diff --git a/.gitignore b/.gitignore index 5917aa55..3f2aad38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.iml .gradle /local.properties +/.idea /.idea/caches /.idea/libraries /.idea/modules.xml diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index 4213d851..00000000 --- a/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 95b17952..5fd33a48 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -7,13 +7,13 @@ - + diff --git a/Boat/build.gradle b/Boat/build.gradle index bd88f4ec..76eedf46 100644 --- a/Boat/build.gradle +++ b/Boat/build.gradle @@ -3,11 +3,11 @@ plugins { } android { - compileSdk 32 + compileSdk 34 defaultConfig { minSdk 26 - targetSdk 32 + targetSdk 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -32,10 +32,10 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.google.code.gson:gson:2.8.9' - implementation 'androidx.appcompat:appcompat:1.5.0' - implementation 'com.google.android.material:material:1.6.1' + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.11.0' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } \ No newline at end of file diff --git a/FilePicker/build.gradle b/FilePicker/build.gradle index 73a0adc9..c7b3332d 100644 --- a/FilePicker/build.gradle +++ b/FilePicker/build.gradle @@ -3,11 +3,11 @@ plugins { } android { - compileSdk 32 + compileSdk 34 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -26,13 +26,13 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.5.0' - implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.11.0' implementation 'com.beardedhen:androidbootstrap:2.3.1' implementation 'com.roughike:bottom-bar:2.3.1' implementation 'com.simplecityapps:recyclerview-fastscroll:1.0.20' implementation files('libs/commons-io-2.11.0.jar') testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } \ No newline at end of file diff --git a/HMCLPE/build.gradle b/HMCLPE/build.gradle index 25ee31b0..3375edd6 100644 --- a/HMCLPE/build.gradle +++ b/HMCLPE/build.gradle @@ -3,7 +3,7 @@ plugins { } android { - compileSdk 32 + compileSdk 34 dexOptions { javaMaxHeapSize "4g" } @@ -30,7 +30,7 @@ android { defaultConfig { applicationId "com.tungsten.hmclpe" minSdk 26 - targetSdk 32 + targetSdk 34 versionCode 12 versionName "1.0.0" @@ -69,28 +69,27 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(path: ':FilePicker') implementation project(path: ':ZipTools') - implementation project(path: ':Hin2n') implementation project(path: ':Boat') implementation project(path: ':PojavLauncher') - implementation 'androidx.appcompat:appcompat:1.5.0' + implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.github.naman14:app-theme-engine:0.5.2@aar' - implementation 'com.google.android.material:material:1.6.1' + implementation 'com.google.android.material:material:1.11.0' implementation 'com.squareup.okhttp3:okhttp:4.9.3' implementation 'org.nanohttpd:nanohttpd:2.3.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'cat.ereza:customactivityoncrash:2.3.0' - implementation 'com.google.code.gson:gson:2.8.9' + implementation 'com.google.code.gson:gson:2.10.1' implementation 'com.moandjiezana.toml:toml4j:0.7.2' implementation 'org.apache.commons:commons-compress:1.21' - implementation 'com.github.steveice10:opennbt:1.4' + implementation 'com.github.steveice10:opennbt:1.5' implementation 'com.jaredrummler:colorpicker:1.1.0' - implementation 'com.jaredrummler:android-device-names:2.0.0' + implementation 'com.jaredrummler:android-device-names:2.1.0' implementation 'org.jsoup:jsoup:1.14.3' - implementation 'org.apache.commons:commons-lang3:3.12.0' + implementation 'org.apache.commons:commons-lang3:3.13.0' implementation 'org.jenkins-ci:constant-pool-scanner:1.2' implementation 'com.github.gzu-liyujiang:Android_CN_OAID:4.2.4' implementation 'com.github.nedimf:maildroid:v0.1.0-release' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/control/MenuHelper.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/control/MenuHelper.java index 3516c7d4..73f6be2c 100644 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/control/MenuHelper.java +++ b/HMCLPE/src/main/java/com/tungsten/hmclpe/control/MenuHelper.java @@ -1,11 +1,8 @@ package com.tungsten.hmclpe.control; -import static android.app.Activity.RESULT_OK; - import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; -import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -30,23 +27,18 @@ import com.tungsten.hmclpe.launcher.dialogs.control.AddViewDialog; import com.tungsten.hmclpe.launcher.dialogs.control.ChildManagerDialog; import com.tungsten.hmclpe.launcher.dialogs.control.EditControlPatternDialog; -import com.tungsten.hmclpe.launcher.dialogs.hin2n.Hin2nMenuDialog; -import com.tungsten.hmclpe.launcher.dialogs.hin2n.JoinCommunityDialog; import com.tungsten.hmclpe.launcher.list.local.controller.ChildLayout; import com.tungsten.hmclpe.launcher.list.local.controller.ControlPattern; import com.tungsten.hmclpe.manifest.AppManifest; import com.tungsten.hmclpe.launcher.setting.InitializeSetting; import com.tungsten.hmclpe.launcher.setting.SettingUtils; import com.tungsten.hmclpe.launcher.setting.game.GameMenuSetting; -import com.tungsten.hmclpe.multiplayer.Hin2nService; import com.tungsten.hmclpe.utils.file.AssetsUtils; import com.tungsten.hmclpe.utils.file.FileStringUtils; import com.tungsten.hmclpe.utils.file.FileUtils; import java.util.ArrayList; -import wang.switchy.hin2n.model.N2NSettingInfo; - public class MenuHelper implements CompoundButton.OnCheckedChangeListener, View.OnClickListener, AdapterView.OnItemSelectedListener, SeekBar.OnSeekBarChangeListener { public Context context; @@ -360,30 +352,7 @@ public void refreshChildSpinner(){ } public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == Hin2nService.VPN_REQUEST_CODE_CREATE && resultCode == RESULT_OK) { - Intent intent = new Intent(context, Hin2nService.class); - Bundle bundle = new Bundle(); - N2NSettingInfo n2NSettingInfo = new N2NSettingInfo(Hin2nService.getCreatorModel()); - bundle.putParcelable("n2nSettingInfo", n2NSettingInfo); - intent.putExtra("Setting", bundle); - activity.startService(intent); - } - if (requestCode == Hin2nService.VPN_REQUEST_CODE_JOIN && resultCode == RESULT_OK) { - Intent intent = new Intent(context, Hin2nService.class); - Bundle bundle = new Bundle(); - new Thread(() -> { - N2NSettingInfo n2NSettingInfo = new N2NSettingInfo(Hin2nService.getPlayerModel()); - activity.runOnUiThread(() -> { - bundle.putParcelable("n2nSettingInfo", n2NSettingInfo); - intent.putExtra("Setting", bundle); - activity.startService(intent); - JoinCommunityDialog.getInstance().progressBar.setVisibility(View.GONE); - JoinCommunityDialog.getInstance().positive.setVisibility(View.VISIBLE); - JoinCommunityDialog.getInstance().negative.setEnabled(true); - JoinCommunityDialog.getInstance().dismiss(); - }); - }).start(); - } + } @Override @@ -480,10 +449,7 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) { @Override public void onClick(View view) { if (view == openHin2nMenu) { - if (launcher != 0) { - Hin2nMenuDialog dialog = new Hin2nMenuDialog(context, this); - dialog.show(); - } + } if (view == forceExit) { AlertDialog.Builder builder = new AlertDialog.Builder(context); diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/HMCLPEApplication.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/HMCLPEApplication.java index ab047f04..00653271 100644 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/HMCLPEApplication.java +++ b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/HMCLPEApplication.java @@ -2,12 +2,8 @@ import android.app.Application; import android.content.Context; -import android.content.res.Configuration; import com.github.gzuliyujiang.oaid.DeviceIdentifier; -import com.tungsten.hmclpe.utils.LocaleUtils; - -import wang.switchy.hin2n.Hin2n; public class HMCLPEApplication extends Application { @@ -18,7 +14,6 @@ public void onCreate() { super.onCreate(); DeviceIdentifier.register(this); context = this.getApplicationContext(); - Hin2n.getInstance().setup(context); } public static Context getContext(){ diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/CreateCommunityDialog.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/CreateCommunityDialog.java deleted file mode 100644 index e0f722f3..00000000 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/CreateCommunityDialog.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.tungsten.hmclpe.launcher.dialogs.hin2n; - -import static android.app.Activity.RESULT_OK; - -import android.annotation.SuppressLint; -import android.app.Dialog; -import android.content.Context; -import android.content.Intent; -import android.net.VpnService; -import android.os.Handler; -import android.view.View; -import android.widget.Button; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.annotation.NonNull; - -import com.tungsten.hmclpe.R; -import com.tungsten.hmclpe.control.MenuHelper; -import com.tungsten.hmclpe.launcher.uis.universal.multiplayer.MultiPlayerUI; -import com.tungsten.hmclpe.multiplayer.Hin2nService; -import com.tungsten.hmclpe.multiplayer.LocalServerDetector; - -import wang.switchy.hin2n.model.EdgeStatus; - -public class CreateCommunityDialog extends Dialog implements View.OnClickListener { - - public static CreateCommunityDialog INSTANCE; - - private final MenuHelper menuHelper; - private final MultiPlayerUI multiPlayerUI; - private ProgressBar progressBar; - - private TextView nameText; - private TextView portText; - private TextView errorText; - private Button positive; - private Button negative; - - private LocalServerDetector lanServerDetectorThread; - - public CreateCommunityDialog(@NonNull Context context, MenuHelper menuHelper, MultiPlayerUI multiPlayerUI) { - super(context); - INSTANCE = this; - this.menuHelper = menuHelper; - this.multiPlayerUI = multiPlayerUI; - setContentView(R.layout.dialog_create_community); - setCancelable(false); - init(); - } - - public static CreateCommunityDialog getInstance() { - return INSTANCE; - } - - @SuppressLint("SetTextI18n") - private void init() { - progressBar = findViewById(R.id.progress); - - nameText = findViewById(R.id.name); - portText = findViewById(R.id.port); - errorText = findViewById(R.id.error); - - positive = findViewById(R.id.create); - negative = findViewById(R.id.exit); - - positive.setOnClickListener(this); - negative.setOnClickListener(this); - - progressBar.setVisibility(View.VISIBLE); - nameText.setText(getContext().getString(R.string.dialog_create_community_getting)); - portText.setText(getContext().getString(R.string.dialog_create_community_getting)); - errorText.setVisibility(View.GONE); - positive.setEnabled(false); - - Handler handler = new Handler(); - lanServerDetectorThread = new LocalServerDetector(3); - lanServerDetectorThread.onDetectedLanServer().register(event -> { - handler.post(() -> { - if (event.getLanServer() != null && event.getLanServer().isValid()) { - nameText.setText(event.getLanServer().getMotd()); - portText.setText(event.getLanServer().getAd().toString()); - positive.setEnabled(true); - } else { - nameText.setText(""); - portText.setText(""); - errorText.setVisibility(View.VISIBLE); - positive.setEnabled(false); - } - progressBar.setVisibility(View.GONE); - }); - }); - lanServerDetectorThread.start(); - } - - @Override - public void onClick(View view) { - if (view == positive) { - Hin2nService.IP_PORT = "1.1.1.1:" + portText.getText().toString(); - EdgeStatus.RunningStatus status = Hin2nService.INSTANCE == null ? EdgeStatus.RunningStatus.DISCONNECT : Hin2nService.INSTANCE.getCurrentStatus(); - if (Hin2nService.INSTANCE != null && status != EdgeStatus.RunningStatus.DISCONNECT && status != EdgeStatus.RunningStatus.FAILED) { - Hin2nService.INSTANCE.stop(null); - } - Intent vpnPrepareIntent = menuHelper != null ? VpnService.prepare(menuHelper.context) : VpnService.prepare(multiPlayerUI.context); - if (vpnPrepareIntent != null) { - if (menuHelper != null) { - menuHelper.activity.startActivityForResult(vpnPrepareIntent, Hin2nService.VPN_REQUEST_CODE_CREATE); - } - else { - multiPlayerUI.activity.startActivityForResult(vpnPrepareIntent, Hin2nService.VPN_REQUEST_CODE_CREATE); - } - } else { - if (menuHelper != null) { - menuHelper.onActivityResult(Hin2nService.VPN_REQUEST_CODE_CREATE, RESULT_OK, null); - } - else { - multiPlayerUI.onActivityResult(Hin2nService.VPN_REQUEST_CODE_CREATE, RESULT_OK, null); - } - } - dismiss(); - } - if (view == negative) { - lanServerDetectorThread.interrupt(); - dismiss(); - } - } -} diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/Hin2nInfoDialog.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/Hin2nInfoDialog.java deleted file mode 100644 index 4c67a341..00000000 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/Hin2nInfoDialog.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.tungsten.hmclpe.launcher.dialogs.hin2n; - -import static android.content.Context.CLIPBOARD_SERVICE; - -import android.app.Dialog; -import android.content.ClipData; -import android.content.ClipboardManager; -import android.content.Context; -import android.content.Intent; -import android.view.View; -import android.widget.Button; -import android.widget.ImageButton; -import android.widget.LinearLayout; -import android.widget.TextView; -import android.widget.Toast; - -import androidx.annotation.NonNull; - -import com.tungsten.hmclpe.R; -import com.tungsten.hmclpe.multiplayer.Hin2nService; -import com.tungsten.hmclpe.multiplayer.ServerType; - -public class Hin2nInfoDialog extends Dialog implements View.OnClickListener { - - private String inviteCode; - private String ipPort; - - private LinearLayout layout; - private TextView inviteCodeText; - private TextView ipPortText; - private ImageButton copyInviteCode; - private ImageButton copyIpPort; - - private Button exit; - private Button positive; - - public Hin2nInfoDialog(@NonNull Context context) { - super(context); - setContentView(R.layout.dialog_hin2n_community); - setCancelable(false); - init(); - } - - private void init() { - inviteCode = Hin2nService.COMMUNITY_CODE; - ipPort = Hin2nService.IP_PORT; - - layout = findViewById(R.id.ip_port_layout); - inviteCodeText = findViewById(R.id.invite_code); - ipPortText = findViewById(R.id.ip_port); - copyInviteCode = findViewById(R.id.copy_invite_code); - copyIpPort = findViewById(R.id.copy_ip_port); - exit = findViewById(R.id.exit); - positive = findViewById(R.id.positive); - - copyInviteCode.setOnClickListener(this); - copyIpPort.setOnClickListener(this); - exit.setOnClickListener(this); - positive.setOnClickListener(this); - - inviteCodeText.setText(inviteCode); - if (Hin2nService.SERVER_TYPE == ServerType.SERVER) { - layout.setVisibility(View.VISIBLE); - ipPortText.setText(ipPort); - } - else { - layout.setVisibility(View.GONE); - } - } - - @Override - public void onClick(View view) { - if (view == copyInviteCode) { - ClipboardManager clip = (ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE); - ClipData data = ClipData.newPlainText(null, inviteCode); - clip.setPrimaryClip(data); - Toast.makeText(getContext(), getContext().getString(R.string.dialog_community_copy_success), Toast.LENGTH_SHORT).show(); - } - if (view == copyIpPort) { - ClipboardManager clip = (ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE); - ClipData data = ClipData.newPlainText(null, ipPort); - clip.setPrimaryClip(data); - Toast.makeText(getContext(), getContext().getString(R.string.dialog_community_copy_success), Toast.LENGTH_SHORT).show(); - } - if (view == exit) { - Hin2nService.INSTANCE.stop(null); - dismiss(); - } - if (view == positive) { - dismiss(); - } - } -} diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/Hin2nMenuDialog.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/Hin2nMenuDialog.java deleted file mode 100644 index 9a8cbb6e..00000000 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/Hin2nMenuDialog.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.tungsten.hmclpe.launcher.dialogs.hin2n; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.content.Context; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.view.View; -import android.widget.LinearLayout; -import android.widget.Toast; - -import androidx.annotation.NonNull; - -import com.tungsten.hmclpe.R; -import com.tungsten.hmclpe.control.MenuHelper; -import com.tungsten.hmclpe.multiplayer.Hin2nService; - -import wang.switchy.hin2n.model.EdgeStatus; - -public class Hin2nMenuDialog extends Dialog implements View.OnClickListener { - - private final MenuHelper menuHelper; - - private LinearLayout create; - private LinearLayout join; - private LinearLayout info; - private LinearLayout help; - - public Hin2nMenuDialog(@NonNull Context context, MenuHelper menuHelper) { - super(context); - this.menuHelper = menuHelper; - setContentView(R.layout.dialog_hin2n_menu); - getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); - - create = findViewById(R.id.create); - join = findViewById(R.id.join); - info = findViewById(R.id.info); - help = findViewById(R.id.help); - - create.setOnClickListener(this); - join.setOnClickListener(this); - info.setOnClickListener(this); - help.setOnClickListener(this); - } - - @Override - public void onClick(View view) { - EdgeStatus.RunningStatus status = Hin2nService.INSTANCE == null ? EdgeStatus.RunningStatus.DISCONNECT : Hin2nService.INSTANCE.getCurrentStatus(); - boolean isCreated = Hin2nService.INSTANCE != null && status != EdgeStatus.RunningStatus.DISCONNECT && status != EdgeStatus.RunningStatus.FAILED; - if (view == create) { - if (!isCreated) { - CreateCommunityDialog dialog = new CreateCommunityDialog(getContext(), menuHelper, null); - dialog.show(); - dismiss(); - } - else { - Toast.makeText(getContext(), getContext().getString(R.string.dialog_hin2n_menu_in), Toast.LENGTH_SHORT).show(); - } - } - if (view == join) { - if (!isCreated) { - JoinCommunityDialog dialog = new JoinCommunityDialog(getContext(), menuHelper, null); - dialog.show(); - dismiss(); - } - else { - Toast.makeText(getContext(), getContext().getString(R.string.dialog_hin2n_menu_in), Toast.LENGTH_SHORT).show(); - } - } - if (view == info) { - if (!isCreated) { - Toast.makeText(getContext(), getContext().getString(R.string.dialog_hin2n_menu_out), Toast.LENGTH_SHORT).show(); - } - else { - Hin2nInfoDialog dialog = new Hin2nInfoDialog(getContext()); - dialog.show(); - dismiss(); - } - } - if (view == help) { - AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); - builder.setTitle(getContext().getString(R.string.dialog_hin2n_help_title)); - builder.setMessage(getContext().getString(R.string.dialog_hin2n_help_text)); - builder.setPositiveButton(getContext().getString(R.string.dialog_hin2n_help_positive), null); - builder.create().show(); - dismiss(); - } - } -} diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/JoinCommunityDialog.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/JoinCommunityDialog.java deleted file mode 100644 index 510f4292..00000000 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/dialogs/hin2n/JoinCommunityDialog.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.tungsten.hmclpe.launcher.dialogs.hin2n; - -import static android.app.Activity.RESULT_OK; - -import android.app.Dialog; -import android.content.Context; -import android.content.Intent; -import android.net.VpnService; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; -import android.widget.ProgressBar; -import android.widget.Toast; - -import androidx.annotation.NonNull; - -import com.tungsten.hmclpe.R; -import com.tungsten.hmclpe.control.MenuHelper; -import com.tungsten.hmclpe.launcher.uis.universal.multiplayer.MultiPlayerUI; -import com.tungsten.hmclpe.multiplayer.Hin2nService; -import com.tungsten.hmclpe.utils.string.StringUtils; - -import wang.switchy.hin2n.model.EdgeStatus; - -public class JoinCommunityDialog extends Dialog implements View.OnClickListener { - - public static JoinCommunityDialog INSTANCE; - - private final MenuHelper menuHelper; - private final MultiPlayerUI multiPlayerUI; - - private EditText editText; - public Button positive; - public Button negative; - - public ProgressBar progressBar; - - public JoinCommunityDialog(@NonNull Context context, MenuHelper menuHelper, MultiPlayerUI multiPlayerUI) { - super(context); - INSTANCE = this; - this.menuHelper = menuHelper; - this.multiPlayerUI = multiPlayerUI; - setContentView(R.layout.dialog_join_community); - setCancelable(false); - init(); - } - - public static JoinCommunityDialog getInstance() { - return INSTANCE; - } - - private void init() { - editText = findViewById(R.id.invite_code); - positive = findViewById(R.id.join); - negative = findViewById(R.id.exit); - progressBar = findViewById(R.id.progress); - - positive.setOnClickListener(this); - negative.setOnClickListener(this); - } - - @Override - public void onClick(View view) { - if (view == positive) { - if (StringUtils.isNotBlank(editText.getText().toString())) { - progressBar.setVisibility(View.VISIBLE); - positive.setVisibility(View.GONE); - negative.setEnabled(false); - Hin2nService.COMMUNITY_CODE = editText.getText().toString(); - EdgeStatus.RunningStatus status = Hin2nService.INSTANCE == null ? EdgeStatus.RunningStatus.DISCONNECT : Hin2nService.INSTANCE.getCurrentStatus(); - if (Hin2nService.INSTANCE != null && status != EdgeStatus.RunningStatus.DISCONNECT && status != EdgeStatus.RunningStatus.FAILED) { - System.out.println("stop"); - Hin2nService.INSTANCE.stop(null); - } - Intent vpnPrepareIntent = menuHelper != null ? VpnService.prepare(menuHelper.context) : VpnService.prepare(multiPlayerUI.context); - if (vpnPrepareIntent != null) { - if (menuHelper != null) { - menuHelper.activity.startActivityForResult(vpnPrepareIntent, Hin2nService.VPN_REQUEST_CODE_JOIN); - } - else { - multiPlayerUI.activity.startActivityForResult(vpnPrepareIntent, Hin2nService.VPN_REQUEST_CODE_JOIN); - } - } else { - if (menuHelper != null) { - menuHelper.onActivityResult(Hin2nService.VPN_REQUEST_CODE_JOIN, RESULT_OK, null); - } - else { - multiPlayerUI.onActivityResult(Hin2nService.VPN_REQUEST_CODE_JOIN, RESULT_OK, null); - } - } - } - else { - Toast.makeText(getContext(), getContext().getString(R.string.dialog_join_community_code_empty), Toast.LENGTH_SHORT).show(); - } - } - if (view == negative) { - dismiss(); - } - } -} diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/main/MainUI.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/main/MainUI.java index 46f1b81e..dd8342bd 100644 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/main/MainUI.java +++ b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/main/MainUI.java @@ -240,7 +240,7 @@ public void onClick(View v) { activity.uiManager.switchMainUI(activity.uiManager.downloadUI); } if (v == startMultiPlayerUI){ - activity.uiManager.switchMainUI(activity.uiManager.multiPlayerUI); + } if (v == startSettingUI){ activity.uiManager.switchMainUI(activity.uiManager.settingUI); diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/tools/UIManager.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/tools/UIManager.java index 2411c808..6a2f1edc 100644 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/tools/UIManager.java +++ b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/tools/UIManager.java @@ -26,7 +26,6 @@ import com.tungsten.hmclpe.launcher.uis.game.version.universal.ExportPackageTypeUI; import com.tungsten.hmclpe.launcher.uis.game.version.universal.InstallPackageUI; import com.tungsten.hmclpe.launcher.uis.main.MainUI; -import com.tungsten.hmclpe.launcher.uis.universal.multiplayer.MultiPlayerUI; import com.tungsten.hmclpe.launcher.uis.universal.setting.SettingUI; import java.util.ArrayList; @@ -38,7 +37,6 @@ public class UIManager { public GameManagerUI gameManagerUI; public VersionListUI versionListUI; public DownloadUI downloadUI; - public MultiPlayerUI multiPlayerUI; public SettingUI settingUI; public ModUpdateUI modUpdateUI; @@ -69,7 +67,6 @@ public UIManager (Context context, MainActivity activity){ gameManagerUI = new GameManagerUI(context, activity); versionListUI = new VersionListUI(context, activity); downloadUI = new DownloadUI(context, activity); - multiPlayerUI = new MultiPlayerUI(context, activity); settingUI = new SettingUI(context, activity); modUpdateUI = new ModUpdateUI(context, activity); @@ -95,7 +92,6 @@ public UIManager (Context context, MainActivity activity){ gameManagerUI.onCreate(); versionListUI.onCreate(); downloadUI.onCreate(); - multiPlayerUI.onCreate(); settingUI.onCreate(); modUpdateUI.onCreate(); @@ -130,7 +126,6 @@ public UIManager (Context context, MainActivity activity){ gameManagerUI, versionListUI, downloadUI, - multiPlayerUI, settingUI, installGameUI, downloadForgeUI, diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/universal/multiplayer/MultiPlayerUI.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/universal/multiplayer/MultiPlayerUI.java deleted file mode 100644 index cc2c31aa..00000000 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/launcher/uis/universal/multiplayer/MultiPlayerUI.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.tungsten.hmclpe.launcher.uis.universal.multiplayer; - -import static android.app.Activity.RESULT_OK; - -import android.app.AlertDialog; -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.view.View; -import android.widget.LinearLayout; -import android.widget.Toast; - -import com.tungsten.hmclpe.R; -import com.tungsten.hmclpe.launcher.MainActivity; -import com.tungsten.hmclpe.launcher.dialogs.hin2n.CreateCommunityDialog; -import com.tungsten.hmclpe.launcher.dialogs.hin2n.JoinCommunityDialog; -import com.tungsten.hmclpe.launcher.launch.check.LaunchTools; -import com.tungsten.hmclpe.launcher.uis.tools.BaseUI; -import com.tungsten.hmclpe.manifest.AppManifest; -import com.tungsten.hmclpe.multiplayer.Hin2nService; -import com.tungsten.hmclpe.utils.animation.CustomAnimationUtils; -import com.tungsten.hmclpe.utils.gson.GsonUtils; - -import java.io.File; - -import wang.switchy.hin2n.model.EdgeStatus; -import wang.switchy.hin2n.model.N2NSettingInfo; - -public class MultiPlayerUI extends BaseUI implements View.OnClickListener { - - public LinearLayout multiPlayerUI; - - private LinearLayout launch; - private LinearLayout create; - private LinearLayout join; - private LinearLayout help; - private LinearLayout feedback; - - public MultiPlayerUI(Context context, MainActivity activity) { - super(context, activity); - } - - @Override - public void onCreate() { - super.onCreate(); - multiPlayerUI = activity.findViewById(R.id.ui_multi_player); - - launch = activity.findViewById(R.id.launch_game_from_multiplayer); - create = activity.findViewById(R.id.create_multiplayer_community); - join = activity.findViewById(R.id.join_multiplayer_community); - help = activity.findViewById(R.id.multiplayer_help); - feedback = activity.findViewById(R.id.multiplayer_feedback); - - launch.setOnClickListener(this); - create.setOnClickListener(this); - join.setOnClickListener(this); - help.setOnClickListener(this); - feedback.setOnClickListener(this); - } - - @Override - public void onStart() { - super.onStart(); - activity.showBarTitle(context.getResources().getString(R.string.multi_player_ui_title),activity.uiManager.uis.get(activity.uiManager.uis.size() - 2) != activity.uiManager.mainUI,false); - CustomAnimationUtils.showViewFromLeft(multiPlayerUI,activity,context,true); - } - - @Override - public void onStop() { - super.onStop(); - CustomAnimationUtils.hideViewToLeft(multiPlayerUI,activity,context,true); - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == Hin2nService.VPN_REQUEST_CODE_CREATE && resultCode == RESULT_OK) { - Intent intent = new Intent(context, Hin2nService.class); - Bundle bundle = new Bundle(); - N2NSettingInfo n2NSettingInfo = new N2NSettingInfo(Hin2nService.getCreatorModel()); - bundle.putParcelable("n2nSettingInfo", n2NSettingInfo); - intent.putExtra("Setting", bundle); - activity.startService(intent); - } - if (requestCode == Hin2nService.VPN_REQUEST_CODE_JOIN && resultCode == RESULT_OK) { - Intent intent = new Intent(context, Hin2nService.class); - Bundle bundle = new Bundle(); - new Thread(() -> { - N2NSettingInfo n2NSettingInfo = new N2NSettingInfo(Hin2nService.getPlayerModel()); - activity.runOnUiThread(() -> { - bundle.putParcelable("n2nSettingInfo", n2NSettingInfo); - intent.putExtra("Setting", bundle); - activity.startService(intent); - JoinCommunityDialog.getInstance().progressBar.setVisibility(View.GONE); - JoinCommunityDialog.getInstance().positive.setVisibility(View.VISIBLE); - JoinCommunityDialog.getInstance().negative.setEnabled(true); - JoinCommunityDialog.getInstance().dismiss(); - }); - }).start(); - } - } - - @Override - public void onClick(View view) { - EdgeStatus.RunningStatus status = Hin2nService.INSTANCE == null ? EdgeStatus.RunningStatus.DISCONNECT : Hin2nService.INSTANCE.getCurrentStatus(); - boolean isCreated = Hin2nService.INSTANCE != null && status != EdgeStatus.RunningStatus.DISCONNECT && status != EdgeStatus.RunningStatus.FAILED; - if (view == launch) { - String settingPath = activity.publicGameSetting.currentVersion + "/hmclpe.cfg"; - String finalPath; - if (new File(settingPath).exists() && GsonUtils.getPrivateGameSettingFromFile(settingPath) != null && (GsonUtils.getPrivateGameSettingFromFile(settingPath).forceEnable || GsonUtils.getPrivateGameSettingFromFile(settingPath).enable)) { - finalPath = settingPath; - } - else { - finalPath = AppManifest.SETTING_DIR + "/private_game_setting.json"; - } - Bundle bundle = new Bundle(); - bundle.putString("setting_path",finalPath); - bundle.putBoolean("test",false); - LaunchTools.launch(context, activity, activity.publicGameSetting.currentVersion, bundle); - } - if (view == create) { - if (!isCreated) { - CreateCommunityDialog dialog = new CreateCommunityDialog(context, null, this); - dialog.show(); - } - else { - Toast.makeText(context, context.getString(R.string.dialog_hin2n_menu_in), Toast.LENGTH_SHORT).show(); - } - } - if (view == join) { - if (!isCreated) { - JoinCommunityDialog dialog = new JoinCommunityDialog(context, null, this); - dialog.show(); - } - else { - Toast.makeText(context, context.getString(R.string.dialog_hin2n_menu_in), Toast.LENGTH_SHORT).show(); - } - } - if (view == help) { - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(context.getString(R.string.dialog_hin2n_help_title)); - builder.setMessage(context.getString(R.string.dialog_hin2n_help_text)); - builder.setPositiveButton(context.getString(R.string.dialog_hin2n_help_positive), null); - builder.create().show(); - } - if (view == feedback) { - Uri uri = Uri.parse("https://github.com/Tungstend/HMCL-PE/issues"); - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - context.startActivity(intent); - } - } -} diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/multiplayer/Hin2nService.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/multiplayer/Hin2nService.java deleted file mode 100644 index 2a339ce9..00000000 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/multiplayer/Hin2nService.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.tungsten.hmclpe.multiplayer; - -import com.tungsten.hmclpe.utils.DigestUtils; -import com.tungsten.hmclpe.utils.io.NetworkUtils; - -import java.io.IOException; -import java.util.Random; - -import wang.switchy.hin2n.service.N2NService; -import wang.switchy.hin2n.storage.db.base.model.N2NSettingModel; - -public class Hin2nService extends N2NService { - - public static final int VPN_REQUEST_CODE_CREATE = 10000; - public static final int VPN_REQUEST_CODE_JOIN = 10001; - - public static final String IP_VERIFICATION_URL = "http://101.43.66.4:8080/IPVerification/ipverification?room="; - - public static ServerType SERVER_TYPE; - - public static String COMMUNITY_CODE; - public static String IP_PORT; - - public static N2NSettingModel getCreatorModel() { - SERVER_TYPE = ServerType.SERVER; - COMMUNITY_CODE = DigestUtils.encryptToMD5(Long.toString(System.currentTimeMillis())).substring(DigestUtils.encryptToMD5(Long.toString(System.currentTimeMillis())).length() - 10); - return new N2NSettingModel(1L, - 1, - "HMCL-PE-Local-Server-Setting", - 0, - "1.1.1.1", - "255.255.255.0", - COMMUNITY_CODE, - "HMCL-PE-Password", - "", - "hin2n.wang:10086", - true, - "", - getRandomMacAddress(), - 1386, - "", - 20, - false, - 0, - false, - true, - false, - 4, - true, - "", - "", - "Twofish", - false); - } - - public static N2NSettingModel getPlayerModel() { - SERVER_TYPE = ServerType.CLIENT; - String response = randomNumber() + ""; - try { - response = NetworkUtils.doGet(NetworkUtils.toURL(IP_VERIFICATION_URL + COMMUNITY_CODE)); - } catch (IOException e) { - e.printStackTrace(); - } - return new N2NSettingModel(1L, - 1, - "HMCL-PE-Local-Server-Setting", - 0, - "1.1.1." + response, - "255.255.255.0", - COMMUNITY_CODE, - "HMCL-PE-Password", - "", - "hin2n.wang:10086", - true, - "", - getRandomMacAddress(), - 1386, - "", - 20, - false, - 0, - false, - true, - false, - 4, - true, - "", - "", - "Twofish", - false); - } - - private static int randomNumber() { - Random random = new Random(); - return random.nextInt(253) + 2; - } - - public static String getRandomMacAddress() { - Random random = new Random(); - String[] mac = { - String.format("%02x", 0x52), - String.format("%02x", 0x54), - String.format("%02x", 0x00), - String.format("%02x", random.nextInt(0xff)), - String.format("%02x", random.nextInt(0xff)), - String.format("%02x", random.nextInt(0xff)) - }; - return String.join(":", mac); - } - -} diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/multiplayer/LocalServerDetector.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/multiplayer/LocalServerDetector.java deleted file mode 100644 index 4e880f9f..00000000 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/multiplayer/LocalServerDetector.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.tungsten.hmclpe.multiplayer; - -import static com.tungsten.hmclpe.utils.Logging.LOG; - -import com.tungsten.hmclpe.event.Event; -import com.tungsten.hmclpe.event.EventManager; -import com.tungsten.hmclpe.utils.Lang; -import com.tungsten.hmclpe.utils.string.StringUtils; - -import java.io.IOException; -import java.net.DatagramPacket; -import java.net.InetAddress; -import java.net.MulticastSocket; -import java.net.SocketTimeoutException; -import java.nio.charset.StandardCharsets; - -public class LocalServerDetector extends Thread { - - private final EventManager onDetectedLanServer = new EventManager<>(); - private final int retry; - - public LocalServerDetector(int retry) { - this.retry = retry; - - setName("LocalServerDetector"); - setDaemon(true); - } - - public EventManager onDetectedLanServer() { - return onDetectedLanServer; - } - - @Override - public void run() { - MulticastSocket socket; - InetAddress broadcastAddress; - try { - socket = new MulticastSocket(4445); - socket.setSoTimeout(5000); - socket.joinGroup(broadcastAddress = InetAddress.getByName("224.0.2.60")); - } catch (IOException e) { - e.printStackTrace(); - return; - } - - byte[] buf = new byte[1024]; - - int tried = 0; - while (!isInterrupted()) { - DatagramPacket packet = new DatagramPacket(buf, 1024); - - try { - socket.receive(packet); - } catch (SocketTimeoutException e) { - if (tried++ > retry) { - onDetectedLanServer.fireEvent(new DetectedLanServerEvent(this, null)); - break; - } - - continue; - } catch (IOException e) { - e.printStackTrace(); - break; - } - - String response = new String(packet.getData(), packet.getOffset(), packet.getLength(), StandardCharsets.UTF_8); - LOG.fine("Local server " + packet.getAddress() + ":" + packet.getPort() + " broadcast message: " + response); - onDetectedLanServer.fireEvent(new DetectedLanServerEvent(this, PingResponse.parsePingResponse(response))); - break; - } - - try { - socket.leaveGroup(broadcastAddress); - } catch (IOException e) { - e.printStackTrace(); - } - - socket.close(); - } - - public static class DetectedLanServerEvent extends Event { - private final PingResponse lanServer; - - public DetectedLanServerEvent(Object source, PingResponse lanServer) { - super(source); - this.lanServer = lanServer; - } - - public PingResponse getLanServer() { - return lanServer; - } - } - - public static class PingResponse { - private final String motd; - private final Integer ad; - - public PingResponse(String motd, Integer ad) { - this.motd = motd; - this.ad = ad; - } - - public String getMotd() { - return motd; - } - - public Integer getAd() { - return ad; - } - - public boolean isValid() { - return ad != null; - } - - public static PingResponse parsePingResponse(String message) { - return new PingResponse( - StringUtils.substringBefore( - StringUtils.substringAfter(message, "[MOTD]"), - "[/MOTD]"), - Lang.toIntOrNull(StringUtils.substringBefore( - StringUtils.substringAfter(message, "[AD]"), - "[/AD]")) - ); - } - } -} diff --git a/HMCLPE/src/main/java/com/tungsten/hmclpe/multiplayer/ServerType.java b/HMCLPE/src/main/java/com/tungsten/hmclpe/multiplayer/ServerType.java deleted file mode 100644 index 7edd2011..00000000 --- a/HMCLPE/src/main/java/com/tungsten/hmclpe/multiplayer/ServerType.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.tungsten.hmclpe.multiplayer; - -public enum ServerType { - - SERVER, - CLIENT - -} diff --git a/HMCLPE/src/main/res/layout/ui_main.xml b/HMCLPE/src/main/res/layout/ui_main.xml index ebf4bc4d..3fe67d0b 100644 --- a/HMCLPE/src/main/res/layout/ui_main.xml +++ b/HMCLPE/src/main/res/layout/ui_main.xml @@ -248,6 +248,7 @@ android:background="@color/colorPureBlack"/> Hello Minecraft! Launcher : Pocket Edition Hello Minecraft! Launcher Pocket Edition - v1.0.0 - Hello Minecraft! Launcher Pocket Edition v1.0.0 + v2.0.7 + Hello Minecraft! Launcher Pocket Edition v2.0.7 UUID diff --git a/Hin2n/.gitignore b/Hin2n/.gitignore deleted file mode 100644 index 42afabfd..00000000 --- a/Hin2n/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/Hin2n/CMakeLists.txt b/Hin2n/CMakeLists.txt deleted file mode 100644 index c193ab46..00000000 --- a/Hin2n/CMakeLists.txt +++ /dev/null @@ -1,153 +0,0 @@ -project(Hin2n) -cmake_minimum_required(VERSION 3.4.1) - -# N2n information -set(N2N_VERSION 2.9.0) -set(N2N_OSNAME ${CMAKE_SYSTEM}) -set(N2N_MODIFY_VERSION v2s_0.1.0) -set(N2N_MODIFY_AUTHOR "switchwang(https://github.com/switch-st) zhangbz(https://github.com/zhangbz)") -add_definitions(-DCMAKE_BUILD) - -INCLUDE(TestBigEndian) -TEST_BIG_ENDIAN(UIP_CONF_BYTE_ORDER) -if(${UIP_CONF_BYTE_ORDER} EQUAL 1) -set(UIP_CONF_BYTE_ORDER UIP_BIG_ENDIAN) -else(${UIP_CONF_BYTE_ORDER} EQUAL 1) -set(UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN) -endif(${UIP_CONF_BYTE_ORDER} EQUAL 1) - -# OpenSSL -SET(OPENSSL_ROOT_DIR src/main/jniLibs/${ANDROID_ABI}) -SET(OPENSSL_LIBRARIES_DIR "${OPENSSL_ROOT_DIR}") -SET(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include) -SET(OPENSSL_LIBRARIES "crypto") -LINK_DIRECTORIES(${OPENSSL_LIBRARIES_DIR}) -OPTION(N2N_OPTION_AES "USE AES" ON) -set(N2N_OPTION_AES ON) - -if(CMAKE_BUILD_TYPE) -if(NOT ${CMAKE_BUILD_TYPE} STREQUAL Debug) -set(CMAKE_BUILD_TYPE Release) -endif(NOT ${CMAKE_BUILD_TYPE} STREQUAL Debug) -else(CMAKE_BUILD_TYPE) -set(CMAKE_BUILD_TYPE Release) -endif(CMAKE_BUILD_TYPE) -add_definitions(-DCMAKE_BUILD) - -add_definitions(-DN2N_VERSION=\"${N2N_VERSION}\" -DN2N_OSNAME=\"${N2N_OSNAME}\" -DN2N_MODIFY_VERSION=\"${N2N_MODIFY_VERSION}\" -DN2N_MODIFY_AUTHOR=\"${N2N_MODIFY_AUTHOR}\" -DUIP_CONF_BYTE_ORDER=\"${UIP_CONF_BYTE_ORDER}\") -add_definitions(-DGIT_RELEASE="" -DPACKAGE_VERSION="${N2N_VERSION}" -DPACKAGE_OSNAME="${CMAKE_SYSTEM}") -include_directories(src/main/cpp src/main/cpp/edge_jni src/main/cpp/slog src/main/cpp/tun2tap src/main/cpp/uip) - -add_library(edge_jni SHARED src/main/cpp/edge_jni/edge_jni.c) -target_link_libraries(edge_jni edge_v3) -target_link_libraries(edge_jni edge_v2s) -target_link_libraries(edge_jni edge_v2) -target_link_libraries(edge_jni edge_v1) -target_link_libraries(edge_jni slog) -target_link_libraries(edge_jni ${OPENSSL_LIBRARIES}) - -add_library(edge_v2s SHARED src/main/cpp/n2n_v2s/edge.c) -target_link_libraries(edge_v2s n2n_v2s) -target_link_libraries(edge_v2s slog) - -# -- ntop n2n -add_library(edge_v2 SHARED - src/main/cpp/n2n_v2/src/n2n.c - src/main/cpp/n2n_v2/src/edge_utils.c - src/main/cpp/n2n_v2/src/wire.c - src/main/cpp/n2n_v2/src/minilzo.c - src/main/cpp/n2n_v2/src/twofish.c - src/main/cpp/n2n_v2/src/speck.c - src/main/cpp/n2n_v2/src/pearson.c - src/main/cpp/n2n_v2/src/header_encryption.c - src/main/cpp/n2n_v2/src/transform_null.c - src/main/cpp/n2n_v2/src/transform_tf.c - src/main/cpp/n2n_v2/src/transform_aes.c - src/main/cpp/n2n_v2/src/transform_speck.c - src/main/cpp/n2n_v2/src/transform_cc20.c - src/main/cpp/n2n_v2/src/random_numbers.c - - src/main/cpp/edge_jni/tuntap_android_v2.c - src/main/cpp/edge_jni/edge_android_v2.c - ) -target_compile_definitions(edge_v2 PUBLIC N2N_HAVE_AES HAVE_OPENSSL_1_1) -target_include_directories(edge_v2 PUBLIC - src/main/cpp/n2n_v2/include - ${OPENSSL_INCLUDE_DIR} - ) -target_link_libraries(edge_v2 uip) -target_link_libraries(edge_v2 ${OPENSSL_LIBRARIES}) - -add_library(edge_v3 SHARED - src/main/cpp/n2n_v3/src/n2n.c - src/main/cpp/n2n_v3/src/edge_management.c - src/main/cpp/n2n_v3/src/curve25519.c - src/main/cpp/n2n_v3/src/auth.c - src/main/cpp/n2n_v3/src/edge_utils.c - src/main/cpp/n2n_v3/src/wire.c - src/main/cpp/n2n_v3/src/minilzo.c - src/main/cpp/n2n_v3/src/speck.c - src/main/cpp/n2n_v3/src/pearson.c - src/main/cpp/n2n_v3/src/tf.c - src/main/cpp/n2n_v3/src/header_encryption.c - src/main/cpp/n2n_v3/src/transform_null.c - src/main/cpp/n2n_v3/src/transform_tf.c - src/main/cpp/n2n_v3/src/transform_aes.c - src/main/cpp/n2n_v3/src/transform_speck.c - src/main/cpp/n2n_v3/src/transform_cc20.c - src/main/cpp/n2n_v3/src/cc20.c - src/main/cpp/n2n_v3/src/aes.c - src/main/cpp/n2n_v3/src/network_traffic_filter.c - src/main/cpp/n2n_v3/src/sn_selection.c - src/main/cpp/n2n_v3/src/random_numbers.c - src/main/cpp/edge_jni/tuntap_android_v2.c - src/main/cpp/edge_jni/edge_android_v2.c - ) -target_compile_definitions(edge_v3 PUBLIC N2N_HAVE_AES HAVE_OPENSSL_1_1) -target_compile_options(edge_v3 PRIVATE -DN2N_V3) -target_include_directories(edge_v3 PUBLIC - src/main/cpp/n2n_v3/include - ${OPENSSL_INCLUDE_DIR} - ) -target_link_libraries(edge_v3 uip) -target_link_libraries(edge_v3 ${OPENSSL_LIBRARIES}) - -add_library(edge_v1 SHARED - src/main/cpp/n2n_v1/edge.c - ) -target_link_libraries(edge_v1 n2n_v1) -target_link_libraries(edge_v1 slog) - -add_library(n2n_v2s SHARED - src/main/cpp/n2n_v2s/n2n.c - src/main/cpp/n2n_v2s/n2n_keyfile.c - src/main/cpp/n2n_v2s/wire.c - src/main/cpp/n2n_v2s/minilzo.c - src/main/cpp/n2n_v2s/twofish.c - src/main/cpp/n2n_v2s/transform_null.c - src/main/cpp/n2n_v2s/transform_tf.c - src/main/cpp/n2n_v2s/transform_aes.c - src/main/cpp/n2n_v2s/android/tuntap_android.c - src/main/cpp/n2n_v2s/version.c - ) -target_link_libraries(n2n_v2s uip) -target_link_libraries(n2n_v2s slog) - -add_library(n2n_v1 SHARED - src/main/cpp/n2n_v1/n2n.c - src/main/cpp/n2n_v1/minilzo.c - src/main/cpp/n2n_v1/twofish.c - src/main/cpp/n2n_v1/android/tuntap_android.c - src/main/cpp/n2n_v1/version.c - ) -target_link_libraries(n2n_v1 uip) -target_link_libraries(n2n_v1 slog) - -add_library(uip SHARED - src/main/cpp/uip/uip.c - src/main/cpp/uip/uip_arp.c - src/main/cpp/tun2tap/tun2tap.c - ) - -add_library(slog SHARED src/main/cpp/slog/slog.c) -target_link_libraries(slog log) diff --git a/Hin2n/build.gradle b/Hin2n/build.gradle deleted file mode 100644 index 6a46baae..00000000 --- a/Hin2n/build.gradle +++ /dev/null @@ -1,47 +0,0 @@ -plugins { - id 'com.android.library' -} - -android { - compileSdk 32 - - defaultConfig { - minSdk 26 - targetSdk 32 - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - externalNativeBuild { - cmake { - cppFlags "" - cFlags "-D__ANDROID_NDK__" - } - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - externalNativeBuild { - cmake { - path "CMakeLists.txt" - } - } -} - -dependencies { - implementation 'org.greenrobot:eventbus:latest.integration' - implementation 'org.greenrobot:greendao:3.2.0' - implementation 'androidx.appcompat:appcompat:1.5.0' - implementation 'com.google.android.material:material:1.6.1' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} \ No newline at end of file diff --git a/Hin2n/consumer-rules.pro b/Hin2n/consumer-rules.pro deleted file mode 100644 index e69de29b..00000000 diff --git a/Hin2n/proguard-rules.pro b/Hin2n/proguard-rules.pro deleted file mode 100644 index 481bb434..00000000 --- a/Hin2n/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/Hin2n/src/androidTest/java/wang/switchy/hin2n/ExampleInstrumentedTest.java b/Hin2n/src/androidTest/java/wang/switchy/hin2n/ExampleInstrumentedTest.java deleted file mode 100644 index 01ad039d..00000000 --- a/Hin2n/src/androidTest/java/wang/switchy/hin2n/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package wang.switchy.hin2n; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - assertEquals("wang.switchy.hin2n.test", appContext.getPackageName()); - } -} \ No newline at end of file diff --git a/Hin2n/src/main/AndroidManifest.xml b/Hin2n/src/main/AndroidManifest.xml deleted file mode 100644 index 1abad640..00000000 --- a/Hin2n/src/main/AndroidManifest.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Hin2n/src/main/cpp/edge_jni/edge_android_v2.c b/Hin2n/src/main/cpp/edge_jni/edge_android_v2.c deleted file mode 100644 index d052b4a5..00000000 --- a/Hin2n/src/main/cpp/edge_jni/edge_android_v2.c +++ /dev/null @@ -1,1124 +0,0 @@ -/** - * (C) 2007-18 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#include -#include -#include - -#define N2N_NETMASK_STR_SIZE 16 /* dotted decimal 12 numbers + 3 dots */ -#define N2N_MACNAMSIZ 18 /* AA:BB:CC:DD:EE:FF + NULL*/ -#define N2N_IF_MODE_SIZE 16 /* static | dhcp */ -#define ARP_PERIOD_INTERVAL 10 /* sec */ - -/* Shared status. Must call pthread_mutex_lock before use. */ -n2n_edge_status_t *g_status; - -#ifndef N2N_V3 -static n2n_mac_t broadcast_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -static n2n_mac_t null_mac = {0, 0, 0, 0, 0, 0}; -#endif - -/* ***************************************************** */ - -/* Private status. Can be accessed without lock. */ -typedef struct { - uint32_t gateway_ip; - n2n_mac_t gateway_mac; - n2n_edge_conf_t *conf; - uint8_t tap_mac[6]; - uint32_t tap_ipaddr; - time_t lastArpPeriod; -} n2n_android_t; - -/* ***************************************************** */ - -static char arp_packet[] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* Dest mac */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Src mac */ - 0x08, 0x06, /* ARP */ - 0x00, 0x01, /* Ethernet */ - 0x08, 0x00, /* IP */ - 0x06, /* Hw Size */ - 0x04, /* Protocol Size */ - 0x00, 0x01, /* ARP Request */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Src mac */ - 0x00, 0x00, 0x00, 0x00, /* Src IP */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Target mac */ - 0x00, 0x00, 0x00, 0x00 /* Target IP */ -}; - -/* ************************************** */ - -static int build_unicast_arp(char *buffer, size_t buffer_len, - uint32_t target, n2n_android_t *priv) { - if (buffer_len < sizeof(arp_packet)) return (-1); - - memcpy(buffer, arp_packet, sizeof(arp_packet)); - memcpy(&buffer[6], priv->tap_mac, 6); - memcpy(&buffer[22], priv->tap_mac, 6); - memcpy(&buffer[28], &priv->tap_ipaddr, 4); - memcpy(&buffer[32], broadcast_mac, 6); - memcpy(&buffer[38], &target, 4); - return (sizeof(arp_packet)); -} - -/* ***************************************************** */ - -/** Find the address and IP mode for the tuntap device. - * - * s is one of these forms: - * - * := | A.B.C.D - * - * | static: | dhcp: - * - * If the mode is present (colon required) then fill ip_mode with that value - * otherwise do not change ip_mode. Fill ip_mode with everything after the - * colon if it is present; or s if colon is not present. - * - * ip_add and ip_mode are NULL terminated if modified. - * - * return 0 on success and -1 on error - */ -static int scan_address(char *ip_addr, size_t addr_size, - char *ip_mode, size_t mode_size, - const char *s) { - int retval = -1; - char *p; - - if ((NULL == s) || (NULL == ip_addr)) { - return -1; - } - - memset(ip_addr, 0, addr_size); - - p = strpbrk(s, ":"); - - if (p) { - /* colon is present */ - if (ip_mode) { - size_t end = 0; - - memset(ip_mode, 0, mode_size); - end = MIN(p - s, (ssize_t) (mode_size - 1)); /* ensure NULL term */ - strncpy(ip_mode, s, end); - strncpy(ip_addr, p + 1, addr_size - 1); /* ensure NULL term */ - retval = 0; - } - } else { - /* colon is not present */ - strncpy(ip_addr, s, addr_size); - } - - return retval; -} - -/* *************************************************** */ - -static const char *random_device_mac(void) { - const char key[] = "0123456789abcdef"; - static char mac[18]; - int i; - - srand(getpid()); - for (i = 0; i < sizeof(mac) - 1; ++i) { - if ((i + 1) % 3 == 0) { - mac[i] = ':'; - continue; - } - mac[i] = key[random() % sizeof(key)]; - } - mac[sizeof(mac) - 1] = '\0'; - return mac; -} - -/* *************************************************** */ - -static int protect_socket(int sock) { - JNIEnv *env = NULL; - - if (!sock) - return (-1); - - if (!g_status) - return (-1); - - if ((*g_status->jvm)->GetEnv(g_status->jvm, (void **) &env, JNI_VERSION_1_1) != JNI_OK || - !env) { - traceEvent(TRACE_ERROR, "GetEnv failed"); - return (-1); - } - - jclass vpn_service_cls = (*env)->GetObjectClass(env, g_status->jobj_service); - - if (!vpn_service_cls) { - traceEvent(TRACE_ERROR, "GetObjectClass(VpnService) failed"); - return (-1); - } - - /* Call VpnService protect */ - jmethodID midProtect = (*env)->GetMethodID(env, vpn_service_cls, "protect", "(I)Z"); - if (!midProtect) { - traceEvent(TRACE_ERROR, "Could not resolve VpnService::protect"); - return (-1); - } - - jboolean isProtected = (*env)->CallBooleanMethod(env, g_status->jobj_service, midProtect, sock); - - if (!isProtected) { - traceEvent(TRACE_ERROR, "VpnService::protect failed"); - return (-1); - } - - return (0); -} - -/* *************************************************** */ - -/** Called periodically to update the gateway MAC address. The ARP reply packet - is handled in handle_PACKET . */ -static void update_gateway_mac(n2n_edge_t *eee) { - n2n_android_t *priv = (n2n_android_t *) edge_get_userdata(eee); - - if (priv->gateway_ip != 0) { - size_t len; - char buffer[48]; - - len = build_unicast_arp(buffer, sizeof(buffer), priv->gateway_ip, priv); - traceEvent(TRACE_DEBUG, "Updating gateway mac"); - edge_send_packet2net(eee, (uint8_t *) buffer, len); - } -} - -int getIpAddrPrefixLength(char *ipaddrStr) { - unsigned int a[4] = {0}; - unsigned int total = 0; - int ret = 0; - - sscanf(ipaddrStr, "%u.%u.%u.%u", &a[0], &a[1], &a[2], &a[3]); - total = (a[0] << 24) + (a[1] << 16) + (a[2] << 8) + a[3]; - - int i, j; - for (i = 0, j = 0; i < 32; i++) { - unsigned char tmp = total % 2; - if (tmp == 1) { - j = 1; - ret += 1; - } else { // tmp == 0 - if (j == 1) - return -1; - } - total /= 2; - } - - return ret; -} - -int establishVpnService(n2n_edge_cmd_t *cmd, char ipStr[], int netmask) { - JNIEnv *env = NULL; - - if (!g_status) - return (-1); - - if ((*g_status->jvm)->GetEnv(g_status->jvm, (void **) &env, JNI_VERSION_1_1) != JNI_OK || - !env) { - traceEvent(TRACE_ERROR, "GetEnv failed"); - return (-1); - } - - jclass vpn_service_cls = (*env)->GetObjectClass(env, g_status->jobj_service); - if (!vpn_service_cls) { - traceEvent(TRACE_ERROR, "GetObjectClass(VpnService) failed"); - return (-1); - } - - /* Call VpnService protect */ - jmethodID midEstablishVpnService = (*env)->GetMethodID(env, vpn_service_cls, "EstablishVpnService", "(Ljava/lang/String;I)I"); - if (!midEstablishVpnService) { - traceEvent(TRACE_ERROR, "Could not resolve VpnService::EstablishVpnService"); - return (-1); - } - - jstring jIpStr = (*env)->NewStringUTF(env, ipStr); -#if 0 - if(!jIpStr) { - traceEvent(TRACE_ERROR, "Failed to create newStringUTF."); - return -1; - } -#endif - - int vpn_fd = (*env)->CallIntMethod(env, g_status->jobj_service, midEstablishVpnService, jIpStr, netmask); - if (vpn_fd < 0) { - traceEvent(TRACE_ERROR, "VpnService::EstablishVpnService failed"); - return (-1); - } - - return vpn_fd; -} - -/* *************************************************** */ - -static void on_sn_registration_updated(n2n_edge_t *eee, time_t now, const n2n_sock_t *sn) { - int change = 0; - - pthread_mutex_lock(&g_status->mutex); - change = g_status->running_status == EDGE_STAT_CONNECTED ? 0 : 1; - g_status->running_status = EDGE_STAT_CONNECTED; - pthread_mutex_unlock(&g_status->mutex); - - if (change) - g_status->report_edge_status(); - - update_gateway_mac(eee); -} - -/* *************************************************** */ - -static n2n_verdict on_packet_from_peer(n2n_edge_t *eee, const n2n_sock_t *peer, - uint8_t *payload, uint16_t *payload_size) { - n2n_android_t *priv = (n2n_android_t *) edge_get_userdata(eee); - - if ((*payload_size >= 36) && - (ntohs(*((uint16_t *) &payload[12])) == 0x0806) && /* ARP */ - (ntohs(*((uint16_t *) &payload[20])) == 0x0002) && /* REPLY */ - (!memcmp(&payload[28], &priv->gateway_ip, 4))) { /* From gateway */ - memcpy(priv->gateway_mac, &payload[22], 6); - - traceEvent(TRACE_INFO, "Gateway MAC: %02X:%02X:%02X:%02X:%02X:%02X", - priv->gateway_mac[0], priv->gateway_mac[1], priv->gateway_mac[2], - priv->gateway_mac[3], priv->gateway_mac[4], priv->gateway_mac[5]); - } - - uip_buf = payload; - uip_len = *payload_size; - if (IPBUF->ethhdr.type == htons(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - if (uip_len > 0) { - traceEvent(TRACE_DEBUG, "ARP reply packet prepare to send"); - edge_send_packet2net(eee, uip_buf, uip_len); - return N2N_DROP; - } - } - - return (N2N_ACCEPT); -} - -/* *************************************************** */ - -static n2n_verdict on_packet_from_tap(n2n_edge_t *eee, uint8_t *payload, - uint16_t *payload_size) { - n2n_android_t *priv = (n2n_android_t *) edge_get_userdata(eee); - - /* Fill destination mac address first or generate arp request packet instead of - * normal packet. */ - uip_buf = payload; - uip_len = *payload_size; - uip_arp_out(); - if (IPBUF->ethhdr.type == htons(UIP_ETHTYPE_ARP)) { - *payload_size = uip_len; - traceEvent(TRACE_DEBUG, "ARP request packets are sent instead of packets"); - } - - /* A NULL MAC as destination means that the packet is directed to the - * default gateway. */ - if ((*payload_size > 6) && (!memcmp(payload, null_mac, 6))) { - traceEvent(TRACE_DEBUG, "Detected packet for the gateway"); - - /* Overwrite the destination MAC with the actual gateway mac address */ - memcpy(payload, priv->gateway_mac, 6); - } - - return (N2N_ACCEPT); -} - -void on_main_loop_period(n2n_edge_t *eee, time_t now) { - n2n_android_t *priv = (n2n_android_t *) edge_get_userdata(eee); - - /* call arp timer periodically */ - if ((now - priv->lastArpPeriod) > ARP_PERIOD_INTERVAL) { - uip_arp_timer(); - priv->lastArpPeriod = now; - } -} - -void on_edge_sock_opened(n2n_edge_t *eee) { - if (!g_status && !g_status->jvm) { - traceEvent(TRACE_ERROR, "Failed to get jvm environment."); - return; - } - - JNIEnv *env; - if ((*g_status->jvm)->AttachCurrentThread(g_status->jvm, &env, NULL) != JNI_OK) { - traceEvent(TRACE_ERROR, "Failed to attach jvm to this thread."); - return; - } - - if (protect_socket(edge_get_n2n_socket(eee)) < 0) { - traceEvent(TRACE_ERROR, "protect(n2n_socket) failed"); - // todo notify deamon to stop - } - - traceEvent(TRACE_DEBUG, "Successfully protected n2n_sock."); - return; -} - -/* *************************************************** */ -#ifndef N2N_V3 -int start_edge_v2(n2n_edge_status_t *status) { - int keep_on_running = 0; - char tuntap_dev_name[N2N_IFNAMSIZ] = "tun0"; - char ip_mode[N2N_IF_MODE_SIZE] = "static"; - char ip_addr[N2N_NETMASK_STR_SIZE] = ""; - char netmask[N2N_NETMASK_STR_SIZE] = "255.255.255.0"; - char device_mac[N2N_MACNAMSIZ] = ""; - char *encrypt_key = NULL; - struct in_addr gateway_ip = {0}; - struct in_addr tap_ip = {0}; - n2n_edge_conf_t conf; - n2n_edge_t *eee = NULL; - n2n_edge_callbacks_t callbacks; - n2n_android_t private_status; - int i; - tuntap_dev dev; - uint8_t hex_mac[6]; - int rv = 0; - - if (!status) { - traceEvent(TRACE_ERROR, "Empty cmd struct"); - return 1; - } - g_status = status; - n2n_edge_cmd_t *cmd = &status->cmd; - - setTraceLevel(cmd->trace_vlevel); - FILE *fp = fopen(cmd->logpath, "a"); - if (fp == NULL) { - traceEvent(TRACE_ERROR, "failed to open log file."); - } else { - setTraceFile(fp); - } - - if (cmd->vpn_fd < 0) { - traceEvent(TRACE_ERROR, "VPN socket is invalid."); - return 1; - } - - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_CONNECTING; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - - memset(&dev, 0, sizeof(dev)); - edge_init_conf_defaults(&conf); - - /* Load the configuration */ - strncpy((char *) conf.community_name, cmd->community, N2N_COMMUNITY_SIZE - 1); - - if (cmd->enc_key && cmd->enc_key[0]) { - conf.transop_id = N2N_TRANSFORM_ID_TWOFISH; - conf.encrypt_key = strdup(cmd->enc_key); - traceEvent(TRACE_DEBUG, "encrypt_key = '%s'\n", encrypt_key); - - if (cmd->encryption_mode[0]) { - if (!strcmp(cmd->encryption_mode, "Twofish")) - conf.transop_id = N2N_TRANSFORM_ID_TWOFISH; - else if (!strcmp(cmd->encryption_mode, "AES-CBC")) - conf.transop_id = N2N_TRANSFORM_ID_AESCBC; - else if (!strcmp(cmd->encryption_mode, "Speck-CTR")) - conf.transop_id = N2N_TRANSFORM_ID_SPECK; - else if (!strcmp(cmd->encryption_mode, "ChaCha20")) - conf.transop_id = N2N_TRANSFORM_ID_CHACHA20; - else - traceEvent(TRACE_WARNING, "unknown encryption mode:'%s'\n", cmd->encryption_mode); - } - } else - conf.transop_id = N2N_TRANSFORM_ID_NULL; - - scan_address(ip_addr, N2N_NETMASK_STR_SIZE, - ip_mode, N2N_IF_MODE_SIZE, - cmd->ip_addr); - - dev.fd = cmd->vpn_fd; - - conf.drop_multicast = cmd->drop_multicast == 0 ? 0 : 1; - conf.allow_routing = cmd->allow_routing == 0 ? 0 : 1; - conf.dyn_ip_mode = (strcmp("dhcp", ip_mode) == 0) ? 1 : 0; - conf.header_encryption = cmd->header_encryption == 0 ? 0 : 2; - - for (i = 0; i < N2N_EDGE_NUM_SUPERNODES && i < EDGE_CMD_SUPERNODES_NUM; ++i) { - if (cmd->supernodes[i][0] != '\0') { - strncpy(conf.sn_ip_array[conf.sn_num], cmd->supernodes[i], N2N_EDGE_SN_HOST_SIZE); - traceEvent(TRACE_DEBUG, "Adding supernode[%u] = %s\n", (unsigned int) conf.sn_num, - (conf.sn_ip_array[conf.sn_num])); - ++conf.sn_num; - } - } - - if (cmd->ip_netmask[0] != '\0') - strncpy(netmask, cmd->ip_netmask, N2N_NETMASK_STR_SIZE); - - if (cmd->gateway_ip[0] != '\0') - inet_aton(cmd->gateway_ip, &gateway_ip); - - if (cmd->mac_addr[0] != '\0') - strncpy(device_mac, cmd->mac_addr, N2N_MACNAMSIZ); - else { - strncpy(device_mac, random_device_mac(), N2N_MACNAMSIZ); - traceEvent(TRACE_DEBUG, "random device mac: %s\n", device_mac); - } - - str2mac(hex_mac, device_mac); - - if (edge_verify_conf(&conf) != 0) { - if (conf.encrypt_key) free(conf.encrypt_key); - conf.encrypt_key = NULL; - traceEvent(TRACE_ERROR, "Bad configuration"); - rv = 1; - goto cleanup; - } - - /* Open the TAP device */ - if (tuntap_open(&dev, tuntap_dev_name, ip_mode, ip_addr, netmask, device_mac, cmd->mtu) < 0) { - traceEvent(TRACE_ERROR, "Failed in tuntap_open"); - rv = 1; - goto cleanup; - } - - /* Start n2n */ - eee = edge_init(&dev, &conf, &i); - - if (eee == NULL) { - traceEvent(TRACE_ERROR, "Failed in edge_init"); - rv = 1; - goto cleanup; - } - - /* Protect the socket so that the supernode traffic won't go inside the n2n VPN */ - if (protect_socket(edge_get_n2n_socket(eee)) < 0) { - traceEvent(TRACE_ERROR, "protect(n2n_socket) failed"); - rv = 1; - goto cleanup; - } - - if (protect_socket(edge_get_management_socket(eee)) < 0) { - traceEvent(TRACE_ERROR, "protect(management_socket) failed"); - rv = 1; - goto cleanup; - } - - /* Private Status */ - memset(&private_status, 0, sizeof(private_status)); - private_status.gateway_ip = gateway_ip.s_addr; - private_status.conf = &conf; - memcpy(private_status.tap_mac, hex_mac, 6); - inet_aton(ip_addr, &tap_ip); - private_status.tap_ipaddr = tap_ip.s_addr; - edge_set_userdata(eee, &private_status); - - /* set host addr, netmask, mac addr for UIP and init arp*/ - { - int match, i; - int ip[4]; - uip_ipaddr_t ipaddr; - struct uip_eth_addr eaddr; - - match = sscanf(ip_addr, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan ip failed, ip: %s", ip_addr); - rv = 1; - goto cleanup; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_sethostaddr(ipaddr); - match = sscanf(netmask, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan netmask error, ip: %s", netmask); - rv = 1; - goto cleanup; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_setnetmask(ipaddr); - for (i = 0; i < 6; ++i) - eaddr.addr[i] = hex_mac[i]; - uip_setethaddr(eaddr); - - uip_arp_init(); - } - - /* Set up the callbacks */ - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.sn_registration_updated = on_sn_registration_updated; - callbacks.packet_from_peer = on_packet_from_peer; - callbacks.packet_from_tap = on_packet_from_tap; - callbacks.main_loop_period = on_main_loop_period; - edge_set_callbacks(eee, &callbacks); - - keep_on_running = 1; - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_CONNECTED; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - traceEvent(TRACE_NORMAL, "edge started"); - - run_edge_loop(eee, &keep_on_running); - - traceEvent(TRACE_NORMAL, "edge stopped"); - - cleanup: - if (eee) edge_term(eee); - if (encrypt_key) free(encrypt_key); - tuntap_close(&dev); - edge_term_conf(&conf); - - return rv; -} - -/* *************************************************** */ - -int stop_edge_v2(void) { - // quick stop - int fd = open_socket(0, 0 /* bind LOOPBACK*/ ); - if (fd < 0) { - return 1; - } - - struct sockaddr_in peer_addr; - peer_addr.sin_family = PF_INET; - peer_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - peer_addr.sin_port = htons(N2N_EDGE_MGMT_PORT); - sendto(fd, "stop", 4, 0, (struct sockaddr *) &peer_addr, sizeof(struct sockaddr_in)); - close(fd); - - // Do not report the status yet, the edge thread may be still running - /* - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_DISCONNECT; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - */ - - return 0; -} -#else - -int g_stop_initial = 0; - -int start_edge_v3(n2n_edge_status_t *status) { - int keep_on_running = 0; - char tuntap_dev_name[N2N_IFNAMSIZ] = "tun0"; - char ip_mode[N2N_IF_MODE_SIZE] = "static"; - char ip_addr[N2N_NETMASK_STR_SIZE] = ""; - char netmask[N2N_NETMASK_STR_SIZE] = "255.255.255.0"; - char device_mac[N2N_MACNAMSIZ] = ""; - char *encrypt_key = NULL; - struct in_addr gateway_ip = {0}; - struct in_addr tap_ip = {0}; - n2n_edge_conf_t conf; - n2n_edge_t *eee = NULL; - n2n_edge_callbacks_t callbacks; - n2n_android_t private_status; - int i; - tuntap_dev dev; - uint8_t hex_mac[6]; - int rv = 0; - - if (!status) { - traceEvent(TRACE_ERROR, "Empty cmd struct"); - return 1; - } - - g_stop_initial = 0; - g_status = status; - n2n_edge_cmd_t *cmd = &status->cmd; - - setTraceLevel(cmd->trace_vlevel); - FILE *fp = fopen(cmd->logpath, "a"); - if (fp == NULL) { - traceEvent(TRACE_ERROR, "failed to open log file."); - } else { - setTraceFile(fp); - } - - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_CONNECTING; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - - memset(&dev, 0, sizeof(dev)); - edge_init_conf_defaults(&conf); - - /* Load the configuration */ - strncpy((char *) conf.community_name, cmd->community, N2N_COMMUNITY_SIZE - 1); - - if (cmd->enc_key && cmd->enc_key[0]) { - conf.transop_id = N2N_TRANSFORM_ID_TWOFISH; - conf.encrypt_key = strdup(cmd->enc_key); - traceEvent(TRACE_DEBUG, "encrypt_key = '%s'\n", encrypt_key); - - if (cmd->encryption_mode[0]) { - if (!strcmp(cmd->encryption_mode, "Twofish")) - conf.transop_id = N2N_TRANSFORM_ID_TWOFISH; - else if (!strcmp(cmd->encryption_mode, "AES-CBC")) - conf.transop_id = N2N_TRANSFORM_ID_AES; - else if (!strcmp(cmd->encryption_mode, "Speck-CTR")) - conf.transop_id = N2N_TRANSFORM_ID_SPECK; - else if (!strcmp(cmd->encryption_mode, "ChaCha20")) - conf.transop_id = N2N_TRANSFORM_ID_CHACHA20; - else - traceEvent(TRACE_WARNING, "unknown encryption mode:'%s'\n", cmd->encryption_mode); - } - } else - conf.transop_id = N2N_TRANSFORM_ID_NULL; - - if(cmd->ip_mode == 0) - scan_address(ip_addr, N2N_NETMASK_STR_SIZE, - ip_mode, N2N_IF_MODE_SIZE, - cmd->ip_addr); - else if(cmd->ip_mode == 1) - memset(ip_mode, 0, sizeof(ip_mode)); - - dev.fd = cmd->vpn_fd; - - conf.drop_multicast = cmd->drop_multicast == 0 ? 0 : 1; - conf.allow_routing = cmd->allow_routing == 0 ? 0 : 1; - conf.header_encryption = cmd->header_encryption == 0 ? 0 : 2; - - if(0 == strcmp("static", ip_mode)) - conf.tuntap_ip_mode = TUNTAP_IP_MODE_STATIC; - else if(0 == strcmp("dhcp", ip_mode)) - conf.tuntap_ip_mode = TUNTAP_IP_MODE_DHCP; - else - conf.tuntap_ip_mode = TUNTAP_IP_MODE_SN_ASSIGN; - - for (i = 0; i < EDGE_CMD_SUPERNODES_NUM && cmd->supernodes[i][0] != '\0'; i++) { - if( 0 == edge_conf_add_supernode(&conf, cmd->supernodes[i])) - traceEvent(TRACE_DEBUG, "Adding supernode[%u] = %s\n", (unsigned int) conf.sn_num, - cmd->supernodes[i]); - } - - if (cmd->ip_netmask[0] != '\0') - strncpy(netmask, cmd->ip_netmask, N2N_NETMASK_STR_SIZE); - - if (cmd->gateway_ip[0] != '\0') - inet_aton(cmd->gateway_ip, &gateway_ip); - - if (cmd->mac_addr[0] != '\0') - strncpy(device_mac, cmd->mac_addr, N2N_MACNAMSIZ); - else { - strncpy(device_mac, random_device_mac(), N2N_MACNAMSIZ); - traceEvent(TRACE_DEBUG, "random device mac: %s\n", device_mac); - } - - str2mac(hex_mac, device_mac); - - if(cmd->devDesc && cmd->devDesc[0]) { - memset(conf.dev_desc, 0, sizeof(conf.dev_desc)); - strncpy(conf.dev_desc, cmd->devDesc, sizeof(conf.dev_desc) - 1); - } - - if (edge_verify_conf(&conf) != 0) { - if (conf.encrypt_key) free(conf.encrypt_key); - conf.encrypt_key = NULL; - traceEvent(TRACE_ERROR, "Bad configuration"); - rv = 1; - goto cleanup; - } - - /* Start n2n */ - eee = edge_init(&conf, &i); - - if (eee == NULL) { - traceEvent(TRACE_ERROR, "Failed in edge_init"); - rv = 1; - goto cleanup; - } - - /* Protect the socket so that the supernode traffic won't go inside the n2n VPN */ - if (protect_socket(edge_get_management_socket(eee)) < 0) { - traceEvent(TRACE_ERROR, "protect(management_socket) failed"); - rv = 1; - goto cleanup; - } - - strncpy(eee->tuntap_priv_conf.tuntap_dev_name, tuntap_dev_name, N2N_IFNAMSIZ - 1); - strncpy(eee->tuntap_priv_conf.ip_mode, ip_mode, N2N_IF_MODE_SIZE - 1); - strncpy(eee->tuntap_priv_conf.ip_addr, ip_addr, N2N_NETMASK_STR_SIZE - 1); - strncpy(eee->tuntap_priv_conf.netmask, netmask, N2N_NETMASK_STR_SIZE - 1); - strncpy(eee->tuntap_priv_conf.device_mac, device_mac, N2N_MACNAMSIZ - 1); - eee->tuntap_priv_conf.mtu = cmd->mtu; - - if((0 == strcmp("static", eee->tuntap_priv_conf.ip_mode)) || - ((eee->tuntap_priv_conf.ip_mode[0] == '\0') && (eee->tuntap_priv_conf.ip_addr[0] != '\0'))) { - traceEvent(TRACE_NORMAL, "Use manually set IP address."); - eee->conf.tuntap_ip_mode = TUNTAP_IP_MODE_STATIC; - } else if(0 == strcmp("dhcp", eee->tuntap_priv_conf.ip_mode)) { - traceEvent(TRACE_NORMAL, "Obtain IP from other edge DHCP services."); - eee->conf.tuntap_ip_mode = TUNTAP_IP_MODE_DHCP; - } else { - traceEvent(TRACE_NORMAL, "Automatically assign IP address by supernode."); - eee->conf.tuntap_ip_mode = TUNTAP_IP_MODE_SN_ASSIGN; - } - - /* Private Status */ - memset(&private_status, 0, sizeof(private_status)); - private_status.gateway_ip = gateway_ip.s_addr; - private_status.conf = &conf; - memcpy(private_status.tap_mac, hex_mac, 6); - inet_aton(ip_addr, &tap_ip); - private_status.tap_ipaddr = tap_ip.s_addr; - edge_set_userdata(eee, &private_status); - - /* set host addr, netmask, mac addr for UIP and init arp*/ - if(cmd->ip_mode == 0) - { - int match, i; - int ip[4]; - uip_ipaddr_t ipaddr; - struct uip_eth_addr eaddr; - - match = sscanf(ip_addr, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan ip failed, ip: %s", ip_addr); - rv = 1; - goto cleanup; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_sethostaddr(ipaddr); - match = sscanf(netmask, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan netmask error, ip: %s", netmask); - rv = 1; - goto cleanup; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_setnetmask(ipaddr); - for (i = 0; i < 6; ++i) - eaddr.addr[i] = hex_mac[i]; - uip_setethaddr(eaddr); - - uip_arp_init(); - } - - /* Set up the callbacks */ - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.sn_registration_updated = on_sn_registration_updated; - callbacks.packet_from_peer = on_packet_from_peer; - callbacks.packet_from_tap = on_packet_from_tap; - callbacks.main_loop_period = on_main_loop_period; - callbacks.sock_opened = on_edge_sock_opened; - edge_set_callbacks(eee, &callbacks); - - /* Hin2n : mostly transplant from origin n2n edge init sequence */ - uint8_t runlevel = 0; /* bootstrap: runlevel */ - time_t now, last_action = 0; /* timeout */ - uint8_t seek_answer = 1; /* expecting answer from supernode */ - tuntap_dev tuntap = {0}; /* a tuntap device */ - fd_set socket_mask; /* for supernode answer */ - struct timeval wait_time; /* timeout for sn answer */ - peer_info_t *scan, *scan_tmp; /* supernode iteration */ - uint16_t expected = sizeof(uint16_t); - uint16_t position = 0; - uint8_t pktbuf[N2N_SN_PKTBUF_SIZE + sizeof(uint16_t)]; /* buffer + prepended buffer length in case of tcp */ - macstr_t mac_buf; /* output mac address */ - - tuntap.fd = cmd->vpn_fd; - - // mini main loop for bootstrap, not using main loop code because some of its mechanisms do not fit in here - // for the sake of quickly establishing connection. REVISIT when a more elegant way to re-use main loop code - // is found - - // if more than one supernode given, find at least one who is alive to faster establish connection - if((HASH_COUNT(eee->conf.supernodes) <= 1) || (eee->conf.connect_tcp)) { - // skip the initial supernode ping - traceEvent(TRACE_DEBUG, "Skip PING to supernode."); - runlevel = 2; - } - - eee->last_sup = 0; /* if it wasn't zero yet */ - eee->curr_sn = eee->conf.supernodes; - supernode_connect(eee); - - while(runlevel < 5) { - if(g_stop_initial) { - rv = 1; - goto cleanup; - } - - now = time(NULL); - - // we do not use switch-case because we also check for 'greater than' - - if(runlevel == 0) { /* PING to all known supernodes */ - last_action = now; - eee->sn_pong = 0; - // (re-)initialize the number of max concurrent pings (decreases by calling send_query_peer) - eee->conf.number_max_sn_pings = NUMBER_SN_PINGS_INITIAL; - send_query_peer(eee, null_mac); - traceEvent(TRACE_NORMAL, "Send PING to supernodes."); - runlevel++; - } - - if(runlevel == 1) { /* PING has been sent to all known supernodes */ - if(eee->sn_pong) { - // first answer - eee->sn_pong = 0; - sn_selection_sort(&(eee->conf.supernodes)); - eee->curr_sn = eee->conf.supernodes; - supernode_connect(eee); - traceEvent(TRACE_NORMAL, "Received first PONG from supernode [%s].", eee->curr_sn->ip_addr); - runlevel++; - } else if(last_action <= (now - BOOTSTRAP_TIMEOUT)) { - // timeout - runlevel--; - // skip waiting for answer to direcly go to send PING again - seek_answer = 0; - traceEvent(TRACE_DEBUG, "PONG timeout."); - } - } - - // by the way, have every later PONG cause the remaining (!) list to be sorted because the entries - // before have already been tried; as opposed to initial PONG, do not change curr_sn - if(runlevel > 1) { - if(eee->sn_pong) { - eee->sn_pong = 0; - if(eee->curr_sn->hh.next) { - sn_selection_sort((peer_info_t**)&(eee->curr_sn->hh.next)); - traceEvent(TRACE_DEBUG, "Received additional PONG from supernode."); - // here, it is hard to detemine from which one, so no details to output - } - } - } - - if(runlevel == 2) { /* send REGISTER_SUPER to get auto ip address from a supernode */ - if(eee->conf.tuntap_ip_mode == TUNTAP_IP_MODE_SN_ASSIGN) { - last_action = now; - eee->sn_wait = 1; - send_register_super(eee); - runlevel++; - traceEvent(TRACE_NORMAL, "Send REGISTER_SUPER to supernode [%s] asking for IP address.", - eee->curr_sn->ip_addr); - } else { - runlevel += 2; /* skip waiting for TUNTAP IP address */ - traceEvent(TRACE_DEBUG, "Skip auto IP address asignment."); - } - } - - if(runlevel == 3) { /* REGISTER_SUPER to get auto ip address from a sn has been sent */ - if(!eee->sn_wait) { /* TUNTAP IP address received */ - runlevel++; - traceEvent(TRACE_NORMAL, "Received REGISTER_SUPER_ACK from supernode for IP address asignment."); - // it should be from curr_sn, but we can't determine definitely here, so no details to output - } else if(last_action <= (now - BOOTSTRAP_TIMEOUT)) { - // timeout, so try next supernode - if(eee->curr_sn->hh.next) - eee->curr_sn = eee->curr_sn->hh.next; - else - eee->curr_sn = eee->conf.supernodes; - supernode_connect(eee); - runlevel--; - // skip waiting for answer to direcly go to send REGISTER_SUPER again - seek_answer = 0; - traceEvent(TRACE_DEBUG, "REGISTER_SUPER_ACK timeout."); - } - } - - if(runlevel == 4) { /* configure the TUNTAP device */ - /* call java function to establish vpn service */ - if(tuntap.fd < 0) { - int netmask = getIpAddrPrefixLength(eee->tuntap_priv_conf.netmask); - tuntap.fd = establishVpnService(&g_status->cmd, eee->tuntap_priv_conf.ip_addr, netmask); - - dev.fd = g_status->cmd.vpn_fd = tuntap.fd; - int val = fcntl(g_status->cmd.vpn_fd, F_GETFL); - if (val == -1) { - rv = 1; - goto cleanup; - } - if ((val & O_NONBLOCK) == O_NONBLOCK) { - val &= ~O_NONBLOCK; - val = fcntl(g_status->cmd.vpn_fd, F_SETFL, val); - if (val == -1) { - rv = 1; - goto cleanup; - } - } - - /****************** INIT ARP MODULE ******************/ - { - int match, i; - int ip[4]; - uip_ipaddr_t ipaddr; - struct uip_eth_addr eaddr; - - match = sscanf(eee->tuntap_priv_conf.ip_addr, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan ip failed, ip: %s", ip_addr); - rv = 1; - goto cleanup; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_sethostaddr(ipaddr); - - match = sscanf(eee->tuntap_priv_conf.netmask, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan netmask error, ip: %s", netmask); - rv = 1; - goto cleanup; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_setnetmask(ipaddr); - - for (i = 0; i < 6; ++i) - eaddr.addr[i] = hex_mac[i]; - uip_setethaddr(eaddr); - - uip_arp_init(); - } - } - - if(tuntap_open(&tuntap, eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, - eee->tuntap_priv_conf.ip_addr, eee->tuntap_priv_conf.netmask, - eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu) < 0) - goto cleanup; - memcpy(&eee->device, &tuntap, sizeof(tuntap)); - traceEvent(TRACE_NORMAL, "Created local tap device IP: %s, Mask: %s, MAC: %s", - eee->tuntap_priv_conf.ip_addr, - eee->tuntap_priv_conf.netmask, - macaddr_str(mac_buf, eee->device.mac_addr)); - runlevel = 5; - // no more answers required - seek_answer = 0; - } - - // we usually wait for some answer, there however are exceptions when going back to a previous runlevel - if(seek_answer) { - FD_ZERO(&socket_mask); - FD_SET(eee->sock, &socket_mask); - wait_time.tv_sec = BOOTSTRAP_TIMEOUT; - wait_time.tv_usec = 0; - - if(select(eee->sock + 1, &socket_mask, NULL, NULL, &wait_time) > 0) { - if(FD_ISSET(eee->sock, &socket_mask)) { - fetch_and_eventually_process_data (eee, eee->sock, - pktbuf, &expected, &position, - now); - } - } - } - - seek_answer = 1; - } - // allow a higher number of pings for first regular round of ping - // to quicker get an inital 'supernode selection criterion overview' - eee->conf.number_max_sn_pings = NUMBER_SN_PINGS_INITIAL; - // shape supernode list; make current one the first on the list - HASH_ITER(hh, eee->conf.supernodes, scan, scan_tmp) { - if(scan == eee->curr_sn) - sn_selection_criterion_good(&(scan->selection_criterion)); - else - sn_selection_criterion_default(&(scan->selection_criterion)); - } - sn_selection_sort(&(eee->conf.supernodes)); - // do not immediately ping again, allow some time - eee->last_sweep = now - SWEEP_TIME + 2 * BOOTSTRAP_TIMEOUT; - eee->sn_wait = 1; - eee->last_register_req = 0; - -#ifdef HAVE_LIBCAP - /* Before dropping the privileges, retain capabilities to regain them in future. */ - caps = cap_get_proc(); - - cap_set_flag(caps, CAP_PERMITTED, num_cap, cap_values, CAP_SET); - cap_set_flag(caps, CAP_EFFECTIVE, num_cap, cap_values, CAP_SET); - - if((cap_set_proc(caps) != 0) || (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0)) - traceEvent(TRACE_WARNING, "Unable to retain permitted capabilities [%s]\n", strerror(errno)); -#else -#ifndef __APPLE__ - traceEvent(TRACE_WARNING, "n2n has not been compiled with libcap-dev. Some commands may fail."); -#endif -#endif /* HAVE_LIBCAP */ - -#if 1 - if((eee->tuntap_priv_conf.userid != 0) || (eee->tuntap_priv_conf.groupid != 0)) { - traceEvent(TRACE_NORMAL, "Dropping privileges to uid=%d, gid=%d", - (signed int)eee->tuntap_priv_conf.userid, (signed int)eee->tuntap_priv_conf.groupid); - - /* Finished with the need for root privileges. Drop to unprivileged user. */ - if((setgid(eee->tuntap_priv_conf.groupid) != 0) - || (setuid(eee->tuntap_priv_conf.userid) != 0)) { - traceEvent(TRACE_ERROR, "Unable to drop privileges [%u/%s]", errno, strerror(errno)); - exit(1); - } - } - - if((getuid() == 0) || (getgid() == 0)) - traceEvent(TRACE_WARNING, "Running as root is discouraged, check out the -u/-g options"); -#endif - - keep_on_running = 1; - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_CONNECTED; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - traceEvent(TRACE_NORMAL, "edge started"); - - eee->keep_running = &keep_on_running; - run_edge_loop(eee); - - traceEvent(TRACE_NORMAL, "edge stopped"); - -cleanup: - if (eee) edge_term(eee); - if (encrypt_key) free(encrypt_key); - tuntap_close(&dev); - edge_term_conf(&conf); - - return rv; -} - -int stop_edge_v3(void) { - // quick stop - g_stop_initial = 1; - - int fd = open_socket(0, 0 /* bind LOOPBACK*/,0 ); - if (fd < 0) { - return 1; - } - - struct sockaddr_in peer_addr; - peer_addr.sin_family = PF_INET; - peer_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - peer_addr.sin_port = htons(N2N_EDGE_MGMT_PORT); - sendto(fd, "stop", 4, 0, (struct sockaddr *) &peer_addr, sizeof(struct sockaddr_in)); - close(fd); - - // Do not report the status yet, the edge thread may be still running - /* - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_DISCONNECT; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - */ - - return 0; -} - -#endif diff --git a/Hin2n/src/main/cpp/edge_jni/edge_jni.c b/Hin2n/src/main/cpp/edge_jni/edge_jni.c deleted file mode 100644 index 3db3439e..00000000 --- a/Hin2n/src/main/cpp/edge_jni/edge_jni.c +++ /dev/null @@ -1,709 +0,0 @@ -// -// Created by switchwang(https://github.com/switch-st) on 2018-04-15. -// - -#include -#include -#include -#include -#include -#include "edge_jni.h" - -static n2n_edge_status_t status; - -static int GetEdgeCmd(JNIEnv *env, jobject jcmd, n2n_edge_cmd_t *cmd); - -static void *EdgeRoutine(void *); - -static void ResetEdgeStatus(JNIEnv *env, uint8_t cleanup); - -static void InitEdgeStatus(void); - -JNIEXPORT jboolean JNICALL Java_wang_switchy_hin2n_service_N2NService_startEdge( - JNIEnv *env, - jobject this, - jobject jcmd) { - -#ifndef NDEBUG - __android_log_write(ANDROID_LOG_DEBUG, "edge_jni", "in start"); -#endif /* #ifndef NDEBUG */ - ResetEdgeStatus(env, 0 /* not cleanup*/); - if (GetEdgeCmd(env, jcmd, &status.cmd) != 0) { - ResetEdgeStatus(env, 1 /* cleanup*/); - return JNI_FALSE; - } - - /* only when java already created the vpn service and pass to C should we reset NON_BLOCK */ - if(status.cmd.vpn_fd > 0) { - int val = fcntl(status.cmd.vpn_fd, F_GETFL); - if (val == -1) { - ResetEdgeStatus(env, 1 /* cleanup*/); - return JNI_FALSE; - } - if ((val & O_NONBLOCK) == O_NONBLOCK) { - val &= ~O_NONBLOCK; - val = fcntl(status.cmd.vpn_fd, F_SETFL, val); - if (val == -1) { - ResetEdgeStatus(env, 1 /* cleanup*/); - return JNI_FALSE; - } - } - } - - if ((*env)->GetJavaVM(env, &status.jvm) != JNI_OK) { - ResetEdgeStatus(env, 1 /* cleanup*/); - return JNI_FALSE; - } - status.jobj_service = (*env)->NewGlobalRef(env, this); - jclass cls = (*env)->FindClass(env, "wang/switchy/hin2n/model/EdgeStatus"); - if (!cls) { - ResetEdgeStatus(env, 1 /* cleanup*/); - return JNI_FALSE; - } - status.jcls_status = (*env)->NewGlobalRef(env, cls); - jclass cls_rs = (*env)->FindClass(env, "wang/switchy/hin2n/model/EdgeStatus$RunningStatus"); - if (!cls_rs) { - ResetEdgeStatus(env, 1 /* cleanup*/); - return JNI_FALSE; - } - status.jcls_rs = (*env)->NewGlobalRef(env, cls_rs); - - switch (status.edge_type) { - case EDGE_TYPE_V1: - status.start_edge = start_edge_v1; - status.stop_edge = stop_edge_v1; - break; - case EDGE_TYPE_V2: - status.start_edge = start_edge_v2; - status.stop_edge = stop_edge_v2; - break; - case EDGE_TYPE_V2S: - status.start_edge = start_edge_v2s; - status.stop_edge = stop_edge_v2s; - break; - case EDGE_TYPE_V3: - status.start_edge = start_edge_v3; - status.stop_edge = stop_edge_v3; - break; - default: - ResetEdgeStatus(env, 1 /* cleanup*/); - return JNI_FALSE; - } - status.report_edge_status = report_edge_status; - pthread_mutex_init(&status.mutex, NULL); - int ret = pthread_create(&status.tid, NULL, EdgeRoutine, NULL); - if (ret != 0) { - ResetEdgeStatus(env, 1 /* cleanup*/); - return JNI_FALSE; - } - - return JNI_TRUE; -} - -JNIEXPORT void JNICALL Java_wang_switchy_hin2n_service_N2NService_stopEdge( - JNIEnv *env, - jobject this) { - -#ifndef NDEBUG - __android_log_write(ANDROID_LOG_DEBUG, "edge_jni", "in stop"); -#endif /* #ifndef NDEBUG */ - ResetEdgeStatus(env, 0 /* not cleanup*/); -} - -JNIEXPORT jobject JNICALL Java_wang_switchy_hin2n_service_N2NService_getEdgeStatus( - JNIEnv *env, - jobject this) { - const char *running_status = "DISCONNECT"; - if (status.tid != -1) { - if (!pthread_kill(status.tid, 0)) { - pthread_mutex_lock(&status.mutex); - switch (status.running_status) { - case EDGE_STAT_CONNECTING: - running_status = "CONNECTING"; - break; - case EDGE_STAT_CONNECTED: - running_status = "CONNECTED"; - break; - case EDGE_STAT_SUPERNODE_DISCONNECT: - running_status = "SUPERNODE_DISCONNECT"; - break; - case EDGE_STAT_DISCONNECT: - running_status = "DISCONNECT"; - break; - case EDGE_STAT_FAILED: - running_status = "FAILED"; - break; - default: - running_status = "DISCONNECT"; - } - pthread_mutex_unlock(&status.mutex); - } - } - - jclass cls = (*env)->FindClass(env, "wang/switchy/hin2n/model/EdgeStatus"); - jobject jStatus = (*env)->NewObject(env, cls, (*env)->GetMethodID(env, cls, "", "()V")); - if (!jStatus) { - return NULL; - } - jclass cls_rs = (*env)->FindClass(env, "wang/switchy/hin2n/model/EdgeStatus$RunningStatus"); - jobject jRunningStatus = (*env)->GetStaticObjectField(env, cls_rs, - (*env)->GetStaticFieldID(env, cls_rs, - running_status, - "Lwang/switchy/hin2n/model/EdgeStatus$RunningStatus;")); - (*env)->SetObjectField(env, jStatus, (*env)->GetFieldID(env, cls, "runningStatus", - "Lwang/switchy/hin2n/model/EdgeStatus$RunningStatus;"), - jRunningStatus); - - return jStatus; -} - -///////////////////////////////////////////////////////////////////////// -#ifndef JNI_CHECKNULL -#define JNI_CHECKNULL(p) do { if (!(p)) return 1;}while(0) -#endif /* JNI_CHECKNULL */ - -int GetEdgeCmd(JNIEnv *env, jobject jcmd, n2n_edge_cmd_t *cmd) { - jclass cls; - int i, j; - - cls = (*env)->GetObjectClass(env, jcmd); - JNI_CHECKNULL(cls); - - // edgeType - { - jint jiEdgeType = (*env)->GetIntField(env, jcmd, - (*env)->GetFieldID(env, cls, "edgeType", "I")); - if (jiEdgeType < EDGE_TYPE_V1 || jiEdgeType > EDGE_TYPE_V3) { - return 1; - } - status.edge_type = jiEdgeType; - -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "edgeType = %d", status.edge_type); -#endif /* #ifndef NDEBUG */ - } - - { - jint jiEdgeType = (*env)->GetIntField(env, jcmd, - (*env)->GetFieldID(env, cls, "ipMode", "I")); - if (jiEdgeType < 0 || jiEdgeType > 1) { - return 1; - } - status.cmd.ip_mode = jiEdgeType; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "ipMode = %d", status.cmd.ip_mode); -#endif /* #ifndef NDEBUG */ - } - - // ipAddr - { - jstring jsIpAddr = (*env)->GetObjectField(env, jcmd, (*env)->GetFieldID(env, cls, "ipAddr", - "Ljava/lang/String;")); - JNI_CHECKNULL(jsIpAddr); - const char *ipAddr = (*env)->GetStringUTFChars(env, jsIpAddr, NULL); - if (!ipAddr || strlen(ipAddr) == 0) { - (*env)->ReleaseStringUTFChars(env, jsIpAddr, ipAddr); - return 1; - } - strncpy(cmd->ip_addr, ipAddr, EDGE_CMD_IPSTR_SIZE); - (*env)->ReleaseStringUTFChars(env, jsIpAddr, ipAddr); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "ipAddr = %s", cmd->ip_addr); -#endif /* #ifndef NDEBUG */ - } - // ipNetmask - { - jstring jsIpNetmask = (*env)->GetObjectField(env, jcmd, - (*env)->GetFieldID(env, cls, "ipNetmask", - "Ljava/lang/String;")); - JNI_CHECKNULL(jsIpNetmask); - const char *ipNetmask = (*env)->GetStringUTFChars(env, jsIpNetmask, NULL); - if (!ipNetmask || strlen(ipNetmask) == 0) { - (*env)->ReleaseStringUTFChars(env, jsIpNetmask, ipNetmask); - return 1; - } - strncpy(cmd->ip_netmask, ipNetmask, EDGE_CMD_IPSTR_SIZE); - (*env)->ReleaseStringUTFChars(env, jsIpNetmask, ipNetmask); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "ipNetmask = %s", cmd->ip_netmask); -#endif /* #ifndef NDEBUG */ - } - // supernodes - { - jarray jaSupernodes = (*env)->GetObjectField(env, jcmd, - (*env)->GetFieldID(env, cls, "supernodes", - "[Ljava/lang/String;")); - JNI_CHECKNULL(jaSupernodes); - int len = (*env)->GetArrayLength(env, jaSupernodes); - if (len <= 0) { - return 1; - } - for (i = 0, j = 0; i < len && i < EDGE_CMD_SUPERNODES_NUM; ++i) { - const jobject jsNode = (*env)->GetObjectArrayElement(env, jaSupernodes, i); - if (!jsNode) { - continue; - } - const char *node = (*env)->GetStringUTFChars(env, jsNode, NULL); - if (!node || strlen(node) == 0) { - (*env)->ReleaseStringUTFChars(env, jsNode, node); - continue; - } - strncpy(cmd->supernodes[j], node, EDGE_CMD_SN_HOST_SIZE); - (*env)->ReleaseStringUTFChars(env, jsNode, node); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "supernodes = %s", - cmd->supernodes[j]); -#endif /* #ifndef NDEBUG */ - j++; - } -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "j = %d", j); -#endif /* #ifndef NDEBUG */ - if (j == 0) { - return 1; - } - } - // community - { - jstring jsCommunity = (*env)->GetObjectField(env, jcmd, - (*env)->GetFieldID(env, cls, "community", - "Ljava/lang/String;")); - JNI_CHECKNULL(jsCommunity); - const char *community = (*env)->GetStringUTFChars(env, jsCommunity, NULL); - if (!community || strlen(community) == 0) { - (*env)->ReleaseStringUTFChars(env, jsCommunity, community); - return 1; - } - strncpy(cmd->community, community, EDGE_CMD_COMMUNITY_SIZE); - (*env)->ReleaseStringUTFChars(env, jsCommunity, community); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "community = %s", cmd->community); -#endif /* #ifndef NDEBUG */ - } - // encKey - { - jstring jsEncKey = (*env)->GetObjectField(env, jcmd, (*env)->GetFieldID(env, cls, "encKey", - "Ljava/lang/String;")); - if (jsEncKey) { - const char *encKey = (*env)->GetStringUTFChars(env, jsEncKey, NULL); - if (encKey && strlen(encKey) != 0) { - cmd->enc_key = strdup(encKey); - } - (*env)->ReleaseStringUTFChars(env, jsEncKey, encKey); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "encKey = %s", cmd->enc_key); -#endif /* #ifndef NDEBUG */ - } - } - // encKeyFile - if (EDGE_TYPE_V2 <= status.edge_type && status.edge_type <= EDGE_TYPE_V3) { - jstring jsEncKeyFile = (*env)->GetObjectField(env, jcmd, - (*env)->GetFieldID(env, cls, "encKeyFile", - "Ljava/lang/String;")); - if (jsEncKeyFile) { - const char *encKeyFile = (*env)->GetStringUTFChars(env, jsEncKeyFile, NULL); - if (encKeyFile && strlen(encKeyFile) != 0) { - cmd->enc_key_file = strdup(encKeyFile); - } - (*env)->ReleaseStringUTFChars(env, jsEncKeyFile, encKeyFile); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "encKeyFile = %s", - cmd->enc_key_file); -#endif /* #ifndef NDEBUG */ - } - } - // macAddr - { - jstring jsMacAddr = (*env)->GetObjectField(env, jcmd, - (*env)->GetFieldID(env, cls, "macAddr", - "Ljava/lang/String;")); - JNI_CHECKNULL(jsMacAddr); - const char *macAddr = (*env)->GetStringUTFChars(env, jsMacAddr, NULL); - if (macAddr && strlen(macAddr) != 0) { - strncpy(cmd->mac_addr, macAddr, EDGE_CMD_MACNAMSIZ); - } - (*env)->ReleaseStringUTFChars(env, jsMacAddr, macAddr); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "macAddr = %s", cmd->mac_addr); -#endif /* #ifndef NDEBUG */ - } - // mtu - { - jint jiMtu = (*env)->GetIntField(env, jcmd, (*env)->GetFieldID(env, cls, "mtu", "I")); - if (jiMtu <= 0) { - return 1; - } - cmd->mtu = jiMtu; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "mtu = %d", cmd->mtu); -#endif /* #ifndef NDEBUG */ - } - // localIP - if (status.edge_type == EDGE_TYPE_V2S) { - jstring jsLocalIP = (*env)->GetObjectField(env, jcmd, - (*env)->GetFieldID(env, cls, "localIP", - "Ljava/lang/String;")); - JNI_CHECKNULL(jsLocalIP); - const char *localIP = (*env)->GetStringUTFChars(env, jsLocalIP, NULL); - if (localIP && strlen(localIP) != 0) { - strncpy(cmd->local_ip, localIP, EDGE_CMD_IPSTR_SIZE); - } - (*env)->ReleaseStringUTFChars(env, jsLocalIP, localIP); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "localIP = %s", cmd->local_ip); -#endif /* #ifndef NDEBUG */ - } - // holePunchInterval - if (status.edge_type == EDGE_TYPE_V2S) { - jint jiHolePunchInterval = (*env)->GetIntField(env, jcmd, (*env)->GetFieldID(env, cls, - "holePunchInterval", - "I")); - if (jiHolePunchInterval <= 0) { - return 1; - } - cmd->holepunch_interval = jiHolePunchInterval; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "holePunchInterval = %d", - cmd->holepunch_interval); -#endif /* #ifndef NDEBUG */ - } - // reResoveSupernodeIP - { - jboolean jbReResoveSupernodeIP = (*env)->GetBooleanField(env, jcmd, - (*env)->GetFieldID(env, cls, - "reResoveSupernodeIP", - "Z")); - cmd->re_resolve_supernode_ip = jbReResoveSupernodeIP ? 1 : 0; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "reResoveSupernodeIP = %d", - cmd->re_resolve_supernode_ip); -#endif /* #ifndef NDEBUG */ - } - // localPort - { - jint jiLocalPort = (*env)->GetIntField(env, jcmd, - (*env)->GetFieldID(env, cls, "localPort", "I")); - if (jiLocalPort < 0) { - return 1; - } - cmd->local_port = jiLocalPort; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "localPort = %d", cmd->local_port); -#endif /* #ifndef NDEBUG */ - } - // allowRouting - { - jboolean jbAllowRouting = (*env)->GetBooleanField(env, jcmd, (*env)->GetFieldID(env, cls, - "allowRouting", - "Z")); - cmd->allow_routing = jbAllowRouting ? 1 : 0; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "allowRouting = %d", cmd->allow_routing); -#endif /* #ifndef NDEBUG */ - } - // dropMuticast - if (status.edge_type == EDGE_TYPE_V2 || status.edge_type == EDGE_TYPE_V2S) { - jboolean jbDropMuticast = (*env)->GetBooleanField(env, jcmd, (*env)->GetFieldID(env, cls, - "dropMuticast", - "Z")); - cmd->drop_multicast = jbDropMuticast ? 1 : 0; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "dropMuticast = %d", - cmd->drop_multicast); -#endif /* #ifndef NDEBUG */ - } - // gatewayIp - { - jstring jbGatewayIp = (*env)->GetObjectField(env, jcmd, (*env)->GetFieldID(env, cls, "gatewayIp", - "Ljava/lang/String;")); - JNI_CHECKNULL(jbGatewayIp); - const char *ipAddr = (*env)->GetStringUTFChars(env, jbGatewayIp, NULL); - if (!ipAddr) { - (*env)->ReleaseStringUTFChars(env, jbGatewayIp, ipAddr); - return 1; - } - strncpy(cmd->gateway_ip, ipAddr, EDGE_CMD_IPSTR_SIZE); - (*env)->ReleaseStringUTFChars(env, jbGatewayIp, ipAddr); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "gatewayIp = %s", cmd->gateway_ip); -#endif /* #ifndef NDEBUG */ - } - // encryptionMode - { - jstring jEncryptionMode = (*env)->GetObjectField(env, jcmd, (*env)->GetFieldID(env, cls, "encryptionMode", - "Ljava/lang/String;")); - JNI_CHECKNULL(jEncryptionMode); - const char *encMode = (*env)->GetStringUTFChars(env, jEncryptionMode, NULL); - if (!encMode) { - (*env)->ReleaseStringUTFChars(env, jEncryptionMode, encMode); - return 1; - } - strncpy(cmd->encryption_mode, encMode, EDGE_CMD_ENCRYPTION_MODE_SIZE); - (*env)->ReleaseStringUTFChars(env, jEncryptionMode, encMode); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "encryptionMode = %s", cmd->encryption_mode); -#endif /* #ifndef NDEBUG */ - } - // httpTunnel - if (status.edge_type == EDGE_TYPE_V1) { - jboolean jbHttpTunnel = (*env)->GetBooleanField(env, jcmd, - (*env)->GetFieldID(env, cls, "httpTunnel", - "Z")); - cmd->http_tunnel = jbHttpTunnel ? 1 : 0; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "httpTunnel = %d", cmd->http_tunnel); -#endif /* #ifndef NDEBUG */ - } - // traceLevel - { - jint jiTraceLevel = (*env)->GetIntField(env, jcmd, - (*env)->GetFieldID(env, cls, "traceLevel", "I")); - cmd->trace_vlevel = jiTraceLevel; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "traceLevel = %d", cmd->trace_vlevel); -#endif /* #ifndef NDEBUG */ - } - // vpnFd - { - jint jiVpnFd = (*env)->GetIntField(env, jcmd, (*env)->GetFieldID(env, cls, "vpnFd", "I")); -#if 0 - if (jiVpnFd < 0) { - return 1; - } -#endif - cmd->vpn_fd = jiVpnFd; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "vpnFd = %d", cmd->vpn_fd); -#endif /* #ifndef NDEBUG */ - } - // logPath - jstring jsLogPath = (*env)->GetObjectField(env, jcmd, (*env)->GetFieldID(env, cls, "logPath", - "Ljava/lang/String;")); - JNI_CHECKNULL(jsLogPath); - const char *logPath = (*env)->GetStringUTFChars(env, jsLogPath, NULL); - if (logPath && strlen(logPath) != 0) { - cmd->logpath = strdup(logPath); - } - (*env)->ReleaseStringUTFChars(env, jsLogPath, logPath); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "logPath = %s", cmd->logpath); -#endif /* #ifndef NDEBUG */ - // devDesc - { - jstring jsDevDesc = (*env)->GetObjectField(env, jcmd, (*env)->GetFieldID(env, cls, "devDesc", - "Ljava/lang/String;")); - JNI_CHECKNULL(jsDevDesc); - const char *devDesc = (*env)->GetStringUTFChars(env, jsDevDesc, NULL); - if (devDesc && strlen(devDesc) != 0) { - cmd->devDesc = strdup(devDesc); - } - (*env)->ReleaseStringUTFChars(env, jsDevDesc, devDesc); -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "devDesc = %s", cmd->devDesc); -#endif /* #ifndef NDEBUG */ - } - // headerEnc - { - jboolean jbHeaderEnc = (*env)->GetBooleanField(env, jcmd, (*env)->GetFieldID(env, cls, - "headerEnc", - "Z")); - cmd->header_encryption = jbHeaderEnc ? 2 : 0; -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", "headerEnc = %d", cmd->header_encryption); -#endif /* #ifndef NDEBUG */ - } - - return 0; -} - -void InitEdgeStatus(void) { - memset(&status.cmd, 0, sizeof(status.cmd)); - status.cmd.enc_key = NULL; - status.cmd.enc_key_file = NULL; - status.cmd.mtu = 1400; - status.cmd.holepunch_interval = EDGE_CMD_HOLEPUNCH_INTERVAL; - status.cmd.re_resolve_supernode_ip = 0; - status.cmd.local_port = 0; - status.cmd.allow_routing = 0; - status.cmd.drop_multicast = 1; - status.cmd.http_tunnel = 0; - status.cmd.trace_vlevel = 1; - status.cmd.vpn_fd = -1; - status.cmd.logpath = NULL; - status.cmd.header_encryption = 0; - - status.tid = -1; - status.jvm = NULL; - status.jobj_service = NULL; - status.jcls_status = NULL; - status.jcls_rs = NULL; - status.start_edge = NULL; - status.stop_edge = NULL; - status.report_edge_status = NULL; - - status.edge_type = EDGE_TYPE_NONE; - status.running_status = EDGE_STAT_DISCONNECT; -} - -void ResetEdgeStatus(JNIEnv *env, uint8_t cleanup) { - static u_int8_t once = 0; - static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; - - if (!once) { - InitEdgeStatus(); - once = 1; - return; - } - - pthread_mutex_lock(&mut); - if (status.tid != -1 || cleanup) { -#ifndef NDEBUG - __android_log_print(ANDROID_LOG_DEBUG, "edge_jni", - "ResetEdgeStatus tid = %ld, cleanup = %d", status.tid, cleanup); -#endif /* #ifndef NDEBUG */ - if (status.stop_edge) { - status.stop_edge(); - } - if (status.tid != -1) { - pthread_join(status.tid, NULL); - } - pthread_mutex_lock(&status.mutex); - if (env) { - if (status.jcls_rs) { - (*env)->DeleteGlobalRef(env, status.jcls_rs); - } - if (status.jcls_status) { - (*env)->DeleteGlobalRef(env, status.jcls_status); - } - if (status.jobj_service) { - (*env)->DeleteGlobalRef(env, status.jobj_service); - } - } - if (status.cmd.enc_key_file) { - free(status.cmd.enc_key_file); - } - if (status.cmd.enc_key) { - free(status.cmd.enc_key); - } - if (status.cmd.logpath) { - free(status.cmd.logpath); - } - InitEdgeStatus(); - pthread_mutex_unlock(&status.mutex); - pthread_mutex_destroy(&status.mutex); - } - pthread_mutex_unlock(&mut); -} - -void *EdgeRoutine(void *ignore) { - int flag = 0; - JNIEnv *env = NULL; - - if (status.jvm) { - if ((*status.jvm)->AttachCurrentThread(status.jvm, &env, NULL) == JNI_OK) { - flag = 1; - } - } - - if (!status.start_edge) { - return NULL; - } - - int ret = status.start_edge(&status); - if (ret) { - pthread_mutex_lock(&status.mutex); - status.running_status = EDGE_STAT_FAILED; - pthread_mutex_unlock(&status.mutex); - report_edge_status(); - } - - if (flag && status.jvm) { - (*status.jvm)->DetachCurrentThread(status.jvm); - } - - return NULL; -} - -void report_edge_status(void) { - if (!status.jvm || !status.jobj_service || !status.jcls_status || !status.jcls_rs || - status.tid == -1) { - return; - } - - const char *running_status = "DISCONNECT"; - pthread_mutex_lock(&status.mutex); - switch (status.running_status) { - case EDGE_STAT_CONNECTING: - running_status = "CONNECTING"; - break; - case EDGE_STAT_CONNECTED: - running_status = "CONNECTED"; - break; - case EDGE_STAT_SUPERNODE_DISCONNECT: - running_status = "SUPERNODE_DISCONNECT"; - break; - case EDGE_STAT_DISCONNECT: - running_status = "DISCONNECT"; - break; - case EDGE_STAT_FAILED: - running_status = "FAILED"; - break; - default: - running_status = "DISCONNECT"; - } - pthread_mutex_unlock(&status.mutex); - - JNIEnv *env = NULL; - if ((*status.jvm)->GetEnv(status.jvm, (void **)&env, JNI_VERSION_1_1) != JNI_OK || !env) { - return; - } - - jmethodID mid = (*env)->GetMethodID(env, status.jcls_status, "", "()V"); - if (!mid) { - return; - } - jobject jStatus = (*env)->NewObject(env, status.jcls_status, mid); - if (!jStatus) { - return; - } - - jfieldID fid = (*env)->GetStaticFieldID(env, status.jcls_rs, running_status, - "Lwang/switchy/hin2n/model/EdgeStatus$RunningStatus;"); - if (!fid) { - (*env)->DeleteLocalRef(env, jStatus); - return; - } - jobject jRunningStatus = (*env)->GetStaticObjectField(env, status.jcls_rs, fid); - if (!jRunningStatus) { - (*env)->DeleteLocalRef(env, jRunningStatus); - (*env)->DeleteLocalRef(env, jStatus); - return; - } - fid = (*env)->GetFieldID(env, status.jcls_status, "runningStatus", - "Lwang/switchy/hin2n/model/EdgeStatus$RunningStatus;"); - if (!fid) { - (*env)->DeleteLocalRef(env, jRunningStatus); - (*env)->DeleteLocalRef(env, jStatus); - return; - } - (*env)->SetObjectField(env, jStatus, fid, jRunningStatus); - - - jclass cls = (*env)->GetObjectClass(env, status.jobj_service); - if (!cls) { - (*env)->DeleteLocalRef(env, jRunningStatus); - (*env)->DeleteLocalRef(env, jStatus); - return; - } - mid = (*env)->GetMethodID(env, cls, "reportEdgeStatus", - "(Lwang/switchy/hin2n/model/EdgeStatus;)V"); - if (!mid) { - (*env)->DeleteLocalRef(env, jRunningStatus); - (*env)->DeleteLocalRef(env, jStatus); - return; - } - (*env)->CallVoidMethod(env, status.jobj_service, mid, jStatus); - - (*env)->DeleteLocalRef(env, jRunningStatus); - (*env)->DeleteLocalRef(env, jStatus); -} diff --git a/Hin2n/src/main/cpp/edge_jni/edge_jni.h b/Hin2n/src/main/cpp/edge_jni/edge_jni.h deleted file mode 100644 index d905cd34..00000000 --- a/Hin2n/src/main/cpp/edge_jni/edge_jni.h +++ /dev/null @@ -1,96 +0,0 @@ -// -// Created by switchwang(https://github.com/switch-st) on 2018-04-13. -// - -#ifndef _EDGE_JNI_H_ -#define _EDGE_JNI_H_ - -#ifdef __ANDROID_NDK__ - -#include -#include - -#define EDGE_CMD_IPSTR_SIZE 16 -#define EDGE_CMD_SUPERNODES_NUM 2 -#define EDGE_CMD_SN_HOST_SIZE 48 -#define EDGE_CMD_MACNAMSIZ 18 -#define EDGE_CMD_COMMUNITY_SIZE 16 -#define EDGE_CMD_HOLEPUNCH_INTERVAL 25 -#define EDGE_CMD_ENCRYPTION_MODE_SIZE 16 - -typedef struct n2n_edge_cmd_st -{ - char ip_mode; - char ip_addr[EDGE_CMD_IPSTR_SIZE]; - char ip_netmask[EDGE_CMD_IPSTR_SIZE]; - char supernodes[EDGE_CMD_SUPERNODES_NUM][EDGE_CMD_SN_HOST_SIZE]; - char community[EDGE_CMD_COMMUNITY_SIZE]; - char* enc_key; - char* enc_key_file; - char mac_addr[EDGE_CMD_MACNAMSIZ]; - unsigned int mtu; - char local_ip[EDGE_CMD_IPSTR_SIZE]; - char gateway_ip[EDGE_CMD_IPSTR_SIZE]; - char encryption_mode[EDGE_CMD_ENCRYPTION_MODE_SIZE]; - unsigned int holepunch_interval; - int re_resolve_supernode_ip; - unsigned int local_port; - int allow_routing; - int drop_multicast; - int http_tunnel; - int trace_vlevel; - int vpn_fd; - char* logpath; - char* devDesc; - int header_encryption; -} n2n_edge_cmd_t; - -enum -{ - EDGE_STAT_CONNECTING, - EDGE_STAT_CONNECTED, - EDGE_STAT_SUPERNODE_DISCONNECT, - EDGE_STAT_DISCONNECT, - EDGE_STAT_FAILED -}; - -enum -{ - EDGE_TYPE_NONE = -1, - EDGE_TYPE_V1, - EDGE_TYPE_V2, - EDGE_TYPE_V2S, - EDGE_TYPE_V3 -}; - -typedef struct n2n_edge_status_st { - pthread_mutex_t mutex; - n2n_edge_cmd_t cmd; - pthread_t tid; - JavaVM *jvm; - jobject jobj_service; - jclass jcls_status; - jclass jcls_rs; - int (*start_edge)(struct n2n_edge_status_st* status); - int (*stop_edge)(void); - void (*report_edge_status)(void); - - uint8_t edge_type; - uint8_t running_status; -} n2n_edge_status_t; - -extern n2n_edge_status_t* g_status; - -extern int start_edge_v1(n2n_edge_status_t* status); -extern int stop_edge_v1(void); -extern int start_edge_v2(n2n_edge_status_t* status); -extern int stop_edge_v2(void); -extern int start_edge_v2s(n2n_edge_status_t* status); -extern int stop_edge_v2s(void); -extern int start_edge_v3(n2n_edge_status_t* status); -extern int stop_edge_v3(void); -extern void report_edge_status(void); - -#endif /* __ANDROID_NDK__ */ - -#endif //_EDGE_ANDROID_H_ diff --git a/Hin2n/src/main/cpp/edge_jni/tuntap_android_v2.c b/Hin2n/src/main/cpp/edge_jni/tuntap_android_v2.c deleted file mode 100644 index fb516b89..00000000 --- a/Hin2n/src/main/cpp/edge_jni/tuntap_android_v2.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see -*/ - -#include "n2n.h" - -#ifdef __ANDROID_NDK__ -#include - -/* ********************************** */ - -/** @brief Open and configure the TAP device for packet read/write. - * - * This routine creates the interface via the tuntap driver then uses ifconfig - * to configure address/mask and MTU. - * - * @param device - [inout] a device info holder object - * @param dev - user-defined name for the new iface, - * if NULL system will assign a name - * @param device_ip - address of iface - * @param device_mask - netmask for device_ip - * @param mtu - MTU for device_ip - * - * @return - negative value on error - * - non-negative file-descriptor on success - */ -int tuntap_open(tuntap_dev *device, - char *dev, /* user-definable interface name, eg. edge0 */ - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - int i, n_matched; - unsigned int mac[6]; - - n_matched = sscanf(device_mac, "%x:%x:%x:%x:%x:%x", mac, mac + 1, mac + 2, mac + 3, mac + 4, mac + 5); - if (n_matched != 6) { - return -1; - } - memset(device->mac_addr, 0, sizeof(device->mac_addr)); - for (i = 0; i < 6; i++) - device->mac_addr[i] = mac[i]; - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - device->mtu = mtu; - strncpy(device->dev_name, dev, N2N_IFNAMSIZ); - return device->fd; -} - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - memset(buf, 0, UIP_LLH_LEN); - int rlen = read(tuntap->fd, buf + UIP_LLH_LEN, len - UIP_LLH_LEN); - if (rlen < 0) { - return rlen; - } - return rlen + UIP_LLH_LEN; -} - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - uip_buf = buf; - uip_len = len; - if (IPBUF->ethhdr.type == htons(UIP_ETHTYPE_IP)) { - int rlen = write(tuntap->fd, buf + UIP_LLH_LEN, len - UIP_LLH_LEN); - if (rlen < 0) { - return rlen; - } - return rlen + UIP_LLH_LEN; - } - return 0; -} - -void tuntap_close(struct tuntap_dev *tuntap) { - if(tuntap->fd > 0) - close(tuntap->fd); -} - -void tuntap_get_address(struct tuntap_dev *tuntap) { -} - -#endif /* #ifdef __ANDROID_NDK__ */ diff --git a/Hin2n/src/main/cpp/n2n_v1 b/Hin2n/src/main/cpp/n2n_v1 deleted file mode 120000 index c61c459a..00000000 --- a/Hin2n/src/main/cpp/n2n_v1 +++ /dev/null @@ -1 +0,0 @@ -../../../../bundles/n2n_meyerd/n2n_v1 \ No newline at end of file diff --git a/Hin2n/src/main/cpp/n2n_v2 b/Hin2n/src/main/cpp/n2n_v2 deleted file mode 120000 index 3b70dd20..00000000 --- a/Hin2n/src/main/cpp/n2n_v2 +++ /dev/null @@ -1 +0,0 @@ -../../../../bundles/n2n_ntop_v2 \ No newline at end of file diff --git a/Hin2n/src/main/cpp/n2n_v2s b/Hin2n/src/main/cpp/n2n_v2s deleted file mode 120000 index 0133d66d..00000000 --- a/Hin2n/src/main/cpp/n2n_v2s +++ /dev/null @@ -1 +0,0 @@ -../../../../bundles/n2n_meyerd/n2n_v2 \ No newline at end of file diff --git a/Hin2n/src/main/cpp/n2n_v3 b/Hin2n/src/main/cpp/n2n_v3 deleted file mode 120000 index 5f1fe9aa..00000000 --- a/Hin2n/src/main/cpp/n2n_v3 +++ /dev/null @@ -1 +0,0 @@ -../../../../bundles/n2n_ntop_v3 \ No newline at end of file diff --git a/Hin2n/src/main/cpp/slog b/Hin2n/src/main/cpp/slog deleted file mode 120000 index 68de9e35..00000000 --- a/Hin2n/src/main/cpp/slog +++ /dev/null @@ -1 +0,0 @@ -../../../../bundles/slog \ No newline at end of file diff --git a/Hin2n/src/main/cpp/tun2tap b/Hin2n/src/main/cpp/tun2tap deleted file mode 120000 index 887be0df..00000000 --- a/Hin2n/src/main/cpp/tun2tap +++ /dev/null @@ -1 +0,0 @@ -../../../../bundles/tun2tap \ No newline at end of file diff --git a/Hin2n/src/main/cpp/uip b/Hin2n/src/main/cpp/uip deleted file mode 120000 index 4e26bd5b..00000000 --- a/Hin2n/src/main/cpp/uip +++ /dev/null @@ -1 +0,0 @@ -../../../../bundles/uip/uip \ No newline at end of file diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/Hin2n.java b/Hin2n/src/main/java/wang/switchy/hin2n/Hin2n.java deleted file mode 100644 index f1322979..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/Hin2n.java +++ /dev/null @@ -1,79 +0,0 @@ -package wang.switchy.hin2n; - -import static android.content.Context.NOTIFICATION_SERVICE; - -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; - -import wang.switchy.hin2n.storage.db.base.DaoMaster; -import wang.switchy.hin2n.storage.db.base.DaoSession; - - -/** - * Created by janiszhang on 2018/4/19. - */ - -public class Hin2n { - - public Context appContext; - - private DaoMaster.DevOpenHelper mHelper; - private SQLiteDatabase db; - private DaoMaster mDaoMaster; - private DaoSession mDaoSession; - - static { - System.loadLibrary("slog"); - System.loadLibrary("uip"); - System.loadLibrary("n2n_v2s"); - // n2n_v2 is part of edge_v2 due to dependency on the g_status - System.loadLibrary("n2n_v1"); - System.loadLibrary("edge_v2s"); - System.loadLibrary("edge_v2"); - System.loadLibrary("edge_v1"); - System.loadLibrary("edge_jni"); - } - - //静态单例 - public static Hin2n instance; - - public static Hin2n getInstance() { - if (instance == null) { - instance = new Hin2n(); - } - return instance; - } - - public void setup(Context context) { - appContext = context; - setDatabase(); - initNotificationChannel(); - } - - /** - * 设置greenDao - */ - private void setDatabase() { - mHelper = new DaoMaster.DevOpenHelper(appContext, "N2N-db", null); - db = mHelper.getWritableDatabase(); - mDaoMaster = new DaoMaster(db); - mDaoSession = mDaoMaster.newSession(); - } - - public SQLiteDatabase getDb() { - return db; - } - - private void initNotificationChannel() { - String id = appContext.getString(R.string.notification_channel_id_default); - String name = appContext.getString(R.string.notification_channel_name_default); - createNotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH); - } - - private void createNotificationChannel(String id, CharSequence name, int importance) { - NotificationManager notificationManager = (NotificationManager) appContext.getSystemService(NOTIFICATION_SERVICE); - notificationManager.createNotificationChannel(new NotificationChannel(id, name, importance)); - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/entity/SettingItemEntity.java b/Hin2n/src/main/java/wang/switchy/hin2n/entity/SettingItemEntity.java deleted file mode 100644 index 88551d7e..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/entity/SettingItemEntity.java +++ /dev/null @@ -1,51 +0,0 @@ -package wang.switchy.hin2n.entity; - -/** - * Created by janiszhang on 2018/5/5. - */ - -public class SettingItemEntity { - private String mSettingName; - private Long mSaveId; - private boolean isSelected; - - public SettingItemEntity(String settingName, Long saveId, boolean isSelected) { - mSettingName = settingName; - mSaveId = saveId; - this.isSelected = isSelected; - } - - public String getSettingName() { - return mSettingName; - } - - public void setSettingName(String settingName) { - mSettingName = settingName; - } - - public Long getSaveId() { - return mSaveId; - } - - public void setSaveId(Long saveId) { - mSaveId = saveId; - } - - public boolean isSelected() { - return isSelected; - } - - public void setSelected(boolean isSelected) { - this.isSelected = isSelected; - } - - public OnMoreBtnClickListener mOnMoreBtnClickListener; - - public void setOnMoreBtnClickListener(OnMoreBtnClickListener onMoreBtnClickListener) { - mOnMoreBtnClickListener = onMoreBtnClickListener; - } - - public interface OnMoreBtnClickListener { - void onClick(int positon); - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/event/ConnectingEvent.java b/Hin2n/src/main/java/wang/switchy/hin2n/event/ConnectingEvent.java deleted file mode 100644 index 2c7e6edc..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/event/ConnectingEvent.java +++ /dev/null @@ -1,8 +0,0 @@ -package wang.switchy.hin2n.event; - -/** - * Created by janiszhang on 2018/6/20. - */ - -public class ConnectingEvent { -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/event/ErrorEvent.java b/Hin2n/src/main/java/wang/switchy/hin2n/event/ErrorEvent.java deleted file mode 100644 index 7d7ab2c2..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/event/ErrorEvent.java +++ /dev/null @@ -1,8 +0,0 @@ -package wang.switchy.hin2n.event; - -/** - * Created by janiszhang on 2018/4/21. - */ - -public class ErrorEvent { -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/event/LogChangeEvent.java b/Hin2n/src/main/java/wang/switchy/hin2n/event/LogChangeEvent.java deleted file mode 100644 index e880757b..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/event/LogChangeEvent.java +++ /dev/null @@ -1,13 +0,0 @@ -package wang.switchy.hin2n.event; - -public class LogChangeEvent { - - private final String txtPath; - public LogChangeEvent(String txtPath){ - this.txtPath = txtPath; - } - - public String getTxtPath() { - return txtPath; - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/event/StartEvent.java b/Hin2n/src/main/java/wang/switchy/hin2n/event/StartEvent.java deleted file mode 100644 index 3d6f4052..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/event/StartEvent.java +++ /dev/null @@ -1,8 +0,0 @@ -package wang.switchy.hin2n.event; - -/** - * Created by janiszhang on 2018/4/21. - */ - -public class StartEvent { -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/event/StopEvent.java b/Hin2n/src/main/java/wang/switchy/hin2n/event/StopEvent.java deleted file mode 100644 index 1163fc72..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/event/StopEvent.java +++ /dev/null @@ -1,8 +0,0 @@ -package wang.switchy.hin2n.event; - -/** - * Created by janiszhang on 2018/4/21. - */ - -public class StopEvent { -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/event/SupernodeDisconnectEvent.java b/Hin2n/src/main/java/wang/switchy/hin2n/event/SupernodeDisconnectEvent.java deleted file mode 100644 index a489949f..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/event/SupernodeDisconnectEvent.java +++ /dev/null @@ -1,8 +0,0 @@ -package wang.switchy.hin2n.event; - -/** - * Created by janiszhang on 2018/6/21. - */ - -public class SupernodeDisconnectEvent { -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/model/EdgeCmd.java b/Hin2n/src/main/java/wang/switchy/hin2n/model/EdgeCmd.java deleted file mode 100644 index eca72709..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/model/EdgeCmd.java +++ /dev/null @@ -1,280 +0,0 @@ -package wang.switchy.hin2n.model; - -import java.util.Random; -import java.util.Vector; - -public class EdgeCmd { - public int edgeType; // 0: v1, 1: v2, 2: v2s 3: v3 - public int ipMode; - public String ipAddr; - public String ipNetmask; - public String[] supernodes; - public String community; - public String devDesc; - public String encKey; - public String encKeyFile; - public String macAddr; - public int mtu; - public String localIP; - public int holePunchInterval; - public boolean reResoveSupernodeIP; - public int localPort; - public boolean allowRouting; - public boolean dropMuticast; - public boolean httpTunnel; - public int traceLevel; - public int vpnFd; - public String gatewayIp; - public String dnsServer; - public String logPath; - public String encryptionMode; - public boolean headerEnc; - - public EdgeCmd(int edgeType, int ipMode, String ipAddr, String ipNetmask, String[] supernodes, String community, - String encKey, String devDesc, String encKeyFile, String macAddr, int mtu, String localIP, int holePunchInterval, - boolean reResoveSupernodeIP, int localPort, boolean allowRouting, boolean dropMuticast, - boolean httpTunnel, int traceLevel, int vpnFd, String logPath, String gatewayIp, String dnsServer, - String encryptionMode, boolean headerEnc) { - this.edgeType = edgeType; - this.ipMode = ipMode; - this.ipAddr = ipAddr; - this.ipNetmask = ipNetmask; - this.supernodes = supernodes; - this.community = community; - this.encKey = encKey; - this.devDesc = devDesc; - this.encKeyFile = encKeyFile; - this.macAddr = macAddr; - this.mtu = mtu; - this.localIP = localIP; - this.holePunchInterval = holePunchInterval; - this.reResoveSupernodeIP = reResoveSupernodeIP; - this.localPort = localPort; - this.allowRouting = allowRouting; - this.dropMuticast = dropMuticast; - this.httpTunnel = httpTunnel; - this.traceLevel = traceLevel; - this.vpnFd = vpnFd; - this.logPath = logPath; - this.gatewayIp = gatewayIp; - this.dnsServer = dnsServer; - this.encryptionMode = encryptionMode; - this.headerEnc = headerEnc; - } - - public EdgeCmd(N2NSettingInfo n2NSettingInfo, int vpnFd, String logPath){ - this.edgeType = n2NSettingInfo.getVersion(); - this.ipMode = n2NSettingInfo.getIpMode(); - this.ipAddr = n2NSettingInfo.getIp(); - this.ipNetmask = n2NSettingInfo.getNetmask(); - this.supernodes = new String[2]; - this.supernodes[0] = n2NSettingInfo.getSuperNode(); - this.supernodes[1] = n2NSettingInfo.getSuperNodeBackup(); - this.community = n2NSettingInfo.getCommunity(); - this.encKey = n2NSettingInfo.getPassword(); - this.devDesc = n2NSettingInfo.getDevDesc(); - this.encKeyFile = ""; - this.macAddr = n2NSettingInfo.getMacAddr(); - this.mtu = n2NSettingInfo.getMtu(); - this.localIP = n2NSettingInfo.getLocalIP(); - this.holePunchInterval = n2NSettingInfo.getHolePunchInterval(); - this.reResoveSupernodeIP = n2NSettingInfo.isResoveSupernodeIP(); - this.localPort = n2NSettingInfo.getLocalPort(); - this.allowRouting = n2NSettingInfo.isAllowRouting(); - this.dropMuticast = n2NSettingInfo.isDropMuticast(); - this.httpTunnel = n2NSettingInfo.isUseHttpTunnel(); - this.traceLevel = n2NSettingInfo.getTraceLevel(); - this.vpnFd = vpnFd; - this.logPath = logPath; - this.gatewayIp = n2NSettingInfo.getGatewayIp(); - this.dnsServer = n2NSettingInfo.getDnsServer(); - this.encryptionMode = n2NSettingInfo.getEncryptionMode(); - this.headerEnc = n2NSettingInfo.isHeaderEnc(); - } - - public boolean checkValues(Vector invalids) { - if (invalids == null) { - invalids = new Vector(); - } - invalids.clear(); - if (!checkIPV4(ipAddr)) { - invalids.add("ipAddr"); - } - if (!checkIPV4Mask(ipNetmask)) { - invalids.add("ipNetmask"); - } - if (supernodes == null || !checkSupernode(supernodes[0]) || - (supernodes[1] != null && !supernodes[1].isEmpty() && !checkSupernode(supernodes[1]))) { - invalids.add("(backup)supernode"); - } - if (!checkCommunity(community)) { - invalids.add("community"); - } - if (!checkEncKey(encKey)) { - invalids.add("encKey"); - } - if (!checkEncKeyFile(encKeyFile)) { - invalids.add("encKeyFile"); - } - if (!checkMacAddr(macAddr)) { - invalids.add("macAddr"); - } - if (!checkInt(mtu, 46, 1500)) { - invalids.add("mut"); - } - if (localIP != null && !localIP.isEmpty() && !checkIPV4(localIP)) { - invalids.add("localIP"); - } - if (!checkInt(holePunchInterval, 10, 120)) { - invalids.add("holePunchInterval"); - } - if (!checkInt(localPort, 0, 65535)) { - invalids.add("localPort"); - } - if (!checkInt(traceLevel, 0, 4)) { - invalids.add("traceLevel"); - } - if (!checkInt(vpnFd, 0, 65535)) { - invalids.add("traceLevel"); - } - if (!gatewayIp.isEmpty() && !checkIPV4(gatewayIp)) { - invalids.add("gatewayIp"); - } - if (!dnsServer.isEmpty() && !checkIPV4(dnsServer)) { - invalids.add("dnsServer"); - } - - return invalids.size() == 0; - } - - public static boolean checkIPV4(String ip) { - if (ip == null || ip.length() < 7 || ip.length() > 15) { - return false; - } - String[] split = ip.split("\\."); - if (split == null || split.length != 4) { - return false; - } - try { - for (int i = 0; i < split.length; ++i) { - int n = Integer.parseInt(split[i]); - if (n < 0 || n > 255 || !String.valueOf(n).equals(split[i])) { - return false; - } - } - } catch (Exception e) { - return false; - } - - return true; - } - - public static boolean checkIPV4Mask(String netmask) { - int[] arr = {0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF}; - if (netmask == null || netmask.length() < 7 || netmask.length() > 15) { - return false; - } - String[] split = netmask.split("\\."); - if (split == null || split.length != 4) { - return false; - } - try { - for (int i = 0; i < split.length; ++i) { - int n = Integer.parseInt(split[i]); - boolean flag = false; - for (int j = 0; j < arr.length; ++j) { - if (n == arr[j]) { - flag = true; - break; - } - } - if (!flag || !String.valueOf(n).equals(split[i])) { - return false; - } - } - } catch (Exception e) { - return false; - } - - return true; - } - - public static boolean checkSupernode(String supernode) { - if (supernode == null || supernode.isEmpty() || supernode.length() > 47) { - return false; - } - String[] split = supernode.split(":"); - if (split == null || split.length != 2 || split[0].isEmpty()) { - return false; - } - int n = Integer.parseInt(split[1]); - if (n < 0 || n > 65535 || !String.valueOf(n).equals(split[1])) { - return false; - } - - return true; - } - - public static boolean checkCommunity(String community) { - if (community == null || community.isEmpty() || community.length() > 15) { - return false; - } - - return true; - } - - public static boolean checkEncKey(String encKey) { - return true; - } - - public static boolean checkEncKeyFile(String encKeyFile) { - return true; - } - - public static boolean checkMacAddr(String mac) { - String hex = "0123456789abcdef"; - if (mac == null || mac.length() != 17) { - return false; - } - for (int i = 0; i < mac.length(); ++i) { - char c = mac.charAt(i); - if ((i + 1) % 3 == 0) { - if (c != ':') { - return false; - } - continue; - } - if (!hex.contains(String.valueOf(c))) { - return false; - } - } - - return true; - } - - public static boolean checkMtu(int mtu) { - return checkInt(mtu, 46, 1500); - } - - public static boolean checkInt(int n, int min, int max) { - if (n < min || n > max) { - return false; - } - - return true; - } - - - public static String getRandomMac() { - String mac = "", hex = "0123456789abcdef"; - Random rand = new Random(); - for (int i = 0; i < 17; ++i) { - if ((i + 1) % 3 == 0) { - mac += ':'; - continue; - } - mac += hex.charAt(rand.nextInt(16)); - } - return mac; - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/model/EdgeStatus.java b/Hin2n/src/main/java/wang/switchy/hin2n/model/EdgeStatus.java deleted file mode 100644 index 6c8b1692..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/model/EdgeStatus.java +++ /dev/null @@ -1,17 +0,0 @@ -package wang.switchy.hin2n.model; - -// -// Created by switchwang(https://github.com/switch-st) on 2018-04-28. -// - -public class EdgeStatus { - public enum RunningStatus { - CONNECTING, // Connecting to N2N network - CONNECTED, // Connect to N2N network successfully - SUPERNODE_DISCONNECT, // Disconnect from the supernode - DISCONNECT, // Disconnect from N2N network - FAILED // Fail to connect to N2N network - } - - public RunningStatus runningStatus; -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/model/N2NSettingInfo.java b/Hin2n/src/main/java/wang/switchy/hin2n/model/N2NSettingInfo.java deleted file mode 100644 index 49c178bd..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/model/N2NSettingInfo.java +++ /dev/null @@ -1,370 +0,0 @@ -package wang.switchy.hin2n.model; - -import android.os.Parcel; -import android.os.Parcelable; - -import wang.switchy.hin2n.storage.db.base.model.N2NSettingModel; - -/** - * Created by janiszhang on 2018/5/11. - */ - -public class N2NSettingInfo implements Parcelable { - - Long id; - String name; - int version; - int ipMode; - String ip; - String netmask; - String community; - /** - * 后续需要加密存储 - */ - String password; - String devDesc; - String superNode; - boolean moreSettings; - String superNodeBackup; - String macAddr; - int mtu; - String localIP; - int holePunchInterval; - boolean resoveSupernodeIP; - int localPort; - boolean allowRouting; - boolean dropMuticast; - int traceLevel; - boolean useHttpTunnel; - String gatewayIp; - String dnsServer; - String encryptionMode; - boolean headerEnc; - - public N2NSettingInfo(N2NSettingModel n2NSettingModel) { - this.id = n2NSettingModel.getId(); - this.name = n2NSettingModel.getName(); - this.version = n2NSettingModel.getVersion(); - this.ipMode = n2NSettingModel.getIpMode(); - this.ip = n2NSettingModel.getIp(); - this.netmask = n2NSettingModel.getNetmask(); - this.community = n2NSettingModel.getCommunity(); - this.password = n2NSettingModel.getPassword(); - this.devDesc = n2NSettingModel.getDevDesc(); - this.superNode = n2NSettingModel.getSuperNode(); - this.moreSettings = n2NSettingModel.getMoreSettings(); - this.superNodeBackup = n2NSettingModel.getSuperNodeBackup(); - this.macAddr = n2NSettingModel.getMacAddr(); - this.mtu = n2NSettingModel.getMtu(); - this.localIP = n2NSettingModel.getLocalIP(); - this.holePunchInterval = n2NSettingModel.getHolePunchInterval(); - this.resoveSupernodeIP = n2NSettingModel.getResoveSupernodeIP(); - this.localPort = n2NSettingModel.getLocalPort(); - this.allowRouting = n2NSettingModel.getAllowRouting(); - this.dropMuticast = n2NSettingModel.getDropMuticast(); - this.traceLevel = n2NSettingModel.getTraceLevel(); - this.useHttpTunnel = n2NSettingModel.isUseHttpTunnel(); - this.gatewayIp = n2NSettingModel.getGatewayIp(); - this.dnsServer = n2NSettingModel.getDnsServer(); - this.encryptionMode = n2NSettingModel.getEncryptionMode(); - this.headerEnc = n2NSettingModel.getHeaderEnc(); - } - - protected N2NSettingInfo(Parcel in) { - id = in.readLong(); - name = in.readString(); - version = in.readInt(); - ipMode = in.readInt(); - ip = in.readString(); - netmask = in.readString(); - community = in.readString(); - password = in.readString(); - devDesc = in.readString(); - superNode = in.readString(); - moreSettings = in.readByte() != 0; - superNodeBackup = in.readString(); - macAddr = in.readString(); - mtu = in.readInt(); - localIP = in.readString(); - holePunchInterval = in.readInt(); - resoveSupernodeIP = in.readByte() != 0; - localPort = in.readInt(); - allowRouting = in.readByte() != 0; - dropMuticast = in.readByte() != 0; - traceLevel = in.readInt(); - useHttpTunnel = in.readByte() != 0; - gatewayIp = in.readString(); - dnsServer = in.readString(); - encryptionMode = in.readString(); - headerEnc = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override - public N2NSettingInfo createFromParcel(Parcel in) { - return new N2NSettingInfo(in); - } - - @Override - public N2NSettingInfo[] newArray(int size) { - return new N2NSettingInfo[size]; - } - }; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getIpMode() {return ipMode;} - - public void setIpMode(int ipMode) { this.ipMode = ipMode; } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getNetmask() { - return netmask; - } - - public void setNetmask(String netmask) { - this.netmask = netmask; - } - - public String getCommunity() { - return community; - } - - public void setCommunity(String community) { - this.community = community; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getSuperNode() { - return superNode; - } - - public void setSuperNode(String superNode) { - this.superNode = superNode; - } - - public String getDevDesc() { return devDesc; } - - public void setDevDesc(String devDesc) { this.devDesc = devDesc; } - - public boolean isMoreSettings() { - return moreSettings; - } - - public void setMoreSettings(boolean moreSettings) { - this.moreSettings = moreSettings; - } - - public String getSuperNodeBackup() { - return superNodeBackup; - } - - public void setSuperNodeBackup(String superNodeBackup) { - this.superNodeBackup = superNodeBackup; - } - - public String getMacAddr() { - return macAddr; - } - - public void setMacAddr(String macAddr) { - this.macAddr = macAddr; - } - - public int getMtu() { - return mtu; - } - - public void setMtu(int mtu) { - this.mtu = mtu; - } - - public String getLocalIP() { - return localIP; - } - - public void setLocalIP(String localIP) { - this.localIP = localIP; - } - - public int getHolePunchInterval() { - return holePunchInterval; - } - - public void setHolePunchInterval(int holePunchInterval) { - this.holePunchInterval = holePunchInterval; - } - - public boolean isResoveSupernodeIP() { - return resoveSupernodeIP; - } - - public void setResoveSupernodeIP(boolean resoveSupernodeIP) { - this.resoveSupernodeIP = resoveSupernodeIP; - } - - public int getLocalPort() { - return localPort; - } - - public void setLocalPort(int localPort) { - this.localPort = localPort; - } - - public boolean isAllowRouting() { - return allowRouting; - } - - public void setAllowRouting(boolean allowRouting) { - this.allowRouting = allowRouting; - } - - public boolean isDropMuticast() { - return dropMuticast; - } - - public void setDropMuticast(boolean dropMuticast) { - this.dropMuticast = dropMuticast; - } - - public int getTraceLevel() { - return traceLevel; - } - - public void setTraceLevel(int traceLevel) { - this.traceLevel = traceLevel; - } - - public int getVersion() { - return version; - } - - public void setVersion(int version) { - this.version = version; - } - - public boolean isUseHttpTunnel() { - return useHttpTunnel; - } - - public void setUseHttpTunnel(boolean useHttpTunnel) { - this.useHttpTunnel = useHttpTunnel; - } - - public String getGatewayIp() { - return gatewayIp; - } - - public String getDnsServer() { - return dnsServer; - } - - public String getEncryptionMode() { return encryptionMode; } - - public boolean isHeaderEnc() { - return headerEnc; - } - - public void setHeaderEnc(boolean headerEnc) { - this.headerEnc = headerEnc; - } - - @Override - public String toString() { - return "N2NSettingInfo{" + - "id=" + id + - ", name='" + name + '\'' + - ", version=" + version + - ", ipMode=" + ipMode + - ", ip='" + ip + '\'' + - ", netmask='" + netmask + '\'' + - ", community='" + community + '\'' + - ", password='" + password + '\'' + - ", devDesc='" + devDesc + '\'' + - ", superNode='" + superNode + '\'' + - ", moreSettings=" + moreSettings + - ", superNodeBackup='" + superNodeBackup + '\'' + - ", macAddr='" + macAddr + '\'' + - ", mtu=" + mtu + - ", localIP='" + localIP + '\'' + - ", holePunchInterval=" + holePunchInterval + - ", resoveSupernodeIP=" + resoveSupernodeIP + - ", localPort=" + localPort + - ", allowRouting=" + allowRouting + - ", dropMuticast=" + dropMuticast + - ", traceLevel=" + traceLevel + - ", useHttpTunnel=" + useHttpTunnel + - ", gatewayIp=" + gatewayIp + - ", dnsServer=" + dnsServer + - ", encryptionMode=" + encryptionMode + - ", headerEnc=" + headerEnc + - '}'; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel parcel, int i) { - if (id == null) { - parcel.writeLong(new Long(-1)); - } else { - parcel.writeLong(id); - } - parcel.writeString(name); - parcel.writeInt(version); - parcel.writeInt(ipMode); - parcel.writeString(ip); - parcel.writeString(netmask); - parcel.writeString(community); - parcel.writeString(password); - parcel.writeString(devDesc); - parcel.writeString(superNode); - parcel.writeByte((byte) (moreSettings ? 1 : 0)); - parcel.writeString(superNodeBackup); - parcel.writeString(macAddr); - parcel.writeInt(mtu); - parcel.writeString(localIP); - parcel.writeInt(holePunchInterval); - parcel.writeByte((byte) (resoveSupernodeIP ? 1 : 0)); - parcel.writeInt(localPort); - parcel.writeByte((byte) (allowRouting ? 1 : 0)); - parcel.writeByte((byte) (dropMuticast ? 1 : 0)); - parcel.writeInt(traceLevel); - parcel.writeByte((byte) (useHttpTunnel ? 1 : 0)); - parcel.writeString(gatewayIp); - parcel.writeString(dnsServer); - parcel.writeString(encryptionMode); - parcel.writeByte((byte) (headerEnc ? 2 : 0)); - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/service/N2NService.java b/Hin2n/src/main/java/wang/switchy/hin2n/service/N2NService.java deleted file mode 100644 index 68b381e1..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/service/N2NService.java +++ /dev/null @@ -1,361 +0,0 @@ -package wang.switchy.hin2n.service; - -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.content.Intent; -import android.graphics.BitmapFactory; -import android.graphics.Color; -import android.net.ConnectivityManager; -import android.net.Network; -import android.net.NetworkCapabilities; -import android.net.NetworkRequest; -import android.net.VpnService; -import android.os.*; - -import android.util.Log; -import android.widget.Toast; - -import androidx.annotation.NonNull; -import androidx.core.app.NotificationCompat; - -import org.greenrobot.eventbus.EventBus; - -import java.io.IOException; - -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; -import wang.switchy.hin2n.R; -import wang.switchy.hin2n.event.*; -import wang.switchy.hin2n.model.EdgeCmd; -import wang.switchy.hin2n.model.EdgeStatus; -import wang.switchy.hin2n.model.N2NSettingInfo; -import wang.switchy.hin2n.tool.IOUtils; -import wang.switchy.hin2n.tool.LogFileObserver; -import wang.switchy.hin2n.tool.ThreadUtils; - -import static wang.switchy.hin2n.model.EdgeStatus.RunningStatus.DISCONNECT; -import static wang.switchy.hin2n.model.EdgeStatus.RunningStatus.SUPERNODE_DISCONNECT; -import static wang.switchy.hin2n.tool.N2nTools.getIpAddrPrefixLength; -import static wang.switchy.hin2n.tool.N2nTools.getRoute; - -/** - * Created by janiszhang on 2018/4/15. - */ - -public class N2NService extends VpnService { - - public static N2NService INSTANCE; - - private ParcelFileDescriptor mParcelFileDescriptor = null; - private EdgeCmd cmd; - N2NSettingInfo mN2nSettingInfo = null; - - private EdgeStatus.RunningStatus mLastStatus = DISCONNECT; - private EdgeStatus.RunningStatus mCurrentStatus = DISCONNECT; - - private static final int sNotificationId = 1; - private NotificationManager mNotificationManager; - private boolean mStopInProgress = false; - private FileObserver mFileObserver; - - @Override - public void onCreate() { - super.onCreate(); - INSTANCE = this; - if (!EventBus.getDefault().isRegistered(this)) { - EventBus.getDefault().register(this); - } - } - - public int EstablishVpnService(String ip, int mask) { - - Builder builder = new Builder() - .setMtu(mN2nSettingInfo.getMtu()) - .addAddress(ip, mask) - .addRoute(getRoute(mN2nSettingInfo.getIp(), mask), mask); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - builder.setMetered(false); - } - - if (!mN2nSettingInfo.getGatewayIp().isEmpty()) { - /* Route all the internet traffic via n2n. Most specific routes "win" over the system default gateway. - * See https://github.com/zerotier/ZeroTierOne/issues/178#issuecomment-204599227 */ - builder.addRoute("0.0.0.0", 1); - builder.addRoute("128.0.0.0", 1); - } - - if (!mN2nSettingInfo.getDnsServer().isEmpty()) { - Log.d("N2NService", "Using DNS server: " + mN2nSettingInfo.getDnsServer()); - builder.addDnsServer(mN2nSettingInfo.getDnsServer()); - } - - String session = getResources().getStringArray(R.array.vpn_session_name)[mN2nSettingInfo.getVersion()]; - try { - mParcelFileDescriptor = builder.setSession(session).establish(); - } catch (IllegalArgumentException e) { - Toast.makeText(INSTANCE, "Parameter is not accepted by the operating system.", Toast.LENGTH_SHORT).show(); - return -1; - } catch (IllegalStateException e) { - Toast.makeText(INSTANCE, "Parameter cannot be applied by the operating system.", Toast.LENGTH_SHORT).show(); - return -1; - } - - if (mParcelFileDescriptor == null) { - EventBus.getDefault().post(new ErrorEvent()); - return -1; - } - - return mParcelFileDescriptor.detachFd(); - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - ConnectivityManager connectivityManager=(ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); - connectivityManager.registerNetworkCallback(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) - .addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED) - .build(),new ConnectivityManager.NetworkCallback(){ - @Override - public void onAvailable(@NonNull Network network) { - super.onAvailable(network); - Network[] networks=new Network[]{network}; - setUnderlyingNetworks(networks); - Log.e("测试","onAvailable"); - } - - @Override - public void onLost(@NonNull Network network) { - super.onLost(network); - setUnderlyingNetworks(null); - Log.e("测试","onLost"); - } - - @Override - public void onCapabilitiesChanged(@NonNull Network network, @NonNull NetworkCapabilities networkCapabilities) { - super.onCapabilitiesChanged(network, networkCapabilities); - Network[] networks=new Network[]{network}; - setUnderlyingNetworks(networks); - Log.e("测试","onCapabilitiesChanged"); - } - }); - if (intent == null) { - EventBus.getDefault().post(new ErrorEvent()); - return super.onStartCommand(intent, flags, startId); - } - - Bundle setting = intent.getBundleExtra("Setting"); - mN2nSettingInfo = setting.getParcelable("n2nSettingInfo"); - - int vpnServiceFd = -1; - if (mN2nSettingInfo.getIpMode() == 0) { - vpnServiceFd = EstablishVpnService(mN2nSettingInfo.getIp(), getIpAddrPrefixLength(mN2nSettingInfo.getNetmask())); - if (vpnServiceFd < 0) { - return super.onStartCommand(intent, flags, startId); - } - } - - String session = getResources().getStringArray(R.array.vpn_session_name)[mN2nSettingInfo.getVersion()]; - cmd = new EdgeCmd(mN2nSettingInfo, vpnServiceFd, getExternalFilesDir("debug") + "/" + session + ".log"); - mFileObserver = new LogFileObserver(cmd.logPath); - mFileObserver.stopWatching(); - IOUtils.clearLogTxt(cmd.logPath); - mFileObserver.startWatching(); - try { - if (!startEdge(cmd)) { - EventBus.getDefault().post(new ErrorEvent()); - } - } catch (Exception e) { - EventBus.getDefault().post(new ErrorEvent()); - } - - String CHANNEL_ONE_ID = "wang.switchy.hin2n"; - String CHANNEL_ONE_NAME = "Channel One"; - NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ONE_ID, - CHANNEL_ONE_NAME, NotificationManager.IMPORTANCE_HIGH); - notificationChannel.enableLights(true); - notificationChannel.setLightColor(Color.RED); - notificationChannel.setShowBadge(true); - notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); - NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - manager.createNotificationChannel(notificationChannel); - - NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,CHANNEL_ONE_ID) - .setTicker("Nature") - .setSmallIcon(R.drawable.ic_craft_table) - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_craft_table)) - .setContentTitle("Hin2n") - .setContentText("Hin2n service is running!"); - Notification notification = notificationBuilder.build(); - notification.flags |= Notification.FLAG_NO_CLEAR; - startForeground(1, notification); - - return super.onStartCommand(intent, flags, startId); - } - - public boolean isStopInProgress() { - return (mStopInProgress); - } - - public boolean stop(final Runnable onStopCallback) { - if (isStopInProgress()) { - Toast.makeText(getApplicationContext(), "a stop command is already in progress", Toast.LENGTH_SHORT).show(); - return (false); - } - - stopForeground(true); - - ThreadUtils.cachedThreadExecutor(() -> { - /* Blocking call */ - stopEdge(); - mStopInProgress = true; - ThreadUtils.mainThreadExecutor(() -> { - mLastStatus = mCurrentStatus = DISCONNECT; - showOrRemoveNotification(CMD_REMOVE_NOTIFICATION); - - try { - if (mParcelFileDescriptor != null) { - mParcelFileDescriptor.close(); - mParcelFileDescriptor = null; - } - } catch (IOException e) { - EventBus.getDefault().post(new ErrorEvent()); - return; - } - - EventBus.getDefault().post(new StopEvent()); - mStopInProgress = false; - if(mFileObserver != null){ - mFileObserver.stopWatching(); //清除日志文件会导致FileObserver失效,要先stop再start - } - if (onStopCallback != null) - onStopCallback.run(); - - }); - }); - return (true); - } - - @Override - public void onRevoke() { - super.onRevoke(); - stop(null); - } - - @Override - public void onDestroy() { - super.onDestroy(); - stop(null); - if (mFileObserver != null) { - mFileObserver.stopWatching(); - } - if (EventBus.getDefault().isRegistered(this)) { - EventBus.getDefault().unregister(this); - } - } - - public native boolean startEdge(EdgeCmd cmd); - - public native void stopEdge(); - - public native EdgeStatus getEdgeStatus(); - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onLogChangeEvent(final LogChangeEvent event) { - EdgeStatus status = getEdgeStatus(); - Log.d("status",status.runningStatus.name()); - reportEdgeStatus(status); - } - - - public void reportEdgeStatus(EdgeStatus status) { - mLastStatus = mCurrentStatus; - mCurrentStatus = status.runningStatus; - - if (mLastStatus == mCurrentStatus) { - return; - } - - switch (status.runningStatus) { - case CONNECTING: - case CONNECTED: - EventBus.getDefault().post(new StartEvent()); - if (mLastStatus == SUPERNODE_DISCONNECT) { - showOrRemoveNotification(CMD_UPDATE_NOTIFICATION); - } - break; - case SUPERNODE_DISCONNECT: - showOrRemoveNotification(CMD_ADD_NOTIFICATION); - EventBus.getDefault().post(new SupernodeDisconnectEvent()); - break; - case DISCONNECT: - EventBus.getDefault().post(new StopEvent()); - if (mLastStatus == SUPERNODE_DISCONNECT) { - showOrRemoveNotification(CMD_REMOVE_NOTIFICATION); - } - break; - case FAILED: - EventBus.getDefault().post(new StopEvent()); - if (mLastStatus == SUPERNODE_DISCONNECT) { - showOrRemoveNotification(CMD_REMOVE_NOTIFICATION); - } - break; - default: - break; - } - } - - public EdgeStatus.RunningStatus getCurrentStatus() { - return mCurrentStatus; - } - - private static final int CMD_REMOVE_NOTIFICATION = 0; - private static final int CMD_ADD_NOTIFICATION = 1; - private static final int CMD_UPDATE_NOTIFICATION = 2; - - //supernode连接断开 supernode连接恢复 连接断开/失败--清除通知栏 - private void showOrRemoveNotification(int cmd) { - switch (cmd) { - case CMD_REMOVE_NOTIFICATION: - if (mNotificationManager == null) { - mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - } - mNotificationManager.cancel(sNotificationId); - break; - case CMD_ADD_NOTIFICATION: - NotificationCompat.Builder builder = new NotificationCompat.Builder(this, getString(R.string.notification_channel_id_default)) - .setSmallIcon(R.drawable.ic_craft_table) - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_craft_table)) - .setContentTitle(getString(R.string.service_title)) - .setContentText(getString(R.string.notify_disconnect)) - .setFullScreenIntent(null, false) - .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) - .setAutoCancel(false); - - Notification notification = builder.build(); - notification.flags |= Notification.FLAG_NO_CLEAR; - if (mNotificationManager == null) { - mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - } - mNotificationManager.notify(sNotificationId, notification); - break; - case CMD_UPDATE_NOTIFICATION: - NotificationCompat.Builder builder2 = new NotificationCompat.Builder(this, getString(R.string.notification_channel_id_default)) - .setSmallIcon(R.drawable.ic_craft_table) - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_craft_table)) - .setContentTitle(getString(R.string.service_title)) - .setContentText(getString(R.string.notify_reconnected)) - .setFullScreenIntent(null, false) - .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) - .setAutoCancel(true); - - Notification notification2 = builder2.build(); - if (mNotificationManager == null) { - mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - } - mNotificationManager.notify(sNotificationId, notification2); - break; - default: - break; - } - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/DaoMaster.java b/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/DaoMaster.java deleted file mode 100644 index 40813b54..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/DaoMaster.java +++ /dev/null @@ -1,96 +0,0 @@ -package wang.switchy.hin2n.storage.db.base; - -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteDatabase.CursorFactory; -import android.util.Log; - -import org.greenrobot.greendao.AbstractDaoMaster; -import org.greenrobot.greendao.database.StandardDatabase; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseOpenHelper; -import org.greenrobot.greendao.identityscope.IdentityScopeType; - - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * Master of DAO (schema version 4): knows all DAOs. - */ -public class DaoMaster extends AbstractDaoMaster { - public static final int SCHEMA_VERSION = 4; - - /** Creates underlying database table using DAOs. */ - public static void createAllTables(Database db, boolean ifNotExists) { - N2NSettingModelDao.createTable(db, ifNotExists); - } - - /** Drops underlying database table using DAOs. */ - public static void dropAllTables(Database db, boolean ifExists) { - N2NSettingModelDao.dropTable(db, ifExists); - } - - /** - * WARNING: Drops all table on Upgrade! Use only during development. - * Convenience method using a {@link DevOpenHelper}. - */ - public static DaoSession newDevSession(Context context, String name) { - Database db = new DevOpenHelper(context, name).getWritableDb(); - DaoMaster daoMaster = new DaoMaster(db); - return daoMaster.newSession(); - } - - public DaoMaster(SQLiteDatabase db) { - this(new StandardDatabase(db)); - } - - public DaoMaster(Database db) { - super(db, SCHEMA_VERSION); - registerDaoClass(N2NSettingModelDao.class); - } - - public DaoSession newSession() { - return new DaoSession(db, IdentityScopeType.Session, daoConfigMap); - } - - public DaoSession newSession(IdentityScopeType type) { - return new DaoSession(db, type, daoConfigMap); - } - - /** - * Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} - - */ - public static abstract class OpenHelper extends DatabaseOpenHelper { - public OpenHelper(Context context, String name) { - super(context, name, SCHEMA_VERSION); - } - - public OpenHelper(Context context, String name, CursorFactory factory) { - super(context, name, factory, SCHEMA_VERSION); - } - - @Override - public void onCreate(Database db) { - Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION); - createAllTables(db, false); - } - } - - /** WARNING: Drops all table on Upgrade! Use only during development. */ - public static class DevOpenHelper extends OpenHelper { - public DevOpenHelper(Context context, String name) { - super(context, name); - } - - public DevOpenHelper(Context context, String name, CursorFactory factory) { - super(context, name, factory); - } - - @Override - public void onUpgrade(Database db, int oldVersion, int newVersion) { - Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables"); - dropAllTables(db, true); - onCreate(db); - } - } - -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/DaoSession.java b/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/DaoSession.java deleted file mode 100644 index fa06d36e..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/DaoSession.java +++ /dev/null @@ -1,48 +0,0 @@ -package wang.switchy.hin2n.storage.db.base; - -import java.util.Map; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.AbstractDaoSession; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.identityscope.IdentityScopeType; -import org.greenrobot.greendao.internal.DaoConfig; - -import wang.switchy.hin2n.storage.db.base.model.N2NSettingModel; - -import wang.switchy.hin2n.storage.db.base.N2NSettingModelDao; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. - -/** - * {@inheritDoc} - * - * @see AbstractDaoSession - */ -public class DaoSession extends AbstractDaoSession { - - private final DaoConfig n2NSettingModelDaoConfig; - - private final N2NSettingModelDao n2NSettingModelDao; - - public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> - daoConfigMap) { - super(db); - - n2NSettingModelDaoConfig = daoConfigMap.get(N2NSettingModelDao.class).clone(); - n2NSettingModelDaoConfig.initIdentityScope(type); - - n2NSettingModelDao = new N2NSettingModelDao(n2NSettingModelDaoConfig, this); - - registerDao(N2NSettingModel.class, n2NSettingModelDao); - } - - public void clear() { - n2NSettingModelDaoConfig.clearIdentityScope(); - } - - public N2NSettingModelDao getN2NSettingModelDao() { - return n2NSettingModelDao; - } - -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/N2NSettingModelDao.java b/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/N2NSettingModelDao.java deleted file mode 100644 index 24b3c553..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/N2NSettingModelDao.java +++ /dev/null @@ -1,375 +0,0 @@ -package wang.switchy.hin2n.storage.db.base; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.internal.DaoConfig; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; - -import wang.switchy.hin2n.storage.db.base.model.N2NSettingModel; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "N2NSettingList". -*/ -public class N2NSettingModelDao extends AbstractDao { - - public static final String TABLENAME = "N2NSettingList"; - - /** - * Properties of entity N2NSettingModel.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property Version = new Property(1, int.class, "version", false, "VERSION"); - public final static Property Name = new Property(2, String.class, "name", false, "NAME"); - public final static Property IpMode = new Property(3, int.class, "ipMode", false, "IP_MODE"); - public final static Property Ip = new Property(4, String.class, "ip", false, "IP"); - public final static Property Netmask = new Property(5, String.class, "netmask", false, "NETMASK"); - public final static Property Community = new Property(6, String.class, "community", false, "COMMUNITY"); - public final static Property Password = new Property(7, String.class, "password", false, "PASSWORD"); - public final static Property DevDesc = new Property(8, String.class, "devDesc", false, "DEV_DESC"); - public final static Property SuperNode = new Property(9, String.class, "superNode", false, "SUPER_NODE"); - public final static Property MoreSettings = new Property(10, boolean.class, "moreSettings", false, "MORE_SETTINGS"); - public final static Property SuperNodeBackup = new Property(11, String.class, "superNodeBackup", false, "SUPER_NODE_BACKUP"); - public final static Property MacAddr = new Property(12, String.class, "macAddr", false, "MAC_ADDR"); - public final static Property Mtu = new Property(13, int.class, "mtu", false, "MTU"); - public final static Property LocalIP = new Property(14, String.class, "localIP", false, "LOCAL_IP"); - public final static Property HolePunchInterval = new Property(15, int.class, "holePunchInterval", false, "HOLE_PUNCH_INTERVAL"); - public final static Property ResoveSupernodeIP = new Property(16, boolean.class, "resoveSupernodeIP", false, "RESOVE_SUPERNODE_IP"); - public final static Property LocalPort = new Property(17, int.class, "localPort", false, "LOCAL_PORT"); - public final static Property AllowRouting = new Property(18, boolean.class, "allowRouting", false, "ALLOW_ROUTING"); - public final static Property DropMuticast = new Property(19, boolean.class, "dropMuticast", false, "DROP_MUTICAST"); - public final static Property UseHttpTunnel = new Property(20, boolean.class, "useHttpTunnel", false, "USE_HTTP_TUNNEL"); - public final static Property TraceLevel = new Property(21, int.class, "traceLevel", false, "TRACE_LEVEL"); - public final static Property IsSelcected = new Property(22, boolean.class, "isSelcected", false, "IS_SELCECTED"); - public final static Property GatewayIp = new Property(23, String.class, "gatewayIp", false, "GATEWAY_IP"); - public final static Property DnsServer = new Property(24, String.class, "dnsServer", false, "DNS_SERVER"); - public final static Property EncryptionMode = new Property(25, String.class, "encryptionMode", false, "ENCRYPTION_MODE"); - public final static Property HeaderEnc = new Property(26, boolean.class, "headerEnc", false, "HEADER_ENC"); - } - - - public N2NSettingModelDao(DaoConfig config) { - super(config); - } - - public N2NSettingModelDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"N2NSettingList\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"VERSION\" INTEGER NOT NULL ," + // 1: version - "\"NAME\" TEXT," + // 2: name - "\"IP_MODE\" INTEGER NOT NULL ," + // 3: ipMode - "\"IP\" TEXT," + // 4: ip - "\"NETMASK\" TEXT," + // 5: netmask - "\"COMMUNITY\" TEXT," + // 6: community - "\"PASSWORD\" TEXT," + // 7: password - "\"DEV_DESC\" TEXT," + // 8: devDesc - "\"SUPER_NODE\" TEXT," + // 9: superNode - "\"MORE_SETTINGS\" INTEGER NOT NULL ," + // 10: moreSettings - "\"SUPER_NODE_BACKUP\" TEXT," + // 11: superNodeBackup - "\"MAC_ADDR\" TEXT," + // 12: macAddr - "\"MTU\" INTEGER NOT NULL ," + // 13: mtu - "\"LOCAL_IP\" TEXT," + // 14: localIP - "\"HOLE_PUNCH_INTERVAL\" INTEGER NOT NULL ," + // 15: holePunchInterval - "\"RESOVE_SUPERNODE_IP\" INTEGER NOT NULL ," + // 16: resoveSupernodeIP - "\"LOCAL_PORT\" INTEGER NOT NULL ," + // 17: localPort - "\"ALLOW_ROUTING\" INTEGER NOT NULL ," + // 18: allowRouting - "\"DROP_MUTICAST\" INTEGER NOT NULL ," + // 19: dropMuticast - "\"USE_HTTP_TUNNEL\" INTEGER NOT NULL ," + // 20: useHttpTunnel - "\"TRACE_LEVEL\" INTEGER NOT NULL ," + // 21: traceLevel - "\"IS_SELCECTED\" INTEGER NOT NULL ," + // 22: isSelcected - "\"GATEWAY_IP\" TEXT," + // 23: gatewayIp - "\"DNS_SERVER\" TEXT," + // 24: dnsServer - "\"ENCRYPTION_MODE\" TEXT ," + // 25: encryptionMode - "\"HEADER_ENC\" INTEGER NOT NULL);"); // 26: headerEnc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"N2NSettingList\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, N2NSettingModel entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - stmt.bindLong(2, entity.getVersion()); - - String name = entity.getName(); - if (name != null) { - stmt.bindString(3, name); - } - stmt.bindLong(4, entity.getIpMode()); - - String ip = entity.getIp(); - if (ip != null) { - stmt.bindString(5, ip); - } - - String netmask = entity.getNetmask(); - if (netmask != null) { - stmt.bindString(6, netmask); - } - - String community = entity.getCommunity(); - if (community != null) { - stmt.bindString(7, community); - } - - String password = entity.getPassword(); - if (password != null) { - stmt.bindString(8, password); - } - - String devDesc = entity.getDevDesc(); - if (devDesc != null) { - stmt.bindString(9, devDesc); - } - - String superNode = entity.getSuperNode(); - if (superNode != null) { - stmt.bindString(10, superNode); - } - stmt.bindLong(11, entity.getMoreSettings() ? 1L: 0L); - - String superNodeBackup = entity.getSuperNodeBackup(); - if (superNodeBackup != null) { - stmt.bindString(12, superNodeBackup); - } - - String macAddr = entity.getMacAddr(); - if (macAddr != null) { - stmt.bindString(13, macAddr); - } - stmt.bindLong(14, entity.getMtu()); - - String localIP = entity.getLocalIP(); - if (localIP != null) { - stmt.bindString(15, localIP); - } - stmt.bindLong(16, entity.getHolePunchInterval()); - stmt.bindLong(17, entity.getResoveSupernodeIP() ? 1L: 0L); - stmt.bindLong(18, entity.getLocalPort()); - stmt.bindLong(19, entity.getAllowRouting() ? 1L: 0L); - stmt.bindLong(20, entity.getDropMuticast() ? 1L: 0L); - stmt.bindLong(21, entity.getUseHttpTunnel() ? 1L: 0L); - stmt.bindLong(22, entity.getTraceLevel()); - stmt.bindLong(23, entity.getIsSelcected() ? 1L: 0L); - - String gatewayIp = entity.getGatewayIp(); - if (gatewayIp != null) { - stmt.bindString(24, gatewayIp); - } - - String dnsServer = entity.getDnsServer(); - if (dnsServer != null) { - stmt.bindString(25, dnsServer); - } - - String encryptionMode = entity.getEncryptionMode(); - if (encryptionMode != null) { - stmt.bindString(26, encryptionMode); - } - stmt.bindLong(27, entity.getHeaderEnc() ? 1L: 0L); - } - - @Override - protected final void bindValues(SQLiteStatement stmt, N2NSettingModel entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - stmt.bindLong(2, entity.getVersion()); - - String name = entity.getName(); - if (name != null) { - stmt.bindString(3, name); - } - stmt.bindLong(4, entity.getIpMode()); - - String ip = entity.getIp(); - if (ip != null) { - stmt.bindString(5, ip); - } - - String netmask = entity.getNetmask(); - if (netmask != null) { - stmt.bindString(6, netmask); - } - - String community = entity.getCommunity(); - if (community != null) { - stmt.bindString(7, community); - } - - String password = entity.getPassword(); - if (password != null) { - stmt.bindString(8, password); - } - - String devDesc = entity.getDevDesc(); - if (devDesc != null) { - stmt.bindString(9, devDesc); - } - - String superNode = entity.getSuperNode(); - if (superNode != null) { - stmt.bindString(10, superNode); - } - stmt.bindLong(11, entity.getMoreSettings() ? 1L: 0L); - - String superNodeBackup = entity.getSuperNodeBackup(); - if (superNodeBackup != null) { - stmt.bindString(12, superNodeBackup); - } - - String macAddr = entity.getMacAddr(); - if (macAddr != null) { - stmt.bindString(13, macAddr); - } - stmt.bindLong(14, entity.getMtu()); - - String localIP = entity.getLocalIP(); - if (localIP != null) { - stmt.bindString(15, localIP); - } - stmt.bindLong(16, entity.getHolePunchInterval()); - stmt.bindLong(17, entity.getResoveSupernodeIP() ? 1L: 0L); - stmt.bindLong(18, entity.getLocalPort()); - stmt.bindLong(19, entity.getAllowRouting() ? 1L: 0L); - stmt.bindLong(20, entity.getDropMuticast() ? 1L: 0L); - stmt.bindLong(21, entity.getUseHttpTunnel() ? 1L: 0L); - stmt.bindLong(22, entity.getTraceLevel()); - stmt.bindLong(23, entity.getIsSelcected() ? 1L: 0L); - - String gatewayIp = entity.getGatewayIp(); - if (gatewayIp != null) { - stmt.bindString(24, gatewayIp); - } - - String dnsServer = entity.getDnsServer(); - if (dnsServer != null) { - stmt.bindString(25, dnsServer); - } - - String encryptionMode = entity.getEncryptionMode(); - if (encryptionMode != null) { - stmt.bindString(26, encryptionMode); - } - stmt.bindLong(27, entity.getHeaderEnc() ? 1L: 0L); - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public N2NSettingModel readEntity(Cursor cursor, int offset) { - N2NSettingModel entity = new N2NSettingModel( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.getInt(offset + 1), // version - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // name - cursor.getInt(offset + 3), // ipMode - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // ip - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // netmask - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // community - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // password - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // devDesc - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // superNode - cursor.getShort(offset + 10) != 0, // moreSettings - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // superNodeBackup - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // macAddr - cursor.getInt(offset + 13), // mtu - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // localIP - cursor.getInt(offset + 15), // holePunchInterval - cursor.getShort(offset + 16) != 0, // resoveSupernodeIP - cursor.getInt(offset + 17), // localPort - cursor.getShort(offset + 18) != 0, // allowRouting - cursor.getShort(offset + 19) != 0, // dropMuticast - cursor.getShort(offset + 20) != 0, // useHttpTunnel - cursor.getInt(offset + 21), // traceLevel - cursor.getShort(offset + 22) != 0, // isSelcected - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // gatewayIp - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // dnsServer - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // encryptionMode - cursor.getShort(offset + 26) != 0 // headerEnc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, N2NSettingModel entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setVersion(cursor.getInt(offset + 1)); - entity.setName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setIpMode(cursor.getInt(offset + 3)); - entity.setIp(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setNetmask(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCommunity(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setPassword(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setDevDesc(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setSuperNode(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setMoreSettings(cursor.getShort(offset + 10) != 0); - entity.setSuperNodeBackup(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setMacAddr(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setMtu(cursor.getInt(offset + 13)); - entity.setLocalIP(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setHolePunchInterval(cursor.getInt(offset + 15)); - entity.setResoveSupernodeIP(cursor.getShort(offset + 16) != 0); - entity.setLocalPort(cursor.getInt(offset + 17)); - entity.setAllowRouting(cursor.getShort(offset + 18) != 0); - entity.setDropMuticast(cursor.getShort(offset + 19) != 0); - entity.setUseHttpTunnel(cursor.getShort(offset + 20) != 0); - entity.setTraceLevel(cursor.getInt(offset + 21)); - entity.setIsSelcected(cursor.getShort(offset + 22) != 0); - entity.setGatewayIp(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setDnsServer(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setEncryptionMode(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setHeaderEnc(cursor.getShort(offset + 26) != 0); - } - - @Override - protected final Long updateKeyAfterInsert(N2NSettingModel entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(N2NSettingModel entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(N2NSettingModel entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/model/N2NSettingModel.java b/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/model/N2NSettingModel.java deleted file mode 100644 index 2d159663..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/storage/db/base/model/N2NSettingModel.java +++ /dev/null @@ -1,329 +0,0 @@ -package wang.switchy.hin2n.storage.db.base.model; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -/** - * Created by janiszhang on 2018/5/4. - */ - -@Entity( - nameInDb = "N2NSettingList"//表名 -) -public class N2NSettingModel /*implements Parcelable*/ { - - @Id(autoincrement = true) - Long id; - int version; - String name; - int ipMode; /* 0 - fix , 1 - from supernode */ - String ip; - String netmask; - String community; - /** - * 后续需要加密存储 - */ - String password; - String devDesc; - String superNode; - boolean moreSettings; - String superNodeBackup; - String macAddr; - int mtu; - String localIP; - int holePunchInterval; - boolean resoveSupernodeIP; - int localPort; - boolean allowRouting; - boolean dropMuticast; - boolean useHttpTunnel; - int traceLevel; - boolean isSelcected; - String gatewayIp; - String dnsServer; - String encryptionMode; - boolean headerEnc; - - - public String getSuperNode() { - return this.superNode; - } - - public void setSuperNode(String superNode) { - this.superNode = superNode; - } - - public String getPassword() { - return this.password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getCommunity() { - return this.community; - } - - public void setCommunity(String community) { - this.community = community; - } - - public int getIpMode() { return this.ipMode; } - - public void setIpMode(int ipMode) { this.ipMode = ipMode; } - - public String getNetmask() { - return this.netmask; - } - - public void setNetmask(String netmask) { - this.netmask = netmask; - } - - public String getIp() { - return this.ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getDevDesc() { return this.devDesc; } - - public void setDevDesc(String devDesc) { this.devDesc = devDesc; } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean getIsSelcected() { - return this.isSelcected; - } - - public void setIsSelcected(boolean isSelcected) { - this.isSelcected = isSelcected; - } - - public int getTraceLevel() { - return this.traceLevel; - } - - public void setTraceLevel(int traceLevel) { - this.traceLevel = traceLevel; - } - - public boolean getDropMuticast() { - return this.dropMuticast; - } - - public void setDropMuticast(boolean dropMuticast) { - this.dropMuticast = dropMuticast; - } - - public boolean getAllowRouting() { - return this.allowRouting; - } - - public void setAllowRouting(boolean allowRouting) { - this.allowRouting = allowRouting; - } - - public int getLocalPort() { - return this.localPort; - } - - public void setLocalPort(int localPort) { - this.localPort = localPort; - } - - public boolean getResoveSupernodeIP() { - return this.resoveSupernodeIP; - } - - public void setResoveSupernodeIP(boolean resoveSupernodeIP) { - this.resoveSupernodeIP = resoveSupernodeIP; - } - - public int getHolePunchInterval() { - return this.holePunchInterval; - } - - public void setHolePunchInterval(int holePunchInterval) { - this.holePunchInterval = holePunchInterval; - } - - public String getLocalIP() { - return this.localIP; - } - - public void setLocalIP(String localIP) { - this.localIP = localIP; - } - - public int getMtu() { - return this.mtu; - } - - public void setMtu(int mtu) { - this.mtu = mtu; - } - - public String getMacAddr() { - return this.macAddr; - } - - public void setMacAddr(String macAddr) { - this.macAddr = macAddr; - } - - public String getSuperNodeBackup() { - return this.superNodeBackup; - } - - public void setSuperNodeBackup(String superNodeBackup) { - this.superNodeBackup = superNodeBackup; - } - - public int getVersion() { - return version; - } - - public void setVersion(int version) { - this.version = version; - } - - public boolean isUseHttpTunnel() { - return useHttpTunnel; - } - - public void setUseHttpTunnel(boolean useHttpTunnel) { - this.useHttpTunnel = useHttpTunnel; - } - - public String getGatewayIp() { - return this.gatewayIp; - } - - public String getDnsServer() { - return this.dnsServer; - } - - public String getEncryptionMode() { - return this.encryptionMode; - } - - public void setGatewayIp(String gatewayIp) { - this.gatewayIp = gatewayIp; - } - - public void setDnsServer(String dnsServer) { - this.dnsServer = dnsServer; - } - - public void setEncryptionMode(String mode) { this.encryptionMode = mode; } - - public boolean getHeaderEnc() { - return this.headerEnc; - } - - public void setHeaderEnc(boolean headerEnc) { - this.headerEnc = headerEnc; - } - - @Generated - public N2NSettingModel(Long id, int version, String name, int ipMode, String ip, String netmask, String community, String password, String devDesc, - String superNode, boolean moreSettings, String superNodeBackup, String macAddr, int mtu, String localIP, int holePunchInterval, - boolean resoveSupernodeIP, int localPort, boolean allowRouting, boolean dropMuticast, boolean useHttpTunnel, int traceLevel, - boolean isSelcected, String gatewayIp, String dnsServer, String encryptionMode, boolean headerEnc) { - this.id = id; - this.version = version; - this.name = name; - this.ipMode = ipMode; - this.ip = ip; - this.netmask = netmask; - this.community = community; - this.password = password; - this.devDesc = devDesc; - this.superNode = superNode; - this.moreSettings = moreSettings; - this.superNodeBackup = superNodeBackup; - this.macAddr = macAddr; - this.mtu = mtu; - this.localIP = localIP; - this.holePunchInterval = holePunchInterval; - this.resoveSupernodeIP = resoveSupernodeIP; - this.localPort = localPort; - this.allowRouting = allowRouting; - this.dropMuticast = dropMuticast; - this.useHttpTunnel = useHttpTunnel; - this.traceLevel = traceLevel; - this.isSelcected = isSelcected; - this.gatewayIp = gatewayIp; - this.dnsServer = dnsServer; - this.encryptionMode = encryptionMode; - this.headerEnc = headerEnc; - } - - @Generated - public N2NSettingModel() { - } - - public boolean getMoreSettings() { - return this.moreSettings; - } - - public void setMoreSettings(boolean moreSettings) { - this.moreSettings = moreSettings; - } - - @Override - public String toString() { - return "N2NSettingModel{" + - "id=" + id + - ", version=" + version + - ", name='" + name + '\'' + - ", ipMode='" + ipMode + '\'' + - ", ip='" + ip + '\'' + - ", netmask='" + netmask + '\'' + - ", community='" + community + '\'' + - ", password='" + password + '\'' + - ", devDesc='" + devDesc + '\'' + - ", superNode='" + superNode + '\'' + - ", moreSettings=" + moreSettings + - ", superNodeBackup='" + superNodeBackup + '\'' + - ", macAddr='" + macAddr + '\'' + - ", mtu=" + mtu + - ", localIP='" + localIP + '\'' + - ", holePunchInterval=" + holePunchInterval + - ", resoveSupernodeIP=" + resoveSupernodeIP + - ", localPort=" + localPort + - ", allowRouting=" + allowRouting + - ", dropMuticast=" + dropMuticast + - ", useHttpTunnel=" + useHttpTunnel + - ", traceLevel=" + traceLevel + - ", isSelcected=" + isSelcected + - ", gatewayIp=" + gatewayIp + - ", dnsServer=" + dnsServer + - ", encryptionMode =" + encryptionMode + - ", headerEnc =" + headerEnc + - '}'; - } - - public boolean getUseHttpTunnel() { - return this.useHttpTunnel; - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/tool/IOUtils.java b/Hin2n/src/main/java/wang/switchy/hin2n/tool/IOUtils.java deleted file mode 100644 index bb46b273..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/tool/IOUtils.java +++ /dev/null @@ -1,96 +0,0 @@ -package wang.switchy.hin2n.tool; - - -import java.io.*; - -public class IOUtils { - - public static String readTxt(String txtPath){ - File file = new File(txtPath); - if(file.isFile() && file.exists()){ - FileInputStream fileInputStream = null; - InputStreamReader inputStreamReader = null; - BufferedReader bufferedReader = null; - try { - fileInputStream = new FileInputStream(file); - inputStreamReader = new InputStreamReader(fileInputStream); - bufferedReader = new BufferedReader(inputStreamReader); - StringBuilder stringBuilder = new StringBuilder(); - String text = null; - while ((text = bufferedReader.readLine()) != null){ - stringBuilder.append(text); - stringBuilder.append("\n"); - } - return stringBuilder.toString(); - }catch (Exception e) { - e.printStackTrace(); - }finally { - close(fileInputStream); - close(inputStreamReader); - close(bufferedReader); - } - } - return ""; - } - - public static String readTxtLimit(String txtPath,int size){ - File file = new File(txtPath); - if(file.isFile() && file.exists()){ - RandomAccessFile randomAccessFile = null; - try { - randomAccessFile = new RandomAccessFile(file, "r"); - long length = randomAccessFile.length(); - long start = 0; - if(length > size){ - start = length - size; - } - randomAccessFile.seek(start); - StringBuilder stringBuilder = new StringBuilder(); - String text = null; - while ((text = randomAccessFile.readLine()) != null){ - stringBuilder.append(text); - stringBuilder.append("\n"); - } - return stringBuilder.toString(); - }catch (Exception e) { - e.printStackTrace(); - }finally { - close(randomAccessFile); - } - } - return ""; - } - - public static boolean clearLogTxt(String txtPath){ - File file = new File(txtPath); - File fileBak = new File(txtPath+".bak"); - if(file.exists()){ - if(fileBak.exists()){ - fileBak.delete(); - } - try { - file.renameTo(fileBak); - return file.createNewFile(); - } catch (IOException e) { - e.printStackTrace(); - } - } else { - try { - return file.createNewFile(); - } catch (IOException e) { - e.printStackTrace(); - } - } - return false; - } - - public static void close(Closeable closeable){ - try { - if(null != closeable){ - closeable.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/tool/LogFileObserver.java b/Hin2n/src/main/java/wang/switchy/hin2n/tool/LogFileObserver.java deleted file mode 100644 index b9809338..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/tool/LogFileObserver.java +++ /dev/null @@ -1,54 +0,0 @@ -package wang.switchy.hin2n.tool; - -import android.os.FileObserver; -import android.util.Log; - -import androidx.annotation.Nullable; - -import org.greenrobot.eventbus.EventBus; -import wang.switchy.hin2n.event.LogChangeEvent; - -public class LogFileObserver extends FileObserver { - - int action; - String txtPath; - public LogFileObserver(String path) { - this(path,ALL_EVENTS); - } - - public LogFileObserver(String path, int mask) { - super(path, mask); - this.txtPath = path; - } - - @Override - public void onEvent(int event, @Nullable String path) { - action = event & FileObserver.ALL_EVENTS; - switch (action){ -// case FileObserver.ACCESS: -// Log.d("LogFileObserver","event: 文件或目录被访问, path: " + path); -// EventBus.getDefault().post(new LogChangeEvent(txtPath)); -// break; - - case FileObserver.DELETE: - Log.d("LogFileObserver","event: 文件或目录被删除, path: " + path); - EventBus.getDefault().post(new LogChangeEvent(txtPath)); - break; - -// case FileObserver.OPEN: -// Log.d("LogFileObserver","event: 文件或目录被打开, path: " + path); -// EventBus.getDefault().post(new LogChangeEvent(txtPath)); -// break; - - case FileObserver.MODIFY: - Log.d("LogFileObserver","event: 文件或目录被修改, path: " + path); - EventBus.getDefault().post(new LogChangeEvent(txtPath)); - break; - - case FileObserver.CREATE: - Log.d("LogFileObserver","event: 文件或目录被创建, path: " + path); - EventBus.getDefault().post(new LogChangeEvent(txtPath)); - break; - } - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/tool/N2nTools.java b/Hin2n/src/main/java/wang/switchy/hin2n/tool/N2nTools.java deleted file mode 100644 index 8fb9dcae..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/tool/N2nTools.java +++ /dev/null @@ -1,108 +0,0 @@ -package wang.switchy.hin2n.tool; - -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.net.VpnService; -import android.util.TypedValue; - -import java.net.InetAddress; - -/** - * Created by janiszhang on 2018/5/23. - */ - -public class N2nTools { - public static final String MetaUmengAppKey = "UMENG_APPKEY"; - public static final String MetaUmengChannel = "UMENG_CHANNEL"; - public static final String MetaBuglyAppId = "BUGLY_APPID"; - public static final String MetaShareWxAppId = "SHARE_WX_APPID"; - public static final String MetaShareWxAppSecret = "SHARE_WX_APPSECRET"; - public static final String MetaShareWbAppId = "SHARE_WB_APPID"; - public static final String MetaShareWbAppSecret = "SHARE_WB_APPSECRET"; - - - public static int dp2px(Context context, int dp) { - - return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()); - } - - public static String getVersionName(Context context) { - PackageManager packageManager = context.getPackageManager(); - try { - PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); - return packageInfo.versionName; - } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); - } - - return ""; - } - - public static int getVersionCode(Context context) { - PackageManager packageManager = context.getPackageManager(); - try { - PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); - return packageInfo.versionCode; - } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); - } - - return 0; - } - - public static String getMetaData(Context context, String key) { - try { - return context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA).metaData.getString(key, ""); - } catch (Exception e) { - e.printStackTrace(); - } - - return ""; - } - - public static int getIpAddrPrefixLength(String netmask) { - try { - byte[] byteAddr = InetAddress.getByName(netmask).getAddress(); - int prefixLength = 0; - for (int i = 0; i < byteAddr.length; i++) { - for (int j = 0; j < 8; j++) { - if ((byteAddr[i] << j & 0xFF) != 0) { - prefixLength++; - } else { - return prefixLength; - } - } - } - return prefixLength; - } catch (Exception e) { - return -1; - } - } - - public static String getRoute(String ipAddr, int prefixLength) { - byte[] arr = {(byte) 0x00, (byte) 0x80, (byte) 0xC0, (byte) 0xE0, (byte) 0xF0, (byte) 0xF8, (byte) 0xFC, (byte) 0xFE, (byte) 0xFF}; - - if (prefixLength > 32 || prefixLength < 0) { - return ""; - } - try { - byte[] byteAddr = InetAddress.getByName(ipAddr).getAddress(); - int idx = 0; - while (prefixLength >= 8) { - idx++; - prefixLength -= 8; - } - if (idx < byteAddr.length) { - byteAddr[idx++] &= arr[prefixLength]; - } - for (; idx < byteAddr.length; idx++) { - byteAddr[idx] = (byte) 0x00; - } - return InetAddress.getByAddress(byteAddr).getHostAddress(); - } catch (Exception e) { - return ""; - } - } -} diff --git a/Hin2n/src/main/java/wang/switchy/hin2n/tool/ThreadUtils.java b/Hin2n/src/main/java/wang/switchy/hin2n/tool/ThreadUtils.java deleted file mode 100644 index c3d5a27c..00000000 --- a/Hin2n/src/main/java/wang/switchy/hin2n/tool/ThreadUtils.java +++ /dev/null @@ -1,20 +0,0 @@ -package wang.switchy.hin2n.tool; - -import android.os.Handler; -import android.os.Looper; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class ThreadUtils { - private final static ExecutorService cachedThreadExecutor = Executors.newCachedThreadPool(); - private final static Handler mHandler = new Handler(Looper.getMainLooper()); - - public static void cachedThreadExecutor(Runnable runnable){ - cachedThreadExecutor.execute(runnable); - } - - public static void mainThreadExecutor(Runnable runnable){ - mHandler.post(runnable); - } -} diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/aes.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/aes.h deleted file mode 100644 index 245c552a..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/aes.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_AES_H -# define HEADER_AES_H - -# include - -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define AES_ENCRYPT 1 -# define AES_DECRYPT 0 - -/* - * Because array size can't be a const in C, the following two are macros. - * Both sizes are in bytes. - */ -# define AES_MAXNR 14 -# define AES_BLOCK_SIZE 16 - -/* This should be a hidden type, but EVP requires that the size be known */ -struct aes_key_st { -# ifdef AES_LONG - unsigned long rd_key[4 * (AES_MAXNR + 1)]; -# else - unsigned int rd_key[4 * (AES_MAXNR + 1)]; -# endif - int rounds; -}; -typedef struct aes_key_st AES_KEY; - -const char *AES_options(void); - -int AES_set_encrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); -int AES_set_decrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); - -void AES_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); -void AES_decrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); - -void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key, const int enc); -void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, const int enc); -void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num); -/* NB: the IV is _two_ blocks long */ -void AES_ige_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, const int enc); -/* NB: the IV is _four_ blocks long */ -void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - const AES_KEY *key2, const unsigned char *ivec, - const int enc); - -int AES_wrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); -int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); - - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1.h deleted file mode 100644 index 9522eec1..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1.h +++ /dev/null @@ -1,886 +0,0 @@ -/* - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_ASN1_H -# define HEADER_ASN1_H - -# include -# include -# include -# include -# include -# include -# include - -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -# define V_ASN1_UNIVERSAL 0x00 -# define V_ASN1_APPLICATION 0x40 -# define V_ASN1_CONTEXT_SPECIFIC 0x80 -# define V_ASN1_PRIVATE 0xc0 - -# define V_ASN1_CONSTRUCTED 0x20 -# define V_ASN1_PRIMITIVE_TAG 0x1f -# define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG - -# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */ -# define V_ASN1_OTHER -3/* used in ASN1_TYPE */ -# define V_ASN1_ANY -4/* used in ASN1 template code */ - -# define V_ASN1_UNDEF -1 -/* ASN.1 tag values */ -# define V_ASN1_EOC 0 -# define V_ASN1_BOOLEAN 1 /**/ -# define V_ASN1_INTEGER 2 -# define V_ASN1_BIT_STRING 3 -# define V_ASN1_OCTET_STRING 4 -# define V_ASN1_NULL 5 -# define V_ASN1_OBJECT 6 -# define V_ASN1_OBJECT_DESCRIPTOR 7 -# define V_ASN1_EXTERNAL 8 -# define V_ASN1_REAL 9 -# define V_ASN1_ENUMERATED 10 -# define V_ASN1_UTF8STRING 12 -# define V_ASN1_SEQUENCE 16 -# define V_ASN1_SET 17 -# define V_ASN1_NUMERICSTRING 18 /**/ -# define V_ASN1_PRINTABLESTRING 19 -# define V_ASN1_T61STRING 20 -# define V_ASN1_TELETEXSTRING 20/* alias */ -# define V_ASN1_VIDEOTEXSTRING 21 /**/ -# define V_ASN1_IA5STRING 22 -# define V_ASN1_UTCTIME 23 -# define V_ASN1_GENERALIZEDTIME 24 /**/ -# define V_ASN1_GRAPHICSTRING 25 /**/ -# define V_ASN1_ISO64STRING 26 /**/ -# define V_ASN1_VISIBLESTRING 26/* alias */ -# define V_ASN1_GENERALSTRING 27 /**/ -# define V_ASN1_UNIVERSALSTRING 28 /**/ -# define V_ASN1_BMPSTRING 30 - -/* - * NB the constants below are used internally by ASN1_INTEGER - * and ASN1_ENUMERATED to indicate the sign. They are *not* on - * the wire tag values. - */ - -# define V_ASN1_NEG 0x100 -# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) -# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) - -/* For use with d2i_ASN1_type_bytes() */ -# define B_ASN1_NUMERICSTRING 0x0001 -# define B_ASN1_PRINTABLESTRING 0x0002 -# define B_ASN1_T61STRING 0x0004 -# define B_ASN1_TELETEXSTRING 0x0004 -# define B_ASN1_VIDEOTEXSTRING 0x0008 -# define B_ASN1_IA5STRING 0x0010 -# define B_ASN1_GRAPHICSTRING 0x0020 -# define B_ASN1_ISO64STRING 0x0040 -# define B_ASN1_VISIBLESTRING 0x0040 -# define B_ASN1_GENERALSTRING 0x0080 -# define B_ASN1_UNIVERSALSTRING 0x0100 -# define B_ASN1_OCTET_STRING 0x0200 -# define B_ASN1_BIT_STRING 0x0400 -# define B_ASN1_BMPSTRING 0x0800 -# define B_ASN1_UNKNOWN 0x1000 -# define B_ASN1_UTF8STRING 0x2000 -# define B_ASN1_UTCTIME 0x4000 -# define B_ASN1_GENERALIZEDTIME 0x8000 -# define B_ASN1_SEQUENCE 0x10000 -/* For use with ASN1_mbstring_copy() */ -# define MBSTRING_FLAG 0x1000 -# define MBSTRING_UTF8 (MBSTRING_FLAG) -# define MBSTRING_ASC (MBSTRING_FLAG|1) -# define MBSTRING_BMP (MBSTRING_FLAG|2) -# define MBSTRING_UNIV (MBSTRING_FLAG|4) -# define SMIME_OLDMIME 0x400 -# define SMIME_CRLFEOL 0x800 -# define SMIME_STREAM 0x1000 - struct X509_algor_st; -DEFINE_STACK_OF(X509_ALGOR) - -# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */ -/* - * This indicates that the ASN1_STRING is not a real value but just a place - * holder for the location where indefinite length constructed data should be - * inserted in the memory buffer - */ -# define ASN1_STRING_FLAG_NDEF 0x010 - -/* - * This flag is used by the CMS code to indicate that a string is not - * complete and is a place holder for content when it had all been accessed. - * The flag will be reset when content has been written to it. - */ - -# define ASN1_STRING_FLAG_CONT 0x020 -/* - * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING - * type. - */ -# define ASN1_STRING_FLAG_MSTRING 0x040 -/* String is embedded and only content should be freed */ -# define ASN1_STRING_FLAG_EMBED 0x080 -/* String should be parsed in RFC 5280's time format */ -# define ASN1_STRING_FLAG_X509_TIME 0x100 -/* This is the base type that holds just about everything :-) */ -struct asn1_string_st { - int length; - int type; - unsigned char *data; - /* - * The value of the following field depends on the type being held. It - * is mostly being used for BIT_STRING so if the input data has a - * non-zero 'unused bits' value, it will be handled correctly - */ - long flags; -}; - -/* - * ASN1_ENCODING structure: this is used to save the received encoding of an - * ASN1 type. This is useful to get round problems with invalid encodings - * which can break signatures. - */ - -typedef struct ASN1_ENCODING_st { - unsigned char *enc; /* DER encoding */ - long len; /* Length of encoding */ - int modified; /* set to 1 if 'enc' is invalid */ -} ASN1_ENCODING; - -/* Used with ASN1 LONG type: if a long is set to this it is omitted */ -# define ASN1_LONG_UNDEF 0x7fffffffL - -# define STABLE_FLAGS_MALLOC 0x01 -/* - * A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted - * as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting - * STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias - * STABLE_FLAGS_CLEAR to reflect this. - */ -# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC -# define STABLE_NO_MASK 0x02 -# define DIRSTRING_TYPE \ - (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) -# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) - -typedef struct asn1_string_table_st { - int nid; - long minsize; - long maxsize; - unsigned long mask; - unsigned long flags; -} ASN1_STRING_TABLE; - -DEFINE_STACK_OF(ASN1_STRING_TABLE) - -/* size limits: this stuff is taken straight from RFC2459 */ - -# define ub_name 32768 -# define ub_common_name 64 -# define ub_locality_name 128 -# define ub_state_name 128 -# define ub_organization_name 64 -# define ub_organization_unit_name 64 -# define ub_title 64 -# define ub_email_address 128 - -/* - * Declarations for template structures: for full definitions see asn1t.h - */ -typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; -typedef struct ASN1_TLC_st ASN1_TLC; -/* This is just an opaque pointer */ -typedef struct ASN1_VALUE_st ASN1_VALUE; - -/* Declare ASN1 functions: the implement macro in in asn1t.h */ - -# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) - -# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) - -# define DECLARE_ASN1_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) - -# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) - -# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ - type *d2i_##name(type **a, const unsigned char **in, long len); \ - int i2d_##name(type *a, unsigned char **out); \ - DECLARE_ASN1_ITEM(itname) - -# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ - type *d2i_##name(type **a, const unsigned char **in, long len); \ - int i2d_##name(const type *a, unsigned char **out); \ - DECLARE_ASN1_ITEM(name) - -# define DECLARE_ASN1_NDEF_FUNCTION(name) \ - int i2d_##name##_NDEF(name *a, unsigned char **out); - -# define DECLARE_ASN1_FUNCTIONS_const(name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) - -# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - type *name##_new(void); \ - void name##_free(type *a); - -# define DECLARE_ASN1_PRINT_FUNCTION(stname) \ - DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) - -# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ - int fname##_print_ctx(BIO *out, stname *x, int indent, \ - const ASN1_PCTX *pctx); - -# define D2I_OF(type) type *(*)(type **,const unsigned char **,long) -# define I2D_OF(type) int (*)(type *,unsigned char **) -# define I2D_OF_const(type) int (*)(const type *,unsigned char **) - -# define CHECKED_D2I_OF(type, d2i) \ - ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) -# define CHECKED_I2D_OF(type, i2d) \ - ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) -# define CHECKED_NEW_OF(type, xnew) \ - ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) -# define CHECKED_PTR_OF(type, p) \ - ((void*) (1 ? p : (type*)0)) -# define CHECKED_PPTR_OF(type, p) \ - ((void**) (1 ? p : (type**)0)) - -# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) -# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) -# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) - -TYPEDEF_D2I2D_OF(void); - -/*- - * The following macros and typedefs allow an ASN1_ITEM - * to be embedded in a structure and referenced. Since - * the ASN1_ITEM pointers need to be globally accessible - * (possibly from shared libraries) they may exist in - * different forms. On platforms that support it the - * ASN1_ITEM structure itself will be globally exported. - * Other platforms will export a function that returns - * an ASN1_ITEM pointer. - * - * To handle both cases transparently the macros below - * should be used instead of hard coding an ASN1_ITEM - * pointer in a structure. - * - * The structure will look like this: - * - * typedef struct SOMETHING_st { - * ... - * ASN1_ITEM_EXP *iptr; - * ... - * } SOMETHING; - * - * It would be initialised as e.g.: - * - * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; - * - * and the actual pointer extracted with: - * - * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); - * - * Finally an ASN1_ITEM pointer can be extracted from an - * appropriate reference with: ASN1_ITEM_rptr(X509). This - * would be used when a function takes an ASN1_ITEM * argument. - * - */ - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM ASN1_ITEM_EXP; - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -# define ASN1_ITEM_ptr(iptr) (iptr) - -/* Macro to include ASN1_ITEM pointer from base type */ -# define ASN1_ITEM_ref(iptr) (&(iptr##_it)) - -# define ASN1_ITEM_rptr(ref) (&(ref##_it)) - -# define DECLARE_ASN1_ITEM(name) \ - OPENSSL_EXTERN const ASN1_ITEM name##_it; - -# else - -/* - * Platforms that can't easily handle shared global variables are declared as - * functions returning ASN1_ITEM pointers. - */ - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM *ASN1_ITEM_EXP (void); - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -# define ASN1_ITEM_ptr(iptr) (iptr()) - -/* Macro to include ASN1_ITEM pointer from base type */ -# define ASN1_ITEM_ref(iptr) (iptr##_it) - -# define ASN1_ITEM_rptr(ref) (ref##_it()) - -# define DECLARE_ASN1_ITEM(name) \ - const ASN1_ITEM * name##_it(void); - -# endif - -/* Parameters used by ASN1_STRING_print_ex() */ - -/* - * These determine which characters to escape: RFC2253 special characters, - * control characters and MSB set characters - */ - -# define ASN1_STRFLGS_ESC_2253 1 -# define ASN1_STRFLGS_ESC_CTRL 2 -# define ASN1_STRFLGS_ESC_MSB 4 - -/* - * This flag determines how we do escaping: normally RC2253 backslash only, - * set this to use backslash and quote. - */ - -# define ASN1_STRFLGS_ESC_QUOTE 8 - -/* These three flags are internal use only. */ - -/* Character is a valid PrintableString character */ -# define CHARTYPE_PRINTABLESTRING 0x10 -/* Character needs escaping if it is the first character */ -# define CHARTYPE_FIRST_ESC_2253 0x20 -/* Character needs escaping if it is the last character */ -# define CHARTYPE_LAST_ESC_2253 0x40 - -/* - * NB the internal flags are safely reused below by flags handled at the top - * level. - */ - -/* - * If this is set we convert all character strings to UTF8 first - */ - -# define ASN1_STRFLGS_UTF8_CONVERT 0x10 - -/* - * If this is set we don't attempt to interpret content: just assume all - * strings are 1 byte per character. This will produce some pretty odd - * looking output! - */ - -# define ASN1_STRFLGS_IGNORE_TYPE 0x20 - -/* If this is set we include the string type in the output */ -# define ASN1_STRFLGS_SHOW_TYPE 0x40 - -/* - * This determines which strings to display and which to 'dump' (hex dump of - * content octets or DER encoding). We can only dump non character strings or - * everything. If we don't dump 'unknown' they are interpreted as character - * strings with 1 octet per character and are subject to the usual escaping - * options. - */ - -# define ASN1_STRFLGS_DUMP_ALL 0x80 -# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 - -/* - * These determine what 'dumping' does, we can dump the content octets or the - * DER encoding: both use the RFC2253 #XXXXX notation. - */ - -# define ASN1_STRFLGS_DUMP_DER 0x200 - -/* - * This flag specifies that RC2254 escaping shall be performed. - */ -#define ASN1_STRFLGS_ESC_2254 0x400 - -/* - * All the string flags consistent with RFC2253, escaping control characters - * isn't essential in RFC2253 but it is advisable anyway. - */ - -# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ - ASN1_STRFLGS_ESC_CTRL | \ - ASN1_STRFLGS_ESC_MSB | \ - ASN1_STRFLGS_UTF8_CONVERT | \ - ASN1_STRFLGS_DUMP_UNKNOWN | \ - ASN1_STRFLGS_DUMP_DER) - -DEFINE_STACK_OF(ASN1_INTEGER) - -DEFINE_STACK_OF(ASN1_GENERALSTRING) - -DEFINE_STACK_OF(ASN1_UTF8STRING) - -typedef struct asn1_type_st { - int type; - union { - char *ptr; - ASN1_BOOLEAN boolean; - ASN1_STRING *asn1_string; - ASN1_OBJECT *object; - ASN1_INTEGER *integer; - ASN1_ENUMERATED *enumerated; - ASN1_BIT_STRING *bit_string; - ASN1_OCTET_STRING *octet_string; - ASN1_PRINTABLESTRING *printablestring; - ASN1_T61STRING *t61string; - ASN1_IA5STRING *ia5string; - ASN1_GENERALSTRING *generalstring; - ASN1_BMPSTRING *bmpstring; - ASN1_UNIVERSALSTRING *universalstring; - ASN1_UTCTIME *utctime; - ASN1_GENERALIZEDTIME *generalizedtime; - ASN1_VISIBLESTRING *visiblestring; - ASN1_UTF8STRING *utf8string; - /* - * set and sequence are left complete and still contain the set or - * sequence bytes - */ - ASN1_STRING *set; - ASN1_STRING *sequence; - ASN1_VALUE *asn1_value; - } value; -} ASN1_TYPE; - -DEFINE_STACK_OF(ASN1_TYPE) - -typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; - -DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) -DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) - -/* This is used to contain a list of bit names */ -typedef struct BIT_STRING_BITNAME_st { - int bitnum; - const char *lname; - const char *sname; -} BIT_STRING_BITNAME; - -# define B_ASN1_TIME \ - B_ASN1_UTCTIME | \ - B_ASN1_GENERALIZEDTIME - -# define B_ASN1_PRINTABLE \ - B_ASN1_NUMERICSTRING| \ - B_ASN1_PRINTABLESTRING| \ - B_ASN1_T61STRING| \ - B_ASN1_IA5STRING| \ - B_ASN1_BIT_STRING| \ - B_ASN1_UNIVERSALSTRING|\ - B_ASN1_BMPSTRING|\ - B_ASN1_UTF8STRING|\ - B_ASN1_SEQUENCE|\ - B_ASN1_UNKNOWN - -# define B_ASN1_DIRECTORYSTRING \ - B_ASN1_PRINTABLESTRING| \ - B_ASN1_TELETEXSTRING|\ - B_ASN1_BMPSTRING|\ - B_ASN1_UNIVERSALSTRING|\ - B_ASN1_UTF8STRING - -# define B_ASN1_DISPLAYTEXT \ - B_ASN1_IA5STRING| \ - B_ASN1_VISIBLESTRING| \ - B_ASN1_BMPSTRING|\ - B_ASN1_UTF8STRING - -DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) - -int ASN1_TYPE_get(const ASN1_TYPE *a); -void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); -int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); -int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); - -ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t); -void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t); - -ASN1_OBJECT *ASN1_OBJECT_new(void); -void ASN1_OBJECT_free(ASN1_OBJECT *a); -int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp); -ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, - long length); - -DECLARE_ASN1_ITEM(ASN1_OBJECT) - -DEFINE_STACK_OF(ASN1_OBJECT) - -ASN1_STRING *ASN1_STRING_new(void); -void ASN1_STRING_free(ASN1_STRING *a); -void ASN1_STRING_clear_free(ASN1_STRING *a); -int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); -ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a); -ASN1_STRING *ASN1_STRING_type_new(int type); -int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); - /* - * Since this is used to store all sorts of things, via macros, for now, - * make its data void * - */ -int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); -void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); -int ASN1_STRING_length(const ASN1_STRING *x); -void ASN1_STRING_length_set(ASN1_STRING *x, int n); -int ASN1_STRING_type(const ASN1_STRING *x); -DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) -const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); - -DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) -int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); -int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); -int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); -int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, - const unsigned char *flags, int flags_len); - -int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, - BIT_STRING_BITNAME *tbl, int indent); -int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); -int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, - BIT_STRING_BITNAME *tbl); - -DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) -ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, - long length); -ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x); -int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); - -DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) - -int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); -ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); -ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, - int offset_day, long offset_sec); -int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); -int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); - -int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); -ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, - time_t t); -ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, - time_t t, int offset_day, - long offset_sec); -int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); - -int ASN1_TIME_diff(int *pday, int *psec, - const ASN1_TIME *from, const ASN1_TIME *to); - -DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) -ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); -int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, - const ASN1_OCTET_STRING *b); -int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, - int len); - -DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_NULL) -DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) - -int UTF8_getc(const unsigned char *str, int len, unsigned long *val); -int UTF8_putc(unsigned char *str, int len, unsigned long value); - -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) - -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) -DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) -DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) -DECLARE_ASN1_FUNCTIONS(ASN1_TIME) - -DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) - -ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); -ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, - int offset_day, long offset_sec); -int ASN1_TIME_check(const ASN1_TIME *t); -ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, - ASN1_GENERALIZEDTIME **out); -int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); -int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str); -int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm); -int ASN1_TIME_normalize(ASN1_TIME *s); -int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t); -int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b); - -int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); -int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); -int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a); -int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); -int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a); -int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); -int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type); -int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a); - -int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); -ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, - const char *sn, const char *ln); - -int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); -int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); -int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); -int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); - -int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); -long ASN1_INTEGER_get(const ASN1_INTEGER *a); -ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); -BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); - -int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); -int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); - - -int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); -long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); -ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); -BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn); - -/* General */ -/* given a string, return the correct type, max is the maximum length */ -int ASN1_PRINTABLE_type(const unsigned char *s, int max); - -unsigned long ASN1_tag2bit(int tag); - -/* SPECIALS */ -int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, - int *pclass, long omax); -int ASN1_check_infinite_end(unsigned char **p, long len); -int ASN1_const_check_infinite_end(const unsigned char **p, long len); -void ASN1_put_object(unsigned char **pp, int constructed, int length, - int tag, int xclass); -int ASN1_put_eoc(unsigned char **pp); -int ASN1_object_size(int constructed, int length, int tag); - -/* Used to implement other functions */ -void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); - -# define ASN1_dup_of(type,i2d,d2i,x) \ - ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ - CHECKED_D2I_OF(type, d2i), \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_dup_of_const(type,i2d,d2i,x) \ - ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ - CHECKED_D2I_OF(type, d2i), \ - CHECKED_PTR_OF(const type, x))) - -void *ASN1_item_dup(const ASN1_ITEM *it, void *x); - -/* ASN1 alloc/free macros for when a type is only used internally */ - -# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) -# define M_ASN1_free_of(x, type) \ - ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) - -# ifndef OPENSSL_NO_STDIO -void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x); - -# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ - ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ - CHECKED_D2I_OF(type, d2i), \ - in, \ - CHECKED_PPTR_OF(type, x))) - -void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); -int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x); - -# define ASN1_i2d_fp_of(type,i2d,out,x) \ - (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ - out, \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_i2d_fp_of_const(type,i2d,out,x) \ - (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ - out, \ - CHECKED_PTR_OF(const type, x))) - -int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); -int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); -# endif - -int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in); - -void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x); - -# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ - ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ - CHECKED_D2I_OF(type, d2i), \ - in, \ - CHECKED_PPTR_OF(type, x))) - -void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); -int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x); - -# define ASN1_i2d_bio_of(type,i2d,out,x) \ - (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ - out, \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_i2d_bio_of_const(type,i2d,out,x) \ - (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ - out, \ - CHECKED_PTR_OF(const type, x))) - -int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); -int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); -int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); -int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); -int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); -int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); -int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off); -int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, - unsigned char *buf, int off); -int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); -int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, - int dump); -const char *ASN1_tag2str(int tag); - -/* Used to load and write Netscape format cert */ - -int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); - -int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); -int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len); -int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, - unsigned char *data, int len); -int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, - unsigned char *data, int max_len); - -void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it); - -ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, - ASN1_OCTET_STRING **oct); - -void ASN1_STRING_set_default_mask(unsigned long mask); -int ASN1_STRING_set_default_mask_asc(const char *p); -unsigned long ASN1_STRING_get_default_mask(void); -int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask); -int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask, - long minsize, long maxsize); - -ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, - const unsigned char *in, int inlen, - int inform, int nid); -ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); -int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); -void ASN1_STRING_TABLE_cleanup(void); - -/* ASN1 template functions */ - -/* Old API compatible functions */ -ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); -void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); -ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, - long len, const ASN1_ITEM *it); -int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); -int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, - const ASN1_ITEM *it); - -void ASN1_add_oid_module(void); -void ASN1_add_stable_module(void); - -ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf); -ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf); -int ASN1_str2mask(const char *str, unsigned long *pmask); - -/* ASN1 Print flags */ - -/* Indicate missing OPTIONAL fields */ -# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 -/* Mark start and end of SEQUENCE */ -# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 -/* Mark start and end of SEQUENCE/SET OF */ -# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 -/* Show the ASN1 type of primitives */ -# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 -/* Don't show ASN1 type of ANY */ -# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 -/* Don't show ASN1 type of MSTRINGs */ -# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 -/* Don't show field names in SEQUENCE */ -# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 -/* Show structure names of each SEQUENCE field */ -# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 -/* Don't show structure name even at top level */ -# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 - -int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, - const ASN1_ITEM *it, const ASN1_PCTX *pctx); -ASN1_PCTX *ASN1_PCTX_new(void); -void ASN1_PCTX_free(ASN1_PCTX *p); -unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); - -ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx)); -void ASN1_SCTX_free(ASN1_SCTX *p); -const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p); -const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p); -unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); -void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); -void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); - -const BIO_METHOD *BIO_f_asn1(void); - -BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); - -int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, - const ASN1_ITEM *it); -int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, - const char *hdr, const ASN1_ITEM *it); -int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, - int ctype_nid, int econt_nid, - STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); -ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); -int SMIME_crlf_copy(BIO *in, BIO *out, int flags); -int SMIME_text(BIO *in, BIO *out); - -const ASN1_ITEM *ASN1_ITEM_lookup(const char *name); -const ASN1_ITEM *ASN1_ITEM_get(size_t i); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1_mac.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1_mac.h deleted file mode 100644 index 7ac1782a..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1_mac.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2015-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 - */ - -#error "This file is obsolete; please update your software." diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1err.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1err.h deleted file mode 100644 index faed5a55..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1err.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - * 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_ASN1ERR_H -# define HEADER_ASN1ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# 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_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_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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1t.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1t.h deleted file mode 100644 index a450ba0d..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asn1t.h +++ /dev/null @@ -1,945 +0,0 @@ -/* - * Copyright 2000-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_ASN1T_H -# define HEADER_ASN1T_H - -# include -# include -# include - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -/* ASN1 template defines, structures and functions */ - -#ifdef __cplusplus -extern "C" { -#endif - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) - -/* Macros for start and end of ASN1_ITEM definition */ - -# define ASN1_ITEM_start(itname) \ - const ASN1_ITEM itname##_it = { - -# define static_ASN1_ITEM_start(itname) \ - static const ASN1_ITEM itname##_it = { - -# define ASN1_ITEM_end(itname) \ - }; - -# else - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)())) - -/* Macros for start and end of ASN1_ITEM definition */ - -# define ASN1_ITEM_start(itname) \ - const ASN1_ITEM * itname##_it(void) \ - { \ - static const ASN1_ITEM local_it = { - -# define static_ASN1_ITEM_start(itname) \ - static ASN1_ITEM_start(itname) - -# define ASN1_ITEM_end(itname) \ - }; \ - return &local_it; \ - } - -# endif - -/* Macros to aid ASN1 template writing */ - -# define ASN1_ITEM_TEMPLATE(tname) \ - static const ASN1_TEMPLATE tname##_item_tt - -# define ASN1_ITEM_TEMPLATE_END(tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_PRIMITIVE,\ - -1,\ - &tname##_item_tt,\ - 0,\ - NULL,\ - 0,\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_ITEM_TEMPLATE_END(tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_PRIMITIVE,\ - -1,\ - &tname##_item_tt,\ - 0,\ - NULL,\ - 0,\ - #tname \ - ASN1_ITEM_end(tname) - -/* This is a ASN1 type which just embeds a template */ - -/*- - * This pair helps declare a SEQUENCE. We can do: - * - * ASN1_SEQUENCE(stname) = { - * ... SEQUENCE components ... - * } ASN1_SEQUENCE_END(stname) - * - * This will produce an ASN1_ITEM called stname_it - * for a structure called stname. - * - * If you want the same structure but a different - * name then use: - * - * ASN1_SEQUENCE(itname) = { - * ... SEQUENCE components ... - * } ASN1_SEQUENCE_END_name(stname, itname) - * - * This will create an item called itname_it using - * a structure called stname. - */ - -# define ASN1_SEQUENCE(tname) \ - static const ASN1_TEMPLATE tname##_seq_tt[] - -# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) - -# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) - -# define ASN1_SEQUENCE_END_name(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #tname \ - ASN1_ITEM_end(tname) - -# define static_ASN1_SEQUENCE_END_name(stname, tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_NDEF_SEQUENCE(tname) \ - ASN1_SEQUENCE(tname) - -# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ - ASN1_SEQUENCE_cb(tname, cb) - -# define ASN1_SEQUENCE_cb(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_BROKEN_SEQUENCE(tname) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_SEQUENCE_ref(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_SEQUENCE_enc(tname, enc, cb) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_NDEF_SEQUENCE_END(tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(tname),\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_NDEF_SEQUENCE_END(tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(tname),\ - #tname \ - ASN1_ITEM_end(tname) - -# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) -# define static_ASN1_BROKEN_SEQUENCE_END(stname) \ - static_ASN1_SEQUENCE_END_ref(stname, stname) - -# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) - -# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) -# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) - -# define ASN1_SEQUENCE_END_ref(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_SEQUENCE_END_ref(stname, tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -/*- - * This pair helps declare a CHOICE type. We can do: - * - * ASN1_CHOICE(chname) = { - * ... CHOICE options ... - * ASN1_CHOICE_END(chname) - * - * This will produce an ASN1_ITEM called chname_it - * for a structure called chname. The structure - * definition must look like this: - * typedef struct { - * int type; - * union { - * ASN1_SOMETHING *opt1; - * ASN1_SOMEOTHER *opt2; - * } value; - * } chname; - * - * the name of the selector must be 'type'. - * to use an alternative selector name use the - * ASN1_CHOICE_END_selector() version. - */ - -# define ASN1_CHOICE(tname) \ - static const ASN1_TEMPLATE tname##_ch_tt[] - -# define ASN1_CHOICE_cb(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ - ASN1_CHOICE(tname) - -# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) - -# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) - -# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) - -# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) - -# define ASN1_CHOICE_END_selector(stname, tname, selname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_CHOICE_END_cb(stname, tname, selname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -/* This helps with the template wrapper form of ASN1_ITEM */ - -# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ - (flags), (tag), 0,\ - #name, ASN1_ITEM_ref(type) } - -/* These help with SEQUENCE or CHOICE components */ - -/* used to declare other types */ - -# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ - (flags), (tag), offsetof(stname, field),\ - #field, ASN1_ITEM_ref(type) } - -/* implicit and explicit helper macros */ - -# define ASN1_IMP_EX(stname, field, type, tag, ex) \ - ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type) - -# define ASN1_EXP_EX(stname, field, type, tag, ex) \ - ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type) - -/* Any defined by macros: the field used is in the table itself */ - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -# else -# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } -# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } -# endif -/* Plain simple type */ -# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) -/* Embedded simple type */ -# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type) - -/* OPTIONAL simple type */ -# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) -# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type) - -/* IMPLICIT tagged simple type */ -# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) -# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) - -/* IMPLICIT tagged OPTIONAL simple type */ -# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) -# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) - -/* Same as above but EXPLICIT */ - -# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) -# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) -# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) -# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) - -/* SEQUENCE OF type */ -# define ASN1_SEQUENCE_OF(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) - -/* OPTIONAL SEQUENCE OF */ -# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) - -/* Same as above but for SET OF */ - -# define ASN1_SET_OF(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) - -# define ASN1_SET_OF_OPT(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) - -/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ - -# define ASN1_IMP_SET_OF(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) - -# define ASN1_EXP_SET_OF(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) - -# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) - -# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) - -# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) - -/* EXPLICIT using indefinite length constructed form */ -# define ASN1_NDEF_EXP(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) - -/* EXPLICIT OPTIONAL using indefinite length constructed form */ -# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) - -/* Macros for the ASN1_ADB structure */ - -# define ASN1_ADB(name) \ - static const ASN1_ADB_TABLE name##_adbtbl[] - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ - ;\ - static const ASN1_ADB name##_adb = {\ - flags,\ - offsetof(name, field),\ - adb_cb,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - } - -# else - -# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ - ;\ - static const ASN1_ITEM *name##_adb(void) \ - { \ - static const ASN1_ADB internal_adb = \ - {\ - flags,\ - offsetof(name, field),\ - adb_cb,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - }; \ - return (const ASN1_ITEM *) &internal_adb; \ - } \ - void dummy_function(void) - -# endif - -# define ADB_ENTRY(val, template) {val, template} - -# define ASN1_ADB_TEMPLATE(name) \ - static const ASN1_TEMPLATE name##_tt - -/* - * This is the ASN1 template structure that defines a wrapper round the - * actual type. It determines the actual position of the field in the value - * structure, various flags such as OPTIONAL and the field name. - */ - -struct ASN1_TEMPLATE_st { - unsigned long flags; /* Various flags */ - long tag; /* tag, not used if no tagging */ - unsigned long offset; /* Offset of this field in structure */ - const char *field_name; /* Field name */ - ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ -}; - -/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ - -# define ASN1_TEMPLATE_item(t) (t->item_ptr) -# define ASN1_TEMPLATE_adb(t) (t->item_ptr) - -typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; -typedef struct ASN1_ADB_st ASN1_ADB; - -struct ASN1_ADB_st { - unsigned long flags; /* Various flags */ - unsigned long offset; /* Offset of selector field */ - int (*adb_cb)(long *psel); /* Application callback */ - const ASN1_ADB_TABLE *tbl; /* Table of possible types */ - long tblcount; /* Number of entries in tbl */ - const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ - const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ -}; - -struct ASN1_ADB_TABLE_st { - long value; /* NID for an object or value for an int */ - const ASN1_TEMPLATE tt; /* item for this value */ -}; - -/* template flags */ - -/* Field is optional */ -# define ASN1_TFLG_OPTIONAL (0x1) - -/* Field is a SET OF */ -# define ASN1_TFLG_SET_OF (0x1 << 1) - -/* Field is a SEQUENCE OF */ -# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) - -/* - * Special case: this refers to a SET OF that will be sorted into DER order - * when encoded *and* the corresponding STACK will be modified to match the - * new order. - */ -# define ASN1_TFLG_SET_ORDER (0x3 << 1) - -/* Mask for SET OF or SEQUENCE OF */ -# define ASN1_TFLG_SK_MASK (0x3 << 1) - -/* - * These flags mean the tag should be taken from the tag field. If EXPLICIT - * then the underlying type is used for the inner tag. - */ - -/* IMPLICIT tagging */ -# define ASN1_TFLG_IMPTAG (0x1 << 3) - -/* EXPLICIT tagging, inner tag from underlying type */ -# define ASN1_TFLG_EXPTAG (0x2 << 3) - -# define ASN1_TFLG_TAG_MASK (0x3 << 3) - -/* context specific IMPLICIT */ -# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT) - -/* context specific EXPLICIT */ -# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT) - -/* - * If tagging is in force these determine the type of tag to use. Otherwise - * the tag is determined by the underlying type. These values reflect the - * actual octet format. - */ - -/* Universal tag */ -# define ASN1_TFLG_UNIVERSAL (0x0<<6) -/* Application tag */ -# define ASN1_TFLG_APPLICATION (0x1<<6) -/* Context specific tag */ -# define ASN1_TFLG_CONTEXT (0x2<<6) -/* Private tag */ -# define ASN1_TFLG_PRIVATE (0x3<<6) - -# define ASN1_TFLG_TAG_CLASS (0x3<<6) - -/* - * These are for ANY DEFINED BY type. In this case the 'item' field points to - * an ASN1_ADB structure which contains a table of values to decode the - * relevant type - */ - -# define ASN1_TFLG_ADB_MASK (0x3<<8) - -# define ASN1_TFLG_ADB_OID (0x1<<8) - -# define ASN1_TFLG_ADB_INT (0x1<<9) - -/* - * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes - * indefinite length constructed encoding to be used if required. - */ - -# define ASN1_TFLG_NDEF (0x1<<11) - -/* Field is embedded and not a pointer */ -# define ASN1_TFLG_EMBED (0x1 << 12) - -/* This is the actual ASN1 item itself */ - -struct ASN1_ITEM_st { - char itype; /* The item type, primitive, SEQUENCE, CHOICE - * or extern */ - long utype; /* underlying type */ - const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains - * the contents */ - long tcount; /* Number of templates if SEQUENCE or CHOICE */ - const void *funcs; /* functions that handle this type */ - long size; /* Structure size (usually) */ - const char *sname; /* Structure name */ -}; - -/*- - * These are values for the itype field and - * determine how the type is interpreted. - * - * For PRIMITIVE types the underlying type - * determines the behaviour if items is NULL. - * - * Otherwise templates must contain a single - * template and the type is treated in the - * same way as the type specified in the template. - * - * For SEQUENCE types the templates field points - * to the members, the size field is the - * structure size. - * - * For CHOICE types the templates field points - * to each possible member (typically a union) - * and the 'size' field is the offset of the - * selector. - * - * The 'funcs' field is used for application - * specific functions. - * - * The EXTERN type uses a new style d2i/i2d. - * The new style should be used where possible - * because it avoids things like the d2i IMPLICIT - * hack. - * - * MSTRING is a multiple string type, it is used - * for a CHOICE of character strings where the - * actual strings all occupy an ASN1_STRING - * structure. In this case the 'utype' field - * has a special meaning, it is used as a mask - * of acceptable types using the B_ASN1 constants. - * - * NDEF_SEQUENCE is the same as SEQUENCE except - * that it will use indefinite length constructed - * encoding if requested. - * - */ - -# define ASN1_ITYPE_PRIMITIVE 0x0 - -# define ASN1_ITYPE_SEQUENCE 0x1 - -# define ASN1_ITYPE_CHOICE 0x2 - -# define ASN1_ITYPE_EXTERN 0x4 - -# define ASN1_ITYPE_MSTRING 0x5 - -# define ASN1_ITYPE_NDEF_SEQUENCE 0x6 - -/* - * Cache for ASN1 tag and length, so we don't keep re-reading it for things - * like CHOICE - */ - -struct ASN1_TLC_st { - char valid; /* Values below are valid */ - int ret; /* return value */ - long plen; /* length */ - int ptag; /* class value */ - int pclass; /* class value */ - int hdrlen; /* header length */ -}; - -/* Typedefs for ASN1 function pointers */ -typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, - const ASN1_ITEM *it, int tag, int aclass, char opt, - ASN1_TLC *ctx); - -typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, - const ASN1_ITEM *it, int tag, int aclass); -typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); -typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); - -typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, - int indent, const char *fname, - const ASN1_PCTX *pctx); - -typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, - int *putype, const ASN1_ITEM *it); -typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, - int len, int utype, char *free_cont, - const ASN1_ITEM *it); -typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, - const ASN1_ITEM *it, int indent, - const ASN1_PCTX *pctx); - -typedef struct ASN1_EXTERN_FUNCS_st { - void *app_data; - ASN1_ex_new_func *asn1_ex_new; - ASN1_ex_free_func *asn1_ex_free; - ASN1_ex_free_func *asn1_ex_clear; - ASN1_ex_d2i *asn1_ex_d2i; - ASN1_ex_i2d *asn1_ex_i2d; - ASN1_ex_print_func *asn1_ex_print; -} ASN1_EXTERN_FUNCS; - -typedef struct ASN1_PRIMITIVE_FUNCS_st { - void *app_data; - unsigned long flags; - ASN1_ex_new_func *prim_new; - ASN1_ex_free_func *prim_free; - ASN1_ex_free_func *prim_clear; - ASN1_primitive_c2i *prim_c2i; - ASN1_primitive_i2c *prim_i2c; - ASN1_primitive_print *prim_print; -} ASN1_PRIMITIVE_FUNCS; - -/* - * This is the ASN1_AUX structure: it handles various miscellaneous - * requirements. For example the use of reference counts and an informational - * callback. The "informational callback" is called at various points during - * the ASN1 encoding and decoding. It can be used to provide minor - * customisation of the structures used. This is most useful where the - * supplied routines *almost* do the right thing but need some extra help at - * a few points. If the callback returns zero then it is assumed a fatal - * error has occurred and the main operation should be abandoned. If major - * changes in the default behaviour are required then an external type is - * more appropriate. - */ - -typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, - void *exarg); - -typedef struct ASN1_AUX_st { - void *app_data; - int flags; - int ref_offset; /* Offset of reference value */ - int ref_lock; /* Lock type to use */ - ASN1_aux_cb *asn1_cb; - int enc_offset; /* Offset of ASN1_ENCODING structure */ -} ASN1_AUX; - -/* For print related callbacks exarg points to this structure */ -typedef struct ASN1_PRINT_ARG_st { - BIO *out; - int indent; - const ASN1_PCTX *pctx; -} ASN1_PRINT_ARG; - -/* For streaming related callbacks exarg points to this structure */ -typedef struct ASN1_STREAM_ARG_st { - /* BIO to stream through */ - BIO *out; - /* BIO with filters appended */ - BIO *ndef_bio; - /* Streaming I/O boundary */ - unsigned char **boundary; -} ASN1_STREAM_ARG; - -/* Flags in ASN1_AUX */ - -/* Use a reference count */ -# define ASN1_AFLG_REFCOUNT 1 -/* Save the encoding of structure (useful for signatures) */ -# define ASN1_AFLG_ENCODING 2 -/* The Sequence length is invalid */ -# define ASN1_AFLG_BROKEN 4 - -/* operation values for asn1_cb */ - -# define ASN1_OP_NEW_PRE 0 -# define ASN1_OP_NEW_POST 1 -# define ASN1_OP_FREE_PRE 2 -# define ASN1_OP_FREE_POST 3 -# define ASN1_OP_D2I_PRE 4 -# define ASN1_OP_D2I_POST 5 -# define ASN1_OP_I2D_PRE 6 -# define ASN1_OP_I2D_POST 7 -# define ASN1_OP_PRINT_PRE 8 -# define ASN1_OP_PRINT_POST 9 -# define ASN1_OP_STREAM_PRE 10 -# define ASN1_OP_STREAM_POST 11 -# define ASN1_OP_DETACHED_PRE 12 -# define ASN1_OP_DETACHED_POST 13 - -/* Macro to implement a primitive type */ -# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) -# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ - ASN1_ITEM_start(itname) \ - ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ - ASN1_ITEM_end(itname) - -/* Macro to implement a multi string type */ -# define IMPLEMENT_ASN1_MSTRING(itname, mask) \ - ASN1_ITEM_start(itname) \ - ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ - ASN1_ITEM_end(itname) - -# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ - ASN1_ITEM_start(sname) \ - ASN1_ITYPE_EXTERN, \ - tag, \ - NULL, \ - 0, \ - &fptrs, \ - 0, \ - #sname \ - ASN1_ITEM_end(sname) - -/* Macro to implement standard functions in terms of ASN1_ITEM structures */ - -# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) - -# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ - IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) - -# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ - pre stname *fname##_new(void) \ - { \ - return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ - } \ - pre void fname##_free(stname *a) \ - { \ - ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ - } - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ - stname *fname##_new(void) \ - { \ - return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ - } \ - void fname##_free(stname *a) \ - { \ - ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ - } - -# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) - -# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ - } \ - int i2d_##fname(stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ - } - -# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ - int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ - { \ - return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ - } - -# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \ - static stname *d2i_##stname(stname **a, \ - const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \ - ASN1_ITEM_rptr(stname)); \ - } \ - static int i2d_##stname(stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, \ - ASN1_ITEM_rptr(stname)); \ - } - -/* - * This includes evil casts to remove const: they will go away when full ASN1 - * constification is done. - */ -# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ - } \ - int i2d_##fname(const stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ - } - -# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ - stname * stname##_dup(stname *x) \ - { \ - return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ - } - -# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ - IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ - int fname##_print_ctx(BIO *out, stname *x, int indent, \ - const ASN1_PCTX *pctx) \ - { \ - return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ - ASN1_ITEM_rptr(itname), pctx); \ - } - -# define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ - IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) - -# define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) - -/* external definitions for primitive types */ - -DECLARE_ASN1_ITEM(ASN1_BOOLEAN) -DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) -DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) -DECLARE_ASN1_ITEM(ASN1_SEQUENCE) -DECLARE_ASN1_ITEM(CBIGNUM) -DECLARE_ASN1_ITEM(BIGNUM) -DECLARE_ASN1_ITEM(INT32) -DECLARE_ASN1_ITEM(ZINT32) -DECLARE_ASN1_ITEM(UINT32) -DECLARE_ASN1_ITEM(ZUINT32) -DECLARE_ASN1_ITEM(INT64) -DECLARE_ASN1_ITEM(ZINT64) -DECLARE_ASN1_ITEM(UINT64) -DECLARE_ASN1_ITEM(ZUINT64) - -# if OPENSSL_API_COMPAT < 0x10200000L -/* - * LONG and ZLONG are strongly discouraged for use as stored data, as the - * underlying C type (long) differs in size depending on the architecture. - * They are designed with 32-bit longs in mind. - */ -DECLARE_ASN1_ITEM(LONG) -DECLARE_ASN1_ITEM(ZLONG) -# endif - -DEFINE_STACK_OF(ASN1_VALUE) - -/* Functions used internally by the ASN1 code */ - -int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); -void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); - -int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, - const ASN1_ITEM *it, int tag, int aclass, char opt, - ASN1_TLC *ctx); - -int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, - const ASN1_ITEM *it, int tag, int aclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/async.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/async.h deleted file mode 100644 index 7052b890..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/async.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 - -#ifndef HEADER_ASYNC_H -# define HEADER_ASYNC_H - -#if defined(_WIN32) -# if defined(BASETYPES) || defined(_WINDEF_H) -/* application has to include 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 - - -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asyncerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asyncerr.h deleted file mode 100644 index 91afbbb2..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/asyncerr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bio.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bio.h deleted file mode 100644 index ae559a51..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bio.h +++ /dev/null @@ -1,801 +0,0 @@ -/* - * 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_BIO_H -# define HEADER_BIO_H - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# endif -# include - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* There are the classes of BIOs */ -# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ -# define BIO_TYPE_FILTER 0x0200 -# define BIO_TYPE_SOURCE_SINK 0x0400 - -/* These are the 'types' of BIOs */ -# define BIO_TYPE_NONE 0 -# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK) -# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK) - -# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK) -# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER) -# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER) -# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER) -# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER) -# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER) -# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) - -# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */ -# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER) -# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */ -# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER) -# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER) -# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER) -# ifndef OPENSSL_NO_SCTP -# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# endif - -#define BIO_TYPE_START 128 - -/* - * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. - * BIO_set_fp(in,stdin,BIO_NOCLOSE); - */ -# define BIO_NOCLOSE 0x00 -# define BIO_CLOSE 0x01 - -/* - * These are used in the following macros and are passed to BIO_ctrl() - */ -# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ -# define BIO_CTRL_EOF 2/* opt - are we at the eof */ -# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ -# define BIO_CTRL_SET 4/* man - set the 'IO' type */ -# define BIO_CTRL_GET 5/* man - get the 'IO' type */ -# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ -# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ -# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ -# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ -# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ -# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ -# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ -# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ -# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ -# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ - -# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ -# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ - -/* dgram BIO stuff */ -# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ -# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected - * socket to be passed in */ -# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ -# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ -# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ -# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ - -# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ -# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ - -/* #ifdef IP_MTU_DISCOVER */ -# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ -/* #endif */ - -# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ -# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 -# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ -# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. - * want to use this if asking - * the kernel fails */ - -# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was - * exceed in the previous write - * operation */ - -# define BIO_CTRL_DGRAM_GET_PEER 46 -# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ - -# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout - * to adjust socket timeouts */ -# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 - -# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 - -/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ -# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 -# ifndef OPENSSL_NO_SCTP -/* SCTP stuff */ -# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 -# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 -# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 -# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 -# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 -# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 -# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 -# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 -# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 -# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 -# endif - -# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71 - -/* modifiers */ -# define BIO_FP_READ 0x02 -# define BIO_FP_WRITE 0x04 -# define BIO_FP_APPEND 0x08 -# define BIO_FP_TEXT 0x10 - -# define BIO_FLAGS_READ 0x01 -# define BIO_FLAGS_WRITE 0x02 -# define BIO_FLAGS_IO_SPECIAL 0x04 -# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) -# define BIO_FLAGS_SHOULD_RETRY 0x08 -# ifndef BIO_FLAGS_UPLINK -/* - * "UPLINK" flag denotes file descriptors provided by application. It - * defaults to 0, as most platforms don't require UPLINK interface. - */ -# define BIO_FLAGS_UPLINK 0 -# endif - -# define BIO_FLAGS_BASE64_NO_NL 0x100 - -/* - * This is used with memory BIOs: - * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; - * BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. - */ -# define BIO_FLAGS_MEM_RDONLY 0x200 -# define BIO_FLAGS_NONCLEAR_RST 0x400 -# define BIO_FLAGS_IN_EOF 0x800 - -typedef union bio_addr_st BIO_ADDR; -typedef struct bio_addrinfo_st BIO_ADDRINFO; - -int BIO_get_new_index(void); -void BIO_set_flags(BIO *b, int flags); -int BIO_test_flags(const BIO *b, int flags); -void BIO_clear_flags(BIO *b, int flags); - -# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) -# define BIO_set_retry_special(b) \ - BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_set_retry_read(b) \ - BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_set_retry_write(b) \ - BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) - -/* These are normally used internally in BIOs */ -# define BIO_clear_retry_flags(b) \ - BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_get_retry_flags(b) \ - BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) - -/* These should be used by the application to tell why we should retry */ -# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) -# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) -# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) -# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) -# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) - -/* - * The next three are used in conjunction with the BIO_should_io_special() - * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int - * *reason); will walk the BIO stack and return the 'reason' for the special - * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return - * the code. - */ -/* - * Returned from the SSL bio when the certificate retrieval code had an error - */ -# define BIO_RR_SSL_X509_LOOKUP 0x01 -/* Returned from the connect BIO when a connect would have blocked */ -# define BIO_RR_CONNECT 0x02 -/* Returned from the accept BIO when an accept would have blocked */ -# define BIO_RR_ACCEPT 0x03 - -/* These are passed by the BIO callback */ -# define BIO_CB_FREE 0x01 -# define BIO_CB_READ 0x02 -# define BIO_CB_WRITE 0x03 -# define BIO_CB_PUTS 0x04 -# define BIO_CB_GETS 0x05 -# define BIO_CB_CTRL 0x06 - -/* - * The callback is called before and after the underling operation, The - * BIO_CB_RETURN flag indicates if it is after the call - */ -# define BIO_CB_RETURN 0x80 -# define BIO_CB_return(a) ((a)|BIO_CB_RETURN) -# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) -# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) - -typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, - long argl, long ret); -typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, - size_t len, int argi, - long argl, int ret, size_t *processed); -BIO_callback_fn BIO_get_callback(const BIO *b); -void BIO_set_callback(BIO *b, BIO_callback_fn callback); - -BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); -void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); - -char *BIO_get_callback_arg(const BIO *b); -void BIO_set_callback_arg(BIO *b, char *arg); - -typedef struct bio_method_st BIO_METHOD; - -const char *BIO_method_name(const BIO *b); -int BIO_method_type(const BIO *b); - -typedef int BIO_info_cb(BIO *, int, int); -typedef BIO_info_cb bio_info_cb; /* backward compatibility */ - -DEFINE_STACK_OF(BIO) - -/* Prefix and suffix callback in ASN1 BIO */ -typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, - void *parg); - -# ifndef OPENSSL_NO_SCTP -/* SCTP parameter structs */ -struct bio_dgram_sctp_sndinfo { - uint16_t snd_sid; - uint16_t snd_flags; - uint32_t snd_ppid; - uint32_t snd_context; -}; - -struct bio_dgram_sctp_rcvinfo { - uint16_t rcv_sid; - uint16_t rcv_ssn; - uint16_t rcv_flags; - uint32_t rcv_ppid; - uint32_t rcv_tsn; - uint32_t rcv_cumtsn; - uint32_t rcv_context; -}; - -struct bio_dgram_sctp_prinfo { - uint16_t pr_policy; - uint32_t pr_value; -}; -# endif - -/* - * #define BIO_CONN_get_param_hostname BIO_ctrl - */ - -# define BIO_C_SET_CONNECT 100 -# define BIO_C_DO_STATE_MACHINE 101 -# define BIO_C_SET_NBIO 102 -/* # define BIO_C_SET_PROXY_PARAM 103 */ -# define BIO_C_SET_FD 104 -# define BIO_C_GET_FD 105 -# define BIO_C_SET_FILE_PTR 106 -# define BIO_C_GET_FILE_PTR 107 -# define BIO_C_SET_FILENAME 108 -# define BIO_C_SET_SSL 109 -# define BIO_C_GET_SSL 110 -# define BIO_C_SET_MD 111 -# define BIO_C_GET_MD 112 -# define BIO_C_GET_CIPHER_STATUS 113 -# define BIO_C_SET_BUF_MEM 114 -# define BIO_C_GET_BUF_MEM_PTR 115 -# define BIO_C_GET_BUFF_NUM_LINES 116 -# define BIO_C_SET_BUFF_SIZE 117 -# define BIO_C_SET_ACCEPT 118 -# define BIO_C_SSL_MODE 119 -# define BIO_C_GET_MD_CTX 120 -/* # define BIO_C_GET_PROXY_PARAM 121 */ -# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ -# define BIO_C_GET_CONNECT 123 -# define BIO_C_GET_ACCEPT 124 -# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 -# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 -# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 -# define BIO_C_FILE_SEEK 128 -# define BIO_C_GET_CIPHER_CTX 129 -# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input - * value */ -# define BIO_C_SET_BIND_MODE 131 -# define BIO_C_GET_BIND_MODE 132 -# define BIO_C_FILE_TELL 133 -# define BIO_C_GET_SOCKS 134 -# define BIO_C_SET_SOCKS 135 - -# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ -# define BIO_C_GET_WRITE_BUF_SIZE 137 -# define BIO_C_MAKE_BIO_PAIR 138 -# define BIO_C_DESTROY_BIO_PAIR 139 -# define BIO_C_GET_WRITE_GUARANTEE 140 -# define BIO_C_GET_READ_REQUEST 141 -# define BIO_C_SHUTDOWN_WR 142 -# define BIO_C_NREAD0 143 -# define BIO_C_NREAD 144 -# define BIO_C_NWRITE0 145 -# define BIO_C_NWRITE 146 -# define BIO_C_RESET_READ_REQUEST 147 -# define BIO_C_SET_MD_CTX 148 - -# define BIO_C_SET_PREFIX 149 -# define BIO_C_GET_PREFIX 150 -# define BIO_C_SET_SUFFIX 151 -# define BIO_C_GET_SUFFIX 152 - -# define BIO_C_SET_EX_ARG 153 -# define BIO_C_GET_EX_ARG 154 - -# define BIO_C_SET_CONNECT_MODE 155 - -# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) -# define BIO_get_app_data(s) BIO_get_ex_data(s,0) - -# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) - -# ifndef OPENSSL_NO_SOCK -/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ -/* Note: the underlying operating system may not support some of them */ -# define BIO_FAMILY_IPV4 4 -# define BIO_FAMILY_IPV6 6 -# define BIO_FAMILY_IPANY 256 - -/* BIO_s_connect() */ -# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \ - (char *)(name)) -# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \ - (char *)(port)) -# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \ - (char *)(addr)) -# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f) -# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)) -# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)) -# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)) -# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) -# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL) - -/* BIO_s_accept() */ -# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \ - (char *)(name)) -# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \ - (char *)(port)) -# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)) -# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1)) -# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2)) -# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3)) -/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ -# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL) -# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \ - (char *)(bio)) -# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f) -# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL) - -/* Aliases kept for backward compatibility */ -# define BIO_BIND_NORMAL 0 -# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR -# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR -# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) -# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) - -/* BIO_s_accept() and BIO_s_connect() */ -# define BIO_do_connect(b) BIO_do_handshake(b) -# define BIO_do_accept(b) BIO_do_handshake(b) -# endif /* OPENSSL_NO_SOCK */ - -# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) - -/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ -# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) -# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c)) - -/* BIO_s_file() */ -# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp)) -# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp)) - -/* BIO_s_fd() and BIO_s_file() */ -# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) -# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) - -/* - * name is cast to lose const, but might be better to route through a - * function so we can do it safely - */ -# ifdef CONST_STRICT -/* - * If you are wondering why this isn't defined, its because CONST_STRICT is - * purely a compile-time kludge to allow const to be checked. - */ -int BIO_read_filename(BIO *b, const char *name); -# else -# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_READ,(char *)(name)) -# endif -# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_WRITE,name) -# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_APPEND,name) -# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) - -/* - * WARNING WARNING, this ups the reference count on the read bio of the SSL - * structure. This is because the ssl read BIO is now pointed to by the - * next_bio field in the bio. So when you free the BIO, make sure you are - * doing a BIO_free_all() to catch the underlying BIO. - */ -# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl)) -# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp)) -# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) -# define BIO_set_ssl_renegotiate_bytes(b,num) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) -# define BIO_get_num_renegotiates(b) \ - BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL) -# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) - -/* defined in evp.h */ -/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ - -# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp)) -# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm)) -# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \ - (char *)(pp)) -# define BIO_set_mem_eof_return(b,v) \ - BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) - -/* For the BIO_f_buffer() type */ -# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) -# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) -# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) -# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) -# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) - -/* Don't use the next one unless you know what you are doing :-) */ -# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) - -# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) -# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) -# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) -# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) -# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) -# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) -/* ...pending macros have inappropriate return type */ -size_t BIO_ctrl_pending(BIO *b); -size_t BIO_ctrl_wpending(BIO *b); -# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) -# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ - cbp) -# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) - -/* For the BIO_f_buffer() type */ -# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) -# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) - -/* For BIO_s_bio() */ -# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) -# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) -# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) -# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) -# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) -/* macros with inappropriate type -- but ...pending macros use int too: */ -# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) -# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) -size_t BIO_ctrl_get_write_guarantee(BIO *b); -size_t BIO_ctrl_get_read_request(BIO *b); -int BIO_ctrl_reset_read_request(BIO *b); - -/* ctrl macros for dgram */ -# define BIO_ctrl_dgram_connect(b,peer) \ - (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer)) -# define BIO_ctrl_set_connected(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer)) -# define BIO_dgram_recv_timedout(b) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) -# define BIO_dgram_send_timedout(b) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) -# define BIO_dgram_get_peer(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer)) -# define BIO_dgram_set_peer(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer)) -# define BIO_dgram_get_mtu_overhead(b) \ - (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) - -#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef) -int BIO_set_ex_data(BIO *bio, int idx, void *data); -void *BIO_get_ex_data(BIO *bio, int idx); -uint64_t BIO_number_read(BIO *bio); -uint64_t BIO_number_written(BIO *bio); - -/* For BIO_f_asn1() */ -int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, - asn1_ps_func *prefix_free); -int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, - asn1_ps_func **pprefix_free); -int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, - asn1_ps_func *suffix_free); -int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, - asn1_ps_func **psuffix_free); - -const BIO_METHOD *BIO_s_file(void); -BIO *BIO_new_file(const char *filename, const char *mode); -# ifndef OPENSSL_NO_STDIO -BIO *BIO_new_fp(FILE *stream, int close_flag); -# endif -BIO *BIO_new(const BIO_METHOD *type); -int BIO_free(BIO *a); -void BIO_set_data(BIO *a, void *ptr); -void *BIO_get_data(BIO *a); -void BIO_set_init(BIO *a, int init); -int BIO_get_init(BIO *a); -void BIO_set_shutdown(BIO *a, int shut); -int BIO_get_shutdown(BIO *a); -void BIO_vfree(BIO *a); -int BIO_up_ref(BIO *a); -int BIO_read(BIO *b, void *data, int dlen); -int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); -int BIO_gets(BIO *bp, char *buf, int size); -int BIO_write(BIO *b, const void *data, int dlen); -int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); -int BIO_puts(BIO *bp, const char *buf); -int BIO_indent(BIO *b, int indent, int max); -long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); -long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); -void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); -long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); -BIO *BIO_push(BIO *b, BIO *append); -BIO *BIO_pop(BIO *b); -void BIO_free_all(BIO *a); -BIO *BIO_find_type(BIO *b, int bio_type); -BIO *BIO_next(BIO *b); -void BIO_set_next(BIO *b, BIO *next); -BIO *BIO_get_retry_BIO(BIO *bio, int *reason); -int BIO_get_retry_reason(BIO *bio); -void BIO_set_retry_reason(BIO *bio, int reason); -BIO *BIO_dup_chain(BIO *in); - -int BIO_nread0(BIO *bio, char **buf); -int BIO_nread(BIO *bio, char **buf, int num); -int BIO_nwrite0(BIO *bio, char **buf); -int BIO_nwrite(BIO *bio, char **buf, int num); - -long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, - long argl, long ret); - -const BIO_METHOD *BIO_s_mem(void); -const BIO_METHOD *BIO_s_secmem(void); -BIO *BIO_new_mem_buf(const void *buf, int len); -# ifndef OPENSSL_NO_SOCK -const BIO_METHOD *BIO_s_socket(void); -const BIO_METHOD *BIO_s_connect(void); -const BIO_METHOD *BIO_s_accept(void); -# endif -const BIO_METHOD *BIO_s_fd(void); -const BIO_METHOD *BIO_s_log(void); -const BIO_METHOD *BIO_s_bio(void); -const BIO_METHOD *BIO_s_null(void); -const BIO_METHOD *BIO_f_null(void); -const BIO_METHOD *BIO_f_buffer(void); -const BIO_METHOD *BIO_f_linebuffer(void); -const BIO_METHOD *BIO_f_nbio_test(void); -# ifndef OPENSSL_NO_DGRAM -const BIO_METHOD *BIO_s_datagram(void); -int BIO_dgram_non_fatal_error(int error); -BIO *BIO_new_dgram(int fd, int close_flag); -# ifndef OPENSSL_NO_SCTP -const BIO_METHOD *BIO_s_datagram_sctp(void); -BIO *BIO_new_dgram_sctp(int fd, int close_flag); -int BIO_dgram_is_sctp(BIO *bio); -int BIO_dgram_sctp_notification_cb(BIO *b, - void (*handle_notifications) (BIO *bio, - void *context, - void *buf), - void *context); -int BIO_dgram_sctp_wait_for_dry(BIO *b); -int BIO_dgram_sctp_msg_waiting(BIO *b); -# endif -# endif - -# ifndef OPENSSL_NO_SOCK -int BIO_sock_should_retry(int i); -int BIO_sock_non_fatal_error(int error); -# endif - -int BIO_fd_should_retry(int i); -int BIO_fd_non_fatal_error(int error); -int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), - void *u, const char *s, int len); -int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), - void *u, const char *s, int len, int indent); -int BIO_dump(BIO *b, const char *bytes, int len); -int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); -# ifndef OPENSSL_NO_STDIO -int BIO_dump_fp(FILE *fp, const char *s, int len); -int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); -# endif -int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data, - int datalen); - -# ifndef OPENSSL_NO_SOCK -BIO_ADDR *BIO_ADDR_new(void); -int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, - const void *where, size_t wherelen, unsigned short port); -void BIO_ADDR_free(BIO_ADDR *); -void BIO_ADDR_clear(BIO_ADDR *ap); -int BIO_ADDR_family(const BIO_ADDR *ap); -int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); -unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); -char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); -char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); -char *BIO_ADDR_path_string(const BIO_ADDR *ap); - -const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); -const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); -void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); - -enum BIO_hostserv_priorities { - BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV -}; -int BIO_parse_hostserv(const char *hostserv, char **host, char **service, - enum BIO_hostserv_priorities hostserv_prio); -enum BIO_lookup_type { - BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER -}; -int BIO_lookup(const char *host, const char *service, - enum BIO_lookup_type lookup_type, - int family, int socktype, BIO_ADDRINFO **res); -int BIO_lookup_ex(const char *host, const char *service, - int lookup_type, int family, int socktype, int protocol, - BIO_ADDRINFO **res); -int BIO_sock_error(int sock); -int BIO_socket_ioctl(int fd, long type, void *arg); -int BIO_socket_nbio(int fd, int mode); -int BIO_sock_init(void); -# if OPENSSL_API_COMPAT < 0x10100000L -# define BIO_sock_cleanup() while(0) continue -# endif -int BIO_set_tcp_ndelay(int sock, int turn_on); - -DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name)) -DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr)) -DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip)) -DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode)) -DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port)) - -union BIO_sock_info_u { - BIO_ADDR *addr; -}; -enum BIO_sock_info_type { - BIO_SOCK_INFO_ADDRESS -}; -int BIO_sock_info(int sock, - enum BIO_sock_info_type type, union BIO_sock_info_u *info); - -# define BIO_SOCK_REUSEADDR 0x01 -# define BIO_SOCK_V6_ONLY 0x02 -# define BIO_SOCK_KEEPALIVE 0x04 -# define BIO_SOCK_NONBLOCK 0x08 -# define BIO_SOCK_NODELAY 0x10 - -int BIO_socket(int domain, int socktype, int protocol, int options); -int BIO_connect(int sock, const BIO_ADDR *addr, int options); -int BIO_bind(int sock, const BIO_ADDR *addr, int options); -int BIO_listen(int sock, const BIO_ADDR *addr, int options); -int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); -int BIO_closesocket(int sock); - -BIO *BIO_new_socket(int sock, int close_flag); -BIO *BIO_new_connect(const char *host_port); -BIO *BIO_new_accept(const char *host_port); -# endif /* OPENSSL_NO_SOCK*/ - -BIO *BIO_new_fd(int fd, int close_flag); - -int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, - BIO **bio2, size_t writebuf2); -/* - * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. - * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default - * value. - */ - -void BIO_copy_next_retry(BIO *b); - -/* - * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); - */ - -# define ossl_bio__attr__(x) -# if defined(__GNUC__) && defined(__STDC_VERSION__) \ - && !defined(__APPLE__) - /* - * Because we support the 'z' modifier, which made its appearance in C99, - * we can't use __attribute__ with pre C99 dialects. - */ -# if __STDC_VERSION__ >= 199901L -# undef ossl_bio__attr__ -# define ossl_bio__attr__ __attribute__ -# if __GNUC__*10 + __GNUC_MINOR__ >= 44 -# define ossl_bio__printf__ __gnu_printf__ -# else -# define ossl_bio__printf__ __printf__ -# endif -# endif -# endif -int BIO_printf(BIO *bio, const char *format, ...) -ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); -int BIO_vprintf(BIO *bio, const char *format, va_list args) -ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); -int BIO_snprintf(char *buf, size_t n, const char *format, ...) -ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); -int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) -ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); -# undef ossl_bio__attr__ -# undef ossl_bio__printf__ - - -BIO_METHOD *BIO_meth_new(int type, const char *name); -void BIO_meth_free(BIO_METHOD *biom); -int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int); -int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, - size_t *); -int BIO_meth_set_write(BIO_METHOD *biom, - int (*write) (BIO *, const char *, int)); -int BIO_meth_set_write_ex(BIO_METHOD *biom, - int (*bwrite) (BIO *, const char *, size_t, size_t *)); -int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int); -int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *); -int BIO_meth_set_read(BIO_METHOD *biom, - int (*read) (BIO *, char *, int)); -int BIO_meth_set_read_ex(BIO_METHOD *biom, - int (*bread) (BIO *, char *, size_t, size_t *)); -int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *); -int BIO_meth_set_puts(BIO_METHOD *biom, - int (*puts) (BIO *, const char *)); -int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int); -int BIO_meth_set_gets(BIO_METHOD *biom, - int (*gets) (BIO *, char *, int)); -long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *); -int BIO_meth_set_ctrl(BIO_METHOD *biom, - long (*ctrl) (BIO *, int, long, void *)); -int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *); -int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); -int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *); -int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); -long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) - (BIO *, int, BIO_info_cb *); -int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, - long (*callback_ctrl) (BIO *, int, - BIO_info_cb *)); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bioerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bioerr.h deleted file mode 100644 index 46e2c96e..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bioerr.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/blowfish.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/blowfish.h deleted file mode 100644 index cd3e460e..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/blowfish.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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_BLOWFISH_H -# define HEADER_BLOWFISH_H - -# include - -# ifndef OPENSSL_NO_BF -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define BF_ENCRYPT 1 -# define BF_DECRYPT 0 - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! BF_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define BF_LONG unsigned int - -# define BF_ROUNDS 16 -# define BF_BLOCK 8 - -typedef struct bf_key_st { - BF_LONG P[BF_ROUNDS + 2]; - BF_LONG S[4 * 256]; -} BF_KEY; - -void BF_set_key(BF_KEY *key, int len, const unsigned char *data); - -void BF_encrypt(BF_LONG *data, const BF_KEY *key); -void BF_decrypt(BF_LONG *data, const BF_KEY *key); - -void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, - const BF_KEY *key, int enc); -void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - const BF_KEY *schedule, unsigned char *ivec, int enc); -void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num); -const char *BF_options(void); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bn.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bn.h deleted file mode 100644 index 8af05d00..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bn.h +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_BN_H -# define HEADER_BN_H - -# include -# ifndef OPENSSL_NO_STDIO -# include -# endif -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * 64-bit processor with LP64 ABI - */ -# ifdef SIXTY_FOUR_BIT_LONG -# define BN_ULONG unsigned long -# define BN_BYTES 8 -# endif - -/* - * 64-bit processor other than LP64 ABI - */ -# ifdef SIXTY_FOUR_BIT -# define BN_ULONG unsigned long long -# define BN_BYTES 8 -# endif - -# ifdef THIRTY_TWO_BIT -# define BN_ULONG unsigned int -# define BN_BYTES 4 -# endif - -# define BN_BITS2 (BN_BYTES * 8) -# define BN_BITS (BN_BITS2 * 2) -# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1)) - -# define BN_FLG_MALLOCED 0x01 -# define BN_FLG_STATIC_DATA 0x02 - -/* - * avoid leaking exponent information through timing, - * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, - * BN_div() will call BN_div_no_branch, - * BN_mod_inverse() will call BN_mod_inverse_no_branch. - */ -# define BN_FLG_CONSTTIME 0x04 -# define BN_FLG_SECURE 0x08 - -# if OPENSSL_API_COMPAT < 0x00908000L -/* deprecated name for the flag */ -# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME -# define BN_FLG_FREE 0x8000 /* used for debugging */ -# endif - -void BN_set_flags(BIGNUM *b, int n); -int BN_get_flags(const BIGNUM *b, int n); - -/* Values for |top| in BN_rand() */ -#define BN_RAND_TOP_ANY -1 -#define BN_RAND_TOP_ONE 0 -#define BN_RAND_TOP_TWO 1 - -/* Values for |bottom| in BN_rand() */ -#define BN_RAND_BOTTOM_ANY 0 -#define BN_RAND_BOTTOM_ODD 1 - -/* - * get a clone of a BIGNUM with changed flags, for *temporary* use only (the - * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The - * value |dest| should be a newly allocated BIGNUM obtained via BN_new() that - * has not been otherwise initialised or used. - */ -void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); - -/* Wrapper function to make using BN_GENCB easier */ -int BN_GENCB_call(BN_GENCB *cb, int a, int b); - -BN_GENCB *BN_GENCB_new(void); -void BN_GENCB_free(BN_GENCB *cb); - -/* Populate a BN_GENCB structure with an "old"-style callback */ -void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *), - void *cb_arg); - -/* Populate a BN_GENCB structure with a "new"-style callback */ -void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), - void *cb_arg); - -void *BN_GENCB_get_arg(BN_GENCB *cb); - -# define BN_prime_checks 0 /* default: select number of iterations based - * on the size of the number */ - -/* - * BN_prime_checks_for_size() returns the number of Miller-Rabin iterations - * that will be done for checking that a random number is probably prime. The - * error rate for accepting a composite number as prime depends on the size of - * the prime |b|. The error rates used are for calculating an RSA key with 2 primes, - * and so the level is what you would expect for a key of double the size of the - * prime. - * - * This table is generated using the algorithm of FIPS PUB 186-4 - * Digital Signature Standard (DSS), section F.1, page 117. - * (https://dx.doi.org/10.6028/NIST.FIPS.186-4) - * - * The following magma script was used to generate the output: - * securitybits:=125; - * k:=1024; - * for t:=1 to 65 do - * for M:=3 to Floor(2*Sqrt(k-1)-1) do - * S:=0; - * // Sum over m - * for m:=3 to M do - * s:=0; - * // Sum over j - * for j:=2 to m do - * s+:=(RealField(32)!2)^-(j+(k-1)/j); - * end for; - * S+:=2^(m-(m-1)*t)*s; - * end for; - * A:=2^(k-2-M*t); - * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S; - * pkt:=2.00743*Log(2)*k*2^-k*(A+B); - * seclevel:=Floor(-Log(2,pkt)); - * if seclevel ge securitybits then - * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M; - * break; - * end if; - * end for; - * if seclevel ge securitybits then break; end if; - * end for; - * - * It can be run online at: - * http://magma.maths.usyd.edu.au/calc - * - * And will output: - * k: 1024, security: 129 bits (t: 6, M: 23) - * - * k is the number of bits of the prime, securitybits is the level we want to - * reach. - * - * prime length | RSA key size | # MR tests | security level - * -------------+--------------|------------+--------------- - * (b) >= 6394 | >= 12788 | 3 | 256 bit - * (b) >= 3747 | >= 7494 | 3 | 192 bit - * (b) >= 1345 | >= 2690 | 4 | 128 bit - * (b) >= 1080 | >= 2160 | 5 | 128 bit - * (b) >= 852 | >= 1704 | 5 | 112 bit - * (b) >= 476 | >= 952 | 5 | 80 bit - * (b) >= 400 | >= 800 | 6 | 80 bit - * (b) >= 347 | >= 694 | 7 | 80 bit - * (b) >= 308 | >= 616 | 8 | 80 bit - * (b) >= 55 | >= 110 | 27 | 64 bit - * (b) >= 6 | >= 12 | 34 | 64 bit - */ - -# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \ - (b) >= 1345 ? 4 : \ - (b) >= 476 ? 5 : \ - (b) >= 400 ? 6 : \ - (b) >= 347 ? 7 : \ - (b) >= 308 ? 8 : \ - (b) >= 55 ? 27 : \ - /* b >= 6 */ 34) - -# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) - -int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); -int BN_is_zero(const BIGNUM *a); -int BN_is_one(const BIGNUM *a); -int BN_is_word(const BIGNUM *a, const BN_ULONG w); -int BN_is_odd(const BIGNUM *a); - -# define BN_one(a) (BN_set_word((a),1)) - -void BN_zero_ex(BIGNUM *a); - -# if OPENSSL_API_COMPAT >= 0x00908000L -# define BN_zero(a) BN_zero_ex(a) -# else -# define BN_zero(a) (BN_set_word((a),0)) -# endif - -const BIGNUM *BN_value_one(void); -char *BN_options(void); -BN_CTX *BN_CTX_new(void); -BN_CTX *BN_CTX_secure_new(void); -void BN_CTX_free(BN_CTX *c); -void BN_CTX_start(BN_CTX *ctx); -BIGNUM *BN_CTX_get(BN_CTX *ctx); -void BN_CTX_end(BN_CTX *ctx); -int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_num_bits(const BIGNUM *a); -int BN_num_bits_word(BN_ULONG l); -int BN_security_bits(int L, int N); -BIGNUM *BN_new(void); -BIGNUM *BN_secure_new(void); -void BN_clear_free(BIGNUM *a); -BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); -void BN_swap(BIGNUM *a, BIGNUM *b); -BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2bin(const BIGNUM *a, unsigned char *to); -int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); -BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); -BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2mpi(const BIGNUM *a, unsigned char *to); -int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); -int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); -/** BN_set_negative sets sign of a BIGNUM - * \param b pointer to the BIGNUM object - * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise - */ -void BN_set_negative(BIGNUM *b, int n); -/** BN_is_negative returns 1 if the BIGNUM is negative - * \param b pointer to the BIGNUM object - * \return 1 if a < 0 and 0 otherwise - */ -int BN_is_negative(const BIGNUM *b); - -int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, - BN_CTX *ctx); -# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) -int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); -int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); -int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); -int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); -int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); - -BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); -BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); -int BN_mul_word(BIGNUM *a, BN_ULONG w); -int BN_add_word(BIGNUM *a, BN_ULONG w); -int BN_sub_word(BIGNUM *a, BN_ULONG w); -int BN_set_word(BIGNUM *a, BN_ULONG w); -BN_ULONG BN_get_word(const BIGNUM *a); - -int BN_cmp(const BIGNUM *a, const BIGNUM *b); -void BN_free(BIGNUM *a); -int BN_is_bit_set(const BIGNUM *a, int n); -int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); -int BN_lshift1(BIGNUM *r, const BIGNUM *a); -int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - -int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); -int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, - BN_MONT_CTX *in_mont); -int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, - const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, - BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); - -int BN_mask_bits(BIGNUM *a, int n); -# ifndef OPENSSL_NO_STDIO -int BN_print_fp(FILE *fp, const BIGNUM *a); -# endif -int BN_print(BIO *bio, const BIGNUM *a); -int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); -int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); -int BN_rshift1(BIGNUM *r, const BIGNUM *a); -void BN_clear(BIGNUM *a); -BIGNUM *BN_dup(const BIGNUM *a); -int BN_ucmp(const BIGNUM *a, const BIGNUM *b); -int BN_set_bit(BIGNUM *a, int n); -int BN_clear_bit(BIGNUM *a, int n); -char *BN_bn2hex(const BIGNUM *a); -char *BN_bn2dec(const BIGNUM *a); -int BN_hex2bn(BIGNUM **a, const char *str); -int BN_dec2bn(BIGNUM **a, const char *str); -int BN_asc2bn(BIGNUM **a, const char *str); -int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); -int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns - * -2 for - * error */ -BIGNUM *BN_mod_inverse(BIGNUM *ret, - const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); -BIGNUM *BN_mod_sqrt(BIGNUM *ret, - const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); - -void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); - -/* Deprecated versions */ -DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, - const BIGNUM *add, - const BIGNUM *rem, - void (*callback) (int, int, - void *), - void *cb_arg)) -DEPRECATEDIN_0_9_8(int - BN_is_prime(const BIGNUM *p, int nchecks, - void (*callback) (int, int, void *), - BN_CTX *ctx, void *cb_arg)) -DEPRECATEDIN_0_9_8(int - BN_is_prime_fasttest(const BIGNUM *p, int nchecks, - void (*callback) (int, int, void *), - BN_CTX *ctx, void *cb_arg, - int do_trial_division)) - -/* Newer versions */ -int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, - const BIGNUM *rem, BN_GENCB *cb); -int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); -int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, - int do_trial_division, BN_GENCB *cb); - -int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); - -int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, - const BIGNUM *Xp, const BIGNUM *Xp1, - const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, - BN_GENCB *cb); -int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, - BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, - BN_CTX *ctx, BN_GENCB *cb); - -BN_MONT_CTX *BN_MONT_CTX_new(void); -int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - BN_MONT_CTX *mont, BN_CTX *ctx); -int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -void BN_MONT_CTX_free(BN_MONT_CTX *mont); -int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); -BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); -BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, - const BIGNUM *mod, BN_CTX *ctx); - -/* BN_BLINDING flags */ -# define BN_BLINDING_NO_UPDATE 0x00000001 -# define BN_BLINDING_NO_RECREATE 0x00000002 - -BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); -void BN_BLINDING_free(BN_BLINDING *b); -int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); -int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, - BN_CTX *); - -int BN_BLINDING_is_current_thread(BN_BLINDING *b); -void BN_BLINDING_set_current_thread(BN_BLINDING *b); -int BN_BLINDING_lock(BN_BLINDING *b); -int BN_BLINDING_unlock(BN_BLINDING *b); - -unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); -void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); -BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, - const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, - int (*bn_mod_exp) (BIGNUM *r, - const BIGNUM *a, - const BIGNUM *p, - const BIGNUM *m, - BN_CTX *ctx, - BN_MONT_CTX *m_ctx), - BN_MONT_CTX *m_ctx); - -DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont)) -DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3 - * mont */ - -BN_RECP_CTX *BN_RECP_CTX_new(void); -void BN_RECP_CTX_free(BN_RECP_CTX *recp); -int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); -int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, - BN_RECP_CTX *recp, BN_CTX *ctx); -int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); -int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, - BN_RECP_CTX *recp, BN_CTX *ctx); - -# ifndef OPENSSL_NO_EC2M - -/* - * Functions for arithmetic over binary polynomials represented by BIGNUMs. - * The BIGNUM::neg property of BIGNUMs representing binary polynomials is - * ignored. Note that input arguments are not const so that their bit arrays - * can be expanded to the appropriate size if needed. - */ - -/* - * r = a + b - */ -int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) -/* - * r=a mod p - */ -int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); -/* r = (a * b) mod p */ -int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = (a * a) mod p */ -int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -/* r = (1 / b) mod p */ -int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); -/* r = (a / b) mod p */ -int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = (a ^ b) mod p */ -int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = sqrt(a) mod p */ -int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - BN_CTX *ctx); -/* r^2 + r = a mod p */ -int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - BN_CTX *ctx); -# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) -/*- - * Some functions allow for representation of the irreducible polynomials - * as an unsigned int[], say p. The irreducible f(t) is then of the form: - * t^p[0] + t^p[1] + ... + t^p[k] - * where m = p[0] > p[1] > ... > p[k] = 0. - */ -/* r = a mod p */ -int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); -/* r = (a * b) mod p */ -int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = (a * a) mod p */ -int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], - BN_CTX *ctx); -/* r = (1 / b) mod p */ -int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], - BN_CTX *ctx); -/* r = (a / b) mod p */ -int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = (a ^ b) mod p */ -int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = sqrt(a) mod p */ -int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, - const int p[], BN_CTX *ctx); -/* r^2 + r = a mod p */ -int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, - const int p[], BN_CTX *ctx); -int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); -int BN_GF2m_arr2poly(const int p[], BIGNUM *a); - -# endif - -/* - * faster mod functions for the 'NIST primes' 0 <= a < p^2 - */ -int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - -const BIGNUM *BN_get0_nist_prime_192(void); -const BIGNUM *BN_get0_nist_prime_224(void); -const BIGNUM *BN_get0_nist_prime_256(void); -const BIGNUM *BN_get0_nist_prime_384(void); -const BIGNUM *BN_get0_nist_prime_521(void); - -int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a, - const BIGNUM *field, BN_CTX *ctx); - -int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, - const BIGNUM *priv, const unsigned char *message, - size_t message_len, BN_CTX *ctx); - -/* Primes from RFC 2409 */ -BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn); -BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn); - -/* Primes from RFC 3526 */ -BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768 -# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024 -# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536 -# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048 -# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072 -# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096 -# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144 -# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192 -# endif - -int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bnerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bnerr.h deleted file mode 100644 index 9f3c7cfa..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/bnerr.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/buffer.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/buffer.h deleted file mode 100644 index d2765766..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/buffer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 1995-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_BUFFER_H -# define HEADER_BUFFER_H - -# include -# ifndef HEADER_CRYPTO_H -# include -# endif -# include - - -#ifdef __cplusplus -extern "C" { -#endif - -# include -# include - -/* - * 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 { - size_t length; /* current number of bytes */ - char *data; - 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_ex(unsigned long flags); -void BUF_MEM_free(BUF_MEM *a); -size_t BUF_MEM_grow(BUF_MEM *str, size_t len); -size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); -void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/buffererr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/buffererr.h deleted file mode 100644 index 04f6ff7a..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/buffererr.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/camellia.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/camellia.h deleted file mode 100644 index 151f3c13..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/camellia.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2006-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_CAMELLIA_H -# define HEADER_CAMELLIA_H - -# include - -# ifndef OPENSSL_NO_CAMELLIA -# include -#ifdef __cplusplus -extern "C" { -#endif - -# define CAMELLIA_ENCRYPT 1 -# define CAMELLIA_DECRYPT 0 - -/* - * Because array size can't be a const in C, the following two are macros. - * Both sizes are in bytes. - */ - -/* This should be a hidden type, but EVP requires that the size be known */ - -# define CAMELLIA_BLOCK_SIZE 16 -# define CAMELLIA_TABLE_BYTE_LEN 272 -# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) - -typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match - * with WORD */ - -struct camellia_key_st { - union { - double d; /* ensures 64-bit align */ - KEY_TABLE_TYPE rd_key; - } u; - int grand_rounds; -}; -typedef struct camellia_key_st CAMELLIA_KEY; - -int Camellia_set_key(const unsigned char *userKey, const int bits, - CAMELLIA_KEY *key); - -void Camellia_encrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key); -void Camellia_decrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key); - -void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key, const int enc); -void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, const int enc); -void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num); -void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char ivec[CAMELLIA_BLOCK_SIZE], - unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], - unsigned int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cast.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cast.h deleted file mode 100644 index 2cc89ae0..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cast.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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_CAST_H -# define HEADER_CAST_H - -# include - -# ifndef OPENSSL_NO_CAST -# ifdef __cplusplus -extern "C" { -# endif - -# define CAST_ENCRYPT 1 -# define CAST_DECRYPT 0 - -# define CAST_LONG unsigned int - -# define CAST_BLOCK 8 -# define CAST_KEY_LENGTH 16 - -typedef struct cast_key_st { - CAST_LONG data[32]; - int short_key; /* Use reduced rounds for short key */ -} CAST_KEY; - -void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); -void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, - const CAST_KEY *key, int enc); -void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); -void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); -void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *ks, unsigned char *iv, - int enc); -void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, - unsigned char *ivec, int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cmac.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cmac.h deleted file mode 100644 index 3535a9ab..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cmac.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2010-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_CMAC_H -# define HEADER_CMAC_H - -# ifndef OPENSSL_NO_CMAC - -#ifdef __cplusplus -extern "C" { -#endif - -# include - -/* Opaque */ -typedef struct CMAC_CTX_st CMAC_CTX; - -CMAC_CTX *CMAC_CTX_new(void); -void CMAC_CTX_cleanup(CMAC_CTX *ctx); -void CMAC_CTX_free(CMAC_CTX *ctx); -EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); -int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); - -int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, - const EVP_CIPHER *cipher, ENGINE *impl); -int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); -int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); -int CMAC_resume(CMAC_CTX *ctx); - -#ifdef __cplusplus -} -#endif - -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cms.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cms.h deleted file mode 100644 index c7627968..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cms.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 2008-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_CMS_H -# define HEADER_CMS_H - -# include - -# ifndef OPENSSL_NO_CMS -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -typedef struct CMS_ContentInfo_st CMS_ContentInfo; -typedef struct CMS_SignerInfo_st CMS_SignerInfo; -typedef struct CMS_CertificateChoices CMS_CertificateChoices; -typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; -typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; -typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; -typedef struct CMS_Receipt_st CMS_Receipt; -typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; -typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; - -DEFINE_STACK_OF(CMS_SignerInfo) -DEFINE_STACK_OF(CMS_RecipientEncryptedKey) -DEFINE_STACK_OF(CMS_RecipientInfo) -DEFINE_STACK_OF(CMS_RevocationInfoChoice) -DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) -DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) -DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) - -# define CMS_SIGNERINFO_ISSUER_SERIAL 0 -# define CMS_SIGNERINFO_KEYIDENTIFIER 1 - -# define CMS_RECIPINFO_NONE -1 -# define CMS_RECIPINFO_TRANS 0 -# define CMS_RECIPINFO_AGREE 1 -# define CMS_RECIPINFO_KEK 2 -# define CMS_RECIPINFO_PASS 3 -# define CMS_RECIPINFO_OTHER 4 - -/* S/MIME related flags */ - -# define CMS_TEXT 0x1 -# define CMS_NOCERTS 0x2 -# define CMS_NO_CONTENT_VERIFY 0x4 -# define CMS_NO_ATTR_VERIFY 0x8 -# define CMS_NOSIGS \ - (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY) -# define CMS_NOINTERN 0x10 -# define CMS_NO_SIGNER_CERT_VERIFY 0x20 -# define CMS_NOVERIFY 0x20 -# define CMS_DETACHED 0x40 -# define CMS_BINARY 0x80 -# define CMS_NOATTR 0x100 -# define CMS_NOSMIMECAP 0x200 -# define CMS_NOOLDMIMETYPE 0x400 -# define CMS_CRLFEOL 0x800 -# define CMS_STREAM 0x1000 -# define CMS_NOCRL 0x2000 -# define CMS_PARTIAL 0x4000 -# define CMS_REUSE_DIGEST 0x8000 -# define CMS_USE_KEYID 0x10000 -# define CMS_DEBUG_DECRYPT 0x20000 -# define CMS_KEY_PARAM 0x40000 -# define CMS_ASCIICRLF 0x80000 - -const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms); - -BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); -int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); - -ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); -int CMS_is_detached(CMS_ContentInfo *cms); -int CMS_set_detached(CMS_ContentInfo *cms, int detached); - -# ifdef HEADER_PEM_H -DECLARE_PEM_rw_const(CMS, CMS_ContentInfo) -# endif -int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms); -CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms); -int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms); - -BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); -int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); -int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, - int flags); -CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont); -int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags); - -int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, - unsigned int flags); - -CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, BIO *data, - unsigned int flags); - -CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, - X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, unsigned int flags); - -int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags); -CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags); - -int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, - unsigned int flags); -CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, - unsigned int flags); - -int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, - const unsigned char *key, size_t keylen, - BIO *dcont, BIO *out, unsigned int flags); - -CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, - const unsigned char *key, - size_t keylen, unsigned int flags); - -int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, - const unsigned char *key, size_t keylen); - -int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, - X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags); - -int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, - STACK_OF(X509) *certs, - X509_STORE *store, unsigned int flags); - -STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); - -CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, - const EVP_CIPHER *cipher, unsigned int flags); - -int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, - BIO *dcont, BIO *out, unsigned int flags); - -int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert); -int CMS_decrypt_set1_key(CMS_ContentInfo *cms, - unsigned char *key, size_t keylen, - const unsigned char *id, size_t idlen); -int CMS_decrypt_set1_password(CMS_ContentInfo *cms, - unsigned char *pass, ossl_ssize_t passlen); - -STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); -int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); -EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri); -CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); -CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, - X509 *recip, unsigned int flags); -int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); -int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); -int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, - EVP_PKEY **pk, X509 **recip, - X509_ALGOR **palg); -int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, - ASN1_INTEGER **sno); - -CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, - unsigned char *key, size_t keylen, - unsigned char *id, size_t idlen, - ASN1_GENERALIZEDTIME *date, - ASN1_OBJECT *otherTypeId, - ASN1_TYPE *otherType); - -int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, - X509_ALGOR **palg, - ASN1_OCTET_STRING **pid, - ASN1_GENERALIZEDTIME **pdate, - ASN1_OBJECT **potherid, - ASN1_TYPE **pothertype); - -int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, - unsigned char *key, size_t keylen); - -int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, - const unsigned char *id, size_t idlen); - -int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, - unsigned char *pass, - ossl_ssize_t passlen); - -CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, - int iter, int wrap_nid, - int pbe_nid, - unsigned char *pass, - ossl_ssize_t passlen, - const EVP_CIPHER *kekciph); - -int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); -int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); - -int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, - unsigned int flags); -CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); - -int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); -const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); - -CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms); -int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); -int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); -STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); - -CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms); -int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); -int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); -STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); - -int CMS_SignedData_init(CMS_ContentInfo *cms); -CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, - X509 *signer, EVP_PKEY *pk, const EVP_MD *md, - unsigned int flags); -EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si); -EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si); -STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); - -void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); -int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, ASN1_INTEGER **sno); -int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); -int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs, - unsigned int flags); -void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, - X509 **signer, X509_ALGOR **pdig, - X509_ALGOR **psig); -ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); -int CMS_SignerInfo_sign(CMS_SignerInfo *si); -int CMS_SignerInfo_verify(CMS_SignerInfo *si); -int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain); - -int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs); -int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, - int algnid, int keysize); -int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap); - -int CMS_signed_get_attr_count(const CMS_SignerInfo *si); -int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, - int lastpos); -int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc); -X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc); -int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); -int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int type, - const void *bytes, int len); -int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, - int nid, int type, - const void *bytes, int len); -int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, - const char *attrname, int type, - const void *bytes, int len); -void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, - int lastpos, int type); - -int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si); -int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, - int lastpos); -int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int lastpos); -X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc); -X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc); -int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); -int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int type, - const void *bytes, int len); -int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, - int nid, int type, - const void *bytes, int len); -int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, - const char *attrname, int type, - const void *bytes, int len); -void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, - int lastpos, int type); - -int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); -CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, - int allorfirst, - STACK_OF(GENERAL_NAMES) - *receiptList, STACK_OF(GENERAL_NAMES) - *receiptsTo); -int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); -void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, - ASN1_STRING **pcid, - int *pallorfirst, - STACK_OF(GENERAL_NAMES) **plist, - STACK_OF(GENERAL_NAMES) **prto); -int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, - X509_ALGOR **palg, - ASN1_OCTET_STRING **pukm); -STACK_OF(CMS_RecipientEncryptedKey) -*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri); - -int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, - X509_ALGOR **pubalg, - ASN1_BIT_STRING **pubkey, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, - ASN1_INTEGER **sno); - -int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert); - -int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, - ASN1_OCTET_STRING **keyid, - ASN1_GENERALIZEDTIME **tm, - CMS_OtherKeyAttribute **other, - X509_NAME **issuer, ASN1_INTEGER **sno); -int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, - X509 *cert); -int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); -EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri); -int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, - CMS_RecipientInfo *ri, - CMS_RecipientEncryptedKey *rek); - -int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, - ASN1_OCTET_STRING *ukm, int keylen); - -/* Backward compatibility for spelling errors. */ -# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM -# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \ - CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cmserr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cmserr.h deleted file mode 100644 index 7dbc13dc..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cmserr.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/comp.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/comp.h deleted file mode 100644 index d814d3cf..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/comp.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 -# define HEADER_COMP_H - -# include - -# ifndef OPENSSL_NO_COMP -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - - - -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); - -int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); -int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); - -COMP_METHOD *COMP_zlib(void); - -#if OPENSSL_API_COMPAT < 0x10100000L -#define COMP_zlib_cleanup() while(0) continue -#endif - -# ifdef HEADER_BIO_H -# ifdef ZLIB -const BIO_METHOD *BIO_f_zlib(void); -# endif -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/comperr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/comperr.h deleted file mode 100644 index 90231e9a..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/comperr.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/conf.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/conf.h deleted file mode 100644 index 7336cd2f..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/conf.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 1995-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_CONF_H -# define HEADER_CONF_H - -# include -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - char *section; - char *name; - char *value; -} CONF_VALUE; - -DEFINE_STACK_OF(CONF_VALUE) -DEFINE_LHASH_OF(CONF_VALUE); - -struct conf_st; -struct conf_method_st; -typedef struct conf_method_st CONF_METHOD; - -struct conf_method_st { - const char *name; - CONF *(*create) (CONF_METHOD *meth); - int (*init) (CONF *conf); - int (*destroy) (CONF *conf); - int (*destroy_data) (CONF *conf); - int (*load_bio) (CONF *conf, BIO *bp, long *eline); - int (*dump) (const CONF *conf, BIO *bp); - int (*is_number) (const CONF *conf, char c); - int (*to_int) (const CONF *conf, char c); - int (*load) (CONF *conf, const char *name, long *eline); -}; - -/* Module definitions */ - -typedef struct conf_imodule_st CONF_IMODULE; -typedef struct conf_module_st CONF_MODULE; - -DEFINE_STACK_OF(CONF_MODULE) -DEFINE_STACK_OF(CONF_IMODULE) - -/* DSO module function typedefs */ -typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); -typedef void conf_finish_func (CONF_IMODULE *md); - -# define CONF_MFLAGS_IGNORE_ERRORS 0x1 -# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 -# define CONF_MFLAGS_SILENT 0x4 -# define CONF_MFLAGS_NO_DSO 0x8 -# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 -# define CONF_MFLAGS_DEFAULT_SECTION 0x20 - -int CONF_set_default_method(CONF_METHOD *meth); -void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); -LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, - long *eline); -# ifndef OPENSSL_NO_STDIO -LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, - long *eline); -# endif -LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, - long *eline); -STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, - const char *section); -char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -void CONF_free(LHASH_OF(CONF_VALUE) *conf); -#ifndef OPENSSL_NO_STDIO -int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); -#endif -int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); - -DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name)) - -#if OPENSSL_API_COMPAT < 0x10100000L -# define OPENSSL_no_config() \ - OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) -#endif - -/* - * New conf code. The semantics are different from the functions above. If - * that wasn't the case, the above functions would have been replaced - */ - -struct conf_st { - CONF_METHOD *meth; - void *meth_data; - LHASH_OF(CONF_VALUE) *data; -}; - -CONF *NCONF_new(CONF_METHOD *meth); -CONF_METHOD *NCONF_default(void); -CONF_METHOD *NCONF_WIN32(void); -void NCONF_free(CONF *conf); -void NCONF_free_data(CONF *conf); - -int NCONF_load(CONF *conf, const char *file, long *eline); -# ifndef OPENSSL_NO_STDIO -int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); -# endif -int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); -STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, - const char *section); -char *NCONF_get_string(const CONF *conf, const char *group, const char *name); -int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, - long *result); -#ifndef OPENSSL_NO_STDIO -int NCONF_dump_fp(const CONF *conf, FILE *out); -#endif -int NCONF_dump_bio(const CONF *conf, BIO *out); - -#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) - -/* Module functions */ - -int CONF_modules_load(const CONF *cnf, const char *appname, - unsigned long flags); -int CONF_modules_load_file(const char *filename, const char *appname, - unsigned long flags); -void CONF_modules_unload(int all); -void CONF_modules_finish(void); -#if OPENSSL_API_COMPAT < 0x10100000L -# define CONF_modules_free() while(0) continue -#endif -int CONF_module_add(const char *name, conf_init_func *ifunc, - conf_finish_func *ffunc); - -const char *CONF_imodule_get_name(const CONF_IMODULE *md); -const char *CONF_imodule_get_value(const CONF_IMODULE *md); -void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); -void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); -CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); -unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); -void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); -void *CONF_module_get_usr_data(CONF_MODULE *pmod); -void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); - -char *CONF_get1_default_config_file(void); - -int CONF_parse_list(const char *list, int sep, int nospc, - int (*list_cb) (const char *elem, int len, void *usr), - void *arg); - -void OPENSSL_load_builtin_modules(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/conf_api.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/conf_api.h deleted file mode 100644 index a0275ad7..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/conf_api.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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_CONF_API_H -# define HEADER_CONF_API_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Up until OpenSSL 0.9.5a, this was new_section */ -CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); -/* Up until OpenSSL 0.9.5a, this was get_section */ -CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); -/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ -STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, - const char *section); - -int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); -char *_CONF_get_string(const CONF *conf, const char *section, - const char *name); -long _CONF_get_number(const CONF *conf, const char *section, - const char *name); - -int _CONF_new_data(CONF *conf); -void _CONF_free_data(CONF *conf); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/conferr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/conferr.h deleted file mode 100644 index 32b92291..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/conferr.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/crypto.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/crypto.h deleted file mode 100644 index 7d0b5262..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/crypto.h +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_CRYPTO_H -# define HEADER_CRYPTO_H - -# include -# include - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# endif - -# include -# include -# include -# include -# include - -# ifdef CHARSET_EBCDIC -# include -# endif - -/* - * Resolve problems on some operating systems with symbol names that clash - * one way or another - */ -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSLeay OpenSSL_version_num -# define SSLeay_version OpenSSL_version -# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER -# define SSLEAY_VERSION OPENSSL_VERSION -# define SSLEAY_CFLAGS OPENSSL_CFLAGS -# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON -# define SSLEAY_PLATFORM OPENSSL_PLATFORM -# define SSLEAY_DIR OPENSSL_DIR - -/* - * Old type for allocating dynamic locks. No longer used. Use the new thread - * API instead. - */ -typedef struct { - int dummy; -} CRYPTO_dynlock; - -# endif /* OPENSSL_API_COMPAT */ - -typedef void CRYPTO_RWLOCK; - -CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void); -int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock); -int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock); -int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock); -void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock); - -int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock); - -/* - * The following can be used to detect memory leaks in the library. If - * used, it turns on malloc checking - */ -# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */ -# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */ -# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */ -# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */ - -struct crypto_ex_data_st { - STACK_OF(void) *sk; -}; -DEFINE_STACK_OF(void) - -/* - * Per class, we have a STACK of function pointers. - */ -# define CRYPTO_EX_INDEX_SSL 0 -# define CRYPTO_EX_INDEX_SSL_CTX 1 -# define CRYPTO_EX_INDEX_SSL_SESSION 2 -# define CRYPTO_EX_INDEX_X509 3 -# define CRYPTO_EX_INDEX_X509_STORE 4 -# define CRYPTO_EX_INDEX_X509_STORE_CTX 5 -# define CRYPTO_EX_INDEX_DH 6 -# define CRYPTO_EX_INDEX_DSA 7 -# define CRYPTO_EX_INDEX_EC_KEY 8 -# define CRYPTO_EX_INDEX_RSA 9 -# define CRYPTO_EX_INDEX_ENGINE 10 -# define CRYPTO_EX_INDEX_UI 11 -# define CRYPTO_EX_INDEX_BIO 12 -# define CRYPTO_EX_INDEX_APP 13 -# define CRYPTO_EX_INDEX_UI_METHOD 14 -# define CRYPTO_EX_INDEX_DRBG 15 -# define CRYPTO_EX_INDEX__COUNT 16 - -/* No longer needed, so this is a no-op */ -#define OPENSSL_malloc_init() while(0) continue - -int CRYPTO_mem_ctrl(int mode); - -# define OPENSSL_malloc(num) \ - CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_zalloc(num) \ - CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_realloc(addr, num) \ - CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_clear_realloc(addr, old_num, num) \ - CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_clear_free(addr, num) \ - CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_free(addr) \ - CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_memdup(str, s) \ - CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_strdup(str) \ - CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_strndup(str, n) \ - CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_malloc(num) \ - CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_zalloc(num) \ - CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_free(addr) \ - CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_clear_free(addr, num) \ - CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_actual_size(ptr) \ - CRYPTO_secure_actual_size(ptr) - -size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz); -size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz); -size_t OPENSSL_strnlen(const char *str, size_t maxlen); -char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len); -unsigned char *OPENSSL_hexstr2buf(const char *str, long *len); -int OPENSSL_hexchar2int(unsigned char c); - -# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type)) - -unsigned long OpenSSL_version_num(void); -const char *OpenSSL_version(int type); -# define OPENSSL_VERSION 0 -# define OPENSSL_CFLAGS 1 -# define OPENSSL_BUILT_ON 2 -# define OPENSSL_PLATFORM 3 -# define OPENSSL_DIR 4 -# define OPENSSL_ENGINES_DIR 5 - -int OPENSSL_issetugid(void); - -typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); -typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); -typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, - void *from_d, int idx, long argl, void *argp); -__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, - CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); -/* No longer use an index. */ -int CRYPTO_free_ex_index(int class_index, int idx); - -/* - * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a - * given class (invokes whatever per-class callbacks are applicable) - */ -int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); -int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, - const CRYPTO_EX_DATA *from); - -void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); - -/* - * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular - * index (relative to the class type involved) - */ -int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); -void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); - -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * This function cleans up all "ex_data" state. It mustn't be called under - * potential race-conditions. - */ -# define CRYPTO_cleanup_all_ex_data() while(0) continue - -/* - * The old locking functions have been removed completely without compatibility - * macros. This is because the old functions either could not properly report - * errors, or the returned error values were not clearly documented. - * Replacing the locking functions with no-ops would cause race condition - * issues in the affected applications. It is far better for them to fail at - * compile time. - * On the other hand, the locking callbacks are no longer used. Consequently, - * the callback management functions can be safely replaced with no-op macros. - */ -# define CRYPTO_num_locks() (1) -# define CRYPTO_set_locking_callback(func) -# define CRYPTO_get_locking_callback() (NULL) -# define CRYPTO_set_add_lock_callback(func) -# define CRYPTO_get_add_lock_callback() (NULL) - -/* - * These defines where used in combination with the old locking callbacks, - * they are not called anymore, but old code that's not called might still - * use them. - */ -# define CRYPTO_LOCK 1 -# define CRYPTO_UNLOCK 2 -# define CRYPTO_READ 4 -# define CRYPTO_WRITE 8 - -/* This structure is no longer used */ -typedef struct crypto_threadid_st { - int dummy; -} CRYPTO_THREADID; -/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ -# define CRYPTO_THREADID_set_numeric(id, val) -# define CRYPTO_THREADID_set_pointer(id, ptr) -# define CRYPTO_THREADID_set_callback(threadid_func) (0) -# define CRYPTO_THREADID_get_callback() (NULL) -# define CRYPTO_THREADID_current(id) -# define CRYPTO_THREADID_cmp(a, b) (-1) -# define CRYPTO_THREADID_cpy(dest, src) -# define CRYPTO_THREADID_hash(id) (0UL) - -# if OPENSSL_API_COMPAT < 0x10000000L -# define CRYPTO_set_id_callback(func) -# define CRYPTO_get_id_callback() (NULL) -# define CRYPTO_thread_id() (0UL) -# endif /* OPENSSL_API_COMPAT < 0x10000000L */ - -# define CRYPTO_set_dynlock_create_callback(dyn_create_function) -# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function) -# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function) -# define CRYPTO_get_dynlock_create_callback() (NULL) -# define CRYPTO_get_dynlock_lock_callback() (NULL) -# define CRYPTO_get_dynlock_destroy_callback() (NULL) -# endif /* OPENSSL_API_COMPAT < 0x10100000L */ - -int CRYPTO_set_mem_functions( - void *(*m) (size_t, const char *, int), - void *(*r) (void *, size_t, const char *, int), - void (*f) (void *, const char *, int)); -int CRYPTO_set_mem_debug(int flag); -void CRYPTO_get_mem_functions( - void *(**m) (size_t, const char *, int), - void *(**r) (void *, size_t, const char *, int), - void (**f) (void *, const char *, int)); - -void *CRYPTO_malloc(size_t num, const char *file, int line); -void *CRYPTO_zalloc(size_t num, const char *file, int line); -void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); -char *CRYPTO_strdup(const char *str, const char *file, int line); -char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); -void CRYPTO_free(void *ptr, const char *file, int line); -void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line); -void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); -void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num, - const char *file, int line); - -int CRYPTO_secure_malloc_init(size_t sz, int minsize); -int CRYPTO_secure_malloc_done(void); -void *CRYPTO_secure_malloc(size_t num, const char *file, int line); -void *CRYPTO_secure_zalloc(size_t num, const char *file, int line); -void CRYPTO_secure_free(void *ptr, const char *file, int line); -void CRYPTO_secure_clear_free(void *ptr, size_t num, - const char *file, int line); -int CRYPTO_secure_allocated(const void *ptr); -int CRYPTO_secure_malloc_initialized(void); -size_t CRYPTO_secure_actual_size(void *ptr); -size_t CRYPTO_secure_used(void); - -void OPENSSL_cleanse(void *ptr, size_t len); - -# ifndef OPENSSL_NO_CRYPTO_MDEBUG -# define OPENSSL_mem_debug_push(info) \ - CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_mem_debug_pop() \ - CRYPTO_mem_debug_pop() -int CRYPTO_mem_debug_push(const char *info, const char *file, int line); -int CRYPTO_mem_debug_pop(void); -void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount); - -/*- - * Debugging functions (enabled by CRYPTO_set_mem_debug(1)) - * The flag argument has the following significance: - * 0: called before the actual memory allocation has taken place - * 1: called after the actual memory allocation has taken place - */ -void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag, - const char *file, int line); -void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag, - const char *file, int line); -void CRYPTO_mem_debug_free(void *addr, int flag, - const char *file, int line); - -int CRYPTO_mem_leaks_cb(int (*cb) (const char *str, size_t len, void *u), - void *u); -# ifndef OPENSSL_NO_STDIO -int CRYPTO_mem_leaks_fp(FILE *); -# endif -int CRYPTO_mem_leaks(BIO *bio); -# endif - -/* die if we have to */ -ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line); -# if OPENSSL_API_COMPAT < 0x10100000L -# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l)) -# endif -# define OPENSSL_assert(e) \ - (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1)) - -int OPENSSL_isservice(void); - -int FIPS_mode(void); -int FIPS_mode_set(int r); - -void OPENSSL_init(void); -# ifdef OPENSSL_SYS_UNIX -void OPENSSL_fork_prepare(void); -void OPENSSL_fork_parent(void); -void OPENSSL_fork_child(void); -# endif - -struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); -int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); -int OPENSSL_gmtime_diff(int *pday, int *psec, - const struct tm *from, const struct tm *to); - -/* - * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. - * It takes an amount of time dependent on |len|, but independent of the - * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements - * into a defined order as the return value when a != b is undefined, other - * than to be non-zero. - */ -int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len); - -/* Standard initialisation options */ -# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L -# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L -# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L -# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L -# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L -# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L -# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L -# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L -# define OPENSSL_INIT_ASYNC 0x00000100L -# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L -# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L -# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L -# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L -# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L -# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L -# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L -/* OPENSSL_INIT_ZLIB 0x00010000L */ -# define OPENSSL_INIT_ATFORK 0x00020000L -/* OPENSSL_INIT_BASE_ONLY 0x00040000L */ -# define OPENSSL_INIT_NO_ATEXIT 0x00080000L -/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */ -/* Max OPENSSL_INIT flag value is 0x80000000 */ - -/* openssl and dasync not counted as builtin */ -# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \ - (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \ - | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \ - OPENSSL_INIT_ENGINE_PADLOCK) - - -/* Library initialisation functions */ -void OPENSSL_cleanup(void); -int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); -int OPENSSL_atexit(void (*handler)(void)); -void OPENSSL_thread_stop(void); - -/* Low-level control of initialization */ -OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void); -# ifndef OPENSSL_NO_STDIO -int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, - const char *config_filename); -void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, - unsigned long flags); -int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, - const char *config_appname); -# endif -void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings); - -# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) -# if defined(_WIN32) -# if defined(BASETYPES) || defined(_WINDEF_H) -/* application has to include in order to use this */ -typedef DWORD CRYPTO_THREAD_LOCAL; -typedef DWORD CRYPTO_THREAD_ID; - -typedef LONG CRYPTO_ONCE; -# define CRYPTO_ONCE_STATIC_INIT 0 -# endif -# else -# include -typedef pthread_once_t CRYPTO_ONCE; -typedef pthread_key_t CRYPTO_THREAD_LOCAL; -typedef pthread_t CRYPTO_THREAD_ID; - -# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT -# endif -# endif - -# if !defined(CRYPTO_ONCE_STATIC_INIT) -typedef unsigned int CRYPTO_ONCE; -typedef unsigned int CRYPTO_THREAD_LOCAL; -typedef unsigned int CRYPTO_THREAD_ID; -# define CRYPTO_ONCE_STATIC_INIT 0 -# endif - -int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)); - -int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)); -void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key); -int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val); -int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key); - -CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void); -int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cryptoerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cryptoerr.h deleted file mode 100644 index 3db5a4ee..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cryptoerr.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ct.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ct.h deleted file mode 100644 index ebdba34d..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ct.h +++ /dev/null @@ -1,474 +0,0 @@ -/* - * 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 - -# ifndef OPENSSL_NO_CT -# include -# include -# include -# include -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cterr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cterr.h deleted file mode 100644 index feb7bc56..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/cterr.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/des.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/des.h deleted file mode 100644 index be4abbdf..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/des.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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_DES_H -# define HEADER_DES_H - -# include - -# ifndef OPENSSL_NO_DES -# ifdef __cplusplus -extern "C" { -# endif -# include - -typedef unsigned int DES_LONG; - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -typedef unsigned char DES_cblock[8]; -typedef /* const */ unsigned char const_DES_cblock[8]; -/* - * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and - * const_DES_cblock * are incompatible pointer types. - */ - -typedef struct DES_ks { - union { - DES_cblock cblock; - /* - * make sure things are correct size on machines with 8 byte longs - */ - DES_LONG deslong[2]; - } ks[16]; -} DES_key_schedule; - -# define DES_KEY_SZ (sizeof(DES_cblock)) -# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) - -# define DES_ENCRYPT 1 -# define DES_DECRYPT 0 - -# define DES_CBC_MODE 0 -# define DES_PCBC_MODE 1 - -# 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)) - -OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */ -# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) - -const char *DES_options(void); -void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, int enc); -DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, - long length, DES_key_schedule *schedule, - const_DES_cblock *ivec); -/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ -void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, const_DES_cblock *inw, - const_DES_cblock *outw, int enc); -void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks, int enc); - -/* - * This is the DES encryption function that gets called by just about every - * other DES routine in the library. You should not use this function except - * to implement 'modes' of DES. I say this because the functions that call - * this routine do the conversion from 'char *' to long, and this needs to be - * done to make sure 'non-aligned' memory access do not occur. The - * characters are loaded 'little endian'. Data is a pointer to 2 unsigned - * long's and ks is the DES_key_schedule to use. enc, is non zero specifies - * encryption, zero if decryption. - */ -void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); - -/* - * This functions is the same as DES_encrypt1() except that the DES initial - * permutation (IP) and final permutation (FP) have been left out. As for - * DES_encrypt1(), you should not use this function. It is used by the - * routines in the library that implement triple DES. IP() DES_encrypt2() - * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() - * DES_encrypt1() DES_encrypt1() except faster :-). - */ -void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); - -void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, DES_cblock *ivec, int enc); -void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num, int enc); -void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, - int numbits, long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int enc); -void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num); -char *DES_fcrypt(const char *buf, const char *salt, char *ret); -char *DES_crypt(const char *buf, const char *salt); -void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, - DES_cblock *ivec); -void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], - long length, int out_count, DES_cblock *seed); -int DES_random_key(DES_cblock *ret); -void DES_set_odd_parity(DES_cblock *key); -int DES_check_key_parity(const_DES_cblock *key); -int DES_is_weak_key(const_DES_cblock *key); -/* - * DES_set_key (= set_key = DES_key_sched = key_sched) calls - * DES_set_key_checked if global variable DES_check_key is set, - * DES_set_key_unchecked otherwise. - */ -int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); -int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); -int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); -void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); -void DES_string_to_key(const char *str, DES_cblock *key); -void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); -void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int *num, int enc); -void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int *num); - -# define DES_fixup_key_parity DES_set_odd_parity - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dh.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dh.h deleted file mode 100644 index 3527540c..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dh.h +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright 1995-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_DH_H -# define HEADER_DH_H - -# include - -# ifndef OPENSSL_NO_DH -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include - -# ifdef __cplusplus -extern "C" { -# endif - -# ifndef OPENSSL_DH_MAX_MODULUS_BITS -# define OPENSSL_DH_MAX_MODULUS_BITS 10000 -# endif - -# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 - -# define DH_FLAG_CACHE_MONT_P 0x01 - -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define DH_FLAG_NO_EXP_CONSTTIME 0x00 -# endif - -/* - * If this flag is set the DH method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define DH_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define DH_FLAG_NON_FIPS_ALLOW 0x0400 - -/* Already defined in ossl_typ.h */ -/* typedef struct dh_st DH; */ -/* typedef struct dh_method DH_METHOD; */ - -DECLARE_ASN1_ITEM(DHparams) - -# define DH_GENERATOR_2 2 -/* #define DH_GENERATOR_3 3 */ -# define DH_GENERATOR_5 5 - -/* DH_check error codes */ -# define DH_CHECK_P_NOT_PRIME 0x01 -# define DH_CHECK_P_NOT_SAFE_PRIME 0x02 -# define DH_UNABLE_TO_CHECK_GENERATOR 0x04 -# define DH_NOT_SUITABLE_GENERATOR 0x08 -# define DH_CHECK_Q_NOT_PRIME 0x10 -# define DH_CHECK_INVALID_Q_VALUE 0x20 -# define DH_CHECK_INVALID_J_VALUE 0x40 - -/* DH_check_pub_key error codes */ -# define DH_CHECK_PUBKEY_TOO_SMALL 0x01 -# define DH_CHECK_PUBKEY_TOO_LARGE 0x02 -# define DH_CHECK_PUBKEY_INVALID 0x04 - -/* - * primes p where (p-1)/2 is prime too are called "safe"; we define this for - * backward compatibility: - */ -# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME - -# define d2i_DHparams_fp(fp,x) \ - (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ - (char *(*)())d2i_DHparams, \ - (fp), \ - (unsigned char **)(x)) -# define i2d_DHparams_fp(fp,x) \ - ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x)) -# define d2i_DHparams_bio(bp,x) \ - ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) -# define i2d_DHparams_bio(bp,x) \ - ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) - -# define d2i_DHxparams_fp(fp,x) \ - (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ - (char *(*)())d2i_DHxparams, \ - (fp), \ - (unsigned char **)(x)) -# define i2d_DHxparams_fp(fp,x) \ - ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x)) -# define d2i_DHxparams_bio(bp,x) \ - ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) -# define i2d_DHxparams_bio(bp,x) \ - ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x) - -DH *DHparams_dup(DH *); - -const DH_METHOD *DH_OpenSSL(void); - -void DH_set_default_method(const DH_METHOD *meth); -const DH_METHOD *DH_get_default_method(void); -int DH_set_method(DH *dh, const DH_METHOD *meth); -DH *DH_new_method(ENGINE *engine); - -DH *DH_new(void); -void DH_free(DH *dh); -int DH_up_ref(DH *dh); -int DH_bits(const DH *dh); -int DH_size(const DH *dh); -int DH_security_bits(const DH *dh); -#define DH_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef) -int DH_set_ex_data(DH *d, int idx, void *arg); -void *DH_get_ex_data(DH *d, int idx); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator, - void (*callback) (int, int, - void *), - void *cb_arg)) - -/* New version */ -int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, - BN_GENCB *cb); - -int DH_check_params_ex(const DH *dh); -int DH_check_ex(const DH *dh); -int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key); -int DH_check_params(const DH *dh, int *ret); -int DH_check(const DH *dh, int *codes); -int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes); -int DH_generate_key(DH *dh); -int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); -int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh); -DH *d2i_DHparams(DH **a, const unsigned char **pp, long length); -int i2d_DHparams(const DH *a, unsigned char **pp); -DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length); -int i2d_DHxparams(const DH *a, unsigned char **pp); -# ifndef OPENSSL_NO_STDIO -int DHparams_print_fp(FILE *fp, const DH *x); -# endif -int DHparams_print(BIO *bp, const DH *x); - -/* RFC 5114 parameters */ -DH *DH_get_1024_160(void); -DH *DH_get_2048_224(void); -DH *DH_get_2048_256(void); - -/* Named parameters, currently RFC7919 */ -DH *DH_new_by_nid(int nid); -int DH_get_nid(const DH *dh); - -# ifndef OPENSSL_NO_CMS -/* RFC2631 KDF */ -int DH_KDF_X9_42(unsigned char *out, size_t outlen, - const unsigned char *Z, size_t Zlen, - ASN1_OBJECT *key_oid, - const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); -# endif - -void DH_get0_pqg(const DH *dh, - const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); -void DH_get0_key(const DH *dh, - const BIGNUM **pub_key, const BIGNUM **priv_key); -int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); -const BIGNUM *DH_get0_p(const DH *dh); -const BIGNUM *DH_get0_q(const DH *dh); -const BIGNUM *DH_get0_g(const DH *dh); -const BIGNUM *DH_get0_priv_key(const DH *dh); -const BIGNUM *DH_get0_pub_key(const DH *dh); -void DH_clear_flags(DH *dh, int flags); -int DH_test_flags(const DH *dh, int flags); -void DH_set_flags(DH *dh, int flags); -ENGINE *DH_get0_engine(DH *d); -long DH_get_length(const DH *dh); -int DH_set_length(DH *dh, long length); - -DH_METHOD *DH_meth_new(const char *name, int flags); -void DH_meth_free(DH_METHOD *dhm); -DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); -const char *DH_meth_get0_name(const DH_METHOD *dhm); -int DH_meth_set1_name(DH_METHOD *dhm, const char *name); -int DH_meth_get_flags(const DH_METHOD *dhm); -int DH_meth_set_flags(DH_METHOD *dhm, int flags); -void *DH_meth_get0_app_data(const DH_METHOD *dhm); -int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); -int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); -int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); -int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) - (unsigned char *key, const BIGNUM *pub_key, DH *dh); -int DH_meth_set_compute_key(DH_METHOD *dhm, - int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); -int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) - (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - BN_CTX *, BN_MONT_CTX *); -int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, - int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); -int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); -int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); -int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); -int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); -int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) - (DH *, int, int, BN_GENCB *); -int DH_meth_set_generate_params(DH_METHOD *dhm, - int (*generate_params) (DH *, int, int, BN_GENCB *)); - - -# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) - -# define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) - -# define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) - -# define EVP_PKEY_CTX_set_dh_nid(ctx, nid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, \ - EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_DH_NID, nid, NULL) - -# define EVP_PKEY_CTX_set_dh_pad(ctx, pad) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_PAD, pad, NULL) - -# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL) - -# define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL) - -# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)(oid)) - -# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)(poid)) - -# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)(plen)) - -# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)(p)) - -# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)(p)) - -# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) -# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) -# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) -# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) -# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) -# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) -# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15) -# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16) - -/* KDF types */ -# define EVP_PKEY_DH_KDF_NONE 1 -# ifndef OPENSSL_NO_CMS -# define EVP_PKEY_DH_KDF_X9_42 2 -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dherr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dherr.h deleted file mode 100644 index 916b3bed..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dherr.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dsa.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dsa.h deleted file mode 100644 index 6d8a18a4..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dsa.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 1995-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_DSA_H -# define HEADER_DSA_H - -# include - -# ifndef OPENSSL_NO_DSA -# ifdef __cplusplus -extern "C" { -# endif -# include -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include - -# ifndef OPENSSL_DSA_MAX_MODULUS_BITS -# define OPENSSL_DSA_MAX_MODULUS_BITS 10000 -# endif - -# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 - -# define DSA_FLAG_CACHE_MONT_P 0x01 -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define DSA_FLAG_NO_EXP_CONSTTIME 0x00 -# endif - -/* - * If this flag is set the DSA method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define DSA_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define DSA_FLAG_NON_FIPS_ALLOW 0x0400 -# define DSA_FLAG_FIPS_CHECKED 0x0800 - -/* Already defined in ossl_typ.h */ -/* typedef struct dsa_st DSA; */ -/* typedef struct dsa_method DSA_METHOD; */ - -typedef struct DSA_SIG_st DSA_SIG; - -# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ - (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) -# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ - (unsigned char *)(x)) -# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) -# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) - -DSA *DSAparams_dup(DSA *x); -DSA_SIG *DSA_SIG_new(void); -void DSA_SIG_free(DSA_SIG *a); -int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); -DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); -void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); -int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); - -DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); -int DSA_do_verify(const unsigned char *dgst, int dgst_len, - DSA_SIG *sig, DSA *dsa); - -const DSA_METHOD *DSA_OpenSSL(void); - -void DSA_set_default_method(const DSA_METHOD *); -const DSA_METHOD *DSA_get_default_method(void); -int DSA_set_method(DSA *dsa, const DSA_METHOD *); -const DSA_METHOD *DSA_get_method(DSA *d); - -DSA *DSA_new(void); -DSA *DSA_new_method(ENGINE *engine); -void DSA_free(DSA *r); -/* "up" the DSA object's reference count */ -int DSA_up_ref(DSA *r); -int DSA_size(const DSA *); -int DSA_bits(const DSA *d); -int DSA_security_bits(const DSA *d); - /* next 4 return -1 on error */ -DEPRECATEDIN_1_2_0(int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)) -int DSA_sign(int type, const unsigned char *dgst, int dlen, - unsigned char *sig, unsigned int *siglen, DSA *dsa); -int DSA_verify(int type, const unsigned char *dgst, int dgst_len, - const unsigned char *sigbuf, int siglen, DSA *dsa); -#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef) -int DSA_set_ex_data(DSA *d, int idx, void *arg); -void *DSA_get_ex_data(DSA *d, int idx); - -DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); -DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); -DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits, - unsigned char *seed, - int seed_len, - int *counter_ret, - unsigned long *h_ret, void - (*callback) (int, int, - void *), - void *cb_arg)) - -/* New version */ -int DSA_generate_parameters_ex(DSA *dsa, int bits, - const unsigned char *seed, int seed_len, - int *counter_ret, unsigned long *h_ret, - BN_GENCB *cb); - -int DSA_generate_key(DSA *a); -int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); -int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); -int i2d_DSAparams(const DSA *a, unsigned char **pp); - -int DSAparams_print(BIO *bp, const DSA *x); -int DSA_print(BIO *bp, const DSA *x, int off); -# ifndef OPENSSL_NO_STDIO -int DSAparams_print_fp(FILE *fp, const DSA *x); -int DSA_print_fp(FILE *bp, const DSA *x, int off); -# endif - -# define DSS_prime_checks 64 -/* - * Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only - * have one value here we set the number of checks to 64 which is the 128 bit - * security level that is the highest level and valid for creating a 3072 bit - * DSA key. - */ -# define DSA_is_prime(n, callback, cb_arg) \ - BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) - -# ifndef OPENSSL_NO_DH -/* - * Convert DSA structure (key or just parameters) into DH structure (be - * careful to avoid small subgroup attacks when using this!) - */ -DH *DSA_dup_DH(const DSA *r); -# endif - -# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) -# define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits, NULL) -# define EVP_PKEY_CTX_set_dsa_paramgen_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) - -void DSA_get0_pqg(const DSA *d, - const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); -void DSA_get0_key(const DSA *d, - const BIGNUM **pub_key, const BIGNUM **priv_key); -int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); -const BIGNUM *DSA_get0_p(const DSA *d); -const BIGNUM *DSA_get0_q(const DSA *d); -const BIGNUM *DSA_get0_g(const DSA *d); -const BIGNUM *DSA_get0_pub_key(const DSA *d); -const BIGNUM *DSA_get0_priv_key(const DSA *d); -void DSA_clear_flags(DSA *d, int flags); -int DSA_test_flags(const DSA *d, int flags); -void DSA_set_flags(DSA *d, int flags); -ENGINE *DSA_get0_engine(DSA *d); - -DSA_METHOD *DSA_meth_new(const char *name, int flags); -void DSA_meth_free(DSA_METHOD *dsam); -DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam); -const char *DSA_meth_get0_name(const DSA_METHOD *dsam); -int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name); -int DSA_meth_get_flags(const DSA_METHOD *dsam); -int DSA_meth_set_flags(DSA_METHOD *dsam, int flags); -void *DSA_meth_get0_app_data(const DSA_METHOD *dsam); -int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data); -DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam)) - (const unsigned char *, int, DSA *); -int DSA_meth_set_sign(DSA_METHOD *dsam, - DSA_SIG *(*sign) (const unsigned char *, int, DSA *)); -int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam)) - (DSA *, BN_CTX *, BIGNUM **, BIGNUM **); -int DSA_meth_set_sign_setup(DSA_METHOD *dsam, - int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)); -int (*DSA_meth_get_verify(const DSA_METHOD *dsam)) - (const unsigned char *, int, DSA_SIG *, DSA *); -int DSA_meth_set_verify(DSA_METHOD *dsam, - int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *)); -int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam)) - (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); -int DSA_meth_set_mod_exp(DSA_METHOD *dsam, - int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, - BN_MONT_CTX *)); -int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam)) - (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - BN_CTX *, BN_MONT_CTX *); -int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, - int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); -int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *); -int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *)); -int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *); -int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *)); -int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam)) - (DSA *, int, const unsigned char *, int, int *, unsigned long *, - BN_GENCB *); -int DSA_meth_set_paramgen(DSA_METHOD *dsam, - int (*paramgen) (DSA *, int, const unsigned char *, int, int *, - unsigned long *, BN_GENCB *)); -int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *); -int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *)); - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dsaerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dsaerr.h deleted file mode 100644 index 495a1ac8..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dsaerr.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dtls1.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dtls1.h deleted file mode 100644 index d55ca9c3..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/dtls1.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2005-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_DTLS1_H -# define HEADER_DTLS1_H - -#ifdef __cplusplus -extern "C" { -#endif - -# define DTLS1_VERSION 0xFEFF -# define DTLS1_2_VERSION 0xFEFD -# define DTLS_MIN_VERSION DTLS1_VERSION -# define DTLS_MAX_VERSION DTLS1_2_VERSION -# define DTLS1_VERSION_MAJOR 0xFE - -# define DTLS1_BAD_VER 0x0100 - -/* Special value for method supporting multiple versions */ -# define DTLS_ANY_VERSION 0x1FFFF - -/* lengths of messages */ -/* - * Actually the max cookie length in DTLS is 255. But we can't change this now - * due to compatibility concerns. - */ -# define DTLS1_COOKIE_LENGTH 256 - -# define DTLS1_RT_HEADER_LENGTH 13 - -# define DTLS1_HM_HEADER_LENGTH 12 - -# define DTLS1_HM_BAD_FRAGMENT -2 -# define DTLS1_HM_FRAGMENT_RETRY -3 - -# define DTLS1_CCS_HEADER_LENGTH 1 - -# define DTLS1_AL_HEADER_LENGTH 2 - -/* Timeout multipliers */ -# define DTLS1_TMO_READ_COUNT 2 -# define DTLS1_TMO_WRITE_COUNT 2 - -# define DTLS1_TMO_ALERT_COUNT 12 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/e_os2.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/e_os2.h deleted file mode 100644 index 97a776cd..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/e_os2.h +++ /dev/null @@ -1,300 +0,0 @@ -/* - * 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_E_OS2_H -# define HEADER_E_OS2_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/****************************************************************************** - * Detect operating systems. This probably needs completing. - * The result is that at least one OPENSSL_SYS_os macro should be defined. - * However, if none is defined, Unix is assumed. - **/ - -# define OPENSSL_SYS_UNIX - -/* --------------------- Microsoft operating systems ---------------------- */ - -/* - * Note that MSDOS actually denotes 32-bit environments running on top of - * MS-DOS, such as DJGPP one. - */ -# if defined(OPENSSL_SYS_MSDOS) -# undef OPENSSL_SYS_UNIX -# endif - -/* - * For 32 bit environment, there seems to be the CygWin environment and then - * all the others that try to do the same thing Microsoft does... - */ -/* - * UEFI lives here because it might be built with a Microsoft toolchain and - * we need to avoid the false positive match on Windows. - */ -# if defined(OPENSSL_SYS_UEFI) -# undef OPENSSL_SYS_UNIX -# elif defined(OPENSSL_SYS_UWIN) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WIN32_UWIN -# else -# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN) -# define OPENSSL_SYS_WIN32_CYGWIN -# else -# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32) -# undef OPENSSL_SYS_UNIX -# if !defined(OPENSSL_SYS_WIN32) -# define OPENSSL_SYS_WIN32 -# endif -# endif -# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64) -# undef OPENSSL_SYS_UNIX -# if !defined(OPENSSL_SYS_WIN64) -# define OPENSSL_SYS_WIN64 -# endif -# endif -# if defined(OPENSSL_SYS_WINNT) -# undef OPENSSL_SYS_UNIX -# endif -# if defined(OPENSSL_SYS_WINCE) -# undef OPENSSL_SYS_UNIX -# endif -# endif -# endif - -/* Anything that tries to look like Microsoft is "Windows" */ -# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_SYS_MSDOS -# define OPENSSL_SYS_MSDOS -# endif -# endif - -/* - * DLL settings. This part is a bit tough, because it's up to the - * application implementor how he or she will link the application, so it - * requires some macro to be used. - */ -# ifdef OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_OPT_WINDLL -# if defined(_WINDLL) /* This is used when building OpenSSL to - * indicate that DLL linkage should be used */ -# define OPENSSL_OPT_WINDLL -# endif -# endif -# endif - -/* ------------------------------- OpenVMS -------------------------------- */ -# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS) -# if !defined(OPENSSL_SYS_VMS) -# undef OPENSSL_SYS_UNIX -# endif -# define OPENSSL_SYS_VMS -# if defined(__DECC) -# define OPENSSL_SYS_VMS_DECC -# elif defined(__DECCXX) -# define OPENSSL_SYS_VMS_DECC -# define OPENSSL_SYS_VMS_DECCXX -# else -# define OPENSSL_SYS_VMS_NODECC -# endif -# endif - -/* -------------------------------- Unix ---------------------------------- */ -# ifdef OPENSSL_SYS_UNIX -# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX) -# define OPENSSL_SYS_LINUX -# endif -# if defined(_AIX) && !defined(OPENSSL_SYS_AIX) -# define OPENSSL_SYS_AIX -# endif -# endif - -/* -------------------------------- VOS ----------------------------------- */ -# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS) -# define OPENSSL_SYS_VOS -# ifdef __HPPA__ -# define OPENSSL_SYS_VOS_HPPA -# endif -# ifdef __IA32__ -# define OPENSSL_SYS_VOS_IA32 -# endif -# endif - -/** - * That's it for OS-specific stuff - *****************************************************************************/ - -/* Specials for I/O an exit */ -# ifdef OPENSSL_SYS_MSDOS -# define OPENSSL_UNISTD_IO -# define OPENSSL_DECLARE_EXIT extern void exit(int); -# else -# define OPENSSL_UNISTD_IO OPENSSL_UNISTD -# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ -# endif - -/*- - * OPENSSL_EXTERN is normally used to declare a symbol with possible extra - * attributes to handle its presence in a shared library. - * OPENSSL_EXPORT is used to define a symbol with extra possible attributes - * to make it visible in a shared library. - * Care needs to be taken when a header file is used both to declare and - * define symbols. Basically, for any library that exports some global - * variables, the following code must be present in the header file that - * declares them, before OPENSSL_EXTERN is used: - * - * #ifdef SOME_BUILD_FLAG_MACRO - * # undef OPENSSL_EXTERN - * # define OPENSSL_EXTERN OPENSSL_EXPORT - * #endif - * - * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN - * have some generally sensible values. - */ - -# if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) -# define OPENSSL_EXPORT extern __declspec(dllexport) -# define OPENSSL_EXTERN extern __declspec(dllimport) -# else -# define OPENSSL_EXPORT extern -# define OPENSSL_EXTERN extern -# endif - -/*- - * Macros to allow global variables to be reached through function calls when - * required (if a shared library version requires it, for example. - * The way it's done allows definitions like this: - * - * // in foobar.c - * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) - * // in foobar.h - * OPENSSL_DECLARE_GLOBAL(int,foobar); - * #define foobar OPENSSL_GLOBAL_REF(foobar) - */ -# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ - type *_shadow_##name(void) \ - { static type _hide_##name=value; return &_hide_##name; } -# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) -# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) -# else -# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) type _shadow_##name=value; -# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name -# define OPENSSL_GLOBAL_REF(name) _shadow_##name -# endif - -# ifdef _WIN32 -# ifdef _WIN64 -# define ossl_ssize_t __int64 -# define OSSL_SSIZE_MAX _I64_MAX -# else -# define ossl_ssize_t int -# define OSSL_SSIZE_MAX INT_MAX -# endif -# endif - -# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t) -# define ossl_ssize_t INTN -# define OSSL_SSIZE_MAX MAX_INTN -# endif - -# ifndef ossl_ssize_t -# define ossl_ssize_t ssize_t -# if defined(SSIZE_MAX) -# define OSSL_SSIZE_MAX SSIZE_MAX -# elif defined(_POSIX_SSIZE_MAX) -# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX -# else -# define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1)) -# endif -# endif - -# ifdef DEBUG_UNUSED -# define __owur __attribute__((__warn_unused_result__)) -# else -# define __owur -# endif - -/* Standard integer types */ -# if defined(OPENSSL_SYS_UEFI) -typedef INT8 int8_t; -typedef UINT8 uint8_t; -typedef INT16 int16_t; -typedef UINT16 uint16_t; -typedef INT32 int32_t; -typedef UINT32 uint32_t; -typedef INT64 int64_t; -typedef UINT64 uint64_t; -# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ - defined(__osf__) || defined(__sgi) || defined(__hpux) || \ - defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__) -# include -# elif defined(_MSC_VER) && _MSC_VER<=1500 -/* - * minimally required typdefs for systems not supporting inttypes.h or - * stdint.h: currently just older VC++ - */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -# else -# include -# endif - -/* ossl_inline: portable inline definition usable in public headers */ -# if !defined(inline) && !defined(__cplusplus) -# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L - /* just use inline */ -# define ossl_inline inline -# elif defined(__GNUC__) && __GNUC__>=2 -# define ossl_inline __inline__ -# elif defined(_MSC_VER) - /* - * Visual Studio: inline is available in C++ only, however - * __inline is available for C, see - * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx - */ -# define ossl_inline __inline -# else -# define ossl_inline -# endif -# else -# define ossl_inline inline -# endif - -# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -# define ossl_noreturn _Noreturn -# elif defined(__GNUC__) && __GNUC__ >= 2 -# define ossl_noreturn __attribute__((noreturn)) -# else -# define ossl_noreturn -# endif - -/* ossl_unused: portable unused attribute for use in public headers */ -# if defined(__GNUC__) -# define ossl_unused __attribute__((unused)) -# else -# define ossl_unused -# endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ebcdic.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ebcdic.h deleted file mode 100644 index aa012855..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ebcdic.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 1999-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_EBCDIC_H -# define HEADER_EBCDIC_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Avoid name clashes with other applications */ -# define os_toascii _openssl_os_toascii -# define os_toebcdic _openssl_os_toebcdic -# define ebcdic2ascii _openssl_ebcdic2ascii -# define ascii2ebcdic _openssl_ascii2ebcdic - -extern const unsigned char os_toascii[256]; -extern const unsigned char os_toebcdic[256]; -void *ebcdic2ascii(void *dest, const void *srce, size_t count); -void *ascii2ebcdic(void *dest, const void *srce, size_t count); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ec.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ec.h deleted file mode 100644 index 5af9ebdc..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ec.h +++ /dev/null @@ -1,1479 +0,0 @@ -/* - * Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_EC_H -# define HEADER_EC_H - -# include - -# ifndef OPENSSL_NO_EC -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# ifdef __cplusplus -extern "C" { -# endif - -# ifndef OPENSSL_ECC_MAX_FIELD_BITS -# define OPENSSL_ECC_MAX_FIELD_BITS 661 -# endif - -/** Enum for the point conversion form as defined in X9.62 (ECDSA) - * for the encoding of a elliptic curve point (x,y) */ -typedef enum { - /** the point is encoded as z||x, where the octet z specifies - * which solution of the quadratic equation y is */ - POINT_CONVERSION_COMPRESSED = 2, - /** the point is encoded as z||x||y, where z is the octet 0x04 */ - POINT_CONVERSION_UNCOMPRESSED = 4, - /** the point is encoded as z||x||y, where the octet z specifies - * which solution of the quadratic equation y is */ - POINT_CONVERSION_HYBRID = 6 -} point_conversion_form_t; - -typedef struct ec_method_st EC_METHOD; -typedef struct ec_group_st EC_GROUP; -typedef struct ec_point_st EC_POINT; -typedef struct ecpk_parameters_st ECPKPARAMETERS; -typedef struct ec_parameters_st ECPARAMETERS; - -/********************************************************************/ -/* EC_METHODs for curves over GF(p) */ -/********************************************************************/ - -/** Returns the basic GFp ec methods which provides the basis for the - * optimized methods. - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_simple_method(void); - -/** Returns GFp methods using montgomery multiplication. - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_mont_method(void); - -/** Returns GFp methods using optimized methods for NIST recommended curves - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nist_method(void); - -# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -/** Returns 64-bit optimized methods for nistp224 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp224_method(void); - -/** Returns 64-bit optimized methods for nistp256 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp256_method(void); - -/** Returns 64-bit optimized methods for nistp521 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp521_method(void); -# endif - -# ifndef OPENSSL_NO_EC2M -/********************************************************************/ -/* EC_METHOD for curves over GF(2^m) */ -/********************************************************************/ - -/** Returns the basic GF2m ec method - * \return EC_METHOD object - */ -const EC_METHOD *EC_GF2m_simple_method(void); - -# endif - -/********************************************************************/ -/* EC_GROUP functions */ -/********************************************************************/ - -/** Creates a new EC_GROUP object - * \param meth EC_METHOD to use - * \return newly created EC_GROUP object or NULL in case of an error. - */ -EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); - -/** Frees a EC_GROUP object - * \param group EC_GROUP object to be freed. - */ -void EC_GROUP_free(EC_GROUP *group); - -/** Clears and frees a EC_GROUP object - * \param group EC_GROUP object to be cleared and freed. - */ -void EC_GROUP_clear_free(EC_GROUP *group); - -/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. - * \param dst destination EC_GROUP object - * \param src source EC_GROUP object - * \return 1 on success and 0 if an error occurred. - */ -int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); - -/** Creates a new EC_GROUP object and copies the copies the content - * form src to the newly created EC_KEY object - * \param src source EC_GROUP object - * \return newly created EC_GROUP object or NULL in case of an error. - */ -EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); - -/** Returns the EC_METHOD of the EC_GROUP object. - * \param group EC_GROUP object - * \return EC_METHOD used in this EC_GROUP object. - */ -const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); - -/** Returns the field type of the EC_METHOD. - * \param meth EC_METHOD object - * \return NID of the underlying field type OID. - */ -int EC_METHOD_get_field_type(const EC_METHOD *meth); - -/** Sets the generator and its order/cofactor of a EC_GROUP object. - * \param group EC_GROUP object - * \param generator EC_POINT object with the generator. - * \param order the order of the group generated by the generator. - * \param cofactor the index of the sub-group generated by the generator - * in the group of all points on the elliptic curve. - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, - const BIGNUM *order, const BIGNUM *cofactor); - -/** Returns the generator of a EC_GROUP object. - * \param group EC_GROUP object - * \return the currently used generator (possibly NULL). - */ -const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); - -/** Returns the montgomery data for order(Generator) - * \param group EC_GROUP object - * \return the currently used montgomery data (possibly NULL). -*/ -BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); - -/** Gets the order of a EC_GROUP - * \param group EC_GROUP object - * \param order BIGNUM to which the order is copied - * \param ctx unused - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); - -/** Gets the order of an EC_GROUP - * \param group EC_GROUP object - * \return the group order - */ -const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); - -/** Gets the number of bits of the order of an EC_GROUP - * \param group EC_GROUP object - * \return number of bits of group order. - */ -int EC_GROUP_order_bits(const EC_GROUP *group); - -/** Gets the cofactor of a EC_GROUP - * \param group EC_GROUP object - * \param cofactor BIGNUM to which the cofactor is copied - * \param ctx unused - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, - BN_CTX *ctx); - -/** Gets the cofactor of an EC_GROUP - * \param group EC_GROUP object - * \return the group cofactor - */ -const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group); - -/** Sets the name of a EC_GROUP object - * \param group EC_GROUP object - * \param nid NID of the curve name OID - */ -void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); - -/** Returns the curve name of a EC_GROUP object - * \param group EC_GROUP object - * \return NID of the curve name OID or 0 if not set. - */ -int EC_GROUP_get_curve_name(const EC_GROUP *group); - -void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); -int EC_GROUP_get_asn1_flag(const EC_GROUP *group); - -void EC_GROUP_set_point_conversion_form(EC_GROUP *group, - point_conversion_form_t form); -point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); - -unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); -size_t EC_GROUP_get_seed_len(const EC_GROUP *); -size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); - -/** Sets the parameters of a ec curve defined by y^2 = x^3 + a*x + b (for GFp) - * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); - -/** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp) - * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, - BN_CTX *ctx); - -/** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, - const BIGNUM *a, const BIGNUM *b, - BN_CTX *ctx)) - -/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, - BIGNUM *a, BIGNUM *b, - BN_CTX *ctx)) - -# ifndef OPENSSL_NO_EC2M -/** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, - const BIGNUM *a, const BIGNUM *b, - BN_CTX *ctx)) - -/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, - BIGNUM *a, BIGNUM *b, - BN_CTX *ctx)) -# endif -/** Returns the number of bits needed to represent a field element - * \param group EC_GROUP object - * \return number of bits needed to represent a field element - */ -int EC_GROUP_get_degree(const EC_GROUP *group); - -/** Checks whether the parameter in the EC_GROUP define a valid ec group - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 if group is a valid ec group and 0 otherwise - */ -int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); - -/** Checks whether the discriminant of the elliptic curve is zero or not - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 if the discriminant is not zero and 0 otherwise - */ -int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); - -/** Compares two EC_GROUP objects - * \param a first EC_GROUP object - * \param b second EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 0 if the groups are equal, 1 if not, or -1 on error - */ -int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); - -/* - * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after - * choosing an appropriate EC_METHOD - */ - -/** Creates a new EC_GROUP object with the specified parameters defined - * over GFp (defined by the equation y^2 = x^3 + a*x + b) - * \param p BIGNUM with the prime number - * \param a BIGNUM with the parameter a of the equation - * \param b BIGNUM with the parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return newly created EC_GROUP object with the specified parameters - */ -EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); -# ifndef OPENSSL_NO_EC2M -/** Creates a new EC_GROUP object with the specified parameters defined - * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) - * \param p BIGNUM with the polynomial defining the underlying field - * \param a BIGNUM with the parameter a of the equation - * \param b BIGNUM with the parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return newly created EC_GROUP object with the specified parameters - */ -EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); -# endif - -/** Creates a EC_GROUP object with a curve specified by a NID - * \param nid NID of the OID of the curve name - * \return newly created EC_GROUP object with specified curve or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_by_curve_name(int nid); - -/** Creates a new EC_GROUP object from an ECPARAMETERS object - * \param params pointer to the ECPARAMETERS object - * \return newly created EC_GROUP object with specified curve or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params); - -/** Creates an ECPARAMETERS object for the given EC_GROUP object. - * \param group pointer to the EC_GROUP object - * \param params pointer to an existing ECPARAMETERS object or NULL - * \return pointer to the new ECPARAMETERS object or NULL - * if an error occurred. - */ -ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, - ECPARAMETERS *params); - -/** Creates a new EC_GROUP object from an ECPKPARAMETERS object - * \param params pointer to an existing ECPKPARAMETERS object, or NULL - * \return newly created EC_GROUP object with specified curve, or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params); - -/** Creates an ECPKPARAMETERS object for the given EC_GROUP object. - * \param group pointer to the EC_GROUP object - * \param params pointer to an existing ECPKPARAMETERS object or NULL - * \return pointer to the new ECPKPARAMETERS object or NULL - * if an error occurred. - */ -ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, - ECPKPARAMETERS *params); - -/********************************************************************/ -/* handling of internal curves */ -/********************************************************************/ - -typedef struct { - int nid; - const char *comment; -} EC_builtin_curve; - -/* - * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all - * available curves or zero if a error occurred. In case r is not zero, - * nitems EC_builtin_curve structures are filled with the data of the first - * nitems internal groups - */ -size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); - -const char *EC_curve_nid2nist(int nid); -int EC_curve_nist2nid(const char *name); - -/********************************************************************/ -/* EC_POINT functions */ -/********************************************************************/ - -/** Creates a new EC_POINT object for the specified EC_GROUP - * \param group EC_GROUP the underlying EC_GROUP object - * \return newly created EC_POINT object or NULL if an error occurred - */ -EC_POINT *EC_POINT_new(const EC_GROUP *group); - -/** Frees a EC_POINT object - * \param point EC_POINT object to be freed - */ -void EC_POINT_free(EC_POINT *point); - -/** Clears and frees a EC_POINT object - * \param point EC_POINT object to be cleared and freed - */ -void EC_POINT_clear_free(EC_POINT *point); - -/** Copies EC_POINT object - * \param dst destination EC_POINT object - * \param src source EC_POINT object - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); - -/** Creates a new EC_POINT object and copies the content of the supplied - * EC_POINT - * \param src source EC_POINT object - * \param group underlying the EC_GROUP object - * \return newly created EC_POINT object or NULL if an error occurred - */ -EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); - -/** Returns the EC_METHOD used in EC_POINT object - * \param point EC_POINT object - * \return the EC_METHOD used - */ -const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); - -/** Sets a point to infinity (neutral element) - * \param group underlying EC_GROUP object - * \param point EC_POINT to set to infinity - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); - -/** Sets the jacobian projective coordinates of a EC_POINT over GFp - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param z BIGNUM with the z-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, const BIGNUM *x, - const BIGNUM *y, const BIGNUM *z, - BN_CTX *ctx); - -/** Gets the jacobian projective coordinates of a EC_POINT over GFp - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param z BIGNUM for the z-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, - const EC_POINT *p, BIGNUM *x, - BIGNUM *y, BIGNUM *z, - BN_CTX *ctx); - -/** Sets the affine coordinates of an EC_POINT - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, - const BIGNUM *x, const BIGNUM *y, - BN_CTX *ctx); - -/** Gets the affine coordinates of an EC_POINT. - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p, - BIGNUM *x, BIGNUM *y, BN_CTX *ctx); - -/** Sets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_set_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - const BIGNUM *y, - BN_CTX *ctx)) - -/** Gets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_get_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, - const EC_POINT *p, - BIGNUM *x, - BIGNUM *y, - BN_CTX *ctx)) - -/** Sets the x9.62 compressed coordinates of a EC_POINT - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p, - const BIGNUM *x, int y_bit, - BN_CTX *ctx); - -/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of - * EC_POINT_set_compressed_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - int y_bit, - BN_CTX *ctx)) -# ifndef OPENSSL_NO_EC2M -/** Sets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_set_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - const BIGNUM *y, - BN_CTX *ctx)) - -/** Gets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_get_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, - const EC_POINT *p, - BIGNUM *x, - BIGNUM *y, - BN_CTX *ctx)) - -/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of - * EC_POINT_set_compressed_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - int y_bit, - BN_CTX *ctx)) -# endif -/** Encodes a EC_POINT object to a octet string - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param form point conversion form - * \param buf memory buffer for the result. If NULL the function returns - * required buffer size. - * \param len length of the memory buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, - point_conversion_form_t form, - unsigned char *buf, size_t len, BN_CTX *ctx); - -/** Decodes a EC_POINT from a octet string - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param buf memory buffer with the encoded ec point - * \param len length of the encoded ec point - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, - const unsigned char *buf, size_t len, BN_CTX *ctx); - -/** Encodes an EC_POINT object to an allocated octet string - * \param group underlying EC_GROUP object - * \param point EC_POINT object - * \param form point conversion form - * \param pbuf returns pointer to allocated buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point, - point_conversion_form_t form, - unsigned char **pbuf, BN_CTX *ctx); - -/* other interfaces to point2oct/oct2point: */ -BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, - point_conversion_form_t form, BIGNUM *, BN_CTX *); -EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, - EC_POINT *, BN_CTX *); -char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, - point_conversion_form_t form, BN_CTX *); -EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, - EC_POINT *, BN_CTX *); - -/********************************************************************/ -/* functions for doing EC_POINT arithmetic */ -/********************************************************************/ - -/** Computes the sum of two EC_POINT - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result (r = a + b) - * \param a EC_POINT object with the first summand - * \param b EC_POINT object with the second summand - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, - const EC_POINT *b, BN_CTX *ctx); - -/** Computes the double of a EC_POINT - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result (r = 2 * a) - * \param a EC_POINT object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, - BN_CTX *ctx); - -/** Computes the inverse of a EC_POINT - * \param group underlying EC_GROUP object - * \param a EC_POINT object to be inverted (it's used for the result as well) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); - -/** Checks whether the point is the neutral element of the group - * \param group the underlying EC_GROUP object - * \param p EC_POINT object - * \return 1 if the point is the neutral element and 0 otherwise - */ -int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); - -/** Checks whether the point is on the curve - * \param group underlying EC_GROUP object - * \param point EC_POINT object to check - * \param ctx BN_CTX object (optional) - * \return 1 if the point is on the curve, 0 if not, or -1 on error - */ -int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, - BN_CTX *ctx); - -/** Compares two EC_POINTs - * \param group underlying EC_GROUP object - * \param a first EC_POINT object - * \param b second EC_POINT object - * \param ctx BN_CTX object (optional) - * \return 1 if the points are not equal, 0 if they are, or -1 on error - */ -int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, - BN_CTX *ctx); - -int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); -int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, - EC_POINT *points[], BN_CTX *ctx); - -/** Computes r = generator * n + sum_{i=0}^{num-1} p[i] * m[i] - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result - * \param n BIGNUM with the multiplier for the group generator (optional) - * \param num number further summands - * \param p array of size num of EC_POINT objects - * \param m array of size num of BIGNUM objects - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, - size_t num, const EC_POINT *p[], const BIGNUM *m[], - BN_CTX *ctx); - -/** Computes r = generator * n + q * m - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result - * \param n BIGNUM with the multiplier for the group generator (optional) - * \param q EC_POINT object with the first factor of the second summand - * \param m BIGNUM with the second factor of the second summand - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, - const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); - -/** Stores multiples of generator for faster point multiplication - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); - -/** Reports whether a precomputation has been done - * \param group EC_GROUP object - * \return 1 if a pre-computation has been done and 0 otherwise - */ -int EC_GROUP_have_precompute_mult(const EC_GROUP *group); - -/********************************************************************/ -/* ASN1 stuff */ -/********************************************************************/ - -DECLARE_ASN1_ITEM(ECPKPARAMETERS) -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPKPARAMETERS) -DECLARE_ASN1_ITEM(ECPARAMETERS) -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) - -/* - * EC_GROUP_get_basis_type() returns the NID of the basis type used to - * represent the field elements - */ -int EC_GROUP_get_basis_type(const EC_GROUP *); -# ifndef OPENSSL_NO_EC2M -int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); -int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, - unsigned int *k2, unsigned int *k3); -# endif - -# define OPENSSL_EC_EXPLICIT_CURVE 0x000 -# define OPENSSL_EC_NAMED_CURVE 0x001 - -EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); -int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); - -# define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) -# define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) -# define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ - (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) -# define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ - (unsigned char *)(x)) - -int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); -# ifndef OPENSSL_NO_STDIO -int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); -# endif - -/********************************************************************/ -/* EC_KEY functions */ -/********************************************************************/ - -/* some values for the encoding_flag */ -# define EC_PKEY_NO_PARAMETERS 0x001 -# define EC_PKEY_NO_PUBKEY 0x002 - -/* some values for the flags field */ -# define EC_FLAG_NON_FIPS_ALLOW 0x1 -# define EC_FLAG_FIPS_CHECKED 0x2 -# define EC_FLAG_COFACTOR_ECDH 0x1000 - -/** Creates a new EC_KEY object. - * \return EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_new(void); - -int EC_KEY_get_flags(const EC_KEY *key); - -void EC_KEY_set_flags(EC_KEY *key, int flags); - -void EC_KEY_clear_flags(EC_KEY *key, int flags); - -/** Creates a new EC_KEY object using a named curve as underlying - * EC_GROUP object. - * \param nid NID of the named curve. - * \return EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_new_by_curve_name(int nid); - -/** Frees a EC_KEY object. - * \param key EC_KEY object to be freed. - */ -void EC_KEY_free(EC_KEY *key); - -/** Copies a EC_KEY object. - * \param dst destination EC_KEY object - * \param src src EC_KEY object - * \return dst or NULL if an error occurred. - */ -EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); - -/** Creates a new EC_KEY object and copies the content from src to it. - * \param src the source EC_KEY object - * \return newly created EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_dup(const EC_KEY *src); - -/** Increases the internal reference count of a EC_KEY object. - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_up_ref(EC_KEY *key); - -/** Returns the ENGINE object of a EC_KEY object - * \param eckey EC_KEY object - * \return the ENGINE object (possibly NULL). - */ -ENGINE *EC_KEY_get0_engine(const EC_KEY *eckey); - -/** Returns the EC_GROUP object of a EC_KEY object - * \param key EC_KEY object - * \return the EC_GROUP object (possibly NULL). - */ -const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); - -/** Sets the EC_GROUP of a EC_KEY object. - * \param key EC_KEY object - * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY - * object will use an own copy of the EC_GROUP). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); - -/** Returns the private key of a EC_KEY object. - * \param key EC_KEY object - * \return a BIGNUM with the private key (possibly NULL). - */ -const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); - -/** Sets the private key of a EC_KEY object. - * \param key EC_KEY object - * \param prv BIGNUM with the private key (note: the EC_KEY object - * will use an own copy of the BIGNUM). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); - -/** Returns the public key of a EC_KEY object. - * \param key the EC_KEY object - * \return a EC_POINT object with the public key (possibly NULL) - */ -const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); - -/** Sets the public key of a EC_KEY object. - * \param key EC_KEY object - * \param pub EC_POINT object with the public key (note: the EC_KEY object - * will use an own copy of the EC_POINT object). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); - -unsigned EC_KEY_get_enc_flags(const EC_KEY *key); -void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); -point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); -void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); - -#define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef) -int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg); -void *EC_KEY_get_ex_data(const EC_KEY *key, int idx); - -/* wrapper functions for the underlying EC_GROUP object */ -void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); - -/** Creates a table of pre-computed multiples of the generator to - * accelerate further EC_KEY operations. - * \param key EC_KEY object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); - -/** Creates a new ec private (and optional a new public) key. - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_generate_key(EC_KEY *key); - -/** Verifies that a private and/or public key is valid. - * \param key the EC_KEY object - * \return 1 on success and 0 otherwise. - */ -int EC_KEY_check_key(const EC_KEY *key); - -/** Indicates if an EC_KEY can be used for signing. - * \param eckey the EC_KEY object - * \return 1 if can can sign and 0 otherwise. - */ -int EC_KEY_can_sign(const EC_KEY *eckey); - -/** Sets a public key from affine coordinates performing - * necessary NIST PKV tests. - * \param key the EC_KEY object - * \param x public key x coordinate - * \param y public key y coordinate - * \return 1 on success and 0 otherwise. - */ -int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, - BIGNUM *y); - -/** Encodes an EC_KEY public key to an allocated octet string - * \param key key to encode - * \param form point conversion form - * \param pbuf returns pointer to allocated buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form, - unsigned char **pbuf, BN_CTX *ctx); - -/** Decodes a EC_KEY public key from a octet string - * \param key key to decode - * \param buf memory buffer with the encoded ec point - * \param len length of the encoded ec point - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ - -int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, - BN_CTX *ctx); - -/** Decodes an EC_KEY private key from an octet string - * \param key key to decode - * \param buf memory buffer with the encoded private key - * \param len length of the encoded key - * \return 1 on success and 0 if an error occurred - */ - -int EC_KEY_oct2priv(EC_KEY *key, const unsigned char *buf, size_t len); - -/** Encodes a EC_KEY private key to an octet string - * \param key key to encode - * \param buf memory buffer for the result. If NULL the function returns - * required buffer size. - * \param len length of the memory buffer - * \return the length of the encoded octet string or 0 if an error occurred - */ - -size_t EC_KEY_priv2oct(const EC_KEY *key, unsigned char *buf, size_t len); - -/** Encodes an EC_KEY private key to an allocated octet string - * \param eckey key to encode - * \param pbuf returns pointer to allocated buffer - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf); - -/********************************************************************/ -/* de- and encoding functions for SEC1 ECPrivateKey */ -/********************************************************************/ - -/** Decodes a private key from a memory buffer. - * \param key a pointer to a EC_KEY object which should be used (or NULL) - * \param in pointer to memory with the DER encoded private key - * \param len length of the DER encoded private key - * \return the decoded private key or NULL if an error occurred. - */ -EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes a private key object and stores the result in a buffer. - * \param key the EC_KEY object to encode - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred. - */ -int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); - -/********************************************************************/ -/* de- and encoding functions for EC parameters */ -/********************************************************************/ - -/** Decodes ec parameter from a memory buffer. - * \param key a pointer to a EC_KEY object which should be used (or NULL) - * \param in pointer to memory with the DER encoded ec parameters - * \param len length of the DER encoded ec parameters - * \return a EC_KEY object with the decoded parameters or NULL if an error - * occurred. - */ -EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes ec parameter and stores the result in a buffer. - * \param key the EC_KEY object with ec parameters to encode - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred. - */ -int i2d_ECParameters(EC_KEY *key, unsigned char **out); - -/********************************************************************/ -/* de- and encoding functions for EC public key */ -/* (octet string, not DER -- hence 'o2i' and 'i2o') */ -/********************************************************************/ - -/** Decodes a ec public key from a octet string. - * \param key a pointer to a EC_KEY object which should be used - * \param in memory buffer with the encoded public key - * \param len length of the encoded public key - * \return EC_KEY object with decoded public key or NULL if an error - * occurred. - */ -EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes a ec public key in an octet string. - * \param key the EC_KEY object with the public key - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred - */ -int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out); - -/** Prints out the ec parameters on human readable form. - * \param bp BIO object to which the information is printed - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred - */ -int ECParameters_print(BIO *bp, const EC_KEY *key); - -/** Prints out the contents of a EC_KEY object - * \param bp BIO object to which the information is printed - * \param key EC_KEY object - * \param off line offset - * \return 1 on success and 0 if an error occurred - */ -int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); - -# ifndef OPENSSL_NO_STDIO -/** Prints out the ec parameters on human readable form. - * \param fp file descriptor to which the information is printed - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred - */ -int ECParameters_print_fp(FILE *fp, const EC_KEY *key); - -/** Prints out the contents of a EC_KEY object - * \param fp file descriptor to which the information is printed - * \param key EC_KEY object - * \param off line offset - * \return 1 on success and 0 if an error occurred - */ -int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); - -# endif - -const EC_KEY_METHOD *EC_KEY_OpenSSL(void); -const EC_KEY_METHOD *EC_KEY_get_default_method(void); -void EC_KEY_set_default_method(const EC_KEY_METHOD *meth); -const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key); -int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth); -EC_KEY *EC_KEY_new_method(ENGINE *engine); - -/** The old name for ecdh_KDF_X9_63 - * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, - * it is actually specified in ANSI X9.63. - * This identifier is retained for backwards compatibility - */ -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); - -int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, - const EC_KEY *ecdh, - void *(*KDF) (const void *in, size_t inlen, - void *out, size_t *outlen)); - -typedef struct ECDSA_SIG_st 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 a negative value - * on error - */ -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); - -/** Accessor for r and s fields of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - * \param pr pointer to BIGNUM pointer for r (may be NULL) - * \param ps pointer to BIGNUM pointer for s (may be NULL) - */ -void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); - -/** Accessor for r field of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - */ -const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); - -/** Accessor for s field of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - */ -const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); - -/** Setter for r and s fields of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - * \param r pointer to BIGNUM for r (may be NULL) - * \param s pointer to BIGNUM for s (may be NULL) - */ -int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); - -/** 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 (optional), - * 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); - -/** 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 (optional), - * 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); - -/** 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); - -/********************************************************************/ -/* EC_KEY_METHOD constructors, destructors, writers and accessors */ -/********************************************************************/ - -EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth); -void EC_KEY_METHOD_free(EC_KEY_METHOD *meth); -void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, - int (*init)(EC_KEY *key), - void (*finish)(EC_KEY *key), - int (*copy)(EC_KEY *dest, const EC_KEY *src), - int (*set_group)(EC_KEY *key, const EC_GROUP *grp), - int (*set_private)(EC_KEY *key, - const BIGNUM *priv_key), - int (*set_public)(EC_KEY *key, - const EC_POINT *pub_key)); - -void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, - int (*keygen)(EC_KEY *key)); - -void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, - int (*ckey)(unsigned char **psec, - size_t *pseclen, - const EC_POINT *pub_key, - const EC_KEY *ecdh)); - -void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, - int (*sign)(int type, const unsigned char *dgst, - int dlen, unsigned char *sig, - unsigned int *siglen, - const BIGNUM *kinv, const BIGNUM *r, - EC_KEY *eckey), - int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, - BIGNUM **kinvp, BIGNUM **rp), - ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, - int dgst_len, - const BIGNUM *in_kinv, - const BIGNUM *in_r, - EC_KEY *eckey)); - -void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, - int (*verify)(int type, const unsigned - char *dgst, int dgst_len, - const unsigned char *sigbuf, - int sig_len, EC_KEY *eckey), - int (*verify_sig)(const unsigned char *dgst, - int dgst_len, - const ECDSA_SIG *sig, - EC_KEY *eckey)); - -void EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth, - int (**pinit)(EC_KEY *key), - void (**pfinish)(EC_KEY *key), - int (**pcopy)(EC_KEY *dest, const EC_KEY *src), - int (**pset_group)(EC_KEY *key, - const EC_GROUP *grp), - int (**pset_private)(EC_KEY *key, - const BIGNUM *priv_key), - int (**pset_public)(EC_KEY *key, - const EC_POINT *pub_key)); - -void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, - int (**pkeygen)(EC_KEY *key)); - -void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, - int (**pck)(unsigned char **psec, - size_t *pseclen, - const EC_POINT *pub_key, - const EC_KEY *ecdh)); - -void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, - int (**psign)(int type, const unsigned char *dgst, - int dlen, unsigned char *sig, - unsigned int *siglen, - const BIGNUM *kinv, const BIGNUM *r, - EC_KEY *eckey), - int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, - BIGNUM **kinvp, BIGNUM **rp), - ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, - int dgst_len, - const BIGNUM *in_kinv, - const BIGNUM *in_r, - EC_KEY *eckey)); - -void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, - int (**pverify)(int type, const unsigned - char *dgst, int dgst_len, - const unsigned char *sigbuf, - int sig_len, EC_KEY *eckey), - int (**pverify_sig)(const unsigned char *dgst, - int dgst_len, - const ECDSA_SIG *sig, - EC_KEY *eckey)); - -# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) - -# ifndef __cplusplus -# if defined(__SUNPRO_C) -# if __SUNPRO_C >= 0x520 -# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) -# endif -# endif -# endif - -# define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) - -# define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_EC_PARAM_ENC, flag, NULL) - -# define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_ECDH_COFACTOR, flag, NULL) - -# define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_ECDH_COFACTOR, -2, NULL) - -# define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_TYPE, kdf, NULL) - -# define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_TYPE, -2, NULL) - -# define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_OUTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, 0, \ - (void *)(plen)) - -# define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_UKM, plen, (void *)(p)) - -# define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_UKM, 0, (void *)(p)) - -/* SM2 will skip the operation check so no need to pass operation here */ -# define EVP_PKEY_CTX_set1_id(ctx, id, id_len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_SET1_ID, (int)id_len, (void*)(id)) - -# define EVP_PKEY_CTX_get1_id(ctx, id) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_GET1_ID, 0, (void*)(id)) - -# define EVP_PKEY_CTX_get1_id_len(ctx, id_len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_GET1_ID_LEN, 0, (void*)(id_len)) - -# define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) -# define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) -# define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) -# define EVP_PKEY_CTRL_SET1_ID (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET1_ID (EVP_PKEY_ALG_CTRL + 12) -# define EVP_PKEY_CTRL_GET1_ID_LEN (EVP_PKEY_ALG_CTRL + 13) -/* KDF types */ -# define EVP_PKEY_ECDH_KDF_NONE 1 -# define EVP_PKEY_ECDH_KDF_X9_63 2 -/** The old name for EVP_PKEY_ECDH_KDF_X9_63 - * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, - * it is actually specified in ANSI X9.63. - * This identifier is retained for backwards compatibility - */ -# define EVP_PKEY_ECDH_KDF_X9_62 EVP_PKEY_ECDH_KDF_X9_63 - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ecdh.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ecdh.h deleted file mode 100644 index 681f3d5e..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ecdh.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ecdsa.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ecdsa.h deleted file mode 100644 index 681f3d5e..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ecdsa.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ecerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ecerr.h deleted file mode 100644 index f7b91834..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ecerr.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * 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_ECERR_H -# define HEADER_ECERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# include - -# 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_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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/engine.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/engine.h deleted file mode 100644 index 0780f0fb..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/engine.h +++ /dev/null @@ -1,751 +0,0 @@ -/* - * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_ENGINE_H -# define HEADER_ENGINE_H - -# include - -# ifndef OPENSSL_NO_ENGINE -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# include -# include -# include -# include -# include -# endif -# include -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* - * These flags are used to control combinations of algorithm (methods) by - * bitwise "OR"ing. - */ -# define ENGINE_METHOD_RSA (unsigned int)0x0001 -# define ENGINE_METHOD_DSA (unsigned int)0x0002 -# define ENGINE_METHOD_DH (unsigned int)0x0004 -# define ENGINE_METHOD_RAND (unsigned int)0x0008 -# define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 -# define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 -# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 -# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 -# define ENGINE_METHOD_EC (unsigned int)0x0800 -/* Obvious all-or-nothing cases. */ -# define ENGINE_METHOD_ALL (unsigned int)0xFFFF -# define ENGINE_METHOD_NONE (unsigned int)0x0000 - -/* - * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used - * internally to control registration of ENGINE implementations, and can be - * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to - * initialise registered ENGINEs if they are not already initialised. - */ -# define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 - -/* ENGINE flags that can be set by ENGINE_set_flags(). */ -/* Not used */ -/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ - -/* - * This flag is for ENGINEs that wish to handle the various 'CMD'-related - * control commands on their own. Without this flag, ENGINE_ctrl() handles - * these control commands on behalf of the ENGINE using their "cmd_defns" - * data. - */ -# define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 - -/* - * This flag is for ENGINEs who return new duplicate structures when found - * via "ENGINE_by_id()". When an ENGINE must store state (eg. if - * ENGINE_ctrl() commands are called in sequence as part of some stateful - * process like key-generation setup and execution), it can set this flag - - * then each attempt to obtain the ENGINE will result in it being copied into - * a new structure. Normally, ENGINEs don't declare this flag so - * ENGINE_by_id() just increments the existing ENGINE's structural reference - * count. - */ -# define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 - -/* - * This flag if for an ENGINE that does not want its methods registered as - * part of ENGINE_register_all_complete() for example if the methods are not - * usable as default methods. - */ - -# define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 - -/* - * ENGINEs can support their own command types, and these flags are used in - * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input - * each command expects. Currently only numeric and string input is - * supported. If a control command supports none of the _NUMERIC, _STRING, or - * _NO_INPUT options, then it is regarded as an "internal" control command - - * and not for use in config setting situations. As such, they're not - * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() - * access. Changes to this list of 'command types' should be reflected - * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). - */ - -/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ -# define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 -/* - * accepts string input (cast from 'void*' to 'const char *', 4th parameter - * to ENGINE_ctrl) - */ -# define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 -/* - * Indicates that the control command takes *no* input. Ie. the control - * command is unparameterised. - */ -# define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 -/* - * Indicates that the control command is internal. This control command won't - * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() - * function. - */ -# define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 - -/* - * NB: These 3 control commands are deprecated and should not be used. - * ENGINEs relying on these commands should compile conditional support for - * compatibility (eg. if these symbols are defined) but should also migrate - * the same functionality to their own ENGINE-specific control functions that - * can be "discovered" by calling applications. The fact these control - * commands wouldn't be "executable" (ie. usable by text-based config) - * doesn't change the fact that application code can find and use them - * without requiring per-ENGINE hacking. - */ - -/* - * These flags are used to tell the ctrl function what should be done. All - * command numbers are shared between all engines, even if some don't make - * sense to some engines. In such a case, they do nothing but return the - * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. - */ -# define ENGINE_CTRL_SET_LOGSTREAM 1 -# define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 -# define ENGINE_CTRL_HUP 3/* Close and reinitialise - * any handles/connections - * etc. */ -# define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */ -# define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used - * when calling the password - * callback and the user - * interface */ -# define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration, - * given a string that - * represents a file name - * or so */ -# define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given - * section in the already - * loaded configuration */ - -/* - * These control commands allow an application to deal with an arbitrary - * engine in a dynamic way. Warn: Negative return values indicate errors FOR - * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other - * commands, including ENGINE-specific command types, return zero for an - * error. An ENGINE can choose to implement these ctrl functions, and can - * internally manage things however it chooses - it does so by setting the - * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise - * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the - * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's - * ctrl() handler need only implement its own commands - the above "meta" - * commands will be taken care of. - */ - -/* - * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", - * then all the remaining control commands will return failure, so it is - * worth checking this first if the caller is trying to "discover" the - * engine's capabilities and doesn't want errors generated unnecessarily. - */ -# define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 -/* - * Returns a positive command number for the first command supported by the - * engine. Returns zero if no ctrl commands are supported. - */ -# define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 -/* - * The 'long' argument specifies a command implemented by the engine, and the - * return value is the next command supported, or zero if there are no more. - */ -# define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 -/* - * The 'void*' argument is a command name (cast from 'const char *'), and the - * return value is the command that corresponds to it. - */ -# define ENGINE_CTRL_GET_CMD_FROM_NAME 13 -/* - * The next two allow a command to be converted into its corresponding string - * form. In each case, the 'long' argument supplies the command. In the - * NAME_LEN case, the return value is the length of the command name (not - * counting a trailing EOL). In the NAME case, the 'void*' argument must be a - * string buffer large enough, and it will be populated with the name of the - * command (WITH a trailing EOL). - */ -# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 -# define ENGINE_CTRL_GET_NAME_FROM_CMD 15 -/* The next two are similar but give a "short description" of a command. */ -# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 -# define ENGINE_CTRL_GET_DESC_FROM_CMD 17 -/* - * With this command, the return value is the OR'd combination of - * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given - * engine-specific ctrl command expects. - */ -# define ENGINE_CTRL_GET_CMD_FLAGS 18 - -/* - * ENGINE implementations should start the numbering of their own control - * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). - */ -# define ENGINE_CMD_BASE 200 - -/* - * NB: These 2 nCipher "chil" control commands are deprecated, and their - * functionality is now available through ENGINE-specific control commands - * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 - * commands should be migrated to the more general command handling before - * these are removed. - */ - -/* Flags specific to the nCipher "chil" engine */ -# define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 - /* - * Depending on the value of the (long)i argument, this sets or - * unsets the SimpleForkCheck flag in the CHIL API to enable or - * disable checking and workarounds for applications that fork(). - */ -# define ENGINE_CTRL_CHIL_NO_LOCKING 101 - /* - * This prevents the initialisation function from providing mutex - * callbacks to the nCipher library. - */ - -/* - * If an ENGINE supports its own specific control commands and wishes the - * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on - * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN - * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() - * handler that supports the stated commands (ie. the "cmd_num" entries as - * described by the array). NB: The array must be ordered in increasing order - * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element - * has cmd_num set to zero and/or cmd_name set to NULL. - */ -typedef struct ENGINE_CMD_DEFN_st { - unsigned int cmd_num; /* The command number */ - const char *cmd_name; /* The command name itself */ - const char *cmd_desc; /* A short description of the command */ - unsigned int cmd_flags; /* The input the command expects */ -} ENGINE_CMD_DEFN; - -/* Generic function pointer */ -typedef int (*ENGINE_GEN_FUNC_PTR) (void); -/* Generic function pointer taking no arguments */ -typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *); -/* Specific control function pointer */ -typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *, - void (*f) (void)); -/* Generic load_key function pointer */ -typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, - UI_METHOD *ui_method, - void *callback_data); -typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl, - STACK_OF(X509_NAME) *ca_dn, - X509 **pcert, EVP_PKEY **pkey, - STACK_OF(X509) **pother, - UI_METHOD *ui_method, - void *callback_data); -/*- - * These callback types are for an ENGINE's handler for cipher and digest logic. - * These handlers have these prototypes; - * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); - * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); - * Looking at how to implement these handlers in the case of cipher support, if - * the framework wants the EVP_CIPHER for 'nid', it will call; - * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) - * If the framework wants a list of supported 'nid's, it will call; - * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) - */ -/* - * Returns to a pointer to the array of supported cipher 'nid's. If the - * second parameter is non-NULL it is set to the size of the returned array. - */ -typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **, - const int **, int); -typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **, - int); -typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **, - const int **, int); -typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **, - const int **, int); -/* - * STRUCTURE functions ... all of these functions deal with pointers to - * ENGINE structures where the pointers have a "structural reference". This - * means that their reference is to allowed access to the structure but it - * does not imply that the structure is functional. To simply increment or - * decrement the structural reference count, use ENGINE_by_id and - * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next - * as it will automatically decrement the structural reference count of the - * "current" ENGINE and increment the structural reference count of the - * ENGINE it returns (unless it is NULL). - */ - -/* Get the first/last "ENGINE" type available. */ -ENGINE *ENGINE_get_first(void); -ENGINE *ENGINE_get_last(void); -/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ -ENGINE *ENGINE_get_next(ENGINE *e); -ENGINE *ENGINE_get_prev(ENGINE *e); -/* Add another "ENGINE" type into the array. */ -int ENGINE_add(ENGINE *e); -/* Remove an existing "ENGINE" type from the array. */ -int ENGINE_remove(ENGINE *e); -/* Retrieve an engine from the list by its unique "id" value. */ -ENGINE *ENGINE_by_id(const char *id); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define ENGINE_load_openssl() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL) -# define ENGINE_load_dynamic() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL) -# ifndef OPENSSL_NO_STATIC_ENGINE -# define ENGINE_load_padlock() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL) -# define ENGINE_load_capi() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL) -# define ENGINE_load_afalg() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL) -# endif -# define ENGINE_load_cryptodev() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) -# define ENGINE_load_rdrand() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL) -#endif -void ENGINE_load_builtin_engines(void); - -/* - * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation - * "registry" handling. - */ -unsigned int ENGINE_get_table_flags(void); -void ENGINE_set_table_flags(unsigned int flags); - -/*- Manage registration of ENGINEs per "table". For each type, there are 3 - * functions; - * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) - * ENGINE_unregister_***(e) - unregister the implementation from 'e' - * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list - * Cleanup is automatically registered from each table when required. - */ - -int ENGINE_register_RSA(ENGINE *e); -void ENGINE_unregister_RSA(ENGINE *e); -void ENGINE_register_all_RSA(void); - -int ENGINE_register_DSA(ENGINE *e); -void ENGINE_unregister_DSA(ENGINE *e); -void ENGINE_register_all_DSA(void); - -int ENGINE_register_EC(ENGINE *e); -void ENGINE_unregister_EC(ENGINE *e); -void ENGINE_register_all_EC(void); - -int ENGINE_register_DH(ENGINE *e); -void ENGINE_unregister_DH(ENGINE *e); -void ENGINE_register_all_DH(void); - -int ENGINE_register_RAND(ENGINE *e); -void ENGINE_unregister_RAND(ENGINE *e); -void ENGINE_register_all_RAND(void); - -int ENGINE_register_ciphers(ENGINE *e); -void ENGINE_unregister_ciphers(ENGINE *e); -void ENGINE_register_all_ciphers(void); - -int ENGINE_register_digests(ENGINE *e); -void ENGINE_unregister_digests(ENGINE *e); -void ENGINE_register_all_digests(void); - -int ENGINE_register_pkey_meths(ENGINE *e); -void ENGINE_unregister_pkey_meths(ENGINE *e); -void ENGINE_register_all_pkey_meths(void); - -int ENGINE_register_pkey_asn1_meths(ENGINE *e); -void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); -void ENGINE_register_all_pkey_asn1_meths(void); - -/* - * These functions register all support from the above categories. Note, use - * of these functions can result in static linkage of code your application - * may not need. If you only need a subset of functionality, consider using - * more selective initialisation. - */ -int ENGINE_register_complete(ENGINE *e); -int ENGINE_register_all_complete(void); - -/* - * Send parameterised control commands to the engine. The possibilities to - * send down an integer, a pointer to data or a function pointer are - * provided. Any of the parameters may or may not be NULL, depending on the - * command number. In actuality, this function only requires a structural - * (rather than functional) reference to an engine, but many control commands - * may require the engine be functional. The caller should be aware of trying - * commands that require an operational ENGINE, and only use functional - * references in such situations. - */ -int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)); - -/* - * This function tests if an ENGINE-specific command is usable as a - * "setting". Eg. in an application's config file that gets processed through - * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to - * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). - */ -int ENGINE_cmd_is_executable(ENGINE *e, int cmd); - -/* - * This function works like ENGINE_ctrl() with the exception of taking a - * command name instead of a command number, and can handle optional - * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation - * on how to use the cmd_name and cmd_optional. - */ -int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, - long i, void *p, void (*f) (void), int cmd_optional); - -/* - * This function passes a command-name and argument to an ENGINE. The - * cmd_name is converted to a command number and the control command is - * called using 'arg' as an argument (unless the ENGINE doesn't support such - * a command, in which case no control command is called). The command is - * checked for input flags, and if necessary the argument will be converted - * to a numeric value. If cmd_optional is non-zero, then if the ENGINE - * doesn't support the given cmd_name the return value will be success - * anyway. This function is intended for applications to use so that users - * (or config files) can supply engine-specific config data to the ENGINE at - * run-time to control behaviour of specific engines. As such, it shouldn't - * be used for calling ENGINE_ctrl() functions that return data, deal with - * binary data, or that are otherwise supposed to be used directly through - * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() - * operation in this function will be lost - the return value is interpreted - * as failure if the return value is zero, success otherwise, and this - * function returns a boolean value as a result. In other words, vendors of - * 'ENGINE'-enabled devices should write ENGINE implementations with - * parameterisations that work in this scheme, so that compliant ENGINE-based - * applications can work consistently with the same configuration for the - * same ENGINE-enabled devices, across applications. - */ -int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, - int cmd_optional); - -/* - * These functions are useful for manufacturing new ENGINE structures. They - * don't address reference counting at all - one uses them to populate an - * ENGINE structure with personalised implementations of things prior to - * using it directly or adding it to the builtin ENGINE list in OpenSSL. - * These are also here so that the ENGINE structure doesn't have to be - * exposed and break binary compatibility! - */ -ENGINE *ENGINE_new(void); -int ENGINE_free(ENGINE *e); -int ENGINE_up_ref(ENGINE *e); -int ENGINE_set_id(ENGINE *e, const char *id); -int ENGINE_set_name(ENGINE *e, const char *name); -int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); -int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); -int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth); -int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); -int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); -int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); -int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); -int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); -int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); -int ENGINE_set_load_privkey_function(ENGINE *e, - ENGINE_LOAD_KEY_PTR loadpriv_f); -int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); -int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, - ENGINE_SSL_CLIENT_CERT_PTR - loadssl_f); -int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); -int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); -int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); -int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); -int ENGINE_set_flags(ENGINE *e, int flags); -int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); -/* These functions allow control over any per-structure ENGINE data. */ -#define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef) -int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); -void *ENGINE_get_ex_data(const ENGINE *e, int idx); - -#if OPENSSL_API_COMPAT < 0x10100000L -/* - * This function previously cleaned up anything that needs it. Auto-deinit will - * now take care of it so it is no longer required to call this function. - */ -# define ENGINE_cleanup() while(0) continue -#endif - -/* - * These return values from within the ENGINE structure. These can be useful - * with functional references as well as structural references - it depends - * which you obtained. Using the result for functional purposes if you only - * obtained a structural reference may be problematic! - */ -const char *ENGINE_get_id(const ENGINE *e); -const char *ENGINE_get_name(const ENGINE *e); -const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); -const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); -const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); -const DH_METHOD *ENGINE_get_DH(const ENGINE *e); -const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); -ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); -ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); -ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); -ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE - *e); -ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); -ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); -ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); -ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); -const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); -const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); -const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); -const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); -const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, - const char *str, - int len); -const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, - const char *str, - int len); -const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); -int ENGINE_get_flags(const ENGINE *e); - -/* - * FUNCTIONAL functions. These functions deal with ENGINE structures that - * have (or will) be initialised for use. Broadly speaking, the structural - * functions are useful for iterating the list of available engine types, - * creating new engine types, and other "list" operations. These functions - * actually deal with ENGINEs that are to be used. As such these functions - * can fail (if applicable) when particular engines are unavailable - eg. if - * a hardware accelerator is not attached or not functioning correctly. Each - * ENGINE has 2 reference counts; structural and functional. Every time a - * functional reference is obtained or released, a corresponding structural - * reference is automatically obtained or released too. - */ - -/* - * Initialise a engine type for use (or up its reference count if it's - * already in use). This will fail if the engine is not currently operational - * and cannot initialise. - */ -int ENGINE_init(ENGINE *e); -/* - * Free a functional reference to a engine type. This does not require a - * corresponding call to ENGINE_free as it also releases a structural - * reference. - */ -int ENGINE_finish(ENGINE *e); - -/* - * The following functions handle keys that are stored in some secondary - * location, handled by the engine. The storage may be on a card or - * whatever. - */ -EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); -EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); -int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, - STACK_OF(X509_NAME) *ca_dn, X509 **pcert, - EVP_PKEY **ppkey, STACK_OF(X509) **pother, - UI_METHOD *ui_method, void *callback_data); - -/* - * This returns a pointer for the current ENGINE structure that is (by - * default) performing any RSA operations. The value returned is an - * incremented reference, so it should be free'd (ENGINE_finish) before it is - * discarded. - */ -ENGINE *ENGINE_get_default_RSA(void); -/* Same for the other "methods" */ -ENGINE *ENGINE_get_default_DSA(void); -ENGINE *ENGINE_get_default_EC(void); -ENGINE *ENGINE_get_default_DH(void); -ENGINE *ENGINE_get_default_RAND(void); -/* - * These functions can be used to get a functional reference to perform - * ciphering or digesting corresponding to "nid". - */ -ENGINE *ENGINE_get_cipher_engine(int nid); -ENGINE *ENGINE_get_digest_engine(int nid); -ENGINE *ENGINE_get_pkey_meth_engine(int nid); -ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); - -/* - * This sets a new default ENGINE structure for performing RSA operations. If - * the result is non-zero (success) then the ENGINE structure will have had - * its reference count up'd so the caller should still free their own - * reference 'e'. - */ -int ENGINE_set_default_RSA(ENGINE *e); -int ENGINE_set_default_string(ENGINE *e, const char *def_list); -/* Same for the other "methods" */ -int ENGINE_set_default_DSA(ENGINE *e); -int ENGINE_set_default_EC(ENGINE *e); -int ENGINE_set_default_DH(ENGINE *e); -int ENGINE_set_default_RAND(ENGINE *e); -int ENGINE_set_default_ciphers(ENGINE *e); -int ENGINE_set_default_digests(ENGINE *e); -int ENGINE_set_default_pkey_meths(ENGINE *e); -int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); - -/* - * The combination "set" - the flags are bitwise "OR"d from the - * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" - * function, this function can result in unnecessary static linkage. If your - * application requires only specific functionality, consider using more - * selective functions. - */ -int ENGINE_set_default(ENGINE *e, unsigned int flags); - -void ENGINE_add_conf_module(void); - -/* Deprecated functions ... */ -/* int ENGINE_clear_defaults(void); */ - -/**************************/ -/* DYNAMIC ENGINE SUPPORT */ -/**************************/ - -/* Binary/behaviour compatibility levels */ -# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000 -/* - * Binary versions older than this are too old for us (whether we're a loader - * or a loadee) - */ -# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000 - -/* - * When compiling an ENGINE entirely as an external shared library, loadable - * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' - * structure type provides the calling application's (or library's) error - * functionality and memory management function pointers to the loaded - * library. These should be used/set in the loaded library code so that the - * loading application's 'state' will be used/changed in all operations. The - * 'static_state' pointer allows the loaded library to know if it shares the - * same static data as the calling application (or library), and thus whether - * these callbacks need to be set or not. - */ -typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int); -typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int); -typedef void (*dyn_MEM_free_fn) (void *, const char *, int); -typedef struct st_dynamic_MEM_fns { - dyn_MEM_malloc_fn malloc_fn; - dyn_MEM_realloc_fn realloc_fn; - dyn_MEM_free_fn free_fn; -} dynamic_MEM_fns; -/* - * FIXME: Perhaps the memory and locking code (crypto.h) should declare and - * use these types so we (and any other dependent code) can simplify a bit?? - */ -/* The top-level structure */ -typedef struct st_dynamic_fns { - void *static_state; - dynamic_MEM_fns mem_fns; -} dynamic_fns; - -/* - * The version checking function should be of this prototype. NB: The - * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading - * code. If this function returns zero, it indicates a (potential) version - * incompatibility and the loaded library doesn't believe it can proceed. - * Otherwise, the returned value is the (latest) version supported by the - * loading library. The loader may still decide that the loaded code's - * version is unsatisfactory and could veto the load. The function is - * expected to be implemented with the symbol name "v_check", and a default - * implementation can be fully instantiated with - * IMPLEMENT_DYNAMIC_CHECK_FN(). - */ -typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version); -# define IMPLEMENT_DYNAMIC_CHECK_FN() \ - OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ - OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ - if (v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ - return 0; } - -/* - * This function is passed the ENGINE structure to initialise with its own - * function and command settings. It should not adjust the structural or - * functional reference counts. If this function returns zero, (a) the load - * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto - * the structure, and (c) the shared library will be unloaded. So - * implementations should do their own internal cleanup in failure - * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, - * represents the ENGINE id that the loader is looking for. If this is NULL, - * the shared library can choose to return failure or to initialise a - * 'default' ENGINE. If non-NULL, the shared library must initialise only an - * ENGINE matching the passed 'id'. The function is expected to be - * implemented with the symbol name "bind_engine". A standard implementation - * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter - * 'fn' is a callback function that populates the ENGINE structure and - * returns an int value (zero for failure). 'fn' should have prototype; - * [static] int fn(ENGINE *e, const char *id); - */ -typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, - const dynamic_fns *fns); -# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ - OPENSSL_EXPORT \ - int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ - OPENSSL_EXPORT \ - int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ - if (ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ - CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \ - fns->mem_fns.realloc_fn, \ - fns->mem_fns.free_fn); \ - skip_cbs: \ - if (!fn(e, id)) return 0; \ - return 1; } - -/* - * If the loading application (or library) and the loaded ENGINE library - * share the same static data (eg. they're both dynamically linked to the - * same libcrypto.so) we need a way to avoid trying to set system callbacks - - * this would fail, and for the same reason that it's unnecessary to try. If - * the loaded ENGINE has (or gets from through the loader) its own copy of - * the libcrypto static data, we will need to set the callbacks. The easiest - * way to detect this is to have a function that returns a pointer to some - * static data and let the loading application and loaded ENGINE compare - * their respective values. - */ -void *ENGINE_get_static_state(void); - -# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void)) -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/engineerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/engineerr.h deleted file mode 100644 index 05e84bd2..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/engineerr.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/err.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/err.h deleted file mode 100644 index b49f8812..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/err.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * 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_ERR_H -# define HEADER_ERR_H - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# include -# endif - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# ifndef OPENSSL_NO_ERR -# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) -# else -# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) -# endif - -# include - -# define ERR_TXT_MALLOCED 0x01 -# define ERR_TXT_STRING 0x02 - -# define ERR_FLAG_MARK 0x01 -# define ERR_FLAG_CLEAR 0x02 - -# define ERR_NUM_ERRORS 16 -typedef struct err_state_st { - int err_flags[ERR_NUM_ERRORS]; - unsigned long err_buffer[ERR_NUM_ERRORS]; - char *err_data[ERR_NUM_ERRORS]; - int err_data_flags[ERR_NUM_ERRORS]; - const char *err_file[ERR_NUM_ERRORS]; - int err_line[ERR_NUM_ERRORS]; - int top, bottom; -} ERR_STATE; - -/* library */ -# define ERR_LIB_NONE 1 -# define ERR_LIB_SYS 2 -# define ERR_LIB_BN 3 -# define ERR_LIB_RSA 4 -# define ERR_LIB_DH 5 -# define ERR_LIB_EVP 6 -# define ERR_LIB_BUF 7 -# define ERR_LIB_OBJ 8 -# define ERR_LIB_PEM 9 -# define ERR_LIB_DSA 10 -# define ERR_LIB_X509 11 -/* #define ERR_LIB_METH 12 */ -# define ERR_LIB_ASN1 13 -# define ERR_LIB_CONF 14 -# define ERR_LIB_CRYPTO 15 -# define ERR_LIB_EC 16 -# define ERR_LIB_SSL 20 -/* #define ERR_LIB_SSL23 21 */ -/* #define ERR_LIB_SSL2 22 */ -/* #define ERR_LIB_SSL3 23 */ -/* #define ERR_LIB_RSAREF 30 */ -/* #define ERR_LIB_PROXY 31 */ -# define ERR_LIB_BIO 32 -# define ERR_LIB_PKCS7 33 -# define ERR_LIB_X509V3 34 -# define ERR_LIB_PKCS12 35 -# define ERR_LIB_RAND 36 -# define ERR_LIB_DSO 37 -# define ERR_LIB_ENGINE 38 -# define ERR_LIB_OCSP 39 -# define ERR_LIB_UI 40 -# define ERR_LIB_COMP 41 -# define ERR_LIB_ECDSA 42 -# define ERR_LIB_ECDH 43 -# define ERR_LIB_OSSL_STORE 44 -# define ERR_LIB_FIPS 45 -# define ERR_LIB_CMS 46 -# define ERR_LIB_TS 47 -# define ERR_LIB_HMAC 48 -/* # define ERR_LIB_JPAKE 49 */ -# define ERR_LIB_CT 50 -# define ERR_LIB_ASYNC 51 -# define ERR_LIB_KDF 52 -# define ERR_LIB_SM2 53 - -# define ERR_LIB_USER 128 - -# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE) - -# define ERR_PACK(l,f,r) ( \ - (((unsigned int)(l) & 0x0FF) << 24L) | \ - (((unsigned int)(f) & 0xFFF) << 12L) | \ - (((unsigned int)(r) & 0xFFF) ) ) -# define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL) -# define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL) -# define ERR_GET_REASON(l) (int)( (l) & 0xFFFL) -# define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL) - -/* OS functions */ -# define SYS_F_FOPEN 1 -# define SYS_F_CONNECT 2 -# define SYS_F_GETSERVBYNAME 3 -# define SYS_F_SOCKET 4 -# define SYS_F_IOCTLSOCKET 5 -# define SYS_F_BIND 6 -# define SYS_F_LISTEN 7 -# define SYS_F_ACCEPT 8 -# define SYS_F_WSASTARTUP 9/* Winsock stuff */ -# define SYS_F_OPENDIR 10 -# define SYS_F_FREAD 11 -# define SYS_F_GETADDRINFO 12 -# define SYS_F_GETNAMEINFO 13 -# define SYS_F_SETSOCKOPT 14 -# define SYS_F_GETSOCKOPT 15 -# define SYS_F_GETSOCKNAME 16 -# define SYS_F_GETHOSTBYNAME 17 -# define SYS_F_FFLUSH 18 -# define SYS_F_OPEN 19 -# define SYS_F_CLOSE 20 -# define SYS_F_IOCTL 21 -# define SYS_F_STAT 22 -# define SYS_F_FCNTL 23 -# define SYS_F_FSTAT 24 - -/* reasons */ -# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ -# define ERR_R_BN_LIB ERR_LIB_BN/* 3 */ -# define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */ -# define ERR_R_DH_LIB ERR_LIB_DH/* 5 */ -# define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */ -# define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */ -# define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */ -# define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */ -# define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */ -# define ERR_R_X509_LIB ERR_LIB_X509/* 11 */ -# define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */ -# define ERR_R_EC_LIB ERR_LIB_EC/* 16 */ -# define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */ -# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */ -# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */ -# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */ -# define ERR_R_UI_LIB ERR_LIB_UI/* 40 */ -# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */ -# define ERR_R_OSSL_STORE_LIB ERR_LIB_OSSL_STORE/* 44 */ - -# define ERR_R_NESTED_ASN1_ERROR 58 -# define ERR_R_MISSING_ASN1_EOS 63 - -/* fatal error */ -# define ERR_R_FATAL 64 -# define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) -# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) -# define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) -# define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) -# define ERR_R_DISABLED (5|ERR_R_FATAL) -# define ERR_R_INIT_FAIL (6|ERR_R_FATAL) -# define ERR_R_PASSED_INVALID_ARGUMENT (7) -# define ERR_R_OPERATION_FAIL (8|ERR_R_FATAL) - -/* - * 99 is the maximum possible ERR_R_... code, higher values are reserved for - * the individual libraries - */ - -typedef struct ERR_string_data_st { - unsigned long error; - const char *string; -} ERR_STRING_DATA; - -DEFINE_LHASH_OF(ERR_STRING_DATA); - -void ERR_put_error(int lib, int func, int reason, const char *file, int line); -void ERR_set_error_data(char *data, int flags); - -unsigned long ERR_get_error(void); -unsigned long ERR_get_error_line(const char **file, int *line); -unsigned long ERR_get_error_line_data(const char **file, int *line, - const char **data, int *flags); -unsigned long ERR_peek_error(void); -unsigned long ERR_peek_error_line(const char **file, int *line); -unsigned long ERR_peek_error_line_data(const char **file, int *line, - const char **data, int *flags); -unsigned long ERR_peek_last_error(void); -unsigned long ERR_peek_last_error_line(const char **file, int *line); -unsigned long ERR_peek_last_error_line_data(const char **file, int *line, - const char **data, int *flags); -void ERR_clear_error(void); -char *ERR_error_string(unsigned long e, char *buf); -void ERR_error_string_n(unsigned long e, char *buf, size_t len); -const char *ERR_lib_error_string(unsigned long e); -const char *ERR_func_error_string(unsigned long e); -const char *ERR_reason_error_string(unsigned long e); -void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), - void *u); -# ifndef OPENSSL_NO_STDIO -void ERR_print_errors_fp(FILE *fp); -# endif -void ERR_print_errors(BIO *bp); -void ERR_add_error_data(int num, ...); -void ERR_add_error_vdata(int num, va_list args); -int ERR_load_strings(int lib, ERR_STRING_DATA *str); -int ERR_load_strings_const(const ERR_STRING_DATA *str); -int ERR_unload_strings(int lib, ERR_STRING_DATA *str); -int ERR_load_ERR_strings(void); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define ERR_load_crypto_strings() \ - OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) -# define ERR_free_strings() while(0) continue -#endif - -DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *)) -DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid)) -ERR_STATE *ERR_get_state(void); - -int ERR_get_next_error_library(void); - -int ERR_set_mark(void); -int ERR_pop_to_mark(void); -int ERR_clear_last_mark(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/evp.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/evp.h deleted file mode 100644 index a411f3f2..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/evp.h +++ /dev/null @@ -1,1666 +0,0 @@ -/* - * 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_ENVELOPE_H -# define HEADER_ENVELOPE_H - -# include -# include -# include -# include -# include - -# define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ -# define EVP_MAX_KEY_LENGTH 64 -# define EVP_MAX_IV_LENGTH 16 -# define EVP_MAX_BLOCK_LENGTH 32 - -# define PKCS5_SALT_LEN 8 -/* Default PKCS#5 iteration count */ -# define PKCS5_DEFAULT_ITER 2048 - -# include - -# define EVP_PK_RSA 0x0001 -# define EVP_PK_DSA 0x0002 -# define EVP_PK_DH 0x0004 -# define EVP_PK_EC 0x0008 -# define EVP_PKT_SIGN 0x0010 -# define EVP_PKT_ENC 0x0020 -# define EVP_PKT_EXCH 0x0040 -# define EVP_PKS_RSA 0x0100 -# define EVP_PKS_DSA 0x0200 -# define EVP_PKS_EC 0x0400 - -# define EVP_PKEY_NONE NID_undef -# define EVP_PKEY_RSA NID_rsaEncryption -# define EVP_PKEY_RSA2 NID_rsa -# define EVP_PKEY_RSA_PSS NID_rsassaPss -# define EVP_PKEY_DSA NID_dsa -# define EVP_PKEY_DSA1 NID_dsa_2 -# define EVP_PKEY_DSA2 NID_dsaWithSHA -# define EVP_PKEY_DSA3 NID_dsaWithSHA1 -# define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 -# define EVP_PKEY_DH NID_dhKeyAgreement -# define EVP_PKEY_DHX NID_dhpublicnumber -# define EVP_PKEY_EC NID_X9_62_id_ecPublicKey -# define EVP_PKEY_SM2 NID_sm2 -# define EVP_PKEY_HMAC NID_hmac -# define EVP_PKEY_CMAC NID_cmac -# define EVP_PKEY_SCRYPT NID_id_scrypt -# define EVP_PKEY_TLS1_PRF NID_tls1_prf -# define EVP_PKEY_HKDF NID_hkdf -# define EVP_PKEY_POLY1305 NID_poly1305 -# define EVP_PKEY_SIPHASH NID_siphash -# define EVP_PKEY_X25519 NID_X25519 -# define EVP_PKEY_ED25519 NID_ED25519 -# define EVP_PKEY_X448 NID_X448 -# define EVP_PKEY_ED448 NID_ED448 - -#ifdef __cplusplus -extern "C" { -#endif - -# define EVP_PKEY_MO_SIGN 0x0001 -# define EVP_PKEY_MO_VERIFY 0x0002 -# define EVP_PKEY_MO_ENCRYPT 0x0004 -# define EVP_PKEY_MO_DECRYPT 0x0008 - -# ifndef EVP_MD -EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); -EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); -void EVP_MD_meth_free(EVP_MD *md); - -int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); -int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); -int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); -int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); -int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); -int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, - const void *data, - size_t count)); -int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, - unsigned char *md)); -int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, - const EVP_MD_CTX *from)); -int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); -int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, - int p1, void *p2)); - -int EVP_MD_meth_get_input_blocksize(const EVP_MD *md); -int EVP_MD_meth_get_result_size(const EVP_MD *md); -int EVP_MD_meth_get_app_datasize(const EVP_MD *md); -unsigned long EVP_MD_meth_get_flags(const EVP_MD *md); -int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); -int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, - const void *data, - size_t count); -int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, - unsigned char *md); -int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, - const EVP_MD_CTX *from); -int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); -int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, - int p1, void *p2); - -/* digest can only handle a single block */ -# define EVP_MD_FLAG_ONESHOT 0x0001 - -/* digest is extensible-output function, XOF */ -# define EVP_MD_FLAG_XOF 0x0002 - -/* DigestAlgorithmIdentifier flags... */ - -# define EVP_MD_FLAG_DIGALGID_MASK 0x0018 - -/* NULL or absent parameter accepted. Use NULL */ - -# define EVP_MD_FLAG_DIGALGID_NULL 0x0000 - -/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ - -# define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 - -/* Custom handling via ctrl */ - -# define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 - -/* Note if suitable for use in FIPS mode */ -# define EVP_MD_FLAG_FIPS 0x0400 - -/* Digest ctrls */ - -# define EVP_MD_CTRL_DIGALGID 0x1 -# define EVP_MD_CTRL_MICALG 0x2 -# define EVP_MD_CTRL_XOF_LEN 0x3 - -/* Minimum Algorithm specific ctrl value */ - -# define EVP_MD_CTRL_ALG_CTRL 0x1000 - -# endif /* !EVP_MD */ - -/* values for EVP_MD_CTX flags */ - -# define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be - * called once only */ -# define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been - * cleaned */ -# define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data - * in EVP_MD_CTX_reset */ -/* - * FIPS and pad options are ignored in 1.0.0, definitions are here so we - * don't accidentally reuse the values for other purposes. - */ - -# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS - * digest in FIPS mode */ - -/* - * The following PAD options are also currently ignored in 1.0.0, digest - * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() - * instead. - */ -# define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ -# define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ -# define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ -# define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ - -# define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ -/* - * Some functions such as EVP_DigestSign only finalise copies of internal - * contexts so additional data can be included after the finalisation call. - * This is inefficient if this functionality is not required: it is disabled - * if the following flag is set. - */ -# define EVP_MD_CTX_FLAG_FINALISE 0x0200 -/* NOTE: 0x0400 is reserved for internal usage */ - -EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); -EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); -void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); - -int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); -int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); -int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); -int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, - int (*init) (EVP_CIPHER_CTX *ctx, - const unsigned char *key, - const unsigned char *iv, - int enc)); -int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, - int (*do_cipher) (EVP_CIPHER_CTX *ctx, - unsigned char *out, - const unsigned char *in, - size_t inl)); -int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, - int (*cleanup) (EVP_CIPHER_CTX *)); -int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, - int (*set_asn1_parameters) (EVP_CIPHER_CTX *, - ASN1_TYPE *)); -int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, - int (*get_asn1_parameters) (EVP_CIPHER_CTX *, - ASN1_TYPE *)); -int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, - int (*ctrl) (EVP_CIPHER_CTX *, int type, - int arg, void *ptr)); - -int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, - const unsigned char *key, - const unsigned char *iv, - int enc); -int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, - unsigned char *out, - const unsigned char *in, - size_t inl); -int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); -int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - ASN1_TYPE *); -int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - ASN1_TYPE *); -int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - int type, int arg, - void *ptr); - -/* Values for cipher flags */ - -/* Modes for ciphers */ - -# define EVP_CIPH_STREAM_CIPHER 0x0 -# define EVP_CIPH_ECB_MODE 0x1 -# define EVP_CIPH_CBC_MODE 0x2 -# define EVP_CIPH_CFB_MODE 0x3 -# define EVP_CIPH_OFB_MODE 0x4 -# define EVP_CIPH_CTR_MODE 0x5 -# define EVP_CIPH_GCM_MODE 0x6 -# define EVP_CIPH_CCM_MODE 0x7 -# define EVP_CIPH_XTS_MODE 0x10001 -# define EVP_CIPH_WRAP_MODE 0x10002 -# define EVP_CIPH_OCB_MODE 0x10003 -# define EVP_CIPH_MODE 0xF0007 -/* Set if variable length cipher */ -# define EVP_CIPH_VARIABLE_LENGTH 0x8 -/* Set if the iv handling should be done by the cipher itself */ -# define EVP_CIPH_CUSTOM_IV 0x10 -/* Set if the cipher's init() function should be called if key is NULL */ -# define EVP_CIPH_ALWAYS_CALL_INIT 0x20 -/* Call ctrl() to init cipher parameters */ -# define EVP_CIPH_CTRL_INIT 0x40 -/* Don't use standard key length function */ -# define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 -/* Don't use standard block padding */ -# define EVP_CIPH_NO_PADDING 0x100 -/* cipher handles random key generation */ -# define EVP_CIPH_RAND_KEY 0x200 -/* cipher has its own additional copying logic */ -# define EVP_CIPH_CUSTOM_COPY 0x400 -/* Don't use standard iv length function */ -# define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 -/* Allow use default ASN1 get/set iv */ -# define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 -/* Buffer length in bits not bytes: CFB1 mode only */ -# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 -/* Note if suitable for use in FIPS mode */ -# define EVP_CIPH_FLAG_FIPS 0x4000 -/* Allow non FIPS cipher in FIPS mode */ -# define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 -/* - * Cipher handles any and all padding logic as well as finalisation. - */ -# define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 -# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 -# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 -/* Cipher can handle pipeline operations */ -# define EVP_CIPH_FLAG_PIPELINE 0X800000 - -/* - * Cipher context flag to indicate we can handle wrap mode: if allowed in - * older applications it could overflow buffers. - */ - -# define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 - -/* ctrl() values */ - -# define EVP_CTRL_INIT 0x0 -# define EVP_CTRL_SET_KEY_LENGTH 0x1 -# define EVP_CTRL_GET_RC2_KEY_BITS 0x2 -# define EVP_CTRL_SET_RC2_KEY_BITS 0x3 -# define EVP_CTRL_GET_RC5_ROUNDS 0x4 -# define EVP_CTRL_SET_RC5_ROUNDS 0x5 -# define EVP_CTRL_RAND_KEY 0x6 -# define EVP_CTRL_PBE_PRF_NID 0x7 -# define EVP_CTRL_COPY 0x8 -# define EVP_CTRL_AEAD_SET_IVLEN 0x9 -# define EVP_CTRL_AEAD_GET_TAG 0x10 -# define EVP_CTRL_AEAD_SET_TAG 0x11 -# define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 -# define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN -# define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED -# define EVP_CTRL_GCM_IV_GEN 0x13 -# define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN -# define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED -# define EVP_CTRL_CCM_SET_L 0x14 -# define EVP_CTRL_CCM_SET_MSGLEN 0x15 -/* - * AEAD cipher deduces payload length and returns number of bytes required to - * store MAC and eventual padding. Subsequent call to EVP_Cipher even - * appends/verifies MAC. - */ -# define EVP_CTRL_AEAD_TLS1_AAD 0x16 -/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ -# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 -/* Set the GCM invocation field, decrypt only */ -# define EVP_CTRL_GCM_SET_IV_INV 0x18 - -# define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 -# define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a -# define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b -# define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c - -# define EVP_CTRL_SSL3_MASTER_SECRET 0x1d - -/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ -# define EVP_CTRL_SET_SBOX 0x1e -/* - * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a - * pre-allocated buffer with specified size - */ -# define EVP_CTRL_SBOX_USED 0x1f -/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, - * 0 switches meshing off - */ -# define EVP_CTRL_KEY_MESH 0x20 -/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ -# define EVP_CTRL_BLOCK_PADDING_MODE 0x21 - -/* Set the output buffers to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 -/* Set the input buffers to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 -/* Set the input buffer lengths to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 - -# define EVP_CTRL_GET_IVLEN 0x25 - -/* Padding modes */ -#define EVP_PADDING_PKCS7 1 -#define EVP_PADDING_ISO7816_4 2 -#define EVP_PADDING_ANSI923 3 -#define EVP_PADDING_ISO10126 4 -#define EVP_PADDING_ZERO 5 - -/* RFC 5246 defines additional data to be 13 bytes in length */ -# define EVP_AEAD_TLS1_AAD_LEN 13 - -typedef struct { - unsigned char *out; - const unsigned char *inp; - size_t len; - unsigned int interleave; -} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; - -/* GCM TLS constants */ -/* Length of fixed part of IV derived from PRF */ -# define EVP_GCM_TLS_FIXED_IV_LEN 4 -/* Length of explicit part of IV part of TLS records */ -# define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 -/* Length of tag for TLS */ -# define EVP_GCM_TLS_TAG_LEN 16 - -/* CCM TLS constants */ -/* Length of fixed part of IV derived from PRF */ -# define EVP_CCM_TLS_FIXED_IV_LEN 4 -/* Length of explicit part of IV part of TLS records */ -# define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 -/* Total length of CCM IV length for TLS */ -# define EVP_CCM_TLS_IV_LEN 12 -/* Length of tag for TLS */ -# define EVP_CCM_TLS_TAG_LEN 16 -/* Length of CCM8 tag for TLS */ -# define EVP_CCM8_TLS_TAG_LEN 8 - -/* Length of tag for TLS */ -# define EVP_CHACHAPOLY_TLS_TAG_LEN 16 - -typedef struct evp_cipher_info_st { - const EVP_CIPHER *cipher; - unsigned char iv[EVP_MAX_IV_LENGTH]; -} EVP_CIPHER_INFO; - - -/* Password based encryption function */ -typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, - int passlen, ASN1_TYPE *param, - const EVP_CIPHER *cipher, const EVP_MD *md, - int en_de); - -# ifndef OPENSSL_NO_RSA -# define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ - (char *)(rsa)) -# endif - -# ifndef OPENSSL_NO_DSA -# define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ - (char *)(dsa)) -# endif - -# ifndef OPENSSL_NO_DH -# define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ - (char *)(dh)) -# endif - -# ifndef OPENSSL_NO_EC -# define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ - (char *)(eckey)) -# endif -# ifndef OPENSSL_NO_SIPHASH -# define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),EVP_PKEY_SIPHASH,\ - (char *)(shkey)) -# endif - -# ifndef OPENSSL_NO_POLY1305 -# define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),EVP_PKEY_POLY1305,\ - (char *)(polykey)) -# endif - -/* Add some extra combinations */ -# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) -# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) -# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) -# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) - -int EVP_MD_type(const EVP_MD *md); -# define EVP_MD_nid(e) EVP_MD_type(e) -# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) -int EVP_MD_pkey_type(const EVP_MD *md); -int EVP_MD_size(const EVP_MD *md); -int EVP_MD_block_size(const EVP_MD *md); -unsigned long EVP_MD_flags(const EVP_MD *md); - -const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); -int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, - const void *data, size_t count); -void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, - int (*update) (EVP_MD_CTX *ctx, - const void *data, size_t count)); -# define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) -# define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) -# define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) -EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); -void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); -void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); - -int EVP_CIPHER_nid(const EVP_CIPHER *cipher); -# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) -int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); -int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); -int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); -int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); -unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); -# define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) - -const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); -const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); -const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); -unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); -unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx); -void EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); -int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); -void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); -void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); -void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); -void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); -# define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) -# if OPENSSL_API_COMPAT < 0x10100000L -# define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) -# endif -# define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c)) - -# define EVP_ENCODE_LENGTH(l) ((((l)+2)/3*4)+((l)/48+1)*2+80) -# define EVP_DECODE_LENGTH(l) (((l)+3)/4*3+80) - -# define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) -# define EVP_SignInit(a,b) EVP_DigestInit(a,b) -# define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) -# define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) -# define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) -# define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) -# define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) - -# ifdef CONST_STRICT -void BIO_set_md(BIO *, const EVP_MD *md); -# else -# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)(md)) -# endif -# define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)(mdp)) -# define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0, \ - (char *)(mdcp)) -# define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0, \ - (char *)(mdcp)) -# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) -# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0, \ - (char *)(c_pp)) - -/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c, - unsigned char *out, - const unsigned char *in, unsigned int inl); - -# define EVP_add_cipher_alias(n,alias) \ - OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) -# define EVP_add_digest_alias(n,alias) \ - OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) -# define EVP_delete_cipher_alias(alias) \ - OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); -# define EVP_delete_digest_alias(alias) \ - OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); - -int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); -EVP_MD_CTX *EVP_MD_CTX_new(void); -int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); -void EVP_MD_CTX_free(EVP_MD_CTX *ctx); -# define EVP_MD_CTX_create() EVP_MD_CTX_new() -# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) -# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) -__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); -void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); -void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); -int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); -__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, - ENGINE *impl); -__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, - size_t cnt); -__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); -__owur int EVP_Digest(const void *data, size_t count, - unsigned char *md, unsigned int *size, - const EVP_MD *type, ENGINE *impl); - -__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); -__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); -__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); -__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, - size_t len); - -int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); -int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, - const char *prompt, int verify); -void EVP_set_pw_prompt(const char *prompt); -char *EVP_get_pw_prompt(void); - -__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, - const unsigned char *salt, - const unsigned char *data, int datal, int count, - unsigned char *key, unsigned char *iv); - -void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); -void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); -int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); - -__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv); -/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv); -/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); -/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); - -__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv); -/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv); -/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); -/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - -__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv, - int enc); -/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv, int enc); -__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); -__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - -__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, - EVP_PKEY *pkey); - -__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen, const unsigned char *tbs, - size_t tbslen); - -__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, - unsigned int siglen, EVP_PKEY *pkey); - -__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, - size_t siglen, const unsigned char *tbs, - size_t tbslen); - -/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, - EVP_PKEY *pkey); -__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen); - -__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, - EVP_PKEY *pkey); -__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, - size_t siglen); - -# ifndef OPENSSL_NO_RSA -__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - const unsigned char *ek, int ekl, - const unsigned char *iv, EVP_PKEY *priv); -__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); - -__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - unsigned char **ek, int *ekl, unsigned char *iv, - EVP_PKEY **pubk, int npubk); -__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); -# endif - -EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); -void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); -int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx); -int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); -void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); -int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, - const unsigned char *in, int inl); -void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); -int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); - -void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); -int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, - const unsigned char *in, int inl); -int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned - char *out, int *outl); -int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) -# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) -# endif -EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); -int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); -void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); -int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); -int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); -int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); -int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); - -const BIO_METHOD *BIO_f_md(void); -const BIO_METHOD *BIO_f_base64(void); -const BIO_METHOD *BIO_f_cipher(void); -const BIO_METHOD *BIO_f_reliable(void); -__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, - const unsigned char *i, int enc); - -const EVP_MD *EVP_md_null(void); -# ifndef OPENSSL_NO_MD2 -const EVP_MD *EVP_md2(void); -# endif -# ifndef OPENSSL_NO_MD4 -const EVP_MD *EVP_md4(void); -# endif -# ifndef OPENSSL_NO_MD5 -const EVP_MD *EVP_md5(void); -const EVP_MD *EVP_md5_sha1(void); -# endif -# ifndef OPENSSL_NO_BLAKE2 -const EVP_MD *EVP_blake2b512(void); -const EVP_MD *EVP_blake2s256(void); -# endif -const EVP_MD *EVP_sha1(void); -const EVP_MD *EVP_sha224(void); -const EVP_MD *EVP_sha256(void); -const EVP_MD *EVP_sha384(void); -const EVP_MD *EVP_sha512(void); -const EVP_MD *EVP_sha512_224(void); -const EVP_MD *EVP_sha512_256(void); -const EVP_MD *EVP_sha3_224(void); -const EVP_MD *EVP_sha3_256(void); -const EVP_MD *EVP_sha3_384(void); -const EVP_MD *EVP_sha3_512(void); -const EVP_MD *EVP_shake128(void); -const EVP_MD *EVP_shake256(void); -# ifndef OPENSSL_NO_MDC2 -const EVP_MD *EVP_mdc2(void); -# endif -# ifndef OPENSSL_NO_RMD160 -const EVP_MD *EVP_ripemd160(void); -# endif -# ifndef OPENSSL_NO_WHIRLPOOL -const EVP_MD *EVP_whirlpool(void); -# endif -# ifndef OPENSSL_NO_SM3 -const EVP_MD *EVP_sm3(void); -# endif -const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ -# ifndef OPENSSL_NO_DES -const EVP_CIPHER *EVP_des_ecb(void); -const EVP_CIPHER *EVP_des_ede(void); -const EVP_CIPHER *EVP_des_ede3(void); -const EVP_CIPHER *EVP_des_ede_ecb(void); -const EVP_CIPHER *EVP_des_ede3_ecb(void); -const EVP_CIPHER *EVP_des_cfb64(void); -# define EVP_des_cfb EVP_des_cfb64 -const EVP_CIPHER *EVP_des_cfb1(void); -const EVP_CIPHER *EVP_des_cfb8(void); -const EVP_CIPHER *EVP_des_ede_cfb64(void); -# define EVP_des_ede_cfb EVP_des_ede_cfb64 -const EVP_CIPHER *EVP_des_ede3_cfb64(void); -# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 -const EVP_CIPHER *EVP_des_ede3_cfb1(void); -const EVP_CIPHER *EVP_des_ede3_cfb8(void); -const EVP_CIPHER *EVP_des_ofb(void); -const EVP_CIPHER *EVP_des_ede_ofb(void); -const EVP_CIPHER *EVP_des_ede3_ofb(void); -const EVP_CIPHER *EVP_des_cbc(void); -const EVP_CIPHER *EVP_des_ede_cbc(void); -const EVP_CIPHER *EVP_des_ede3_cbc(void); -const EVP_CIPHER *EVP_desx_cbc(void); -const EVP_CIPHER *EVP_des_ede3_wrap(void); -/* - * This should now be supported through the dev_crypto ENGINE. But also, why - * are rc4 and md5 declarations made here inside a "NO_DES" precompiler - * branch? - */ -# endif -# ifndef OPENSSL_NO_RC4 -const EVP_CIPHER *EVP_rc4(void); -const EVP_CIPHER *EVP_rc4_40(void); -# ifndef OPENSSL_NO_MD5 -const EVP_CIPHER *EVP_rc4_hmac_md5(void); -# endif -# endif -# ifndef OPENSSL_NO_IDEA -const EVP_CIPHER *EVP_idea_ecb(void); -const EVP_CIPHER *EVP_idea_cfb64(void); -# define EVP_idea_cfb EVP_idea_cfb64 -const EVP_CIPHER *EVP_idea_ofb(void); -const EVP_CIPHER *EVP_idea_cbc(void); -# endif -# ifndef OPENSSL_NO_RC2 -const EVP_CIPHER *EVP_rc2_ecb(void); -const EVP_CIPHER *EVP_rc2_cbc(void); -const EVP_CIPHER *EVP_rc2_40_cbc(void); -const EVP_CIPHER *EVP_rc2_64_cbc(void); -const EVP_CIPHER *EVP_rc2_cfb64(void); -# define EVP_rc2_cfb EVP_rc2_cfb64 -const EVP_CIPHER *EVP_rc2_ofb(void); -# endif -# ifndef OPENSSL_NO_BF -const EVP_CIPHER *EVP_bf_ecb(void); -const EVP_CIPHER *EVP_bf_cbc(void); -const EVP_CIPHER *EVP_bf_cfb64(void); -# define EVP_bf_cfb EVP_bf_cfb64 -const EVP_CIPHER *EVP_bf_ofb(void); -# endif -# ifndef OPENSSL_NO_CAST -const EVP_CIPHER *EVP_cast5_ecb(void); -const EVP_CIPHER *EVP_cast5_cbc(void); -const EVP_CIPHER *EVP_cast5_cfb64(void); -# define EVP_cast5_cfb EVP_cast5_cfb64 -const EVP_CIPHER *EVP_cast5_ofb(void); -# endif -# ifndef OPENSSL_NO_RC5 -const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); -const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); -const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); -# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 -const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); -# endif -const EVP_CIPHER *EVP_aes_128_ecb(void); -const EVP_CIPHER *EVP_aes_128_cbc(void); -const EVP_CIPHER *EVP_aes_128_cfb1(void); -const EVP_CIPHER *EVP_aes_128_cfb8(void); -const EVP_CIPHER *EVP_aes_128_cfb128(void); -# define EVP_aes_128_cfb EVP_aes_128_cfb128 -const EVP_CIPHER *EVP_aes_128_ofb(void); -const EVP_CIPHER *EVP_aes_128_ctr(void); -const EVP_CIPHER *EVP_aes_128_ccm(void); -const EVP_CIPHER *EVP_aes_128_gcm(void); -const EVP_CIPHER *EVP_aes_128_xts(void); -const EVP_CIPHER *EVP_aes_128_wrap(void); -const EVP_CIPHER *EVP_aes_128_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_128_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_192_ecb(void); -const EVP_CIPHER *EVP_aes_192_cbc(void); -const EVP_CIPHER *EVP_aes_192_cfb1(void); -const EVP_CIPHER *EVP_aes_192_cfb8(void); -const EVP_CIPHER *EVP_aes_192_cfb128(void); -# define EVP_aes_192_cfb EVP_aes_192_cfb128 -const EVP_CIPHER *EVP_aes_192_ofb(void); -const EVP_CIPHER *EVP_aes_192_ctr(void); -const EVP_CIPHER *EVP_aes_192_ccm(void); -const EVP_CIPHER *EVP_aes_192_gcm(void); -const EVP_CIPHER *EVP_aes_192_wrap(void); -const EVP_CIPHER *EVP_aes_192_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_192_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_256_ecb(void); -const EVP_CIPHER *EVP_aes_256_cbc(void); -const EVP_CIPHER *EVP_aes_256_cfb1(void); -const EVP_CIPHER *EVP_aes_256_cfb8(void); -const EVP_CIPHER *EVP_aes_256_cfb128(void); -# define EVP_aes_256_cfb EVP_aes_256_cfb128 -const EVP_CIPHER *EVP_aes_256_ofb(void); -const EVP_CIPHER *EVP_aes_256_ctr(void); -const EVP_CIPHER *EVP_aes_256_ccm(void); -const EVP_CIPHER *EVP_aes_256_gcm(void); -const EVP_CIPHER *EVP_aes_256_xts(void); -const EVP_CIPHER *EVP_aes_256_wrap(void); -const EVP_CIPHER *EVP_aes_256_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_256_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); -const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); -const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); -const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); -# ifndef OPENSSL_NO_ARIA -const EVP_CIPHER *EVP_aria_128_ecb(void); -const EVP_CIPHER *EVP_aria_128_cbc(void); -const EVP_CIPHER *EVP_aria_128_cfb1(void); -const EVP_CIPHER *EVP_aria_128_cfb8(void); -const EVP_CIPHER *EVP_aria_128_cfb128(void); -# define EVP_aria_128_cfb EVP_aria_128_cfb128 -const EVP_CIPHER *EVP_aria_128_ctr(void); -const EVP_CIPHER *EVP_aria_128_ofb(void); -const EVP_CIPHER *EVP_aria_128_gcm(void); -const EVP_CIPHER *EVP_aria_128_ccm(void); -const EVP_CIPHER *EVP_aria_192_ecb(void); -const EVP_CIPHER *EVP_aria_192_cbc(void); -const EVP_CIPHER *EVP_aria_192_cfb1(void); -const EVP_CIPHER *EVP_aria_192_cfb8(void); -const EVP_CIPHER *EVP_aria_192_cfb128(void); -# define EVP_aria_192_cfb EVP_aria_192_cfb128 -const EVP_CIPHER *EVP_aria_192_ctr(void); -const EVP_CIPHER *EVP_aria_192_ofb(void); -const EVP_CIPHER *EVP_aria_192_gcm(void); -const EVP_CIPHER *EVP_aria_192_ccm(void); -const EVP_CIPHER *EVP_aria_256_ecb(void); -const EVP_CIPHER *EVP_aria_256_cbc(void); -const EVP_CIPHER *EVP_aria_256_cfb1(void); -const EVP_CIPHER *EVP_aria_256_cfb8(void); -const EVP_CIPHER *EVP_aria_256_cfb128(void); -# define EVP_aria_256_cfb EVP_aria_256_cfb128 -const EVP_CIPHER *EVP_aria_256_ctr(void); -const EVP_CIPHER *EVP_aria_256_ofb(void); -const EVP_CIPHER *EVP_aria_256_gcm(void); -const EVP_CIPHER *EVP_aria_256_ccm(void); -# endif -# ifndef OPENSSL_NO_CAMELLIA -const EVP_CIPHER *EVP_camellia_128_ecb(void); -const EVP_CIPHER *EVP_camellia_128_cbc(void); -const EVP_CIPHER *EVP_camellia_128_cfb1(void); -const EVP_CIPHER *EVP_camellia_128_cfb8(void); -const EVP_CIPHER *EVP_camellia_128_cfb128(void); -# define EVP_camellia_128_cfb EVP_camellia_128_cfb128 -const EVP_CIPHER *EVP_camellia_128_ofb(void); -const EVP_CIPHER *EVP_camellia_128_ctr(void); -const EVP_CIPHER *EVP_camellia_192_ecb(void); -const EVP_CIPHER *EVP_camellia_192_cbc(void); -const EVP_CIPHER *EVP_camellia_192_cfb1(void); -const EVP_CIPHER *EVP_camellia_192_cfb8(void); -const EVP_CIPHER *EVP_camellia_192_cfb128(void); -# define EVP_camellia_192_cfb EVP_camellia_192_cfb128 -const EVP_CIPHER *EVP_camellia_192_ofb(void); -const EVP_CIPHER *EVP_camellia_192_ctr(void); -const EVP_CIPHER *EVP_camellia_256_ecb(void); -const EVP_CIPHER *EVP_camellia_256_cbc(void); -const EVP_CIPHER *EVP_camellia_256_cfb1(void); -const EVP_CIPHER *EVP_camellia_256_cfb8(void); -const EVP_CIPHER *EVP_camellia_256_cfb128(void); -# define EVP_camellia_256_cfb EVP_camellia_256_cfb128 -const EVP_CIPHER *EVP_camellia_256_ofb(void); -const EVP_CIPHER *EVP_camellia_256_ctr(void); -# endif -# ifndef OPENSSL_NO_CHACHA -const EVP_CIPHER *EVP_chacha20(void); -# ifndef OPENSSL_NO_POLY1305 -const EVP_CIPHER *EVP_chacha20_poly1305(void); -# endif -# endif - -# ifndef OPENSSL_NO_SEED -const EVP_CIPHER *EVP_seed_ecb(void); -const EVP_CIPHER *EVP_seed_cbc(void); -const EVP_CIPHER *EVP_seed_cfb128(void); -# define EVP_seed_cfb EVP_seed_cfb128 -const EVP_CIPHER *EVP_seed_ofb(void); -# endif - -# ifndef OPENSSL_NO_SM4 -const EVP_CIPHER *EVP_sm4_ecb(void); -const EVP_CIPHER *EVP_sm4_cbc(void); -const EVP_CIPHER *EVP_sm4_cfb128(void); -# define EVP_sm4_cfb EVP_sm4_cfb128 -const EVP_CIPHER *EVP_sm4_ofb(void); -const EVP_CIPHER *EVP_sm4_ctr(void); -# endif - -# if OPENSSL_API_COMPAT < 0x10100000L -# define OPENSSL_add_all_algorithms_conf() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ - | OPENSSL_INIT_ADD_ALL_DIGESTS \ - | OPENSSL_INIT_LOAD_CONFIG, NULL) -# define OPENSSL_add_all_algorithms_noconf() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ - | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) - -# ifdef OPENSSL_LOAD_CONF -# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() -# else -# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() -# endif - -# define OpenSSL_add_all_ciphers() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) -# define OpenSSL_add_all_digests() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) - -# define EVP_cleanup() while(0) continue -# endif - -int EVP_add_cipher(const EVP_CIPHER *cipher); -int EVP_add_digest(const EVP_MD *digest); - -const EVP_CIPHER *EVP_get_cipherbyname(const char *name); -const EVP_MD *EVP_get_digestbyname(const char *name); - -void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, - const char *from, const char *to, void *x), - void *arg); -void EVP_CIPHER_do_all_sorted(void (*fn) - (const EVP_CIPHER *ciph, const char *from, - const char *to, void *x), void *arg); - -void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, - const char *from, const char *to, void *x), - void *arg); -void EVP_MD_do_all_sorted(void (*fn) - (const EVP_MD *ciph, const char *from, - const char *to, void *x), void *arg); - -int EVP_PKEY_decrypt_old(unsigned char *dec_key, - const unsigned char *enc_key, int enc_key_len, - EVP_PKEY *private_key); -int EVP_PKEY_encrypt_old(unsigned char *enc_key, - const unsigned char *key, int key_len, - EVP_PKEY *pub_key); -int EVP_PKEY_type(int type); -int EVP_PKEY_id(const EVP_PKEY *pkey); -int EVP_PKEY_base_id(const EVP_PKEY *pkey); -int EVP_PKEY_bits(const EVP_PKEY *pkey); -int EVP_PKEY_security_bits(const EVP_PKEY *pkey); -int EVP_PKEY_size(const EVP_PKEY *pkey); -int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); -int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); -int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); -# ifndef OPENSSL_NO_ENGINE -int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); -ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); -# endif -int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); -void *EVP_PKEY_get0(const EVP_PKEY *pkey); -const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); -# ifndef OPENSSL_NO_POLY1305 -const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); -# endif -# ifndef OPENSSL_NO_SIPHASH -const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); -# endif - -# ifndef OPENSSL_NO_RSA -struct rsa_st; -int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); -struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); -struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_DSA -struct dsa_st; -int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); -struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); -struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_DH -struct dh_st; -int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); -struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); -struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_EC -struct ec_key_st; -int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); -struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); -struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); -# endif - -EVP_PKEY *EVP_PKEY_new(void); -int EVP_PKEY_up_ref(EVP_PKEY *pkey); -void EVP_PKEY_free(EVP_PKEY *pkey); - -EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, - long length); -int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); - -EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, - long length); -EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, - long length); -int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); - -int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); -int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); -int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); -int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); - -int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); - -int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); -int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); -int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); - -int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); - -int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, - const unsigned char *pt, size_t ptlen); -size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); - -int EVP_CIPHER_type(const EVP_CIPHER *ctx); - -/* calls methods */ -int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -/* These are used by EVP_CIPHER methods */ -int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -/* PKCS5 password based encryption */ -int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md, int en_de); -int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, - const unsigned char *salt, int saltlen, int iter, - int keylen, unsigned char *out); -int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, - const unsigned char *salt, int saltlen, int iter, - const EVP_MD *digest, int keylen, unsigned char *out); -int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md, int en_de); - -#ifndef OPENSSL_NO_SCRYPT -int EVP_PBE_scrypt(const char *pass, size_t passlen, - const unsigned char *salt, size_t saltlen, - uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, - unsigned char *key, size_t keylen); - -int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, - int passlen, ASN1_TYPE *param, - const EVP_CIPHER *c, const EVP_MD *md, int en_de); -#endif - -void PKCS5_PBE_add(void); - -int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, - ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); - -/* PBE type */ - -/* Can appear as the outermost AlgorithmIdentifier */ -# define EVP_PBE_TYPE_OUTER 0x0 -/* Is an PRF type OID */ -# define EVP_PBE_TYPE_PRF 0x1 -/* Is a PKCS#5 v2.0 KDF */ -# define EVP_PBE_TYPE_KDF 0x2 - -int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, - int md_nid, EVP_PBE_KEYGEN *keygen); -int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, - EVP_PBE_KEYGEN *keygen); -int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, - EVP_PBE_KEYGEN **pkeygen); -void EVP_PBE_cleanup(void); -int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); - -# define ASN1_PKEY_ALIAS 0x1 -# define ASN1_PKEY_DYNAMIC 0x2 -# define ASN1_PKEY_SIGPARAM_NULL 0x4 - -# define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 -# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 -# define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 -# define ASN1_PKEY_CTRL_CMS_SIGN 0x5 -# define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 -# define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 - -# define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 -# define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa - -int EVP_PKEY_asn1_get_count(void); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, - const char *str, int len); -int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); -int EVP_PKEY_asn1_add_alias(int to, int from); -int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, - int *ppkey_flags, const char **pinfo, - const char **ppem_str, - const EVP_PKEY_ASN1_METHOD *ameth); - -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); -EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, - const char *pem_str, - const char *info); -void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, - const EVP_PKEY_ASN1_METHOD *src); -void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); -void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, - int (*pub_decode) (EVP_PKEY *pk, - X509_PUBKEY *pub), - int (*pub_encode) (X509_PUBKEY *pub, - const EVP_PKEY *pk), - int (*pub_cmp) (const EVP_PKEY *a, - const EVP_PKEY *b), - int (*pub_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx), - int (*pkey_size) (const EVP_PKEY *pk), - int (*pkey_bits) (const EVP_PKEY *pk)); -void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, - int (*priv_decode) (EVP_PKEY *pk, - const PKCS8_PRIV_KEY_INFO - *p8inf), - int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, - const EVP_PKEY *pk), - int (*priv_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, - ASN1_PCTX *pctx)); -void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, - int (*param_decode) (EVP_PKEY *pkey, - const unsigned char **pder, - int derlen), - int (*param_encode) (const EVP_PKEY *pkey, - unsigned char **pder), - int (*param_missing) (const EVP_PKEY *pk), - int (*param_copy) (EVP_PKEY *to, - const EVP_PKEY *from), - int (*param_cmp) (const EVP_PKEY *a, - const EVP_PKEY *b), - int (*param_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, - ASN1_PCTX *pctx)); - -void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, - void (*pkey_free) (EVP_PKEY *pkey)); -void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_ctrl) (EVP_PKEY *pkey, int op, - long arg1, void *arg2)); -void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, - int (*item_verify) (EVP_MD_CTX *ctx, - const ASN1_ITEM *it, - void *asn, - X509_ALGOR *a, - ASN1_BIT_STRING *sig, - EVP_PKEY *pkey), - int (*item_sign) (EVP_MD_CTX *ctx, - const ASN1_ITEM *it, - void *asn, - X509_ALGOR *alg1, - X509_ALGOR *alg2, - ASN1_BIT_STRING *sig)); - -void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, - int (*siginf_set) (X509_SIG_INFO *siginf, - const X509_ALGOR *alg, - const ASN1_STRING *sig)); - -void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_pub_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_param_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*set_priv_key) (EVP_PKEY *pk, - const unsigned char - *priv, - size_t len)); -void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*set_pub_key) (EVP_PKEY *pk, - const unsigned char *pub, - size_t len)); -void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*get_priv_key) (const EVP_PKEY *pk, - unsigned char *priv, - size_t *len)); -void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*get_pub_key) (const EVP_PKEY *pk, - unsigned char *pub, - size_t *len)); - -void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_security_bits) (const EVP_PKEY - *pk)); - -# define EVP_PKEY_OP_UNDEFINED 0 -# define EVP_PKEY_OP_PARAMGEN (1<<1) -# define EVP_PKEY_OP_KEYGEN (1<<2) -# define EVP_PKEY_OP_SIGN (1<<3) -# define EVP_PKEY_OP_VERIFY (1<<4) -# define EVP_PKEY_OP_VERIFYRECOVER (1<<5) -# define EVP_PKEY_OP_SIGNCTX (1<<6) -# define EVP_PKEY_OP_VERIFYCTX (1<<7) -# define EVP_PKEY_OP_ENCRYPT (1<<8) -# define EVP_PKEY_OP_DECRYPT (1<<9) -# define EVP_PKEY_OP_DERIVE (1<<10) - -# define EVP_PKEY_OP_TYPE_SIG \ - (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ - | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) - -# define EVP_PKEY_OP_TYPE_CRYPT \ - (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) - -# define EVP_PKEY_OP_TYPE_NOGEN \ - (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE) - -# define EVP_PKEY_OP_TYPE_GEN \ - (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) - -# define EVP_PKEY_CTX_set_signature_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ - EVP_PKEY_CTRL_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ - EVP_PKEY_CTRL_GET_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)(key)) - -# define EVP_PKEY_CTRL_MD 1 -# define EVP_PKEY_CTRL_PEER_KEY 2 - -# define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 -# define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 - -# define EVP_PKEY_CTRL_PKCS7_SIGN 5 - -# define EVP_PKEY_CTRL_SET_MAC_KEY 6 - -# define EVP_PKEY_CTRL_DIGESTINIT 7 - -/* Used by GOST key encryption in TLS */ -# define EVP_PKEY_CTRL_SET_IV 8 - -# define EVP_PKEY_CTRL_CMS_ENCRYPT 9 -# define EVP_PKEY_CTRL_CMS_DECRYPT 10 -# define EVP_PKEY_CTRL_CMS_SIGN 11 - -# define EVP_PKEY_CTRL_CIPHER 12 - -# define EVP_PKEY_CTRL_GET_MD 13 - -# define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 - -# define EVP_PKEY_ALG_CTRL 0x1000 - -# define EVP_PKEY_FLAG_AUTOARGLEN 2 -/* - * Method handles all operations: don't assume any digest related defaults. - */ -# define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 - -const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); -EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); -void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, - const EVP_PKEY_METHOD *meth); -void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); -void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); -int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); -int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); -size_t EVP_PKEY_meth_get_count(void); -const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); - -EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); -EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); -EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); -void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, - int cmd, int p1, void *p2); -int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, - const char *value); -int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, - int cmd, uint64_t value); - -int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); -int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); - -int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); - -int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); -void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); - -EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, - const unsigned char *key, int keylen); -EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, - const unsigned char *priv, - size_t len); -EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, - const unsigned char *pub, - size_t len); -int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, - size_t *len); -int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, - size_t *len); - -EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, - size_t len, const EVP_CIPHER *cipher); - -void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); -void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); -EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); - -EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); - -void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); -void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, size_t tbslen); -int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, - const unsigned char *sig, size_t siglen, - const unsigned char *tbs, size_t tbslen); -int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, - unsigned char *rout, size_t *routlen, - const unsigned char *sig, size_t siglen); -int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); -int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); - -int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); -int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); - -typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); -int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); -int EVP_PKEY_check(EVP_PKEY_CTX *ctx); -int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); -int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); - -void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); -EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); - -void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, - int (*init) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, - int (*copy) (EVP_PKEY_CTX *dst, - EVP_PKEY_CTX *src)); - -void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, - void (*cleanup) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, - int (*paramgen_init) (EVP_PKEY_CTX *ctx), - int (*paramgen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, - int (*keygen_init) (EVP_PKEY_CTX *ctx), - int (*keygen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, - int (*sign_init) (EVP_PKEY_CTX *ctx), - int (*sign) (EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, - int (*verify_init) (EVP_PKEY_CTX *ctx), - int (*verify) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, - int (*verify_recover_init) (EVP_PKEY_CTX - *ctx), - int (*verify_recover) (EVP_PKEY_CTX - *ctx, - unsigned char - *sig, - size_t *siglen, - const unsigned - char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, - int (*signctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (*signctx) (EVP_PKEY_CTX *ctx, - unsigned char *sig, - size_t *siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, - int (*verifyctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (*verifyctx) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - int siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, - int (*encrypt_init) (EVP_PKEY_CTX *ctx), - int (*encryptfn) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, - int (*decrypt_init) (EVP_PKEY_CTX *ctx), - int (*decrypt) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, - int (*derive_init) (EVP_PKEY_CTX *ctx), - int (*derive) (EVP_PKEY_CTX *ctx, - unsigned char *key, - size_t *keylen)); - -void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, - int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, - void *p2), - int (*ctrl_str) (EVP_PKEY_CTX *ctx, - const char *type, - const char *value)); - -void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth, - int (*digestsign) (EVP_MD_CTX *ctx, - unsigned char *sig, - size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth, - int (*digestverify) (EVP_MD_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, - int (*digest_custom) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, - int (**pinit) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, - int (**pcopy) (EVP_PKEY_CTX *dst, - EVP_PKEY_CTX *src)); - -void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, - void (**pcleanup) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, - int (**pparamgen_init) (EVP_PKEY_CTX *ctx), - int (**pparamgen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, - int (**pkeygen_init) (EVP_PKEY_CTX *ctx), - int (**pkeygen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, - int (**psign_init) (EVP_PKEY_CTX *ctx), - int (**psign) (EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, - int (**pverify_init) (EVP_PKEY_CTX *ctx), - int (**pverify) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, - int (**pverify_recover_init) (EVP_PKEY_CTX - *ctx), - int (**pverify_recover) (EVP_PKEY_CTX - *ctx, - unsigned char - *sig, - size_t *siglen, - const unsigned - char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, - int (**psignctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (**psignctx) (EVP_PKEY_CTX *ctx, - unsigned char *sig, - size_t *siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, - int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (**pverifyctx) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - int siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, - int (**pencrypt_init) (EVP_PKEY_CTX *ctx), - int (**pencryptfn) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, - int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), - int (**pdecrypt) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, - int (**pderive_init) (EVP_PKEY_CTX *ctx), - int (**pderive) (EVP_PKEY_CTX *ctx, - unsigned char *key, - size_t *keylen)); - -void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, - int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, - void *p2), - int (**pctrl_str) (EVP_PKEY_CTX *ctx, - const char *type, - const char *value)); - -void EVP_PKEY_meth_get_digestsign(EVP_PKEY_METHOD *pmeth, - int (**digestsign) (EVP_MD_CTX *ctx, - unsigned char *sig, - size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_digestverify(EVP_PKEY_METHOD *pmeth, - int (**digestverify) (EVP_MD_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_digest_custom(EVP_PKEY_METHOD *pmeth, - int (**pdigest_custom) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx)); -void EVP_add_alg_module(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/evperr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/evperr.h deleted file mode 100644 index d2b26ea5..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/evperr.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/hmac.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/hmac.h deleted file mode 100644 index 458efc1d..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/hmac.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 1995-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_HMAC_H -# define HEADER_HMAC_H - -# include - -# include - -# if OPENSSL_API_COMPAT < 0x10200000L -# define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */ -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -size_t HMAC_size(const HMAC_CTX *e); -HMAC_CTX *HMAC_CTX_new(void); -int HMAC_CTX_reset(HMAC_CTX *ctx); -void HMAC_CTX_free(HMAC_CTX *ctx); - -DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md)) - -/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md, ENGINE *impl); -/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, - size_t len); -/*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, - unsigned int *len); -unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, - const unsigned char *d, size_t n, unsigned char *md, - unsigned int *md_len); -__owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); - -void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); -const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/idea.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/idea.h deleted file mode 100644 index 4334f3ea..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/idea.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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_IDEA_H -# define HEADER_IDEA_H - -# include - -# ifndef OPENSSL_NO_IDEA -# ifdef __cplusplus -extern "C" { -# endif - -typedef unsigned int IDEA_INT; - -# define IDEA_ENCRYPT 1 -# define IDEA_DECRYPT 0 - -# define IDEA_BLOCK 8 -# define IDEA_KEY_LENGTH 16 - -typedef struct idea_key_st { - IDEA_INT data[9][6]; -} IDEA_KEY_SCHEDULE; - -const char *IDEA_options(void); -void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, - 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_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int enc); -void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int *num, int enc); -void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int *num); -void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); - -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/kdf.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/kdf.h deleted file mode 100644 index 5abd4c37..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/kdf.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 -#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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/kdferr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/kdferr.h deleted file mode 100644 index 3f51bd02..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/kdferr.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/lhash.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/lhash.h deleted file mode 100644 index 2e42d727..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/lhash.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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 - */ - -/* - * Header for dynamic hash table routines Author - Eric Young - */ - -#ifndef HEADER_LHASH_H -# define HEADER_LHASH_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct lhash_node_st OPENSSL_LH_NODE; -typedef int (*OPENSSL_LH_COMPFUNC) (const void *, const void *); -typedef unsigned long (*OPENSSL_LH_HASHFUNC) (const void *); -typedef void (*OPENSSL_LH_DOALL_FUNC) (void *); -typedef void (*OPENSSL_LH_DOALL_FUNCARG) (void *, void *); -typedef struct lhash_st OPENSSL_LHASH; - -/* - * Macros for declaring and implementing type-safe wrappers for LHASH - * callbacks. This way, callbacks can be provided to LHASH structures without - * function pointer casting and the macro-defined callbacks provide - * per-variable casting before deferring to the underlying type-specific - * callbacks. NB: It is possible to place a "static" in front of both the - * DECLARE and IMPLEMENT macros if the functions are strictly internal. - */ - -/* First: "hash" functions */ -# define DECLARE_LHASH_HASH_FN(name, o_type) \ - unsigned long name##_LHASH_HASH(const void *); -# define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ - unsigned long name##_LHASH_HASH(const void *arg) { \ - const o_type *a = arg; \ - return name##_hash(a); } -# define LHASH_HASH_FN(name) name##_LHASH_HASH - -/* Second: "compare" functions */ -# define DECLARE_LHASH_COMP_FN(name, o_type) \ - int name##_LHASH_COMP(const void *, const void *); -# define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ - int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ - const o_type *a = arg1; \ - const o_type *b = arg2; \ - return name##_cmp(a,b); } -# define LHASH_COMP_FN(name) name##_LHASH_COMP - -/* Fourth: "doall_arg" functions */ -# define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ - void name##_LHASH_DOALL_ARG(void *, void *); -# define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ - void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ - o_type *a = arg1; \ - a_type *b = arg2; \ - name##_doall_arg(a, b); } -# define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG - - -# define LH_LOAD_MULT 256 - -int OPENSSL_LH_error(OPENSSL_LHASH *lh); -OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c); -void OPENSSL_LH_free(OPENSSL_LHASH *lh); -void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data); -void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data); -void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data); -void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func); -void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg); -unsigned long OPENSSL_LH_strhash(const char *c); -unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh); -unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh); -void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load); - -# ifndef OPENSSL_NO_STDIO -void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp); -void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp); -void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp); -# endif -void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out); -void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out); -void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define _LHASH OPENSSL_LHASH -# define LHASH_NODE OPENSSL_LH_NODE -# define lh_error OPENSSL_LH_error -# define lh_new OPENSSL_LH_new -# define lh_free OPENSSL_LH_free -# define lh_insert OPENSSL_LH_insert -# define lh_delete OPENSSL_LH_delete -# define lh_retrieve OPENSSL_LH_retrieve -# define lh_doall OPENSSL_LH_doall -# define lh_doall_arg OPENSSL_LH_doall_arg -# define lh_strhash OPENSSL_LH_strhash -# define lh_num_items OPENSSL_LH_num_items -# ifndef OPENSSL_NO_STDIO -# define lh_stats OPENSSL_LH_stats -# define lh_node_stats OPENSSL_LH_node_stats -# define lh_node_usage_stats OPENSSL_LH_node_usage_stats -# endif -# define lh_stats_bio OPENSSL_LH_stats_bio -# define lh_node_stats_bio OPENSSL_LH_node_stats_bio -# define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio -# endif - -/* Type checking... */ - -# define LHASH_OF(type) struct lhash_st_##type - -# define DEFINE_LHASH_OF(type) \ - LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \ - static ossl_unused ossl_inline LHASH_OF(type) *lh_##type##_new(unsigned long (*hfn)(const type *), \ - int (*cfn)(const type *, const type *)) \ - { \ - return (LHASH_OF(type) *) \ - OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \ - } \ - static ossl_unused ossl_inline void lh_##type##_free(LHASH_OF(type) *lh) \ - { \ - OPENSSL_LH_free((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_insert(LHASH_OF(type) *lh, type *d) \ - { \ - return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *d) \ - { \ - return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d) \ - { \ - return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline int lh_##type##_error(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline unsigned long lh_##type##_num_items(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline void lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline void lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline void lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline unsigned long lh_##type##_get_down_load(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline void lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl) \ - { \ - OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \ - } \ - static ossl_unused ossl_inline void lh_##type##_doall(LHASH_OF(type) *lh, \ - void (*doall)(type *)) \ - { \ - OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \ - } \ - LHASH_OF(type) - -#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \ - int_implement_lhash_doall(type, argtype, const type) - -#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \ - int_implement_lhash_doall(type, argtype, type) - -#define int_implement_lhash_doall(type, argtype, cbargtype) \ - static ossl_unused ossl_inline void \ - lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \ - void (*fn)(cbargtype *, argtype *), \ - argtype *arg) \ - { \ - OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \ - } \ - LHASH_OF(type) - -DEFINE_LHASH_OF(OPENSSL_STRING); -# ifdef _MSC_VER -/* - * push and pop this warning: - * warning C4090: 'function': different 'const' qualifiers - */ -# pragma warning (push) -# pragma warning (disable: 4090) -# endif - -DEFINE_LHASH_OF(OPENSSL_CSTRING); - -# ifdef _MSC_VER -# pragma warning (pop) -# endif - -/* - * If called without higher optimization (min. -xO3) the Oracle Developer - * Studio compiler generates code for the defined (static inline) functions - * above. - * This would later lead to the linker complaining about missing symbols when - * this header file is included but the resulting object is not linked against - * the Crypto library (openssl#6912). - */ -# ifdef __SUNPRO_C -# pragma weak OPENSSL_LH_new -# pragma weak OPENSSL_LH_free -# pragma weak OPENSSL_LH_insert -# pragma weak OPENSSL_LH_delete -# pragma weak OPENSSL_LH_retrieve -# pragma weak OPENSSL_LH_error -# pragma weak OPENSSL_LH_num_items -# pragma weak OPENSSL_LH_node_stats_bio -# pragma weak OPENSSL_LH_node_usage_stats_bio -# pragma weak OPENSSL_LH_stats_bio -# pragma weak OPENSSL_LH_get_down_load -# pragma weak OPENSSL_LH_set_down_load -# pragma weak OPENSSL_LH_doall -# pragma weak OPENSSL_LH_doall_arg -# endif /* __SUNPRO_C */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/md2.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/md2.h deleted file mode 100644 index 7faf8e3d..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/md2.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 - -# ifndef OPENSSL_NO_MD2 -# include -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/md4.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/md4.h deleted file mode 100644 index 940e29db..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/md4.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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_MD4_H -# define HEADER_MD4_H - -# include - -# ifndef OPENSSL_NO_MD4 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! MD4_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define MD4_LONG unsigned int - -# define MD4_CBLOCK 64 -# define MD4_LBLOCK (MD4_CBLOCK/4) -# define MD4_DIGEST_LENGTH 16 - -typedef struct MD4state_st { - MD4_LONG A, B, C, D; - MD4_LONG Nl, Nh; - MD4_LONG data[MD4_LBLOCK]; - unsigned int num; -} MD4_CTX; - -int MD4_Init(MD4_CTX *c); -int MD4_Update(MD4_CTX *c, const void *data, size_t len); -int MD4_Final(unsigned char *md, MD4_CTX *c); -unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); -void MD4_Transform(MD4_CTX *c, const unsigned char *b); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/md5.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/md5.h deleted file mode 100644 index 2deb7721..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/md5.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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_MD5_H -# define HEADER_MD5_H - -# include - -# ifndef OPENSSL_NO_MD5 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! MD5_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define MD5_LONG unsigned int - -# define MD5_CBLOCK 64 -# define MD5_LBLOCK (MD5_CBLOCK/4) -# define MD5_DIGEST_LENGTH 16 - -typedef struct MD5state_st { - MD5_LONG A, B, C, D; - MD5_LONG Nl, Nh; - MD5_LONG data[MD5_LBLOCK]; - unsigned int num; -} MD5_CTX; - -int MD5_Init(MD5_CTX *c); -int MD5_Update(MD5_CTX *c, const void *data, size_t len); -int MD5_Final(unsigned char *md, MD5_CTX *c); -unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); -void MD5_Transform(MD5_CTX *c, const unsigned char *b); -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/mdc2.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/mdc2.h deleted file mode 100644 index aabd2bfa..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/mdc2.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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_MDC2_H -# define HEADER_MDC2_H - -# include - -#ifndef OPENSSL_NO_MDC2 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define MDC2_BLOCK 8 -# define MDC2_DIGEST_LENGTH 16 - -typedef struct mdc2_ctx_st { - unsigned int num; - unsigned char data[MDC2_BLOCK]; - DES_cblock h, hh; - int pad_type; /* either 1 or 2, default 1 */ -} MDC2_CTX; - -int MDC2_Init(MDC2_CTX *c); -int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); -int MDC2_Final(unsigned char *md, MDC2_CTX *c); -unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/modes.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/modes.h deleted file mode 100644 index d544f98d..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/modes.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright 2008-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_MODES_H -# define HEADER_MODES_H - -# include - -# ifdef __cplusplus -extern "C" { -# endif -typedef void (*block128_f) (const unsigned char in[16], - unsigned char out[16], const void *key); - -typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int enc); - -typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16]); - -typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16], - unsigned char cmac[16]); - -void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); -void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); - -void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], - unsigned char ecount_buf[16], unsigned int *num, - block128_f block); - -void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], - unsigned char ecount_buf[16], - unsigned int *num, ctr128_f ctr); - -void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - block128_f block); - -void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); -void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); -void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, - size_t bits, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); - -size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, unsigned char ivec[16], - block128_f block); -size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); -size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, unsigned char ivec[16], - block128_f block); -size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); - -size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, - unsigned char ivec[16], - block128_f block); -size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); -size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, - unsigned char ivec[16], - block128_f block); -size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); - -typedef struct gcm128_context GCM128_CONTEXT; - -GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); -void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); -void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, - size_t len); -int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, - size_t len); -int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); -int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); -int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); -int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); -int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, - size_t len); -void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); -void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); - -typedef struct ccm128_context CCM128_CONTEXT; - -void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, - unsigned int M, unsigned int L, void *key, - block128_f block); -int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, - size_t nlen, size_t mlen); -void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, - size_t alen); -int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len); -int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len); -int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len, - ccm128_f stream); -int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len, - ccm128_f stream); -size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); - -typedef struct xts128_context XTS128_CONTEXT; - -int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, - const unsigned char iv[16], - const unsigned char *inp, unsigned char *out, - size_t len, int enc); - -size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, size_t inlen, - block128_f block); - -size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, size_t inlen, - block128_f block); -size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, - unsigned char *out, const unsigned char *in, - size_t inlen, block128_f block); -size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, - unsigned char *out, const unsigned char *in, - size_t inlen, block128_f block); - -# ifndef OPENSSL_NO_OCB -typedef struct ocb128_context OCB128_CONTEXT; - -typedef void (*ocb128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - size_t start_block_num, - unsigned char offset_i[16], - const unsigned char L_[][16], - unsigned char checksum[16]); - -OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, - block128_f encrypt, block128_f decrypt, - ocb128_f stream); -int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, - block128_f encrypt, block128_f decrypt, - ocb128_f stream); -int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, - void *keyenc, void *keydec); -int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, - size_t len, size_t taglen); -int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, - size_t len); -int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in, - unsigned char *out, size_t len); -int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in, - unsigned char *out, size_t len); -int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag, - size_t len); -int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len); -void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx); -# endif /* OPENSSL_NO_OCB */ - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/obj_mac.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/obj_mac.h deleted file mode 100644 index 483fc050..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/obj_mac.h +++ /dev/null @@ -1,5198 +0,0 @@ -/* - * WARNING: do not edit! - * Generated by crypto/objects/objects.pl - * - * Copyright 2000-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 - */ - -#define SN_undef "UNDEF" -#define LN_undef "undefined" -#define NID_undef 0 -#define OBJ_undef 0L - -#define SN_itu_t "ITU-T" -#define LN_itu_t "itu-t" -#define NID_itu_t 645 -#define OBJ_itu_t 0L - -#define NID_ccitt 404 -#define OBJ_ccitt OBJ_itu_t - -#define SN_iso "ISO" -#define LN_iso "iso" -#define NID_iso 181 -#define OBJ_iso 1L - -#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" -#define LN_joint_iso_itu_t "joint-iso-itu-t" -#define NID_joint_iso_itu_t 646 -#define OBJ_joint_iso_itu_t 2L - -#define NID_joint_iso_ccitt 393 -#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t - -#define SN_member_body "member-body" -#define LN_member_body "ISO Member Body" -#define NID_member_body 182 -#define OBJ_member_body OBJ_iso,2L - -#define SN_identified_organization "identified-organization" -#define NID_identified_organization 676 -#define OBJ_identified_organization OBJ_iso,3L - -#define SN_hmac_md5 "HMAC-MD5" -#define LN_hmac_md5 "hmac-md5" -#define NID_hmac_md5 780 -#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L - -#define SN_hmac_sha1 "HMAC-SHA1" -#define LN_hmac_sha1 "hmac-sha1" -#define NID_hmac_sha1 781 -#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L - -#define SN_x509ExtAdmission "x509ExtAdmission" -#define LN_x509ExtAdmission "Professional Information or basis for Admission" -#define NID_x509ExtAdmission 1093 -#define OBJ_x509ExtAdmission OBJ_identified_organization,36L,8L,3L,3L - -#define SN_certicom_arc "certicom-arc" -#define NID_certicom_arc 677 -#define OBJ_certicom_arc OBJ_identified_organization,132L - -#define SN_ieee "ieee" -#define NID_ieee 1170 -#define OBJ_ieee OBJ_identified_organization,111L - -#define SN_ieee_siswg "ieee-siswg" -#define LN_ieee_siswg "IEEE Security in Storage Working Group" -#define NID_ieee_siswg 1171 -#define OBJ_ieee_siswg OBJ_ieee,2L,1619L - -#define SN_international_organizations "international-organizations" -#define LN_international_organizations "International Organizations" -#define NID_international_organizations 647 -#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L - -#define SN_wap "wap" -#define NID_wap 678 -#define OBJ_wap OBJ_international_organizations,43L - -#define SN_wap_wsg "wap-wsg" -#define NID_wap_wsg 679 -#define OBJ_wap_wsg OBJ_wap,1L - -#define SN_selected_attribute_types "selected-attribute-types" -#define LN_selected_attribute_types "Selected Attribute Types" -#define NID_selected_attribute_types 394 -#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L - -#define SN_clearance "clearance" -#define NID_clearance 395 -#define OBJ_clearance OBJ_selected_attribute_types,55L - -#define SN_ISO_US "ISO-US" -#define LN_ISO_US "ISO US Member Body" -#define NID_ISO_US 183 -#define OBJ_ISO_US OBJ_member_body,840L - -#define SN_X9_57 "X9-57" -#define LN_X9_57 "X9.57" -#define NID_X9_57 184 -#define OBJ_X9_57 OBJ_ISO_US,10040L - -#define SN_X9cm "X9cm" -#define LN_X9cm "X9.57 CM ?" -#define NID_X9cm 185 -#define OBJ_X9cm OBJ_X9_57,4L - -#define SN_ISO_CN "ISO-CN" -#define LN_ISO_CN "ISO CN Member Body" -#define NID_ISO_CN 1140 -#define OBJ_ISO_CN OBJ_member_body,156L - -#define SN_oscca "oscca" -#define NID_oscca 1141 -#define OBJ_oscca OBJ_ISO_CN,10197L - -#define SN_sm_scheme "sm-scheme" -#define NID_sm_scheme 1142 -#define OBJ_sm_scheme OBJ_oscca,1L - -#define SN_dsa "DSA" -#define LN_dsa "dsaEncryption" -#define NID_dsa 116 -#define OBJ_dsa OBJ_X9cm,1L - -#define SN_dsaWithSHA1 "DSA-SHA1" -#define LN_dsaWithSHA1 "dsaWithSHA1" -#define NID_dsaWithSHA1 113 -#define OBJ_dsaWithSHA1 OBJ_X9cm,3L - -#define SN_ansi_X9_62 "ansi-X9-62" -#define LN_ansi_X9_62 "ANSI X9.62" -#define NID_ansi_X9_62 405 -#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L - -#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L - -#define SN_X9_62_prime_field "prime-field" -#define NID_X9_62_prime_field 406 -#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L - -#define SN_X9_62_characteristic_two_field "characteristic-two-field" -#define NID_X9_62_characteristic_two_field 407 -#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L - -#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" -#define NID_X9_62_id_characteristic_two_basis 680 -#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L - -#define SN_X9_62_onBasis "onBasis" -#define NID_X9_62_onBasis 681 -#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L - -#define SN_X9_62_tpBasis "tpBasis" -#define NID_X9_62_tpBasis 682 -#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L - -#define SN_X9_62_ppBasis "ppBasis" -#define NID_X9_62_ppBasis 683 -#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L - -#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L - -#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" -#define NID_X9_62_id_ecPublicKey 408 -#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L - -#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L - -#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L - -#define SN_X9_62_c2pnb163v1 "c2pnb163v1" -#define NID_X9_62_c2pnb163v1 684 -#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L - -#define SN_X9_62_c2pnb163v2 "c2pnb163v2" -#define NID_X9_62_c2pnb163v2 685 -#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L - -#define SN_X9_62_c2pnb163v3 "c2pnb163v3" -#define NID_X9_62_c2pnb163v3 686 -#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L - -#define SN_X9_62_c2pnb176v1 "c2pnb176v1" -#define NID_X9_62_c2pnb176v1 687 -#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L - -#define SN_X9_62_c2tnb191v1 "c2tnb191v1" -#define NID_X9_62_c2tnb191v1 688 -#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L - -#define SN_X9_62_c2tnb191v2 "c2tnb191v2" -#define NID_X9_62_c2tnb191v2 689 -#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L - -#define SN_X9_62_c2tnb191v3 "c2tnb191v3" -#define NID_X9_62_c2tnb191v3 690 -#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L - -#define SN_X9_62_c2onb191v4 "c2onb191v4" -#define NID_X9_62_c2onb191v4 691 -#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L - -#define SN_X9_62_c2onb191v5 "c2onb191v5" -#define NID_X9_62_c2onb191v5 692 -#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L - -#define SN_X9_62_c2pnb208w1 "c2pnb208w1" -#define NID_X9_62_c2pnb208w1 693 -#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L - -#define SN_X9_62_c2tnb239v1 "c2tnb239v1" -#define NID_X9_62_c2tnb239v1 694 -#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L - -#define SN_X9_62_c2tnb239v2 "c2tnb239v2" -#define NID_X9_62_c2tnb239v2 695 -#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L - -#define SN_X9_62_c2tnb239v3 "c2tnb239v3" -#define NID_X9_62_c2tnb239v3 696 -#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L - -#define SN_X9_62_c2onb239v4 "c2onb239v4" -#define NID_X9_62_c2onb239v4 697 -#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L - -#define SN_X9_62_c2onb239v5 "c2onb239v5" -#define NID_X9_62_c2onb239v5 698 -#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L - -#define SN_X9_62_c2pnb272w1 "c2pnb272w1" -#define NID_X9_62_c2pnb272w1 699 -#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L - -#define SN_X9_62_c2pnb304w1 "c2pnb304w1" -#define NID_X9_62_c2pnb304w1 700 -#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L - -#define SN_X9_62_c2tnb359v1 "c2tnb359v1" -#define NID_X9_62_c2tnb359v1 701 -#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L - -#define SN_X9_62_c2pnb368w1 "c2pnb368w1" -#define NID_X9_62_c2pnb368w1 702 -#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L - -#define SN_X9_62_c2tnb431r1 "c2tnb431r1" -#define NID_X9_62_c2tnb431r1 703 -#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L - -#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L - -#define SN_X9_62_prime192v1 "prime192v1" -#define NID_X9_62_prime192v1 409 -#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L - -#define SN_X9_62_prime192v2 "prime192v2" -#define NID_X9_62_prime192v2 410 -#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L - -#define SN_X9_62_prime192v3 "prime192v3" -#define NID_X9_62_prime192v3 411 -#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L - -#define SN_X9_62_prime239v1 "prime239v1" -#define NID_X9_62_prime239v1 412 -#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L - -#define SN_X9_62_prime239v2 "prime239v2" -#define NID_X9_62_prime239v2 413 -#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L - -#define SN_X9_62_prime239v3 "prime239v3" -#define NID_X9_62_prime239v3 414 -#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L - -#define SN_X9_62_prime256v1 "prime256v1" -#define NID_X9_62_prime256v1 415 -#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L - -#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L - -#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" -#define NID_ecdsa_with_SHA1 416 -#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L - -#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" -#define NID_ecdsa_with_Recommended 791 -#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L - -#define SN_ecdsa_with_Specified "ecdsa-with-Specified" -#define NID_ecdsa_with_Specified 792 -#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L - -#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" -#define NID_ecdsa_with_SHA224 793 -#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L - -#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" -#define NID_ecdsa_with_SHA256 794 -#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L - -#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" -#define NID_ecdsa_with_SHA384 795 -#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L - -#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" -#define NID_ecdsa_with_SHA512 796 -#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L - -#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L - -#define SN_secp112r1 "secp112r1" -#define NID_secp112r1 704 -#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L - -#define SN_secp112r2 "secp112r2" -#define NID_secp112r2 705 -#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L - -#define SN_secp128r1 "secp128r1" -#define NID_secp128r1 706 -#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L - -#define SN_secp128r2 "secp128r2" -#define NID_secp128r2 707 -#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L - -#define SN_secp160k1 "secp160k1" -#define NID_secp160k1 708 -#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L - -#define SN_secp160r1 "secp160r1" -#define NID_secp160r1 709 -#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L - -#define SN_secp160r2 "secp160r2" -#define NID_secp160r2 710 -#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L - -#define SN_secp192k1 "secp192k1" -#define NID_secp192k1 711 -#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L - -#define SN_secp224k1 "secp224k1" -#define NID_secp224k1 712 -#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L - -#define SN_secp224r1 "secp224r1" -#define NID_secp224r1 713 -#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L - -#define SN_secp256k1 "secp256k1" -#define NID_secp256k1 714 -#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L - -#define SN_secp384r1 "secp384r1" -#define NID_secp384r1 715 -#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L - -#define SN_secp521r1 "secp521r1" -#define NID_secp521r1 716 -#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L - -#define SN_sect113r1 "sect113r1" -#define NID_sect113r1 717 -#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L - -#define SN_sect113r2 "sect113r2" -#define NID_sect113r2 718 -#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L - -#define SN_sect131r1 "sect131r1" -#define NID_sect131r1 719 -#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L - -#define SN_sect131r2 "sect131r2" -#define NID_sect131r2 720 -#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L - -#define SN_sect163k1 "sect163k1" -#define NID_sect163k1 721 -#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L - -#define SN_sect163r1 "sect163r1" -#define NID_sect163r1 722 -#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L - -#define SN_sect163r2 "sect163r2" -#define NID_sect163r2 723 -#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L - -#define SN_sect193r1 "sect193r1" -#define NID_sect193r1 724 -#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L - -#define SN_sect193r2 "sect193r2" -#define NID_sect193r2 725 -#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L - -#define SN_sect233k1 "sect233k1" -#define NID_sect233k1 726 -#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L - -#define SN_sect233r1 "sect233r1" -#define NID_sect233r1 727 -#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L - -#define SN_sect239k1 "sect239k1" -#define NID_sect239k1 728 -#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L - -#define SN_sect283k1 "sect283k1" -#define NID_sect283k1 729 -#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L - -#define SN_sect283r1 "sect283r1" -#define NID_sect283r1 730 -#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L - -#define SN_sect409k1 "sect409k1" -#define NID_sect409k1 731 -#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L - -#define SN_sect409r1 "sect409r1" -#define NID_sect409r1 732 -#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L - -#define SN_sect571k1 "sect571k1" -#define NID_sect571k1 733 -#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L - -#define SN_sect571r1 "sect571r1" -#define NID_sect571r1 734 -#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L - -#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L - -#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" -#define NID_wap_wsg_idm_ecid_wtls1 735 -#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L - -#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" -#define NID_wap_wsg_idm_ecid_wtls3 736 -#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L - -#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" -#define NID_wap_wsg_idm_ecid_wtls4 737 -#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L - -#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" -#define NID_wap_wsg_idm_ecid_wtls5 738 -#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L - -#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" -#define NID_wap_wsg_idm_ecid_wtls6 739 -#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L - -#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" -#define NID_wap_wsg_idm_ecid_wtls7 740 -#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L - -#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" -#define NID_wap_wsg_idm_ecid_wtls8 741 -#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L - -#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" -#define NID_wap_wsg_idm_ecid_wtls9 742 -#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L - -#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" -#define NID_wap_wsg_idm_ecid_wtls10 743 -#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L - -#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" -#define NID_wap_wsg_idm_ecid_wtls11 744 -#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L - -#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" -#define NID_wap_wsg_idm_ecid_wtls12 745 -#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L - -#define SN_cast5_cbc "CAST5-CBC" -#define LN_cast5_cbc "cast5-cbc" -#define NID_cast5_cbc 108 -#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L - -#define SN_cast5_ecb "CAST5-ECB" -#define LN_cast5_ecb "cast5-ecb" -#define NID_cast5_ecb 109 - -#define SN_cast5_cfb64 "CAST5-CFB" -#define LN_cast5_cfb64 "cast5-cfb" -#define NID_cast5_cfb64 110 - -#define SN_cast5_ofb64 "CAST5-OFB" -#define LN_cast5_ofb64 "cast5-ofb" -#define NID_cast5_ofb64 111 - -#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" -#define NID_pbeWithMD5AndCast5_CBC 112 -#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L - -#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" -#define LN_id_PasswordBasedMAC "password based MAC" -#define NID_id_PasswordBasedMAC 782 -#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L - -#define SN_id_DHBasedMac "id-DHBasedMac" -#define LN_id_DHBasedMac "Diffie-Hellman based MAC" -#define NID_id_DHBasedMac 783 -#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L - -#define SN_rsadsi "rsadsi" -#define LN_rsadsi "RSA Data Security, Inc." -#define NID_rsadsi 1 -#define OBJ_rsadsi OBJ_ISO_US,113549L - -#define SN_pkcs "pkcs" -#define LN_pkcs "RSA Data Security, Inc. PKCS" -#define NID_pkcs 2 -#define OBJ_pkcs OBJ_rsadsi,1L - -#define SN_pkcs1 "pkcs1" -#define NID_pkcs1 186 -#define OBJ_pkcs1 OBJ_pkcs,1L - -#define LN_rsaEncryption "rsaEncryption" -#define NID_rsaEncryption 6 -#define OBJ_rsaEncryption OBJ_pkcs1,1L - -#define SN_md2WithRSAEncryption "RSA-MD2" -#define LN_md2WithRSAEncryption "md2WithRSAEncryption" -#define NID_md2WithRSAEncryption 7 -#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L - -#define SN_md4WithRSAEncryption "RSA-MD4" -#define LN_md4WithRSAEncryption "md4WithRSAEncryption" -#define NID_md4WithRSAEncryption 396 -#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L - -#define SN_md5WithRSAEncryption "RSA-MD5" -#define LN_md5WithRSAEncryption "md5WithRSAEncryption" -#define NID_md5WithRSAEncryption 8 -#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L - -#define SN_sha1WithRSAEncryption "RSA-SHA1" -#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" -#define NID_sha1WithRSAEncryption 65 -#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L - -#define SN_rsaesOaep "RSAES-OAEP" -#define LN_rsaesOaep "rsaesOaep" -#define NID_rsaesOaep 919 -#define OBJ_rsaesOaep OBJ_pkcs1,7L - -#define SN_mgf1 "MGF1" -#define LN_mgf1 "mgf1" -#define NID_mgf1 911 -#define OBJ_mgf1 OBJ_pkcs1,8L - -#define SN_pSpecified "PSPECIFIED" -#define LN_pSpecified "pSpecified" -#define NID_pSpecified 935 -#define OBJ_pSpecified OBJ_pkcs1,9L - -#define SN_rsassaPss "RSASSA-PSS" -#define LN_rsassaPss "rsassaPss" -#define NID_rsassaPss 912 -#define OBJ_rsassaPss OBJ_pkcs1,10L - -#define SN_sha256WithRSAEncryption "RSA-SHA256" -#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" -#define NID_sha256WithRSAEncryption 668 -#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L - -#define SN_sha384WithRSAEncryption "RSA-SHA384" -#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" -#define NID_sha384WithRSAEncryption 669 -#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L - -#define SN_sha512WithRSAEncryption "RSA-SHA512" -#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" -#define NID_sha512WithRSAEncryption 670 -#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L - -#define SN_sha224WithRSAEncryption "RSA-SHA224" -#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" -#define NID_sha224WithRSAEncryption 671 -#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L - -#define SN_sha512_224WithRSAEncryption "RSA-SHA512/224" -#define LN_sha512_224WithRSAEncryption "sha512-224WithRSAEncryption" -#define NID_sha512_224WithRSAEncryption 1145 -#define OBJ_sha512_224WithRSAEncryption OBJ_pkcs1,15L - -#define SN_sha512_256WithRSAEncryption "RSA-SHA512/256" -#define LN_sha512_256WithRSAEncryption "sha512-256WithRSAEncryption" -#define NID_sha512_256WithRSAEncryption 1146 -#define OBJ_sha512_256WithRSAEncryption OBJ_pkcs1,16L - -#define SN_pkcs3 "pkcs3" -#define NID_pkcs3 27 -#define OBJ_pkcs3 OBJ_pkcs,3L - -#define LN_dhKeyAgreement "dhKeyAgreement" -#define NID_dhKeyAgreement 28 -#define OBJ_dhKeyAgreement OBJ_pkcs3,1L - -#define SN_pkcs5 "pkcs5" -#define NID_pkcs5 187 -#define OBJ_pkcs5 OBJ_pkcs,5L - -#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" -#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" -#define NID_pbeWithMD2AndDES_CBC 9 -#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L - -#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" -#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" -#define NID_pbeWithMD5AndDES_CBC 10 -#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L - -#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" -#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" -#define NID_pbeWithMD2AndRC2_CBC 168 -#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L - -#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" -#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" -#define NID_pbeWithMD5AndRC2_CBC 169 -#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L - -#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" -#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" -#define NID_pbeWithSHA1AndDES_CBC 170 -#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L - -#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" -#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" -#define NID_pbeWithSHA1AndRC2_CBC 68 -#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L - -#define LN_id_pbkdf2 "PBKDF2" -#define NID_id_pbkdf2 69 -#define OBJ_id_pbkdf2 OBJ_pkcs5,12L - -#define LN_pbes2 "PBES2" -#define NID_pbes2 161 -#define OBJ_pbes2 OBJ_pkcs5,13L - -#define LN_pbmac1 "PBMAC1" -#define NID_pbmac1 162 -#define OBJ_pbmac1 OBJ_pkcs5,14L - -#define SN_pkcs7 "pkcs7" -#define NID_pkcs7 20 -#define OBJ_pkcs7 OBJ_pkcs,7L - -#define LN_pkcs7_data "pkcs7-data" -#define NID_pkcs7_data 21 -#define OBJ_pkcs7_data OBJ_pkcs7,1L - -#define LN_pkcs7_signed "pkcs7-signedData" -#define NID_pkcs7_signed 22 -#define OBJ_pkcs7_signed OBJ_pkcs7,2L - -#define LN_pkcs7_enveloped "pkcs7-envelopedData" -#define NID_pkcs7_enveloped 23 -#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L - -#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" -#define NID_pkcs7_signedAndEnveloped 24 -#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L - -#define LN_pkcs7_digest "pkcs7-digestData" -#define NID_pkcs7_digest 25 -#define OBJ_pkcs7_digest OBJ_pkcs7,5L - -#define LN_pkcs7_encrypted "pkcs7-encryptedData" -#define NID_pkcs7_encrypted 26 -#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L - -#define SN_pkcs9 "pkcs9" -#define NID_pkcs9 47 -#define OBJ_pkcs9 OBJ_pkcs,9L - -#define LN_pkcs9_emailAddress "emailAddress" -#define NID_pkcs9_emailAddress 48 -#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L - -#define LN_pkcs9_unstructuredName "unstructuredName" -#define NID_pkcs9_unstructuredName 49 -#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L - -#define LN_pkcs9_contentType "contentType" -#define NID_pkcs9_contentType 50 -#define OBJ_pkcs9_contentType OBJ_pkcs9,3L - -#define LN_pkcs9_messageDigest "messageDigest" -#define NID_pkcs9_messageDigest 51 -#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L - -#define LN_pkcs9_signingTime "signingTime" -#define NID_pkcs9_signingTime 52 -#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L - -#define LN_pkcs9_countersignature "countersignature" -#define NID_pkcs9_countersignature 53 -#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L - -#define LN_pkcs9_challengePassword "challengePassword" -#define NID_pkcs9_challengePassword 54 -#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L - -#define LN_pkcs9_unstructuredAddress "unstructuredAddress" -#define NID_pkcs9_unstructuredAddress 55 -#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L - -#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" -#define NID_pkcs9_extCertAttributes 56 -#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L - -#define SN_ext_req "extReq" -#define LN_ext_req "Extension Request" -#define NID_ext_req 172 -#define OBJ_ext_req OBJ_pkcs9,14L - -#define SN_SMIMECapabilities "SMIME-CAPS" -#define LN_SMIMECapabilities "S/MIME Capabilities" -#define NID_SMIMECapabilities 167 -#define OBJ_SMIMECapabilities OBJ_pkcs9,15L - -#define SN_SMIME "SMIME" -#define LN_SMIME "S/MIME" -#define NID_SMIME 188 -#define OBJ_SMIME OBJ_pkcs9,16L - -#define SN_id_smime_mod "id-smime-mod" -#define NID_id_smime_mod 189 -#define OBJ_id_smime_mod OBJ_SMIME,0L - -#define SN_id_smime_ct "id-smime-ct" -#define NID_id_smime_ct 190 -#define OBJ_id_smime_ct OBJ_SMIME,1L - -#define SN_id_smime_aa "id-smime-aa" -#define NID_id_smime_aa 191 -#define OBJ_id_smime_aa OBJ_SMIME,2L - -#define SN_id_smime_alg "id-smime-alg" -#define NID_id_smime_alg 192 -#define OBJ_id_smime_alg OBJ_SMIME,3L - -#define SN_id_smime_cd "id-smime-cd" -#define NID_id_smime_cd 193 -#define OBJ_id_smime_cd OBJ_SMIME,4L - -#define SN_id_smime_spq "id-smime-spq" -#define NID_id_smime_spq 194 -#define OBJ_id_smime_spq OBJ_SMIME,5L - -#define SN_id_smime_cti "id-smime-cti" -#define NID_id_smime_cti 195 -#define OBJ_id_smime_cti OBJ_SMIME,6L - -#define SN_id_smime_mod_cms "id-smime-mod-cms" -#define NID_id_smime_mod_cms 196 -#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L - -#define SN_id_smime_mod_ess "id-smime-mod-ess" -#define NID_id_smime_mod_ess 197 -#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L - -#define SN_id_smime_mod_oid "id-smime-mod-oid" -#define NID_id_smime_mod_oid 198 -#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L - -#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" -#define NID_id_smime_mod_msg_v3 199 -#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L - -#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" -#define NID_id_smime_mod_ets_eSignature_88 200 -#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L - -#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" -#define NID_id_smime_mod_ets_eSignature_97 201 -#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L - -#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" -#define NID_id_smime_mod_ets_eSigPolicy_88 202 -#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L - -#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" -#define NID_id_smime_mod_ets_eSigPolicy_97 203 -#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L - -#define SN_id_smime_ct_receipt "id-smime-ct-receipt" -#define NID_id_smime_ct_receipt 204 -#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L - -#define SN_id_smime_ct_authData "id-smime-ct-authData" -#define NID_id_smime_ct_authData 205 -#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L - -#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" -#define NID_id_smime_ct_publishCert 206 -#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L - -#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" -#define NID_id_smime_ct_TSTInfo 207 -#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L - -#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" -#define NID_id_smime_ct_TDTInfo 208 -#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L - -#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" -#define NID_id_smime_ct_contentInfo 209 -#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L - -#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" -#define NID_id_smime_ct_DVCSRequestData 210 -#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L - -#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" -#define NID_id_smime_ct_DVCSResponseData 211 -#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L - -#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" -#define NID_id_smime_ct_compressedData 786 -#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L - -#define SN_id_smime_ct_contentCollection "id-smime-ct-contentCollection" -#define NID_id_smime_ct_contentCollection 1058 -#define OBJ_id_smime_ct_contentCollection OBJ_id_smime_ct,19L - -#define SN_id_smime_ct_authEnvelopedData "id-smime-ct-authEnvelopedData" -#define NID_id_smime_ct_authEnvelopedData 1059 -#define OBJ_id_smime_ct_authEnvelopedData OBJ_id_smime_ct,23L - -#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" -#define NID_id_ct_asciiTextWithCRLF 787 -#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L - -#define SN_id_ct_xml "id-ct-xml" -#define NID_id_ct_xml 1060 -#define OBJ_id_ct_xml OBJ_id_smime_ct,28L - -#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" -#define NID_id_smime_aa_receiptRequest 212 -#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L - -#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" -#define NID_id_smime_aa_securityLabel 213 -#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L - -#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" -#define NID_id_smime_aa_mlExpandHistory 214 -#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L - -#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" -#define NID_id_smime_aa_contentHint 215 -#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L - -#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" -#define NID_id_smime_aa_msgSigDigest 216 -#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L - -#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" -#define NID_id_smime_aa_encapContentType 217 -#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L - -#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" -#define NID_id_smime_aa_contentIdentifier 218 -#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L - -#define SN_id_smime_aa_macValue "id-smime-aa-macValue" -#define NID_id_smime_aa_macValue 219 -#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L - -#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" -#define NID_id_smime_aa_equivalentLabels 220 -#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L - -#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" -#define NID_id_smime_aa_contentReference 221 -#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L - -#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" -#define NID_id_smime_aa_encrypKeyPref 222 -#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L - -#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" -#define NID_id_smime_aa_signingCertificate 223 -#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L - -#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" -#define NID_id_smime_aa_smimeEncryptCerts 224 -#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L - -#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" -#define NID_id_smime_aa_timeStampToken 225 -#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L - -#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" -#define NID_id_smime_aa_ets_sigPolicyId 226 -#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L - -#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" -#define NID_id_smime_aa_ets_commitmentType 227 -#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L - -#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" -#define NID_id_smime_aa_ets_signerLocation 228 -#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L - -#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" -#define NID_id_smime_aa_ets_signerAttr 229 -#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L - -#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" -#define NID_id_smime_aa_ets_otherSigCert 230 -#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L - -#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" -#define NID_id_smime_aa_ets_contentTimestamp 231 -#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L - -#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" -#define NID_id_smime_aa_ets_CertificateRefs 232 -#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L - -#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" -#define NID_id_smime_aa_ets_RevocationRefs 233 -#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L - -#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" -#define NID_id_smime_aa_ets_certValues 234 -#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L - -#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" -#define NID_id_smime_aa_ets_revocationValues 235 -#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L - -#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" -#define NID_id_smime_aa_ets_escTimeStamp 236 -#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L - -#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" -#define NID_id_smime_aa_ets_certCRLTimestamp 237 -#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L - -#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" -#define NID_id_smime_aa_ets_archiveTimeStamp 238 -#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L - -#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" -#define NID_id_smime_aa_signatureType 239 -#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L - -#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" -#define NID_id_smime_aa_dvcs_dvc 240 -#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L - -#define SN_id_smime_aa_signingCertificateV2 "id-smime-aa-signingCertificateV2" -#define NID_id_smime_aa_signingCertificateV2 1086 -#define OBJ_id_smime_aa_signingCertificateV2 OBJ_id_smime_aa,47L - -#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" -#define NID_id_smime_alg_ESDHwith3DES 241 -#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L - -#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" -#define NID_id_smime_alg_ESDHwithRC2 242 -#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L - -#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" -#define NID_id_smime_alg_3DESwrap 243 -#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L - -#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" -#define NID_id_smime_alg_RC2wrap 244 -#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L - -#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" -#define NID_id_smime_alg_ESDH 245 -#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L - -#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" -#define NID_id_smime_alg_CMS3DESwrap 246 -#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L - -#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" -#define NID_id_smime_alg_CMSRC2wrap 247 -#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L - -#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" -#define NID_id_alg_PWRI_KEK 893 -#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L - -#define SN_id_smime_cd_ldap "id-smime-cd-ldap" -#define NID_id_smime_cd_ldap 248 -#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L - -#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" -#define NID_id_smime_spq_ets_sqt_uri 249 -#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L - -#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" -#define NID_id_smime_spq_ets_sqt_unotice 250 -#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L - -#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" -#define NID_id_smime_cti_ets_proofOfOrigin 251 -#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L - -#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" -#define NID_id_smime_cti_ets_proofOfReceipt 252 -#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L - -#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" -#define NID_id_smime_cti_ets_proofOfDelivery 253 -#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L - -#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" -#define NID_id_smime_cti_ets_proofOfSender 254 -#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L - -#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" -#define NID_id_smime_cti_ets_proofOfApproval 255 -#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L - -#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" -#define NID_id_smime_cti_ets_proofOfCreation 256 -#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L - -#define LN_friendlyName "friendlyName" -#define NID_friendlyName 156 -#define OBJ_friendlyName OBJ_pkcs9,20L - -#define LN_localKeyID "localKeyID" -#define NID_localKeyID 157 -#define OBJ_localKeyID OBJ_pkcs9,21L - -#define SN_ms_csp_name "CSPName" -#define LN_ms_csp_name "Microsoft CSP Name" -#define NID_ms_csp_name 417 -#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L - -#define SN_LocalKeySet "LocalKeySet" -#define LN_LocalKeySet "Microsoft Local Key set" -#define NID_LocalKeySet 856 -#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L - -#define OBJ_certTypes OBJ_pkcs9,22L - -#define LN_x509Certificate "x509Certificate" -#define NID_x509Certificate 158 -#define OBJ_x509Certificate OBJ_certTypes,1L - -#define LN_sdsiCertificate "sdsiCertificate" -#define NID_sdsiCertificate 159 -#define OBJ_sdsiCertificate OBJ_certTypes,2L - -#define OBJ_crlTypes OBJ_pkcs9,23L - -#define LN_x509Crl "x509Crl" -#define NID_x509Crl 160 -#define OBJ_x509Crl OBJ_crlTypes,1L - -#define OBJ_pkcs12 OBJ_pkcs,12L - -#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L - -#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" -#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" -#define NID_pbe_WithSHA1And128BitRC4 144 -#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L - -#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" -#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" -#define NID_pbe_WithSHA1And40BitRC4 145 -#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L - -#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" -#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 -#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L - -#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" -#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 -#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L - -#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" -#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" -#define NID_pbe_WithSHA1And128BitRC2_CBC 148 -#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L - -#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" -#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" -#define NID_pbe_WithSHA1And40BitRC2_CBC 149 -#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L - -#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L - -#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L - -#define LN_keyBag "keyBag" -#define NID_keyBag 150 -#define OBJ_keyBag OBJ_pkcs12_BagIds,1L - -#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" -#define NID_pkcs8ShroudedKeyBag 151 -#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L - -#define LN_certBag "certBag" -#define NID_certBag 152 -#define OBJ_certBag OBJ_pkcs12_BagIds,3L - -#define LN_crlBag "crlBag" -#define NID_crlBag 153 -#define OBJ_crlBag OBJ_pkcs12_BagIds,4L - -#define LN_secretBag "secretBag" -#define NID_secretBag 154 -#define OBJ_secretBag OBJ_pkcs12_BagIds,5L - -#define LN_safeContentsBag "safeContentsBag" -#define NID_safeContentsBag 155 -#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L - -#define SN_md2 "MD2" -#define LN_md2 "md2" -#define NID_md2 3 -#define OBJ_md2 OBJ_rsadsi,2L,2L - -#define SN_md4 "MD4" -#define LN_md4 "md4" -#define NID_md4 257 -#define OBJ_md4 OBJ_rsadsi,2L,4L - -#define SN_md5 "MD5" -#define LN_md5 "md5" -#define NID_md5 4 -#define OBJ_md5 OBJ_rsadsi,2L,5L - -#define SN_md5_sha1 "MD5-SHA1" -#define LN_md5_sha1 "md5-sha1" -#define NID_md5_sha1 114 - -#define LN_hmacWithMD5 "hmacWithMD5" -#define NID_hmacWithMD5 797 -#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L - -#define LN_hmacWithSHA1 "hmacWithSHA1" -#define NID_hmacWithSHA1 163 -#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L - -#define SN_sm2 "SM2" -#define LN_sm2 "sm2" -#define NID_sm2 1172 -#define OBJ_sm2 OBJ_sm_scheme,301L - -#define SN_sm3 "SM3" -#define LN_sm3 "sm3" -#define NID_sm3 1143 -#define OBJ_sm3 OBJ_sm_scheme,401L - -#define SN_sm3WithRSAEncryption "RSA-SM3" -#define LN_sm3WithRSAEncryption "sm3WithRSAEncryption" -#define NID_sm3WithRSAEncryption 1144 -#define OBJ_sm3WithRSAEncryption OBJ_sm_scheme,504L - -#define LN_hmacWithSHA224 "hmacWithSHA224" -#define NID_hmacWithSHA224 798 -#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L - -#define LN_hmacWithSHA256 "hmacWithSHA256" -#define NID_hmacWithSHA256 799 -#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L - -#define LN_hmacWithSHA384 "hmacWithSHA384" -#define NID_hmacWithSHA384 800 -#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L - -#define LN_hmacWithSHA512 "hmacWithSHA512" -#define NID_hmacWithSHA512 801 -#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L - -#define LN_hmacWithSHA512_224 "hmacWithSHA512-224" -#define NID_hmacWithSHA512_224 1193 -#define OBJ_hmacWithSHA512_224 OBJ_rsadsi,2L,12L - -#define LN_hmacWithSHA512_256 "hmacWithSHA512-256" -#define NID_hmacWithSHA512_256 1194 -#define OBJ_hmacWithSHA512_256 OBJ_rsadsi,2L,13L - -#define SN_rc2_cbc "RC2-CBC" -#define LN_rc2_cbc "rc2-cbc" -#define NID_rc2_cbc 37 -#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L - -#define SN_rc2_ecb "RC2-ECB" -#define LN_rc2_ecb "rc2-ecb" -#define NID_rc2_ecb 38 - -#define SN_rc2_cfb64 "RC2-CFB" -#define LN_rc2_cfb64 "rc2-cfb" -#define NID_rc2_cfb64 39 - -#define SN_rc2_ofb64 "RC2-OFB" -#define LN_rc2_ofb64 "rc2-ofb" -#define NID_rc2_ofb64 40 - -#define SN_rc2_40_cbc "RC2-40-CBC" -#define LN_rc2_40_cbc "rc2-40-cbc" -#define NID_rc2_40_cbc 98 - -#define SN_rc2_64_cbc "RC2-64-CBC" -#define LN_rc2_64_cbc "rc2-64-cbc" -#define NID_rc2_64_cbc 166 - -#define SN_rc4 "RC4" -#define LN_rc4 "rc4" -#define NID_rc4 5 -#define OBJ_rc4 OBJ_rsadsi,3L,4L - -#define SN_rc4_40 "RC4-40" -#define LN_rc4_40 "rc4-40" -#define NID_rc4_40 97 - -#define SN_des_ede3_cbc "DES-EDE3-CBC" -#define LN_des_ede3_cbc "des-ede3-cbc" -#define NID_des_ede3_cbc 44 -#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L - -#define SN_rc5_cbc "RC5-CBC" -#define LN_rc5_cbc "rc5-cbc" -#define NID_rc5_cbc 120 -#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L - -#define SN_rc5_ecb "RC5-ECB" -#define LN_rc5_ecb "rc5-ecb" -#define NID_rc5_ecb 121 - -#define SN_rc5_cfb64 "RC5-CFB" -#define LN_rc5_cfb64 "rc5-cfb" -#define NID_rc5_cfb64 122 - -#define SN_rc5_ofb64 "RC5-OFB" -#define LN_rc5_ofb64 "rc5-ofb" -#define NID_rc5_ofb64 123 - -#define SN_ms_ext_req "msExtReq" -#define LN_ms_ext_req "Microsoft Extension Request" -#define NID_ms_ext_req 171 -#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L - -#define SN_ms_code_ind "msCodeInd" -#define LN_ms_code_ind "Microsoft Individual Code Signing" -#define NID_ms_code_ind 134 -#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L - -#define SN_ms_code_com "msCodeCom" -#define LN_ms_code_com "Microsoft Commercial Code Signing" -#define NID_ms_code_com 135 -#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L - -#define SN_ms_ctl_sign "msCTLSign" -#define LN_ms_ctl_sign "Microsoft Trust List Signing" -#define NID_ms_ctl_sign 136 -#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L - -#define SN_ms_sgc "msSGC" -#define LN_ms_sgc "Microsoft Server Gated Crypto" -#define NID_ms_sgc 137 -#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L - -#define SN_ms_efs "msEFS" -#define LN_ms_efs "Microsoft Encrypted File System" -#define NID_ms_efs 138 -#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L - -#define SN_ms_smartcard_login "msSmartcardLogin" -#define LN_ms_smartcard_login "Microsoft Smartcard Login" -#define NID_ms_smartcard_login 648 -#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L - -#define SN_ms_upn "msUPN" -#define LN_ms_upn "Microsoft User Principal Name" -#define NID_ms_upn 649 -#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L - -#define SN_idea_cbc "IDEA-CBC" -#define LN_idea_cbc "idea-cbc" -#define NID_idea_cbc 34 -#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L - -#define SN_idea_ecb "IDEA-ECB" -#define LN_idea_ecb "idea-ecb" -#define NID_idea_ecb 36 - -#define SN_idea_cfb64 "IDEA-CFB" -#define LN_idea_cfb64 "idea-cfb" -#define NID_idea_cfb64 35 - -#define SN_idea_ofb64 "IDEA-OFB" -#define LN_idea_ofb64 "idea-ofb" -#define NID_idea_ofb64 46 - -#define SN_bf_cbc "BF-CBC" -#define LN_bf_cbc "bf-cbc" -#define NID_bf_cbc 91 -#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L - -#define SN_bf_ecb "BF-ECB" -#define LN_bf_ecb "bf-ecb" -#define NID_bf_ecb 92 - -#define SN_bf_cfb64 "BF-CFB" -#define LN_bf_cfb64 "bf-cfb" -#define NID_bf_cfb64 93 - -#define SN_bf_ofb64 "BF-OFB" -#define LN_bf_ofb64 "bf-ofb" -#define NID_bf_ofb64 94 - -#define SN_id_pkix "PKIX" -#define NID_id_pkix 127 -#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L - -#define SN_id_pkix_mod "id-pkix-mod" -#define NID_id_pkix_mod 258 -#define OBJ_id_pkix_mod OBJ_id_pkix,0L - -#define SN_id_pe "id-pe" -#define NID_id_pe 175 -#define OBJ_id_pe OBJ_id_pkix,1L - -#define SN_id_qt "id-qt" -#define NID_id_qt 259 -#define OBJ_id_qt OBJ_id_pkix,2L - -#define SN_id_kp "id-kp" -#define NID_id_kp 128 -#define OBJ_id_kp OBJ_id_pkix,3L - -#define SN_id_it "id-it" -#define NID_id_it 260 -#define OBJ_id_it OBJ_id_pkix,4L - -#define SN_id_pkip "id-pkip" -#define NID_id_pkip 261 -#define OBJ_id_pkip OBJ_id_pkix,5L - -#define SN_id_alg "id-alg" -#define NID_id_alg 262 -#define OBJ_id_alg OBJ_id_pkix,6L - -#define SN_id_cmc "id-cmc" -#define NID_id_cmc 263 -#define OBJ_id_cmc OBJ_id_pkix,7L - -#define SN_id_on "id-on" -#define NID_id_on 264 -#define OBJ_id_on OBJ_id_pkix,8L - -#define SN_id_pda "id-pda" -#define NID_id_pda 265 -#define OBJ_id_pda OBJ_id_pkix,9L - -#define SN_id_aca "id-aca" -#define NID_id_aca 266 -#define OBJ_id_aca OBJ_id_pkix,10L - -#define SN_id_qcs "id-qcs" -#define NID_id_qcs 267 -#define OBJ_id_qcs OBJ_id_pkix,11L - -#define SN_id_cct "id-cct" -#define NID_id_cct 268 -#define OBJ_id_cct OBJ_id_pkix,12L - -#define SN_id_ppl "id-ppl" -#define NID_id_ppl 662 -#define OBJ_id_ppl OBJ_id_pkix,21L - -#define SN_id_ad "id-ad" -#define NID_id_ad 176 -#define OBJ_id_ad OBJ_id_pkix,48L - -#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" -#define NID_id_pkix1_explicit_88 269 -#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L - -#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" -#define NID_id_pkix1_implicit_88 270 -#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L - -#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" -#define NID_id_pkix1_explicit_93 271 -#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L - -#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" -#define NID_id_pkix1_implicit_93 272 -#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L - -#define SN_id_mod_crmf "id-mod-crmf" -#define NID_id_mod_crmf 273 -#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L - -#define SN_id_mod_cmc "id-mod-cmc" -#define NID_id_mod_cmc 274 -#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L - -#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" -#define NID_id_mod_kea_profile_88 275 -#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L - -#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" -#define NID_id_mod_kea_profile_93 276 -#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L - -#define SN_id_mod_cmp "id-mod-cmp" -#define NID_id_mod_cmp 277 -#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L - -#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" -#define NID_id_mod_qualified_cert_88 278 -#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L - -#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" -#define NID_id_mod_qualified_cert_93 279 -#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L - -#define SN_id_mod_attribute_cert "id-mod-attribute-cert" -#define NID_id_mod_attribute_cert 280 -#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L - -#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" -#define NID_id_mod_timestamp_protocol 281 -#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L - -#define SN_id_mod_ocsp "id-mod-ocsp" -#define NID_id_mod_ocsp 282 -#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L - -#define SN_id_mod_dvcs "id-mod-dvcs" -#define NID_id_mod_dvcs 283 -#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L - -#define SN_id_mod_cmp2000 "id-mod-cmp2000" -#define NID_id_mod_cmp2000 284 -#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L - -#define SN_info_access "authorityInfoAccess" -#define LN_info_access "Authority Information Access" -#define NID_info_access 177 -#define OBJ_info_access OBJ_id_pe,1L - -#define SN_biometricInfo "biometricInfo" -#define LN_biometricInfo "Biometric Info" -#define NID_biometricInfo 285 -#define OBJ_biometricInfo OBJ_id_pe,2L - -#define SN_qcStatements "qcStatements" -#define NID_qcStatements 286 -#define OBJ_qcStatements OBJ_id_pe,3L - -#define SN_ac_auditEntity "ac-auditEntity" -#define NID_ac_auditEntity 287 -#define OBJ_ac_auditEntity OBJ_id_pe,4L - -#define SN_ac_targeting "ac-targeting" -#define NID_ac_targeting 288 -#define OBJ_ac_targeting OBJ_id_pe,5L - -#define SN_aaControls "aaControls" -#define NID_aaControls 289 -#define OBJ_aaControls OBJ_id_pe,6L - -#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" -#define NID_sbgp_ipAddrBlock 290 -#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L - -#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" -#define NID_sbgp_autonomousSysNum 291 -#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L - -#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" -#define NID_sbgp_routerIdentifier 292 -#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L - -#define SN_ac_proxying "ac-proxying" -#define NID_ac_proxying 397 -#define OBJ_ac_proxying OBJ_id_pe,10L - -#define SN_sinfo_access "subjectInfoAccess" -#define LN_sinfo_access "Subject Information Access" -#define NID_sinfo_access 398 -#define OBJ_sinfo_access OBJ_id_pe,11L - -#define SN_proxyCertInfo "proxyCertInfo" -#define LN_proxyCertInfo "Proxy Certificate Information" -#define NID_proxyCertInfo 663 -#define OBJ_proxyCertInfo OBJ_id_pe,14L - -#define SN_tlsfeature "tlsfeature" -#define LN_tlsfeature "TLS Feature" -#define NID_tlsfeature 1020 -#define OBJ_tlsfeature OBJ_id_pe,24L - -#define SN_id_qt_cps "id-qt-cps" -#define LN_id_qt_cps "Policy Qualifier CPS" -#define NID_id_qt_cps 164 -#define OBJ_id_qt_cps OBJ_id_qt,1L - -#define SN_id_qt_unotice "id-qt-unotice" -#define LN_id_qt_unotice "Policy Qualifier User Notice" -#define NID_id_qt_unotice 165 -#define OBJ_id_qt_unotice OBJ_id_qt,2L - -#define SN_textNotice "textNotice" -#define NID_textNotice 293 -#define OBJ_textNotice OBJ_id_qt,3L - -#define SN_server_auth "serverAuth" -#define LN_server_auth "TLS Web Server Authentication" -#define NID_server_auth 129 -#define OBJ_server_auth OBJ_id_kp,1L - -#define SN_client_auth "clientAuth" -#define LN_client_auth "TLS Web Client Authentication" -#define NID_client_auth 130 -#define OBJ_client_auth OBJ_id_kp,2L - -#define SN_code_sign "codeSigning" -#define LN_code_sign "Code Signing" -#define NID_code_sign 131 -#define OBJ_code_sign OBJ_id_kp,3L - -#define SN_email_protect "emailProtection" -#define LN_email_protect "E-mail Protection" -#define NID_email_protect 132 -#define OBJ_email_protect OBJ_id_kp,4L - -#define SN_ipsecEndSystem "ipsecEndSystem" -#define LN_ipsecEndSystem "IPSec End System" -#define NID_ipsecEndSystem 294 -#define OBJ_ipsecEndSystem OBJ_id_kp,5L - -#define SN_ipsecTunnel "ipsecTunnel" -#define LN_ipsecTunnel "IPSec Tunnel" -#define NID_ipsecTunnel 295 -#define OBJ_ipsecTunnel OBJ_id_kp,6L - -#define SN_ipsecUser "ipsecUser" -#define LN_ipsecUser "IPSec User" -#define NID_ipsecUser 296 -#define OBJ_ipsecUser OBJ_id_kp,7L - -#define SN_time_stamp "timeStamping" -#define LN_time_stamp "Time Stamping" -#define NID_time_stamp 133 -#define OBJ_time_stamp OBJ_id_kp,8L - -#define SN_OCSP_sign "OCSPSigning" -#define LN_OCSP_sign "OCSP Signing" -#define NID_OCSP_sign 180 -#define OBJ_OCSP_sign OBJ_id_kp,9L - -#define SN_dvcs "DVCS" -#define LN_dvcs "dvcs" -#define NID_dvcs 297 -#define OBJ_dvcs OBJ_id_kp,10L - -#define SN_ipsec_IKE "ipsecIKE" -#define LN_ipsec_IKE "ipsec Internet Key Exchange" -#define NID_ipsec_IKE 1022 -#define OBJ_ipsec_IKE OBJ_id_kp,17L - -#define SN_capwapAC "capwapAC" -#define LN_capwapAC "Ctrl/provision WAP Access" -#define NID_capwapAC 1023 -#define OBJ_capwapAC OBJ_id_kp,18L - -#define SN_capwapWTP "capwapWTP" -#define LN_capwapWTP "Ctrl/Provision WAP Termination" -#define NID_capwapWTP 1024 -#define OBJ_capwapWTP OBJ_id_kp,19L - -#define SN_sshClient "secureShellClient" -#define LN_sshClient "SSH Client" -#define NID_sshClient 1025 -#define OBJ_sshClient OBJ_id_kp,21L - -#define SN_sshServer "secureShellServer" -#define LN_sshServer "SSH Server" -#define NID_sshServer 1026 -#define OBJ_sshServer OBJ_id_kp,22L - -#define SN_sendRouter "sendRouter" -#define LN_sendRouter "Send Router" -#define NID_sendRouter 1027 -#define OBJ_sendRouter OBJ_id_kp,23L - -#define SN_sendProxiedRouter "sendProxiedRouter" -#define LN_sendProxiedRouter "Send Proxied Router" -#define NID_sendProxiedRouter 1028 -#define OBJ_sendProxiedRouter OBJ_id_kp,24L - -#define SN_sendOwner "sendOwner" -#define LN_sendOwner "Send Owner" -#define NID_sendOwner 1029 -#define OBJ_sendOwner OBJ_id_kp,25L - -#define SN_sendProxiedOwner "sendProxiedOwner" -#define LN_sendProxiedOwner "Send Proxied Owner" -#define NID_sendProxiedOwner 1030 -#define OBJ_sendProxiedOwner OBJ_id_kp,26L - -#define SN_cmcCA "cmcCA" -#define LN_cmcCA "CMC Certificate Authority" -#define NID_cmcCA 1131 -#define OBJ_cmcCA OBJ_id_kp,27L - -#define SN_cmcRA "cmcRA" -#define LN_cmcRA "CMC Registration Authority" -#define NID_cmcRA 1132 -#define OBJ_cmcRA OBJ_id_kp,28L - -#define SN_id_it_caProtEncCert "id-it-caProtEncCert" -#define NID_id_it_caProtEncCert 298 -#define OBJ_id_it_caProtEncCert OBJ_id_it,1L - -#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" -#define NID_id_it_signKeyPairTypes 299 -#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L - -#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" -#define NID_id_it_encKeyPairTypes 300 -#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L - -#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" -#define NID_id_it_preferredSymmAlg 301 -#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L - -#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" -#define NID_id_it_caKeyUpdateInfo 302 -#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L - -#define SN_id_it_currentCRL "id-it-currentCRL" -#define NID_id_it_currentCRL 303 -#define OBJ_id_it_currentCRL OBJ_id_it,6L - -#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" -#define NID_id_it_unsupportedOIDs 304 -#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L - -#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" -#define NID_id_it_subscriptionRequest 305 -#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L - -#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" -#define NID_id_it_subscriptionResponse 306 -#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L - -#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" -#define NID_id_it_keyPairParamReq 307 -#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L - -#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" -#define NID_id_it_keyPairParamRep 308 -#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L - -#define SN_id_it_revPassphrase "id-it-revPassphrase" -#define NID_id_it_revPassphrase 309 -#define OBJ_id_it_revPassphrase OBJ_id_it,12L - -#define SN_id_it_implicitConfirm "id-it-implicitConfirm" -#define NID_id_it_implicitConfirm 310 -#define OBJ_id_it_implicitConfirm OBJ_id_it,13L - -#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" -#define NID_id_it_confirmWaitTime 311 -#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L - -#define SN_id_it_origPKIMessage "id-it-origPKIMessage" -#define NID_id_it_origPKIMessage 312 -#define OBJ_id_it_origPKIMessage OBJ_id_it,15L - -#define SN_id_it_suppLangTags "id-it-suppLangTags" -#define NID_id_it_suppLangTags 784 -#define OBJ_id_it_suppLangTags OBJ_id_it,16L - -#define SN_id_regCtrl "id-regCtrl" -#define NID_id_regCtrl 313 -#define OBJ_id_regCtrl OBJ_id_pkip,1L - -#define SN_id_regInfo "id-regInfo" -#define NID_id_regInfo 314 -#define OBJ_id_regInfo OBJ_id_pkip,2L - -#define SN_id_regCtrl_regToken "id-regCtrl-regToken" -#define NID_id_regCtrl_regToken 315 -#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L - -#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" -#define NID_id_regCtrl_authenticator 316 -#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L - -#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" -#define NID_id_regCtrl_pkiPublicationInfo 317 -#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L - -#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" -#define NID_id_regCtrl_pkiArchiveOptions 318 -#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L - -#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" -#define NID_id_regCtrl_oldCertID 319 -#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L - -#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" -#define NID_id_regCtrl_protocolEncrKey 320 -#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L - -#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" -#define NID_id_regInfo_utf8Pairs 321 -#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L - -#define SN_id_regInfo_certReq "id-regInfo-certReq" -#define NID_id_regInfo_certReq 322 -#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L - -#define SN_id_alg_des40 "id-alg-des40" -#define NID_id_alg_des40 323 -#define OBJ_id_alg_des40 OBJ_id_alg,1L - -#define SN_id_alg_noSignature "id-alg-noSignature" -#define NID_id_alg_noSignature 324 -#define OBJ_id_alg_noSignature OBJ_id_alg,2L - -#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" -#define NID_id_alg_dh_sig_hmac_sha1 325 -#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L - -#define SN_id_alg_dh_pop "id-alg-dh-pop" -#define NID_id_alg_dh_pop 326 -#define OBJ_id_alg_dh_pop OBJ_id_alg,4L - -#define SN_id_cmc_statusInfo "id-cmc-statusInfo" -#define NID_id_cmc_statusInfo 327 -#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L - -#define SN_id_cmc_identification "id-cmc-identification" -#define NID_id_cmc_identification 328 -#define OBJ_id_cmc_identification OBJ_id_cmc,2L - -#define SN_id_cmc_identityProof "id-cmc-identityProof" -#define NID_id_cmc_identityProof 329 -#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L - -#define SN_id_cmc_dataReturn "id-cmc-dataReturn" -#define NID_id_cmc_dataReturn 330 -#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L - -#define SN_id_cmc_transactionId "id-cmc-transactionId" -#define NID_id_cmc_transactionId 331 -#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L - -#define SN_id_cmc_senderNonce "id-cmc-senderNonce" -#define NID_id_cmc_senderNonce 332 -#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L - -#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" -#define NID_id_cmc_recipientNonce 333 -#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L - -#define SN_id_cmc_addExtensions "id-cmc-addExtensions" -#define NID_id_cmc_addExtensions 334 -#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L - -#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" -#define NID_id_cmc_encryptedPOP 335 -#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L - -#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" -#define NID_id_cmc_decryptedPOP 336 -#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L - -#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" -#define NID_id_cmc_lraPOPWitness 337 -#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L - -#define SN_id_cmc_getCert "id-cmc-getCert" -#define NID_id_cmc_getCert 338 -#define OBJ_id_cmc_getCert OBJ_id_cmc,15L - -#define SN_id_cmc_getCRL "id-cmc-getCRL" -#define NID_id_cmc_getCRL 339 -#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L - -#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" -#define NID_id_cmc_revokeRequest 340 -#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L - -#define SN_id_cmc_regInfo "id-cmc-regInfo" -#define NID_id_cmc_regInfo 341 -#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L - -#define SN_id_cmc_responseInfo "id-cmc-responseInfo" -#define NID_id_cmc_responseInfo 342 -#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L - -#define SN_id_cmc_queryPending "id-cmc-queryPending" -#define NID_id_cmc_queryPending 343 -#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L - -#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" -#define NID_id_cmc_popLinkRandom 344 -#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L - -#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" -#define NID_id_cmc_popLinkWitness 345 -#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L - -#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" -#define NID_id_cmc_confirmCertAcceptance 346 -#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L - -#define SN_id_on_personalData "id-on-personalData" -#define NID_id_on_personalData 347 -#define OBJ_id_on_personalData OBJ_id_on,1L - -#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" -#define LN_id_on_permanentIdentifier "Permanent Identifier" -#define NID_id_on_permanentIdentifier 858 -#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L - -#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" -#define NID_id_pda_dateOfBirth 348 -#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L - -#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" -#define NID_id_pda_placeOfBirth 349 -#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L - -#define SN_id_pda_gender "id-pda-gender" -#define NID_id_pda_gender 351 -#define OBJ_id_pda_gender OBJ_id_pda,3L - -#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" -#define NID_id_pda_countryOfCitizenship 352 -#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L - -#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" -#define NID_id_pda_countryOfResidence 353 -#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L - -#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" -#define NID_id_aca_authenticationInfo 354 -#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L - -#define SN_id_aca_accessIdentity "id-aca-accessIdentity" -#define NID_id_aca_accessIdentity 355 -#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L - -#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" -#define NID_id_aca_chargingIdentity 356 -#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L - -#define SN_id_aca_group "id-aca-group" -#define NID_id_aca_group 357 -#define OBJ_id_aca_group OBJ_id_aca,4L - -#define SN_id_aca_role "id-aca-role" -#define NID_id_aca_role 358 -#define OBJ_id_aca_role OBJ_id_aca,5L - -#define SN_id_aca_encAttrs "id-aca-encAttrs" -#define NID_id_aca_encAttrs 399 -#define OBJ_id_aca_encAttrs OBJ_id_aca,6L - -#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" -#define NID_id_qcs_pkixQCSyntax_v1 359 -#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L - -#define SN_id_cct_crs "id-cct-crs" -#define NID_id_cct_crs 360 -#define OBJ_id_cct_crs OBJ_id_cct,1L - -#define SN_id_cct_PKIData "id-cct-PKIData" -#define NID_id_cct_PKIData 361 -#define OBJ_id_cct_PKIData OBJ_id_cct,2L - -#define SN_id_cct_PKIResponse "id-cct-PKIResponse" -#define NID_id_cct_PKIResponse 362 -#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L - -#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" -#define LN_id_ppl_anyLanguage "Any language" -#define NID_id_ppl_anyLanguage 664 -#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L - -#define SN_id_ppl_inheritAll "id-ppl-inheritAll" -#define LN_id_ppl_inheritAll "Inherit all" -#define NID_id_ppl_inheritAll 665 -#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L - -#define SN_Independent "id-ppl-independent" -#define LN_Independent "Independent" -#define NID_Independent 667 -#define OBJ_Independent OBJ_id_ppl,2L - -#define SN_ad_OCSP "OCSP" -#define LN_ad_OCSP "OCSP" -#define NID_ad_OCSP 178 -#define OBJ_ad_OCSP OBJ_id_ad,1L - -#define SN_ad_ca_issuers "caIssuers" -#define LN_ad_ca_issuers "CA Issuers" -#define NID_ad_ca_issuers 179 -#define OBJ_ad_ca_issuers OBJ_id_ad,2L - -#define SN_ad_timeStamping "ad_timestamping" -#define LN_ad_timeStamping "AD Time Stamping" -#define NID_ad_timeStamping 363 -#define OBJ_ad_timeStamping OBJ_id_ad,3L - -#define SN_ad_dvcs "AD_DVCS" -#define LN_ad_dvcs "ad dvcs" -#define NID_ad_dvcs 364 -#define OBJ_ad_dvcs OBJ_id_ad,4L - -#define SN_caRepository "caRepository" -#define LN_caRepository "CA Repository" -#define NID_caRepository 785 -#define OBJ_caRepository OBJ_id_ad,5L - -#define OBJ_id_pkix_OCSP OBJ_ad_OCSP - -#define SN_id_pkix_OCSP_basic "basicOCSPResponse" -#define LN_id_pkix_OCSP_basic "Basic OCSP Response" -#define NID_id_pkix_OCSP_basic 365 -#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L - -#define SN_id_pkix_OCSP_Nonce "Nonce" -#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" -#define NID_id_pkix_OCSP_Nonce 366 -#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L - -#define SN_id_pkix_OCSP_CrlID "CrlID" -#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" -#define NID_id_pkix_OCSP_CrlID 367 -#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L - -#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" -#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" -#define NID_id_pkix_OCSP_acceptableResponses 368 -#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L - -#define SN_id_pkix_OCSP_noCheck "noCheck" -#define LN_id_pkix_OCSP_noCheck "OCSP No Check" -#define NID_id_pkix_OCSP_noCheck 369 -#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L - -#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" -#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" -#define NID_id_pkix_OCSP_archiveCutoff 370 -#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L - -#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" -#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" -#define NID_id_pkix_OCSP_serviceLocator 371 -#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L - -#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" -#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" -#define NID_id_pkix_OCSP_extendedStatus 372 -#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L - -#define SN_id_pkix_OCSP_valid "valid" -#define NID_id_pkix_OCSP_valid 373 -#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L - -#define SN_id_pkix_OCSP_path "path" -#define NID_id_pkix_OCSP_path 374 -#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L - -#define SN_id_pkix_OCSP_trustRoot "trustRoot" -#define LN_id_pkix_OCSP_trustRoot "Trust Root" -#define NID_id_pkix_OCSP_trustRoot 375 -#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L - -#define SN_algorithm "algorithm" -#define LN_algorithm "algorithm" -#define NID_algorithm 376 -#define OBJ_algorithm 1L,3L,14L,3L,2L - -#define SN_md5WithRSA "RSA-NP-MD5" -#define LN_md5WithRSA "md5WithRSA" -#define NID_md5WithRSA 104 -#define OBJ_md5WithRSA OBJ_algorithm,3L - -#define SN_des_ecb "DES-ECB" -#define LN_des_ecb "des-ecb" -#define NID_des_ecb 29 -#define OBJ_des_ecb OBJ_algorithm,6L - -#define SN_des_cbc "DES-CBC" -#define LN_des_cbc "des-cbc" -#define NID_des_cbc 31 -#define OBJ_des_cbc OBJ_algorithm,7L - -#define SN_des_ofb64 "DES-OFB" -#define LN_des_ofb64 "des-ofb" -#define NID_des_ofb64 45 -#define OBJ_des_ofb64 OBJ_algorithm,8L - -#define SN_des_cfb64 "DES-CFB" -#define LN_des_cfb64 "des-cfb" -#define NID_des_cfb64 30 -#define OBJ_des_cfb64 OBJ_algorithm,9L - -#define SN_rsaSignature "rsaSignature" -#define NID_rsaSignature 377 -#define OBJ_rsaSignature OBJ_algorithm,11L - -#define SN_dsa_2 "DSA-old" -#define LN_dsa_2 "dsaEncryption-old" -#define NID_dsa_2 67 -#define OBJ_dsa_2 OBJ_algorithm,12L - -#define SN_dsaWithSHA "DSA-SHA" -#define LN_dsaWithSHA "dsaWithSHA" -#define NID_dsaWithSHA 66 -#define OBJ_dsaWithSHA OBJ_algorithm,13L - -#define SN_shaWithRSAEncryption "RSA-SHA" -#define LN_shaWithRSAEncryption "shaWithRSAEncryption" -#define NID_shaWithRSAEncryption 42 -#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L - -#define SN_des_ede_ecb "DES-EDE" -#define LN_des_ede_ecb "des-ede" -#define NID_des_ede_ecb 32 -#define OBJ_des_ede_ecb OBJ_algorithm,17L - -#define SN_des_ede3_ecb "DES-EDE3" -#define LN_des_ede3_ecb "des-ede3" -#define NID_des_ede3_ecb 33 - -#define SN_des_ede_cbc "DES-EDE-CBC" -#define LN_des_ede_cbc "des-ede-cbc" -#define NID_des_ede_cbc 43 - -#define SN_des_ede_cfb64 "DES-EDE-CFB" -#define LN_des_ede_cfb64 "des-ede-cfb" -#define NID_des_ede_cfb64 60 - -#define SN_des_ede3_cfb64 "DES-EDE3-CFB" -#define LN_des_ede3_cfb64 "des-ede3-cfb" -#define NID_des_ede3_cfb64 61 - -#define SN_des_ede_ofb64 "DES-EDE-OFB" -#define LN_des_ede_ofb64 "des-ede-ofb" -#define NID_des_ede_ofb64 62 - -#define SN_des_ede3_ofb64 "DES-EDE3-OFB" -#define LN_des_ede3_ofb64 "des-ede3-ofb" -#define NID_des_ede3_ofb64 63 - -#define SN_desx_cbc "DESX-CBC" -#define LN_desx_cbc "desx-cbc" -#define NID_desx_cbc 80 - -#define SN_sha "SHA" -#define LN_sha "sha" -#define NID_sha 41 -#define OBJ_sha OBJ_algorithm,18L - -#define SN_sha1 "SHA1" -#define LN_sha1 "sha1" -#define NID_sha1 64 -#define OBJ_sha1 OBJ_algorithm,26L - -#define SN_dsaWithSHA1_2 "DSA-SHA1-old" -#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" -#define NID_dsaWithSHA1_2 70 -#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L - -#define SN_sha1WithRSA "RSA-SHA1-2" -#define LN_sha1WithRSA "sha1WithRSA" -#define NID_sha1WithRSA 115 -#define OBJ_sha1WithRSA OBJ_algorithm,29L - -#define SN_ripemd160 "RIPEMD160" -#define LN_ripemd160 "ripemd160" -#define NID_ripemd160 117 -#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L - -#define SN_ripemd160WithRSA "RSA-RIPEMD160" -#define LN_ripemd160WithRSA "ripemd160WithRSA" -#define NID_ripemd160WithRSA 119 -#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L - -#define SN_blake2b512 "BLAKE2b512" -#define LN_blake2b512 "blake2b512" -#define NID_blake2b512 1056 -#define OBJ_blake2b512 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L,16L - -#define SN_blake2s256 "BLAKE2s256" -#define LN_blake2s256 "blake2s256" -#define NID_blake2s256 1057 -#define OBJ_blake2s256 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L,8L - -#define SN_sxnet "SXNetID" -#define LN_sxnet "Strong Extranet ID" -#define NID_sxnet 143 -#define OBJ_sxnet 1L,3L,101L,1L,4L,1L - -#define SN_X500 "X500" -#define LN_X500 "directory services (X.500)" -#define NID_X500 11 -#define OBJ_X500 2L,5L - -#define SN_X509 "X509" -#define NID_X509 12 -#define OBJ_X509 OBJ_X500,4L - -#define SN_commonName "CN" -#define LN_commonName "commonName" -#define NID_commonName 13 -#define OBJ_commonName OBJ_X509,3L - -#define SN_surname "SN" -#define LN_surname "surname" -#define NID_surname 100 -#define OBJ_surname OBJ_X509,4L - -#define LN_serialNumber "serialNumber" -#define NID_serialNumber 105 -#define OBJ_serialNumber OBJ_X509,5L - -#define SN_countryName "C" -#define LN_countryName "countryName" -#define NID_countryName 14 -#define OBJ_countryName OBJ_X509,6L - -#define SN_localityName "L" -#define LN_localityName "localityName" -#define NID_localityName 15 -#define OBJ_localityName OBJ_X509,7L - -#define SN_stateOrProvinceName "ST" -#define LN_stateOrProvinceName "stateOrProvinceName" -#define NID_stateOrProvinceName 16 -#define OBJ_stateOrProvinceName OBJ_X509,8L - -#define SN_streetAddress "street" -#define LN_streetAddress "streetAddress" -#define NID_streetAddress 660 -#define OBJ_streetAddress OBJ_X509,9L - -#define SN_organizationName "O" -#define LN_organizationName "organizationName" -#define NID_organizationName 17 -#define OBJ_organizationName OBJ_X509,10L - -#define SN_organizationalUnitName "OU" -#define LN_organizationalUnitName "organizationalUnitName" -#define NID_organizationalUnitName 18 -#define OBJ_organizationalUnitName OBJ_X509,11L - -#define SN_title "title" -#define LN_title "title" -#define NID_title 106 -#define OBJ_title OBJ_X509,12L - -#define LN_description "description" -#define NID_description 107 -#define OBJ_description OBJ_X509,13L - -#define LN_searchGuide "searchGuide" -#define NID_searchGuide 859 -#define OBJ_searchGuide OBJ_X509,14L - -#define LN_businessCategory "businessCategory" -#define NID_businessCategory 860 -#define OBJ_businessCategory OBJ_X509,15L - -#define LN_postalAddress "postalAddress" -#define NID_postalAddress 861 -#define OBJ_postalAddress OBJ_X509,16L - -#define LN_postalCode "postalCode" -#define NID_postalCode 661 -#define OBJ_postalCode OBJ_X509,17L - -#define LN_postOfficeBox "postOfficeBox" -#define NID_postOfficeBox 862 -#define OBJ_postOfficeBox OBJ_X509,18L - -#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" -#define NID_physicalDeliveryOfficeName 863 -#define OBJ_physicalDeliveryOfficeName OBJ_X509,19L - -#define LN_telephoneNumber "telephoneNumber" -#define NID_telephoneNumber 864 -#define OBJ_telephoneNumber OBJ_X509,20L - -#define LN_telexNumber "telexNumber" -#define NID_telexNumber 865 -#define OBJ_telexNumber OBJ_X509,21L - -#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" -#define NID_teletexTerminalIdentifier 866 -#define OBJ_teletexTerminalIdentifier OBJ_X509,22L - -#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" -#define NID_facsimileTelephoneNumber 867 -#define OBJ_facsimileTelephoneNumber OBJ_X509,23L - -#define LN_x121Address "x121Address" -#define NID_x121Address 868 -#define OBJ_x121Address OBJ_X509,24L - -#define LN_internationaliSDNNumber "internationaliSDNNumber" -#define NID_internationaliSDNNumber 869 -#define OBJ_internationaliSDNNumber OBJ_X509,25L - -#define LN_registeredAddress "registeredAddress" -#define NID_registeredAddress 870 -#define OBJ_registeredAddress OBJ_X509,26L - -#define LN_destinationIndicator "destinationIndicator" -#define NID_destinationIndicator 871 -#define OBJ_destinationIndicator OBJ_X509,27L - -#define LN_preferredDeliveryMethod "preferredDeliveryMethod" -#define NID_preferredDeliveryMethod 872 -#define OBJ_preferredDeliveryMethod OBJ_X509,28L - -#define LN_presentationAddress "presentationAddress" -#define NID_presentationAddress 873 -#define OBJ_presentationAddress OBJ_X509,29L - -#define LN_supportedApplicationContext "supportedApplicationContext" -#define NID_supportedApplicationContext 874 -#define OBJ_supportedApplicationContext OBJ_X509,30L - -#define SN_member "member" -#define NID_member 875 -#define OBJ_member OBJ_X509,31L - -#define SN_owner "owner" -#define NID_owner 876 -#define OBJ_owner OBJ_X509,32L - -#define LN_roleOccupant "roleOccupant" -#define NID_roleOccupant 877 -#define OBJ_roleOccupant OBJ_X509,33L - -#define SN_seeAlso "seeAlso" -#define NID_seeAlso 878 -#define OBJ_seeAlso OBJ_X509,34L - -#define LN_userPassword "userPassword" -#define NID_userPassword 879 -#define OBJ_userPassword OBJ_X509,35L - -#define LN_userCertificate "userCertificate" -#define NID_userCertificate 880 -#define OBJ_userCertificate OBJ_X509,36L - -#define LN_cACertificate "cACertificate" -#define NID_cACertificate 881 -#define OBJ_cACertificate OBJ_X509,37L - -#define LN_authorityRevocationList "authorityRevocationList" -#define NID_authorityRevocationList 882 -#define OBJ_authorityRevocationList OBJ_X509,38L - -#define LN_certificateRevocationList "certificateRevocationList" -#define NID_certificateRevocationList 883 -#define OBJ_certificateRevocationList OBJ_X509,39L - -#define LN_crossCertificatePair "crossCertificatePair" -#define NID_crossCertificatePair 884 -#define OBJ_crossCertificatePair OBJ_X509,40L - -#define SN_name "name" -#define LN_name "name" -#define NID_name 173 -#define OBJ_name OBJ_X509,41L - -#define SN_givenName "GN" -#define LN_givenName "givenName" -#define NID_givenName 99 -#define OBJ_givenName OBJ_X509,42L - -#define SN_initials "initials" -#define LN_initials "initials" -#define NID_initials 101 -#define OBJ_initials OBJ_X509,43L - -#define LN_generationQualifier "generationQualifier" -#define NID_generationQualifier 509 -#define OBJ_generationQualifier OBJ_X509,44L - -#define LN_x500UniqueIdentifier "x500UniqueIdentifier" -#define NID_x500UniqueIdentifier 503 -#define OBJ_x500UniqueIdentifier OBJ_X509,45L - -#define SN_dnQualifier "dnQualifier" -#define LN_dnQualifier "dnQualifier" -#define NID_dnQualifier 174 -#define OBJ_dnQualifier OBJ_X509,46L - -#define LN_enhancedSearchGuide "enhancedSearchGuide" -#define NID_enhancedSearchGuide 885 -#define OBJ_enhancedSearchGuide OBJ_X509,47L - -#define LN_protocolInformation "protocolInformation" -#define NID_protocolInformation 886 -#define OBJ_protocolInformation OBJ_X509,48L - -#define LN_distinguishedName "distinguishedName" -#define NID_distinguishedName 887 -#define OBJ_distinguishedName OBJ_X509,49L - -#define LN_uniqueMember "uniqueMember" -#define NID_uniqueMember 888 -#define OBJ_uniqueMember OBJ_X509,50L - -#define LN_houseIdentifier "houseIdentifier" -#define NID_houseIdentifier 889 -#define OBJ_houseIdentifier OBJ_X509,51L - -#define LN_supportedAlgorithms "supportedAlgorithms" -#define NID_supportedAlgorithms 890 -#define OBJ_supportedAlgorithms OBJ_X509,52L - -#define LN_deltaRevocationList "deltaRevocationList" -#define NID_deltaRevocationList 891 -#define OBJ_deltaRevocationList OBJ_X509,53L - -#define SN_dmdName "dmdName" -#define NID_dmdName 892 -#define OBJ_dmdName OBJ_X509,54L - -#define LN_pseudonym "pseudonym" -#define NID_pseudonym 510 -#define OBJ_pseudonym OBJ_X509,65L - -#define SN_role "role" -#define LN_role "role" -#define NID_role 400 -#define OBJ_role OBJ_X509,72L - -#define LN_organizationIdentifier "organizationIdentifier" -#define NID_organizationIdentifier 1089 -#define OBJ_organizationIdentifier OBJ_X509,97L - -#define SN_countryCode3c "c3" -#define LN_countryCode3c "countryCode3c" -#define NID_countryCode3c 1090 -#define OBJ_countryCode3c OBJ_X509,98L - -#define SN_countryCode3n "n3" -#define LN_countryCode3n "countryCode3n" -#define NID_countryCode3n 1091 -#define OBJ_countryCode3n OBJ_X509,99L - -#define LN_dnsName "dnsName" -#define NID_dnsName 1092 -#define OBJ_dnsName OBJ_X509,100L - -#define SN_X500algorithms "X500algorithms" -#define LN_X500algorithms "directory services - algorithms" -#define NID_X500algorithms 378 -#define OBJ_X500algorithms OBJ_X500,8L - -#define SN_rsa "RSA" -#define LN_rsa "rsa" -#define NID_rsa 19 -#define OBJ_rsa OBJ_X500algorithms,1L,1L - -#define SN_mdc2WithRSA "RSA-MDC2" -#define LN_mdc2WithRSA "mdc2WithRSA" -#define NID_mdc2WithRSA 96 -#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L - -#define SN_mdc2 "MDC2" -#define LN_mdc2 "mdc2" -#define NID_mdc2 95 -#define OBJ_mdc2 OBJ_X500algorithms,3L,101L - -#define SN_id_ce "id-ce" -#define NID_id_ce 81 -#define OBJ_id_ce OBJ_X500,29L - -#define SN_subject_directory_attributes "subjectDirectoryAttributes" -#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" -#define NID_subject_directory_attributes 769 -#define OBJ_subject_directory_attributes OBJ_id_ce,9L - -#define SN_subject_key_identifier "subjectKeyIdentifier" -#define LN_subject_key_identifier "X509v3 Subject Key Identifier" -#define NID_subject_key_identifier 82 -#define OBJ_subject_key_identifier OBJ_id_ce,14L - -#define SN_key_usage "keyUsage" -#define LN_key_usage "X509v3 Key Usage" -#define NID_key_usage 83 -#define OBJ_key_usage OBJ_id_ce,15L - -#define SN_private_key_usage_period "privateKeyUsagePeriod" -#define LN_private_key_usage_period "X509v3 Private Key Usage Period" -#define NID_private_key_usage_period 84 -#define OBJ_private_key_usage_period OBJ_id_ce,16L - -#define SN_subject_alt_name "subjectAltName" -#define LN_subject_alt_name "X509v3 Subject Alternative Name" -#define NID_subject_alt_name 85 -#define OBJ_subject_alt_name OBJ_id_ce,17L - -#define SN_issuer_alt_name "issuerAltName" -#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" -#define NID_issuer_alt_name 86 -#define OBJ_issuer_alt_name OBJ_id_ce,18L - -#define SN_basic_constraints "basicConstraints" -#define LN_basic_constraints "X509v3 Basic Constraints" -#define NID_basic_constraints 87 -#define OBJ_basic_constraints OBJ_id_ce,19L - -#define SN_crl_number "crlNumber" -#define LN_crl_number "X509v3 CRL Number" -#define NID_crl_number 88 -#define OBJ_crl_number OBJ_id_ce,20L - -#define SN_crl_reason "CRLReason" -#define LN_crl_reason "X509v3 CRL Reason Code" -#define NID_crl_reason 141 -#define OBJ_crl_reason OBJ_id_ce,21L - -#define SN_invalidity_date "invalidityDate" -#define LN_invalidity_date "Invalidity Date" -#define NID_invalidity_date 142 -#define OBJ_invalidity_date OBJ_id_ce,24L - -#define SN_delta_crl "deltaCRL" -#define LN_delta_crl "X509v3 Delta CRL Indicator" -#define NID_delta_crl 140 -#define OBJ_delta_crl OBJ_id_ce,27L - -#define SN_issuing_distribution_point "issuingDistributionPoint" -#define LN_issuing_distribution_point "X509v3 Issuing Distribution Point" -#define NID_issuing_distribution_point 770 -#define OBJ_issuing_distribution_point OBJ_id_ce,28L - -#define SN_certificate_issuer "certificateIssuer" -#define LN_certificate_issuer "X509v3 Certificate Issuer" -#define NID_certificate_issuer 771 -#define OBJ_certificate_issuer OBJ_id_ce,29L - -#define SN_name_constraints "nameConstraints" -#define LN_name_constraints "X509v3 Name Constraints" -#define NID_name_constraints 666 -#define OBJ_name_constraints OBJ_id_ce,30L - -#define SN_crl_distribution_points "crlDistributionPoints" -#define LN_crl_distribution_points "X509v3 CRL Distribution Points" -#define NID_crl_distribution_points 103 -#define OBJ_crl_distribution_points OBJ_id_ce,31L - -#define SN_certificate_policies "certificatePolicies" -#define LN_certificate_policies "X509v3 Certificate Policies" -#define NID_certificate_policies 89 -#define OBJ_certificate_policies OBJ_id_ce,32L - -#define SN_any_policy "anyPolicy" -#define LN_any_policy "X509v3 Any Policy" -#define NID_any_policy 746 -#define OBJ_any_policy OBJ_certificate_policies,0L - -#define SN_policy_mappings "policyMappings" -#define LN_policy_mappings "X509v3 Policy Mappings" -#define NID_policy_mappings 747 -#define OBJ_policy_mappings OBJ_id_ce,33L - -#define SN_authority_key_identifier "authorityKeyIdentifier" -#define LN_authority_key_identifier "X509v3 Authority Key Identifier" -#define NID_authority_key_identifier 90 -#define OBJ_authority_key_identifier OBJ_id_ce,35L - -#define SN_policy_constraints "policyConstraints" -#define LN_policy_constraints "X509v3 Policy Constraints" -#define NID_policy_constraints 401 -#define OBJ_policy_constraints OBJ_id_ce,36L - -#define SN_ext_key_usage "extendedKeyUsage" -#define LN_ext_key_usage "X509v3 Extended Key Usage" -#define NID_ext_key_usage 126 -#define OBJ_ext_key_usage OBJ_id_ce,37L - -#define SN_freshest_crl "freshestCRL" -#define LN_freshest_crl "X509v3 Freshest CRL" -#define NID_freshest_crl 857 -#define OBJ_freshest_crl OBJ_id_ce,46L - -#define SN_inhibit_any_policy "inhibitAnyPolicy" -#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" -#define NID_inhibit_any_policy 748 -#define OBJ_inhibit_any_policy OBJ_id_ce,54L - -#define SN_target_information "targetInformation" -#define LN_target_information "X509v3 AC Targeting" -#define NID_target_information 402 -#define OBJ_target_information OBJ_id_ce,55L - -#define SN_no_rev_avail "noRevAvail" -#define LN_no_rev_avail "X509v3 No Revocation Available" -#define NID_no_rev_avail 403 -#define OBJ_no_rev_avail OBJ_id_ce,56L - -#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" -#define LN_anyExtendedKeyUsage "Any Extended Key Usage" -#define NID_anyExtendedKeyUsage 910 -#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L - -#define SN_netscape "Netscape" -#define LN_netscape "Netscape Communications Corp." -#define NID_netscape 57 -#define OBJ_netscape 2L,16L,840L,1L,113730L - -#define SN_netscape_cert_extension "nsCertExt" -#define LN_netscape_cert_extension "Netscape Certificate Extension" -#define NID_netscape_cert_extension 58 -#define OBJ_netscape_cert_extension OBJ_netscape,1L - -#define SN_netscape_data_type "nsDataType" -#define LN_netscape_data_type "Netscape Data Type" -#define NID_netscape_data_type 59 -#define OBJ_netscape_data_type OBJ_netscape,2L - -#define SN_netscape_cert_type "nsCertType" -#define LN_netscape_cert_type "Netscape Cert Type" -#define NID_netscape_cert_type 71 -#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L - -#define SN_netscape_base_url "nsBaseUrl" -#define LN_netscape_base_url "Netscape Base Url" -#define NID_netscape_base_url 72 -#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L - -#define SN_netscape_revocation_url "nsRevocationUrl" -#define LN_netscape_revocation_url "Netscape Revocation Url" -#define NID_netscape_revocation_url 73 -#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L - -#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" -#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" -#define NID_netscape_ca_revocation_url 74 -#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L - -#define SN_netscape_renewal_url "nsRenewalUrl" -#define LN_netscape_renewal_url "Netscape Renewal Url" -#define NID_netscape_renewal_url 75 -#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L - -#define SN_netscape_ca_policy_url "nsCaPolicyUrl" -#define LN_netscape_ca_policy_url "Netscape CA Policy Url" -#define NID_netscape_ca_policy_url 76 -#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L - -#define SN_netscape_ssl_server_name "nsSslServerName" -#define LN_netscape_ssl_server_name "Netscape SSL Server Name" -#define NID_netscape_ssl_server_name 77 -#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L - -#define SN_netscape_comment "nsComment" -#define LN_netscape_comment "Netscape Comment" -#define NID_netscape_comment 78 -#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L - -#define SN_netscape_cert_sequence "nsCertSequence" -#define LN_netscape_cert_sequence "Netscape Certificate Sequence" -#define NID_netscape_cert_sequence 79 -#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L - -#define SN_ns_sgc "nsSGC" -#define LN_ns_sgc "Netscape Server Gated Crypto" -#define NID_ns_sgc 139 -#define OBJ_ns_sgc OBJ_netscape,4L,1L - -#define SN_org "ORG" -#define LN_org "org" -#define NID_org 379 -#define OBJ_org OBJ_iso,3L - -#define SN_dod "DOD" -#define LN_dod "dod" -#define NID_dod 380 -#define OBJ_dod OBJ_org,6L - -#define SN_iana "IANA" -#define LN_iana "iana" -#define NID_iana 381 -#define OBJ_iana OBJ_dod,1L - -#define OBJ_internet OBJ_iana - -#define SN_Directory "directory" -#define LN_Directory "Directory" -#define NID_Directory 382 -#define OBJ_Directory OBJ_internet,1L - -#define SN_Management "mgmt" -#define LN_Management "Management" -#define NID_Management 383 -#define OBJ_Management OBJ_internet,2L - -#define SN_Experimental "experimental" -#define LN_Experimental "Experimental" -#define NID_Experimental 384 -#define OBJ_Experimental OBJ_internet,3L - -#define SN_Private "private" -#define LN_Private "Private" -#define NID_Private 385 -#define OBJ_Private OBJ_internet,4L - -#define SN_Security "security" -#define LN_Security "Security" -#define NID_Security 386 -#define OBJ_Security OBJ_internet,5L - -#define SN_SNMPv2 "snmpv2" -#define LN_SNMPv2 "SNMPv2" -#define NID_SNMPv2 387 -#define OBJ_SNMPv2 OBJ_internet,6L - -#define LN_Mail "Mail" -#define NID_Mail 388 -#define OBJ_Mail OBJ_internet,7L - -#define SN_Enterprises "enterprises" -#define LN_Enterprises "Enterprises" -#define NID_Enterprises 389 -#define OBJ_Enterprises OBJ_Private,1L - -#define SN_dcObject "dcobject" -#define LN_dcObject "dcObject" -#define NID_dcObject 390 -#define OBJ_dcObject OBJ_Enterprises,1466L,344L - -#define SN_mime_mhs "mime-mhs" -#define LN_mime_mhs "MIME MHS" -#define NID_mime_mhs 504 -#define OBJ_mime_mhs OBJ_Mail,1L - -#define SN_mime_mhs_headings "mime-mhs-headings" -#define LN_mime_mhs_headings "mime-mhs-headings" -#define NID_mime_mhs_headings 505 -#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L - -#define SN_mime_mhs_bodies "mime-mhs-bodies" -#define LN_mime_mhs_bodies "mime-mhs-bodies" -#define NID_mime_mhs_bodies 506 -#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L - -#define SN_id_hex_partial_message "id-hex-partial-message" -#define LN_id_hex_partial_message "id-hex-partial-message" -#define NID_id_hex_partial_message 507 -#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L - -#define SN_id_hex_multipart_message "id-hex-multipart-message" -#define LN_id_hex_multipart_message "id-hex-multipart-message" -#define NID_id_hex_multipart_message 508 -#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L - -#define SN_zlib_compression "ZLIB" -#define LN_zlib_compression "zlib compression" -#define NID_zlib_compression 125 -#define OBJ_zlib_compression OBJ_id_smime_alg,8L - -#define OBJ_csor 2L,16L,840L,1L,101L,3L - -#define OBJ_nistAlgorithms OBJ_csor,4L - -#define OBJ_aes OBJ_nistAlgorithms,1L - -#define SN_aes_128_ecb "AES-128-ECB" -#define LN_aes_128_ecb "aes-128-ecb" -#define NID_aes_128_ecb 418 -#define OBJ_aes_128_ecb OBJ_aes,1L - -#define SN_aes_128_cbc "AES-128-CBC" -#define LN_aes_128_cbc "aes-128-cbc" -#define NID_aes_128_cbc 419 -#define OBJ_aes_128_cbc OBJ_aes,2L - -#define SN_aes_128_ofb128 "AES-128-OFB" -#define LN_aes_128_ofb128 "aes-128-ofb" -#define NID_aes_128_ofb128 420 -#define OBJ_aes_128_ofb128 OBJ_aes,3L - -#define SN_aes_128_cfb128 "AES-128-CFB" -#define LN_aes_128_cfb128 "aes-128-cfb" -#define NID_aes_128_cfb128 421 -#define OBJ_aes_128_cfb128 OBJ_aes,4L - -#define SN_id_aes128_wrap "id-aes128-wrap" -#define NID_id_aes128_wrap 788 -#define OBJ_id_aes128_wrap OBJ_aes,5L - -#define SN_aes_128_gcm "id-aes128-GCM" -#define LN_aes_128_gcm "aes-128-gcm" -#define NID_aes_128_gcm 895 -#define OBJ_aes_128_gcm OBJ_aes,6L - -#define SN_aes_128_ccm "id-aes128-CCM" -#define LN_aes_128_ccm "aes-128-ccm" -#define NID_aes_128_ccm 896 -#define OBJ_aes_128_ccm OBJ_aes,7L - -#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" -#define NID_id_aes128_wrap_pad 897 -#define OBJ_id_aes128_wrap_pad OBJ_aes,8L - -#define SN_aes_192_ecb "AES-192-ECB" -#define LN_aes_192_ecb "aes-192-ecb" -#define NID_aes_192_ecb 422 -#define OBJ_aes_192_ecb OBJ_aes,21L - -#define SN_aes_192_cbc "AES-192-CBC" -#define LN_aes_192_cbc "aes-192-cbc" -#define NID_aes_192_cbc 423 -#define OBJ_aes_192_cbc OBJ_aes,22L - -#define SN_aes_192_ofb128 "AES-192-OFB" -#define LN_aes_192_ofb128 "aes-192-ofb" -#define NID_aes_192_ofb128 424 -#define OBJ_aes_192_ofb128 OBJ_aes,23L - -#define SN_aes_192_cfb128 "AES-192-CFB" -#define LN_aes_192_cfb128 "aes-192-cfb" -#define NID_aes_192_cfb128 425 -#define OBJ_aes_192_cfb128 OBJ_aes,24L - -#define SN_id_aes192_wrap "id-aes192-wrap" -#define NID_id_aes192_wrap 789 -#define OBJ_id_aes192_wrap OBJ_aes,25L - -#define SN_aes_192_gcm "id-aes192-GCM" -#define LN_aes_192_gcm "aes-192-gcm" -#define NID_aes_192_gcm 898 -#define OBJ_aes_192_gcm OBJ_aes,26L - -#define SN_aes_192_ccm "id-aes192-CCM" -#define LN_aes_192_ccm "aes-192-ccm" -#define NID_aes_192_ccm 899 -#define OBJ_aes_192_ccm OBJ_aes,27L - -#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" -#define NID_id_aes192_wrap_pad 900 -#define OBJ_id_aes192_wrap_pad OBJ_aes,28L - -#define SN_aes_256_ecb "AES-256-ECB" -#define LN_aes_256_ecb "aes-256-ecb" -#define NID_aes_256_ecb 426 -#define OBJ_aes_256_ecb OBJ_aes,41L - -#define SN_aes_256_cbc "AES-256-CBC" -#define LN_aes_256_cbc "aes-256-cbc" -#define NID_aes_256_cbc 427 -#define OBJ_aes_256_cbc OBJ_aes,42L - -#define SN_aes_256_ofb128 "AES-256-OFB" -#define LN_aes_256_ofb128 "aes-256-ofb" -#define NID_aes_256_ofb128 428 -#define OBJ_aes_256_ofb128 OBJ_aes,43L - -#define SN_aes_256_cfb128 "AES-256-CFB" -#define LN_aes_256_cfb128 "aes-256-cfb" -#define NID_aes_256_cfb128 429 -#define OBJ_aes_256_cfb128 OBJ_aes,44L - -#define SN_id_aes256_wrap "id-aes256-wrap" -#define NID_id_aes256_wrap 790 -#define OBJ_id_aes256_wrap OBJ_aes,45L - -#define SN_aes_256_gcm "id-aes256-GCM" -#define LN_aes_256_gcm "aes-256-gcm" -#define NID_aes_256_gcm 901 -#define OBJ_aes_256_gcm OBJ_aes,46L - -#define SN_aes_256_ccm "id-aes256-CCM" -#define LN_aes_256_ccm "aes-256-ccm" -#define NID_aes_256_ccm 902 -#define OBJ_aes_256_ccm OBJ_aes,47L - -#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" -#define NID_id_aes256_wrap_pad 903 -#define OBJ_id_aes256_wrap_pad OBJ_aes,48L - -#define SN_aes_128_xts "AES-128-XTS" -#define LN_aes_128_xts "aes-128-xts" -#define NID_aes_128_xts 913 -#define OBJ_aes_128_xts OBJ_ieee_siswg,0L,1L,1L - -#define SN_aes_256_xts "AES-256-XTS" -#define LN_aes_256_xts "aes-256-xts" -#define NID_aes_256_xts 914 -#define OBJ_aes_256_xts OBJ_ieee_siswg,0L,1L,2L - -#define SN_aes_128_cfb1 "AES-128-CFB1" -#define LN_aes_128_cfb1 "aes-128-cfb1" -#define NID_aes_128_cfb1 650 - -#define SN_aes_192_cfb1 "AES-192-CFB1" -#define LN_aes_192_cfb1 "aes-192-cfb1" -#define NID_aes_192_cfb1 651 - -#define SN_aes_256_cfb1 "AES-256-CFB1" -#define LN_aes_256_cfb1 "aes-256-cfb1" -#define NID_aes_256_cfb1 652 - -#define SN_aes_128_cfb8 "AES-128-CFB8" -#define LN_aes_128_cfb8 "aes-128-cfb8" -#define NID_aes_128_cfb8 653 - -#define SN_aes_192_cfb8 "AES-192-CFB8" -#define LN_aes_192_cfb8 "aes-192-cfb8" -#define NID_aes_192_cfb8 654 - -#define SN_aes_256_cfb8 "AES-256-CFB8" -#define LN_aes_256_cfb8 "aes-256-cfb8" -#define NID_aes_256_cfb8 655 - -#define SN_aes_128_ctr "AES-128-CTR" -#define LN_aes_128_ctr "aes-128-ctr" -#define NID_aes_128_ctr 904 - -#define SN_aes_192_ctr "AES-192-CTR" -#define LN_aes_192_ctr "aes-192-ctr" -#define NID_aes_192_ctr 905 - -#define SN_aes_256_ctr "AES-256-CTR" -#define LN_aes_256_ctr "aes-256-ctr" -#define NID_aes_256_ctr 906 - -#define SN_aes_128_ocb "AES-128-OCB" -#define LN_aes_128_ocb "aes-128-ocb" -#define NID_aes_128_ocb 958 - -#define SN_aes_192_ocb "AES-192-OCB" -#define LN_aes_192_ocb "aes-192-ocb" -#define NID_aes_192_ocb 959 - -#define SN_aes_256_ocb "AES-256-OCB" -#define LN_aes_256_ocb "aes-256-ocb" -#define NID_aes_256_ocb 960 - -#define SN_des_cfb1 "DES-CFB1" -#define LN_des_cfb1 "des-cfb1" -#define NID_des_cfb1 656 - -#define SN_des_cfb8 "DES-CFB8" -#define LN_des_cfb8 "des-cfb8" -#define NID_des_cfb8 657 - -#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" -#define LN_des_ede3_cfb1 "des-ede3-cfb1" -#define NID_des_ede3_cfb1 658 - -#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" -#define LN_des_ede3_cfb8 "des-ede3-cfb8" -#define NID_des_ede3_cfb8 659 - -#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L - -#define SN_sha256 "SHA256" -#define LN_sha256 "sha256" -#define NID_sha256 672 -#define OBJ_sha256 OBJ_nist_hashalgs,1L - -#define SN_sha384 "SHA384" -#define LN_sha384 "sha384" -#define NID_sha384 673 -#define OBJ_sha384 OBJ_nist_hashalgs,2L - -#define SN_sha512 "SHA512" -#define LN_sha512 "sha512" -#define NID_sha512 674 -#define OBJ_sha512 OBJ_nist_hashalgs,3L - -#define SN_sha224 "SHA224" -#define LN_sha224 "sha224" -#define NID_sha224 675 -#define OBJ_sha224 OBJ_nist_hashalgs,4L - -#define SN_sha512_224 "SHA512-224" -#define LN_sha512_224 "sha512-224" -#define NID_sha512_224 1094 -#define OBJ_sha512_224 OBJ_nist_hashalgs,5L - -#define SN_sha512_256 "SHA512-256" -#define LN_sha512_256 "sha512-256" -#define NID_sha512_256 1095 -#define OBJ_sha512_256 OBJ_nist_hashalgs,6L - -#define SN_sha3_224 "SHA3-224" -#define LN_sha3_224 "sha3-224" -#define NID_sha3_224 1096 -#define OBJ_sha3_224 OBJ_nist_hashalgs,7L - -#define SN_sha3_256 "SHA3-256" -#define LN_sha3_256 "sha3-256" -#define NID_sha3_256 1097 -#define OBJ_sha3_256 OBJ_nist_hashalgs,8L - -#define SN_sha3_384 "SHA3-384" -#define LN_sha3_384 "sha3-384" -#define NID_sha3_384 1098 -#define OBJ_sha3_384 OBJ_nist_hashalgs,9L - -#define SN_sha3_512 "SHA3-512" -#define LN_sha3_512 "sha3-512" -#define NID_sha3_512 1099 -#define OBJ_sha3_512 OBJ_nist_hashalgs,10L - -#define SN_shake128 "SHAKE128" -#define LN_shake128 "shake128" -#define NID_shake128 1100 -#define OBJ_shake128 OBJ_nist_hashalgs,11L - -#define SN_shake256 "SHAKE256" -#define LN_shake256 "shake256" -#define NID_shake256 1101 -#define OBJ_shake256 OBJ_nist_hashalgs,12L - -#define SN_hmac_sha3_224 "id-hmacWithSHA3-224" -#define LN_hmac_sha3_224 "hmac-sha3-224" -#define NID_hmac_sha3_224 1102 -#define OBJ_hmac_sha3_224 OBJ_nist_hashalgs,13L - -#define SN_hmac_sha3_256 "id-hmacWithSHA3-256" -#define LN_hmac_sha3_256 "hmac-sha3-256" -#define NID_hmac_sha3_256 1103 -#define OBJ_hmac_sha3_256 OBJ_nist_hashalgs,14L - -#define SN_hmac_sha3_384 "id-hmacWithSHA3-384" -#define LN_hmac_sha3_384 "hmac-sha3-384" -#define NID_hmac_sha3_384 1104 -#define OBJ_hmac_sha3_384 OBJ_nist_hashalgs,15L - -#define SN_hmac_sha3_512 "id-hmacWithSHA3-512" -#define LN_hmac_sha3_512 "hmac-sha3-512" -#define NID_hmac_sha3_512 1105 -#define OBJ_hmac_sha3_512 OBJ_nist_hashalgs,16L - -#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L - -#define SN_dsa_with_SHA224 "dsa_with_SHA224" -#define NID_dsa_with_SHA224 802 -#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L - -#define SN_dsa_with_SHA256 "dsa_with_SHA256" -#define NID_dsa_with_SHA256 803 -#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L - -#define OBJ_sigAlgs OBJ_nistAlgorithms,3L - -#define SN_dsa_with_SHA384 "id-dsa-with-sha384" -#define LN_dsa_with_SHA384 "dsa_with_SHA384" -#define NID_dsa_with_SHA384 1106 -#define OBJ_dsa_with_SHA384 OBJ_sigAlgs,3L - -#define SN_dsa_with_SHA512 "id-dsa-with-sha512" -#define LN_dsa_with_SHA512 "dsa_with_SHA512" -#define NID_dsa_with_SHA512 1107 -#define OBJ_dsa_with_SHA512 OBJ_sigAlgs,4L - -#define SN_dsa_with_SHA3_224 "id-dsa-with-sha3-224" -#define LN_dsa_with_SHA3_224 "dsa_with_SHA3-224" -#define NID_dsa_with_SHA3_224 1108 -#define OBJ_dsa_with_SHA3_224 OBJ_sigAlgs,5L - -#define SN_dsa_with_SHA3_256 "id-dsa-with-sha3-256" -#define LN_dsa_with_SHA3_256 "dsa_with_SHA3-256" -#define NID_dsa_with_SHA3_256 1109 -#define OBJ_dsa_with_SHA3_256 OBJ_sigAlgs,6L - -#define SN_dsa_with_SHA3_384 "id-dsa-with-sha3-384" -#define LN_dsa_with_SHA3_384 "dsa_with_SHA3-384" -#define NID_dsa_with_SHA3_384 1110 -#define OBJ_dsa_with_SHA3_384 OBJ_sigAlgs,7L - -#define SN_dsa_with_SHA3_512 "id-dsa-with-sha3-512" -#define LN_dsa_with_SHA3_512 "dsa_with_SHA3-512" -#define NID_dsa_with_SHA3_512 1111 -#define OBJ_dsa_with_SHA3_512 OBJ_sigAlgs,8L - -#define SN_ecdsa_with_SHA3_224 "id-ecdsa-with-sha3-224" -#define LN_ecdsa_with_SHA3_224 "ecdsa_with_SHA3-224" -#define NID_ecdsa_with_SHA3_224 1112 -#define OBJ_ecdsa_with_SHA3_224 OBJ_sigAlgs,9L - -#define SN_ecdsa_with_SHA3_256 "id-ecdsa-with-sha3-256" -#define LN_ecdsa_with_SHA3_256 "ecdsa_with_SHA3-256" -#define NID_ecdsa_with_SHA3_256 1113 -#define OBJ_ecdsa_with_SHA3_256 OBJ_sigAlgs,10L - -#define SN_ecdsa_with_SHA3_384 "id-ecdsa-with-sha3-384" -#define LN_ecdsa_with_SHA3_384 "ecdsa_with_SHA3-384" -#define NID_ecdsa_with_SHA3_384 1114 -#define OBJ_ecdsa_with_SHA3_384 OBJ_sigAlgs,11L - -#define SN_ecdsa_with_SHA3_512 "id-ecdsa-with-sha3-512" -#define LN_ecdsa_with_SHA3_512 "ecdsa_with_SHA3-512" -#define NID_ecdsa_with_SHA3_512 1115 -#define OBJ_ecdsa_with_SHA3_512 OBJ_sigAlgs,12L - -#define SN_RSA_SHA3_224 "id-rsassa-pkcs1-v1_5-with-sha3-224" -#define LN_RSA_SHA3_224 "RSA-SHA3-224" -#define NID_RSA_SHA3_224 1116 -#define OBJ_RSA_SHA3_224 OBJ_sigAlgs,13L - -#define SN_RSA_SHA3_256 "id-rsassa-pkcs1-v1_5-with-sha3-256" -#define LN_RSA_SHA3_256 "RSA-SHA3-256" -#define NID_RSA_SHA3_256 1117 -#define OBJ_RSA_SHA3_256 OBJ_sigAlgs,14L - -#define SN_RSA_SHA3_384 "id-rsassa-pkcs1-v1_5-with-sha3-384" -#define LN_RSA_SHA3_384 "RSA-SHA3-384" -#define NID_RSA_SHA3_384 1118 -#define OBJ_RSA_SHA3_384 OBJ_sigAlgs,15L - -#define SN_RSA_SHA3_512 "id-rsassa-pkcs1-v1_5-with-sha3-512" -#define LN_RSA_SHA3_512 "RSA-SHA3-512" -#define NID_RSA_SHA3_512 1119 -#define OBJ_RSA_SHA3_512 OBJ_sigAlgs,16L - -#define SN_hold_instruction_code "holdInstructionCode" -#define LN_hold_instruction_code "Hold Instruction Code" -#define NID_hold_instruction_code 430 -#define OBJ_hold_instruction_code OBJ_id_ce,23L - -#define OBJ_holdInstruction OBJ_X9_57,2L - -#define SN_hold_instruction_none "holdInstructionNone" -#define LN_hold_instruction_none "Hold Instruction None" -#define NID_hold_instruction_none 431 -#define OBJ_hold_instruction_none OBJ_holdInstruction,1L - -#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" -#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" -#define NID_hold_instruction_call_issuer 432 -#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L - -#define SN_hold_instruction_reject "holdInstructionReject" -#define LN_hold_instruction_reject "Hold Instruction Reject" -#define NID_hold_instruction_reject 433 -#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L - -#define SN_data "data" -#define NID_data 434 -#define OBJ_data OBJ_itu_t,9L - -#define SN_pss "pss" -#define NID_pss 435 -#define OBJ_pss OBJ_data,2342L - -#define SN_ucl "ucl" -#define NID_ucl 436 -#define OBJ_ucl OBJ_pss,19200300L - -#define SN_pilot "pilot" -#define NID_pilot 437 -#define OBJ_pilot OBJ_ucl,100L - -#define LN_pilotAttributeType "pilotAttributeType" -#define NID_pilotAttributeType 438 -#define OBJ_pilotAttributeType OBJ_pilot,1L - -#define LN_pilotAttributeSyntax "pilotAttributeSyntax" -#define NID_pilotAttributeSyntax 439 -#define OBJ_pilotAttributeSyntax OBJ_pilot,3L - -#define LN_pilotObjectClass "pilotObjectClass" -#define NID_pilotObjectClass 440 -#define OBJ_pilotObjectClass OBJ_pilot,4L - -#define LN_pilotGroups "pilotGroups" -#define NID_pilotGroups 441 -#define OBJ_pilotGroups OBJ_pilot,10L - -#define LN_iA5StringSyntax "iA5StringSyntax" -#define NID_iA5StringSyntax 442 -#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L - -#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" -#define NID_caseIgnoreIA5StringSyntax 443 -#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L - -#define LN_pilotObject "pilotObject" -#define NID_pilotObject 444 -#define OBJ_pilotObject OBJ_pilotObjectClass,3L - -#define LN_pilotPerson "pilotPerson" -#define NID_pilotPerson 445 -#define OBJ_pilotPerson OBJ_pilotObjectClass,4L - -#define SN_account "account" -#define NID_account 446 -#define OBJ_account OBJ_pilotObjectClass,5L - -#define SN_document "document" -#define NID_document 447 -#define OBJ_document OBJ_pilotObjectClass,6L - -#define SN_room "room" -#define NID_room 448 -#define OBJ_room OBJ_pilotObjectClass,7L - -#define LN_documentSeries "documentSeries" -#define NID_documentSeries 449 -#define OBJ_documentSeries OBJ_pilotObjectClass,9L - -#define SN_Domain "domain" -#define LN_Domain "Domain" -#define NID_Domain 392 -#define OBJ_Domain OBJ_pilotObjectClass,13L - -#define LN_rFC822localPart "rFC822localPart" -#define NID_rFC822localPart 450 -#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L - -#define LN_dNSDomain "dNSDomain" -#define NID_dNSDomain 451 -#define OBJ_dNSDomain OBJ_pilotObjectClass,15L - -#define LN_domainRelatedObject "domainRelatedObject" -#define NID_domainRelatedObject 452 -#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L - -#define LN_friendlyCountry "friendlyCountry" -#define NID_friendlyCountry 453 -#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L - -#define LN_simpleSecurityObject "simpleSecurityObject" -#define NID_simpleSecurityObject 454 -#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L - -#define LN_pilotOrganization "pilotOrganization" -#define NID_pilotOrganization 455 -#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L - -#define LN_pilotDSA "pilotDSA" -#define NID_pilotDSA 456 -#define OBJ_pilotDSA OBJ_pilotObjectClass,21L - -#define LN_qualityLabelledData "qualityLabelledData" -#define NID_qualityLabelledData 457 -#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L - -#define SN_userId "UID" -#define LN_userId "userId" -#define NID_userId 458 -#define OBJ_userId OBJ_pilotAttributeType,1L - -#define LN_textEncodedORAddress "textEncodedORAddress" -#define NID_textEncodedORAddress 459 -#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L - -#define SN_rfc822Mailbox "mail" -#define LN_rfc822Mailbox "rfc822Mailbox" -#define NID_rfc822Mailbox 460 -#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L - -#define SN_info "info" -#define NID_info 461 -#define OBJ_info OBJ_pilotAttributeType,4L - -#define LN_favouriteDrink "favouriteDrink" -#define NID_favouriteDrink 462 -#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L - -#define LN_roomNumber "roomNumber" -#define NID_roomNumber 463 -#define OBJ_roomNumber OBJ_pilotAttributeType,6L - -#define SN_photo "photo" -#define NID_photo 464 -#define OBJ_photo OBJ_pilotAttributeType,7L - -#define LN_userClass "userClass" -#define NID_userClass 465 -#define OBJ_userClass OBJ_pilotAttributeType,8L - -#define SN_host "host" -#define NID_host 466 -#define OBJ_host OBJ_pilotAttributeType,9L - -#define SN_manager "manager" -#define NID_manager 467 -#define OBJ_manager OBJ_pilotAttributeType,10L - -#define LN_documentIdentifier "documentIdentifier" -#define NID_documentIdentifier 468 -#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L - -#define LN_documentTitle "documentTitle" -#define NID_documentTitle 469 -#define OBJ_documentTitle OBJ_pilotAttributeType,12L - -#define LN_documentVersion "documentVersion" -#define NID_documentVersion 470 -#define OBJ_documentVersion OBJ_pilotAttributeType,13L - -#define LN_documentAuthor "documentAuthor" -#define NID_documentAuthor 471 -#define OBJ_documentAuthor OBJ_pilotAttributeType,14L - -#define LN_documentLocation "documentLocation" -#define NID_documentLocation 472 -#define OBJ_documentLocation OBJ_pilotAttributeType,15L - -#define LN_homeTelephoneNumber "homeTelephoneNumber" -#define NID_homeTelephoneNumber 473 -#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L - -#define SN_secretary "secretary" -#define NID_secretary 474 -#define OBJ_secretary OBJ_pilotAttributeType,21L - -#define LN_otherMailbox "otherMailbox" -#define NID_otherMailbox 475 -#define OBJ_otherMailbox OBJ_pilotAttributeType,22L - -#define LN_lastModifiedTime "lastModifiedTime" -#define NID_lastModifiedTime 476 -#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L - -#define LN_lastModifiedBy "lastModifiedBy" -#define NID_lastModifiedBy 477 -#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L - -#define SN_domainComponent "DC" -#define LN_domainComponent "domainComponent" -#define NID_domainComponent 391 -#define OBJ_domainComponent OBJ_pilotAttributeType,25L - -#define LN_aRecord "aRecord" -#define NID_aRecord 478 -#define OBJ_aRecord OBJ_pilotAttributeType,26L - -#define LN_pilotAttributeType27 "pilotAttributeType27" -#define NID_pilotAttributeType27 479 -#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L - -#define LN_mXRecord "mXRecord" -#define NID_mXRecord 480 -#define OBJ_mXRecord OBJ_pilotAttributeType,28L - -#define LN_nSRecord "nSRecord" -#define NID_nSRecord 481 -#define OBJ_nSRecord OBJ_pilotAttributeType,29L - -#define LN_sOARecord "sOARecord" -#define NID_sOARecord 482 -#define OBJ_sOARecord OBJ_pilotAttributeType,30L - -#define LN_cNAMERecord "cNAMERecord" -#define NID_cNAMERecord 483 -#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L - -#define LN_associatedDomain "associatedDomain" -#define NID_associatedDomain 484 -#define OBJ_associatedDomain OBJ_pilotAttributeType,37L - -#define LN_associatedName "associatedName" -#define NID_associatedName 485 -#define OBJ_associatedName OBJ_pilotAttributeType,38L - -#define LN_homePostalAddress "homePostalAddress" -#define NID_homePostalAddress 486 -#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L - -#define LN_personalTitle "personalTitle" -#define NID_personalTitle 487 -#define OBJ_personalTitle OBJ_pilotAttributeType,40L - -#define LN_mobileTelephoneNumber "mobileTelephoneNumber" -#define NID_mobileTelephoneNumber 488 -#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L - -#define LN_pagerTelephoneNumber "pagerTelephoneNumber" -#define NID_pagerTelephoneNumber 489 -#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L - -#define LN_friendlyCountryName "friendlyCountryName" -#define NID_friendlyCountryName 490 -#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L - -#define SN_uniqueIdentifier "uid" -#define LN_uniqueIdentifier "uniqueIdentifier" -#define NID_uniqueIdentifier 102 -#define OBJ_uniqueIdentifier OBJ_pilotAttributeType,44L - -#define LN_organizationalStatus "organizationalStatus" -#define NID_organizationalStatus 491 -#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L - -#define LN_janetMailbox "janetMailbox" -#define NID_janetMailbox 492 -#define OBJ_janetMailbox OBJ_pilotAttributeType,46L - -#define LN_mailPreferenceOption "mailPreferenceOption" -#define NID_mailPreferenceOption 493 -#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L - -#define LN_buildingName "buildingName" -#define NID_buildingName 494 -#define OBJ_buildingName OBJ_pilotAttributeType,48L - -#define LN_dSAQuality "dSAQuality" -#define NID_dSAQuality 495 -#define OBJ_dSAQuality OBJ_pilotAttributeType,49L - -#define LN_singleLevelQuality "singleLevelQuality" -#define NID_singleLevelQuality 496 -#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L - -#define LN_subtreeMinimumQuality "subtreeMinimumQuality" -#define NID_subtreeMinimumQuality 497 -#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L - -#define LN_subtreeMaximumQuality "subtreeMaximumQuality" -#define NID_subtreeMaximumQuality 498 -#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L - -#define LN_personalSignature "personalSignature" -#define NID_personalSignature 499 -#define OBJ_personalSignature OBJ_pilotAttributeType,53L - -#define LN_dITRedirect "dITRedirect" -#define NID_dITRedirect 500 -#define OBJ_dITRedirect OBJ_pilotAttributeType,54L - -#define SN_audio "audio" -#define NID_audio 501 -#define OBJ_audio OBJ_pilotAttributeType,55L - -#define LN_documentPublisher "documentPublisher" -#define NID_documentPublisher 502 -#define OBJ_documentPublisher OBJ_pilotAttributeType,56L - -#define SN_id_set "id-set" -#define LN_id_set "Secure Electronic Transactions" -#define NID_id_set 512 -#define OBJ_id_set OBJ_international_organizations,42L - -#define SN_set_ctype "set-ctype" -#define LN_set_ctype "content types" -#define NID_set_ctype 513 -#define OBJ_set_ctype OBJ_id_set,0L - -#define SN_set_msgExt "set-msgExt" -#define LN_set_msgExt "message extensions" -#define NID_set_msgExt 514 -#define OBJ_set_msgExt OBJ_id_set,1L - -#define SN_set_attr "set-attr" -#define NID_set_attr 515 -#define OBJ_set_attr OBJ_id_set,3L - -#define SN_set_policy "set-policy" -#define NID_set_policy 516 -#define OBJ_set_policy OBJ_id_set,5L - -#define SN_set_certExt "set-certExt" -#define LN_set_certExt "certificate extensions" -#define NID_set_certExt 517 -#define OBJ_set_certExt OBJ_id_set,7L - -#define SN_set_brand "set-brand" -#define NID_set_brand 518 -#define OBJ_set_brand OBJ_id_set,8L - -#define SN_setct_PANData "setct-PANData" -#define NID_setct_PANData 519 -#define OBJ_setct_PANData OBJ_set_ctype,0L - -#define SN_setct_PANToken "setct-PANToken" -#define NID_setct_PANToken 520 -#define OBJ_setct_PANToken OBJ_set_ctype,1L - -#define SN_setct_PANOnly "setct-PANOnly" -#define NID_setct_PANOnly 521 -#define OBJ_setct_PANOnly OBJ_set_ctype,2L - -#define SN_setct_OIData "setct-OIData" -#define NID_setct_OIData 522 -#define OBJ_setct_OIData OBJ_set_ctype,3L - -#define SN_setct_PI "setct-PI" -#define NID_setct_PI 523 -#define OBJ_setct_PI OBJ_set_ctype,4L - -#define SN_setct_PIData "setct-PIData" -#define NID_setct_PIData 524 -#define OBJ_setct_PIData OBJ_set_ctype,5L - -#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" -#define NID_setct_PIDataUnsigned 525 -#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L - -#define SN_setct_HODInput "setct-HODInput" -#define NID_setct_HODInput 526 -#define OBJ_setct_HODInput OBJ_set_ctype,7L - -#define SN_setct_AuthResBaggage "setct-AuthResBaggage" -#define NID_setct_AuthResBaggage 527 -#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L - -#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" -#define NID_setct_AuthRevReqBaggage 528 -#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L - -#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" -#define NID_setct_AuthRevResBaggage 529 -#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L - -#define SN_setct_CapTokenSeq "setct-CapTokenSeq" -#define NID_setct_CapTokenSeq 530 -#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L - -#define SN_setct_PInitResData "setct-PInitResData" -#define NID_setct_PInitResData 531 -#define OBJ_setct_PInitResData OBJ_set_ctype,12L - -#define SN_setct_PI_TBS "setct-PI-TBS" -#define NID_setct_PI_TBS 532 -#define OBJ_setct_PI_TBS OBJ_set_ctype,13L - -#define SN_setct_PResData "setct-PResData" -#define NID_setct_PResData 533 -#define OBJ_setct_PResData OBJ_set_ctype,14L - -#define SN_setct_AuthReqTBS "setct-AuthReqTBS" -#define NID_setct_AuthReqTBS 534 -#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L - -#define SN_setct_AuthResTBS "setct-AuthResTBS" -#define NID_setct_AuthResTBS 535 -#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L - -#define SN_setct_AuthResTBSX "setct-AuthResTBSX" -#define NID_setct_AuthResTBSX 536 -#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L - -#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" -#define NID_setct_AuthTokenTBS 537 -#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L - -#define SN_setct_CapTokenData "setct-CapTokenData" -#define NID_setct_CapTokenData 538 -#define OBJ_setct_CapTokenData OBJ_set_ctype,20L - -#define SN_setct_CapTokenTBS "setct-CapTokenTBS" -#define NID_setct_CapTokenTBS 539 -#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L - -#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" -#define NID_setct_AcqCardCodeMsg 540 -#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L - -#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" -#define NID_setct_AuthRevReqTBS 541 -#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L - -#define SN_setct_AuthRevResData "setct-AuthRevResData" -#define NID_setct_AuthRevResData 542 -#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L - -#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" -#define NID_setct_AuthRevResTBS 543 -#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L - -#define SN_setct_CapReqTBS "setct-CapReqTBS" -#define NID_setct_CapReqTBS 544 -#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L - -#define SN_setct_CapReqTBSX "setct-CapReqTBSX" -#define NID_setct_CapReqTBSX 545 -#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L - -#define SN_setct_CapResData "setct-CapResData" -#define NID_setct_CapResData 546 -#define OBJ_setct_CapResData OBJ_set_ctype,28L - -#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" -#define NID_setct_CapRevReqTBS 547 -#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L - -#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" -#define NID_setct_CapRevReqTBSX 548 -#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L - -#define SN_setct_CapRevResData "setct-CapRevResData" -#define NID_setct_CapRevResData 549 -#define OBJ_setct_CapRevResData OBJ_set_ctype,31L - -#define SN_setct_CredReqTBS "setct-CredReqTBS" -#define NID_setct_CredReqTBS 550 -#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L - -#define SN_setct_CredReqTBSX "setct-CredReqTBSX" -#define NID_setct_CredReqTBSX 551 -#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L - -#define SN_setct_CredResData "setct-CredResData" -#define NID_setct_CredResData 552 -#define OBJ_setct_CredResData OBJ_set_ctype,34L - -#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" -#define NID_setct_CredRevReqTBS 553 -#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L - -#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" -#define NID_setct_CredRevReqTBSX 554 -#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L - -#define SN_setct_CredRevResData "setct-CredRevResData" -#define NID_setct_CredRevResData 555 -#define OBJ_setct_CredRevResData OBJ_set_ctype,37L - -#define SN_setct_PCertReqData "setct-PCertReqData" -#define NID_setct_PCertReqData 556 -#define OBJ_setct_PCertReqData OBJ_set_ctype,38L - -#define SN_setct_PCertResTBS "setct-PCertResTBS" -#define NID_setct_PCertResTBS 557 -#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L - -#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" -#define NID_setct_BatchAdminReqData 558 -#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L - -#define SN_setct_BatchAdminResData "setct-BatchAdminResData" -#define NID_setct_BatchAdminResData 559 -#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L - -#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" -#define NID_setct_CardCInitResTBS 560 -#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L - -#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" -#define NID_setct_MeAqCInitResTBS 561 -#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L - -#define SN_setct_RegFormResTBS "setct-RegFormResTBS" -#define NID_setct_RegFormResTBS 562 -#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L - -#define SN_setct_CertReqData "setct-CertReqData" -#define NID_setct_CertReqData 563 -#define OBJ_setct_CertReqData OBJ_set_ctype,45L - -#define SN_setct_CertReqTBS "setct-CertReqTBS" -#define NID_setct_CertReqTBS 564 -#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L - -#define SN_setct_CertResData "setct-CertResData" -#define NID_setct_CertResData 565 -#define OBJ_setct_CertResData OBJ_set_ctype,47L - -#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" -#define NID_setct_CertInqReqTBS 566 -#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L - -#define SN_setct_ErrorTBS "setct-ErrorTBS" -#define NID_setct_ErrorTBS 567 -#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L - -#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" -#define NID_setct_PIDualSignedTBE 568 -#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L - -#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" -#define NID_setct_PIUnsignedTBE 569 -#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L - -#define SN_setct_AuthReqTBE "setct-AuthReqTBE" -#define NID_setct_AuthReqTBE 570 -#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L - -#define SN_setct_AuthResTBE "setct-AuthResTBE" -#define NID_setct_AuthResTBE 571 -#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L - -#define SN_setct_AuthResTBEX "setct-AuthResTBEX" -#define NID_setct_AuthResTBEX 572 -#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L - -#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" -#define NID_setct_AuthTokenTBE 573 -#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L - -#define SN_setct_CapTokenTBE "setct-CapTokenTBE" -#define NID_setct_CapTokenTBE 574 -#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L - -#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" -#define NID_setct_CapTokenTBEX 575 -#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L - -#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" -#define NID_setct_AcqCardCodeMsgTBE 576 -#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L - -#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" -#define NID_setct_AuthRevReqTBE 577 -#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L - -#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" -#define NID_setct_AuthRevResTBE 578 -#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L - -#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" -#define NID_setct_AuthRevResTBEB 579 -#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L - -#define SN_setct_CapReqTBE "setct-CapReqTBE" -#define NID_setct_CapReqTBE 580 -#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L - -#define SN_setct_CapReqTBEX "setct-CapReqTBEX" -#define NID_setct_CapReqTBEX 581 -#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L - -#define SN_setct_CapResTBE "setct-CapResTBE" -#define NID_setct_CapResTBE 582 -#define OBJ_setct_CapResTBE OBJ_set_ctype,64L - -#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" -#define NID_setct_CapRevReqTBE 583 -#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L - -#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" -#define NID_setct_CapRevReqTBEX 584 -#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L - -#define SN_setct_CapRevResTBE "setct-CapRevResTBE" -#define NID_setct_CapRevResTBE 585 -#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L - -#define SN_setct_CredReqTBE "setct-CredReqTBE" -#define NID_setct_CredReqTBE 586 -#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L - -#define SN_setct_CredReqTBEX "setct-CredReqTBEX" -#define NID_setct_CredReqTBEX 587 -#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L - -#define SN_setct_CredResTBE "setct-CredResTBE" -#define NID_setct_CredResTBE 588 -#define OBJ_setct_CredResTBE OBJ_set_ctype,70L - -#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" -#define NID_setct_CredRevReqTBE 589 -#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L - -#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" -#define NID_setct_CredRevReqTBEX 590 -#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L - -#define SN_setct_CredRevResTBE "setct-CredRevResTBE" -#define NID_setct_CredRevResTBE 591 -#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L - -#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" -#define NID_setct_BatchAdminReqTBE 592 -#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L - -#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" -#define NID_setct_BatchAdminResTBE 593 -#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L - -#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" -#define NID_setct_RegFormReqTBE 594 -#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L - -#define SN_setct_CertReqTBE "setct-CertReqTBE" -#define NID_setct_CertReqTBE 595 -#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L - -#define SN_setct_CertReqTBEX "setct-CertReqTBEX" -#define NID_setct_CertReqTBEX 596 -#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L - -#define SN_setct_CertResTBE "setct-CertResTBE" -#define NID_setct_CertResTBE 597 -#define OBJ_setct_CertResTBE OBJ_set_ctype,79L - -#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" -#define NID_setct_CRLNotificationTBS 598 -#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L - -#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" -#define NID_setct_CRLNotificationResTBS 599 -#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L - -#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" -#define NID_setct_BCIDistributionTBS 600 -#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L - -#define SN_setext_genCrypt "setext-genCrypt" -#define LN_setext_genCrypt "generic cryptogram" -#define NID_setext_genCrypt 601 -#define OBJ_setext_genCrypt OBJ_set_msgExt,1L - -#define SN_setext_miAuth "setext-miAuth" -#define LN_setext_miAuth "merchant initiated auth" -#define NID_setext_miAuth 602 -#define OBJ_setext_miAuth OBJ_set_msgExt,3L - -#define SN_setext_pinSecure "setext-pinSecure" -#define NID_setext_pinSecure 603 -#define OBJ_setext_pinSecure OBJ_set_msgExt,4L - -#define SN_setext_pinAny "setext-pinAny" -#define NID_setext_pinAny 604 -#define OBJ_setext_pinAny OBJ_set_msgExt,5L - -#define SN_setext_track2 "setext-track2" -#define NID_setext_track2 605 -#define OBJ_setext_track2 OBJ_set_msgExt,7L - -#define SN_setext_cv "setext-cv" -#define LN_setext_cv "additional verification" -#define NID_setext_cv 606 -#define OBJ_setext_cv OBJ_set_msgExt,8L - -#define SN_set_policy_root "set-policy-root" -#define NID_set_policy_root 607 -#define OBJ_set_policy_root OBJ_set_policy,0L - -#define SN_setCext_hashedRoot "setCext-hashedRoot" -#define NID_setCext_hashedRoot 608 -#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L - -#define SN_setCext_certType "setCext-certType" -#define NID_setCext_certType 609 -#define OBJ_setCext_certType OBJ_set_certExt,1L - -#define SN_setCext_merchData "setCext-merchData" -#define NID_setCext_merchData 610 -#define OBJ_setCext_merchData OBJ_set_certExt,2L - -#define SN_setCext_cCertRequired "setCext-cCertRequired" -#define NID_setCext_cCertRequired 611 -#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L - -#define SN_setCext_tunneling "setCext-tunneling" -#define NID_setCext_tunneling 612 -#define OBJ_setCext_tunneling OBJ_set_certExt,4L - -#define SN_setCext_setExt "setCext-setExt" -#define NID_setCext_setExt 613 -#define OBJ_setCext_setExt OBJ_set_certExt,5L - -#define SN_setCext_setQualf "setCext-setQualf" -#define NID_setCext_setQualf 614 -#define OBJ_setCext_setQualf OBJ_set_certExt,6L - -#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" -#define NID_setCext_PGWYcapabilities 615 -#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L - -#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" -#define NID_setCext_TokenIdentifier 616 -#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L - -#define SN_setCext_Track2Data "setCext-Track2Data" -#define NID_setCext_Track2Data 617 -#define OBJ_setCext_Track2Data OBJ_set_certExt,9L - -#define SN_setCext_TokenType "setCext-TokenType" -#define NID_setCext_TokenType 618 -#define OBJ_setCext_TokenType OBJ_set_certExt,10L - -#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" -#define NID_setCext_IssuerCapabilities 619 -#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L - -#define SN_setAttr_Cert "setAttr-Cert" -#define NID_setAttr_Cert 620 -#define OBJ_setAttr_Cert OBJ_set_attr,0L - -#define SN_setAttr_PGWYcap "setAttr-PGWYcap" -#define LN_setAttr_PGWYcap "payment gateway capabilities" -#define NID_setAttr_PGWYcap 621 -#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L - -#define SN_setAttr_TokenType "setAttr-TokenType" -#define NID_setAttr_TokenType 622 -#define OBJ_setAttr_TokenType OBJ_set_attr,2L - -#define SN_setAttr_IssCap "setAttr-IssCap" -#define LN_setAttr_IssCap "issuer capabilities" -#define NID_setAttr_IssCap 623 -#define OBJ_setAttr_IssCap OBJ_set_attr,3L - -#define SN_set_rootKeyThumb "set-rootKeyThumb" -#define NID_set_rootKeyThumb 624 -#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L - -#define SN_set_addPolicy "set-addPolicy" -#define NID_set_addPolicy 625 -#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L - -#define SN_setAttr_Token_EMV "setAttr-Token-EMV" -#define NID_setAttr_Token_EMV 626 -#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L - -#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" -#define NID_setAttr_Token_B0Prime 627 -#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L - -#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" -#define NID_setAttr_IssCap_CVM 628 -#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L - -#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" -#define NID_setAttr_IssCap_T2 629 -#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L - -#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" -#define NID_setAttr_IssCap_Sig 630 -#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L - -#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" -#define LN_setAttr_GenCryptgrm "generate cryptogram" -#define NID_setAttr_GenCryptgrm 631 -#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L - -#define SN_setAttr_T2Enc "setAttr-T2Enc" -#define LN_setAttr_T2Enc "encrypted track 2" -#define NID_setAttr_T2Enc 632 -#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L - -#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" -#define LN_setAttr_T2cleartxt "cleartext track 2" -#define NID_setAttr_T2cleartxt 633 -#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L - -#define SN_setAttr_TokICCsig "setAttr-TokICCsig" -#define LN_setAttr_TokICCsig "ICC or token signature" -#define NID_setAttr_TokICCsig 634 -#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L - -#define SN_setAttr_SecDevSig "setAttr-SecDevSig" -#define LN_setAttr_SecDevSig "secure device signature" -#define NID_setAttr_SecDevSig 635 -#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L - -#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" -#define NID_set_brand_IATA_ATA 636 -#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L - -#define SN_set_brand_Diners "set-brand-Diners" -#define NID_set_brand_Diners 637 -#define OBJ_set_brand_Diners OBJ_set_brand,30L - -#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" -#define NID_set_brand_AmericanExpress 638 -#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L - -#define SN_set_brand_JCB "set-brand-JCB" -#define NID_set_brand_JCB 639 -#define OBJ_set_brand_JCB OBJ_set_brand,35L - -#define SN_set_brand_Visa "set-brand-Visa" -#define NID_set_brand_Visa 640 -#define OBJ_set_brand_Visa OBJ_set_brand,4L - -#define SN_set_brand_MasterCard "set-brand-MasterCard" -#define NID_set_brand_MasterCard 641 -#define OBJ_set_brand_MasterCard OBJ_set_brand,5L - -#define SN_set_brand_Novus "set-brand-Novus" -#define NID_set_brand_Novus 642 -#define OBJ_set_brand_Novus OBJ_set_brand,6011L - -#define SN_des_cdmf "DES-CDMF" -#define LN_des_cdmf "des-cdmf" -#define NID_des_cdmf 643 -#define OBJ_des_cdmf OBJ_rsadsi,3L,10L - -#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" -#define NID_rsaOAEPEncryptionSET 644 -#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L - -#define SN_ipsec3 "Oakley-EC2N-3" -#define LN_ipsec3 "ipsec3" -#define NID_ipsec3 749 - -#define SN_ipsec4 "Oakley-EC2N-4" -#define LN_ipsec4 "ipsec4" -#define NID_ipsec4 750 - -#define SN_whirlpool "whirlpool" -#define NID_whirlpool 804 -#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L - -#define SN_cryptopro "cryptopro" -#define NID_cryptopro 805 -#define OBJ_cryptopro OBJ_member_body,643L,2L,2L - -#define SN_cryptocom "cryptocom" -#define NID_cryptocom 806 -#define OBJ_cryptocom OBJ_member_body,643L,2L,9L - -#define SN_id_tc26 "id-tc26" -#define NID_id_tc26 974 -#define OBJ_id_tc26 OBJ_member_body,643L,7L,1L - -#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" -#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" -#define NID_id_GostR3411_94_with_GostR3410_2001 807 -#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L - -#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" -#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" -#define NID_id_GostR3411_94_with_GostR3410_94 808 -#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L - -#define SN_id_GostR3411_94 "md_gost94" -#define LN_id_GostR3411_94 "GOST R 34.11-94" -#define NID_id_GostR3411_94 809 -#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L - -#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" -#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" -#define NID_id_HMACGostR3411_94 810 -#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L - -#define SN_id_GostR3410_2001 "gost2001" -#define LN_id_GostR3410_2001 "GOST R 34.10-2001" -#define NID_id_GostR3410_2001 811 -#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L - -#define SN_id_GostR3410_94 "gost94" -#define LN_id_GostR3410_94 "GOST R 34.10-94" -#define NID_id_GostR3410_94 812 -#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L - -#define SN_id_Gost28147_89 "gost89" -#define LN_id_Gost28147_89 "GOST 28147-89" -#define NID_id_Gost28147_89 813 -#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L - -#define SN_gost89_cnt "gost89-cnt" -#define NID_gost89_cnt 814 - -#define SN_gost89_cnt_12 "gost89-cnt-12" -#define NID_gost89_cnt_12 975 - -#define SN_gost89_cbc "gost89-cbc" -#define NID_gost89_cbc 1009 - -#define SN_gost89_ecb "gost89-ecb" -#define NID_gost89_ecb 1010 - -#define SN_gost89_ctr "gost89-ctr" -#define NID_gost89_ctr 1011 - -#define SN_id_Gost28147_89_MAC "gost-mac" -#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" -#define NID_id_Gost28147_89_MAC 815 -#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L - -#define SN_gost_mac_12 "gost-mac-12" -#define NID_gost_mac_12 976 - -#define SN_id_GostR3411_94_prf "prf-gostr3411-94" -#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" -#define NID_id_GostR3411_94_prf 816 -#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L - -#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" -#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" -#define NID_id_GostR3410_2001DH 817 -#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L - -#define SN_id_GostR3410_94DH "id-GostR3410-94DH" -#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" -#define NID_id_GostR3410_94DH 818 -#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L - -#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" -#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 -#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L - -#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" -#define NID_id_Gost28147_89_None_KeyMeshing 820 -#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L - -#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" -#define NID_id_GostR3411_94_TestParamSet 821 -#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L - -#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" -#define NID_id_GostR3411_94_CryptoProParamSet 822 -#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L - -#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" -#define NID_id_Gost28147_89_TestParamSet 823 -#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L - -#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 -#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L - -#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 -#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L - -#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 -#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L - -#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 -#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L - -#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 -#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L - -#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 -#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L - -#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 -#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L - -#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" -#define NID_id_GostR3410_94_TestParamSet 831 -#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L - -#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 -#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L - -#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 -#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L - -#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 -#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L - -#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 -#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L - -#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 -#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L - -#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 -#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L - -#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 -#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L - -#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" -#define NID_id_GostR3410_2001_TestParamSet 839 -#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L - -#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 -#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L - -#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 -#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L - -#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 -#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L - -#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 -#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L - -#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 -#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L - -#define SN_id_GostR3410_94_a "id-GostR3410-94-a" -#define NID_id_GostR3410_94_a 845 -#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L - -#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" -#define NID_id_GostR3410_94_aBis 846 -#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L - -#define SN_id_GostR3410_94_b "id-GostR3410-94-b" -#define NID_id_GostR3410_94_b 847 -#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L - -#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" -#define NID_id_GostR3410_94_bBis 848 -#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L - -#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" -#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" -#define NID_id_Gost28147_89_cc 849 -#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L - -#define SN_id_GostR3410_94_cc "gost94cc" -#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" -#define NID_id_GostR3410_94_cc 850 -#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L - -#define SN_id_GostR3410_2001_cc "gost2001cc" -#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" -#define NID_id_GostR3410_2001_cc 851 -#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L - -#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" -#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" -#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 -#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L - -#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" -#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" -#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 -#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L - -#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" -#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" -#define NID_id_GostR3410_2001_ParamSet_cc 854 -#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L - -#define SN_id_tc26_algorithms "id-tc26-algorithms" -#define NID_id_tc26_algorithms 977 -#define OBJ_id_tc26_algorithms OBJ_id_tc26,1L - -#define SN_id_tc26_sign "id-tc26-sign" -#define NID_id_tc26_sign 978 -#define OBJ_id_tc26_sign OBJ_id_tc26_algorithms,1L - -#define SN_id_GostR3410_2012_256 "gost2012_256" -#define LN_id_GostR3410_2012_256 "GOST R 34.10-2012 with 256 bit modulus" -#define NID_id_GostR3410_2012_256 979 -#define OBJ_id_GostR3410_2012_256 OBJ_id_tc26_sign,1L - -#define SN_id_GostR3410_2012_512 "gost2012_512" -#define LN_id_GostR3410_2012_512 "GOST R 34.10-2012 with 512 bit modulus" -#define NID_id_GostR3410_2012_512 980 -#define OBJ_id_GostR3410_2012_512 OBJ_id_tc26_sign,2L - -#define SN_id_tc26_digest "id-tc26-digest" -#define NID_id_tc26_digest 981 -#define OBJ_id_tc26_digest OBJ_id_tc26_algorithms,2L - -#define SN_id_GostR3411_2012_256 "md_gost12_256" -#define LN_id_GostR3411_2012_256 "GOST R 34.11-2012 with 256 bit hash" -#define NID_id_GostR3411_2012_256 982 -#define OBJ_id_GostR3411_2012_256 OBJ_id_tc26_digest,2L - -#define SN_id_GostR3411_2012_512 "md_gost12_512" -#define LN_id_GostR3411_2012_512 "GOST R 34.11-2012 with 512 bit hash" -#define NID_id_GostR3411_2012_512 983 -#define OBJ_id_GostR3411_2012_512 OBJ_id_tc26_digest,3L - -#define SN_id_tc26_signwithdigest "id-tc26-signwithdigest" -#define NID_id_tc26_signwithdigest 984 -#define OBJ_id_tc26_signwithdigest OBJ_id_tc26_algorithms,3L - -#define SN_id_tc26_signwithdigest_gost3410_2012_256 "id-tc26-signwithdigest-gost3410-2012-256" -#define LN_id_tc26_signwithdigest_gost3410_2012_256 "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" -#define NID_id_tc26_signwithdigest_gost3410_2012_256 985 -#define OBJ_id_tc26_signwithdigest_gost3410_2012_256 OBJ_id_tc26_signwithdigest,2L - -#define SN_id_tc26_signwithdigest_gost3410_2012_512 "id-tc26-signwithdigest-gost3410-2012-512" -#define LN_id_tc26_signwithdigest_gost3410_2012_512 "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" -#define NID_id_tc26_signwithdigest_gost3410_2012_512 986 -#define OBJ_id_tc26_signwithdigest_gost3410_2012_512 OBJ_id_tc26_signwithdigest,3L - -#define SN_id_tc26_mac "id-tc26-mac" -#define NID_id_tc26_mac 987 -#define OBJ_id_tc26_mac OBJ_id_tc26_algorithms,4L - -#define SN_id_tc26_hmac_gost_3411_2012_256 "id-tc26-hmac-gost-3411-2012-256" -#define LN_id_tc26_hmac_gost_3411_2012_256 "HMAC GOST 34.11-2012 256 bit" -#define NID_id_tc26_hmac_gost_3411_2012_256 988 -#define OBJ_id_tc26_hmac_gost_3411_2012_256 OBJ_id_tc26_mac,1L - -#define SN_id_tc26_hmac_gost_3411_2012_512 "id-tc26-hmac-gost-3411-2012-512" -#define LN_id_tc26_hmac_gost_3411_2012_512 "HMAC GOST 34.11-2012 512 bit" -#define NID_id_tc26_hmac_gost_3411_2012_512 989 -#define OBJ_id_tc26_hmac_gost_3411_2012_512 OBJ_id_tc26_mac,2L - -#define SN_id_tc26_cipher "id-tc26-cipher" -#define NID_id_tc26_cipher 990 -#define OBJ_id_tc26_cipher OBJ_id_tc26_algorithms,5L - -#define SN_id_tc26_cipher_gostr3412_2015_magma "id-tc26-cipher-gostr3412-2015-magma" -#define NID_id_tc26_cipher_gostr3412_2015_magma 1173 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma OBJ_id_tc26_cipher,1L - -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm "id-tc26-cipher-gostr3412-2015-magma-ctracpkm" -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm 1174 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_magma,1L - -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-magma-ctracpkm-omac" -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac 1175 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_magma,2L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik "id-tc26-cipher-gostr3412-2015-kuznyechik" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik 1176 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik OBJ_id_tc26_cipher,2L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm 1177 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,1L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm-omac" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac 1178 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,2L - -#define SN_id_tc26_agreement "id-tc26-agreement" -#define NID_id_tc26_agreement 991 -#define OBJ_id_tc26_agreement OBJ_id_tc26_algorithms,6L - -#define SN_id_tc26_agreement_gost_3410_2012_256 "id-tc26-agreement-gost-3410-2012-256" -#define NID_id_tc26_agreement_gost_3410_2012_256 992 -#define OBJ_id_tc26_agreement_gost_3410_2012_256 OBJ_id_tc26_agreement,1L - -#define SN_id_tc26_agreement_gost_3410_2012_512 "id-tc26-agreement-gost-3410-2012-512" -#define NID_id_tc26_agreement_gost_3410_2012_512 993 -#define OBJ_id_tc26_agreement_gost_3410_2012_512 OBJ_id_tc26_agreement,2L - -#define SN_id_tc26_wrap "id-tc26-wrap" -#define NID_id_tc26_wrap 1179 -#define OBJ_id_tc26_wrap OBJ_id_tc26_algorithms,7L - -#define SN_id_tc26_wrap_gostr3412_2015_magma "id-tc26-wrap-gostr3412-2015-magma" -#define NID_id_tc26_wrap_gostr3412_2015_magma 1180 -#define OBJ_id_tc26_wrap_gostr3412_2015_magma OBJ_id_tc26_wrap,1L - -#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 "id-tc26-wrap-gostr3412-2015-magma-kexp15" -#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 1181 -#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_magma,1L - -#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik "id-tc26-wrap-gostr3412-2015-kuznyechik" -#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik 1182 -#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik OBJ_id_tc26_wrap,2L - -#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 "id-tc26-wrap-gostr3412-2015-kuznyechik-kexp15" -#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 1183 -#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik,1L - -#define SN_id_tc26_constants "id-tc26-constants" -#define NID_id_tc26_constants 994 -#define OBJ_id_tc26_constants OBJ_id_tc26,2L - -#define SN_id_tc26_sign_constants "id-tc26-sign-constants" -#define NID_id_tc26_sign_constants 995 -#define OBJ_id_tc26_sign_constants OBJ_id_tc26_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_constants "id-tc26-gost-3410-2012-256-constants" -#define NID_id_tc26_gost_3410_2012_256_constants 1147 -#define OBJ_id_tc26_gost_3410_2012_256_constants OBJ_id_tc26_sign_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_paramSetA "id-tc26-gost-3410-2012-256-paramSetA" -#define LN_id_tc26_gost_3410_2012_256_paramSetA "GOST R 34.10-2012 (256 bit) ParamSet A" -#define NID_id_tc26_gost_3410_2012_256_paramSetA 1148 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetA OBJ_id_tc26_gost_3410_2012_256_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_paramSetB "id-tc26-gost-3410-2012-256-paramSetB" -#define LN_id_tc26_gost_3410_2012_256_paramSetB "GOST R 34.10-2012 (256 bit) ParamSet B" -#define NID_id_tc26_gost_3410_2012_256_paramSetB 1184 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetB OBJ_id_tc26_gost_3410_2012_256_constants,2L - -#define SN_id_tc26_gost_3410_2012_256_paramSetC "id-tc26-gost-3410-2012-256-paramSetC" -#define LN_id_tc26_gost_3410_2012_256_paramSetC "GOST R 34.10-2012 (256 bit) ParamSet C" -#define NID_id_tc26_gost_3410_2012_256_paramSetC 1185 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetC OBJ_id_tc26_gost_3410_2012_256_constants,3L - -#define SN_id_tc26_gost_3410_2012_256_paramSetD "id-tc26-gost-3410-2012-256-paramSetD" -#define LN_id_tc26_gost_3410_2012_256_paramSetD "GOST R 34.10-2012 (256 bit) ParamSet D" -#define NID_id_tc26_gost_3410_2012_256_paramSetD 1186 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetD OBJ_id_tc26_gost_3410_2012_256_constants,4L - -#define SN_id_tc26_gost_3410_2012_512_constants "id-tc26-gost-3410-2012-512-constants" -#define NID_id_tc26_gost_3410_2012_512_constants 996 -#define OBJ_id_tc26_gost_3410_2012_512_constants OBJ_id_tc26_sign_constants,2L - -#define SN_id_tc26_gost_3410_2012_512_paramSetTest "id-tc26-gost-3410-2012-512-paramSetTest" -#define LN_id_tc26_gost_3410_2012_512_paramSetTest "GOST R 34.10-2012 (512 bit) testing parameter set" -#define NID_id_tc26_gost_3410_2012_512_paramSetTest 997 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetTest OBJ_id_tc26_gost_3410_2012_512_constants,0L - -#define SN_id_tc26_gost_3410_2012_512_paramSetA "id-tc26-gost-3410-2012-512-paramSetA" -#define LN_id_tc26_gost_3410_2012_512_paramSetA "GOST R 34.10-2012 (512 bit) ParamSet A" -#define NID_id_tc26_gost_3410_2012_512_paramSetA 998 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetA OBJ_id_tc26_gost_3410_2012_512_constants,1L - -#define SN_id_tc26_gost_3410_2012_512_paramSetB "id-tc26-gost-3410-2012-512-paramSetB" -#define LN_id_tc26_gost_3410_2012_512_paramSetB "GOST R 34.10-2012 (512 bit) ParamSet B" -#define NID_id_tc26_gost_3410_2012_512_paramSetB 999 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetB OBJ_id_tc26_gost_3410_2012_512_constants,2L - -#define SN_id_tc26_gost_3410_2012_512_paramSetC "id-tc26-gost-3410-2012-512-paramSetC" -#define LN_id_tc26_gost_3410_2012_512_paramSetC "GOST R 34.10-2012 (512 bit) ParamSet C" -#define NID_id_tc26_gost_3410_2012_512_paramSetC 1149 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetC OBJ_id_tc26_gost_3410_2012_512_constants,3L - -#define SN_id_tc26_digest_constants "id-tc26-digest-constants" -#define NID_id_tc26_digest_constants 1000 -#define OBJ_id_tc26_digest_constants OBJ_id_tc26_constants,2L - -#define SN_id_tc26_cipher_constants "id-tc26-cipher-constants" -#define NID_id_tc26_cipher_constants 1001 -#define OBJ_id_tc26_cipher_constants OBJ_id_tc26_constants,5L - -#define SN_id_tc26_gost_28147_constants "id-tc26-gost-28147-constants" -#define NID_id_tc26_gost_28147_constants 1002 -#define OBJ_id_tc26_gost_28147_constants OBJ_id_tc26_cipher_constants,1L - -#define SN_id_tc26_gost_28147_param_Z "id-tc26-gost-28147-param-Z" -#define LN_id_tc26_gost_28147_param_Z "GOST 28147-89 TC26 parameter set" -#define NID_id_tc26_gost_28147_param_Z 1003 -#define OBJ_id_tc26_gost_28147_param_Z OBJ_id_tc26_gost_28147_constants,1L - -#define SN_INN "INN" -#define LN_INN "INN" -#define NID_INN 1004 -#define OBJ_INN OBJ_member_body,643L,3L,131L,1L,1L - -#define SN_OGRN "OGRN" -#define LN_OGRN "OGRN" -#define NID_OGRN 1005 -#define OBJ_OGRN OBJ_member_body,643L,100L,1L - -#define SN_SNILS "SNILS" -#define LN_SNILS "SNILS" -#define NID_SNILS 1006 -#define OBJ_SNILS OBJ_member_body,643L,100L,3L - -#define SN_subjectSignTool "subjectSignTool" -#define LN_subjectSignTool "Signing Tool of Subject" -#define NID_subjectSignTool 1007 -#define OBJ_subjectSignTool OBJ_member_body,643L,100L,111L - -#define SN_issuerSignTool "issuerSignTool" -#define LN_issuerSignTool "Signing Tool of Issuer" -#define NID_issuerSignTool 1008 -#define OBJ_issuerSignTool OBJ_member_body,643L,100L,112L - -#define SN_grasshopper_ecb "grasshopper-ecb" -#define NID_grasshopper_ecb 1012 - -#define SN_grasshopper_ctr "grasshopper-ctr" -#define NID_grasshopper_ctr 1013 - -#define SN_grasshopper_ofb "grasshopper-ofb" -#define NID_grasshopper_ofb 1014 - -#define SN_grasshopper_cbc "grasshopper-cbc" -#define NID_grasshopper_cbc 1015 - -#define SN_grasshopper_cfb "grasshopper-cfb" -#define NID_grasshopper_cfb 1016 - -#define SN_grasshopper_mac "grasshopper-mac" -#define NID_grasshopper_mac 1017 - -#define SN_magma_ecb "magma-ecb" -#define NID_magma_ecb 1187 - -#define SN_magma_ctr "magma-ctr" -#define NID_magma_ctr 1188 - -#define SN_magma_ofb "magma-ofb" -#define NID_magma_ofb 1189 - -#define SN_magma_cbc "magma-cbc" -#define NID_magma_cbc 1190 - -#define SN_magma_cfb "magma-cfb" -#define NID_magma_cfb 1191 - -#define SN_magma_mac "magma-mac" -#define NID_magma_mac 1192 - -#define SN_camellia_128_cbc "CAMELLIA-128-CBC" -#define LN_camellia_128_cbc "camellia-128-cbc" -#define NID_camellia_128_cbc 751 -#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L - -#define SN_camellia_192_cbc "CAMELLIA-192-CBC" -#define LN_camellia_192_cbc "camellia-192-cbc" -#define NID_camellia_192_cbc 752 -#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L - -#define SN_camellia_256_cbc "CAMELLIA-256-CBC" -#define LN_camellia_256_cbc "camellia-256-cbc" -#define NID_camellia_256_cbc 753 -#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L - -#define SN_id_camellia128_wrap "id-camellia128-wrap" -#define NID_id_camellia128_wrap 907 -#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L - -#define SN_id_camellia192_wrap "id-camellia192-wrap" -#define NID_id_camellia192_wrap 908 -#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L - -#define SN_id_camellia256_wrap "id-camellia256-wrap" -#define NID_id_camellia256_wrap 909 -#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L - -#define OBJ_ntt_ds 0L,3L,4401L,5L - -#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L - -#define SN_camellia_128_ecb "CAMELLIA-128-ECB" -#define LN_camellia_128_ecb "camellia-128-ecb" -#define NID_camellia_128_ecb 754 -#define OBJ_camellia_128_ecb OBJ_camellia,1L - -#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" -#define LN_camellia_128_ofb128 "camellia-128-ofb" -#define NID_camellia_128_ofb128 766 -#define OBJ_camellia_128_ofb128 OBJ_camellia,3L - -#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" -#define LN_camellia_128_cfb128 "camellia-128-cfb" -#define NID_camellia_128_cfb128 757 -#define OBJ_camellia_128_cfb128 OBJ_camellia,4L - -#define SN_camellia_128_gcm "CAMELLIA-128-GCM" -#define LN_camellia_128_gcm "camellia-128-gcm" -#define NID_camellia_128_gcm 961 -#define OBJ_camellia_128_gcm OBJ_camellia,6L - -#define SN_camellia_128_ccm "CAMELLIA-128-CCM" -#define LN_camellia_128_ccm "camellia-128-ccm" -#define NID_camellia_128_ccm 962 -#define OBJ_camellia_128_ccm OBJ_camellia,7L - -#define SN_camellia_128_ctr "CAMELLIA-128-CTR" -#define LN_camellia_128_ctr "camellia-128-ctr" -#define NID_camellia_128_ctr 963 -#define OBJ_camellia_128_ctr OBJ_camellia,9L - -#define SN_camellia_128_cmac "CAMELLIA-128-CMAC" -#define LN_camellia_128_cmac "camellia-128-cmac" -#define NID_camellia_128_cmac 964 -#define OBJ_camellia_128_cmac OBJ_camellia,10L - -#define SN_camellia_192_ecb "CAMELLIA-192-ECB" -#define LN_camellia_192_ecb "camellia-192-ecb" -#define NID_camellia_192_ecb 755 -#define OBJ_camellia_192_ecb OBJ_camellia,21L - -#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" -#define LN_camellia_192_ofb128 "camellia-192-ofb" -#define NID_camellia_192_ofb128 767 -#define OBJ_camellia_192_ofb128 OBJ_camellia,23L - -#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" -#define LN_camellia_192_cfb128 "camellia-192-cfb" -#define NID_camellia_192_cfb128 758 -#define OBJ_camellia_192_cfb128 OBJ_camellia,24L - -#define SN_camellia_192_gcm "CAMELLIA-192-GCM" -#define LN_camellia_192_gcm "camellia-192-gcm" -#define NID_camellia_192_gcm 965 -#define OBJ_camellia_192_gcm OBJ_camellia,26L - -#define SN_camellia_192_ccm "CAMELLIA-192-CCM" -#define LN_camellia_192_ccm "camellia-192-ccm" -#define NID_camellia_192_ccm 966 -#define OBJ_camellia_192_ccm OBJ_camellia,27L - -#define SN_camellia_192_ctr "CAMELLIA-192-CTR" -#define LN_camellia_192_ctr "camellia-192-ctr" -#define NID_camellia_192_ctr 967 -#define OBJ_camellia_192_ctr OBJ_camellia,29L - -#define SN_camellia_192_cmac "CAMELLIA-192-CMAC" -#define LN_camellia_192_cmac "camellia-192-cmac" -#define NID_camellia_192_cmac 968 -#define OBJ_camellia_192_cmac OBJ_camellia,30L - -#define SN_camellia_256_ecb "CAMELLIA-256-ECB" -#define LN_camellia_256_ecb "camellia-256-ecb" -#define NID_camellia_256_ecb 756 -#define OBJ_camellia_256_ecb OBJ_camellia,41L - -#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" -#define LN_camellia_256_ofb128 "camellia-256-ofb" -#define NID_camellia_256_ofb128 768 -#define OBJ_camellia_256_ofb128 OBJ_camellia,43L - -#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" -#define LN_camellia_256_cfb128 "camellia-256-cfb" -#define NID_camellia_256_cfb128 759 -#define OBJ_camellia_256_cfb128 OBJ_camellia,44L - -#define SN_camellia_256_gcm "CAMELLIA-256-GCM" -#define LN_camellia_256_gcm "camellia-256-gcm" -#define NID_camellia_256_gcm 969 -#define OBJ_camellia_256_gcm OBJ_camellia,46L - -#define SN_camellia_256_ccm "CAMELLIA-256-CCM" -#define LN_camellia_256_ccm "camellia-256-ccm" -#define NID_camellia_256_ccm 970 -#define OBJ_camellia_256_ccm OBJ_camellia,47L - -#define SN_camellia_256_ctr "CAMELLIA-256-CTR" -#define LN_camellia_256_ctr "camellia-256-ctr" -#define NID_camellia_256_ctr 971 -#define OBJ_camellia_256_ctr OBJ_camellia,49L - -#define SN_camellia_256_cmac "CAMELLIA-256-CMAC" -#define LN_camellia_256_cmac "camellia-256-cmac" -#define NID_camellia_256_cmac 972 -#define OBJ_camellia_256_cmac OBJ_camellia,50L - -#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" -#define LN_camellia_128_cfb1 "camellia-128-cfb1" -#define NID_camellia_128_cfb1 760 - -#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" -#define LN_camellia_192_cfb1 "camellia-192-cfb1" -#define NID_camellia_192_cfb1 761 - -#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" -#define LN_camellia_256_cfb1 "camellia-256-cfb1" -#define NID_camellia_256_cfb1 762 - -#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" -#define LN_camellia_128_cfb8 "camellia-128-cfb8" -#define NID_camellia_128_cfb8 763 - -#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" -#define LN_camellia_192_cfb8 "camellia-192-cfb8" -#define NID_camellia_192_cfb8 764 - -#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" -#define LN_camellia_256_cfb8 "camellia-256-cfb8" -#define NID_camellia_256_cfb8 765 - -#define OBJ_aria 1L,2L,410L,200046L,1L,1L - -#define SN_aria_128_ecb "ARIA-128-ECB" -#define LN_aria_128_ecb "aria-128-ecb" -#define NID_aria_128_ecb 1065 -#define OBJ_aria_128_ecb OBJ_aria,1L - -#define SN_aria_128_cbc "ARIA-128-CBC" -#define LN_aria_128_cbc "aria-128-cbc" -#define NID_aria_128_cbc 1066 -#define OBJ_aria_128_cbc OBJ_aria,2L - -#define SN_aria_128_cfb128 "ARIA-128-CFB" -#define LN_aria_128_cfb128 "aria-128-cfb" -#define NID_aria_128_cfb128 1067 -#define OBJ_aria_128_cfb128 OBJ_aria,3L - -#define SN_aria_128_ofb128 "ARIA-128-OFB" -#define LN_aria_128_ofb128 "aria-128-ofb" -#define NID_aria_128_ofb128 1068 -#define OBJ_aria_128_ofb128 OBJ_aria,4L - -#define SN_aria_128_ctr "ARIA-128-CTR" -#define LN_aria_128_ctr "aria-128-ctr" -#define NID_aria_128_ctr 1069 -#define OBJ_aria_128_ctr OBJ_aria,5L - -#define SN_aria_192_ecb "ARIA-192-ECB" -#define LN_aria_192_ecb "aria-192-ecb" -#define NID_aria_192_ecb 1070 -#define OBJ_aria_192_ecb OBJ_aria,6L - -#define SN_aria_192_cbc "ARIA-192-CBC" -#define LN_aria_192_cbc "aria-192-cbc" -#define NID_aria_192_cbc 1071 -#define OBJ_aria_192_cbc OBJ_aria,7L - -#define SN_aria_192_cfb128 "ARIA-192-CFB" -#define LN_aria_192_cfb128 "aria-192-cfb" -#define NID_aria_192_cfb128 1072 -#define OBJ_aria_192_cfb128 OBJ_aria,8L - -#define SN_aria_192_ofb128 "ARIA-192-OFB" -#define LN_aria_192_ofb128 "aria-192-ofb" -#define NID_aria_192_ofb128 1073 -#define OBJ_aria_192_ofb128 OBJ_aria,9L - -#define SN_aria_192_ctr "ARIA-192-CTR" -#define LN_aria_192_ctr "aria-192-ctr" -#define NID_aria_192_ctr 1074 -#define OBJ_aria_192_ctr OBJ_aria,10L - -#define SN_aria_256_ecb "ARIA-256-ECB" -#define LN_aria_256_ecb "aria-256-ecb" -#define NID_aria_256_ecb 1075 -#define OBJ_aria_256_ecb OBJ_aria,11L - -#define SN_aria_256_cbc "ARIA-256-CBC" -#define LN_aria_256_cbc "aria-256-cbc" -#define NID_aria_256_cbc 1076 -#define OBJ_aria_256_cbc OBJ_aria,12L - -#define SN_aria_256_cfb128 "ARIA-256-CFB" -#define LN_aria_256_cfb128 "aria-256-cfb" -#define NID_aria_256_cfb128 1077 -#define OBJ_aria_256_cfb128 OBJ_aria,13L - -#define SN_aria_256_ofb128 "ARIA-256-OFB" -#define LN_aria_256_ofb128 "aria-256-ofb" -#define NID_aria_256_ofb128 1078 -#define OBJ_aria_256_ofb128 OBJ_aria,14L - -#define SN_aria_256_ctr "ARIA-256-CTR" -#define LN_aria_256_ctr "aria-256-ctr" -#define NID_aria_256_ctr 1079 -#define OBJ_aria_256_ctr OBJ_aria,15L - -#define SN_aria_128_cfb1 "ARIA-128-CFB1" -#define LN_aria_128_cfb1 "aria-128-cfb1" -#define NID_aria_128_cfb1 1080 - -#define SN_aria_192_cfb1 "ARIA-192-CFB1" -#define LN_aria_192_cfb1 "aria-192-cfb1" -#define NID_aria_192_cfb1 1081 - -#define SN_aria_256_cfb1 "ARIA-256-CFB1" -#define LN_aria_256_cfb1 "aria-256-cfb1" -#define NID_aria_256_cfb1 1082 - -#define SN_aria_128_cfb8 "ARIA-128-CFB8" -#define LN_aria_128_cfb8 "aria-128-cfb8" -#define NID_aria_128_cfb8 1083 - -#define SN_aria_192_cfb8 "ARIA-192-CFB8" -#define LN_aria_192_cfb8 "aria-192-cfb8" -#define NID_aria_192_cfb8 1084 - -#define SN_aria_256_cfb8 "ARIA-256-CFB8" -#define LN_aria_256_cfb8 "aria-256-cfb8" -#define NID_aria_256_cfb8 1085 - -#define SN_aria_128_ccm "ARIA-128-CCM" -#define LN_aria_128_ccm "aria-128-ccm" -#define NID_aria_128_ccm 1120 -#define OBJ_aria_128_ccm OBJ_aria,37L - -#define SN_aria_192_ccm "ARIA-192-CCM" -#define LN_aria_192_ccm "aria-192-ccm" -#define NID_aria_192_ccm 1121 -#define OBJ_aria_192_ccm OBJ_aria,38L - -#define SN_aria_256_ccm "ARIA-256-CCM" -#define LN_aria_256_ccm "aria-256-ccm" -#define NID_aria_256_ccm 1122 -#define OBJ_aria_256_ccm OBJ_aria,39L - -#define SN_aria_128_gcm "ARIA-128-GCM" -#define LN_aria_128_gcm "aria-128-gcm" -#define NID_aria_128_gcm 1123 -#define OBJ_aria_128_gcm OBJ_aria,34L - -#define SN_aria_192_gcm "ARIA-192-GCM" -#define LN_aria_192_gcm "aria-192-gcm" -#define NID_aria_192_gcm 1124 -#define OBJ_aria_192_gcm OBJ_aria,35L - -#define SN_aria_256_gcm "ARIA-256-GCM" -#define LN_aria_256_gcm "aria-256-gcm" -#define NID_aria_256_gcm 1125 -#define OBJ_aria_256_gcm OBJ_aria,36L - -#define SN_kisa "KISA" -#define LN_kisa "kisa" -#define NID_kisa 773 -#define OBJ_kisa OBJ_member_body,410L,200004L - -#define SN_seed_ecb "SEED-ECB" -#define LN_seed_ecb "seed-ecb" -#define NID_seed_ecb 776 -#define OBJ_seed_ecb OBJ_kisa,1L,3L - -#define SN_seed_cbc "SEED-CBC" -#define LN_seed_cbc "seed-cbc" -#define NID_seed_cbc 777 -#define OBJ_seed_cbc OBJ_kisa,1L,4L - -#define SN_seed_cfb128 "SEED-CFB" -#define LN_seed_cfb128 "seed-cfb" -#define NID_seed_cfb128 779 -#define OBJ_seed_cfb128 OBJ_kisa,1L,5L - -#define SN_seed_ofb128 "SEED-OFB" -#define LN_seed_ofb128 "seed-ofb" -#define NID_seed_ofb128 778 -#define OBJ_seed_ofb128 OBJ_kisa,1L,6L - -#define SN_sm4_ecb "SM4-ECB" -#define LN_sm4_ecb "sm4-ecb" -#define NID_sm4_ecb 1133 -#define OBJ_sm4_ecb OBJ_sm_scheme,104L,1L - -#define SN_sm4_cbc "SM4-CBC" -#define LN_sm4_cbc "sm4-cbc" -#define NID_sm4_cbc 1134 -#define OBJ_sm4_cbc OBJ_sm_scheme,104L,2L - -#define SN_sm4_ofb128 "SM4-OFB" -#define LN_sm4_ofb128 "sm4-ofb" -#define NID_sm4_ofb128 1135 -#define OBJ_sm4_ofb128 OBJ_sm_scheme,104L,3L - -#define SN_sm4_cfb128 "SM4-CFB" -#define LN_sm4_cfb128 "sm4-cfb" -#define NID_sm4_cfb128 1137 -#define OBJ_sm4_cfb128 OBJ_sm_scheme,104L,4L - -#define SN_sm4_cfb1 "SM4-CFB1" -#define LN_sm4_cfb1 "sm4-cfb1" -#define NID_sm4_cfb1 1136 -#define OBJ_sm4_cfb1 OBJ_sm_scheme,104L,5L - -#define SN_sm4_cfb8 "SM4-CFB8" -#define LN_sm4_cfb8 "sm4-cfb8" -#define NID_sm4_cfb8 1138 -#define OBJ_sm4_cfb8 OBJ_sm_scheme,104L,6L - -#define SN_sm4_ctr "SM4-CTR" -#define LN_sm4_ctr "sm4-ctr" -#define NID_sm4_ctr 1139 -#define OBJ_sm4_ctr OBJ_sm_scheme,104L,7L - -#define SN_hmac "HMAC" -#define LN_hmac "hmac" -#define NID_hmac 855 - -#define SN_cmac "CMAC" -#define LN_cmac "cmac" -#define NID_cmac 894 - -#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" -#define LN_rc4_hmac_md5 "rc4-hmac-md5" -#define NID_rc4_hmac_md5 915 - -#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" -#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" -#define NID_aes_128_cbc_hmac_sha1 916 - -#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" -#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" -#define NID_aes_192_cbc_hmac_sha1 917 - -#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" -#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" -#define NID_aes_256_cbc_hmac_sha1 918 - -#define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" -#define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" -#define NID_aes_128_cbc_hmac_sha256 948 - -#define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" -#define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" -#define NID_aes_192_cbc_hmac_sha256 949 - -#define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" -#define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" -#define NID_aes_256_cbc_hmac_sha256 950 - -#define SN_chacha20_poly1305 "ChaCha20-Poly1305" -#define LN_chacha20_poly1305 "chacha20-poly1305" -#define NID_chacha20_poly1305 1018 - -#define SN_chacha20 "ChaCha20" -#define LN_chacha20 "chacha20" -#define NID_chacha20 1019 - -#define SN_dhpublicnumber "dhpublicnumber" -#define LN_dhpublicnumber "X9.42 DH" -#define NID_dhpublicnumber 920 -#define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L - -#define SN_brainpoolP160r1 "brainpoolP160r1" -#define NID_brainpoolP160r1 921 -#define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L - -#define SN_brainpoolP160t1 "brainpoolP160t1" -#define NID_brainpoolP160t1 922 -#define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L - -#define SN_brainpoolP192r1 "brainpoolP192r1" -#define NID_brainpoolP192r1 923 -#define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L - -#define SN_brainpoolP192t1 "brainpoolP192t1" -#define NID_brainpoolP192t1 924 -#define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L - -#define SN_brainpoolP224r1 "brainpoolP224r1" -#define NID_brainpoolP224r1 925 -#define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L - -#define SN_brainpoolP224t1 "brainpoolP224t1" -#define NID_brainpoolP224t1 926 -#define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L - -#define SN_brainpoolP256r1 "brainpoolP256r1" -#define NID_brainpoolP256r1 927 -#define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L - -#define SN_brainpoolP256t1 "brainpoolP256t1" -#define NID_brainpoolP256t1 928 -#define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L - -#define SN_brainpoolP320r1 "brainpoolP320r1" -#define NID_brainpoolP320r1 929 -#define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L - -#define SN_brainpoolP320t1 "brainpoolP320t1" -#define NID_brainpoolP320t1 930 -#define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L - -#define SN_brainpoolP384r1 "brainpoolP384r1" -#define NID_brainpoolP384r1 931 -#define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L - -#define SN_brainpoolP384t1 "brainpoolP384t1" -#define NID_brainpoolP384t1 932 -#define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L - -#define SN_brainpoolP512r1 "brainpoolP512r1" -#define NID_brainpoolP512r1 933 -#define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L - -#define SN_brainpoolP512t1 "brainpoolP512t1" -#define NID_brainpoolP512t1 934 -#define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L - -#define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L - -#define OBJ_secg_scheme OBJ_certicom_arc,1L - -#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" -#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 -#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L - -#define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" -#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 -#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L - -#define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" -#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 -#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L - -#define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" -#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 -#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L - -#define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" -#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 -#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L - -#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 -#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L - -#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 -#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L - -#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 -#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L - -#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 -#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L - -#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 -#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L - -#define SN_dh_std_kdf "dh-std-kdf" -#define NID_dh_std_kdf 946 - -#define SN_dh_cofactor_kdf "dh-cofactor-kdf" -#define NID_dh_cofactor_kdf 947 - -#define SN_ct_precert_scts "ct_precert_scts" -#define LN_ct_precert_scts "CT Precertificate SCTs" -#define NID_ct_precert_scts 951 -#define OBJ_ct_precert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,2L - -#define SN_ct_precert_poison "ct_precert_poison" -#define LN_ct_precert_poison "CT Precertificate Poison" -#define NID_ct_precert_poison 952 -#define OBJ_ct_precert_poison 1L,3L,6L,1L,4L,1L,11129L,2L,4L,3L - -#define SN_ct_precert_signer "ct_precert_signer" -#define LN_ct_precert_signer "CT Precertificate Signer" -#define NID_ct_precert_signer 953 -#define OBJ_ct_precert_signer 1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L - -#define SN_ct_cert_scts "ct_cert_scts" -#define LN_ct_cert_scts "CT Certificate SCTs" -#define NID_ct_cert_scts 954 -#define OBJ_ct_cert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L - -#define SN_jurisdictionLocalityName "jurisdictionL" -#define LN_jurisdictionLocalityName "jurisdictionLocalityName" -#define NID_jurisdictionLocalityName 955 -#define OBJ_jurisdictionLocalityName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,1L - -#define SN_jurisdictionStateOrProvinceName "jurisdictionST" -#define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" -#define NID_jurisdictionStateOrProvinceName 956 -#define OBJ_jurisdictionStateOrProvinceName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,2L - -#define SN_jurisdictionCountryName "jurisdictionC" -#define LN_jurisdictionCountryName "jurisdictionCountryName" -#define NID_jurisdictionCountryName 957 -#define OBJ_jurisdictionCountryName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,3L - -#define SN_id_scrypt "id-scrypt" -#define LN_id_scrypt "scrypt" -#define NID_id_scrypt 973 -#define OBJ_id_scrypt 1L,3L,6L,1L,4L,1L,11591L,4L,11L - -#define SN_tls1_prf "TLS1-PRF" -#define LN_tls1_prf "tls1-prf" -#define NID_tls1_prf 1021 - -#define SN_hkdf "HKDF" -#define LN_hkdf "hkdf" -#define NID_hkdf 1036 - -#define SN_id_pkinit "id-pkinit" -#define NID_id_pkinit 1031 -#define OBJ_id_pkinit 1L,3L,6L,1L,5L,2L,3L - -#define SN_pkInitClientAuth "pkInitClientAuth" -#define LN_pkInitClientAuth "PKINIT Client Auth" -#define NID_pkInitClientAuth 1032 -#define OBJ_pkInitClientAuth OBJ_id_pkinit,4L - -#define SN_pkInitKDC "pkInitKDC" -#define LN_pkInitKDC "Signing KDC Response" -#define NID_pkInitKDC 1033 -#define OBJ_pkInitKDC OBJ_id_pkinit,5L - -#define SN_X25519 "X25519" -#define NID_X25519 1034 -#define OBJ_X25519 1L,3L,101L,110L - -#define SN_X448 "X448" -#define NID_X448 1035 -#define OBJ_X448 1L,3L,101L,111L - -#define SN_ED25519 "ED25519" -#define NID_ED25519 1087 -#define OBJ_ED25519 1L,3L,101L,112L - -#define SN_ED448 "ED448" -#define NID_ED448 1088 -#define OBJ_ED448 1L,3L,101L,113L - -#define SN_kx_rsa "KxRSA" -#define LN_kx_rsa "kx-rsa" -#define NID_kx_rsa 1037 - -#define SN_kx_ecdhe "KxECDHE" -#define LN_kx_ecdhe "kx-ecdhe" -#define NID_kx_ecdhe 1038 - -#define SN_kx_dhe "KxDHE" -#define LN_kx_dhe "kx-dhe" -#define NID_kx_dhe 1039 - -#define SN_kx_ecdhe_psk "KxECDHE-PSK" -#define LN_kx_ecdhe_psk "kx-ecdhe-psk" -#define NID_kx_ecdhe_psk 1040 - -#define SN_kx_dhe_psk "KxDHE-PSK" -#define LN_kx_dhe_psk "kx-dhe-psk" -#define NID_kx_dhe_psk 1041 - -#define SN_kx_rsa_psk "KxRSA_PSK" -#define LN_kx_rsa_psk "kx-rsa-psk" -#define NID_kx_rsa_psk 1042 - -#define SN_kx_psk "KxPSK" -#define LN_kx_psk "kx-psk" -#define NID_kx_psk 1043 - -#define SN_kx_srp "KxSRP" -#define LN_kx_srp "kx-srp" -#define NID_kx_srp 1044 - -#define SN_kx_gost "KxGOST" -#define LN_kx_gost "kx-gost" -#define NID_kx_gost 1045 - -#define SN_kx_any "KxANY" -#define LN_kx_any "kx-any" -#define NID_kx_any 1063 - -#define SN_auth_rsa "AuthRSA" -#define LN_auth_rsa "auth-rsa" -#define NID_auth_rsa 1046 - -#define SN_auth_ecdsa "AuthECDSA" -#define LN_auth_ecdsa "auth-ecdsa" -#define NID_auth_ecdsa 1047 - -#define SN_auth_psk "AuthPSK" -#define LN_auth_psk "auth-psk" -#define NID_auth_psk 1048 - -#define SN_auth_dss "AuthDSS" -#define LN_auth_dss "auth-dss" -#define NID_auth_dss 1049 - -#define SN_auth_gost01 "AuthGOST01" -#define LN_auth_gost01 "auth-gost01" -#define NID_auth_gost01 1050 - -#define SN_auth_gost12 "AuthGOST12" -#define LN_auth_gost12 "auth-gost12" -#define NID_auth_gost12 1051 - -#define SN_auth_srp "AuthSRP" -#define LN_auth_srp "auth-srp" -#define NID_auth_srp 1052 - -#define SN_auth_null "AuthNULL" -#define LN_auth_null "auth-null" -#define NID_auth_null 1053 - -#define SN_auth_any "AuthANY" -#define LN_auth_any "auth-any" -#define NID_auth_any 1064 - -#define SN_poly1305 "Poly1305" -#define LN_poly1305 "poly1305" -#define NID_poly1305 1061 - -#define SN_siphash "SipHash" -#define LN_siphash "siphash" -#define NID_siphash 1062 - -#define SN_ffdhe2048 "ffdhe2048" -#define NID_ffdhe2048 1126 - -#define SN_ffdhe3072 "ffdhe3072" -#define NID_ffdhe3072 1127 - -#define SN_ffdhe4096 "ffdhe4096" -#define NID_ffdhe4096 1128 - -#define SN_ffdhe6144 "ffdhe6144" -#define NID_ffdhe6144 1129 - -#define SN_ffdhe8192 "ffdhe8192" -#define NID_ffdhe8192 1130 - -#define SN_ISO_UA "ISO-UA" -#define NID_ISO_UA 1150 -#define OBJ_ISO_UA OBJ_member_body,804L - -#define SN_ua_pki "ua-pki" -#define NID_ua_pki 1151 -#define OBJ_ua_pki OBJ_ISO_UA,2L,1L,1L,1L - -#define SN_dstu28147 "dstu28147" -#define LN_dstu28147 "DSTU Gost 28147-2009" -#define NID_dstu28147 1152 -#define OBJ_dstu28147 OBJ_ua_pki,1L,1L,1L - -#define SN_dstu28147_ofb "dstu28147-ofb" -#define LN_dstu28147_ofb "DSTU Gost 28147-2009 OFB mode" -#define NID_dstu28147_ofb 1153 -#define OBJ_dstu28147_ofb OBJ_dstu28147,2L - -#define SN_dstu28147_cfb "dstu28147-cfb" -#define LN_dstu28147_cfb "DSTU Gost 28147-2009 CFB mode" -#define NID_dstu28147_cfb 1154 -#define OBJ_dstu28147_cfb OBJ_dstu28147,3L - -#define SN_dstu28147_wrap "dstu28147-wrap" -#define LN_dstu28147_wrap "DSTU Gost 28147-2009 key wrap" -#define NID_dstu28147_wrap 1155 -#define OBJ_dstu28147_wrap OBJ_dstu28147,5L - -#define SN_hmacWithDstu34311 "hmacWithDstu34311" -#define LN_hmacWithDstu34311 "HMAC DSTU Gost 34311-95" -#define NID_hmacWithDstu34311 1156 -#define OBJ_hmacWithDstu34311 OBJ_ua_pki,1L,1L,2L - -#define SN_dstu34311 "dstu34311" -#define LN_dstu34311 "DSTU Gost 34311-95" -#define NID_dstu34311 1157 -#define OBJ_dstu34311 OBJ_ua_pki,1L,2L,1L - -#define SN_dstu4145le "dstu4145le" -#define LN_dstu4145le "DSTU 4145-2002 little endian" -#define NID_dstu4145le 1158 -#define OBJ_dstu4145le OBJ_ua_pki,1L,3L,1L,1L - -#define SN_dstu4145be "dstu4145be" -#define LN_dstu4145be "DSTU 4145-2002 big endian" -#define NID_dstu4145be 1159 -#define OBJ_dstu4145be OBJ_dstu4145le,1L,1L - -#define SN_uacurve0 "uacurve0" -#define LN_uacurve0 "DSTU curve 0" -#define NID_uacurve0 1160 -#define OBJ_uacurve0 OBJ_dstu4145le,2L,0L - -#define SN_uacurve1 "uacurve1" -#define LN_uacurve1 "DSTU curve 1" -#define NID_uacurve1 1161 -#define OBJ_uacurve1 OBJ_dstu4145le,2L,1L - -#define SN_uacurve2 "uacurve2" -#define LN_uacurve2 "DSTU curve 2" -#define NID_uacurve2 1162 -#define OBJ_uacurve2 OBJ_dstu4145le,2L,2L - -#define SN_uacurve3 "uacurve3" -#define LN_uacurve3 "DSTU curve 3" -#define NID_uacurve3 1163 -#define OBJ_uacurve3 OBJ_dstu4145le,2L,3L - -#define SN_uacurve4 "uacurve4" -#define LN_uacurve4 "DSTU curve 4" -#define NID_uacurve4 1164 -#define OBJ_uacurve4 OBJ_dstu4145le,2L,4L - -#define SN_uacurve5 "uacurve5" -#define LN_uacurve5 "DSTU curve 5" -#define NID_uacurve5 1165 -#define OBJ_uacurve5 OBJ_dstu4145le,2L,5L - -#define SN_uacurve6 "uacurve6" -#define LN_uacurve6 "DSTU curve 6" -#define NID_uacurve6 1166 -#define OBJ_uacurve6 OBJ_dstu4145le,2L,6L - -#define SN_uacurve7 "uacurve7" -#define LN_uacurve7 "DSTU curve 7" -#define NID_uacurve7 1167 -#define OBJ_uacurve7 OBJ_dstu4145le,2L,7L - -#define SN_uacurve8 "uacurve8" -#define LN_uacurve8 "DSTU curve 8" -#define NID_uacurve8 1168 -#define OBJ_uacurve8 OBJ_dstu4145le,2L,8L - -#define SN_uacurve9 "uacurve9" -#define LN_uacurve9 "DSTU curve 9" -#define NID_uacurve9 1169 -#define OBJ_uacurve9 OBJ_dstu4145le,2L,9L diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/objects.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/objects.h deleted file mode 100644 index 5e8b5762..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/objects.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 1995-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_OBJECTS_H -# define HEADER_OBJECTS_H - -# include -# include -# include -# include - -# define OBJ_NAME_TYPE_UNDEF 0x00 -# define OBJ_NAME_TYPE_MD_METH 0x01 -# define OBJ_NAME_TYPE_CIPHER_METH 0x02 -# define OBJ_NAME_TYPE_PKEY_METH 0x03 -# define OBJ_NAME_TYPE_COMP_METH 0x04 -# define OBJ_NAME_TYPE_NUM 0x05 - -# define OBJ_NAME_ALIAS 0x8000 - -# define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 -# define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct obj_name_st { - int type; - int alias; - const char *name; - const char *data; -} OBJ_NAME; - -# define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) - -int OBJ_NAME_init(void); -int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), - int (*cmp_func) (const char *, const char *), - void (*free_func) (const char *, int, const char *)); -const char *OBJ_NAME_get(const char *name, int type); -int OBJ_NAME_add(const char *name, int type, const char *data); -int OBJ_NAME_remove(const char *name, int type); -void OBJ_NAME_cleanup(int type); /* -1 for everything */ -void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), - void *arg); -void OBJ_NAME_do_all_sorted(int type, - void (*fn) (const OBJ_NAME *, void *arg), - void *arg); - -ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o); -ASN1_OBJECT *OBJ_nid2obj(int n); -const char *OBJ_nid2ln(int n); -const char *OBJ_nid2sn(int n); -int OBJ_obj2nid(const ASN1_OBJECT *o); -ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); -int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); -int OBJ_txt2nid(const char *s); -int OBJ_ln2nid(const char *s); -int OBJ_sn2nid(const char *s); -int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); -const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, - int (*cmp) (const void *, const void *)); -const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, - int size, - int (*cmp) (const void *, const void *), - int flags); - -# define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ - static int nm##_cmp(type1 const *, type2 const *); \ - scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) - -# define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ - _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) -# define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ - type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) - -/*- - * Unsolved problem: if a type is actually a pointer type, like - * nid_triple is, then its impossible to get a const where you need - * it. Consider: - * - * typedef int nid_triple[3]; - * const void *a_; - * const nid_triple const *a = a_; - * - * The assignment discards a const because what you really want is: - * - * const int const * const *a = a_; - * - * But if you do that, you lose the fact that a is an array of 3 ints, - * which breaks comparison functions. - * - * Thus we end up having to cast, sadly, or unpack the - * declarations. Or, as I finally did in this case, declare nid_triple - * to be a struct, which it should have been in the first place. - * - * Ben, August 2008. - * - * Also, strictly speaking not all types need be const, but handling - * the non-constness means a lot of complication, and in practice - * comparison routines do always not touch their arguments. - */ - -# define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ - { \ - type1 const *a = a_; \ - type2 const *b = b_; \ - return nm##_cmp(a,b); \ - } \ - static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ - { \ - return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ - nm##_cmp_BSEARCH_CMP_FN); \ - } \ - extern void dummy_prototype(void) - -# define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ - { \ - type1 const *a = a_; \ - type2 const *b = b_; \ - return nm##_cmp(a,b); \ - } \ - type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ - { \ - return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ - nm##_cmp_BSEARCH_CMP_FN); \ - } \ - extern void dummy_prototype(void) - -# define OBJ_bsearch(type1,key,type2,base,num,cmp) \ - ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ - num,sizeof(type2), \ - ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ - (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ - cmp##_BSEARCH_CMP_FN))) - -# define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ - ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ - num,sizeof(type2), \ - ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ - (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ - cmp##_BSEARCH_CMP_FN)),flags) - -int OBJ_new_nid(int num); -int OBJ_add_object(const ASN1_OBJECT *obj); -int OBJ_create(const char *oid, const char *sn, const char *ln); -#if OPENSSL_API_COMPAT < 0x10100000L -# define OBJ_cleanup() while(0) continue -#endif -int OBJ_create_objects(BIO *in); - -size_t OBJ_length(const ASN1_OBJECT *obj); -const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); - -int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); -int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); -int OBJ_add_sigid(int signid, int dig_id, int pkey_id); -void OBJ_sigid_free(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/objectserr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/objectserr.h deleted file mode 100644 index 02e166f1..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/objectserr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ocsp.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ocsp.h deleted file mode 100644 index 4d759a49..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ocsp.h +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright 2000-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_OCSP_H -# define HEADER_OCSP_H - -#include - -/* - * These definitions are outside the OPENSSL_NO_OCSP guard because although for - * historical reasons they have OCSP_* names, they can actually be used - * independently of OCSP. E.g. see RFC5280 - */ -/*- - * CRLReason ::= ENUMERATED { - * unspecified (0), - * keyCompromise (1), - * cACompromise (2), - * affiliationChanged (3), - * superseded (4), - * cessationOfOperation (5), - * certificateHold (6), - * removeFromCRL (8) } - */ -# define OCSP_REVOKED_STATUS_NOSTATUS -1 -# define OCSP_REVOKED_STATUS_UNSPECIFIED 0 -# define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 -# define OCSP_REVOKED_STATUS_CACOMPROMISE 2 -# define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 -# define OCSP_REVOKED_STATUS_SUPERSEDED 4 -# define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 -# define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 -# define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 - - -# ifndef OPENSSL_NO_OCSP - -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Various flags and values */ - -# define OCSP_DEFAULT_NONCE_LENGTH 16 - -# define OCSP_NOCERTS 0x1 -# define OCSP_NOINTERN 0x2 -# define OCSP_NOSIGS 0x4 -# define OCSP_NOCHAIN 0x8 -# define OCSP_NOVERIFY 0x10 -# define OCSP_NOEXPLICIT 0x20 -# define OCSP_NOCASIGN 0x40 -# define OCSP_NODELEGATED 0x80 -# define OCSP_NOCHECKS 0x100 -# define OCSP_TRUSTOTHER 0x200 -# define OCSP_RESPID_KEY 0x400 -# define OCSP_NOTIME 0x800 - -typedef struct ocsp_cert_id_st OCSP_CERTID; - -DEFINE_STACK_OF(OCSP_CERTID) - -typedef struct ocsp_one_request_st OCSP_ONEREQ; - -DEFINE_STACK_OF(OCSP_ONEREQ) - -typedef struct ocsp_req_info_st OCSP_REQINFO; -typedef struct ocsp_signature_st OCSP_SIGNATURE; -typedef struct ocsp_request_st OCSP_REQUEST; - -# define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 -# define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 -# define OCSP_RESPONSE_STATUS_INTERNALERROR 2 -# define OCSP_RESPONSE_STATUS_TRYLATER 3 -# define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 -# define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 - -typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES; - -# define V_OCSP_RESPID_NAME 0 -# define V_OCSP_RESPID_KEY 1 - -DEFINE_STACK_OF(OCSP_RESPID) - -typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO; - -# define V_OCSP_CERTSTATUS_GOOD 0 -# define V_OCSP_CERTSTATUS_REVOKED 1 -# define V_OCSP_CERTSTATUS_UNKNOWN 2 - -typedef struct ocsp_cert_status_st OCSP_CERTSTATUS; -typedef struct ocsp_single_response_st OCSP_SINGLERESP; - -DEFINE_STACK_OF(OCSP_SINGLERESP) - -typedef struct ocsp_response_data_st OCSP_RESPDATA; - -typedef struct ocsp_basic_response_st OCSP_BASICRESP; - -typedef struct ocsp_crl_id_st OCSP_CRLID; -typedef struct ocsp_service_locator_st OCSP_SERVICELOC; - -# define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" -# define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" - -# define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) - -# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) - -# define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ - (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST, \ - bp,(char **)(x),cb,NULL) - -# define PEM_read_bio_OCSP_RESPONSE(bp,x,cb) (OCSP_RESPONSE *)PEM_ASN1_read_bio(\ - (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE, \ - bp,(char **)(x),cb,NULL) - -# define PEM_write_bio_OCSP_REQUEST(bp,o) \ - PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ - bp,(char *)(o), NULL,NULL,0,NULL,NULL) - -# define PEM_write_bio_OCSP_RESPONSE(bp,o) \ - PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ - bp,(char *)(o), NULL,NULL,0,NULL,NULL) - -# define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) - -# define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) - -# define ASN1_BIT_STRING_digest(data,type,md,len) \ - ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) - -# define OCSP_CERTSTATUS_dup(cs)\ - (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ - (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) - -OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); - -OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); -OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, - int maxline); -int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx); -int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); -OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline); -void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); -void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); -int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, - ASN1_VALUE *val); -int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval, - const ASN1_ITEM *it); -BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx); -int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path); -int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); -int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, - const char *name, const char *value); - -OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject, - const X509 *issuer); - -OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, - const X509_NAME *issuerName, - const ASN1_BIT_STRING *issuerKey, - const ASN1_INTEGER *serialNumber); - -OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); - -int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); -int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); -int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); -int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); - -int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); -int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); - -int OCSP_request_sign(OCSP_REQUEST *req, - X509 *signer, - EVP_PKEY *key, - const EVP_MD *dgst, - STACK_OF(X509) *certs, unsigned long flags); - -int OCSP_response_status(OCSP_RESPONSE *resp); -OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); - -const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs); -const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs); -const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs); -int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, - STACK_OF(X509) *extra_certs); - -int OCSP_resp_count(OCSP_BASICRESP *bs); -OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); -const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP* bs); -const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs); -int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, - const ASN1_OCTET_STRING **pid, - const X509_NAME **pname); -int OCSP_resp_get1_id(const OCSP_BASICRESP *bs, - ASN1_OCTET_STRING **pid, - X509_NAME **pname); - -int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); -int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, - ASN1_GENERALIZEDTIME **revtime, - ASN1_GENERALIZEDTIME **thisupd, - ASN1_GENERALIZEDTIME **nextupd); -int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, - int *reason, - ASN1_GENERALIZEDTIME **revtime, - ASN1_GENERALIZEDTIME **thisupd, - ASN1_GENERALIZEDTIME **nextupd); -int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, - ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); - -int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, - X509_STORE *store, unsigned long flags); - -int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, - int *pssl); - -int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); -int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); - -int OCSP_request_onereq_count(OCSP_REQUEST *req); -OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); -OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); -int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, - ASN1_OCTET_STRING **pikeyHash, - ASN1_INTEGER **pserial, OCSP_CERTID *cid); -int OCSP_request_is_signed(OCSP_REQUEST *req); -OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); -OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, - OCSP_CERTID *cid, - int status, int reason, - ASN1_TIME *revtime, - ASN1_TIME *thisupd, - ASN1_TIME *nextupd); -int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); -int OCSP_basic_sign(OCSP_BASICRESP *brsp, - X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, - STACK_OF(X509) *certs, unsigned long flags); -int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, - X509 *signer, EVP_MD_CTX *ctx, - STACK_OF(X509) *certs, unsigned long flags); -int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert); -int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert); -int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert); - -X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim); - -X509_EXTENSION *OCSP_accept_responses_new(char **oids); - -X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); - -X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, const char **urls); - -int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); -int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); -int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); -X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); -X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); -void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, - int *idx); -int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, - unsigned long flags); -int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); - -int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); -int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); -int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos); -int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); -X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); -X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); -void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); -int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, - unsigned long flags); -int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); - -int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); -int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); -int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, - int lastpos); -X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); -X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); -void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, - int *idx); -int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, - int crit, unsigned long flags); -int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); - -int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); -int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); -int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, - int lastpos); -X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); -X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); -void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, - int *idx); -int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, - int crit, unsigned long flags); -int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); -const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x); - -DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) -DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) -DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) -DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) -DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) -DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) -DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) -DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) -DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) -DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) -DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) - -const char *OCSP_response_status_str(long s); -const char *OCSP_cert_status_str(long s); -const char *OCSP_crl_reason_str(long s); - -int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); -int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); - -int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, - X509_STORE *st, unsigned long flags); - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ocsperr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ocsperr.h deleted file mode 100644 index 8dd9e01a..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ocsperr.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/opensslconf.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/opensslconf.h deleted file mode 100644 index 1b0705db..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/opensslconf.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * WARNING: do not edit! - * Generated by Makefile from include/openssl/opensslconf.h.in - * - * 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 - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef OPENSSL_ALGORITHM_DEFINES -# error OPENSSL_ALGORITHM_DEFINES no longer supported -#endif - -/* - * OpenSSL was configured with the following options: - */ - -#ifndef OPENSSL_NO_MD2 -# define OPENSSL_NO_MD2 -#endif -#ifndef OPENSSL_NO_RC5 -# define OPENSSL_NO_RC5 -#endif -#ifndef OPENSSL_THREADS -# define OPENSSL_THREADS -#endif -#ifndef OPENSSL_RAND_SEED_OS -# define OPENSSL_RAND_SEED_OS -#endif -#ifndef OPENSSL_NO_AFALGENG -# define OPENSSL_NO_AFALGENG -#endif -#ifndef OPENSSL_NO_ASAN -# define OPENSSL_NO_ASAN -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG -# define OPENSSL_NO_CRYPTO_MDEBUG -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -#endif -#ifndef OPENSSL_NO_DEVCRYPTOENG -# define OPENSSL_NO_DEVCRYPTOENG -#endif -#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -# define OPENSSL_NO_EC_NISTP_64_GCC_128 -#endif -#ifndef OPENSSL_NO_EGD -# define OPENSSL_NO_EGD -#endif -#ifndef OPENSSL_NO_EXTERNAL_TESTS -# define OPENSSL_NO_EXTERNAL_TESTS -#endif -#ifndef OPENSSL_NO_FUZZ_AFL -# define OPENSSL_NO_FUZZ_AFL -#endif -#ifndef OPENSSL_NO_FUZZ_LIBFUZZER -# define OPENSSL_NO_FUZZ_LIBFUZZER -#endif -#ifndef OPENSSL_NO_HEARTBEATS -# define OPENSSL_NO_HEARTBEATS -#endif -#ifndef OPENSSL_NO_MSAN -# define OPENSSL_NO_MSAN -#endif -#ifndef OPENSSL_NO_SCTP -# define OPENSSL_NO_SCTP -#endif -#ifndef OPENSSL_NO_SSL_TRACE -# define OPENSSL_NO_SSL_TRACE -#endif -#ifndef OPENSSL_NO_SSL3 -# define OPENSSL_NO_SSL3 -#endif -#ifndef OPENSSL_NO_SSL3_METHOD -# define OPENSSL_NO_SSL3_METHOD -#endif -#ifndef OPENSSL_NO_UBSAN -# define OPENSSL_NO_UBSAN -#endif -#ifndef OPENSSL_NO_UNIT_TEST -# define OPENSSL_NO_UNIT_TEST -#endif -#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS -# define OPENSSL_NO_WEAK_SSL_CIPHERS -#endif -#ifndef OPENSSL_NO_STATIC_ENGINE -# define OPENSSL_NO_STATIC_ENGINE -#endif - - -/* - * 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= to suppress the - * declarations of functions deprecated in or before . 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 -# 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? */ -#undef I386_ONLY - -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* - * The following are cipher-specific, but are part of the public API. - */ -#if !defined(OPENSSL_SYS_UEFI) -# undef BN_LLONG -/* Only one for the following should be defined */ -# define SIXTY_FOUR_BIT_LONG -# undef SIXTY_FOUR_BIT -# undef THIRTY_TWO_BIT -#endif - -#define RC4_INT unsigned char - -#ifdef __cplusplus -} -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/opensslv.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/opensslv.h deleted file mode 100644 index 17d271f5..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/opensslv.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 1999-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_OPENSSLV_H -# define HEADER_OPENSSLV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*- - * Numeric release version identifier: - * MNNFFPPS: major minor fix patch status - * The status nibble has one of the values 0 for development, 1 to e for betas - * 1 to 14, and f for release. The patch level is exactly that. - * For example: - * 0.9.3-dev 0x00903000 - * 0.9.3-beta1 0x00903001 - * 0.9.3-beta2-dev 0x00903002 - * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) - * 0.9.3 0x0090300f - * 0.9.3a 0x0090301f - * 0.9.4 0x0090400f - * 1.2.3z 0x102031af - * - * For continuity reasons (because 0.9.5 is already out, and is coded - * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level - * part is slightly different, by setting the highest bit. This means - * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start - * with 0x0090600S... - * - * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) - * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for - * major minor fix final patch/beta) - */ -# define OPENSSL_VERSION_NUMBER 0x1010107fL -# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1g 21 Apr 2020" - -/*- - * The macros below are to be used for shared library (.so, .dll, ...) - * versioning. That kind of versioning works a bit differently between - * operating systems. The most usual scheme is to set a major and a minor - * number, and have the runtime loader check that the major number is equal - * to what it was at application link time, while the minor number has to - * be greater or equal to what it was at application link time. With this - * scheme, the version number is usually part of the file name, like this: - * - * libcrypto.so.0.9 - * - * Some unixen also make a softlink with the major version number only: - * - * libcrypto.so.0 - * - * On Tru64 and IRIX 6.x it works a little bit differently. There, the - * shared library version is stored in the file, and is actually a series - * of versions, separated by colons. The rightmost version present in the - * library when linking an application is stored in the application to be - * matched at run time. When the application is run, a check is done to - * see if the library version stored in the application matches any of the - * versions in the version string of the library itself. - * This version string can be constructed in any way, depending on what - * kind of matching is desired. However, to implement the same scheme as - * the one used in the other unixen, all compatible versions, from lowest - * to highest, should be part of the string. Consecutive builds would - * give the following versions strings: - * - * 3.0 - * 3.0:3.1 - * 3.0:3.1:3.2 - * 4.0 - * 4.0:4.1 - * - * Notice how version 4 is completely incompatible with version, and - * therefore give the breach you can see. - * - * There may be other schemes as well that I haven't yet discovered. - * - * So, here's the way it works here: first of all, the library version - * number doesn't need at all to match the overall OpenSSL version. - * However, it's nice and more understandable if it actually does. - * The current library version is stored in the macro SHLIB_VERSION_NUMBER, - * which is just a piece of text in the format "M.m.e" (Major, minor, edit). - * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, - * we need to keep a history of version numbers, which is done in the - * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and - * should only keep the versions that are binary compatible with the current. - */ -# define SHLIB_VERSION_HISTORY "" -# define SHLIB_VERSION_NUMBER "1.1" - - -#ifdef __cplusplus -} -#endif -#endif /* HEADER_OPENSSLV_H */ diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ossl_typ.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ossl_typ.h deleted file mode 100644 index e0edfaaf..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ossl_typ.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2001-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_OPENSSL_TYPES_H -# define HEADER_OPENSSL_TYPES_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -# include - -# ifdef NO_ASN1_TYPEDEFS -# define ASN1_INTEGER ASN1_STRING -# define ASN1_ENUMERATED ASN1_STRING -# define ASN1_BIT_STRING ASN1_STRING -# define ASN1_OCTET_STRING ASN1_STRING -# define ASN1_PRINTABLESTRING ASN1_STRING -# define ASN1_T61STRING ASN1_STRING -# define ASN1_IA5STRING ASN1_STRING -# define ASN1_UTCTIME ASN1_STRING -# define ASN1_GENERALIZEDTIME ASN1_STRING -# define ASN1_TIME ASN1_STRING -# define ASN1_GENERALSTRING ASN1_STRING -# define ASN1_UNIVERSALSTRING ASN1_STRING -# define ASN1_BMPSTRING ASN1_STRING -# define ASN1_VISIBLESTRING ASN1_STRING -# define ASN1_UTF8STRING ASN1_STRING -# define ASN1_BOOLEAN int -# define ASN1_NULL int -# else -typedef struct asn1_string_st ASN1_INTEGER; -typedef struct asn1_string_st ASN1_ENUMERATED; -typedef struct asn1_string_st ASN1_BIT_STRING; -typedef struct asn1_string_st ASN1_OCTET_STRING; -typedef struct asn1_string_st ASN1_PRINTABLESTRING; -typedef struct asn1_string_st ASN1_T61STRING; -typedef struct asn1_string_st ASN1_IA5STRING; -typedef struct asn1_string_st ASN1_GENERALSTRING; -typedef struct asn1_string_st ASN1_UNIVERSALSTRING; -typedef struct asn1_string_st ASN1_BMPSTRING; -typedef struct asn1_string_st ASN1_UTCTIME; -typedef struct asn1_string_st ASN1_TIME; -typedef struct asn1_string_st ASN1_GENERALIZEDTIME; -typedef struct asn1_string_st ASN1_VISIBLESTRING; -typedef struct asn1_string_st ASN1_UTF8STRING; -typedef struct asn1_string_st ASN1_STRING; -typedef int ASN1_BOOLEAN; -typedef int ASN1_NULL; -# endif - -typedef struct asn1_object_st ASN1_OBJECT; - -typedef struct ASN1_ITEM_st ASN1_ITEM; -typedef struct asn1_pctx_st ASN1_PCTX; -typedef struct asn1_sctx_st ASN1_SCTX; - -# ifdef _WIN32 -# undef X509_NAME -# undef X509_EXTENSIONS -# undef PKCS7_ISSUER_AND_SERIAL -# undef PKCS7_SIGNER_INFO -# undef OCSP_REQUEST -# undef OCSP_RESPONSE -# endif - -# ifdef BIGNUM -# undef BIGNUM -# endif -struct dane_st; -typedef struct bio_st BIO; -typedef struct bignum_st BIGNUM; -typedef struct bignum_ctx BN_CTX; -typedef struct bn_blinding_st BN_BLINDING; -typedef struct bn_mont_ctx_st BN_MONT_CTX; -typedef struct bn_recp_ctx_st BN_RECP_CTX; -typedef struct bn_gencb_st BN_GENCB; - -typedef struct buf_mem_st BUF_MEM; - -typedef struct evp_cipher_st EVP_CIPHER; -typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; -typedef struct evp_md_st EVP_MD; -typedef struct evp_md_ctx_st EVP_MD_CTX; -typedef struct evp_pkey_st EVP_PKEY; - -typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; - -typedef struct evp_pkey_method_st EVP_PKEY_METHOD; -typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; - -typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; - -typedef struct hmac_ctx_st HMAC_CTX; - -typedef struct dh_st DH; -typedef struct dh_method DH_METHOD; - -typedef struct dsa_st DSA; -typedef struct dsa_method DSA_METHOD; - -typedef struct rsa_st RSA; -typedef struct rsa_meth_st RSA_METHOD; -typedef struct rsa_pss_params_st RSA_PSS_PARAMS; - -typedef struct ec_key_st EC_KEY; -typedef struct ec_key_method_st EC_KEY_METHOD; - -typedef struct rand_meth_st RAND_METHOD; -typedef struct rand_drbg_st RAND_DRBG; - -typedef struct ssl_dane_st SSL_DANE; -typedef struct x509_st X509; -typedef struct X509_algor_st X509_ALGOR; -typedef struct X509_crl_st X509_CRL; -typedef struct x509_crl_method_st X509_CRL_METHOD; -typedef struct x509_revoked_st X509_REVOKED; -typedef struct X509_name_st X509_NAME; -typedef struct X509_pubkey_st X509_PUBKEY; -typedef struct x509_store_st X509_STORE; -typedef struct x509_store_ctx_st X509_STORE_CTX; - -typedef struct x509_object_st X509_OBJECT; -typedef struct x509_lookup_st X509_LOOKUP; -typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; -typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; - -typedef struct x509_sig_info_st X509_SIG_INFO; - -typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; - -typedef struct v3_ext_ctx X509V3_CTX; -typedef struct conf_st CONF; -typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS; - -typedef struct ui_st UI; -typedef struct ui_method_st UI_METHOD; - -typedef struct engine_st ENGINE; -typedef struct ssl_st SSL; -typedef struct ssl_ctx_st SSL_CTX; - -typedef struct comp_ctx_st COMP_CTX; -typedef struct comp_method_st COMP_METHOD; - -typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; -typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; -typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; -typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; - -typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; -typedef struct DIST_POINT_st DIST_POINT; -typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; -typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; - -typedef struct crypto_ex_data_st CRYPTO_EX_DATA; - -typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; -typedef struct ocsp_response_st OCSP_RESPONSE; -typedef struct ocsp_responder_id_st OCSP_RESPID; - -typedef struct sct_st SCT; -typedef struct sct_ctx_st SCT_CTX; -typedef struct ctlog_st CTLOG; -typedef struct ctlog_store_st CTLOG_STORE; -typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX; - -typedef struct ossl_store_info_st OSSL_STORE_INFO; -typedef struct ossl_store_search_st OSSL_STORE_SEARCH; - -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ - defined(INTMAX_MAX) && defined(UINTMAX_MAX) -typedef intmax_t ossl_intmax_t; -typedef uintmax_t ossl_uintmax_t; -#else -/* - * Not long long, because the C-library can only be expected to provide - * strtoll(), strtoull() at the same time as intmax_t and strtoimax(), - * strtoumax(). Since we use these for parsing arguments, we need the - * conversion functions, not just the sizes. - */ -typedef long ossl_intmax_t; -typedef unsigned long ossl_uintmax_t; -#endif - -#ifdef __cplusplus -} -#endif -#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pem.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pem.h deleted file mode 100644 index 2ef5b5d0..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pem.h +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright 1995-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_PEM_H -# define HEADER_PEM_H - -# include -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define PEM_BUFSIZE 1024 - -# define PEM_STRING_X509_OLD "X509 CERTIFICATE" -# define PEM_STRING_X509 "CERTIFICATE" -# define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" -# define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" -# define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" -# define PEM_STRING_X509_CRL "X509 CRL" -# define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" -# define PEM_STRING_PUBLIC "PUBLIC KEY" -# define PEM_STRING_RSA "RSA PRIVATE KEY" -# define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" -# define PEM_STRING_DSA "DSA PRIVATE KEY" -# define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" -# define PEM_STRING_PKCS7 "PKCS7" -# define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" -# define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" -# define PEM_STRING_PKCS8INF "PRIVATE KEY" -# define PEM_STRING_DHPARAMS "DH PARAMETERS" -# define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" -# define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" -# define PEM_STRING_DSAPARAMS "DSA PARAMETERS" -# define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" -# define PEM_STRING_ECPARAMETERS "EC PARAMETERS" -# define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" -# define PEM_STRING_PARAMETERS "PARAMETERS" -# define PEM_STRING_CMS "CMS" - -# define PEM_TYPE_ENCRYPTED 10 -# define PEM_TYPE_MIC_ONLY 20 -# define PEM_TYPE_MIC_CLEAR 30 -# define PEM_TYPE_CLEAR 40 - -/* - * These macros make the PEM_read/PEM_write functions easier to maintain and - * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or - * IMPLEMENT_PEM_rw_cb(...) - */ - -# ifdef OPENSSL_NO_STDIO - -# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ -# else - -# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ -type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ -{ \ -return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ -} - -# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x) \ -{ \ -return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, const type *x) \ -{ \ -return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, \ - void *u) \ - { \ - return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, \ - void *u) \ - { \ - return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ - } - -# endif - -# define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ -type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ -{ \ -return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ -} - -# define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x) \ -{ \ -return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, const type *x) \ -{ \ -return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ - { \ - return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ - { \ - return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write(name, type, str, asn1) \ - IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_write_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_read_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb(name, type, str, asn1) - -/* These are the same except they are for the declarations */ - -# if defined(OPENSSL_NO_STDIO) - -# define DECLARE_PEM_read_fp(name, type) /**/ -# define DECLARE_PEM_write_fp(name, type) /**/ -# define DECLARE_PEM_write_fp_const(name, type) /**/ -# define DECLARE_PEM_write_cb_fp(name, type) /**/ -# else - -# define DECLARE_PEM_read_fp(name, type) \ - type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write_fp(name, type) \ - int PEM_write_##name(FILE *fp, type *x); - -# define DECLARE_PEM_write_fp_const(name, type) \ - int PEM_write_##name(FILE *fp, const type *x); - -# define DECLARE_PEM_write_cb_fp(name, type) \ - int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u); - -# endif - -# define DECLARE_PEM_read_bio(name, type) \ - type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write_bio(name, type) \ - int PEM_write_bio_##name(BIO *bp, type *x); - -# define DECLARE_PEM_write_bio_const(name, type) \ - int PEM_write_bio_##name(BIO *bp, const type *x); - -# define DECLARE_PEM_write_cb_bio(name, type) \ - int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write(name, type) \ - DECLARE_PEM_write_bio(name, type) \ - DECLARE_PEM_write_fp(name, type) -# define DECLARE_PEM_write_const(name, type) \ - DECLARE_PEM_write_bio_const(name, type) \ - DECLARE_PEM_write_fp_const(name, type) -# define DECLARE_PEM_write_cb(name, type) \ - DECLARE_PEM_write_cb_bio(name, type) \ - DECLARE_PEM_write_cb_fp(name, type) -# define DECLARE_PEM_read(name, type) \ - DECLARE_PEM_read_bio(name, type) \ - DECLARE_PEM_read_fp(name, type) -# define DECLARE_PEM_rw(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write(name, type) -# define DECLARE_PEM_rw_const(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write_const(name, type) -# define DECLARE_PEM_rw_cb(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write_cb(name, type) -typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); - -int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); -int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, - pem_password_cb *callback, void *u); - -int PEM_read_bio(BIO *bp, char **name, char **header, - unsigned char **data, long *len); -# define PEM_FLAG_SECURE 0x1 -# define PEM_FLAG_EAY_COMPATIBLE 0x2 -# define PEM_FLAG_ONLY_B64 0x4 -int PEM_read_bio_ex(BIO *bp, char **name, char **header, - unsigned char **data, long *len, unsigned int flags); -int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, - const char *name, BIO *bp, pem_password_cb *cb, - void *u); -int PEM_write_bio(BIO *bp, const char *name, const char *hdr, - const unsigned char *data, long len); -int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, - const char *name, BIO *bp, pem_password_cb *cb, - void *u); -void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, - pem_password_cb *cb, void *u); -int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, - const EVP_CIPHER *enc, unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - -STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u); -int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cd, void *u); - -#ifndef OPENSSL_NO_STDIO -int PEM_read(FILE *fp, char **name, char **header, - unsigned char **data, long *len); -int PEM_write(FILE *fp, const char *name, const char *hdr, - const unsigned char *data, long len); -void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, - pem_password_cb *cb, void *u); -int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, - void *x, const EVP_CIPHER *enc, unsigned char *kstr, - int klen, pem_password_cb *callback, void *u); -STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u); -#endif - -int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); -int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); -int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, - unsigned int *siglen, EVP_PKEY *pkey); - -/* The default pem_password_cb that's used internally */ -int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); -void PEM_proc_type(char *buf, int type); -void PEM_dek_info(char *buf, const char *type, int len, char *str); - -# include - -DECLARE_PEM_rw(X509, X509) -DECLARE_PEM_rw(X509_AUX, X509) -DECLARE_PEM_rw(X509_REQ, X509_REQ) -DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) -DECLARE_PEM_rw(X509_CRL, X509_CRL) -DECLARE_PEM_rw(PKCS7, PKCS7) -DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) -DECLARE_PEM_rw(PKCS8, X509_SIG) -DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) -# ifndef OPENSSL_NO_RSA -DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) -DECLARE_PEM_rw_const(RSAPublicKey, RSA) -DECLARE_PEM_rw(RSA_PUBKEY, RSA) -# endif -# ifndef OPENSSL_NO_DSA -DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) -DECLARE_PEM_rw(DSA_PUBKEY, DSA) -DECLARE_PEM_rw_const(DSAparams, DSA) -# endif -# ifndef OPENSSL_NO_EC -DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) -DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) -DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) -# endif -# ifndef OPENSSL_NO_DH -DECLARE_PEM_rw_const(DHparams, DH) -DECLARE_PEM_write_const(DHxparams, DH) -# endif -DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) -DECLARE_PEM_rw(PUBKEY, EVP_PKEY) - -int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, - const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - -int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, - char *, int, pem_password_cb *, void *); -int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, - void *u); - -# ifndef OPENSSL_NO_STDIO -int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); - -EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, - void *u); - -int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, pem_password_cb *cd, - void *u); -# endif -EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); -int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); - -# ifndef OPENSSL_NO_DSA -EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); -EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); -EVP_PKEY *b2i_PrivateKey_bio(BIO *in); -EVP_PKEY *b2i_PublicKey_bio(BIO *in); -int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); -int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); -# ifndef OPENSSL_NO_RC4 -EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); -int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, - pem_password_cb *cb, void *u); -# endif -# endif - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pem2.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pem2.h deleted file mode 100644 index 038fe790..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pem2.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 1999-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_PEM2_H -# define HEADER_PEM2_H -# include -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pemerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pemerr.h deleted file mode 100644 index 0c45918f..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pemerr.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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_PEMERR_H -# define HEADER_PEMERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PEM_strings(void); - -/* - * PEM function codes. - */ -# define PEM_F_B2I_DSS 127 -# define PEM_F_B2I_PVK_BIO 128 -# define PEM_F_B2I_RSA 129 -# define PEM_F_CHECK_BITLEN_DSA 130 -# define PEM_F_CHECK_BITLEN_RSA 131 -# define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 -# define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 -# define PEM_F_DO_B2I 132 -# define PEM_F_DO_B2I_BIO 133 -# define PEM_F_DO_BLOB_HEADER 134 -# define PEM_F_DO_I2B 146 -# define PEM_F_DO_PK8PKEY 126 -# define PEM_F_DO_PK8PKEY_FP 125 -# define PEM_F_DO_PVK_BODY 135 -# define PEM_F_DO_PVK_HEADER 136 -# define PEM_F_GET_HEADER_AND_DATA 143 -# define PEM_F_GET_NAME 144 -# define PEM_F_I2B_PVK 137 -# define PEM_F_I2B_PVK_BIO 138 -# define PEM_F_LOAD_IV 101 -# define PEM_F_PEM_ASN1_READ 102 -# define PEM_F_PEM_ASN1_READ_BIO 103 -# define PEM_F_PEM_ASN1_WRITE 104 -# define PEM_F_PEM_ASN1_WRITE_BIO 105 -# define PEM_F_PEM_DEF_CALLBACK 100 -# define PEM_F_PEM_DO_HEADER 106 -# define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 -# define PEM_F_PEM_READ 108 -# define PEM_F_PEM_READ_BIO 109 -# define PEM_F_PEM_READ_BIO_DHPARAMS 141 -# define PEM_F_PEM_READ_BIO_EX 145 -# define PEM_F_PEM_READ_BIO_PARAMETERS 140 -# define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 -# define PEM_F_PEM_READ_DHPARAMS 142 -# define PEM_F_PEM_READ_PRIVATEKEY 124 -# define PEM_F_PEM_SIGNFINAL 112 -# define PEM_F_PEM_WRITE 113 -# define PEM_F_PEM_WRITE_BIO 114 -# define PEM_F_PEM_WRITE_PRIVATEKEY 139 -# define PEM_F_PEM_X509_INFO_READ 115 -# define PEM_F_PEM_X509_INFO_READ_BIO 116 -# define PEM_F_PEM_X509_INFO_WRITE_BIO 117 - -/* - * PEM reason codes. - */ -# define PEM_R_BAD_BASE64_DECODE 100 -# define PEM_R_BAD_DECRYPT 101 -# define PEM_R_BAD_END_LINE 102 -# define PEM_R_BAD_IV_CHARS 103 -# define PEM_R_BAD_MAGIC_NUMBER 116 -# define PEM_R_BAD_PASSWORD_READ 104 -# define PEM_R_BAD_VERSION_NUMBER 117 -# define PEM_R_BIO_WRITE_FAILURE 118 -# define PEM_R_CIPHER_IS_NULL 127 -# define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 -# define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 -# define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 -# define PEM_R_HEADER_TOO_LONG 128 -# define PEM_R_INCONSISTENT_HEADER 121 -# define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 -# define PEM_R_KEYBLOB_TOO_SHORT 123 -# define PEM_R_MISSING_DEK_IV 129 -# define PEM_R_NOT_DEK_INFO 105 -# define PEM_R_NOT_ENCRYPTED 106 -# define PEM_R_NOT_PROC_TYPE 107 -# define PEM_R_NO_START_LINE 108 -# define PEM_R_PROBLEMS_GETTING_PASSWORD 109 -# define PEM_R_PVK_DATA_TOO_SHORT 124 -# define PEM_R_PVK_TOO_SHORT 125 -# define PEM_R_READ_KEY 111 -# define PEM_R_SHORT_HEADER 112 -# define PEM_R_UNEXPECTED_DEK_IV 130 -# define PEM_R_UNSUPPORTED_CIPHER 113 -# define PEM_R_UNSUPPORTED_ENCRYPTION 114 -# define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs12.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs12.h deleted file mode 100644 index 3f43dad6..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs12.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 1999-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_PKCS12_H -# define HEADER_PKCS12_H - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define PKCS12_KEY_ID 1 -# define PKCS12_IV_ID 2 -# define PKCS12_MAC_ID 3 - -/* Default iteration count */ -# ifndef PKCS12_DEFAULT_ITER -# define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER -# endif - -# define PKCS12_MAC_KEY_LENGTH 20 - -# define PKCS12_SALT_LEN 8 - -/* It's not clear if these are actually needed... */ -# define PKCS12_key_gen PKCS12_key_gen_utf8 -# define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8 - -/* MS key usage constants */ - -# define KEY_EX 0x10 -# define KEY_SIG 0x80 - -typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; - -typedef struct PKCS12_st PKCS12; - -typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; - -DEFINE_STACK_OF(PKCS12_SAFEBAG) - -typedef struct pkcs12_bag_st PKCS12_BAGS; - -# define PKCS12_ERROR 0 -# define PKCS12_OK 1 - -/* Compatibility macros */ - -#if OPENSSL_API_COMPAT < 0x10100000L - -# define M_PKCS12_bag_type PKCS12_bag_type -# define M_PKCS12_cert_bag_type PKCS12_cert_bag_type -# define M_PKCS12_crl_bag_type PKCS12_cert_bag_type - -# define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert -# define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl -# define PKCS12_bag_type PKCS12_SAFEBAG_get_nid -# define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid -# define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert -# define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl -# define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf -# define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt - -#endif - -DEPRECATEDIN_1_1_0(ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, int attr_nid)) - -ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid); -int PKCS12_mac_present(const PKCS12 *p12); -void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, - const X509_ALGOR **pmacalg, - const ASN1_OCTET_STRING **psalt, - const ASN1_INTEGER **piter, - const PKCS12 *p12); - -const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, - int attr_nid); -const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); -int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag); -int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag); - -X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag); -X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag); -const STACK_OF(PKCS12_SAFEBAG) * -PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); -const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag); -const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag); - -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, - const char *pass, - int passlen, - unsigned char *salt, - int saltlen, int iter, - PKCS8_PRIV_KEY_INFO *p8inf); - -PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, - int nid1, int nid2); -PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, - int passlen); -PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag, - const char *pass, int passlen); -X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, - const char *pass, int passlen, unsigned char *salt, - int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); -X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen, - PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe); -PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); -STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); -PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, - unsigned char *salt, int saltlen, int iter, - STACK_OF(PKCS12_SAFEBAG) *bags); -STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, - int passlen); - -int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); -STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12); - -int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, - int namelen); -int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, - const unsigned char *name, int namelen); -int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); -ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, - int attr_nid); -char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); -const STACK_OF(X509_ATTRIBUTE) * -PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag); -unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, - const char *pass, int passlen, - const unsigned char *in, int inlen, - unsigned char **data, int *datalen, - int en_de); -void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, - const char *pass, int passlen, - const ASN1_OCTET_STRING *oct, int zbuf); -ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, - const ASN1_ITEM *it, - const char *pass, int passlen, - void *obj, int zbuf); -PKCS12 *PKCS12_init(int mode); -int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md_type, int en_de); -int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, - unsigned char *mac, unsigned int *maclen); -int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); -int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, - unsigned char *salt, int saltlen, int iter, - const EVP_MD *md_type); -int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, - int saltlen, const EVP_MD *md_type); -unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, - unsigned char **uni, int *unilen); -char *OPENSSL_uni2asc(const unsigned char *uni, int unilen); -unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, - unsigned char **uni, int *unilen); -char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen); - -DECLARE_ASN1_FUNCTIONS(PKCS12) -DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) -DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) -DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) - -DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) -DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) - -void PKCS12_PBE_add(void); -int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, - STACK_OF(X509) **ca); -PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, - X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, - int iter, int mac_iter, int keytype); - -PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); -PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, - EVP_PKEY *key, int key_usage, int iter, - int key_nid, const char *pass); -int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, - int safe_nid, int iter, const char *pass); -PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); - -int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); -# ifndef OPENSSL_NO_STDIO -int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); -# endif -PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); -# ifndef OPENSSL_NO_STDIO -PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); -# endif -int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs12err.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs12err.h deleted file mode 100644 index eff5eb26..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs12err.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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_PKCS12ERR_H -# define HEADER_PKCS12ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PKCS12_strings(void); - -/* - * PKCS12 function codes. - */ -# define PKCS12_F_OPENSSL_ASC2UNI 121 -# define PKCS12_F_OPENSSL_UNI2ASC 124 -# define PKCS12_F_OPENSSL_UNI2UTF8 127 -# define PKCS12_F_OPENSSL_UTF82UNI 129 -# define PKCS12_F_PKCS12_CREATE 105 -# define PKCS12_F_PKCS12_GEN_MAC 107 -# define PKCS12_F_PKCS12_INIT 109 -# define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 -# define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 -# define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 -# define PKCS12_F_PKCS12_KEY_GEN_ASC 110 -# define PKCS12_F_PKCS12_KEY_GEN_UNI 111 -# define PKCS12_F_PKCS12_KEY_GEN_UTF8 116 -# define PKCS12_F_PKCS12_NEWPASS 128 -# define PKCS12_F_PKCS12_PACK_P7DATA 114 -# define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 -# define PKCS12_F_PKCS12_PARSE 118 -# define PKCS12_F_PKCS12_PBE_CRYPT 119 -# define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 112 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 113 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 133 -# define PKCS12_F_PKCS12_SETUP_MAC 122 -# define PKCS12_F_PKCS12_SET_MAC 123 -# define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 -# define PKCS12_F_PKCS12_UNPACK_P7DATA 131 -# define PKCS12_F_PKCS12_VERIFY_MAC 126 -# define PKCS12_F_PKCS8_ENCRYPT 125 -# define PKCS12_F_PKCS8_SET0_PBE 132 - -/* - * PKCS12 reason codes. - */ -# define PKCS12_R_CANT_PACK_STRUCTURE 100 -# define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 -# define PKCS12_R_DECODE_ERROR 101 -# define PKCS12_R_ENCODE_ERROR 102 -# define PKCS12_R_ENCRYPT_ERROR 103 -# define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 -# define PKCS12_R_INVALID_NULL_ARGUMENT 104 -# define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 -# define PKCS12_R_IV_GEN_ERROR 106 -# define PKCS12_R_KEY_GEN_ERROR 107 -# define PKCS12_R_MAC_ABSENT 108 -# define PKCS12_R_MAC_GENERATION_ERROR 109 -# define PKCS12_R_MAC_SETUP_ERROR 110 -# define PKCS12_R_MAC_STRING_SET_ERROR 111 -# define PKCS12_R_MAC_VERIFY_FAILURE 113 -# define PKCS12_R_PARSE_ERROR 114 -# define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 -# define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 -# define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 -# define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 -# define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs7.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs7.h deleted file mode 100644 index 9b66e002..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs7.h +++ /dev/null @@ -1,319 +0,0 @@ -/* - * 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_PKCS7_H -# define HEADER_PKCS7_H - -# include -# include -# include - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- -Encryption_ID DES-CBC -Digest_ID MD5 -Digest_Encryption_ID rsaEncryption -Key_Encryption_ID rsaEncryption -*/ - -typedef struct pkcs7_issuer_and_serial_st { - X509_NAME *issuer; - ASN1_INTEGER *serial; -} PKCS7_ISSUER_AND_SERIAL; - -typedef struct pkcs7_signer_info_st { - ASN1_INTEGER *version; /* version 1 */ - PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; - X509_ALGOR *digest_alg; - STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ - X509_ALGOR *digest_enc_alg; - ASN1_OCTET_STRING *enc_digest; - STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ - /* The private key to sign with */ - EVP_PKEY *pkey; -} PKCS7_SIGNER_INFO; - -DEFINE_STACK_OF(PKCS7_SIGNER_INFO) - -typedef struct pkcs7_recip_info_st { - ASN1_INTEGER *version; /* version 0 */ - PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; - X509_ALGOR *key_enc_algor; - ASN1_OCTET_STRING *enc_key; - X509 *cert; /* get the pub-key from this */ -} PKCS7_RECIP_INFO; - -DEFINE_STACK_OF(PKCS7_RECIP_INFO) - -typedef struct pkcs7_signed_st { - ASN1_INTEGER *version; /* version 1 */ - STACK_OF(X509_ALGOR) *md_algs; /* md used */ - STACK_OF(X509) *cert; /* [ 0 ] */ - STACK_OF(X509_CRL) *crl; /* [ 1 ] */ - STACK_OF(PKCS7_SIGNER_INFO) *signer_info; - struct pkcs7_st *contents; -} PKCS7_SIGNED; -/* - * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about - * merging the two - */ - -typedef struct pkcs7_enc_content_st { - ASN1_OBJECT *content_type; - X509_ALGOR *algorithm; - ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ - const EVP_CIPHER *cipher; -} PKCS7_ENC_CONTENT; - -typedef struct pkcs7_enveloped_st { - ASN1_INTEGER *version; /* version 0 */ - STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; - PKCS7_ENC_CONTENT *enc_data; -} PKCS7_ENVELOPE; - -typedef struct pkcs7_signedandenveloped_st { - ASN1_INTEGER *version; /* version 1 */ - STACK_OF(X509_ALGOR) *md_algs; /* md used */ - STACK_OF(X509) *cert; /* [ 0 ] */ - STACK_OF(X509_CRL) *crl; /* [ 1 ] */ - STACK_OF(PKCS7_SIGNER_INFO) *signer_info; - PKCS7_ENC_CONTENT *enc_data; - STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; -} PKCS7_SIGN_ENVELOPE; - -typedef struct pkcs7_digest_st { - ASN1_INTEGER *version; /* version 0 */ - X509_ALGOR *md; /* md used */ - struct pkcs7_st *contents; - ASN1_OCTET_STRING *digest; -} PKCS7_DIGEST; - -typedef struct pkcs7_encrypted_st { - ASN1_INTEGER *version; /* version 0 */ - PKCS7_ENC_CONTENT *enc_data; -} PKCS7_ENCRYPT; - -typedef struct pkcs7_st { - /* - * The following is non NULL if it contains ASN1 encoding of this - * structure - */ - unsigned char *asn1; - long length; -# define PKCS7_S_HEADER 0 -# define PKCS7_S_BODY 1 -# define PKCS7_S_TAIL 2 - int state; /* used during processing */ - int detached; - ASN1_OBJECT *type; - /* content as defined by the type */ - /* - * all encryption/message digests are applied to the 'contents', leaving - * out the 'type' field. - */ - union { - char *ptr; - /* NID_pkcs7_data */ - ASN1_OCTET_STRING *data; - /* NID_pkcs7_signed */ - PKCS7_SIGNED *sign; - /* NID_pkcs7_enveloped */ - PKCS7_ENVELOPE *enveloped; - /* NID_pkcs7_signedAndEnveloped */ - PKCS7_SIGN_ENVELOPE *signed_and_enveloped; - /* NID_pkcs7_digest */ - PKCS7_DIGEST *digest; - /* NID_pkcs7_encrypted */ - PKCS7_ENCRYPT *encrypted; - /* Anything else */ - ASN1_TYPE *other; - } d; -} PKCS7; - -DEFINE_STACK_OF(PKCS7) - -# define PKCS7_OP_SET_DETACHED_SIGNATURE 1 -# define PKCS7_OP_GET_DETACHED_SIGNATURE 2 - -# define PKCS7_get_signed_attributes(si) ((si)->auth_attr) -# define PKCS7_get_attributes(si) ((si)->unauth_attr) - -# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) -# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) -# define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) -# define PKCS7_type_is_signedAndEnveloped(a) \ - (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) -# define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) -# define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) - -# define PKCS7_set_detached(p,v) \ - PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) -# define PKCS7_get_detached(p) \ - PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) - -# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) - -/* S/MIME related flags */ - -# define PKCS7_TEXT 0x1 -# define PKCS7_NOCERTS 0x2 -# define PKCS7_NOSIGS 0x4 -# define PKCS7_NOCHAIN 0x8 -# define PKCS7_NOINTERN 0x10 -# define PKCS7_NOVERIFY 0x20 -# define PKCS7_DETACHED 0x40 -# define PKCS7_BINARY 0x80 -# define PKCS7_NOATTR 0x100 -# define PKCS7_NOSMIMECAP 0x200 -# define PKCS7_NOOLDMIMETYPE 0x400 -# define PKCS7_CRLFEOL 0x800 -# define PKCS7_STREAM 0x1000 -# define PKCS7_NOCRL 0x2000 -# define PKCS7_PARTIAL 0x4000 -# define PKCS7_REUSE_DIGEST 0x8000 -# define PKCS7_NO_DUAL_CONTENT 0x10000 - -/* Flags: for compatibility with older code */ - -# define SMIME_TEXT PKCS7_TEXT -# define SMIME_NOCERTS PKCS7_NOCERTS -# define SMIME_NOSIGS PKCS7_NOSIGS -# define SMIME_NOCHAIN PKCS7_NOCHAIN -# define SMIME_NOINTERN PKCS7_NOINTERN -# define SMIME_NOVERIFY PKCS7_NOVERIFY -# define SMIME_DETACHED PKCS7_DETACHED -# define SMIME_BINARY PKCS7_BINARY -# define SMIME_NOATTR PKCS7_NOATTR - -/* CRLF ASCII canonicalisation */ -# define SMIME_ASCIICRLF 0x80000 - -DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) - -int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, - const EVP_MD *type, unsigned char *md, - unsigned int *len); -# ifndef OPENSSL_NO_STDIO -PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7); -int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7); -# endif -PKCS7 *PKCS7_dup(PKCS7 *p7); -PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7); -int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7); -int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); -int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); - -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) -DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) -DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) -DECLARE_ASN1_FUNCTIONS(PKCS7) - -DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) -DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) - -DECLARE_ASN1_NDEF_FUNCTION(PKCS7) -DECLARE_ASN1_PRINT_FUNCTION(PKCS7) - -long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); - -int PKCS7_set_type(PKCS7 *p7, int type); -int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); -int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); -int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, - const EVP_MD *dgst); -int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); -int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); -int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); -int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); -int PKCS7_content_new(PKCS7 *p7, int nid); -int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, - BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); -int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, - X509 *x509); - -BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); -int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); -BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); - -PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, - EVP_PKEY *pkey, const EVP_MD *dgst); -X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); -int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); -STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); - -PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); -void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, - X509_ALGOR **pdig, X509_ALGOR **psig); -void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); -int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); -int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); -int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); -int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); - -PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); -ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); -int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, - void *data); -int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, - void *value); -ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); -ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); -int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, - STACK_OF(X509_ATTRIBUTE) *sk); -int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, - STACK_OF(X509_ATTRIBUTE) *sk); - -PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, - BIO *data, int flags); - -PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, - X509 *signcert, EVP_PKEY *pkey, - const EVP_MD *md, int flags); - -int PKCS7_final(PKCS7 *p7, BIO *data, int flags); -int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, - BIO *indata, BIO *out, int flags); -STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, - int flags); -PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, - int flags); -int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, - int flags); - -int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, - STACK_OF(X509_ALGOR) *cap); -STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); -int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); - -int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); -int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); -int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, - const unsigned char *md, int mdlen); - -int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); -PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); - -BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs7err.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs7err.h deleted file mode 100644 index 02e0299a..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/pkcs7err.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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_PKCS7ERR_H -# define HEADER_PKCS7ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PKCS7_strings(void); - -/* - * PKCS7 function codes. - */ -# define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 -# define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 -# define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 -# define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 -# define PKCS7_F_PKCS7_ADD_CRL 101 -# define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 -# define PKCS7_F_PKCS7_ADD_SIGNATURE 131 -# define PKCS7_F_PKCS7_ADD_SIGNER 103 -# define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 -# define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 -# define PKCS7_F_PKCS7_CTRL 104 -# define PKCS7_F_PKCS7_DATADECODE 112 -# define PKCS7_F_PKCS7_DATAFINAL 128 -# define PKCS7_F_PKCS7_DATAINIT 105 -# define PKCS7_F_PKCS7_DATAVERIFY 107 -# define PKCS7_F_PKCS7_DECRYPT 114 -# define PKCS7_F_PKCS7_DECRYPT_RINFO 133 -# define PKCS7_F_PKCS7_ENCODE_RINFO 132 -# define PKCS7_F_PKCS7_ENCRYPT 115 -# define PKCS7_F_PKCS7_FINAL 134 -# define PKCS7_F_PKCS7_FIND_DIGEST 127 -# define PKCS7_F_PKCS7_GET0_SIGNERS 124 -# define PKCS7_F_PKCS7_RECIP_INFO_SET 130 -# define PKCS7_F_PKCS7_SET_CIPHER 108 -# define PKCS7_F_PKCS7_SET_CONTENT 109 -# define PKCS7_F_PKCS7_SET_DIGEST 126 -# define PKCS7_F_PKCS7_SET_TYPE 110 -# define PKCS7_F_PKCS7_SIGN 116 -# define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 -# define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 -# define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 -# define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 -# define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 -# define PKCS7_F_PKCS7_VERIFY 117 - -/* - * PKCS7 reason codes. - */ -# define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 -# define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 -# define PKCS7_R_CIPHER_NOT_INITIALIZED 116 -# define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 -# define PKCS7_R_CTRL_ERROR 152 -# define PKCS7_R_DECRYPT_ERROR 119 -# define PKCS7_R_DIGEST_FAILURE 101 -# define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 -# define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 -# define PKCS7_R_ERROR_ADDING_RECIPIENT 120 -# define PKCS7_R_ERROR_SETTING_CIPHER 121 -# define PKCS7_R_INVALID_NULL_POINTER 143 -# define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 -# define PKCS7_R_NO_CONTENT 122 -# define PKCS7_R_NO_DEFAULT_DIGEST 151 -# define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 -# define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 -# define PKCS7_R_NO_SIGNATURES_ON_DATA 123 -# define PKCS7_R_NO_SIGNERS 142 -# define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 -# define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 -# define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 -# define PKCS7_R_PKCS7_DATASIGN 145 -# define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 -# define PKCS7_R_SIGNATURE_FAILURE 105 -# define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 -# define PKCS7_R_SIGNING_CTRL_FAILURE 147 -# define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 -# define PKCS7_R_SMIME_TEXT_ERROR 129 -# define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 -# define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 -# define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 -# define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 -# define PKCS7_R_UNKNOWN_OPERATION 110 -# define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 -# define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 -# define PKCS7_R_WRONG_CONTENT_TYPE 113 -# define PKCS7_R_WRONG_PKCS7_TYPE 114 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rand.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rand.h deleted file mode 100644 index 38a2a271..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rand.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1995-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_RAND_H -# define HEADER_RAND_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -struct rand_meth_st { - int (*seed) (const void *buf, int num); - int (*bytes) (unsigned char *buf, int num); - void (*cleanup) (void); - int (*add) (const void *buf, int num, double randomness); - int (*pseudorand) (unsigned char *buf, int num); - int (*status) (void); -}; - -int RAND_set_rand_method(const RAND_METHOD *meth); -const RAND_METHOD *RAND_get_rand_method(void); -# ifndef OPENSSL_NO_ENGINE -int RAND_set_rand_engine(ENGINE *engine); -# endif - -RAND_METHOD *RAND_OpenSSL(void); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define RAND_cleanup() while(0) continue -# endif -int RAND_bytes(unsigned char *buf, int num); -int RAND_priv_bytes(unsigned char *buf, int num); -DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) - -void RAND_seed(const void *buf, int num); -void RAND_keep_random_devices_open(int keep); - -# if defined(__ANDROID__) && defined(__NDK_FPABI__) -__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ -# endif -void RAND_add(const void *buf, int num, double randomness); -int RAND_load_file(const char *file, long max_bytes); -int RAND_write_file(const char *file); -const char *RAND_file_name(char *file, size_t num); -int RAND_status(void); - -# ifndef OPENSSL_NO_EGD -int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); -int RAND_egd(const char *path); -int RAND_egd_bytes(const char *path, int bytes); -# endif - -int RAND_poll(void); - -# if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) -/* application has to include in order to use these */ -DEPRECATEDIN_1_1_0(void RAND_screen(void)) -DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) -# endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rand_drbg.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rand_drbg.h deleted file mode 100644 index 45b731b7..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rand_drbg.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2017-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_DRBG_RAND_H -# define HEADER_DRBG_RAND_H - -# include -# include -# include - -/* - * RAND_DRBG flags - * - * Note: if new flags are added, the constant `rand_drbg_used_flags` - * in drbg_lib.c needs to be updated accordingly. - */ - -/* In CTR mode, disable derivation function ctr_df */ -# define RAND_DRBG_FLAG_CTR_NO_DF 0x1 - - -# if OPENSSL_API_COMPAT < 0x10200000L -/* This #define was replaced by an internal constant and should not be used. */ -# define RAND_DRBG_USED_FLAGS (RAND_DRBG_FLAG_CTR_NO_DF) -# endif - -/* - * Default security strength (in the sense of [NIST SP 800-90Ar1]) - * - * NIST SP 800-90Ar1 supports the strength of the DRBG being smaller than that - * of the cipher by collecting less entropy. The current DRBG implementation - * does not take RAND_DRBG_STRENGTH into account and sets the strength of the - * DRBG to that of the cipher. - * - * RAND_DRBG_STRENGTH is currently only used for the legacy RAND - * implementation. - * - * Currently supported ciphers are: NID_aes_128_ctr, NID_aes_192_ctr and - * NID_aes_256_ctr - */ -# define RAND_DRBG_STRENGTH 256 -/* Default drbg type */ -# define RAND_DRBG_TYPE NID_aes_256_ctr -/* Default drbg flags */ -# define RAND_DRBG_FLAGS 0 - - -# ifdef __cplusplus -extern "C" { -# endif - -/* - * Object lifetime functions. - */ -RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent); -RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent); -int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags); -int RAND_DRBG_set_defaults(int type, unsigned int flags); -int RAND_DRBG_instantiate(RAND_DRBG *drbg, - const unsigned char *pers, size_t perslen); -int RAND_DRBG_uninstantiate(RAND_DRBG *drbg); -void RAND_DRBG_free(RAND_DRBG *drbg); - -/* - * Object "use" functions. - */ -int RAND_DRBG_reseed(RAND_DRBG *drbg, - const unsigned char *adin, size_t adinlen, - int prediction_resistance); -int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, - int prediction_resistance, - const unsigned char *adin, size_t adinlen); -int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen); - -int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, unsigned int interval); -int RAND_DRBG_set_reseed_time_interval(RAND_DRBG *drbg, time_t interval); - -int RAND_DRBG_set_reseed_defaults( - unsigned int master_reseed_interval, - unsigned int slave_reseed_interval, - time_t master_reseed_time_interval, - time_t slave_reseed_time_interval - ); - -RAND_DRBG *RAND_DRBG_get0_master(void); -RAND_DRBG *RAND_DRBG_get0_public(void); -RAND_DRBG *RAND_DRBG_get0_private(void); - -/* - * EXDATA - */ -# define RAND_DRBG_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DRBG, l, p, newf, dupf, freef) -int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *arg); -void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx); - -/* - * Callback function typedefs - */ -typedef size_t (*RAND_DRBG_get_entropy_fn)(RAND_DRBG *drbg, - unsigned char **pout, - int entropy, size_t min_len, - size_t max_len, - int prediction_resistance); -typedef void (*RAND_DRBG_cleanup_entropy_fn)(RAND_DRBG *ctx, - unsigned char *out, size_t outlen); -typedef size_t (*RAND_DRBG_get_nonce_fn)(RAND_DRBG *drbg, unsigned char **pout, - int entropy, size_t min_len, - size_t max_len); -typedef void (*RAND_DRBG_cleanup_nonce_fn)(RAND_DRBG *drbg, - unsigned char *out, size_t outlen); - -int RAND_DRBG_set_callbacks(RAND_DRBG *drbg, - RAND_DRBG_get_entropy_fn get_entropy, - RAND_DRBG_cleanup_entropy_fn cleanup_entropy, - RAND_DRBG_get_nonce_fn get_nonce, - RAND_DRBG_cleanup_nonce_fn cleanup_nonce); - - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/randerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/randerr.h deleted file mode 100644 index 79d57905..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/randerr.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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_RANDERR_H -# define HEADER_RANDERR_H - -# include - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_RAND_strings(void); - -/* - * RAND function codes. - */ -# define RAND_F_DATA_COLLECT_METHOD 127 -# define RAND_F_DRBG_BYTES 101 -# define RAND_F_DRBG_GET_ENTROPY 105 -# define RAND_F_DRBG_SETUP 117 -# define RAND_F_GET_ENTROPY 106 -# define RAND_F_RAND_BYTES 100 -# define RAND_F_RAND_DRBG_ENABLE_LOCKING 119 -# define RAND_F_RAND_DRBG_GENERATE 107 -# define RAND_F_RAND_DRBG_GET_ENTROPY 120 -# define RAND_F_RAND_DRBG_GET_NONCE 123 -# define RAND_F_RAND_DRBG_INSTANTIATE 108 -# define RAND_F_RAND_DRBG_NEW 109 -# define RAND_F_RAND_DRBG_RESEED 110 -# define RAND_F_RAND_DRBG_RESTART 102 -# define RAND_F_RAND_DRBG_SET 104 -# define RAND_F_RAND_DRBG_SET_DEFAULTS 121 -# define RAND_F_RAND_DRBG_UNINSTANTIATE 118 -# define RAND_F_RAND_LOAD_FILE 111 -# define RAND_F_RAND_POOL_ACQUIRE_ENTROPY 122 -# define RAND_F_RAND_POOL_ADD 103 -# define RAND_F_RAND_POOL_ADD_BEGIN 113 -# define RAND_F_RAND_POOL_ADD_END 114 -# define RAND_F_RAND_POOL_ATTACH 124 -# define RAND_F_RAND_POOL_BYTES_NEEDED 115 -# define RAND_F_RAND_POOL_GROW 125 -# define RAND_F_RAND_POOL_NEW 116 -# define RAND_F_RAND_PSEUDO_BYTES 126 -# define RAND_F_RAND_WRITE_FILE 112 - -/* - * RAND reason codes. - */ -# define RAND_R_ADDITIONAL_INPUT_TOO_LONG 102 -# define RAND_R_ALREADY_INSTANTIATED 103 -# define RAND_R_ARGUMENT_OUT_OF_RANGE 105 -# define RAND_R_CANNOT_OPEN_FILE 121 -# define RAND_R_DRBG_ALREADY_INITIALIZED 129 -# define RAND_R_DRBG_NOT_INITIALISED 104 -# define RAND_R_ENTROPY_INPUT_TOO_LONG 106 -# define RAND_R_ENTROPY_OUT_OF_RANGE 124 -# define RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED 127 -# define RAND_R_ERROR_INITIALISING_DRBG 107 -# define RAND_R_ERROR_INSTANTIATING_DRBG 108 -# define RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 109 -# define RAND_R_ERROR_RETRIEVING_ENTROPY 110 -# define RAND_R_ERROR_RETRIEVING_NONCE 111 -# define RAND_R_FAILED_TO_CREATE_LOCK 126 -# define RAND_R_FUNC_NOT_IMPLEMENTED 101 -# define RAND_R_FWRITE_ERROR 123 -# define RAND_R_GENERATE_ERROR 112 -# define RAND_R_INTERNAL_ERROR 113 -# define RAND_R_IN_ERROR_STATE 114 -# define RAND_R_NOT_A_REGULAR_FILE 122 -# define RAND_R_NOT_INSTANTIATED 115 -# define RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED 128 -# define RAND_R_PARENT_LOCKING_NOT_ENABLED 130 -# define RAND_R_PARENT_STRENGTH_TOO_WEAK 131 -# define RAND_R_PERSONALISATION_STRING_TOO_LONG 116 -# define RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED 133 -# define RAND_R_PRNG_NOT_SEEDED 100 -# define RAND_R_RANDOM_POOL_OVERFLOW 125 -# define RAND_R_RANDOM_POOL_UNDERFLOW 134 -# define RAND_R_REQUEST_TOO_LARGE_FOR_DRBG 117 -# define RAND_R_RESEED_ERROR 118 -# define RAND_R_SELFTEST_FAILURE 119 -# define RAND_R_TOO_LITTLE_NONCE_REQUESTED 135 -# define RAND_R_TOO_MUCH_NONCE_REQUESTED 136 -# define RAND_R_UNSUPPORTED_DRBG_FLAGS 132 -# define RAND_R_UNSUPPORTED_DRBG_TYPE 120 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rc2.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rc2.h deleted file mode 100644 index 585f9e4c..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rc2.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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_RC2_H -# define HEADER_RC2_H - -# include - -# ifndef OPENSSL_NO_RC2 -# ifdef __cplusplus -extern "C" { -# endif - -typedef unsigned int RC2_INT; - -# define RC2_ENCRYPT 1 -# define RC2_DECRYPT 0 - -# define RC2_BLOCK 8 -# define RC2_KEY_LENGTH 16 - -typedef struct rc2_key_st { - RC2_INT data[64]; -} RC2_KEY; - -void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); -void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, - RC2_KEY *key, int enc); -void RC2_encrypt(unsigned long *data, RC2_KEY *key); -void RC2_decrypt(unsigned long *data, RC2_KEY *key); -void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - RC2_KEY *ks, unsigned char *iv, int enc); -void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num, int enc); -void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rc4.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rc4.h deleted file mode 100644 index 86803b37..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rc4.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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_RC4_H -# define HEADER_RC4_H - -# include - -# ifndef OPENSSL_NO_RC4 -# include -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct rc4_key_st { - RC4_INT x, y; - RC4_INT data[256]; -} RC4_KEY; - -const char *RC4_options(void); -void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); -void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, - unsigned char *outdata); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rc5.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rc5.h deleted file mode 100644 index 793f88e4..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rc5.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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_RC5_H -# define HEADER_RC5_H - -# include - -# ifndef OPENSSL_NO_RC5 -# ifdef __cplusplus -extern "C" { -# endif - -# define RC5_ENCRYPT 1 -# define RC5_DECRYPT 0 - -# define RC5_32_INT unsigned int - -# define RC5_32_BLOCK 8 -# define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ - -/* - * This are the only values supported. Tweak the code if you want more The - * most supported modes will be RC5-32/12/16 RC5-32/16/8 - */ -# define RC5_8_ROUNDS 8 -# define RC5_12_ROUNDS 12 -# define RC5_16_ROUNDS 16 - -typedef struct rc5_key_st { - /* Number of rounds */ - int rounds; - RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; -} RC5_32_KEY; - -void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, - int rounds); -void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, - RC5_32_KEY *key, int enc); -void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *ks, unsigned char *iv, - int enc); -void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ripemd.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ripemd.h deleted file mode 100644 index c42026aa..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ripemd.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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_RIPEMD_H -# define HEADER_RIPEMD_H - -# include - -#ifndef OPENSSL_NO_RMD160 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define RIPEMD160_LONG unsigned int - -# define RIPEMD160_CBLOCK 64 -# define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) -# define RIPEMD160_DIGEST_LENGTH 20 - -typedef struct RIPEMD160state_st { - RIPEMD160_LONG A, B, C, D, E; - RIPEMD160_LONG Nl, Nh; - RIPEMD160_LONG data[RIPEMD160_LBLOCK]; - unsigned int num; -} RIPEMD160_CTX; - -int RIPEMD160_Init(RIPEMD160_CTX *c); -int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); -int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); -unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); -void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); - -# ifdef __cplusplus -} -# endif -# endif - - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rsa.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rsa.h deleted file mode 100644 index 5e76365c..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rsa.h +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Copyright 1995-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_RSA_H -# define HEADER_RSA_H - -# include - -# ifndef OPENSSL_NO_RSA -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* The types RSA and RSA_METHOD are defined in ossl_typ.h */ - -# ifndef OPENSSL_RSA_MAX_MODULUS_BITS -# define OPENSSL_RSA_MAX_MODULUS_BITS 16384 -# endif - -# define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 - -# ifndef OPENSSL_RSA_SMALL_MODULUS_BITS -# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 -# endif -# ifndef OPENSSL_RSA_MAX_PUBEXP_BITS - -/* exponent limit enforced for "large" modulus only */ -# define OPENSSL_RSA_MAX_PUBEXP_BITS 64 -# endif - -# define RSA_3 0x3L -# define RSA_F4 0x10001L - -/* based on RFC 8017 appendix A.1.2 */ -# define RSA_ASN1_VERSION_DEFAULT 0 -# define RSA_ASN1_VERSION_MULTI 1 - -# define RSA_DEFAULT_PRIME_NUM 2 - -# define RSA_METHOD_FLAG_NO_CHECK 0x0001/* don't check pub/private - * match */ - -# define RSA_FLAG_CACHE_PUBLIC 0x0002 -# define RSA_FLAG_CACHE_PRIVATE 0x0004 -# define RSA_FLAG_BLINDING 0x0008 -# define RSA_FLAG_THREAD_SAFE 0x0010 -/* - * This flag means the private key operations will be handled by rsa_mod_exp - * and that they do not depend on the private key components being present: - * for example a key stored in external hardware. Without this flag - * bn_mod_exp gets called when private key components are absent. - */ -# define RSA_FLAG_EXT_PKEY 0x0020 - -/* - * new with 0.9.6j and 0.9.7b; the built-in - * RSA implementation now uses blinding by - * default (ignoring RSA_FLAG_BLINDING), - * but other engines might not need it - */ -# define RSA_FLAG_NO_BLINDING 0x0080 -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define RSA_FLAG_NO_CONSTTIME 0x0000 -# endif -# if OPENSSL_API_COMPAT < 0x00908000L -/* deprecated name for the flag*/ -/* - * new with 0.9.7h; the built-in RSA - * implementation now uses constant time - * modular exponentiation for secret exponents - * by default. This flag causes the - * faster variable sliding window method to - * be used for all exponents. - */ -# define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME -# endif - -# define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ - RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_RSA_PADDING, pad, NULL) - -# define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \ - RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad) - -# define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ - RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ - EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) -/* Salt length matches digest */ -# define RSA_PSS_SALTLEN_DIGEST -1 -/* Verify only: auto detect salt length */ -# define RSA_PSS_SALTLEN_AUTO -2 -/* Set salt length to maximum possible */ -# define RSA_PSS_SALTLEN_MAX -3 -/* Old compatible max salt length for sign only */ -# define RSA_PSS_SALTLEN_MAX_SIGN -2 - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \ - RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ - EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, 0, plen) - -# define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) - -# define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp) - -# define EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, primes) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES, primes, NULL) - -# define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)(l)) - -# define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)(l)) - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, \ - EVP_PKEY_OP_KEYGEN, EVP_PKEY_CTRL_MD, \ - 0, (void *)(md)) - -# define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) - -# define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) - -# define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) - -# define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) - -# define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) - -# define EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES (EVP_PKEY_ALG_CTRL + 13) - -# define RSA_PKCS1_PADDING 1 -# define RSA_SSLV23_PADDING 2 -# define RSA_NO_PADDING 3 -# define RSA_PKCS1_OAEP_PADDING 4 -# define RSA_X931_PADDING 5 -/* EVP_PKEY_ only */ -# define RSA_PKCS1_PSS_PADDING 6 - -# define RSA_PKCS1_PADDING_SIZE 11 - -# define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) -# define RSA_get_app_data(s) RSA_get_ex_data(s,0) - -RSA *RSA_new(void); -RSA *RSA_new_method(ENGINE *engine); -int RSA_bits(const RSA *rsa); -int RSA_size(const RSA *rsa); -int RSA_security_bits(const RSA *rsa); - -int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); -int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); -int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); -int RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[], - BIGNUM *coeffs[], int pnum); -void RSA_get0_key(const RSA *r, - const BIGNUM **n, const BIGNUM **e, const BIGNUM **d); -void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); -int RSA_get_multi_prime_extra_count(const RSA *r); -int RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]); -void RSA_get0_crt_params(const RSA *r, - const BIGNUM **dmp1, const BIGNUM **dmq1, - const BIGNUM **iqmp); -int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[], - const BIGNUM *coeffs[]); -const BIGNUM *RSA_get0_n(const RSA *d); -const BIGNUM *RSA_get0_e(const RSA *d); -const BIGNUM *RSA_get0_d(const RSA *d); -const BIGNUM *RSA_get0_p(const RSA *d); -const BIGNUM *RSA_get0_q(const RSA *d); -const BIGNUM *RSA_get0_dmp1(const RSA *r); -const BIGNUM *RSA_get0_dmq1(const RSA *r); -const BIGNUM *RSA_get0_iqmp(const RSA *r); -const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); -void RSA_clear_flags(RSA *r, int flags); -int RSA_test_flags(const RSA *r, int flags); -void RSA_set_flags(RSA *r, int flags); -int RSA_get_version(RSA *r); -ENGINE *RSA_get0_engine(const RSA *r); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void - (*callback) (int, int, void *), - void *cb_arg)) - -/* New version */ -int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); -/* Multi-prime version */ -int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, - BIGNUM *e, BN_GENCB *cb); - -int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, - BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2, - const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2, - const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb); -int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, - BN_GENCB *cb); - -int RSA_check_key(const RSA *); -int RSA_check_key_ex(const RSA *, BN_GENCB *cb); - /* next 4 return -1 on error */ -int RSA_public_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_private_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_public_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_private_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -void RSA_free(RSA *r); -/* "up" the RSA object's reference count */ -int RSA_up_ref(RSA *r); - -int RSA_flags(const RSA *r); - -void RSA_set_default_method(const RSA_METHOD *meth); -const RSA_METHOD *RSA_get_default_method(void); -const RSA_METHOD *RSA_null_method(void); -const RSA_METHOD *RSA_get_method(const RSA *rsa); -int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); - -/* these are the actual RSA functions */ -const RSA_METHOD *RSA_PKCS1_OpenSSL(void); - -int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); - -DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) -DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) - -struct rsa_pss_params_st { - X509_ALGOR *hashAlgorithm; - X509_ALGOR *maskGenAlgorithm; - ASN1_INTEGER *saltLength; - ASN1_INTEGER *trailerField; - /* Decoded hash algorithm from maskGenAlgorithm */ - X509_ALGOR *maskHash; -}; - -DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) - -typedef struct rsa_oaep_params_st { - X509_ALGOR *hashFunc; - X509_ALGOR *maskGenFunc; - X509_ALGOR *pSourceFunc; - /* Decoded hash algorithm from maskGenFunc */ - X509_ALGOR *maskHash; -} RSA_OAEP_PARAMS; - -DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) - -# ifndef OPENSSL_NO_STDIO -int RSA_print_fp(FILE *fp, const RSA *r, int offset); -# endif - -int RSA_print(BIO *bp, const RSA *r, int offset); - -/* - * The following 2 functions sign and verify a X509_SIG ASN1 object inside - * PKCS#1 padded RSA encryption - */ -int RSA_sign(int type, const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, RSA *rsa); -int RSA_verify(int type, const unsigned char *m, unsigned int m_length, - const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); - -/* - * The following 2 function sign and verify a ASN1_OCTET_STRING object inside - * PKCS#1 padded RSA encryption - */ -int RSA_sign_ASN1_OCTET_STRING(int type, - const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - RSA *rsa); -int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, - unsigned int m_length, unsigned char *sigbuf, - unsigned int siglen, RSA *rsa); - -int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); -void RSA_blinding_off(RSA *rsa); -BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); - -int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, - const unsigned char *f, int fl, - int rsa_len); -int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, - const unsigned char *f, int fl, - int rsa_len); -int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, - long seedlen, const EVP_MD *dgst); -int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, - const unsigned char *f, int fl, - const unsigned char *p, int pl); -int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len, - const unsigned char *p, int pl); -int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, - const unsigned char *from, int flen, - const unsigned char *param, int plen, - const EVP_MD *md, const EVP_MD *mgf1md); -int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, - const unsigned char *from, int flen, - int num, const unsigned char *param, - int plen, const EVP_MD *md, - const EVP_MD *mgf1md); -int RSA_padding_add_SSLv23(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_SSLv23(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f, - int fl); -int RSA_padding_check_none(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f, - int fl); -int RSA_padding_check_X931(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_X931_hash_id(int nid); - -int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, - const EVP_MD *Hash, const unsigned char *EM, - int sLen); -int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, - const unsigned char *mHash, const EVP_MD *Hash, - int sLen); - -int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - const unsigned char *EM, int sLen); - -int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, - const unsigned char *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - int sLen); - -#define RSA_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef) -int RSA_set_ex_data(RSA *r, int idx, void *arg); -void *RSA_get_ex_data(const RSA *r, int idx); - -RSA *RSAPublicKey_dup(RSA *rsa); -RSA *RSAPrivateKey_dup(RSA *rsa); - -/* - * If this flag is set the RSA method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define RSA_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define RSA_FLAG_NON_FIPS_ALLOW 0x0400 -/* - * Application has decided PRNG is good enough to generate a key: don't - * check. - */ -# define RSA_FLAG_CHECKED 0x0800 - -RSA_METHOD *RSA_meth_new(const char *name, int flags); -void RSA_meth_free(RSA_METHOD *meth); -RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth); -const char *RSA_meth_get0_name(const RSA_METHOD *meth); -int RSA_meth_set1_name(RSA_METHOD *meth, const char *name); -int RSA_meth_get_flags(const RSA_METHOD *meth); -int RSA_meth_set_flags(RSA_METHOD *meth, int flags); -void *RSA_meth_get0_app_data(const RSA_METHOD *meth); -int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data); -int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_pub_enc(RSA_METHOD *rsa, - int (*pub_enc) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_pub_dec(RSA_METHOD *rsa, - int (*pub_dec) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_priv_enc(RSA_METHOD *rsa, - int (*priv_enc) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_priv_dec(RSA_METHOD *rsa, - int (*priv_dec) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth)) - (BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); -int RSA_meth_set_mod_exp(RSA_METHOD *rsa, - int (*mod_exp) (BIGNUM *r0, const BIGNUM *i, RSA *rsa, - BN_CTX *ctx)); -int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth)) - (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa, - int (*bn_mod_exp) (BIGNUM *r, - const BIGNUM *a, - const BIGNUM *p, - const BIGNUM *m, - BN_CTX *ctx, - BN_MONT_CTX *m_ctx)); -int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa); -int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa)); -int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa); -int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa)); -int (*RSA_meth_get_sign(const RSA_METHOD *meth)) - (int type, - const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - const RSA *rsa); -int RSA_meth_set_sign(RSA_METHOD *rsa, - int (*sign) (int type, const unsigned char *m, - unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - const RSA *rsa)); -int (*RSA_meth_get_verify(const RSA_METHOD *meth)) - (int dtype, const unsigned char *m, - unsigned int m_length, const unsigned char *sigbuf, - unsigned int siglen, const RSA *rsa); -int RSA_meth_set_verify(RSA_METHOD *rsa, - int (*verify) (int dtype, const unsigned char *m, - unsigned int m_length, - const unsigned char *sigbuf, - unsigned int siglen, const RSA *rsa)); -int (*RSA_meth_get_keygen(const RSA_METHOD *meth)) - (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); -int RSA_meth_set_keygen(RSA_METHOD *rsa, - int (*keygen) (RSA *rsa, int bits, BIGNUM *e, - BN_GENCB *cb)); -int (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth)) - (RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb); -int RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth, - int (*keygen) (RSA *rsa, int bits, - int primes, BIGNUM *e, - BN_GENCB *cb)); - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rsaerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rsaerr.h deleted file mode 100644 index 59b15e13..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/rsaerr.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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_RSAERR_H -# define HEADER_RSAERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_RSA_strings(void); - -/* - * RSA function codes. - */ -# define RSA_F_CHECK_PADDING_MD 140 -# define RSA_F_ENCODE_PKCS1 146 -# define RSA_F_INT_RSA_VERIFY 145 -# define RSA_F_OLD_RSA_PRIV_DECODE 147 -# define RSA_F_PKEY_PSS_INIT 165 -# define RSA_F_PKEY_RSA_CTRL 143 -# define RSA_F_PKEY_RSA_CTRL_STR 144 -# define RSA_F_PKEY_RSA_SIGN 142 -# define RSA_F_PKEY_RSA_VERIFY 149 -# define RSA_F_PKEY_RSA_VERIFYRECOVER 141 -# define RSA_F_RSA_ALGOR_TO_MD 156 -# define RSA_F_RSA_BUILTIN_KEYGEN 129 -# define RSA_F_RSA_CHECK_KEY 123 -# define RSA_F_RSA_CHECK_KEY_EX 160 -# define RSA_F_RSA_CMS_DECRYPT 159 -# define RSA_F_RSA_CMS_VERIFY 158 -# define RSA_F_RSA_ITEM_VERIFY 148 -# define RSA_F_RSA_METH_DUP 161 -# define RSA_F_RSA_METH_NEW 162 -# define RSA_F_RSA_METH_SET1_NAME 163 -# define RSA_F_RSA_MGF1_TO_MD 157 -# define RSA_F_RSA_MULTIP_INFO_NEW 166 -# define RSA_F_RSA_NEW_METHOD 106 -# define RSA_F_RSA_NULL 124 -# define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 -# define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 -# define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 -# define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 -# define RSA_F_RSA_OSSL_PRIVATE_DECRYPT 101 -# define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 102 -# define RSA_F_RSA_OSSL_PUBLIC_DECRYPT 103 -# define RSA_F_RSA_OSSL_PUBLIC_ENCRYPT 104 -# define RSA_F_RSA_PADDING_ADD_NONE 107 -# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 -# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 154 -# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 -# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 152 -# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 -# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 -# define RSA_F_RSA_PADDING_ADD_SSLV23 110 -# define RSA_F_RSA_PADDING_ADD_X931 127 -# define RSA_F_RSA_PADDING_CHECK_NONE 111 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 153 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 -# define RSA_F_RSA_PADDING_CHECK_SSLV23 114 -# define RSA_F_RSA_PADDING_CHECK_X931 128 -# define RSA_F_RSA_PARAM_DECODE 164 -# define RSA_F_RSA_PRINT 115 -# define RSA_F_RSA_PRINT_FP 116 -# define RSA_F_RSA_PRIV_DECODE 150 -# define RSA_F_RSA_PRIV_ENCODE 138 -# define RSA_F_RSA_PSS_GET_PARAM 151 -# define RSA_F_RSA_PSS_TO_CTX 155 -# define RSA_F_RSA_PUB_DECODE 139 -# define RSA_F_RSA_SETUP_BLINDING 136 -# define RSA_F_RSA_SIGN 117 -# define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 -# define RSA_F_RSA_VERIFY 119 -# define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 -# define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 126 -# define RSA_F_SETUP_TBUF 167 - -/* - * RSA reason codes. - */ -# define RSA_R_ALGORITHM_MISMATCH 100 -# define RSA_R_BAD_E_VALUE 101 -# define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 -# define RSA_R_BAD_PAD_BYTE_COUNT 103 -# define RSA_R_BAD_SIGNATURE 104 -# define RSA_R_BLOCK_TYPE_IS_NOT_01 106 -# define RSA_R_BLOCK_TYPE_IS_NOT_02 107 -# define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 -# define RSA_R_DATA_TOO_LARGE 109 -# define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 -# define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 -# define RSA_R_DATA_TOO_SMALL 111 -# define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 -# define RSA_R_DIGEST_DOES_NOT_MATCH 158 -# define RSA_R_DIGEST_NOT_ALLOWED 145 -# define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 -# define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 -# define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 -# define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 -# define RSA_R_FIRST_OCTET_INVALID 133 -# define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 -# define RSA_R_INVALID_DIGEST 157 -# define RSA_R_INVALID_DIGEST_LENGTH 143 -# define RSA_R_INVALID_HEADER 137 -# define RSA_R_INVALID_LABEL 160 -# define RSA_R_INVALID_MESSAGE_LENGTH 131 -# define RSA_R_INVALID_MGF1_MD 156 -# define RSA_R_INVALID_MULTI_PRIME_KEY 167 -# define RSA_R_INVALID_OAEP_PARAMETERS 161 -# define RSA_R_INVALID_PADDING 138 -# define RSA_R_INVALID_PADDING_MODE 141 -# define RSA_R_INVALID_PSS_PARAMETERS 149 -# define RSA_R_INVALID_PSS_SALTLEN 146 -# define RSA_R_INVALID_SALT_LENGTH 150 -# define RSA_R_INVALID_TRAILER 139 -# define RSA_R_INVALID_X931_DIGEST 142 -# define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 -# define RSA_R_KEY_PRIME_NUM_INVALID 165 -# define RSA_R_KEY_SIZE_TOO_SMALL 120 -# define RSA_R_LAST_OCTET_INVALID 134 -# define RSA_R_MISSING_PRIVATE_KEY 179 -# define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 -# define RSA_R_MODULUS_TOO_LARGE 105 -# define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 -# define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 -# define RSA_R_MP_R_NOT_PRIME 170 -# define RSA_R_NO_PUBLIC_EXPONENT 140 -# define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 -# define RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES 172 -# define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 -# define RSA_R_OAEP_DECODING_ERROR 121 -# define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 -# define RSA_R_PADDING_CHECK_FAILED 114 -# define RSA_R_PKCS_DECODING_ERROR 159 -# define RSA_R_PSS_SALTLEN_TOO_SMALL 164 -# define RSA_R_P_NOT_PRIME 128 -# define RSA_R_Q_NOT_PRIME 129 -# define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 -# define RSA_R_SLEN_CHECK_FAILED 136 -# define RSA_R_SLEN_RECOVERY_FAILED 135 -# define RSA_R_SSLV3_ROLLBACK_ATTACK 115 -# define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 -# define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 -# define RSA_R_UNKNOWN_DIGEST 166 -# define RSA_R_UNKNOWN_MASK_DIGEST 151 -# define RSA_R_UNKNOWN_PADDING_TYPE 118 -# define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162 -# define RSA_R_UNSUPPORTED_LABEL_SOURCE 163 -# define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 -# define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 -# define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 -# define RSA_R_VALUE_MISSING 147 -# define RSA_R_WRONG_SIGNATURE_LENGTH 119 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/safestack.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/safestack.h deleted file mode 100644 index 38b55789..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/safestack.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 1999-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_SAFESTACK_H -# define HEADER_SAFESTACK_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define STACK_OF(type) struct stack_st_##type - -# define SKM_DEFINE_STACK_OF(t1, t2, t3) \ - STACK_OF(t1); \ - typedef int (*sk_##t1##_compfunc)(const t3 * const *a, const t3 *const *b); \ - typedef void (*sk_##t1##_freefunc)(t3 *a); \ - typedef t3 * (*sk_##t1##_copyfunc)(const t3 *a); \ - static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk) \ - { \ - return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx) \ - { \ - return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n) \ - { \ - return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_free((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_zero((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i) \ - { \ - return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \ - (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \ - { \ - return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk) \ - { \ - return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc) \ - { \ - OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \ - { \ - return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \ - { \ - return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_sort((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk) \ - { \ - return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \ - sk_##t1##_copyfunc copyfunc, \ - sk_##t1##_freefunc freefunc) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \ - (OPENSSL_sk_copyfunc)copyfunc, \ - (OPENSSL_sk_freefunc)freefunc); \ - } \ - static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare) \ - { \ - return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare); \ - } - -# define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2) -# define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t) -# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \ - SKM_DEFINE_STACK_OF(t1, const t2, t2) -# define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t) - -/*- - * Strings are special: normally an lhash entry will point to a single - * (somewhat) mutable object. In the case of strings: - * - * a) Instead of a single char, there is an array of chars, NUL-terminated. - * b) The string may have be immutable. - * - * So, they need their own declarations. Especially important for - * type-checking tools, such as Deputy. - * - * In practice, however, it appears to be hard to have a const - * string. For now, I'm settling for dealing with the fact it is a - * string at all. - */ -typedef char *OPENSSL_STRING; -typedef const char *OPENSSL_CSTRING; - -/*- - * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but - * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned - * above, instead of a single char each entry is a NUL-terminated array of - * chars. So, we have to implement STRING specially for STACK_OF. This is - * dealt with in the autogenerated macros below. - */ -DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char) -DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char) - -/* - * Similarly, we sometimes use a block of characters, NOT nul-terminated. - * These should also be distinguished from "normal" stacks. - */ -typedef void *OPENSSL_BLOCK; -DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) - -/* - * If called without higher optimization (min. -xO3) the Oracle Developer - * Studio compiler generates code for the defined (static inline) functions - * above. - * This would later lead to the linker complaining about missing symbols when - * this header file is included but the resulting object is not linked against - * the Crypto library (openssl#6912). - */ -# ifdef __SUNPRO_C -# pragma weak OPENSSL_sk_num -# pragma weak OPENSSL_sk_value -# pragma weak OPENSSL_sk_new -# pragma weak OPENSSL_sk_new_null -# pragma weak OPENSSL_sk_new_reserve -# pragma weak OPENSSL_sk_reserve -# pragma weak OPENSSL_sk_free -# pragma weak OPENSSL_sk_zero -# pragma weak OPENSSL_sk_delete -# pragma weak OPENSSL_sk_delete_ptr -# pragma weak OPENSSL_sk_push -# pragma weak OPENSSL_sk_unshift -# pragma weak OPENSSL_sk_pop -# pragma weak OPENSSL_sk_shift -# pragma weak OPENSSL_sk_pop_free -# pragma weak OPENSSL_sk_insert -# pragma weak OPENSSL_sk_set -# pragma weak OPENSSL_sk_find -# pragma weak OPENSSL_sk_find_ex -# pragma weak OPENSSL_sk_sort -# pragma weak OPENSSL_sk_is_sorted -# pragma weak OPENSSL_sk_dup -# pragma weak OPENSSL_sk_deep_copy -# pragma weak OPENSSL_sk_set_cmp_func -# endif /* __SUNPRO_C */ - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/seed.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/seed.h deleted file mode 100644 index de10b085..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/seed.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2007-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 - */ - -/* - * Copyright (c) 2007 KISA(Korea Information Security Agency). 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. Neither the name of author nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``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 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. - */ - -#ifndef HEADER_SEED_H -# define HEADER_SEED_H - -# include - -# ifndef OPENSSL_NO_SEED -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* look whether we need 'long' to get 32 bits */ -# ifdef AES_LONG -# ifndef SEED_LONG -# define SEED_LONG 1 -# endif -# endif - -# include - -# define SEED_BLOCK_SIZE 16 -# define SEED_KEY_LENGTH 16 - -typedef struct seed_key_st { -# ifdef SEED_LONG - unsigned long data[32]; -# else - unsigned int data[32]; -# endif -} SEED_KEY_SCHEDULE; - -void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], - SEED_KEY_SCHEDULE *ks); - -void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], - unsigned char d[SEED_BLOCK_SIZE], - const SEED_KEY_SCHEDULE *ks); -void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], - unsigned char d[SEED_BLOCK_SIZE], - const SEED_KEY_SCHEDULE *ks); - -void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, - const SEED_KEY_SCHEDULE *ks, int enc); -void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, - const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int enc); -void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int *num, - int enc); -void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/sha.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/sha.h deleted file mode 100644 index 6a1eb0de..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/sha.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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_SHA_H -# define HEADER_SHA_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! SHA_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define SHA_LONG unsigned int - -# define SHA_LBLOCK 16 -# define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a - * contiguous array of 32 bit wide - * big-endian values. */ -# define SHA_LAST_BLOCK (SHA_CBLOCK-8) -# define SHA_DIGEST_LENGTH 20 - -typedef struct SHAstate_st { - SHA_LONG h0, h1, h2, h3, h4; - SHA_LONG Nl, Nh; - SHA_LONG data[SHA_LBLOCK]; - unsigned int num; -} SHA_CTX; - -int SHA1_Init(SHA_CTX *c); -int SHA1_Update(SHA_CTX *c, const void *data, size_t len); -int SHA1_Final(unsigned char *md, SHA_CTX *c); -unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); -void SHA1_Transform(SHA_CTX *c, const unsigned char *data); - -# define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a - * contiguous array of 32 bit wide - * big-endian values. */ - -typedef struct SHA256state_st { - SHA_LONG h[8]; - SHA_LONG Nl, Nh; - SHA_LONG data[SHA_LBLOCK]; - unsigned int num, md_len; -} SHA256_CTX; - -int SHA224_Init(SHA256_CTX *c); -int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA224_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); -int SHA256_Init(SHA256_CTX *c); -int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA256_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); -void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); - -# define SHA224_DIGEST_LENGTH 28 -# define SHA256_DIGEST_LENGTH 32 -# define SHA384_DIGEST_LENGTH 48 -# define SHA512_DIGEST_LENGTH 64 - -/* - * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 - * being exactly 64-bit wide. See Implementation Notes in sha512.c - * for further details. - */ -/* - * SHA-512 treats input data as a - * contiguous array of 64 bit - * wide big-endian values. - */ -# define SHA512_CBLOCK (SHA_LBLOCK*8) -# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -# define SHA_LONG64 unsigned __int64 -# define U64(C) C##UI64 -# elif defined(__arch64__) -# define SHA_LONG64 unsigned long -# define U64(C) C##UL -# else -# define SHA_LONG64 unsigned long long -# define U64(C) C##ULL -# endif - -typedef struct SHA512state_st { - SHA_LONG64 h[8]; - SHA_LONG64 Nl, Nh; - union { - SHA_LONG64 d[SHA_LBLOCK]; - unsigned char p[SHA512_CBLOCK]; - } u; - unsigned int num, md_len; -} SHA512_CTX; - -int SHA384_Init(SHA512_CTX *c); -int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA384_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); -int SHA512_Init(SHA512_CTX *c); -int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA512_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); -void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/srp.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/srp.h deleted file mode 100644 index aaf13558..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/srp.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2004, EdelKey Project. 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 - * - * Originally written by Christophe Renou and Peter Sylvester, - * for the EdelKey project. - */ - -#ifndef HEADER_SRP_H -# define HEADER_SRP_H - -#include - -#ifndef OPENSSL_NO_SRP -# include -# include -# include -# include -# include - -# ifdef __cplusplus -extern "C" { -# endif - -typedef struct SRP_gN_cache_st { - char *b64_bn; - BIGNUM *bn; -} SRP_gN_cache; - - -DEFINE_STACK_OF(SRP_gN_cache) - -typedef struct SRP_user_pwd_st { - /* Owned by us. */ - char *id; - BIGNUM *s; - BIGNUM *v; - /* Not owned by us. */ - const BIGNUM *g; - const BIGNUM *N; - /* Owned by us. */ - char *info; -} SRP_user_pwd; - -void SRP_user_pwd_free(SRP_user_pwd *user_pwd); - -DEFINE_STACK_OF(SRP_user_pwd) - -typedef struct SRP_VBASE_st { - STACK_OF(SRP_user_pwd) *users_pwd; - STACK_OF(SRP_gN_cache) *gN_cache; -/* to simulate a user */ - char *seed_key; - const BIGNUM *default_g; - const BIGNUM *default_N; -} SRP_VBASE; - -/* - * Internal structure storing N and g pair - */ -typedef struct SRP_gN_st { - char *id; - const BIGNUM *g; - const BIGNUM *N; -} SRP_gN; - -DEFINE_STACK_OF(SRP_gN) - -SRP_VBASE *SRP_VBASE_new(char *seed_key); -void SRP_VBASE_free(SRP_VBASE *vb); -int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); - -/* This method ignores the configured seed and fails for an unknown user. */ -DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)) -/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ -SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); - -char *SRP_create_verifier(const char *user, const char *pass, char **salt, - char **verifier, const char *N, const char *g); -int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, - BIGNUM **verifier, const BIGNUM *N, - const BIGNUM *g); - -# define SRP_NO_ERROR 0 -# define SRP_ERR_VBASE_INCOMPLETE_FILE 1 -# define SRP_ERR_VBASE_BN_LIB 2 -# define SRP_ERR_OPEN_FILE 3 -# define SRP_ERR_MEMORY 4 - -# define DB_srptype 0 -# define DB_srpverifier 1 -# define DB_srpsalt 2 -# define DB_srpid 3 -# define DB_srpgN 4 -# define DB_srpinfo 5 -# undef DB_NUMBER -# define DB_NUMBER 6 - -# define DB_SRP_INDEX 'I' -# define DB_SRP_VALID 'V' -# define DB_SRP_REVOKED 'R' -# define DB_SRP_MODIF 'v' - -/* see srp.c */ -char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N); -SRP_gN *SRP_get_default_gN(const char *id); - -/* server side .... */ -BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, - const BIGNUM *b, const BIGNUM *N); -BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, - const BIGNUM *v); -int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N); -BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N); - -/* client side .... */ -BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass); -BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g); -BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, - const BIGNUM *x, const BIGNUM *a, const BIGNUM *u); -int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N); - -# define SRP_MINIMAL_N 1024 - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/srtp.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/srtp.h deleted file mode 100644 index 0b57c235..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/srtp.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011-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 - */ - -/* - * DTLS code by Eric Rescorla - * - * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. - */ - -#ifndef HEADER_D1_SRTP_H -# define HEADER_D1_SRTP_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define SRTP_AES128_CM_SHA1_80 0x0001 -# define SRTP_AES128_CM_SHA1_32 0x0002 -# define SRTP_AES128_F8_SHA1_80 0x0003 -# define SRTP_AES128_F8_SHA1_32 0x0004 -# define SRTP_NULL_SHA1_80 0x0005 -# define SRTP_NULL_SHA1_32 0x0006 - -/* AEAD SRTP protection profiles from RFC 7714 */ -# define SRTP_AEAD_AES_128_GCM 0x0007 -# define SRTP_AEAD_AES_256_GCM 0x0008 - -# ifndef OPENSSL_NO_SRTP - -__owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); -__owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); - -__owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); -__owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); - -# endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ssl.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ssl.h deleted file mode 100644 index 6724ccf2..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ssl.h +++ /dev/null @@ -1,2438 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved - * Copyright 2005 Nokia. 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_SSL_H -# define HEADER_SSL_H - -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# endif -# include -# include -# include -# include - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* OpenSSL version number for ASN.1 encoding of the session information */ -/*- - * Version 0 - initial version - * Version 1 - added the optional peer certificate - */ -# define SSL_SESSION_ASN1_VERSION 0x0001 - -# define SSL_MAX_SSL_SESSION_ID_LENGTH 32 -# define SSL_MAX_SID_CTX_LENGTH 32 - -# define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) -# define SSL_MAX_KEY_ARG_LENGTH 8 -# define SSL_MAX_MASTER_KEY_LENGTH 48 - -/* The maximum number of encrypt/decrypt pipelines we can support */ -# define SSL_MAX_PIPELINES 32 - -/* text strings for the ciphers */ - -/* These are used to specify which ciphers to use and not to use */ - -# define SSL_TXT_LOW "LOW" -# define SSL_TXT_MEDIUM "MEDIUM" -# define SSL_TXT_HIGH "HIGH" -# define SSL_TXT_FIPS "FIPS" - -# define SSL_TXT_aNULL "aNULL" -# define SSL_TXT_eNULL "eNULL" -# define SSL_TXT_NULL "NULL" - -# define SSL_TXT_kRSA "kRSA" -# define SSL_TXT_kDHr "kDHr"/* this cipher class has been removed */ -# define SSL_TXT_kDHd "kDHd"/* this cipher class has been removed */ -# define SSL_TXT_kDH "kDH"/* this cipher class has been removed */ -# define SSL_TXT_kEDH "kEDH"/* alias for kDHE */ -# define SSL_TXT_kDHE "kDHE" -# define SSL_TXT_kECDHr "kECDHr"/* this cipher class has been removed */ -# define SSL_TXT_kECDHe "kECDHe"/* this cipher class has been removed */ -# define SSL_TXT_kECDH "kECDH"/* this cipher class has been removed */ -# define SSL_TXT_kEECDH "kEECDH"/* alias for kECDHE */ -# define SSL_TXT_kECDHE "kECDHE" -# define SSL_TXT_kPSK "kPSK" -# define SSL_TXT_kRSAPSK "kRSAPSK" -# define SSL_TXT_kECDHEPSK "kECDHEPSK" -# define SSL_TXT_kDHEPSK "kDHEPSK" -# define SSL_TXT_kGOST "kGOST" -# define SSL_TXT_kSRP "kSRP" - -# define SSL_TXT_aRSA "aRSA" -# define SSL_TXT_aDSS "aDSS" -# define SSL_TXT_aDH "aDH"/* this cipher class has been removed */ -# define SSL_TXT_aECDH "aECDH"/* this cipher class has been removed */ -# define SSL_TXT_aECDSA "aECDSA" -# define SSL_TXT_aPSK "aPSK" -# define SSL_TXT_aGOST94 "aGOST94" -# define SSL_TXT_aGOST01 "aGOST01" -# define SSL_TXT_aGOST12 "aGOST12" -# define SSL_TXT_aGOST "aGOST" -# define SSL_TXT_aSRP "aSRP" - -# define SSL_TXT_DSS "DSS" -# define SSL_TXT_DH "DH" -# define SSL_TXT_DHE "DHE"/* same as "kDHE:-ADH" */ -# define SSL_TXT_EDH "EDH"/* alias for DHE */ -# define SSL_TXT_ADH "ADH" -# define SSL_TXT_RSA "RSA" -# define SSL_TXT_ECDH "ECDH" -# define SSL_TXT_EECDH "EECDH"/* alias for ECDHE" */ -# define SSL_TXT_ECDHE "ECDHE"/* same as "kECDHE:-AECDH" */ -# define SSL_TXT_AECDH "AECDH" -# define SSL_TXT_ECDSA "ECDSA" -# define SSL_TXT_PSK "PSK" -# define SSL_TXT_SRP "SRP" - -# define SSL_TXT_DES "DES" -# define SSL_TXT_3DES "3DES" -# define SSL_TXT_RC4 "RC4" -# define SSL_TXT_RC2 "RC2" -# define SSL_TXT_IDEA "IDEA" -# define SSL_TXT_SEED "SEED" -# define SSL_TXT_AES128 "AES128" -# define SSL_TXT_AES256 "AES256" -# define SSL_TXT_AES "AES" -# define SSL_TXT_AES_GCM "AESGCM" -# define SSL_TXT_AES_CCM "AESCCM" -# define SSL_TXT_AES_CCM_8 "AESCCM8" -# define SSL_TXT_CAMELLIA128 "CAMELLIA128" -# define SSL_TXT_CAMELLIA256 "CAMELLIA256" -# define SSL_TXT_CAMELLIA "CAMELLIA" -# define SSL_TXT_CHACHA20 "CHACHA20" -# define SSL_TXT_GOST "GOST89" -# define SSL_TXT_ARIA "ARIA" -# define SSL_TXT_ARIA_GCM "ARIAGCM" -# define SSL_TXT_ARIA128 "ARIA128" -# define SSL_TXT_ARIA256 "ARIA256" - -# define SSL_TXT_MD5 "MD5" -# define SSL_TXT_SHA1 "SHA1" -# define SSL_TXT_SHA "SHA"/* same as "SHA1" */ -# define SSL_TXT_GOST94 "GOST94" -# define SSL_TXT_GOST89MAC "GOST89MAC" -# define SSL_TXT_GOST12 "GOST12" -# define SSL_TXT_GOST89MAC12 "GOST89MAC12" -# define SSL_TXT_SHA256 "SHA256" -# define SSL_TXT_SHA384 "SHA384" - -# define SSL_TXT_SSLV3 "SSLv3" -# define SSL_TXT_TLSV1 "TLSv1" -# define SSL_TXT_TLSV1_1 "TLSv1.1" -# define SSL_TXT_TLSV1_2 "TLSv1.2" - -# define SSL_TXT_ALL "ALL" - -/*- - * COMPLEMENTOF* definitions. These identifiers are used to (de-select) - * ciphers normally not being used. - * Example: "RC4" will activate all ciphers using RC4 including ciphers - * without authentication, which would normally disabled by DEFAULT (due - * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" - * will make sure that it is also disabled in the specific selection. - * COMPLEMENTOF* identifiers are portable between version, as adjustments - * to the default cipher setup will also be included here. - * - * COMPLEMENTOFDEFAULT does not experience the same special treatment that - * DEFAULT gets, as only selection is being done and no sorting as needed - * for DEFAULT. - */ -# define SSL_TXT_CMPALL "COMPLEMENTOFALL" -# define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" - -/* - * The following cipher list is used by default. It also is substituted when - * an application-defined cipher list string starts with 'DEFAULT'. - * This applies to ciphersuites for TLSv1.2 and below. - */ -# define SSL_DEFAULT_CIPHER_LIST "ALL:!COMPLEMENTOFDEFAULT:!eNULL" -/* This is the default set of TLSv1.3 ciphersuites */ -# if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) -# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ - "TLS_CHACHA20_POLY1305_SHA256:" \ - "TLS_AES_128_GCM_SHA256" -# else -# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ - "TLS_AES_128_GCM_SHA256" -#endif -/* - * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always - * starts with a reasonable order, and all we have to do for DEFAULT is - * throwing out anonymous and unencrypted ciphersuites! (The latter are not - * actually enabled by ALL, but "ALL:RSA" would enable some of them.) - */ - -/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ -# define SSL_SENT_SHUTDOWN 1 -# define SSL_RECEIVED_SHUTDOWN 2 - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -# define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 -# define SSL_FILETYPE_PEM X509_FILETYPE_PEM - -/* - * This is needed to stop compilers complaining about the 'struct ssl_st *' - * function parameters used to prototype callbacks in SSL_CTX. - */ -typedef struct ssl_st *ssl_crock_st; -typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; -typedef struct ssl_method_st SSL_METHOD; -typedef struct ssl_cipher_st SSL_CIPHER; -typedef struct ssl_session_st SSL_SESSION; -typedef struct tls_sigalgs_st TLS_SIGALGS; -typedef struct ssl_conf_ctx_st SSL_CONF_CTX; -typedef struct ssl_comp_st SSL_COMP; - -STACK_OF(SSL_CIPHER); -STACK_OF(SSL_COMP); - -/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ -typedef struct srtp_protection_profile_st { - const char *name; - unsigned long id; -} SRTP_PROTECTION_PROFILE; - -DEFINE_STACK_OF(SRTP_PROTECTION_PROFILE) - -typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, - int len, void *arg); -typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, - STACK_OF(SSL_CIPHER) *peer_ciphers, - const SSL_CIPHER **cipher, void *arg); - -/* Extension context codes */ -/* This extension is only allowed in TLS */ -#define SSL_EXT_TLS_ONLY 0x0001 -/* This extension is only allowed in DTLS */ -#define SSL_EXT_DTLS_ONLY 0x0002 -/* Some extensions may be allowed in DTLS but we don't implement them for it */ -#define SSL_EXT_TLS_IMPLEMENTATION_ONLY 0x0004 -/* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */ -#define SSL_EXT_SSL3_ALLOWED 0x0008 -/* Extension is only defined for TLS1.2 and below */ -#define SSL_EXT_TLS1_2_AND_BELOW_ONLY 0x0010 -/* Extension is only defined for TLS1.3 and above */ -#define SSL_EXT_TLS1_3_ONLY 0x0020 -/* Ignore this extension during parsing if we are resuming */ -#define SSL_EXT_IGNORE_ON_RESUMPTION 0x0040 -#define SSL_EXT_CLIENT_HELLO 0x0080 -/* Really means TLS1.2 or below */ -#define SSL_EXT_TLS1_2_SERVER_HELLO 0x0100 -#define SSL_EXT_TLS1_3_SERVER_HELLO 0x0200 -#define SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS 0x0400 -#define SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST 0x0800 -#define SSL_EXT_TLS1_3_CERTIFICATE 0x1000 -#define SSL_EXT_TLS1_3_NEW_SESSION_TICKET 0x2000 -#define SSL_EXT_TLS1_3_CERTIFICATE_REQUEST 0x4000 - -/* Typedefs for handling custom extensions */ - -typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type, - const unsigned char **out, size_t *outlen, - int *al, void *add_arg); - -typedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type, - const unsigned char *out, void *add_arg); - -typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type, - const unsigned char *in, size_t inlen, - int *al, void *parse_arg); - - -typedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char **out, - size_t *outlen, X509 *x, - size_t chainidx, - int *al, void *add_arg); - -typedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char *out, - void *add_arg); - -typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char *in, - size_t inlen, X509 *x, - size_t chainidx, - int *al, void *parse_arg); - -/* Typedef for verification callback */ -typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); - -/* - * Some values are reserved until OpenSSL 1.2.0 because they were previously - * included in SSL_OP_ALL in a 1.1.x release. - * - * Reserved value (until OpenSSL 1.2.0) 0x00000001U - * Reserved value (until OpenSSL 1.2.0) 0x00000002U - */ -/* Allow initial connection to servers that don't support RI */ -# define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004U - -/* Reserved value (until OpenSSL 1.2.0) 0x00000008U */ -# define SSL_OP_TLSEXT_PADDING 0x00000010U -/* Reserved value (until OpenSSL 1.2.0) 0x00000020U */ -# define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040U -/* - * Reserved value (until OpenSSL 1.2.0) 0x00000080U - * Reserved value (until OpenSSL 1.2.0) 0x00000100U - * Reserved value (until OpenSSL 1.2.0) 0x00000200U - */ - -/* In TLSv1.3 allow a non-(ec)dhe based kex_mode */ -# define SSL_OP_ALLOW_NO_DHE_KEX 0x00000400U - -/* - * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in - * OpenSSL 0.9.6d. Usually (depending on the application protocol) the - * workaround is not needed. Unfortunately some broken SSL/TLS - * implementations cannot handle it at all, which is why we include it in - * SSL_OP_ALL. Added in 0.9.6e - */ -# define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800U - -/* DTLS options */ -# define SSL_OP_NO_QUERY_MTU 0x00001000U -/* Turn on Cookie Exchange (on relevant for servers) */ -# define SSL_OP_COOKIE_EXCHANGE 0x00002000U -/* Don't use RFC4507 ticket extension */ -# define SSL_OP_NO_TICKET 0x00004000U -# ifndef OPENSSL_NO_DTLS1_METHOD -/* Use Cisco's "speshul" version of DTLS_BAD_VER - * (only with deprecated DTLSv1_client_method()) */ -# define SSL_OP_CISCO_ANYCONNECT 0x00008000U -# endif - -/* As server, disallow session resumption on renegotiation */ -# define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000U -/* Don't use compression even if supported */ -# define SSL_OP_NO_COMPRESSION 0x00020000U -/* Permit unsafe legacy renegotiation */ -# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000U -/* Disable encrypt-then-mac */ -# define SSL_OP_NO_ENCRYPT_THEN_MAC 0x00080000U - -/* - * Enable TLSv1.3 Compatibility mode. This is on by default. A future version - * of OpenSSL may have this disabled by default. - */ -# define SSL_OP_ENABLE_MIDDLEBOX_COMPAT 0x00100000U - -/* Prioritize Chacha20Poly1305 when client does. - * Modifies SSL_OP_CIPHER_SERVER_PREFERENCE */ -# define SSL_OP_PRIORITIZE_CHACHA 0x00200000U - -/* - * Set on servers to choose the cipher according to the server's preferences - */ -# define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000U -/* - * If set, a server will allow a client to issue a SSLv3.0 version number as - * latest version supported in the premaster secret, even when TLSv1.0 - * (version 3.1) was announced in the client hello. Normally this is - * forbidden to prevent version rollback attacks. - */ -# define SSL_OP_TLS_ROLLBACK_BUG 0x00800000U - -/* - * Switches off automatic TLSv1.3 anti-replay protection for early data. This - * is a server-side option only (no effect on the client). - */ -# define SSL_OP_NO_ANTI_REPLAY 0x01000000U - -# define SSL_OP_NO_SSLv3 0x02000000U -# define SSL_OP_NO_TLSv1 0x04000000U -# define SSL_OP_NO_TLSv1_2 0x08000000U -# define SSL_OP_NO_TLSv1_1 0x10000000U -# define SSL_OP_NO_TLSv1_3 0x20000000U - -# define SSL_OP_NO_DTLSv1 0x04000000U -# define SSL_OP_NO_DTLSv1_2 0x08000000U - -# define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv3|\ - SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2|SSL_OP_NO_TLSv1_3) -# define SSL_OP_NO_DTLS_MASK (SSL_OP_NO_DTLSv1|SSL_OP_NO_DTLSv1_2) - -/* Disallow all renegotiation */ -# define SSL_OP_NO_RENEGOTIATION 0x40000000U - -/* - * Make server add server-hello extension from early version of cryptopro - * draft, when GOST ciphersuite is negotiated. Required for interoperability - * with CryptoPro CSP 3.x - */ -# define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000U - -/* - * SSL_OP_ALL: various bug workarounds that should be rather harmless. - * This used to be 0x000FFFFFL before 0.9.7. - * This used to be 0x80000BFFU before 1.1.1. - */ -# define SSL_OP_ALL (SSL_OP_CRYPTOPRO_TLSEXT_BUG|\ - SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS|\ - SSL_OP_LEGACY_SERVER_CONNECT|\ - SSL_OP_TLSEXT_PADDING|\ - SSL_OP_SAFARI_ECDHE_ECDSA_BUG) - -/* OBSOLETE OPTIONS: retained for compatibility */ - -/* Removed from OpenSSL 1.1.0. Was 0x00000001L */ -/* Related to removed SSLv2. */ -# define SSL_OP_MICROSOFT_SESS_ID_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000002L */ -/* Related to removed SSLv2. */ -# define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x0 -/* Removed from OpenSSL 0.9.8q and 1.0.0c. Was 0x00000008L */ -/* Dead forever, see CVE-2010-4180 */ -# define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x0 -/* Removed from OpenSSL 1.0.1h and 1.0.2. Was 0x00000010L */ -/* Refers to ancient SSLREF and SSLv2. */ -# define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000020 */ -# define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x0 -/* Removed from OpenSSL 0.9.7h and 0.9.8b. Was 0x00000040L */ -# define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000080 */ -/* Ancient SSLeay version. */ -# define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000100L */ -# define SSL_OP_TLS_D5_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000200L */ -# define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00080000L */ -# define SSL_OP_SINGLE_ECDH_USE 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00100000L */ -# define SSL_OP_SINGLE_DH_USE 0x0 -/* Removed from OpenSSL 1.0.1k and 1.0.2. Was 0x00200000L */ -# define SSL_OP_EPHEMERAL_RSA 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x01000000L */ -# define SSL_OP_NO_SSLv2 0x0 -/* Removed from OpenSSL 1.0.1. Was 0x08000000L */ -# define SSL_OP_PKCS1_CHECK_1 0x0 -/* Removed from OpenSSL 1.0.1. Was 0x10000000L */ -# define SSL_OP_PKCS1_CHECK_2 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x20000000L */ -# define SSL_OP_NETSCAPE_CA_DN_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x40000000L */ -# define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x0 - -/* - * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success - * when just a single record has been written): - */ -# define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001U -/* - * Make it possible to retry SSL_write() with changed buffer location (buffer - * contents must stay the same!); this is not the default to avoid the - * misconception that non-blocking SSL_write() behaves like non-blocking - * write(): - */ -# define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002U -/* - * Never bother the application with retries if the transport is blocking: - */ -# define SSL_MODE_AUTO_RETRY 0x00000004U -/* Don't attempt to automatically build certificate chain */ -# define SSL_MODE_NO_AUTO_CHAIN 0x00000008U -/* - * Save RAM by releasing read and write buffers when they're empty. (SSL3 and - * TLS only.) Released buffers are freed. - */ -# define SSL_MODE_RELEASE_BUFFERS 0x00000010U -/* - * Send the current time in the Random fields of the ClientHello and - * ServerHello records for compatibility with hypothetical implementations - * that require it. - */ -# define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020U -# define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040U -/* - * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications - * that reconnect with a downgraded protocol version; see - * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your - * application attempts a normal handshake. Only use this in explicit - * fallback retries, following the guidance in - * draft-ietf-tls-downgrade-scsv-00. - */ -# define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U -/* - * Support Asynchronous operation - */ -# define SSL_MODE_ASYNC 0x00000100U - -/* - * When using DTLS/SCTP, include the terminating zero in the label - * used for computing the endpoint-pair shared secret. Required for - * interoperability with implementations having this bug like these - * older version of OpenSSL: - * - OpenSSL 1.0.0 series - * - OpenSSL 1.0.1 series - * - OpenSSL 1.0.2 series - * - OpenSSL 1.1.0 series - * - OpenSSL 1.1.1 and 1.1.1a - */ -# define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U - -/* Cert related flags */ -/* - * Many implementations ignore some aspects of the TLS standards such as - * enforcing certificate chain algorithms. When this is set we enforce them. - */ -# define SSL_CERT_FLAG_TLS_STRICT 0x00000001U - -/* Suite B modes, takes same values as certificate verify flags */ -# define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 -/* Suite B 192 bit only mode */ -# define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 -/* Suite B 128 bit mode allowing 192 bit algorithms */ -# define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 - -/* Perform all sorts of protocol violations for testing purposes */ -# define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 - -/* Flags for building certificate chains */ -/* Treat any existing certificates as untrusted CAs */ -# define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 -/* Don't include root CA in chain */ -# define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 -/* Just check certificates already there */ -# define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 -/* Ignore verification errors */ -# define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 -/* Clear verification errors from queue */ -# define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 - -/* Flags returned by SSL_check_chain */ -/* Certificate can be used with this session */ -# define CERT_PKEY_VALID 0x1 -/* Certificate can also be used for signing */ -# define CERT_PKEY_SIGN 0x2 -/* EE certificate signing algorithm OK */ -# define CERT_PKEY_EE_SIGNATURE 0x10 -/* CA signature algorithms OK */ -# define CERT_PKEY_CA_SIGNATURE 0x20 -/* EE certificate parameters OK */ -# define CERT_PKEY_EE_PARAM 0x40 -/* CA certificate parameters OK */ -# define CERT_PKEY_CA_PARAM 0x80 -/* Signing explicitly allowed as opposed to SHA1 fallback */ -# define CERT_PKEY_EXPLICIT_SIGN 0x100 -/* Client CA issuer names match (always set for server cert) */ -# define CERT_PKEY_ISSUER_NAME 0x200 -/* Cert type matches client types (always set for server cert) */ -# define CERT_PKEY_CERT_TYPE 0x400 -/* Cert chain suitable to Suite B */ -# define CERT_PKEY_SUITEB 0x800 - -# define SSL_CONF_FLAG_CMDLINE 0x1 -# define SSL_CONF_FLAG_FILE 0x2 -# define SSL_CONF_FLAG_CLIENT 0x4 -# define SSL_CONF_FLAG_SERVER 0x8 -# define SSL_CONF_FLAG_SHOW_ERRORS 0x10 -# define SSL_CONF_FLAG_CERTIFICATE 0x20 -# define SSL_CONF_FLAG_REQUIRE_PRIVATE 0x40 -/* Configuration value types */ -# define SSL_CONF_TYPE_UNKNOWN 0x0 -# define SSL_CONF_TYPE_STRING 0x1 -# define SSL_CONF_TYPE_FILE 0x2 -# define SSL_CONF_TYPE_DIR 0x3 -# define SSL_CONF_TYPE_NONE 0x4 - -/* Maximum length of the application-controlled segment of a a TLSv1.3 cookie */ -# define SSL_COOKIE_LENGTH 4096 - -/* - * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they - * cannot be used to clear bits. - */ - -unsigned long SSL_CTX_get_options(const SSL_CTX *ctx); -unsigned long SSL_get_options(const SSL *s); -unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op); -unsigned long SSL_clear_options(SSL *s, unsigned long op); -unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op); -unsigned long SSL_set_options(SSL *s, unsigned long op); - -# define SSL_CTX_set_mode(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) -# define SSL_CTX_clear_mode(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL) -# define SSL_CTX_get_mode(ctx) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) -# define SSL_clear_mode(ssl,op) \ - SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL) -# define SSL_set_mode(ssl,op) \ - SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) -# define SSL_get_mode(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) -# define SSL_set_mtu(ssl, mtu) \ - SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) -# define DTLS_set_link_mtu(ssl, mtu) \ - SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL) -# define DTLS_get_link_min_mtu(ssl) \ - SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL) - -# define SSL_get_secure_renegotiation_support(ssl) \ - SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) - -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_heartbeat(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT,0,NULL) -# endif - -# define SSL_CTX_set_cert_flags(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL) -# define SSL_set_cert_flags(s,op) \ - SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL) -# define SSL_CTX_clear_cert_flags(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) -# define SSL_clear_cert_flags(s,op) \ - SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) - -void SSL_CTX_set_msg_callback(SSL_CTX *ctx, - void (*cb) (int write_p, int version, - int content_type, const void *buf, - size_t len, SSL *ssl, void *arg)); -void SSL_set_msg_callback(SSL *ssl, - void (*cb) (int write_p, int version, - int content_type, const void *buf, - size_t len, SSL *ssl, void *arg)); -# define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) -# define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) - -# define SSL_get_extms_support(s) \ - SSL_ctrl((s),SSL_CTRL_GET_EXTMS_SUPPORT,0,NULL) - -# ifndef OPENSSL_NO_SRP - -/* see tls_srp.c */ -__owur int SSL_SRP_CTX_init(SSL *s); -__owur int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx); -int SSL_SRP_CTX_free(SSL *ctx); -int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); -__owur int SSL_srp_server_param_with_username(SSL *s, int *ad); -__owur int SRP_Calc_A_param(SSL *s); - -# endif - -/* 100k max cert list */ -# define SSL_MAX_CERT_LIST_DEFAULT 1024*100 - -# define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) - -/* - * This callback type is used inside SSL_CTX, SSL, and in the functions that - * set them. It is used to override the generation of SSL/TLS session IDs in - * a server. Return value should be zero on an error, non-zero to proceed. - * Also, callbacks should themselves check if the id they generate is unique - * otherwise the SSL handshake will fail with an error - callbacks can do - * this using the 'ssl' value they're passed by; - * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in - * is set at the maximum size the session ID can be. In SSLv3/TLSv1 it is 32 - * bytes. The callback can alter this length to be less if desired. It is - * also an error for the callback to set the size to zero. - */ -typedef int (*GEN_SESSION_CB) (SSL *ssl, unsigned char *id, - unsigned int *id_len); - -# define SSL_SESS_CACHE_OFF 0x0000 -# define SSL_SESS_CACHE_CLIENT 0x0001 -# define SSL_SESS_CACHE_SERVER 0x0002 -# define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) -# define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 -/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ -# define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 -# define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 -# define SSL_SESS_CACHE_NO_INTERNAL \ - (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) - -LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); -# define SSL_CTX_sess_number(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) -# define SSL_CTX_sess_connect(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) -# define SSL_CTX_sess_connect_good(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) -# define SSL_CTX_sess_connect_renegotiate(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) -# define SSL_CTX_sess_accept(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) -# define SSL_CTX_sess_accept_renegotiate(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) -# define SSL_CTX_sess_accept_good(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) -# define SSL_CTX_sess_hits(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) -# define SSL_CTX_sess_cb_hits(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) -# define SSL_CTX_sess_misses(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) -# define SSL_CTX_sess_timeouts(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) -# define SSL_CTX_sess_cache_full(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) - -void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, - int (*new_session_cb) (struct ssl_st *ssl, - SSL_SESSION *sess)); -int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, - SSL_SESSION *sess); -void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, - void (*remove_session_cb) (struct ssl_ctx_st - *ctx, - SSL_SESSION *sess)); -void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx, - SSL_SESSION *sess); -void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, - SSL_SESSION *(*get_session_cb) (struct ssl_st - *ssl, - const unsigned char - *data, int len, - int *copy)); -SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, - const unsigned char *data, - int len, int *copy); -void SSL_CTX_set_info_callback(SSL_CTX *ctx, - void (*cb) (const SSL *ssl, int type, int val)); -void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, - int val); -void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, - int (*client_cert_cb) (SSL *ssl, X509 **x509, - EVP_PKEY **pkey)); -int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509, - EVP_PKEY **pkey); -# ifndef OPENSSL_NO_ENGINE -__owur int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); -# endif -void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, - int (*app_gen_cookie_cb) (SSL *ssl, - unsigned char - *cookie, - unsigned int - *cookie_len)); -void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, - int (*app_verify_cookie_cb) (SSL *ssl, - const unsigned - char *cookie, - unsigned int - cookie_len)); - -void SSL_CTX_set_stateless_cookie_generate_cb( - SSL_CTX *ctx, - int (*gen_stateless_cookie_cb) (SSL *ssl, - unsigned char *cookie, - size_t *cookie_len)); -void SSL_CTX_set_stateless_cookie_verify_cb( - SSL_CTX *ctx, - int (*verify_stateless_cookie_cb) (SSL *ssl, - const unsigned char *cookie, - size_t cookie_len)); -# ifndef OPENSSL_NO_NEXTPROTONEG - -typedef int (*SSL_CTX_npn_advertised_cb_func)(SSL *ssl, - const unsigned char **out, - unsigned int *outlen, - void *arg); -void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, - SSL_CTX_npn_advertised_cb_func cb, - void *arg); -# define SSL_CTX_set_npn_advertised_cb SSL_CTX_set_next_protos_advertised_cb - -typedef int (*SSL_CTX_npn_select_cb_func)(SSL *s, - unsigned char **out, - unsigned char *outlen, - const unsigned char *in, - unsigned int inlen, - void *arg); -void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, - SSL_CTX_npn_select_cb_func cb, - void *arg); -# define SSL_CTX_set_npn_select_cb SSL_CTX_set_next_proto_select_cb - -void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, - unsigned *len); -# define SSL_get0_npn_negotiated SSL_get0_next_proto_negotiated -# endif - -__owur int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, - const unsigned char *in, unsigned int inlen, - const unsigned char *client, - unsigned int client_len); - -# define OPENSSL_NPN_UNSUPPORTED 0 -# define OPENSSL_NPN_NEGOTIATED 1 -# define OPENSSL_NPN_NO_OVERLAP 2 - -__owur int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, - unsigned int protos_len); -__owur int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, - unsigned int protos_len); -typedef int (*SSL_CTX_alpn_select_cb_func)(SSL *ssl, - const unsigned char **out, - unsigned char *outlen, - const unsigned char *in, - unsigned int inlen, - void *arg); -void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, - SSL_CTX_alpn_select_cb_func cb, - void *arg); -void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, - unsigned int *len); - -# ifndef OPENSSL_NO_PSK -/* - * the maximum length of the buffer given to callbacks containing the - * resulting identity/psk - */ -# define PSK_MAX_IDENTITY_LEN 128 -# define PSK_MAX_PSK_LEN 256 -typedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl, - const char *hint, - char *identity, - unsigned int max_identity_len, - unsigned char *psk, - unsigned int max_psk_len); -void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb); -void SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb); - -typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl, - const char *identity, - unsigned char *psk, - unsigned int max_psk_len); -void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb); -void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb); - -__owur int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); -__owur int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); -const char *SSL_get_psk_identity_hint(const SSL *s); -const char *SSL_get_psk_identity(const SSL *s); -# endif - -typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl, - const unsigned char *identity, - size_t identity_len, - SSL_SESSION **sess); -typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md, - const unsigned char **id, - size_t *idlen, - SSL_SESSION **sess); - -void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb); -void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, - SSL_psk_find_session_cb_func cb); -void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb); -void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, - SSL_psk_use_session_cb_func cb); - -/* Register callbacks to handle custom TLS Extensions for client or server. */ - -__owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, - unsigned int ext_type); - -__owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, - unsigned int ext_type, - custom_ext_add_cb add_cb, - custom_ext_free_cb free_cb, - void *add_arg, - custom_ext_parse_cb parse_cb, - void *parse_arg); - -__owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, - unsigned int ext_type, - custom_ext_add_cb add_cb, - custom_ext_free_cb free_cb, - void *add_arg, - custom_ext_parse_cb parse_cb, - void *parse_arg); - -__owur int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, - unsigned int context, - SSL_custom_ext_add_cb_ex add_cb, - SSL_custom_ext_free_cb_ex free_cb, - void *add_arg, - SSL_custom_ext_parse_cb_ex parse_cb, - void *parse_arg); - -__owur int SSL_extension_supported(unsigned int ext_type); - -# define SSL_NOTHING 1 -# define SSL_WRITING 2 -# define SSL_READING 3 -# define SSL_X509_LOOKUP 4 -# define SSL_ASYNC_PAUSED 5 -# define SSL_ASYNC_NO_JOBS 6 -# define SSL_CLIENT_HELLO_CB 7 - -/* These will only be used when doing non-blocking IO */ -# define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) -# define SSL_want_read(s) (SSL_want(s) == SSL_READING) -# define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) -# define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) -# define SSL_want_async(s) (SSL_want(s) == SSL_ASYNC_PAUSED) -# define SSL_want_async_job(s) (SSL_want(s) == SSL_ASYNC_NO_JOBS) -# define SSL_want_client_hello_cb(s) (SSL_want(s) == SSL_CLIENT_HELLO_CB) - -# define SSL_MAC_FLAG_READ_MAC_STREAM 1 -# define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 - -/* - * A callback for logging out TLS key material. This callback should log out - * |line| followed by a newline. - */ -typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line); - -/* - * SSL_CTX_set_keylog_callback configures a callback to log key material. This - * is intended for debugging use with tools like Wireshark. The cb function - * should log line followed by a newline. - */ -void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb); - -/* - * SSL_CTX_get_keylog_callback returns the callback configured by - * SSL_CTX_set_keylog_callback. - */ -SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx); - -int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data); -uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); -int SSL_set_max_early_data(SSL *s, uint32_t max_early_data); -uint32_t SSL_get_max_early_data(const SSL *s); -int SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data); -uint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx); -int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data); -uint32_t SSL_get_recv_max_early_data(const SSL *s); - -#ifdef __cplusplus -} -#endif - -# include -# include -# include /* This is mostly sslv3 with a few tweaks */ -# include /* Datagram TLS */ -# include /* Support for the use_srtp extension */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * These need to be after the above set of includes due to a compiler bug - * in VisualStudio 2015 - */ -DEFINE_STACK_OF_CONST(SSL_CIPHER) -DEFINE_STACK_OF(SSL_COMP) - -/* compatibility */ -# define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)(arg))) -# define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) -# define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0, \ - (char *)(a))) -# define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) -# define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) -# define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0, \ - (char *)(arg))) -DEPRECATEDIN_1_1_0(void SSL_set_debug(SSL *s, int debug)) - -/* TLSv1.3 KeyUpdate message types */ -/* -1 used so that this is an invalid value for the on-the-wire protocol */ -#define SSL_KEY_UPDATE_NONE -1 -/* Values as defined for the on-the-wire protocol */ -#define SSL_KEY_UPDATE_NOT_REQUESTED 0 -#define SSL_KEY_UPDATE_REQUESTED 1 - -/* - * The valid handshake states (one for each type message sent and one for each - * type of message received). There are also two "special" states: - * TLS = TLS or DTLS state - * DTLS = DTLS specific state - * CR/SR = Client Read/Server Read - * CW/SW = Client Write/Server Write - * - * The "special" states are: - * TLS_ST_BEFORE = No handshake has been initiated yet - * TLS_ST_OK = A handshake has been successfully completed - */ -typedef enum { - TLS_ST_BEFORE, - TLS_ST_OK, - DTLS_ST_CR_HELLO_VERIFY_REQUEST, - TLS_ST_CR_SRVR_HELLO, - TLS_ST_CR_CERT, - TLS_ST_CR_CERT_STATUS, - TLS_ST_CR_KEY_EXCH, - TLS_ST_CR_CERT_REQ, - TLS_ST_CR_SRVR_DONE, - TLS_ST_CR_SESSION_TICKET, - TLS_ST_CR_CHANGE, - TLS_ST_CR_FINISHED, - TLS_ST_CW_CLNT_HELLO, - TLS_ST_CW_CERT, - TLS_ST_CW_KEY_EXCH, - TLS_ST_CW_CERT_VRFY, - TLS_ST_CW_CHANGE, - TLS_ST_CW_NEXT_PROTO, - TLS_ST_CW_FINISHED, - TLS_ST_SW_HELLO_REQ, - TLS_ST_SR_CLNT_HELLO, - DTLS_ST_SW_HELLO_VERIFY_REQUEST, - TLS_ST_SW_SRVR_HELLO, - TLS_ST_SW_CERT, - TLS_ST_SW_KEY_EXCH, - TLS_ST_SW_CERT_REQ, - TLS_ST_SW_SRVR_DONE, - TLS_ST_SR_CERT, - TLS_ST_SR_KEY_EXCH, - TLS_ST_SR_CERT_VRFY, - TLS_ST_SR_NEXT_PROTO, - TLS_ST_SR_CHANGE, - TLS_ST_SR_FINISHED, - TLS_ST_SW_SESSION_TICKET, - TLS_ST_SW_CERT_STATUS, - TLS_ST_SW_CHANGE, - TLS_ST_SW_FINISHED, - TLS_ST_SW_ENCRYPTED_EXTENSIONS, - TLS_ST_CR_ENCRYPTED_EXTENSIONS, - TLS_ST_CR_CERT_VRFY, - TLS_ST_SW_CERT_VRFY, - TLS_ST_CR_HELLO_REQ, - TLS_ST_SW_KEY_UPDATE, - TLS_ST_CW_KEY_UPDATE, - TLS_ST_SR_KEY_UPDATE, - TLS_ST_CR_KEY_UPDATE, - TLS_ST_EARLY_DATA, - TLS_ST_PENDING_EARLY_DATA_END, - TLS_ST_CW_END_OF_EARLY_DATA, - TLS_ST_SR_END_OF_EARLY_DATA -} OSSL_HANDSHAKE_STATE; - -/* - * Most of the following state values are no longer used and are defined to be - * the closest equivalent value in the current state machine code. Not all - * defines have an equivalent and are set to a dummy value (-1). SSL_ST_CONNECT - * and SSL_ST_ACCEPT are still in use in the definition of SSL_CB_ACCEPT_LOOP, - * SSL_CB_ACCEPT_EXIT, SSL_CB_CONNECT_LOOP and SSL_CB_CONNECT_EXIT. - */ - -# define SSL_ST_CONNECT 0x1000 -# define SSL_ST_ACCEPT 0x2000 - -# define SSL_ST_MASK 0x0FFF - -# define SSL_CB_LOOP 0x01 -# define SSL_CB_EXIT 0x02 -# define SSL_CB_READ 0x04 -# define SSL_CB_WRITE 0x08 -# define SSL_CB_ALERT 0x4000/* used in callback */ -# define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) -# define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) -# define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) -# define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) -# define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) -# define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) -# define SSL_CB_HANDSHAKE_START 0x10 -# define SSL_CB_HANDSHAKE_DONE 0x20 - -/* Is the SSL_connection established? */ -# define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a)) -# define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a)) -int SSL_in_init(const SSL *s); -int SSL_in_before(const SSL *s); -int SSL_is_init_finished(const SSL *s); - -/* - * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you - * should not need these - */ -# define SSL_ST_READ_HEADER 0xF0 -# define SSL_ST_READ_BODY 0xF1 -# define SSL_ST_READ_DONE 0xF2 - -/*- - * Obtain latest Finished message - * -- that we sent (SSL_get_finished) - * -- that we expected from peer (SSL_get_peer_finished). - * Returns length (0 == no Finished so far), copies up to 'count' bytes. - */ -size_t SSL_get_finished(const SSL *s, void *buf, size_t count); -size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); - -/* - * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options are - * 'ored' with SSL_VERIFY_PEER if they are desired - */ -# define SSL_VERIFY_NONE 0x00 -# define SSL_VERIFY_PEER 0x01 -# define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 -# define SSL_VERIFY_CLIENT_ONCE 0x04 -# define SSL_VERIFY_POST_HANDSHAKE 0x08 - -# if OPENSSL_API_COMPAT < 0x10100000L -# define OpenSSL_add_ssl_algorithms() SSL_library_init() -# define SSLeay_add_ssl_algorithms() SSL_library_init() -# endif - -/* More backward compatibility */ -# define SSL_get_cipher(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) -# define SSL_get_cipher_bits(s,np) \ - SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) -# define SSL_get_cipher_version(s) \ - SSL_CIPHER_get_version(SSL_get_current_cipher(s)) -# define SSL_get_cipher_name(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) -# define SSL_get_time(a) SSL_SESSION_get_time(a) -# define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) -# define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) -# define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) - -# define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) -# define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) - -DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) -# define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value - * from SSL_AD_... */ -/* These alert types are for SSLv3 and TLSv1 */ -# define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY -/* fatal */ -# define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE -/* fatal */ -# define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC -# define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED -# define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW -/* fatal */ -# define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE -/* fatal */ -# define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE -/* Not for TLS */ -# define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE -# define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE -# define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE -# define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED -# define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED -# define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN -/* fatal */ -# define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER -/* fatal */ -# define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA -/* fatal */ -# define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED -/* fatal */ -# define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR -# define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR -/* fatal */ -# define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION -/* fatal */ -# define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION -/* fatal */ -# define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY -/* fatal */ -# define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR -# define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED -# define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION -# define SSL_AD_MISSING_EXTENSION TLS13_AD_MISSING_EXTENSION -# define SSL_AD_CERTIFICATE_REQUIRED TLS13_AD_CERTIFICATE_REQUIRED -# define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION -# define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE -# define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME -# define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE -# define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE -/* fatal */ -# define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY -/* fatal */ -# define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK -# define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL -# define SSL_ERROR_NONE 0 -# define SSL_ERROR_SSL 1 -# define SSL_ERROR_WANT_READ 2 -# define SSL_ERROR_WANT_WRITE 3 -# define SSL_ERROR_WANT_X509_LOOKUP 4 -# define SSL_ERROR_SYSCALL 5/* look at error stack/return - * value/errno */ -# define SSL_ERROR_ZERO_RETURN 6 -# define SSL_ERROR_WANT_CONNECT 7 -# define SSL_ERROR_WANT_ACCEPT 8 -# define SSL_ERROR_WANT_ASYNC 9 -# define SSL_ERROR_WANT_ASYNC_JOB 10 -# define SSL_ERROR_WANT_CLIENT_HELLO_CB 11 -# define SSL_CTRL_SET_TMP_DH 3 -# define SSL_CTRL_SET_TMP_ECDH 4 -# define SSL_CTRL_SET_TMP_DH_CB 6 -# define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 -# define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 -# define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 -# define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 -# define SSL_CTRL_GET_FLAGS 13 -# define SSL_CTRL_EXTRA_CHAIN_CERT 14 -# define SSL_CTRL_SET_MSG_CALLBACK 15 -# define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 -/* only applies to datagram connections */ -# define SSL_CTRL_SET_MTU 17 -/* Stats */ -# define SSL_CTRL_SESS_NUMBER 20 -# define SSL_CTRL_SESS_CONNECT 21 -# define SSL_CTRL_SESS_CONNECT_GOOD 22 -# define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 -# define SSL_CTRL_SESS_ACCEPT 24 -# define SSL_CTRL_SESS_ACCEPT_GOOD 25 -# define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 -# define SSL_CTRL_SESS_HIT 27 -# define SSL_CTRL_SESS_CB_HIT 28 -# define SSL_CTRL_SESS_MISSES 29 -# define SSL_CTRL_SESS_TIMEOUTS 30 -# define SSL_CTRL_SESS_CACHE_FULL 31 -# define SSL_CTRL_MODE 33 -# define SSL_CTRL_GET_READ_AHEAD 40 -# define SSL_CTRL_SET_READ_AHEAD 41 -# define SSL_CTRL_SET_SESS_CACHE_SIZE 42 -# define SSL_CTRL_GET_SESS_CACHE_SIZE 43 -# define SSL_CTRL_SET_SESS_CACHE_MODE 44 -# define SSL_CTRL_GET_SESS_CACHE_MODE 45 -# define SSL_CTRL_GET_MAX_CERT_LIST 50 -# define SSL_CTRL_SET_MAX_CERT_LIST 51 -# define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 -/* see tls1.h for macros based on these */ -# define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 -# define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 -# define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 -# define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 -# define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 -# define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 -# define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 */ -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 */ -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 */ -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 -# define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 -# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 -# define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 -# define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 -# define SSL_CTRL_SET_SRP_ARG 78 -# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 -# define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 -# define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT 85 -# define SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING 86 -# define SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS 87 -# endif -# define DTLS_CTRL_GET_TIMEOUT 73 -# define DTLS_CTRL_HANDLE_TIMEOUT 74 -# define SSL_CTRL_GET_RI_SUPPORT 76 -# define SSL_CTRL_CLEAR_MODE 78 -# define SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB 79 -# define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 -# define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 -# define SSL_CTRL_CHAIN 88 -# define SSL_CTRL_CHAIN_CERT 89 -# define SSL_CTRL_GET_GROUPS 90 -# define SSL_CTRL_SET_GROUPS 91 -# define SSL_CTRL_SET_GROUPS_LIST 92 -# define SSL_CTRL_GET_SHARED_GROUP 93 -# define SSL_CTRL_SET_SIGALGS 97 -# define SSL_CTRL_SET_SIGALGS_LIST 98 -# define SSL_CTRL_CERT_FLAGS 99 -# define SSL_CTRL_CLEAR_CERT_FLAGS 100 -# define SSL_CTRL_SET_CLIENT_SIGALGS 101 -# define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 -# define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 -# define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 -# define SSL_CTRL_BUILD_CERT_CHAIN 105 -# define SSL_CTRL_SET_VERIFY_CERT_STORE 106 -# define SSL_CTRL_SET_CHAIN_CERT_STORE 107 -# define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 -# define SSL_CTRL_GET_PEER_TMP_KEY 109 -# define SSL_CTRL_GET_RAW_CIPHERLIST 110 -# define SSL_CTRL_GET_EC_POINT_FORMATS 111 -# define SSL_CTRL_GET_CHAIN_CERTS 115 -# define SSL_CTRL_SELECT_CURRENT_CERT 116 -# define SSL_CTRL_SET_CURRENT_CERT 117 -# define SSL_CTRL_SET_DH_AUTO 118 -# define DTLS_CTRL_SET_LINK_MTU 120 -# define DTLS_CTRL_GET_LINK_MIN_MTU 121 -# define SSL_CTRL_GET_EXTMS_SUPPORT 122 -# define SSL_CTRL_SET_MIN_PROTO_VERSION 123 -# define SSL_CTRL_SET_MAX_PROTO_VERSION 124 -# define SSL_CTRL_SET_SPLIT_SEND_FRAGMENT 125 -# define SSL_CTRL_SET_MAX_PIPELINES 126 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 127 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129 -# define SSL_CTRL_GET_MIN_PROTO_VERSION 130 -# define SSL_CTRL_GET_MAX_PROTO_VERSION 131 -# define SSL_CTRL_GET_SIGNATURE_NID 132 -# define SSL_CTRL_GET_TMP_KEY 133 -# define SSL_CERT_SET_FIRST 1 -# define SSL_CERT_SET_NEXT 2 -# define SSL_CERT_SET_SERVER 3 -# define DTLSv1_get_timeout(ssl, arg) \ - SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)(arg)) -# define DTLSv1_handle_timeout(ssl) \ - SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL) -# define SSL_num_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) -# define SSL_clear_num_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) -# define SSL_total_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) -# define SSL_CTX_set_tmp_dh(ctx,dh) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) -# define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) -# define SSL_CTX_set_dh_auto(ctx, onoff) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_DH_AUTO,onoff,NULL) -# define SSL_set_dh_auto(s, onoff) \ - SSL_ctrl(s,SSL_CTRL_SET_DH_AUTO,onoff,NULL) -# define SSL_set_tmp_dh(ssl,dh) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) -# define SSL_set_tmp_ecdh(ssl,ecdh) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) -# define SSL_CTX_add_extra_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509)) -# define SSL_CTX_get_extra_chain_certs(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509) -# define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509) -# define SSL_CTX_clear_extra_chain_certs(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL) -# define SSL_CTX_set0_chain(ctx,sk) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk)) -# define SSL_CTX_set1_chain(ctx,sk) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)(sk)) -# define SSL_CTX_add0_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) -# define SSL_CTX_add1_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) -# define SSL_CTX_get0_chain_certs(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) -# define SSL_CTX_clear_chain_certs(ctx) \ - SSL_CTX_set0_chain(ctx,NULL) -# define SSL_CTX_build_cert_chain(ctx, flags) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) -# define SSL_CTX_select_current_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) -# define SSL_CTX_set_current_cert(ctx, op) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) -# define SSL_CTX_set0_verify_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) -# define SSL_CTX_set1_verify_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) -# define SSL_CTX_set0_chain_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) -# define SSL_CTX_set1_chain_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) -# define SSL_set0_chain(s,sk) \ - SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk)) -# define SSL_set1_chain(s,sk) \ - SSL_ctrl(s,SSL_CTRL_CHAIN,1,(char *)(sk)) -# define SSL_add0_chain_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) -# define SSL_add1_chain_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) -# define SSL_get0_chain_certs(s,px509) \ - SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERTS,0,px509) -# define SSL_clear_chain_certs(s) \ - SSL_set0_chain(s,NULL) -# define SSL_build_cert_chain(s, flags) \ - SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) -# define SSL_select_current_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) -# define SSL_set_current_cert(s,op) \ - SSL_ctrl(s,SSL_CTRL_SET_CURRENT_CERT, op, NULL) -# define SSL_set0_verify_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) -# define SSL_set1_verify_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) -# define SSL_set0_chain_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) -# define SSL_set1_chain_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) -# define SSL_get1_groups(s, glist) \ - SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist)) -# define SSL_CTX_set1_groups(ctx, glist, glistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) -# define SSL_CTX_set1_groups_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(s)) -# define SSL_set1_groups(s, glist, glistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) -# define SSL_set1_groups_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(str)) -# define SSL_get_shared_group(s, n) \ - SSL_ctrl(s,SSL_CTRL_GET_SHARED_GROUP,n,NULL) -# define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) -# define SSL_CTX_set1_sigalgs_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(s)) -# define SSL_set1_sigalgs(s, slist, slistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) -# define SSL_set1_sigalgs_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(str)) -# define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) -# define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(s)) -# define SSL_set1_client_sigalgs(s, slist, slistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) -# define SSL_set1_client_sigalgs_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(str)) -# define SSL_get0_certificate_types(s, clist) \ - SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)(clist)) -# define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen, \ - (char *)(clist)) -# define SSL_set1_client_certificate_types(s, clist, clistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)(clist)) -# define SSL_get_signature_nid(s, pn) \ - SSL_ctrl(s,SSL_CTRL_GET_SIGNATURE_NID,0,pn) -# define SSL_get_peer_signature_nid(s, pn) \ - SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn) -# define SSL_get_peer_tmp_key(s, pk) \ - SSL_ctrl(s,SSL_CTRL_GET_PEER_TMP_KEY,0,pk) -# define SSL_get_tmp_key(s, pk) \ - SSL_ctrl(s,SSL_CTRL_GET_TMP_KEY,0,pk) -# define SSL_get0_raw_cipherlist(s, plst) \ - SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,plst) -# define SSL_get0_ec_point_formats(s, plst) \ - SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,plst) -# define SSL_CTX_set_min_proto_version(ctx, version) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) -# define SSL_CTX_set_max_proto_version(ctx, version) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) -# define SSL_CTX_get_min_proto_version(ctx) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) -# define SSL_CTX_get_max_proto_version(ctx) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) -# define SSL_set_min_proto_version(s, version) \ - SSL_ctrl(s, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) -# define SSL_set_max_proto_version(s, version) \ - SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) -# define SSL_get_min_proto_version(s) \ - SSL_ctrl(s, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) -# define SSL_get_max_proto_version(s) \ - SSL_ctrl(s, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) - -/* Backwards compatibility, original 1.1.0 names */ -# define SSL_CTRL_GET_SERVER_TMP_KEY \ - SSL_CTRL_GET_PEER_TMP_KEY -# define SSL_get_server_tmp_key(s, pk) \ - SSL_get_peer_tmp_key(s, pk) - -/* - * The following symbol names are old and obsolete. They are kept - * for compatibility reasons only and should not be used anymore. - */ -# define SSL_CTRL_GET_CURVES SSL_CTRL_GET_GROUPS -# define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS -# define SSL_CTRL_SET_CURVES_LIST SSL_CTRL_SET_GROUPS_LIST -# define SSL_CTRL_GET_SHARED_CURVE SSL_CTRL_GET_SHARED_GROUP - -# define SSL_get1_curves SSL_get1_groups -# define SSL_CTX_set1_curves SSL_CTX_set1_groups -# define SSL_CTX_set1_curves_list SSL_CTX_set1_groups_list -# define SSL_set1_curves SSL_set1_groups -# define SSL_set1_curves_list SSL_set1_groups_list -# define SSL_get_shared_curve SSL_get_shared_group - - -# if OPENSSL_API_COMPAT < 0x10100000L -/* Provide some compatibility macros for removed functionality. */ -# define SSL_CTX_need_tmp_RSA(ctx) 0 -# define SSL_CTX_set_tmp_rsa(ctx,rsa) 1 -# define SSL_need_tmp_RSA(ssl) 0 -# define SSL_set_tmp_rsa(ssl,rsa) 1 -# define SSL_CTX_set_ecdh_auto(dummy, onoff) ((onoff) != 0) -# define SSL_set_ecdh_auto(dummy, onoff) ((onoff) != 0) -/* - * We "pretend" to call the callback to avoid warnings about unused static - * functions. - */ -# define SSL_CTX_set_tmp_rsa_callback(ctx, cb) while(0) (cb)(NULL, 0, 0) -# define SSL_set_tmp_rsa_callback(ssl, cb) while(0) (cb)(NULL, 0, 0) -# endif -__owur const BIO_METHOD *BIO_f_ssl(void); -__owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client); -__owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx); -__owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); -__owur int BIO_ssl_copy_session_id(BIO *to, BIO *from); -void BIO_ssl_shutdown(BIO *ssl_bio); - -__owur int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); -__owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); -int SSL_CTX_up_ref(SSL_CTX *ctx); -void SSL_CTX_free(SSL_CTX *); -__owur long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); -__owur long SSL_CTX_get_timeout(const SSL_CTX *ctx); -__owur X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); -void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); -void SSL_CTX_set1_cert_store(SSL_CTX *, X509_STORE *); -__owur int SSL_want(const SSL *s); -__owur int SSL_clear(SSL *s); - -void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); - -__owur const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); -__owur const SSL_CIPHER *SSL_get_pending_cipher(const SSL *s); -__owur int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); -__owur const char *SSL_CIPHER_get_version(const SSL_CIPHER *c); -__owur const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); -__owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); -__owur const char *OPENSSL_cipher_name(const char *rfc_name); -__owur uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c); -__owur uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c); -__owur int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c); -__owur int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c); -__owur const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c); -__owur int SSL_CIPHER_is_aead(const SSL_CIPHER *c); - -__owur int SSL_get_fd(const SSL *s); -__owur int SSL_get_rfd(const SSL *s); -__owur int SSL_get_wfd(const SSL *s); -__owur const char *SSL_get_cipher_list(const SSL *s, int n); -__owur char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size); -__owur int SSL_get_read_ahead(const SSL *s); -__owur int SSL_pending(const SSL *s); -__owur int SSL_has_pending(const SSL *s); -# ifndef OPENSSL_NO_SOCK -__owur int SSL_set_fd(SSL *s, int fd); -__owur int SSL_set_rfd(SSL *s, int fd); -__owur int SSL_set_wfd(SSL *s, int fd); -# endif -void SSL_set0_rbio(SSL *s, BIO *rbio); -void SSL_set0_wbio(SSL *s, BIO *wbio); -void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); -__owur BIO *SSL_get_rbio(const SSL *s); -__owur BIO *SSL_get_wbio(const SSL *s); -__owur int SSL_set_cipher_list(SSL *s, const char *str); -__owur int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); -__owur int SSL_set_ciphersuites(SSL *s, const char *str); -void SSL_set_read_ahead(SSL *s, int yes); -__owur int SSL_get_verify_mode(const SSL *s); -__owur int SSL_get_verify_depth(const SSL *s); -__owur SSL_verify_cb SSL_get_verify_callback(const SSL *s); -void SSL_set_verify(SSL *s, int mode, SSL_verify_cb callback); -void SSL_set_verify_depth(SSL *s, int depth); -void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg); -# ifndef OPENSSL_NO_RSA -__owur int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); -__owur int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, - long len); -# endif -__owur int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); -__owur int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, - long len); -__owur int SSL_use_certificate(SSL *ssl, X509 *x); -__owur int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); -__owur int SSL_use_cert_and_key(SSL *ssl, X509 *x509, EVP_PKEY *privatekey, - STACK_OF(X509) *chain, int override); - - -/* serverinfo file format versions */ -# define SSL_SERVERINFOV1 1 -# define SSL_SERVERINFOV2 2 - -/* Set serverinfo data for the current active cert. */ -__owur int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, - size_t serverinfo_length); -__owur int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version, - const unsigned char *serverinfo, - size_t serverinfo_length); -__owur int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); - -#ifndef OPENSSL_NO_RSA -__owur int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); -#endif - -__owur int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); -__owur int SSL_use_certificate_file(SSL *ssl, const char *file, int type); - -#ifndef OPENSSL_NO_RSA -__owur int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, - int type); -#endif -__owur int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, - int type); -__owur int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, - int type); -/* PEM type */ -__owur int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); -__owur int SSL_use_certificate_chain_file(SSL *ssl, const char *file); -__owur STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); -__owur int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, - const char *file); -int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, - const char *dir); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_load_error_strings() \ - OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ - | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) -# endif - -__owur const char *SSL_state_string(const SSL *s); -__owur const char *SSL_rstate_string(const SSL *s); -__owur const char *SSL_state_string_long(const SSL *s); -__owur const char *SSL_rstate_string_long(const SSL *s); -__owur long SSL_SESSION_get_time(const SSL_SESSION *s); -__owur long SSL_SESSION_set_time(SSL_SESSION *s, long t); -__owur long SSL_SESSION_get_timeout(const SSL_SESSION *s); -__owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); -__owur int SSL_SESSION_get_protocol_version(const SSL_SESSION *s); -__owur int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version); - -__owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s); -__owur int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname); -void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s, - const unsigned char **alpn, - size_t *len); -__owur int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, - const unsigned char *alpn, - size_t len); -__owur const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s); -__owur int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher); -__owur int SSL_SESSION_has_ticket(const SSL_SESSION *s); -__owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s); -void SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick, - size_t *len); -__owur uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s); -__owur int SSL_SESSION_set_max_early_data(SSL_SESSION *s, - uint32_t max_early_data); -__owur int SSL_copy_session_id(SSL *to, const SSL *from); -__owur X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); -__owur int SSL_SESSION_set1_id_context(SSL_SESSION *s, - const unsigned char *sid_ctx, - unsigned int sid_ctx_len); -__owur int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, - unsigned int sid_len); -__owur int SSL_SESSION_is_resumable(const SSL_SESSION *s); - -__owur SSL_SESSION *SSL_SESSION_new(void); -__owur SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src); -const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, - unsigned int *len); -const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s, - unsigned int *len); -__owur unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); -# ifndef OPENSSL_NO_STDIO -int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); -# endif -int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); -int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x); -int SSL_SESSION_up_ref(SSL_SESSION *ses); -void SSL_SESSION_free(SSL_SESSION *ses); -__owur int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); -__owur int SSL_set_session(SSL *to, SSL_SESSION *session); -int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session); -int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session); -__owur int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); -__owur int SSL_set_generate_session_id(SSL *s, GEN_SESSION_CB cb); -__owur int SSL_has_matching_session_id(const SSL *s, - const unsigned char *id, - unsigned int id_len); -SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, - long length); - -# ifdef HEADER_X509_H -__owur X509 *SSL_get_peer_certificate(const SSL *s); -# endif - -__owur STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); - -__owur int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); -__owur int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); -__owur SSL_verify_cb SSL_CTX_get_verify_callback(const SSL_CTX *ctx); -void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb callback); -void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); -void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, - int (*cb) (X509_STORE_CTX *, void *), - void *arg); -void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), - void *arg); -# ifndef OPENSSL_NO_RSA -__owur int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); -__owur int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, - long len); -# endif -__owur int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); -__owur int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, - const unsigned char *d, long len); -__owur int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); -__owur int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, - const unsigned char *d); -__owur int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey, - STACK_OF(X509) *chain, int override); - -void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); -void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); -pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx); -void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx); -void SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb); -void SSL_set_default_passwd_cb_userdata(SSL *s, void *u); -pem_password_cb *SSL_get_default_passwd_cb(SSL *s); -void *SSL_get_default_passwd_cb_userdata(SSL *s); - -__owur int SSL_CTX_check_private_key(const SSL_CTX *ctx); -__owur int SSL_check_private_key(const SSL *ctx); - -__owur int SSL_CTX_set_session_id_context(SSL_CTX *ctx, - const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - -SSL *SSL_new(SSL_CTX *ctx); -int SSL_up_ref(SSL *s); -int SSL_is_dtls(const SSL *s); -__owur int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - -__owur int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose); -__owur int SSL_set_purpose(SSL *ssl, int purpose); -__owur int SSL_CTX_set_trust(SSL_CTX *ctx, int trust); -__owur int SSL_set_trust(SSL *ssl, int trust); - -__owur int SSL_set1_host(SSL *s, const char *hostname); -__owur int SSL_add1_host(SSL *s, const char *hostname); -__owur const char *SSL_get0_peername(SSL *s); -void SSL_set_hostflags(SSL *s, unsigned int flags); - -__owur int SSL_CTX_dane_enable(SSL_CTX *ctx); -__owur int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, - uint8_t mtype, uint8_t ord); -__owur int SSL_dane_enable(SSL *s, const char *basedomain); -__owur int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector, - uint8_t mtype, unsigned const char *data, size_t dlen); -__owur int SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki); -__owur int SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector, - uint8_t *mtype, unsigned const char **data, - size_t *dlen); -/* - * Bridge opacity barrier between libcrypt and libssl, also needed to support - * offline testing in test/danetest.c - */ -SSL_DANE *SSL_get0_dane(SSL *ssl); -/* - * DANE flags - */ -unsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags); -unsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags); -unsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags); -unsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags); - -__owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); -__owur int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); - -__owur X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); -__owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); - -# ifndef OPENSSL_NO_SRP -int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); -int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); -int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); -int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, - char *(*cb) (SSL *, void *)); -int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, - int (*cb) (SSL *, void *)); -int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, - int (*cb) (SSL *, int *, void *)); -int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); - -int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, - BIGNUM *sa, BIGNUM *v, char *info); -int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, - const char *grp); - -__owur BIGNUM *SSL_get_srp_g(SSL *s); -__owur BIGNUM *SSL_get_srp_N(SSL *s); - -__owur char *SSL_get_srp_username(SSL *s); -__owur char *SSL_get_srp_userinfo(SSL *s); -# endif - -/* - * ClientHello callback and helpers. - */ - -# define SSL_CLIENT_HELLO_SUCCESS 1 -# define SSL_CLIENT_HELLO_ERROR 0 -# define SSL_CLIENT_HELLO_RETRY (-1) - -typedef int (*SSL_client_hello_cb_fn) (SSL *s, int *al, void *arg); -void SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn cb, - void *arg); -int SSL_client_hello_isv2(SSL *s); -unsigned int SSL_client_hello_get0_legacy_version(SSL *s); -size_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_compression_methods(SSL *s, - const unsigned char **out); -int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen); -int SSL_client_hello_get0_ext(SSL *s, unsigned int type, - const unsigned char **out, size_t *outlen); - -void SSL_certs_clear(SSL *s); -void SSL_free(SSL *ssl); -# ifdef OSSL_ASYNC_FD -/* - * Windows application developer has to include windows.h to use these. - */ -__owur int SSL_waiting_for_async(SSL *s); -__owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds); -__owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, - size_t *numaddfds, OSSL_ASYNC_FD *delfd, - size_t *numdelfds); -# endif -__owur int SSL_accept(SSL *ssl); -__owur int SSL_stateless(SSL *s); -__owur int SSL_connect(SSL *ssl); -__owur int SSL_read(SSL *ssl, void *buf, int num); -__owur int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); - -# define SSL_READ_EARLY_DATA_ERROR 0 -# define SSL_READ_EARLY_DATA_SUCCESS 1 -# define SSL_READ_EARLY_DATA_FINISH 2 - -__owur int SSL_read_early_data(SSL *s, void *buf, size_t num, - size_t *readbytes); -__owur int SSL_peek(SSL *ssl, void *buf, int num); -__owur int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); -__owur int SSL_write(SSL *ssl, const void *buf, int num); -__owur int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written); -__owur int SSL_write_early_data(SSL *s, const void *buf, size_t num, - size_t *written); -long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); -long SSL_callback_ctrl(SSL *, int, void (*)(void)); -long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); -long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); - -# define SSL_EARLY_DATA_NOT_SENT 0 -# define SSL_EARLY_DATA_REJECTED 1 -# define SSL_EARLY_DATA_ACCEPTED 2 - -__owur int SSL_get_early_data_status(const SSL *s); - -__owur int SSL_get_error(const SSL *s, int ret_code); -__owur const char *SSL_get_version(const SSL *s); - -/* This sets the 'default' SSL version that SSL_new() will create */ -__owur int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); - -# ifndef OPENSSL_NO_SSL3_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_method(void)) /* SSLv3 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_client_method(void)) -# endif - -#define SSLv23_method TLS_method -#define SSLv23_server_method TLS_server_method -#define SSLv23_client_method TLS_client_method - -/* Negotiate highest available SSL/TLS version */ -__owur const SSL_METHOD *TLS_method(void); -__owur const SSL_METHOD *TLS_server_method(void); -__owur const SSL_METHOD *TLS_client_method(void); - -# ifndef OPENSSL_NO_TLS1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_TLS1_1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_TLS1_2_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void)) -# endif - -# ifndef OPENSSL_NO_DTLS1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_DTLS1_2_METHOD -/* DTLSv1.2 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_client_method(void)) -# endif - -__owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ -__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ -__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ - -__owur size_t DTLS_get_data_mtu(const SSL *s); - -__owur STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); -__owur STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx); -__owur STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *s); -__owur STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s); - -__owur int SSL_do_handshake(SSL *s); -int SSL_key_update(SSL *s, int updatetype); -int SSL_get_key_update_type(const SSL *s); -int SSL_renegotiate(SSL *s); -int SSL_renegotiate_abbreviated(SSL *s); -__owur int SSL_renegotiate_pending(const SSL *s); -int SSL_shutdown(SSL *s); -__owur int SSL_verify_client_post_handshake(SSL *s); -void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val); -void SSL_set_post_handshake_auth(SSL *s, int val); - -__owur const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx); -__owur const SSL_METHOD *SSL_get_ssl_method(const SSL *s); -__owur int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); -__owur const char *SSL_alert_type_string_long(int value); -__owur const char *SSL_alert_type_string(int value); -__owur const char *SSL_alert_desc_string_long(int value); -__owur const char *SSL_alert_desc_string(int value); - -void SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); -void SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); -__owur const STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s); -__owur const STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx); -__owur int SSL_add1_to_CA_list(SSL *ssl, const X509 *x); -__owur int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x); -__owur const STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s); - -void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); -void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); -__owur STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); -__owur STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); -__owur int SSL_add_client_CA(SSL *ssl, X509 *x); -__owur int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); - -void SSL_set_connect_state(SSL *s); -void SSL_set_accept_state(SSL *s); - -__owur long SSL_get_default_timeout(const SSL *s); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_library_init() OPENSSL_init_ssl(0, NULL) -# endif - -__owur char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); -__owur STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk); - -__owur SSL *SSL_dup(SSL *ssl); - -__owur X509 *SSL_get_certificate(const SSL *ssl); -/* - * EVP_PKEY - */ -struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); - -__owur X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); -__owur EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); - -void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); -__owur int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); -void SSL_set_quiet_shutdown(SSL *ssl, int mode); -__owur int SSL_get_quiet_shutdown(const SSL *ssl); -void SSL_set_shutdown(SSL *ssl, int mode); -__owur int SSL_get_shutdown(const SSL *ssl); -__owur int SSL_version(const SSL *ssl); -__owur int SSL_client_version(const SSL *s); -__owur int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); -__owur int SSL_CTX_set_default_verify_dir(SSL_CTX *ctx); -__owur int SSL_CTX_set_default_verify_file(SSL_CTX *ctx); -__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, - const char *CApath); -# define SSL_get0_session SSL_get_session/* just peek at pointer */ -__owur SSL_SESSION *SSL_get_session(const SSL *ssl); -__owur SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ -__owur SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); -SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); -void SSL_set_info_callback(SSL *ssl, - void (*cb) (const SSL *ssl, int type, int val)); -void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, - int val); -__owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl); - -void SSL_set_verify_result(SSL *ssl, long v); -__owur long SSL_get_verify_result(const SSL *ssl); -__owur STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s); - -__owur size_t SSL_get_client_random(const SSL *ssl, unsigned char *out, - size_t outlen); -__owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out, - size_t outlen); -__owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess, - unsigned char *out, size_t outlen); -__owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess, - const unsigned char *in, size_t len); -uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *sess); - -#define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) -__owur int SSL_set_ex_data(SSL *ssl, int idx, void *data); -void *SSL_get_ex_data(const SSL *ssl, int idx); -#define SSL_SESSION_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef) -__owur int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); -void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); -#define SSL_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef) -__owur int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); -void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); - -__owur int SSL_get_ex_data_X509_STORE_CTX_idx(void); - -# define SSL_CTX_sess_set_cache_size(ctx,t) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) -# define SSL_CTX_sess_get_cache_size(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) -# define SSL_CTX_set_session_cache_mode(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) -# define SSL_CTX_get_session_cache_mode(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) - -# define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) -# define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) -# define SSL_CTX_get_read_ahead(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) -# define SSL_CTX_set_read_ahead(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) -# define SSL_CTX_get_max_cert_list(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) -# define SSL_CTX_set_max_cert_list(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) -# define SSL_get_max_cert_list(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) -# define SSL_set_max_cert_list(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) - -# define SSL_CTX_set_max_send_fragment(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) -# define SSL_set_max_send_fragment(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) -# define SSL_CTX_set_split_send_fragment(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) -# define SSL_set_split_send_fragment(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) -# define SSL_CTX_set_max_pipelines(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) -# define SSL_set_max_pipelines(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) - -void SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len); -void SSL_set_default_read_buffer_len(SSL *s, size_t len); - -# ifndef OPENSSL_NO_DH -/* NB: the |keylength| is only applicable when is_export is true */ -void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, - DH *(*dh) (SSL *ssl, int is_export, - int keylength)); -void SSL_set_tmp_dh_callback(SSL *ssl, - DH *(*dh) (SSL *ssl, int is_export, - int keylength)); -# endif - -__owur const COMP_METHOD *SSL_get_current_compression(const SSL *s); -__owur const COMP_METHOD *SSL_get_current_expansion(const SSL *s); -__owur const char *SSL_COMP_get_name(const COMP_METHOD *comp); -__owur const char *SSL_COMP_get0_name(const SSL_COMP *comp); -__owur int SSL_COMP_get_id(const SSL_COMP *comp); -STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); -__owur STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) - *meths); -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_COMP_free_compression_methods() while(0) continue -# endif -__owur int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); - -const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); -int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); -int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c); -int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len, - int isv2format, STACK_OF(SSL_CIPHER) **sk, - STACK_OF(SSL_CIPHER) **scsvs); - -/* TLS extensions functions */ -__owur int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); - -__owur int SSL_set_session_ticket_ext_cb(SSL *s, - tls_session_ticket_ext_cb_fn cb, - void *arg); - -/* Pre-shared secret session resumption functions */ -__owur int SSL_set_session_secret_cb(SSL *s, - tls_session_secret_cb_fn session_secret_cb, - void *arg); - -void SSL_CTX_set_not_resumable_session_callback(SSL_CTX *ctx, - int (*cb) (SSL *ssl, - int - is_forward_secure)); - -void SSL_set_not_resumable_session_callback(SSL *ssl, - int (*cb) (SSL *ssl, - int is_forward_secure)); - -void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, - size_t (*cb) (SSL *ssl, int type, - size_t len, void *arg)); -void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg); -void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx); -int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size); - -void SSL_set_record_padding_callback(SSL *ssl, - size_t (*cb) (SSL *ssl, int type, - size_t len, void *arg)); -void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg); -void *SSL_get_record_padding_callback_arg(const SSL *ssl); -int SSL_set_block_padding(SSL *ssl, size_t block_size); - -int SSL_set_num_tickets(SSL *s, size_t num_tickets); -size_t SSL_get_num_tickets(const SSL *s); -int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); -size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_cache_hit(s) SSL_session_reused(s) -# endif - -__owur int SSL_session_reused(const SSL *s); -__owur int SSL_is_server(const SSL *s); - -__owur __owur SSL_CONF_CTX *SSL_CONF_CTX_new(void); -int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); -void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); -unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); -__owur unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, - unsigned int flags); -__owur int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); - -void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); -void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); - -__owur int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); -__owur int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); -__owur int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); - -void SSL_add_ssl_module(void); -int SSL_config(SSL *s, const char *name); -int SSL_CTX_config(SSL_CTX *ctx, const char *name); - -# ifndef OPENSSL_NO_SSL_TRACE -void SSL_trace(int write_p, int version, int content_type, - const void *buf, size_t len, SSL *ssl, void *arg); -# endif - -# ifndef OPENSSL_NO_SOCK -int DTLSv1_listen(SSL *s, BIO_ADDR *client); -# endif - -# ifndef OPENSSL_NO_CT - -/* - * A callback for verifying that the received SCTs are sufficient. - * Expected to return 1 if they are sufficient, otherwise 0. - * May return a negative integer if an error occurs. - * A connection should be aborted if the SCTs are deemed insufficient. - */ -typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx, - const STACK_OF(SCT) *scts, void *arg); - -/* - * Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate - * the received SCTs. - * If the callback returns a non-positive result, the connection is terminated. - * Call this function before beginning a handshake. - * If a NULL |callback| is provided, SCT validation is disabled. - * |arg| is arbitrary userdata that will be passed to the callback whenever it - * is invoked. Ownership of |arg| remains with the caller. - * - * NOTE: A side-effect of setting a CT callback is that an OCSP stapled response - * will be requested. - */ -int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback, - void *arg); -int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx, - ssl_ct_validation_cb callback, - void *arg); -#define SSL_disable_ct(s) \ - ((void) SSL_set_validation_callback((s), NULL, NULL)) -#define SSL_CTX_disable_ct(ctx) \ - ((void) SSL_CTX_set_validation_callback((ctx), NULL, NULL)) - -/* - * The validation type enumerates the available behaviours of the built-in SSL - * CT validation callback selected via SSL_enable_ct() and SSL_CTX_enable_ct(). - * The underlying callback is a static function in libssl. - */ -enum { - SSL_CT_VALIDATION_PERMISSIVE = 0, - SSL_CT_VALIDATION_STRICT -}; - -/* - * Enable CT by setting up a callback that implements one of the built-in - * validation variants. The SSL_CT_VALIDATION_PERMISSIVE variant always - * continues the handshake, the application can make appropriate decisions at - * handshake completion. The SSL_CT_VALIDATION_STRICT variant requires at - * least one valid SCT, or else handshake termination will be requested. The - * handshake may continue anyway if SSL_VERIFY_NONE is in effect. - */ -int SSL_enable_ct(SSL *s, int validation_mode); -int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode); - -/* - * Report whether a non-NULL callback is enabled. - */ -int SSL_ct_is_enabled(const SSL *s); -int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx); - -/* Gets the SCTs received from a connection */ -const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s); - -/* - * Loads the CT log list from the default location. - * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, - * the log information loaded from this file will be appended to the - * CTLOG_STORE. - * Returns 1 on success, 0 otherwise. - */ -int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx); - -/* - * Loads the CT log list from the specified file path. - * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, - * the log information loaded from this file will be appended to the - * CTLOG_STORE. - * Returns 1 on success, 0 otherwise. - */ -int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path); - -/* - * Sets the CT log list used by all SSL connections created from this SSL_CTX. - * Ownership of the CTLOG_STORE is transferred to the SSL_CTX. - */ -void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs); - -/* - * Gets the CT log list used by all SSL connections created from this SSL_CTX. - * This will be NULL unless one of the following functions has been called: - * - SSL_CTX_set_default_ctlog_list_file - * - SSL_CTX_set_ctlog_list_file - * - SSL_CTX_set_ctlog_store - */ -const CTLOG_STORE *SSL_CTX_get0_ctlog_store(const SSL_CTX *ctx); - -# endif /* OPENSSL_NO_CT */ - -/* What the "other" parameter contains in security callback */ -/* Mask for type */ -# define SSL_SECOP_OTHER_TYPE 0xffff0000 -# define SSL_SECOP_OTHER_NONE 0 -# define SSL_SECOP_OTHER_CIPHER (1 << 16) -# define SSL_SECOP_OTHER_CURVE (2 << 16) -# define SSL_SECOP_OTHER_DH (3 << 16) -# define SSL_SECOP_OTHER_PKEY (4 << 16) -# define SSL_SECOP_OTHER_SIGALG (5 << 16) -# define SSL_SECOP_OTHER_CERT (6 << 16) - -/* Indicated operation refers to peer key or certificate */ -# define SSL_SECOP_PEER 0x1000 - -/* Values for "op" parameter in security callback */ - -/* Called to filter ciphers */ -/* Ciphers client supports */ -# define SSL_SECOP_CIPHER_SUPPORTED (1 | SSL_SECOP_OTHER_CIPHER) -/* Cipher shared by client/server */ -# define SSL_SECOP_CIPHER_SHARED (2 | SSL_SECOP_OTHER_CIPHER) -/* Sanity check of cipher server selects */ -# define SSL_SECOP_CIPHER_CHECK (3 | SSL_SECOP_OTHER_CIPHER) -/* Curves supported by client */ -# define SSL_SECOP_CURVE_SUPPORTED (4 | SSL_SECOP_OTHER_CURVE) -/* Curves shared by client/server */ -# define SSL_SECOP_CURVE_SHARED (5 | SSL_SECOP_OTHER_CURVE) -/* Sanity check of curve server selects */ -# define SSL_SECOP_CURVE_CHECK (6 | SSL_SECOP_OTHER_CURVE) -/* Temporary DH key */ -# define SSL_SECOP_TMP_DH (7 | SSL_SECOP_OTHER_PKEY) -/* SSL/TLS version */ -# define SSL_SECOP_VERSION (9 | SSL_SECOP_OTHER_NONE) -/* Session tickets */ -# define SSL_SECOP_TICKET (10 | SSL_SECOP_OTHER_NONE) -/* Supported signature algorithms sent to peer */ -# define SSL_SECOP_SIGALG_SUPPORTED (11 | SSL_SECOP_OTHER_SIGALG) -/* Shared signature algorithm */ -# define SSL_SECOP_SIGALG_SHARED (12 | SSL_SECOP_OTHER_SIGALG) -/* Sanity check signature algorithm allowed */ -# define SSL_SECOP_SIGALG_CHECK (13 | SSL_SECOP_OTHER_SIGALG) -/* Used to get mask of supported public key signature algorithms */ -# define SSL_SECOP_SIGALG_MASK (14 | SSL_SECOP_OTHER_SIGALG) -/* Use to see if compression is allowed */ -# define SSL_SECOP_COMPRESSION (15 | SSL_SECOP_OTHER_NONE) -/* EE key in certificate */ -# define SSL_SECOP_EE_KEY (16 | SSL_SECOP_OTHER_CERT) -/* CA key in certificate */ -# define SSL_SECOP_CA_KEY (17 | SSL_SECOP_OTHER_CERT) -/* CA digest algorithm in certificate */ -# define SSL_SECOP_CA_MD (18 | SSL_SECOP_OTHER_CERT) -/* Peer EE key in certificate */ -# define SSL_SECOP_PEER_EE_KEY (SSL_SECOP_EE_KEY | SSL_SECOP_PEER) -/* Peer CA key in certificate */ -# define SSL_SECOP_PEER_CA_KEY (SSL_SECOP_CA_KEY | SSL_SECOP_PEER) -/* Peer CA digest algorithm in certificate */ -# define SSL_SECOP_PEER_CA_MD (SSL_SECOP_CA_MD | SSL_SECOP_PEER) - -void SSL_set_security_level(SSL *s, int level); -__owur int SSL_get_security_level(const SSL *s); -void SSL_set_security_callback(SSL *s, - int (*cb) (const SSL *s, const SSL_CTX *ctx, - int op, int bits, int nid, - void *other, void *ex)); -int (*SSL_get_security_callback(const SSL *s)) (const SSL *s, - const SSL_CTX *ctx, int op, - int bits, int nid, void *other, - void *ex); -void SSL_set0_security_ex_data(SSL *s, void *ex); -__owur void *SSL_get0_security_ex_data(const SSL *s); - -void SSL_CTX_set_security_level(SSL_CTX *ctx, int level); -__owur int SSL_CTX_get_security_level(const SSL_CTX *ctx); -void SSL_CTX_set_security_callback(SSL_CTX *ctx, - int (*cb) (const SSL *s, const SSL_CTX *ctx, - int op, int bits, int nid, - void *other, void *ex)); -int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (const SSL *s, - const SSL_CTX *ctx, - int op, int bits, - int nid, - void *other, - void *ex); -void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex); -__owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx); - -/* OPENSSL_INIT flag 0x010000 reserved for internal use */ -# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x00100000L -# define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L - -# define OPENSSL_INIT_SSL_DEFAULT \ - (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS) - -int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); - -# ifndef OPENSSL_NO_UNIT_TEST -__owur const struct openssl_ssl_test_functions *SSL_test_functions(void); -# endif - -__owur int SSL_free_buffers(SSL *ssl); -__owur int SSL_alloc_buffers(SSL *ssl); - -/* Status codes passed to the decrypt session ticket callback. Some of these - * are for internal use only and are never passed to the callback. */ -typedef int SSL_TICKET_STATUS; - -/* Support for ticket appdata */ -/* fatal error, malloc failure */ -# define SSL_TICKET_FATAL_ERR_MALLOC 0 -/* fatal error, either from parsing or decrypting the ticket */ -# define SSL_TICKET_FATAL_ERR_OTHER 1 -/* No ticket present */ -# define SSL_TICKET_NONE 2 -/* Empty ticket present */ -# define SSL_TICKET_EMPTY 3 -/* the ticket couldn't be decrypted */ -# define SSL_TICKET_NO_DECRYPT 4 -/* a ticket was successfully decrypted */ -# define SSL_TICKET_SUCCESS 5 -/* same as above but the ticket needs to be renewed */ -# define SSL_TICKET_SUCCESS_RENEW 6 - -/* Return codes for the decrypt session ticket callback */ -typedef int SSL_TICKET_RETURN; - -/* An error occurred */ -#define SSL_TICKET_RETURN_ABORT 0 -/* Do not use the ticket, do not send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_IGNORE 1 -/* Do not use the ticket, send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_IGNORE_RENEW 2 -/* Use the ticket, do not send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_USE 3 -/* Use the ticket, send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_USE_RENEW 4 - -typedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg); -typedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss, - const unsigned char *keyname, - size_t keyname_length, - SSL_TICKET_STATUS status, - void *arg); -int SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx, - SSL_CTX_generate_session_ticket_fn gen_cb, - SSL_CTX_decrypt_session_ticket_fn dec_cb, - void *arg); -int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len); -int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len); - -extern const char SSL_version_str[]; - -typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us); - -void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb); - - -typedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg); -void SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx, - SSL_allow_early_data_cb_fn cb, - void *arg); -void SSL_set_allow_early_data_cb(SSL *s, - SSL_allow_early_data_cb_fn cb, - void *arg); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ssl2.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ssl2.h deleted file mode 100644 index 5321bd27..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ssl2.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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_SSL2_H -# define HEADER_SSL2_H - -#ifdef __cplusplus -extern "C" { -#endif - -# define SSL2_VERSION 0x0002 - -# define SSL2_MT_CLIENT_HELLO 1 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ssl3.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ssl3.h deleted file mode 100644 index 8d01fcc4..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ssl3.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_SSL3_H -# define HEADER_SSL3_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Signalling cipher suite value from RFC 5746 - * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) - */ -# define SSL3_CK_SCSV 0x030000FF - -/* - * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 - * (TLS_FALLBACK_SCSV) - */ -# define SSL3_CK_FALLBACK_SCSV 0x03005600 - -# define SSL3_CK_RSA_NULL_MD5 0x03000001 -# define SSL3_CK_RSA_NULL_SHA 0x03000002 -# define SSL3_CK_RSA_RC4_40_MD5 0x03000003 -# define SSL3_CK_RSA_RC4_128_MD5 0x03000004 -# define SSL3_CK_RSA_RC4_128_SHA 0x03000005 -# define SSL3_CK_RSA_RC2_40_MD5 0x03000006 -# define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 -# define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 -# define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 -# define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A - -# define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B -# define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C -# define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D -# define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E -# define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F -# define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 - -# define SSL3_CK_DHE_DSS_DES_40_CBC_SHA 0x03000011 -# define SSL3_CK_EDH_DSS_DES_40_CBC_SHA SSL3_CK_DHE_DSS_DES_40_CBC_SHA -# define SSL3_CK_DHE_DSS_DES_64_CBC_SHA 0x03000012 -# define SSL3_CK_EDH_DSS_DES_64_CBC_SHA SSL3_CK_DHE_DSS_DES_64_CBC_SHA -# define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA 0x03000013 -# define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA SSL3_CK_DHE_DSS_DES_192_CBC3_SHA -# define SSL3_CK_DHE_RSA_DES_40_CBC_SHA 0x03000014 -# define SSL3_CK_EDH_RSA_DES_40_CBC_SHA SSL3_CK_DHE_RSA_DES_40_CBC_SHA -# define SSL3_CK_DHE_RSA_DES_64_CBC_SHA 0x03000015 -# define SSL3_CK_EDH_RSA_DES_64_CBC_SHA SSL3_CK_DHE_RSA_DES_64_CBC_SHA -# define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA 0x03000016 -# define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA SSL3_CK_DHE_RSA_DES_192_CBC3_SHA - -# define SSL3_CK_ADH_RC4_40_MD5 0x03000017 -# define SSL3_CK_ADH_RC4_128_MD5 0x03000018 -# define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 -# define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A -# define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B - -/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ -# define SSL3_RFC_RSA_NULL_MD5 "TLS_RSA_WITH_NULL_MD5" -# define SSL3_RFC_RSA_NULL_SHA "TLS_RSA_WITH_NULL_SHA" -# define SSL3_RFC_RSA_DES_192_CBC3_SHA "TLS_RSA_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_DHE_DSS_DES_192_CBC3_SHA "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_DHE_RSA_DES_192_CBC3_SHA "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_ADH_DES_192_CBC_SHA "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_RSA_IDEA_128_SHA "TLS_RSA_WITH_IDEA_CBC_SHA" -# define SSL3_RFC_RSA_RC4_128_MD5 "TLS_RSA_WITH_RC4_128_MD5" -# define SSL3_RFC_RSA_RC4_128_SHA "TLS_RSA_WITH_RC4_128_SHA" -# define SSL3_RFC_ADH_RC4_128_MD5 "TLS_DH_anon_WITH_RC4_128_MD5" - -# define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" -# define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" -# define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" -# define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" -# define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" -# define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" -# define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" -# define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" -# define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" -# define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" - -# define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" -# define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" -# define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" -# define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" -# define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" -# define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" - -# define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" -# define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" -# define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" -# define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" -# define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" -# define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" - -/* - * This next block of six "EDH" labels is for backward compatibility with - * older versions of OpenSSL. New code should use the six "DHE" labels above - * instead: - */ -# define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" -# define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" -# define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" -# define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" -# define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" -# define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" - -# define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" -# define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" -# define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" -# define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" -# define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" - -# define SSL3_SSL_SESSION_ID_LENGTH 32 -# define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 - -# define SSL3_MASTER_SECRET_SIZE 48 -# define SSL3_RANDOM_SIZE 32 -# define SSL3_SESSION_ID_SIZE 32 -# define SSL3_RT_HEADER_LENGTH 5 - -# define SSL3_HM_HEADER_LENGTH 4 - -# ifndef SSL3_ALIGN_PAYLOAD - /* - * Some will argue that this increases memory footprint, but it's not - * actually true. Point is that malloc has to return at least 64-bit aligned - * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. - * Suggested pre-gaping simply moves these wasted bytes from the end of - * allocated region to its front, but makes data payload aligned, which - * improves performance:-) - */ -# define SSL3_ALIGN_PAYLOAD 8 -# else -# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0 -# error "insane SSL3_ALIGN_PAYLOAD" -# undef SSL3_ALIGN_PAYLOAD -# endif -# endif - -/* - * This is the maximum MAC (digest) size used by the SSL library. Currently - * maximum of 20 is used by SHA1, but we reserve for future extension for - * 512-bit hashes. - */ - -# define SSL3_RT_MAX_MD_SIZE 64 - -/* - * Maximum block size used in all ciphersuites. Currently 16 for AES. - */ - -# define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 - -# define SSL3_RT_MAX_EXTRA (16384) - -/* Maximum plaintext length: defined by SSL/TLS standards */ -# define SSL3_RT_MAX_PLAIN_LENGTH 16384 -/* Maximum compression overhead: defined by SSL/TLS standards */ -# define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 - -/* - * The standards give a maximum encryption overhead of 1024 bytes. In - * practice the value is lower than this. The overhead is the maximum number - * of padding bytes (256) plus the mac size. - */ -# define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) -# define SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD 256 - -/* - * OpenSSL currently only uses a padding length of at most one block so the - * send overhead is smaller. - */ - -# define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ - (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) - -/* If compression isn't used don't include the compression overhead */ - -# ifdef OPENSSL_NO_COMP -# define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH -# else -# define SSL3_RT_MAX_COMPRESSED_LENGTH \ - (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) -# endif -# define SSL3_RT_MAX_ENCRYPTED_LENGTH \ - (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) -# define SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH \ - (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD) -# define SSL3_RT_MAX_PACKET_SIZE \ - (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) - -# define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" -# define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" - -# define SSL3_VERSION 0x0300 -# define SSL3_VERSION_MAJOR 0x03 -# define SSL3_VERSION_MINOR 0x00 - -# define SSL3_RT_CHANGE_CIPHER_SPEC 20 -# define SSL3_RT_ALERT 21 -# define SSL3_RT_HANDSHAKE 22 -# define SSL3_RT_APPLICATION_DATA 23 -# define DTLS1_RT_HEARTBEAT 24 - -/* Pseudo content types to indicate additional parameters */ -# define TLS1_RT_CRYPTO 0x1000 -# define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) -# define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) -# define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) -# define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) - -# define TLS1_RT_CRYPTO_READ 0x0000 -# define TLS1_RT_CRYPTO_WRITE 0x0100 -# define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) -# define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) -# define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) -# define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) - -/* Pseudo content types for SSL/TLS header info */ -# define SSL3_RT_HEADER 0x100 -# define SSL3_RT_INNER_CONTENT_TYPE 0x101 - -# define SSL3_AL_WARNING 1 -# define SSL3_AL_FATAL 2 - -# define SSL3_AD_CLOSE_NOTIFY 0 -# define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */ -# define SSL3_AD_BAD_RECORD_MAC 20/* fatal */ -# define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */ -# define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */ -# define SSL3_AD_NO_CERTIFICATE 41 -# define SSL3_AD_BAD_CERTIFICATE 42 -# define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 -# define SSL3_AD_CERTIFICATE_REVOKED 44 -# define SSL3_AD_CERTIFICATE_EXPIRED 45 -# define SSL3_AD_CERTIFICATE_UNKNOWN 46 -# define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */ - -# define TLS1_HB_REQUEST 1 -# define TLS1_HB_RESPONSE 2 - - -# define SSL3_CT_RSA_SIGN 1 -# define SSL3_CT_DSS_SIGN 2 -# define SSL3_CT_RSA_FIXED_DH 3 -# define SSL3_CT_DSS_FIXED_DH 4 -# define SSL3_CT_RSA_EPHEMERAL_DH 5 -# define SSL3_CT_DSS_EPHEMERAL_DH 6 -# define SSL3_CT_FORTEZZA_DMS 20 -/* - * SSL3_CT_NUMBER is used to size arrays and it must be large enough to - * contain all of the cert types defined for *either* SSLv3 and TLSv1. - */ -# define SSL3_CT_NUMBER 10 - -# if defined(TLS_CT_NUMBER) -# if TLS_CT_NUMBER != SSL3_CT_NUMBER -# error "SSL/TLS CT_NUMBER values do not match" -# endif -# endif - -/* No longer used as of OpenSSL 1.1.1 */ -# define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 - -/* Removed from OpenSSL 1.1.0 */ -# define TLS1_FLAGS_TLS_PADDING_BUG 0x0 - -# define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 - -/* Set if we encrypt then mac instead of usual mac then encrypt */ -# define TLS1_FLAGS_ENCRYPT_THEN_MAC_READ 0x0100 -# define TLS1_FLAGS_ENCRYPT_THEN_MAC TLS1_FLAGS_ENCRYPT_THEN_MAC_READ - -/* Set if extended master secret extension received from peer */ -# define TLS1_FLAGS_RECEIVED_EXTMS 0x0200 - -# define TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE 0x0400 - -# define TLS1_FLAGS_STATELESS 0x0800 - -# define SSL3_MT_HELLO_REQUEST 0 -# define SSL3_MT_CLIENT_HELLO 1 -# define SSL3_MT_SERVER_HELLO 2 -# define SSL3_MT_NEWSESSION_TICKET 4 -# define SSL3_MT_END_OF_EARLY_DATA 5 -# define SSL3_MT_ENCRYPTED_EXTENSIONS 8 -# define SSL3_MT_CERTIFICATE 11 -# define SSL3_MT_SERVER_KEY_EXCHANGE 12 -# define SSL3_MT_CERTIFICATE_REQUEST 13 -# define SSL3_MT_SERVER_DONE 14 -# define SSL3_MT_CERTIFICATE_VERIFY 15 -# define SSL3_MT_CLIENT_KEY_EXCHANGE 16 -# define SSL3_MT_FINISHED 20 -# define SSL3_MT_CERTIFICATE_URL 21 -# define SSL3_MT_CERTIFICATE_STATUS 22 -# define SSL3_MT_SUPPLEMENTAL_DATA 23 -# define SSL3_MT_KEY_UPDATE 24 -# ifndef OPENSSL_NO_NEXTPROTONEG -# define SSL3_MT_NEXT_PROTO 67 -# endif -# define SSL3_MT_MESSAGE_HASH 254 -# define DTLS1_MT_HELLO_VERIFY_REQUEST 3 - -/* Dummy message type for handling CCS like a normal handshake message */ -# define SSL3_MT_CHANGE_CIPHER_SPEC 0x0101 - -# define SSL3_MT_CCS 1 - -/* These are used when changing over to a new cipher */ -# define SSL3_CC_READ 0x001 -# define SSL3_CC_WRITE 0x002 -# define SSL3_CC_CLIENT 0x010 -# define SSL3_CC_SERVER 0x020 -# define SSL3_CC_EARLY 0x040 -# define SSL3_CC_HANDSHAKE 0x080 -# define SSL3_CC_APPLICATION 0x100 -# define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) -# define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) -# define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) -# define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/sslerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/sslerr.h deleted file mode 100644 index 82983d3c..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/sslerr.h +++ /dev/null @@ -1,773 +0,0 @@ -/* - * 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_SSLERR_H -# define HEADER_SSLERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_SSL_strings(void); - -/* - * SSL function codes. - */ -# define SSL_F_ADD_CLIENT_KEY_SHARE_EXT 438 -# define SSL_F_ADD_KEY_SHARE 512 -# define SSL_F_BYTES_TO_CIPHER_LIST 519 -# define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 -# define SSL_F_CIPHERSUITE_CB 622 -# define SSL_F_CONSTRUCT_CA_NAMES 552 -# define SSL_F_CONSTRUCT_KEY_EXCHANGE_TBS 553 -# define SSL_F_CONSTRUCT_STATEFUL_TICKET 636 -# define SSL_F_CONSTRUCT_STATELESS_TICKET 637 -# define SSL_F_CREATE_SYNTHETIC_MESSAGE_HASH 539 -# define SSL_F_CREATE_TICKET_PREQUEL 638 -# define SSL_F_CT_MOVE_SCTS 345 -# define SSL_F_CT_STRICT 349 -# define SSL_F_CUSTOM_EXT_ADD 554 -# define SSL_F_CUSTOM_EXT_PARSE 555 -# define SSL_F_D2I_SSL_SESSION 103 -# define SSL_F_DANE_CTX_ENABLE 347 -# define SSL_F_DANE_MTYPE_SET 393 -# define SSL_F_DANE_TLSA_ADD 394 -# define SSL_F_DERIVE_SECRET_KEY_AND_IV 514 -# define SSL_F_DO_DTLS1_WRITE 245 -# define SSL_F_DO_SSL3_WRITE 104 -# define SSL_F_DTLS1_BUFFER_RECORD 247 -# define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 318 -# define SSL_F_DTLS1_HEARTBEAT 305 -# define SSL_F_DTLS1_HM_FRAGMENT_NEW 623 -# define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 -# define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 -# define SSL_F_DTLS1_PROCESS_RECORD 257 -# define SSL_F_DTLS1_READ_BYTES 258 -# define SSL_F_DTLS1_READ_FAILED 339 -# define SSL_F_DTLS1_RETRANSMIT_MESSAGE 390 -# define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 -# define SSL_F_DTLS1_WRITE_BYTES 545 -# define SSL_F_DTLSV1_LISTEN 350 -# define SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC 371 -# define SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST 385 -# define SSL_F_DTLS_GET_REASSEMBLED_MESSAGE 370 -# define SSL_F_DTLS_PROCESS_HELLO_VERIFY 386 -# define SSL_F_DTLS_RECORD_LAYER_NEW 635 -# define SSL_F_DTLS_WAIT_FOR_DRY 592 -# define SSL_F_EARLY_DATA_COUNT_OK 532 -# define SSL_F_FINAL_EARLY_DATA 556 -# define SSL_F_FINAL_EC_PT_FORMATS 485 -# define SSL_F_FINAL_EMS 486 -# define SSL_F_FINAL_KEY_SHARE 503 -# define SSL_F_FINAL_MAXFRAGMENTLEN 557 -# define SSL_F_FINAL_RENEGOTIATE 483 -# define SSL_F_FINAL_SERVER_NAME 558 -# define SSL_F_FINAL_SIG_ALGS 497 -# define SSL_F_GET_CERT_VERIFY_TBS_DATA 588 -# define SSL_F_NSS_KEYLOG_INT 500 -# define SSL_F_OPENSSL_INIT_SSL 342 -# define SSL_F_OSSL_STATEM_CLIENT13_READ_TRANSITION 436 -# define SSL_F_OSSL_STATEM_CLIENT13_WRITE_TRANSITION 598 -# define SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE 430 -# define SSL_F_OSSL_STATEM_CLIENT_POST_PROCESS_MESSAGE 593 -# define SSL_F_OSSL_STATEM_CLIENT_PROCESS_MESSAGE 594 -# define SSL_F_OSSL_STATEM_CLIENT_READ_TRANSITION 417 -# define SSL_F_OSSL_STATEM_CLIENT_WRITE_TRANSITION 599 -# define SSL_F_OSSL_STATEM_SERVER13_READ_TRANSITION 437 -# define SSL_F_OSSL_STATEM_SERVER13_WRITE_TRANSITION 600 -# define SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE 431 -# define SSL_F_OSSL_STATEM_SERVER_POST_PROCESS_MESSAGE 601 -# define SSL_F_OSSL_STATEM_SERVER_POST_WORK 602 -# define SSL_F_OSSL_STATEM_SERVER_PRE_WORK 640 -# define SSL_F_OSSL_STATEM_SERVER_PROCESS_MESSAGE 603 -# define SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION 418 -# define SSL_F_OSSL_STATEM_SERVER_WRITE_TRANSITION 604 -# define SSL_F_PARSE_CA_NAMES 541 -# define SSL_F_PITEM_NEW 624 -# define SSL_F_PQUEUE_NEW 625 -# define SSL_F_PROCESS_KEY_SHARE_EXT 439 -# define SSL_F_READ_STATE_MACHINE 352 -# define SSL_F_SET_CLIENT_CIPHERSUITE 540 -# define SSL_F_SRP_GENERATE_CLIENT_MASTER_SECRET 595 -# define SSL_F_SRP_GENERATE_SERVER_MASTER_SECRET 589 -# define SSL_F_SRP_VERIFY_SERVER_PARAM 596 -# define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 -# define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 -# define SSL_F_SSL3_CTRL 213 -# define SSL_F_SSL3_CTX_CTRL 133 -# define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 -# define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 -# define SSL_F_SSL3_ENC 608 -# define SSL_F_SSL3_FINAL_FINISH_MAC 285 -# define SSL_F_SSL3_FINISH_MAC 587 -# define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 -# define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 -# define SSL_F_SSL3_GET_RECORD 143 -# define SSL_F_SSL3_INIT_FINISHED_MAC 397 -# define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 -# define SSL_F_SSL3_READ_BYTES 148 -# define SSL_F_SSL3_READ_N 149 -# define SSL_F_SSL3_SETUP_KEY_BLOCK 157 -# define SSL_F_SSL3_SETUP_READ_BUFFER 156 -# define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 -# define SSL_F_SSL3_WRITE_BYTES 158 -# define SSL_F_SSL3_WRITE_PENDING 159 -# define SSL_F_SSL_ADD_CERT_CHAIN 316 -# define SSL_F_SSL_ADD_CERT_TO_BUF 319 -# define SSL_F_SSL_ADD_CERT_TO_WPACKET 493 -# define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 -# define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 -# define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 -# define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 -# define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 -# define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 -# define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 -# define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 -# define SSL_F_SSL_BAD_METHOD 160 -# define SSL_F_SSL_BUILD_CERT_CHAIN 332 -# define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 -# define SSL_F_SSL_CACHE_CIPHERLIST 520 -# define SSL_F_SSL_CERT_ADD0_CHAIN_CERT 346 -# define SSL_F_SSL_CERT_DUP 221 -# define SSL_F_SSL_CERT_NEW 162 -# define SSL_F_SSL_CERT_SET0_CHAIN 340 -# define SSL_F_SSL_CHECK_PRIVATE_KEY 163 -# define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 -# define SSL_F_SSL_CHECK_SRP_EXT_CLIENTHELLO 606 -# define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 -# define SSL_F_SSL_CHOOSE_CLIENT_VERSION 607 -# define SSL_F_SSL_CIPHER_DESCRIPTION 626 -# define SSL_F_SSL_CIPHER_LIST_TO_BYTES 425 -# define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 -# define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 -# define SSL_F_SSL_CLEAR 164 -# define SSL_F_SSL_CLIENT_HELLO_GET1_EXTENSIONS_PRESENT 627 -# define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 -# define SSL_F_SSL_CONF_CMD 334 -# define SSL_F_SSL_CREATE_CIPHER_LIST 166 -# define SSL_F_SSL_CTRL 232 -# define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 -# define SSL_F_SSL_CTX_ENABLE_CT 398 -# define SSL_F_SSL_CTX_MAKE_PROFILES 309 -# define SSL_F_SSL_CTX_NEW 169 -# define SSL_F_SSL_CTX_SET_ALPN_PROTOS 343 -# define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 -# define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 -# define SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK 396 -# define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 -# define SSL_F_SSL_CTX_SET_SSL_VERSION 170 -# define SSL_F_SSL_CTX_SET_TLSEXT_MAX_FRAGMENT_LENGTH 551 -# define SSL_F_SSL_CTX_USE_CERTIFICATE 171 -# define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 -# define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 -# define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 -# define SSL_F_SSL_CTX_USE_SERVERINFO 336 -# define SSL_F_SSL_CTX_USE_SERVERINFO_EX 543 -# define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 -# define SSL_F_SSL_DANE_DUP 403 -# define SSL_F_SSL_DANE_ENABLE 395 -# define SSL_F_SSL_DERIVE 590 -# define SSL_F_SSL_DO_CONFIG 391 -# define SSL_F_SSL_DO_HANDSHAKE 180 -# define SSL_F_SSL_DUP_CA_LIST 408 -# define SSL_F_SSL_ENABLE_CT 402 -# define SSL_F_SSL_GENERATE_PKEY_GROUP 559 -# define SSL_F_SSL_GENERATE_SESSION_ID 547 -# define SSL_F_SSL_GET_NEW_SESSION 181 -# define SSL_F_SSL_GET_PREV_SESSION 217 -# define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 -# define SSL_F_SSL_GET_SIGN_PKEY 183 -# define SSL_F_SSL_HANDSHAKE_HASH 560 -# define SSL_F_SSL_INIT_WBIO_BUFFER 184 -# define SSL_F_SSL_KEY_UPDATE 515 -# define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 -# define SSL_F_SSL_LOG_MASTER_SECRET 498 -# define SSL_F_SSL_LOG_RSA_CLIENT_KEY_EXCHANGE 499 -# define SSL_F_SSL_MODULE_INIT 392 -# define SSL_F_SSL_NEW 186 -# define SSL_F_SSL_NEXT_PROTO_VALIDATE 565 -# define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 -# define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 -# define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 -# define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 -# define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 -# define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 -# define SSL_F_SSL_PEEK 270 -# define SSL_F_SSL_PEEK_EX 432 -# define SSL_F_SSL_PEEK_INTERNAL 522 -# define SSL_F_SSL_READ 223 -# define SSL_F_SSL_READ_EARLY_DATA 529 -# define SSL_F_SSL_READ_EX 434 -# define SSL_F_SSL_READ_INTERNAL 523 -# define SSL_F_SSL_RENEGOTIATE 516 -# define SSL_F_SSL_RENEGOTIATE_ABBREVIATED 546 -# define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 -# define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 -# define SSL_F_SSL_SESSION_DUP 348 -# define SSL_F_SSL_SESSION_NEW 189 -# define SSL_F_SSL_SESSION_PRINT_FP 190 -# define SSL_F_SSL_SESSION_SET1_ID 423 -# define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 -# define SSL_F_SSL_SET_ALPN_PROTOS 344 -# define SSL_F_SSL_SET_CERT 191 -# define SSL_F_SSL_SET_CERT_AND_KEY 621 -# define SSL_F_SSL_SET_CIPHER_LIST 271 -# define SSL_F_SSL_SET_CT_VALIDATION_CALLBACK 399 -# define SSL_F_SSL_SET_FD 192 -# define SSL_F_SSL_SET_PKEY 193 -# define SSL_F_SSL_SET_RFD 194 -# define SSL_F_SSL_SET_SESSION 195 -# define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 -# define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 -# define SSL_F_SSL_SET_TLSEXT_MAX_FRAGMENT_LENGTH 550 -# define SSL_F_SSL_SET_WFD 196 -# define SSL_F_SSL_SHUTDOWN 224 -# define SSL_F_SSL_SRP_CTX_INIT 313 -# define SSL_F_SSL_START_ASYNC_JOB 389 -# define SSL_F_SSL_UNDEFINED_FUNCTION 197 -# define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 -# define SSL_F_SSL_USE_CERTIFICATE 198 -# define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 -# define SSL_F_SSL_USE_CERTIFICATE_FILE 200 -# define SSL_F_SSL_USE_PRIVATEKEY 201 -# define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 -# define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 -# define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 -# define SSL_F_SSL_USE_RSAPRIVATEKEY 204 -# define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 -# define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 -# define SSL_F_SSL_VALIDATE_CT 400 -# define SSL_F_SSL_VERIFY_CERT_CHAIN 207 -# define SSL_F_SSL_VERIFY_CLIENT_POST_HANDSHAKE 616 -# define SSL_F_SSL_WRITE 208 -# define SSL_F_SSL_WRITE_EARLY_DATA 526 -# define SSL_F_SSL_WRITE_EARLY_FINISH 527 -# define SSL_F_SSL_WRITE_EX 433 -# define SSL_F_SSL_WRITE_INTERNAL 524 -# define SSL_F_STATE_MACHINE 353 -# define SSL_F_TLS12_CHECK_PEER_SIGALG 333 -# define SSL_F_TLS12_COPY_SIGALGS 533 -# define SSL_F_TLS13_CHANGE_CIPHER_STATE 440 -# define SSL_F_TLS13_ENC 609 -# define SSL_F_TLS13_FINAL_FINISH_MAC 605 -# define SSL_F_TLS13_GENERATE_SECRET 591 -# define SSL_F_TLS13_HKDF_EXPAND 561 -# define SSL_F_TLS13_RESTORE_HANDSHAKE_DIGEST_FOR_PHA 617 -# define SSL_F_TLS13_SAVE_HANDSHAKE_DIGEST_FOR_PHA 618 -# define SSL_F_TLS13_SETUP_KEY_BLOCK 441 -# define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 -# define SSL_F_TLS1_CHECK_DUPLICATE_EXTENSIONS 341 -# define SSL_F_TLS1_ENC 401 -# define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 -# define SSL_F_TLS1_GET_CURVELIST 338 -# define SSL_F_TLS1_PRF 284 -# define SSL_F_TLS1_SAVE_U16 628 -# define SSL_F_TLS1_SETUP_KEY_BLOCK 211 -# define SSL_F_TLS1_SET_GROUPS 629 -# define SSL_F_TLS1_SET_RAW_SIGALGS 630 -# define SSL_F_TLS1_SET_SERVER_SIGALGS 335 -# define SSL_F_TLS1_SET_SHARED_SIGALGS 631 -# define SSL_F_TLS1_SET_SIGALGS 632 -# define SSL_F_TLS_CHOOSE_SIGALG 513 -# define SSL_F_TLS_CLIENT_KEY_EXCHANGE_POST_WORK 354 -# define SSL_F_TLS_COLLECT_EXTENSIONS 435 -# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES 542 -# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST 372 -# define SSL_F_TLS_CONSTRUCT_CERT_STATUS 429 -# define SSL_F_TLS_CONSTRUCT_CERT_STATUS_BODY 494 -# define SSL_F_TLS_CONSTRUCT_CERT_VERIFY 496 -# define SSL_F_TLS_CONSTRUCT_CHANGE_CIPHER_SPEC 427 -# define SSL_F_TLS_CONSTRUCT_CKE_DHE 404 -# define SSL_F_TLS_CONSTRUCT_CKE_ECDHE 405 -# define SSL_F_TLS_CONSTRUCT_CKE_GOST 406 -# define SSL_F_TLS_CONSTRUCT_CKE_PSK_PREAMBLE 407 -# define SSL_F_TLS_CONSTRUCT_CKE_RSA 409 -# define SSL_F_TLS_CONSTRUCT_CKE_SRP 410 -# define SSL_F_TLS_CONSTRUCT_CLIENT_CERTIFICATE 484 -# define SSL_F_TLS_CONSTRUCT_CLIENT_HELLO 487 -# define SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE 488 -# define SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY 489 -# define SSL_F_TLS_CONSTRUCT_CTOS_ALPN 466 -# define SSL_F_TLS_CONSTRUCT_CTOS_CERTIFICATE 355 -# define SSL_F_TLS_CONSTRUCT_CTOS_COOKIE 535 -# define SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA 530 -# define SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS 467 -# define SSL_F_TLS_CONSTRUCT_CTOS_EMS 468 -# define SSL_F_TLS_CONSTRUCT_CTOS_ETM 469 -# define SSL_F_TLS_CONSTRUCT_CTOS_HELLO 356 -# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_EXCHANGE 357 -# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE 470 -# define SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN 549 -# define SSL_F_TLS_CONSTRUCT_CTOS_NPN 471 -# define SSL_F_TLS_CONSTRUCT_CTOS_PADDING 472 -# define SSL_F_TLS_CONSTRUCT_CTOS_POST_HANDSHAKE_AUTH 619 -# define SSL_F_TLS_CONSTRUCT_CTOS_PSK 501 -# define SSL_F_TLS_CONSTRUCT_CTOS_PSK_KEX_MODES 509 -# define SSL_F_TLS_CONSTRUCT_CTOS_RENEGOTIATE 473 -# define SSL_F_TLS_CONSTRUCT_CTOS_SCT 474 -# define SSL_F_TLS_CONSTRUCT_CTOS_SERVER_NAME 475 -# define SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET 476 -# define SSL_F_TLS_CONSTRUCT_CTOS_SIG_ALGS 477 -# define SSL_F_TLS_CONSTRUCT_CTOS_SRP 478 -# define SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST 479 -# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS 480 -# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS 481 -# define SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP 482 -# define SSL_F_TLS_CONSTRUCT_CTOS_VERIFY 358 -# define SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS 443 -# define SSL_F_TLS_CONSTRUCT_END_OF_EARLY_DATA 536 -# define SSL_F_TLS_CONSTRUCT_EXTENSIONS 447 -# define SSL_F_TLS_CONSTRUCT_FINISHED 359 -# define SSL_F_TLS_CONSTRUCT_HELLO_REQUEST 373 -# define SSL_F_TLS_CONSTRUCT_HELLO_RETRY_REQUEST 510 -# define SSL_F_TLS_CONSTRUCT_KEY_UPDATE 517 -# define SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET 428 -# define SSL_F_TLS_CONSTRUCT_NEXT_PROTO 426 -# define SSL_F_TLS_CONSTRUCT_SERVER_CERTIFICATE 490 -# define SSL_F_TLS_CONSTRUCT_SERVER_HELLO 491 -# define SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE 492 -# define SSL_F_TLS_CONSTRUCT_STOC_ALPN 451 -# define SSL_F_TLS_CONSTRUCT_STOC_CERTIFICATE 374 -# define SSL_F_TLS_CONSTRUCT_STOC_COOKIE 613 -# define SSL_F_TLS_CONSTRUCT_STOC_CRYPTOPRO_BUG 452 -# define SSL_F_TLS_CONSTRUCT_STOC_DONE 375 -# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA 531 -# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA_INFO 525 -# define SSL_F_TLS_CONSTRUCT_STOC_EC_PT_FORMATS 453 -# define SSL_F_TLS_CONSTRUCT_STOC_EMS 454 -# define SSL_F_TLS_CONSTRUCT_STOC_ETM 455 -# define SSL_F_TLS_CONSTRUCT_STOC_HELLO 376 -# define SSL_F_TLS_CONSTRUCT_STOC_KEY_EXCHANGE 377 -# define SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE 456 -# define SSL_F_TLS_CONSTRUCT_STOC_MAXFRAGMENTLEN 548 -# define SSL_F_TLS_CONSTRUCT_STOC_NEXT_PROTO_NEG 457 -# define SSL_F_TLS_CONSTRUCT_STOC_PSK 504 -# define SSL_F_TLS_CONSTRUCT_STOC_RENEGOTIATE 458 -# define SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME 459 -# define SSL_F_TLS_CONSTRUCT_STOC_SESSION_TICKET 460 -# define SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST 461 -# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_GROUPS 544 -# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_VERSIONS 611 -# define SSL_F_TLS_CONSTRUCT_STOC_USE_SRTP 462 -# define SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO 521 -# define SSL_F_TLS_FINISH_HANDSHAKE 597 -# define SSL_F_TLS_GET_MESSAGE_BODY 351 -# define SSL_F_TLS_GET_MESSAGE_HEADER 387 -# define SSL_F_TLS_HANDLE_ALPN 562 -# define SSL_F_TLS_HANDLE_STATUS_REQUEST 563 -# define SSL_F_TLS_PARSE_CERTIFICATE_AUTHORITIES 566 -# define SSL_F_TLS_PARSE_CLIENTHELLO_TLSEXT 449 -# define SSL_F_TLS_PARSE_CTOS_ALPN 567 -# define SSL_F_TLS_PARSE_CTOS_COOKIE 614 -# define SSL_F_TLS_PARSE_CTOS_EARLY_DATA 568 -# define SSL_F_TLS_PARSE_CTOS_EC_PT_FORMATS 569 -# define SSL_F_TLS_PARSE_CTOS_EMS 570 -# define SSL_F_TLS_PARSE_CTOS_KEY_SHARE 463 -# define SSL_F_TLS_PARSE_CTOS_MAXFRAGMENTLEN 571 -# define SSL_F_TLS_PARSE_CTOS_POST_HANDSHAKE_AUTH 620 -# define SSL_F_TLS_PARSE_CTOS_PSK 505 -# define SSL_F_TLS_PARSE_CTOS_PSK_KEX_MODES 572 -# define SSL_F_TLS_PARSE_CTOS_RENEGOTIATE 464 -# define SSL_F_TLS_PARSE_CTOS_SERVER_NAME 573 -# define SSL_F_TLS_PARSE_CTOS_SESSION_TICKET 574 -# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS 575 -# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS_CERT 615 -# define SSL_F_TLS_PARSE_CTOS_SRP 576 -# define SSL_F_TLS_PARSE_CTOS_STATUS_REQUEST 577 -# define SSL_F_TLS_PARSE_CTOS_SUPPORTED_GROUPS 578 -# define SSL_F_TLS_PARSE_CTOS_USE_SRTP 465 -# define SSL_F_TLS_PARSE_STOC_ALPN 579 -# define SSL_F_TLS_PARSE_STOC_COOKIE 534 -# define SSL_F_TLS_PARSE_STOC_EARLY_DATA 538 -# define SSL_F_TLS_PARSE_STOC_EARLY_DATA_INFO 528 -# define SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS 580 -# define SSL_F_TLS_PARSE_STOC_KEY_SHARE 445 -# define SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN 581 -# define SSL_F_TLS_PARSE_STOC_NPN 582 -# define SSL_F_TLS_PARSE_STOC_PSK 502 -# define SSL_F_TLS_PARSE_STOC_RENEGOTIATE 448 -# define SSL_F_TLS_PARSE_STOC_SCT 564 -# define SSL_F_TLS_PARSE_STOC_SERVER_NAME 583 -# define SSL_F_TLS_PARSE_STOC_SESSION_TICKET 584 -# define SSL_F_TLS_PARSE_STOC_STATUS_REQUEST 585 -# define SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS 612 -# define SSL_F_TLS_PARSE_STOC_USE_SRTP 446 -# define SSL_F_TLS_POST_PROCESS_CLIENT_HELLO 378 -# define SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE 384 -# define SSL_F_TLS_PREPARE_CLIENT_CERTIFICATE 360 -# define SSL_F_TLS_PROCESS_AS_HELLO_RETRY_REQUEST 610 -# define SSL_F_TLS_PROCESS_CERTIFICATE_REQUEST 361 -# define SSL_F_TLS_PROCESS_CERT_STATUS 362 -# define SSL_F_TLS_PROCESS_CERT_STATUS_BODY 495 -# define SSL_F_TLS_PROCESS_CERT_VERIFY 379 -# define SSL_F_TLS_PROCESS_CHANGE_CIPHER_SPEC 363 -# define SSL_F_TLS_PROCESS_CKE_DHE 411 -# define SSL_F_TLS_PROCESS_CKE_ECDHE 412 -# define SSL_F_TLS_PROCESS_CKE_GOST 413 -# define SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE 414 -# define SSL_F_TLS_PROCESS_CKE_RSA 415 -# define SSL_F_TLS_PROCESS_CKE_SRP 416 -# define SSL_F_TLS_PROCESS_CLIENT_CERTIFICATE 380 -# define SSL_F_TLS_PROCESS_CLIENT_HELLO 381 -# define SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE 382 -# define SSL_F_TLS_PROCESS_ENCRYPTED_EXTENSIONS 444 -# define SSL_F_TLS_PROCESS_END_OF_EARLY_DATA 537 -# define SSL_F_TLS_PROCESS_FINISHED 364 -# define SSL_F_TLS_PROCESS_HELLO_REQ 507 -# define SSL_F_TLS_PROCESS_HELLO_RETRY_REQUEST 511 -# define SSL_F_TLS_PROCESS_INITIAL_SERVER_FLIGHT 442 -# define SSL_F_TLS_PROCESS_KEY_EXCHANGE 365 -# define SSL_F_TLS_PROCESS_KEY_UPDATE 518 -# define SSL_F_TLS_PROCESS_NEW_SESSION_TICKET 366 -# define SSL_F_TLS_PROCESS_NEXT_PROTO 383 -# define SSL_F_TLS_PROCESS_SERVER_CERTIFICATE 367 -# define SSL_F_TLS_PROCESS_SERVER_DONE 368 -# define SSL_F_TLS_PROCESS_SERVER_HELLO 369 -# define SSL_F_TLS_PROCESS_SKE_DHE 419 -# define SSL_F_TLS_PROCESS_SKE_ECDHE 420 -# define SSL_F_TLS_PROCESS_SKE_PSK_PREAMBLE 421 -# define SSL_F_TLS_PROCESS_SKE_SRP 422 -# define SSL_F_TLS_PSK_DO_BINDER 506 -# define SSL_F_TLS_SCAN_CLIENTHELLO_TLSEXT 450 -# define SSL_F_TLS_SETUP_HANDSHAKE 508 -# define SSL_F_USE_CERTIFICATE_CHAIN_FILE 220 -# define SSL_F_WPACKET_INTERN_INIT_LEN 633 -# define SSL_F_WPACKET_START_SUB_PACKET_LEN__ 634 -# define SSL_F_WRITE_STATE_MACHINE 586 - -/* - * SSL reason codes. - */ -# define SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY 291 -# define SSL_R_APP_DATA_IN_HANDSHAKE 100 -# define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 -# define SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE 143 -# define SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE 158 -# define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 -# define SSL_R_BAD_CIPHER 186 -# define SSL_R_BAD_DATA 390 -# define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 -# define SSL_R_BAD_DECOMPRESSION 107 -# define SSL_R_BAD_DH_VALUE 102 -# define SSL_R_BAD_DIGEST_LENGTH 111 -# define SSL_R_BAD_EARLY_DATA 233 -# define SSL_R_BAD_ECC_CERT 304 -# define SSL_R_BAD_ECPOINT 306 -# define SSL_R_BAD_EXTENSION 110 -# define SSL_R_BAD_HANDSHAKE_LENGTH 332 -# define SSL_R_BAD_HANDSHAKE_STATE 236 -# define SSL_R_BAD_HELLO_REQUEST 105 -# define SSL_R_BAD_HRR_VERSION 263 -# define SSL_R_BAD_KEY_SHARE 108 -# define SSL_R_BAD_KEY_UPDATE 122 -# define SSL_R_BAD_LEGACY_VERSION 292 -# define SSL_R_BAD_LENGTH 271 -# define SSL_R_BAD_PACKET 240 -# define SSL_R_BAD_PACKET_LENGTH 115 -# define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 -# define SSL_R_BAD_PSK 219 -# define SSL_R_BAD_PSK_IDENTITY 114 -# define SSL_R_BAD_RECORD_TYPE 443 -# define SSL_R_BAD_RSA_ENCRYPT 119 -# define SSL_R_BAD_SIGNATURE 123 -# define SSL_R_BAD_SRP_A_LENGTH 347 -# define SSL_R_BAD_SRP_PARAMETERS 371 -# define SSL_R_BAD_SRTP_MKI_VALUE 352 -# define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 -# define SSL_R_BAD_SSL_FILETYPE 124 -# define SSL_R_BAD_VALUE 384 -# define SSL_R_BAD_WRITE_RETRY 127 -# define SSL_R_BINDER_DOES_NOT_VERIFY 253 -# define SSL_R_BIO_NOT_SET 128 -# define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 -# define SSL_R_BN_LIB 130 -# define SSL_R_CALLBACK_FAILED 234 -# define SSL_R_CANNOT_CHANGE_CIPHER 109 -# define SSL_R_CA_DN_LENGTH_MISMATCH 131 -# define SSL_R_CA_KEY_TOO_SMALL 397 -# define SSL_R_CA_MD_TOO_WEAK 398 -# define SSL_R_CCS_RECEIVED_EARLY 133 -# define SSL_R_CERTIFICATE_VERIFY_FAILED 134 -# define SSL_R_CERT_CB_ERROR 377 -# define SSL_R_CERT_LENGTH_MISMATCH 135 -# define SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED 218 -# define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 -# define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 -# define SSL_R_CLIENTHELLO_TLSEXT 226 -# define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 -# define SSL_R_COMPRESSION_DISABLED 343 -# define SSL_R_COMPRESSION_FAILURE 141 -# define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 -# define SSL_R_COMPRESSION_LIBRARY_ERROR 142 -# define SSL_R_CONNECTION_TYPE_NOT_SET 144 -# define SSL_R_CONTEXT_NOT_DANE_ENABLED 167 -# define SSL_R_COOKIE_GEN_CALLBACK_FAILURE 400 -# define SSL_R_COOKIE_MISMATCH 308 -# define SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED 206 -# define SSL_R_DANE_ALREADY_ENABLED 172 -# define SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL 173 -# define SSL_R_DANE_NOT_ENABLED 175 -# define SSL_R_DANE_TLSA_BAD_CERTIFICATE 180 -# define SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE 184 -# define SSL_R_DANE_TLSA_BAD_DATA_LENGTH 189 -# define SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH 192 -# define SSL_R_DANE_TLSA_BAD_MATCHING_TYPE 200 -# define SSL_R_DANE_TLSA_BAD_PUBLIC_KEY 201 -# define SSL_R_DANE_TLSA_BAD_SELECTOR 202 -# define SSL_R_DANE_TLSA_NULL_DATA 203 -# define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 -# define SSL_R_DATA_LENGTH_TOO_LONG 146 -# define SSL_R_DECRYPTION_FAILED 147 -# define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 -# define SSL_R_DH_KEY_TOO_SMALL 394 -# define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 -# define SSL_R_DIGEST_CHECK_FAILED 149 -# define SSL_R_DTLS_MESSAGE_TOO_BIG 334 -# define SSL_R_DUPLICATE_COMPRESSION_ID 309 -# define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 -# define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 -# define SSL_R_EE_KEY_TOO_SMALL 399 -# define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 -# define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 -# define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 -# define SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN 204 -# define SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE 194 -# define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 -# define SSL_R_EXTENSION_NOT_RECEIVED 279 -# define SSL_R_EXTRA_DATA_IN_MESSAGE 153 -# define SSL_R_EXT_LENGTH_MISMATCH 163 -# define SSL_R_FAILED_TO_INIT_ASYNC 405 -# define SSL_R_FRAGMENTED_CLIENT_HELLO 401 -# define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 -# define SSL_R_HTTPS_PROXY_REQUEST 155 -# define SSL_R_HTTP_REQUEST 156 -# define SSL_R_ILLEGAL_POINT_COMPRESSION 162 -# define SSL_R_ILLEGAL_SUITEB_DIGEST 380 -# define SSL_R_INAPPROPRIATE_FALLBACK 373 -# define SSL_R_INCONSISTENT_COMPRESSION 340 -# define SSL_R_INCONSISTENT_EARLY_DATA_ALPN 222 -# define SSL_R_INCONSISTENT_EARLY_DATA_SNI 231 -# define SSL_R_INCONSISTENT_EXTMS 104 -# define SSL_R_INSUFFICIENT_SECURITY 241 -# define SSL_R_INVALID_ALERT 205 -# define SSL_R_INVALID_CCS_MESSAGE 260 -# define SSL_R_INVALID_CERTIFICATE_OR_ALG 238 -# define SSL_R_INVALID_COMMAND 280 -# define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 -# define SSL_R_INVALID_CONFIG 283 -# define SSL_R_INVALID_CONFIGURATION_NAME 113 -# define SSL_R_INVALID_CONTEXT 282 -# define SSL_R_INVALID_CT_VALIDATION_TYPE 212 -# define SSL_R_INVALID_KEY_UPDATE_TYPE 120 -# define SSL_R_INVALID_MAX_EARLY_DATA 174 -# define SSL_R_INVALID_NULL_CMD_NAME 385 -# define SSL_R_INVALID_SEQUENCE_NUMBER 402 -# define SSL_R_INVALID_SERVERINFO_DATA 388 -# define SSL_R_INVALID_SESSION_ID 999 -# define SSL_R_INVALID_SRP_USERNAME 357 -# define SSL_R_INVALID_STATUS_RESPONSE 328 -# define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 -# define SSL_R_LENGTH_MISMATCH 159 -# define SSL_R_LENGTH_TOO_LONG 404 -# define SSL_R_LENGTH_TOO_SHORT 160 -# define SSL_R_LIBRARY_BUG 274 -# define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 -# define SSL_R_MISSING_DSA_SIGNING_CERT 165 -# define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 -# define SSL_R_MISSING_FATAL 256 -# define SSL_R_MISSING_PARAMETERS 290 -# define SSL_R_MISSING_RSA_CERTIFICATE 168 -# define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 -# define SSL_R_MISSING_RSA_SIGNING_CERT 170 -# define SSL_R_MISSING_SIGALGS_EXTENSION 112 -# define SSL_R_MISSING_SIGNING_CERT 221 -# define SSL_R_MISSING_SRP_PARAM 358 -# define SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION 209 -# define SSL_R_MISSING_TMP_DH_KEY 171 -# define SSL_R_MISSING_TMP_ECDH_KEY 311 -# define SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA 293 -# define SSL_R_NOT_ON_RECORD_BOUNDARY 182 -# define SSL_R_NOT_REPLACING_CERTIFICATE 289 -# define SSL_R_NOT_SERVER 284 -# define SSL_R_NO_APPLICATION_PROTOCOL 235 -# define SSL_R_NO_CERTIFICATES_RETURNED 176 -# define SSL_R_NO_CERTIFICATE_ASSIGNED 177 -# define SSL_R_NO_CERTIFICATE_SET 179 -# define SSL_R_NO_CHANGE_FOLLOWING_HRR 214 -# define SSL_R_NO_CIPHERS_AVAILABLE 181 -# define SSL_R_NO_CIPHERS_SPECIFIED 183 -# define SSL_R_NO_CIPHER_MATCH 185 -# define SSL_R_NO_CLIENT_CERT_METHOD 331 -# define SSL_R_NO_COMPRESSION_SPECIFIED 187 -# define SSL_R_NO_COOKIE_CALLBACK_SET 287 -# define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 -# define SSL_R_NO_METHOD_SPECIFIED 188 -# define SSL_R_NO_PEM_EXTENSIONS 389 -# define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 -# define SSL_R_NO_PROTOCOLS_AVAILABLE 191 -# define SSL_R_NO_RENEGOTIATION 339 -# define SSL_R_NO_REQUIRED_DIGEST 324 -# define SSL_R_NO_SHARED_CIPHER 193 -# define SSL_R_NO_SHARED_GROUPS 410 -# define SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS 376 -# define SSL_R_NO_SRTP_PROFILES 359 -# define SSL_R_NO_SUITABLE_KEY_SHARE 101 -# define SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM 118 -# define SSL_R_NO_VALID_SCTS 216 -# define SSL_R_NO_VERIFY_COOKIE_CALLBACK 403 -# define SSL_R_NULL_SSL_CTX 195 -# define SSL_R_NULL_SSL_METHOD_PASSED 196 -# define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 -# define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 -# define SSL_R_OVERFLOW_ERROR 237 -# define SSL_R_PACKET_LENGTH_TOO_LONG 198 -# define SSL_R_PARSE_TLSEXT 227 -# define SSL_R_PATH_TOO_LONG 270 -# define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 -# define SSL_R_PEM_NAME_BAD_PREFIX 391 -# define SSL_R_PEM_NAME_TOO_SHORT 392 -# define SSL_R_PIPELINE_FAILURE 406 -# define SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR 278 -# define SSL_R_PRIVATE_KEY_MISMATCH 288 -# define SSL_R_PROTOCOL_IS_SHUTDOWN 207 -# define SSL_R_PSK_IDENTITY_NOT_FOUND 223 -# define SSL_R_PSK_NO_CLIENT_CB 224 -# define SSL_R_PSK_NO_SERVER_CB 225 -# define SSL_R_READ_BIO_NOT_SET 211 -# define SSL_R_READ_TIMEOUT_EXPIRED 312 -# define SSL_R_RECORD_LENGTH_MISMATCH 213 -# define SSL_R_RECORD_TOO_SMALL 298 -# define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 -# define SSL_R_RENEGOTIATION_ENCODING_ERR 336 -# define SSL_R_RENEGOTIATION_MISMATCH 337 -# define SSL_R_REQUEST_PENDING 285 -# define SSL_R_REQUEST_SENT 286 -# define SSL_R_REQUIRED_CIPHER_MISSING 215 -# define SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING 342 -# define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 -# define SSL_R_SCT_VERIFICATION_FAILED 208 -# define SSL_R_SERVERHELLO_TLSEXT 275 -# define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 -# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 -# define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 -# define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 -# define SSL_R_SRP_A_CALC 361 -# define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 -# define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 -# define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 -# define SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH 232 -# define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 -# define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 -# define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 -# define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 -# define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 -# define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 -# define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 -# define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 -# define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 -# define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 -# define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 -# define SSL_R_SSL_COMMAND_SECTION_EMPTY 117 -# define SSL_R_SSL_COMMAND_SECTION_NOT_FOUND 125 -# define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 -# define SSL_R_SSL_HANDSHAKE_FAILURE 229 -# define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 -# define SSL_R_SSL_NEGATIVE_LENGTH 372 -# define SSL_R_SSL_SECTION_EMPTY 126 -# define SSL_R_SSL_SECTION_NOT_FOUND 136 -# define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 -# define SSL_R_SSL_SESSION_ID_CONFLICT 302 -# define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 -# define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 -# define SSL_R_SSL_SESSION_ID_TOO_LONG 408 -# define SSL_R_SSL_SESSION_VERSION_MISMATCH 210 -# define SSL_R_STILL_IN_INIT 121 -# define SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED 1116 -# define SSL_R_TLSV13_ALERT_MISSING_EXTENSION 1109 -# define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 -# define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 -# define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 -# define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 -# define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 -# define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 -# define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 -# define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 -# define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 -# define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 -# define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 -# define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 -# define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 -# define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 -# define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 -# define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 -# define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 -# define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 -# define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 -# define SSL_R_TLS_HEARTBEAT_PENDING 366 -# define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 -# define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 -# define SSL_R_TOO_MANY_KEY_UPDATES 132 -# define SSL_R_TOO_MANY_WARN_ALERTS 409 -# define SSL_R_TOO_MUCH_EARLY_DATA 164 -# define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 -# define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 -# define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 -# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 -# define SSL_R_UNEXPECTED_CCS_MESSAGE 262 -# define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178 -# define SSL_R_UNEXPECTED_MESSAGE 244 -# define SSL_R_UNEXPECTED_RECORD 245 -# define SSL_R_UNINITIALIZED 276 -# define SSL_R_UNKNOWN_ALERT_TYPE 246 -# define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 -# define SSL_R_UNKNOWN_CIPHER_RETURNED 248 -# define SSL_R_UNKNOWN_CIPHER_TYPE 249 -# define SSL_R_UNKNOWN_CMD_NAME 386 -# define SSL_R_UNKNOWN_COMMAND 139 -# define SSL_R_UNKNOWN_DIGEST 368 -# define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 -# define SSL_R_UNKNOWN_PKEY_TYPE 251 -# define SSL_R_UNKNOWN_PROTOCOL 252 -# define SSL_R_UNKNOWN_SSL_VERSION 254 -# define SSL_R_UNKNOWN_STATE 255 -# define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 -# define SSL_R_UNSOLICITED_EXTENSION 217 -# define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 -# define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 -# define SSL_R_UNSUPPORTED_PROTOCOL 258 -# define SSL_R_UNSUPPORTED_SSL_VERSION 259 -# define SSL_R_UNSUPPORTED_STATUS_TYPE 329 -# define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 -# define SSL_R_VERSION_TOO_HIGH 166 -# define SSL_R_VERSION_TOO_LOW 396 -# define SSL_R_WRONG_CERTIFICATE_TYPE 383 -# define SSL_R_WRONG_CIPHER_RETURNED 261 -# define SSL_R_WRONG_CURVE 378 -# define SSL_R_WRONG_SIGNATURE_LENGTH 264 -# define SSL_R_WRONG_SIGNATURE_SIZE 265 -# define SSL_R_WRONG_SIGNATURE_TYPE 370 -# define SSL_R_WRONG_SSL_VERSION 266 -# define SSL_R_WRONG_VERSION_NUMBER 267 -# define SSL_R_X509_LIB 268 -# define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/stack.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/stack.h deleted file mode 100644 index cfc07505..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/stack.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 1995-2017 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_STACK_H -# define HEADER_STACK_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */ - -typedef int (*OPENSSL_sk_compfunc)(const void *, const void *); -typedef void (*OPENSSL_sk_freefunc)(void *); -typedef void *(*OPENSSL_sk_copyfunc)(const void *); - -int OPENSSL_sk_num(const OPENSSL_STACK *); -void *OPENSSL_sk_value(const OPENSSL_STACK *, int); - -void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data); - -OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp); -OPENSSL_STACK *OPENSSL_sk_new_null(void); -OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n); -int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n); -void OPENSSL_sk_free(OPENSSL_STACK *); -void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *)); -OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, - OPENSSL_sk_copyfunc c, - OPENSSL_sk_freefunc f); -int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where); -void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc); -void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p); -int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data); -void *OPENSSL_sk_shift(OPENSSL_STACK *st); -void *OPENSSL_sk_pop(OPENSSL_STACK *st); -void OPENSSL_sk_zero(OPENSSL_STACK *st); -OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, - OPENSSL_sk_compfunc cmp); -OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st); -void OPENSSL_sk_sort(OPENSSL_STACK *st); -int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define _STACK OPENSSL_STACK -# define sk_num OPENSSL_sk_num -# define sk_value OPENSSL_sk_value -# define sk_set OPENSSL_sk_set -# define sk_new OPENSSL_sk_new -# define sk_new_null OPENSSL_sk_new_null -# define sk_free OPENSSL_sk_free -# define sk_pop_free OPENSSL_sk_pop_free -# define sk_deep_copy OPENSSL_sk_deep_copy -# define sk_insert OPENSSL_sk_insert -# define sk_delete OPENSSL_sk_delete -# define sk_delete_ptr OPENSSL_sk_delete_ptr -# define sk_find OPENSSL_sk_find -# define sk_find_ex OPENSSL_sk_find_ex -# define sk_push OPENSSL_sk_push -# define sk_unshift OPENSSL_sk_unshift -# define sk_shift OPENSSL_sk_shift -# define sk_pop OPENSSL_sk_pop -# define sk_zero OPENSSL_sk_zero -# define sk_set_cmp_func OPENSSL_sk_set_cmp_func -# define sk_dup OPENSSL_sk_dup -# define sk_sort OPENSSL_sk_sort -# define sk_is_sorted OPENSSL_sk_is_sorted -# endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/store.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/store.h deleted file mode 100644 index a40a7339..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/store.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2016-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_OSSL_STORE_H -# define HEADER_OSSL_STORE_H - -# include -# include -# include -# include - -# ifdef __cplusplus -extern "C" { -# endif - -/*- - * The main OSSL_STORE functions. - * ------------------------------ - * - * These allow applications to open a channel to a resource with supported - * data (keys, certs, crls, ...), read the data a piece at a time and decide - * what to do with it, and finally close. - */ - -typedef struct ossl_store_ctx_st OSSL_STORE_CTX; - -/* - * Typedef for the OSSL_STORE_INFO post processing callback. This can be used - * to massage the given OSSL_STORE_INFO, or to drop it entirely (by returning - * NULL). - */ -typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *, - void *); - -/* - * Open a channel given a URI. The given UI method will be used any time the - * loader needs extra input, for example when a password or pin is needed, and - * will be passed the same user data every time it's needed in this context. - * - * Returns a context reference which represents the channel to communicate - * through. - */ -OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method, - void *ui_data, - OSSL_STORE_post_process_info_fn post_process, - void *post_process_data); - -/* - * Control / fine tune the OSSL_STORE channel. |cmd| determines what is to be - * done, and depends on the underlying loader (use OSSL_STORE_get0_scheme to - * determine which loader is used), except for common commands (see below). - * Each command takes different arguments. - */ -int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */); -int OSSL_STORE_vctrl(OSSL_STORE_CTX *ctx, int cmd, va_list args); - -/* - * Common ctrl commands that different loaders may choose to support. - */ -/* int on = 0 or 1; STORE_ctrl(ctx, STORE_C_USE_SECMEM, &on); */ -# define OSSL_STORE_C_USE_SECMEM 1 -/* Where custom commands start */ -# define OSSL_STORE_C_CUSTOM_START 100 - -/* - * Read one data item (a key, a cert, a CRL) that is supported by the OSSL_STORE - * functionality, given a context. - * Returns a OSSL_STORE_INFO pointer, from which OpenSSL typed data can be - * extracted with OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), ... - * NULL is returned on error, which may include that the data found at the URI - * can't be figured out for certain or is ambiguous. - */ -OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx); - -/* - * Check if end of data (end of file) is reached - * Returns 1 on end, 0 otherwise. - */ -int OSSL_STORE_eof(OSSL_STORE_CTX *ctx); - -/* - * Check if an error occurred - * Returns 1 if it did, 0 otherwise. - */ -int OSSL_STORE_error(OSSL_STORE_CTX *ctx); - -/* - * Close the channel - * Returns 1 on success, 0 on error. - */ -int OSSL_STORE_close(OSSL_STORE_CTX *ctx); - - -/*- - * Extracting OpenSSL types from and creating new OSSL_STORE_INFOs - * --------------------------------------------------------------- - */ - -/* - * Types of data that can be ossl_stored in a OSSL_STORE_INFO. - * OSSL_STORE_INFO_NAME is typically found when getting a listing of - * available "files" / "tokens" / what have you. - */ -# define OSSL_STORE_INFO_NAME 1 /* char * */ -# define OSSL_STORE_INFO_PARAMS 2 /* EVP_PKEY * */ -# define OSSL_STORE_INFO_PKEY 3 /* EVP_PKEY * */ -# define OSSL_STORE_INFO_CERT 4 /* X509 * */ -# define OSSL_STORE_INFO_CRL 5 /* X509_CRL * */ - -/* - * Functions to generate OSSL_STORE_INFOs, one function for each type we - * support having in them, as well as a generic constructor. - * - * In all cases, ownership of the object is transferred to the OSSL_STORE_INFO - * and will therefore be freed when the OSSL_STORE_INFO is freed. - */ -OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name); -int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(EVP_PKEY *params); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl); - -/* - * Functions to try to extract data from a OSSL_STORE_INFO. - */ -int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *info); -const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *info); -char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *info); -const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO *info); -char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *info); -X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *info); -X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *info); -X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *info); -X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *info); - -const char *OSSL_STORE_INFO_type_string(int type); - -/* - * Free the OSSL_STORE_INFO - */ -void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info); - - -/*- - * Functions to construct a search URI from a base URI and search criteria - * ----------------------------------------------------------------------- - */ - -/* OSSL_STORE search types */ -# define OSSL_STORE_SEARCH_BY_NAME 1 /* subject in certs, issuer in CRLs */ -# define OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 2 -# define OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 3 -# define OSSL_STORE_SEARCH_BY_ALIAS 4 - -/* To check what search types the scheme handler supports */ -int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type); - -/* Search term constructors */ -/* - * The input is considered to be owned by the caller, and must therefore - * remain present throughout the lifetime of the returned OSSL_STORE_SEARCH - */ -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name, - const ASN1_INTEGER - *serial); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest, - const unsigned char - *bytes, size_t len); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias); - -/* Search term destructor */ -void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search); - -/* Search term accessors */ -int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion); -X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion); -const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH - *criterion); -const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH - *criterion, size_t *length); -const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion); -const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH *criterion); - -/* - * Add search criterion and expected return type (which can be unspecified) - * to the loading channel. This MUST happen before the first OSSL_STORE_load(). - */ -int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type); -int OSSL_STORE_find(OSSL_STORE_CTX *ctx, OSSL_STORE_SEARCH *search); - - -/*- - * Function to register a loader for the given URI scheme. - * ------------------------------------------------------- - * - * The loader receives all the main components of an URI except for the - * scheme. - */ - -typedef struct ossl_store_loader_st OSSL_STORE_LOADER; -OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme); -const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader); -const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader); -/* struct ossl_store_loader_ctx_st is defined differently by each loader */ -typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX; -typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(const OSSL_STORE_LOADER - *loader, - const char *uri, - const UI_METHOD *ui_method, - void *ui_data); -int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader, - OSSL_STORE_open_fn open_function); -typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd, - va_list args); -int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader, - OSSL_STORE_ctrl_fn ctrl_function); -typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected); -int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader, - OSSL_STORE_expect_fn expect_function); -typedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx, - OSSL_STORE_SEARCH *criteria); -int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader, - OSSL_STORE_find_fn find_function); -typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx, - const UI_METHOD *ui_method, - void *ui_data); -int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *loader, - OSSL_STORE_load_fn load_function); -typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *loader, - OSSL_STORE_eof_fn eof_function); -typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader, - OSSL_STORE_error_fn error_function); -typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader, - OSSL_STORE_close_fn close_function); -void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader); - -int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader); -OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme); - -/*- - * Functions to list STORE loaders - * ------------------------------- - */ -int OSSL_STORE_do_all_loaders(void (*do_function) (const OSSL_STORE_LOADER - *loader, void *do_arg), - void *do_arg); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/storeerr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/storeerr.h deleted file mode 100644 index 190eab07..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/storeerr.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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_OSSL_STOREERR_H -# define HEADER_OSSL_STOREERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_OSSL_STORE_strings(void); - -/* - * OSSL_STORE function codes. - */ -# define OSSL_STORE_F_FILE_CTRL 129 -# define OSSL_STORE_F_FILE_FIND 138 -# define OSSL_STORE_F_FILE_GET_PASS 118 -# define OSSL_STORE_F_FILE_LOAD 119 -# define OSSL_STORE_F_FILE_LOAD_TRY_DECODE 124 -# define OSSL_STORE_F_FILE_NAME_TO_URI 126 -# define OSSL_STORE_F_FILE_OPEN 120 -# define OSSL_STORE_F_OSSL_STORE_ATTACH_PEM_BIO 127 -# define OSSL_STORE_F_OSSL_STORE_EXPECT 130 -# define OSSL_STORE_F_OSSL_STORE_FILE_ATTACH_PEM_BIO_INT 128 -# define OSSL_STORE_F_OSSL_STORE_FIND 131 -# define OSSL_STORE_F_OSSL_STORE_GET0_LOADER_INT 100 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CERT 101 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CRL 102 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME 103 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME_DESCRIPTION 135 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PARAMS 104 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PKEY 105 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CERT 106 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CRL 107 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_EMBEDDED 123 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_NAME 109 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PARAMS 110 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PKEY 111 -# define OSSL_STORE_F_OSSL_STORE_INFO_SET0_NAME_DESCRIPTION 134 -# define OSSL_STORE_F_OSSL_STORE_INIT_ONCE 112 -# define OSSL_STORE_F_OSSL_STORE_LOADER_NEW 113 -# define OSSL_STORE_F_OSSL_STORE_OPEN 114 -# define OSSL_STORE_F_OSSL_STORE_OPEN_INT 115 -# define OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT 117 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ALIAS 132 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 133 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 136 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_NAME 137 -# define OSSL_STORE_F_OSSL_STORE_UNREGISTER_LOADER_INT 116 -# define OSSL_STORE_F_TRY_DECODE_PARAMS 121 -# define OSSL_STORE_F_TRY_DECODE_PKCS12 122 -# define OSSL_STORE_F_TRY_DECODE_PKCS8ENCRYPTED 125 - -/* - * OSSL_STORE reason codes. - */ -# define OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE 107 -# define OSSL_STORE_R_BAD_PASSWORD_READ 115 -# define OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC 113 -# define OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST 121 -# define OSSL_STORE_R_INVALID_SCHEME 106 -# define OSSL_STORE_R_IS_NOT_A 112 -# define OSSL_STORE_R_LOADER_INCOMPLETE 116 -# define OSSL_STORE_R_LOADING_STARTED 117 -# define OSSL_STORE_R_NOT_A_CERTIFICATE 100 -# define OSSL_STORE_R_NOT_A_CRL 101 -# define OSSL_STORE_R_NOT_A_KEY 102 -# define OSSL_STORE_R_NOT_A_NAME 103 -# define OSSL_STORE_R_NOT_PARAMETERS 104 -# define OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR 114 -# define OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE 108 -# define OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 119 -# define OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED 109 -# define OSSL_STORE_R_UNREGISTERED_SCHEME 105 -# define OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE 110 -# define OSSL_STORE_R_UNSUPPORTED_OPERATION 118 -# define OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE 120 -# define OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED 111 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/symhacks.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/symhacks.h deleted file mode 100644 index 156ea6e4..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/symhacks.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 1999-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_SYMHACKS_H -# define HEADER_SYMHACKS_H - -# include - -/* Case insensitive linking causes problems.... */ -# if defined(OPENSSL_SYS_VMS) -# undef ERR_load_CRYPTO_strings -# define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings -# undef OCSP_crlID_new -# define OCSP_crlID_new OCSP_crlID2_new - -# undef d2i_ECPARAMETERS -# define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS -# undef i2d_ECPARAMETERS -# define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS -# undef d2i_ECPKPARAMETERS -# define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS -# undef i2d_ECPKPARAMETERS -# define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS - -/* This one clashes with CMS_data_create */ -# undef cms_Data_create -# define cms_Data_create priv_cms_Data_create - -# endif - -#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/tls1.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/tls1.h deleted file mode 100644 index 76d9fda4..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/tls1.h +++ /dev/null @@ -1,1237 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved - * Copyright 2005 Nokia. 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_TLS1_H -# define HEADER_TLS1_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Default security level if not overridden at config time */ -# ifndef OPENSSL_TLS_SECURITY_LEVEL -# define OPENSSL_TLS_SECURITY_LEVEL 1 -# endif - -# define TLS1_VERSION 0x0301 -# define TLS1_1_VERSION 0x0302 -# define TLS1_2_VERSION 0x0303 -# define TLS1_3_VERSION 0x0304 -# define TLS_MAX_VERSION TLS1_3_VERSION - -/* Special value for method supporting multiple versions */ -# define TLS_ANY_VERSION 0x10000 - -# define TLS1_VERSION_MAJOR 0x03 -# define TLS1_VERSION_MINOR 0x01 - -# define TLS1_1_VERSION_MAJOR 0x03 -# define TLS1_1_VERSION_MINOR 0x02 - -# define TLS1_2_VERSION_MAJOR 0x03 -# define TLS1_2_VERSION_MINOR 0x03 - -# define TLS1_get_version(s) \ - ((SSL_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_version(s) : 0) - -# define TLS1_get_client_version(s) \ - ((SSL_client_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_client_version(s) : 0) - -# define TLS1_AD_DECRYPTION_FAILED 21 -# define TLS1_AD_RECORD_OVERFLOW 22 -# define TLS1_AD_UNKNOWN_CA 48/* fatal */ -# define TLS1_AD_ACCESS_DENIED 49/* fatal */ -# define TLS1_AD_DECODE_ERROR 50/* fatal */ -# define TLS1_AD_DECRYPT_ERROR 51 -# define TLS1_AD_EXPORT_RESTRICTION 60/* fatal */ -# define TLS1_AD_PROTOCOL_VERSION 70/* fatal */ -# define TLS1_AD_INSUFFICIENT_SECURITY 71/* fatal */ -# define TLS1_AD_INTERNAL_ERROR 80/* fatal */ -# define TLS1_AD_INAPPROPRIATE_FALLBACK 86/* fatal */ -# define TLS1_AD_USER_CANCELLED 90 -# define TLS1_AD_NO_RENEGOTIATION 100 -/* TLSv1.3 alerts */ -# define TLS13_AD_MISSING_EXTENSION 109 /* fatal */ -# define TLS13_AD_CERTIFICATE_REQUIRED 116 /* fatal */ -/* codes 110-114 are from RFC3546 */ -# define TLS1_AD_UNSUPPORTED_EXTENSION 110 -# define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 -# define TLS1_AD_UNRECOGNIZED_NAME 112 -# define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 -# define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 -# define TLS1_AD_UNKNOWN_PSK_IDENTITY 115/* fatal */ -# define TLS1_AD_NO_APPLICATION_PROTOCOL 120 /* fatal */ - -/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ -# define TLSEXT_TYPE_server_name 0 -# define TLSEXT_TYPE_max_fragment_length 1 -# define TLSEXT_TYPE_client_certificate_url 2 -# define TLSEXT_TYPE_trusted_ca_keys 3 -# define TLSEXT_TYPE_truncated_hmac 4 -# define TLSEXT_TYPE_status_request 5 -/* ExtensionType values from RFC4681 */ -# define TLSEXT_TYPE_user_mapping 6 -/* ExtensionType values from RFC5878 */ -# define TLSEXT_TYPE_client_authz 7 -# define TLSEXT_TYPE_server_authz 8 -/* ExtensionType values from RFC6091 */ -# define TLSEXT_TYPE_cert_type 9 - -/* ExtensionType values from RFC4492 */ -/* - * Prior to TLSv1.3 the supported_groups extension was known as - * elliptic_curves - */ -# define TLSEXT_TYPE_supported_groups 10 -# define TLSEXT_TYPE_elliptic_curves TLSEXT_TYPE_supported_groups -# define TLSEXT_TYPE_ec_point_formats 11 - - -/* ExtensionType value from RFC5054 */ -# define TLSEXT_TYPE_srp 12 - -/* ExtensionType values from RFC5246 */ -# define TLSEXT_TYPE_signature_algorithms 13 - -/* ExtensionType value from RFC5764 */ -# define TLSEXT_TYPE_use_srtp 14 - -/* ExtensionType value from RFC5620 */ -# define TLSEXT_TYPE_heartbeat 15 - -/* ExtensionType value from RFC7301 */ -# define TLSEXT_TYPE_application_layer_protocol_negotiation 16 - -/* - * Extension type for Certificate Transparency - * https://tools.ietf.org/html/rfc6962#section-3.3.1 - */ -# define TLSEXT_TYPE_signed_certificate_timestamp 18 - -/* - * ExtensionType value for TLS padding extension. - * http://tools.ietf.org/html/draft-agl-tls-padding - */ -# define TLSEXT_TYPE_padding 21 - -/* ExtensionType value from RFC7366 */ -# define TLSEXT_TYPE_encrypt_then_mac 22 - -/* ExtensionType value from RFC7627 */ -# define TLSEXT_TYPE_extended_master_secret 23 - -/* ExtensionType value from RFC4507 */ -# define TLSEXT_TYPE_session_ticket 35 - -/* As defined for TLS1.3 */ -# define TLSEXT_TYPE_psk 41 -# define TLSEXT_TYPE_early_data 42 -# define TLSEXT_TYPE_supported_versions 43 -# define TLSEXT_TYPE_cookie 44 -# define TLSEXT_TYPE_psk_kex_modes 45 -# define TLSEXT_TYPE_certificate_authorities 47 -# define TLSEXT_TYPE_post_handshake_auth 49 -# define TLSEXT_TYPE_signature_algorithms_cert 50 -# define TLSEXT_TYPE_key_share 51 - -/* Temporary extension type */ -# define TLSEXT_TYPE_renegotiate 0xff01 - -# ifndef OPENSSL_NO_NEXTPROTONEG -/* This is not an IANA defined extension number */ -# define TLSEXT_TYPE_next_proto_neg 13172 -# endif - -/* NameType value from RFC3546 */ -# define TLSEXT_NAMETYPE_host_name 0 -/* status request value from RFC3546 */ -# define TLSEXT_STATUSTYPE_ocsp 1 - -/* ECPointFormat values from RFC4492 */ -# define TLSEXT_ECPOINTFORMAT_first 0 -# define TLSEXT_ECPOINTFORMAT_uncompressed 0 -# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 -# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 -# define TLSEXT_ECPOINTFORMAT_last 2 - -/* Signature and hash algorithms from RFC5246 */ -# define TLSEXT_signature_anonymous 0 -# define TLSEXT_signature_rsa 1 -# define TLSEXT_signature_dsa 2 -# define TLSEXT_signature_ecdsa 3 -# define TLSEXT_signature_gostr34102001 237 -# define TLSEXT_signature_gostr34102012_256 238 -# define TLSEXT_signature_gostr34102012_512 239 - -/* Total number of different signature algorithms */ -# define TLSEXT_signature_num 7 - -# define TLSEXT_hash_none 0 -# define TLSEXT_hash_md5 1 -# define TLSEXT_hash_sha1 2 -# define TLSEXT_hash_sha224 3 -# define TLSEXT_hash_sha256 4 -# define TLSEXT_hash_sha384 5 -# define TLSEXT_hash_sha512 6 -# define TLSEXT_hash_gostr3411 237 -# define TLSEXT_hash_gostr34112012_256 238 -# define TLSEXT_hash_gostr34112012_512 239 - -/* Total number of different digest algorithms */ - -# define TLSEXT_hash_num 10 - -/* Flag set for unrecognised algorithms */ -# define TLSEXT_nid_unknown 0x1000000 - -/* ECC curves */ - -# define TLSEXT_curve_P_256 23 -# define TLSEXT_curve_P_384 24 - -/* OpenSSL value to disable maximum fragment length extension */ -# define TLSEXT_max_fragment_length_DISABLED 0 -/* Allowed values for max fragment length extension */ -# define TLSEXT_max_fragment_length_512 1 -# define TLSEXT_max_fragment_length_1024 2 -# define TLSEXT_max_fragment_length_2048 3 -# define TLSEXT_max_fragment_length_4096 4 - -int SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode); -int SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode); - -# define TLSEXT_MAXLEN_host_name 255 - -__owur const char *SSL_get_servername(const SSL *s, const int type); -__owur int SSL_get_servername_type(const SSL *s); -/* - * SSL_export_keying_material exports a value derived from the master secret, - * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and - * optional context. (Since a zero length context is allowed, the |use_context| - * flag controls whether a context is included.) It returns 1 on success and - * 0 or -1 otherwise. - */ -__owur int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, - const char *label, size_t llen, - const unsigned char *context, - size_t contextlen, int use_context); - -/* - * SSL_export_keying_material_early exports a value derived from the - * early exporter master secret, as specified in - * https://tools.ietf.org/html/draft-ietf-tls-tls13-23. It writes - * |olen| bytes to |out| given a label and optional context. It - * returns 1 on success and 0 otherwise. - */ -__owur int SSL_export_keying_material_early(SSL *s, unsigned char *out, - size_t olen, const char *label, - size_t llen, - const unsigned char *context, - size_t contextlen); - -int SSL_get_peer_signature_type_nid(const SSL *s, int *pnid); -int SSL_get_signature_type_nid(const SSL *s, int *pnid); - -int SSL_get_sigalgs(SSL *s, int idx, - int *psign, int *phash, int *psignandhash, - unsigned char *rsig, unsigned char *rhash); - -int SSL_get_shared_sigalgs(SSL *s, int idx, - int *psign, int *phash, int *psignandhash, - unsigned char *rsig, unsigned char *rhash); - -__owur int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain); - -# define SSL_set_tlsext_host_name(s,name) \ - SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,\ - (void *)name) - -# define SSL_set_tlsext_debug_callback(ssl, cb) \ - SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,\ - (void (*)(void))cb) - -# define SSL_set_tlsext_debug_arg(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0,arg) - -# define SSL_get_tlsext_status_type(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) - -# define SSL_set_tlsext_status_type(ssl, type) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) - -# define SSL_get_tlsext_status_exts(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0,arg) - -# define SSL_set_tlsext_status_exts(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0,arg) - -# define SSL_get_tlsext_status_ids(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0,arg) - -# define SSL_set_tlsext_status_ids(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0,arg) - -# define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0,arg) - -# define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen,arg) - -# define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ - SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,\ - (void (*)(void))cb) - -# define SSL_TLSEXT_ERR_OK 0 -# define SSL_TLSEXT_ERR_ALERT_WARNING 1 -# define SSL_TLSEXT_ERR_ALERT_FATAL 2 -# define SSL_TLSEXT_ERR_NOACK 3 - -# define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0,arg) - -# define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_TLSEXT_TICKET_KEYS,keylen,keys) -# define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_TICKET_KEYS,keylen,keys) - -# define SSL_CTX_get_tlsext_status_cb(ssl, cb) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB,0,(void *)cb) -# define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ - SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,\ - (void (*)(void))cb) - -# define SSL_CTX_get_tlsext_status_arg(ssl, arg) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) -# define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) - -# define SSL_CTX_set_tlsext_status_type(ssl, type) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) - -# define SSL_CTX_get_tlsext_status_type(ssl) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) - -# define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ - SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,\ - (void (*)(void))cb) - -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_DTLSEXT_HB_ENABLED 0x01 -# define SSL_DTLSEXT_HB_DONT_SEND_REQUESTS 0x02 -# define SSL_DTLSEXT_HB_DONT_RECV_REQUESTS 0x04 -# define SSL_get_dtlsext_heartbeat_pending(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING,0,NULL) -# define SSL_set_dtlsext_heartbeat_no_requests(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL) - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT \ - SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT -# define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING \ - SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING -# define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS \ - SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS -# define SSL_TLSEXT_HB_ENABLED \ - SSL_DTLSEXT_HB_ENABLED -# define SSL_TLSEXT_HB_DONT_SEND_REQUESTS \ - SSL_DTLSEXT_HB_DONT_SEND_REQUESTS -# define SSL_TLSEXT_HB_DONT_RECV_REQUESTS \ - SSL_DTLSEXT_HB_DONT_RECV_REQUESTS -# define SSL_get_tlsext_heartbeat_pending(ssl) \ - SSL_get_dtlsext_heartbeat_pending(ssl) -# define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \ - SSL_set_dtlsext_heartbeat_no_requests(ssl,arg) -# endif -# endif - -/* PSK ciphersuites from 4279 */ -# define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A -# define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B -# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C -# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D -# define TLS1_CK_DHE_PSK_WITH_RC4_128_SHA 0x0300008E -# define TLS1_CK_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008F -# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA 0x03000090 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA 0x03000091 -# define TLS1_CK_RSA_PSK_WITH_RC4_128_SHA 0x03000092 -# define TLS1_CK_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x03000093 -# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA 0x03000094 -# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA 0x03000095 - -/* PSK ciphersuites from 5487 */ -# define TLS1_CK_PSK_WITH_AES_128_GCM_SHA256 0x030000A8 -# define TLS1_CK_PSK_WITH_AES_256_GCM_SHA384 0x030000A9 -# define TLS1_CK_DHE_PSK_WITH_AES_128_GCM_SHA256 0x030000AA -# define TLS1_CK_DHE_PSK_WITH_AES_256_GCM_SHA384 0x030000AB -# define TLS1_CK_RSA_PSK_WITH_AES_128_GCM_SHA256 0x030000AC -# define TLS1_CK_RSA_PSK_WITH_AES_256_GCM_SHA384 0x030000AD -# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA256 0x030000AE -# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA384 0x030000AF -# define TLS1_CK_PSK_WITH_NULL_SHA256 0x030000B0 -# define TLS1_CK_PSK_WITH_NULL_SHA384 0x030000B1 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA256 0x030000B2 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA384 0x030000B3 -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA256 0x030000B4 -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA384 0x030000B5 -# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA256 0x030000B6 -# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA384 0x030000B7 -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA256 0x030000B8 -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA384 0x030000B9 - -/* NULL PSK ciphersuites from RFC4785 */ -# define TLS1_CK_PSK_WITH_NULL_SHA 0x0300002C -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA 0x0300002D -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA 0x0300002E - -/* AES ciphersuites from RFC3268 */ -# define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F -# define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 -# define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 -# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 -# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 -# define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 -# define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 -# define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 -# define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 -# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 -# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 -# define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A - -/* TLS v1.2 ciphersuites */ -# define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B -# define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C -# define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D -# define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E -# define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F -# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 -# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 - -/* TLS v1.2 ciphersuites */ -# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 -# define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 -# define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 -# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A -# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B -# define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C -# define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 -# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 - -/* SEED ciphersuites from RFC4162 */ -# define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 -# define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 -# define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 -# define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 -# define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A -# define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B - -/* TLS v1.2 GCM ciphersuites from RFC5288 */ -# define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C -# define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D -# define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E -# define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F -# define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 -# define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 -# define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 -# define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 -# define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 -# define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 -# define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 -# define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 - -/* CCM ciphersuites from RFC6655 */ -# define TLS1_CK_RSA_WITH_AES_128_CCM 0x0300C09C -# define TLS1_CK_RSA_WITH_AES_256_CCM 0x0300C09D -# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM 0x0300C09E -# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM 0x0300C09F -# define TLS1_CK_RSA_WITH_AES_128_CCM_8 0x0300C0A0 -# define TLS1_CK_RSA_WITH_AES_256_CCM_8 0x0300C0A1 -# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM_8 0x0300C0A2 -# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM_8 0x0300C0A3 -# define TLS1_CK_PSK_WITH_AES_128_CCM 0x0300C0A4 -# define TLS1_CK_PSK_WITH_AES_256_CCM 0x0300C0A5 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM 0x0300C0A6 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM 0x0300C0A7 -# define TLS1_CK_PSK_WITH_AES_128_CCM_8 0x0300C0A8 -# define TLS1_CK_PSK_WITH_AES_256_CCM_8 0x0300C0A9 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM_8 0x0300C0AA -# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM_8 0x0300C0AB - -/* CCM ciphersuites from RFC7251 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM 0x0300C0AC -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM 0x0300C0AD -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM_8 0x0300C0AE -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM_8 0x0300C0AF - -/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BA -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BB -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BC -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BD -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BE -# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256 0x030000BF - -# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C0 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C1 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C2 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C3 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4 -# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5 - -/* ECC ciphersuites from RFC4492 */ -# define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 -# define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 -# define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 - -# define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 -# define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 -# define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A - -# define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B -# define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C -# define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D -# define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E -# define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F - -# define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 -# define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 -# define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 - -# define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 -# define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 -# define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 -# define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 -# define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 - -/* SRP ciphersuites from RFC 5054 */ -# define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A -# define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B -# define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C -# define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D -# define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E -# define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F -# define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 -# define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 -# define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 - -/* ECDH HMAC based ciphersuites from RFC5289 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 -# define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 -# define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A - -/* ECDH GCM based ciphersuites from RFC5289 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 -# define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 -# define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 - -/* ECDHE PSK ciphersuites from RFC5489 */ -# define TLS1_CK_ECDHE_PSK_WITH_RC4_128_SHA 0x0300C033 -# define TLS1_CK_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300C034 -# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035 -# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036 - -# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0x0300C037 -# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0x0300C038 - -/* NULL PSK ciphersuites from RFC4785 */ -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA 0x0300C039 -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA256 0x0300C03A -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA384 0x0300C03B - -/* Camellia-CBC ciphersuites from RFC6367 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C072 -# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C073 -# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C074 -# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C075 -# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C076 -# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C077 -# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C078 -# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C079 - -# define TLS1_CK_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C094 -# define TLS1_CK_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C095 -# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C096 -# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C097 -# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C098 -# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C099 -# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C09A -# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C09B - -/* draft-ietf-tls-chacha20-poly1305-03 */ -# define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCA8 -# define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0x0300CCA9 -# define TLS1_CK_DHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCAA -# define TLS1_CK_PSK_WITH_CHACHA20_POLY1305 0x0300CCAB -# define TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAC -# define TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAD -# define TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305 0x0300CCAE - -/* TLS v1.3 ciphersuites */ -# define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301 -# define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302 -# define TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x03001303 -# define TLS1_3_CK_AES_128_CCM_SHA256 0x03001304 -# define TLS1_3_CK_AES_128_CCM_8_SHA256 0x03001305 - -/* Aria ciphersuites from RFC6209 */ -# define TLS1_CK_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C050 -# define TLS1_CK_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C051 -# define TLS1_CK_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C052 -# define TLS1_CK_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C053 -# define TLS1_CK_DH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C054 -# define TLS1_CK_DH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C055 -# define TLS1_CK_DHE_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C056 -# define TLS1_CK_DHE_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C057 -# define TLS1_CK_DH_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C058 -# define TLS1_CK_DH_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C059 -# define TLS1_CK_DH_anon_WITH_ARIA_128_GCM_SHA256 0x0300C05A -# define TLS1_CK_DH_anon_WITH_ARIA_256_GCM_SHA384 0x0300C05B -# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05C -# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05D -# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05E -# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05F -# define TLS1_CK_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C060 -# define TLS1_CK_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C061 -# define TLS1_CK_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C062 -# define TLS1_CK_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C063 -# define TLS1_CK_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06A -# define TLS1_CK_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06B -# define TLS1_CK_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06C -# define TLS1_CK_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06D -# define TLS1_CK_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06E -# define TLS1_CK_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06F - -/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ -# define TLS1_RFC_RSA_WITH_AES_128_SHA "TLS_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ADH_WITH_AES_128_SHA "TLS_DH_anon_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_RSA_WITH_AES_256_SHA "TLS_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ADH_WITH_AES_256_SHA "TLS_DH_anon_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_RSA_WITH_NULL_SHA256 "TLS_RSA_WITH_NULL_SHA256" -# define TLS1_RFC_RSA_WITH_AES_128_SHA256 "TLS_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_AES_256_SHA256 "TLS_RSA_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA256 "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA256 "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA256 "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA256 "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_AES_128_SHA256 "TLS_DH_anon_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_AES_256_SHA256 "TLS_DH_anon_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_AES_128_GCM_SHA256 "TLS_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_RSA_WITH_AES_256_GCM_SHA384 "TLS_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_GCM_SHA256 "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_GCM_SHA384 "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_ADH_WITH_AES_128_GCM_SHA256 "TLS_DH_anon_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ADH_WITH_AES_256_GCM_SHA384 "TLS_DH_anon_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_RSA_WITH_AES_128_CCM "TLS_RSA_WITH_AES_128_CCM" -# define TLS1_RFC_RSA_WITH_AES_256_CCM "TLS_RSA_WITH_AES_256_CCM" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM "TLS_DHE_RSA_WITH_AES_128_CCM" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM "TLS_DHE_RSA_WITH_AES_256_CCM" -# define TLS1_RFC_RSA_WITH_AES_128_CCM_8 "TLS_RSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_RSA_WITH_AES_256_CCM_8 "TLS_RSA_WITH_AES_256_CCM_8" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM_8 "TLS_DHE_RSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM_8 "TLS_DHE_RSA_WITH_AES_256_CCM_8" -# define TLS1_RFC_PSK_WITH_AES_128_CCM "TLS_PSK_WITH_AES_128_CCM" -# define TLS1_RFC_PSK_WITH_AES_256_CCM "TLS_PSK_WITH_AES_256_CCM" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM "TLS_DHE_PSK_WITH_AES_128_CCM" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM "TLS_DHE_PSK_WITH_AES_256_CCM" -# define TLS1_RFC_PSK_WITH_AES_128_CCM_8 "TLS_PSK_WITH_AES_128_CCM_8" -# define TLS1_RFC_PSK_WITH_AES_256_CCM_8 "TLS_PSK_WITH_AES_256_CCM_8" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM_8 "TLS_PSK_DHE_WITH_AES_128_CCM_8" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM_8 "TLS_PSK_DHE_WITH_AES_256_CCM_8" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM "TLS_ECDHE_ECDSA_WITH_AES_128_CCM" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM "TLS_ECDHE_ECDSA_WITH_AES_256_CCM" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8" -# define TLS1_3_RFC_AES_128_GCM_SHA256 "TLS_AES_128_GCM_SHA256" -# define TLS1_3_RFC_AES_256_GCM_SHA384 "TLS_AES_256_GCM_SHA384" -# define TLS1_3_RFC_CHACHA20_POLY1305_SHA256 "TLS_CHACHA20_POLY1305_SHA256" -# define TLS1_3_RFC_AES_128_CCM_SHA256 "TLS_AES_128_CCM_SHA256" -# define TLS1_3_RFC_AES_128_CCM_8_SHA256 "TLS_AES_128_CCM_8_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_NULL_SHA "TLS_ECDHE_ECDSA_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_NULL_SHA "TLS_ECDHE_RSA_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_NULL_SHA "TLS_ECDH_anon_WITH_NULL_SHA" -# define TLS1_RFC_ECDH_anon_WITH_DES_192_CBC3_SHA "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_AES_128_CBC_SHA "TLS_ECDH_anon_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_AES_256_CBC_SHA "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_NULL_SHA "TLS_PSK_WITH_NULL_SHA" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA "TLS_DHE_PSK_WITH_NULL_SHA" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA "TLS_RSA_PSK_WITH_NULL_SHA" -# define TLS1_RFC_PSK_WITH_3DES_EDE_CBC_SHA "TLS_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA "TLS_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA "TLS_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA "TLS_DHE_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA "TLS_DHE_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_3DES_EDE_CBC_SHA "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA "TLS_RSA_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA "TLS_RSA_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_128_GCM_SHA256 "TLS_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_PSK_WITH_AES_256_GCM_SHA384 "TLS_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_GCM_SHA256 "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_GCM_SHA384 "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_GCM_SHA256 "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_GCM_SHA384 "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA256 "TLS_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA384 "TLS_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_PSK_WITH_NULL_SHA256 "TLS_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_PSK_WITH_NULL_SHA384 "TLS_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA256 "TLS_DHE_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA384 "TLS_DHE_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA256 "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA384 "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA256 "TLS_RSA_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA384 "TLS_RSA_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA "TLS_ECDHE_PSK_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA256 "TLS_ECDHE_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA384 "TLS_ECDHE_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_SRP_SHA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CHACHA20_POLY1305 "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_PSK_WITH_CHACHA20_POLY1305 "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_CHACHA20_POLY1305 "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_CHACHA20_POLY1305 "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_CHACHA20_POLY1305 "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_RSA_WITH_SEED_SHA "TLS_RSA_WITH_SEED_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_SEED_SHA "TLS_DHE_DSS_WITH_SEED_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_SEED_SHA "TLS_DHE_RSA_WITH_SEED_CBC_SHA" -# define TLS1_RFC_ADH_WITH_SEED_SHA "TLS_DH_anon_WITH_SEED_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_RC4_128_SHA "TLS_ECDHE_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDH_anon_WITH_RC4_128_SHA "TLS_ECDH_anon_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_RC4_128_SHA "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_RC4_128_SHA "TLS_ECDHE_RSA_WITH_RC4_128_SHA" -# define TLS1_RFC_PSK_WITH_RC4_128_SHA "TLS_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_RSA_PSK_WITH_RC4_128_SHA "TLS_RSA_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_DHE_PSK_WITH_RC4_128_SHA "TLS_DHE_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_anon_WITH_ARIA_128_GCM_SHA256 "TLS_DH_anon_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_anon_WITH_ARIA_256_GCM_SHA384 "TLS_DH_anon_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_PSK_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384" - - -/* - * XXX Backward compatibility alert: Older versions of OpenSSL gave some DHE - * ciphers names with "EDH" instead of "DHE". Going forward, we should be - * using DHE everywhere, though we may indefinitely maintain aliases for - * users or configurations that used "EDH" - */ -# define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" - -# define TLS1_TXT_PSK_WITH_NULL_SHA "PSK-NULL-SHA" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA "DHE-PSK-NULL-SHA" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA "RSA-PSK-NULL-SHA" - -/* AES ciphersuites from RFC3268 */ -# define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" -# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" -# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" -# define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" - -# define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" -# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" -# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" -# define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" - -/* ECC ciphersuites from RFC4492 */ -# define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" - -# define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" - -# define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" - -# define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" - -# define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" -# define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" -# define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" -# define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" - -/* PSK ciphersuites from RFC 4279 */ -# define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" -# define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" -# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" - -# define TLS1_TXT_DHE_PSK_WITH_RC4_128_SHA "DHE-PSK-RC4-SHA" -# define TLS1_TXT_DHE_PSK_WITH_3DES_EDE_CBC_SHA "DHE-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA "DHE-PSK-AES128-CBC-SHA" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA "DHE-PSK-AES256-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_RC4_128_SHA "RSA-PSK-RC4-SHA" -# define TLS1_TXT_RSA_PSK_WITH_3DES_EDE_CBC_SHA "RSA-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA "RSA-PSK-AES128-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA "RSA-PSK-AES256-CBC-SHA" - -/* PSK ciphersuites from RFC 5487 */ -# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_GCM_SHA256 "DHE-PSK-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_GCM_SHA384 "DHE-PSK-AES256-GCM-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_AES_128_GCM_SHA256 "RSA-PSK-AES128-GCM-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_GCM_SHA384 "RSA-PSK-AES256-GCM-SHA384" - -# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA256 "PSK-AES128-CBC-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA384 "PSK-AES256-CBC-SHA384" -# define TLS1_TXT_PSK_WITH_NULL_SHA256 "PSK-NULL-SHA256" -# define TLS1_TXT_PSK_WITH_NULL_SHA384 "PSK-NULL-SHA384" - -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA256 "DHE-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA384 "DHE-PSK-AES256-CBC-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA256 "DHE-PSK-NULL-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA384 "DHE-PSK-NULL-SHA384" - -# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA256 "RSA-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA384 "RSA-PSK-AES256-CBC-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA256 "RSA-PSK-NULL-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA384 "RSA-PSK-NULL-SHA384" - -/* SRP ciphersuite from RFC 5054 */ -# define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" -# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" - -# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" -# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" - -/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ -# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256 "CAMELLIA128-SHA256" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DH-DSS-CAMELLIA128-SHA256" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DH-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DHE-DSS-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DHE-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256 "ADH-CAMELLIA128-SHA256" - -# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256 "CAMELLIA256-SHA256" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DH-DSS-CAMELLIA256-SHA256" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DH-RSA-CAMELLIA256-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DHE-DSS-CAMELLIA256-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DHE-RSA-CAMELLIA256-SHA256" -# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256 "ADH-CAMELLIA256-SHA256" - -# define TLS1_TXT_PSK_WITH_CAMELLIA_128_CBC_SHA256 "PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_PSK_WITH_CAMELLIA_256_CBC_SHA384 "PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "DHE-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "DHE-PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "RSA-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "RSA-PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-PSK-CAMELLIA256-SHA384" - -/* SEED ciphersuites from RFC4162 */ -# define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" -# define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" -# define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" -# define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" -# define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" -# define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" - -/* TLS v1.2 ciphersuites */ -# define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" -# define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" -# define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" -# define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" -# define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" - -/* TLS v1.2 GCM ciphersuites from RFC5288 */ -# define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" -# define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" -# define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" -# define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" -# define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" - -/* CCM ciphersuites from RFC6655 */ -# define TLS1_TXT_RSA_WITH_AES_128_CCM "AES128-CCM" -# define TLS1_TXT_RSA_WITH_AES_256_CCM "AES256-CCM" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM "DHE-RSA-AES128-CCM" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM "DHE-RSA-AES256-CCM" - -# define TLS1_TXT_RSA_WITH_AES_128_CCM_8 "AES128-CCM8" -# define TLS1_TXT_RSA_WITH_AES_256_CCM_8 "AES256-CCM8" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM_8 "DHE-RSA-AES128-CCM8" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM_8 "DHE-RSA-AES256-CCM8" - -# define TLS1_TXT_PSK_WITH_AES_128_CCM "PSK-AES128-CCM" -# define TLS1_TXT_PSK_WITH_AES_256_CCM "PSK-AES256-CCM" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM "DHE-PSK-AES128-CCM" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM "DHE-PSK-AES256-CCM" - -# define TLS1_TXT_PSK_WITH_AES_128_CCM_8 "PSK-AES128-CCM8" -# define TLS1_TXT_PSK_WITH_AES_256_CCM_8 "PSK-AES256-CCM8" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM_8 "DHE-PSK-AES128-CCM8" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM_8 "DHE-PSK-AES256-CCM8" - -/* CCM ciphersuites from RFC7251 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM "ECDHE-ECDSA-AES128-CCM" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM "ECDHE-ECDSA-AES256-CCM" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM_8 "ECDHE-ECDSA-AES128-CCM8" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8 "ECDHE-ECDSA-AES256-CCM8" - -/* ECDH HMAC based ciphersuites from RFC5289 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" - -/* ECDH GCM based ciphersuites from RFC5289 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" - -/* TLS v1.2 PSK GCM ciphersuites from RFC5487 */ -# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" - -/* ECDHE PSK ciphersuites from RFC 5489 */ -# define TLS1_TXT_ECDHE_PSK_WITH_RC4_128_SHA "ECDHE-PSK-RC4-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "ECDHE-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA "ECDHE-PSK-AES256-CBC-SHA" - -# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "ECDHE-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "ECDHE-PSK-AES256-CBC-SHA384" - -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA "ECDHE-PSK-NULL-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA256 "ECDHE-PSK-NULL-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA384 "ECDHE-PSK-NULL-SHA384" - -/* Camellia-CBC ciphersuites from RFC6367 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-ECDSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-ECDSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-ECDSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-ECDSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-RSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-RSA-CAMELLIA256-SHA384" - -/* draft-ietf-tls-chacha20-poly1305-03 */ -# define TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305 "ECDHE-RSA-CHACHA20-POLY1305" -# define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305" -# define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" -# define TLS1_TXT_PSK_WITH_CHACHA20_POLY1305 "PSK-CHACHA20-POLY1305" -# define TLS1_TXT_ECDHE_PSK_WITH_CHACHA20_POLY1305 "ECDHE-PSK-CHACHA20-POLY1305" -# define TLS1_TXT_DHE_PSK_WITH_CHACHA20_POLY1305 "DHE-PSK-CHACHA20-POLY1305" -# define TLS1_TXT_RSA_PSK_WITH_CHACHA20_POLY1305 "RSA-PSK-CHACHA20-POLY1305" - -/* Aria ciphersuites from RFC6209 */ -# define TLS1_TXT_RSA_WITH_ARIA_128_GCM_SHA256 "ARIA128-GCM-SHA256" -# define TLS1_TXT_RSA_WITH_ARIA_256_GCM_SHA384 "ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "DHE-RSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "DHE-RSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_RSA_WITH_ARIA_128_GCM_SHA256 "DH-RSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_RSA_WITH_ARIA_256_GCM_SHA384 "DH-RSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "DHE-DSS-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "DHE-DSS-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_DSS_WITH_ARIA_128_GCM_SHA256 "DH-DSS-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_DSS_WITH_ARIA_256_GCM_SHA384 "DH-DSS-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_anon_WITH_ARIA_128_GCM_SHA256 "ADH-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_anon_WITH_ARIA_256_GCM_SHA384 "ADH-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ECDSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ECDSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ECDSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ECDSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ARIA256-GCM-SHA384" -# define TLS1_TXT_PSK_WITH_ARIA_128_GCM_SHA256 "PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_ARIA_256_GCM_SHA384 "PSK-ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "DHE-PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "DHE-PSK-ARIA256-GCM-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "RSA-PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "RSA-PSK-ARIA256-GCM-SHA384" - -# define TLS_CT_RSA_SIGN 1 -# define TLS_CT_DSS_SIGN 2 -# define TLS_CT_RSA_FIXED_DH 3 -# define TLS_CT_DSS_FIXED_DH 4 -# define TLS_CT_ECDSA_SIGN 64 -# define TLS_CT_RSA_FIXED_ECDH 65 -# define TLS_CT_ECDSA_FIXED_ECDH 66 -# define TLS_CT_GOST01_SIGN 22 -# define TLS_CT_GOST12_SIGN 238 -# define TLS_CT_GOST12_512_SIGN 239 - -/* - * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see - * comment there) - */ -# define TLS_CT_NUMBER 10 - -# if defined(SSL3_CT_NUMBER) -# if TLS_CT_NUMBER != SSL3_CT_NUMBER -# error "SSL/TLS CT_NUMBER values do not match" -# endif -# endif - -# define TLS1_FINISH_MAC_LENGTH 12 - -# define TLS_MD_MAX_CONST_SIZE 22 -# define TLS_MD_CLIENT_FINISH_CONST "client finished" -# define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 -# define TLS_MD_SERVER_FINISH_CONST "server finished" -# define TLS_MD_SERVER_FINISH_CONST_SIZE 15 -# define TLS_MD_KEY_EXPANSION_CONST "key expansion" -# define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 -# define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" -# define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 -# define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" -# define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 -# define TLS_MD_IV_BLOCK_CONST "IV block" -# define TLS_MD_IV_BLOCK_CONST_SIZE 8 -# define TLS_MD_MASTER_SECRET_CONST "master secret" -# define TLS_MD_MASTER_SECRET_CONST_SIZE 13 -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "extended master secret" -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE 22 - -# ifdef CHARSET_EBCDIC -# undef TLS_MD_CLIENT_FINISH_CONST -/* - * client finished - */ -# define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" - -# undef TLS_MD_SERVER_FINISH_CONST -/* - * server finished - */ -# define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" - -# undef TLS_MD_SERVER_WRITE_KEY_CONST -/* - * server write key - */ -# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_KEY_EXPANSION_CONST -/* - * key expansion - */ -# define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" - -# undef TLS_MD_CLIENT_WRITE_KEY_CONST -/* - * client write key - */ -# define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_SERVER_WRITE_KEY_CONST -/* - * server write key - */ -# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_IV_BLOCK_CONST -/* - * IV block - */ -# define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" - -# undef TLS_MD_MASTER_SECRET_CONST -/* - * master secret - */ -# define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" -# undef TLS_MD_EXTENDED_MASTER_SECRET_CONST -/* - * extended master secret - */ -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" -# endif - -/* TLS Session Ticket extension struct */ -struct tls_session_ticket_ext_st { - unsigned short length; - void *data; -}; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ts.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ts.h deleted file mode 100644 index 3b58aa52..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ts.h +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Copyright 2006-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_TS_H -# define HEADER_TS_H - -# include - -# ifndef OPENSSL_NO_TS -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# include -# include - -typedef struct TS_msg_imprint_st TS_MSG_IMPRINT; -typedef struct TS_req_st TS_REQ; -typedef struct TS_accuracy_st TS_ACCURACY; -typedef struct TS_tst_info_st TS_TST_INFO; - -/* Possible values for status. */ -# define TS_STATUS_GRANTED 0 -# define TS_STATUS_GRANTED_WITH_MODS 1 -# define TS_STATUS_REJECTION 2 -# define TS_STATUS_WAITING 3 -# define TS_STATUS_REVOCATION_WARNING 4 -# define TS_STATUS_REVOCATION_NOTIFICATION 5 - -/* Possible values for failure_info. */ -# define TS_INFO_BAD_ALG 0 -# define TS_INFO_BAD_REQUEST 2 -# define TS_INFO_BAD_DATA_FORMAT 5 -# define TS_INFO_TIME_NOT_AVAILABLE 14 -# define TS_INFO_UNACCEPTED_POLICY 15 -# define TS_INFO_UNACCEPTED_EXTENSION 16 -# define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 -# define TS_INFO_SYSTEM_FAILURE 25 - - -typedef struct TS_status_info_st TS_STATUS_INFO; -typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL; -typedef struct ESS_cert_id ESS_CERT_ID; -typedef struct ESS_signing_cert ESS_SIGNING_CERT; - -DEFINE_STACK_OF(ESS_CERT_ID) - -typedef struct ESS_cert_id_v2_st ESS_CERT_ID_V2; -typedef struct ESS_signing_cert_v2_st ESS_SIGNING_CERT_V2; - -DEFINE_STACK_OF(ESS_CERT_ID_V2) - -typedef struct TS_resp_st TS_RESP; - -TS_REQ *TS_REQ_new(void); -void TS_REQ_free(TS_REQ *a); -int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); -TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); - -TS_REQ *TS_REQ_dup(TS_REQ *a); - -#ifndef OPENSSL_NO_STDIO -TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); -int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); -#endif -TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); -int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); - -TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); -void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); -int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, - const unsigned char **pp, long length); - -TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); - -#ifndef OPENSSL_NO_STDIO -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); -int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); -#endif -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a); -int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a); - -TS_RESP *TS_RESP_new(void); -void TS_RESP_free(TS_RESP *a); -int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); -TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); -TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); -TS_RESP *TS_RESP_dup(TS_RESP *a); - -#ifndef OPENSSL_NO_STDIO -TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); -int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); -#endif -TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a); -int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a); - -TS_STATUS_INFO *TS_STATUS_INFO_new(void); -void TS_STATUS_INFO_free(TS_STATUS_INFO *a); -int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); -TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, - const unsigned char **pp, long length); -TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); - -TS_TST_INFO *TS_TST_INFO_new(void); -void TS_TST_INFO_free(TS_TST_INFO *a); -int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); -TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, - long length); -TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); - -#ifndef OPENSSL_NO_STDIO -TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); -int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); -#endif -TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a); -int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a); - -TS_ACCURACY *TS_ACCURACY_new(void); -void TS_ACCURACY_free(TS_ACCURACY *a); -int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); -TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, - long length); -TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); - -ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); -void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); -int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp); -ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, - const unsigned char **pp, - long length); -ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); - -ESS_CERT_ID *ESS_CERT_ID_new(void); -void ESS_CERT_ID_free(ESS_CERT_ID *a); -int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); -ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, - long length); -ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); - -ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); -void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); -int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp); -ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, - const unsigned char **pp, long length); -ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); - -ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new(void); -void ESS_CERT_ID_V2_free(ESS_CERT_ID_V2 *a); -int i2d_ESS_CERT_ID_V2(const ESS_CERT_ID_V2 *a, unsigned char **pp); -ESS_CERT_ID_V2 *d2i_ESS_CERT_ID_V2(ESS_CERT_ID_V2 **a, - const unsigned char **pp, long length); -ESS_CERT_ID_V2 *ESS_CERT_ID_V2_dup(ESS_CERT_ID_V2 *a); - -ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new(void); -void ESS_SIGNING_CERT_V2_free(ESS_SIGNING_CERT_V2 *a); -int i2d_ESS_SIGNING_CERT_V2(const ESS_SIGNING_CERT_V2 *a, unsigned char **pp); -ESS_SIGNING_CERT_V2 *d2i_ESS_SIGNING_CERT_V2(ESS_SIGNING_CERT_V2 **a, - const unsigned char **pp, - long length); -ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_dup(ESS_SIGNING_CERT_V2 *a); - -int TS_REQ_set_version(TS_REQ *a, long version); -long TS_REQ_get_version(const TS_REQ *a); - -int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i); -const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a); - -const STACK_OF(ASN1_UTF8STRING) * -TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a); - -const ASN1_BIT_STRING * -TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a); - -int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); -TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); - -int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); -X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); - -int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); -ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); - -int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy); -ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); - -int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); -const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); - -int TS_REQ_set_cert_req(TS_REQ *a, int cert_req); -int TS_REQ_get_cert_req(const TS_REQ *a); - -STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); -void TS_REQ_ext_free(TS_REQ *a); -int TS_REQ_get_ext_count(TS_REQ *a); -int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); -int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos); -int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); -X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); -X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); -int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); -void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); - -/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ - -int TS_REQ_print_bio(BIO *bio, TS_REQ *a); - -/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ - -int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); -TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); - -/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ -void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); -PKCS7 *TS_RESP_get_token(TS_RESP *a); -TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); - -int TS_TST_INFO_set_version(TS_TST_INFO *a, long version); -long TS_TST_INFO_get_version(const TS_TST_INFO *a); - -int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); -ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); - -int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); -TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); - -int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); -const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); - -int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); -const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); - -int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); -TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); - -int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); -const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); - -int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); -const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); - -int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); -const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); - -int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); -int TS_TST_INFO_get_ordering(const TS_TST_INFO *a); - -int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); -const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); - -int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); -GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); - -STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); -void TS_TST_INFO_ext_free(TS_TST_INFO *a); -int TS_TST_INFO_get_ext_count(TS_TST_INFO *a); -int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); -int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, - int lastpos); -int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); -X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); -X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); -int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); -void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); - -/* - * Declarations related to response generation, defined in ts/ts_resp_sign.c. - */ - -/* Optional flags for response generation. */ - -/* Don't include the TSA name in response. */ -# define TS_TSA_NAME 0x01 - -/* Set ordering to true in response. */ -# define TS_ORDERING 0x02 - -/* - * Include the signer certificate and the other specified certificates in - * the ESS signing certificate attribute beside the PKCS7 signed data. - * Only the signer certificates is included by default. - */ -# define TS_ESS_CERT_ID_CHAIN 0x04 - -/* Forward declaration. */ -struct TS_resp_ctx; - -/* This must return a unique number less than 160 bits long. */ -typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *); - -/* - * This must return the seconds and microseconds since Jan 1, 1970 in the sec - * and usec variables allocated by the caller. Return non-zero for success - * and zero for failure. - */ -typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec, - long *usec); - -/* - * This must process the given extension. It can modify the TS_TST_INFO - * object of the context. Return values: !0 (processed), 0 (error, it must - * set the status info/failure info of the response). - */ -typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *, - void *); - -typedef struct TS_resp_ctx TS_RESP_CTX; - -DEFINE_STACK_OF_CONST(EVP_MD) - -/* Creates a response context that can be used for generating responses. */ -TS_RESP_CTX *TS_RESP_CTX_new(void); -void TS_RESP_CTX_free(TS_RESP_CTX *ctx); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); - -int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx, - const EVP_MD *signer_digest); -int TS_RESP_CTX_set_ess_cert_id_digest(TS_RESP_CTX *ctx, const EVP_MD *md); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy); - -/* No additional certs are included in the response by default. */ -int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); - -/* - * Adds a new acceptable policy, only the default policy is accepted by - * default. - */ -int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy); - -/* - * Adds a new acceptable message digest. Note that no message digests are - * accepted by default. The md argument is shared with the caller. - */ -int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); - -/* Accuracy is not included by default. */ -int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, - int secs, int millis, int micros); - -/* - * Clock precision digits, i.e. the number of decimal digits: '0' means sec, - * '3' msec, '6' usec, and so on. Default is 0. - */ -int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, - unsigned clock_precision_digits); -/* At most we accept usec precision. */ -# define TS_MAX_CLOCK_PRECISION_DIGITS 6 - -/* Maximum status message length */ -# define TS_MAX_STATUS_LENGTH (1024 * 1024) - -/* No flags are set by default. */ -void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); - -/* Default callback always returns a constant. */ -void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); - -/* Default callback uses the gettimeofday() and gmtime() system calls. */ -void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); - -/* - * Default callback rejects all extensions. The extension callback is called - * when the TS_TST_INFO object is already set up and not signed yet. - */ -/* FIXME: extension handling is not tested yet. */ -void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, - TS_extension_cb cb, void *data); - -/* The following methods can be used in the callbacks. */ -int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, - int status, const char *text); - -/* Sets the status info only if it is still TS_STATUS_GRANTED. */ -int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, - int status, const char *text); - -int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); - -/* The get methods below can be used in the extension callback. */ -TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); - -TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); - -/* - * Creates the signed TS_TST_INFO and puts it in TS_RESP. - * In case of errors it sets the status info properly. - * Returns NULL only in case of memory allocation/fatal error. - */ -TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); - -/* - * Declarations related to response verification, - * they are defined in ts/ts_resp_verify.c. - */ - -int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, - X509_STORE *store, X509 **signer_out); - -/* Context structure for the generic verify method. */ - -/* Verify the signer's certificate and the signature of the response. */ -# define TS_VFY_SIGNATURE (1u << 0) -/* Verify the version number of the response. */ -# define TS_VFY_VERSION (1u << 1) -/* Verify if the policy supplied by the user matches the policy of the TSA. */ -# define TS_VFY_POLICY (1u << 2) -/* - * Verify the message imprint provided by the user. This flag should not be - * specified with TS_VFY_DATA. - */ -# define TS_VFY_IMPRINT (1u << 3) -/* - * Verify the message imprint computed by the verify method from the user - * provided data and the MD algorithm of the response. This flag should not - * be specified with TS_VFY_IMPRINT. - */ -# define TS_VFY_DATA (1u << 4) -/* Verify the nonce value. */ -# define TS_VFY_NONCE (1u << 5) -/* Verify if the TSA name field matches the signer certificate. */ -# define TS_VFY_SIGNER (1u << 6) -/* Verify if the TSA name field equals to the user provided name. */ -# define TS_VFY_TSA_NAME (1u << 7) - -/* You can use the following convenience constants. */ -# define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ - | TS_VFY_VERSION \ - | TS_VFY_POLICY \ - | TS_VFY_IMPRINT \ - | TS_VFY_NONCE \ - | TS_VFY_SIGNER \ - | TS_VFY_TSA_NAME) -# define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ - | TS_VFY_VERSION \ - | TS_VFY_POLICY \ - | TS_VFY_DATA \ - | TS_VFY_NONCE \ - | TS_VFY_SIGNER \ - | TS_VFY_TSA_NAME) - -typedef struct TS_verify_ctx TS_VERIFY_CTX; - -int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); -int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); - -/* - * Declarations related to response verification context, - */ -TS_VERIFY_CTX *TS_VERIFY_CTX_new(void); -void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); -void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); -void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); -int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f); -int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f); -BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b); -unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, - unsigned char *hexstr, long len); -X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s); -STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs); - -/*- - * If ctx is NULL, it allocates and returns a new object, otherwise - * it returns ctx. It initialises all the members as follows: - * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) - * certs = NULL - * store = NULL - * policy = policy from the request or NULL if absent (in this case - * TS_VFY_POLICY is cleared from flags as well) - * md_alg = MD algorithm from request - * imprint, imprint_len = imprint from request - * data = NULL - * nonce, nonce_len = nonce from the request or NULL if absent (in this case - * TS_VFY_NONCE is cleared from flags as well) - * tsa_name = NULL - * Important: after calling this method TS_VFY_SIGNATURE should be added! - */ -TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); - -/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ - -int TS_RESP_print_bio(BIO *bio, TS_RESP *a); -int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); -int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); - -/* Common utility functions defined in ts/ts_lib.c */ - -int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); -int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); -int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); -int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); -int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); - -/* - * Function declarations for handling configuration options, defined in - * ts/ts_conf.c - */ - -X509 *TS_CONF_load_cert(const char *file); -STACK_OF(X509) *TS_CONF_load_certs(const char *file); -EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); -const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); -int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, - TS_RESP_CTX *ctx); -#ifndef OPENSSL_NO_ENGINE -int TS_CONF_set_crypto_device(CONF *conf, const char *section, - const char *device); -int TS_CONF_set_default_engine(const char *name); -#endif -int TS_CONF_set_signer_cert(CONF *conf, const char *section, - const char *cert, TS_RESP_CTX *ctx); -int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, - TS_RESP_CTX *ctx); -int TS_CONF_set_signer_key(CONF *conf, const char *section, - const char *key, const char *pass, - TS_RESP_CTX *ctx); -int TS_CONF_set_signer_digest(CONF *conf, const char *section, - const char *md, TS_RESP_CTX *ctx); -int TS_CONF_set_def_policy(CONF *conf, const char *section, - const char *policy, TS_RESP_CTX *ctx); -int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, - TS_RESP_CTX *ctx); -int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, - TS_RESP_CTX *ctx); -int TS_CONF_set_ess_cert_id_digest(CONF *conf, const char *section, - TS_RESP_CTX *ctx); - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/tserr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/tserr.h deleted file mode 100644 index 07f23339..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/tserr.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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_TSERR_H -# define HEADER_TSERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# include - -# ifndef OPENSSL_NO_TS - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_TS_strings(void); - -/* - * TS function codes. - */ -# define TS_F_DEF_SERIAL_CB 110 -# define TS_F_DEF_TIME_CB 111 -# define TS_F_ESS_ADD_SIGNING_CERT 112 -# define TS_F_ESS_ADD_SIGNING_CERT_V2 147 -# define TS_F_ESS_CERT_ID_NEW_INIT 113 -# define TS_F_ESS_CERT_ID_V2_NEW_INIT 156 -# define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 -# define TS_F_ESS_SIGNING_CERT_V2_NEW_INIT 157 -# define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 -# define TS_F_PKCS7_TO_TS_TST_INFO 148 -# define TS_F_TS_ACCURACY_SET_MICROS 115 -# define TS_F_TS_ACCURACY_SET_MILLIS 116 -# define TS_F_TS_ACCURACY_SET_SECONDS 117 -# define TS_F_TS_CHECK_IMPRINTS 100 -# define TS_F_TS_CHECK_NONCES 101 -# define TS_F_TS_CHECK_POLICY 102 -# define TS_F_TS_CHECK_SIGNING_CERTS 103 -# define TS_F_TS_CHECK_STATUS_INFO 104 -# define TS_F_TS_COMPUTE_IMPRINT 145 -# define TS_F_TS_CONF_INVALID 151 -# define TS_F_TS_CONF_LOAD_CERT 153 -# define TS_F_TS_CONF_LOAD_CERTS 154 -# define TS_F_TS_CONF_LOAD_KEY 155 -# define TS_F_TS_CONF_LOOKUP_FAIL 152 -# define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 -# define TS_F_TS_GET_STATUS_TEXT 105 -# define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 -# define TS_F_TS_REQ_SET_MSG_IMPRINT 119 -# define TS_F_TS_REQ_SET_NONCE 120 -# define TS_F_TS_REQ_SET_POLICY_ID 121 -# define TS_F_TS_RESP_CREATE_RESPONSE 122 -# define TS_F_TS_RESP_CREATE_TST_INFO 123 -# define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 -# define TS_F_TS_RESP_CTX_ADD_MD 125 -# define TS_F_TS_RESP_CTX_ADD_POLICY 126 -# define TS_F_TS_RESP_CTX_NEW 127 -# define TS_F_TS_RESP_CTX_SET_ACCURACY 128 -# define TS_F_TS_RESP_CTX_SET_CERTS 129 -# define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 -# define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 -# define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 -# define TS_F_TS_RESP_GET_POLICY 133 -# define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 -# define TS_F_TS_RESP_SET_STATUS_INFO 135 -# define TS_F_TS_RESP_SET_TST_INFO 150 -# define TS_F_TS_RESP_SIGN 136 -# define TS_F_TS_RESP_VERIFY_SIGNATURE 106 -# define TS_F_TS_TST_INFO_SET_ACCURACY 137 -# define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 -# define TS_F_TS_TST_INFO_SET_NONCE 139 -# define TS_F_TS_TST_INFO_SET_POLICY_ID 140 -# define TS_F_TS_TST_INFO_SET_SERIAL 141 -# define TS_F_TS_TST_INFO_SET_TIME 142 -# define TS_F_TS_TST_INFO_SET_TSA 143 -# define TS_F_TS_VERIFY 108 -# define TS_F_TS_VERIFY_CERT 109 -# define TS_F_TS_VERIFY_CTX_NEW 144 - -/* - * TS reason codes. - */ -# define TS_R_BAD_PKCS7_TYPE 132 -# define TS_R_BAD_TYPE 133 -# define TS_R_CANNOT_LOAD_CERT 137 -# define TS_R_CANNOT_LOAD_KEY 138 -# define TS_R_CERTIFICATE_VERIFY_ERROR 100 -# define TS_R_COULD_NOT_SET_ENGINE 127 -# define TS_R_COULD_NOT_SET_TIME 115 -# define TS_R_DETACHED_CONTENT 134 -# define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 -# define TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR 139 -# define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 -# define TS_R_INVALID_NULL_POINTER 102 -# define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 -# define TS_R_MESSAGE_IMPRINT_MISMATCH 103 -# define TS_R_NONCE_MISMATCH 104 -# define TS_R_NONCE_NOT_RETURNED 105 -# define TS_R_NO_CONTENT 106 -# define TS_R_NO_TIME_STAMP_TOKEN 107 -# define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 -# define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 -# define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 -# define TS_R_POLICY_MISMATCH 108 -# define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 -# define TS_R_RESPONSE_SETUP_ERROR 121 -# define TS_R_SIGNATURE_FAILURE 109 -# define TS_R_THERE_MUST_BE_ONE_SIGNER 110 -# define TS_R_TIME_SYSCALL_ERROR 122 -# define TS_R_TOKEN_NOT_PRESENT 130 -# define TS_R_TOKEN_PRESENT 131 -# define TS_R_TSA_NAME_MISMATCH 111 -# define TS_R_TSA_UNTRUSTED 112 -# define TS_R_TST_INFO_SETUP_ERROR 123 -# define TS_R_TS_DATASIGN 124 -# define TS_R_UNACCEPTABLE_POLICY 125 -# define TS_R_UNSUPPORTED_MD_ALGORITHM 126 -# define TS_R_UNSUPPORTED_VERSION 113 -# define TS_R_VAR_BAD_VALUE 135 -# define TS_R_VAR_LOOKUP_FAILURE 136 -# define TS_R_WRONG_CONTENT_TYPE 114 - -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/txt_db.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/txt_db.h deleted file mode 100644 index ec981a43..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/txt_db.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 1995-2017 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_TXT_DB_H -# define HEADER_TXT_DB_H - -# include -# include -# include -# include - -# define DB_ERROR_OK 0 -# define DB_ERROR_MALLOC 1 -# define DB_ERROR_INDEX_CLASH 2 -# define DB_ERROR_INDEX_OUT_OF_RANGE 3 -# define DB_ERROR_NO_INDEX 4 -# define DB_ERROR_INSERT_INDEX_CLASH 5 -# define DB_ERROR_WRONG_NUM_FIELDS 6 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef OPENSSL_STRING *OPENSSL_PSTRING; -DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) - -typedef struct txt_db_st { - int num_fields; - STACK_OF(OPENSSL_PSTRING) *data; - LHASH_OF(OPENSSL_STRING) **index; - int (**qual) (OPENSSL_STRING *); - long error; - long arg1; - long arg2; - OPENSSL_STRING *arg_row; -} TXT_DB; - -TXT_DB *TXT_DB_read(BIO *in, int num); -long TXT_DB_write(BIO *out, TXT_DB *db); -int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), - OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); -void TXT_DB_free(TXT_DB *db); -OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, - OPENSSL_STRING *value); -int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ui.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ui.h deleted file mode 100644 index 7c721ec8..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/ui.h +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright 2001-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_UI_H -# define HEADER_UI_H - -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# include -# include -# include - -/* For compatibility reasons, the macro OPENSSL_NO_UI is currently retained */ -# if OPENSSL_API_COMPAT < 0x10200000L -# ifdef OPENSSL_NO_UI_CONSOLE -# define OPENSSL_NO_UI -# endif -# endif - -# ifdef __cplusplus -extern "C" { -# endif - -/* - * All the following functions return -1 or NULL on error and in some cases - * (UI_process()) -2 if interrupted or in some other way cancelled. When - * everything is fine, they return 0, a positive value or a non-NULL pointer, - * all depending on their purpose. - */ - -/* Creators and destructor. */ -UI *UI_new(void); -UI *UI_new_method(const UI_METHOD *method); -void UI_free(UI *ui); - -/*- - The following functions are used to add strings to be printed and prompt - strings to prompt for data. The names are UI_{add,dup}__string - and UI_{add,dup}_input_boolean. - - UI_{add,dup}__string have the following meanings: - add add a text or prompt string. The pointers given to these - functions are used verbatim, no copying is done. - dup make a copy of the text or prompt string, then add the copy - to the collection of strings in the user interface. - - The function is a name for the functionality that the given - string shall be used for. It can be one of: - input use the string as data prompt. - verify use the string as verification prompt. This - is used to verify a previous input. - info use the string for informational output. - error use the string for error output. - Honestly, there's currently no difference between info and error for the - moment. - - UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", - and are typically used when one wants to prompt for a yes/no response. - - All of the functions in this group take a UI and a prompt string. - The string input and verify addition functions also take a flag argument, - a buffer for the result to end up with, a minimum input size and a maximum - input size (the result buffer MUST be large enough to be able to contain - the maximum number of characters). Additionally, the verify addition - functions takes another buffer to compare the result against. - The boolean input functions take an action description string (which should - be safe to ignore if the expected user action is obvious, for example with - a dialog box with an OK button and a Cancel button), a string of acceptable - characters to mean OK and to mean Cancel. The two last strings are checked - to make sure they don't have common characters. Additionally, the same - flag argument as for the string input is taken, as well as a result buffer. - The result buffer is required to be at least one byte long. Depending on - the answer, the first character from the OK or the Cancel character strings - will be stored in the first byte of the result buffer. No NUL will be - added, so the result is *not* a string. - - On success, the all return an index of the added information. That index - is useful when retrieving results with UI_get0_result(). */ -int UI_add_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); -int UI_dup_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); -int UI_add_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, - const char *test_buf); -int UI_dup_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, - const char *test_buf); -int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); -int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); -int UI_add_info_string(UI *ui, const char *text); -int UI_dup_info_string(UI *ui, const char *text); -int UI_add_error_string(UI *ui, const char *text); -int UI_dup_error_string(UI *ui, const char *text); - -/* These are the possible flags. They can be or'ed together. */ -/* Use to have echoing of input */ -# define UI_INPUT_FLAG_ECHO 0x01 -/* - * Use a default password. Where that password is found is completely up to - * the application, it might for example be in the user data set with - * UI_add_user_data(). It is not recommended to have more than one input in - * each UI being marked with this flag, or the application might get - * confused. - */ -# define UI_INPUT_FLAG_DEFAULT_PWD 0x02 - -/*- - * The user of these routines may want to define flags of their own. The core - * UI won't look at those, but will pass them on to the method routines. They - * must use higher bits so they don't get confused with the UI bits above. - * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good - * example of use is this: - * - * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) - * -*/ -# define UI_INPUT_FLAG_USER_BASE 16 - -/*- - * The following function helps construct a prompt. object_desc is a - * textual short description of the object, for example "pass phrase", - * and object_name is the name of the object (might be a card name or - * a file name. - * The returned string shall always be allocated on the heap with - * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). - * - * If the ui_method doesn't contain a pointer to a user-defined prompt - * constructor, a default string is built, looking like this: - * - * "Enter {object_desc} for {object_name}:" - * - * So, if object_desc has the value "pass phrase" and object_name has - * the value "foo.key", the resulting string is: - * - * "Enter pass phrase for foo.key:" -*/ -char *UI_construct_prompt(UI *ui_method, - const char *object_desc, const char *object_name); - -/* - * The following function is used to store a pointer to user-specific data. - * Any previous such pointer will be returned and replaced. - * - * For callback purposes, this function makes a lot more sense than using - * ex_data, since the latter requires that different parts of OpenSSL or - * applications share the same ex_data index. - * - * Note that the UI_OpenSSL() method completely ignores the user data. Other - * methods may not, however. - */ -void *UI_add_user_data(UI *ui, void *user_data); -/* - * Alternatively, this function is used to duplicate the user data. - * This uses the duplicator method function. The destroy function will - * be used to free the user data in this case. - */ -int UI_dup_user_data(UI *ui, void *user_data); -/* We need a user data retrieving function as well. */ -void *UI_get0_user_data(UI *ui); - -/* Return the result associated with a prompt given with the index i. */ -const char *UI_get0_result(UI *ui, int i); -int UI_get_result_length(UI *ui, int i); - -/* When all strings have been added, process the whole thing. */ -int UI_process(UI *ui); - -/* - * Give a user interface parameterised control commands. This can be used to - * send down an integer, a data pointer or a function pointer, as well as be - * used to get information from a UI. - */ -int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void)); - -/* The commands */ -/* - * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the - * OpenSSL error stack before printing any info or added error messages and - * before any prompting. - */ -# define UI_CTRL_PRINT_ERRORS 1 -/* - * Check if a UI_process() is possible to do again with the same instance of - * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 - * if not. - */ -# define UI_CTRL_IS_REDOABLE 2 - -/* Some methods may use extra data */ -# define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) -# define UI_get_app_data(s) UI_get_ex_data(s,0) - -# define UI_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef) -int UI_set_ex_data(UI *r, int idx, void *arg); -void *UI_get_ex_data(UI *r, int idx); - -/* Use specific methods instead of the built-in one */ -void UI_set_default_method(const UI_METHOD *meth); -const UI_METHOD *UI_get_default_method(void); -const UI_METHOD *UI_get_method(UI *ui); -const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); - -# ifndef OPENSSL_NO_UI_CONSOLE - -/* The method with all the built-in thingies */ -UI_METHOD *UI_OpenSSL(void); - -# endif - -/* - * NULL method. Literally does nothing, but may serve as a placeholder - * to avoid internal default. - */ -const UI_METHOD *UI_null(void); - -/* ---------- For method writers ---------- */ -/*- - A method contains a number of functions that implement the low level - of the User Interface. The functions are: - - an opener This function starts a session, maybe by opening - a channel to a tty, or by opening a window. - a writer This function is called to write a given string, - maybe to the tty, maybe as a field label in a - window. - a flusher This function is called to flush everything that - has been output so far. It can be used to actually - display a dialog box after it has been built. - a reader This function is called to read a given prompt, - maybe from the tty, maybe from a field in a - window. Note that it's called with all string - structures, not only the prompt ones, so it must - check such things itself. - a closer This function closes the session, maybe by closing - the channel to the tty, or closing the window. - - All these functions are expected to return: - - 0 on error. - 1 on success. - -1 on out-of-band events, for example if some prompting has - been canceled (by pressing Ctrl-C, for example). This is - only checked when returned by the flusher or the reader. - - The way this is used, the opener is first called, then the writer for all - strings, then the flusher, then the reader for all strings and finally the - closer. Note that if you want to prompt from a terminal or other command - line interface, the best is to have the reader also write the prompts - instead of having the writer do it. If you want to prompt from a dialog - box, the writer can be used to build up the contents of the box, and the - flusher to actually display the box and run the event loop until all data - has been given, after which the reader only grabs the given data and puts - them back into the UI strings. - - All method functions take a UI as argument. Additionally, the writer and - the reader take a UI_STRING. -*/ - -/* - * The UI_STRING type is the data structure that contains all the needed info - * about a string or a prompt, including test data for a verification prompt. - */ -typedef struct ui_string_st UI_STRING; -DEFINE_STACK_OF(UI_STRING) - -/* - * The different types of strings that are currently supported. This is only - * needed by method authors. - */ -enum UI_string_types { - UIT_NONE = 0, - UIT_PROMPT, /* Prompt for a string */ - UIT_VERIFY, /* Prompt for a string and verify */ - UIT_BOOLEAN, /* Prompt for a yes/no response */ - UIT_INFO, /* Send info to the user */ - UIT_ERROR /* Send an error message to the user */ -}; - -/* Create and manipulate methods */ -UI_METHOD *UI_create_method(const char *name); -void UI_destroy_method(UI_METHOD *ui_method); -int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui)); -int UI_method_set_writer(UI_METHOD *method, - int (*writer) (UI *ui, UI_STRING *uis)); -int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui)); -int UI_method_set_reader(UI_METHOD *method, - int (*reader) (UI *ui, UI_STRING *uis)); -int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui)); -int UI_method_set_data_duplicator(UI_METHOD *method, - void *(*duplicator) (UI *ui, void *ui_data), - void (*destructor)(UI *ui, void *ui_data)); -int UI_method_set_prompt_constructor(UI_METHOD *method, - char *(*prompt_constructor) (UI *ui, - const char - *object_desc, - const char - *object_name)); -int UI_method_set_ex_data(UI_METHOD *method, int idx, void *data); -int (*UI_method_get_opener(const UI_METHOD *method)) (UI *); -int (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *); -int (*UI_method_get_flusher(const UI_METHOD *method)) (UI *); -int (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *); -int (*UI_method_get_closer(const UI_METHOD *method)) (UI *); -char *(*UI_method_get_prompt_constructor(const UI_METHOD *method)) - (UI *, const char *, const char *); -void *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *); -void (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *); -const void *UI_method_get_ex_data(const UI_METHOD *method, int idx); - -/* - * The following functions are helpers for method writers to access relevant - * data from a UI_STRING. - */ - -/* Return type of the UI_STRING */ -enum UI_string_types UI_get_string_type(UI_STRING *uis); -/* Return input flags of the UI_STRING */ -int UI_get_input_flags(UI_STRING *uis); -/* Return the actual string to output (the prompt, info or error) */ -const char *UI_get0_output_string(UI_STRING *uis); -/* - * Return the optional action string to output (the boolean prompt - * instruction) - */ -const char *UI_get0_action_string(UI_STRING *uis); -/* Return the result of a prompt */ -const char *UI_get0_result_string(UI_STRING *uis); -int UI_get_result_string_length(UI_STRING *uis); -/* - * Return the string to test the result against. Only useful with verifies. - */ -const char *UI_get0_test_string(UI_STRING *uis); -/* Return the required minimum size of the result */ -int UI_get_result_minsize(UI_STRING *uis); -/* Return the required maximum size of the result */ -int UI_get_result_maxsize(UI_STRING *uis); -/* Set the result of a UI_STRING. */ -int UI_set_result(UI *ui, UI_STRING *uis, const char *result); -int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len); - -/* A couple of popular utility functions */ -int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, - int verify); -int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, - int verify); -UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/uierr.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/uierr.h deleted file mode 100644 index bd68864d..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/uierr.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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_UIERR_H -# define HEADER_UIERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_UI_strings(void); - -/* - * UI function codes. - */ -# define UI_F_CLOSE_CONSOLE 115 -# define UI_F_ECHO_CONSOLE 116 -# define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 -# define UI_F_GENERAL_ALLOCATE_PROMPT 109 -# define UI_F_NOECHO_CONSOLE 117 -# define UI_F_OPEN_CONSOLE 114 -# define UI_F_UI_CONSTRUCT_PROMPT 121 -# define UI_F_UI_CREATE_METHOD 112 -# define UI_F_UI_CTRL 111 -# define UI_F_UI_DUP_ERROR_STRING 101 -# define UI_F_UI_DUP_INFO_STRING 102 -# define UI_F_UI_DUP_INPUT_BOOLEAN 110 -# define UI_F_UI_DUP_INPUT_STRING 103 -# define UI_F_UI_DUP_USER_DATA 118 -# define UI_F_UI_DUP_VERIFY_STRING 106 -# define UI_F_UI_GET0_RESULT 107 -# define UI_F_UI_GET_RESULT_LENGTH 119 -# define UI_F_UI_NEW_METHOD 104 -# define UI_F_UI_PROCESS 113 -# define UI_F_UI_SET_RESULT 105 -# define UI_F_UI_SET_RESULT_EX 120 - -/* - * UI reason codes. - */ -# define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 -# define UI_R_INDEX_TOO_LARGE 102 -# define UI_R_INDEX_TOO_SMALL 103 -# define UI_R_NO_RESULT_BUFFER 105 -# define UI_R_PROCESSING_ERROR 107 -# define UI_R_RESULT_TOO_LARGE 100 -# define UI_R_RESULT_TOO_SMALL 101 -# define UI_R_SYSASSIGN_ERROR 109 -# define UI_R_SYSDASSGN_ERROR 110 -# define UI_R_SYSQIOW_ERROR 111 -# define UI_R_UNKNOWN_CONTROL_COMMAND 106 -# define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 -# define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/whrlpool.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/whrlpool.h deleted file mode 100644 index 20ea3503..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/whrlpool.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-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_WHRLPOOL_H -# define HEADER_WHRLPOOL_H - -#include - -# ifndef OPENSSL_NO_WHIRLPOOL -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define WHIRLPOOL_DIGEST_LENGTH (512/8) -# define WHIRLPOOL_BBLOCK 512 -# define WHIRLPOOL_COUNTER (256/8) - -typedef struct { - union { - unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; - /* double q is here to ensure 64-bit alignment */ - double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; - } H; - unsigned char data[WHIRLPOOL_BBLOCK / 8]; - unsigned int bitoff; - size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; -} WHIRLPOOL_CTX; - -int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); -int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); -void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); -int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); -unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509.h deleted file mode 100644 index 39ca0ba5..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509.h +++ /dev/null @@ -1,1047 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_X509_H -# define HEADER_X509_H - -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# endif - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Flags for X509_get_signature_info() */ -/* Signature info is valid */ -# define X509_SIG_INFO_VALID 0x1 -/* Signature is suitable for TLS use */ -# define X509_SIG_INFO_TLS 0x2 - -# define X509_FILETYPE_PEM 1 -# define X509_FILETYPE_ASN1 2 -# define X509_FILETYPE_DEFAULT 3 - -# define X509v3_KU_DIGITAL_SIGNATURE 0x0080 -# define X509v3_KU_NON_REPUDIATION 0x0040 -# define X509v3_KU_KEY_ENCIPHERMENT 0x0020 -# define X509v3_KU_DATA_ENCIPHERMENT 0x0010 -# define X509v3_KU_KEY_AGREEMENT 0x0008 -# define X509v3_KU_KEY_CERT_SIGN 0x0004 -# define X509v3_KU_CRL_SIGN 0x0002 -# define X509v3_KU_ENCIPHER_ONLY 0x0001 -# define X509v3_KU_DECIPHER_ONLY 0x8000 -# define X509v3_KU_UNDEF 0xffff - -struct X509_algor_st { - ASN1_OBJECT *algorithm; - ASN1_TYPE *parameter; -} /* X509_ALGOR */ ; - -typedef STACK_OF(X509_ALGOR) X509_ALGORS; - -typedef struct X509_val_st { - ASN1_TIME *notBefore; - ASN1_TIME *notAfter; -} X509_VAL; - -typedef struct X509_sig_st X509_SIG; - -typedef struct X509_name_entry_st X509_NAME_ENTRY; - -DEFINE_STACK_OF(X509_NAME_ENTRY) - -DEFINE_STACK_OF(X509_NAME) - -# define X509_EX_V_NETSCAPE_HACK 0x8000 -# define X509_EX_V_INIT 0x0001 -typedef struct X509_extension_st X509_EXTENSION; - -typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; - -DEFINE_STACK_OF(X509_EXTENSION) - -typedef struct x509_attributes_st X509_ATTRIBUTE; - -DEFINE_STACK_OF(X509_ATTRIBUTE) - -typedef struct X509_req_info_st X509_REQ_INFO; - -typedef struct X509_req_st X509_REQ; - -typedef struct x509_cert_aux_st X509_CERT_AUX; - -typedef struct x509_cinf_st X509_CINF; - -DEFINE_STACK_OF(X509) - -/* This is used for a table of trust checking functions */ - -typedef struct x509_trust_st { - int trust; - int flags; - int (*check_trust) (struct x509_trust_st *, X509 *, int); - char *name; - int arg1; - void *arg2; -} X509_TRUST; - -DEFINE_STACK_OF(X509_TRUST) - -/* standard trust ids */ - -# define X509_TRUST_DEFAULT 0 /* Only valid in purpose settings */ - -# define X509_TRUST_COMPAT 1 -# define X509_TRUST_SSL_CLIENT 2 -# define X509_TRUST_SSL_SERVER 3 -# define X509_TRUST_EMAIL 4 -# define X509_TRUST_OBJECT_SIGN 5 -# define X509_TRUST_OCSP_SIGN 6 -# define X509_TRUST_OCSP_REQUEST 7 -# define X509_TRUST_TSA 8 - -/* Keep these up to date! */ -# define X509_TRUST_MIN 1 -# define X509_TRUST_MAX 8 - -/* trust_flags values */ -# define X509_TRUST_DYNAMIC (1U << 0) -# define X509_TRUST_DYNAMIC_NAME (1U << 1) -/* No compat trust if self-signed, preempts "DO_SS" */ -# define X509_TRUST_NO_SS_COMPAT (1U << 2) -/* Compat trust if no explicit accepted trust EKUs */ -# define X509_TRUST_DO_SS_COMPAT (1U << 3) -/* Accept "anyEKU" as a wildcard trust OID */ -# define X509_TRUST_OK_ANY_EKU (1U << 4) - -/* check_trust return codes */ - -# define X509_TRUST_TRUSTED 1 -# define X509_TRUST_REJECTED 2 -# define X509_TRUST_UNTRUSTED 3 - -/* Flags for X509_print_ex() */ - -# define X509_FLAG_COMPAT 0 -# define X509_FLAG_NO_HEADER 1L -# define X509_FLAG_NO_VERSION (1L << 1) -# define X509_FLAG_NO_SERIAL (1L << 2) -# define X509_FLAG_NO_SIGNAME (1L << 3) -# define X509_FLAG_NO_ISSUER (1L << 4) -# define X509_FLAG_NO_VALIDITY (1L << 5) -# define X509_FLAG_NO_SUBJECT (1L << 6) -# define X509_FLAG_NO_PUBKEY (1L << 7) -# define X509_FLAG_NO_EXTENSIONS (1L << 8) -# define X509_FLAG_NO_SIGDUMP (1L << 9) -# define X509_FLAG_NO_AUX (1L << 10) -# define X509_FLAG_NO_ATTRIBUTES (1L << 11) -# define X509_FLAG_NO_IDS (1L << 12) - -/* Flags specific to X509_NAME_print_ex() */ - -/* The field separator information */ - -# define XN_FLAG_SEP_MASK (0xf << 16) - -# define XN_FLAG_COMPAT 0/* Traditional; use old X509_NAME_print */ -# define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */ -# define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */ -# define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */ -# define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */ - -# define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */ - -/* How the field name is shown */ - -# define XN_FLAG_FN_MASK (0x3 << 21) - -# define XN_FLAG_FN_SN 0/* Object short name */ -# define XN_FLAG_FN_LN (1 << 21)/* Object long name */ -# define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */ -# define XN_FLAG_FN_NONE (3 << 21)/* No field names */ - -# define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */ - -/* - * This determines if we dump fields we don't recognise: RFC2253 requires - * this. - */ - -# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) - -# define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20 - * characters */ - -/* Complete set of RFC2253 flags */ - -# define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ - XN_FLAG_SEP_COMMA_PLUS | \ - XN_FLAG_DN_REV | \ - XN_FLAG_FN_SN | \ - XN_FLAG_DUMP_UNKNOWN_FIELDS) - -/* readable oneline form */ - -# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ - ASN1_STRFLGS_ESC_QUOTE | \ - XN_FLAG_SEP_CPLUS_SPC | \ - XN_FLAG_SPC_EQ | \ - XN_FLAG_FN_SN) - -/* readable multiline form */ - -# define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ - ASN1_STRFLGS_ESC_MSB | \ - XN_FLAG_SEP_MULTILINE | \ - XN_FLAG_SPC_EQ | \ - XN_FLAG_FN_LN | \ - XN_FLAG_FN_ALIGN) - -DEFINE_STACK_OF(X509_REVOKED) - -typedef struct X509_crl_info_st X509_CRL_INFO; - -DEFINE_STACK_OF(X509_CRL) - -typedef struct private_key_st { - int version; - /* The PKCS#8 data types */ - X509_ALGOR *enc_algor; - ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ - /* When decrypted, the following will not be NULL */ - EVP_PKEY *dec_pkey; - /* used to encrypt and decrypt */ - int key_length; - char *key_data; - int key_free; /* true if we should auto free key_data */ - /* expanded version of 'enc_algor' */ - EVP_CIPHER_INFO cipher; -} X509_PKEY; - -typedef struct X509_info_st { - X509 *x509; - X509_CRL *crl; - X509_PKEY *x_pkey; - EVP_CIPHER_INFO enc_cipher; - int enc_len; - char *enc_data; -} X509_INFO; - -DEFINE_STACK_OF(X509_INFO) - -/* - * The next 2 structures and their 8 routines are used to manipulate Netscape's - * spki structures - useful if you are writing a CA web page - */ -typedef struct Netscape_spkac_st { - X509_PUBKEY *pubkey; - ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ -} NETSCAPE_SPKAC; - -typedef struct Netscape_spki_st { - NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ - X509_ALGOR sig_algor; - ASN1_BIT_STRING *signature; -} NETSCAPE_SPKI; - -/* Netscape certificate sequence structure */ -typedef struct Netscape_certificate_sequence { - ASN1_OBJECT *type; - STACK_OF(X509) *certs; -} NETSCAPE_CERT_SEQUENCE; - -/*- Unused (and iv length is wrong) -typedef struct CBCParameter_st - { - unsigned char iv[8]; - } CBC_PARAM; -*/ - -/* Password based encryption structure */ - -typedef struct PBEPARAM_st { - ASN1_OCTET_STRING *salt; - ASN1_INTEGER *iter; -} PBEPARAM; - -/* Password based encryption V2 structures */ - -typedef struct PBE2PARAM_st { - X509_ALGOR *keyfunc; - X509_ALGOR *encryption; -} PBE2PARAM; - -typedef struct PBKDF2PARAM_st { -/* Usually OCTET STRING but could be anything */ - ASN1_TYPE *salt; - ASN1_INTEGER *iter; - ASN1_INTEGER *keylength; - X509_ALGOR *prf; -} PBKDF2PARAM; - -#ifndef OPENSSL_NO_SCRYPT -typedef struct SCRYPT_PARAMS_st { - ASN1_OCTET_STRING *salt; - ASN1_INTEGER *costParameter; - ASN1_INTEGER *blockSize; - ASN1_INTEGER *parallelizationParameter; - ASN1_INTEGER *keyLength; -} SCRYPT_PARAMS; -#endif - -#ifdef __cplusplus -} -#endif - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define X509_EXT_PACK_UNKNOWN 1 -# define X509_EXT_PACK_STRING 2 - -# define X509_extract_key(x) X509_get_pubkey(x)/*****/ -# define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) -# define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) - -void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); -X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl), - int (*crl_free) (X509_CRL *crl), - int (*crl_lookup) (X509_CRL *crl, - X509_REVOKED **ret, - ASN1_INTEGER *ser, - X509_NAME *issuer), - int (*crl_verify) (X509_CRL *crl, - EVP_PKEY *pk)); -void X509_CRL_METHOD_free(X509_CRL_METHOD *m); - -void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); -void *X509_CRL_get_meth_data(X509_CRL *crl); - -const char *X509_verify_cert_error_string(long n); - -int X509_verify(X509 *a, EVP_PKEY *r); - -int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); -int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); -int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); - -NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); -char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); -EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); -int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); - -int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); - -int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); -int X509_signature_print(BIO *bp, const X509_ALGOR *alg, - const ASN1_STRING *sig); - -int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); -# ifndef OPENSSL_NO_OCSP -int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert); -# endif -int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); -int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); -# ifndef OPENSSL_NO_OCSP -int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl); -# endif -int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); - -int X509_pubkey_digest(const X509 *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_digest(const X509 *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); - -# ifndef OPENSSL_NO_STDIO -X509 *d2i_X509_fp(FILE *fp, X509 **x509); -int i2d_X509_fp(FILE *fp, X509 *x509); -X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); -int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl); -X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); -int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req); -# ifndef OPENSSL_NO_RSA -RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); -int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa); -RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); -int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa); -RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); -int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa); -# endif -# ifndef OPENSSL_NO_DSA -DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); -int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); -DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); -int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); -# endif -# ifndef OPENSSL_NO_EC -EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); -int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); -EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); -int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); -# endif -X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); -int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8); -PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, - PKCS8_PRIV_KEY_INFO **p8inf); -int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf); -int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); -int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); -int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); -# endif - -X509 *d2i_X509_bio(BIO *bp, X509 **x509); -int i2d_X509_bio(BIO *bp, X509 *x509); -X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); -int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl); -X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); -int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req); -# ifndef OPENSSL_NO_RSA -RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); -int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa); -RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); -int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa); -RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); -int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa); -# endif -# ifndef OPENSSL_NO_DSA -DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); -int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); -DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); -int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); -# endif -# ifndef OPENSSL_NO_EC -EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); -int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); -EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); -int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); -# endif -X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); -int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8); -PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, - PKCS8_PRIV_KEY_INFO **p8inf); -int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf); -int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); -int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); -int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); - -X509 *X509_dup(X509 *x509); -X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); -X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); -X509_CRL *X509_CRL_dup(X509_CRL *crl); -X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev); -X509_REQ *X509_REQ_dup(X509_REQ *req); -X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); -int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, - void *pval); -void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, - const void **ppval, const X509_ALGOR *algor); -void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); -int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); - -X509_NAME *X509_NAME_dup(X509_NAME *xn); -X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); - -int X509_cmp_time(const ASN1_TIME *s, time_t *t); -int X509_cmp_current_time(const ASN1_TIME *s); -ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t); -ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, - int offset_day, long offset_sec, time_t *t); -ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); - -const char *X509_get_default_cert_area(void); -const char *X509_get_default_cert_dir(void); -const char *X509_get_default_cert_file(void); -const char *X509_get_default_cert_dir_env(void); -const char *X509_get_default_cert_file_env(void); -const char *X509_get_default_private_dir(void); - -X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); -X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); - -DECLARE_ASN1_FUNCTIONS(X509_ALGOR) -DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) -DECLARE_ASN1_FUNCTIONS(X509_VAL) - -DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) - -int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); -EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key); -EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key); -int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain); -long X509_get_pathlen(X509 *x); -int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp); -EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length); -# ifndef OPENSSL_NO_RSA -int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); -RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length); -# endif -# ifndef OPENSSL_NO_DSA -int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp); -DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length); -# endif -# ifndef OPENSSL_NO_EC -int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); -EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length); -# endif - -DECLARE_ASN1_FUNCTIONS(X509_SIG) -void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, - const ASN1_OCTET_STRING **pdigest); -void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, - ASN1_OCTET_STRING **pdigest); - -DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) -DECLARE_ASN1_FUNCTIONS(X509_REQ) - -DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) -X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); - -DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) -DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) - -DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) - -DECLARE_ASN1_FUNCTIONS(X509_NAME) - -int X509_NAME_set(X509_NAME **xn, X509_NAME *name); - -DECLARE_ASN1_FUNCTIONS(X509_CINF) - -DECLARE_ASN1_FUNCTIONS(X509) -DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) - -#define X509_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef) -int X509_set_ex_data(X509 *r, int idx, void *arg); -void *X509_get_ex_data(X509 *r, int idx); -int i2d_X509_AUX(X509 *a, unsigned char **pp); -X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length); - -int i2d_re_X509_tbs(X509 *x, unsigned char **pp); - -int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid, - int *secbits, uint32_t *flags); -void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid, - int secbits, uint32_t flags); - -int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits, - uint32_t *flags); - -void X509_get0_signature(const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg, const X509 *x); -int X509_get_signature_nid(const X509 *x); - -int X509_trusted(const X509 *x); -int X509_alias_set1(X509 *x, const unsigned char *name, int len); -int X509_keyid_set1(X509 *x, const unsigned char *id, int len); -unsigned char *X509_alias_get0(X509 *x, int *len); -unsigned char *X509_keyid_get0(X509 *x, int *len); -int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *, - int); -int X509_TRUST_set(int *t, int trust); -int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); -int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj); -void X509_trust_clear(X509 *x); -void X509_reject_clear(X509 *x); - -STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x); -STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x); - -DECLARE_ASN1_FUNCTIONS(X509_REVOKED) -DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) -DECLARE_ASN1_FUNCTIONS(X509_CRL) - -int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); -int X509_CRL_get0_by_serial(X509_CRL *crl, - X509_REVOKED **ret, ASN1_INTEGER *serial); -int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); - -X509_PKEY *X509_PKEY_new(void); -void X509_PKEY_free(X509_PKEY *a); - -DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) -DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) -DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) - -X509_INFO *X509_INFO_new(void); -void X509_INFO_free(X509_INFO *a); -char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size); - -int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, - ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); - -int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, - unsigned char *md, unsigned int *len); - -int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, - char *data, EVP_PKEY *pkey, const EVP_MD *type); - -int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, - unsigned char *md, unsigned int *len); - -int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, - ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey); - -int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data, - EVP_PKEY *pkey, const EVP_MD *type); -int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, - void *asn, EVP_MD_CTX *ctx); - -long X509_get_version(const X509 *x); -int X509_set_version(X509 *x, long version); -int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); -ASN1_INTEGER *X509_get_serialNumber(X509 *x); -const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); -int X509_set_issuer_name(X509 *x, X509_NAME *name); -X509_NAME *X509_get_issuer_name(const X509 *a); -int X509_set_subject_name(X509 *x, X509_NAME *name); -X509_NAME *X509_get_subject_name(const X509 *a); -const ASN1_TIME * X509_get0_notBefore(const X509 *x); -ASN1_TIME *X509_getm_notBefore(const X509 *x); -int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); -const ASN1_TIME *X509_get0_notAfter(const X509 *x); -ASN1_TIME *X509_getm_notAfter(const X509 *x); -int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); -int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); -int X509_up_ref(X509 *x); -int X509_get_signature_type(const X509 *x); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_get_notBefore X509_getm_notBefore -# define X509_get_notAfter X509_getm_notAfter -# define X509_set_notBefore X509_set1_notBefore -# define X509_set_notAfter X509_set1_notAfter -#endif - - -/* - * This one is only used so that a binary form can output, as in - * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf) - */ -X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); -const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); -void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid, - const ASN1_BIT_STRING **psuid); -const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); - -EVP_PKEY *X509_get0_pubkey(const X509 *x); -EVP_PKEY *X509_get_pubkey(X509 *x); -ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); -int X509_certificate_type(const X509 *x, const EVP_PKEY *pubkey); - -long X509_REQ_get_version(const X509_REQ *req); -int X509_REQ_set_version(X509_REQ *x, long version); -X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req); -int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); -void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg); -int X509_REQ_get_signature_nid(const X509_REQ *req); -int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); -int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); -EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); -EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req); -X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req); -int X509_REQ_extension_nid(int nid); -int *X509_REQ_get_extension_nids(void); -void X509_REQ_set_extension_nids(int *nids); -STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); -int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, - int nid); -int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); -int X509_REQ_get_attr_count(const X509_REQ *req); -int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); -int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); -X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); -int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); -int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len); -int X509_REQ_add1_attr_by_NID(X509_REQ *req, - int nid, int type, - const unsigned char *bytes, int len); -int X509_REQ_add1_attr_by_txt(X509_REQ *req, - const char *attrname, int type, - const unsigned char *bytes, int len); - -int X509_CRL_set_version(X509_CRL *x, long version); -int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); -int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); -int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); -int X509_CRL_sort(X509_CRL *crl); -int X509_CRL_up_ref(X509_CRL *crl); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate -# define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate -#endif - -long X509_CRL_get_version(const X509_CRL *crl); -const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); -const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); -DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl)) -DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl)) -X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); -const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); -STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); -void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg); -int X509_CRL_get_signature_nid(const X509_CRL *crl); -int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); - -const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); -int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); -const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); -int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); -const STACK_OF(X509_EXTENSION) * -X509_REVOKED_get0_extensions(const X509_REVOKED *r); - -X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, - EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); - -int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey); - -int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); -int X509_chain_check_suiteb(int *perror_depth, - X509 *x, STACK_OF(X509) *chain, - unsigned long flags); -int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); -STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); - -int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); -unsigned long X509_issuer_and_serial_hash(X509 *a); - -int X509_issuer_name_cmp(const X509 *a, const X509 *b); -unsigned long X509_issuer_name_hash(X509 *a); - -int X509_subject_name_cmp(const X509 *a, const X509 *b); -unsigned long X509_subject_name_hash(X509 *x); - -# ifndef OPENSSL_NO_MD5 -unsigned long X509_issuer_name_hash_old(X509 *a); -unsigned long X509_subject_name_hash_old(X509 *x); -# endif - -int X509_cmp(const X509 *a, const X509 *b); -int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); -unsigned long X509_NAME_hash(X509_NAME *x); -unsigned long X509_NAME_hash_old(X509_NAME *x); - -int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); -int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); -int X509_aux_print(BIO *out, X509 *x, int indent); -# ifndef OPENSSL_NO_STDIO -int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, - unsigned long cflag); -int X509_print_fp(FILE *bp, X509 *x); -int X509_CRL_print_fp(FILE *bp, X509_CRL *x); -int X509_REQ_print_fp(FILE *bp, X509_REQ *req); -int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, - unsigned long flags); -# endif - -int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase); -int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, - unsigned long flags); -int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, - unsigned long cflag); -int X509_print(BIO *bp, X509 *x); -int X509_ocspid_print(BIO *bp, X509 *x); -int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag); -int X509_CRL_print(BIO *bp, X509_CRL *x); -int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, - unsigned long cflag); -int X509_REQ_print(BIO *bp, X509_REQ *req); - -int X509_NAME_entry_count(const X509_NAME *name); -int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len); -int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, - char *buf, int len); - -/* - * NOTE: you should be passing -1, not 0 as lastpos. The functions that use - * lastpos, search after that position on. - */ -int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos); -int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, - int lastpos); -X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); -X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); -int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, - int loc, int set); -int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len, int loc, - int set); -int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, - const unsigned char *bytes, int len, int loc, - int set); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, - const char *field, int type, - const unsigned char *bytes, - int len); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, - int type, - const unsigned char *bytes, - int len); -int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, - const unsigned char *bytes, int len, int loc, - int set); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, - int len); -int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj); -int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, - const unsigned char *bytes, int len); -ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); -ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); -int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); - -int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, - size_t *pderlen); - -int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); -int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, - int nid, int lastpos); -int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, - const ASN1_OBJECT *obj, int lastpos); -int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, - int crit, int lastpos); -X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); -X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); -STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, - X509_EXTENSION *ex, int loc); - -int X509_get_ext_count(const X509 *x); -int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); -int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos); -int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); -X509_EXTENSION *X509_get_ext(const X509 *x, int loc); -X509_EXTENSION *X509_delete_ext(X509 *x, int loc); -int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); -void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); -int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, - unsigned long flags); - -int X509_CRL_get_ext_count(const X509_CRL *x); -int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos); -int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, - int lastpos); -int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos); -X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); -X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); -int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); -void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx); -int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, - unsigned long flags); - -int X509_REVOKED_get_ext_count(const X509_REVOKED *x); -int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos); -int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj, - int lastpos); -int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, - int lastpos); -X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); -X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); -int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); -void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, - int *idx); -int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, - unsigned long flags); - -X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, - int nid, int crit, - ASN1_OCTET_STRING *data); -X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, - const ASN1_OBJECT *obj, int crit, - ASN1_OCTET_STRING *data); -int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); -int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); -int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); -ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); -ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); -int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); - -int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); -int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, - int lastpos); -int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, - const ASN1_OBJECT *obj, int lastpos); -X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); -X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, - X509_ATTRIBUTE *attr); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) - **x, const ASN1_OBJECT *obj, - int type, - const unsigned char *bytes, - int len); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) - **x, int nid, int type, - const unsigned char *bytes, - int len); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) - **x, const char *attrname, - int type, - const unsigned char *bytes, - int len); -void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, - const ASN1_OBJECT *obj, int lastpos, int type); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, - int atrtype, const void *data, - int len); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, - const ASN1_OBJECT *obj, - int atrtype, const void *data, - int len); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, - const char *atrname, int type, - const unsigned char *bytes, - int len); -int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); -int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, - const void *data, int len); -void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype, - void *data); -int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); -ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); -ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); - -int EVP_PKEY_get_attr_count(const EVP_PKEY *key); -int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); -int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); -X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); -int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); -int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len); -int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, - int nid, int type, - const unsigned char *bytes, int len); -int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, - const char *attrname, int type, - const unsigned char *bytes, int len); - -int X509_verify_cert(X509_STORE_CTX *ctx); - -/* lookup a cert from a X509 STACK */ -X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name, - ASN1_INTEGER *serial); -X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name); - -DECLARE_ASN1_FUNCTIONS(PBEPARAM) -DECLARE_ASN1_FUNCTIONS(PBE2PARAM) -DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) -#ifndef OPENSSL_NO_SCRYPT -DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS) -#endif - -int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, - const unsigned char *salt, int saltlen); - -X509_ALGOR *PKCS5_pbe_set(int alg, int iter, - const unsigned char *salt, int saltlen); -X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, - unsigned char *salt, int saltlen); -X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, - unsigned char *salt, int saltlen, - unsigned char *aiv, int prf_nid); - -#ifndef OPENSSL_NO_SCRYPT -X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, - const unsigned char *salt, int saltlen, - unsigned char *aiv, uint64_t N, uint64_t r, - uint64_t p); -#endif - -X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, - int prf_nid, int keylen); - -/* PKCS#8 utilities */ - -DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) - -EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); -PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); - -int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, - int version, int ptype, void *pval, - unsigned char *penc, int penclen); -int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, - const unsigned char **pk, int *ppklen, - const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); - -const STACK_OF(X509_ATTRIBUTE) * -PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); -int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, - const unsigned char *bytes, int len); - -int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, - int ptype, void *pval, - unsigned char *penc, int penclen); -int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, - const unsigned char **pk, int *ppklen, - X509_ALGOR **pa, X509_PUBKEY *pub); - -int X509_check_trust(X509 *x, int id, int flags); -int X509_TRUST_get_count(void); -X509_TRUST *X509_TRUST_get0(int idx); -int X509_TRUST_get_by_id(int id); -int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), - const char *name, int arg1, void *arg2); -void X509_TRUST_cleanup(void); -int X509_TRUST_get_flags(const X509_TRUST *xp); -char *X509_TRUST_get0_name(const X509_TRUST *xp); -int X509_TRUST_get_trust(const X509_TRUST *xp); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509_vfy.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509_vfy.h deleted file mode 100644 index adb8bce7..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509_vfy.h +++ /dev/null @@ -1,628 +0,0 @@ -/* - * 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_X509_VFY_H -# define HEADER_X509_VFY_H - -/* - * Protect against recursion, x509.h and x509_vfy.h each include the other. - */ -# ifndef HEADER_X509_H -# include -# endif - -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- -SSL_CTX -> X509_STORE - -> X509_LOOKUP - ->X509_LOOKUP_METHOD - -> X509_LOOKUP - ->X509_LOOKUP_METHOD - -SSL -> X509_STORE_CTX - ->X509_STORE - -The X509_STORE holds the tables etc for verification stuff. -A X509_STORE_CTX is used while validating a single certificate. -The X509_STORE has X509_LOOKUPs for looking up certs. -The X509_STORE then calls a function to actually verify the -certificate chain. -*/ - -typedef enum { - X509_LU_NONE = 0, - X509_LU_X509, X509_LU_CRL -} X509_LOOKUP_TYPE; - -#if OPENSSL_API_COMPAT < 0x10100000L -#define X509_LU_RETRY -1 -#define X509_LU_FAIL 0 -#endif - -DEFINE_STACK_OF(X509_LOOKUP) -DEFINE_STACK_OF(X509_OBJECT) -DEFINE_STACK_OF(X509_VERIFY_PARAM) - -int X509_STORE_set_depth(X509_STORE *store, int depth); - -typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *); -typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); -typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer, - X509_STORE_CTX *ctx, X509 *x); -typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx, - X509 *x, X509 *issuer); -typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx); -typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx, - X509_CRL **crl, X509 *x); -typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl); -typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx, - X509_CRL *crl, X509 *x); -typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx); -typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx, - X509_NAME *nm); -typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx, - X509_NAME *nm); -typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx); - - -void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); - -# define X509_STORE_CTX_set_app_data(ctx,data) \ - X509_STORE_CTX_set_ex_data(ctx,0,data) -# define X509_STORE_CTX_get_app_data(ctx) \ - X509_STORE_CTX_get_ex_data(ctx,0) - -# define X509_L_FILE_LOAD 1 -# define X509_L_ADD_DIR 2 - -# define X509_LOOKUP_load_file(x,name,type) \ - X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) - -# define X509_LOOKUP_add_dir(x,name,type) \ - X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) - -# define X509_V_OK 0 -# define X509_V_ERR_UNSPECIFIED 1 -# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 -# define X509_V_ERR_UNABLE_TO_GET_CRL 3 -# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 -# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 -# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 -# define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 -# define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 -# define X509_V_ERR_CERT_NOT_YET_VALID 9 -# define X509_V_ERR_CERT_HAS_EXPIRED 10 -# define X509_V_ERR_CRL_NOT_YET_VALID 11 -# define X509_V_ERR_CRL_HAS_EXPIRED 12 -# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 -# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 -# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 -# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 -# define X509_V_ERR_OUT_OF_MEM 17 -# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 -# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 -# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 -# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 -# define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 -# define X509_V_ERR_CERT_REVOKED 23 -# define X509_V_ERR_INVALID_CA 24 -# define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 -# define X509_V_ERR_INVALID_PURPOSE 26 -# define X509_V_ERR_CERT_UNTRUSTED 27 -# define X509_V_ERR_CERT_REJECTED 28 -/* These are 'informational' when looking for issuer cert */ -# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 -# define X509_V_ERR_AKID_SKID_MISMATCH 30 -# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 -# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 -# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 -# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 -# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 -# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 -# define X509_V_ERR_INVALID_NON_CA 37 -# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 -# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 -# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 -# define X509_V_ERR_INVALID_EXTENSION 41 -# define X509_V_ERR_INVALID_POLICY_EXTENSION 42 -# define X509_V_ERR_NO_EXPLICIT_POLICY 43 -# define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 -# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 -# define X509_V_ERR_UNNESTED_RESOURCE 46 -# define X509_V_ERR_PERMITTED_VIOLATION 47 -# define X509_V_ERR_EXCLUDED_VIOLATION 48 -# define X509_V_ERR_SUBTREE_MINMAX 49 -/* The application is not happy */ -# define X509_V_ERR_APPLICATION_VERIFICATION 50 -# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 -# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 -# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 -# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 -/* Another issuer check debug option */ -# define X509_V_ERR_PATH_LOOP 55 -/* Suite B mode algorithm violation */ -# define X509_V_ERR_SUITE_B_INVALID_VERSION 56 -# define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 -# define X509_V_ERR_SUITE_B_INVALID_CURVE 58 -# define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 -# define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 -# define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 -/* Host, email and IP check errors */ -# define X509_V_ERR_HOSTNAME_MISMATCH 62 -# define X509_V_ERR_EMAIL_MISMATCH 63 -# define X509_V_ERR_IP_ADDRESS_MISMATCH 64 -/* DANE TLSA errors */ -# define X509_V_ERR_DANE_NO_MATCH 65 -/* security level errors */ -# define X509_V_ERR_EE_KEY_TOO_SMALL 66 -# define X509_V_ERR_CA_KEY_TOO_SMALL 67 -# define X509_V_ERR_CA_MD_TOO_WEAK 68 -/* Caller error */ -# define X509_V_ERR_INVALID_CALL 69 -/* Issuer lookup error */ -# define X509_V_ERR_STORE_LOOKUP 70 -/* Certificate transparency */ -# define X509_V_ERR_NO_VALID_SCTS 71 - -# define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72 -/* OCSP status errors */ -# define X509_V_ERR_OCSP_VERIFY_NEEDED 73 /* Need OCSP verification */ -# define X509_V_ERR_OCSP_VERIFY_FAILED 74 /* Couldn't verify cert through OCSP */ -# define X509_V_ERR_OCSP_CERT_UNKNOWN 75 /* Certificate wasn't recognized by the OCSP responder */ - -/* Certificate verify flags */ - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_V_FLAG_CB_ISSUER_CHECK 0x0 /* Deprecated */ -# endif -/* Use check time instead of current time */ -# define X509_V_FLAG_USE_CHECK_TIME 0x2 -/* Lookup CRLs */ -# define X509_V_FLAG_CRL_CHECK 0x4 -/* Lookup CRLs for whole chain */ -# define X509_V_FLAG_CRL_CHECK_ALL 0x8 -/* Ignore unhandled critical extensions */ -# define X509_V_FLAG_IGNORE_CRITICAL 0x10 -/* Disable workarounds for broken certificates */ -# define X509_V_FLAG_X509_STRICT 0x20 -/* Enable proxy certificate validation */ -# define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 -/* Enable policy checking */ -# define X509_V_FLAG_POLICY_CHECK 0x80 -/* Policy variable require-explicit-policy */ -# define X509_V_FLAG_EXPLICIT_POLICY 0x100 -/* Policy variable inhibit-any-policy */ -# define X509_V_FLAG_INHIBIT_ANY 0x200 -/* Policy variable inhibit-policy-mapping */ -# define X509_V_FLAG_INHIBIT_MAP 0x400 -/* Notify callback that policy is OK */ -# define X509_V_FLAG_NOTIFY_POLICY 0x800 -/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ -# define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 -/* Delta CRL support */ -# define X509_V_FLAG_USE_DELTAS 0x2000 -/* Check self-signed CA signature */ -# define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 -/* Use trusted store first */ -# define X509_V_FLAG_TRUSTED_FIRST 0x8000 -/* Suite B 128 bit only mode: not normally used */ -# define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 -/* Suite B 192 bit only mode */ -# define X509_V_FLAG_SUITEB_192_LOS 0x20000 -/* Suite B 128 bit mode allowing 192 bit algorithms */ -# define X509_V_FLAG_SUITEB_128_LOS 0x30000 -/* Allow partial chains if at least one certificate is in trusted store */ -# define X509_V_FLAG_PARTIAL_CHAIN 0x80000 -/* - * If the initial chain is not trusted, do not attempt to build an alternative - * chain. Alternate chain checking was introduced in 1.1.0. Setting this flag - * will force the behaviour to match that of previous versions. - */ -# define X509_V_FLAG_NO_ALT_CHAINS 0x100000 -/* Do not check certificate/CRL validity against current time */ -# define X509_V_FLAG_NO_CHECK_TIME 0x200000 - -# define X509_VP_FLAG_DEFAULT 0x1 -# define X509_VP_FLAG_OVERWRITE 0x2 -# define X509_VP_FLAG_RESET_FLAGS 0x4 -# define X509_VP_FLAG_LOCKED 0x8 -# define X509_VP_FLAG_ONCE 0x10 - -/* Internal use: mask of policy related options */ -# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ - | X509_V_FLAG_EXPLICIT_POLICY \ - | X509_V_FLAG_INHIBIT_ANY \ - | X509_V_FLAG_INHIBIT_MAP) - -int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, - X509_NAME *name); -X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, - X509_LOOKUP_TYPE type, - X509_NAME *name); -X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, - X509_OBJECT *x); -int X509_OBJECT_up_ref_count(X509_OBJECT *a); -X509_OBJECT *X509_OBJECT_new(void); -void X509_OBJECT_free(X509_OBJECT *a); -X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); -X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a); -int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj); -X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a); -int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj); -X509_STORE *X509_STORE_new(void); -void X509_STORE_free(X509_STORE *v); -int X509_STORE_lock(X509_STORE *ctx); -int X509_STORE_unlock(X509_STORE *ctx); -int X509_STORE_up_ref(X509_STORE *v); -STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v); - -STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); -STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); -int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); -int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); -int X509_STORE_set_trust(X509_STORE *ctx, int trust); -int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); -X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx); - -void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify); -#define X509_STORE_set_verify_func(ctx, func) \ - X509_STORE_set_verify((ctx),(func)) -void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, - X509_STORE_CTX_verify_fn verify); -X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx); -void X509_STORE_set_verify_cb(X509_STORE *ctx, - X509_STORE_CTX_verify_cb verify_cb); -# define X509_STORE_set_verify_cb_func(ctx,func) \ - X509_STORE_set_verify_cb((ctx),(func)) -X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx); -void X509_STORE_set_get_issuer(X509_STORE *ctx, - X509_STORE_CTX_get_issuer_fn get_issuer); -X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE *ctx); -void X509_STORE_set_check_issued(X509_STORE *ctx, - X509_STORE_CTX_check_issued_fn check_issued); -X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *ctx); -void X509_STORE_set_check_revocation(X509_STORE *ctx, - X509_STORE_CTX_check_revocation_fn check_revocation); -X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE *ctx); -void X509_STORE_set_get_crl(X509_STORE *ctx, - X509_STORE_CTX_get_crl_fn get_crl); -X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE *ctx); -void X509_STORE_set_check_crl(X509_STORE *ctx, - X509_STORE_CTX_check_crl_fn check_crl); -X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE *ctx); -void X509_STORE_set_cert_crl(X509_STORE *ctx, - X509_STORE_CTX_cert_crl_fn cert_crl); -X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE *ctx); -void X509_STORE_set_check_policy(X509_STORE *ctx, - X509_STORE_CTX_check_policy_fn check_policy); -X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE *ctx); -void X509_STORE_set_lookup_certs(X509_STORE *ctx, - X509_STORE_CTX_lookup_certs_fn lookup_certs); -X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE *ctx); -void X509_STORE_set_lookup_crls(X509_STORE *ctx, - X509_STORE_CTX_lookup_crls_fn lookup_crls); -#define X509_STORE_set_lookup_crls_cb(ctx, func) \ - X509_STORE_set_lookup_crls((ctx), (func)) -X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE *ctx); -void X509_STORE_set_cleanup(X509_STORE *ctx, - X509_STORE_CTX_cleanup_fn cleanup); -X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE *ctx); - -#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, l, p, newf, dupf, freef) -int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data); -void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx); - -X509_STORE_CTX *X509_STORE_CTX_new(void); - -int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); - -void X509_STORE_CTX_free(X509_STORE_CTX *ctx); -int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, - X509 *x509, STACK_OF(X509) *chain); -void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); -void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); - -X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); -X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx); -STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); -void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, - X509_STORE_CTX_verify_cb verify); -X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx); -X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx); -X509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx); -X509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx); -X509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx); -X509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx); -X509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define X509_STORE_CTX_get_chain X509_STORE_CTX_get0_chain -# define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted -# define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack -# define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject -# define X509_STORE_get1_certs X509_STORE_CTX_get1_certs -# define X509_STORE_get1_crls X509_STORE_CTX_get1_crls -/* the following macro is misspelled; use X509_STORE_get1_certs instead */ -# define X509_STORE_get1_cert X509_STORE_CTX_get1_certs -/* the following macro is misspelled; use X509_STORE_get1_crls instead */ -# define X509_STORE_get1_crl X509_STORE_CTX_get1_crls -#endif - -X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); -X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); -X509_LOOKUP_METHOD *X509_LOOKUP_file(void); - -typedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc, - long argl, char **ret); -typedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - X509_NAME *name, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - X509_NAME *name, - ASN1_INTEGER *serial, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - const unsigned char* bytes, - int len, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - const char *str, - int len, - X509_OBJECT *ret); - -X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name); -void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method, - int (*new_item) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method, - void (*free_fn) (X509_LOOKUP *ctx)); -void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method, - int (*init) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method, - int (*shutdown) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method, - X509_LOOKUP_ctrl_fn ctrl_fn); -X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_subject_fn fn); -X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_issuer_serial(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_issuer_serial_fn fn); -X509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_fingerprint_fn fn); -X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_alias_fn fn); -X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias( - const X509_LOOKUP_METHOD *method); - - -int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); -int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); - -int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, - X509_NAME *name, X509_OBJECT *ret); -X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, - X509_LOOKUP_TYPE type, - X509_NAME *name); - -int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, - long argl, char **ret); - -int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); -int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); -int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); - -X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); -void X509_LOOKUP_free(X509_LOOKUP *ctx); -int X509_LOOKUP_init(X509_LOOKUP *ctx); -int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - X509_NAME *name, X509_OBJECT *ret); -int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - X509_NAME *name, ASN1_INTEGER *serial, - X509_OBJECT *ret); -int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const unsigned char *bytes, int len, - X509_OBJECT *ret); -int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const char *str, int len, X509_OBJECT *ret); -int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data); -void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx); -X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx); -int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); - -int X509_STORE_load_locations(X509_STORE *ctx, - const char *file, const char *dir); -int X509_STORE_set_default_paths(X509_STORE *ctx); - -#define X509_STORE_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE_CTX, l, p, newf, dupf, freef) -int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data); -void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx); -int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s); -int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth); -X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x); -X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); -X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); -STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx); -STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x); -void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk); -void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk); -int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); -int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); -int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, - int purpose, int trust); -void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); -void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, - time_t t); - -X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); -int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); -int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx); - -X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); -int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); - -/* - * Bridge opacity barrier between libcrypt and libssl, also needed to support - * offline testing in test/danetest.c - */ -void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane); -#define DANE_FLAG_NO_DANE_EE_NAMECHECKS (1L << 0) - -/* X509_VERIFY_PARAM functions */ - -X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); -void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, - const X509_VERIFY_PARAM *from); -int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, - const X509_VERIFY_PARAM *from); -int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); -int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, - unsigned long flags); -int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, - unsigned long flags); -unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); -int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); -void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); -void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level); -time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param); -void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); -int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, - ASN1_OBJECT *policy); -int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, - STACK_OF(ASN1_OBJECT) *policies); - -int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, - uint32_t flags); -uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param); - -int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, - const char *name, size_t namelen); -int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, - const char *name, size_t namelen); -void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, - unsigned int flags); -unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param); -char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *); -void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *, X509_VERIFY_PARAM *); -int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, - const char *email, size_t emaillen); -int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, - const unsigned char *ip, size_t iplen); -int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, - const char *ipasc); - -int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param); -const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); - -int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_get_count(void); -const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); -const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); -void X509_VERIFY_PARAM_table_cleanup(void); - -/* Non positive return values are errors */ -#define X509_PCY_TREE_FAILURE -2 /* Failure to satisfy explicit policy */ -#define X509_PCY_TREE_INVALID -1 /* Inconsistent or invalid extensions */ -#define X509_PCY_TREE_INTERNAL 0 /* Internal error, most likely malloc */ - -/* - * Positive return values form a bit mask, all but the first are internal to - * the library and don't appear in results from X509_policy_check(). - */ -#define X509_PCY_TREE_VALID 1 /* The policy tree is valid */ -#define X509_PCY_TREE_EMPTY 2 /* The policy tree is empty */ -#define X509_PCY_TREE_EXPLICIT 4 /* Explicit policy required */ - -int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, - STACK_OF(X509) *certs, - STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags); - -void X509_policy_tree_free(X509_POLICY_TREE *tree); - -int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); -X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, - int i); - -STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const - X509_POLICY_TREE - *tree); - -STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const - X509_POLICY_TREE - *tree); - -int X509_policy_level_node_count(X509_POLICY_LEVEL *level); - -X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, - int i); - -const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); - -STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const - X509_POLICY_NODE - *node); -const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE - *node); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509err.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509err.h deleted file mode 100644 index 02738531..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509err.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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_X509ERR_H -# define HEADER_X509ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_X509_strings(void); - -/* - * X509 function codes. - */ -# define X509_F_ADD_CERT_DIR 100 -# define X509_F_BUILD_CHAIN 106 -# define X509_F_BY_FILE_CTRL 101 -# define X509_F_CHECK_NAME_CONSTRAINTS 149 -# define X509_F_CHECK_POLICY 145 -# define X509_F_DANE_I2D 107 -# define X509_F_DIR_CTRL 102 -# define X509_F_GET_CERT_BY_SUBJECT 103 -# define X509_F_I2D_X509_AUX 151 -# define X509_F_LOOKUP_CERTS_SK 152 -# define X509_F_NETSCAPE_SPKI_B64_DECODE 129 -# define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 -# define X509_F_NEW_DIR 153 -# define X509_F_X509AT_ADD1_ATTR 135 -# define X509_F_X509V3_ADD_EXT 104 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 -# define X509_F_X509_ATTRIBUTE_GET0_DATA 139 -# define X509_F_X509_ATTRIBUTE_SET1_DATA 138 -# define X509_F_X509_CHECK_PRIVATE_KEY 128 -# define X509_F_X509_CRL_DIFF 105 -# define X509_F_X509_CRL_METHOD_NEW 154 -# define X509_F_X509_CRL_PRINT_FP 147 -# define X509_F_X509_EXTENSION_CREATE_BY_NID 108 -# define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 -# define X509_F_X509_GET_PUBKEY_PARAMETERS 110 -# define X509_F_X509_LOAD_CERT_CRL_FILE 132 -# define X509_F_X509_LOAD_CERT_FILE 111 -# define X509_F_X509_LOAD_CRL_FILE 112 -# define X509_F_X509_LOOKUP_METH_NEW 160 -# define X509_F_X509_LOOKUP_NEW 155 -# define X509_F_X509_NAME_ADD_ENTRY 113 -# define X509_F_X509_NAME_CANON 156 -# define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 -# define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 -# define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 -# define X509_F_X509_NAME_ONELINE 116 -# define X509_F_X509_NAME_PRINT 117 -# define X509_F_X509_OBJECT_NEW 150 -# define X509_F_X509_PRINT_EX_FP 118 -# define X509_F_X509_PUBKEY_DECODE 148 -# define X509_F_X509_PUBKEY_GET0 119 -# define X509_F_X509_PUBKEY_SET 120 -# define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 -# define X509_F_X509_REQ_PRINT_EX 121 -# define X509_F_X509_REQ_PRINT_FP 122 -# define X509_F_X509_REQ_TO_X509 123 -# define X509_F_X509_STORE_ADD_CERT 124 -# define X509_F_X509_STORE_ADD_CRL 125 -# define X509_F_X509_STORE_ADD_LOOKUP 157 -# define X509_F_X509_STORE_CTX_GET1_ISSUER 146 -# define X509_F_X509_STORE_CTX_INIT 143 -# define X509_F_X509_STORE_CTX_NEW 142 -# define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 -# define X509_F_X509_STORE_NEW 158 -# define X509_F_X509_TO_X509_REQ 126 -# define X509_F_X509_TRUST_ADD 133 -# define X509_F_X509_TRUST_SET 141 -# define X509_F_X509_VERIFY_CERT 127 -# define X509_F_X509_VERIFY_PARAM_NEW 159 - -/* - * X509 reason codes. - */ -# define X509_R_AKID_MISMATCH 110 -# define X509_R_BAD_SELECTOR 133 -# define X509_R_BAD_X509_FILETYPE 100 -# define X509_R_BASE64_DECODE_ERROR 118 -# define X509_R_CANT_CHECK_DH_KEY 114 -# define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 -# define X509_R_CRL_ALREADY_DELTA 127 -# define X509_R_CRL_VERIFY_FAILURE 131 -# define X509_R_IDP_MISMATCH 128 -# define X509_R_INVALID_ATTRIBUTES 138 -# define X509_R_INVALID_DIRECTORY 113 -# define X509_R_INVALID_FIELD_NAME 119 -# define X509_R_INVALID_TRUST 123 -# define X509_R_ISSUER_MISMATCH 129 -# define X509_R_KEY_TYPE_MISMATCH 115 -# define X509_R_KEY_VALUES_MISMATCH 116 -# define X509_R_LOADING_CERT_DIR 103 -# define X509_R_LOADING_DEFAULTS 104 -# define X509_R_METHOD_NOT_SUPPORTED 124 -# define X509_R_NAME_TOO_LONG 134 -# define X509_R_NEWER_CRL_NOT_NEWER 132 -# define X509_R_NO_CERTIFICATE_FOUND 135 -# define X509_R_NO_CERTIFICATE_OR_CRL_FOUND 136 -# define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 -# define X509_R_NO_CRL_FOUND 137 -# define X509_R_NO_CRL_NUMBER 130 -# define X509_R_PUBLIC_KEY_DECODE_ERROR 125 -# define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 -# define X509_R_SHOULD_RETRY 106 -# define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 -# define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 -# define X509_R_UNKNOWN_KEY_TYPE 117 -# define X509_R_UNKNOWN_NID 109 -# define X509_R_UNKNOWN_PURPOSE_ID 121 -# define X509_R_UNKNOWN_TRUST_ID 120 -# define X509_R_UNSUPPORTED_ALGORITHM 111 -# define X509_R_WRONG_LOOKUP_TYPE 112 -# define X509_R_WRONG_TYPE 122 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509v3.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509v3.h deleted file mode 100644 index 6c6eca38..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509v3.h +++ /dev/null @@ -1,937 +0,0 @@ -/* - * Copyright 1999-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_X509V3_H -# define HEADER_X509V3_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward reference */ -struct v3_ext_method; -struct v3_ext_ctx; - -/* Useful typedefs */ - -typedef void *(*X509V3_EXT_NEW)(void); -typedef void (*X509V3_EXT_FREE) (void *); -typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); -typedef int (*X509V3_EXT_I2D) (void *, unsigned char **); -typedef STACK_OF(CONF_VALUE) * - (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, - STACK_OF(CONF_VALUE) *extlist); -typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, - STACK_OF(CONF_VALUE) *values); -typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, - void *ext); -typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, const char *str); -typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, - BIO *out, int indent); -typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, const char *str); - -/* V3 extension structure */ - -struct v3_ext_method { - int ext_nid; - int ext_flags; -/* If this is set the following four fields are ignored */ - ASN1_ITEM_EXP *it; -/* Old style ASN1 calls */ - X509V3_EXT_NEW ext_new; - X509V3_EXT_FREE ext_free; - X509V3_EXT_D2I d2i; - X509V3_EXT_I2D i2d; -/* The following pair is used for string extensions */ - X509V3_EXT_I2S i2s; - X509V3_EXT_S2I s2i; -/* The following pair is used for multi-valued extensions */ - X509V3_EXT_I2V i2v; - X509V3_EXT_V2I v2i; -/* The following are used for raw extensions */ - X509V3_EXT_I2R i2r; - X509V3_EXT_R2I r2i; - void *usr_data; /* Any extension specific data */ -}; - -typedef struct X509V3_CONF_METHOD_st { - char *(*get_string) (void *db, const char *section, const char *value); - STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section); - void (*free_string) (void *db, char *string); - void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); -} X509V3_CONF_METHOD; - -/* Context specific info */ -struct v3_ext_ctx { -# define CTX_TEST 0x1 -# define X509V3_CTX_REPLACE 0x2 - int flags; - X509 *issuer_cert; - X509 *subject_cert; - X509_REQ *subject_req; - X509_CRL *crl; - X509V3_CONF_METHOD *db_meth; - void *db; -/* Maybe more here */ -}; - -typedef struct v3_ext_method X509V3_EXT_METHOD; - -DEFINE_STACK_OF(X509V3_EXT_METHOD) - -/* ext_flags values */ -# define X509V3_EXT_DYNAMIC 0x1 -# define X509V3_EXT_CTX_DEP 0x2 -# define X509V3_EXT_MULTILINE 0x4 - -typedef BIT_STRING_BITNAME ENUMERATED_NAMES; - -typedef struct BASIC_CONSTRAINTS_st { - int ca; - ASN1_INTEGER *pathlen; -} BASIC_CONSTRAINTS; - -typedef struct PKEY_USAGE_PERIOD_st { - ASN1_GENERALIZEDTIME *notBefore; - ASN1_GENERALIZEDTIME *notAfter; -} PKEY_USAGE_PERIOD; - -typedef struct otherName_st { - ASN1_OBJECT *type_id; - ASN1_TYPE *value; -} OTHERNAME; - -typedef struct EDIPartyName_st { - ASN1_STRING *nameAssigner; - ASN1_STRING *partyName; -} EDIPARTYNAME; - -typedef struct GENERAL_NAME_st { -# define GEN_OTHERNAME 0 -# define GEN_EMAIL 1 -# define GEN_DNS 2 -# define GEN_X400 3 -# define GEN_DIRNAME 4 -# define GEN_EDIPARTY 5 -# define GEN_URI 6 -# define GEN_IPADD 7 -# define GEN_RID 8 - int type; - union { - char *ptr; - OTHERNAME *otherName; /* otherName */ - ASN1_IA5STRING *rfc822Name; - ASN1_IA5STRING *dNSName; - ASN1_TYPE *x400Address; - X509_NAME *directoryName; - EDIPARTYNAME *ediPartyName; - ASN1_IA5STRING *uniformResourceIdentifier; - ASN1_OCTET_STRING *iPAddress; - ASN1_OBJECT *registeredID; - /* Old names */ - ASN1_OCTET_STRING *ip; /* iPAddress */ - X509_NAME *dirn; /* dirn */ - ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, - * uniformResourceIdentifier */ - ASN1_OBJECT *rid; /* registeredID */ - ASN1_TYPE *other; /* x400Address */ - } d; -} GENERAL_NAME; - -typedef struct ACCESS_DESCRIPTION_st { - ASN1_OBJECT *method; - GENERAL_NAME *location; -} ACCESS_DESCRIPTION; - -typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; - -typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; - -typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; - -DEFINE_STACK_OF(GENERAL_NAME) -typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; -DEFINE_STACK_OF(GENERAL_NAMES) - -DEFINE_STACK_OF(ACCESS_DESCRIPTION) - -typedef struct DIST_POINT_NAME_st { - int type; - union { - GENERAL_NAMES *fullname; - STACK_OF(X509_NAME_ENTRY) *relativename; - } name; -/* If relativename then this contains the full distribution point name */ - X509_NAME *dpname; -} DIST_POINT_NAME; -/* All existing reasons */ -# define CRLDP_ALL_REASONS 0x807f - -# define CRL_REASON_NONE -1 -# define CRL_REASON_UNSPECIFIED 0 -# define CRL_REASON_KEY_COMPROMISE 1 -# define CRL_REASON_CA_COMPROMISE 2 -# define CRL_REASON_AFFILIATION_CHANGED 3 -# define CRL_REASON_SUPERSEDED 4 -# define CRL_REASON_CESSATION_OF_OPERATION 5 -# define CRL_REASON_CERTIFICATE_HOLD 6 -# define CRL_REASON_REMOVE_FROM_CRL 8 -# define CRL_REASON_PRIVILEGE_WITHDRAWN 9 -# define CRL_REASON_AA_COMPROMISE 10 - -struct DIST_POINT_st { - DIST_POINT_NAME *distpoint; - ASN1_BIT_STRING *reasons; - GENERAL_NAMES *CRLissuer; - int dp_reasons; -}; - -typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; - -DEFINE_STACK_OF(DIST_POINT) - -struct AUTHORITY_KEYID_st { - ASN1_OCTET_STRING *keyid; - GENERAL_NAMES *issuer; - ASN1_INTEGER *serial; -}; - -/* Strong extranet structures */ - -typedef struct SXNET_ID_st { - ASN1_INTEGER *zone; - ASN1_OCTET_STRING *user; -} SXNETID; - -DEFINE_STACK_OF(SXNETID) - -typedef struct SXNET_st { - ASN1_INTEGER *version; - STACK_OF(SXNETID) *ids; -} SXNET; - -typedef struct NOTICEREF_st { - ASN1_STRING *organization; - STACK_OF(ASN1_INTEGER) *noticenos; -} NOTICEREF; - -typedef struct USERNOTICE_st { - NOTICEREF *noticeref; - ASN1_STRING *exptext; -} USERNOTICE; - -typedef struct POLICYQUALINFO_st { - ASN1_OBJECT *pqualid; - union { - ASN1_IA5STRING *cpsuri; - USERNOTICE *usernotice; - ASN1_TYPE *other; - } d; -} POLICYQUALINFO; - -DEFINE_STACK_OF(POLICYQUALINFO) - -typedef struct POLICYINFO_st { - ASN1_OBJECT *policyid; - STACK_OF(POLICYQUALINFO) *qualifiers; -} POLICYINFO; - -typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; - -DEFINE_STACK_OF(POLICYINFO) - -typedef struct POLICY_MAPPING_st { - ASN1_OBJECT *issuerDomainPolicy; - ASN1_OBJECT *subjectDomainPolicy; -} POLICY_MAPPING; - -DEFINE_STACK_OF(POLICY_MAPPING) - -typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; - -typedef struct GENERAL_SUBTREE_st { - GENERAL_NAME *base; - ASN1_INTEGER *minimum; - ASN1_INTEGER *maximum; -} GENERAL_SUBTREE; - -DEFINE_STACK_OF(GENERAL_SUBTREE) - -struct NAME_CONSTRAINTS_st { - STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; - STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; -}; - -typedef struct POLICY_CONSTRAINTS_st { - ASN1_INTEGER *requireExplicitPolicy; - ASN1_INTEGER *inhibitPolicyMapping; -} POLICY_CONSTRAINTS; - -/* Proxy certificate structures, see RFC 3820 */ -typedef struct PROXY_POLICY_st { - ASN1_OBJECT *policyLanguage; - ASN1_OCTET_STRING *policy; -} PROXY_POLICY; - -typedef struct PROXY_CERT_INFO_EXTENSION_st { - ASN1_INTEGER *pcPathLengthConstraint; - PROXY_POLICY *proxyPolicy; -} PROXY_CERT_INFO_EXTENSION; - -DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) -DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) - -struct ISSUING_DIST_POINT_st { - DIST_POINT_NAME *distpoint; - int onlyuser; - int onlyCA; - ASN1_BIT_STRING *onlysomereasons; - int indirectCRL; - int onlyattr; -}; - -/* Values in idp_flags field */ -/* IDP present */ -# define IDP_PRESENT 0x1 -/* IDP values inconsistent */ -# define IDP_INVALID 0x2 -/* onlyuser true */ -# define IDP_ONLYUSER 0x4 -/* onlyCA true */ -# define IDP_ONLYCA 0x8 -/* onlyattr true */ -# define IDP_ONLYATTR 0x10 -/* indirectCRL true */ -# define IDP_INDIRECT 0x20 -/* onlysomereasons present */ -# define IDP_REASONS 0x40 - -# define X509V3_conf_err(val) ERR_add_error_data(6, \ - "section:", (val)->section, \ - ",name:", (val)->name, ",value:", (val)->value) - -# define X509V3_set_ctx_test(ctx) \ - X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) -# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; - -# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ - 0,0,0,0, \ - 0,0, \ - (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ - (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ - NULL, NULL, \ - table} - -# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ - 0,0,0,0, \ - (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ - (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ - 0,0,0,0, \ - NULL} - -# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - -/* X509_PURPOSE stuff */ - -# define EXFLAG_BCONS 0x1 -# define EXFLAG_KUSAGE 0x2 -# define EXFLAG_XKUSAGE 0x4 -# define EXFLAG_NSCERT 0x8 - -# define EXFLAG_CA 0x10 -/* Really self issued not necessarily self signed */ -# define EXFLAG_SI 0x20 -# define EXFLAG_V1 0x40 -# define EXFLAG_INVALID 0x80 -/* EXFLAG_SET is set to indicate that some values have been precomputed */ -# define EXFLAG_SET 0x100 -# define EXFLAG_CRITICAL 0x200 -# define EXFLAG_PROXY 0x400 - -# define EXFLAG_INVALID_POLICY 0x800 -# define EXFLAG_FRESHEST 0x1000 -/* Self signed */ -# define EXFLAG_SS 0x2000 - -# define KU_DIGITAL_SIGNATURE 0x0080 -# define KU_NON_REPUDIATION 0x0040 -# define KU_KEY_ENCIPHERMENT 0x0020 -# define KU_DATA_ENCIPHERMENT 0x0010 -# define KU_KEY_AGREEMENT 0x0008 -# define KU_KEY_CERT_SIGN 0x0004 -# define KU_CRL_SIGN 0x0002 -# define KU_ENCIPHER_ONLY 0x0001 -# define KU_DECIPHER_ONLY 0x8000 - -# define NS_SSL_CLIENT 0x80 -# define NS_SSL_SERVER 0x40 -# define NS_SMIME 0x20 -# define NS_OBJSIGN 0x10 -# define NS_SSL_CA 0x04 -# define NS_SMIME_CA 0x02 -# define NS_OBJSIGN_CA 0x01 -# define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) - -# define XKU_SSL_SERVER 0x1 -# define XKU_SSL_CLIENT 0x2 -# define XKU_SMIME 0x4 -# define XKU_CODE_SIGN 0x8 -# define XKU_SGC 0x10 -# define XKU_OCSP_SIGN 0x20 -# define XKU_TIMESTAMP 0x40 -# define XKU_DVCS 0x80 -# define XKU_ANYEKU 0x100 - -# define X509_PURPOSE_DYNAMIC 0x1 -# define X509_PURPOSE_DYNAMIC_NAME 0x2 - -typedef struct x509_purpose_st { - int purpose; - int trust; /* Default trust ID */ - int flags; - int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); - char *name; - char *sname; - void *usr_data; -} X509_PURPOSE; - -# define X509_PURPOSE_SSL_CLIENT 1 -# define X509_PURPOSE_SSL_SERVER 2 -# define X509_PURPOSE_NS_SSL_SERVER 3 -# define X509_PURPOSE_SMIME_SIGN 4 -# define X509_PURPOSE_SMIME_ENCRYPT 5 -# define X509_PURPOSE_CRL_SIGN 6 -# define X509_PURPOSE_ANY 7 -# define X509_PURPOSE_OCSP_HELPER 8 -# define X509_PURPOSE_TIMESTAMP_SIGN 9 - -# define X509_PURPOSE_MIN 1 -# define X509_PURPOSE_MAX 9 - -/* Flags for X509V3_EXT_print() */ - -# define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) -/* Return error for unknown extensions */ -# define X509V3_EXT_DEFAULT 0 -/* Print error for unknown extensions */ -# define X509V3_EXT_ERROR_UNKNOWN (1L << 16) -/* ASN1 parse unknown extensions */ -# define X509V3_EXT_PARSE_UNKNOWN (2L << 16) -/* BIO_dump unknown extensions */ -# define X509V3_EXT_DUMP_UNKNOWN (3L << 16) - -/* Flags for X509V3_add1_i2d */ - -# define X509V3_ADD_OP_MASK 0xfL -# define X509V3_ADD_DEFAULT 0L -# define X509V3_ADD_APPEND 1L -# define X509V3_ADD_REPLACE 2L -# define X509V3_ADD_REPLACE_EXISTING 3L -# define X509V3_ADD_KEEP_EXISTING 4L -# define X509V3_ADD_DELETE 5L -# define X509V3_ADD_SILENT 0x10 - -DEFINE_STACK_OF(X509_PURPOSE) - -DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) - -DECLARE_ASN1_FUNCTIONS(SXNET) -DECLARE_ASN1_FUNCTIONS(SXNETID) - -int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); -int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, - int userlen); -int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, - int userlen); - -ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); -ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); -ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); - -DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) - -DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) - -DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) -GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); -int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); - -ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, - STACK_OF(CONF_VALUE) *nval); -STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, - ASN1_BIT_STRING *bits, - STACK_OF(CONF_VALUE) *extlist); -char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); -ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, const char *str); - -STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, - GENERAL_NAME *gen, - STACK_OF(CONF_VALUE) *ret); -int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); - -DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) - -STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, - GENERAL_NAMES *gen, - STACK_OF(CONF_VALUE) *extlist); -GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); - -DECLARE_ASN1_FUNCTIONS(OTHERNAME) -DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) -int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); -void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); -void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); -int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, - ASN1_OBJECT *oid, ASN1_TYPE *value); -int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, - ASN1_OBJECT **poid, ASN1_TYPE **pvalue); - -char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, - const ASN1_OCTET_STRING *ia5); -ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, const char *str); - -DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) -int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); - -DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) - -DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) -DECLARE_ASN1_FUNCTIONS(POLICYINFO) -DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) -DECLARE_ASN1_FUNCTIONS(USERNOTICE) -DECLARE_ASN1_FUNCTIONS(NOTICEREF) - -DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) -DECLARE_ASN1_FUNCTIONS(DIST_POINT) -DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) -DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) - -int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); - -int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); -int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); - -DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) -DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) - -DECLARE_ASN1_ITEM(POLICY_MAPPING) -DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) -DECLARE_ASN1_ITEM(POLICY_MAPPINGS) - -DECLARE_ASN1_ITEM(GENERAL_SUBTREE) -DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) - -DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) -DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) - -DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) -DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) - -GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, - const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, int gen_type, - const char *value, int is_nc); - -# ifdef HEADER_CONF_H -GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, CONF_VALUE *cnf); -GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, - const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, CONF_VALUE *cnf, - int is_nc); -void X509V3_conf_free(CONF_VALUE *val); - -X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, - const char *value); -X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, - const char *value); -int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, - STACK_OF(X509_EXTENSION) **sk); -int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509 *cert); -int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509_REQ *req); -int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509_CRL *crl); - -X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, - X509V3_CTX *ctx, int ext_nid, - const char *value); -X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *name, const char *value); -int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509 *cert); -int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509_REQ *req); -int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509_CRL *crl); - -int X509V3_add_value_bool_nf(const char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); -int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); -void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); -void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); -# endif - -char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); -STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); -void X509V3_string_free(X509V3_CTX *ctx, char *str); -void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); -void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, - X509_REQ *req, X509_CRL *crl, int flags); - -int X509V3_add_value(const char *name, const char *value, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_uchar(const char *name, const unsigned char *value, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_bool(const char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, - STACK_OF(CONF_VALUE) **extlist); -char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); -ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); -char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); -char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, - const ASN1_ENUMERATED *aint); -int X509V3_EXT_add(X509V3_EXT_METHOD *ext); -int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); -int X509V3_EXT_add_alias(int nid_to, int nid_from); -void X509V3_EXT_cleanup(void); - -const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); -const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); -int X509V3_add_standard_extensions(void); -STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); -void *X509V3_EXT_d2i(X509_EXTENSION *ext); -void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, - int *idx); - -X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); -int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, - int crit, unsigned long flags); - -#if OPENSSL_API_COMPAT < 0x10100000L -/* The new declarations are in crypto.h, but the old ones were here. */ -# define hex_to_string OPENSSL_buf2hexstr -# define string_to_hex OPENSSL_hexstr2buf -#endif - -void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, - int ml); -int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, - int indent); -#ifndef OPENSSL_NO_STDIO -int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); -#endif -int X509V3_extensions_print(BIO *out, const char *title, - const STACK_OF(X509_EXTENSION) *exts, - unsigned long flag, int indent); - -int X509_check_ca(X509 *x); -int X509_check_purpose(X509 *x, int id, int ca); -int X509_supported_extension(X509_EXTENSION *ex); -int X509_PURPOSE_set(int *p, int purpose); -int X509_check_issued(X509 *issuer, X509 *subject); -int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); -void X509_set_proxy_flag(X509 *x); -void X509_set_proxy_pathlen(X509 *x, long l); -long X509_get_proxy_pathlen(X509 *x); - -uint32_t X509_get_extension_flags(X509 *x); -uint32_t X509_get_key_usage(X509 *x); -uint32_t X509_get_extended_key_usage(X509 *x); -const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); -const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); -const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); -const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); - -int X509_PURPOSE_get_count(void); -X509_PURPOSE *X509_PURPOSE_get0(int idx); -int X509_PURPOSE_get_by_sname(const char *sname); -int X509_PURPOSE_get_by_id(int id); -int X509_PURPOSE_add(int id, int trust, int flags, - int (*ck) (const X509_PURPOSE *, const X509 *, int), - const char *name, const char *sname, void *arg); -char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); -char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); -int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); -void X509_PURPOSE_cleanup(void); -int X509_PURPOSE_get_id(const X509_PURPOSE *); - -STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); -STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); -void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); -STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); -/* Flags for X509_check_* functions */ - -/* - * Always check subject name for host match even if subject alt names present - */ -# define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 -/* Disable wildcard matching for dnsName fields and common name. */ -# define X509_CHECK_FLAG_NO_WILDCARDS 0x2 -/* Wildcards must not match a partial label. */ -# define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 -/* Allow (non-partial) wildcards to match multiple labels. */ -# define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 -/* Constraint verifier subdomain patterns to match a single labels. */ -# define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 -/* Never check the subject CN */ -# define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 -/* - * Match reference identifiers starting with "." to any sub-domain. - * This is a non-public flag, turned on implicitly when the subject - * reference identity is a DNS name. - */ -# define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 - -int X509_check_host(X509 *x, const char *chk, size_t chklen, - unsigned int flags, char **peername); -int X509_check_email(X509 *x, const char *chk, size_t chklen, - unsigned int flags); -int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags); -int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); - -ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); -ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); -int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, - unsigned long chtype); - -void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); -DEFINE_STACK_OF(X509_POLICY_NODE) - -#ifndef OPENSSL_NO_RFC3779 -typedef struct ASRange_st { - ASN1_INTEGER *min, *max; -} ASRange; - -# define ASIdOrRange_id 0 -# define ASIdOrRange_range 1 - -typedef struct ASIdOrRange_st { - int type; - union { - ASN1_INTEGER *id; - ASRange *range; - } u; -} ASIdOrRange; - -typedef STACK_OF(ASIdOrRange) ASIdOrRanges; -DEFINE_STACK_OF(ASIdOrRange) - -# define ASIdentifierChoice_inherit 0 -# define ASIdentifierChoice_asIdsOrRanges 1 - -typedef struct ASIdentifierChoice_st { - int type; - union { - ASN1_NULL *inherit; - ASIdOrRanges *asIdsOrRanges; - } u; -} ASIdentifierChoice; - -typedef struct ASIdentifiers_st { - ASIdentifierChoice *asnum, *rdi; -} ASIdentifiers; - -DECLARE_ASN1_FUNCTIONS(ASRange) -DECLARE_ASN1_FUNCTIONS(ASIdOrRange) -DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) -DECLARE_ASN1_FUNCTIONS(ASIdentifiers) - -typedef struct IPAddressRange_st { - ASN1_BIT_STRING *min, *max; -} IPAddressRange; - -# define IPAddressOrRange_addressPrefix 0 -# define IPAddressOrRange_addressRange 1 - -typedef struct IPAddressOrRange_st { - int type; - union { - ASN1_BIT_STRING *addressPrefix; - IPAddressRange *addressRange; - } u; -} IPAddressOrRange; - -typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; -DEFINE_STACK_OF(IPAddressOrRange) - -# define IPAddressChoice_inherit 0 -# define IPAddressChoice_addressesOrRanges 1 - -typedef struct IPAddressChoice_st { - int type; - union { - ASN1_NULL *inherit; - IPAddressOrRanges *addressesOrRanges; - } u; -} IPAddressChoice; - -typedef struct IPAddressFamily_st { - ASN1_OCTET_STRING *addressFamily; - IPAddressChoice *ipAddressChoice; -} IPAddressFamily; - -typedef STACK_OF(IPAddressFamily) IPAddrBlocks; -DEFINE_STACK_OF(IPAddressFamily) - -DECLARE_ASN1_FUNCTIONS(IPAddressRange) -DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) -DECLARE_ASN1_FUNCTIONS(IPAddressChoice) -DECLARE_ASN1_FUNCTIONS(IPAddressFamily) - -/* - * API tag for elements of the ASIdentifer SEQUENCE. - */ -# define V3_ASID_ASNUM 0 -# define V3_ASID_RDI 1 - -/* - * AFI values, assigned by IANA. It'd be nice to make the AFI - * handling code totally generic, but there are too many little things - * that would need to be defined for other address families for it to - * be worth the trouble. - */ -# define IANA_AFI_IPV4 1 -# define IANA_AFI_IPV6 2 - -/* - * Utilities to construct and extract values from RFC3779 extensions, - * since some of the encodings (particularly for IP address prefixes - * and ranges) are a bit tedious to work with directly. - */ -int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); -int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, - ASN1_INTEGER *min, ASN1_INTEGER *max); -int X509v3_addr_add_inherit(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi); -int X509v3_addr_add_prefix(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi, - unsigned char *a, const int prefixlen); -int X509v3_addr_add_range(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi, - unsigned char *min, unsigned char *max); -unsigned X509v3_addr_get_afi(const IPAddressFamily *f); -int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, - unsigned char *min, unsigned char *max, - const int length); - -/* - * Canonical forms. - */ -int X509v3_asid_is_canonical(ASIdentifiers *asid); -int X509v3_addr_is_canonical(IPAddrBlocks *addr); -int X509v3_asid_canonize(ASIdentifiers *asid); -int X509v3_addr_canonize(IPAddrBlocks *addr); - -/* - * Tests for inheritance and containment. - */ -int X509v3_asid_inherits(ASIdentifiers *asid); -int X509v3_addr_inherits(IPAddrBlocks *addr); -int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); -int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); - -/* - * Check whether RFC 3779 extensions nest properly in chains. - */ -int X509v3_asid_validate_path(X509_STORE_CTX *); -int X509v3_addr_validate_path(X509_STORE_CTX *); -int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, - ASIdentifiers *ext, - int allow_inheritance); -int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, - IPAddrBlocks *ext, int allow_inheritance); - -#endif /* OPENSSL_NO_RFC3779 */ - -DEFINE_STACK_OF(ASN1_STRING) - -/* - * Admission Syntax - */ -typedef struct NamingAuthority_st NAMING_AUTHORITY; -typedef struct ProfessionInfo_st PROFESSION_INFO; -typedef struct Admissions_st ADMISSIONS; -typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; -DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) -DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) -DECLARE_ASN1_FUNCTIONS(ADMISSIONS) -DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) -DEFINE_STACK_OF(ADMISSIONS) -DEFINE_STACK_OF(PROFESSION_INFO) -typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; - -const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( - const NAMING_AUTHORITY *n); -const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( - const NAMING_AUTHORITY *n); -const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( - const NAMING_AUTHORITY *n); -void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, - ASN1_OBJECT* namingAuthorityId); -void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, - ASN1_IA5STRING* namingAuthorityUrl); -void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, - ASN1_STRING* namingAuthorityText); - -const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( - const ADMISSION_SYNTAX *as); -void ADMISSION_SYNTAX_set0_admissionAuthority( - ADMISSION_SYNTAX *as, GENERAL_NAME *aa); -const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( - const ADMISSION_SYNTAX *as); -void ADMISSION_SYNTAX_set0_contentsOfAdmissions( - ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); -const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); -void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); -const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); -void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); -const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); -void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); -const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_addProfessionInfo( - PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); -const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_namingAuthority( - PROFESSION_INFO *pi, NAMING_AUTHORITY *na); -const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_professionItems( - PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); -const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_professionOIDs( - PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); -const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_registrationNumber( - PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509v3err.h b/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509v3err.h deleted file mode 100644 index 5f25442f..00000000 --- a/Hin2n/src/main/jniLibs/arm64-v8a/include/openssl/x509v3err.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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_X509V3ERR_H -# define HEADER_X509V3ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_X509V3_strings(void); - -/* - * X509V3 function codes. - */ -# define X509V3_F_A2I_GENERAL_NAME 164 -# define X509V3_F_ADDR_VALIDATE_PATH_INTERNAL 166 -# define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 -# define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 -# define X509V3_F_BIGNUM_TO_STRING 167 -# define X509V3_F_COPY_EMAIL 122 -# define X509V3_F_COPY_ISSUER 123 -# define X509V3_F_DO_DIRNAME 144 -# define X509V3_F_DO_EXT_I2D 135 -# define X509V3_F_DO_EXT_NCONF 151 -# define X509V3_F_GNAMES_FROM_SECTNAME 156 -# define X509V3_F_I2S_ASN1_ENUMERATED 121 -# define X509V3_F_I2S_ASN1_IA5STRING 149 -# define X509V3_F_I2S_ASN1_INTEGER 120 -# define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 -# define X509V3_F_LEVEL_ADD_NODE 168 -# define X509V3_F_NOTICE_SECTION 132 -# define X509V3_F_NREF_NOS 133 -# define X509V3_F_POLICY_CACHE_CREATE 169 -# define X509V3_F_POLICY_CACHE_NEW 170 -# define X509V3_F_POLICY_DATA_NEW 171 -# define X509V3_F_POLICY_SECTION 131 -# define X509V3_F_PROCESS_PCI_VALUE 150 -# define X509V3_F_R2I_CERTPOL 130 -# define X509V3_F_R2I_PCI 155 -# define X509V3_F_S2I_ASN1_IA5STRING 100 -# define X509V3_F_S2I_ASN1_INTEGER 108 -# define X509V3_F_S2I_ASN1_OCTET_STRING 112 -# define X509V3_F_S2I_SKEY_ID 115 -# define X509V3_F_SET_DIST_POINT_NAME 158 -# define X509V3_F_SXNET_ADD_ID_ASC 125 -# define X509V3_F_SXNET_ADD_ID_INTEGER 126 -# define X509V3_F_SXNET_ADD_ID_ULONG 127 -# define X509V3_F_SXNET_GET_ID_ASC 128 -# define X509V3_F_SXNET_GET_ID_ULONG 129 -# define X509V3_F_TREE_INIT 172 -# define X509V3_F_V2I_ASIDENTIFIERS 163 -# define X509V3_F_V2I_ASN1_BIT_STRING 101 -# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 -# define X509V3_F_V2I_AUTHORITY_KEYID 119 -# define X509V3_F_V2I_BASIC_CONSTRAINTS 102 -# define X509V3_F_V2I_CRLD 134 -# define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 -# define X509V3_F_V2I_GENERAL_NAMES 118 -# define X509V3_F_V2I_GENERAL_NAME_EX 117 -# define X509V3_F_V2I_IDP 157 -# define X509V3_F_V2I_IPADDRBLOCKS 159 -# define X509V3_F_V2I_ISSUER_ALT 153 -# define X509V3_F_V2I_NAME_CONSTRAINTS 147 -# define X509V3_F_V2I_POLICY_CONSTRAINTS 146 -# define X509V3_F_V2I_POLICY_MAPPINGS 145 -# define X509V3_F_V2I_SUBJECT_ALT 154 -# define X509V3_F_V2I_TLS_FEATURE 165 -# define X509V3_F_V3_GENERIC_EXTENSION 116 -# define X509V3_F_X509V3_ADD1_I2D 140 -# define X509V3_F_X509V3_ADD_VALUE 105 -# define X509V3_F_X509V3_EXT_ADD 104 -# define X509V3_F_X509V3_EXT_ADD_ALIAS 106 -# define X509V3_F_X509V3_EXT_I2D 136 -# define X509V3_F_X509V3_EXT_NCONF 152 -# define X509V3_F_X509V3_GET_SECTION 142 -# define X509V3_F_X509V3_GET_STRING 143 -# define X509V3_F_X509V3_GET_VALUE_BOOL 110 -# define X509V3_F_X509V3_PARSE_LIST 109 -# define X509V3_F_X509_PURPOSE_ADD 137 -# define X509V3_F_X509_PURPOSE_SET 141 - -/* - * X509V3 reason codes. - */ -# define X509V3_R_BAD_IP_ADDRESS 118 -# define X509V3_R_BAD_OBJECT 119 -# define X509V3_R_BN_DEC2BN_ERROR 100 -# define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 -# define X509V3_R_DIRNAME_ERROR 149 -# define X509V3_R_DISTPOINT_ALREADY_SET 160 -# define X509V3_R_DUPLICATE_ZONE_ID 133 -# define X509V3_R_ERROR_CONVERTING_ZONE 131 -# define X509V3_R_ERROR_CREATING_EXTENSION 144 -# define X509V3_R_ERROR_IN_EXTENSION 128 -# define X509V3_R_EXPECTED_A_SECTION_NAME 137 -# define X509V3_R_EXTENSION_EXISTS 145 -# define X509V3_R_EXTENSION_NAME_ERROR 115 -# define X509V3_R_EXTENSION_NOT_FOUND 102 -# define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 -# define X509V3_R_EXTENSION_VALUE_ERROR 116 -# define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 -# define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 -# define X509V3_R_INVALID_ASNUMBER 162 -# define X509V3_R_INVALID_ASRANGE 163 -# define X509V3_R_INVALID_BOOLEAN_STRING 104 -# define X509V3_R_INVALID_EXTENSION_STRING 105 -# define X509V3_R_INVALID_INHERITANCE 165 -# define X509V3_R_INVALID_IPADDRESS 166 -# define X509V3_R_INVALID_MULTIPLE_RDNS 161 -# define X509V3_R_INVALID_NAME 106 -# define X509V3_R_INVALID_NULL_ARGUMENT 107 -# define X509V3_R_INVALID_NULL_NAME 108 -# define X509V3_R_INVALID_NULL_VALUE 109 -# define X509V3_R_INVALID_NUMBER 140 -# define X509V3_R_INVALID_NUMBERS 141 -# define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 -# define X509V3_R_INVALID_OPTION 138 -# define X509V3_R_INVALID_POLICY_IDENTIFIER 134 -# define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 -# define X509V3_R_INVALID_PURPOSE 146 -# define X509V3_R_INVALID_SAFI 164 -# define X509V3_R_INVALID_SECTION 135 -# define X509V3_R_INVALID_SYNTAX 143 -# define X509V3_R_ISSUER_DECODE_ERROR 126 -# define X509V3_R_MISSING_VALUE 124 -# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 -# define X509V3_R_NO_CONFIG_DATABASE 136 -# define X509V3_R_NO_ISSUER_CERTIFICATE 121 -# define X509V3_R_NO_ISSUER_DETAILS 127 -# define X509V3_R_NO_POLICY_IDENTIFIER 139 -# define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 -# define X509V3_R_NO_PUBLIC_KEY 114 -# define X509V3_R_NO_SUBJECT_DETAILS 125 -# define X509V3_R_OPERATION_NOT_DEFINED 148 -# define X509V3_R_OTHERNAME_ERROR 147 -# define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 -# define X509V3_R_POLICY_PATH_LENGTH 156 -# define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 -# define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 -# define X509V3_R_SECTION_NOT_FOUND 150 -# define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 -# define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 -# define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 -# define X509V3_R_UNKNOWN_EXTENSION 129 -# define X509V3_R_UNKNOWN_EXTENSION_NAME 130 -# define X509V3_R_UNKNOWN_OPTION 120 -# define X509V3_R_UNSUPPORTED_OPTION 117 -# define X509V3_R_UNSUPPORTED_TYPE 167 -# define X509V3_R_USER_TOO_LONG 132 - -#endif diff --git a/Hin2n/src/main/jniLibs/arm64-v8a/libcrypto.so b/Hin2n/src/main/jniLibs/arm64-v8a/libcrypto.so deleted file mode 100644 index 6df75a0b..00000000 Binary files a/Hin2n/src/main/jniLibs/arm64-v8a/libcrypto.so and /dev/null differ diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/aes.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/aes.h deleted file mode 100644 index 245c552a..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/aes.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_AES_H -# define HEADER_AES_H - -# include - -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define AES_ENCRYPT 1 -# define AES_DECRYPT 0 - -/* - * Because array size can't be a const in C, the following two are macros. - * Both sizes are in bytes. - */ -# define AES_MAXNR 14 -# define AES_BLOCK_SIZE 16 - -/* This should be a hidden type, but EVP requires that the size be known */ -struct aes_key_st { -# ifdef AES_LONG - unsigned long rd_key[4 * (AES_MAXNR + 1)]; -# else - unsigned int rd_key[4 * (AES_MAXNR + 1)]; -# endif - int rounds; -}; -typedef struct aes_key_st AES_KEY; - -const char *AES_options(void); - -int AES_set_encrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); -int AES_set_decrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); - -void AES_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); -void AES_decrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); - -void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key, const int enc); -void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, const int enc); -void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num); -/* NB: the IV is _two_ blocks long */ -void AES_ige_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, const int enc); -/* NB: the IV is _four_ blocks long */ -void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - const AES_KEY *key2, const unsigned char *ivec, - const int enc); - -int AES_wrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); -int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); - - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1.h deleted file mode 100644 index 9522eec1..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1.h +++ /dev/null @@ -1,886 +0,0 @@ -/* - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_ASN1_H -# define HEADER_ASN1_H - -# include -# include -# include -# include -# include -# include -# include - -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -# define V_ASN1_UNIVERSAL 0x00 -# define V_ASN1_APPLICATION 0x40 -# define V_ASN1_CONTEXT_SPECIFIC 0x80 -# define V_ASN1_PRIVATE 0xc0 - -# define V_ASN1_CONSTRUCTED 0x20 -# define V_ASN1_PRIMITIVE_TAG 0x1f -# define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG - -# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */ -# define V_ASN1_OTHER -3/* used in ASN1_TYPE */ -# define V_ASN1_ANY -4/* used in ASN1 template code */ - -# define V_ASN1_UNDEF -1 -/* ASN.1 tag values */ -# define V_ASN1_EOC 0 -# define V_ASN1_BOOLEAN 1 /**/ -# define V_ASN1_INTEGER 2 -# define V_ASN1_BIT_STRING 3 -# define V_ASN1_OCTET_STRING 4 -# define V_ASN1_NULL 5 -# define V_ASN1_OBJECT 6 -# define V_ASN1_OBJECT_DESCRIPTOR 7 -# define V_ASN1_EXTERNAL 8 -# define V_ASN1_REAL 9 -# define V_ASN1_ENUMERATED 10 -# define V_ASN1_UTF8STRING 12 -# define V_ASN1_SEQUENCE 16 -# define V_ASN1_SET 17 -# define V_ASN1_NUMERICSTRING 18 /**/ -# define V_ASN1_PRINTABLESTRING 19 -# define V_ASN1_T61STRING 20 -# define V_ASN1_TELETEXSTRING 20/* alias */ -# define V_ASN1_VIDEOTEXSTRING 21 /**/ -# define V_ASN1_IA5STRING 22 -# define V_ASN1_UTCTIME 23 -# define V_ASN1_GENERALIZEDTIME 24 /**/ -# define V_ASN1_GRAPHICSTRING 25 /**/ -# define V_ASN1_ISO64STRING 26 /**/ -# define V_ASN1_VISIBLESTRING 26/* alias */ -# define V_ASN1_GENERALSTRING 27 /**/ -# define V_ASN1_UNIVERSALSTRING 28 /**/ -# define V_ASN1_BMPSTRING 30 - -/* - * NB the constants below are used internally by ASN1_INTEGER - * and ASN1_ENUMERATED to indicate the sign. They are *not* on - * the wire tag values. - */ - -# define V_ASN1_NEG 0x100 -# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) -# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) - -/* For use with d2i_ASN1_type_bytes() */ -# define B_ASN1_NUMERICSTRING 0x0001 -# define B_ASN1_PRINTABLESTRING 0x0002 -# define B_ASN1_T61STRING 0x0004 -# define B_ASN1_TELETEXSTRING 0x0004 -# define B_ASN1_VIDEOTEXSTRING 0x0008 -# define B_ASN1_IA5STRING 0x0010 -# define B_ASN1_GRAPHICSTRING 0x0020 -# define B_ASN1_ISO64STRING 0x0040 -# define B_ASN1_VISIBLESTRING 0x0040 -# define B_ASN1_GENERALSTRING 0x0080 -# define B_ASN1_UNIVERSALSTRING 0x0100 -# define B_ASN1_OCTET_STRING 0x0200 -# define B_ASN1_BIT_STRING 0x0400 -# define B_ASN1_BMPSTRING 0x0800 -# define B_ASN1_UNKNOWN 0x1000 -# define B_ASN1_UTF8STRING 0x2000 -# define B_ASN1_UTCTIME 0x4000 -# define B_ASN1_GENERALIZEDTIME 0x8000 -# define B_ASN1_SEQUENCE 0x10000 -/* For use with ASN1_mbstring_copy() */ -# define MBSTRING_FLAG 0x1000 -# define MBSTRING_UTF8 (MBSTRING_FLAG) -# define MBSTRING_ASC (MBSTRING_FLAG|1) -# define MBSTRING_BMP (MBSTRING_FLAG|2) -# define MBSTRING_UNIV (MBSTRING_FLAG|4) -# define SMIME_OLDMIME 0x400 -# define SMIME_CRLFEOL 0x800 -# define SMIME_STREAM 0x1000 - struct X509_algor_st; -DEFINE_STACK_OF(X509_ALGOR) - -# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */ -/* - * This indicates that the ASN1_STRING is not a real value but just a place - * holder for the location where indefinite length constructed data should be - * inserted in the memory buffer - */ -# define ASN1_STRING_FLAG_NDEF 0x010 - -/* - * This flag is used by the CMS code to indicate that a string is not - * complete and is a place holder for content when it had all been accessed. - * The flag will be reset when content has been written to it. - */ - -# define ASN1_STRING_FLAG_CONT 0x020 -/* - * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING - * type. - */ -# define ASN1_STRING_FLAG_MSTRING 0x040 -/* String is embedded and only content should be freed */ -# define ASN1_STRING_FLAG_EMBED 0x080 -/* String should be parsed in RFC 5280's time format */ -# define ASN1_STRING_FLAG_X509_TIME 0x100 -/* This is the base type that holds just about everything :-) */ -struct asn1_string_st { - int length; - int type; - unsigned char *data; - /* - * The value of the following field depends on the type being held. It - * is mostly being used for BIT_STRING so if the input data has a - * non-zero 'unused bits' value, it will be handled correctly - */ - long flags; -}; - -/* - * ASN1_ENCODING structure: this is used to save the received encoding of an - * ASN1 type. This is useful to get round problems with invalid encodings - * which can break signatures. - */ - -typedef struct ASN1_ENCODING_st { - unsigned char *enc; /* DER encoding */ - long len; /* Length of encoding */ - int modified; /* set to 1 if 'enc' is invalid */ -} ASN1_ENCODING; - -/* Used with ASN1 LONG type: if a long is set to this it is omitted */ -# define ASN1_LONG_UNDEF 0x7fffffffL - -# define STABLE_FLAGS_MALLOC 0x01 -/* - * A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted - * as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting - * STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias - * STABLE_FLAGS_CLEAR to reflect this. - */ -# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC -# define STABLE_NO_MASK 0x02 -# define DIRSTRING_TYPE \ - (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) -# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) - -typedef struct asn1_string_table_st { - int nid; - long minsize; - long maxsize; - unsigned long mask; - unsigned long flags; -} ASN1_STRING_TABLE; - -DEFINE_STACK_OF(ASN1_STRING_TABLE) - -/* size limits: this stuff is taken straight from RFC2459 */ - -# define ub_name 32768 -# define ub_common_name 64 -# define ub_locality_name 128 -# define ub_state_name 128 -# define ub_organization_name 64 -# define ub_organization_unit_name 64 -# define ub_title 64 -# define ub_email_address 128 - -/* - * Declarations for template structures: for full definitions see asn1t.h - */ -typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; -typedef struct ASN1_TLC_st ASN1_TLC; -/* This is just an opaque pointer */ -typedef struct ASN1_VALUE_st ASN1_VALUE; - -/* Declare ASN1 functions: the implement macro in in asn1t.h */ - -# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) - -# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) - -# define DECLARE_ASN1_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) - -# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) - -# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ - type *d2i_##name(type **a, const unsigned char **in, long len); \ - int i2d_##name(type *a, unsigned char **out); \ - DECLARE_ASN1_ITEM(itname) - -# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ - type *d2i_##name(type **a, const unsigned char **in, long len); \ - int i2d_##name(const type *a, unsigned char **out); \ - DECLARE_ASN1_ITEM(name) - -# define DECLARE_ASN1_NDEF_FUNCTION(name) \ - int i2d_##name##_NDEF(name *a, unsigned char **out); - -# define DECLARE_ASN1_FUNCTIONS_const(name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) - -# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - type *name##_new(void); \ - void name##_free(type *a); - -# define DECLARE_ASN1_PRINT_FUNCTION(stname) \ - DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) - -# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ - int fname##_print_ctx(BIO *out, stname *x, int indent, \ - const ASN1_PCTX *pctx); - -# define D2I_OF(type) type *(*)(type **,const unsigned char **,long) -# define I2D_OF(type) int (*)(type *,unsigned char **) -# define I2D_OF_const(type) int (*)(const type *,unsigned char **) - -# define CHECKED_D2I_OF(type, d2i) \ - ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) -# define CHECKED_I2D_OF(type, i2d) \ - ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) -# define CHECKED_NEW_OF(type, xnew) \ - ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) -# define CHECKED_PTR_OF(type, p) \ - ((void*) (1 ? p : (type*)0)) -# define CHECKED_PPTR_OF(type, p) \ - ((void**) (1 ? p : (type**)0)) - -# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) -# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) -# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) - -TYPEDEF_D2I2D_OF(void); - -/*- - * The following macros and typedefs allow an ASN1_ITEM - * to be embedded in a structure and referenced. Since - * the ASN1_ITEM pointers need to be globally accessible - * (possibly from shared libraries) they may exist in - * different forms. On platforms that support it the - * ASN1_ITEM structure itself will be globally exported. - * Other platforms will export a function that returns - * an ASN1_ITEM pointer. - * - * To handle both cases transparently the macros below - * should be used instead of hard coding an ASN1_ITEM - * pointer in a structure. - * - * The structure will look like this: - * - * typedef struct SOMETHING_st { - * ... - * ASN1_ITEM_EXP *iptr; - * ... - * } SOMETHING; - * - * It would be initialised as e.g.: - * - * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; - * - * and the actual pointer extracted with: - * - * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); - * - * Finally an ASN1_ITEM pointer can be extracted from an - * appropriate reference with: ASN1_ITEM_rptr(X509). This - * would be used when a function takes an ASN1_ITEM * argument. - * - */ - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM ASN1_ITEM_EXP; - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -# define ASN1_ITEM_ptr(iptr) (iptr) - -/* Macro to include ASN1_ITEM pointer from base type */ -# define ASN1_ITEM_ref(iptr) (&(iptr##_it)) - -# define ASN1_ITEM_rptr(ref) (&(ref##_it)) - -# define DECLARE_ASN1_ITEM(name) \ - OPENSSL_EXTERN const ASN1_ITEM name##_it; - -# else - -/* - * Platforms that can't easily handle shared global variables are declared as - * functions returning ASN1_ITEM pointers. - */ - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM *ASN1_ITEM_EXP (void); - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -# define ASN1_ITEM_ptr(iptr) (iptr()) - -/* Macro to include ASN1_ITEM pointer from base type */ -# define ASN1_ITEM_ref(iptr) (iptr##_it) - -# define ASN1_ITEM_rptr(ref) (ref##_it()) - -# define DECLARE_ASN1_ITEM(name) \ - const ASN1_ITEM * name##_it(void); - -# endif - -/* Parameters used by ASN1_STRING_print_ex() */ - -/* - * These determine which characters to escape: RFC2253 special characters, - * control characters and MSB set characters - */ - -# define ASN1_STRFLGS_ESC_2253 1 -# define ASN1_STRFLGS_ESC_CTRL 2 -# define ASN1_STRFLGS_ESC_MSB 4 - -/* - * This flag determines how we do escaping: normally RC2253 backslash only, - * set this to use backslash and quote. - */ - -# define ASN1_STRFLGS_ESC_QUOTE 8 - -/* These three flags are internal use only. */ - -/* Character is a valid PrintableString character */ -# define CHARTYPE_PRINTABLESTRING 0x10 -/* Character needs escaping if it is the first character */ -# define CHARTYPE_FIRST_ESC_2253 0x20 -/* Character needs escaping if it is the last character */ -# define CHARTYPE_LAST_ESC_2253 0x40 - -/* - * NB the internal flags are safely reused below by flags handled at the top - * level. - */ - -/* - * If this is set we convert all character strings to UTF8 first - */ - -# define ASN1_STRFLGS_UTF8_CONVERT 0x10 - -/* - * If this is set we don't attempt to interpret content: just assume all - * strings are 1 byte per character. This will produce some pretty odd - * looking output! - */ - -# define ASN1_STRFLGS_IGNORE_TYPE 0x20 - -/* If this is set we include the string type in the output */ -# define ASN1_STRFLGS_SHOW_TYPE 0x40 - -/* - * This determines which strings to display and which to 'dump' (hex dump of - * content octets or DER encoding). We can only dump non character strings or - * everything. If we don't dump 'unknown' they are interpreted as character - * strings with 1 octet per character and are subject to the usual escaping - * options. - */ - -# define ASN1_STRFLGS_DUMP_ALL 0x80 -# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 - -/* - * These determine what 'dumping' does, we can dump the content octets or the - * DER encoding: both use the RFC2253 #XXXXX notation. - */ - -# define ASN1_STRFLGS_DUMP_DER 0x200 - -/* - * This flag specifies that RC2254 escaping shall be performed. - */ -#define ASN1_STRFLGS_ESC_2254 0x400 - -/* - * All the string flags consistent with RFC2253, escaping control characters - * isn't essential in RFC2253 but it is advisable anyway. - */ - -# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ - ASN1_STRFLGS_ESC_CTRL | \ - ASN1_STRFLGS_ESC_MSB | \ - ASN1_STRFLGS_UTF8_CONVERT | \ - ASN1_STRFLGS_DUMP_UNKNOWN | \ - ASN1_STRFLGS_DUMP_DER) - -DEFINE_STACK_OF(ASN1_INTEGER) - -DEFINE_STACK_OF(ASN1_GENERALSTRING) - -DEFINE_STACK_OF(ASN1_UTF8STRING) - -typedef struct asn1_type_st { - int type; - union { - char *ptr; - ASN1_BOOLEAN boolean; - ASN1_STRING *asn1_string; - ASN1_OBJECT *object; - ASN1_INTEGER *integer; - ASN1_ENUMERATED *enumerated; - ASN1_BIT_STRING *bit_string; - ASN1_OCTET_STRING *octet_string; - ASN1_PRINTABLESTRING *printablestring; - ASN1_T61STRING *t61string; - ASN1_IA5STRING *ia5string; - ASN1_GENERALSTRING *generalstring; - ASN1_BMPSTRING *bmpstring; - ASN1_UNIVERSALSTRING *universalstring; - ASN1_UTCTIME *utctime; - ASN1_GENERALIZEDTIME *generalizedtime; - ASN1_VISIBLESTRING *visiblestring; - ASN1_UTF8STRING *utf8string; - /* - * set and sequence are left complete and still contain the set or - * sequence bytes - */ - ASN1_STRING *set; - ASN1_STRING *sequence; - ASN1_VALUE *asn1_value; - } value; -} ASN1_TYPE; - -DEFINE_STACK_OF(ASN1_TYPE) - -typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; - -DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) -DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) - -/* This is used to contain a list of bit names */ -typedef struct BIT_STRING_BITNAME_st { - int bitnum; - const char *lname; - const char *sname; -} BIT_STRING_BITNAME; - -# define B_ASN1_TIME \ - B_ASN1_UTCTIME | \ - B_ASN1_GENERALIZEDTIME - -# define B_ASN1_PRINTABLE \ - B_ASN1_NUMERICSTRING| \ - B_ASN1_PRINTABLESTRING| \ - B_ASN1_T61STRING| \ - B_ASN1_IA5STRING| \ - B_ASN1_BIT_STRING| \ - B_ASN1_UNIVERSALSTRING|\ - B_ASN1_BMPSTRING|\ - B_ASN1_UTF8STRING|\ - B_ASN1_SEQUENCE|\ - B_ASN1_UNKNOWN - -# define B_ASN1_DIRECTORYSTRING \ - B_ASN1_PRINTABLESTRING| \ - B_ASN1_TELETEXSTRING|\ - B_ASN1_BMPSTRING|\ - B_ASN1_UNIVERSALSTRING|\ - B_ASN1_UTF8STRING - -# define B_ASN1_DISPLAYTEXT \ - B_ASN1_IA5STRING| \ - B_ASN1_VISIBLESTRING| \ - B_ASN1_BMPSTRING|\ - B_ASN1_UTF8STRING - -DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) - -int ASN1_TYPE_get(const ASN1_TYPE *a); -void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); -int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); -int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); - -ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t); -void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t); - -ASN1_OBJECT *ASN1_OBJECT_new(void); -void ASN1_OBJECT_free(ASN1_OBJECT *a); -int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp); -ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, - long length); - -DECLARE_ASN1_ITEM(ASN1_OBJECT) - -DEFINE_STACK_OF(ASN1_OBJECT) - -ASN1_STRING *ASN1_STRING_new(void); -void ASN1_STRING_free(ASN1_STRING *a); -void ASN1_STRING_clear_free(ASN1_STRING *a); -int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); -ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a); -ASN1_STRING *ASN1_STRING_type_new(int type); -int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); - /* - * Since this is used to store all sorts of things, via macros, for now, - * make its data void * - */ -int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); -void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); -int ASN1_STRING_length(const ASN1_STRING *x); -void ASN1_STRING_length_set(ASN1_STRING *x, int n); -int ASN1_STRING_type(const ASN1_STRING *x); -DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) -const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); - -DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) -int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); -int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); -int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); -int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, - const unsigned char *flags, int flags_len); - -int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, - BIT_STRING_BITNAME *tbl, int indent); -int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); -int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, - BIT_STRING_BITNAME *tbl); - -DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) -ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, - long length); -ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x); -int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); - -DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) - -int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); -ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); -ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, - int offset_day, long offset_sec); -int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); -int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); - -int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); -ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, - time_t t); -ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, - time_t t, int offset_day, - long offset_sec); -int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); - -int ASN1_TIME_diff(int *pday, int *psec, - const ASN1_TIME *from, const ASN1_TIME *to); - -DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) -ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); -int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, - const ASN1_OCTET_STRING *b); -int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, - int len); - -DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_NULL) -DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) - -int UTF8_getc(const unsigned char *str, int len, unsigned long *val); -int UTF8_putc(unsigned char *str, int len, unsigned long value); - -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) - -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) -DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) -DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) -DECLARE_ASN1_FUNCTIONS(ASN1_TIME) - -DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) - -ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); -ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, - int offset_day, long offset_sec); -int ASN1_TIME_check(const ASN1_TIME *t); -ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, - ASN1_GENERALIZEDTIME **out); -int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); -int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str); -int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm); -int ASN1_TIME_normalize(ASN1_TIME *s); -int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t); -int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b); - -int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); -int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); -int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a); -int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); -int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a); -int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); -int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type); -int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a); - -int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); -ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, - const char *sn, const char *ln); - -int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); -int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); -int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); -int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); - -int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); -long ASN1_INTEGER_get(const ASN1_INTEGER *a); -ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); -BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); - -int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); -int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); - - -int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); -long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); -ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); -BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn); - -/* General */ -/* given a string, return the correct type, max is the maximum length */ -int ASN1_PRINTABLE_type(const unsigned char *s, int max); - -unsigned long ASN1_tag2bit(int tag); - -/* SPECIALS */ -int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, - int *pclass, long omax); -int ASN1_check_infinite_end(unsigned char **p, long len); -int ASN1_const_check_infinite_end(const unsigned char **p, long len); -void ASN1_put_object(unsigned char **pp, int constructed, int length, - int tag, int xclass); -int ASN1_put_eoc(unsigned char **pp); -int ASN1_object_size(int constructed, int length, int tag); - -/* Used to implement other functions */ -void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); - -# define ASN1_dup_of(type,i2d,d2i,x) \ - ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ - CHECKED_D2I_OF(type, d2i), \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_dup_of_const(type,i2d,d2i,x) \ - ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ - CHECKED_D2I_OF(type, d2i), \ - CHECKED_PTR_OF(const type, x))) - -void *ASN1_item_dup(const ASN1_ITEM *it, void *x); - -/* ASN1 alloc/free macros for when a type is only used internally */ - -# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) -# define M_ASN1_free_of(x, type) \ - ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) - -# ifndef OPENSSL_NO_STDIO -void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x); - -# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ - ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ - CHECKED_D2I_OF(type, d2i), \ - in, \ - CHECKED_PPTR_OF(type, x))) - -void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); -int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x); - -# define ASN1_i2d_fp_of(type,i2d,out,x) \ - (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ - out, \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_i2d_fp_of_const(type,i2d,out,x) \ - (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ - out, \ - CHECKED_PTR_OF(const type, x))) - -int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); -int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); -# endif - -int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in); - -void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x); - -# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ - ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ - CHECKED_D2I_OF(type, d2i), \ - in, \ - CHECKED_PPTR_OF(type, x))) - -void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); -int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x); - -# define ASN1_i2d_bio_of(type,i2d,out,x) \ - (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ - out, \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_i2d_bio_of_const(type,i2d,out,x) \ - (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ - out, \ - CHECKED_PTR_OF(const type, x))) - -int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); -int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); -int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); -int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); -int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); -int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); -int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off); -int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, - unsigned char *buf, int off); -int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); -int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, - int dump); -const char *ASN1_tag2str(int tag); - -/* Used to load and write Netscape format cert */ - -int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); - -int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); -int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len); -int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, - unsigned char *data, int len); -int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, - unsigned char *data, int max_len); - -void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it); - -ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, - ASN1_OCTET_STRING **oct); - -void ASN1_STRING_set_default_mask(unsigned long mask); -int ASN1_STRING_set_default_mask_asc(const char *p); -unsigned long ASN1_STRING_get_default_mask(void); -int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask); -int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask, - long minsize, long maxsize); - -ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, - const unsigned char *in, int inlen, - int inform, int nid); -ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); -int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); -void ASN1_STRING_TABLE_cleanup(void); - -/* ASN1 template functions */ - -/* Old API compatible functions */ -ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); -void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); -ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, - long len, const ASN1_ITEM *it); -int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); -int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, - const ASN1_ITEM *it); - -void ASN1_add_oid_module(void); -void ASN1_add_stable_module(void); - -ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf); -ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf); -int ASN1_str2mask(const char *str, unsigned long *pmask); - -/* ASN1 Print flags */ - -/* Indicate missing OPTIONAL fields */ -# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 -/* Mark start and end of SEQUENCE */ -# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 -/* Mark start and end of SEQUENCE/SET OF */ -# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 -/* Show the ASN1 type of primitives */ -# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 -/* Don't show ASN1 type of ANY */ -# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 -/* Don't show ASN1 type of MSTRINGs */ -# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 -/* Don't show field names in SEQUENCE */ -# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 -/* Show structure names of each SEQUENCE field */ -# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 -/* Don't show structure name even at top level */ -# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 - -int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, - const ASN1_ITEM *it, const ASN1_PCTX *pctx); -ASN1_PCTX *ASN1_PCTX_new(void); -void ASN1_PCTX_free(ASN1_PCTX *p); -unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); - -ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx)); -void ASN1_SCTX_free(ASN1_SCTX *p); -const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p); -const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p); -unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); -void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); -void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); - -const BIO_METHOD *BIO_f_asn1(void); - -BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); - -int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, - const ASN1_ITEM *it); -int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, - const char *hdr, const ASN1_ITEM *it); -int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, - int ctype_nid, int econt_nid, - STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); -ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); -int SMIME_crlf_copy(BIO *in, BIO *out, int flags); -int SMIME_text(BIO *in, BIO *out); - -const ASN1_ITEM *ASN1_ITEM_lookup(const char *name); -const ASN1_ITEM *ASN1_ITEM_get(size_t i); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1_mac.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1_mac.h deleted file mode 100644 index 7ac1782a..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1_mac.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2015-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 - */ - -#error "This file is obsolete; please update your software." diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1err.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1err.h deleted file mode 100644 index faed5a55..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1err.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - * 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_ASN1ERR_H -# define HEADER_ASN1ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# 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_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_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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1t.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1t.h deleted file mode 100644 index a450ba0d..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asn1t.h +++ /dev/null @@ -1,945 +0,0 @@ -/* - * Copyright 2000-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_ASN1T_H -# define HEADER_ASN1T_H - -# include -# include -# include - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -/* ASN1 template defines, structures and functions */ - -#ifdef __cplusplus -extern "C" { -#endif - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) - -/* Macros for start and end of ASN1_ITEM definition */ - -# define ASN1_ITEM_start(itname) \ - const ASN1_ITEM itname##_it = { - -# define static_ASN1_ITEM_start(itname) \ - static const ASN1_ITEM itname##_it = { - -# define ASN1_ITEM_end(itname) \ - }; - -# else - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)())) - -/* Macros for start and end of ASN1_ITEM definition */ - -# define ASN1_ITEM_start(itname) \ - const ASN1_ITEM * itname##_it(void) \ - { \ - static const ASN1_ITEM local_it = { - -# define static_ASN1_ITEM_start(itname) \ - static ASN1_ITEM_start(itname) - -# define ASN1_ITEM_end(itname) \ - }; \ - return &local_it; \ - } - -# endif - -/* Macros to aid ASN1 template writing */ - -# define ASN1_ITEM_TEMPLATE(tname) \ - static const ASN1_TEMPLATE tname##_item_tt - -# define ASN1_ITEM_TEMPLATE_END(tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_PRIMITIVE,\ - -1,\ - &tname##_item_tt,\ - 0,\ - NULL,\ - 0,\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_ITEM_TEMPLATE_END(tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_PRIMITIVE,\ - -1,\ - &tname##_item_tt,\ - 0,\ - NULL,\ - 0,\ - #tname \ - ASN1_ITEM_end(tname) - -/* This is a ASN1 type which just embeds a template */ - -/*- - * This pair helps declare a SEQUENCE. We can do: - * - * ASN1_SEQUENCE(stname) = { - * ... SEQUENCE components ... - * } ASN1_SEQUENCE_END(stname) - * - * This will produce an ASN1_ITEM called stname_it - * for a structure called stname. - * - * If you want the same structure but a different - * name then use: - * - * ASN1_SEQUENCE(itname) = { - * ... SEQUENCE components ... - * } ASN1_SEQUENCE_END_name(stname, itname) - * - * This will create an item called itname_it using - * a structure called stname. - */ - -# define ASN1_SEQUENCE(tname) \ - static const ASN1_TEMPLATE tname##_seq_tt[] - -# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) - -# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) - -# define ASN1_SEQUENCE_END_name(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #tname \ - ASN1_ITEM_end(tname) - -# define static_ASN1_SEQUENCE_END_name(stname, tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_NDEF_SEQUENCE(tname) \ - ASN1_SEQUENCE(tname) - -# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ - ASN1_SEQUENCE_cb(tname, cb) - -# define ASN1_SEQUENCE_cb(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_BROKEN_SEQUENCE(tname) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_SEQUENCE_ref(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_SEQUENCE_enc(tname, enc, cb) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_NDEF_SEQUENCE_END(tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(tname),\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_NDEF_SEQUENCE_END(tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(tname),\ - #tname \ - ASN1_ITEM_end(tname) - -# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) -# define static_ASN1_BROKEN_SEQUENCE_END(stname) \ - static_ASN1_SEQUENCE_END_ref(stname, stname) - -# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) - -# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) -# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) - -# define ASN1_SEQUENCE_END_ref(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_SEQUENCE_END_ref(stname, tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -/*- - * This pair helps declare a CHOICE type. We can do: - * - * ASN1_CHOICE(chname) = { - * ... CHOICE options ... - * ASN1_CHOICE_END(chname) - * - * This will produce an ASN1_ITEM called chname_it - * for a structure called chname. The structure - * definition must look like this: - * typedef struct { - * int type; - * union { - * ASN1_SOMETHING *opt1; - * ASN1_SOMEOTHER *opt2; - * } value; - * } chname; - * - * the name of the selector must be 'type'. - * to use an alternative selector name use the - * ASN1_CHOICE_END_selector() version. - */ - -# define ASN1_CHOICE(tname) \ - static const ASN1_TEMPLATE tname##_ch_tt[] - -# define ASN1_CHOICE_cb(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ - ASN1_CHOICE(tname) - -# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) - -# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) - -# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) - -# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) - -# define ASN1_CHOICE_END_selector(stname, tname, selname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_CHOICE_END_cb(stname, tname, selname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -/* This helps with the template wrapper form of ASN1_ITEM */ - -# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ - (flags), (tag), 0,\ - #name, ASN1_ITEM_ref(type) } - -/* These help with SEQUENCE or CHOICE components */ - -/* used to declare other types */ - -# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ - (flags), (tag), offsetof(stname, field),\ - #field, ASN1_ITEM_ref(type) } - -/* implicit and explicit helper macros */ - -# define ASN1_IMP_EX(stname, field, type, tag, ex) \ - ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type) - -# define ASN1_EXP_EX(stname, field, type, tag, ex) \ - ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type) - -/* Any defined by macros: the field used is in the table itself */ - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -# else -# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } -# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } -# endif -/* Plain simple type */ -# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) -/* Embedded simple type */ -# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type) - -/* OPTIONAL simple type */ -# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) -# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type) - -/* IMPLICIT tagged simple type */ -# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) -# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) - -/* IMPLICIT tagged OPTIONAL simple type */ -# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) -# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) - -/* Same as above but EXPLICIT */ - -# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) -# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) -# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) -# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) - -/* SEQUENCE OF type */ -# define ASN1_SEQUENCE_OF(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) - -/* OPTIONAL SEQUENCE OF */ -# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) - -/* Same as above but for SET OF */ - -# define ASN1_SET_OF(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) - -# define ASN1_SET_OF_OPT(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) - -/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ - -# define ASN1_IMP_SET_OF(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) - -# define ASN1_EXP_SET_OF(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) - -# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) - -# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) - -# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) - -/* EXPLICIT using indefinite length constructed form */ -# define ASN1_NDEF_EXP(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) - -/* EXPLICIT OPTIONAL using indefinite length constructed form */ -# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) - -/* Macros for the ASN1_ADB structure */ - -# define ASN1_ADB(name) \ - static const ASN1_ADB_TABLE name##_adbtbl[] - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ - ;\ - static const ASN1_ADB name##_adb = {\ - flags,\ - offsetof(name, field),\ - adb_cb,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - } - -# else - -# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ - ;\ - static const ASN1_ITEM *name##_adb(void) \ - { \ - static const ASN1_ADB internal_adb = \ - {\ - flags,\ - offsetof(name, field),\ - adb_cb,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - }; \ - return (const ASN1_ITEM *) &internal_adb; \ - } \ - void dummy_function(void) - -# endif - -# define ADB_ENTRY(val, template) {val, template} - -# define ASN1_ADB_TEMPLATE(name) \ - static const ASN1_TEMPLATE name##_tt - -/* - * This is the ASN1 template structure that defines a wrapper round the - * actual type. It determines the actual position of the field in the value - * structure, various flags such as OPTIONAL and the field name. - */ - -struct ASN1_TEMPLATE_st { - unsigned long flags; /* Various flags */ - long tag; /* tag, not used if no tagging */ - unsigned long offset; /* Offset of this field in structure */ - const char *field_name; /* Field name */ - ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ -}; - -/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ - -# define ASN1_TEMPLATE_item(t) (t->item_ptr) -# define ASN1_TEMPLATE_adb(t) (t->item_ptr) - -typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; -typedef struct ASN1_ADB_st ASN1_ADB; - -struct ASN1_ADB_st { - unsigned long flags; /* Various flags */ - unsigned long offset; /* Offset of selector field */ - int (*adb_cb)(long *psel); /* Application callback */ - const ASN1_ADB_TABLE *tbl; /* Table of possible types */ - long tblcount; /* Number of entries in tbl */ - const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ - const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ -}; - -struct ASN1_ADB_TABLE_st { - long value; /* NID for an object or value for an int */ - const ASN1_TEMPLATE tt; /* item for this value */ -}; - -/* template flags */ - -/* Field is optional */ -# define ASN1_TFLG_OPTIONAL (0x1) - -/* Field is a SET OF */ -# define ASN1_TFLG_SET_OF (0x1 << 1) - -/* Field is a SEQUENCE OF */ -# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) - -/* - * Special case: this refers to a SET OF that will be sorted into DER order - * when encoded *and* the corresponding STACK will be modified to match the - * new order. - */ -# define ASN1_TFLG_SET_ORDER (0x3 << 1) - -/* Mask for SET OF or SEQUENCE OF */ -# define ASN1_TFLG_SK_MASK (0x3 << 1) - -/* - * These flags mean the tag should be taken from the tag field. If EXPLICIT - * then the underlying type is used for the inner tag. - */ - -/* IMPLICIT tagging */ -# define ASN1_TFLG_IMPTAG (0x1 << 3) - -/* EXPLICIT tagging, inner tag from underlying type */ -# define ASN1_TFLG_EXPTAG (0x2 << 3) - -# define ASN1_TFLG_TAG_MASK (0x3 << 3) - -/* context specific IMPLICIT */ -# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT) - -/* context specific EXPLICIT */ -# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT) - -/* - * If tagging is in force these determine the type of tag to use. Otherwise - * the tag is determined by the underlying type. These values reflect the - * actual octet format. - */ - -/* Universal tag */ -# define ASN1_TFLG_UNIVERSAL (0x0<<6) -/* Application tag */ -# define ASN1_TFLG_APPLICATION (0x1<<6) -/* Context specific tag */ -# define ASN1_TFLG_CONTEXT (0x2<<6) -/* Private tag */ -# define ASN1_TFLG_PRIVATE (0x3<<6) - -# define ASN1_TFLG_TAG_CLASS (0x3<<6) - -/* - * These are for ANY DEFINED BY type. In this case the 'item' field points to - * an ASN1_ADB structure which contains a table of values to decode the - * relevant type - */ - -# define ASN1_TFLG_ADB_MASK (0x3<<8) - -# define ASN1_TFLG_ADB_OID (0x1<<8) - -# define ASN1_TFLG_ADB_INT (0x1<<9) - -/* - * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes - * indefinite length constructed encoding to be used if required. - */ - -# define ASN1_TFLG_NDEF (0x1<<11) - -/* Field is embedded and not a pointer */ -# define ASN1_TFLG_EMBED (0x1 << 12) - -/* This is the actual ASN1 item itself */ - -struct ASN1_ITEM_st { - char itype; /* The item type, primitive, SEQUENCE, CHOICE - * or extern */ - long utype; /* underlying type */ - const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains - * the contents */ - long tcount; /* Number of templates if SEQUENCE or CHOICE */ - const void *funcs; /* functions that handle this type */ - long size; /* Structure size (usually) */ - const char *sname; /* Structure name */ -}; - -/*- - * These are values for the itype field and - * determine how the type is interpreted. - * - * For PRIMITIVE types the underlying type - * determines the behaviour if items is NULL. - * - * Otherwise templates must contain a single - * template and the type is treated in the - * same way as the type specified in the template. - * - * For SEQUENCE types the templates field points - * to the members, the size field is the - * structure size. - * - * For CHOICE types the templates field points - * to each possible member (typically a union) - * and the 'size' field is the offset of the - * selector. - * - * The 'funcs' field is used for application - * specific functions. - * - * The EXTERN type uses a new style d2i/i2d. - * The new style should be used where possible - * because it avoids things like the d2i IMPLICIT - * hack. - * - * MSTRING is a multiple string type, it is used - * for a CHOICE of character strings where the - * actual strings all occupy an ASN1_STRING - * structure. In this case the 'utype' field - * has a special meaning, it is used as a mask - * of acceptable types using the B_ASN1 constants. - * - * NDEF_SEQUENCE is the same as SEQUENCE except - * that it will use indefinite length constructed - * encoding if requested. - * - */ - -# define ASN1_ITYPE_PRIMITIVE 0x0 - -# define ASN1_ITYPE_SEQUENCE 0x1 - -# define ASN1_ITYPE_CHOICE 0x2 - -# define ASN1_ITYPE_EXTERN 0x4 - -# define ASN1_ITYPE_MSTRING 0x5 - -# define ASN1_ITYPE_NDEF_SEQUENCE 0x6 - -/* - * Cache for ASN1 tag and length, so we don't keep re-reading it for things - * like CHOICE - */ - -struct ASN1_TLC_st { - char valid; /* Values below are valid */ - int ret; /* return value */ - long plen; /* length */ - int ptag; /* class value */ - int pclass; /* class value */ - int hdrlen; /* header length */ -}; - -/* Typedefs for ASN1 function pointers */ -typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, - const ASN1_ITEM *it, int tag, int aclass, char opt, - ASN1_TLC *ctx); - -typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, - const ASN1_ITEM *it, int tag, int aclass); -typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); -typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); - -typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, - int indent, const char *fname, - const ASN1_PCTX *pctx); - -typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, - int *putype, const ASN1_ITEM *it); -typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, - int len, int utype, char *free_cont, - const ASN1_ITEM *it); -typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, - const ASN1_ITEM *it, int indent, - const ASN1_PCTX *pctx); - -typedef struct ASN1_EXTERN_FUNCS_st { - void *app_data; - ASN1_ex_new_func *asn1_ex_new; - ASN1_ex_free_func *asn1_ex_free; - ASN1_ex_free_func *asn1_ex_clear; - ASN1_ex_d2i *asn1_ex_d2i; - ASN1_ex_i2d *asn1_ex_i2d; - ASN1_ex_print_func *asn1_ex_print; -} ASN1_EXTERN_FUNCS; - -typedef struct ASN1_PRIMITIVE_FUNCS_st { - void *app_data; - unsigned long flags; - ASN1_ex_new_func *prim_new; - ASN1_ex_free_func *prim_free; - ASN1_ex_free_func *prim_clear; - ASN1_primitive_c2i *prim_c2i; - ASN1_primitive_i2c *prim_i2c; - ASN1_primitive_print *prim_print; -} ASN1_PRIMITIVE_FUNCS; - -/* - * This is the ASN1_AUX structure: it handles various miscellaneous - * requirements. For example the use of reference counts and an informational - * callback. The "informational callback" is called at various points during - * the ASN1 encoding and decoding. It can be used to provide minor - * customisation of the structures used. This is most useful where the - * supplied routines *almost* do the right thing but need some extra help at - * a few points. If the callback returns zero then it is assumed a fatal - * error has occurred and the main operation should be abandoned. If major - * changes in the default behaviour are required then an external type is - * more appropriate. - */ - -typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, - void *exarg); - -typedef struct ASN1_AUX_st { - void *app_data; - int flags; - int ref_offset; /* Offset of reference value */ - int ref_lock; /* Lock type to use */ - ASN1_aux_cb *asn1_cb; - int enc_offset; /* Offset of ASN1_ENCODING structure */ -} ASN1_AUX; - -/* For print related callbacks exarg points to this structure */ -typedef struct ASN1_PRINT_ARG_st { - BIO *out; - int indent; - const ASN1_PCTX *pctx; -} ASN1_PRINT_ARG; - -/* For streaming related callbacks exarg points to this structure */ -typedef struct ASN1_STREAM_ARG_st { - /* BIO to stream through */ - BIO *out; - /* BIO with filters appended */ - BIO *ndef_bio; - /* Streaming I/O boundary */ - unsigned char **boundary; -} ASN1_STREAM_ARG; - -/* Flags in ASN1_AUX */ - -/* Use a reference count */ -# define ASN1_AFLG_REFCOUNT 1 -/* Save the encoding of structure (useful for signatures) */ -# define ASN1_AFLG_ENCODING 2 -/* The Sequence length is invalid */ -# define ASN1_AFLG_BROKEN 4 - -/* operation values for asn1_cb */ - -# define ASN1_OP_NEW_PRE 0 -# define ASN1_OP_NEW_POST 1 -# define ASN1_OP_FREE_PRE 2 -# define ASN1_OP_FREE_POST 3 -# define ASN1_OP_D2I_PRE 4 -# define ASN1_OP_D2I_POST 5 -# define ASN1_OP_I2D_PRE 6 -# define ASN1_OP_I2D_POST 7 -# define ASN1_OP_PRINT_PRE 8 -# define ASN1_OP_PRINT_POST 9 -# define ASN1_OP_STREAM_PRE 10 -# define ASN1_OP_STREAM_POST 11 -# define ASN1_OP_DETACHED_PRE 12 -# define ASN1_OP_DETACHED_POST 13 - -/* Macro to implement a primitive type */ -# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) -# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ - ASN1_ITEM_start(itname) \ - ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ - ASN1_ITEM_end(itname) - -/* Macro to implement a multi string type */ -# define IMPLEMENT_ASN1_MSTRING(itname, mask) \ - ASN1_ITEM_start(itname) \ - ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ - ASN1_ITEM_end(itname) - -# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ - ASN1_ITEM_start(sname) \ - ASN1_ITYPE_EXTERN, \ - tag, \ - NULL, \ - 0, \ - &fptrs, \ - 0, \ - #sname \ - ASN1_ITEM_end(sname) - -/* Macro to implement standard functions in terms of ASN1_ITEM structures */ - -# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) - -# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ - IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) - -# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ - pre stname *fname##_new(void) \ - { \ - return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ - } \ - pre void fname##_free(stname *a) \ - { \ - ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ - } - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ - stname *fname##_new(void) \ - { \ - return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ - } \ - void fname##_free(stname *a) \ - { \ - ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ - } - -# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) - -# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ - } \ - int i2d_##fname(stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ - } - -# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ - int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ - { \ - return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ - } - -# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \ - static stname *d2i_##stname(stname **a, \ - const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \ - ASN1_ITEM_rptr(stname)); \ - } \ - static int i2d_##stname(stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, \ - ASN1_ITEM_rptr(stname)); \ - } - -/* - * This includes evil casts to remove const: they will go away when full ASN1 - * constification is done. - */ -# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ - } \ - int i2d_##fname(const stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ - } - -# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ - stname * stname##_dup(stname *x) \ - { \ - return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ - } - -# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ - IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ - int fname##_print_ctx(BIO *out, stname *x, int indent, \ - const ASN1_PCTX *pctx) \ - { \ - return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ - ASN1_ITEM_rptr(itname), pctx); \ - } - -# define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ - IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) - -# define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) - -/* external definitions for primitive types */ - -DECLARE_ASN1_ITEM(ASN1_BOOLEAN) -DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) -DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) -DECLARE_ASN1_ITEM(ASN1_SEQUENCE) -DECLARE_ASN1_ITEM(CBIGNUM) -DECLARE_ASN1_ITEM(BIGNUM) -DECLARE_ASN1_ITEM(INT32) -DECLARE_ASN1_ITEM(ZINT32) -DECLARE_ASN1_ITEM(UINT32) -DECLARE_ASN1_ITEM(ZUINT32) -DECLARE_ASN1_ITEM(INT64) -DECLARE_ASN1_ITEM(ZINT64) -DECLARE_ASN1_ITEM(UINT64) -DECLARE_ASN1_ITEM(ZUINT64) - -# if OPENSSL_API_COMPAT < 0x10200000L -/* - * LONG and ZLONG are strongly discouraged for use as stored data, as the - * underlying C type (long) differs in size depending on the architecture. - * They are designed with 32-bit longs in mind. - */ -DECLARE_ASN1_ITEM(LONG) -DECLARE_ASN1_ITEM(ZLONG) -# endif - -DEFINE_STACK_OF(ASN1_VALUE) - -/* Functions used internally by the ASN1 code */ - -int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); -void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); - -int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, - const ASN1_ITEM *it, int tag, int aclass, char opt, - ASN1_TLC *ctx); - -int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, - const ASN1_ITEM *it, int tag, int aclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/async.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/async.h deleted file mode 100644 index 7052b890..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/async.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 - -#ifndef HEADER_ASYNC_H -# define HEADER_ASYNC_H - -#if defined(_WIN32) -# if defined(BASETYPES) || defined(_WINDEF_H) -/* application has to include 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 - - -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asyncerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asyncerr.h deleted file mode 100644 index 91afbbb2..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/asyncerr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bio.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bio.h deleted file mode 100644 index ae559a51..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bio.h +++ /dev/null @@ -1,801 +0,0 @@ -/* - * 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_BIO_H -# define HEADER_BIO_H - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# endif -# include - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* There are the classes of BIOs */ -# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ -# define BIO_TYPE_FILTER 0x0200 -# define BIO_TYPE_SOURCE_SINK 0x0400 - -/* These are the 'types' of BIOs */ -# define BIO_TYPE_NONE 0 -# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK) -# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK) - -# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK) -# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER) -# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER) -# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER) -# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER) -# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER) -# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) - -# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */ -# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER) -# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */ -# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER) -# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER) -# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER) -# ifndef OPENSSL_NO_SCTP -# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# endif - -#define BIO_TYPE_START 128 - -/* - * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. - * BIO_set_fp(in,stdin,BIO_NOCLOSE); - */ -# define BIO_NOCLOSE 0x00 -# define BIO_CLOSE 0x01 - -/* - * These are used in the following macros and are passed to BIO_ctrl() - */ -# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ -# define BIO_CTRL_EOF 2/* opt - are we at the eof */ -# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ -# define BIO_CTRL_SET 4/* man - set the 'IO' type */ -# define BIO_CTRL_GET 5/* man - get the 'IO' type */ -# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ -# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ -# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ -# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ -# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ -# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ -# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ -# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ -# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ -# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ - -# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ -# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ - -/* dgram BIO stuff */ -# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ -# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected - * socket to be passed in */ -# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ -# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ -# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ -# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ - -# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ -# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ - -/* #ifdef IP_MTU_DISCOVER */ -# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ -/* #endif */ - -# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ -# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 -# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ -# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. - * want to use this if asking - * the kernel fails */ - -# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was - * exceed in the previous write - * operation */ - -# define BIO_CTRL_DGRAM_GET_PEER 46 -# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ - -# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout - * to adjust socket timeouts */ -# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 - -# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 - -/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ -# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 -# ifndef OPENSSL_NO_SCTP -/* SCTP stuff */ -# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 -# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 -# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 -# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 -# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 -# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 -# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 -# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 -# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 -# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 -# endif - -# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71 - -/* modifiers */ -# define BIO_FP_READ 0x02 -# define BIO_FP_WRITE 0x04 -# define BIO_FP_APPEND 0x08 -# define BIO_FP_TEXT 0x10 - -# define BIO_FLAGS_READ 0x01 -# define BIO_FLAGS_WRITE 0x02 -# define BIO_FLAGS_IO_SPECIAL 0x04 -# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) -# define BIO_FLAGS_SHOULD_RETRY 0x08 -# ifndef BIO_FLAGS_UPLINK -/* - * "UPLINK" flag denotes file descriptors provided by application. It - * defaults to 0, as most platforms don't require UPLINK interface. - */ -# define BIO_FLAGS_UPLINK 0 -# endif - -# define BIO_FLAGS_BASE64_NO_NL 0x100 - -/* - * This is used with memory BIOs: - * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; - * BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. - */ -# define BIO_FLAGS_MEM_RDONLY 0x200 -# define BIO_FLAGS_NONCLEAR_RST 0x400 -# define BIO_FLAGS_IN_EOF 0x800 - -typedef union bio_addr_st BIO_ADDR; -typedef struct bio_addrinfo_st BIO_ADDRINFO; - -int BIO_get_new_index(void); -void BIO_set_flags(BIO *b, int flags); -int BIO_test_flags(const BIO *b, int flags); -void BIO_clear_flags(BIO *b, int flags); - -# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) -# define BIO_set_retry_special(b) \ - BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_set_retry_read(b) \ - BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_set_retry_write(b) \ - BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) - -/* These are normally used internally in BIOs */ -# define BIO_clear_retry_flags(b) \ - BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_get_retry_flags(b) \ - BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) - -/* These should be used by the application to tell why we should retry */ -# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) -# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) -# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) -# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) -# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) - -/* - * The next three are used in conjunction with the BIO_should_io_special() - * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int - * *reason); will walk the BIO stack and return the 'reason' for the special - * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return - * the code. - */ -/* - * Returned from the SSL bio when the certificate retrieval code had an error - */ -# define BIO_RR_SSL_X509_LOOKUP 0x01 -/* Returned from the connect BIO when a connect would have blocked */ -# define BIO_RR_CONNECT 0x02 -/* Returned from the accept BIO when an accept would have blocked */ -# define BIO_RR_ACCEPT 0x03 - -/* These are passed by the BIO callback */ -# define BIO_CB_FREE 0x01 -# define BIO_CB_READ 0x02 -# define BIO_CB_WRITE 0x03 -# define BIO_CB_PUTS 0x04 -# define BIO_CB_GETS 0x05 -# define BIO_CB_CTRL 0x06 - -/* - * The callback is called before and after the underling operation, The - * BIO_CB_RETURN flag indicates if it is after the call - */ -# define BIO_CB_RETURN 0x80 -# define BIO_CB_return(a) ((a)|BIO_CB_RETURN) -# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) -# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) - -typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, - long argl, long ret); -typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, - size_t len, int argi, - long argl, int ret, size_t *processed); -BIO_callback_fn BIO_get_callback(const BIO *b); -void BIO_set_callback(BIO *b, BIO_callback_fn callback); - -BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); -void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); - -char *BIO_get_callback_arg(const BIO *b); -void BIO_set_callback_arg(BIO *b, char *arg); - -typedef struct bio_method_st BIO_METHOD; - -const char *BIO_method_name(const BIO *b); -int BIO_method_type(const BIO *b); - -typedef int BIO_info_cb(BIO *, int, int); -typedef BIO_info_cb bio_info_cb; /* backward compatibility */ - -DEFINE_STACK_OF(BIO) - -/* Prefix and suffix callback in ASN1 BIO */ -typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, - void *parg); - -# ifndef OPENSSL_NO_SCTP -/* SCTP parameter structs */ -struct bio_dgram_sctp_sndinfo { - uint16_t snd_sid; - uint16_t snd_flags; - uint32_t snd_ppid; - uint32_t snd_context; -}; - -struct bio_dgram_sctp_rcvinfo { - uint16_t rcv_sid; - uint16_t rcv_ssn; - uint16_t rcv_flags; - uint32_t rcv_ppid; - uint32_t rcv_tsn; - uint32_t rcv_cumtsn; - uint32_t rcv_context; -}; - -struct bio_dgram_sctp_prinfo { - uint16_t pr_policy; - uint32_t pr_value; -}; -# endif - -/* - * #define BIO_CONN_get_param_hostname BIO_ctrl - */ - -# define BIO_C_SET_CONNECT 100 -# define BIO_C_DO_STATE_MACHINE 101 -# define BIO_C_SET_NBIO 102 -/* # define BIO_C_SET_PROXY_PARAM 103 */ -# define BIO_C_SET_FD 104 -# define BIO_C_GET_FD 105 -# define BIO_C_SET_FILE_PTR 106 -# define BIO_C_GET_FILE_PTR 107 -# define BIO_C_SET_FILENAME 108 -# define BIO_C_SET_SSL 109 -# define BIO_C_GET_SSL 110 -# define BIO_C_SET_MD 111 -# define BIO_C_GET_MD 112 -# define BIO_C_GET_CIPHER_STATUS 113 -# define BIO_C_SET_BUF_MEM 114 -# define BIO_C_GET_BUF_MEM_PTR 115 -# define BIO_C_GET_BUFF_NUM_LINES 116 -# define BIO_C_SET_BUFF_SIZE 117 -# define BIO_C_SET_ACCEPT 118 -# define BIO_C_SSL_MODE 119 -# define BIO_C_GET_MD_CTX 120 -/* # define BIO_C_GET_PROXY_PARAM 121 */ -# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ -# define BIO_C_GET_CONNECT 123 -# define BIO_C_GET_ACCEPT 124 -# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 -# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 -# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 -# define BIO_C_FILE_SEEK 128 -# define BIO_C_GET_CIPHER_CTX 129 -# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input - * value */ -# define BIO_C_SET_BIND_MODE 131 -# define BIO_C_GET_BIND_MODE 132 -# define BIO_C_FILE_TELL 133 -# define BIO_C_GET_SOCKS 134 -# define BIO_C_SET_SOCKS 135 - -# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ -# define BIO_C_GET_WRITE_BUF_SIZE 137 -# define BIO_C_MAKE_BIO_PAIR 138 -# define BIO_C_DESTROY_BIO_PAIR 139 -# define BIO_C_GET_WRITE_GUARANTEE 140 -# define BIO_C_GET_READ_REQUEST 141 -# define BIO_C_SHUTDOWN_WR 142 -# define BIO_C_NREAD0 143 -# define BIO_C_NREAD 144 -# define BIO_C_NWRITE0 145 -# define BIO_C_NWRITE 146 -# define BIO_C_RESET_READ_REQUEST 147 -# define BIO_C_SET_MD_CTX 148 - -# define BIO_C_SET_PREFIX 149 -# define BIO_C_GET_PREFIX 150 -# define BIO_C_SET_SUFFIX 151 -# define BIO_C_GET_SUFFIX 152 - -# define BIO_C_SET_EX_ARG 153 -# define BIO_C_GET_EX_ARG 154 - -# define BIO_C_SET_CONNECT_MODE 155 - -# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) -# define BIO_get_app_data(s) BIO_get_ex_data(s,0) - -# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) - -# ifndef OPENSSL_NO_SOCK -/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ -/* Note: the underlying operating system may not support some of them */ -# define BIO_FAMILY_IPV4 4 -# define BIO_FAMILY_IPV6 6 -# define BIO_FAMILY_IPANY 256 - -/* BIO_s_connect() */ -# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \ - (char *)(name)) -# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \ - (char *)(port)) -# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \ - (char *)(addr)) -# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f) -# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)) -# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)) -# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)) -# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) -# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL) - -/* BIO_s_accept() */ -# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \ - (char *)(name)) -# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \ - (char *)(port)) -# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)) -# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1)) -# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2)) -# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3)) -/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ -# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL) -# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \ - (char *)(bio)) -# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f) -# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL) - -/* Aliases kept for backward compatibility */ -# define BIO_BIND_NORMAL 0 -# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR -# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR -# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) -# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) - -/* BIO_s_accept() and BIO_s_connect() */ -# define BIO_do_connect(b) BIO_do_handshake(b) -# define BIO_do_accept(b) BIO_do_handshake(b) -# endif /* OPENSSL_NO_SOCK */ - -# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) - -/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ -# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) -# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c)) - -/* BIO_s_file() */ -# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp)) -# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp)) - -/* BIO_s_fd() and BIO_s_file() */ -# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) -# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) - -/* - * name is cast to lose const, but might be better to route through a - * function so we can do it safely - */ -# ifdef CONST_STRICT -/* - * If you are wondering why this isn't defined, its because CONST_STRICT is - * purely a compile-time kludge to allow const to be checked. - */ -int BIO_read_filename(BIO *b, const char *name); -# else -# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_READ,(char *)(name)) -# endif -# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_WRITE,name) -# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_APPEND,name) -# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) - -/* - * WARNING WARNING, this ups the reference count on the read bio of the SSL - * structure. This is because the ssl read BIO is now pointed to by the - * next_bio field in the bio. So when you free the BIO, make sure you are - * doing a BIO_free_all() to catch the underlying BIO. - */ -# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl)) -# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp)) -# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) -# define BIO_set_ssl_renegotiate_bytes(b,num) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) -# define BIO_get_num_renegotiates(b) \ - BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL) -# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) - -/* defined in evp.h */ -/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ - -# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp)) -# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm)) -# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \ - (char *)(pp)) -# define BIO_set_mem_eof_return(b,v) \ - BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) - -/* For the BIO_f_buffer() type */ -# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) -# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) -# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) -# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) -# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) - -/* Don't use the next one unless you know what you are doing :-) */ -# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) - -# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) -# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) -# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) -# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) -# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) -# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) -/* ...pending macros have inappropriate return type */ -size_t BIO_ctrl_pending(BIO *b); -size_t BIO_ctrl_wpending(BIO *b); -# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) -# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ - cbp) -# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) - -/* For the BIO_f_buffer() type */ -# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) -# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) - -/* For BIO_s_bio() */ -# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) -# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) -# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) -# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) -# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) -/* macros with inappropriate type -- but ...pending macros use int too: */ -# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) -# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) -size_t BIO_ctrl_get_write_guarantee(BIO *b); -size_t BIO_ctrl_get_read_request(BIO *b); -int BIO_ctrl_reset_read_request(BIO *b); - -/* ctrl macros for dgram */ -# define BIO_ctrl_dgram_connect(b,peer) \ - (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer)) -# define BIO_ctrl_set_connected(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer)) -# define BIO_dgram_recv_timedout(b) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) -# define BIO_dgram_send_timedout(b) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) -# define BIO_dgram_get_peer(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer)) -# define BIO_dgram_set_peer(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer)) -# define BIO_dgram_get_mtu_overhead(b) \ - (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) - -#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef) -int BIO_set_ex_data(BIO *bio, int idx, void *data); -void *BIO_get_ex_data(BIO *bio, int idx); -uint64_t BIO_number_read(BIO *bio); -uint64_t BIO_number_written(BIO *bio); - -/* For BIO_f_asn1() */ -int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, - asn1_ps_func *prefix_free); -int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, - asn1_ps_func **pprefix_free); -int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, - asn1_ps_func *suffix_free); -int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, - asn1_ps_func **psuffix_free); - -const BIO_METHOD *BIO_s_file(void); -BIO *BIO_new_file(const char *filename, const char *mode); -# ifndef OPENSSL_NO_STDIO -BIO *BIO_new_fp(FILE *stream, int close_flag); -# endif -BIO *BIO_new(const BIO_METHOD *type); -int BIO_free(BIO *a); -void BIO_set_data(BIO *a, void *ptr); -void *BIO_get_data(BIO *a); -void BIO_set_init(BIO *a, int init); -int BIO_get_init(BIO *a); -void BIO_set_shutdown(BIO *a, int shut); -int BIO_get_shutdown(BIO *a); -void BIO_vfree(BIO *a); -int BIO_up_ref(BIO *a); -int BIO_read(BIO *b, void *data, int dlen); -int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); -int BIO_gets(BIO *bp, char *buf, int size); -int BIO_write(BIO *b, const void *data, int dlen); -int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); -int BIO_puts(BIO *bp, const char *buf); -int BIO_indent(BIO *b, int indent, int max); -long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); -long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); -void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); -long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); -BIO *BIO_push(BIO *b, BIO *append); -BIO *BIO_pop(BIO *b); -void BIO_free_all(BIO *a); -BIO *BIO_find_type(BIO *b, int bio_type); -BIO *BIO_next(BIO *b); -void BIO_set_next(BIO *b, BIO *next); -BIO *BIO_get_retry_BIO(BIO *bio, int *reason); -int BIO_get_retry_reason(BIO *bio); -void BIO_set_retry_reason(BIO *bio, int reason); -BIO *BIO_dup_chain(BIO *in); - -int BIO_nread0(BIO *bio, char **buf); -int BIO_nread(BIO *bio, char **buf, int num); -int BIO_nwrite0(BIO *bio, char **buf); -int BIO_nwrite(BIO *bio, char **buf, int num); - -long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, - long argl, long ret); - -const BIO_METHOD *BIO_s_mem(void); -const BIO_METHOD *BIO_s_secmem(void); -BIO *BIO_new_mem_buf(const void *buf, int len); -# ifndef OPENSSL_NO_SOCK -const BIO_METHOD *BIO_s_socket(void); -const BIO_METHOD *BIO_s_connect(void); -const BIO_METHOD *BIO_s_accept(void); -# endif -const BIO_METHOD *BIO_s_fd(void); -const BIO_METHOD *BIO_s_log(void); -const BIO_METHOD *BIO_s_bio(void); -const BIO_METHOD *BIO_s_null(void); -const BIO_METHOD *BIO_f_null(void); -const BIO_METHOD *BIO_f_buffer(void); -const BIO_METHOD *BIO_f_linebuffer(void); -const BIO_METHOD *BIO_f_nbio_test(void); -# ifndef OPENSSL_NO_DGRAM -const BIO_METHOD *BIO_s_datagram(void); -int BIO_dgram_non_fatal_error(int error); -BIO *BIO_new_dgram(int fd, int close_flag); -# ifndef OPENSSL_NO_SCTP -const BIO_METHOD *BIO_s_datagram_sctp(void); -BIO *BIO_new_dgram_sctp(int fd, int close_flag); -int BIO_dgram_is_sctp(BIO *bio); -int BIO_dgram_sctp_notification_cb(BIO *b, - void (*handle_notifications) (BIO *bio, - void *context, - void *buf), - void *context); -int BIO_dgram_sctp_wait_for_dry(BIO *b); -int BIO_dgram_sctp_msg_waiting(BIO *b); -# endif -# endif - -# ifndef OPENSSL_NO_SOCK -int BIO_sock_should_retry(int i); -int BIO_sock_non_fatal_error(int error); -# endif - -int BIO_fd_should_retry(int i); -int BIO_fd_non_fatal_error(int error); -int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), - void *u, const char *s, int len); -int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), - void *u, const char *s, int len, int indent); -int BIO_dump(BIO *b, const char *bytes, int len); -int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); -# ifndef OPENSSL_NO_STDIO -int BIO_dump_fp(FILE *fp, const char *s, int len); -int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); -# endif -int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data, - int datalen); - -# ifndef OPENSSL_NO_SOCK -BIO_ADDR *BIO_ADDR_new(void); -int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, - const void *where, size_t wherelen, unsigned short port); -void BIO_ADDR_free(BIO_ADDR *); -void BIO_ADDR_clear(BIO_ADDR *ap); -int BIO_ADDR_family(const BIO_ADDR *ap); -int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); -unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); -char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); -char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); -char *BIO_ADDR_path_string(const BIO_ADDR *ap); - -const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); -const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); -void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); - -enum BIO_hostserv_priorities { - BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV -}; -int BIO_parse_hostserv(const char *hostserv, char **host, char **service, - enum BIO_hostserv_priorities hostserv_prio); -enum BIO_lookup_type { - BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER -}; -int BIO_lookup(const char *host, const char *service, - enum BIO_lookup_type lookup_type, - int family, int socktype, BIO_ADDRINFO **res); -int BIO_lookup_ex(const char *host, const char *service, - int lookup_type, int family, int socktype, int protocol, - BIO_ADDRINFO **res); -int BIO_sock_error(int sock); -int BIO_socket_ioctl(int fd, long type, void *arg); -int BIO_socket_nbio(int fd, int mode); -int BIO_sock_init(void); -# if OPENSSL_API_COMPAT < 0x10100000L -# define BIO_sock_cleanup() while(0) continue -# endif -int BIO_set_tcp_ndelay(int sock, int turn_on); - -DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name)) -DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr)) -DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip)) -DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode)) -DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port)) - -union BIO_sock_info_u { - BIO_ADDR *addr; -}; -enum BIO_sock_info_type { - BIO_SOCK_INFO_ADDRESS -}; -int BIO_sock_info(int sock, - enum BIO_sock_info_type type, union BIO_sock_info_u *info); - -# define BIO_SOCK_REUSEADDR 0x01 -# define BIO_SOCK_V6_ONLY 0x02 -# define BIO_SOCK_KEEPALIVE 0x04 -# define BIO_SOCK_NONBLOCK 0x08 -# define BIO_SOCK_NODELAY 0x10 - -int BIO_socket(int domain, int socktype, int protocol, int options); -int BIO_connect(int sock, const BIO_ADDR *addr, int options); -int BIO_bind(int sock, const BIO_ADDR *addr, int options); -int BIO_listen(int sock, const BIO_ADDR *addr, int options); -int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); -int BIO_closesocket(int sock); - -BIO *BIO_new_socket(int sock, int close_flag); -BIO *BIO_new_connect(const char *host_port); -BIO *BIO_new_accept(const char *host_port); -# endif /* OPENSSL_NO_SOCK*/ - -BIO *BIO_new_fd(int fd, int close_flag); - -int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, - BIO **bio2, size_t writebuf2); -/* - * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. - * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default - * value. - */ - -void BIO_copy_next_retry(BIO *b); - -/* - * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); - */ - -# define ossl_bio__attr__(x) -# if defined(__GNUC__) && defined(__STDC_VERSION__) \ - && !defined(__APPLE__) - /* - * Because we support the 'z' modifier, which made its appearance in C99, - * we can't use __attribute__ with pre C99 dialects. - */ -# if __STDC_VERSION__ >= 199901L -# undef ossl_bio__attr__ -# define ossl_bio__attr__ __attribute__ -# if __GNUC__*10 + __GNUC_MINOR__ >= 44 -# define ossl_bio__printf__ __gnu_printf__ -# else -# define ossl_bio__printf__ __printf__ -# endif -# endif -# endif -int BIO_printf(BIO *bio, const char *format, ...) -ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); -int BIO_vprintf(BIO *bio, const char *format, va_list args) -ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); -int BIO_snprintf(char *buf, size_t n, const char *format, ...) -ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); -int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) -ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); -# undef ossl_bio__attr__ -# undef ossl_bio__printf__ - - -BIO_METHOD *BIO_meth_new(int type, const char *name); -void BIO_meth_free(BIO_METHOD *biom); -int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int); -int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, - size_t *); -int BIO_meth_set_write(BIO_METHOD *biom, - int (*write) (BIO *, const char *, int)); -int BIO_meth_set_write_ex(BIO_METHOD *biom, - int (*bwrite) (BIO *, const char *, size_t, size_t *)); -int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int); -int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *); -int BIO_meth_set_read(BIO_METHOD *biom, - int (*read) (BIO *, char *, int)); -int BIO_meth_set_read_ex(BIO_METHOD *biom, - int (*bread) (BIO *, char *, size_t, size_t *)); -int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *); -int BIO_meth_set_puts(BIO_METHOD *biom, - int (*puts) (BIO *, const char *)); -int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int); -int BIO_meth_set_gets(BIO_METHOD *biom, - int (*gets) (BIO *, char *, int)); -long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *); -int BIO_meth_set_ctrl(BIO_METHOD *biom, - long (*ctrl) (BIO *, int, long, void *)); -int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *); -int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); -int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *); -int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); -long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) - (BIO *, int, BIO_info_cb *); -int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, - long (*callback_ctrl) (BIO *, int, - BIO_info_cb *)); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bioerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bioerr.h deleted file mode 100644 index 46e2c96e..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bioerr.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/blowfish.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/blowfish.h deleted file mode 100644 index cd3e460e..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/blowfish.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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_BLOWFISH_H -# define HEADER_BLOWFISH_H - -# include - -# ifndef OPENSSL_NO_BF -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define BF_ENCRYPT 1 -# define BF_DECRYPT 0 - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! BF_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define BF_LONG unsigned int - -# define BF_ROUNDS 16 -# define BF_BLOCK 8 - -typedef struct bf_key_st { - BF_LONG P[BF_ROUNDS + 2]; - BF_LONG S[4 * 256]; -} BF_KEY; - -void BF_set_key(BF_KEY *key, int len, const unsigned char *data); - -void BF_encrypt(BF_LONG *data, const BF_KEY *key); -void BF_decrypt(BF_LONG *data, const BF_KEY *key); - -void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, - const BF_KEY *key, int enc); -void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - const BF_KEY *schedule, unsigned char *ivec, int enc); -void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num); -const char *BF_options(void); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bn.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bn.h deleted file mode 100644 index 8af05d00..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bn.h +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_BN_H -# define HEADER_BN_H - -# include -# ifndef OPENSSL_NO_STDIO -# include -# endif -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * 64-bit processor with LP64 ABI - */ -# ifdef SIXTY_FOUR_BIT_LONG -# define BN_ULONG unsigned long -# define BN_BYTES 8 -# endif - -/* - * 64-bit processor other than LP64 ABI - */ -# ifdef SIXTY_FOUR_BIT -# define BN_ULONG unsigned long long -# define BN_BYTES 8 -# endif - -# ifdef THIRTY_TWO_BIT -# define BN_ULONG unsigned int -# define BN_BYTES 4 -# endif - -# define BN_BITS2 (BN_BYTES * 8) -# define BN_BITS (BN_BITS2 * 2) -# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1)) - -# define BN_FLG_MALLOCED 0x01 -# define BN_FLG_STATIC_DATA 0x02 - -/* - * avoid leaking exponent information through timing, - * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, - * BN_div() will call BN_div_no_branch, - * BN_mod_inverse() will call BN_mod_inverse_no_branch. - */ -# define BN_FLG_CONSTTIME 0x04 -# define BN_FLG_SECURE 0x08 - -# if OPENSSL_API_COMPAT < 0x00908000L -/* deprecated name for the flag */ -# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME -# define BN_FLG_FREE 0x8000 /* used for debugging */ -# endif - -void BN_set_flags(BIGNUM *b, int n); -int BN_get_flags(const BIGNUM *b, int n); - -/* Values for |top| in BN_rand() */ -#define BN_RAND_TOP_ANY -1 -#define BN_RAND_TOP_ONE 0 -#define BN_RAND_TOP_TWO 1 - -/* Values for |bottom| in BN_rand() */ -#define BN_RAND_BOTTOM_ANY 0 -#define BN_RAND_BOTTOM_ODD 1 - -/* - * get a clone of a BIGNUM with changed flags, for *temporary* use only (the - * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The - * value |dest| should be a newly allocated BIGNUM obtained via BN_new() that - * has not been otherwise initialised or used. - */ -void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); - -/* Wrapper function to make using BN_GENCB easier */ -int BN_GENCB_call(BN_GENCB *cb, int a, int b); - -BN_GENCB *BN_GENCB_new(void); -void BN_GENCB_free(BN_GENCB *cb); - -/* Populate a BN_GENCB structure with an "old"-style callback */ -void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *), - void *cb_arg); - -/* Populate a BN_GENCB structure with a "new"-style callback */ -void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), - void *cb_arg); - -void *BN_GENCB_get_arg(BN_GENCB *cb); - -# define BN_prime_checks 0 /* default: select number of iterations based - * on the size of the number */ - -/* - * BN_prime_checks_for_size() returns the number of Miller-Rabin iterations - * that will be done for checking that a random number is probably prime. The - * error rate for accepting a composite number as prime depends on the size of - * the prime |b|. The error rates used are for calculating an RSA key with 2 primes, - * and so the level is what you would expect for a key of double the size of the - * prime. - * - * This table is generated using the algorithm of FIPS PUB 186-4 - * Digital Signature Standard (DSS), section F.1, page 117. - * (https://dx.doi.org/10.6028/NIST.FIPS.186-4) - * - * The following magma script was used to generate the output: - * securitybits:=125; - * k:=1024; - * for t:=1 to 65 do - * for M:=3 to Floor(2*Sqrt(k-1)-1) do - * S:=0; - * // Sum over m - * for m:=3 to M do - * s:=0; - * // Sum over j - * for j:=2 to m do - * s+:=(RealField(32)!2)^-(j+(k-1)/j); - * end for; - * S+:=2^(m-(m-1)*t)*s; - * end for; - * A:=2^(k-2-M*t); - * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S; - * pkt:=2.00743*Log(2)*k*2^-k*(A+B); - * seclevel:=Floor(-Log(2,pkt)); - * if seclevel ge securitybits then - * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M; - * break; - * end if; - * end for; - * if seclevel ge securitybits then break; end if; - * end for; - * - * It can be run online at: - * http://magma.maths.usyd.edu.au/calc - * - * And will output: - * k: 1024, security: 129 bits (t: 6, M: 23) - * - * k is the number of bits of the prime, securitybits is the level we want to - * reach. - * - * prime length | RSA key size | # MR tests | security level - * -------------+--------------|------------+--------------- - * (b) >= 6394 | >= 12788 | 3 | 256 bit - * (b) >= 3747 | >= 7494 | 3 | 192 bit - * (b) >= 1345 | >= 2690 | 4 | 128 bit - * (b) >= 1080 | >= 2160 | 5 | 128 bit - * (b) >= 852 | >= 1704 | 5 | 112 bit - * (b) >= 476 | >= 952 | 5 | 80 bit - * (b) >= 400 | >= 800 | 6 | 80 bit - * (b) >= 347 | >= 694 | 7 | 80 bit - * (b) >= 308 | >= 616 | 8 | 80 bit - * (b) >= 55 | >= 110 | 27 | 64 bit - * (b) >= 6 | >= 12 | 34 | 64 bit - */ - -# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \ - (b) >= 1345 ? 4 : \ - (b) >= 476 ? 5 : \ - (b) >= 400 ? 6 : \ - (b) >= 347 ? 7 : \ - (b) >= 308 ? 8 : \ - (b) >= 55 ? 27 : \ - /* b >= 6 */ 34) - -# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) - -int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); -int BN_is_zero(const BIGNUM *a); -int BN_is_one(const BIGNUM *a); -int BN_is_word(const BIGNUM *a, const BN_ULONG w); -int BN_is_odd(const BIGNUM *a); - -# define BN_one(a) (BN_set_word((a),1)) - -void BN_zero_ex(BIGNUM *a); - -# if OPENSSL_API_COMPAT >= 0x00908000L -# define BN_zero(a) BN_zero_ex(a) -# else -# define BN_zero(a) (BN_set_word((a),0)) -# endif - -const BIGNUM *BN_value_one(void); -char *BN_options(void); -BN_CTX *BN_CTX_new(void); -BN_CTX *BN_CTX_secure_new(void); -void BN_CTX_free(BN_CTX *c); -void BN_CTX_start(BN_CTX *ctx); -BIGNUM *BN_CTX_get(BN_CTX *ctx); -void BN_CTX_end(BN_CTX *ctx); -int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_num_bits(const BIGNUM *a); -int BN_num_bits_word(BN_ULONG l); -int BN_security_bits(int L, int N); -BIGNUM *BN_new(void); -BIGNUM *BN_secure_new(void); -void BN_clear_free(BIGNUM *a); -BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); -void BN_swap(BIGNUM *a, BIGNUM *b); -BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2bin(const BIGNUM *a, unsigned char *to); -int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); -BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); -BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2mpi(const BIGNUM *a, unsigned char *to); -int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); -int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); -/** BN_set_negative sets sign of a BIGNUM - * \param b pointer to the BIGNUM object - * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise - */ -void BN_set_negative(BIGNUM *b, int n); -/** BN_is_negative returns 1 if the BIGNUM is negative - * \param b pointer to the BIGNUM object - * \return 1 if a < 0 and 0 otherwise - */ -int BN_is_negative(const BIGNUM *b); - -int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, - BN_CTX *ctx); -# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) -int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); -int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); -int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); -int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); -int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); - -BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); -BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); -int BN_mul_word(BIGNUM *a, BN_ULONG w); -int BN_add_word(BIGNUM *a, BN_ULONG w); -int BN_sub_word(BIGNUM *a, BN_ULONG w); -int BN_set_word(BIGNUM *a, BN_ULONG w); -BN_ULONG BN_get_word(const BIGNUM *a); - -int BN_cmp(const BIGNUM *a, const BIGNUM *b); -void BN_free(BIGNUM *a); -int BN_is_bit_set(const BIGNUM *a, int n); -int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); -int BN_lshift1(BIGNUM *r, const BIGNUM *a); -int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - -int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); -int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, - BN_MONT_CTX *in_mont); -int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, - const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, - BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); - -int BN_mask_bits(BIGNUM *a, int n); -# ifndef OPENSSL_NO_STDIO -int BN_print_fp(FILE *fp, const BIGNUM *a); -# endif -int BN_print(BIO *bio, const BIGNUM *a); -int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); -int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); -int BN_rshift1(BIGNUM *r, const BIGNUM *a); -void BN_clear(BIGNUM *a); -BIGNUM *BN_dup(const BIGNUM *a); -int BN_ucmp(const BIGNUM *a, const BIGNUM *b); -int BN_set_bit(BIGNUM *a, int n); -int BN_clear_bit(BIGNUM *a, int n); -char *BN_bn2hex(const BIGNUM *a); -char *BN_bn2dec(const BIGNUM *a); -int BN_hex2bn(BIGNUM **a, const char *str); -int BN_dec2bn(BIGNUM **a, const char *str); -int BN_asc2bn(BIGNUM **a, const char *str); -int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); -int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns - * -2 for - * error */ -BIGNUM *BN_mod_inverse(BIGNUM *ret, - const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); -BIGNUM *BN_mod_sqrt(BIGNUM *ret, - const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); - -void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); - -/* Deprecated versions */ -DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, - const BIGNUM *add, - const BIGNUM *rem, - void (*callback) (int, int, - void *), - void *cb_arg)) -DEPRECATEDIN_0_9_8(int - BN_is_prime(const BIGNUM *p, int nchecks, - void (*callback) (int, int, void *), - BN_CTX *ctx, void *cb_arg)) -DEPRECATEDIN_0_9_8(int - BN_is_prime_fasttest(const BIGNUM *p, int nchecks, - void (*callback) (int, int, void *), - BN_CTX *ctx, void *cb_arg, - int do_trial_division)) - -/* Newer versions */ -int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, - const BIGNUM *rem, BN_GENCB *cb); -int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); -int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, - int do_trial_division, BN_GENCB *cb); - -int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); - -int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, - const BIGNUM *Xp, const BIGNUM *Xp1, - const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, - BN_GENCB *cb); -int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, - BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, - BN_CTX *ctx, BN_GENCB *cb); - -BN_MONT_CTX *BN_MONT_CTX_new(void); -int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - BN_MONT_CTX *mont, BN_CTX *ctx); -int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -void BN_MONT_CTX_free(BN_MONT_CTX *mont); -int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); -BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); -BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, - const BIGNUM *mod, BN_CTX *ctx); - -/* BN_BLINDING flags */ -# define BN_BLINDING_NO_UPDATE 0x00000001 -# define BN_BLINDING_NO_RECREATE 0x00000002 - -BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); -void BN_BLINDING_free(BN_BLINDING *b); -int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); -int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, - BN_CTX *); - -int BN_BLINDING_is_current_thread(BN_BLINDING *b); -void BN_BLINDING_set_current_thread(BN_BLINDING *b); -int BN_BLINDING_lock(BN_BLINDING *b); -int BN_BLINDING_unlock(BN_BLINDING *b); - -unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); -void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); -BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, - const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, - int (*bn_mod_exp) (BIGNUM *r, - const BIGNUM *a, - const BIGNUM *p, - const BIGNUM *m, - BN_CTX *ctx, - BN_MONT_CTX *m_ctx), - BN_MONT_CTX *m_ctx); - -DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont)) -DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3 - * mont */ - -BN_RECP_CTX *BN_RECP_CTX_new(void); -void BN_RECP_CTX_free(BN_RECP_CTX *recp); -int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); -int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, - BN_RECP_CTX *recp, BN_CTX *ctx); -int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); -int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, - BN_RECP_CTX *recp, BN_CTX *ctx); - -# ifndef OPENSSL_NO_EC2M - -/* - * Functions for arithmetic over binary polynomials represented by BIGNUMs. - * The BIGNUM::neg property of BIGNUMs representing binary polynomials is - * ignored. Note that input arguments are not const so that their bit arrays - * can be expanded to the appropriate size if needed. - */ - -/* - * r = a + b - */ -int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) -/* - * r=a mod p - */ -int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); -/* r = (a * b) mod p */ -int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = (a * a) mod p */ -int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -/* r = (1 / b) mod p */ -int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); -/* r = (a / b) mod p */ -int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = (a ^ b) mod p */ -int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = sqrt(a) mod p */ -int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - BN_CTX *ctx); -/* r^2 + r = a mod p */ -int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - BN_CTX *ctx); -# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) -/*- - * Some functions allow for representation of the irreducible polynomials - * as an unsigned int[], say p. The irreducible f(t) is then of the form: - * t^p[0] + t^p[1] + ... + t^p[k] - * where m = p[0] > p[1] > ... > p[k] = 0. - */ -/* r = a mod p */ -int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); -/* r = (a * b) mod p */ -int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = (a * a) mod p */ -int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], - BN_CTX *ctx); -/* r = (1 / b) mod p */ -int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], - BN_CTX *ctx); -/* r = (a / b) mod p */ -int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = (a ^ b) mod p */ -int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = sqrt(a) mod p */ -int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, - const int p[], BN_CTX *ctx); -/* r^2 + r = a mod p */ -int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, - const int p[], BN_CTX *ctx); -int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); -int BN_GF2m_arr2poly(const int p[], BIGNUM *a); - -# endif - -/* - * faster mod functions for the 'NIST primes' 0 <= a < p^2 - */ -int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - -const BIGNUM *BN_get0_nist_prime_192(void); -const BIGNUM *BN_get0_nist_prime_224(void); -const BIGNUM *BN_get0_nist_prime_256(void); -const BIGNUM *BN_get0_nist_prime_384(void); -const BIGNUM *BN_get0_nist_prime_521(void); - -int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a, - const BIGNUM *field, BN_CTX *ctx); - -int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, - const BIGNUM *priv, const unsigned char *message, - size_t message_len, BN_CTX *ctx); - -/* Primes from RFC 2409 */ -BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn); -BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn); - -/* Primes from RFC 3526 */ -BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768 -# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024 -# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536 -# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048 -# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072 -# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096 -# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144 -# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192 -# endif - -int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bnerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bnerr.h deleted file mode 100644 index 9f3c7cfa..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/bnerr.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/buffer.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/buffer.h deleted file mode 100644 index d2765766..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/buffer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 1995-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_BUFFER_H -# define HEADER_BUFFER_H - -# include -# ifndef HEADER_CRYPTO_H -# include -# endif -# include - - -#ifdef __cplusplus -extern "C" { -#endif - -# include -# include - -/* - * 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 { - size_t length; /* current number of bytes */ - char *data; - 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_ex(unsigned long flags); -void BUF_MEM_free(BUF_MEM *a); -size_t BUF_MEM_grow(BUF_MEM *str, size_t len); -size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); -void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/buffererr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/buffererr.h deleted file mode 100644 index 04f6ff7a..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/buffererr.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/camellia.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/camellia.h deleted file mode 100644 index 151f3c13..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/camellia.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2006-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_CAMELLIA_H -# define HEADER_CAMELLIA_H - -# include - -# ifndef OPENSSL_NO_CAMELLIA -# include -#ifdef __cplusplus -extern "C" { -#endif - -# define CAMELLIA_ENCRYPT 1 -# define CAMELLIA_DECRYPT 0 - -/* - * Because array size can't be a const in C, the following two are macros. - * Both sizes are in bytes. - */ - -/* This should be a hidden type, but EVP requires that the size be known */ - -# define CAMELLIA_BLOCK_SIZE 16 -# define CAMELLIA_TABLE_BYTE_LEN 272 -# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) - -typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match - * with WORD */ - -struct camellia_key_st { - union { - double d; /* ensures 64-bit align */ - KEY_TABLE_TYPE rd_key; - } u; - int grand_rounds; -}; -typedef struct camellia_key_st CAMELLIA_KEY; - -int Camellia_set_key(const unsigned char *userKey, const int bits, - CAMELLIA_KEY *key); - -void Camellia_encrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key); -void Camellia_decrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key); - -void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key, const int enc); -void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, const int enc); -void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num); -void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char ivec[CAMELLIA_BLOCK_SIZE], - unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], - unsigned int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cast.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cast.h deleted file mode 100644 index 2cc89ae0..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cast.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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_CAST_H -# define HEADER_CAST_H - -# include - -# ifndef OPENSSL_NO_CAST -# ifdef __cplusplus -extern "C" { -# endif - -# define CAST_ENCRYPT 1 -# define CAST_DECRYPT 0 - -# define CAST_LONG unsigned int - -# define CAST_BLOCK 8 -# define CAST_KEY_LENGTH 16 - -typedef struct cast_key_st { - CAST_LONG data[32]; - int short_key; /* Use reduced rounds for short key */ -} CAST_KEY; - -void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); -void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, - const CAST_KEY *key, int enc); -void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); -void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); -void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *ks, unsigned char *iv, - int enc); -void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, - unsigned char *ivec, int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cmac.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cmac.h deleted file mode 100644 index 3535a9ab..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cmac.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2010-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_CMAC_H -# define HEADER_CMAC_H - -# ifndef OPENSSL_NO_CMAC - -#ifdef __cplusplus -extern "C" { -#endif - -# include - -/* Opaque */ -typedef struct CMAC_CTX_st CMAC_CTX; - -CMAC_CTX *CMAC_CTX_new(void); -void CMAC_CTX_cleanup(CMAC_CTX *ctx); -void CMAC_CTX_free(CMAC_CTX *ctx); -EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); -int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); - -int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, - const EVP_CIPHER *cipher, ENGINE *impl); -int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); -int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); -int CMAC_resume(CMAC_CTX *ctx); - -#ifdef __cplusplus -} -#endif - -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cms.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cms.h deleted file mode 100644 index c7627968..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cms.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 2008-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_CMS_H -# define HEADER_CMS_H - -# include - -# ifndef OPENSSL_NO_CMS -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -typedef struct CMS_ContentInfo_st CMS_ContentInfo; -typedef struct CMS_SignerInfo_st CMS_SignerInfo; -typedef struct CMS_CertificateChoices CMS_CertificateChoices; -typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; -typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; -typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; -typedef struct CMS_Receipt_st CMS_Receipt; -typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; -typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; - -DEFINE_STACK_OF(CMS_SignerInfo) -DEFINE_STACK_OF(CMS_RecipientEncryptedKey) -DEFINE_STACK_OF(CMS_RecipientInfo) -DEFINE_STACK_OF(CMS_RevocationInfoChoice) -DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) -DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) -DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) - -# define CMS_SIGNERINFO_ISSUER_SERIAL 0 -# define CMS_SIGNERINFO_KEYIDENTIFIER 1 - -# define CMS_RECIPINFO_NONE -1 -# define CMS_RECIPINFO_TRANS 0 -# define CMS_RECIPINFO_AGREE 1 -# define CMS_RECIPINFO_KEK 2 -# define CMS_RECIPINFO_PASS 3 -# define CMS_RECIPINFO_OTHER 4 - -/* S/MIME related flags */ - -# define CMS_TEXT 0x1 -# define CMS_NOCERTS 0x2 -# define CMS_NO_CONTENT_VERIFY 0x4 -# define CMS_NO_ATTR_VERIFY 0x8 -# define CMS_NOSIGS \ - (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY) -# define CMS_NOINTERN 0x10 -# define CMS_NO_SIGNER_CERT_VERIFY 0x20 -# define CMS_NOVERIFY 0x20 -# define CMS_DETACHED 0x40 -# define CMS_BINARY 0x80 -# define CMS_NOATTR 0x100 -# define CMS_NOSMIMECAP 0x200 -# define CMS_NOOLDMIMETYPE 0x400 -# define CMS_CRLFEOL 0x800 -# define CMS_STREAM 0x1000 -# define CMS_NOCRL 0x2000 -# define CMS_PARTIAL 0x4000 -# define CMS_REUSE_DIGEST 0x8000 -# define CMS_USE_KEYID 0x10000 -# define CMS_DEBUG_DECRYPT 0x20000 -# define CMS_KEY_PARAM 0x40000 -# define CMS_ASCIICRLF 0x80000 - -const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms); - -BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); -int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); - -ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); -int CMS_is_detached(CMS_ContentInfo *cms); -int CMS_set_detached(CMS_ContentInfo *cms, int detached); - -# ifdef HEADER_PEM_H -DECLARE_PEM_rw_const(CMS, CMS_ContentInfo) -# endif -int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms); -CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms); -int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms); - -BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); -int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); -int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, - int flags); -CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont); -int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags); - -int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, - unsigned int flags); - -CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, BIO *data, - unsigned int flags); - -CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, - X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, unsigned int flags); - -int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags); -CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags); - -int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, - unsigned int flags); -CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, - unsigned int flags); - -int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, - const unsigned char *key, size_t keylen, - BIO *dcont, BIO *out, unsigned int flags); - -CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, - const unsigned char *key, - size_t keylen, unsigned int flags); - -int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, - const unsigned char *key, size_t keylen); - -int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, - X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags); - -int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, - STACK_OF(X509) *certs, - X509_STORE *store, unsigned int flags); - -STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); - -CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, - const EVP_CIPHER *cipher, unsigned int flags); - -int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, - BIO *dcont, BIO *out, unsigned int flags); - -int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert); -int CMS_decrypt_set1_key(CMS_ContentInfo *cms, - unsigned char *key, size_t keylen, - const unsigned char *id, size_t idlen); -int CMS_decrypt_set1_password(CMS_ContentInfo *cms, - unsigned char *pass, ossl_ssize_t passlen); - -STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); -int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); -EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri); -CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); -CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, - X509 *recip, unsigned int flags); -int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); -int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); -int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, - EVP_PKEY **pk, X509 **recip, - X509_ALGOR **palg); -int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, - ASN1_INTEGER **sno); - -CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, - unsigned char *key, size_t keylen, - unsigned char *id, size_t idlen, - ASN1_GENERALIZEDTIME *date, - ASN1_OBJECT *otherTypeId, - ASN1_TYPE *otherType); - -int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, - X509_ALGOR **palg, - ASN1_OCTET_STRING **pid, - ASN1_GENERALIZEDTIME **pdate, - ASN1_OBJECT **potherid, - ASN1_TYPE **pothertype); - -int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, - unsigned char *key, size_t keylen); - -int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, - const unsigned char *id, size_t idlen); - -int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, - unsigned char *pass, - ossl_ssize_t passlen); - -CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, - int iter, int wrap_nid, - int pbe_nid, - unsigned char *pass, - ossl_ssize_t passlen, - const EVP_CIPHER *kekciph); - -int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); -int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); - -int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, - unsigned int flags); -CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); - -int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); -const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); - -CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms); -int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); -int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); -STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); - -CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms); -int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); -int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); -STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); - -int CMS_SignedData_init(CMS_ContentInfo *cms); -CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, - X509 *signer, EVP_PKEY *pk, const EVP_MD *md, - unsigned int flags); -EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si); -EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si); -STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); - -void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); -int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, ASN1_INTEGER **sno); -int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); -int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs, - unsigned int flags); -void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, - X509 **signer, X509_ALGOR **pdig, - X509_ALGOR **psig); -ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); -int CMS_SignerInfo_sign(CMS_SignerInfo *si); -int CMS_SignerInfo_verify(CMS_SignerInfo *si); -int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain); - -int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs); -int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, - int algnid, int keysize); -int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap); - -int CMS_signed_get_attr_count(const CMS_SignerInfo *si); -int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, - int lastpos); -int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc); -X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc); -int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); -int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int type, - const void *bytes, int len); -int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, - int nid, int type, - const void *bytes, int len); -int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, - const char *attrname, int type, - const void *bytes, int len); -void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, - int lastpos, int type); - -int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si); -int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, - int lastpos); -int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int lastpos); -X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc); -X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc); -int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); -int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int type, - const void *bytes, int len); -int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, - int nid, int type, - const void *bytes, int len); -int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, - const char *attrname, int type, - const void *bytes, int len); -void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, - int lastpos, int type); - -int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); -CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, - int allorfirst, - STACK_OF(GENERAL_NAMES) - *receiptList, STACK_OF(GENERAL_NAMES) - *receiptsTo); -int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); -void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, - ASN1_STRING **pcid, - int *pallorfirst, - STACK_OF(GENERAL_NAMES) **plist, - STACK_OF(GENERAL_NAMES) **prto); -int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, - X509_ALGOR **palg, - ASN1_OCTET_STRING **pukm); -STACK_OF(CMS_RecipientEncryptedKey) -*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri); - -int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, - X509_ALGOR **pubalg, - ASN1_BIT_STRING **pubkey, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, - ASN1_INTEGER **sno); - -int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert); - -int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, - ASN1_OCTET_STRING **keyid, - ASN1_GENERALIZEDTIME **tm, - CMS_OtherKeyAttribute **other, - X509_NAME **issuer, ASN1_INTEGER **sno); -int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, - X509 *cert); -int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); -EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri); -int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, - CMS_RecipientInfo *ri, - CMS_RecipientEncryptedKey *rek); - -int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, - ASN1_OCTET_STRING *ukm, int keylen); - -/* Backward compatibility for spelling errors. */ -# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM -# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \ - CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cmserr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cmserr.h deleted file mode 100644 index 7dbc13dc..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cmserr.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/comp.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/comp.h deleted file mode 100644 index d814d3cf..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/comp.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 -# define HEADER_COMP_H - -# include - -# ifndef OPENSSL_NO_COMP -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - - - -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); - -int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); -int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); - -COMP_METHOD *COMP_zlib(void); - -#if OPENSSL_API_COMPAT < 0x10100000L -#define COMP_zlib_cleanup() while(0) continue -#endif - -# ifdef HEADER_BIO_H -# ifdef ZLIB -const BIO_METHOD *BIO_f_zlib(void); -# endif -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/comperr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/comperr.h deleted file mode 100644 index 90231e9a..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/comperr.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/conf.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/conf.h deleted file mode 100644 index 7336cd2f..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/conf.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 1995-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_CONF_H -# define HEADER_CONF_H - -# include -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - char *section; - char *name; - char *value; -} CONF_VALUE; - -DEFINE_STACK_OF(CONF_VALUE) -DEFINE_LHASH_OF(CONF_VALUE); - -struct conf_st; -struct conf_method_st; -typedef struct conf_method_st CONF_METHOD; - -struct conf_method_st { - const char *name; - CONF *(*create) (CONF_METHOD *meth); - int (*init) (CONF *conf); - int (*destroy) (CONF *conf); - int (*destroy_data) (CONF *conf); - int (*load_bio) (CONF *conf, BIO *bp, long *eline); - int (*dump) (const CONF *conf, BIO *bp); - int (*is_number) (const CONF *conf, char c); - int (*to_int) (const CONF *conf, char c); - int (*load) (CONF *conf, const char *name, long *eline); -}; - -/* Module definitions */ - -typedef struct conf_imodule_st CONF_IMODULE; -typedef struct conf_module_st CONF_MODULE; - -DEFINE_STACK_OF(CONF_MODULE) -DEFINE_STACK_OF(CONF_IMODULE) - -/* DSO module function typedefs */ -typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); -typedef void conf_finish_func (CONF_IMODULE *md); - -# define CONF_MFLAGS_IGNORE_ERRORS 0x1 -# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 -# define CONF_MFLAGS_SILENT 0x4 -# define CONF_MFLAGS_NO_DSO 0x8 -# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 -# define CONF_MFLAGS_DEFAULT_SECTION 0x20 - -int CONF_set_default_method(CONF_METHOD *meth); -void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); -LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, - long *eline); -# ifndef OPENSSL_NO_STDIO -LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, - long *eline); -# endif -LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, - long *eline); -STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, - const char *section); -char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -void CONF_free(LHASH_OF(CONF_VALUE) *conf); -#ifndef OPENSSL_NO_STDIO -int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); -#endif -int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); - -DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name)) - -#if OPENSSL_API_COMPAT < 0x10100000L -# define OPENSSL_no_config() \ - OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) -#endif - -/* - * New conf code. The semantics are different from the functions above. If - * that wasn't the case, the above functions would have been replaced - */ - -struct conf_st { - CONF_METHOD *meth; - void *meth_data; - LHASH_OF(CONF_VALUE) *data; -}; - -CONF *NCONF_new(CONF_METHOD *meth); -CONF_METHOD *NCONF_default(void); -CONF_METHOD *NCONF_WIN32(void); -void NCONF_free(CONF *conf); -void NCONF_free_data(CONF *conf); - -int NCONF_load(CONF *conf, const char *file, long *eline); -# ifndef OPENSSL_NO_STDIO -int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); -# endif -int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); -STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, - const char *section); -char *NCONF_get_string(const CONF *conf, const char *group, const char *name); -int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, - long *result); -#ifndef OPENSSL_NO_STDIO -int NCONF_dump_fp(const CONF *conf, FILE *out); -#endif -int NCONF_dump_bio(const CONF *conf, BIO *out); - -#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) - -/* Module functions */ - -int CONF_modules_load(const CONF *cnf, const char *appname, - unsigned long flags); -int CONF_modules_load_file(const char *filename, const char *appname, - unsigned long flags); -void CONF_modules_unload(int all); -void CONF_modules_finish(void); -#if OPENSSL_API_COMPAT < 0x10100000L -# define CONF_modules_free() while(0) continue -#endif -int CONF_module_add(const char *name, conf_init_func *ifunc, - conf_finish_func *ffunc); - -const char *CONF_imodule_get_name(const CONF_IMODULE *md); -const char *CONF_imodule_get_value(const CONF_IMODULE *md); -void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); -void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); -CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); -unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); -void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); -void *CONF_module_get_usr_data(CONF_MODULE *pmod); -void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); - -char *CONF_get1_default_config_file(void); - -int CONF_parse_list(const char *list, int sep, int nospc, - int (*list_cb) (const char *elem, int len, void *usr), - void *arg); - -void OPENSSL_load_builtin_modules(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/conf_api.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/conf_api.h deleted file mode 100644 index a0275ad7..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/conf_api.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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_CONF_API_H -# define HEADER_CONF_API_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Up until OpenSSL 0.9.5a, this was new_section */ -CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); -/* Up until OpenSSL 0.9.5a, this was get_section */ -CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); -/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ -STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, - const char *section); - -int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); -char *_CONF_get_string(const CONF *conf, const char *section, - const char *name); -long _CONF_get_number(const CONF *conf, const char *section, - const char *name); - -int _CONF_new_data(CONF *conf); -void _CONF_free_data(CONF *conf); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/conferr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/conferr.h deleted file mode 100644 index 32b92291..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/conferr.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/crypto.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/crypto.h deleted file mode 100644 index 7d0b5262..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/crypto.h +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_CRYPTO_H -# define HEADER_CRYPTO_H - -# include -# include - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# endif - -# include -# include -# include -# include -# include - -# ifdef CHARSET_EBCDIC -# include -# endif - -/* - * Resolve problems on some operating systems with symbol names that clash - * one way or another - */ -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSLeay OpenSSL_version_num -# define SSLeay_version OpenSSL_version -# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER -# define SSLEAY_VERSION OPENSSL_VERSION -# define SSLEAY_CFLAGS OPENSSL_CFLAGS -# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON -# define SSLEAY_PLATFORM OPENSSL_PLATFORM -# define SSLEAY_DIR OPENSSL_DIR - -/* - * Old type for allocating dynamic locks. No longer used. Use the new thread - * API instead. - */ -typedef struct { - int dummy; -} CRYPTO_dynlock; - -# endif /* OPENSSL_API_COMPAT */ - -typedef void CRYPTO_RWLOCK; - -CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void); -int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock); -int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock); -int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock); -void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock); - -int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock); - -/* - * The following can be used to detect memory leaks in the library. If - * used, it turns on malloc checking - */ -# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */ -# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */ -# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */ -# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */ - -struct crypto_ex_data_st { - STACK_OF(void) *sk; -}; -DEFINE_STACK_OF(void) - -/* - * Per class, we have a STACK of function pointers. - */ -# define CRYPTO_EX_INDEX_SSL 0 -# define CRYPTO_EX_INDEX_SSL_CTX 1 -# define CRYPTO_EX_INDEX_SSL_SESSION 2 -# define CRYPTO_EX_INDEX_X509 3 -# define CRYPTO_EX_INDEX_X509_STORE 4 -# define CRYPTO_EX_INDEX_X509_STORE_CTX 5 -# define CRYPTO_EX_INDEX_DH 6 -# define CRYPTO_EX_INDEX_DSA 7 -# define CRYPTO_EX_INDEX_EC_KEY 8 -# define CRYPTO_EX_INDEX_RSA 9 -# define CRYPTO_EX_INDEX_ENGINE 10 -# define CRYPTO_EX_INDEX_UI 11 -# define CRYPTO_EX_INDEX_BIO 12 -# define CRYPTO_EX_INDEX_APP 13 -# define CRYPTO_EX_INDEX_UI_METHOD 14 -# define CRYPTO_EX_INDEX_DRBG 15 -# define CRYPTO_EX_INDEX__COUNT 16 - -/* No longer needed, so this is a no-op */ -#define OPENSSL_malloc_init() while(0) continue - -int CRYPTO_mem_ctrl(int mode); - -# define OPENSSL_malloc(num) \ - CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_zalloc(num) \ - CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_realloc(addr, num) \ - CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_clear_realloc(addr, old_num, num) \ - CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_clear_free(addr, num) \ - CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_free(addr) \ - CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_memdup(str, s) \ - CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_strdup(str) \ - CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_strndup(str, n) \ - CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_malloc(num) \ - CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_zalloc(num) \ - CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_free(addr) \ - CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_clear_free(addr, num) \ - CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_actual_size(ptr) \ - CRYPTO_secure_actual_size(ptr) - -size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz); -size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz); -size_t OPENSSL_strnlen(const char *str, size_t maxlen); -char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len); -unsigned char *OPENSSL_hexstr2buf(const char *str, long *len); -int OPENSSL_hexchar2int(unsigned char c); - -# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type)) - -unsigned long OpenSSL_version_num(void); -const char *OpenSSL_version(int type); -# define OPENSSL_VERSION 0 -# define OPENSSL_CFLAGS 1 -# define OPENSSL_BUILT_ON 2 -# define OPENSSL_PLATFORM 3 -# define OPENSSL_DIR 4 -# define OPENSSL_ENGINES_DIR 5 - -int OPENSSL_issetugid(void); - -typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); -typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); -typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, - void *from_d, int idx, long argl, void *argp); -__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, - CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); -/* No longer use an index. */ -int CRYPTO_free_ex_index(int class_index, int idx); - -/* - * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a - * given class (invokes whatever per-class callbacks are applicable) - */ -int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); -int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, - const CRYPTO_EX_DATA *from); - -void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); - -/* - * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular - * index (relative to the class type involved) - */ -int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); -void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); - -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * This function cleans up all "ex_data" state. It mustn't be called under - * potential race-conditions. - */ -# define CRYPTO_cleanup_all_ex_data() while(0) continue - -/* - * The old locking functions have been removed completely without compatibility - * macros. This is because the old functions either could not properly report - * errors, or the returned error values were not clearly documented. - * Replacing the locking functions with no-ops would cause race condition - * issues in the affected applications. It is far better for them to fail at - * compile time. - * On the other hand, the locking callbacks are no longer used. Consequently, - * the callback management functions can be safely replaced with no-op macros. - */ -# define CRYPTO_num_locks() (1) -# define CRYPTO_set_locking_callback(func) -# define CRYPTO_get_locking_callback() (NULL) -# define CRYPTO_set_add_lock_callback(func) -# define CRYPTO_get_add_lock_callback() (NULL) - -/* - * These defines where used in combination with the old locking callbacks, - * they are not called anymore, but old code that's not called might still - * use them. - */ -# define CRYPTO_LOCK 1 -# define CRYPTO_UNLOCK 2 -# define CRYPTO_READ 4 -# define CRYPTO_WRITE 8 - -/* This structure is no longer used */ -typedef struct crypto_threadid_st { - int dummy; -} CRYPTO_THREADID; -/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ -# define CRYPTO_THREADID_set_numeric(id, val) -# define CRYPTO_THREADID_set_pointer(id, ptr) -# define CRYPTO_THREADID_set_callback(threadid_func) (0) -# define CRYPTO_THREADID_get_callback() (NULL) -# define CRYPTO_THREADID_current(id) -# define CRYPTO_THREADID_cmp(a, b) (-1) -# define CRYPTO_THREADID_cpy(dest, src) -# define CRYPTO_THREADID_hash(id) (0UL) - -# if OPENSSL_API_COMPAT < 0x10000000L -# define CRYPTO_set_id_callback(func) -# define CRYPTO_get_id_callback() (NULL) -# define CRYPTO_thread_id() (0UL) -# endif /* OPENSSL_API_COMPAT < 0x10000000L */ - -# define CRYPTO_set_dynlock_create_callback(dyn_create_function) -# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function) -# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function) -# define CRYPTO_get_dynlock_create_callback() (NULL) -# define CRYPTO_get_dynlock_lock_callback() (NULL) -# define CRYPTO_get_dynlock_destroy_callback() (NULL) -# endif /* OPENSSL_API_COMPAT < 0x10100000L */ - -int CRYPTO_set_mem_functions( - void *(*m) (size_t, const char *, int), - void *(*r) (void *, size_t, const char *, int), - void (*f) (void *, const char *, int)); -int CRYPTO_set_mem_debug(int flag); -void CRYPTO_get_mem_functions( - void *(**m) (size_t, const char *, int), - void *(**r) (void *, size_t, const char *, int), - void (**f) (void *, const char *, int)); - -void *CRYPTO_malloc(size_t num, const char *file, int line); -void *CRYPTO_zalloc(size_t num, const char *file, int line); -void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); -char *CRYPTO_strdup(const char *str, const char *file, int line); -char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); -void CRYPTO_free(void *ptr, const char *file, int line); -void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line); -void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); -void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num, - const char *file, int line); - -int CRYPTO_secure_malloc_init(size_t sz, int minsize); -int CRYPTO_secure_malloc_done(void); -void *CRYPTO_secure_malloc(size_t num, const char *file, int line); -void *CRYPTO_secure_zalloc(size_t num, const char *file, int line); -void CRYPTO_secure_free(void *ptr, const char *file, int line); -void CRYPTO_secure_clear_free(void *ptr, size_t num, - const char *file, int line); -int CRYPTO_secure_allocated(const void *ptr); -int CRYPTO_secure_malloc_initialized(void); -size_t CRYPTO_secure_actual_size(void *ptr); -size_t CRYPTO_secure_used(void); - -void OPENSSL_cleanse(void *ptr, size_t len); - -# ifndef OPENSSL_NO_CRYPTO_MDEBUG -# define OPENSSL_mem_debug_push(info) \ - CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_mem_debug_pop() \ - CRYPTO_mem_debug_pop() -int CRYPTO_mem_debug_push(const char *info, const char *file, int line); -int CRYPTO_mem_debug_pop(void); -void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount); - -/*- - * Debugging functions (enabled by CRYPTO_set_mem_debug(1)) - * The flag argument has the following significance: - * 0: called before the actual memory allocation has taken place - * 1: called after the actual memory allocation has taken place - */ -void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag, - const char *file, int line); -void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag, - const char *file, int line); -void CRYPTO_mem_debug_free(void *addr, int flag, - const char *file, int line); - -int CRYPTO_mem_leaks_cb(int (*cb) (const char *str, size_t len, void *u), - void *u); -# ifndef OPENSSL_NO_STDIO -int CRYPTO_mem_leaks_fp(FILE *); -# endif -int CRYPTO_mem_leaks(BIO *bio); -# endif - -/* die if we have to */ -ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line); -# if OPENSSL_API_COMPAT < 0x10100000L -# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l)) -# endif -# define OPENSSL_assert(e) \ - (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1)) - -int OPENSSL_isservice(void); - -int FIPS_mode(void); -int FIPS_mode_set(int r); - -void OPENSSL_init(void); -# ifdef OPENSSL_SYS_UNIX -void OPENSSL_fork_prepare(void); -void OPENSSL_fork_parent(void); -void OPENSSL_fork_child(void); -# endif - -struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); -int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); -int OPENSSL_gmtime_diff(int *pday, int *psec, - const struct tm *from, const struct tm *to); - -/* - * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. - * It takes an amount of time dependent on |len|, but independent of the - * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements - * into a defined order as the return value when a != b is undefined, other - * than to be non-zero. - */ -int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len); - -/* Standard initialisation options */ -# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L -# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L -# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L -# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L -# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L -# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L -# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L -# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L -# define OPENSSL_INIT_ASYNC 0x00000100L -# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L -# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L -# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L -# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L -# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L -# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L -# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L -/* OPENSSL_INIT_ZLIB 0x00010000L */ -# define OPENSSL_INIT_ATFORK 0x00020000L -/* OPENSSL_INIT_BASE_ONLY 0x00040000L */ -# define OPENSSL_INIT_NO_ATEXIT 0x00080000L -/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */ -/* Max OPENSSL_INIT flag value is 0x80000000 */ - -/* openssl and dasync not counted as builtin */ -# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \ - (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \ - | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \ - OPENSSL_INIT_ENGINE_PADLOCK) - - -/* Library initialisation functions */ -void OPENSSL_cleanup(void); -int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); -int OPENSSL_atexit(void (*handler)(void)); -void OPENSSL_thread_stop(void); - -/* Low-level control of initialization */ -OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void); -# ifndef OPENSSL_NO_STDIO -int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, - const char *config_filename); -void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, - unsigned long flags); -int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, - const char *config_appname); -# endif -void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings); - -# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) -# if defined(_WIN32) -# if defined(BASETYPES) || defined(_WINDEF_H) -/* application has to include in order to use this */ -typedef DWORD CRYPTO_THREAD_LOCAL; -typedef DWORD CRYPTO_THREAD_ID; - -typedef LONG CRYPTO_ONCE; -# define CRYPTO_ONCE_STATIC_INIT 0 -# endif -# else -# include -typedef pthread_once_t CRYPTO_ONCE; -typedef pthread_key_t CRYPTO_THREAD_LOCAL; -typedef pthread_t CRYPTO_THREAD_ID; - -# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT -# endif -# endif - -# if !defined(CRYPTO_ONCE_STATIC_INIT) -typedef unsigned int CRYPTO_ONCE; -typedef unsigned int CRYPTO_THREAD_LOCAL; -typedef unsigned int CRYPTO_THREAD_ID; -# define CRYPTO_ONCE_STATIC_INIT 0 -# endif - -int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)); - -int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)); -void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key); -int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val); -int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key); - -CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void); -int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cryptoerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cryptoerr.h deleted file mode 100644 index 3db5a4ee..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cryptoerr.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ct.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ct.h deleted file mode 100644 index ebdba34d..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ct.h +++ /dev/null @@ -1,474 +0,0 @@ -/* - * 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 - -# ifndef OPENSSL_NO_CT -# include -# include -# include -# include -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cterr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cterr.h deleted file mode 100644 index feb7bc56..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/cterr.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/des.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/des.h deleted file mode 100644 index be4abbdf..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/des.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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_DES_H -# define HEADER_DES_H - -# include - -# ifndef OPENSSL_NO_DES -# ifdef __cplusplus -extern "C" { -# endif -# include - -typedef unsigned int DES_LONG; - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -typedef unsigned char DES_cblock[8]; -typedef /* const */ unsigned char const_DES_cblock[8]; -/* - * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and - * const_DES_cblock * are incompatible pointer types. - */ - -typedef struct DES_ks { - union { - DES_cblock cblock; - /* - * make sure things are correct size on machines with 8 byte longs - */ - DES_LONG deslong[2]; - } ks[16]; -} DES_key_schedule; - -# define DES_KEY_SZ (sizeof(DES_cblock)) -# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) - -# define DES_ENCRYPT 1 -# define DES_DECRYPT 0 - -# define DES_CBC_MODE 0 -# define DES_PCBC_MODE 1 - -# 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)) - -OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */ -# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) - -const char *DES_options(void); -void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, int enc); -DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, - long length, DES_key_schedule *schedule, - const_DES_cblock *ivec); -/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ -void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, const_DES_cblock *inw, - const_DES_cblock *outw, int enc); -void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks, int enc); - -/* - * This is the DES encryption function that gets called by just about every - * other DES routine in the library. You should not use this function except - * to implement 'modes' of DES. I say this because the functions that call - * this routine do the conversion from 'char *' to long, and this needs to be - * done to make sure 'non-aligned' memory access do not occur. The - * characters are loaded 'little endian'. Data is a pointer to 2 unsigned - * long's and ks is the DES_key_schedule to use. enc, is non zero specifies - * encryption, zero if decryption. - */ -void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); - -/* - * This functions is the same as DES_encrypt1() except that the DES initial - * permutation (IP) and final permutation (FP) have been left out. As for - * DES_encrypt1(), you should not use this function. It is used by the - * routines in the library that implement triple DES. IP() DES_encrypt2() - * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() - * DES_encrypt1() DES_encrypt1() except faster :-). - */ -void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); - -void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, DES_cblock *ivec, int enc); -void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num, int enc); -void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, - int numbits, long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int enc); -void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num); -char *DES_fcrypt(const char *buf, const char *salt, char *ret); -char *DES_crypt(const char *buf, const char *salt); -void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, - DES_cblock *ivec); -void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], - long length, int out_count, DES_cblock *seed); -int DES_random_key(DES_cblock *ret); -void DES_set_odd_parity(DES_cblock *key); -int DES_check_key_parity(const_DES_cblock *key); -int DES_is_weak_key(const_DES_cblock *key); -/* - * DES_set_key (= set_key = DES_key_sched = key_sched) calls - * DES_set_key_checked if global variable DES_check_key is set, - * DES_set_key_unchecked otherwise. - */ -int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); -int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); -int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); -void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); -void DES_string_to_key(const char *str, DES_cblock *key); -void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); -void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int *num, int enc); -void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int *num); - -# define DES_fixup_key_parity DES_set_odd_parity - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dh.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dh.h deleted file mode 100644 index 3527540c..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dh.h +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright 1995-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_DH_H -# define HEADER_DH_H - -# include - -# ifndef OPENSSL_NO_DH -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include - -# ifdef __cplusplus -extern "C" { -# endif - -# ifndef OPENSSL_DH_MAX_MODULUS_BITS -# define OPENSSL_DH_MAX_MODULUS_BITS 10000 -# endif - -# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 - -# define DH_FLAG_CACHE_MONT_P 0x01 - -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define DH_FLAG_NO_EXP_CONSTTIME 0x00 -# endif - -/* - * If this flag is set the DH method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define DH_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define DH_FLAG_NON_FIPS_ALLOW 0x0400 - -/* Already defined in ossl_typ.h */ -/* typedef struct dh_st DH; */ -/* typedef struct dh_method DH_METHOD; */ - -DECLARE_ASN1_ITEM(DHparams) - -# define DH_GENERATOR_2 2 -/* #define DH_GENERATOR_3 3 */ -# define DH_GENERATOR_5 5 - -/* DH_check error codes */ -# define DH_CHECK_P_NOT_PRIME 0x01 -# define DH_CHECK_P_NOT_SAFE_PRIME 0x02 -# define DH_UNABLE_TO_CHECK_GENERATOR 0x04 -# define DH_NOT_SUITABLE_GENERATOR 0x08 -# define DH_CHECK_Q_NOT_PRIME 0x10 -# define DH_CHECK_INVALID_Q_VALUE 0x20 -# define DH_CHECK_INVALID_J_VALUE 0x40 - -/* DH_check_pub_key error codes */ -# define DH_CHECK_PUBKEY_TOO_SMALL 0x01 -# define DH_CHECK_PUBKEY_TOO_LARGE 0x02 -# define DH_CHECK_PUBKEY_INVALID 0x04 - -/* - * primes p where (p-1)/2 is prime too are called "safe"; we define this for - * backward compatibility: - */ -# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME - -# define d2i_DHparams_fp(fp,x) \ - (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ - (char *(*)())d2i_DHparams, \ - (fp), \ - (unsigned char **)(x)) -# define i2d_DHparams_fp(fp,x) \ - ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x)) -# define d2i_DHparams_bio(bp,x) \ - ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) -# define i2d_DHparams_bio(bp,x) \ - ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) - -# define d2i_DHxparams_fp(fp,x) \ - (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ - (char *(*)())d2i_DHxparams, \ - (fp), \ - (unsigned char **)(x)) -# define i2d_DHxparams_fp(fp,x) \ - ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x)) -# define d2i_DHxparams_bio(bp,x) \ - ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) -# define i2d_DHxparams_bio(bp,x) \ - ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x) - -DH *DHparams_dup(DH *); - -const DH_METHOD *DH_OpenSSL(void); - -void DH_set_default_method(const DH_METHOD *meth); -const DH_METHOD *DH_get_default_method(void); -int DH_set_method(DH *dh, const DH_METHOD *meth); -DH *DH_new_method(ENGINE *engine); - -DH *DH_new(void); -void DH_free(DH *dh); -int DH_up_ref(DH *dh); -int DH_bits(const DH *dh); -int DH_size(const DH *dh); -int DH_security_bits(const DH *dh); -#define DH_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef) -int DH_set_ex_data(DH *d, int idx, void *arg); -void *DH_get_ex_data(DH *d, int idx); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator, - void (*callback) (int, int, - void *), - void *cb_arg)) - -/* New version */ -int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, - BN_GENCB *cb); - -int DH_check_params_ex(const DH *dh); -int DH_check_ex(const DH *dh); -int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key); -int DH_check_params(const DH *dh, int *ret); -int DH_check(const DH *dh, int *codes); -int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes); -int DH_generate_key(DH *dh); -int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); -int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh); -DH *d2i_DHparams(DH **a, const unsigned char **pp, long length); -int i2d_DHparams(const DH *a, unsigned char **pp); -DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length); -int i2d_DHxparams(const DH *a, unsigned char **pp); -# ifndef OPENSSL_NO_STDIO -int DHparams_print_fp(FILE *fp, const DH *x); -# endif -int DHparams_print(BIO *bp, const DH *x); - -/* RFC 5114 parameters */ -DH *DH_get_1024_160(void); -DH *DH_get_2048_224(void); -DH *DH_get_2048_256(void); - -/* Named parameters, currently RFC7919 */ -DH *DH_new_by_nid(int nid); -int DH_get_nid(const DH *dh); - -# ifndef OPENSSL_NO_CMS -/* RFC2631 KDF */ -int DH_KDF_X9_42(unsigned char *out, size_t outlen, - const unsigned char *Z, size_t Zlen, - ASN1_OBJECT *key_oid, - const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); -# endif - -void DH_get0_pqg(const DH *dh, - const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); -void DH_get0_key(const DH *dh, - const BIGNUM **pub_key, const BIGNUM **priv_key); -int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); -const BIGNUM *DH_get0_p(const DH *dh); -const BIGNUM *DH_get0_q(const DH *dh); -const BIGNUM *DH_get0_g(const DH *dh); -const BIGNUM *DH_get0_priv_key(const DH *dh); -const BIGNUM *DH_get0_pub_key(const DH *dh); -void DH_clear_flags(DH *dh, int flags); -int DH_test_flags(const DH *dh, int flags); -void DH_set_flags(DH *dh, int flags); -ENGINE *DH_get0_engine(DH *d); -long DH_get_length(const DH *dh); -int DH_set_length(DH *dh, long length); - -DH_METHOD *DH_meth_new(const char *name, int flags); -void DH_meth_free(DH_METHOD *dhm); -DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); -const char *DH_meth_get0_name(const DH_METHOD *dhm); -int DH_meth_set1_name(DH_METHOD *dhm, const char *name); -int DH_meth_get_flags(const DH_METHOD *dhm); -int DH_meth_set_flags(DH_METHOD *dhm, int flags); -void *DH_meth_get0_app_data(const DH_METHOD *dhm); -int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); -int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); -int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); -int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) - (unsigned char *key, const BIGNUM *pub_key, DH *dh); -int DH_meth_set_compute_key(DH_METHOD *dhm, - int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); -int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) - (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - BN_CTX *, BN_MONT_CTX *); -int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, - int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); -int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); -int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); -int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); -int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); -int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) - (DH *, int, int, BN_GENCB *); -int DH_meth_set_generate_params(DH_METHOD *dhm, - int (*generate_params) (DH *, int, int, BN_GENCB *)); - - -# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) - -# define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) - -# define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) - -# define EVP_PKEY_CTX_set_dh_nid(ctx, nid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, \ - EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_DH_NID, nid, NULL) - -# define EVP_PKEY_CTX_set_dh_pad(ctx, pad) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_PAD, pad, NULL) - -# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL) - -# define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL) - -# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)(oid)) - -# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)(poid)) - -# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)(plen)) - -# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)(p)) - -# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)(p)) - -# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) -# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) -# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) -# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) -# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) -# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) -# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15) -# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16) - -/* KDF types */ -# define EVP_PKEY_DH_KDF_NONE 1 -# ifndef OPENSSL_NO_CMS -# define EVP_PKEY_DH_KDF_X9_42 2 -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dherr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dherr.h deleted file mode 100644 index 916b3bed..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dherr.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dsa.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dsa.h deleted file mode 100644 index 6d8a18a4..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dsa.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 1995-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_DSA_H -# define HEADER_DSA_H - -# include - -# ifndef OPENSSL_NO_DSA -# ifdef __cplusplus -extern "C" { -# endif -# include -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include - -# ifndef OPENSSL_DSA_MAX_MODULUS_BITS -# define OPENSSL_DSA_MAX_MODULUS_BITS 10000 -# endif - -# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 - -# define DSA_FLAG_CACHE_MONT_P 0x01 -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define DSA_FLAG_NO_EXP_CONSTTIME 0x00 -# endif - -/* - * If this flag is set the DSA method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define DSA_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define DSA_FLAG_NON_FIPS_ALLOW 0x0400 -# define DSA_FLAG_FIPS_CHECKED 0x0800 - -/* Already defined in ossl_typ.h */ -/* typedef struct dsa_st DSA; */ -/* typedef struct dsa_method DSA_METHOD; */ - -typedef struct DSA_SIG_st DSA_SIG; - -# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ - (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) -# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ - (unsigned char *)(x)) -# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) -# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) - -DSA *DSAparams_dup(DSA *x); -DSA_SIG *DSA_SIG_new(void); -void DSA_SIG_free(DSA_SIG *a); -int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); -DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); -void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); -int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); - -DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); -int DSA_do_verify(const unsigned char *dgst, int dgst_len, - DSA_SIG *sig, DSA *dsa); - -const DSA_METHOD *DSA_OpenSSL(void); - -void DSA_set_default_method(const DSA_METHOD *); -const DSA_METHOD *DSA_get_default_method(void); -int DSA_set_method(DSA *dsa, const DSA_METHOD *); -const DSA_METHOD *DSA_get_method(DSA *d); - -DSA *DSA_new(void); -DSA *DSA_new_method(ENGINE *engine); -void DSA_free(DSA *r); -/* "up" the DSA object's reference count */ -int DSA_up_ref(DSA *r); -int DSA_size(const DSA *); -int DSA_bits(const DSA *d); -int DSA_security_bits(const DSA *d); - /* next 4 return -1 on error */ -DEPRECATEDIN_1_2_0(int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)) -int DSA_sign(int type, const unsigned char *dgst, int dlen, - unsigned char *sig, unsigned int *siglen, DSA *dsa); -int DSA_verify(int type, const unsigned char *dgst, int dgst_len, - const unsigned char *sigbuf, int siglen, DSA *dsa); -#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef) -int DSA_set_ex_data(DSA *d, int idx, void *arg); -void *DSA_get_ex_data(DSA *d, int idx); - -DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); -DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); -DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits, - unsigned char *seed, - int seed_len, - int *counter_ret, - unsigned long *h_ret, void - (*callback) (int, int, - void *), - void *cb_arg)) - -/* New version */ -int DSA_generate_parameters_ex(DSA *dsa, int bits, - const unsigned char *seed, int seed_len, - int *counter_ret, unsigned long *h_ret, - BN_GENCB *cb); - -int DSA_generate_key(DSA *a); -int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); -int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); -int i2d_DSAparams(const DSA *a, unsigned char **pp); - -int DSAparams_print(BIO *bp, const DSA *x); -int DSA_print(BIO *bp, const DSA *x, int off); -# ifndef OPENSSL_NO_STDIO -int DSAparams_print_fp(FILE *fp, const DSA *x); -int DSA_print_fp(FILE *bp, const DSA *x, int off); -# endif - -# define DSS_prime_checks 64 -/* - * Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only - * have one value here we set the number of checks to 64 which is the 128 bit - * security level that is the highest level and valid for creating a 3072 bit - * DSA key. - */ -# define DSA_is_prime(n, callback, cb_arg) \ - BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) - -# ifndef OPENSSL_NO_DH -/* - * Convert DSA structure (key or just parameters) into DH structure (be - * careful to avoid small subgroup attacks when using this!) - */ -DH *DSA_dup_DH(const DSA *r); -# endif - -# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) -# define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits, NULL) -# define EVP_PKEY_CTX_set_dsa_paramgen_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) - -void DSA_get0_pqg(const DSA *d, - const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); -void DSA_get0_key(const DSA *d, - const BIGNUM **pub_key, const BIGNUM **priv_key); -int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); -const BIGNUM *DSA_get0_p(const DSA *d); -const BIGNUM *DSA_get0_q(const DSA *d); -const BIGNUM *DSA_get0_g(const DSA *d); -const BIGNUM *DSA_get0_pub_key(const DSA *d); -const BIGNUM *DSA_get0_priv_key(const DSA *d); -void DSA_clear_flags(DSA *d, int flags); -int DSA_test_flags(const DSA *d, int flags); -void DSA_set_flags(DSA *d, int flags); -ENGINE *DSA_get0_engine(DSA *d); - -DSA_METHOD *DSA_meth_new(const char *name, int flags); -void DSA_meth_free(DSA_METHOD *dsam); -DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam); -const char *DSA_meth_get0_name(const DSA_METHOD *dsam); -int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name); -int DSA_meth_get_flags(const DSA_METHOD *dsam); -int DSA_meth_set_flags(DSA_METHOD *dsam, int flags); -void *DSA_meth_get0_app_data(const DSA_METHOD *dsam); -int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data); -DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam)) - (const unsigned char *, int, DSA *); -int DSA_meth_set_sign(DSA_METHOD *dsam, - DSA_SIG *(*sign) (const unsigned char *, int, DSA *)); -int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam)) - (DSA *, BN_CTX *, BIGNUM **, BIGNUM **); -int DSA_meth_set_sign_setup(DSA_METHOD *dsam, - int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)); -int (*DSA_meth_get_verify(const DSA_METHOD *dsam)) - (const unsigned char *, int, DSA_SIG *, DSA *); -int DSA_meth_set_verify(DSA_METHOD *dsam, - int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *)); -int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam)) - (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); -int DSA_meth_set_mod_exp(DSA_METHOD *dsam, - int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, - BN_MONT_CTX *)); -int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam)) - (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - BN_CTX *, BN_MONT_CTX *); -int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, - int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); -int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *); -int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *)); -int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *); -int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *)); -int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam)) - (DSA *, int, const unsigned char *, int, int *, unsigned long *, - BN_GENCB *); -int DSA_meth_set_paramgen(DSA_METHOD *dsam, - int (*paramgen) (DSA *, int, const unsigned char *, int, int *, - unsigned long *, BN_GENCB *)); -int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *); -int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *)); - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dsaerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dsaerr.h deleted file mode 100644 index 495a1ac8..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dsaerr.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dtls1.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dtls1.h deleted file mode 100644 index d55ca9c3..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/dtls1.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2005-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_DTLS1_H -# define HEADER_DTLS1_H - -#ifdef __cplusplus -extern "C" { -#endif - -# define DTLS1_VERSION 0xFEFF -# define DTLS1_2_VERSION 0xFEFD -# define DTLS_MIN_VERSION DTLS1_VERSION -# define DTLS_MAX_VERSION DTLS1_2_VERSION -# define DTLS1_VERSION_MAJOR 0xFE - -# define DTLS1_BAD_VER 0x0100 - -/* Special value for method supporting multiple versions */ -# define DTLS_ANY_VERSION 0x1FFFF - -/* lengths of messages */ -/* - * Actually the max cookie length in DTLS is 255. But we can't change this now - * due to compatibility concerns. - */ -# define DTLS1_COOKIE_LENGTH 256 - -# define DTLS1_RT_HEADER_LENGTH 13 - -# define DTLS1_HM_HEADER_LENGTH 12 - -# define DTLS1_HM_BAD_FRAGMENT -2 -# define DTLS1_HM_FRAGMENT_RETRY -3 - -# define DTLS1_CCS_HEADER_LENGTH 1 - -# define DTLS1_AL_HEADER_LENGTH 2 - -/* Timeout multipliers */ -# define DTLS1_TMO_READ_COUNT 2 -# define DTLS1_TMO_WRITE_COUNT 2 - -# define DTLS1_TMO_ALERT_COUNT 12 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/e_os2.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/e_os2.h deleted file mode 100644 index 97a776cd..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/e_os2.h +++ /dev/null @@ -1,300 +0,0 @@ -/* - * 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_E_OS2_H -# define HEADER_E_OS2_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/****************************************************************************** - * Detect operating systems. This probably needs completing. - * The result is that at least one OPENSSL_SYS_os macro should be defined. - * However, if none is defined, Unix is assumed. - **/ - -# define OPENSSL_SYS_UNIX - -/* --------------------- Microsoft operating systems ---------------------- */ - -/* - * Note that MSDOS actually denotes 32-bit environments running on top of - * MS-DOS, such as DJGPP one. - */ -# if defined(OPENSSL_SYS_MSDOS) -# undef OPENSSL_SYS_UNIX -# endif - -/* - * For 32 bit environment, there seems to be the CygWin environment and then - * all the others that try to do the same thing Microsoft does... - */ -/* - * UEFI lives here because it might be built with a Microsoft toolchain and - * we need to avoid the false positive match on Windows. - */ -# if defined(OPENSSL_SYS_UEFI) -# undef OPENSSL_SYS_UNIX -# elif defined(OPENSSL_SYS_UWIN) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WIN32_UWIN -# else -# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN) -# define OPENSSL_SYS_WIN32_CYGWIN -# else -# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32) -# undef OPENSSL_SYS_UNIX -# if !defined(OPENSSL_SYS_WIN32) -# define OPENSSL_SYS_WIN32 -# endif -# endif -# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64) -# undef OPENSSL_SYS_UNIX -# if !defined(OPENSSL_SYS_WIN64) -# define OPENSSL_SYS_WIN64 -# endif -# endif -# if defined(OPENSSL_SYS_WINNT) -# undef OPENSSL_SYS_UNIX -# endif -# if defined(OPENSSL_SYS_WINCE) -# undef OPENSSL_SYS_UNIX -# endif -# endif -# endif - -/* Anything that tries to look like Microsoft is "Windows" */ -# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_SYS_MSDOS -# define OPENSSL_SYS_MSDOS -# endif -# endif - -/* - * DLL settings. This part is a bit tough, because it's up to the - * application implementor how he or she will link the application, so it - * requires some macro to be used. - */ -# ifdef OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_OPT_WINDLL -# if defined(_WINDLL) /* This is used when building OpenSSL to - * indicate that DLL linkage should be used */ -# define OPENSSL_OPT_WINDLL -# endif -# endif -# endif - -/* ------------------------------- OpenVMS -------------------------------- */ -# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS) -# if !defined(OPENSSL_SYS_VMS) -# undef OPENSSL_SYS_UNIX -# endif -# define OPENSSL_SYS_VMS -# if defined(__DECC) -# define OPENSSL_SYS_VMS_DECC -# elif defined(__DECCXX) -# define OPENSSL_SYS_VMS_DECC -# define OPENSSL_SYS_VMS_DECCXX -# else -# define OPENSSL_SYS_VMS_NODECC -# endif -# endif - -/* -------------------------------- Unix ---------------------------------- */ -# ifdef OPENSSL_SYS_UNIX -# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX) -# define OPENSSL_SYS_LINUX -# endif -# if defined(_AIX) && !defined(OPENSSL_SYS_AIX) -# define OPENSSL_SYS_AIX -# endif -# endif - -/* -------------------------------- VOS ----------------------------------- */ -# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS) -# define OPENSSL_SYS_VOS -# ifdef __HPPA__ -# define OPENSSL_SYS_VOS_HPPA -# endif -# ifdef __IA32__ -# define OPENSSL_SYS_VOS_IA32 -# endif -# endif - -/** - * That's it for OS-specific stuff - *****************************************************************************/ - -/* Specials for I/O an exit */ -# ifdef OPENSSL_SYS_MSDOS -# define OPENSSL_UNISTD_IO -# define OPENSSL_DECLARE_EXIT extern void exit(int); -# else -# define OPENSSL_UNISTD_IO OPENSSL_UNISTD -# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ -# endif - -/*- - * OPENSSL_EXTERN is normally used to declare a symbol with possible extra - * attributes to handle its presence in a shared library. - * OPENSSL_EXPORT is used to define a symbol with extra possible attributes - * to make it visible in a shared library. - * Care needs to be taken when a header file is used both to declare and - * define symbols. Basically, for any library that exports some global - * variables, the following code must be present in the header file that - * declares them, before OPENSSL_EXTERN is used: - * - * #ifdef SOME_BUILD_FLAG_MACRO - * # undef OPENSSL_EXTERN - * # define OPENSSL_EXTERN OPENSSL_EXPORT - * #endif - * - * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN - * have some generally sensible values. - */ - -# if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) -# define OPENSSL_EXPORT extern __declspec(dllexport) -# define OPENSSL_EXTERN extern __declspec(dllimport) -# else -# define OPENSSL_EXPORT extern -# define OPENSSL_EXTERN extern -# endif - -/*- - * Macros to allow global variables to be reached through function calls when - * required (if a shared library version requires it, for example. - * The way it's done allows definitions like this: - * - * // in foobar.c - * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) - * // in foobar.h - * OPENSSL_DECLARE_GLOBAL(int,foobar); - * #define foobar OPENSSL_GLOBAL_REF(foobar) - */ -# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ - type *_shadow_##name(void) \ - { static type _hide_##name=value; return &_hide_##name; } -# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) -# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) -# else -# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) type _shadow_##name=value; -# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name -# define OPENSSL_GLOBAL_REF(name) _shadow_##name -# endif - -# ifdef _WIN32 -# ifdef _WIN64 -# define ossl_ssize_t __int64 -# define OSSL_SSIZE_MAX _I64_MAX -# else -# define ossl_ssize_t int -# define OSSL_SSIZE_MAX INT_MAX -# endif -# endif - -# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t) -# define ossl_ssize_t INTN -# define OSSL_SSIZE_MAX MAX_INTN -# endif - -# ifndef ossl_ssize_t -# define ossl_ssize_t ssize_t -# if defined(SSIZE_MAX) -# define OSSL_SSIZE_MAX SSIZE_MAX -# elif defined(_POSIX_SSIZE_MAX) -# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX -# else -# define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1)) -# endif -# endif - -# ifdef DEBUG_UNUSED -# define __owur __attribute__((__warn_unused_result__)) -# else -# define __owur -# endif - -/* Standard integer types */ -# if defined(OPENSSL_SYS_UEFI) -typedef INT8 int8_t; -typedef UINT8 uint8_t; -typedef INT16 int16_t; -typedef UINT16 uint16_t; -typedef INT32 int32_t; -typedef UINT32 uint32_t; -typedef INT64 int64_t; -typedef UINT64 uint64_t; -# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ - defined(__osf__) || defined(__sgi) || defined(__hpux) || \ - defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__) -# include -# elif defined(_MSC_VER) && _MSC_VER<=1500 -/* - * minimally required typdefs for systems not supporting inttypes.h or - * stdint.h: currently just older VC++ - */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -# else -# include -# endif - -/* ossl_inline: portable inline definition usable in public headers */ -# if !defined(inline) && !defined(__cplusplus) -# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L - /* just use inline */ -# define ossl_inline inline -# elif defined(__GNUC__) && __GNUC__>=2 -# define ossl_inline __inline__ -# elif defined(_MSC_VER) - /* - * Visual Studio: inline is available in C++ only, however - * __inline is available for C, see - * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx - */ -# define ossl_inline __inline -# else -# define ossl_inline -# endif -# else -# define ossl_inline inline -# endif - -# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -# define ossl_noreturn _Noreturn -# elif defined(__GNUC__) && __GNUC__ >= 2 -# define ossl_noreturn __attribute__((noreturn)) -# else -# define ossl_noreturn -# endif - -/* ossl_unused: portable unused attribute for use in public headers */ -# if defined(__GNUC__) -# define ossl_unused __attribute__((unused)) -# else -# define ossl_unused -# endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ebcdic.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ebcdic.h deleted file mode 100644 index aa012855..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ebcdic.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 1999-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_EBCDIC_H -# define HEADER_EBCDIC_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Avoid name clashes with other applications */ -# define os_toascii _openssl_os_toascii -# define os_toebcdic _openssl_os_toebcdic -# define ebcdic2ascii _openssl_ebcdic2ascii -# define ascii2ebcdic _openssl_ascii2ebcdic - -extern const unsigned char os_toascii[256]; -extern const unsigned char os_toebcdic[256]; -void *ebcdic2ascii(void *dest, const void *srce, size_t count); -void *ascii2ebcdic(void *dest, const void *srce, size_t count); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ec.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ec.h deleted file mode 100644 index 5af9ebdc..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ec.h +++ /dev/null @@ -1,1479 +0,0 @@ -/* - * Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_EC_H -# define HEADER_EC_H - -# include - -# ifndef OPENSSL_NO_EC -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# ifdef __cplusplus -extern "C" { -# endif - -# ifndef OPENSSL_ECC_MAX_FIELD_BITS -# define OPENSSL_ECC_MAX_FIELD_BITS 661 -# endif - -/** Enum for the point conversion form as defined in X9.62 (ECDSA) - * for the encoding of a elliptic curve point (x,y) */ -typedef enum { - /** the point is encoded as z||x, where the octet z specifies - * which solution of the quadratic equation y is */ - POINT_CONVERSION_COMPRESSED = 2, - /** the point is encoded as z||x||y, where z is the octet 0x04 */ - POINT_CONVERSION_UNCOMPRESSED = 4, - /** the point is encoded as z||x||y, where the octet z specifies - * which solution of the quadratic equation y is */ - POINT_CONVERSION_HYBRID = 6 -} point_conversion_form_t; - -typedef struct ec_method_st EC_METHOD; -typedef struct ec_group_st EC_GROUP; -typedef struct ec_point_st EC_POINT; -typedef struct ecpk_parameters_st ECPKPARAMETERS; -typedef struct ec_parameters_st ECPARAMETERS; - -/********************************************************************/ -/* EC_METHODs for curves over GF(p) */ -/********************************************************************/ - -/** Returns the basic GFp ec methods which provides the basis for the - * optimized methods. - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_simple_method(void); - -/** Returns GFp methods using montgomery multiplication. - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_mont_method(void); - -/** Returns GFp methods using optimized methods for NIST recommended curves - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nist_method(void); - -# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -/** Returns 64-bit optimized methods for nistp224 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp224_method(void); - -/** Returns 64-bit optimized methods for nistp256 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp256_method(void); - -/** Returns 64-bit optimized methods for nistp521 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp521_method(void); -# endif - -# ifndef OPENSSL_NO_EC2M -/********************************************************************/ -/* EC_METHOD for curves over GF(2^m) */ -/********************************************************************/ - -/** Returns the basic GF2m ec method - * \return EC_METHOD object - */ -const EC_METHOD *EC_GF2m_simple_method(void); - -# endif - -/********************************************************************/ -/* EC_GROUP functions */ -/********************************************************************/ - -/** Creates a new EC_GROUP object - * \param meth EC_METHOD to use - * \return newly created EC_GROUP object or NULL in case of an error. - */ -EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); - -/** Frees a EC_GROUP object - * \param group EC_GROUP object to be freed. - */ -void EC_GROUP_free(EC_GROUP *group); - -/** Clears and frees a EC_GROUP object - * \param group EC_GROUP object to be cleared and freed. - */ -void EC_GROUP_clear_free(EC_GROUP *group); - -/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. - * \param dst destination EC_GROUP object - * \param src source EC_GROUP object - * \return 1 on success and 0 if an error occurred. - */ -int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); - -/** Creates a new EC_GROUP object and copies the copies the content - * form src to the newly created EC_KEY object - * \param src source EC_GROUP object - * \return newly created EC_GROUP object or NULL in case of an error. - */ -EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); - -/** Returns the EC_METHOD of the EC_GROUP object. - * \param group EC_GROUP object - * \return EC_METHOD used in this EC_GROUP object. - */ -const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); - -/** Returns the field type of the EC_METHOD. - * \param meth EC_METHOD object - * \return NID of the underlying field type OID. - */ -int EC_METHOD_get_field_type(const EC_METHOD *meth); - -/** Sets the generator and its order/cofactor of a EC_GROUP object. - * \param group EC_GROUP object - * \param generator EC_POINT object with the generator. - * \param order the order of the group generated by the generator. - * \param cofactor the index of the sub-group generated by the generator - * in the group of all points on the elliptic curve. - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, - const BIGNUM *order, const BIGNUM *cofactor); - -/** Returns the generator of a EC_GROUP object. - * \param group EC_GROUP object - * \return the currently used generator (possibly NULL). - */ -const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); - -/** Returns the montgomery data for order(Generator) - * \param group EC_GROUP object - * \return the currently used montgomery data (possibly NULL). -*/ -BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); - -/** Gets the order of a EC_GROUP - * \param group EC_GROUP object - * \param order BIGNUM to which the order is copied - * \param ctx unused - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); - -/** Gets the order of an EC_GROUP - * \param group EC_GROUP object - * \return the group order - */ -const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); - -/** Gets the number of bits of the order of an EC_GROUP - * \param group EC_GROUP object - * \return number of bits of group order. - */ -int EC_GROUP_order_bits(const EC_GROUP *group); - -/** Gets the cofactor of a EC_GROUP - * \param group EC_GROUP object - * \param cofactor BIGNUM to which the cofactor is copied - * \param ctx unused - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, - BN_CTX *ctx); - -/** Gets the cofactor of an EC_GROUP - * \param group EC_GROUP object - * \return the group cofactor - */ -const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group); - -/** Sets the name of a EC_GROUP object - * \param group EC_GROUP object - * \param nid NID of the curve name OID - */ -void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); - -/** Returns the curve name of a EC_GROUP object - * \param group EC_GROUP object - * \return NID of the curve name OID or 0 if not set. - */ -int EC_GROUP_get_curve_name(const EC_GROUP *group); - -void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); -int EC_GROUP_get_asn1_flag(const EC_GROUP *group); - -void EC_GROUP_set_point_conversion_form(EC_GROUP *group, - point_conversion_form_t form); -point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); - -unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); -size_t EC_GROUP_get_seed_len(const EC_GROUP *); -size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); - -/** Sets the parameters of a ec curve defined by y^2 = x^3 + a*x + b (for GFp) - * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); - -/** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp) - * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, - BN_CTX *ctx); - -/** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, - const BIGNUM *a, const BIGNUM *b, - BN_CTX *ctx)) - -/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, - BIGNUM *a, BIGNUM *b, - BN_CTX *ctx)) - -# ifndef OPENSSL_NO_EC2M -/** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, - const BIGNUM *a, const BIGNUM *b, - BN_CTX *ctx)) - -/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, - BIGNUM *a, BIGNUM *b, - BN_CTX *ctx)) -# endif -/** Returns the number of bits needed to represent a field element - * \param group EC_GROUP object - * \return number of bits needed to represent a field element - */ -int EC_GROUP_get_degree(const EC_GROUP *group); - -/** Checks whether the parameter in the EC_GROUP define a valid ec group - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 if group is a valid ec group and 0 otherwise - */ -int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); - -/** Checks whether the discriminant of the elliptic curve is zero or not - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 if the discriminant is not zero and 0 otherwise - */ -int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); - -/** Compares two EC_GROUP objects - * \param a first EC_GROUP object - * \param b second EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 0 if the groups are equal, 1 if not, or -1 on error - */ -int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); - -/* - * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after - * choosing an appropriate EC_METHOD - */ - -/** Creates a new EC_GROUP object with the specified parameters defined - * over GFp (defined by the equation y^2 = x^3 + a*x + b) - * \param p BIGNUM with the prime number - * \param a BIGNUM with the parameter a of the equation - * \param b BIGNUM with the parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return newly created EC_GROUP object with the specified parameters - */ -EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); -# ifndef OPENSSL_NO_EC2M -/** Creates a new EC_GROUP object with the specified parameters defined - * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) - * \param p BIGNUM with the polynomial defining the underlying field - * \param a BIGNUM with the parameter a of the equation - * \param b BIGNUM with the parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return newly created EC_GROUP object with the specified parameters - */ -EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); -# endif - -/** Creates a EC_GROUP object with a curve specified by a NID - * \param nid NID of the OID of the curve name - * \return newly created EC_GROUP object with specified curve or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_by_curve_name(int nid); - -/** Creates a new EC_GROUP object from an ECPARAMETERS object - * \param params pointer to the ECPARAMETERS object - * \return newly created EC_GROUP object with specified curve or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params); - -/** Creates an ECPARAMETERS object for the given EC_GROUP object. - * \param group pointer to the EC_GROUP object - * \param params pointer to an existing ECPARAMETERS object or NULL - * \return pointer to the new ECPARAMETERS object or NULL - * if an error occurred. - */ -ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, - ECPARAMETERS *params); - -/** Creates a new EC_GROUP object from an ECPKPARAMETERS object - * \param params pointer to an existing ECPKPARAMETERS object, or NULL - * \return newly created EC_GROUP object with specified curve, or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params); - -/** Creates an ECPKPARAMETERS object for the given EC_GROUP object. - * \param group pointer to the EC_GROUP object - * \param params pointer to an existing ECPKPARAMETERS object or NULL - * \return pointer to the new ECPKPARAMETERS object or NULL - * if an error occurred. - */ -ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, - ECPKPARAMETERS *params); - -/********************************************************************/ -/* handling of internal curves */ -/********************************************************************/ - -typedef struct { - int nid; - const char *comment; -} EC_builtin_curve; - -/* - * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all - * available curves or zero if a error occurred. In case r is not zero, - * nitems EC_builtin_curve structures are filled with the data of the first - * nitems internal groups - */ -size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); - -const char *EC_curve_nid2nist(int nid); -int EC_curve_nist2nid(const char *name); - -/********************************************************************/ -/* EC_POINT functions */ -/********************************************************************/ - -/** Creates a new EC_POINT object for the specified EC_GROUP - * \param group EC_GROUP the underlying EC_GROUP object - * \return newly created EC_POINT object or NULL if an error occurred - */ -EC_POINT *EC_POINT_new(const EC_GROUP *group); - -/** Frees a EC_POINT object - * \param point EC_POINT object to be freed - */ -void EC_POINT_free(EC_POINT *point); - -/** Clears and frees a EC_POINT object - * \param point EC_POINT object to be cleared and freed - */ -void EC_POINT_clear_free(EC_POINT *point); - -/** Copies EC_POINT object - * \param dst destination EC_POINT object - * \param src source EC_POINT object - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); - -/** Creates a new EC_POINT object and copies the content of the supplied - * EC_POINT - * \param src source EC_POINT object - * \param group underlying the EC_GROUP object - * \return newly created EC_POINT object or NULL if an error occurred - */ -EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); - -/** Returns the EC_METHOD used in EC_POINT object - * \param point EC_POINT object - * \return the EC_METHOD used - */ -const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); - -/** Sets a point to infinity (neutral element) - * \param group underlying EC_GROUP object - * \param point EC_POINT to set to infinity - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); - -/** Sets the jacobian projective coordinates of a EC_POINT over GFp - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param z BIGNUM with the z-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, const BIGNUM *x, - const BIGNUM *y, const BIGNUM *z, - BN_CTX *ctx); - -/** Gets the jacobian projective coordinates of a EC_POINT over GFp - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param z BIGNUM for the z-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, - const EC_POINT *p, BIGNUM *x, - BIGNUM *y, BIGNUM *z, - BN_CTX *ctx); - -/** Sets the affine coordinates of an EC_POINT - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, - const BIGNUM *x, const BIGNUM *y, - BN_CTX *ctx); - -/** Gets the affine coordinates of an EC_POINT. - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p, - BIGNUM *x, BIGNUM *y, BN_CTX *ctx); - -/** Sets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_set_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - const BIGNUM *y, - BN_CTX *ctx)) - -/** Gets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_get_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, - const EC_POINT *p, - BIGNUM *x, - BIGNUM *y, - BN_CTX *ctx)) - -/** Sets the x9.62 compressed coordinates of a EC_POINT - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p, - const BIGNUM *x, int y_bit, - BN_CTX *ctx); - -/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of - * EC_POINT_set_compressed_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - int y_bit, - BN_CTX *ctx)) -# ifndef OPENSSL_NO_EC2M -/** Sets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_set_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - const BIGNUM *y, - BN_CTX *ctx)) - -/** Gets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_get_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, - const EC_POINT *p, - BIGNUM *x, - BIGNUM *y, - BN_CTX *ctx)) - -/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of - * EC_POINT_set_compressed_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - int y_bit, - BN_CTX *ctx)) -# endif -/** Encodes a EC_POINT object to a octet string - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param form point conversion form - * \param buf memory buffer for the result. If NULL the function returns - * required buffer size. - * \param len length of the memory buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, - point_conversion_form_t form, - unsigned char *buf, size_t len, BN_CTX *ctx); - -/** Decodes a EC_POINT from a octet string - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param buf memory buffer with the encoded ec point - * \param len length of the encoded ec point - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, - const unsigned char *buf, size_t len, BN_CTX *ctx); - -/** Encodes an EC_POINT object to an allocated octet string - * \param group underlying EC_GROUP object - * \param point EC_POINT object - * \param form point conversion form - * \param pbuf returns pointer to allocated buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point, - point_conversion_form_t form, - unsigned char **pbuf, BN_CTX *ctx); - -/* other interfaces to point2oct/oct2point: */ -BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, - point_conversion_form_t form, BIGNUM *, BN_CTX *); -EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, - EC_POINT *, BN_CTX *); -char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, - point_conversion_form_t form, BN_CTX *); -EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, - EC_POINT *, BN_CTX *); - -/********************************************************************/ -/* functions for doing EC_POINT arithmetic */ -/********************************************************************/ - -/** Computes the sum of two EC_POINT - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result (r = a + b) - * \param a EC_POINT object with the first summand - * \param b EC_POINT object with the second summand - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, - const EC_POINT *b, BN_CTX *ctx); - -/** Computes the double of a EC_POINT - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result (r = 2 * a) - * \param a EC_POINT object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, - BN_CTX *ctx); - -/** Computes the inverse of a EC_POINT - * \param group underlying EC_GROUP object - * \param a EC_POINT object to be inverted (it's used for the result as well) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); - -/** Checks whether the point is the neutral element of the group - * \param group the underlying EC_GROUP object - * \param p EC_POINT object - * \return 1 if the point is the neutral element and 0 otherwise - */ -int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); - -/** Checks whether the point is on the curve - * \param group underlying EC_GROUP object - * \param point EC_POINT object to check - * \param ctx BN_CTX object (optional) - * \return 1 if the point is on the curve, 0 if not, or -1 on error - */ -int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, - BN_CTX *ctx); - -/** Compares two EC_POINTs - * \param group underlying EC_GROUP object - * \param a first EC_POINT object - * \param b second EC_POINT object - * \param ctx BN_CTX object (optional) - * \return 1 if the points are not equal, 0 if they are, or -1 on error - */ -int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, - BN_CTX *ctx); - -int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); -int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, - EC_POINT *points[], BN_CTX *ctx); - -/** Computes r = generator * n + sum_{i=0}^{num-1} p[i] * m[i] - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result - * \param n BIGNUM with the multiplier for the group generator (optional) - * \param num number further summands - * \param p array of size num of EC_POINT objects - * \param m array of size num of BIGNUM objects - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, - size_t num, const EC_POINT *p[], const BIGNUM *m[], - BN_CTX *ctx); - -/** Computes r = generator * n + q * m - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result - * \param n BIGNUM with the multiplier for the group generator (optional) - * \param q EC_POINT object with the first factor of the second summand - * \param m BIGNUM with the second factor of the second summand - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, - const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); - -/** Stores multiples of generator for faster point multiplication - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); - -/** Reports whether a precomputation has been done - * \param group EC_GROUP object - * \return 1 if a pre-computation has been done and 0 otherwise - */ -int EC_GROUP_have_precompute_mult(const EC_GROUP *group); - -/********************************************************************/ -/* ASN1 stuff */ -/********************************************************************/ - -DECLARE_ASN1_ITEM(ECPKPARAMETERS) -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPKPARAMETERS) -DECLARE_ASN1_ITEM(ECPARAMETERS) -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) - -/* - * EC_GROUP_get_basis_type() returns the NID of the basis type used to - * represent the field elements - */ -int EC_GROUP_get_basis_type(const EC_GROUP *); -# ifndef OPENSSL_NO_EC2M -int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); -int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, - unsigned int *k2, unsigned int *k3); -# endif - -# define OPENSSL_EC_EXPLICIT_CURVE 0x000 -# define OPENSSL_EC_NAMED_CURVE 0x001 - -EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); -int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); - -# define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) -# define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) -# define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ - (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) -# define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ - (unsigned char *)(x)) - -int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); -# ifndef OPENSSL_NO_STDIO -int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); -# endif - -/********************************************************************/ -/* EC_KEY functions */ -/********************************************************************/ - -/* some values for the encoding_flag */ -# define EC_PKEY_NO_PARAMETERS 0x001 -# define EC_PKEY_NO_PUBKEY 0x002 - -/* some values for the flags field */ -# define EC_FLAG_NON_FIPS_ALLOW 0x1 -# define EC_FLAG_FIPS_CHECKED 0x2 -# define EC_FLAG_COFACTOR_ECDH 0x1000 - -/** Creates a new EC_KEY object. - * \return EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_new(void); - -int EC_KEY_get_flags(const EC_KEY *key); - -void EC_KEY_set_flags(EC_KEY *key, int flags); - -void EC_KEY_clear_flags(EC_KEY *key, int flags); - -/** Creates a new EC_KEY object using a named curve as underlying - * EC_GROUP object. - * \param nid NID of the named curve. - * \return EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_new_by_curve_name(int nid); - -/** Frees a EC_KEY object. - * \param key EC_KEY object to be freed. - */ -void EC_KEY_free(EC_KEY *key); - -/** Copies a EC_KEY object. - * \param dst destination EC_KEY object - * \param src src EC_KEY object - * \return dst or NULL if an error occurred. - */ -EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); - -/** Creates a new EC_KEY object and copies the content from src to it. - * \param src the source EC_KEY object - * \return newly created EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_dup(const EC_KEY *src); - -/** Increases the internal reference count of a EC_KEY object. - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_up_ref(EC_KEY *key); - -/** Returns the ENGINE object of a EC_KEY object - * \param eckey EC_KEY object - * \return the ENGINE object (possibly NULL). - */ -ENGINE *EC_KEY_get0_engine(const EC_KEY *eckey); - -/** Returns the EC_GROUP object of a EC_KEY object - * \param key EC_KEY object - * \return the EC_GROUP object (possibly NULL). - */ -const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); - -/** Sets the EC_GROUP of a EC_KEY object. - * \param key EC_KEY object - * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY - * object will use an own copy of the EC_GROUP). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); - -/** Returns the private key of a EC_KEY object. - * \param key EC_KEY object - * \return a BIGNUM with the private key (possibly NULL). - */ -const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); - -/** Sets the private key of a EC_KEY object. - * \param key EC_KEY object - * \param prv BIGNUM with the private key (note: the EC_KEY object - * will use an own copy of the BIGNUM). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); - -/** Returns the public key of a EC_KEY object. - * \param key the EC_KEY object - * \return a EC_POINT object with the public key (possibly NULL) - */ -const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); - -/** Sets the public key of a EC_KEY object. - * \param key EC_KEY object - * \param pub EC_POINT object with the public key (note: the EC_KEY object - * will use an own copy of the EC_POINT object). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); - -unsigned EC_KEY_get_enc_flags(const EC_KEY *key); -void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); -point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); -void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); - -#define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef) -int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg); -void *EC_KEY_get_ex_data(const EC_KEY *key, int idx); - -/* wrapper functions for the underlying EC_GROUP object */ -void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); - -/** Creates a table of pre-computed multiples of the generator to - * accelerate further EC_KEY operations. - * \param key EC_KEY object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); - -/** Creates a new ec private (and optional a new public) key. - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_generate_key(EC_KEY *key); - -/** Verifies that a private and/or public key is valid. - * \param key the EC_KEY object - * \return 1 on success and 0 otherwise. - */ -int EC_KEY_check_key(const EC_KEY *key); - -/** Indicates if an EC_KEY can be used for signing. - * \param eckey the EC_KEY object - * \return 1 if can can sign and 0 otherwise. - */ -int EC_KEY_can_sign(const EC_KEY *eckey); - -/** Sets a public key from affine coordinates performing - * necessary NIST PKV tests. - * \param key the EC_KEY object - * \param x public key x coordinate - * \param y public key y coordinate - * \return 1 on success and 0 otherwise. - */ -int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, - BIGNUM *y); - -/** Encodes an EC_KEY public key to an allocated octet string - * \param key key to encode - * \param form point conversion form - * \param pbuf returns pointer to allocated buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form, - unsigned char **pbuf, BN_CTX *ctx); - -/** Decodes a EC_KEY public key from a octet string - * \param key key to decode - * \param buf memory buffer with the encoded ec point - * \param len length of the encoded ec point - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ - -int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, - BN_CTX *ctx); - -/** Decodes an EC_KEY private key from an octet string - * \param key key to decode - * \param buf memory buffer with the encoded private key - * \param len length of the encoded key - * \return 1 on success and 0 if an error occurred - */ - -int EC_KEY_oct2priv(EC_KEY *key, const unsigned char *buf, size_t len); - -/** Encodes a EC_KEY private key to an octet string - * \param key key to encode - * \param buf memory buffer for the result. If NULL the function returns - * required buffer size. - * \param len length of the memory buffer - * \return the length of the encoded octet string or 0 if an error occurred - */ - -size_t EC_KEY_priv2oct(const EC_KEY *key, unsigned char *buf, size_t len); - -/** Encodes an EC_KEY private key to an allocated octet string - * \param eckey key to encode - * \param pbuf returns pointer to allocated buffer - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf); - -/********************************************************************/ -/* de- and encoding functions for SEC1 ECPrivateKey */ -/********************************************************************/ - -/** Decodes a private key from a memory buffer. - * \param key a pointer to a EC_KEY object which should be used (or NULL) - * \param in pointer to memory with the DER encoded private key - * \param len length of the DER encoded private key - * \return the decoded private key or NULL if an error occurred. - */ -EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes a private key object and stores the result in a buffer. - * \param key the EC_KEY object to encode - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred. - */ -int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); - -/********************************************************************/ -/* de- and encoding functions for EC parameters */ -/********************************************************************/ - -/** Decodes ec parameter from a memory buffer. - * \param key a pointer to a EC_KEY object which should be used (or NULL) - * \param in pointer to memory with the DER encoded ec parameters - * \param len length of the DER encoded ec parameters - * \return a EC_KEY object with the decoded parameters or NULL if an error - * occurred. - */ -EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes ec parameter and stores the result in a buffer. - * \param key the EC_KEY object with ec parameters to encode - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred. - */ -int i2d_ECParameters(EC_KEY *key, unsigned char **out); - -/********************************************************************/ -/* de- and encoding functions for EC public key */ -/* (octet string, not DER -- hence 'o2i' and 'i2o') */ -/********************************************************************/ - -/** Decodes a ec public key from a octet string. - * \param key a pointer to a EC_KEY object which should be used - * \param in memory buffer with the encoded public key - * \param len length of the encoded public key - * \return EC_KEY object with decoded public key or NULL if an error - * occurred. - */ -EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes a ec public key in an octet string. - * \param key the EC_KEY object with the public key - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred - */ -int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out); - -/** Prints out the ec parameters on human readable form. - * \param bp BIO object to which the information is printed - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred - */ -int ECParameters_print(BIO *bp, const EC_KEY *key); - -/** Prints out the contents of a EC_KEY object - * \param bp BIO object to which the information is printed - * \param key EC_KEY object - * \param off line offset - * \return 1 on success and 0 if an error occurred - */ -int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); - -# ifndef OPENSSL_NO_STDIO -/** Prints out the ec parameters on human readable form. - * \param fp file descriptor to which the information is printed - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred - */ -int ECParameters_print_fp(FILE *fp, const EC_KEY *key); - -/** Prints out the contents of a EC_KEY object - * \param fp file descriptor to which the information is printed - * \param key EC_KEY object - * \param off line offset - * \return 1 on success and 0 if an error occurred - */ -int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); - -# endif - -const EC_KEY_METHOD *EC_KEY_OpenSSL(void); -const EC_KEY_METHOD *EC_KEY_get_default_method(void); -void EC_KEY_set_default_method(const EC_KEY_METHOD *meth); -const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key); -int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth); -EC_KEY *EC_KEY_new_method(ENGINE *engine); - -/** The old name for ecdh_KDF_X9_63 - * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, - * it is actually specified in ANSI X9.63. - * This identifier is retained for backwards compatibility - */ -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); - -int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, - const EC_KEY *ecdh, - void *(*KDF) (const void *in, size_t inlen, - void *out, size_t *outlen)); - -typedef struct ECDSA_SIG_st 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 a negative value - * on error - */ -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); - -/** Accessor for r and s fields of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - * \param pr pointer to BIGNUM pointer for r (may be NULL) - * \param ps pointer to BIGNUM pointer for s (may be NULL) - */ -void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); - -/** Accessor for r field of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - */ -const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); - -/** Accessor for s field of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - */ -const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); - -/** Setter for r and s fields of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - * \param r pointer to BIGNUM for r (may be NULL) - * \param s pointer to BIGNUM for s (may be NULL) - */ -int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); - -/** 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 (optional), - * 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); - -/** 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 (optional), - * 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); - -/** 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); - -/********************************************************************/ -/* EC_KEY_METHOD constructors, destructors, writers and accessors */ -/********************************************************************/ - -EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth); -void EC_KEY_METHOD_free(EC_KEY_METHOD *meth); -void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, - int (*init)(EC_KEY *key), - void (*finish)(EC_KEY *key), - int (*copy)(EC_KEY *dest, const EC_KEY *src), - int (*set_group)(EC_KEY *key, const EC_GROUP *grp), - int (*set_private)(EC_KEY *key, - const BIGNUM *priv_key), - int (*set_public)(EC_KEY *key, - const EC_POINT *pub_key)); - -void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, - int (*keygen)(EC_KEY *key)); - -void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, - int (*ckey)(unsigned char **psec, - size_t *pseclen, - const EC_POINT *pub_key, - const EC_KEY *ecdh)); - -void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, - int (*sign)(int type, const unsigned char *dgst, - int dlen, unsigned char *sig, - unsigned int *siglen, - const BIGNUM *kinv, const BIGNUM *r, - EC_KEY *eckey), - int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, - BIGNUM **kinvp, BIGNUM **rp), - ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, - int dgst_len, - const BIGNUM *in_kinv, - const BIGNUM *in_r, - EC_KEY *eckey)); - -void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, - int (*verify)(int type, const unsigned - char *dgst, int dgst_len, - const unsigned char *sigbuf, - int sig_len, EC_KEY *eckey), - int (*verify_sig)(const unsigned char *dgst, - int dgst_len, - const ECDSA_SIG *sig, - EC_KEY *eckey)); - -void EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth, - int (**pinit)(EC_KEY *key), - void (**pfinish)(EC_KEY *key), - int (**pcopy)(EC_KEY *dest, const EC_KEY *src), - int (**pset_group)(EC_KEY *key, - const EC_GROUP *grp), - int (**pset_private)(EC_KEY *key, - const BIGNUM *priv_key), - int (**pset_public)(EC_KEY *key, - const EC_POINT *pub_key)); - -void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, - int (**pkeygen)(EC_KEY *key)); - -void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, - int (**pck)(unsigned char **psec, - size_t *pseclen, - const EC_POINT *pub_key, - const EC_KEY *ecdh)); - -void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, - int (**psign)(int type, const unsigned char *dgst, - int dlen, unsigned char *sig, - unsigned int *siglen, - const BIGNUM *kinv, const BIGNUM *r, - EC_KEY *eckey), - int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, - BIGNUM **kinvp, BIGNUM **rp), - ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, - int dgst_len, - const BIGNUM *in_kinv, - const BIGNUM *in_r, - EC_KEY *eckey)); - -void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, - int (**pverify)(int type, const unsigned - char *dgst, int dgst_len, - const unsigned char *sigbuf, - int sig_len, EC_KEY *eckey), - int (**pverify_sig)(const unsigned char *dgst, - int dgst_len, - const ECDSA_SIG *sig, - EC_KEY *eckey)); - -# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) - -# ifndef __cplusplus -# if defined(__SUNPRO_C) -# if __SUNPRO_C >= 0x520 -# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) -# endif -# endif -# endif - -# define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) - -# define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_EC_PARAM_ENC, flag, NULL) - -# define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_ECDH_COFACTOR, flag, NULL) - -# define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_ECDH_COFACTOR, -2, NULL) - -# define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_TYPE, kdf, NULL) - -# define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_TYPE, -2, NULL) - -# define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_OUTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, 0, \ - (void *)(plen)) - -# define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_UKM, plen, (void *)(p)) - -# define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_UKM, 0, (void *)(p)) - -/* SM2 will skip the operation check so no need to pass operation here */ -# define EVP_PKEY_CTX_set1_id(ctx, id, id_len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_SET1_ID, (int)id_len, (void*)(id)) - -# define EVP_PKEY_CTX_get1_id(ctx, id) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_GET1_ID, 0, (void*)(id)) - -# define EVP_PKEY_CTX_get1_id_len(ctx, id_len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_GET1_ID_LEN, 0, (void*)(id_len)) - -# define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) -# define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) -# define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) -# define EVP_PKEY_CTRL_SET1_ID (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET1_ID (EVP_PKEY_ALG_CTRL + 12) -# define EVP_PKEY_CTRL_GET1_ID_LEN (EVP_PKEY_ALG_CTRL + 13) -/* KDF types */ -# define EVP_PKEY_ECDH_KDF_NONE 1 -# define EVP_PKEY_ECDH_KDF_X9_63 2 -/** The old name for EVP_PKEY_ECDH_KDF_X9_63 - * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, - * it is actually specified in ANSI X9.63. - * This identifier is retained for backwards compatibility - */ -# define EVP_PKEY_ECDH_KDF_X9_62 EVP_PKEY_ECDH_KDF_X9_63 - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ecdh.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ecdh.h deleted file mode 100644 index 681f3d5e..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ecdh.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ecdsa.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ecdsa.h deleted file mode 100644 index 681f3d5e..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ecdsa.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ecerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ecerr.h deleted file mode 100644 index f7b91834..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ecerr.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * 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_ECERR_H -# define HEADER_ECERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# include - -# 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_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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/engine.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/engine.h deleted file mode 100644 index 0780f0fb..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/engine.h +++ /dev/null @@ -1,751 +0,0 @@ -/* - * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_ENGINE_H -# define HEADER_ENGINE_H - -# include - -# ifndef OPENSSL_NO_ENGINE -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# include -# include -# include -# include -# include -# endif -# include -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* - * These flags are used to control combinations of algorithm (methods) by - * bitwise "OR"ing. - */ -# define ENGINE_METHOD_RSA (unsigned int)0x0001 -# define ENGINE_METHOD_DSA (unsigned int)0x0002 -# define ENGINE_METHOD_DH (unsigned int)0x0004 -# define ENGINE_METHOD_RAND (unsigned int)0x0008 -# define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 -# define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 -# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 -# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 -# define ENGINE_METHOD_EC (unsigned int)0x0800 -/* Obvious all-or-nothing cases. */ -# define ENGINE_METHOD_ALL (unsigned int)0xFFFF -# define ENGINE_METHOD_NONE (unsigned int)0x0000 - -/* - * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used - * internally to control registration of ENGINE implementations, and can be - * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to - * initialise registered ENGINEs if they are not already initialised. - */ -# define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 - -/* ENGINE flags that can be set by ENGINE_set_flags(). */ -/* Not used */ -/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ - -/* - * This flag is for ENGINEs that wish to handle the various 'CMD'-related - * control commands on their own. Without this flag, ENGINE_ctrl() handles - * these control commands on behalf of the ENGINE using their "cmd_defns" - * data. - */ -# define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 - -/* - * This flag is for ENGINEs who return new duplicate structures when found - * via "ENGINE_by_id()". When an ENGINE must store state (eg. if - * ENGINE_ctrl() commands are called in sequence as part of some stateful - * process like key-generation setup and execution), it can set this flag - - * then each attempt to obtain the ENGINE will result in it being copied into - * a new structure. Normally, ENGINEs don't declare this flag so - * ENGINE_by_id() just increments the existing ENGINE's structural reference - * count. - */ -# define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 - -/* - * This flag if for an ENGINE that does not want its methods registered as - * part of ENGINE_register_all_complete() for example if the methods are not - * usable as default methods. - */ - -# define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 - -/* - * ENGINEs can support their own command types, and these flags are used in - * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input - * each command expects. Currently only numeric and string input is - * supported. If a control command supports none of the _NUMERIC, _STRING, or - * _NO_INPUT options, then it is regarded as an "internal" control command - - * and not for use in config setting situations. As such, they're not - * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() - * access. Changes to this list of 'command types' should be reflected - * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). - */ - -/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ -# define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 -/* - * accepts string input (cast from 'void*' to 'const char *', 4th parameter - * to ENGINE_ctrl) - */ -# define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 -/* - * Indicates that the control command takes *no* input. Ie. the control - * command is unparameterised. - */ -# define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 -/* - * Indicates that the control command is internal. This control command won't - * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() - * function. - */ -# define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 - -/* - * NB: These 3 control commands are deprecated and should not be used. - * ENGINEs relying on these commands should compile conditional support for - * compatibility (eg. if these symbols are defined) but should also migrate - * the same functionality to their own ENGINE-specific control functions that - * can be "discovered" by calling applications. The fact these control - * commands wouldn't be "executable" (ie. usable by text-based config) - * doesn't change the fact that application code can find and use them - * without requiring per-ENGINE hacking. - */ - -/* - * These flags are used to tell the ctrl function what should be done. All - * command numbers are shared between all engines, even if some don't make - * sense to some engines. In such a case, they do nothing but return the - * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. - */ -# define ENGINE_CTRL_SET_LOGSTREAM 1 -# define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 -# define ENGINE_CTRL_HUP 3/* Close and reinitialise - * any handles/connections - * etc. */ -# define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */ -# define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used - * when calling the password - * callback and the user - * interface */ -# define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration, - * given a string that - * represents a file name - * or so */ -# define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given - * section in the already - * loaded configuration */ - -/* - * These control commands allow an application to deal with an arbitrary - * engine in a dynamic way. Warn: Negative return values indicate errors FOR - * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other - * commands, including ENGINE-specific command types, return zero for an - * error. An ENGINE can choose to implement these ctrl functions, and can - * internally manage things however it chooses - it does so by setting the - * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise - * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the - * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's - * ctrl() handler need only implement its own commands - the above "meta" - * commands will be taken care of. - */ - -/* - * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", - * then all the remaining control commands will return failure, so it is - * worth checking this first if the caller is trying to "discover" the - * engine's capabilities and doesn't want errors generated unnecessarily. - */ -# define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 -/* - * Returns a positive command number for the first command supported by the - * engine. Returns zero if no ctrl commands are supported. - */ -# define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 -/* - * The 'long' argument specifies a command implemented by the engine, and the - * return value is the next command supported, or zero if there are no more. - */ -# define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 -/* - * The 'void*' argument is a command name (cast from 'const char *'), and the - * return value is the command that corresponds to it. - */ -# define ENGINE_CTRL_GET_CMD_FROM_NAME 13 -/* - * The next two allow a command to be converted into its corresponding string - * form. In each case, the 'long' argument supplies the command. In the - * NAME_LEN case, the return value is the length of the command name (not - * counting a trailing EOL). In the NAME case, the 'void*' argument must be a - * string buffer large enough, and it will be populated with the name of the - * command (WITH a trailing EOL). - */ -# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 -# define ENGINE_CTRL_GET_NAME_FROM_CMD 15 -/* The next two are similar but give a "short description" of a command. */ -# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 -# define ENGINE_CTRL_GET_DESC_FROM_CMD 17 -/* - * With this command, the return value is the OR'd combination of - * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given - * engine-specific ctrl command expects. - */ -# define ENGINE_CTRL_GET_CMD_FLAGS 18 - -/* - * ENGINE implementations should start the numbering of their own control - * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). - */ -# define ENGINE_CMD_BASE 200 - -/* - * NB: These 2 nCipher "chil" control commands are deprecated, and their - * functionality is now available through ENGINE-specific control commands - * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 - * commands should be migrated to the more general command handling before - * these are removed. - */ - -/* Flags specific to the nCipher "chil" engine */ -# define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 - /* - * Depending on the value of the (long)i argument, this sets or - * unsets the SimpleForkCheck flag in the CHIL API to enable or - * disable checking and workarounds for applications that fork(). - */ -# define ENGINE_CTRL_CHIL_NO_LOCKING 101 - /* - * This prevents the initialisation function from providing mutex - * callbacks to the nCipher library. - */ - -/* - * If an ENGINE supports its own specific control commands and wishes the - * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on - * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN - * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() - * handler that supports the stated commands (ie. the "cmd_num" entries as - * described by the array). NB: The array must be ordered in increasing order - * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element - * has cmd_num set to zero and/or cmd_name set to NULL. - */ -typedef struct ENGINE_CMD_DEFN_st { - unsigned int cmd_num; /* The command number */ - const char *cmd_name; /* The command name itself */ - const char *cmd_desc; /* A short description of the command */ - unsigned int cmd_flags; /* The input the command expects */ -} ENGINE_CMD_DEFN; - -/* Generic function pointer */ -typedef int (*ENGINE_GEN_FUNC_PTR) (void); -/* Generic function pointer taking no arguments */ -typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *); -/* Specific control function pointer */ -typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *, - void (*f) (void)); -/* Generic load_key function pointer */ -typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, - UI_METHOD *ui_method, - void *callback_data); -typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl, - STACK_OF(X509_NAME) *ca_dn, - X509 **pcert, EVP_PKEY **pkey, - STACK_OF(X509) **pother, - UI_METHOD *ui_method, - void *callback_data); -/*- - * These callback types are for an ENGINE's handler for cipher and digest logic. - * These handlers have these prototypes; - * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); - * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); - * Looking at how to implement these handlers in the case of cipher support, if - * the framework wants the EVP_CIPHER for 'nid', it will call; - * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) - * If the framework wants a list of supported 'nid's, it will call; - * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) - */ -/* - * Returns to a pointer to the array of supported cipher 'nid's. If the - * second parameter is non-NULL it is set to the size of the returned array. - */ -typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **, - const int **, int); -typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **, - int); -typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **, - const int **, int); -typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **, - const int **, int); -/* - * STRUCTURE functions ... all of these functions deal with pointers to - * ENGINE structures where the pointers have a "structural reference". This - * means that their reference is to allowed access to the structure but it - * does not imply that the structure is functional. To simply increment or - * decrement the structural reference count, use ENGINE_by_id and - * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next - * as it will automatically decrement the structural reference count of the - * "current" ENGINE and increment the structural reference count of the - * ENGINE it returns (unless it is NULL). - */ - -/* Get the first/last "ENGINE" type available. */ -ENGINE *ENGINE_get_first(void); -ENGINE *ENGINE_get_last(void); -/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ -ENGINE *ENGINE_get_next(ENGINE *e); -ENGINE *ENGINE_get_prev(ENGINE *e); -/* Add another "ENGINE" type into the array. */ -int ENGINE_add(ENGINE *e); -/* Remove an existing "ENGINE" type from the array. */ -int ENGINE_remove(ENGINE *e); -/* Retrieve an engine from the list by its unique "id" value. */ -ENGINE *ENGINE_by_id(const char *id); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define ENGINE_load_openssl() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL) -# define ENGINE_load_dynamic() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL) -# ifndef OPENSSL_NO_STATIC_ENGINE -# define ENGINE_load_padlock() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL) -# define ENGINE_load_capi() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL) -# define ENGINE_load_afalg() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL) -# endif -# define ENGINE_load_cryptodev() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) -# define ENGINE_load_rdrand() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL) -#endif -void ENGINE_load_builtin_engines(void); - -/* - * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation - * "registry" handling. - */ -unsigned int ENGINE_get_table_flags(void); -void ENGINE_set_table_flags(unsigned int flags); - -/*- Manage registration of ENGINEs per "table". For each type, there are 3 - * functions; - * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) - * ENGINE_unregister_***(e) - unregister the implementation from 'e' - * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list - * Cleanup is automatically registered from each table when required. - */ - -int ENGINE_register_RSA(ENGINE *e); -void ENGINE_unregister_RSA(ENGINE *e); -void ENGINE_register_all_RSA(void); - -int ENGINE_register_DSA(ENGINE *e); -void ENGINE_unregister_DSA(ENGINE *e); -void ENGINE_register_all_DSA(void); - -int ENGINE_register_EC(ENGINE *e); -void ENGINE_unregister_EC(ENGINE *e); -void ENGINE_register_all_EC(void); - -int ENGINE_register_DH(ENGINE *e); -void ENGINE_unregister_DH(ENGINE *e); -void ENGINE_register_all_DH(void); - -int ENGINE_register_RAND(ENGINE *e); -void ENGINE_unregister_RAND(ENGINE *e); -void ENGINE_register_all_RAND(void); - -int ENGINE_register_ciphers(ENGINE *e); -void ENGINE_unregister_ciphers(ENGINE *e); -void ENGINE_register_all_ciphers(void); - -int ENGINE_register_digests(ENGINE *e); -void ENGINE_unregister_digests(ENGINE *e); -void ENGINE_register_all_digests(void); - -int ENGINE_register_pkey_meths(ENGINE *e); -void ENGINE_unregister_pkey_meths(ENGINE *e); -void ENGINE_register_all_pkey_meths(void); - -int ENGINE_register_pkey_asn1_meths(ENGINE *e); -void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); -void ENGINE_register_all_pkey_asn1_meths(void); - -/* - * These functions register all support from the above categories. Note, use - * of these functions can result in static linkage of code your application - * may not need. If you only need a subset of functionality, consider using - * more selective initialisation. - */ -int ENGINE_register_complete(ENGINE *e); -int ENGINE_register_all_complete(void); - -/* - * Send parameterised control commands to the engine. The possibilities to - * send down an integer, a pointer to data or a function pointer are - * provided. Any of the parameters may or may not be NULL, depending on the - * command number. In actuality, this function only requires a structural - * (rather than functional) reference to an engine, but many control commands - * may require the engine be functional. The caller should be aware of trying - * commands that require an operational ENGINE, and only use functional - * references in such situations. - */ -int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)); - -/* - * This function tests if an ENGINE-specific command is usable as a - * "setting". Eg. in an application's config file that gets processed through - * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to - * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). - */ -int ENGINE_cmd_is_executable(ENGINE *e, int cmd); - -/* - * This function works like ENGINE_ctrl() with the exception of taking a - * command name instead of a command number, and can handle optional - * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation - * on how to use the cmd_name and cmd_optional. - */ -int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, - long i, void *p, void (*f) (void), int cmd_optional); - -/* - * This function passes a command-name and argument to an ENGINE. The - * cmd_name is converted to a command number and the control command is - * called using 'arg' as an argument (unless the ENGINE doesn't support such - * a command, in which case no control command is called). The command is - * checked for input flags, and if necessary the argument will be converted - * to a numeric value. If cmd_optional is non-zero, then if the ENGINE - * doesn't support the given cmd_name the return value will be success - * anyway. This function is intended for applications to use so that users - * (or config files) can supply engine-specific config data to the ENGINE at - * run-time to control behaviour of specific engines. As such, it shouldn't - * be used for calling ENGINE_ctrl() functions that return data, deal with - * binary data, or that are otherwise supposed to be used directly through - * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() - * operation in this function will be lost - the return value is interpreted - * as failure if the return value is zero, success otherwise, and this - * function returns a boolean value as a result. In other words, vendors of - * 'ENGINE'-enabled devices should write ENGINE implementations with - * parameterisations that work in this scheme, so that compliant ENGINE-based - * applications can work consistently with the same configuration for the - * same ENGINE-enabled devices, across applications. - */ -int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, - int cmd_optional); - -/* - * These functions are useful for manufacturing new ENGINE structures. They - * don't address reference counting at all - one uses them to populate an - * ENGINE structure with personalised implementations of things prior to - * using it directly or adding it to the builtin ENGINE list in OpenSSL. - * These are also here so that the ENGINE structure doesn't have to be - * exposed and break binary compatibility! - */ -ENGINE *ENGINE_new(void); -int ENGINE_free(ENGINE *e); -int ENGINE_up_ref(ENGINE *e); -int ENGINE_set_id(ENGINE *e, const char *id); -int ENGINE_set_name(ENGINE *e, const char *name); -int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); -int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); -int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth); -int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); -int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); -int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); -int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); -int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); -int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); -int ENGINE_set_load_privkey_function(ENGINE *e, - ENGINE_LOAD_KEY_PTR loadpriv_f); -int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); -int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, - ENGINE_SSL_CLIENT_CERT_PTR - loadssl_f); -int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); -int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); -int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); -int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); -int ENGINE_set_flags(ENGINE *e, int flags); -int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); -/* These functions allow control over any per-structure ENGINE data. */ -#define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef) -int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); -void *ENGINE_get_ex_data(const ENGINE *e, int idx); - -#if OPENSSL_API_COMPAT < 0x10100000L -/* - * This function previously cleaned up anything that needs it. Auto-deinit will - * now take care of it so it is no longer required to call this function. - */ -# define ENGINE_cleanup() while(0) continue -#endif - -/* - * These return values from within the ENGINE structure. These can be useful - * with functional references as well as structural references - it depends - * which you obtained. Using the result for functional purposes if you only - * obtained a structural reference may be problematic! - */ -const char *ENGINE_get_id(const ENGINE *e); -const char *ENGINE_get_name(const ENGINE *e); -const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); -const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); -const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); -const DH_METHOD *ENGINE_get_DH(const ENGINE *e); -const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); -ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); -ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); -ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); -ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE - *e); -ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); -ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); -ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); -ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); -const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); -const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); -const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); -const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); -const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, - const char *str, - int len); -const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, - const char *str, - int len); -const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); -int ENGINE_get_flags(const ENGINE *e); - -/* - * FUNCTIONAL functions. These functions deal with ENGINE structures that - * have (or will) be initialised for use. Broadly speaking, the structural - * functions are useful for iterating the list of available engine types, - * creating new engine types, and other "list" operations. These functions - * actually deal with ENGINEs that are to be used. As such these functions - * can fail (if applicable) when particular engines are unavailable - eg. if - * a hardware accelerator is not attached or not functioning correctly. Each - * ENGINE has 2 reference counts; structural and functional. Every time a - * functional reference is obtained or released, a corresponding structural - * reference is automatically obtained or released too. - */ - -/* - * Initialise a engine type for use (or up its reference count if it's - * already in use). This will fail if the engine is not currently operational - * and cannot initialise. - */ -int ENGINE_init(ENGINE *e); -/* - * Free a functional reference to a engine type. This does not require a - * corresponding call to ENGINE_free as it also releases a structural - * reference. - */ -int ENGINE_finish(ENGINE *e); - -/* - * The following functions handle keys that are stored in some secondary - * location, handled by the engine. The storage may be on a card or - * whatever. - */ -EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); -EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); -int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, - STACK_OF(X509_NAME) *ca_dn, X509 **pcert, - EVP_PKEY **ppkey, STACK_OF(X509) **pother, - UI_METHOD *ui_method, void *callback_data); - -/* - * This returns a pointer for the current ENGINE structure that is (by - * default) performing any RSA operations. The value returned is an - * incremented reference, so it should be free'd (ENGINE_finish) before it is - * discarded. - */ -ENGINE *ENGINE_get_default_RSA(void); -/* Same for the other "methods" */ -ENGINE *ENGINE_get_default_DSA(void); -ENGINE *ENGINE_get_default_EC(void); -ENGINE *ENGINE_get_default_DH(void); -ENGINE *ENGINE_get_default_RAND(void); -/* - * These functions can be used to get a functional reference to perform - * ciphering or digesting corresponding to "nid". - */ -ENGINE *ENGINE_get_cipher_engine(int nid); -ENGINE *ENGINE_get_digest_engine(int nid); -ENGINE *ENGINE_get_pkey_meth_engine(int nid); -ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); - -/* - * This sets a new default ENGINE structure for performing RSA operations. If - * the result is non-zero (success) then the ENGINE structure will have had - * its reference count up'd so the caller should still free their own - * reference 'e'. - */ -int ENGINE_set_default_RSA(ENGINE *e); -int ENGINE_set_default_string(ENGINE *e, const char *def_list); -/* Same for the other "methods" */ -int ENGINE_set_default_DSA(ENGINE *e); -int ENGINE_set_default_EC(ENGINE *e); -int ENGINE_set_default_DH(ENGINE *e); -int ENGINE_set_default_RAND(ENGINE *e); -int ENGINE_set_default_ciphers(ENGINE *e); -int ENGINE_set_default_digests(ENGINE *e); -int ENGINE_set_default_pkey_meths(ENGINE *e); -int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); - -/* - * The combination "set" - the flags are bitwise "OR"d from the - * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" - * function, this function can result in unnecessary static linkage. If your - * application requires only specific functionality, consider using more - * selective functions. - */ -int ENGINE_set_default(ENGINE *e, unsigned int flags); - -void ENGINE_add_conf_module(void); - -/* Deprecated functions ... */ -/* int ENGINE_clear_defaults(void); */ - -/**************************/ -/* DYNAMIC ENGINE SUPPORT */ -/**************************/ - -/* Binary/behaviour compatibility levels */ -# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000 -/* - * Binary versions older than this are too old for us (whether we're a loader - * or a loadee) - */ -# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000 - -/* - * When compiling an ENGINE entirely as an external shared library, loadable - * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' - * structure type provides the calling application's (or library's) error - * functionality and memory management function pointers to the loaded - * library. These should be used/set in the loaded library code so that the - * loading application's 'state' will be used/changed in all operations. The - * 'static_state' pointer allows the loaded library to know if it shares the - * same static data as the calling application (or library), and thus whether - * these callbacks need to be set or not. - */ -typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int); -typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int); -typedef void (*dyn_MEM_free_fn) (void *, const char *, int); -typedef struct st_dynamic_MEM_fns { - dyn_MEM_malloc_fn malloc_fn; - dyn_MEM_realloc_fn realloc_fn; - dyn_MEM_free_fn free_fn; -} dynamic_MEM_fns; -/* - * FIXME: Perhaps the memory and locking code (crypto.h) should declare and - * use these types so we (and any other dependent code) can simplify a bit?? - */ -/* The top-level structure */ -typedef struct st_dynamic_fns { - void *static_state; - dynamic_MEM_fns mem_fns; -} dynamic_fns; - -/* - * The version checking function should be of this prototype. NB: The - * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading - * code. If this function returns zero, it indicates a (potential) version - * incompatibility and the loaded library doesn't believe it can proceed. - * Otherwise, the returned value is the (latest) version supported by the - * loading library. The loader may still decide that the loaded code's - * version is unsatisfactory and could veto the load. The function is - * expected to be implemented with the symbol name "v_check", and a default - * implementation can be fully instantiated with - * IMPLEMENT_DYNAMIC_CHECK_FN(). - */ -typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version); -# define IMPLEMENT_DYNAMIC_CHECK_FN() \ - OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ - OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ - if (v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ - return 0; } - -/* - * This function is passed the ENGINE structure to initialise with its own - * function and command settings. It should not adjust the structural or - * functional reference counts. If this function returns zero, (a) the load - * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto - * the structure, and (c) the shared library will be unloaded. So - * implementations should do their own internal cleanup in failure - * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, - * represents the ENGINE id that the loader is looking for. If this is NULL, - * the shared library can choose to return failure or to initialise a - * 'default' ENGINE. If non-NULL, the shared library must initialise only an - * ENGINE matching the passed 'id'. The function is expected to be - * implemented with the symbol name "bind_engine". A standard implementation - * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter - * 'fn' is a callback function that populates the ENGINE structure and - * returns an int value (zero for failure). 'fn' should have prototype; - * [static] int fn(ENGINE *e, const char *id); - */ -typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, - const dynamic_fns *fns); -# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ - OPENSSL_EXPORT \ - int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ - OPENSSL_EXPORT \ - int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ - if (ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ - CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \ - fns->mem_fns.realloc_fn, \ - fns->mem_fns.free_fn); \ - skip_cbs: \ - if (!fn(e, id)) return 0; \ - return 1; } - -/* - * If the loading application (or library) and the loaded ENGINE library - * share the same static data (eg. they're both dynamically linked to the - * same libcrypto.so) we need a way to avoid trying to set system callbacks - - * this would fail, and for the same reason that it's unnecessary to try. If - * the loaded ENGINE has (or gets from through the loader) its own copy of - * the libcrypto static data, we will need to set the callbacks. The easiest - * way to detect this is to have a function that returns a pointer to some - * static data and let the loading application and loaded ENGINE compare - * their respective values. - */ -void *ENGINE_get_static_state(void); - -# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void)) -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/engineerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/engineerr.h deleted file mode 100644 index 05e84bd2..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/engineerr.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/err.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/err.h deleted file mode 100644 index b49f8812..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/err.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * 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_ERR_H -# define HEADER_ERR_H - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# include -# endif - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# ifndef OPENSSL_NO_ERR -# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) -# else -# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) -# endif - -# include - -# define ERR_TXT_MALLOCED 0x01 -# define ERR_TXT_STRING 0x02 - -# define ERR_FLAG_MARK 0x01 -# define ERR_FLAG_CLEAR 0x02 - -# define ERR_NUM_ERRORS 16 -typedef struct err_state_st { - int err_flags[ERR_NUM_ERRORS]; - unsigned long err_buffer[ERR_NUM_ERRORS]; - char *err_data[ERR_NUM_ERRORS]; - int err_data_flags[ERR_NUM_ERRORS]; - const char *err_file[ERR_NUM_ERRORS]; - int err_line[ERR_NUM_ERRORS]; - int top, bottom; -} ERR_STATE; - -/* library */ -# define ERR_LIB_NONE 1 -# define ERR_LIB_SYS 2 -# define ERR_LIB_BN 3 -# define ERR_LIB_RSA 4 -# define ERR_LIB_DH 5 -# define ERR_LIB_EVP 6 -# define ERR_LIB_BUF 7 -# define ERR_LIB_OBJ 8 -# define ERR_LIB_PEM 9 -# define ERR_LIB_DSA 10 -# define ERR_LIB_X509 11 -/* #define ERR_LIB_METH 12 */ -# define ERR_LIB_ASN1 13 -# define ERR_LIB_CONF 14 -# define ERR_LIB_CRYPTO 15 -# define ERR_LIB_EC 16 -# define ERR_LIB_SSL 20 -/* #define ERR_LIB_SSL23 21 */ -/* #define ERR_LIB_SSL2 22 */ -/* #define ERR_LIB_SSL3 23 */ -/* #define ERR_LIB_RSAREF 30 */ -/* #define ERR_LIB_PROXY 31 */ -# define ERR_LIB_BIO 32 -# define ERR_LIB_PKCS7 33 -# define ERR_LIB_X509V3 34 -# define ERR_LIB_PKCS12 35 -# define ERR_LIB_RAND 36 -# define ERR_LIB_DSO 37 -# define ERR_LIB_ENGINE 38 -# define ERR_LIB_OCSP 39 -# define ERR_LIB_UI 40 -# define ERR_LIB_COMP 41 -# define ERR_LIB_ECDSA 42 -# define ERR_LIB_ECDH 43 -# define ERR_LIB_OSSL_STORE 44 -# define ERR_LIB_FIPS 45 -# define ERR_LIB_CMS 46 -# define ERR_LIB_TS 47 -# define ERR_LIB_HMAC 48 -/* # define ERR_LIB_JPAKE 49 */ -# define ERR_LIB_CT 50 -# define ERR_LIB_ASYNC 51 -# define ERR_LIB_KDF 52 -# define ERR_LIB_SM2 53 - -# define ERR_LIB_USER 128 - -# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE) - -# define ERR_PACK(l,f,r) ( \ - (((unsigned int)(l) & 0x0FF) << 24L) | \ - (((unsigned int)(f) & 0xFFF) << 12L) | \ - (((unsigned int)(r) & 0xFFF) ) ) -# define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL) -# define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL) -# define ERR_GET_REASON(l) (int)( (l) & 0xFFFL) -# define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL) - -/* OS functions */ -# define SYS_F_FOPEN 1 -# define SYS_F_CONNECT 2 -# define SYS_F_GETSERVBYNAME 3 -# define SYS_F_SOCKET 4 -# define SYS_F_IOCTLSOCKET 5 -# define SYS_F_BIND 6 -# define SYS_F_LISTEN 7 -# define SYS_F_ACCEPT 8 -# define SYS_F_WSASTARTUP 9/* Winsock stuff */ -# define SYS_F_OPENDIR 10 -# define SYS_F_FREAD 11 -# define SYS_F_GETADDRINFO 12 -# define SYS_F_GETNAMEINFO 13 -# define SYS_F_SETSOCKOPT 14 -# define SYS_F_GETSOCKOPT 15 -# define SYS_F_GETSOCKNAME 16 -# define SYS_F_GETHOSTBYNAME 17 -# define SYS_F_FFLUSH 18 -# define SYS_F_OPEN 19 -# define SYS_F_CLOSE 20 -# define SYS_F_IOCTL 21 -# define SYS_F_STAT 22 -# define SYS_F_FCNTL 23 -# define SYS_F_FSTAT 24 - -/* reasons */ -# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ -# define ERR_R_BN_LIB ERR_LIB_BN/* 3 */ -# define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */ -# define ERR_R_DH_LIB ERR_LIB_DH/* 5 */ -# define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */ -# define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */ -# define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */ -# define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */ -# define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */ -# define ERR_R_X509_LIB ERR_LIB_X509/* 11 */ -# define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */ -# define ERR_R_EC_LIB ERR_LIB_EC/* 16 */ -# define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */ -# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */ -# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */ -# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */ -# define ERR_R_UI_LIB ERR_LIB_UI/* 40 */ -# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */ -# define ERR_R_OSSL_STORE_LIB ERR_LIB_OSSL_STORE/* 44 */ - -# define ERR_R_NESTED_ASN1_ERROR 58 -# define ERR_R_MISSING_ASN1_EOS 63 - -/* fatal error */ -# define ERR_R_FATAL 64 -# define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) -# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) -# define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) -# define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) -# define ERR_R_DISABLED (5|ERR_R_FATAL) -# define ERR_R_INIT_FAIL (6|ERR_R_FATAL) -# define ERR_R_PASSED_INVALID_ARGUMENT (7) -# define ERR_R_OPERATION_FAIL (8|ERR_R_FATAL) - -/* - * 99 is the maximum possible ERR_R_... code, higher values are reserved for - * the individual libraries - */ - -typedef struct ERR_string_data_st { - unsigned long error; - const char *string; -} ERR_STRING_DATA; - -DEFINE_LHASH_OF(ERR_STRING_DATA); - -void ERR_put_error(int lib, int func, int reason, const char *file, int line); -void ERR_set_error_data(char *data, int flags); - -unsigned long ERR_get_error(void); -unsigned long ERR_get_error_line(const char **file, int *line); -unsigned long ERR_get_error_line_data(const char **file, int *line, - const char **data, int *flags); -unsigned long ERR_peek_error(void); -unsigned long ERR_peek_error_line(const char **file, int *line); -unsigned long ERR_peek_error_line_data(const char **file, int *line, - const char **data, int *flags); -unsigned long ERR_peek_last_error(void); -unsigned long ERR_peek_last_error_line(const char **file, int *line); -unsigned long ERR_peek_last_error_line_data(const char **file, int *line, - const char **data, int *flags); -void ERR_clear_error(void); -char *ERR_error_string(unsigned long e, char *buf); -void ERR_error_string_n(unsigned long e, char *buf, size_t len); -const char *ERR_lib_error_string(unsigned long e); -const char *ERR_func_error_string(unsigned long e); -const char *ERR_reason_error_string(unsigned long e); -void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), - void *u); -# ifndef OPENSSL_NO_STDIO -void ERR_print_errors_fp(FILE *fp); -# endif -void ERR_print_errors(BIO *bp); -void ERR_add_error_data(int num, ...); -void ERR_add_error_vdata(int num, va_list args); -int ERR_load_strings(int lib, ERR_STRING_DATA *str); -int ERR_load_strings_const(const ERR_STRING_DATA *str); -int ERR_unload_strings(int lib, ERR_STRING_DATA *str); -int ERR_load_ERR_strings(void); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define ERR_load_crypto_strings() \ - OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) -# define ERR_free_strings() while(0) continue -#endif - -DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *)) -DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid)) -ERR_STATE *ERR_get_state(void); - -int ERR_get_next_error_library(void); - -int ERR_set_mark(void); -int ERR_pop_to_mark(void); -int ERR_clear_last_mark(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/evp.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/evp.h deleted file mode 100644 index a411f3f2..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/evp.h +++ /dev/null @@ -1,1666 +0,0 @@ -/* - * 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_ENVELOPE_H -# define HEADER_ENVELOPE_H - -# include -# include -# include -# include -# include - -# define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ -# define EVP_MAX_KEY_LENGTH 64 -# define EVP_MAX_IV_LENGTH 16 -# define EVP_MAX_BLOCK_LENGTH 32 - -# define PKCS5_SALT_LEN 8 -/* Default PKCS#5 iteration count */ -# define PKCS5_DEFAULT_ITER 2048 - -# include - -# define EVP_PK_RSA 0x0001 -# define EVP_PK_DSA 0x0002 -# define EVP_PK_DH 0x0004 -# define EVP_PK_EC 0x0008 -# define EVP_PKT_SIGN 0x0010 -# define EVP_PKT_ENC 0x0020 -# define EVP_PKT_EXCH 0x0040 -# define EVP_PKS_RSA 0x0100 -# define EVP_PKS_DSA 0x0200 -# define EVP_PKS_EC 0x0400 - -# define EVP_PKEY_NONE NID_undef -# define EVP_PKEY_RSA NID_rsaEncryption -# define EVP_PKEY_RSA2 NID_rsa -# define EVP_PKEY_RSA_PSS NID_rsassaPss -# define EVP_PKEY_DSA NID_dsa -# define EVP_PKEY_DSA1 NID_dsa_2 -# define EVP_PKEY_DSA2 NID_dsaWithSHA -# define EVP_PKEY_DSA3 NID_dsaWithSHA1 -# define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 -# define EVP_PKEY_DH NID_dhKeyAgreement -# define EVP_PKEY_DHX NID_dhpublicnumber -# define EVP_PKEY_EC NID_X9_62_id_ecPublicKey -# define EVP_PKEY_SM2 NID_sm2 -# define EVP_PKEY_HMAC NID_hmac -# define EVP_PKEY_CMAC NID_cmac -# define EVP_PKEY_SCRYPT NID_id_scrypt -# define EVP_PKEY_TLS1_PRF NID_tls1_prf -# define EVP_PKEY_HKDF NID_hkdf -# define EVP_PKEY_POLY1305 NID_poly1305 -# define EVP_PKEY_SIPHASH NID_siphash -# define EVP_PKEY_X25519 NID_X25519 -# define EVP_PKEY_ED25519 NID_ED25519 -# define EVP_PKEY_X448 NID_X448 -# define EVP_PKEY_ED448 NID_ED448 - -#ifdef __cplusplus -extern "C" { -#endif - -# define EVP_PKEY_MO_SIGN 0x0001 -# define EVP_PKEY_MO_VERIFY 0x0002 -# define EVP_PKEY_MO_ENCRYPT 0x0004 -# define EVP_PKEY_MO_DECRYPT 0x0008 - -# ifndef EVP_MD -EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); -EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); -void EVP_MD_meth_free(EVP_MD *md); - -int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); -int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); -int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); -int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); -int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); -int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, - const void *data, - size_t count)); -int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, - unsigned char *md)); -int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, - const EVP_MD_CTX *from)); -int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); -int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, - int p1, void *p2)); - -int EVP_MD_meth_get_input_blocksize(const EVP_MD *md); -int EVP_MD_meth_get_result_size(const EVP_MD *md); -int EVP_MD_meth_get_app_datasize(const EVP_MD *md); -unsigned long EVP_MD_meth_get_flags(const EVP_MD *md); -int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); -int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, - const void *data, - size_t count); -int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, - unsigned char *md); -int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, - const EVP_MD_CTX *from); -int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); -int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, - int p1, void *p2); - -/* digest can only handle a single block */ -# define EVP_MD_FLAG_ONESHOT 0x0001 - -/* digest is extensible-output function, XOF */ -# define EVP_MD_FLAG_XOF 0x0002 - -/* DigestAlgorithmIdentifier flags... */ - -# define EVP_MD_FLAG_DIGALGID_MASK 0x0018 - -/* NULL or absent parameter accepted. Use NULL */ - -# define EVP_MD_FLAG_DIGALGID_NULL 0x0000 - -/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ - -# define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 - -/* Custom handling via ctrl */ - -# define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 - -/* Note if suitable for use in FIPS mode */ -# define EVP_MD_FLAG_FIPS 0x0400 - -/* Digest ctrls */ - -# define EVP_MD_CTRL_DIGALGID 0x1 -# define EVP_MD_CTRL_MICALG 0x2 -# define EVP_MD_CTRL_XOF_LEN 0x3 - -/* Minimum Algorithm specific ctrl value */ - -# define EVP_MD_CTRL_ALG_CTRL 0x1000 - -# endif /* !EVP_MD */ - -/* values for EVP_MD_CTX flags */ - -# define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be - * called once only */ -# define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been - * cleaned */ -# define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data - * in EVP_MD_CTX_reset */ -/* - * FIPS and pad options are ignored in 1.0.0, definitions are here so we - * don't accidentally reuse the values for other purposes. - */ - -# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS - * digest in FIPS mode */ - -/* - * The following PAD options are also currently ignored in 1.0.0, digest - * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() - * instead. - */ -# define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ -# define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ -# define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ -# define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ - -# define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ -/* - * Some functions such as EVP_DigestSign only finalise copies of internal - * contexts so additional data can be included after the finalisation call. - * This is inefficient if this functionality is not required: it is disabled - * if the following flag is set. - */ -# define EVP_MD_CTX_FLAG_FINALISE 0x0200 -/* NOTE: 0x0400 is reserved for internal usage */ - -EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); -EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); -void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); - -int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); -int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); -int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); -int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, - int (*init) (EVP_CIPHER_CTX *ctx, - const unsigned char *key, - const unsigned char *iv, - int enc)); -int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, - int (*do_cipher) (EVP_CIPHER_CTX *ctx, - unsigned char *out, - const unsigned char *in, - size_t inl)); -int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, - int (*cleanup) (EVP_CIPHER_CTX *)); -int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, - int (*set_asn1_parameters) (EVP_CIPHER_CTX *, - ASN1_TYPE *)); -int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, - int (*get_asn1_parameters) (EVP_CIPHER_CTX *, - ASN1_TYPE *)); -int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, - int (*ctrl) (EVP_CIPHER_CTX *, int type, - int arg, void *ptr)); - -int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, - const unsigned char *key, - const unsigned char *iv, - int enc); -int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, - unsigned char *out, - const unsigned char *in, - size_t inl); -int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); -int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - ASN1_TYPE *); -int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - ASN1_TYPE *); -int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - int type, int arg, - void *ptr); - -/* Values for cipher flags */ - -/* Modes for ciphers */ - -# define EVP_CIPH_STREAM_CIPHER 0x0 -# define EVP_CIPH_ECB_MODE 0x1 -# define EVP_CIPH_CBC_MODE 0x2 -# define EVP_CIPH_CFB_MODE 0x3 -# define EVP_CIPH_OFB_MODE 0x4 -# define EVP_CIPH_CTR_MODE 0x5 -# define EVP_CIPH_GCM_MODE 0x6 -# define EVP_CIPH_CCM_MODE 0x7 -# define EVP_CIPH_XTS_MODE 0x10001 -# define EVP_CIPH_WRAP_MODE 0x10002 -# define EVP_CIPH_OCB_MODE 0x10003 -# define EVP_CIPH_MODE 0xF0007 -/* Set if variable length cipher */ -# define EVP_CIPH_VARIABLE_LENGTH 0x8 -/* Set if the iv handling should be done by the cipher itself */ -# define EVP_CIPH_CUSTOM_IV 0x10 -/* Set if the cipher's init() function should be called if key is NULL */ -# define EVP_CIPH_ALWAYS_CALL_INIT 0x20 -/* Call ctrl() to init cipher parameters */ -# define EVP_CIPH_CTRL_INIT 0x40 -/* Don't use standard key length function */ -# define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 -/* Don't use standard block padding */ -# define EVP_CIPH_NO_PADDING 0x100 -/* cipher handles random key generation */ -# define EVP_CIPH_RAND_KEY 0x200 -/* cipher has its own additional copying logic */ -# define EVP_CIPH_CUSTOM_COPY 0x400 -/* Don't use standard iv length function */ -# define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 -/* Allow use default ASN1 get/set iv */ -# define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 -/* Buffer length in bits not bytes: CFB1 mode only */ -# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 -/* Note if suitable for use in FIPS mode */ -# define EVP_CIPH_FLAG_FIPS 0x4000 -/* Allow non FIPS cipher in FIPS mode */ -# define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 -/* - * Cipher handles any and all padding logic as well as finalisation. - */ -# define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 -# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 -# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 -/* Cipher can handle pipeline operations */ -# define EVP_CIPH_FLAG_PIPELINE 0X800000 - -/* - * Cipher context flag to indicate we can handle wrap mode: if allowed in - * older applications it could overflow buffers. - */ - -# define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 - -/* ctrl() values */ - -# define EVP_CTRL_INIT 0x0 -# define EVP_CTRL_SET_KEY_LENGTH 0x1 -# define EVP_CTRL_GET_RC2_KEY_BITS 0x2 -# define EVP_CTRL_SET_RC2_KEY_BITS 0x3 -# define EVP_CTRL_GET_RC5_ROUNDS 0x4 -# define EVP_CTRL_SET_RC5_ROUNDS 0x5 -# define EVP_CTRL_RAND_KEY 0x6 -# define EVP_CTRL_PBE_PRF_NID 0x7 -# define EVP_CTRL_COPY 0x8 -# define EVP_CTRL_AEAD_SET_IVLEN 0x9 -# define EVP_CTRL_AEAD_GET_TAG 0x10 -# define EVP_CTRL_AEAD_SET_TAG 0x11 -# define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 -# define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN -# define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED -# define EVP_CTRL_GCM_IV_GEN 0x13 -# define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN -# define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED -# define EVP_CTRL_CCM_SET_L 0x14 -# define EVP_CTRL_CCM_SET_MSGLEN 0x15 -/* - * AEAD cipher deduces payload length and returns number of bytes required to - * store MAC and eventual padding. Subsequent call to EVP_Cipher even - * appends/verifies MAC. - */ -# define EVP_CTRL_AEAD_TLS1_AAD 0x16 -/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ -# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 -/* Set the GCM invocation field, decrypt only */ -# define EVP_CTRL_GCM_SET_IV_INV 0x18 - -# define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 -# define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a -# define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b -# define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c - -# define EVP_CTRL_SSL3_MASTER_SECRET 0x1d - -/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ -# define EVP_CTRL_SET_SBOX 0x1e -/* - * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a - * pre-allocated buffer with specified size - */ -# define EVP_CTRL_SBOX_USED 0x1f -/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, - * 0 switches meshing off - */ -# define EVP_CTRL_KEY_MESH 0x20 -/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ -# define EVP_CTRL_BLOCK_PADDING_MODE 0x21 - -/* Set the output buffers to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 -/* Set the input buffers to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 -/* Set the input buffer lengths to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 - -# define EVP_CTRL_GET_IVLEN 0x25 - -/* Padding modes */ -#define EVP_PADDING_PKCS7 1 -#define EVP_PADDING_ISO7816_4 2 -#define EVP_PADDING_ANSI923 3 -#define EVP_PADDING_ISO10126 4 -#define EVP_PADDING_ZERO 5 - -/* RFC 5246 defines additional data to be 13 bytes in length */ -# define EVP_AEAD_TLS1_AAD_LEN 13 - -typedef struct { - unsigned char *out; - const unsigned char *inp; - size_t len; - unsigned int interleave; -} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; - -/* GCM TLS constants */ -/* Length of fixed part of IV derived from PRF */ -# define EVP_GCM_TLS_FIXED_IV_LEN 4 -/* Length of explicit part of IV part of TLS records */ -# define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 -/* Length of tag for TLS */ -# define EVP_GCM_TLS_TAG_LEN 16 - -/* CCM TLS constants */ -/* Length of fixed part of IV derived from PRF */ -# define EVP_CCM_TLS_FIXED_IV_LEN 4 -/* Length of explicit part of IV part of TLS records */ -# define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 -/* Total length of CCM IV length for TLS */ -# define EVP_CCM_TLS_IV_LEN 12 -/* Length of tag for TLS */ -# define EVP_CCM_TLS_TAG_LEN 16 -/* Length of CCM8 tag for TLS */ -# define EVP_CCM8_TLS_TAG_LEN 8 - -/* Length of tag for TLS */ -# define EVP_CHACHAPOLY_TLS_TAG_LEN 16 - -typedef struct evp_cipher_info_st { - const EVP_CIPHER *cipher; - unsigned char iv[EVP_MAX_IV_LENGTH]; -} EVP_CIPHER_INFO; - - -/* Password based encryption function */ -typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, - int passlen, ASN1_TYPE *param, - const EVP_CIPHER *cipher, const EVP_MD *md, - int en_de); - -# ifndef OPENSSL_NO_RSA -# define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ - (char *)(rsa)) -# endif - -# ifndef OPENSSL_NO_DSA -# define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ - (char *)(dsa)) -# endif - -# ifndef OPENSSL_NO_DH -# define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ - (char *)(dh)) -# endif - -# ifndef OPENSSL_NO_EC -# define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ - (char *)(eckey)) -# endif -# ifndef OPENSSL_NO_SIPHASH -# define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),EVP_PKEY_SIPHASH,\ - (char *)(shkey)) -# endif - -# ifndef OPENSSL_NO_POLY1305 -# define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),EVP_PKEY_POLY1305,\ - (char *)(polykey)) -# endif - -/* Add some extra combinations */ -# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) -# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) -# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) -# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) - -int EVP_MD_type(const EVP_MD *md); -# define EVP_MD_nid(e) EVP_MD_type(e) -# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) -int EVP_MD_pkey_type(const EVP_MD *md); -int EVP_MD_size(const EVP_MD *md); -int EVP_MD_block_size(const EVP_MD *md); -unsigned long EVP_MD_flags(const EVP_MD *md); - -const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); -int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, - const void *data, size_t count); -void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, - int (*update) (EVP_MD_CTX *ctx, - const void *data, size_t count)); -# define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) -# define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) -# define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) -EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); -void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); -void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); - -int EVP_CIPHER_nid(const EVP_CIPHER *cipher); -# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) -int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); -int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); -int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); -int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); -unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); -# define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) - -const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); -const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); -const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); -unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); -unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx); -void EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); -int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); -void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); -void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); -void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); -void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); -# define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) -# if OPENSSL_API_COMPAT < 0x10100000L -# define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) -# endif -# define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c)) - -# define EVP_ENCODE_LENGTH(l) ((((l)+2)/3*4)+((l)/48+1)*2+80) -# define EVP_DECODE_LENGTH(l) (((l)+3)/4*3+80) - -# define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) -# define EVP_SignInit(a,b) EVP_DigestInit(a,b) -# define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) -# define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) -# define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) -# define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) -# define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) - -# ifdef CONST_STRICT -void BIO_set_md(BIO *, const EVP_MD *md); -# else -# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)(md)) -# endif -# define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)(mdp)) -# define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0, \ - (char *)(mdcp)) -# define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0, \ - (char *)(mdcp)) -# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) -# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0, \ - (char *)(c_pp)) - -/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c, - unsigned char *out, - const unsigned char *in, unsigned int inl); - -# define EVP_add_cipher_alias(n,alias) \ - OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) -# define EVP_add_digest_alias(n,alias) \ - OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) -# define EVP_delete_cipher_alias(alias) \ - OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); -# define EVP_delete_digest_alias(alias) \ - OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); - -int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); -EVP_MD_CTX *EVP_MD_CTX_new(void); -int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); -void EVP_MD_CTX_free(EVP_MD_CTX *ctx); -# define EVP_MD_CTX_create() EVP_MD_CTX_new() -# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) -# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) -__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); -void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); -void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); -int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); -__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, - ENGINE *impl); -__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, - size_t cnt); -__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); -__owur int EVP_Digest(const void *data, size_t count, - unsigned char *md, unsigned int *size, - const EVP_MD *type, ENGINE *impl); - -__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); -__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); -__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); -__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, - size_t len); - -int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); -int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, - const char *prompt, int verify); -void EVP_set_pw_prompt(const char *prompt); -char *EVP_get_pw_prompt(void); - -__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, - const unsigned char *salt, - const unsigned char *data, int datal, int count, - unsigned char *key, unsigned char *iv); - -void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); -void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); -int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); - -__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv); -/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv); -/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); -/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); - -__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv); -/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv); -/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); -/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - -__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv, - int enc); -/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv, int enc); -__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); -__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - -__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, - EVP_PKEY *pkey); - -__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen, const unsigned char *tbs, - size_t tbslen); - -__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, - unsigned int siglen, EVP_PKEY *pkey); - -__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, - size_t siglen, const unsigned char *tbs, - size_t tbslen); - -/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, - EVP_PKEY *pkey); -__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen); - -__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, - EVP_PKEY *pkey); -__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, - size_t siglen); - -# ifndef OPENSSL_NO_RSA -__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - const unsigned char *ek, int ekl, - const unsigned char *iv, EVP_PKEY *priv); -__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); - -__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - unsigned char **ek, int *ekl, unsigned char *iv, - EVP_PKEY **pubk, int npubk); -__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); -# endif - -EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); -void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); -int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx); -int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); -void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); -int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, - const unsigned char *in, int inl); -void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); -int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); - -void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); -int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, - const unsigned char *in, int inl); -int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned - char *out, int *outl); -int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) -# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) -# endif -EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); -int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); -void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); -int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); -int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); -int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); -int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); - -const BIO_METHOD *BIO_f_md(void); -const BIO_METHOD *BIO_f_base64(void); -const BIO_METHOD *BIO_f_cipher(void); -const BIO_METHOD *BIO_f_reliable(void); -__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, - const unsigned char *i, int enc); - -const EVP_MD *EVP_md_null(void); -# ifndef OPENSSL_NO_MD2 -const EVP_MD *EVP_md2(void); -# endif -# ifndef OPENSSL_NO_MD4 -const EVP_MD *EVP_md4(void); -# endif -# ifndef OPENSSL_NO_MD5 -const EVP_MD *EVP_md5(void); -const EVP_MD *EVP_md5_sha1(void); -# endif -# ifndef OPENSSL_NO_BLAKE2 -const EVP_MD *EVP_blake2b512(void); -const EVP_MD *EVP_blake2s256(void); -# endif -const EVP_MD *EVP_sha1(void); -const EVP_MD *EVP_sha224(void); -const EVP_MD *EVP_sha256(void); -const EVP_MD *EVP_sha384(void); -const EVP_MD *EVP_sha512(void); -const EVP_MD *EVP_sha512_224(void); -const EVP_MD *EVP_sha512_256(void); -const EVP_MD *EVP_sha3_224(void); -const EVP_MD *EVP_sha3_256(void); -const EVP_MD *EVP_sha3_384(void); -const EVP_MD *EVP_sha3_512(void); -const EVP_MD *EVP_shake128(void); -const EVP_MD *EVP_shake256(void); -# ifndef OPENSSL_NO_MDC2 -const EVP_MD *EVP_mdc2(void); -# endif -# ifndef OPENSSL_NO_RMD160 -const EVP_MD *EVP_ripemd160(void); -# endif -# ifndef OPENSSL_NO_WHIRLPOOL -const EVP_MD *EVP_whirlpool(void); -# endif -# ifndef OPENSSL_NO_SM3 -const EVP_MD *EVP_sm3(void); -# endif -const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ -# ifndef OPENSSL_NO_DES -const EVP_CIPHER *EVP_des_ecb(void); -const EVP_CIPHER *EVP_des_ede(void); -const EVP_CIPHER *EVP_des_ede3(void); -const EVP_CIPHER *EVP_des_ede_ecb(void); -const EVP_CIPHER *EVP_des_ede3_ecb(void); -const EVP_CIPHER *EVP_des_cfb64(void); -# define EVP_des_cfb EVP_des_cfb64 -const EVP_CIPHER *EVP_des_cfb1(void); -const EVP_CIPHER *EVP_des_cfb8(void); -const EVP_CIPHER *EVP_des_ede_cfb64(void); -# define EVP_des_ede_cfb EVP_des_ede_cfb64 -const EVP_CIPHER *EVP_des_ede3_cfb64(void); -# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 -const EVP_CIPHER *EVP_des_ede3_cfb1(void); -const EVP_CIPHER *EVP_des_ede3_cfb8(void); -const EVP_CIPHER *EVP_des_ofb(void); -const EVP_CIPHER *EVP_des_ede_ofb(void); -const EVP_CIPHER *EVP_des_ede3_ofb(void); -const EVP_CIPHER *EVP_des_cbc(void); -const EVP_CIPHER *EVP_des_ede_cbc(void); -const EVP_CIPHER *EVP_des_ede3_cbc(void); -const EVP_CIPHER *EVP_desx_cbc(void); -const EVP_CIPHER *EVP_des_ede3_wrap(void); -/* - * This should now be supported through the dev_crypto ENGINE. But also, why - * are rc4 and md5 declarations made here inside a "NO_DES" precompiler - * branch? - */ -# endif -# ifndef OPENSSL_NO_RC4 -const EVP_CIPHER *EVP_rc4(void); -const EVP_CIPHER *EVP_rc4_40(void); -# ifndef OPENSSL_NO_MD5 -const EVP_CIPHER *EVP_rc4_hmac_md5(void); -# endif -# endif -# ifndef OPENSSL_NO_IDEA -const EVP_CIPHER *EVP_idea_ecb(void); -const EVP_CIPHER *EVP_idea_cfb64(void); -# define EVP_idea_cfb EVP_idea_cfb64 -const EVP_CIPHER *EVP_idea_ofb(void); -const EVP_CIPHER *EVP_idea_cbc(void); -# endif -# ifndef OPENSSL_NO_RC2 -const EVP_CIPHER *EVP_rc2_ecb(void); -const EVP_CIPHER *EVP_rc2_cbc(void); -const EVP_CIPHER *EVP_rc2_40_cbc(void); -const EVP_CIPHER *EVP_rc2_64_cbc(void); -const EVP_CIPHER *EVP_rc2_cfb64(void); -# define EVP_rc2_cfb EVP_rc2_cfb64 -const EVP_CIPHER *EVP_rc2_ofb(void); -# endif -# ifndef OPENSSL_NO_BF -const EVP_CIPHER *EVP_bf_ecb(void); -const EVP_CIPHER *EVP_bf_cbc(void); -const EVP_CIPHER *EVP_bf_cfb64(void); -# define EVP_bf_cfb EVP_bf_cfb64 -const EVP_CIPHER *EVP_bf_ofb(void); -# endif -# ifndef OPENSSL_NO_CAST -const EVP_CIPHER *EVP_cast5_ecb(void); -const EVP_CIPHER *EVP_cast5_cbc(void); -const EVP_CIPHER *EVP_cast5_cfb64(void); -# define EVP_cast5_cfb EVP_cast5_cfb64 -const EVP_CIPHER *EVP_cast5_ofb(void); -# endif -# ifndef OPENSSL_NO_RC5 -const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); -const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); -const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); -# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 -const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); -# endif -const EVP_CIPHER *EVP_aes_128_ecb(void); -const EVP_CIPHER *EVP_aes_128_cbc(void); -const EVP_CIPHER *EVP_aes_128_cfb1(void); -const EVP_CIPHER *EVP_aes_128_cfb8(void); -const EVP_CIPHER *EVP_aes_128_cfb128(void); -# define EVP_aes_128_cfb EVP_aes_128_cfb128 -const EVP_CIPHER *EVP_aes_128_ofb(void); -const EVP_CIPHER *EVP_aes_128_ctr(void); -const EVP_CIPHER *EVP_aes_128_ccm(void); -const EVP_CIPHER *EVP_aes_128_gcm(void); -const EVP_CIPHER *EVP_aes_128_xts(void); -const EVP_CIPHER *EVP_aes_128_wrap(void); -const EVP_CIPHER *EVP_aes_128_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_128_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_192_ecb(void); -const EVP_CIPHER *EVP_aes_192_cbc(void); -const EVP_CIPHER *EVP_aes_192_cfb1(void); -const EVP_CIPHER *EVP_aes_192_cfb8(void); -const EVP_CIPHER *EVP_aes_192_cfb128(void); -# define EVP_aes_192_cfb EVP_aes_192_cfb128 -const EVP_CIPHER *EVP_aes_192_ofb(void); -const EVP_CIPHER *EVP_aes_192_ctr(void); -const EVP_CIPHER *EVP_aes_192_ccm(void); -const EVP_CIPHER *EVP_aes_192_gcm(void); -const EVP_CIPHER *EVP_aes_192_wrap(void); -const EVP_CIPHER *EVP_aes_192_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_192_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_256_ecb(void); -const EVP_CIPHER *EVP_aes_256_cbc(void); -const EVP_CIPHER *EVP_aes_256_cfb1(void); -const EVP_CIPHER *EVP_aes_256_cfb8(void); -const EVP_CIPHER *EVP_aes_256_cfb128(void); -# define EVP_aes_256_cfb EVP_aes_256_cfb128 -const EVP_CIPHER *EVP_aes_256_ofb(void); -const EVP_CIPHER *EVP_aes_256_ctr(void); -const EVP_CIPHER *EVP_aes_256_ccm(void); -const EVP_CIPHER *EVP_aes_256_gcm(void); -const EVP_CIPHER *EVP_aes_256_xts(void); -const EVP_CIPHER *EVP_aes_256_wrap(void); -const EVP_CIPHER *EVP_aes_256_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_256_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); -const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); -const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); -const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); -# ifndef OPENSSL_NO_ARIA -const EVP_CIPHER *EVP_aria_128_ecb(void); -const EVP_CIPHER *EVP_aria_128_cbc(void); -const EVP_CIPHER *EVP_aria_128_cfb1(void); -const EVP_CIPHER *EVP_aria_128_cfb8(void); -const EVP_CIPHER *EVP_aria_128_cfb128(void); -# define EVP_aria_128_cfb EVP_aria_128_cfb128 -const EVP_CIPHER *EVP_aria_128_ctr(void); -const EVP_CIPHER *EVP_aria_128_ofb(void); -const EVP_CIPHER *EVP_aria_128_gcm(void); -const EVP_CIPHER *EVP_aria_128_ccm(void); -const EVP_CIPHER *EVP_aria_192_ecb(void); -const EVP_CIPHER *EVP_aria_192_cbc(void); -const EVP_CIPHER *EVP_aria_192_cfb1(void); -const EVP_CIPHER *EVP_aria_192_cfb8(void); -const EVP_CIPHER *EVP_aria_192_cfb128(void); -# define EVP_aria_192_cfb EVP_aria_192_cfb128 -const EVP_CIPHER *EVP_aria_192_ctr(void); -const EVP_CIPHER *EVP_aria_192_ofb(void); -const EVP_CIPHER *EVP_aria_192_gcm(void); -const EVP_CIPHER *EVP_aria_192_ccm(void); -const EVP_CIPHER *EVP_aria_256_ecb(void); -const EVP_CIPHER *EVP_aria_256_cbc(void); -const EVP_CIPHER *EVP_aria_256_cfb1(void); -const EVP_CIPHER *EVP_aria_256_cfb8(void); -const EVP_CIPHER *EVP_aria_256_cfb128(void); -# define EVP_aria_256_cfb EVP_aria_256_cfb128 -const EVP_CIPHER *EVP_aria_256_ctr(void); -const EVP_CIPHER *EVP_aria_256_ofb(void); -const EVP_CIPHER *EVP_aria_256_gcm(void); -const EVP_CIPHER *EVP_aria_256_ccm(void); -# endif -# ifndef OPENSSL_NO_CAMELLIA -const EVP_CIPHER *EVP_camellia_128_ecb(void); -const EVP_CIPHER *EVP_camellia_128_cbc(void); -const EVP_CIPHER *EVP_camellia_128_cfb1(void); -const EVP_CIPHER *EVP_camellia_128_cfb8(void); -const EVP_CIPHER *EVP_camellia_128_cfb128(void); -# define EVP_camellia_128_cfb EVP_camellia_128_cfb128 -const EVP_CIPHER *EVP_camellia_128_ofb(void); -const EVP_CIPHER *EVP_camellia_128_ctr(void); -const EVP_CIPHER *EVP_camellia_192_ecb(void); -const EVP_CIPHER *EVP_camellia_192_cbc(void); -const EVP_CIPHER *EVP_camellia_192_cfb1(void); -const EVP_CIPHER *EVP_camellia_192_cfb8(void); -const EVP_CIPHER *EVP_camellia_192_cfb128(void); -# define EVP_camellia_192_cfb EVP_camellia_192_cfb128 -const EVP_CIPHER *EVP_camellia_192_ofb(void); -const EVP_CIPHER *EVP_camellia_192_ctr(void); -const EVP_CIPHER *EVP_camellia_256_ecb(void); -const EVP_CIPHER *EVP_camellia_256_cbc(void); -const EVP_CIPHER *EVP_camellia_256_cfb1(void); -const EVP_CIPHER *EVP_camellia_256_cfb8(void); -const EVP_CIPHER *EVP_camellia_256_cfb128(void); -# define EVP_camellia_256_cfb EVP_camellia_256_cfb128 -const EVP_CIPHER *EVP_camellia_256_ofb(void); -const EVP_CIPHER *EVP_camellia_256_ctr(void); -# endif -# ifndef OPENSSL_NO_CHACHA -const EVP_CIPHER *EVP_chacha20(void); -# ifndef OPENSSL_NO_POLY1305 -const EVP_CIPHER *EVP_chacha20_poly1305(void); -# endif -# endif - -# ifndef OPENSSL_NO_SEED -const EVP_CIPHER *EVP_seed_ecb(void); -const EVP_CIPHER *EVP_seed_cbc(void); -const EVP_CIPHER *EVP_seed_cfb128(void); -# define EVP_seed_cfb EVP_seed_cfb128 -const EVP_CIPHER *EVP_seed_ofb(void); -# endif - -# ifndef OPENSSL_NO_SM4 -const EVP_CIPHER *EVP_sm4_ecb(void); -const EVP_CIPHER *EVP_sm4_cbc(void); -const EVP_CIPHER *EVP_sm4_cfb128(void); -# define EVP_sm4_cfb EVP_sm4_cfb128 -const EVP_CIPHER *EVP_sm4_ofb(void); -const EVP_CIPHER *EVP_sm4_ctr(void); -# endif - -# if OPENSSL_API_COMPAT < 0x10100000L -# define OPENSSL_add_all_algorithms_conf() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ - | OPENSSL_INIT_ADD_ALL_DIGESTS \ - | OPENSSL_INIT_LOAD_CONFIG, NULL) -# define OPENSSL_add_all_algorithms_noconf() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ - | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) - -# ifdef OPENSSL_LOAD_CONF -# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() -# else -# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() -# endif - -# define OpenSSL_add_all_ciphers() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) -# define OpenSSL_add_all_digests() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) - -# define EVP_cleanup() while(0) continue -# endif - -int EVP_add_cipher(const EVP_CIPHER *cipher); -int EVP_add_digest(const EVP_MD *digest); - -const EVP_CIPHER *EVP_get_cipherbyname(const char *name); -const EVP_MD *EVP_get_digestbyname(const char *name); - -void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, - const char *from, const char *to, void *x), - void *arg); -void EVP_CIPHER_do_all_sorted(void (*fn) - (const EVP_CIPHER *ciph, const char *from, - const char *to, void *x), void *arg); - -void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, - const char *from, const char *to, void *x), - void *arg); -void EVP_MD_do_all_sorted(void (*fn) - (const EVP_MD *ciph, const char *from, - const char *to, void *x), void *arg); - -int EVP_PKEY_decrypt_old(unsigned char *dec_key, - const unsigned char *enc_key, int enc_key_len, - EVP_PKEY *private_key); -int EVP_PKEY_encrypt_old(unsigned char *enc_key, - const unsigned char *key, int key_len, - EVP_PKEY *pub_key); -int EVP_PKEY_type(int type); -int EVP_PKEY_id(const EVP_PKEY *pkey); -int EVP_PKEY_base_id(const EVP_PKEY *pkey); -int EVP_PKEY_bits(const EVP_PKEY *pkey); -int EVP_PKEY_security_bits(const EVP_PKEY *pkey); -int EVP_PKEY_size(const EVP_PKEY *pkey); -int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); -int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); -int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); -# ifndef OPENSSL_NO_ENGINE -int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); -ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); -# endif -int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); -void *EVP_PKEY_get0(const EVP_PKEY *pkey); -const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); -# ifndef OPENSSL_NO_POLY1305 -const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); -# endif -# ifndef OPENSSL_NO_SIPHASH -const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); -# endif - -# ifndef OPENSSL_NO_RSA -struct rsa_st; -int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); -struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); -struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_DSA -struct dsa_st; -int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); -struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); -struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_DH -struct dh_st; -int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); -struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); -struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_EC -struct ec_key_st; -int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); -struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); -struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); -# endif - -EVP_PKEY *EVP_PKEY_new(void); -int EVP_PKEY_up_ref(EVP_PKEY *pkey); -void EVP_PKEY_free(EVP_PKEY *pkey); - -EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, - long length); -int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); - -EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, - long length); -EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, - long length); -int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); - -int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); -int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); -int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); -int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); - -int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); - -int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); -int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); -int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); - -int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); - -int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, - const unsigned char *pt, size_t ptlen); -size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); - -int EVP_CIPHER_type(const EVP_CIPHER *ctx); - -/* calls methods */ -int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -/* These are used by EVP_CIPHER methods */ -int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -/* PKCS5 password based encryption */ -int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md, int en_de); -int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, - const unsigned char *salt, int saltlen, int iter, - int keylen, unsigned char *out); -int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, - const unsigned char *salt, int saltlen, int iter, - const EVP_MD *digest, int keylen, unsigned char *out); -int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md, int en_de); - -#ifndef OPENSSL_NO_SCRYPT -int EVP_PBE_scrypt(const char *pass, size_t passlen, - const unsigned char *salt, size_t saltlen, - uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, - unsigned char *key, size_t keylen); - -int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, - int passlen, ASN1_TYPE *param, - const EVP_CIPHER *c, const EVP_MD *md, int en_de); -#endif - -void PKCS5_PBE_add(void); - -int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, - ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); - -/* PBE type */ - -/* Can appear as the outermost AlgorithmIdentifier */ -# define EVP_PBE_TYPE_OUTER 0x0 -/* Is an PRF type OID */ -# define EVP_PBE_TYPE_PRF 0x1 -/* Is a PKCS#5 v2.0 KDF */ -# define EVP_PBE_TYPE_KDF 0x2 - -int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, - int md_nid, EVP_PBE_KEYGEN *keygen); -int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, - EVP_PBE_KEYGEN *keygen); -int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, - EVP_PBE_KEYGEN **pkeygen); -void EVP_PBE_cleanup(void); -int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); - -# define ASN1_PKEY_ALIAS 0x1 -# define ASN1_PKEY_DYNAMIC 0x2 -# define ASN1_PKEY_SIGPARAM_NULL 0x4 - -# define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 -# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 -# define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 -# define ASN1_PKEY_CTRL_CMS_SIGN 0x5 -# define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 -# define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 - -# define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 -# define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa - -int EVP_PKEY_asn1_get_count(void); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, - const char *str, int len); -int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); -int EVP_PKEY_asn1_add_alias(int to, int from); -int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, - int *ppkey_flags, const char **pinfo, - const char **ppem_str, - const EVP_PKEY_ASN1_METHOD *ameth); - -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); -EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, - const char *pem_str, - const char *info); -void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, - const EVP_PKEY_ASN1_METHOD *src); -void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); -void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, - int (*pub_decode) (EVP_PKEY *pk, - X509_PUBKEY *pub), - int (*pub_encode) (X509_PUBKEY *pub, - const EVP_PKEY *pk), - int (*pub_cmp) (const EVP_PKEY *a, - const EVP_PKEY *b), - int (*pub_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx), - int (*pkey_size) (const EVP_PKEY *pk), - int (*pkey_bits) (const EVP_PKEY *pk)); -void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, - int (*priv_decode) (EVP_PKEY *pk, - const PKCS8_PRIV_KEY_INFO - *p8inf), - int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, - const EVP_PKEY *pk), - int (*priv_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, - ASN1_PCTX *pctx)); -void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, - int (*param_decode) (EVP_PKEY *pkey, - const unsigned char **pder, - int derlen), - int (*param_encode) (const EVP_PKEY *pkey, - unsigned char **pder), - int (*param_missing) (const EVP_PKEY *pk), - int (*param_copy) (EVP_PKEY *to, - const EVP_PKEY *from), - int (*param_cmp) (const EVP_PKEY *a, - const EVP_PKEY *b), - int (*param_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, - ASN1_PCTX *pctx)); - -void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, - void (*pkey_free) (EVP_PKEY *pkey)); -void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_ctrl) (EVP_PKEY *pkey, int op, - long arg1, void *arg2)); -void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, - int (*item_verify) (EVP_MD_CTX *ctx, - const ASN1_ITEM *it, - void *asn, - X509_ALGOR *a, - ASN1_BIT_STRING *sig, - EVP_PKEY *pkey), - int (*item_sign) (EVP_MD_CTX *ctx, - const ASN1_ITEM *it, - void *asn, - X509_ALGOR *alg1, - X509_ALGOR *alg2, - ASN1_BIT_STRING *sig)); - -void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, - int (*siginf_set) (X509_SIG_INFO *siginf, - const X509_ALGOR *alg, - const ASN1_STRING *sig)); - -void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_pub_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_param_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*set_priv_key) (EVP_PKEY *pk, - const unsigned char - *priv, - size_t len)); -void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*set_pub_key) (EVP_PKEY *pk, - const unsigned char *pub, - size_t len)); -void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*get_priv_key) (const EVP_PKEY *pk, - unsigned char *priv, - size_t *len)); -void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*get_pub_key) (const EVP_PKEY *pk, - unsigned char *pub, - size_t *len)); - -void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_security_bits) (const EVP_PKEY - *pk)); - -# define EVP_PKEY_OP_UNDEFINED 0 -# define EVP_PKEY_OP_PARAMGEN (1<<1) -# define EVP_PKEY_OP_KEYGEN (1<<2) -# define EVP_PKEY_OP_SIGN (1<<3) -# define EVP_PKEY_OP_VERIFY (1<<4) -# define EVP_PKEY_OP_VERIFYRECOVER (1<<5) -# define EVP_PKEY_OP_SIGNCTX (1<<6) -# define EVP_PKEY_OP_VERIFYCTX (1<<7) -# define EVP_PKEY_OP_ENCRYPT (1<<8) -# define EVP_PKEY_OP_DECRYPT (1<<9) -# define EVP_PKEY_OP_DERIVE (1<<10) - -# define EVP_PKEY_OP_TYPE_SIG \ - (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ - | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) - -# define EVP_PKEY_OP_TYPE_CRYPT \ - (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) - -# define EVP_PKEY_OP_TYPE_NOGEN \ - (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE) - -# define EVP_PKEY_OP_TYPE_GEN \ - (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) - -# define EVP_PKEY_CTX_set_signature_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ - EVP_PKEY_CTRL_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ - EVP_PKEY_CTRL_GET_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)(key)) - -# define EVP_PKEY_CTRL_MD 1 -# define EVP_PKEY_CTRL_PEER_KEY 2 - -# define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 -# define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 - -# define EVP_PKEY_CTRL_PKCS7_SIGN 5 - -# define EVP_PKEY_CTRL_SET_MAC_KEY 6 - -# define EVP_PKEY_CTRL_DIGESTINIT 7 - -/* Used by GOST key encryption in TLS */ -# define EVP_PKEY_CTRL_SET_IV 8 - -# define EVP_PKEY_CTRL_CMS_ENCRYPT 9 -# define EVP_PKEY_CTRL_CMS_DECRYPT 10 -# define EVP_PKEY_CTRL_CMS_SIGN 11 - -# define EVP_PKEY_CTRL_CIPHER 12 - -# define EVP_PKEY_CTRL_GET_MD 13 - -# define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 - -# define EVP_PKEY_ALG_CTRL 0x1000 - -# define EVP_PKEY_FLAG_AUTOARGLEN 2 -/* - * Method handles all operations: don't assume any digest related defaults. - */ -# define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 - -const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); -EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); -void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, - const EVP_PKEY_METHOD *meth); -void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); -void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); -int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); -int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); -size_t EVP_PKEY_meth_get_count(void); -const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); - -EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); -EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); -EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); -void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, - int cmd, int p1, void *p2); -int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, - const char *value); -int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, - int cmd, uint64_t value); - -int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); -int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); - -int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); - -int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); -void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); - -EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, - const unsigned char *key, int keylen); -EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, - const unsigned char *priv, - size_t len); -EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, - const unsigned char *pub, - size_t len); -int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, - size_t *len); -int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, - size_t *len); - -EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, - size_t len, const EVP_CIPHER *cipher); - -void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); -void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); -EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); - -EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); - -void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); -void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, size_t tbslen); -int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, - const unsigned char *sig, size_t siglen, - const unsigned char *tbs, size_t tbslen); -int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, - unsigned char *rout, size_t *routlen, - const unsigned char *sig, size_t siglen); -int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); -int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); - -int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); -int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); - -typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); -int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); -int EVP_PKEY_check(EVP_PKEY_CTX *ctx); -int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); -int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); - -void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); -EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); - -void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, - int (*init) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, - int (*copy) (EVP_PKEY_CTX *dst, - EVP_PKEY_CTX *src)); - -void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, - void (*cleanup) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, - int (*paramgen_init) (EVP_PKEY_CTX *ctx), - int (*paramgen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, - int (*keygen_init) (EVP_PKEY_CTX *ctx), - int (*keygen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, - int (*sign_init) (EVP_PKEY_CTX *ctx), - int (*sign) (EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, - int (*verify_init) (EVP_PKEY_CTX *ctx), - int (*verify) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, - int (*verify_recover_init) (EVP_PKEY_CTX - *ctx), - int (*verify_recover) (EVP_PKEY_CTX - *ctx, - unsigned char - *sig, - size_t *siglen, - const unsigned - char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, - int (*signctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (*signctx) (EVP_PKEY_CTX *ctx, - unsigned char *sig, - size_t *siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, - int (*verifyctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (*verifyctx) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - int siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, - int (*encrypt_init) (EVP_PKEY_CTX *ctx), - int (*encryptfn) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, - int (*decrypt_init) (EVP_PKEY_CTX *ctx), - int (*decrypt) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, - int (*derive_init) (EVP_PKEY_CTX *ctx), - int (*derive) (EVP_PKEY_CTX *ctx, - unsigned char *key, - size_t *keylen)); - -void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, - int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, - void *p2), - int (*ctrl_str) (EVP_PKEY_CTX *ctx, - const char *type, - const char *value)); - -void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth, - int (*digestsign) (EVP_MD_CTX *ctx, - unsigned char *sig, - size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth, - int (*digestverify) (EVP_MD_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, - int (*digest_custom) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, - int (**pinit) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, - int (**pcopy) (EVP_PKEY_CTX *dst, - EVP_PKEY_CTX *src)); - -void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, - void (**pcleanup) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, - int (**pparamgen_init) (EVP_PKEY_CTX *ctx), - int (**pparamgen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, - int (**pkeygen_init) (EVP_PKEY_CTX *ctx), - int (**pkeygen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, - int (**psign_init) (EVP_PKEY_CTX *ctx), - int (**psign) (EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, - int (**pverify_init) (EVP_PKEY_CTX *ctx), - int (**pverify) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, - int (**pverify_recover_init) (EVP_PKEY_CTX - *ctx), - int (**pverify_recover) (EVP_PKEY_CTX - *ctx, - unsigned char - *sig, - size_t *siglen, - const unsigned - char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, - int (**psignctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (**psignctx) (EVP_PKEY_CTX *ctx, - unsigned char *sig, - size_t *siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, - int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (**pverifyctx) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - int siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, - int (**pencrypt_init) (EVP_PKEY_CTX *ctx), - int (**pencryptfn) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, - int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), - int (**pdecrypt) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, - int (**pderive_init) (EVP_PKEY_CTX *ctx), - int (**pderive) (EVP_PKEY_CTX *ctx, - unsigned char *key, - size_t *keylen)); - -void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, - int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, - void *p2), - int (**pctrl_str) (EVP_PKEY_CTX *ctx, - const char *type, - const char *value)); - -void EVP_PKEY_meth_get_digestsign(EVP_PKEY_METHOD *pmeth, - int (**digestsign) (EVP_MD_CTX *ctx, - unsigned char *sig, - size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_digestverify(EVP_PKEY_METHOD *pmeth, - int (**digestverify) (EVP_MD_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_digest_custom(EVP_PKEY_METHOD *pmeth, - int (**pdigest_custom) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx)); -void EVP_add_alg_module(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/evperr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/evperr.h deleted file mode 100644 index d2b26ea5..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/evperr.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/hmac.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/hmac.h deleted file mode 100644 index 458efc1d..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/hmac.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 1995-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_HMAC_H -# define HEADER_HMAC_H - -# include - -# include - -# if OPENSSL_API_COMPAT < 0x10200000L -# define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */ -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -size_t HMAC_size(const HMAC_CTX *e); -HMAC_CTX *HMAC_CTX_new(void); -int HMAC_CTX_reset(HMAC_CTX *ctx); -void HMAC_CTX_free(HMAC_CTX *ctx); - -DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md)) - -/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md, ENGINE *impl); -/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, - size_t len); -/*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, - unsigned int *len); -unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, - const unsigned char *d, size_t n, unsigned char *md, - unsigned int *md_len); -__owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); - -void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); -const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/idea.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/idea.h deleted file mode 100644 index 4334f3ea..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/idea.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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_IDEA_H -# define HEADER_IDEA_H - -# include - -# ifndef OPENSSL_NO_IDEA -# ifdef __cplusplus -extern "C" { -# endif - -typedef unsigned int IDEA_INT; - -# define IDEA_ENCRYPT 1 -# define IDEA_DECRYPT 0 - -# define IDEA_BLOCK 8 -# define IDEA_KEY_LENGTH 16 - -typedef struct idea_key_st { - IDEA_INT data[9][6]; -} IDEA_KEY_SCHEDULE; - -const char *IDEA_options(void); -void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, - 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_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int enc); -void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int *num, int enc); -void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int *num); -void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); - -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/kdf.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/kdf.h deleted file mode 100644 index 5abd4c37..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/kdf.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 -#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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/kdferr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/kdferr.h deleted file mode 100644 index 3f51bd02..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/kdferr.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/lhash.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/lhash.h deleted file mode 100644 index 2e42d727..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/lhash.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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 - */ - -/* - * Header for dynamic hash table routines Author - Eric Young - */ - -#ifndef HEADER_LHASH_H -# define HEADER_LHASH_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct lhash_node_st OPENSSL_LH_NODE; -typedef int (*OPENSSL_LH_COMPFUNC) (const void *, const void *); -typedef unsigned long (*OPENSSL_LH_HASHFUNC) (const void *); -typedef void (*OPENSSL_LH_DOALL_FUNC) (void *); -typedef void (*OPENSSL_LH_DOALL_FUNCARG) (void *, void *); -typedef struct lhash_st OPENSSL_LHASH; - -/* - * Macros for declaring and implementing type-safe wrappers for LHASH - * callbacks. This way, callbacks can be provided to LHASH structures without - * function pointer casting and the macro-defined callbacks provide - * per-variable casting before deferring to the underlying type-specific - * callbacks. NB: It is possible to place a "static" in front of both the - * DECLARE and IMPLEMENT macros if the functions are strictly internal. - */ - -/* First: "hash" functions */ -# define DECLARE_LHASH_HASH_FN(name, o_type) \ - unsigned long name##_LHASH_HASH(const void *); -# define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ - unsigned long name##_LHASH_HASH(const void *arg) { \ - const o_type *a = arg; \ - return name##_hash(a); } -# define LHASH_HASH_FN(name) name##_LHASH_HASH - -/* Second: "compare" functions */ -# define DECLARE_LHASH_COMP_FN(name, o_type) \ - int name##_LHASH_COMP(const void *, const void *); -# define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ - int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ - const o_type *a = arg1; \ - const o_type *b = arg2; \ - return name##_cmp(a,b); } -# define LHASH_COMP_FN(name) name##_LHASH_COMP - -/* Fourth: "doall_arg" functions */ -# define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ - void name##_LHASH_DOALL_ARG(void *, void *); -# define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ - void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ - o_type *a = arg1; \ - a_type *b = arg2; \ - name##_doall_arg(a, b); } -# define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG - - -# define LH_LOAD_MULT 256 - -int OPENSSL_LH_error(OPENSSL_LHASH *lh); -OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c); -void OPENSSL_LH_free(OPENSSL_LHASH *lh); -void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data); -void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data); -void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data); -void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func); -void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg); -unsigned long OPENSSL_LH_strhash(const char *c); -unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh); -unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh); -void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load); - -# ifndef OPENSSL_NO_STDIO -void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp); -void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp); -void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp); -# endif -void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out); -void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out); -void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define _LHASH OPENSSL_LHASH -# define LHASH_NODE OPENSSL_LH_NODE -# define lh_error OPENSSL_LH_error -# define lh_new OPENSSL_LH_new -# define lh_free OPENSSL_LH_free -# define lh_insert OPENSSL_LH_insert -# define lh_delete OPENSSL_LH_delete -# define lh_retrieve OPENSSL_LH_retrieve -# define lh_doall OPENSSL_LH_doall -# define lh_doall_arg OPENSSL_LH_doall_arg -# define lh_strhash OPENSSL_LH_strhash -# define lh_num_items OPENSSL_LH_num_items -# ifndef OPENSSL_NO_STDIO -# define lh_stats OPENSSL_LH_stats -# define lh_node_stats OPENSSL_LH_node_stats -# define lh_node_usage_stats OPENSSL_LH_node_usage_stats -# endif -# define lh_stats_bio OPENSSL_LH_stats_bio -# define lh_node_stats_bio OPENSSL_LH_node_stats_bio -# define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio -# endif - -/* Type checking... */ - -# define LHASH_OF(type) struct lhash_st_##type - -# define DEFINE_LHASH_OF(type) \ - LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \ - static ossl_unused ossl_inline LHASH_OF(type) *lh_##type##_new(unsigned long (*hfn)(const type *), \ - int (*cfn)(const type *, const type *)) \ - { \ - return (LHASH_OF(type) *) \ - OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \ - } \ - static ossl_unused ossl_inline void lh_##type##_free(LHASH_OF(type) *lh) \ - { \ - OPENSSL_LH_free((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_insert(LHASH_OF(type) *lh, type *d) \ - { \ - return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *d) \ - { \ - return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d) \ - { \ - return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline int lh_##type##_error(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline unsigned long lh_##type##_num_items(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline void lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline void lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline void lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline unsigned long lh_##type##_get_down_load(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline void lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl) \ - { \ - OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \ - } \ - static ossl_unused ossl_inline void lh_##type##_doall(LHASH_OF(type) *lh, \ - void (*doall)(type *)) \ - { \ - OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \ - } \ - LHASH_OF(type) - -#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \ - int_implement_lhash_doall(type, argtype, const type) - -#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \ - int_implement_lhash_doall(type, argtype, type) - -#define int_implement_lhash_doall(type, argtype, cbargtype) \ - static ossl_unused ossl_inline void \ - lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \ - void (*fn)(cbargtype *, argtype *), \ - argtype *arg) \ - { \ - OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \ - } \ - LHASH_OF(type) - -DEFINE_LHASH_OF(OPENSSL_STRING); -# ifdef _MSC_VER -/* - * push and pop this warning: - * warning C4090: 'function': different 'const' qualifiers - */ -# pragma warning (push) -# pragma warning (disable: 4090) -# endif - -DEFINE_LHASH_OF(OPENSSL_CSTRING); - -# ifdef _MSC_VER -# pragma warning (pop) -# endif - -/* - * If called without higher optimization (min. -xO3) the Oracle Developer - * Studio compiler generates code for the defined (static inline) functions - * above. - * This would later lead to the linker complaining about missing symbols when - * this header file is included but the resulting object is not linked against - * the Crypto library (openssl#6912). - */ -# ifdef __SUNPRO_C -# pragma weak OPENSSL_LH_new -# pragma weak OPENSSL_LH_free -# pragma weak OPENSSL_LH_insert -# pragma weak OPENSSL_LH_delete -# pragma weak OPENSSL_LH_retrieve -# pragma weak OPENSSL_LH_error -# pragma weak OPENSSL_LH_num_items -# pragma weak OPENSSL_LH_node_stats_bio -# pragma weak OPENSSL_LH_node_usage_stats_bio -# pragma weak OPENSSL_LH_stats_bio -# pragma weak OPENSSL_LH_get_down_load -# pragma weak OPENSSL_LH_set_down_load -# pragma weak OPENSSL_LH_doall -# pragma weak OPENSSL_LH_doall_arg -# endif /* __SUNPRO_C */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/md2.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/md2.h deleted file mode 100644 index 7faf8e3d..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/md2.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 - -# ifndef OPENSSL_NO_MD2 -# include -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/md4.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/md4.h deleted file mode 100644 index 940e29db..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/md4.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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_MD4_H -# define HEADER_MD4_H - -# include - -# ifndef OPENSSL_NO_MD4 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! MD4_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define MD4_LONG unsigned int - -# define MD4_CBLOCK 64 -# define MD4_LBLOCK (MD4_CBLOCK/4) -# define MD4_DIGEST_LENGTH 16 - -typedef struct MD4state_st { - MD4_LONG A, B, C, D; - MD4_LONG Nl, Nh; - MD4_LONG data[MD4_LBLOCK]; - unsigned int num; -} MD4_CTX; - -int MD4_Init(MD4_CTX *c); -int MD4_Update(MD4_CTX *c, const void *data, size_t len); -int MD4_Final(unsigned char *md, MD4_CTX *c); -unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); -void MD4_Transform(MD4_CTX *c, const unsigned char *b); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/md5.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/md5.h deleted file mode 100644 index 2deb7721..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/md5.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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_MD5_H -# define HEADER_MD5_H - -# include - -# ifndef OPENSSL_NO_MD5 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! MD5_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define MD5_LONG unsigned int - -# define MD5_CBLOCK 64 -# define MD5_LBLOCK (MD5_CBLOCK/4) -# define MD5_DIGEST_LENGTH 16 - -typedef struct MD5state_st { - MD5_LONG A, B, C, D; - MD5_LONG Nl, Nh; - MD5_LONG data[MD5_LBLOCK]; - unsigned int num; -} MD5_CTX; - -int MD5_Init(MD5_CTX *c); -int MD5_Update(MD5_CTX *c, const void *data, size_t len); -int MD5_Final(unsigned char *md, MD5_CTX *c); -unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); -void MD5_Transform(MD5_CTX *c, const unsigned char *b); -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/mdc2.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/mdc2.h deleted file mode 100644 index aabd2bfa..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/mdc2.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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_MDC2_H -# define HEADER_MDC2_H - -# include - -#ifndef OPENSSL_NO_MDC2 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define MDC2_BLOCK 8 -# define MDC2_DIGEST_LENGTH 16 - -typedef struct mdc2_ctx_st { - unsigned int num; - unsigned char data[MDC2_BLOCK]; - DES_cblock h, hh; - int pad_type; /* either 1 or 2, default 1 */ -} MDC2_CTX; - -int MDC2_Init(MDC2_CTX *c); -int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); -int MDC2_Final(unsigned char *md, MDC2_CTX *c); -unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/modes.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/modes.h deleted file mode 100644 index d544f98d..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/modes.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright 2008-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_MODES_H -# define HEADER_MODES_H - -# include - -# ifdef __cplusplus -extern "C" { -# endif -typedef void (*block128_f) (const unsigned char in[16], - unsigned char out[16], const void *key); - -typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int enc); - -typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16]); - -typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16], - unsigned char cmac[16]); - -void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); -void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); - -void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], - unsigned char ecount_buf[16], unsigned int *num, - block128_f block); - -void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], - unsigned char ecount_buf[16], - unsigned int *num, ctr128_f ctr); - -void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - block128_f block); - -void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); -void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); -void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, - size_t bits, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); - -size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, unsigned char ivec[16], - block128_f block); -size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); -size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, unsigned char ivec[16], - block128_f block); -size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); - -size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, - unsigned char ivec[16], - block128_f block); -size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); -size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, - unsigned char ivec[16], - block128_f block); -size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); - -typedef struct gcm128_context GCM128_CONTEXT; - -GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); -void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); -void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, - size_t len); -int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, - size_t len); -int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); -int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); -int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); -int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); -int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, - size_t len); -void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); -void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); - -typedef struct ccm128_context CCM128_CONTEXT; - -void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, - unsigned int M, unsigned int L, void *key, - block128_f block); -int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, - size_t nlen, size_t mlen); -void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, - size_t alen); -int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len); -int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len); -int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len, - ccm128_f stream); -int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len, - ccm128_f stream); -size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); - -typedef struct xts128_context XTS128_CONTEXT; - -int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, - const unsigned char iv[16], - const unsigned char *inp, unsigned char *out, - size_t len, int enc); - -size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, size_t inlen, - block128_f block); - -size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, size_t inlen, - block128_f block); -size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, - unsigned char *out, const unsigned char *in, - size_t inlen, block128_f block); -size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, - unsigned char *out, const unsigned char *in, - size_t inlen, block128_f block); - -# ifndef OPENSSL_NO_OCB -typedef struct ocb128_context OCB128_CONTEXT; - -typedef void (*ocb128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - size_t start_block_num, - unsigned char offset_i[16], - const unsigned char L_[][16], - unsigned char checksum[16]); - -OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, - block128_f encrypt, block128_f decrypt, - ocb128_f stream); -int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, - block128_f encrypt, block128_f decrypt, - ocb128_f stream); -int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, - void *keyenc, void *keydec); -int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, - size_t len, size_t taglen); -int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, - size_t len); -int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in, - unsigned char *out, size_t len); -int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in, - unsigned char *out, size_t len); -int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag, - size_t len); -int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len); -void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx); -# endif /* OPENSSL_NO_OCB */ - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/obj_mac.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/obj_mac.h deleted file mode 100644 index 483fc050..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/obj_mac.h +++ /dev/null @@ -1,5198 +0,0 @@ -/* - * WARNING: do not edit! - * Generated by crypto/objects/objects.pl - * - * Copyright 2000-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 - */ - -#define SN_undef "UNDEF" -#define LN_undef "undefined" -#define NID_undef 0 -#define OBJ_undef 0L - -#define SN_itu_t "ITU-T" -#define LN_itu_t "itu-t" -#define NID_itu_t 645 -#define OBJ_itu_t 0L - -#define NID_ccitt 404 -#define OBJ_ccitt OBJ_itu_t - -#define SN_iso "ISO" -#define LN_iso "iso" -#define NID_iso 181 -#define OBJ_iso 1L - -#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" -#define LN_joint_iso_itu_t "joint-iso-itu-t" -#define NID_joint_iso_itu_t 646 -#define OBJ_joint_iso_itu_t 2L - -#define NID_joint_iso_ccitt 393 -#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t - -#define SN_member_body "member-body" -#define LN_member_body "ISO Member Body" -#define NID_member_body 182 -#define OBJ_member_body OBJ_iso,2L - -#define SN_identified_organization "identified-organization" -#define NID_identified_organization 676 -#define OBJ_identified_organization OBJ_iso,3L - -#define SN_hmac_md5 "HMAC-MD5" -#define LN_hmac_md5 "hmac-md5" -#define NID_hmac_md5 780 -#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L - -#define SN_hmac_sha1 "HMAC-SHA1" -#define LN_hmac_sha1 "hmac-sha1" -#define NID_hmac_sha1 781 -#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L - -#define SN_x509ExtAdmission "x509ExtAdmission" -#define LN_x509ExtAdmission "Professional Information or basis for Admission" -#define NID_x509ExtAdmission 1093 -#define OBJ_x509ExtAdmission OBJ_identified_organization,36L,8L,3L,3L - -#define SN_certicom_arc "certicom-arc" -#define NID_certicom_arc 677 -#define OBJ_certicom_arc OBJ_identified_organization,132L - -#define SN_ieee "ieee" -#define NID_ieee 1170 -#define OBJ_ieee OBJ_identified_organization,111L - -#define SN_ieee_siswg "ieee-siswg" -#define LN_ieee_siswg "IEEE Security in Storage Working Group" -#define NID_ieee_siswg 1171 -#define OBJ_ieee_siswg OBJ_ieee,2L,1619L - -#define SN_international_organizations "international-organizations" -#define LN_international_organizations "International Organizations" -#define NID_international_organizations 647 -#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L - -#define SN_wap "wap" -#define NID_wap 678 -#define OBJ_wap OBJ_international_organizations,43L - -#define SN_wap_wsg "wap-wsg" -#define NID_wap_wsg 679 -#define OBJ_wap_wsg OBJ_wap,1L - -#define SN_selected_attribute_types "selected-attribute-types" -#define LN_selected_attribute_types "Selected Attribute Types" -#define NID_selected_attribute_types 394 -#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L - -#define SN_clearance "clearance" -#define NID_clearance 395 -#define OBJ_clearance OBJ_selected_attribute_types,55L - -#define SN_ISO_US "ISO-US" -#define LN_ISO_US "ISO US Member Body" -#define NID_ISO_US 183 -#define OBJ_ISO_US OBJ_member_body,840L - -#define SN_X9_57 "X9-57" -#define LN_X9_57 "X9.57" -#define NID_X9_57 184 -#define OBJ_X9_57 OBJ_ISO_US,10040L - -#define SN_X9cm "X9cm" -#define LN_X9cm "X9.57 CM ?" -#define NID_X9cm 185 -#define OBJ_X9cm OBJ_X9_57,4L - -#define SN_ISO_CN "ISO-CN" -#define LN_ISO_CN "ISO CN Member Body" -#define NID_ISO_CN 1140 -#define OBJ_ISO_CN OBJ_member_body,156L - -#define SN_oscca "oscca" -#define NID_oscca 1141 -#define OBJ_oscca OBJ_ISO_CN,10197L - -#define SN_sm_scheme "sm-scheme" -#define NID_sm_scheme 1142 -#define OBJ_sm_scheme OBJ_oscca,1L - -#define SN_dsa "DSA" -#define LN_dsa "dsaEncryption" -#define NID_dsa 116 -#define OBJ_dsa OBJ_X9cm,1L - -#define SN_dsaWithSHA1 "DSA-SHA1" -#define LN_dsaWithSHA1 "dsaWithSHA1" -#define NID_dsaWithSHA1 113 -#define OBJ_dsaWithSHA1 OBJ_X9cm,3L - -#define SN_ansi_X9_62 "ansi-X9-62" -#define LN_ansi_X9_62 "ANSI X9.62" -#define NID_ansi_X9_62 405 -#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L - -#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L - -#define SN_X9_62_prime_field "prime-field" -#define NID_X9_62_prime_field 406 -#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L - -#define SN_X9_62_characteristic_two_field "characteristic-two-field" -#define NID_X9_62_characteristic_two_field 407 -#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L - -#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" -#define NID_X9_62_id_characteristic_two_basis 680 -#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L - -#define SN_X9_62_onBasis "onBasis" -#define NID_X9_62_onBasis 681 -#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L - -#define SN_X9_62_tpBasis "tpBasis" -#define NID_X9_62_tpBasis 682 -#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L - -#define SN_X9_62_ppBasis "ppBasis" -#define NID_X9_62_ppBasis 683 -#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L - -#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L - -#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" -#define NID_X9_62_id_ecPublicKey 408 -#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L - -#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L - -#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L - -#define SN_X9_62_c2pnb163v1 "c2pnb163v1" -#define NID_X9_62_c2pnb163v1 684 -#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L - -#define SN_X9_62_c2pnb163v2 "c2pnb163v2" -#define NID_X9_62_c2pnb163v2 685 -#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L - -#define SN_X9_62_c2pnb163v3 "c2pnb163v3" -#define NID_X9_62_c2pnb163v3 686 -#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L - -#define SN_X9_62_c2pnb176v1 "c2pnb176v1" -#define NID_X9_62_c2pnb176v1 687 -#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L - -#define SN_X9_62_c2tnb191v1 "c2tnb191v1" -#define NID_X9_62_c2tnb191v1 688 -#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L - -#define SN_X9_62_c2tnb191v2 "c2tnb191v2" -#define NID_X9_62_c2tnb191v2 689 -#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L - -#define SN_X9_62_c2tnb191v3 "c2tnb191v3" -#define NID_X9_62_c2tnb191v3 690 -#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L - -#define SN_X9_62_c2onb191v4 "c2onb191v4" -#define NID_X9_62_c2onb191v4 691 -#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L - -#define SN_X9_62_c2onb191v5 "c2onb191v5" -#define NID_X9_62_c2onb191v5 692 -#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L - -#define SN_X9_62_c2pnb208w1 "c2pnb208w1" -#define NID_X9_62_c2pnb208w1 693 -#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L - -#define SN_X9_62_c2tnb239v1 "c2tnb239v1" -#define NID_X9_62_c2tnb239v1 694 -#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L - -#define SN_X9_62_c2tnb239v2 "c2tnb239v2" -#define NID_X9_62_c2tnb239v2 695 -#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L - -#define SN_X9_62_c2tnb239v3 "c2tnb239v3" -#define NID_X9_62_c2tnb239v3 696 -#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L - -#define SN_X9_62_c2onb239v4 "c2onb239v4" -#define NID_X9_62_c2onb239v4 697 -#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L - -#define SN_X9_62_c2onb239v5 "c2onb239v5" -#define NID_X9_62_c2onb239v5 698 -#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L - -#define SN_X9_62_c2pnb272w1 "c2pnb272w1" -#define NID_X9_62_c2pnb272w1 699 -#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L - -#define SN_X9_62_c2pnb304w1 "c2pnb304w1" -#define NID_X9_62_c2pnb304w1 700 -#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L - -#define SN_X9_62_c2tnb359v1 "c2tnb359v1" -#define NID_X9_62_c2tnb359v1 701 -#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L - -#define SN_X9_62_c2pnb368w1 "c2pnb368w1" -#define NID_X9_62_c2pnb368w1 702 -#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L - -#define SN_X9_62_c2tnb431r1 "c2tnb431r1" -#define NID_X9_62_c2tnb431r1 703 -#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L - -#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L - -#define SN_X9_62_prime192v1 "prime192v1" -#define NID_X9_62_prime192v1 409 -#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L - -#define SN_X9_62_prime192v2 "prime192v2" -#define NID_X9_62_prime192v2 410 -#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L - -#define SN_X9_62_prime192v3 "prime192v3" -#define NID_X9_62_prime192v3 411 -#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L - -#define SN_X9_62_prime239v1 "prime239v1" -#define NID_X9_62_prime239v1 412 -#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L - -#define SN_X9_62_prime239v2 "prime239v2" -#define NID_X9_62_prime239v2 413 -#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L - -#define SN_X9_62_prime239v3 "prime239v3" -#define NID_X9_62_prime239v3 414 -#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L - -#define SN_X9_62_prime256v1 "prime256v1" -#define NID_X9_62_prime256v1 415 -#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L - -#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L - -#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" -#define NID_ecdsa_with_SHA1 416 -#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L - -#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" -#define NID_ecdsa_with_Recommended 791 -#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L - -#define SN_ecdsa_with_Specified "ecdsa-with-Specified" -#define NID_ecdsa_with_Specified 792 -#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L - -#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" -#define NID_ecdsa_with_SHA224 793 -#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L - -#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" -#define NID_ecdsa_with_SHA256 794 -#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L - -#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" -#define NID_ecdsa_with_SHA384 795 -#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L - -#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" -#define NID_ecdsa_with_SHA512 796 -#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L - -#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L - -#define SN_secp112r1 "secp112r1" -#define NID_secp112r1 704 -#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L - -#define SN_secp112r2 "secp112r2" -#define NID_secp112r2 705 -#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L - -#define SN_secp128r1 "secp128r1" -#define NID_secp128r1 706 -#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L - -#define SN_secp128r2 "secp128r2" -#define NID_secp128r2 707 -#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L - -#define SN_secp160k1 "secp160k1" -#define NID_secp160k1 708 -#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L - -#define SN_secp160r1 "secp160r1" -#define NID_secp160r1 709 -#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L - -#define SN_secp160r2 "secp160r2" -#define NID_secp160r2 710 -#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L - -#define SN_secp192k1 "secp192k1" -#define NID_secp192k1 711 -#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L - -#define SN_secp224k1 "secp224k1" -#define NID_secp224k1 712 -#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L - -#define SN_secp224r1 "secp224r1" -#define NID_secp224r1 713 -#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L - -#define SN_secp256k1 "secp256k1" -#define NID_secp256k1 714 -#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L - -#define SN_secp384r1 "secp384r1" -#define NID_secp384r1 715 -#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L - -#define SN_secp521r1 "secp521r1" -#define NID_secp521r1 716 -#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L - -#define SN_sect113r1 "sect113r1" -#define NID_sect113r1 717 -#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L - -#define SN_sect113r2 "sect113r2" -#define NID_sect113r2 718 -#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L - -#define SN_sect131r1 "sect131r1" -#define NID_sect131r1 719 -#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L - -#define SN_sect131r2 "sect131r2" -#define NID_sect131r2 720 -#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L - -#define SN_sect163k1 "sect163k1" -#define NID_sect163k1 721 -#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L - -#define SN_sect163r1 "sect163r1" -#define NID_sect163r1 722 -#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L - -#define SN_sect163r2 "sect163r2" -#define NID_sect163r2 723 -#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L - -#define SN_sect193r1 "sect193r1" -#define NID_sect193r1 724 -#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L - -#define SN_sect193r2 "sect193r2" -#define NID_sect193r2 725 -#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L - -#define SN_sect233k1 "sect233k1" -#define NID_sect233k1 726 -#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L - -#define SN_sect233r1 "sect233r1" -#define NID_sect233r1 727 -#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L - -#define SN_sect239k1 "sect239k1" -#define NID_sect239k1 728 -#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L - -#define SN_sect283k1 "sect283k1" -#define NID_sect283k1 729 -#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L - -#define SN_sect283r1 "sect283r1" -#define NID_sect283r1 730 -#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L - -#define SN_sect409k1 "sect409k1" -#define NID_sect409k1 731 -#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L - -#define SN_sect409r1 "sect409r1" -#define NID_sect409r1 732 -#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L - -#define SN_sect571k1 "sect571k1" -#define NID_sect571k1 733 -#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L - -#define SN_sect571r1 "sect571r1" -#define NID_sect571r1 734 -#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L - -#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L - -#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" -#define NID_wap_wsg_idm_ecid_wtls1 735 -#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L - -#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" -#define NID_wap_wsg_idm_ecid_wtls3 736 -#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L - -#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" -#define NID_wap_wsg_idm_ecid_wtls4 737 -#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L - -#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" -#define NID_wap_wsg_idm_ecid_wtls5 738 -#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L - -#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" -#define NID_wap_wsg_idm_ecid_wtls6 739 -#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L - -#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" -#define NID_wap_wsg_idm_ecid_wtls7 740 -#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L - -#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" -#define NID_wap_wsg_idm_ecid_wtls8 741 -#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L - -#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" -#define NID_wap_wsg_idm_ecid_wtls9 742 -#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L - -#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" -#define NID_wap_wsg_idm_ecid_wtls10 743 -#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L - -#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" -#define NID_wap_wsg_idm_ecid_wtls11 744 -#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L - -#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" -#define NID_wap_wsg_idm_ecid_wtls12 745 -#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L - -#define SN_cast5_cbc "CAST5-CBC" -#define LN_cast5_cbc "cast5-cbc" -#define NID_cast5_cbc 108 -#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L - -#define SN_cast5_ecb "CAST5-ECB" -#define LN_cast5_ecb "cast5-ecb" -#define NID_cast5_ecb 109 - -#define SN_cast5_cfb64 "CAST5-CFB" -#define LN_cast5_cfb64 "cast5-cfb" -#define NID_cast5_cfb64 110 - -#define SN_cast5_ofb64 "CAST5-OFB" -#define LN_cast5_ofb64 "cast5-ofb" -#define NID_cast5_ofb64 111 - -#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" -#define NID_pbeWithMD5AndCast5_CBC 112 -#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L - -#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" -#define LN_id_PasswordBasedMAC "password based MAC" -#define NID_id_PasswordBasedMAC 782 -#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L - -#define SN_id_DHBasedMac "id-DHBasedMac" -#define LN_id_DHBasedMac "Diffie-Hellman based MAC" -#define NID_id_DHBasedMac 783 -#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L - -#define SN_rsadsi "rsadsi" -#define LN_rsadsi "RSA Data Security, Inc." -#define NID_rsadsi 1 -#define OBJ_rsadsi OBJ_ISO_US,113549L - -#define SN_pkcs "pkcs" -#define LN_pkcs "RSA Data Security, Inc. PKCS" -#define NID_pkcs 2 -#define OBJ_pkcs OBJ_rsadsi,1L - -#define SN_pkcs1 "pkcs1" -#define NID_pkcs1 186 -#define OBJ_pkcs1 OBJ_pkcs,1L - -#define LN_rsaEncryption "rsaEncryption" -#define NID_rsaEncryption 6 -#define OBJ_rsaEncryption OBJ_pkcs1,1L - -#define SN_md2WithRSAEncryption "RSA-MD2" -#define LN_md2WithRSAEncryption "md2WithRSAEncryption" -#define NID_md2WithRSAEncryption 7 -#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L - -#define SN_md4WithRSAEncryption "RSA-MD4" -#define LN_md4WithRSAEncryption "md4WithRSAEncryption" -#define NID_md4WithRSAEncryption 396 -#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L - -#define SN_md5WithRSAEncryption "RSA-MD5" -#define LN_md5WithRSAEncryption "md5WithRSAEncryption" -#define NID_md5WithRSAEncryption 8 -#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L - -#define SN_sha1WithRSAEncryption "RSA-SHA1" -#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" -#define NID_sha1WithRSAEncryption 65 -#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L - -#define SN_rsaesOaep "RSAES-OAEP" -#define LN_rsaesOaep "rsaesOaep" -#define NID_rsaesOaep 919 -#define OBJ_rsaesOaep OBJ_pkcs1,7L - -#define SN_mgf1 "MGF1" -#define LN_mgf1 "mgf1" -#define NID_mgf1 911 -#define OBJ_mgf1 OBJ_pkcs1,8L - -#define SN_pSpecified "PSPECIFIED" -#define LN_pSpecified "pSpecified" -#define NID_pSpecified 935 -#define OBJ_pSpecified OBJ_pkcs1,9L - -#define SN_rsassaPss "RSASSA-PSS" -#define LN_rsassaPss "rsassaPss" -#define NID_rsassaPss 912 -#define OBJ_rsassaPss OBJ_pkcs1,10L - -#define SN_sha256WithRSAEncryption "RSA-SHA256" -#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" -#define NID_sha256WithRSAEncryption 668 -#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L - -#define SN_sha384WithRSAEncryption "RSA-SHA384" -#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" -#define NID_sha384WithRSAEncryption 669 -#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L - -#define SN_sha512WithRSAEncryption "RSA-SHA512" -#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" -#define NID_sha512WithRSAEncryption 670 -#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L - -#define SN_sha224WithRSAEncryption "RSA-SHA224" -#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" -#define NID_sha224WithRSAEncryption 671 -#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L - -#define SN_sha512_224WithRSAEncryption "RSA-SHA512/224" -#define LN_sha512_224WithRSAEncryption "sha512-224WithRSAEncryption" -#define NID_sha512_224WithRSAEncryption 1145 -#define OBJ_sha512_224WithRSAEncryption OBJ_pkcs1,15L - -#define SN_sha512_256WithRSAEncryption "RSA-SHA512/256" -#define LN_sha512_256WithRSAEncryption "sha512-256WithRSAEncryption" -#define NID_sha512_256WithRSAEncryption 1146 -#define OBJ_sha512_256WithRSAEncryption OBJ_pkcs1,16L - -#define SN_pkcs3 "pkcs3" -#define NID_pkcs3 27 -#define OBJ_pkcs3 OBJ_pkcs,3L - -#define LN_dhKeyAgreement "dhKeyAgreement" -#define NID_dhKeyAgreement 28 -#define OBJ_dhKeyAgreement OBJ_pkcs3,1L - -#define SN_pkcs5 "pkcs5" -#define NID_pkcs5 187 -#define OBJ_pkcs5 OBJ_pkcs,5L - -#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" -#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" -#define NID_pbeWithMD2AndDES_CBC 9 -#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L - -#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" -#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" -#define NID_pbeWithMD5AndDES_CBC 10 -#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L - -#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" -#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" -#define NID_pbeWithMD2AndRC2_CBC 168 -#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L - -#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" -#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" -#define NID_pbeWithMD5AndRC2_CBC 169 -#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L - -#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" -#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" -#define NID_pbeWithSHA1AndDES_CBC 170 -#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L - -#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" -#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" -#define NID_pbeWithSHA1AndRC2_CBC 68 -#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L - -#define LN_id_pbkdf2 "PBKDF2" -#define NID_id_pbkdf2 69 -#define OBJ_id_pbkdf2 OBJ_pkcs5,12L - -#define LN_pbes2 "PBES2" -#define NID_pbes2 161 -#define OBJ_pbes2 OBJ_pkcs5,13L - -#define LN_pbmac1 "PBMAC1" -#define NID_pbmac1 162 -#define OBJ_pbmac1 OBJ_pkcs5,14L - -#define SN_pkcs7 "pkcs7" -#define NID_pkcs7 20 -#define OBJ_pkcs7 OBJ_pkcs,7L - -#define LN_pkcs7_data "pkcs7-data" -#define NID_pkcs7_data 21 -#define OBJ_pkcs7_data OBJ_pkcs7,1L - -#define LN_pkcs7_signed "pkcs7-signedData" -#define NID_pkcs7_signed 22 -#define OBJ_pkcs7_signed OBJ_pkcs7,2L - -#define LN_pkcs7_enveloped "pkcs7-envelopedData" -#define NID_pkcs7_enveloped 23 -#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L - -#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" -#define NID_pkcs7_signedAndEnveloped 24 -#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L - -#define LN_pkcs7_digest "pkcs7-digestData" -#define NID_pkcs7_digest 25 -#define OBJ_pkcs7_digest OBJ_pkcs7,5L - -#define LN_pkcs7_encrypted "pkcs7-encryptedData" -#define NID_pkcs7_encrypted 26 -#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L - -#define SN_pkcs9 "pkcs9" -#define NID_pkcs9 47 -#define OBJ_pkcs9 OBJ_pkcs,9L - -#define LN_pkcs9_emailAddress "emailAddress" -#define NID_pkcs9_emailAddress 48 -#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L - -#define LN_pkcs9_unstructuredName "unstructuredName" -#define NID_pkcs9_unstructuredName 49 -#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L - -#define LN_pkcs9_contentType "contentType" -#define NID_pkcs9_contentType 50 -#define OBJ_pkcs9_contentType OBJ_pkcs9,3L - -#define LN_pkcs9_messageDigest "messageDigest" -#define NID_pkcs9_messageDigest 51 -#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L - -#define LN_pkcs9_signingTime "signingTime" -#define NID_pkcs9_signingTime 52 -#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L - -#define LN_pkcs9_countersignature "countersignature" -#define NID_pkcs9_countersignature 53 -#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L - -#define LN_pkcs9_challengePassword "challengePassword" -#define NID_pkcs9_challengePassword 54 -#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L - -#define LN_pkcs9_unstructuredAddress "unstructuredAddress" -#define NID_pkcs9_unstructuredAddress 55 -#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L - -#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" -#define NID_pkcs9_extCertAttributes 56 -#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L - -#define SN_ext_req "extReq" -#define LN_ext_req "Extension Request" -#define NID_ext_req 172 -#define OBJ_ext_req OBJ_pkcs9,14L - -#define SN_SMIMECapabilities "SMIME-CAPS" -#define LN_SMIMECapabilities "S/MIME Capabilities" -#define NID_SMIMECapabilities 167 -#define OBJ_SMIMECapabilities OBJ_pkcs9,15L - -#define SN_SMIME "SMIME" -#define LN_SMIME "S/MIME" -#define NID_SMIME 188 -#define OBJ_SMIME OBJ_pkcs9,16L - -#define SN_id_smime_mod "id-smime-mod" -#define NID_id_smime_mod 189 -#define OBJ_id_smime_mod OBJ_SMIME,0L - -#define SN_id_smime_ct "id-smime-ct" -#define NID_id_smime_ct 190 -#define OBJ_id_smime_ct OBJ_SMIME,1L - -#define SN_id_smime_aa "id-smime-aa" -#define NID_id_smime_aa 191 -#define OBJ_id_smime_aa OBJ_SMIME,2L - -#define SN_id_smime_alg "id-smime-alg" -#define NID_id_smime_alg 192 -#define OBJ_id_smime_alg OBJ_SMIME,3L - -#define SN_id_smime_cd "id-smime-cd" -#define NID_id_smime_cd 193 -#define OBJ_id_smime_cd OBJ_SMIME,4L - -#define SN_id_smime_spq "id-smime-spq" -#define NID_id_smime_spq 194 -#define OBJ_id_smime_spq OBJ_SMIME,5L - -#define SN_id_smime_cti "id-smime-cti" -#define NID_id_smime_cti 195 -#define OBJ_id_smime_cti OBJ_SMIME,6L - -#define SN_id_smime_mod_cms "id-smime-mod-cms" -#define NID_id_smime_mod_cms 196 -#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L - -#define SN_id_smime_mod_ess "id-smime-mod-ess" -#define NID_id_smime_mod_ess 197 -#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L - -#define SN_id_smime_mod_oid "id-smime-mod-oid" -#define NID_id_smime_mod_oid 198 -#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L - -#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" -#define NID_id_smime_mod_msg_v3 199 -#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L - -#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" -#define NID_id_smime_mod_ets_eSignature_88 200 -#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L - -#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" -#define NID_id_smime_mod_ets_eSignature_97 201 -#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L - -#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" -#define NID_id_smime_mod_ets_eSigPolicy_88 202 -#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L - -#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" -#define NID_id_smime_mod_ets_eSigPolicy_97 203 -#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L - -#define SN_id_smime_ct_receipt "id-smime-ct-receipt" -#define NID_id_smime_ct_receipt 204 -#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L - -#define SN_id_smime_ct_authData "id-smime-ct-authData" -#define NID_id_smime_ct_authData 205 -#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L - -#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" -#define NID_id_smime_ct_publishCert 206 -#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L - -#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" -#define NID_id_smime_ct_TSTInfo 207 -#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L - -#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" -#define NID_id_smime_ct_TDTInfo 208 -#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L - -#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" -#define NID_id_smime_ct_contentInfo 209 -#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L - -#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" -#define NID_id_smime_ct_DVCSRequestData 210 -#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L - -#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" -#define NID_id_smime_ct_DVCSResponseData 211 -#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L - -#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" -#define NID_id_smime_ct_compressedData 786 -#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L - -#define SN_id_smime_ct_contentCollection "id-smime-ct-contentCollection" -#define NID_id_smime_ct_contentCollection 1058 -#define OBJ_id_smime_ct_contentCollection OBJ_id_smime_ct,19L - -#define SN_id_smime_ct_authEnvelopedData "id-smime-ct-authEnvelopedData" -#define NID_id_smime_ct_authEnvelopedData 1059 -#define OBJ_id_smime_ct_authEnvelopedData OBJ_id_smime_ct,23L - -#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" -#define NID_id_ct_asciiTextWithCRLF 787 -#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L - -#define SN_id_ct_xml "id-ct-xml" -#define NID_id_ct_xml 1060 -#define OBJ_id_ct_xml OBJ_id_smime_ct,28L - -#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" -#define NID_id_smime_aa_receiptRequest 212 -#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L - -#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" -#define NID_id_smime_aa_securityLabel 213 -#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L - -#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" -#define NID_id_smime_aa_mlExpandHistory 214 -#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L - -#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" -#define NID_id_smime_aa_contentHint 215 -#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L - -#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" -#define NID_id_smime_aa_msgSigDigest 216 -#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L - -#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" -#define NID_id_smime_aa_encapContentType 217 -#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L - -#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" -#define NID_id_smime_aa_contentIdentifier 218 -#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L - -#define SN_id_smime_aa_macValue "id-smime-aa-macValue" -#define NID_id_smime_aa_macValue 219 -#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L - -#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" -#define NID_id_smime_aa_equivalentLabels 220 -#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L - -#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" -#define NID_id_smime_aa_contentReference 221 -#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L - -#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" -#define NID_id_smime_aa_encrypKeyPref 222 -#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L - -#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" -#define NID_id_smime_aa_signingCertificate 223 -#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L - -#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" -#define NID_id_smime_aa_smimeEncryptCerts 224 -#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L - -#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" -#define NID_id_smime_aa_timeStampToken 225 -#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L - -#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" -#define NID_id_smime_aa_ets_sigPolicyId 226 -#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L - -#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" -#define NID_id_smime_aa_ets_commitmentType 227 -#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L - -#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" -#define NID_id_smime_aa_ets_signerLocation 228 -#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L - -#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" -#define NID_id_smime_aa_ets_signerAttr 229 -#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L - -#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" -#define NID_id_smime_aa_ets_otherSigCert 230 -#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L - -#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" -#define NID_id_smime_aa_ets_contentTimestamp 231 -#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L - -#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" -#define NID_id_smime_aa_ets_CertificateRefs 232 -#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L - -#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" -#define NID_id_smime_aa_ets_RevocationRefs 233 -#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L - -#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" -#define NID_id_smime_aa_ets_certValues 234 -#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L - -#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" -#define NID_id_smime_aa_ets_revocationValues 235 -#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L - -#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" -#define NID_id_smime_aa_ets_escTimeStamp 236 -#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L - -#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" -#define NID_id_smime_aa_ets_certCRLTimestamp 237 -#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L - -#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" -#define NID_id_smime_aa_ets_archiveTimeStamp 238 -#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L - -#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" -#define NID_id_smime_aa_signatureType 239 -#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L - -#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" -#define NID_id_smime_aa_dvcs_dvc 240 -#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L - -#define SN_id_smime_aa_signingCertificateV2 "id-smime-aa-signingCertificateV2" -#define NID_id_smime_aa_signingCertificateV2 1086 -#define OBJ_id_smime_aa_signingCertificateV2 OBJ_id_smime_aa,47L - -#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" -#define NID_id_smime_alg_ESDHwith3DES 241 -#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L - -#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" -#define NID_id_smime_alg_ESDHwithRC2 242 -#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L - -#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" -#define NID_id_smime_alg_3DESwrap 243 -#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L - -#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" -#define NID_id_smime_alg_RC2wrap 244 -#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L - -#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" -#define NID_id_smime_alg_ESDH 245 -#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L - -#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" -#define NID_id_smime_alg_CMS3DESwrap 246 -#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L - -#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" -#define NID_id_smime_alg_CMSRC2wrap 247 -#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L - -#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" -#define NID_id_alg_PWRI_KEK 893 -#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L - -#define SN_id_smime_cd_ldap "id-smime-cd-ldap" -#define NID_id_smime_cd_ldap 248 -#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L - -#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" -#define NID_id_smime_spq_ets_sqt_uri 249 -#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L - -#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" -#define NID_id_smime_spq_ets_sqt_unotice 250 -#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L - -#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" -#define NID_id_smime_cti_ets_proofOfOrigin 251 -#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L - -#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" -#define NID_id_smime_cti_ets_proofOfReceipt 252 -#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L - -#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" -#define NID_id_smime_cti_ets_proofOfDelivery 253 -#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L - -#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" -#define NID_id_smime_cti_ets_proofOfSender 254 -#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L - -#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" -#define NID_id_smime_cti_ets_proofOfApproval 255 -#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L - -#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" -#define NID_id_smime_cti_ets_proofOfCreation 256 -#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L - -#define LN_friendlyName "friendlyName" -#define NID_friendlyName 156 -#define OBJ_friendlyName OBJ_pkcs9,20L - -#define LN_localKeyID "localKeyID" -#define NID_localKeyID 157 -#define OBJ_localKeyID OBJ_pkcs9,21L - -#define SN_ms_csp_name "CSPName" -#define LN_ms_csp_name "Microsoft CSP Name" -#define NID_ms_csp_name 417 -#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L - -#define SN_LocalKeySet "LocalKeySet" -#define LN_LocalKeySet "Microsoft Local Key set" -#define NID_LocalKeySet 856 -#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L - -#define OBJ_certTypes OBJ_pkcs9,22L - -#define LN_x509Certificate "x509Certificate" -#define NID_x509Certificate 158 -#define OBJ_x509Certificate OBJ_certTypes,1L - -#define LN_sdsiCertificate "sdsiCertificate" -#define NID_sdsiCertificate 159 -#define OBJ_sdsiCertificate OBJ_certTypes,2L - -#define OBJ_crlTypes OBJ_pkcs9,23L - -#define LN_x509Crl "x509Crl" -#define NID_x509Crl 160 -#define OBJ_x509Crl OBJ_crlTypes,1L - -#define OBJ_pkcs12 OBJ_pkcs,12L - -#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L - -#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" -#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" -#define NID_pbe_WithSHA1And128BitRC4 144 -#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L - -#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" -#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" -#define NID_pbe_WithSHA1And40BitRC4 145 -#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L - -#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" -#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 -#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L - -#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" -#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 -#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L - -#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" -#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" -#define NID_pbe_WithSHA1And128BitRC2_CBC 148 -#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L - -#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" -#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" -#define NID_pbe_WithSHA1And40BitRC2_CBC 149 -#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L - -#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L - -#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L - -#define LN_keyBag "keyBag" -#define NID_keyBag 150 -#define OBJ_keyBag OBJ_pkcs12_BagIds,1L - -#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" -#define NID_pkcs8ShroudedKeyBag 151 -#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L - -#define LN_certBag "certBag" -#define NID_certBag 152 -#define OBJ_certBag OBJ_pkcs12_BagIds,3L - -#define LN_crlBag "crlBag" -#define NID_crlBag 153 -#define OBJ_crlBag OBJ_pkcs12_BagIds,4L - -#define LN_secretBag "secretBag" -#define NID_secretBag 154 -#define OBJ_secretBag OBJ_pkcs12_BagIds,5L - -#define LN_safeContentsBag "safeContentsBag" -#define NID_safeContentsBag 155 -#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L - -#define SN_md2 "MD2" -#define LN_md2 "md2" -#define NID_md2 3 -#define OBJ_md2 OBJ_rsadsi,2L,2L - -#define SN_md4 "MD4" -#define LN_md4 "md4" -#define NID_md4 257 -#define OBJ_md4 OBJ_rsadsi,2L,4L - -#define SN_md5 "MD5" -#define LN_md5 "md5" -#define NID_md5 4 -#define OBJ_md5 OBJ_rsadsi,2L,5L - -#define SN_md5_sha1 "MD5-SHA1" -#define LN_md5_sha1 "md5-sha1" -#define NID_md5_sha1 114 - -#define LN_hmacWithMD5 "hmacWithMD5" -#define NID_hmacWithMD5 797 -#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L - -#define LN_hmacWithSHA1 "hmacWithSHA1" -#define NID_hmacWithSHA1 163 -#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L - -#define SN_sm2 "SM2" -#define LN_sm2 "sm2" -#define NID_sm2 1172 -#define OBJ_sm2 OBJ_sm_scheme,301L - -#define SN_sm3 "SM3" -#define LN_sm3 "sm3" -#define NID_sm3 1143 -#define OBJ_sm3 OBJ_sm_scheme,401L - -#define SN_sm3WithRSAEncryption "RSA-SM3" -#define LN_sm3WithRSAEncryption "sm3WithRSAEncryption" -#define NID_sm3WithRSAEncryption 1144 -#define OBJ_sm3WithRSAEncryption OBJ_sm_scheme,504L - -#define LN_hmacWithSHA224 "hmacWithSHA224" -#define NID_hmacWithSHA224 798 -#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L - -#define LN_hmacWithSHA256 "hmacWithSHA256" -#define NID_hmacWithSHA256 799 -#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L - -#define LN_hmacWithSHA384 "hmacWithSHA384" -#define NID_hmacWithSHA384 800 -#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L - -#define LN_hmacWithSHA512 "hmacWithSHA512" -#define NID_hmacWithSHA512 801 -#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L - -#define LN_hmacWithSHA512_224 "hmacWithSHA512-224" -#define NID_hmacWithSHA512_224 1193 -#define OBJ_hmacWithSHA512_224 OBJ_rsadsi,2L,12L - -#define LN_hmacWithSHA512_256 "hmacWithSHA512-256" -#define NID_hmacWithSHA512_256 1194 -#define OBJ_hmacWithSHA512_256 OBJ_rsadsi,2L,13L - -#define SN_rc2_cbc "RC2-CBC" -#define LN_rc2_cbc "rc2-cbc" -#define NID_rc2_cbc 37 -#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L - -#define SN_rc2_ecb "RC2-ECB" -#define LN_rc2_ecb "rc2-ecb" -#define NID_rc2_ecb 38 - -#define SN_rc2_cfb64 "RC2-CFB" -#define LN_rc2_cfb64 "rc2-cfb" -#define NID_rc2_cfb64 39 - -#define SN_rc2_ofb64 "RC2-OFB" -#define LN_rc2_ofb64 "rc2-ofb" -#define NID_rc2_ofb64 40 - -#define SN_rc2_40_cbc "RC2-40-CBC" -#define LN_rc2_40_cbc "rc2-40-cbc" -#define NID_rc2_40_cbc 98 - -#define SN_rc2_64_cbc "RC2-64-CBC" -#define LN_rc2_64_cbc "rc2-64-cbc" -#define NID_rc2_64_cbc 166 - -#define SN_rc4 "RC4" -#define LN_rc4 "rc4" -#define NID_rc4 5 -#define OBJ_rc4 OBJ_rsadsi,3L,4L - -#define SN_rc4_40 "RC4-40" -#define LN_rc4_40 "rc4-40" -#define NID_rc4_40 97 - -#define SN_des_ede3_cbc "DES-EDE3-CBC" -#define LN_des_ede3_cbc "des-ede3-cbc" -#define NID_des_ede3_cbc 44 -#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L - -#define SN_rc5_cbc "RC5-CBC" -#define LN_rc5_cbc "rc5-cbc" -#define NID_rc5_cbc 120 -#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L - -#define SN_rc5_ecb "RC5-ECB" -#define LN_rc5_ecb "rc5-ecb" -#define NID_rc5_ecb 121 - -#define SN_rc5_cfb64 "RC5-CFB" -#define LN_rc5_cfb64 "rc5-cfb" -#define NID_rc5_cfb64 122 - -#define SN_rc5_ofb64 "RC5-OFB" -#define LN_rc5_ofb64 "rc5-ofb" -#define NID_rc5_ofb64 123 - -#define SN_ms_ext_req "msExtReq" -#define LN_ms_ext_req "Microsoft Extension Request" -#define NID_ms_ext_req 171 -#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L - -#define SN_ms_code_ind "msCodeInd" -#define LN_ms_code_ind "Microsoft Individual Code Signing" -#define NID_ms_code_ind 134 -#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L - -#define SN_ms_code_com "msCodeCom" -#define LN_ms_code_com "Microsoft Commercial Code Signing" -#define NID_ms_code_com 135 -#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L - -#define SN_ms_ctl_sign "msCTLSign" -#define LN_ms_ctl_sign "Microsoft Trust List Signing" -#define NID_ms_ctl_sign 136 -#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L - -#define SN_ms_sgc "msSGC" -#define LN_ms_sgc "Microsoft Server Gated Crypto" -#define NID_ms_sgc 137 -#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L - -#define SN_ms_efs "msEFS" -#define LN_ms_efs "Microsoft Encrypted File System" -#define NID_ms_efs 138 -#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L - -#define SN_ms_smartcard_login "msSmartcardLogin" -#define LN_ms_smartcard_login "Microsoft Smartcard Login" -#define NID_ms_smartcard_login 648 -#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L - -#define SN_ms_upn "msUPN" -#define LN_ms_upn "Microsoft User Principal Name" -#define NID_ms_upn 649 -#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L - -#define SN_idea_cbc "IDEA-CBC" -#define LN_idea_cbc "idea-cbc" -#define NID_idea_cbc 34 -#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L - -#define SN_idea_ecb "IDEA-ECB" -#define LN_idea_ecb "idea-ecb" -#define NID_idea_ecb 36 - -#define SN_idea_cfb64 "IDEA-CFB" -#define LN_idea_cfb64 "idea-cfb" -#define NID_idea_cfb64 35 - -#define SN_idea_ofb64 "IDEA-OFB" -#define LN_idea_ofb64 "idea-ofb" -#define NID_idea_ofb64 46 - -#define SN_bf_cbc "BF-CBC" -#define LN_bf_cbc "bf-cbc" -#define NID_bf_cbc 91 -#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L - -#define SN_bf_ecb "BF-ECB" -#define LN_bf_ecb "bf-ecb" -#define NID_bf_ecb 92 - -#define SN_bf_cfb64 "BF-CFB" -#define LN_bf_cfb64 "bf-cfb" -#define NID_bf_cfb64 93 - -#define SN_bf_ofb64 "BF-OFB" -#define LN_bf_ofb64 "bf-ofb" -#define NID_bf_ofb64 94 - -#define SN_id_pkix "PKIX" -#define NID_id_pkix 127 -#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L - -#define SN_id_pkix_mod "id-pkix-mod" -#define NID_id_pkix_mod 258 -#define OBJ_id_pkix_mod OBJ_id_pkix,0L - -#define SN_id_pe "id-pe" -#define NID_id_pe 175 -#define OBJ_id_pe OBJ_id_pkix,1L - -#define SN_id_qt "id-qt" -#define NID_id_qt 259 -#define OBJ_id_qt OBJ_id_pkix,2L - -#define SN_id_kp "id-kp" -#define NID_id_kp 128 -#define OBJ_id_kp OBJ_id_pkix,3L - -#define SN_id_it "id-it" -#define NID_id_it 260 -#define OBJ_id_it OBJ_id_pkix,4L - -#define SN_id_pkip "id-pkip" -#define NID_id_pkip 261 -#define OBJ_id_pkip OBJ_id_pkix,5L - -#define SN_id_alg "id-alg" -#define NID_id_alg 262 -#define OBJ_id_alg OBJ_id_pkix,6L - -#define SN_id_cmc "id-cmc" -#define NID_id_cmc 263 -#define OBJ_id_cmc OBJ_id_pkix,7L - -#define SN_id_on "id-on" -#define NID_id_on 264 -#define OBJ_id_on OBJ_id_pkix,8L - -#define SN_id_pda "id-pda" -#define NID_id_pda 265 -#define OBJ_id_pda OBJ_id_pkix,9L - -#define SN_id_aca "id-aca" -#define NID_id_aca 266 -#define OBJ_id_aca OBJ_id_pkix,10L - -#define SN_id_qcs "id-qcs" -#define NID_id_qcs 267 -#define OBJ_id_qcs OBJ_id_pkix,11L - -#define SN_id_cct "id-cct" -#define NID_id_cct 268 -#define OBJ_id_cct OBJ_id_pkix,12L - -#define SN_id_ppl "id-ppl" -#define NID_id_ppl 662 -#define OBJ_id_ppl OBJ_id_pkix,21L - -#define SN_id_ad "id-ad" -#define NID_id_ad 176 -#define OBJ_id_ad OBJ_id_pkix,48L - -#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" -#define NID_id_pkix1_explicit_88 269 -#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L - -#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" -#define NID_id_pkix1_implicit_88 270 -#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L - -#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" -#define NID_id_pkix1_explicit_93 271 -#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L - -#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" -#define NID_id_pkix1_implicit_93 272 -#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L - -#define SN_id_mod_crmf "id-mod-crmf" -#define NID_id_mod_crmf 273 -#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L - -#define SN_id_mod_cmc "id-mod-cmc" -#define NID_id_mod_cmc 274 -#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L - -#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" -#define NID_id_mod_kea_profile_88 275 -#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L - -#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" -#define NID_id_mod_kea_profile_93 276 -#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L - -#define SN_id_mod_cmp "id-mod-cmp" -#define NID_id_mod_cmp 277 -#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L - -#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" -#define NID_id_mod_qualified_cert_88 278 -#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L - -#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" -#define NID_id_mod_qualified_cert_93 279 -#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L - -#define SN_id_mod_attribute_cert "id-mod-attribute-cert" -#define NID_id_mod_attribute_cert 280 -#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L - -#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" -#define NID_id_mod_timestamp_protocol 281 -#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L - -#define SN_id_mod_ocsp "id-mod-ocsp" -#define NID_id_mod_ocsp 282 -#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L - -#define SN_id_mod_dvcs "id-mod-dvcs" -#define NID_id_mod_dvcs 283 -#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L - -#define SN_id_mod_cmp2000 "id-mod-cmp2000" -#define NID_id_mod_cmp2000 284 -#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L - -#define SN_info_access "authorityInfoAccess" -#define LN_info_access "Authority Information Access" -#define NID_info_access 177 -#define OBJ_info_access OBJ_id_pe,1L - -#define SN_biometricInfo "biometricInfo" -#define LN_biometricInfo "Biometric Info" -#define NID_biometricInfo 285 -#define OBJ_biometricInfo OBJ_id_pe,2L - -#define SN_qcStatements "qcStatements" -#define NID_qcStatements 286 -#define OBJ_qcStatements OBJ_id_pe,3L - -#define SN_ac_auditEntity "ac-auditEntity" -#define NID_ac_auditEntity 287 -#define OBJ_ac_auditEntity OBJ_id_pe,4L - -#define SN_ac_targeting "ac-targeting" -#define NID_ac_targeting 288 -#define OBJ_ac_targeting OBJ_id_pe,5L - -#define SN_aaControls "aaControls" -#define NID_aaControls 289 -#define OBJ_aaControls OBJ_id_pe,6L - -#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" -#define NID_sbgp_ipAddrBlock 290 -#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L - -#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" -#define NID_sbgp_autonomousSysNum 291 -#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L - -#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" -#define NID_sbgp_routerIdentifier 292 -#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L - -#define SN_ac_proxying "ac-proxying" -#define NID_ac_proxying 397 -#define OBJ_ac_proxying OBJ_id_pe,10L - -#define SN_sinfo_access "subjectInfoAccess" -#define LN_sinfo_access "Subject Information Access" -#define NID_sinfo_access 398 -#define OBJ_sinfo_access OBJ_id_pe,11L - -#define SN_proxyCertInfo "proxyCertInfo" -#define LN_proxyCertInfo "Proxy Certificate Information" -#define NID_proxyCertInfo 663 -#define OBJ_proxyCertInfo OBJ_id_pe,14L - -#define SN_tlsfeature "tlsfeature" -#define LN_tlsfeature "TLS Feature" -#define NID_tlsfeature 1020 -#define OBJ_tlsfeature OBJ_id_pe,24L - -#define SN_id_qt_cps "id-qt-cps" -#define LN_id_qt_cps "Policy Qualifier CPS" -#define NID_id_qt_cps 164 -#define OBJ_id_qt_cps OBJ_id_qt,1L - -#define SN_id_qt_unotice "id-qt-unotice" -#define LN_id_qt_unotice "Policy Qualifier User Notice" -#define NID_id_qt_unotice 165 -#define OBJ_id_qt_unotice OBJ_id_qt,2L - -#define SN_textNotice "textNotice" -#define NID_textNotice 293 -#define OBJ_textNotice OBJ_id_qt,3L - -#define SN_server_auth "serverAuth" -#define LN_server_auth "TLS Web Server Authentication" -#define NID_server_auth 129 -#define OBJ_server_auth OBJ_id_kp,1L - -#define SN_client_auth "clientAuth" -#define LN_client_auth "TLS Web Client Authentication" -#define NID_client_auth 130 -#define OBJ_client_auth OBJ_id_kp,2L - -#define SN_code_sign "codeSigning" -#define LN_code_sign "Code Signing" -#define NID_code_sign 131 -#define OBJ_code_sign OBJ_id_kp,3L - -#define SN_email_protect "emailProtection" -#define LN_email_protect "E-mail Protection" -#define NID_email_protect 132 -#define OBJ_email_protect OBJ_id_kp,4L - -#define SN_ipsecEndSystem "ipsecEndSystem" -#define LN_ipsecEndSystem "IPSec End System" -#define NID_ipsecEndSystem 294 -#define OBJ_ipsecEndSystem OBJ_id_kp,5L - -#define SN_ipsecTunnel "ipsecTunnel" -#define LN_ipsecTunnel "IPSec Tunnel" -#define NID_ipsecTunnel 295 -#define OBJ_ipsecTunnel OBJ_id_kp,6L - -#define SN_ipsecUser "ipsecUser" -#define LN_ipsecUser "IPSec User" -#define NID_ipsecUser 296 -#define OBJ_ipsecUser OBJ_id_kp,7L - -#define SN_time_stamp "timeStamping" -#define LN_time_stamp "Time Stamping" -#define NID_time_stamp 133 -#define OBJ_time_stamp OBJ_id_kp,8L - -#define SN_OCSP_sign "OCSPSigning" -#define LN_OCSP_sign "OCSP Signing" -#define NID_OCSP_sign 180 -#define OBJ_OCSP_sign OBJ_id_kp,9L - -#define SN_dvcs "DVCS" -#define LN_dvcs "dvcs" -#define NID_dvcs 297 -#define OBJ_dvcs OBJ_id_kp,10L - -#define SN_ipsec_IKE "ipsecIKE" -#define LN_ipsec_IKE "ipsec Internet Key Exchange" -#define NID_ipsec_IKE 1022 -#define OBJ_ipsec_IKE OBJ_id_kp,17L - -#define SN_capwapAC "capwapAC" -#define LN_capwapAC "Ctrl/provision WAP Access" -#define NID_capwapAC 1023 -#define OBJ_capwapAC OBJ_id_kp,18L - -#define SN_capwapWTP "capwapWTP" -#define LN_capwapWTP "Ctrl/Provision WAP Termination" -#define NID_capwapWTP 1024 -#define OBJ_capwapWTP OBJ_id_kp,19L - -#define SN_sshClient "secureShellClient" -#define LN_sshClient "SSH Client" -#define NID_sshClient 1025 -#define OBJ_sshClient OBJ_id_kp,21L - -#define SN_sshServer "secureShellServer" -#define LN_sshServer "SSH Server" -#define NID_sshServer 1026 -#define OBJ_sshServer OBJ_id_kp,22L - -#define SN_sendRouter "sendRouter" -#define LN_sendRouter "Send Router" -#define NID_sendRouter 1027 -#define OBJ_sendRouter OBJ_id_kp,23L - -#define SN_sendProxiedRouter "sendProxiedRouter" -#define LN_sendProxiedRouter "Send Proxied Router" -#define NID_sendProxiedRouter 1028 -#define OBJ_sendProxiedRouter OBJ_id_kp,24L - -#define SN_sendOwner "sendOwner" -#define LN_sendOwner "Send Owner" -#define NID_sendOwner 1029 -#define OBJ_sendOwner OBJ_id_kp,25L - -#define SN_sendProxiedOwner "sendProxiedOwner" -#define LN_sendProxiedOwner "Send Proxied Owner" -#define NID_sendProxiedOwner 1030 -#define OBJ_sendProxiedOwner OBJ_id_kp,26L - -#define SN_cmcCA "cmcCA" -#define LN_cmcCA "CMC Certificate Authority" -#define NID_cmcCA 1131 -#define OBJ_cmcCA OBJ_id_kp,27L - -#define SN_cmcRA "cmcRA" -#define LN_cmcRA "CMC Registration Authority" -#define NID_cmcRA 1132 -#define OBJ_cmcRA OBJ_id_kp,28L - -#define SN_id_it_caProtEncCert "id-it-caProtEncCert" -#define NID_id_it_caProtEncCert 298 -#define OBJ_id_it_caProtEncCert OBJ_id_it,1L - -#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" -#define NID_id_it_signKeyPairTypes 299 -#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L - -#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" -#define NID_id_it_encKeyPairTypes 300 -#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L - -#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" -#define NID_id_it_preferredSymmAlg 301 -#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L - -#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" -#define NID_id_it_caKeyUpdateInfo 302 -#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L - -#define SN_id_it_currentCRL "id-it-currentCRL" -#define NID_id_it_currentCRL 303 -#define OBJ_id_it_currentCRL OBJ_id_it,6L - -#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" -#define NID_id_it_unsupportedOIDs 304 -#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L - -#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" -#define NID_id_it_subscriptionRequest 305 -#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L - -#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" -#define NID_id_it_subscriptionResponse 306 -#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L - -#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" -#define NID_id_it_keyPairParamReq 307 -#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L - -#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" -#define NID_id_it_keyPairParamRep 308 -#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L - -#define SN_id_it_revPassphrase "id-it-revPassphrase" -#define NID_id_it_revPassphrase 309 -#define OBJ_id_it_revPassphrase OBJ_id_it,12L - -#define SN_id_it_implicitConfirm "id-it-implicitConfirm" -#define NID_id_it_implicitConfirm 310 -#define OBJ_id_it_implicitConfirm OBJ_id_it,13L - -#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" -#define NID_id_it_confirmWaitTime 311 -#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L - -#define SN_id_it_origPKIMessage "id-it-origPKIMessage" -#define NID_id_it_origPKIMessage 312 -#define OBJ_id_it_origPKIMessage OBJ_id_it,15L - -#define SN_id_it_suppLangTags "id-it-suppLangTags" -#define NID_id_it_suppLangTags 784 -#define OBJ_id_it_suppLangTags OBJ_id_it,16L - -#define SN_id_regCtrl "id-regCtrl" -#define NID_id_regCtrl 313 -#define OBJ_id_regCtrl OBJ_id_pkip,1L - -#define SN_id_regInfo "id-regInfo" -#define NID_id_regInfo 314 -#define OBJ_id_regInfo OBJ_id_pkip,2L - -#define SN_id_regCtrl_regToken "id-regCtrl-regToken" -#define NID_id_regCtrl_regToken 315 -#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L - -#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" -#define NID_id_regCtrl_authenticator 316 -#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L - -#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" -#define NID_id_regCtrl_pkiPublicationInfo 317 -#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L - -#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" -#define NID_id_regCtrl_pkiArchiveOptions 318 -#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L - -#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" -#define NID_id_regCtrl_oldCertID 319 -#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L - -#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" -#define NID_id_regCtrl_protocolEncrKey 320 -#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L - -#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" -#define NID_id_regInfo_utf8Pairs 321 -#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L - -#define SN_id_regInfo_certReq "id-regInfo-certReq" -#define NID_id_regInfo_certReq 322 -#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L - -#define SN_id_alg_des40 "id-alg-des40" -#define NID_id_alg_des40 323 -#define OBJ_id_alg_des40 OBJ_id_alg,1L - -#define SN_id_alg_noSignature "id-alg-noSignature" -#define NID_id_alg_noSignature 324 -#define OBJ_id_alg_noSignature OBJ_id_alg,2L - -#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" -#define NID_id_alg_dh_sig_hmac_sha1 325 -#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L - -#define SN_id_alg_dh_pop "id-alg-dh-pop" -#define NID_id_alg_dh_pop 326 -#define OBJ_id_alg_dh_pop OBJ_id_alg,4L - -#define SN_id_cmc_statusInfo "id-cmc-statusInfo" -#define NID_id_cmc_statusInfo 327 -#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L - -#define SN_id_cmc_identification "id-cmc-identification" -#define NID_id_cmc_identification 328 -#define OBJ_id_cmc_identification OBJ_id_cmc,2L - -#define SN_id_cmc_identityProof "id-cmc-identityProof" -#define NID_id_cmc_identityProof 329 -#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L - -#define SN_id_cmc_dataReturn "id-cmc-dataReturn" -#define NID_id_cmc_dataReturn 330 -#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L - -#define SN_id_cmc_transactionId "id-cmc-transactionId" -#define NID_id_cmc_transactionId 331 -#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L - -#define SN_id_cmc_senderNonce "id-cmc-senderNonce" -#define NID_id_cmc_senderNonce 332 -#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L - -#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" -#define NID_id_cmc_recipientNonce 333 -#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L - -#define SN_id_cmc_addExtensions "id-cmc-addExtensions" -#define NID_id_cmc_addExtensions 334 -#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L - -#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" -#define NID_id_cmc_encryptedPOP 335 -#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L - -#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" -#define NID_id_cmc_decryptedPOP 336 -#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L - -#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" -#define NID_id_cmc_lraPOPWitness 337 -#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L - -#define SN_id_cmc_getCert "id-cmc-getCert" -#define NID_id_cmc_getCert 338 -#define OBJ_id_cmc_getCert OBJ_id_cmc,15L - -#define SN_id_cmc_getCRL "id-cmc-getCRL" -#define NID_id_cmc_getCRL 339 -#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L - -#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" -#define NID_id_cmc_revokeRequest 340 -#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L - -#define SN_id_cmc_regInfo "id-cmc-regInfo" -#define NID_id_cmc_regInfo 341 -#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L - -#define SN_id_cmc_responseInfo "id-cmc-responseInfo" -#define NID_id_cmc_responseInfo 342 -#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L - -#define SN_id_cmc_queryPending "id-cmc-queryPending" -#define NID_id_cmc_queryPending 343 -#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L - -#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" -#define NID_id_cmc_popLinkRandom 344 -#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L - -#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" -#define NID_id_cmc_popLinkWitness 345 -#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L - -#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" -#define NID_id_cmc_confirmCertAcceptance 346 -#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L - -#define SN_id_on_personalData "id-on-personalData" -#define NID_id_on_personalData 347 -#define OBJ_id_on_personalData OBJ_id_on,1L - -#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" -#define LN_id_on_permanentIdentifier "Permanent Identifier" -#define NID_id_on_permanentIdentifier 858 -#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L - -#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" -#define NID_id_pda_dateOfBirth 348 -#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L - -#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" -#define NID_id_pda_placeOfBirth 349 -#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L - -#define SN_id_pda_gender "id-pda-gender" -#define NID_id_pda_gender 351 -#define OBJ_id_pda_gender OBJ_id_pda,3L - -#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" -#define NID_id_pda_countryOfCitizenship 352 -#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L - -#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" -#define NID_id_pda_countryOfResidence 353 -#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L - -#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" -#define NID_id_aca_authenticationInfo 354 -#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L - -#define SN_id_aca_accessIdentity "id-aca-accessIdentity" -#define NID_id_aca_accessIdentity 355 -#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L - -#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" -#define NID_id_aca_chargingIdentity 356 -#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L - -#define SN_id_aca_group "id-aca-group" -#define NID_id_aca_group 357 -#define OBJ_id_aca_group OBJ_id_aca,4L - -#define SN_id_aca_role "id-aca-role" -#define NID_id_aca_role 358 -#define OBJ_id_aca_role OBJ_id_aca,5L - -#define SN_id_aca_encAttrs "id-aca-encAttrs" -#define NID_id_aca_encAttrs 399 -#define OBJ_id_aca_encAttrs OBJ_id_aca,6L - -#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" -#define NID_id_qcs_pkixQCSyntax_v1 359 -#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L - -#define SN_id_cct_crs "id-cct-crs" -#define NID_id_cct_crs 360 -#define OBJ_id_cct_crs OBJ_id_cct,1L - -#define SN_id_cct_PKIData "id-cct-PKIData" -#define NID_id_cct_PKIData 361 -#define OBJ_id_cct_PKIData OBJ_id_cct,2L - -#define SN_id_cct_PKIResponse "id-cct-PKIResponse" -#define NID_id_cct_PKIResponse 362 -#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L - -#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" -#define LN_id_ppl_anyLanguage "Any language" -#define NID_id_ppl_anyLanguage 664 -#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L - -#define SN_id_ppl_inheritAll "id-ppl-inheritAll" -#define LN_id_ppl_inheritAll "Inherit all" -#define NID_id_ppl_inheritAll 665 -#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L - -#define SN_Independent "id-ppl-independent" -#define LN_Independent "Independent" -#define NID_Independent 667 -#define OBJ_Independent OBJ_id_ppl,2L - -#define SN_ad_OCSP "OCSP" -#define LN_ad_OCSP "OCSP" -#define NID_ad_OCSP 178 -#define OBJ_ad_OCSP OBJ_id_ad,1L - -#define SN_ad_ca_issuers "caIssuers" -#define LN_ad_ca_issuers "CA Issuers" -#define NID_ad_ca_issuers 179 -#define OBJ_ad_ca_issuers OBJ_id_ad,2L - -#define SN_ad_timeStamping "ad_timestamping" -#define LN_ad_timeStamping "AD Time Stamping" -#define NID_ad_timeStamping 363 -#define OBJ_ad_timeStamping OBJ_id_ad,3L - -#define SN_ad_dvcs "AD_DVCS" -#define LN_ad_dvcs "ad dvcs" -#define NID_ad_dvcs 364 -#define OBJ_ad_dvcs OBJ_id_ad,4L - -#define SN_caRepository "caRepository" -#define LN_caRepository "CA Repository" -#define NID_caRepository 785 -#define OBJ_caRepository OBJ_id_ad,5L - -#define OBJ_id_pkix_OCSP OBJ_ad_OCSP - -#define SN_id_pkix_OCSP_basic "basicOCSPResponse" -#define LN_id_pkix_OCSP_basic "Basic OCSP Response" -#define NID_id_pkix_OCSP_basic 365 -#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L - -#define SN_id_pkix_OCSP_Nonce "Nonce" -#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" -#define NID_id_pkix_OCSP_Nonce 366 -#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L - -#define SN_id_pkix_OCSP_CrlID "CrlID" -#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" -#define NID_id_pkix_OCSP_CrlID 367 -#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L - -#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" -#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" -#define NID_id_pkix_OCSP_acceptableResponses 368 -#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L - -#define SN_id_pkix_OCSP_noCheck "noCheck" -#define LN_id_pkix_OCSP_noCheck "OCSP No Check" -#define NID_id_pkix_OCSP_noCheck 369 -#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L - -#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" -#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" -#define NID_id_pkix_OCSP_archiveCutoff 370 -#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L - -#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" -#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" -#define NID_id_pkix_OCSP_serviceLocator 371 -#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L - -#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" -#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" -#define NID_id_pkix_OCSP_extendedStatus 372 -#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L - -#define SN_id_pkix_OCSP_valid "valid" -#define NID_id_pkix_OCSP_valid 373 -#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L - -#define SN_id_pkix_OCSP_path "path" -#define NID_id_pkix_OCSP_path 374 -#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L - -#define SN_id_pkix_OCSP_trustRoot "trustRoot" -#define LN_id_pkix_OCSP_trustRoot "Trust Root" -#define NID_id_pkix_OCSP_trustRoot 375 -#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L - -#define SN_algorithm "algorithm" -#define LN_algorithm "algorithm" -#define NID_algorithm 376 -#define OBJ_algorithm 1L,3L,14L,3L,2L - -#define SN_md5WithRSA "RSA-NP-MD5" -#define LN_md5WithRSA "md5WithRSA" -#define NID_md5WithRSA 104 -#define OBJ_md5WithRSA OBJ_algorithm,3L - -#define SN_des_ecb "DES-ECB" -#define LN_des_ecb "des-ecb" -#define NID_des_ecb 29 -#define OBJ_des_ecb OBJ_algorithm,6L - -#define SN_des_cbc "DES-CBC" -#define LN_des_cbc "des-cbc" -#define NID_des_cbc 31 -#define OBJ_des_cbc OBJ_algorithm,7L - -#define SN_des_ofb64 "DES-OFB" -#define LN_des_ofb64 "des-ofb" -#define NID_des_ofb64 45 -#define OBJ_des_ofb64 OBJ_algorithm,8L - -#define SN_des_cfb64 "DES-CFB" -#define LN_des_cfb64 "des-cfb" -#define NID_des_cfb64 30 -#define OBJ_des_cfb64 OBJ_algorithm,9L - -#define SN_rsaSignature "rsaSignature" -#define NID_rsaSignature 377 -#define OBJ_rsaSignature OBJ_algorithm,11L - -#define SN_dsa_2 "DSA-old" -#define LN_dsa_2 "dsaEncryption-old" -#define NID_dsa_2 67 -#define OBJ_dsa_2 OBJ_algorithm,12L - -#define SN_dsaWithSHA "DSA-SHA" -#define LN_dsaWithSHA "dsaWithSHA" -#define NID_dsaWithSHA 66 -#define OBJ_dsaWithSHA OBJ_algorithm,13L - -#define SN_shaWithRSAEncryption "RSA-SHA" -#define LN_shaWithRSAEncryption "shaWithRSAEncryption" -#define NID_shaWithRSAEncryption 42 -#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L - -#define SN_des_ede_ecb "DES-EDE" -#define LN_des_ede_ecb "des-ede" -#define NID_des_ede_ecb 32 -#define OBJ_des_ede_ecb OBJ_algorithm,17L - -#define SN_des_ede3_ecb "DES-EDE3" -#define LN_des_ede3_ecb "des-ede3" -#define NID_des_ede3_ecb 33 - -#define SN_des_ede_cbc "DES-EDE-CBC" -#define LN_des_ede_cbc "des-ede-cbc" -#define NID_des_ede_cbc 43 - -#define SN_des_ede_cfb64 "DES-EDE-CFB" -#define LN_des_ede_cfb64 "des-ede-cfb" -#define NID_des_ede_cfb64 60 - -#define SN_des_ede3_cfb64 "DES-EDE3-CFB" -#define LN_des_ede3_cfb64 "des-ede3-cfb" -#define NID_des_ede3_cfb64 61 - -#define SN_des_ede_ofb64 "DES-EDE-OFB" -#define LN_des_ede_ofb64 "des-ede-ofb" -#define NID_des_ede_ofb64 62 - -#define SN_des_ede3_ofb64 "DES-EDE3-OFB" -#define LN_des_ede3_ofb64 "des-ede3-ofb" -#define NID_des_ede3_ofb64 63 - -#define SN_desx_cbc "DESX-CBC" -#define LN_desx_cbc "desx-cbc" -#define NID_desx_cbc 80 - -#define SN_sha "SHA" -#define LN_sha "sha" -#define NID_sha 41 -#define OBJ_sha OBJ_algorithm,18L - -#define SN_sha1 "SHA1" -#define LN_sha1 "sha1" -#define NID_sha1 64 -#define OBJ_sha1 OBJ_algorithm,26L - -#define SN_dsaWithSHA1_2 "DSA-SHA1-old" -#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" -#define NID_dsaWithSHA1_2 70 -#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L - -#define SN_sha1WithRSA "RSA-SHA1-2" -#define LN_sha1WithRSA "sha1WithRSA" -#define NID_sha1WithRSA 115 -#define OBJ_sha1WithRSA OBJ_algorithm,29L - -#define SN_ripemd160 "RIPEMD160" -#define LN_ripemd160 "ripemd160" -#define NID_ripemd160 117 -#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L - -#define SN_ripemd160WithRSA "RSA-RIPEMD160" -#define LN_ripemd160WithRSA "ripemd160WithRSA" -#define NID_ripemd160WithRSA 119 -#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L - -#define SN_blake2b512 "BLAKE2b512" -#define LN_blake2b512 "blake2b512" -#define NID_blake2b512 1056 -#define OBJ_blake2b512 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L,16L - -#define SN_blake2s256 "BLAKE2s256" -#define LN_blake2s256 "blake2s256" -#define NID_blake2s256 1057 -#define OBJ_blake2s256 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L,8L - -#define SN_sxnet "SXNetID" -#define LN_sxnet "Strong Extranet ID" -#define NID_sxnet 143 -#define OBJ_sxnet 1L,3L,101L,1L,4L,1L - -#define SN_X500 "X500" -#define LN_X500 "directory services (X.500)" -#define NID_X500 11 -#define OBJ_X500 2L,5L - -#define SN_X509 "X509" -#define NID_X509 12 -#define OBJ_X509 OBJ_X500,4L - -#define SN_commonName "CN" -#define LN_commonName "commonName" -#define NID_commonName 13 -#define OBJ_commonName OBJ_X509,3L - -#define SN_surname "SN" -#define LN_surname "surname" -#define NID_surname 100 -#define OBJ_surname OBJ_X509,4L - -#define LN_serialNumber "serialNumber" -#define NID_serialNumber 105 -#define OBJ_serialNumber OBJ_X509,5L - -#define SN_countryName "C" -#define LN_countryName "countryName" -#define NID_countryName 14 -#define OBJ_countryName OBJ_X509,6L - -#define SN_localityName "L" -#define LN_localityName "localityName" -#define NID_localityName 15 -#define OBJ_localityName OBJ_X509,7L - -#define SN_stateOrProvinceName "ST" -#define LN_stateOrProvinceName "stateOrProvinceName" -#define NID_stateOrProvinceName 16 -#define OBJ_stateOrProvinceName OBJ_X509,8L - -#define SN_streetAddress "street" -#define LN_streetAddress "streetAddress" -#define NID_streetAddress 660 -#define OBJ_streetAddress OBJ_X509,9L - -#define SN_organizationName "O" -#define LN_organizationName "organizationName" -#define NID_organizationName 17 -#define OBJ_organizationName OBJ_X509,10L - -#define SN_organizationalUnitName "OU" -#define LN_organizationalUnitName "organizationalUnitName" -#define NID_organizationalUnitName 18 -#define OBJ_organizationalUnitName OBJ_X509,11L - -#define SN_title "title" -#define LN_title "title" -#define NID_title 106 -#define OBJ_title OBJ_X509,12L - -#define LN_description "description" -#define NID_description 107 -#define OBJ_description OBJ_X509,13L - -#define LN_searchGuide "searchGuide" -#define NID_searchGuide 859 -#define OBJ_searchGuide OBJ_X509,14L - -#define LN_businessCategory "businessCategory" -#define NID_businessCategory 860 -#define OBJ_businessCategory OBJ_X509,15L - -#define LN_postalAddress "postalAddress" -#define NID_postalAddress 861 -#define OBJ_postalAddress OBJ_X509,16L - -#define LN_postalCode "postalCode" -#define NID_postalCode 661 -#define OBJ_postalCode OBJ_X509,17L - -#define LN_postOfficeBox "postOfficeBox" -#define NID_postOfficeBox 862 -#define OBJ_postOfficeBox OBJ_X509,18L - -#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" -#define NID_physicalDeliveryOfficeName 863 -#define OBJ_physicalDeliveryOfficeName OBJ_X509,19L - -#define LN_telephoneNumber "telephoneNumber" -#define NID_telephoneNumber 864 -#define OBJ_telephoneNumber OBJ_X509,20L - -#define LN_telexNumber "telexNumber" -#define NID_telexNumber 865 -#define OBJ_telexNumber OBJ_X509,21L - -#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" -#define NID_teletexTerminalIdentifier 866 -#define OBJ_teletexTerminalIdentifier OBJ_X509,22L - -#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" -#define NID_facsimileTelephoneNumber 867 -#define OBJ_facsimileTelephoneNumber OBJ_X509,23L - -#define LN_x121Address "x121Address" -#define NID_x121Address 868 -#define OBJ_x121Address OBJ_X509,24L - -#define LN_internationaliSDNNumber "internationaliSDNNumber" -#define NID_internationaliSDNNumber 869 -#define OBJ_internationaliSDNNumber OBJ_X509,25L - -#define LN_registeredAddress "registeredAddress" -#define NID_registeredAddress 870 -#define OBJ_registeredAddress OBJ_X509,26L - -#define LN_destinationIndicator "destinationIndicator" -#define NID_destinationIndicator 871 -#define OBJ_destinationIndicator OBJ_X509,27L - -#define LN_preferredDeliveryMethod "preferredDeliveryMethod" -#define NID_preferredDeliveryMethod 872 -#define OBJ_preferredDeliveryMethod OBJ_X509,28L - -#define LN_presentationAddress "presentationAddress" -#define NID_presentationAddress 873 -#define OBJ_presentationAddress OBJ_X509,29L - -#define LN_supportedApplicationContext "supportedApplicationContext" -#define NID_supportedApplicationContext 874 -#define OBJ_supportedApplicationContext OBJ_X509,30L - -#define SN_member "member" -#define NID_member 875 -#define OBJ_member OBJ_X509,31L - -#define SN_owner "owner" -#define NID_owner 876 -#define OBJ_owner OBJ_X509,32L - -#define LN_roleOccupant "roleOccupant" -#define NID_roleOccupant 877 -#define OBJ_roleOccupant OBJ_X509,33L - -#define SN_seeAlso "seeAlso" -#define NID_seeAlso 878 -#define OBJ_seeAlso OBJ_X509,34L - -#define LN_userPassword "userPassword" -#define NID_userPassword 879 -#define OBJ_userPassword OBJ_X509,35L - -#define LN_userCertificate "userCertificate" -#define NID_userCertificate 880 -#define OBJ_userCertificate OBJ_X509,36L - -#define LN_cACertificate "cACertificate" -#define NID_cACertificate 881 -#define OBJ_cACertificate OBJ_X509,37L - -#define LN_authorityRevocationList "authorityRevocationList" -#define NID_authorityRevocationList 882 -#define OBJ_authorityRevocationList OBJ_X509,38L - -#define LN_certificateRevocationList "certificateRevocationList" -#define NID_certificateRevocationList 883 -#define OBJ_certificateRevocationList OBJ_X509,39L - -#define LN_crossCertificatePair "crossCertificatePair" -#define NID_crossCertificatePair 884 -#define OBJ_crossCertificatePair OBJ_X509,40L - -#define SN_name "name" -#define LN_name "name" -#define NID_name 173 -#define OBJ_name OBJ_X509,41L - -#define SN_givenName "GN" -#define LN_givenName "givenName" -#define NID_givenName 99 -#define OBJ_givenName OBJ_X509,42L - -#define SN_initials "initials" -#define LN_initials "initials" -#define NID_initials 101 -#define OBJ_initials OBJ_X509,43L - -#define LN_generationQualifier "generationQualifier" -#define NID_generationQualifier 509 -#define OBJ_generationQualifier OBJ_X509,44L - -#define LN_x500UniqueIdentifier "x500UniqueIdentifier" -#define NID_x500UniqueIdentifier 503 -#define OBJ_x500UniqueIdentifier OBJ_X509,45L - -#define SN_dnQualifier "dnQualifier" -#define LN_dnQualifier "dnQualifier" -#define NID_dnQualifier 174 -#define OBJ_dnQualifier OBJ_X509,46L - -#define LN_enhancedSearchGuide "enhancedSearchGuide" -#define NID_enhancedSearchGuide 885 -#define OBJ_enhancedSearchGuide OBJ_X509,47L - -#define LN_protocolInformation "protocolInformation" -#define NID_protocolInformation 886 -#define OBJ_protocolInformation OBJ_X509,48L - -#define LN_distinguishedName "distinguishedName" -#define NID_distinguishedName 887 -#define OBJ_distinguishedName OBJ_X509,49L - -#define LN_uniqueMember "uniqueMember" -#define NID_uniqueMember 888 -#define OBJ_uniqueMember OBJ_X509,50L - -#define LN_houseIdentifier "houseIdentifier" -#define NID_houseIdentifier 889 -#define OBJ_houseIdentifier OBJ_X509,51L - -#define LN_supportedAlgorithms "supportedAlgorithms" -#define NID_supportedAlgorithms 890 -#define OBJ_supportedAlgorithms OBJ_X509,52L - -#define LN_deltaRevocationList "deltaRevocationList" -#define NID_deltaRevocationList 891 -#define OBJ_deltaRevocationList OBJ_X509,53L - -#define SN_dmdName "dmdName" -#define NID_dmdName 892 -#define OBJ_dmdName OBJ_X509,54L - -#define LN_pseudonym "pseudonym" -#define NID_pseudonym 510 -#define OBJ_pseudonym OBJ_X509,65L - -#define SN_role "role" -#define LN_role "role" -#define NID_role 400 -#define OBJ_role OBJ_X509,72L - -#define LN_organizationIdentifier "organizationIdentifier" -#define NID_organizationIdentifier 1089 -#define OBJ_organizationIdentifier OBJ_X509,97L - -#define SN_countryCode3c "c3" -#define LN_countryCode3c "countryCode3c" -#define NID_countryCode3c 1090 -#define OBJ_countryCode3c OBJ_X509,98L - -#define SN_countryCode3n "n3" -#define LN_countryCode3n "countryCode3n" -#define NID_countryCode3n 1091 -#define OBJ_countryCode3n OBJ_X509,99L - -#define LN_dnsName "dnsName" -#define NID_dnsName 1092 -#define OBJ_dnsName OBJ_X509,100L - -#define SN_X500algorithms "X500algorithms" -#define LN_X500algorithms "directory services - algorithms" -#define NID_X500algorithms 378 -#define OBJ_X500algorithms OBJ_X500,8L - -#define SN_rsa "RSA" -#define LN_rsa "rsa" -#define NID_rsa 19 -#define OBJ_rsa OBJ_X500algorithms,1L,1L - -#define SN_mdc2WithRSA "RSA-MDC2" -#define LN_mdc2WithRSA "mdc2WithRSA" -#define NID_mdc2WithRSA 96 -#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L - -#define SN_mdc2 "MDC2" -#define LN_mdc2 "mdc2" -#define NID_mdc2 95 -#define OBJ_mdc2 OBJ_X500algorithms,3L,101L - -#define SN_id_ce "id-ce" -#define NID_id_ce 81 -#define OBJ_id_ce OBJ_X500,29L - -#define SN_subject_directory_attributes "subjectDirectoryAttributes" -#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" -#define NID_subject_directory_attributes 769 -#define OBJ_subject_directory_attributes OBJ_id_ce,9L - -#define SN_subject_key_identifier "subjectKeyIdentifier" -#define LN_subject_key_identifier "X509v3 Subject Key Identifier" -#define NID_subject_key_identifier 82 -#define OBJ_subject_key_identifier OBJ_id_ce,14L - -#define SN_key_usage "keyUsage" -#define LN_key_usage "X509v3 Key Usage" -#define NID_key_usage 83 -#define OBJ_key_usage OBJ_id_ce,15L - -#define SN_private_key_usage_period "privateKeyUsagePeriod" -#define LN_private_key_usage_period "X509v3 Private Key Usage Period" -#define NID_private_key_usage_period 84 -#define OBJ_private_key_usage_period OBJ_id_ce,16L - -#define SN_subject_alt_name "subjectAltName" -#define LN_subject_alt_name "X509v3 Subject Alternative Name" -#define NID_subject_alt_name 85 -#define OBJ_subject_alt_name OBJ_id_ce,17L - -#define SN_issuer_alt_name "issuerAltName" -#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" -#define NID_issuer_alt_name 86 -#define OBJ_issuer_alt_name OBJ_id_ce,18L - -#define SN_basic_constraints "basicConstraints" -#define LN_basic_constraints "X509v3 Basic Constraints" -#define NID_basic_constraints 87 -#define OBJ_basic_constraints OBJ_id_ce,19L - -#define SN_crl_number "crlNumber" -#define LN_crl_number "X509v3 CRL Number" -#define NID_crl_number 88 -#define OBJ_crl_number OBJ_id_ce,20L - -#define SN_crl_reason "CRLReason" -#define LN_crl_reason "X509v3 CRL Reason Code" -#define NID_crl_reason 141 -#define OBJ_crl_reason OBJ_id_ce,21L - -#define SN_invalidity_date "invalidityDate" -#define LN_invalidity_date "Invalidity Date" -#define NID_invalidity_date 142 -#define OBJ_invalidity_date OBJ_id_ce,24L - -#define SN_delta_crl "deltaCRL" -#define LN_delta_crl "X509v3 Delta CRL Indicator" -#define NID_delta_crl 140 -#define OBJ_delta_crl OBJ_id_ce,27L - -#define SN_issuing_distribution_point "issuingDistributionPoint" -#define LN_issuing_distribution_point "X509v3 Issuing Distribution Point" -#define NID_issuing_distribution_point 770 -#define OBJ_issuing_distribution_point OBJ_id_ce,28L - -#define SN_certificate_issuer "certificateIssuer" -#define LN_certificate_issuer "X509v3 Certificate Issuer" -#define NID_certificate_issuer 771 -#define OBJ_certificate_issuer OBJ_id_ce,29L - -#define SN_name_constraints "nameConstraints" -#define LN_name_constraints "X509v3 Name Constraints" -#define NID_name_constraints 666 -#define OBJ_name_constraints OBJ_id_ce,30L - -#define SN_crl_distribution_points "crlDistributionPoints" -#define LN_crl_distribution_points "X509v3 CRL Distribution Points" -#define NID_crl_distribution_points 103 -#define OBJ_crl_distribution_points OBJ_id_ce,31L - -#define SN_certificate_policies "certificatePolicies" -#define LN_certificate_policies "X509v3 Certificate Policies" -#define NID_certificate_policies 89 -#define OBJ_certificate_policies OBJ_id_ce,32L - -#define SN_any_policy "anyPolicy" -#define LN_any_policy "X509v3 Any Policy" -#define NID_any_policy 746 -#define OBJ_any_policy OBJ_certificate_policies,0L - -#define SN_policy_mappings "policyMappings" -#define LN_policy_mappings "X509v3 Policy Mappings" -#define NID_policy_mappings 747 -#define OBJ_policy_mappings OBJ_id_ce,33L - -#define SN_authority_key_identifier "authorityKeyIdentifier" -#define LN_authority_key_identifier "X509v3 Authority Key Identifier" -#define NID_authority_key_identifier 90 -#define OBJ_authority_key_identifier OBJ_id_ce,35L - -#define SN_policy_constraints "policyConstraints" -#define LN_policy_constraints "X509v3 Policy Constraints" -#define NID_policy_constraints 401 -#define OBJ_policy_constraints OBJ_id_ce,36L - -#define SN_ext_key_usage "extendedKeyUsage" -#define LN_ext_key_usage "X509v3 Extended Key Usage" -#define NID_ext_key_usage 126 -#define OBJ_ext_key_usage OBJ_id_ce,37L - -#define SN_freshest_crl "freshestCRL" -#define LN_freshest_crl "X509v3 Freshest CRL" -#define NID_freshest_crl 857 -#define OBJ_freshest_crl OBJ_id_ce,46L - -#define SN_inhibit_any_policy "inhibitAnyPolicy" -#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" -#define NID_inhibit_any_policy 748 -#define OBJ_inhibit_any_policy OBJ_id_ce,54L - -#define SN_target_information "targetInformation" -#define LN_target_information "X509v3 AC Targeting" -#define NID_target_information 402 -#define OBJ_target_information OBJ_id_ce,55L - -#define SN_no_rev_avail "noRevAvail" -#define LN_no_rev_avail "X509v3 No Revocation Available" -#define NID_no_rev_avail 403 -#define OBJ_no_rev_avail OBJ_id_ce,56L - -#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" -#define LN_anyExtendedKeyUsage "Any Extended Key Usage" -#define NID_anyExtendedKeyUsage 910 -#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L - -#define SN_netscape "Netscape" -#define LN_netscape "Netscape Communications Corp." -#define NID_netscape 57 -#define OBJ_netscape 2L,16L,840L,1L,113730L - -#define SN_netscape_cert_extension "nsCertExt" -#define LN_netscape_cert_extension "Netscape Certificate Extension" -#define NID_netscape_cert_extension 58 -#define OBJ_netscape_cert_extension OBJ_netscape,1L - -#define SN_netscape_data_type "nsDataType" -#define LN_netscape_data_type "Netscape Data Type" -#define NID_netscape_data_type 59 -#define OBJ_netscape_data_type OBJ_netscape,2L - -#define SN_netscape_cert_type "nsCertType" -#define LN_netscape_cert_type "Netscape Cert Type" -#define NID_netscape_cert_type 71 -#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L - -#define SN_netscape_base_url "nsBaseUrl" -#define LN_netscape_base_url "Netscape Base Url" -#define NID_netscape_base_url 72 -#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L - -#define SN_netscape_revocation_url "nsRevocationUrl" -#define LN_netscape_revocation_url "Netscape Revocation Url" -#define NID_netscape_revocation_url 73 -#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L - -#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" -#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" -#define NID_netscape_ca_revocation_url 74 -#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L - -#define SN_netscape_renewal_url "nsRenewalUrl" -#define LN_netscape_renewal_url "Netscape Renewal Url" -#define NID_netscape_renewal_url 75 -#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L - -#define SN_netscape_ca_policy_url "nsCaPolicyUrl" -#define LN_netscape_ca_policy_url "Netscape CA Policy Url" -#define NID_netscape_ca_policy_url 76 -#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L - -#define SN_netscape_ssl_server_name "nsSslServerName" -#define LN_netscape_ssl_server_name "Netscape SSL Server Name" -#define NID_netscape_ssl_server_name 77 -#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L - -#define SN_netscape_comment "nsComment" -#define LN_netscape_comment "Netscape Comment" -#define NID_netscape_comment 78 -#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L - -#define SN_netscape_cert_sequence "nsCertSequence" -#define LN_netscape_cert_sequence "Netscape Certificate Sequence" -#define NID_netscape_cert_sequence 79 -#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L - -#define SN_ns_sgc "nsSGC" -#define LN_ns_sgc "Netscape Server Gated Crypto" -#define NID_ns_sgc 139 -#define OBJ_ns_sgc OBJ_netscape,4L,1L - -#define SN_org "ORG" -#define LN_org "org" -#define NID_org 379 -#define OBJ_org OBJ_iso,3L - -#define SN_dod "DOD" -#define LN_dod "dod" -#define NID_dod 380 -#define OBJ_dod OBJ_org,6L - -#define SN_iana "IANA" -#define LN_iana "iana" -#define NID_iana 381 -#define OBJ_iana OBJ_dod,1L - -#define OBJ_internet OBJ_iana - -#define SN_Directory "directory" -#define LN_Directory "Directory" -#define NID_Directory 382 -#define OBJ_Directory OBJ_internet,1L - -#define SN_Management "mgmt" -#define LN_Management "Management" -#define NID_Management 383 -#define OBJ_Management OBJ_internet,2L - -#define SN_Experimental "experimental" -#define LN_Experimental "Experimental" -#define NID_Experimental 384 -#define OBJ_Experimental OBJ_internet,3L - -#define SN_Private "private" -#define LN_Private "Private" -#define NID_Private 385 -#define OBJ_Private OBJ_internet,4L - -#define SN_Security "security" -#define LN_Security "Security" -#define NID_Security 386 -#define OBJ_Security OBJ_internet,5L - -#define SN_SNMPv2 "snmpv2" -#define LN_SNMPv2 "SNMPv2" -#define NID_SNMPv2 387 -#define OBJ_SNMPv2 OBJ_internet,6L - -#define LN_Mail "Mail" -#define NID_Mail 388 -#define OBJ_Mail OBJ_internet,7L - -#define SN_Enterprises "enterprises" -#define LN_Enterprises "Enterprises" -#define NID_Enterprises 389 -#define OBJ_Enterprises OBJ_Private,1L - -#define SN_dcObject "dcobject" -#define LN_dcObject "dcObject" -#define NID_dcObject 390 -#define OBJ_dcObject OBJ_Enterprises,1466L,344L - -#define SN_mime_mhs "mime-mhs" -#define LN_mime_mhs "MIME MHS" -#define NID_mime_mhs 504 -#define OBJ_mime_mhs OBJ_Mail,1L - -#define SN_mime_mhs_headings "mime-mhs-headings" -#define LN_mime_mhs_headings "mime-mhs-headings" -#define NID_mime_mhs_headings 505 -#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L - -#define SN_mime_mhs_bodies "mime-mhs-bodies" -#define LN_mime_mhs_bodies "mime-mhs-bodies" -#define NID_mime_mhs_bodies 506 -#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L - -#define SN_id_hex_partial_message "id-hex-partial-message" -#define LN_id_hex_partial_message "id-hex-partial-message" -#define NID_id_hex_partial_message 507 -#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L - -#define SN_id_hex_multipart_message "id-hex-multipart-message" -#define LN_id_hex_multipart_message "id-hex-multipart-message" -#define NID_id_hex_multipart_message 508 -#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L - -#define SN_zlib_compression "ZLIB" -#define LN_zlib_compression "zlib compression" -#define NID_zlib_compression 125 -#define OBJ_zlib_compression OBJ_id_smime_alg,8L - -#define OBJ_csor 2L,16L,840L,1L,101L,3L - -#define OBJ_nistAlgorithms OBJ_csor,4L - -#define OBJ_aes OBJ_nistAlgorithms,1L - -#define SN_aes_128_ecb "AES-128-ECB" -#define LN_aes_128_ecb "aes-128-ecb" -#define NID_aes_128_ecb 418 -#define OBJ_aes_128_ecb OBJ_aes,1L - -#define SN_aes_128_cbc "AES-128-CBC" -#define LN_aes_128_cbc "aes-128-cbc" -#define NID_aes_128_cbc 419 -#define OBJ_aes_128_cbc OBJ_aes,2L - -#define SN_aes_128_ofb128 "AES-128-OFB" -#define LN_aes_128_ofb128 "aes-128-ofb" -#define NID_aes_128_ofb128 420 -#define OBJ_aes_128_ofb128 OBJ_aes,3L - -#define SN_aes_128_cfb128 "AES-128-CFB" -#define LN_aes_128_cfb128 "aes-128-cfb" -#define NID_aes_128_cfb128 421 -#define OBJ_aes_128_cfb128 OBJ_aes,4L - -#define SN_id_aes128_wrap "id-aes128-wrap" -#define NID_id_aes128_wrap 788 -#define OBJ_id_aes128_wrap OBJ_aes,5L - -#define SN_aes_128_gcm "id-aes128-GCM" -#define LN_aes_128_gcm "aes-128-gcm" -#define NID_aes_128_gcm 895 -#define OBJ_aes_128_gcm OBJ_aes,6L - -#define SN_aes_128_ccm "id-aes128-CCM" -#define LN_aes_128_ccm "aes-128-ccm" -#define NID_aes_128_ccm 896 -#define OBJ_aes_128_ccm OBJ_aes,7L - -#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" -#define NID_id_aes128_wrap_pad 897 -#define OBJ_id_aes128_wrap_pad OBJ_aes,8L - -#define SN_aes_192_ecb "AES-192-ECB" -#define LN_aes_192_ecb "aes-192-ecb" -#define NID_aes_192_ecb 422 -#define OBJ_aes_192_ecb OBJ_aes,21L - -#define SN_aes_192_cbc "AES-192-CBC" -#define LN_aes_192_cbc "aes-192-cbc" -#define NID_aes_192_cbc 423 -#define OBJ_aes_192_cbc OBJ_aes,22L - -#define SN_aes_192_ofb128 "AES-192-OFB" -#define LN_aes_192_ofb128 "aes-192-ofb" -#define NID_aes_192_ofb128 424 -#define OBJ_aes_192_ofb128 OBJ_aes,23L - -#define SN_aes_192_cfb128 "AES-192-CFB" -#define LN_aes_192_cfb128 "aes-192-cfb" -#define NID_aes_192_cfb128 425 -#define OBJ_aes_192_cfb128 OBJ_aes,24L - -#define SN_id_aes192_wrap "id-aes192-wrap" -#define NID_id_aes192_wrap 789 -#define OBJ_id_aes192_wrap OBJ_aes,25L - -#define SN_aes_192_gcm "id-aes192-GCM" -#define LN_aes_192_gcm "aes-192-gcm" -#define NID_aes_192_gcm 898 -#define OBJ_aes_192_gcm OBJ_aes,26L - -#define SN_aes_192_ccm "id-aes192-CCM" -#define LN_aes_192_ccm "aes-192-ccm" -#define NID_aes_192_ccm 899 -#define OBJ_aes_192_ccm OBJ_aes,27L - -#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" -#define NID_id_aes192_wrap_pad 900 -#define OBJ_id_aes192_wrap_pad OBJ_aes,28L - -#define SN_aes_256_ecb "AES-256-ECB" -#define LN_aes_256_ecb "aes-256-ecb" -#define NID_aes_256_ecb 426 -#define OBJ_aes_256_ecb OBJ_aes,41L - -#define SN_aes_256_cbc "AES-256-CBC" -#define LN_aes_256_cbc "aes-256-cbc" -#define NID_aes_256_cbc 427 -#define OBJ_aes_256_cbc OBJ_aes,42L - -#define SN_aes_256_ofb128 "AES-256-OFB" -#define LN_aes_256_ofb128 "aes-256-ofb" -#define NID_aes_256_ofb128 428 -#define OBJ_aes_256_ofb128 OBJ_aes,43L - -#define SN_aes_256_cfb128 "AES-256-CFB" -#define LN_aes_256_cfb128 "aes-256-cfb" -#define NID_aes_256_cfb128 429 -#define OBJ_aes_256_cfb128 OBJ_aes,44L - -#define SN_id_aes256_wrap "id-aes256-wrap" -#define NID_id_aes256_wrap 790 -#define OBJ_id_aes256_wrap OBJ_aes,45L - -#define SN_aes_256_gcm "id-aes256-GCM" -#define LN_aes_256_gcm "aes-256-gcm" -#define NID_aes_256_gcm 901 -#define OBJ_aes_256_gcm OBJ_aes,46L - -#define SN_aes_256_ccm "id-aes256-CCM" -#define LN_aes_256_ccm "aes-256-ccm" -#define NID_aes_256_ccm 902 -#define OBJ_aes_256_ccm OBJ_aes,47L - -#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" -#define NID_id_aes256_wrap_pad 903 -#define OBJ_id_aes256_wrap_pad OBJ_aes,48L - -#define SN_aes_128_xts "AES-128-XTS" -#define LN_aes_128_xts "aes-128-xts" -#define NID_aes_128_xts 913 -#define OBJ_aes_128_xts OBJ_ieee_siswg,0L,1L,1L - -#define SN_aes_256_xts "AES-256-XTS" -#define LN_aes_256_xts "aes-256-xts" -#define NID_aes_256_xts 914 -#define OBJ_aes_256_xts OBJ_ieee_siswg,0L,1L,2L - -#define SN_aes_128_cfb1 "AES-128-CFB1" -#define LN_aes_128_cfb1 "aes-128-cfb1" -#define NID_aes_128_cfb1 650 - -#define SN_aes_192_cfb1 "AES-192-CFB1" -#define LN_aes_192_cfb1 "aes-192-cfb1" -#define NID_aes_192_cfb1 651 - -#define SN_aes_256_cfb1 "AES-256-CFB1" -#define LN_aes_256_cfb1 "aes-256-cfb1" -#define NID_aes_256_cfb1 652 - -#define SN_aes_128_cfb8 "AES-128-CFB8" -#define LN_aes_128_cfb8 "aes-128-cfb8" -#define NID_aes_128_cfb8 653 - -#define SN_aes_192_cfb8 "AES-192-CFB8" -#define LN_aes_192_cfb8 "aes-192-cfb8" -#define NID_aes_192_cfb8 654 - -#define SN_aes_256_cfb8 "AES-256-CFB8" -#define LN_aes_256_cfb8 "aes-256-cfb8" -#define NID_aes_256_cfb8 655 - -#define SN_aes_128_ctr "AES-128-CTR" -#define LN_aes_128_ctr "aes-128-ctr" -#define NID_aes_128_ctr 904 - -#define SN_aes_192_ctr "AES-192-CTR" -#define LN_aes_192_ctr "aes-192-ctr" -#define NID_aes_192_ctr 905 - -#define SN_aes_256_ctr "AES-256-CTR" -#define LN_aes_256_ctr "aes-256-ctr" -#define NID_aes_256_ctr 906 - -#define SN_aes_128_ocb "AES-128-OCB" -#define LN_aes_128_ocb "aes-128-ocb" -#define NID_aes_128_ocb 958 - -#define SN_aes_192_ocb "AES-192-OCB" -#define LN_aes_192_ocb "aes-192-ocb" -#define NID_aes_192_ocb 959 - -#define SN_aes_256_ocb "AES-256-OCB" -#define LN_aes_256_ocb "aes-256-ocb" -#define NID_aes_256_ocb 960 - -#define SN_des_cfb1 "DES-CFB1" -#define LN_des_cfb1 "des-cfb1" -#define NID_des_cfb1 656 - -#define SN_des_cfb8 "DES-CFB8" -#define LN_des_cfb8 "des-cfb8" -#define NID_des_cfb8 657 - -#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" -#define LN_des_ede3_cfb1 "des-ede3-cfb1" -#define NID_des_ede3_cfb1 658 - -#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" -#define LN_des_ede3_cfb8 "des-ede3-cfb8" -#define NID_des_ede3_cfb8 659 - -#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L - -#define SN_sha256 "SHA256" -#define LN_sha256 "sha256" -#define NID_sha256 672 -#define OBJ_sha256 OBJ_nist_hashalgs,1L - -#define SN_sha384 "SHA384" -#define LN_sha384 "sha384" -#define NID_sha384 673 -#define OBJ_sha384 OBJ_nist_hashalgs,2L - -#define SN_sha512 "SHA512" -#define LN_sha512 "sha512" -#define NID_sha512 674 -#define OBJ_sha512 OBJ_nist_hashalgs,3L - -#define SN_sha224 "SHA224" -#define LN_sha224 "sha224" -#define NID_sha224 675 -#define OBJ_sha224 OBJ_nist_hashalgs,4L - -#define SN_sha512_224 "SHA512-224" -#define LN_sha512_224 "sha512-224" -#define NID_sha512_224 1094 -#define OBJ_sha512_224 OBJ_nist_hashalgs,5L - -#define SN_sha512_256 "SHA512-256" -#define LN_sha512_256 "sha512-256" -#define NID_sha512_256 1095 -#define OBJ_sha512_256 OBJ_nist_hashalgs,6L - -#define SN_sha3_224 "SHA3-224" -#define LN_sha3_224 "sha3-224" -#define NID_sha3_224 1096 -#define OBJ_sha3_224 OBJ_nist_hashalgs,7L - -#define SN_sha3_256 "SHA3-256" -#define LN_sha3_256 "sha3-256" -#define NID_sha3_256 1097 -#define OBJ_sha3_256 OBJ_nist_hashalgs,8L - -#define SN_sha3_384 "SHA3-384" -#define LN_sha3_384 "sha3-384" -#define NID_sha3_384 1098 -#define OBJ_sha3_384 OBJ_nist_hashalgs,9L - -#define SN_sha3_512 "SHA3-512" -#define LN_sha3_512 "sha3-512" -#define NID_sha3_512 1099 -#define OBJ_sha3_512 OBJ_nist_hashalgs,10L - -#define SN_shake128 "SHAKE128" -#define LN_shake128 "shake128" -#define NID_shake128 1100 -#define OBJ_shake128 OBJ_nist_hashalgs,11L - -#define SN_shake256 "SHAKE256" -#define LN_shake256 "shake256" -#define NID_shake256 1101 -#define OBJ_shake256 OBJ_nist_hashalgs,12L - -#define SN_hmac_sha3_224 "id-hmacWithSHA3-224" -#define LN_hmac_sha3_224 "hmac-sha3-224" -#define NID_hmac_sha3_224 1102 -#define OBJ_hmac_sha3_224 OBJ_nist_hashalgs,13L - -#define SN_hmac_sha3_256 "id-hmacWithSHA3-256" -#define LN_hmac_sha3_256 "hmac-sha3-256" -#define NID_hmac_sha3_256 1103 -#define OBJ_hmac_sha3_256 OBJ_nist_hashalgs,14L - -#define SN_hmac_sha3_384 "id-hmacWithSHA3-384" -#define LN_hmac_sha3_384 "hmac-sha3-384" -#define NID_hmac_sha3_384 1104 -#define OBJ_hmac_sha3_384 OBJ_nist_hashalgs,15L - -#define SN_hmac_sha3_512 "id-hmacWithSHA3-512" -#define LN_hmac_sha3_512 "hmac-sha3-512" -#define NID_hmac_sha3_512 1105 -#define OBJ_hmac_sha3_512 OBJ_nist_hashalgs,16L - -#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L - -#define SN_dsa_with_SHA224 "dsa_with_SHA224" -#define NID_dsa_with_SHA224 802 -#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L - -#define SN_dsa_with_SHA256 "dsa_with_SHA256" -#define NID_dsa_with_SHA256 803 -#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L - -#define OBJ_sigAlgs OBJ_nistAlgorithms,3L - -#define SN_dsa_with_SHA384 "id-dsa-with-sha384" -#define LN_dsa_with_SHA384 "dsa_with_SHA384" -#define NID_dsa_with_SHA384 1106 -#define OBJ_dsa_with_SHA384 OBJ_sigAlgs,3L - -#define SN_dsa_with_SHA512 "id-dsa-with-sha512" -#define LN_dsa_with_SHA512 "dsa_with_SHA512" -#define NID_dsa_with_SHA512 1107 -#define OBJ_dsa_with_SHA512 OBJ_sigAlgs,4L - -#define SN_dsa_with_SHA3_224 "id-dsa-with-sha3-224" -#define LN_dsa_with_SHA3_224 "dsa_with_SHA3-224" -#define NID_dsa_with_SHA3_224 1108 -#define OBJ_dsa_with_SHA3_224 OBJ_sigAlgs,5L - -#define SN_dsa_with_SHA3_256 "id-dsa-with-sha3-256" -#define LN_dsa_with_SHA3_256 "dsa_with_SHA3-256" -#define NID_dsa_with_SHA3_256 1109 -#define OBJ_dsa_with_SHA3_256 OBJ_sigAlgs,6L - -#define SN_dsa_with_SHA3_384 "id-dsa-with-sha3-384" -#define LN_dsa_with_SHA3_384 "dsa_with_SHA3-384" -#define NID_dsa_with_SHA3_384 1110 -#define OBJ_dsa_with_SHA3_384 OBJ_sigAlgs,7L - -#define SN_dsa_with_SHA3_512 "id-dsa-with-sha3-512" -#define LN_dsa_with_SHA3_512 "dsa_with_SHA3-512" -#define NID_dsa_with_SHA3_512 1111 -#define OBJ_dsa_with_SHA3_512 OBJ_sigAlgs,8L - -#define SN_ecdsa_with_SHA3_224 "id-ecdsa-with-sha3-224" -#define LN_ecdsa_with_SHA3_224 "ecdsa_with_SHA3-224" -#define NID_ecdsa_with_SHA3_224 1112 -#define OBJ_ecdsa_with_SHA3_224 OBJ_sigAlgs,9L - -#define SN_ecdsa_with_SHA3_256 "id-ecdsa-with-sha3-256" -#define LN_ecdsa_with_SHA3_256 "ecdsa_with_SHA3-256" -#define NID_ecdsa_with_SHA3_256 1113 -#define OBJ_ecdsa_with_SHA3_256 OBJ_sigAlgs,10L - -#define SN_ecdsa_with_SHA3_384 "id-ecdsa-with-sha3-384" -#define LN_ecdsa_with_SHA3_384 "ecdsa_with_SHA3-384" -#define NID_ecdsa_with_SHA3_384 1114 -#define OBJ_ecdsa_with_SHA3_384 OBJ_sigAlgs,11L - -#define SN_ecdsa_with_SHA3_512 "id-ecdsa-with-sha3-512" -#define LN_ecdsa_with_SHA3_512 "ecdsa_with_SHA3-512" -#define NID_ecdsa_with_SHA3_512 1115 -#define OBJ_ecdsa_with_SHA3_512 OBJ_sigAlgs,12L - -#define SN_RSA_SHA3_224 "id-rsassa-pkcs1-v1_5-with-sha3-224" -#define LN_RSA_SHA3_224 "RSA-SHA3-224" -#define NID_RSA_SHA3_224 1116 -#define OBJ_RSA_SHA3_224 OBJ_sigAlgs,13L - -#define SN_RSA_SHA3_256 "id-rsassa-pkcs1-v1_5-with-sha3-256" -#define LN_RSA_SHA3_256 "RSA-SHA3-256" -#define NID_RSA_SHA3_256 1117 -#define OBJ_RSA_SHA3_256 OBJ_sigAlgs,14L - -#define SN_RSA_SHA3_384 "id-rsassa-pkcs1-v1_5-with-sha3-384" -#define LN_RSA_SHA3_384 "RSA-SHA3-384" -#define NID_RSA_SHA3_384 1118 -#define OBJ_RSA_SHA3_384 OBJ_sigAlgs,15L - -#define SN_RSA_SHA3_512 "id-rsassa-pkcs1-v1_5-with-sha3-512" -#define LN_RSA_SHA3_512 "RSA-SHA3-512" -#define NID_RSA_SHA3_512 1119 -#define OBJ_RSA_SHA3_512 OBJ_sigAlgs,16L - -#define SN_hold_instruction_code "holdInstructionCode" -#define LN_hold_instruction_code "Hold Instruction Code" -#define NID_hold_instruction_code 430 -#define OBJ_hold_instruction_code OBJ_id_ce,23L - -#define OBJ_holdInstruction OBJ_X9_57,2L - -#define SN_hold_instruction_none "holdInstructionNone" -#define LN_hold_instruction_none "Hold Instruction None" -#define NID_hold_instruction_none 431 -#define OBJ_hold_instruction_none OBJ_holdInstruction,1L - -#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" -#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" -#define NID_hold_instruction_call_issuer 432 -#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L - -#define SN_hold_instruction_reject "holdInstructionReject" -#define LN_hold_instruction_reject "Hold Instruction Reject" -#define NID_hold_instruction_reject 433 -#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L - -#define SN_data "data" -#define NID_data 434 -#define OBJ_data OBJ_itu_t,9L - -#define SN_pss "pss" -#define NID_pss 435 -#define OBJ_pss OBJ_data,2342L - -#define SN_ucl "ucl" -#define NID_ucl 436 -#define OBJ_ucl OBJ_pss,19200300L - -#define SN_pilot "pilot" -#define NID_pilot 437 -#define OBJ_pilot OBJ_ucl,100L - -#define LN_pilotAttributeType "pilotAttributeType" -#define NID_pilotAttributeType 438 -#define OBJ_pilotAttributeType OBJ_pilot,1L - -#define LN_pilotAttributeSyntax "pilotAttributeSyntax" -#define NID_pilotAttributeSyntax 439 -#define OBJ_pilotAttributeSyntax OBJ_pilot,3L - -#define LN_pilotObjectClass "pilotObjectClass" -#define NID_pilotObjectClass 440 -#define OBJ_pilotObjectClass OBJ_pilot,4L - -#define LN_pilotGroups "pilotGroups" -#define NID_pilotGroups 441 -#define OBJ_pilotGroups OBJ_pilot,10L - -#define LN_iA5StringSyntax "iA5StringSyntax" -#define NID_iA5StringSyntax 442 -#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L - -#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" -#define NID_caseIgnoreIA5StringSyntax 443 -#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L - -#define LN_pilotObject "pilotObject" -#define NID_pilotObject 444 -#define OBJ_pilotObject OBJ_pilotObjectClass,3L - -#define LN_pilotPerson "pilotPerson" -#define NID_pilotPerson 445 -#define OBJ_pilotPerson OBJ_pilotObjectClass,4L - -#define SN_account "account" -#define NID_account 446 -#define OBJ_account OBJ_pilotObjectClass,5L - -#define SN_document "document" -#define NID_document 447 -#define OBJ_document OBJ_pilotObjectClass,6L - -#define SN_room "room" -#define NID_room 448 -#define OBJ_room OBJ_pilotObjectClass,7L - -#define LN_documentSeries "documentSeries" -#define NID_documentSeries 449 -#define OBJ_documentSeries OBJ_pilotObjectClass,9L - -#define SN_Domain "domain" -#define LN_Domain "Domain" -#define NID_Domain 392 -#define OBJ_Domain OBJ_pilotObjectClass,13L - -#define LN_rFC822localPart "rFC822localPart" -#define NID_rFC822localPart 450 -#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L - -#define LN_dNSDomain "dNSDomain" -#define NID_dNSDomain 451 -#define OBJ_dNSDomain OBJ_pilotObjectClass,15L - -#define LN_domainRelatedObject "domainRelatedObject" -#define NID_domainRelatedObject 452 -#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L - -#define LN_friendlyCountry "friendlyCountry" -#define NID_friendlyCountry 453 -#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L - -#define LN_simpleSecurityObject "simpleSecurityObject" -#define NID_simpleSecurityObject 454 -#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L - -#define LN_pilotOrganization "pilotOrganization" -#define NID_pilotOrganization 455 -#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L - -#define LN_pilotDSA "pilotDSA" -#define NID_pilotDSA 456 -#define OBJ_pilotDSA OBJ_pilotObjectClass,21L - -#define LN_qualityLabelledData "qualityLabelledData" -#define NID_qualityLabelledData 457 -#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L - -#define SN_userId "UID" -#define LN_userId "userId" -#define NID_userId 458 -#define OBJ_userId OBJ_pilotAttributeType,1L - -#define LN_textEncodedORAddress "textEncodedORAddress" -#define NID_textEncodedORAddress 459 -#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L - -#define SN_rfc822Mailbox "mail" -#define LN_rfc822Mailbox "rfc822Mailbox" -#define NID_rfc822Mailbox 460 -#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L - -#define SN_info "info" -#define NID_info 461 -#define OBJ_info OBJ_pilotAttributeType,4L - -#define LN_favouriteDrink "favouriteDrink" -#define NID_favouriteDrink 462 -#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L - -#define LN_roomNumber "roomNumber" -#define NID_roomNumber 463 -#define OBJ_roomNumber OBJ_pilotAttributeType,6L - -#define SN_photo "photo" -#define NID_photo 464 -#define OBJ_photo OBJ_pilotAttributeType,7L - -#define LN_userClass "userClass" -#define NID_userClass 465 -#define OBJ_userClass OBJ_pilotAttributeType,8L - -#define SN_host "host" -#define NID_host 466 -#define OBJ_host OBJ_pilotAttributeType,9L - -#define SN_manager "manager" -#define NID_manager 467 -#define OBJ_manager OBJ_pilotAttributeType,10L - -#define LN_documentIdentifier "documentIdentifier" -#define NID_documentIdentifier 468 -#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L - -#define LN_documentTitle "documentTitle" -#define NID_documentTitle 469 -#define OBJ_documentTitle OBJ_pilotAttributeType,12L - -#define LN_documentVersion "documentVersion" -#define NID_documentVersion 470 -#define OBJ_documentVersion OBJ_pilotAttributeType,13L - -#define LN_documentAuthor "documentAuthor" -#define NID_documentAuthor 471 -#define OBJ_documentAuthor OBJ_pilotAttributeType,14L - -#define LN_documentLocation "documentLocation" -#define NID_documentLocation 472 -#define OBJ_documentLocation OBJ_pilotAttributeType,15L - -#define LN_homeTelephoneNumber "homeTelephoneNumber" -#define NID_homeTelephoneNumber 473 -#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L - -#define SN_secretary "secretary" -#define NID_secretary 474 -#define OBJ_secretary OBJ_pilotAttributeType,21L - -#define LN_otherMailbox "otherMailbox" -#define NID_otherMailbox 475 -#define OBJ_otherMailbox OBJ_pilotAttributeType,22L - -#define LN_lastModifiedTime "lastModifiedTime" -#define NID_lastModifiedTime 476 -#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L - -#define LN_lastModifiedBy "lastModifiedBy" -#define NID_lastModifiedBy 477 -#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L - -#define SN_domainComponent "DC" -#define LN_domainComponent "domainComponent" -#define NID_domainComponent 391 -#define OBJ_domainComponent OBJ_pilotAttributeType,25L - -#define LN_aRecord "aRecord" -#define NID_aRecord 478 -#define OBJ_aRecord OBJ_pilotAttributeType,26L - -#define LN_pilotAttributeType27 "pilotAttributeType27" -#define NID_pilotAttributeType27 479 -#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L - -#define LN_mXRecord "mXRecord" -#define NID_mXRecord 480 -#define OBJ_mXRecord OBJ_pilotAttributeType,28L - -#define LN_nSRecord "nSRecord" -#define NID_nSRecord 481 -#define OBJ_nSRecord OBJ_pilotAttributeType,29L - -#define LN_sOARecord "sOARecord" -#define NID_sOARecord 482 -#define OBJ_sOARecord OBJ_pilotAttributeType,30L - -#define LN_cNAMERecord "cNAMERecord" -#define NID_cNAMERecord 483 -#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L - -#define LN_associatedDomain "associatedDomain" -#define NID_associatedDomain 484 -#define OBJ_associatedDomain OBJ_pilotAttributeType,37L - -#define LN_associatedName "associatedName" -#define NID_associatedName 485 -#define OBJ_associatedName OBJ_pilotAttributeType,38L - -#define LN_homePostalAddress "homePostalAddress" -#define NID_homePostalAddress 486 -#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L - -#define LN_personalTitle "personalTitle" -#define NID_personalTitle 487 -#define OBJ_personalTitle OBJ_pilotAttributeType,40L - -#define LN_mobileTelephoneNumber "mobileTelephoneNumber" -#define NID_mobileTelephoneNumber 488 -#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L - -#define LN_pagerTelephoneNumber "pagerTelephoneNumber" -#define NID_pagerTelephoneNumber 489 -#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L - -#define LN_friendlyCountryName "friendlyCountryName" -#define NID_friendlyCountryName 490 -#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L - -#define SN_uniqueIdentifier "uid" -#define LN_uniqueIdentifier "uniqueIdentifier" -#define NID_uniqueIdentifier 102 -#define OBJ_uniqueIdentifier OBJ_pilotAttributeType,44L - -#define LN_organizationalStatus "organizationalStatus" -#define NID_organizationalStatus 491 -#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L - -#define LN_janetMailbox "janetMailbox" -#define NID_janetMailbox 492 -#define OBJ_janetMailbox OBJ_pilotAttributeType,46L - -#define LN_mailPreferenceOption "mailPreferenceOption" -#define NID_mailPreferenceOption 493 -#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L - -#define LN_buildingName "buildingName" -#define NID_buildingName 494 -#define OBJ_buildingName OBJ_pilotAttributeType,48L - -#define LN_dSAQuality "dSAQuality" -#define NID_dSAQuality 495 -#define OBJ_dSAQuality OBJ_pilotAttributeType,49L - -#define LN_singleLevelQuality "singleLevelQuality" -#define NID_singleLevelQuality 496 -#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L - -#define LN_subtreeMinimumQuality "subtreeMinimumQuality" -#define NID_subtreeMinimumQuality 497 -#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L - -#define LN_subtreeMaximumQuality "subtreeMaximumQuality" -#define NID_subtreeMaximumQuality 498 -#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L - -#define LN_personalSignature "personalSignature" -#define NID_personalSignature 499 -#define OBJ_personalSignature OBJ_pilotAttributeType,53L - -#define LN_dITRedirect "dITRedirect" -#define NID_dITRedirect 500 -#define OBJ_dITRedirect OBJ_pilotAttributeType,54L - -#define SN_audio "audio" -#define NID_audio 501 -#define OBJ_audio OBJ_pilotAttributeType,55L - -#define LN_documentPublisher "documentPublisher" -#define NID_documentPublisher 502 -#define OBJ_documentPublisher OBJ_pilotAttributeType,56L - -#define SN_id_set "id-set" -#define LN_id_set "Secure Electronic Transactions" -#define NID_id_set 512 -#define OBJ_id_set OBJ_international_organizations,42L - -#define SN_set_ctype "set-ctype" -#define LN_set_ctype "content types" -#define NID_set_ctype 513 -#define OBJ_set_ctype OBJ_id_set,0L - -#define SN_set_msgExt "set-msgExt" -#define LN_set_msgExt "message extensions" -#define NID_set_msgExt 514 -#define OBJ_set_msgExt OBJ_id_set,1L - -#define SN_set_attr "set-attr" -#define NID_set_attr 515 -#define OBJ_set_attr OBJ_id_set,3L - -#define SN_set_policy "set-policy" -#define NID_set_policy 516 -#define OBJ_set_policy OBJ_id_set,5L - -#define SN_set_certExt "set-certExt" -#define LN_set_certExt "certificate extensions" -#define NID_set_certExt 517 -#define OBJ_set_certExt OBJ_id_set,7L - -#define SN_set_brand "set-brand" -#define NID_set_brand 518 -#define OBJ_set_brand OBJ_id_set,8L - -#define SN_setct_PANData "setct-PANData" -#define NID_setct_PANData 519 -#define OBJ_setct_PANData OBJ_set_ctype,0L - -#define SN_setct_PANToken "setct-PANToken" -#define NID_setct_PANToken 520 -#define OBJ_setct_PANToken OBJ_set_ctype,1L - -#define SN_setct_PANOnly "setct-PANOnly" -#define NID_setct_PANOnly 521 -#define OBJ_setct_PANOnly OBJ_set_ctype,2L - -#define SN_setct_OIData "setct-OIData" -#define NID_setct_OIData 522 -#define OBJ_setct_OIData OBJ_set_ctype,3L - -#define SN_setct_PI "setct-PI" -#define NID_setct_PI 523 -#define OBJ_setct_PI OBJ_set_ctype,4L - -#define SN_setct_PIData "setct-PIData" -#define NID_setct_PIData 524 -#define OBJ_setct_PIData OBJ_set_ctype,5L - -#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" -#define NID_setct_PIDataUnsigned 525 -#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L - -#define SN_setct_HODInput "setct-HODInput" -#define NID_setct_HODInput 526 -#define OBJ_setct_HODInput OBJ_set_ctype,7L - -#define SN_setct_AuthResBaggage "setct-AuthResBaggage" -#define NID_setct_AuthResBaggage 527 -#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L - -#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" -#define NID_setct_AuthRevReqBaggage 528 -#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L - -#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" -#define NID_setct_AuthRevResBaggage 529 -#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L - -#define SN_setct_CapTokenSeq "setct-CapTokenSeq" -#define NID_setct_CapTokenSeq 530 -#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L - -#define SN_setct_PInitResData "setct-PInitResData" -#define NID_setct_PInitResData 531 -#define OBJ_setct_PInitResData OBJ_set_ctype,12L - -#define SN_setct_PI_TBS "setct-PI-TBS" -#define NID_setct_PI_TBS 532 -#define OBJ_setct_PI_TBS OBJ_set_ctype,13L - -#define SN_setct_PResData "setct-PResData" -#define NID_setct_PResData 533 -#define OBJ_setct_PResData OBJ_set_ctype,14L - -#define SN_setct_AuthReqTBS "setct-AuthReqTBS" -#define NID_setct_AuthReqTBS 534 -#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L - -#define SN_setct_AuthResTBS "setct-AuthResTBS" -#define NID_setct_AuthResTBS 535 -#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L - -#define SN_setct_AuthResTBSX "setct-AuthResTBSX" -#define NID_setct_AuthResTBSX 536 -#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L - -#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" -#define NID_setct_AuthTokenTBS 537 -#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L - -#define SN_setct_CapTokenData "setct-CapTokenData" -#define NID_setct_CapTokenData 538 -#define OBJ_setct_CapTokenData OBJ_set_ctype,20L - -#define SN_setct_CapTokenTBS "setct-CapTokenTBS" -#define NID_setct_CapTokenTBS 539 -#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L - -#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" -#define NID_setct_AcqCardCodeMsg 540 -#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L - -#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" -#define NID_setct_AuthRevReqTBS 541 -#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L - -#define SN_setct_AuthRevResData "setct-AuthRevResData" -#define NID_setct_AuthRevResData 542 -#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L - -#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" -#define NID_setct_AuthRevResTBS 543 -#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L - -#define SN_setct_CapReqTBS "setct-CapReqTBS" -#define NID_setct_CapReqTBS 544 -#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L - -#define SN_setct_CapReqTBSX "setct-CapReqTBSX" -#define NID_setct_CapReqTBSX 545 -#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L - -#define SN_setct_CapResData "setct-CapResData" -#define NID_setct_CapResData 546 -#define OBJ_setct_CapResData OBJ_set_ctype,28L - -#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" -#define NID_setct_CapRevReqTBS 547 -#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L - -#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" -#define NID_setct_CapRevReqTBSX 548 -#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L - -#define SN_setct_CapRevResData "setct-CapRevResData" -#define NID_setct_CapRevResData 549 -#define OBJ_setct_CapRevResData OBJ_set_ctype,31L - -#define SN_setct_CredReqTBS "setct-CredReqTBS" -#define NID_setct_CredReqTBS 550 -#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L - -#define SN_setct_CredReqTBSX "setct-CredReqTBSX" -#define NID_setct_CredReqTBSX 551 -#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L - -#define SN_setct_CredResData "setct-CredResData" -#define NID_setct_CredResData 552 -#define OBJ_setct_CredResData OBJ_set_ctype,34L - -#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" -#define NID_setct_CredRevReqTBS 553 -#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L - -#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" -#define NID_setct_CredRevReqTBSX 554 -#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L - -#define SN_setct_CredRevResData "setct-CredRevResData" -#define NID_setct_CredRevResData 555 -#define OBJ_setct_CredRevResData OBJ_set_ctype,37L - -#define SN_setct_PCertReqData "setct-PCertReqData" -#define NID_setct_PCertReqData 556 -#define OBJ_setct_PCertReqData OBJ_set_ctype,38L - -#define SN_setct_PCertResTBS "setct-PCertResTBS" -#define NID_setct_PCertResTBS 557 -#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L - -#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" -#define NID_setct_BatchAdminReqData 558 -#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L - -#define SN_setct_BatchAdminResData "setct-BatchAdminResData" -#define NID_setct_BatchAdminResData 559 -#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L - -#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" -#define NID_setct_CardCInitResTBS 560 -#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L - -#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" -#define NID_setct_MeAqCInitResTBS 561 -#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L - -#define SN_setct_RegFormResTBS "setct-RegFormResTBS" -#define NID_setct_RegFormResTBS 562 -#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L - -#define SN_setct_CertReqData "setct-CertReqData" -#define NID_setct_CertReqData 563 -#define OBJ_setct_CertReqData OBJ_set_ctype,45L - -#define SN_setct_CertReqTBS "setct-CertReqTBS" -#define NID_setct_CertReqTBS 564 -#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L - -#define SN_setct_CertResData "setct-CertResData" -#define NID_setct_CertResData 565 -#define OBJ_setct_CertResData OBJ_set_ctype,47L - -#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" -#define NID_setct_CertInqReqTBS 566 -#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L - -#define SN_setct_ErrorTBS "setct-ErrorTBS" -#define NID_setct_ErrorTBS 567 -#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L - -#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" -#define NID_setct_PIDualSignedTBE 568 -#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L - -#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" -#define NID_setct_PIUnsignedTBE 569 -#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L - -#define SN_setct_AuthReqTBE "setct-AuthReqTBE" -#define NID_setct_AuthReqTBE 570 -#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L - -#define SN_setct_AuthResTBE "setct-AuthResTBE" -#define NID_setct_AuthResTBE 571 -#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L - -#define SN_setct_AuthResTBEX "setct-AuthResTBEX" -#define NID_setct_AuthResTBEX 572 -#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L - -#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" -#define NID_setct_AuthTokenTBE 573 -#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L - -#define SN_setct_CapTokenTBE "setct-CapTokenTBE" -#define NID_setct_CapTokenTBE 574 -#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L - -#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" -#define NID_setct_CapTokenTBEX 575 -#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L - -#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" -#define NID_setct_AcqCardCodeMsgTBE 576 -#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L - -#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" -#define NID_setct_AuthRevReqTBE 577 -#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L - -#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" -#define NID_setct_AuthRevResTBE 578 -#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L - -#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" -#define NID_setct_AuthRevResTBEB 579 -#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L - -#define SN_setct_CapReqTBE "setct-CapReqTBE" -#define NID_setct_CapReqTBE 580 -#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L - -#define SN_setct_CapReqTBEX "setct-CapReqTBEX" -#define NID_setct_CapReqTBEX 581 -#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L - -#define SN_setct_CapResTBE "setct-CapResTBE" -#define NID_setct_CapResTBE 582 -#define OBJ_setct_CapResTBE OBJ_set_ctype,64L - -#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" -#define NID_setct_CapRevReqTBE 583 -#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L - -#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" -#define NID_setct_CapRevReqTBEX 584 -#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L - -#define SN_setct_CapRevResTBE "setct-CapRevResTBE" -#define NID_setct_CapRevResTBE 585 -#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L - -#define SN_setct_CredReqTBE "setct-CredReqTBE" -#define NID_setct_CredReqTBE 586 -#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L - -#define SN_setct_CredReqTBEX "setct-CredReqTBEX" -#define NID_setct_CredReqTBEX 587 -#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L - -#define SN_setct_CredResTBE "setct-CredResTBE" -#define NID_setct_CredResTBE 588 -#define OBJ_setct_CredResTBE OBJ_set_ctype,70L - -#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" -#define NID_setct_CredRevReqTBE 589 -#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L - -#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" -#define NID_setct_CredRevReqTBEX 590 -#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L - -#define SN_setct_CredRevResTBE "setct-CredRevResTBE" -#define NID_setct_CredRevResTBE 591 -#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L - -#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" -#define NID_setct_BatchAdminReqTBE 592 -#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L - -#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" -#define NID_setct_BatchAdminResTBE 593 -#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L - -#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" -#define NID_setct_RegFormReqTBE 594 -#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L - -#define SN_setct_CertReqTBE "setct-CertReqTBE" -#define NID_setct_CertReqTBE 595 -#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L - -#define SN_setct_CertReqTBEX "setct-CertReqTBEX" -#define NID_setct_CertReqTBEX 596 -#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L - -#define SN_setct_CertResTBE "setct-CertResTBE" -#define NID_setct_CertResTBE 597 -#define OBJ_setct_CertResTBE OBJ_set_ctype,79L - -#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" -#define NID_setct_CRLNotificationTBS 598 -#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L - -#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" -#define NID_setct_CRLNotificationResTBS 599 -#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L - -#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" -#define NID_setct_BCIDistributionTBS 600 -#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L - -#define SN_setext_genCrypt "setext-genCrypt" -#define LN_setext_genCrypt "generic cryptogram" -#define NID_setext_genCrypt 601 -#define OBJ_setext_genCrypt OBJ_set_msgExt,1L - -#define SN_setext_miAuth "setext-miAuth" -#define LN_setext_miAuth "merchant initiated auth" -#define NID_setext_miAuth 602 -#define OBJ_setext_miAuth OBJ_set_msgExt,3L - -#define SN_setext_pinSecure "setext-pinSecure" -#define NID_setext_pinSecure 603 -#define OBJ_setext_pinSecure OBJ_set_msgExt,4L - -#define SN_setext_pinAny "setext-pinAny" -#define NID_setext_pinAny 604 -#define OBJ_setext_pinAny OBJ_set_msgExt,5L - -#define SN_setext_track2 "setext-track2" -#define NID_setext_track2 605 -#define OBJ_setext_track2 OBJ_set_msgExt,7L - -#define SN_setext_cv "setext-cv" -#define LN_setext_cv "additional verification" -#define NID_setext_cv 606 -#define OBJ_setext_cv OBJ_set_msgExt,8L - -#define SN_set_policy_root "set-policy-root" -#define NID_set_policy_root 607 -#define OBJ_set_policy_root OBJ_set_policy,0L - -#define SN_setCext_hashedRoot "setCext-hashedRoot" -#define NID_setCext_hashedRoot 608 -#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L - -#define SN_setCext_certType "setCext-certType" -#define NID_setCext_certType 609 -#define OBJ_setCext_certType OBJ_set_certExt,1L - -#define SN_setCext_merchData "setCext-merchData" -#define NID_setCext_merchData 610 -#define OBJ_setCext_merchData OBJ_set_certExt,2L - -#define SN_setCext_cCertRequired "setCext-cCertRequired" -#define NID_setCext_cCertRequired 611 -#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L - -#define SN_setCext_tunneling "setCext-tunneling" -#define NID_setCext_tunneling 612 -#define OBJ_setCext_tunneling OBJ_set_certExt,4L - -#define SN_setCext_setExt "setCext-setExt" -#define NID_setCext_setExt 613 -#define OBJ_setCext_setExt OBJ_set_certExt,5L - -#define SN_setCext_setQualf "setCext-setQualf" -#define NID_setCext_setQualf 614 -#define OBJ_setCext_setQualf OBJ_set_certExt,6L - -#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" -#define NID_setCext_PGWYcapabilities 615 -#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L - -#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" -#define NID_setCext_TokenIdentifier 616 -#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L - -#define SN_setCext_Track2Data "setCext-Track2Data" -#define NID_setCext_Track2Data 617 -#define OBJ_setCext_Track2Data OBJ_set_certExt,9L - -#define SN_setCext_TokenType "setCext-TokenType" -#define NID_setCext_TokenType 618 -#define OBJ_setCext_TokenType OBJ_set_certExt,10L - -#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" -#define NID_setCext_IssuerCapabilities 619 -#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L - -#define SN_setAttr_Cert "setAttr-Cert" -#define NID_setAttr_Cert 620 -#define OBJ_setAttr_Cert OBJ_set_attr,0L - -#define SN_setAttr_PGWYcap "setAttr-PGWYcap" -#define LN_setAttr_PGWYcap "payment gateway capabilities" -#define NID_setAttr_PGWYcap 621 -#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L - -#define SN_setAttr_TokenType "setAttr-TokenType" -#define NID_setAttr_TokenType 622 -#define OBJ_setAttr_TokenType OBJ_set_attr,2L - -#define SN_setAttr_IssCap "setAttr-IssCap" -#define LN_setAttr_IssCap "issuer capabilities" -#define NID_setAttr_IssCap 623 -#define OBJ_setAttr_IssCap OBJ_set_attr,3L - -#define SN_set_rootKeyThumb "set-rootKeyThumb" -#define NID_set_rootKeyThumb 624 -#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L - -#define SN_set_addPolicy "set-addPolicy" -#define NID_set_addPolicy 625 -#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L - -#define SN_setAttr_Token_EMV "setAttr-Token-EMV" -#define NID_setAttr_Token_EMV 626 -#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L - -#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" -#define NID_setAttr_Token_B0Prime 627 -#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L - -#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" -#define NID_setAttr_IssCap_CVM 628 -#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L - -#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" -#define NID_setAttr_IssCap_T2 629 -#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L - -#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" -#define NID_setAttr_IssCap_Sig 630 -#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L - -#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" -#define LN_setAttr_GenCryptgrm "generate cryptogram" -#define NID_setAttr_GenCryptgrm 631 -#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L - -#define SN_setAttr_T2Enc "setAttr-T2Enc" -#define LN_setAttr_T2Enc "encrypted track 2" -#define NID_setAttr_T2Enc 632 -#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L - -#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" -#define LN_setAttr_T2cleartxt "cleartext track 2" -#define NID_setAttr_T2cleartxt 633 -#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L - -#define SN_setAttr_TokICCsig "setAttr-TokICCsig" -#define LN_setAttr_TokICCsig "ICC or token signature" -#define NID_setAttr_TokICCsig 634 -#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L - -#define SN_setAttr_SecDevSig "setAttr-SecDevSig" -#define LN_setAttr_SecDevSig "secure device signature" -#define NID_setAttr_SecDevSig 635 -#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L - -#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" -#define NID_set_brand_IATA_ATA 636 -#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L - -#define SN_set_brand_Diners "set-brand-Diners" -#define NID_set_brand_Diners 637 -#define OBJ_set_brand_Diners OBJ_set_brand,30L - -#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" -#define NID_set_brand_AmericanExpress 638 -#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L - -#define SN_set_brand_JCB "set-brand-JCB" -#define NID_set_brand_JCB 639 -#define OBJ_set_brand_JCB OBJ_set_brand,35L - -#define SN_set_brand_Visa "set-brand-Visa" -#define NID_set_brand_Visa 640 -#define OBJ_set_brand_Visa OBJ_set_brand,4L - -#define SN_set_brand_MasterCard "set-brand-MasterCard" -#define NID_set_brand_MasterCard 641 -#define OBJ_set_brand_MasterCard OBJ_set_brand,5L - -#define SN_set_brand_Novus "set-brand-Novus" -#define NID_set_brand_Novus 642 -#define OBJ_set_brand_Novus OBJ_set_brand,6011L - -#define SN_des_cdmf "DES-CDMF" -#define LN_des_cdmf "des-cdmf" -#define NID_des_cdmf 643 -#define OBJ_des_cdmf OBJ_rsadsi,3L,10L - -#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" -#define NID_rsaOAEPEncryptionSET 644 -#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L - -#define SN_ipsec3 "Oakley-EC2N-3" -#define LN_ipsec3 "ipsec3" -#define NID_ipsec3 749 - -#define SN_ipsec4 "Oakley-EC2N-4" -#define LN_ipsec4 "ipsec4" -#define NID_ipsec4 750 - -#define SN_whirlpool "whirlpool" -#define NID_whirlpool 804 -#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L - -#define SN_cryptopro "cryptopro" -#define NID_cryptopro 805 -#define OBJ_cryptopro OBJ_member_body,643L,2L,2L - -#define SN_cryptocom "cryptocom" -#define NID_cryptocom 806 -#define OBJ_cryptocom OBJ_member_body,643L,2L,9L - -#define SN_id_tc26 "id-tc26" -#define NID_id_tc26 974 -#define OBJ_id_tc26 OBJ_member_body,643L,7L,1L - -#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" -#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" -#define NID_id_GostR3411_94_with_GostR3410_2001 807 -#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L - -#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" -#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" -#define NID_id_GostR3411_94_with_GostR3410_94 808 -#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L - -#define SN_id_GostR3411_94 "md_gost94" -#define LN_id_GostR3411_94 "GOST R 34.11-94" -#define NID_id_GostR3411_94 809 -#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L - -#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" -#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" -#define NID_id_HMACGostR3411_94 810 -#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L - -#define SN_id_GostR3410_2001 "gost2001" -#define LN_id_GostR3410_2001 "GOST R 34.10-2001" -#define NID_id_GostR3410_2001 811 -#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L - -#define SN_id_GostR3410_94 "gost94" -#define LN_id_GostR3410_94 "GOST R 34.10-94" -#define NID_id_GostR3410_94 812 -#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L - -#define SN_id_Gost28147_89 "gost89" -#define LN_id_Gost28147_89 "GOST 28147-89" -#define NID_id_Gost28147_89 813 -#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L - -#define SN_gost89_cnt "gost89-cnt" -#define NID_gost89_cnt 814 - -#define SN_gost89_cnt_12 "gost89-cnt-12" -#define NID_gost89_cnt_12 975 - -#define SN_gost89_cbc "gost89-cbc" -#define NID_gost89_cbc 1009 - -#define SN_gost89_ecb "gost89-ecb" -#define NID_gost89_ecb 1010 - -#define SN_gost89_ctr "gost89-ctr" -#define NID_gost89_ctr 1011 - -#define SN_id_Gost28147_89_MAC "gost-mac" -#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" -#define NID_id_Gost28147_89_MAC 815 -#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L - -#define SN_gost_mac_12 "gost-mac-12" -#define NID_gost_mac_12 976 - -#define SN_id_GostR3411_94_prf "prf-gostr3411-94" -#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" -#define NID_id_GostR3411_94_prf 816 -#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L - -#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" -#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" -#define NID_id_GostR3410_2001DH 817 -#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L - -#define SN_id_GostR3410_94DH "id-GostR3410-94DH" -#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" -#define NID_id_GostR3410_94DH 818 -#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L - -#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" -#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 -#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L - -#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" -#define NID_id_Gost28147_89_None_KeyMeshing 820 -#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L - -#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" -#define NID_id_GostR3411_94_TestParamSet 821 -#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L - -#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" -#define NID_id_GostR3411_94_CryptoProParamSet 822 -#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L - -#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" -#define NID_id_Gost28147_89_TestParamSet 823 -#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L - -#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 -#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L - -#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 -#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L - -#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 -#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L - -#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 -#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L - -#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 -#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L - -#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 -#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L - -#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 -#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L - -#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" -#define NID_id_GostR3410_94_TestParamSet 831 -#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L - -#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 -#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L - -#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 -#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L - -#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 -#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L - -#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 -#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L - -#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 -#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L - -#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 -#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L - -#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 -#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L - -#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" -#define NID_id_GostR3410_2001_TestParamSet 839 -#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L - -#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 -#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L - -#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 -#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L - -#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 -#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L - -#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 -#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L - -#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 -#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L - -#define SN_id_GostR3410_94_a "id-GostR3410-94-a" -#define NID_id_GostR3410_94_a 845 -#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L - -#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" -#define NID_id_GostR3410_94_aBis 846 -#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L - -#define SN_id_GostR3410_94_b "id-GostR3410-94-b" -#define NID_id_GostR3410_94_b 847 -#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L - -#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" -#define NID_id_GostR3410_94_bBis 848 -#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L - -#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" -#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" -#define NID_id_Gost28147_89_cc 849 -#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L - -#define SN_id_GostR3410_94_cc "gost94cc" -#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" -#define NID_id_GostR3410_94_cc 850 -#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L - -#define SN_id_GostR3410_2001_cc "gost2001cc" -#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" -#define NID_id_GostR3410_2001_cc 851 -#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L - -#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" -#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" -#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 -#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L - -#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" -#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" -#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 -#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L - -#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" -#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" -#define NID_id_GostR3410_2001_ParamSet_cc 854 -#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L - -#define SN_id_tc26_algorithms "id-tc26-algorithms" -#define NID_id_tc26_algorithms 977 -#define OBJ_id_tc26_algorithms OBJ_id_tc26,1L - -#define SN_id_tc26_sign "id-tc26-sign" -#define NID_id_tc26_sign 978 -#define OBJ_id_tc26_sign OBJ_id_tc26_algorithms,1L - -#define SN_id_GostR3410_2012_256 "gost2012_256" -#define LN_id_GostR3410_2012_256 "GOST R 34.10-2012 with 256 bit modulus" -#define NID_id_GostR3410_2012_256 979 -#define OBJ_id_GostR3410_2012_256 OBJ_id_tc26_sign,1L - -#define SN_id_GostR3410_2012_512 "gost2012_512" -#define LN_id_GostR3410_2012_512 "GOST R 34.10-2012 with 512 bit modulus" -#define NID_id_GostR3410_2012_512 980 -#define OBJ_id_GostR3410_2012_512 OBJ_id_tc26_sign,2L - -#define SN_id_tc26_digest "id-tc26-digest" -#define NID_id_tc26_digest 981 -#define OBJ_id_tc26_digest OBJ_id_tc26_algorithms,2L - -#define SN_id_GostR3411_2012_256 "md_gost12_256" -#define LN_id_GostR3411_2012_256 "GOST R 34.11-2012 with 256 bit hash" -#define NID_id_GostR3411_2012_256 982 -#define OBJ_id_GostR3411_2012_256 OBJ_id_tc26_digest,2L - -#define SN_id_GostR3411_2012_512 "md_gost12_512" -#define LN_id_GostR3411_2012_512 "GOST R 34.11-2012 with 512 bit hash" -#define NID_id_GostR3411_2012_512 983 -#define OBJ_id_GostR3411_2012_512 OBJ_id_tc26_digest,3L - -#define SN_id_tc26_signwithdigest "id-tc26-signwithdigest" -#define NID_id_tc26_signwithdigest 984 -#define OBJ_id_tc26_signwithdigest OBJ_id_tc26_algorithms,3L - -#define SN_id_tc26_signwithdigest_gost3410_2012_256 "id-tc26-signwithdigest-gost3410-2012-256" -#define LN_id_tc26_signwithdigest_gost3410_2012_256 "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" -#define NID_id_tc26_signwithdigest_gost3410_2012_256 985 -#define OBJ_id_tc26_signwithdigest_gost3410_2012_256 OBJ_id_tc26_signwithdigest,2L - -#define SN_id_tc26_signwithdigest_gost3410_2012_512 "id-tc26-signwithdigest-gost3410-2012-512" -#define LN_id_tc26_signwithdigest_gost3410_2012_512 "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" -#define NID_id_tc26_signwithdigest_gost3410_2012_512 986 -#define OBJ_id_tc26_signwithdigest_gost3410_2012_512 OBJ_id_tc26_signwithdigest,3L - -#define SN_id_tc26_mac "id-tc26-mac" -#define NID_id_tc26_mac 987 -#define OBJ_id_tc26_mac OBJ_id_tc26_algorithms,4L - -#define SN_id_tc26_hmac_gost_3411_2012_256 "id-tc26-hmac-gost-3411-2012-256" -#define LN_id_tc26_hmac_gost_3411_2012_256 "HMAC GOST 34.11-2012 256 bit" -#define NID_id_tc26_hmac_gost_3411_2012_256 988 -#define OBJ_id_tc26_hmac_gost_3411_2012_256 OBJ_id_tc26_mac,1L - -#define SN_id_tc26_hmac_gost_3411_2012_512 "id-tc26-hmac-gost-3411-2012-512" -#define LN_id_tc26_hmac_gost_3411_2012_512 "HMAC GOST 34.11-2012 512 bit" -#define NID_id_tc26_hmac_gost_3411_2012_512 989 -#define OBJ_id_tc26_hmac_gost_3411_2012_512 OBJ_id_tc26_mac,2L - -#define SN_id_tc26_cipher "id-tc26-cipher" -#define NID_id_tc26_cipher 990 -#define OBJ_id_tc26_cipher OBJ_id_tc26_algorithms,5L - -#define SN_id_tc26_cipher_gostr3412_2015_magma "id-tc26-cipher-gostr3412-2015-magma" -#define NID_id_tc26_cipher_gostr3412_2015_magma 1173 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma OBJ_id_tc26_cipher,1L - -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm "id-tc26-cipher-gostr3412-2015-magma-ctracpkm" -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm 1174 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_magma,1L - -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-magma-ctracpkm-omac" -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac 1175 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_magma,2L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik "id-tc26-cipher-gostr3412-2015-kuznyechik" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik 1176 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik OBJ_id_tc26_cipher,2L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm 1177 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,1L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm-omac" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac 1178 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,2L - -#define SN_id_tc26_agreement "id-tc26-agreement" -#define NID_id_tc26_agreement 991 -#define OBJ_id_tc26_agreement OBJ_id_tc26_algorithms,6L - -#define SN_id_tc26_agreement_gost_3410_2012_256 "id-tc26-agreement-gost-3410-2012-256" -#define NID_id_tc26_agreement_gost_3410_2012_256 992 -#define OBJ_id_tc26_agreement_gost_3410_2012_256 OBJ_id_tc26_agreement,1L - -#define SN_id_tc26_agreement_gost_3410_2012_512 "id-tc26-agreement-gost-3410-2012-512" -#define NID_id_tc26_agreement_gost_3410_2012_512 993 -#define OBJ_id_tc26_agreement_gost_3410_2012_512 OBJ_id_tc26_agreement,2L - -#define SN_id_tc26_wrap "id-tc26-wrap" -#define NID_id_tc26_wrap 1179 -#define OBJ_id_tc26_wrap OBJ_id_tc26_algorithms,7L - -#define SN_id_tc26_wrap_gostr3412_2015_magma "id-tc26-wrap-gostr3412-2015-magma" -#define NID_id_tc26_wrap_gostr3412_2015_magma 1180 -#define OBJ_id_tc26_wrap_gostr3412_2015_magma OBJ_id_tc26_wrap,1L - -#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 "id-tc26-wrap-gostr3412-2015-magma-kexp15" -#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 1181 -#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_magma,1L - -#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik "id-tc26-wrap-gostr3412-2015-kuznyechik" -#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik 1182 -#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik OBJ_id_tc26_wrap,2L - -#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 "id-tc26-wrap-gostr3412-2015-kuznyechik-kexp15" -#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 1183 -#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik,1L - -#define SN_id_tc26_constants "id-tc26-constants" -#define NID_id_tc26_constants 994 -#define OBJ_id_tc26_constants OBJ_id_tc26,2L - -#define SN_id_tc26_sign_constants "id-tc26-sign-constants" -#define NID_id_tc26_sign_constants 995 -#define OBJ_id_tc26_sign_constants OBJ_id_tc26_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_constants "id-tc26-gost-3410-2012-256-constants" -#define NID_id_tc26_gost_3410_2012_256_constants 1147 -#define OBJ_id_tc26_gost_3410_2012_256_constants OBJ_id_tc26_sign_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_paramSetA "id-tc26-gost-3410-2012-256-paramSetA" -#define LN_id_tc26_gost_3410_2012_256_paramSetA "GOST R 34.10-2012 (256 bit) ParamSet A" -#define NID_id_tc26_gost_3410_2012_256_paramSetA 1148 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetA OBJ_id_tc26_gost_3410_2012_256_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_paramSetB "id-tc26-gost-3410-2012-256-paramSetB" -#define LN_id_tc26_gost_3410_2012_256_paramSetB "GOST R 34.10-2012 (256 bit) ParamSet B" -#define NID_id_tc26_gost_3410_2012_256_paramSetB 1184 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetB OBJ_id_tc26_gost_3410_2012_256_constants,2L - -#define SN_id_tc26_gost_3410_2012_256_paramSetC "id-tc26-gost-3410-2012-256-paramSetC" -#define LN_id_tc26_gost_3410_2012_256_paramSetC "GOST R 34.10-2012 (256 bit) ParamSet C" -#define NID_id_tc26_gost_3410_2012_256_paramSetC 1185 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetC OBJ_id_tc26_gost_3410_2012_256_constants,3L - -#define SN_id_tc26_gost_3410_2012_256_paramSetD "id-tc26-gost-3410-2012-256-paramSetD" -#define LN_id_tc26_gost_3410_2012_256_paramSetD "GOST R 34.10-2012 (256 bit) ParamSet D" -#define NID_id_tc26_gost_3410_2012_256_paramSetD 1186 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetD OBJ_id_tc26_gost_3410_2012_256_constants,4L - -#define SN_id_tc26_gost_3410_2012_512_constants "id-tc26-gost-3410-2012-512-constants" -#define NID_id_tc26_gost_3410_2012_512_constants 996 -#define OBJ_id_tc26_gost_3410_2012_512_constants OBJ_id_tc26_sign_constants,2L - -#define SN_id_tc26_gost_3410_2012_512_paramSetTest "id-tc26-gost-3410-2012-512-paramSetTest" -#define LN_id_tc26_gost_3410_2012_512_paramSetTest "GOST R 34.10-2012 (512 bit) testing parameter set" -#define NID_id_tc26_gost_3410_2012_512_paramSetTest 997 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetTest OBJ_id_tc26_gost_3410_2012_512_constants,0L - -#define SN_id_tc26_gost_3410_2012_512_paramSetA "id-tc26-gost-3410-2012-512-paramSetA" -#define LN_id_tc26_gost_3410_2012_512_paramSetA "GOST R 34.10-2012 (512 bit) ParamSet A" -#define NID_id_tc26_gost_3410_2012_512_paramSetA 998 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetA OBJ_id_tc26_gost_3410_2012_512_constants,1L - -#define SN_id_tc26_gost_3410_2012_512_paramSetB "id-tc26-gost-3410-2012-512-paramSetB" -#define LN_id_tc26_gost_3410_2012_512_paramSetB "GOST R 34.10-2012 (512 bit) ParamSet B" -#define NID_id_tc26_gost_3410_2012_512_paramSetB 999 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetB OBJ_id_tc26_gost_3410_2012_512_constants,2L - -#define SN_id_tc26_gost_3410_2012_512_paramSetC "id-tc26-gost-3410-2012-512-paramSetC" -#define LN_id_tc26_gost_3410_2012_512_paramSetC "GOST R 34.10-2012 (512 bit) ParamSet C" -#define NID_id_tc26_gost_3410_2012_512_paramSetC 1149 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetC OBJ_id_tc26_gost_3410_2012_512_constants,3L - -#define SN_id_tc26_digest_constants "id-tc26-digest-constants" -#define NID_id_tc26_digest_constants 1000 -#define OBJ_id_tc26_digest_constants OBJ_id_tc26_constants,2L - -#define SN_id_tc26_cipher_constants "id-tc26-cipher-constants" -#define NID_id_tc26_cipher_constants 1001 -#define OBJ_id_tc26_cipher_constants OBJ_id_tc26_constants,5L - -#define SN_id_tc26_gost_28147_constants "id-tc26-gost-28147-constants" -#define NID_id_tc26_gost_28147_constants 1002 -#define OBJ_id_tc26_gost_28147_constants OBJ_id_tc26_cipher_constants,1L - -#define SN_id_tc26_gost_28147_param_Z "id-tc26-gost-28147-param-Z" -#define LN_id_tc26_gost_28147_param_Z "GOST 28147-89 TC26 parameter set" -#define NID_id_tc26_gost_28147_param_Z 1003 -#define OBJ_id_tc26_gost_28147_param_Z OBJ_id_tc26_gost_28147_constants,1L - -#define SN_INN "INN" -#define LN_INN "INN" -#define NID_INN 1004 -#define OBJ_INN OBJ_member_body,643L,3L,131L,1L,1L - -#define SN_OGRN "OGRN" -#define LN_OGRN "OGRN" -#define NID_OGRN 1005 -#define OBJ_OGRN OBJ_member_body,643L,100L,1L - -#define SN_SNILS "SNILS" -#define LN_SNILS "SNILS" -#define NID_SNILS 1006 -#define OBJ_SNILS OBJ_member_body,643L,100L,3L - -#define SN_subjectSignTool "subjectSignTool" -#define LN_subjectSignTool "Signing Tool of Subject" -#define NID_subjectSignTool 1007 -#define OBJ_subjectSignTool OBJ_member_body,643L,100L,111L - -#define SN_issuerSignTool "issuerSignTool" -#define LN_issuerSignTool "Signing Tool of Issuer" -#define NID_issuerSignTool 1008 -#define OBJ_issuerSignTool OBJ_member_body,643L,100L,112L - -#define SN_grasshopper_ecb "grasshopper-ecb" -#define NID_grasshopper_ecb 1012 - -#define SN_grasshopper_ctr "grasshopper-ctr" -#define NID_grasshopper_ctr 1013 - -#define SN_grasshopper_ofb "grasshopper-ofb" -#define NID_grasshopper_ofb 1014 - -#define SN_grasshopper_cbc "grasshopper-cbc" -#define NID_grasshopper_cbc 1015 - -#define SN_grasshopper_cfb "grasshopper-cfb" -#define NID_grasshopper_cfb 1016 - -#define SN_grasshopper_mac "grasshopper-mac" -#define NID_grasshopper_mac 1017 - -#define SN_magma_ecb "magma-ecb" -#define NID_magma_ecb 1187 - -#define SN_magma_ctr "magma-ctr" -#define NID_magma_ctr 1188 - -#define SN_magma_ofb "magma-ofb" -#define NID_magma_ofb 1189 - -#define SN_magma_cbc "magma-cbc" -#define NID_magma_cbc 1190 - -#define SN_magma_cfb "magma-cfb" -#define NID_magma_cfb 1191 - -#define SN_magma_mac "magma-mac" -#define NID_magma_mac 1192 - -#define SN_camellia_128_cbc "CAMELLIA-128-CBC" -#define LN_camellia_128_cbc "camellia-128-cbc" -#define NID_camellia_128_cbc 751 -#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L - -#define SN_camellia_192_cbc "CAMELLIA-192-CBC" -#define LN_camellia_192_cbc "camellia-192-cbc" -#define NID_camellia_192_cbc 752 -#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L - -#define SN_camellia_256_cbc "CAMELLIA-256-CBC" -#define LN_camellia_256_cbc "camellia-256-cbc" -#define NID_camellia_256_cbc 753 -#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L - -#define SN_id_camellia128_wrap "id-camellia128-wrap" -#define NID_id_camellia128_wrap 907 -#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L - -#define SN_id_camellia192_wrap "id-camellia192-wrap" -#define NID_id_camellia192_wrap 908 -#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L - -#define SN_id_camellia256_wrap "id-camellia256-wrap" -#define NID_id_camellia256_wrap 909 -#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L - -#define OBJ_ntt_ds 0L,3L,4401L,5L - -#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L - -#define SN_camellia_128_ecb "CAMELLIA-128-ECB" -#define LN_camellia_128_ecb "camellia-128-ecb" -#define NID_camellia_128_ecb 754 -#define OBJ_camellia_128_ecb OBJ_camellia,1L - -#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" -#define LN_camellia_128_ofb128 "camellia-128-ofb" -#define NID_camellia_128_ofb128 766 -#define OBJ_camellia_128_ofb128 OBJ_camellia,3L - -#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" -#define LN_camellia_128_cfb128 "camellia-128-cfb" -#define NID_camellia_128_cfb128 757 -#define OBJ_camellia_128_cfb128 OBJ_camellia,4L - -#define SN_camellia_128_gcm "CAMELLIA-128-GCM" -#define LN_camellia_128_gcm "camellia-128-gcm" -#define NID_camellia_128_gcm 961 -#define OBJ_camellia_128_gcm OBJ_camellia,6L - -#define SN_camellia_128_ccm "CAMELLIA-128-CCM" -#define LN_camellia_128_ccm "camellia-128-ccm" -#define NID_camellia_128_ccm 962 -#define OBJ_camellia_128_ccm OBJ_camellia,7L - -#define SN_camellia_128_ctr "CAMELLIA-128-CTR" -#define LN_camellia_128_ctr "camellia-128-ctr" -#define NID_camellia_128_ctr 963 -#define OBJ_camellia_128_ctr OBJ_camellia,9L - -#define SN_camellia_128_cmac "CAMELLIA-128-CMAC" -#define LN_camellia_128_cmac "camellia-128-cmac" -#define NID_camellia_128_cmac 964 -#define OBJ_camellia_128_cmac OBJ_camellia,10L - -#define SN_camellia_192_ecb "CAMELLIA-192-ECB" -#define LN_camellia_192_ecb "camellia-192-ecb" -#define NID_camellia_192_ecb 755 -#define OBJ_camellia_192_ecb OBJ_camellia,21L - -#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" -#define LN_camellia_192_ofb128 "camellia-192-ofb" -#define NID_camellia_192_ofb128 767 -#define OBJ_camellia_192_ofb128 OBJ_camellia,23L - -#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" -#define LN_camellia_192_cfb128 "camellia-192-cfb" -#define NID_camellia_192_cfb128 758 -#define OBJ_camellia_192_cfb128 OBJ_camellia,24L - -#define SN_camellia_192_gcm "CAMELLIA-192-GCM" -#define LN_camellia_192_gcm "camellia-192-gcm" -#define NID_camellia_192_gcm 965 -#define OBJ_camellia_192_gcm OBJ_camellia,26L - -#define SN_camellia_192_ccm "CAMELLIA-192-CCM" -#define LN_camellia_192_ccm "camellia-192-ccm" -#define NID_camellia_192_ccm 966 -#define OBJ_camellia_192_ccm OBJ_camellia,27L - -#define SN_camellia_192_ctr "CAMELLIA-192-CTR" -#define LN_camellia_192_ctr "camellia-192-ctr" -#define NID_camellia_192_ctr 967 -#define OBJ_camellia_192_ctr OBJ_camellia,29L - -#define SN_camellia_192_cmac "CAMELLIA-192-CMAC" -#define LN_camellia_192_cmac "camellia-192-cmac" -#define NID_camellia_192_cmac 968 -#define OBJ_camellia_192_cmac OBJ_camellia,30L - -#define SN_camellia_256_ecb "CAMELLIA-256-ECB" -#define LN_camellia_256_ecb "camellia-256-ecb" -#define NID_camellia_256_ecb 756 -#define OBJ_camellia_256_ecb OBJ_camellia,41L - -#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" -#define LN_camellia_256_ofb128 "camellia-256-ofb" -#define NID_camellia_256_ofb128 768 -#define OBJ_camellia_256_ofb128 OBJ_camellia,43L - -#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" -#define LN_camellia_256_cfb128 "camellia-256-cfb" -#define NID_camellia_256_cfb128 759 -#define OBJ_camellia_256_cfb128 OBJ_camellia,44L - -#define SN_camellia_256_gcm "CAMELLIA-256-GCM" -#define LN_camellia_256_gcm "camellia-256-gcm" -#define NID_camellia_256_gcm 969 -#define OBJ_camellia_256_gcm OBJ_camellia,46L - -#define SN_camellia_256_ccm "CAMELLIA-256-CCM" -#define LN_camellia_256_ccm "camellia-256-ccm" -#define NID_camellia_256_ccm 970 -#define OBJ_camellia_256_ccm OBJ_camellia,47L - -#define SN_camellia_256_ctr "CAMELLIA-256-CTR" -#define LN_camellia_256_ctr "camellia-256-ctr" -#define NID_camellia_256_ctr 971 -#define OBJ_camellia_256_ctr OBJ_camellia,49L - -#define SN_camellia_256_cmac "CAMELLIA-256-CMAC" -#define LN_camellia_256_cmac "camellia-256-cmac" -#define NID_camellia_256_cmac 972 -#define OBJ_camellia_256_cmac OBJ_camellia,50L - -#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" -#define LN_camellia_128_cfb1 "camellia-128-cfb1" -#define NID_camellia_128_cfb1 760 - -#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" -#define LN_camellia_192_cfb1 "camellia-192-cfb1" -#define NID_camellia_192_cfb1 761 - -#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" -#define LN_camellia_256_cfb1 "camellia-256-cfb1" -#define NID_camellia_256_cfb1 762 - -#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" -#define LN_camellia_128_cfb8 "camellia-128-cfb8" -#define NID_camellia_128_cfb8 763 - -#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" -#define LN_camellia_192_cfb8 "camellia-192-cfb8" -#define NID_camellia_192_cfb8 764 - -#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" -#define LN_camellia_256_cfb8 "camellia-256-cfb8" -#define NID_camellia_256_cfb8 765 - -#define OBJ_aria 1L,2L,410L,200046L,1L,1L - -#define SN_aria_128_ecb "ARIA-128-ECB" -#define LN_aria_128_ecb "aria-128-ecb" -#define NID_aria_128_ecb 1065 -#define OBJ_aria_128_ecb OBJ_aria,1L - -#define SN_aria_128_cbc "ARIA-128-CBC" -#define LN_aria_128_cbc "aria-128-cbc" -#define NID_aria_128_cbc 1066 -#define OBJ_aria_128_cbc OBJ_aria,2L - -#define SN_aria_128_cfb128 "ARIA-128-CFB" -#define LN_aria_128_cfb128 "aria-128-cfb" -#define NID_aria_128_cfb128 1067 -#define OBJ_aria_128_cfb128 OBJ_aria,3L - -#define SN_aria_128_ofb128 "ARIA-128-OFB" -#define LN_aria_128_ofb128 "aria-128-ofb" -#define NID_aria_128_ofb128 1068 -#define OBJ_aria_128_ofb128 OBJ_aria,4L - -#define SN_aria_128_ctr "ARIA-128-CTR" -#define LN_aria_128_ctr "aria-128-ctr" -#define NID_aria_128_ctr 1069 -#define OBJ_aria_128_ctr OBJ_aria,5L - -#define SN_aria_192_ecb "ARIA-192-ECB" -#define LN_aria_192_ecb "aria-192-ecb" -#define NID_aria_192_ecb 1070 -#define OBJ_aria_192_ecb OBJ_aria,6L - -#define SN_aria_192_cbc "ARIA-192-CBC" -#define LN_aria_192_cbc "aria-192-cbc" -#define NID_aria_192_cbc 1071 -#define OBJ_aria_192_cbc OBJ_aria,7L - -#define SN_aria_192_cfb128 "ARIA-192-CFB" -#define LN_aria_192_cfb128 "aria-192-cfb" -#define NID_aria_192_cfb128 1072 -#define OBJ_aria_192_cfb128 OBJ_aria,8L - -#define SN_aria_192_ofb128 "ARIA-192-OFB" -#define LN_aria_192_ofb128 "aria-192-ofb" -#define NID_aria_192_ofb128 1073 -#define OBJ_aria_192_ofb128 OBJ_aria,9L - -#define SN_aria_192_ctr "ARIA-192-CTR" -#define LN_aria_192_ctr "aria-192-ctr" -#define NID_aria_192_ctr 1074 -#define OBJ_aria_192_ctr OBJ_aria,10L - -#define SN_aria_256_ecb "ARIA-256-ECB" -#define LN_aria_256_ecb "aria-256-ecb" -#define NID_aria_256_ecb 1075 -#define OBJ_aria_256_ecb OBJ_aria,11L - -#define SN_aria_256_cbc "ARIA-256-CBC" -#define LN_aria_256_cbc "aria-256-cbc" -#define NID_aria_256_cbc 1076 -#define OBJ_aria_256_cbc OBJ_aria,12L - -#define SN_aria_256_cfb128 "ARIA-256-CFB" -#define LN_aria_256_cfb128 "aria-256-cfb" -#define NID_aria_256_cfb128 1077 -#define OBJ_aria_256_cfb128 OBJ_aria,13L - -#define SN_aria_256_ofb128 "ARIA-256-OFB" -#define LN_aria_256_ofb128 "aria-256-ofb" -#define NID_aria_256_ofb128 1078 -#define OBJ_aria_256_ofb128 OBJ_aria,14L - -#define SN_aria_256_ctr "ARIA-256-CTR" -#define LN_aria_256_ctr "aria-256-ctr" -#define NID_aria_256_ctr 1079 -#define OBJ_aria_256_ctr OBJ_aria,15L - -#define SN_aria_128_cfb1 "ARIA-128-CFB1" -#define LN_aria_128_cfb1 "aria-128-cfb1" -#define NID_aria_128_cfb1 1080 - -#define SN_aria_192_cfb1 "ARIA-192-CFB1" -#define LN_aria_192_cfb1 "aria-192-cfb1" -#define NID_aria_192_cfb1 1081 - -#define SN_aria_256_cfb1 "ARIA-256-CFB1" -#define LN_aria_256_cfb1 "aria-256-cfb1" -#define NID_aria_256_cfb1 1082 - -#define SN_aria_128_cfb8 "ARIA-128-CFB8" -#define LN_aria_128_cfb8 "aria-128-cfb8" -#define NID_aria_128_cfb8 1083 - -#define SN_aria_192_cfb8 "ARIA-192-CFB8" -#define LN_aria_192_cfb8 "aria-192-cfb8" -#define NID_aria_192_cfb8 1084 - -#define SN_aria_256_cfb8 "ARIA-256-CFB8" -#define LN_aria_256_cfb8 "aria-256-cfb8" -#define NID_aria_256_cfb8 1085 - -#define SN_aria_128_ccm "ARIA-128-CCM" -#define LN_aria_128_ccm "aria-128-ccm" -#define NID_aria_128_ccm 1120 -#define OBJ_aria_128_ccm OBJ_aria,37L - -#define SN_aria_192_ccm "ARIA-192-CCM" -#define LN_aria_192_ccm "aria-192-ccm" -#define NID_aria_192_ccm 1121 -#define OBJ_aria_192_ccm OBJ_aria,38L - -#define SN_aria_256_ccm "ARIA-256-CCM" -#define LN_aria_256_ccm "aria-256-ccm" -#define NID_aria_256_ccm 1122 -#define OBJ_aria_256_ccm OBJ_aria,39L - -#define SN_aria_128_gcm "ARIA-128-GCM" -#define LN_aria_128_gcm "aria-128-gcm" -#define NID_aria_128_gcm 1123 -#define OBJ_aria_128_gcm OBJ_aria,34L - -#define SN_aria_192_gcm "ARIA-192-GCM" -#define LN_aria_192_gcm "aria-192-gcm" -#define NID_aria_192_gcm 1124 -#define OBJ_aria_192_gcm OBJ_aria,35L - -#define SN_aria_256_gcm "ARIA-256-GCM" -#define LN_aria_256_gcm "aria-256-gcm" -#define NID_aria_256_gcm 1125 -#define OBJ_aria_256_gcm OBJ_aria,36L - -#define SN_kisa "KISA" -#define LN_kisa "kisa" -#define NID_kisa 773 -#define OBJ_kisa OBJ_member_body,410L,200004L - -#define SN_seed_ecb "SEED-ECB" -#define LN_seed_ecb "seed-ecb" -#define NID_seed_ecb 776 -#define OBJ_seed_ecb OBJ_kisa,1L,3L - -#define SN_seed_cbc "SEED-CBC" -#define LN_seed_cbc "seed-cbc" -#define NID_seed_cbc 777 -#define OBJ_seed_cbc OBJ_kisa,1L,4L - -#define SN_seed_cfb128 "SEED-CFB" -#define LN_seed_cfb128 "seed-cfb" -#define NID_seed_cfb128 779 -#define OBJ_seed_cfb128 OBJ_kisa,1L,5L - -#define SN_seed_ofb128 "SEED-OFB" -#define LN_seed_ofb128 "seed-ofb" -#define NID_seed_ofb128 778 -#define OBJ_seed_ofb128 OBJ_kisa,1L,6L - -#define SN_sm4_ecb "SM4-ECB" -#define LN_sm4_ecb "sm4-ecb" -#define NID_sm4_ecb 1133 -#define OBJ_sm4_ecb OBJ_sm_scheme,104L,1L - -#define SN_sm4_cbc "SM4-CBC" -#define LN_sm4_cbc "sm4-cbc" -#define NID_sm4_cbc 1134 -#define OBJ_sm4_cbc OBJ_sm_scheme,104L,2L - -#define SN_sm4_ofb128 "SM4-OFB" -#define LN_sm4_ofb128 "sm4-ofb" -#define NID_sm4_ofb128 1135 -#define OBJ_sm4_ofb128 OBJ_sm_scheme,104L,3L - -#define SN_sm4_cfb128 "SM4-CFB" -#define LN_sm4_cfb128 "sm4-cfb" -#define NID_sm4_cfb128 1137 -#define OBJ_sm4_cfb128 OBJ_sm_scheme,104L,4L - -#define SN_sm4_cfb1 "SM4-CFB1" -#define LN_sm4_cfb1 "sm4-cfb1" -#define NID_sm4_cfb1 1136 -#define OBJ_sm4_cfb1 OBJ_sm_scheme,104L,5L - -#define SN_sm4_cfb8 "SM4-CFB8" -#define LN_sm4_cfb8 "sm4-cfb8" -#define NID_sm4_cfb8 1138 -#define OBJ_sm4_cfb8 OBJ_sm_scheme,104L,6L - -#define SN_sm4_ctr "SM4-CTR" -#define LN_sm4_ctr "sm4-ctr" -#define NID_sm4_ctr 1139 -#define OBJ_sm4_ctr OBJ_sm_scheme,104L,7L - -#define SN_hmac "HMAC" -#define LN_hmac "hmac" -#define NID_hmac 855 - -#define SN_cmac "CMAC" -#define LN_cmac "cmac" -#define NID_cmac 894 - -#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" -#define LN_rc4_hmac_md5 "rc4-hmac-md5" -#define NID_rc4_hmac_md5 915 - -#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" -#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" -#define NID_aes_128_cbc_hmac_sha1 916 - -#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" -#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" -#define NID_aes_192_cbc_hmac_sha1 917 - -#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" -#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" -#define NID_aes_256_cbc_hmac_sha1 918 - -#define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" -#define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" -#define NID_aes_128_cbc_hmac_sha256 948 - -#define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" -#define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" -#define NID_aes_192_cbc_hmac_sha256 949 - -#define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" -#define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" -#define NID_aes_256_cbc_hmac_sha256 950 - -#define SN_chacha20_poly1305 "ChaCha20-Poly1305" -#define LN_chacha20_poly1305 "chacha20-poly1305" -#define NID_chacha20_poly1305 1018 - -#define SN_chacha20 "ChaCha20" -#define LN_chacha20 "chacha20" -#define NID_chacha20 1019 - -#define SN_dhpublicnumber "dhpublicnumber" -#define LN_dhpublicnumber "X9.42 DH" -#define NID_dhpublicnumber 920 -#define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L - -#define SN_brainpoolP160r1 "brainpoolP160r1" -#define NID_brainpoolP160r1 921 -#define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L - -#define SN_brainpoolP160t1 "brainpoolP160t1" -#define NID_brainpoolP160t1 922 -#define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L - -#define SN_brainpoolP192r1 "brainpoolP192r1" -#define NID_brainpoolP192r1 923 -#define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L - -#define SN_brainpoolP192t1 "brainpoolP192t1" -#define NID_brainpoolP192t1 924 -#define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L - -#define SN_brainpoolP224r1 "brainpoolP224r1" -#define NID_brainpoolP224r1 925 -#define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L - -#define SN_brainpoolP224t1 "brainpoolP224t1" -#define NID_brainpoolP224t1 926 -#define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L - -#define SN_brainpoolP256r1 "brainpoolP256r1" -#define NID_brainpoolP256r1 927 -#define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L - -#define SN_brainpoolP256t1 "brainpoolP256t1" -#define NID_brainpoolP256t1 928 -#define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L - -#define SN_brainpoolP320r1 "brainpoolP320r1" -#define NID_brainpoolP320r1 929 -#define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L - -#define SN_brainpoolP320t1 "brainpoolP320t1" -#define NID_brainpoolP320t1 930 -#define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L - -#define SN_brainpoolP384r1 "brainpoolP384r1" -#define NID_brainpoolP384r1 931 -#define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L - -#define SN_brainpoolP384t1 "brainpoolP384t1" -#define NID_brainpoolP384t1 932 -#define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L - -#define SN_brainpoolP512r1 "brainpoolP512r1" -#define NID_brainpoolP512r1 933 -#define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L - -#define SN_brainpoolP512t1 "brainpoolP512t1" -#define NID_brainpoolP512t1 934 -#define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L - -#define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L - -#define OBJ_secg_scheme OBJ_certicom_arc,1L - -#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" -#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 -#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L - -#define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" -#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 -#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L - -#define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" -#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 -#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L - -#define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" -#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 -#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L - -#define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" -#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 -#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L - -#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 -#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L - -#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 -#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L - -#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 -#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L - -#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 -#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L - -#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 -#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L - -#define SN_dh_std_kdf "dh-std-kdf" -#define NID_dh_std_kdf 946 - -#define SN_dh_cofactor_kdf "dh-cofactor-kdf" -#define NID_dh_cofactor_kdf 947 - -#define SN_ct_precert_scts "ct_precert_scts" -#define LN_ct_precert_scts "CT Precertificate SCTs" -#define NID_ct_precert_scts 951 -#define OBJ_ct_precert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,2L - -#define SN_ct_precert_poison "ct_precert_poison" -#define LN_ct_precert_poison "CT Precertificate Poison" -#define NID_ct_precert_poison 952 -#define OBJ_ct_precert_poison 1L,3L,6L,1L,4L,1L,11129L,2L,4L,3L - -#define SN_ct_precert_signer "ct_precert_signer" -#define LN_ct_precert_signer "CT Precertificate Signer" -#define NID_ct_precert_signer 953 -#define OBJ_ct_precert_signer 1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L - -#define SN_ct_cert_scts "ct_cert_scts" -#define LN_ct_cert_scts "CT Certificate SCTs" -#define NID_ct_cert_scts 954 -#define OBJ_ct_cert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L - -#define SN_jurisdictionLocalityName "jurisdictionL" -#define LN_jurisdictionLocalityName "jurisdictionLocalityName" -#define NID_jurisdictionLocalityName 955 -#define OBJ_jurisdictionLocalityName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,1L - -#define SN_jurisdictionStateOrProvinceName "jurisdictionST" -#define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" -#define NID_jurisdictionStateOrProvinceName 956 -#define OBJ_jurisdictionStateOrProvinceName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,2L - -#define SN_jurisdictionCountryName "jurisdictionC" -#define LN_jurisdictionCountryName "jurisdictionCountryName" -#define NID_jurisdictionCountryName 957 -#define OBJ_jurisdictionCountryName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,3L - -#define SN_id_scrypt "id-scrypt" -#define LN_id_scrypt "scrypt" -#define NID_id_scrypt 973 -#define OBJ_id_scrypt 1L,3L,6L,1L,4L,1L,11591L,4L,11L - -#define SN_tls1_prf "TLS1-PRF" -#define LN_tls1_prf "tls1-prf" -#define NID_tls1_prf 1021 - -#define SN_hkdf "HKDF" -#define LN_hkdf "hkdf" -#define NID_hkdf 1036 - -#define SN_id_pkinit "id-pkinit" -#define NID_id_pkinit 1031 -#define OBJ_id_pkinit 1L,3L,6L,1L,5L,2L,3L - -#define SN_pkInitClientAuth "pkInitClientAuth" -#define LN_pkInitClientAuth "PKINIT Client Auth" -#define NID_pkInitClientAuth 1032 -#define OBJ_pkInitClientAuth OBJ_id_pkinit,4L - -#define SN_pkInitKDC "pkInitKDC" -#define LN_pkInitKDC "Signing KDC Response" -#define NID_pkInitKDC 1033 -#define OBJ_pkInitKDC OBJ_id_pkinit,5L - -#define SN_X25519 "X25519" -#define NID_X25519 1034 -#define OBJ_X25519 1L,3L,101L,110L - -#define SN_X448 "X448" -#define NID_X448 1035 -#define OBJ_X448 1L,3L,101L,111L - -#define SN_ED25519 "ED25519" -#define NID_ED25519 1087 -#define OBJ_ED25519 1L,3L,101L,112L - -#define SN_ED448 "ED448" -#define NID_ED448 1088 -#define OBJ_ED448 1L,3L,101L,113L - -#define SN_kx_rsa "KxRSA" -#define LN_kx_rsa "kx-rsa" -#define NID_kx_rsa 1037 - -#define SN_kx_ecdhe "KxECDHE" -#define LN_kx_ecdhe "kx-ecdhe" -#define NID_kx_ecdhe 1038 - -#define SN_kx_dhe "KxDHE" -#define LN_kx_dhe "kx-dhe" -#define NID_kx_dhe 1039 - -#define SN_kx_ecdhe_psk "KxECDHE-PSK" -#define LN_kx_ecdhe_psk "kx-ecdhe-psk" -#define NID_kx_ecdhe_psk 1040 - -#define SN_kx_dhe_psk "KxDHE-PSK" -#define LN_kx_dhe_psk "kx-dhe-psk" -#define NID_kx_dhe_psk 1041 - -#define SN_kx_rsa_psk "KxRSA_PSK" -#define LN_kx_rsa_psk "kx-rsa-psk" -#define NID_kx_rsa_psk 1042 - -#define SN_kx_psk "KxPSK" -#define LN_kx_psk "kx-psk" -#define NID_kx_psk 1043 - -#define SN_kx_srp "KxSRP" -#define LN_kx_srp "kx-srp" -#define NID_kx_srp 1044 - -#define SN_kx_gost "KxGOST" -#define LN_kx_gost "kx-gost" -#define NID_kx_gost 1045 - -#define SN_kx_any "KxANY" -#define LN_kx_any "kx-any" -#define NID_kx_any 1063 - -#define SN_auth_rsa "AuthRSA" -#define LN_auth_rsa "auth-rsa" -#define NID_auth_rsa 1046 - -#define SN_auth_ecdsa "AuthECDSA" -#define LN_auth_ecdsa "auth-ecdsa" -#define NID_auth_ecdsa 1047 - -#define SN_auth_psk "AuthPSK" -#define LN_auth_psk "auth-psk" -#define NID_auth_psk 1048 - -#define SN_auth_dss "AuthDSS" -#define LN_auth_dss "auth-dss" -#define NID_auth_dss 1049 - -#define SN_auth_gost01 "AuthGOST01" -#define LN_auth_gost01 "auth-gost01" -#define NID_auth_gost01 1050 - -#define SN_auth_gost12 "AuthGOST12" -#define LN_auth_gost12 "auth-gost12" -#define NID_auth_gost12 1051 - -#define SN_auth_srp "AuthSRP" -#define LN_auth_srp "auth-srp" -#define NID_auth_srp 1052 - -#define SN_auth_null "AuthNULL" -#define LN_auth_null "auth-null" -#define NID_auth_null 1053 - -#define SN_auth_any "AuthANY" -#define LN_auth_any "auth-any" -#define NID_auth_any 1064 - -#define SN_poly1305 "Poly1305" -#define LN_poly1305 "poly1305" -#define NID_poly1305 1061 - -#define SN_siphash "SipHash" -#define LN_siphash "siphash" -#define NID_siphash 1062 - -#define SN_ffdhe2048 "ffdhe2048" -#define NID_ffdhe2048 1126 - -#define SN_ffdhe3072 "ffdhe3072" -#define NID_ffdhe3072 1127 - -#define SN_ffdhe4096 "ffdhe4096" -#define NID_ffdhe4096 1128 - -#define SN_ffdhe6144 "ffdhe6144" -#define NID_ffdhe6144 1129 - -#define SN_ffdhe8192 "ffdhe8192" -#define NID_ffdhe8192 1130 - -#define SN_ISO_UA "ISO-UA" -#define NID_ISO_UA 1150 -#define OBJ_ISO_UA OBJ_member_body,804L - -#define SN_ua_pki "ua-pki" -#define NID_ua_pki 1151 -#define OBJ_ua_pki OBJ_ISO_UA,2L,1L,1L,1L - -#define SN_dstu28147 "dstu28147" -#define LN_dstu28147 "DSTU Gost 28147-2009" -#define NID_dstu28147 1152 -#define OBJ_dstu28147 OBJ_ua_pki,1L,1L,1L - -#define SN_dstu28147_ofb "dstu28147-ofb" -#define LN_dstu28147_ofb "DSTU Gost 28147-2009 OFB mode" -#define NID_dstu28147_ofb 1153 -#define OBJ_dstu28147_ofb OBJ_dstu28147,2L - -#define SN_dstu28147_cfb "dstu28147-cfb" -#define LN_dstu28147_cfb "DSTU Gost 28147-2009 CFB mode" -#define NID_dstu28147_cfb 1154 -#define OBJ_dstu28147_cfb OBJ_dstu28147,3L - -#define SN_dstu28147_wrap "dstu28147-wrap" -#define LN_dstu28147_wrap "DSTU Gost 28147-2009 key wrap" -#define NID_dstu28147_wrap 1155 -#define OBJ_dstu28147_wrap OBJ_dstu28147,5L - -#define SN_hmacWithDstu34311 "hmacWithDstu34311" -#define LN_hmacWithDstu34311 "HMAC DSTU Gost 34311-95" -#define NID_hmacWithDstu34311 1156 -#define OBJ_hmacWithDstu34311 OBJ_ua_pki,1L,1L,2L - -#define SN_dstu34311 "dstu34311" -#define LN_dstu34311 "DSTU Gost 34311-95" -#define NID_dstu34311 1157 -#define OBJ_dstu34311 OBJ_ua_pki,1L,2L,1L - -#define SN_dstu4145le "dstu4145le" -#define LN_dstu4145le "DSTU 4145-2002 little endian" -#define NID_dstu4145le 1158 -#define OBJ_dstu4145le OBJ_ua_pki,1L,3L,1L,1L - -#define SN_dstu4145be "dstu4145be" -#define LN_dstu4145be "DSTU 4145-2002 big endian" -#define NID_dstu4145be 1159 -#define OBJ_dstu4145be OBJ_dstu4145le,1L,1L - -#define SN_uacurve0 "uacurve0" -#define LN_uacurve0 "DSTU curve 0" -#define NID_uacurve0 1160 -#define OBJ_uacurve0 OBJ_dstu4145le,2L,0L - -#define SN_uacurve1 "uacurve1" -#define LN_uacurve1 "DSTU curve 1" -#define NID_uacurve1 1161 -#define OBJ_uacurve1 OBJ_dstu4145le,2L,1L - -#define SN_uacurve2 "uacurve2" -#define LN_uacurve2 "DSTU curve 2" -#define NID_uacurve2 1162 -#define OBJ_uacurve2 OBJ_dstu4145le,2L,2L - -#define SN_uacurve3 "uacurve3" -#define LN_uacurve3 "DSTU curve 3" -#define NID_uacurve3 1163 -#define OBJ_uacurve3 OBJ_dstu4145le,2L,3L - -#define SN_uacurve4 "uacurve4" -#define LN_uacurve4 "DSTU curve 4" -#define NID_uacurve4 1164 -#define OBJ_uacurve4 OBJ_dstu4145le,2L,4L - -#define SN_uacurve5 "uacurve5" -#define LN_uacurve5 "DSTU curve 5" -#define NID_uacurve5 1165 -#define OBJ_uacurve5 OBJ_dstu4145le,2L,5L - -#define SN_uacurve6 "uacurve6" -#define LN_uacurve6 "DSTU curve 6" -#define NID_uacurve6 1166 -#define OBJ_uacurve6 OBJ_dstu4145le,2L,6L - -#define SN_uacurve7 "uacurve7" -#define LN_uacurve7 "DSTU curve 7" -#define NID_uacurve7 1167 -#define OBJ_uacurve7 OBJ_dstu4145le,2L,7L - -#define SN_uacurve8 "uacurve8" -#define LN_uacurve8 "DSTU curve 8" -#define NID_uacurve8 1168 -#define OBJ_uacurve8 OBJ_dstu4145le,2L,8L - -#define SN_uacurve9 "uacurve9" -#define LN_uacurve9 "DSTU curve 9" -#define NID_uacurve9 1169 -#define OBJ_uacurve9 OBJ_dstu4145le,2L,9L diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/objects.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/objects.h deleted file mode 100644 index 5e8b5762..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/objects.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 1995-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_OBJECTS_H -# define HEADER_OBJECTS_H - -# include -# include -# include -# include - -# define OBJ_NAME_TYPE_UNDEF 0x00 -# define OBJ_NAME_TYPE_MD_METH 0x01 -# define OBJ_NAME_TYPE_CIPHER_METH 0x02 -# define OBJ_NAME_TYPE_PKEY_METH 0x03 -# define OBJ_NAME_TYPE_COMP_METH 0x04 -# define OBJ_NAME_TYPE_NUM 0x05 - -# define OBJ_NAME_ALIAS 0x8000 - -# define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 -# define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct obj_name_st { - int type; - int alias; - const char *name; - const char *data; -} OBJ_NAME; - -# define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) - -int OBJ_NAME_init(void); -int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), - int (*cmp_func) (const char *, const char *), - void (*free_func) (const char *, int, const char *)); -const char *OBJ_NAME_get(const char *name, int type); -int OBJ_NAME_add(const char *name, int type, const char *data); -int OBJ_NAME_remove(const char *name, int type); -void OBJ_NAME_cleanup(int type); /* -1 for everything */ -void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), - void *arg); -void OBJ_NAME_do_all_sorted(int type, - void (*fn) (const OBJ_NAME *, void *arg), - void *arg); - -ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o); -ASN1_OBJECT *OBJ_nid2obj(int n); -const char *OBJ_nid2ln(int n); -const char *OBJ_nid2sn(int n); -int OBJ_obj2nid(const ASN1_OBJECT *o); -ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); -int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); -int OBJ_txt2nid(const char *s); -int OBJ_ln2nid(const char *s); -int OBJ_sn2nid(const char *s); -int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); -const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, - int (*cmp) (const void *, const void *)); -const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, - int size, - int (*cmp) (const void *, const void *), - int flags); - -# define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ - static int nm##_cmp(type1 const *, type2 const *); \ - scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) - -# define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ - _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) -# define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ - type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) - -/*- - * Unsolved problem: if a type is actually a pointer type, like - * nid_triple is, then its impossible to get a const where you need - * it. Consider: - * - * typedef int nid_triple[3]; - * const void *a_; - * const nid_triple const *a = a_; - * - * The assignment discards a const because what you really want is: - * - * const int const * const *a = a_; - * - * But if you do that, you lose the fact that a is an array of 3 ints, - * which breaks comparison functions. - * - * Thus we end up having to cast, sadly, or unpack the - * declarations. Or, as I finally did in this case, declare nid_triple - * to be a struct, which it should have been in the first place. - * - * Ben, August 2008. - * - * Also, strictly speaking not all types need be const, but handling - * the non-constness means a lot of complication, and in practice - * comparison routines do always not touch their arguments. - */ - -# define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ - { \ - type1 const *a = a_; \ - type2 const *b = b_; \ - return nm##_cmp(a,b); \ - } \ - static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ - { \ - return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ - nm##_cmp_BSEARCH_CMP_FN); \ - } \ - extern void dummy_prototype(void) - -# define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ - { \ - type1 const *a = a_; \ - type2 const *b = b_; \ - return nm##_cmp(a,b); \ - } \ - type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ - { \ - return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ - nm##_cmp_BSEARCH_CMP_FN); \ - } \ - extern void dummy_prototype(void) - -# define OBJ_bsearch(type1,key,type2,base,num,cmp) \ - ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ - num,sizeof(type2), \ - ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ - (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ - cmp##_BSEARCH_CMP_FN))) - -# define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ - ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ - num,sizeof(type2), \ - ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ - (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ - cmp##_BSEARCH_CMP_FN)),flags) - -int OBJ_new_nid(int num); -int OBJ_add_object(const ASN1_OBJECT *obj); -int OBJ_create(const char *oid, const char *sn, const char *ln); -#if OPENSSL_API_COMPAT < 0x10100000L -# define OBJ_cleanup() while(0) continue -#endif -int OBJ_create_objects(BIO *in); - -size_t OBJ_length(const ASN1_OBJECT *obj); -const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); - -int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); -int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); -int OBJ_add_sigid(int signid, int dig_id, int pkey_id); -void OBJ_sigid_free(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/objectserr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/objectserr.h deleted file mode 100644 index 02e166f1..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/objectserr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ocsp.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ocsp.h deleted file mode 100644 index 4d759a49..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ocsp.h +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright 2000-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_OCSP_H -# define HEADER_OCSP_H - -#include - -/* - * These definitions are outside the OPENSSL_NO_OCSP guard because although for - * historical reasons they have OCSP_* names, they can actually be used - * independently of OCSP. E.g. see RFC5280 - */ -/*- - * CRLReason ::= ENUMERATED { - * unspecified (0), - * keyCompromise (1), - * cACompromise (2), - * affiliationChanged (3), - * superseded (4), - * cessationOfOperation (5), - * certificateHold (6), - * removeFromCRL (8) } - */ -# define OCSP_REVOKED_STATUS_NOSTATUS -1 -# define OCSP_REVOKED_STATUS_UNSPECIFIED 0 -# define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 -# define OCSP_REVOKED_STATUS_CACOMPROMISE 2 -# define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 -# define OCSP_REVOKED_STATUS_SUPERSEDED 4 -# define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 -# define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 -# define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 - - -# ifndef OPENSSL_NO_OCSP - -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Various flags and values */ - -# define OCSP_DEFAULT_NONCE_LENGTH 16 - -# define OCSP_NOCERTS 0x1 -# define OCSP_NOINTERN 0x2 -# define OCSP_NOSIGS 0x4 -# define OCSP_NOCHAIN 0x8 -# define OCSP_NOVERIFY 0x10 -# define OCSP_NOEXPLICIT 0x20 -# define OCSP_NOCASIGN 0x40 -# define OCSP_NODELEGATED 0x80 -# define OCSP_NOCHECKS 0x100 -# define OCSP_TRUSTOTHER 0x200 -# define OCSP_RESPID_KEY 0x400 -# define OCSP_NOTIME 0x800 - -typedef struct ocsp_cert_id_st OCSP_CERTID; - -DEFINE_STACK_OF(OCSP_CERTID) - -typedef struct ocsp_one_request_st OCSP_ONEREQ; - -DEFINE_STACK_OF(OCSP_ONEREQ) - -typedef struct ocsp_req_info_st OCSP_REQINFO; -typedef struct ocsp_signature_st OCSP_SIGNATURE; -typedef struct ocsp_request_st OCSP_REQUEST; - -# define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 -# define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 -# define OCSP_RESPONSE_STATUS_INTERNALERROR 2 -# define OCSP_RESPONSE_STATUS_TRYLATER 3 -# define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 -# define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 - -typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES; - -# define V_OCSP_RESPID_NAME 0 -# define V_OCSP_RESPID_KEY 1 - -DEFINE_STACK_OF(OCSP_RESPID) - -typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO; - -# define V_OCSP_CERTSTATUS_GOOD 0 -# define V_OCSP_CERTSTATUS_REVOKED 1 -# define V_OCSP_CERTSTATUS_UNKNOWN 2 - -typedef struct ocsp_cert_status_st OCSP_CERTSTATUS; -typedef struct ocsp_single_response_st OCSP_SINGLERESP; - -DEFINE_STACK_OF(OCSP_SINGLERESP) - -typedef struct ocsp_response_data_st OCSP_RESPDATA; - -typedef struct ocsp_basic_response_st OCSP_BASICRESP; - -typedef struct ocsp_crl_id_st OCSP_CRLID; -typedef struct ocsp_service_locator_st OCSP_SERVICELOC; - -# define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" -# define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" - -# define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) - -# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) - -# define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ - (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST, \ - bp,(char **)(x),cb,NULL) - -# define PEM_read_bio_OCSP_RESPONSE(bp,x,cb) (OCSP_RESPONSE *)PEM_ASN1_read_bio(\ - (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE, \ - bp,(char **)(x),cb,NULL) - -# define PEM_write_bio_OCSP_REQUEST(bp,o) \ - PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ - bp,(char *)(o), NULL,NULL,0,NULL,NULL) - -# define PEM_write_bio_OCSP_RESPONSE(bp,o) \ - PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ - bp,(char *)(o), NULL,NULL,0,NULL,NULL) - -# define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) - -# define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) - -# define ASN1_BIT_STRING_digest(data,type,md,len) \ - ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) - -# define OCSP_CERTSTATUS_dup(cs)\ - (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ - (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) - -OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); - -OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); -OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, - int maxline); -int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx); -int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); -OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline); -void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); -void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); -int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, - ASN1_VALUE *val); -int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval, - const ASN1_ITEM *it); -BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx); -int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path); -int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); -int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, - const char *name, const char *value); - -OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject, - const X509 *issuer); - -OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, - const X509_NAME *issuerName, - const ASN1_BIT_STRING *issuerKey, - const ASN1_INTEGER *serialNumber); - -OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); - -int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); -int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); -int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); -int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); - -int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); -int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); - -int OCSP_request_sign(OCSP_REQUEST *req, - X509 *signer, - EVP_PKEY *key, - const EVP_MD *dgst, - STACK_OF(X509) *certs, unsigned long flags); - -int OCSP_response_status(OCSP_RESPONSE *resp); -OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); - -const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs); -const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs); -const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs); -int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, - STACK_OF(X509) *extra_certs); - -int OCSP_resp_count(OCSP_BASICRESP *bs); -OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); -const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP* bs); -const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs); -int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, - const ASN1_OCTET_STRING **pid, - const X509_NAME **pname); -int OCSP_resp_get1_id(const OCSP_BASICRESP *bs, - ASN1_OCTET_STRING **pid, - X509_NAME **pname); - -int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); -int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, - ASN1_GENERALIZEDTIME **revtime, - ASN1_GENERALIZEDTIME **thisupd, - ASN1_GENERALIZEDTIME **nextupd); -int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, - int *reason, - ASN1_GENERALIZEDTIME **revtime, - ASN1_GENERALIZEDTIME **thisupd, - ASN1_GENERALIZEDTIME **nextupd); -int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, - ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); - -int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, - X509_STORE *store, unsigned long flags); - -int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, - int *pssl); - -int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); -int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); - -int OCSP_request_onereq_count(OCSP_REQUEST *req); -OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); -OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); -int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, - ASN1_OCTET_STRING **pikeyHash, - ASN1_INTEGER **pserial, OCSP_CERTID *cid); -int OCSP_request_is_signed(OCSP_REQUEST *req); -OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); -OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, - OCSP_CERTID *cid, - int status, int reason, - ASN1_TIME *revtime, - ASN1_TIME *thisupd, - ASN1_TIME *nextupd); -int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); -int OCSP_basic_sign(OCSP_BASICRESP *brsp, - X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, - STACK_OF(X509) *certs, unsigned long flags); -int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, - X509 *signer, EVP_MD_CTX *ctx, - STACK_OF(X509) *certs, unsigned long flags); -int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert); -int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert); -int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert); - -X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim); - -X509_EXTENSION *OCSP_accept_responses_new(char **oids); - -X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); - -X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, const char **urls); - -int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); -int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); -int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); -X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); -X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); -void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, - int *idx); -int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, - unsigned long flags); -int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); - -int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); -int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); -int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos); -int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); -X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); -X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); -void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); -int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, - unsigned long flags); -int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); - -int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); -int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); -int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, - int lastpos); -X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); -X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); -void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, - int *idx); -int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, - int crit, unsigned long flags); -int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); - -int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); -int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); -int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, - int lastpos); -X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); -X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); -void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, - int *idx); -int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, - int crit, unsigned long flags); -int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); -const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x); - -DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) -DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) -DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) -DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) -DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) -DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) -DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) -DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) -DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) -DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) -DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) - -const char *OCSP_response_status_str(long s); -const char *OCSP_cert_status_str(long s); -const char *OCSP_crl_reason_str(long s); - -int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); -int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); - -int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, - X509_STORE *st, unsigned long flags); - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ocsperr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ocsperr.h deleted file mode 100644 index 8dd9e01a..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ocsperr.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/opensslconf.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/opensslconf.h deleted file mode 100644 index e4c111ae..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/opensslconf.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * WARNING: do not edit! - * Generated by Makefile from include/openssl/opensslconf.h.in - * - * 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 - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef OPENSSL_ALGORITHM_DEFINES -# error OPENSSL_ALGORITHM_DEFINES no longer supported -#endif - -/* - * OpenSSL was configured with the following options: - */ - -#ifndef OPENSSL_NO_MD2 -# define OPENSSL_NO_MD2 -#endif -#ifndef OPENSSL_NO_RC5 -# define OPENSSL_NO_RC5 -#endif -#ifndef OPENSSL_THREADS -# define OPENSSL_THREADS -#endif -#ifndef OPENSSL_RAND_SEED_OS -# define OPENSSL_RAND_SEED_OS -#endif -#ifndef OPENSSL_NO_AFALGENG -# define OPENSSL_NO_AFALGENG -#endif -#ifndef OPENSSL_NO_ASAN -# define OPENSSL_NO_ASAN -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG -# define OPENSSL_NO_CRYPTO_MDEBUG -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -#endif -#ifndef OPENSSL_NO_DEVCRYPTOENG -# define OPENSSL_NO_DEVCRYPTOENG -#endif -#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -# define OPENSSL_NO_EC_NISTP_64_GCC_128 -#endif -#ifndef OPENSSL_NO_EGD -# define OPENSSL_NO_EGD -#endif -#ifndef OPENSSL_NO_EXTERNAL_TESTS -# define OPENSSL_NO_EXTERNAL_TESTS -#endif -#ifndef OPENSSL_NO_FUZZ_AFL -# define OPENSSL_NO_FUZZ_AFL -#endif -#ifndef OPENSSL_NO_FUZZ_LIBFUZZER -# define OPENSSL_NO_FUZZ_LIBFUZZER -#endif -#ifndef OPENSSL_NO_HEARTBEATS -# define OPENSSL_NO_HEARTBEATS -#endif -#ifndef OPENSSL_NO_MSAN -# define OPENSSL_NO_MSAN -#endif -#ifndef OPENSSL_NO_SCTP -# define OPENSSL_NO_SCTP -#endif -#ifndef OPENSSL_NO_SSL_TRACE -# define OPENSSL_NO_SSL_TRACE -#endif -#ifndef OPENSSL_NO_SSL3 -# define OPENSSL_NO_SSL3 -#endif -#ifndef OPENSSL_NO_SSL3_METHOD -# define OPENSSL_NO_SSL3_METHOD -#endif -#ifndef OPENSSL_NO_UBSAN -# define OPENSSL_NO_UBSAN -#endif -#ifndef OPENSSL_NO_UNIT_TEST -# define OPENSSL_NO_UNIT_TEST -#endif -#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS -# define OPENSSL_NO_WEAK_SSL_CIPHERS -#endif -#ifndef OPENSSL_NO_STATIC_ENGINE -# define OPENSSL_NO_STATIC_ENGINE -#endif - - -/* - * 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= to suppress the - * declarations of functions deprecated in or before . 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 -# 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? */ -#undef I386_ONLY - -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* - * The following are cipher-specific, but are part of the public API. - */ -#if !defined(OPENSSL_SYS_UEFI) -# define BN_LLONG -/* Only one for the following should be defined */ -# undef SIXTY_FOUR_BIT_LONG -# undef SIXTY_FOUR_BIT -# define THIRTY_TWO_BIT -#endif - -#define RC4_INT unsigned char - -#ifdef __cplusplus -} -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/opensslv.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/opensslv.h deleted file mode 100644 index 17d271f5..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/opensslv.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 1999-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_OPENSSLV_H -# define HEADER_OPENSSLV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*- - * Numeric release version identifier: - * MNNFFPPS: major minor fix patch status - * The status nibble has one of the values 0 for development, 1 to e for betas - * 1 to 14, and f for release. The patch level is exactly that. - * For example: - * 0.9.3-dev 0x00903000 - * 0.9.3-beta1 0x00903001 - * 0.9.3-beta2-dev 0x00903002 - * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) - * 0.9.3 0x0090300f - * 0.9.3a 0x0090301f - * 0.9.4 0x0090400f - * 1.2.3z 0x102031af - * - * For continuity reasons (because 0.9.5 is already out, and is coded - * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level - * part is slightly different, by setting the highest bit. This means - * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start - * with 0x0090600S... - * - * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) - * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for - * major minor fix final patch/beta) - */ -# define OPENSSL_VERSION_NUMBER 0x1010107fL -# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1g 21 Apr 2020" - -/*- - * The macros below are to be used for shared library (.so, .dll, ...) - * versioning. That kind of versioning works a bit differently between - * operating systems. The most usual scheme is to set a major and a minor - * number, and have the runtime loader check that the major number is equal - * to what it was at application link time, while the minor number has to - * be greater or equal to what it was at application link time. With this - * scheme, the version number is usually part of the file name, like this: - * - * libcrypto.so.0.9 - * - * Some unixen also make a softlink with the major version number only: - * - * libcrypto.so.0 - * - * On Tru64 and IRIX 6.x it works a little bit differently. There, the - * shared library version is stored in the file, and is actually a series - * of versions, separated by colons. The rightmost version present in the - * library when linking an application is stored in the application to be - * matched at run time. When the application is run, a check is done to - * see if the library version stored in the application matches any of the - * versions in the version string of the library itself. - * This version string can be constructed in any way, depending on what - * kind of matching is desired. However, to implement the same scheme as - * the one used in the other unixen, all compatible versions, from lowest - * to highest, should be part of the string. Consecutive builds would - * give the following versions strings: - * - * 3.0 - * 3.0:3.1 - * 3.0:3.1:3.2 - * 4.0 - * 4.0:4.1 - * - * Notice how version 4 is completely incompatible with version, and - * therefore give the breach you can see. - * - * There may be other schemes as well that I haven't yet discovered. - * - * So, here's the way it works here: first of all, the library version - * number doesn't need at all to match the overall OpenSSL version. - * However, it's nice and more understandable if it actually does. - * The current library version is stored in the macro SHLIB_VERSION_NUMBER, - * which is just a piece of text in the format "M.m.e" (Major, minor, edit). - * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, - * we need to keep a history of version numbers, which is done in the - * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and - * should only keep the versions that are binary compatible with the current. - */ -# define SHLIB_VERSION_HISTORY "" -# define SHLIB_VERSION_NUMBER "1.1" - - -#ifdef __cplusplus -} -#endif -#endif /* HEADER_OPENSSLV_H */ diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ossl_typ.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ossl_typ.h deleted file mode 100644 index e0edfaaf..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ossl_typ.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2001-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_OPENSSL_TYPES_H -# define HEADER_OPENSSL_TYPES_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -# include - -# ifdef NO_ASN1_TYPEDEFS -# define ASN1_INTEGER ASN1_STRING -# define ASN1_ENUMERATED ASN1_STRING -# define ASN1_BIT_STRING ASN1_STRING -# define ASN1_OCTET_STRING ASN1_STRING -# define ASN1_PRINTABLESTRING ASN1_STRING -# define ASN1_T61STRING ASN1_STRING -# define ASN1_IA5STRING ASN1_STRING -# define ASN1_UTCTIME ASN1_STRING -# define ASN1_GENERALIZEDTIME ASN1_STRING -# define ASN1_TIME ASN1_STRING -# define ASN1_GENERALSTRING ASN1_STRING -# define ASN1_UNIVERSALSTRING ASN1_STRING -# define ASN1_BMPSTRING ASN1_STRING -# define ASN1_VISIBLESTRING ASN1_STRING -# define ASN1_UTF8STRING ASN1_STRING -# define ASN1_BOOLEAN int -# define ASN1_NULL int -# else -typedef struct asn1_string_st ASN1_INTEGER; -typedef struct asn1_string_st ASN1_ENUMERATED; -typedef struct asn1_string_st ASN1_BIT_STRING; -typedef struct asn1_string_st ASN1_OCTET_STRING; -typedef struct asn1_string_st ASN1_PRINTABLESTRING; -typedef struct asn1_string_st ASN1_T61STRING; -typedef struct asn1_string_st ASN1_IA5STRING; -typedef struct asn1_string_st ASN1_GENERALSTRING; -typedef struct asn1_string_st ASN1_UNIVERSALSTRING; -typedef struct asn1_string_st ASN1_BMPSTRING; -typedef struct asn1_string_st ASN1_UTCTIME; -typedef struct asn1_string_st ASN1_TIME; -typedef struct asn1_string_st ASN1_GENERALIZEDTIME; -typedef struct asn1_string_st ASN1_VISIBLESTRING; -typedef struct asn1_string_st ASN1_UTF8STRING; -typedef struct asn1_string_st ASN1_STRING; -typedef int ASN1_BOOLEAN; -typedef int ASN1_NULL; -# endif - -typedef struct asn1_object_st ASN1_OBJECT; - -typedef struct ASN1_ITEM_st ASN1_ITEM; -typedef struct asn1_pctx_st ASN1_PCTX; -typedef struct asn1_sctx_st ASN1_SCTX; - -# ifdef _WIN32 -# undef X509_NAME -# undef X509_EXTENSIONS -# undef PKCS7_ISSUER_AND_SERIAL -# undef PKCS7_SIGNER_INFO -# undef OCSP_REQUEST -# undef OCSP_RESPONSE -# endif - -# ifdef BIGNUM -# undef BIGNUM -# endif -struct dane_st; -typedef struct bio_st BIO; -typedef struct bignum_st BIGNUM; -typedef struct bignum_ctx BN_CTX; -typedef struct bn_blinding_st BN_BLINDING; -typedef struct bn_mont_ctx_st BN_MONT_CTX; -typedef struct bn_recp_ctx_st BN_RECP_CTX; -typedef struct bn_gencb_st BN_GENCB; - -typedef struct buf_mem_st BUF_MEM; - -typedef struct evp_cipher_st EVP_CIPHER; -typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; -typedef struct evp_md_st EVP_MD; -typedef struct evp_md_ctx_st EVP_MD_CTX; -typedef struct evp_pkey_st EVP_PKEY; - -typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; - -typedef struct evp_pkey_method_st EVP_PKEY_METHOD; -typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; - -typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; - -typedef struct hmac_ctx_st HMAC_CTX; - -typedef struct dh_st DH; -typedef struct dh_method DH_METHOD; - -typedef struct dsa_st DSA; -typedef struct dsa_method DSA_METHOD; - -typedef struct rsa_st RSA; -typedef struct rsa_meth_st RSA_METHOD; -typedef struct rsa_pss_params_st RSA_PSS_PARAMS; - -typedef struct ec_key_st EC_KEY; -typedef struct ec_key_method_st EC_KEY_METHOD; - -typedef struct rand_meth_st RAND_METHOD; -typedef struct rand_drbg_st RAND_DRBG; - -typedef struct ssl_dane_st SSL_DANE; -typedef struct x509_st X509; -typedef struct X509_algor_st X509_ALGOR; -typedef struct X509_crl_st X509_CRL; -typedef struct x509_crl_method_st X509_CRL_METHOD; -typedef struct x509_revoked_st X509_REVOKED; -typedef struct X509_name_st X509_NAME; -typedef struct X509_pubkey_st X509_PUBKEY; -typedef struct x509_store_st X509_STORE; -typedef struct x509_store_ctx_st X509_STORE_CTX; - -typedef struct x509_object_st X509_OBJECT; -typedef struct x509_lookup_st X509_LOOKUP; -typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; -typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; - -typedef struct x509_sig_info_st X509_SIG_INFO; - -typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; - -typedef struct v3_ext_ctx X509V3_CTX; -typedef struct conf_st CONF; -typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS; - -typedef struct ui_st UI; -typedef struct ui_method_st UI_METHOD; - -typedef struct engine_st ENGINE; -typedef struct ssl_st SSL; -typedef struct ssl_ctx_st SSL_CTX; - -typedef struct comp_ctx_st COMP_CTX; -typedef struct comp_method_st COMP_METHOD; - -typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; -typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; -typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; -typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; - -typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; -typedef struct DIST_POINT_st DIST_POINT; -typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; -typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; - -typedef struct crypto_ex_data_st CRYPTO_EX_DATA; - -typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; -typedef struct ocsp_response_st OCSP_RESPONSE; -typedef struct ocsp_responder_id_st OCSP_RESPID; - -typedef struct sct_st SCT; -typedef struct sct_ctx_st SCT_CTX; -typedef struct ctlog_st CTLOG; -typedef struct ctlog_store_st CTLOG_STORE; -typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX; - -typedef struct ossl_store_info_st OSSL_STORE_INFO; -typedef struct ossl_store_search_st OSSL_STORE_SEARCH; - -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ - defined(INTMAX_MAX) && defined(UINTMAX_MAX) -typedef intmax_t ossl_intmax_t; -typedef uintmax_t ossl_uintmax_t; -#else -/* - * Not long long, because the C-library can only be expected to provide - * strtoll(), strtoull() at the same time as intmax_t and strtoimax(), - * strtoumax(). Since we use these for parsing arguments, we need the - * conversion functions, not just the sizes. - */ -typedef long ossl_intmax_t; -typedef unsigned long ossl_uintmax_t; -#endif - -#ifdef __cplusplus -} -#endif -#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pem.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pem.h deleted file mode 100644 index 2ef5b5d0..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pem.h +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright 1995-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_PEM_H -# define HEADER_PEM_H - -# include -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define PEM_BUFSIZE 1024 - -# define PEM_STRING_X509_OLD "X509 CERTIFICATE" -# define PEM_STRING_X509 "CERTIFICATE" -# define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" -# define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" -# define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" -# define PEM_STRING_X509_CRL "X509 CRL" -# define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" -# define PEM_STRING_PUBLIC "PUBLIC KEY" -# define PEM_STRING_RSA "RSA PRIVATE KEY" -# define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" -# define PEM_STRING_DSA "DSA PRIVATE KEY" -# define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" -# define PEM_STRING_PKCS7 "PKCS7" -# define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" -# define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" -# define PEM_STRING_PKCS8INF "PRIVATE KEY" -# define PEM_STRING_DHPARAMS "DH PARAMETERS" -# define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" -# define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" -# define PEM_STRING_DSAPARAMS "DSA PARAMETERS" -# define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" -# define PEM_STRING_ECPARAMETERS "EC PARAMETERS" -# define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" -# define PEM_STRING_PARAMETERS "PARAMETERS" -# define PEM_STRING_CMS "CMS" - -# define PEM_TYPE_ENCRYPTED 10 -# define PEM_TYPE_MIC_ONLY 20 -# define PEM_TYPE_MIC_CLEAR 30 -# define PEM_TYPE_CLEAR 40 - -/* - * These macros make the PEM_read/PEM_write functions easier to maintain and - * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or - * IMPLEMENT_PEM_rw_cb(...) - */ - -# ifdef OPENSSL_NO_STDIO - -# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ -# else - -# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ -type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ -{ \ -return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ -} - -# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x) \ -{ \ -return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, const type *x) \ -{ \ -return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, \ - void *u) \ - { \ - return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, \ - void *u) \ - { \ - return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ - } - -# endif - -# define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ -type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ -{ \ -return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ -} - -# define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x) \ -{ \ -return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, const type *x) \ -{ \ -return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ - { \ - return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ - { \ - return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write(name, type, str, asn1) \ - IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_write_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_read_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb(name, type, str, asn1) - -/* These are the same except they are for the declarations */ - -# if defined(OPENSSL_NO_STDIO) - -# define DECLARE_PEM_read_fp(name, type) /**/ -# define DECLARE_PEM_write_fp(name, type) /**/ -# define DECLARE_PEM_write_fp_const(name, type) /**/ -# define DECLARE_PEM_write_cb_fp(name, type) /**/ -# else - -# define DECLARE_PEM_read_fp(name, type) \ - type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write_fp(name, type) \ - int PEM_write_##name(FILE *fp, type *x); - -# define DECLARE_PEM_write_fp_const(name, type) \ - int PEM_write_##name(FILE *fp, const type *x); - -# define DECLARE_PEM_write_cb_fp(name, type) \ - int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u); - -# endif - -# define DECLARE_PEM_read_bio(name, type) \ - type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write_bio(name, type) \ - int PEM_write_bio_##name(BIO *bp, type *x); - -# define DECLARE_PEM_write_bio_const(name, type) \ - int PEM_write_bio_##name(BIO *bp, const type *x); - -# define DECLARE_PEM_write_cb_bio(name, type) \ - int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write(name, type) \ - DECLARE_PEM_write_bio(name, type) \ - DECLARE_PEM_write_fp(name, type) -# define DECLARE_PEM_write_const(name, type) \ - DECLARE_PEM_write_bio_const(name, type) \ - DECLARE_PEM_write_fp_const(name, type) -# define DECLARE_PEM_write_cb(name, type) \ - DECLARE_PEM_write_cb_bio(name, type) \ - DECLARE_PEM_write_cb_fp(name, type) -# define DECLARE_PEM_read(name, type) \ - DECLARE_PEM_read_bio(name, type) \ - DECLARE_PEM_read_fp(name, type) -# define DECLARE_PEM_rw(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write(name, type) -# define DECLARE_PEM_rw_const(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write_const(name, type) -# define DECLARE_PEM_rw_cb(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write_cb(name, type) -typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); - -int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); -int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, - pem_password_cb *callback, void *u); - -int PEM_read_bio(BIO *bp, char **name, char **header, - unsigned char **data, long *len); -# define PEM_FLAG_SECURE 0x1 -# define PEM_FLAG_EAY_COMPATIBLE 0x2 -# define PEM_FLAG_ONLY_B64 0x4 -int PEM_read_bio_ex(BIO *bp, char **name, char **header, - unsigned char **data, long *len, unsigned int flags); -int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, - const char *name, BIO *bp, pem_password_cb *cb, - void *u); -int PEM_write_bio(BIO *bp, const char *name, const char *hdr, - const unsigned char *data, long len); -int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, - const char *name, BIO *bp, pem_password_cb *cb, - void *u); -void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, - pem_password_cb *cb, void *u); -int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, - const EVP_CIPHER *enc, unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - -STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u); -int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cd, void *u); - -#ifndef OPENSSL_NO_STDIO -int PEM_read(FILE *fp, char **name, char **header, - unsigned char **data, long *len); -int PEM_write(FILE *fp, const char *name, const char *hdr, - const unsigned char *data, long len); -void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, - pem_password_cb *cb, void *u); -int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, - void *x, const EVP_CIPHER *enc, unsigned char *kstr, - int klen, pem_password_cb *callback, void *u); -STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u); -#endif - -int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); -int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); -int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, - unsigned int *siglen, EVP_PKEY *pkey); - -/* The default pem_password_cb that's used internally */ -int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); -void PEM_proc_type(char *buf, int type); -void PEM_dek_info(char *buf, const char *type, int len, char *str); - -# include - -DECLARE_PEM_rw(X509, X509) -DECLARE_PEM_rw(X509_AUX, X509) -DECLARE_PEM_rw(X509_REQ, X509_REQ) -DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) -DECLARE_PEM_rw(X509_CRL, X509_CRL) -DECLARE_PEM_rw(PKCS7, PKCS7) -DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) -DECLARE_PEM_rw(PKCS8, X509_SIG) -DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) -# ifndef OPENSSL_NO_RSA -DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) -DECLARE_PEM_rw_const(RSAPublicKey, RSA) -DECLARE_PEM_rw(RSA_PUBKEY, RSA) -# endif -# ifndef OPENSSL_NO_DSA -DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) -DECLARE_PEM_rw(DSA_PUBKEY, DSA) -DECLARE_PEM_rw_const(DSAparams, DSA) -# endif -# ifndef OPENSSL_NO_EC -DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) -DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) -DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) -# endif -# ifndef OPENSSL_NO_DH -DECLARE_PEM_rw_const(DHparams, DH) -DECLARE_PEM_write_const(DHxparams, DH) -# endif -DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) -DECLARE_PEM_rw(PUBKEY, EVP_PKEY) - -int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, - const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - -int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, - char *, int, pem_password_cb *, void *); -int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, - void *u); - -# ifndef OPENSSL_NO_STDIO -int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); - -EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, - void *u); - -int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, pem_password_cb *cd, - void *u); -# endif -EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); -int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); - -# ifndef OPENSSL_NO_DSA -EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); -EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); -EVP_PKEY *b2i_PrivateKey_bio(BIO *in); -EVP_PKEY *b2i_PublicKey_bio(BIO *in); -int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); -int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); -# ifndef OPENSSL_NO_RC4 -EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); -int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, - pem_password_cb *cb, void *u); -# endif -# endif - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pem2.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pem2.h deleted file mode 100644 index 038fe790..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pem2.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 1999-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_PEM2_H -# define HEADER_PEM2_H -# include -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pemerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pemerr.h deleted file mode 100644 index 0c45918f..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pemerr.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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_PEMERR_H -# define HEADER_PEMERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PEM_strings(void); - -/* - * PEM function codes. - */ -# define PEM_F_B2I_DSS 127 -# define PEM_F_B2I_PVK_BIO 128 -# define PEM_F_B2I_RSA 129 -# define PEM_F_CHECK_BITLEN_DSA 130 -# define PEM_F_CHECK_BITLEN_RSA 131 -# define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 -# define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 -# define PEM_F_DO_B2I 132 -# define PEM_F_DO_B2I_BIO 133 -# define PEM_F_DO_BLOB_HEADER 134 -# define PEM_F_DO_I2B 146 -# define PEM_F_DO_PK8PKEY 126 -# define PEM_F_DO_PK8PKEY_FP 125 -# define PEM_F_DO_PVK_BODY 135 -# define PEM_F_DO_PVK_HEADER 136 -# define PEM_F_GET_HEADER_AND_DATA 143 -# define PEM_F_GET_NAME 144 -# define PEM_F_I2B_PVK 137 -# define PEM_F_I2B_PVK_BIO 138 -# define PEM_F_LOAD_IV 101 -# define PEM_F_PEM_ASN1_READ 102 -# define PEM_F_PEM_ASN1_READ_BIO 103 -# define PEM_F_PEM_ASN1_WRITE 104 -# define PEM_F_PEM_ASN1_WRITE_BIO 105 -# define PEM_F_PEM_DEF_CALLBACK 100 -# define PEM_F_PEM_DO_HEADER 106 -# define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 -# define PEM_F_PEM_READ 108 -# define PEM_F_PEM_READ_BIO 109 -# define PEM_F_PEM_READ_BIO_DHPARAMS 141 -# define PEM_F_PEM_READ_BIO_EX 145 -# define PEM_F_PEM_READ_BIO_PARAMETERS 140 -# define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 -# define PEM_F_PEM_READ_DHPARAMS 142 -# define PEM_F_PEM_READ_PRIVATEKEY 124 -# define PEM_F_PEM_SIGNFINAL 112 -# define PEM_F_PEM_WRITE 113 -# define PEM_F_PEM_WRITE_BIO 114 -# define PEM_F_PEM_WRITE_PRIVATEKEY 139 -# define PEM_F_PEM_X509_INFO_READ 115 -# define PEM_F_PEM_X509_INFO_READ_BIO 116 -# define PEM_F_PEM_X509_INFO_WRITE_BIO 117 - -/* - * PEM reason codes. - */ -# define PEM_R_BAD_BASE64_DECODE 100 -# define PEM_R_BAD_DECRYPT 101 -# define PEM_R_BAD_END_LINE 102 -# define PEM_R_BAD_IV_CHARS 103 -# define PEM_R_BAD_MAGIC_NUMBER 116 -# define PEM_R_BAD_PASSWORD_READ 104 -# define PEM_R_BAD_VERSION_NUMBER 117 -# define PEM_R_BIO_WRITE_FAILURE 118 -# define PEM_R_CIPHER_IS_NULL 127 -# define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 -# define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 -# define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 -# define PEM_R_HEADER_TOO_LONG 128 -# define PEM_R_INCONSISTENT_HEADER 121 -# define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 -# define PEM_R_KEYBLOB_TOO_SHORT 123 -# define PEM_R_MISSING_DEK_IV 129 -# define PEM_R_NOT_DEK_INFO 105 -# define PEM_R_NOT_ENCRYPTED 106 -# define PEM_R_NOT_PROC_TYPE 107 -# define PEM_R_NO_START_LINE 108 -# define PEM_R_PROBLEMS_GETTING_PASSWORD 109 -# define PEM_R_PVK_DATA_TOO_SHORT 124 -# define PEM_R_PVK_TOO_SHORT 125 -# define PEM_R_READ_KEY 111 -# define PEM_R_SHORT_HEADER 112 -# define PEM_R_UNEXPECTED_DEK_IV 130 -# define PEM_R_UNSUPPORTED_CIPHER 113 -# define PEM_R_UNSUPPORTED_ENCRYPTION 114 -# define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs12.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs12.h deleted file mode 100644 index 3f43dad6..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs12.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 1999-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_PKCS12_H -# define HEADER_PKCS12_H - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define PKCS12_KEY_ID 1 -# define PKCS12_IV_ID 2 -# define PKCS12_MAC_ID 3 - -/* Default iteration count */ -# ifndef PKCS12_DEFAULT_ITER -# define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER -# endif - -# define PKCS12_MAC_KEY_LENGTH 20 - -# define PKCS12_SALT_LEN 8 - -/* It's not clear if these are actually needed... */ -# define PKCS12_key_gen PKCS12_key_gen_utf8 -# define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8 - -/* MS key usage constants */ - -# define KEY_EX 0x10 -# define KEY_SIG 0x80 - -typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; - -typedef struct PKCS12_st PKCS12; - -typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; - -DEFINE_STACK_OF(PKCS12_SAFEBAG) - -typedef struct pkcs12_bag_st PKCS12_BAGS; - -# define PKCS12_ERROR 0 -# define PKCS12_OK 1 - -/* Compatibility macros */ - -#if OPENSSL_API_COMPAT < 0x10100000L - -# define M_PKCS12_bag_type PKCS12_bag_type -# define M_PKCS12_cert_bag_type PKCS12_cert_bag_type -# define M_PKCS12_crl_bag_type PKCS12_cert_bag_type - -# define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert -# define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl -# define PKCS12_bag_type PKCS12_SAFEBAG_get_nid -# define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid -# define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert -# define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl -# define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf -# define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt - -#endif - -DEPRECATEDIN_1_1_0(ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, int attr_nid)) - -ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid); -int PKCS12_mac_present(const PKCS12 *p12); -void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, - const X509_ALGOR **pmacalg, - const ASN1_OCTET_STRING **psalt, - const ASN1_INTEGER **piter, - const PKCS12 *p12); - -const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, - int attr_nid); -const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); -int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag); -int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag); - -X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag); -X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag); -const STACK_OF(PKCS12_SAFEBAG) * -PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); -const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag); -const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag); - -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, - const char *pass, - int passlen, - unsigned char *salt, - int saltlen, int iter, - PKCS8_PRIV_KEY_INFO *p8inf); - -PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, - int nid1, int nid2); -PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, - int passlen); -PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag, - const char *pass, int passlen); -X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, - const char *pass, int passlen, unsigned char *salt, - int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); -X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen, - PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe); -PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); -STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); -PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, - unsigned char *salt, int saltlen, int iter, - STACK_OF(PKCS12_SAFEBAG) *bags); -STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, - int passlen); - -int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); -STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12); - -int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, - int namelen); -int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, - const unsigned char *name, int namelen); -int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); -ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, - int attr_nid); -char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); -const STACK_OF(X509_ATTRIBUTE) * -PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag); -unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, - const char *pass, int passlen, - const unsigned char *in, int inlen, - unsigned char **data, int *datalen, - int en_de); -void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, - const char *pass, int passlen, - const ASN1_OCTET_STRING *oct, int zbuf); -ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, - const ASN1_ITEM *it, - const char *pass, int passlen, - void *obj, int zbuf); -PKCS12 *PKCS12_init(int mode); -int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md_type, int en_de); -int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, - unsigned char *mac, unsigned int *maclen); -int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); -int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, - unsigned char *salt, int saltlen, int iter, - const EVP_MD *md_type); -int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, - int saltlen, const EVP_MD *md_type); -unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, - unsigned char **uni, int *unilen); -char *OPENSSL_uni2asc(const unsigned char *uni, int unilen); -unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, - unsigned char **uni, int *unilen); -char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen); - -DECLARE_ASN1_FUNCTIONS(PKCS12) -DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) -DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) -DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) - -DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) -DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) - -void PKCS12_PBE_add(void); -int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, - STACK_OF(X509) **ca); -PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, - X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, - int iter, int mac_iter, int keytype); - -PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); -PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, - EVP_PKEY *key, int key_usage, int iter, - int key_nid, const char *pass); -int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, - int safe_nid, int iter, const char *pass); -PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); - -int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); -# ifndef OPENSSL_NO_STDIO -int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); -# endif -PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); -# ifndef OPENSSL_NO_STDIO -PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); -# endif -int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs12err.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs12err.h deleted file mode 100644 index eff5eb26..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs12err.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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_PKCS12ERR_H -# define HEADER_PKCS12ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PKCS12_strings(void); - -/* - * PKCS12 function codes. - */ -# define PKCS12_F_OPENSSL_ASC2UNI 121 -# define PKCS12_F_OPENSSL_UNI2ASC 124 -# define PKCS12_F_OPENSSL_UNI2UTF8 127 -# define PKCS12_F_OPENSSL_UTF82UNI 129 -# define PKCS12_F_PKCS12_CREATE 105 -# define PKCS12_F_PKCS12_GEN_MAC 107 -# define PKCS12_F_PKCS12_INIT 109 -# define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 -# define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 -# define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 -# define PKCS12_F_PKCS12_KEY_GEN_ASC 110 -# define PKCS12_F_PKCS12_KEY_GEN_UNI 111 -# define PKCS12_F_PKCS12_KEY_GEN_UTF8 116 -# define PKCS12_F_PKCS12_NEWPASS 128 -# define PKCS12_F_PKCS12_PACK_P7DATA 114 -# define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 -# define PKCS12_F_PKCS12_PARSE 118 -# define PKCS12_F_PKCS12_PBE_CRYPT 119 -# define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 112 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 113 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 133 -# define PKCS12_F_PKCS12_SETUP_MAC 122 -# define PKCS12_F_PKCS12_SET_MAC 123 -# define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 -# define PKCS12_F_PKCS12_UNPACK_P7DATA 131 -# define PKCS12_F_PKCS12_VERIFY_MAC 126 -# define PKCS12_F_PKCS8_ENCRYPT 125 -# define PKCS12_F_PKCS8_SET0_PBE 132 - -/* - * PKCS12 reason codes. - */ -# define PKCS12_R_CANT_PACK_STRUCTURE 100 -# define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 -# define PKCS12_R_DECODE_ERROR 101 -# define PKCS12_R_ENCODE_ERROR 102 -# define PKCS12_R_ENCRYPT_ERROR 103 -# define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 -# define PKCS12_R_INVALID_NULL_ARGUMENT 104 -# define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 -# define PKCS12_R_IV_GEN_ERROR 106 -# define PKCS12_R_KEY_GEN_ERROR 107 -# define PKCS12_R_MAC_ABSENT 108 -# define PKCS12_R_MAC_GENERATION_ERROR 109 -# define PKCS12_R_MAC_SETUP_ERROR 110 -# define PKCS12_R_MAC_STRING_SET_ERROR 111 -# define PKCS12_R_MAC_VERIFY_FAILURE 113 -# define PKCS12_R_PARSE_ERROR 114 -# define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 -# define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 -# define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 -# define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 -# define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs7.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs7.h deleted file mode 100644 index 9b66e002..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs7.h +++ /dev/null @@ -1,319 +0,0 @@ -/* - * 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_PKCS7_H -# define HEADER_PKCS7_H - -# include -# include -# include - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- -Encryption_ID DES-CBC -Digest_ID MD5 -Digest_Encryption_ID rsaEncryption -Key_Encryption_ID rsaEncryption -*/ - -typedef struct pkcs7_issuer_and_serial_st { - X509_NAME *issuer; - ASN1_INTEGER *serial; -} PKCS7_ISSUER_AND_SERIAL; - -typedef struct pkcs7_signer_info_st { - ASN1_INTEGER *version; /* version 1 */ - PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; - X509_ALGOR *digest_alg; - STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ - X509_ALGOR *digest_enc_alg; - ASN1_OCTET_STRING *enc_digest; - STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ - /* The private key to sign with */ - EVP_PKEY *pkey; -} PKCS7_SIGNER_INFO; - -DEFINE_STACK_OF(PKCS7_SIGNER_INFO) - -typedef struct pkcs7_recip_info_st { - ASN1_INTEGER *version; /* version 0 */ - PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; - X509_ALGOR *key_enc_algor; - ASN1_OCTET_STRING *enc_key; - X509 *cert; /* get the pub-key from this */ -} PKCS7_RECIP_INFO; - -DEFINE_STACK_OF(PKCS7_RECIP_INFO) - -typedef struct pkcs7_signed_st { - ASN1_INTEGER *version; /* version 1 */ - STACK_OF(X509_ALGOR) *md_algs; /* md used */ - STACK_OF(X509) *cert; /* [ 0 ] */ - STACK_OF(X509_CRL) *crl; /* [ 1 ] */ - STACK_OF(PKCS7_SIGNER_INFO) *signer_info; - struct pkcs7_st *contents; -} PKCS7_SIGNED; -/* - * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about - * merging the two - */ - -typedef struct pkcs7_enc_content_st { - ASN1_OBJECT *content_type; - X509_ALGOR *algorithm; - ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ - const EVP_CIPHER *cipher; -} PKCS7_ENC_CONTENT; - -typedef struct pkcs7_enveloped_st { - ASN1_INTEGER *version; /* version 0 */ - STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; - PKCS7_ENC_CONTENT *enc_data; -} PKCS7_ENVELOPE; - -typedef struct pkcs7_signedandenveloped_st { - ASN1_INTEGER *version; /* version 1 */ - STACK_OF(X509_ALGOR) *md_algs; /* md used */ - STACK_OF(X509) *cert; /* [ 0 ] */ - STACK_OF(X509_CRL) *crl; /* [ 1 ] */ - STACK_OF(PKCS7_SIGNER_INFO) *signer_info; - PKCS7_ENC_CONTENT *enc_data; - STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; -} PKCS7_SIGN_ENVELOPE; - -typedef struct pkcs7_digest_st { - ASN1_INTEGER *version; /* version 0 */ - X509_ALGOR *md; /* md used */ - struct pkcs7_st *contents; - ASN1_OCTET_STRING *digest; -} PKCS7_DIGEST; - -typedef struct pkcs7_encrypted_st { - ASN1_INTEGER *version; /* version 0 */ - PKCS7_ENC_CONTENT *enc_data; -} PKCS7_ENCRYPT; - -typedef struct pkcs7_st { - /* - * The following is non NULL if it contains ASN1 encoding of this - * structure - */ - unsigned char *asn1; - long length; -# define PKCS7_S_HEADER 0 -# define PKCS7_S_BODY 1 -# define PKCS7_S_TAIL 2 - int state; /* used during processing */ - int detached; - ASN1_OBJECT *type; - /* content as defined by the type */ - /* - * all encryption/message digests are applied to the 'contents', leaving - * out the 'type' field. - */ - union { - char *ptr; - /* NID_pkcs7_data */ - ASN1_OCTET_STRING *data; - /* NID_pkcs7_signed */ - PKCS7_SIGNED *sign; - /* NID_pkcs7_enveloped */ - PKCS7_ENVELOPE *enveloped; - /* NID_pkcs7_signedAndEnveloped */ - PKCS7_SIGN_ENVELOPE *signed_and_enveloped; - /* NID_pkcs7_digest */ - PKCS7_DIGEST *digest; - /* NID_pkcs7_encrypted */ - PKCS7_ENCRYPT *encrypted; - /* Anything else */ - ASN1_TYPE *other; - } d; -} PKCS7; - -DEFINE_STACK_OF(PKCS7) - -# define PKCS7_OP_SET_DETACHED_SIGNATURE 1 -# define PKCS7_OP_GET_DETACHED_SIGNATURE 2 - -# define PKCS7_get_signed_attributes(si) ((si)->auth_attr) -# define PKCS7_get_attributes(si) ((si)->unauth_attr) - -# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) -# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) -# define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) -# define PKCS7_type_is_signedAndEnveloped(a) \ - (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) -# define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) -# define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) - -# define PKCS7_set_detached(p,v) \ - PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) -# define PKCS7_get_detached(p) \ - PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) - -# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) - -/* S/MIME related flags */ - -# define PKCS7_TEXT 0x1 -# define PKCS7_NOCERTS 0x2 -# define PKCS7_NOSIGS 0x4 -# define PKCS7_NOCHAIN 0x8 -# define PKCS7_NOINTERN 0x10 -# define PKCS7_NOVERIFY 0x20 -# define PKCS7_DETACHED 0x40 -# define PKCS7_BINARY 0x80 -# define PKCS7_NOATTR 0x100 -# define PKCS7_NOSMIMECAP 0x200 -# define PKCS7_NOOLDMIMETYPE 0x400 -# define PKCS7_CRLFEOL 0x800 -# define PKCS7_STREAM 0x1000 -# define PKCS7_NOCRL 0x2000 -# define PKCS7_PARTIAL 0x4000 -# define PKCS7_REUSE_DIGEST 0x8000 -# define PKCS7_NO_DUAL_CONTENT 0x10000 - -/* Flags: for compatibility with older code */ - -# define SMIME_TEXT PKCS7_TEXT -# define SMIME_NOCERTS PKCS7_NOCERTS -# define SMIME_NOSIGS PKCS7_NOSIGS -# define SMIME_NOCHAIN PKCS7_NOCHAIN -# define SMIME_NOINTERN PKCS7_NOINTERN -# define SMIME_NOVERIFY PKCS7_NOVERIFY -# define SMIME_DETACHED PKCS7_DETACHED -# define SMIME_BINARY PKCS7_BINARY -# define SMIME_NOATTR PKCS7_NOATTR - -/* CRLF ASCII canonicalisation */ -# define SMIME_ASCIICRLF 0x80000 - -DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) - -int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, - const EVP_MD *type, unsigned char *md, - unsigned int *len); -# ifndef OPENSSL_NO_STDIO -PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7); -int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7); -# endif -PKCS7 *PKCS7_dup(PKCS7 *p7); -PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7); -int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7); -int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); -int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); - -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) -DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) -DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) -DECLARE_ASN1_FUNCTIONS(PKCS7) - -DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) -DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) - -DECLARE_ASN1_NDEF_FUNCTION(PKCS7) -DECLARE_ASN1_PRINT_FUNCTION(PKCS7) - -long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); - -int PKCS7_set_type(PKCS7 *p7, int type); -int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); -int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); -int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, - const EVP_MD *dgst); -int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); -int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); -int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); -int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); -int PKCS7_content_new(PKCS7 *p7, int nid); -int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, - BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); -int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, - X509 *x509); - -BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); -int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); -BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); - -PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, - EVP_PKEY *pkey, const EVP_MD *dgst); -X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); -int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); -STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); - -PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); -void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, - X509_ALGOR **pdig, X509_ALGOR **psig); -void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); -int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); -int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); -int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); -int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); - -PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); -ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); -int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, - void *data); -int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, - void *value); -ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); -ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); -int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, - STACK_OF(X509_ATTRIBUTE) *sk); -int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, - STACK_OF(X509_ATTRIBUTE) *sk); - -PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, - BIO *data, int flags); - -PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, - X509 *signcert, EVP_PKEY *pkey, - const EVP_MD *md, int flags); - -int PKCS7_final(PKCS7 *p7, BIO *data, int flags); -int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, - BIO *indata, BIO *out, int flags); -STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, - int flags); -PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, - int flags); -int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, - int flags); - -int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, - STACK_OF(X509_ALGOR) *cap); -STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); -int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); - -int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); -int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); -int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, - const unsigned char *md, int mdlen); - -int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); -PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); - -BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs7err.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs7err.h deleted file mode 100644 index 02e0299a..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/pkcs7err.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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_PKCS7ERR_H -# define HEADER_PKCS7ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PKCS7_strings(void); - -/* - * PKCS7 function codes. - */ -# define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 -# define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 -# define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 -# define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 -# define PKCS7_F_PKCS7_ADD_CRL 101 -# define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 -# define PKCS7_F_PKCS7_ADD_SIGNATURE 131 -# define PKCS7_F_PKCS7_ADD_SIGNER 103 -# define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 -# define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 -# define PKCS7_F_PKCS7_CTRL 104 -# define PKCS7_F_PKCS7_DATADECODE 112 -# define PKCS7_F_PKCS7_DATAFINAL 128 -# define PKCS7_F_PKCS7_DATAINIT 105 -# define PKCS7_F_PKCS7_DATAVERIFY 107 -# define PKCS7_F_PKCS7_DECRYPT 114 -# define PKCS7_F_PKCS7_DECRYPT_RINFO 133 -# define PKCS7_F_PKCS7_ENCODE_RINFO 132 -# define PKCS7_F_PKCS7_ENCRYPT 115 -# define PKCS7_F_PKCS7_FINAL 134 -# define PKCS7_F_PKCS7_FIND_DIGEST 127 -# define PKCS7_F_PKCS7_GET0_SIGNERS 124 -# define PKCS7_F_PKCS7_RECIP_INFO_SET 130 -# define PKCS7_F_PKCS7_SET_CIPHER 108 -# define PKCS7_F_PKCS7_SET_CONTENT 109 -# define PKCS7_F_PKCS7_SET_DIGEST 126 -# define PKCS7_F_PKCS7_SET_TYPE 110 -# define PKCS7_F_PKCS7_SIGN 116 -# define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 -# define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 -# define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 -# define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 -# define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 -# define PKCS7_F_PKCS7_VERIFY 117 - -/* - * PKCS7 reason codes. - */ -# define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 -# define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 -# define PKCS7_R_CIPHER_NOT_INITIALIZED 116 -# define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 -# define PKCS7_R_CTRL_ERROR 152 -# define PKCS7_R_DECRYPT_ERROR 119 -# define PKCS7_R_DIGEST_FAILURE 101 -# define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 -# define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 -# define PKCS7_R_ERROR_ADDING_RECIPIENT 120 -# define PKCS7_R_ERROR_SETTING_CIPHER 121 -# define PKCS7_R_INVALID_NULL_POINTER 143 -# define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 -# define PKCS7_R_NO_CONTENT 122 -# define PKCS7_R_NO_DEFAULT_DIGEST 151 -# define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 -# define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 -# define PKCS7_R_NO_SIGNATURES_ON_DATA 123 -# define PKCS7_R_NO_SIGNERS 142 -# define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 -# define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 -# define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 -# define PKCS7_R_PKCS7_DATASIGN 145 -# define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 -# define PKCS7_R_SIGNATURE_FAILURE 105 -# define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 -# define PKCS7_R_SIGNING_CTRL_FAILURE 147 -# define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 -# define PKCS7_R_SMIME_TEXT_ERROR 129 -# define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 -# define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 -# define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 -# define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 -# define PKCS7_R_UNKNOWN_OPERATION 110 -# define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 -# define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 -# define PKCS7_R_WRONG_CONTENT_TYPE 113 -# define PKCS7_R_WRONG_PKCS7_TYPE 114 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rand.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rand.h deleted file mode 100644 index 38a2a271..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rand.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1995-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_RAND_H -# define HEADER_RAND_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -struct rand_meth_st { - int (*seed) (const void *buf, int num); - int (*bytes) (unsigned char *buf, int num); - void (*cleanup) (void); - int (*add) (const void *buf, int num, double randomness); - int (*pseudorand) (unsigned char *buf, int num); - int (*status) (void); -}; - -int RAND_set_rand_method(const RAND_METHOD *meth); -const RAND_METHOD *RAND_get_rand_method(void); -# ifndef OPENSSL_NO_ENGINE -int RAND_set_rand_engine(ENGINE *engine); -# endif - -RAND_METHOD *RAND_OpenSSL(void); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define RAND_cleanup() while(0) continue -# endif -int RAND_bytes(unsigned char *buf, int num); -int RAND_priv_bytes(unsigned char *buf, int num); -DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) - -void RAND_seed(const void *buf, int num); -void RAND_keep_random_devices_open(int keep); - -# if defined(__ANDROID__) && defined(__NDK_FPABI__) -__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ -# endif -void RAND_add(const void *buf, int num, double randomness); -int RAND_load_file(const char *file, long max_bytes); -int RAND_write_file(const char *file); -const char *RAND_file_name(char *file, size_t num); -int RAND_status(void); - -# ifndef OPENSSL_NO_EGD -int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); -int RAND_egd(const char *path); -int RAND_egd_bytes(const char *path, int bytes); -# endif - -int RAND_poll(void); - -# if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) -/* application has to include in order to use these */ -DEPRECATEDIN_1_1_0(void RAND_screen(void)) -DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) -# endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rand_drbg.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rand_drbg.h deleted file mode 100644 index 45b731b7..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rand_drbg.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2017-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_DRBG_RAND_H -# define HEADER_DRBG_RAND_H - -# include -# include -# include - -/* - * RAND_DRBG flags - * - * Note: if new flags are added, the constant `rand_drbg_used_flags` - * in drbg_lib.c needs to be updated accordingly. - */ - -/* In CTR mode, disable derivation function ctr_df */ -# define RAND_DRBG_FLAG_CTR_NO_DF 0x1 - - -# if OPENSSL_API_COMPAT < 0x10200000L -/* This #define was replaced by an internal constant and should not be used. */ -# define RAND_DRBG_USED_FLAGS (RAND_DRBG_FLAG_CTR_NO_DF) -# endif - -/* - * Default security strength (in the sense of [NIST SP 800-90Ar1]) - * - * NIST SP 800-90Ar1 supports the strength of the DRBG being smaller than that - * of the cipher by collecting less entropy. The current DRBG implementation - * does not take RAND_DRBG_STRENGTH into account and sets the strength of the - * DRBG to that of the cipher. - * - * RAND_DRBG_STRENGTH is currently only used for the legacy RAND - * implementation. - * - * Currently supported ciphers are: NID_aes_128_ctr, NID_aes_192_ctr and - * NID_aes_256_ctr - */ -# define RAND_DRBG_STRENGTH 256 -/* Default drbg type */ -# define RAND_DRBG_TYPE NID_aes_256_ctr -/* Default drbg flags */ -# define RAND_DRBG_FLAGS 0 - - -# ifdef __cplusplus -extern "C" { -# endif - -/* - * Object lifetime functions. - */ -RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent); -RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent); -int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags); -int RAND_DRBG_set_defaults(int type, unsigned int flags); -int RAND_DRBG_instantiate(RAND_DRBG *drbg, - const unsigned char *pers, size_t perslen); -int RAND_DRBG_uninstantiate(RAND_DRBG *drbg); -void RAND_DRBG_free(RAND_DRBG *drbg); - -/* - * Object "use" functions. - */ -int RAND_DRBG_reseed(RAND_DRBG *drbg, - const unsigned char *adin, size_t adinlen, - int prediction_resistance); -int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, - int prediction_resistance, - const unsigned char *adin, size_t adinlen); -int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen); - -int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, unsigned int interval); -int RAND_DRBG_set_reseed_time_interval(RAND_DRBG *drbg, time_t interval); - -int RAND_DRBG_set_reseed_defaults( - unsigned int master_reseed_interval, - unsigned int slave_reseed_interval, - time_t master_reseed_time_interval, - time_t slave_reseed_time_interval - ); - -RAND_DRBG *RAND_DRBG_get0_master(void); -RAND_DRBG *RAND_DRBG_get0_public(void); -RAND_DRBG *RAND_DRBG_get0_private(void); - -/* - * EXDATA - */ -# define RAND_DRBG_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DRBG, l, p, newf, dupf, freef) -int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *arg); -void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx); - -/* - * Callback function typedefs - */ -typedef size_t (*RAND_DRBG_get_entropy_fn)(RAND_DRBG *drbg, - unsigned char **pout, - int entropy, size_t min_len, - size_t max_len, - int prediction_resistance); -typedef void (*RAND_DRBG_cleanup_entropy_fn)(RAND_DRBG *ctx, - unsigned char *out, size_t outlen); -typedef size_t (*RAND_DRBG_get_nonce_fn)(RAND_DRBG *drbg, unsigned char **pout, - int entropy, size_t min_len, - size_t max_len); -typedef void (*RAND_DRBG_cleanup_nonce_fn)(RAND_DRBG *drbg, - unsigned char *out, size_t outlen); - -int RAND_DRBG_set_callbacks(RAND_DRBG *drbg, - RAND_DRBG_get_entropy_fn get_entropy, - RAND_DRBG_cleanup_entropy_fn cleanup_entropy, - RAND_DRBG_get_nonce_fn get_nonce, - RAND_DRBG_cleanup_nonce_fn cleanup_nonce); - - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/randerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/randerr.h deleted file mode 100644 index 79d57905..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/randerr.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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_RANDERR_H -# define HEADER_RANDERR_H - -# include - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_RAND_strings(void); - -/* - * RAND function codes. - */ -# define RAND_F_DATA_COLLECT_METHOD 127 -# define RAND_F_DRBG_BYTES 101 -# define RAND_F_DRBG_GET_ENTROPY 105 -# define RAND_F_DRBG_SETUP 117 -# define RAND_F_GET_ENTROPY 106 -# define RAND_F_RAND_BYTES 100 -# define RAND_F_RAND_DRBG_ENABLE_LOCKING 119 -# define RAND_F_RAND_DRBG_GENERATE 107 -# define RAND_F_RAND_DRBG_GET_ENTROPY 120 -# define RAND_F_RAND_DRBG_GET_NONCE 123 -# define RAND_F_RAND_DRBG_INSTANTIATE 108 -# define RAND_F_RAND_DRBG_NEW 109 -# define RAND_F_RAND_DRBG_RESEED 110 -# define RAND_F_RAND_DRBG_RESTART 102 -# define RAND_F_RAND_DRBG_SET 104 -# define RAND_F_RAND_DRBG_SET_DEFAULTS 121 -# define RAND_F_RAND_DRBG_UNINSTANTIATE 118 -# define RAND_F_RAND_LOAD_FILE 111 -# define RAND_F_RAND_POOL_ACQUIRE_ENTROPY 122 -# define RAND_F_RAND_POOL_ADD 103 -# define RAND_F_RAND_POOL_ADD_BEGIN 113 -# define RAND_F_RAND_POOL_ADD_END 114 -# define RAND_F_RAND_POOL_ATTACH 124 -# define RAND_F_RAND_POOL_BYTES_NEEDED 115 -# define RAND_F_RAND_POOL_GROW 125 -# define RAND_F_RAND_POOL_NEW 116 -# define RAND_F_RAND_PSEUDO_BYTES 126 -# define RAND_F_RAND_WRITE_FILE 112 - -/* - * RAND reason codes. - */ -# define RAND_R_ADDITIONAL_INPUT_TOO_LONG 102 -# define RAND_R_ALREADY_INSTANTIATED 103 -# define RAND_R_ARGUMENT_OUT_OF_RANGE 105 -# define RAND_R_CANNOT_OPEN_FILE 121 -# define RAND_R_DRBG_ALREADY_INITIALIZED 129 -# define RAND_R_DRBG_NOT_INITIALISED 104 -# define RAND_R_ENTROPY_INPUT_TOO_LONG 106 -# define RAND_R_ENTROPY_OUT_OF_RANGE 124 -# define RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED 127 -# define RAND_R_ERROR_INITIALISING_DRBG 107 -# define RAND_R_ERROR_INSTANTIATING_DRBG 108 -# define RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 109 -# define RAND_R_ERROR_RETRIEVING_ENTROPY 110 -# define RAND_R_ERROR_RETRIEVING_NONCE 111 -# define RAND_R_FAILED_TO_CREATE_LOCK 126 -# define RAND_R_FUNC_NOT_IMPLEMENTED 101 -# define RAND_R_FWRITE_ERROR 123 -# define RAND_R_GENERATE_ERROR 112 -# define RAND_R_INTERNAL_ERROR 113 -# define RAND_R_IN_ERROR_STATE 114 -# define RAND_R_NOT_A_REGULAR_FILE 122 -# define RAND_R_NOT_INSTANTIATED 115 -# define RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED 128 -# define RAND_R_PARENT_LOCKING_NOT_ENABLED 130 -# define RAND_R_PARENT_STRENGTH_TOO_WEAK 131 -# define RAND_R_PERSONALISATION_STRING_TOO_LONG 116 -# define RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED 133 -# define RAND_R_PRNG_NOT_SEEDED 100 -# define RAND_R_RANDOM_POOL_OVERFLOW 125 -# define RAND_R_RANDOM_POOL_UNDERFLOW 134 -# define RAND_R_REQUEST_TOO_LARGE_FOR_DRBG 117 -# define RAND_R_RESEED_ERROR 118 -# define RAND_R_SELFTEST_FAILURE 119 -# define RAND_R_TOO_LITTLE_NONCE_REQUESTED 135 -# define RAND_R_TOO_MUCH_NONCE_REQUESTED 136 -# define RAND_R_UNSUPPORTED_DRBG_FLAGS 132 -# define RAND_R_UNSUPPORTED_DRBG_TYPE 120 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rc2.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rc2.h deleted file mode 100644 index 585f9e4c..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rc2.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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_RC2_H -# define HEADER_RC2_H - -# include - -# ifndef OPENSSL_NO_RC2 -# ifdef __cplusplus -extern "C" { -# endif - -typedef unsigned int RC2_INT; - -# define RC2_ENCRYPT 1 -# define RC2_DECRYPT 0 - -# define RC2_BLOCK 8 -# define RC2_KEY_LENGTH 16 - -typedef struct rc2_key_st { - RC2_INT data[64]; -} RC2_KEY; - -void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); -void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, - RC2_KEY *key, int enc); -void RC2_encrypt(unsigned long *data, RC2_KEY *key); -void RC2_decrypt(unsigned long *data, RC2_KEY *key); -void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - RC2_KEY *ks, unsigned char *iv, int enc); -void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num, int enc); -void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rc4.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rc4.h deleted file mode 100644 index 86803b37..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rc4.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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_RC4_H -# define HEADER_RC4_H - -# include - -# ifndef OPENSSL_NO_RC4 -# include -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct rc4_key_st { - RC4_INT x, y; - RC4_INT data[256]; -} RC4_KEY; - -const char *RC4_options(void); -void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); -void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, - unsigned char *outdata); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rc5.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rc5.h deleted file mode 100644 index 793f88e4..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rc5.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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_RC5_H -# define HEADER_RC5_H - -# include - -# ifndef OPENSSL_NO_RC5 -# ifdef __cplusplus -extern "C" { -# endif - -# define RC5_ENCRYPT 1 -# define RC5_DECRYPT 0 - -# define RC5_32_INT unsigned int - -# define RC5_32_BLOCK 8 -# define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ - -/* - * This are the only values supported. Tweak the code if you want more The - * most supported modes will be RC5-32/12/16 RC5-32/16/8 - */ -# define RC5_8_ROUNDS 8 -# define RC5_12_ROUNDS 12 -# define RC5_16_ROUNDS 16 - -typedef struct rc5_key_st { - /* Number of rounds */ - int rounds; - RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; -} RC5_32_KEY; - -void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, - int rounds); -void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, - RC5_32_KEY *key, int enc); -void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *ks, unsigned char *iv, - int enc); -void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ripemd.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ripemd.h deleted file mode 100644 index c42026aa..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ripemd.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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_RIPEMD_H -# define HEADER_RIPEMD_H - -# include - -#ifndef OPENSSL_NO_RMD160 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define RIPEMD160_LONG unsigned int - -# define RIPEMD160_CBLOCK 64 -# define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) -# define RIPEMD160_DIGEST_LENGTH 20 - -typedef struct RIPEMD160state_st { - RIPEMD160_LONG A, B, C, D, E; - RIPEMD160_LONG Nl, Nh; - RIPEMD160_LONG data[RIPEMD160_LBLOCK]; - unsigned int num; -} RIPEMD160_CTX; - -int RIPEMD160_Init(RIPEMD160_CTX *c); -int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); -int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); -unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); -void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); - -# ifdef __cplusplus -} -# endif -# endif - - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rsa.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rsa.h deleted file mode 100644 index 5e76365c..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rsa.h +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Copyright 1995-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_RSA_H -# define HEADER_RSA_H - -# include - -# ifndef OPENSSL_NO_RSA -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* The types RSA and RSA_METHOD are defined in ossl_typ.h */ - -# ifndef OPENSSL_RSA_MAX_MODULUS_BITS -# define OPENSSL_RSA_MAX_MODULUS_BITS 16384 -# endif - -# define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 - -# ifndef OPENSSL_RSA_SMALL_MODULUS_BITS -# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 -# endif -# ifndef OPENSSL_RSA_MAX_PUBEXP_BITS - -/* exponent limit enforced for "large" modulus only */ -# define OPENSSL_RSA_MAX_PUBEXP_BITS 64 -# endif - -# define RSA_3 0x3L -# define RSA_F4 0x10001L - -/* based on RFC 8017 appendix A.1.2 */ -# define RSA_ASN1_VERSION_DEFAULT 0 -# define RSA_ASN1_VERSION_MULTI 1 - -# define RSA_DEFAULT_PRIME_NUM 2 - -# define RSA_METHOD_FLAG_NO_CHECK 0x0001/* don't check pub/private - * match */ - -# define RSA_FLAG_CACHE_PUBLIC 0x0002 -# define RSA_FLAG_CACHE_PRIVATE 0x0004 -# define RSA_FLAG_BLINDING 0x0008 -# define RSA_FLAG_THREAD_SAFE 0x0010 -/* - * This flag means the private key operations will be handled by rsa_mod_exp - * and that they do not depend on the private key components being present: - * for example a key stored in external hardware. Without this flag - * bn_mod_exp gets called when private key components are absent. - */ -# define RSA_FLAG_EXT_PKEY 0x0020 - -/* - * new with 0.9.6j and 0.9.7b; the built-in - * RSA implementation now uses blinding by - * default (ignoring RSA_FLAG_BLINDING), - * but other engines might not need it - */ -# define RSA_FLAG_NO_BLINDING 0x0080 -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define RSA_FLAG_NO_CONSTTIME 0x0000 -# endif -# if OPENSSL_API_COMPAT < 0x00908000L -/* deprecated name for the flag*/ -/* - * new with 0.9.7h; the built-in RSA - * implementation now uses constant time - * modular exponentiation for secret exponents - * by default. This flag causes the - * faster variable sliding window method to - * be used for all exponents. - */ -# define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME -# endif - -# define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ - RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_RSA_PADDING, pad, NULL) - -# define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \ - RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad) - -# define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ - RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ - EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) -/* Salt length matches digest */ -# define RSA_PSS_SALTLEN_DIGEST -1 -/* Verify only: auto detect salt length */ -# define RSA_PSS_SALTLEN_AUTO -2 -/* Set salt length to maximum possible */ -# define RSA_PSS_SALTLEN_MAX -3 -/* Old compatible max salt length for sign only */ -# define RSA_PSS_SALTLEN_MAX_SIGN -2 - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \ - RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ - EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, 0, plen) - -# define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) - -# define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp) - -# define EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, primes) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES, primes, NULL) - -# define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)(l)) - -# define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)(l)) - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, \ - EVP_PKEY_OP_KEYGEN, EVP_PKEY_CTRL_MD, \ - 0, (void *)(md)) - -# define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) - -# define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) - -# define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) - -# define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) - -# define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) - -# define EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES (EVP_PKEY_ALG_CTRL + 13) - -# define RSA_PKCS1_PADDING 1 -# define RSA_SSLV23_PADDING 2 -# define RSA_NO_PADDING 3 -# define RSA_PKCS1_OAEP_PADDING 4 -# define RSA_X931_PADDING 5 -/* EVP_PKEY_ only */ -# define RSA_PKCS1_PSS_PADDING 6 - -# define RSA_PKCS1_PADDING_SIZE 11 - -# define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) -# define RSA_get_app_data(s) RSA_get_ex_data(s,0) - -RSA *RSA_new(void); -RSA *RSA_new_method(ENGINE *engine); -int RSA_bits(const RSA *rsa); -int RSA_size(const RSA *rsa); -int RSA_security_bits(const RSA *rsa); - -int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); -int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); -int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); -int RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[], - BIGNUM *coeffs[], int pnum); -void RSA_get0_key(const RSA *r, - const BIGNUM **n, const BIGNUM **e, const BIGNUM **d); -void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); -int RSA_get_multi_prime_extra_count(const RSA *r); -int RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]); -void RSA_get0_crt_params(const RSA *r, - const BIGNUM **dmp1, const BIGNUM **dmq1, - const BIGNUM **iqmp); -int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[], - const BIGNUM *coeffs[]); -const BIGNUM *RSA_get0_n(const RSA *d); -const BIGNUM *RSA_get0_e(const RSA *d); -const BIGNUM *RSA_get0_d(const RSA *d); -const BIGNUM *RSA_get0_p(const RSA *d); -const BIGNUM *RSA_get0_q(const RSA *d); -const BIGNUM *RSA_get0_dmp1(const RSA *r); -const BIGNUM *RSA_get0_dmq1(const RSA *r); -const BIGNUM *RSA_get0_iqmp(const RSA *r); -const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); -void RSA_clear_flags(RSA *r, int flags); -int RSA_test_flags(const RSA *r, int flags); -void RSA_set_flags(RSA *r, int flags); -int RSA_get_version(RSA *r); -ENGINE *RSA_get0_engine(const RSA *r); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void - (*callback) (int, int, void *), - void *cb_arg)) - -/* New version */ -int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); -/* Multi-prime version */ -int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, - BIGNUM *e, BN_GENCB *cb); - -int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, - BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2, - const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2, - const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb); -int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, - BN_GENCB *cb); - -int RSA_check_key(const RSA *); -int RSA_check_key_ex(const RSA *, BN_GENCB *cb); - /* next 4 return -1 on error */ -int RSA_public_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_private_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_public_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_private_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -void RSA_free(RSA *r); -/* "up" the RSA object's reference count */ -int RSA_up_ref(RSA *r); - -int RSA_flags(const RSA *r); - -void RSA_set_default_method(const RSA_METHOD *meth); -const RSA_METHOD *RSA_get_default_method(void); -const RSA_METHOD *RSA_null_method(void); -const RSA_METHOD *RSA_get_method(const RSA *rsa); -int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); - -/* these are the actual RSA functions */ -const RSA_METHOD *RSA_PKCS1_OpenSSL(void); - -int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); - -DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) -DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) - -struct rsa_pss_params_st { - X509_ALGOR *hashAlgorithm; - X509_ALGOR *maskGenAlgorithm; - ASN1_INTEGER *saltLength; - ASN1_INTEGER *trailerField; - /* Decoded hash algorithm from maskGenAlgorithm */ - X509_ALGOR *maskHash; -}; - -DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) - -typedef struct rsa_oaep_params_st { - X509_ALGOR *hashFunc; - X509_ALGOR *maskGenFunc; - X509_ALGOR *pSourceFunc; - /* Decoded hash algorithm from maskGenFunc */ - X509_ALGOR *maskHash; -} RSA_OAEP_PARAMS; - -DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) - -# ifndef OPENSSL_NO_STDIO -int RSA_print_fp(FILE *fp, const RSA *r, int offset); -# endif - -int RSA_print(BIO *bp, const RSA *r, int offset); - -/* - * The following 2 functions sign and verify a X509_SIG ASN1 object inside - * PKCS#1 padded RSA encryption - */ -int RSA_sign(int type, const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, RSA *rsa); -int RSA_verify(int type, const unsigned char *m, unsigned int m_length, - const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); - -/* - * The following 2 function sign and verify a ASN1_OCTET_STRING object inside - * PKCS#1 padded RSA encryption - */ -int RSA_sign_ASN1_OCTET_STRING(int type, - const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - RSA *rsa); -int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, - unsigned int m_length, unsigned char *sigbuf, - unsigned int siglen, RSA *rsa); - -int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); -void RSA_blinding_off(RSA *rsa); -BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); - -int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, - const unsigned char *f, int fl, - int rsa_len); -int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, - const unsigned char *f, int fl, - int rsa_len); -int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, - long seedlen, const EVP_MD *dgst); -int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, - const unsigned char *f, int fl, - const unsigned char *p, int pl); -int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len, - const unsigned char *p, int pl); -int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, - const unsigned char *from, int flen, - const unsigned char *param, int plen, - const EVP_MD *md, const EVP_MD *mgf1md); -int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, - const unsigned char *from, int flen, - int num, const unsigned char *param, - int plen, const EVP_MD *md, - const EVP_MD *mgf1md); -int RSA_padding_add_SSLv23(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_SSLv23(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f, - int fl); -int RSA_padding_check_none(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f, - int fl); -int RSA_padding_check_X931(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_X931_hash_id(int nid); - -int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, - const EVP_MD *Hash, const unsigned char *EM, - int sLen); -int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, - const unsigned char *mHash, const EVP_MD *Hash, - int sLen); - -int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - const unsigned char *EM, int sLen); - -int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, - const unsigned char *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - int sLen); - -#define RSA_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef) -int RSA_set_ex_data(RSA *r, int idx, void *arg); -void *RSA_get_ex_data(const RSA *r, int idx); - -RSA *RSAPublicKey_dup(RSA *rsa); -RSA *RSAPrivateKey_dup(RSA *rsa); - -/* - * If this flag is set the RSA method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define RSA_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define RSA_FLAG_NON_FIPS_ALLOW 0x0400 -/* - * Application has decided PRNG is good enough to generate a key: don't - * check. - */ -# define RSA_FLAG_CHECKED 0x0800 - -RSA_METHOD *RSA_meth_new(const char *name, int flags); -void RSA_meth_free(RSA_METHOD *meth); -RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth); -const char *RSA_meth_get0_name(const RSA_METHOD *meth); -int RSA_meth_set1_name(RSA_METHOD *meth, const char *name); -int RSA_meth_get_flags(const RSA_METHOD *meth); -int RSA_meth_set_flags(RSA_METHOD *meth, int flags); -void *RSA_meth_get0_app_data(const RSA_METHOD *meth); -int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data); -int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_pub_enc(RSA_METHOD *rsa, - int (*pub_enc) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_pub_dec(RSA_METHOD *rsa, - int (*pub_dec) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_priv_enc(RSA_METHOD *rsa, - int (*priv_enc) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_priv_dec(RSA_METHOD *rsa, - int (*priv_dec) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth)) - (BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); -int RSA_meth_set_mod_exp(RSA_METHOD *rsa, - int (*mod_exp) (BIGNUM *r0, const BIGNUM *i, RSA *rsa, - BN_CTX *ctx)); -int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth)) - (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa, - int (*bn_mod_exp) (BIGNUM *r, - const BIGNUM *a, - const BIGNUM *p, - const BIGNUM *m, - BN_CTX *ctx, - BN_MONT_CTX *m_ctx)); -int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa); -int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa)); -int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa); -int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa)); -int (*RSA_meth_get_sign(const RSA_METHOD *meth)) - (int type, - const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - const RSA *rsa); -int RSA_meth_set_sign(RSA_METHOD *rsa, - int (*sign) (int type, const unsigned char *m, - unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - const RSA *rsa)); -int (*RSA_meth_get_verify(const RSA_METHOD *meth)) - (int dtype, const unsigned char *m, - unsigned int m_length, const unsigned char *sigbuf, - unsigned int siglen, const RSA *rsa); -int RSA_meth_set_verify(RSA_METHOD *rsa, - int (*verify) (int dtype, const unsigned char *m, - unsigned int m_length, - const unsigned char *sigbuf, - unsigned int siglen, const RSA *rsa)); -int (*RSA_meth_get_keygen(const RSA_METHOD *meth)) - (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); -int RSA_meth_set_keygen(RSA_METHOD *rsa, - int (*keygen) (RSA *rsa, int bits, BIGNUM *e, - BN_GENCB *cb)); -int (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth)) - (RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb); -int RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth, - int (*keygen) (RSA *rsa, int bits, - int primes, BIGNUM *e, - BN_GENCB *cb)); - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rsaerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rsaerr.h deleted file mode 100644 index 59b15e13..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/rsaerr.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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_RSAERR_H -# define HEADER_RSAERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_RSA_strings(void); - -/* - * RSA function codes. - */ -# define RSA_F_CHECK_PADDING_MD 140 -# define RSA_F_ENCODE_PKCS1 146 -# define RSA_F_INT_RSA_VERIFY 145 -# define RSA_F_OLD_RSA_PRIV_DECODE 147 -# define RSA_F_PKEY_PSS_INIT 165 -# define RSA_F_PKEY_RSA_CTRL 143 -# define RSA_F_PKEY_RSA_CTRL_STR 144 -# define RSA_F_PKEY_RSA_SIGN 142 -# define RSA_F_PKEY_RSA_VERIFY 149 -# define RSA_F_PKEY_RSA_VERIFYRECOVER 141 -# define RSA_F_RSA_ALGOR_TO_MD 156 -# define RSA_F_RSA_BUILTIN_KEYGEN 129 -# define RSA_F_RSA_CHECK_KEY 123 -# define RSA_F_RSA_CHECK_KEY_EX 160 -# define RSA_F_RSA_CMS_DECRYPT 159 -# define RSA_F_RSA_CMS_VERIFY 158 -# define RSA_F_RSA_ITEM_VERIFY 148 -# define RSA_F_RSA_METH_DUP 161 -# define RSA_F_RSA_METH_NEW 162 -# define RSA_F_RSA_METH_SET1_NAME 163 -# define RSA_F_RSA_MGF1_TO_MD 157 -# define RSA_F_RSA_MULTIP_INFO_NEW 166 -# define RSA_F_RSA_NEW_METHOD 106 -# define RSA_F_RSA_NULL 124 -# define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 -# define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 -# define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 -# define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 -# define RSA_F_RSA_OSSL_PRIVATE_DECRYPT 101 -# define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 102 -# define RSA_F_RSA_OSSL_PUBLIC_DECRYPT 103 -# define RSA_F_RSA_OSSL_PUBLIC_ENCRYPT 104 -# define RSA_F_RSA_PADDING_ADD_NONE 107 -# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 -# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 154 -# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 -# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 152 -# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 -# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 -# define RSA_F_RSA_PADDING_ADD_SSLV23 110 -# define RSA_F_RSA_PADDING_ADD_X931 127 -# define RSA_F_RSA_PADDING_CHECK_NONE 111 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 153 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 -# define RSA_F_RSA_PADDING_CHECK_SSLV23 114 -# define RSA_F_RSA_PADDING_CHECK_X931 128 -# define RSA_F_RSA_PARAM_DECODE 164 -# define RSA_F_RSA_PRINT 115 -# define RSA_F_RSA_PRINT_FP 116 -# define RSA_F_RSA_PRIV_DECODE 150 -# define RSA_F_RSA_PRIV_ENCODE 138 -# define RSA_F_RSA_PSS_GET_PARAM 151 -# define RSA_F_RSA_PSS_TO_CTX 155 -# define RSA_F_RSA_PUB_DECODE 139 -# define RSA_F_RSA_SETUP_BLINDING 136 -# define RSA_F_RSA_SIGN 117 -# define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 -# define RSA_F_RSA_VERIFY 119 -# define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 -# define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 126 -# define RSA_F_SETUP_TBUF 167 - -/* - * RSA reason codes. - */ -# define RSA_R_ALGORITHM_MISMATCH 100 -# define RSA_R_BAD_E_VALUE 101 -# define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 -# define RSA_R_BAD_PAD_BYTE_COUNT 103 -# define RSA_R_BAD_SIGNATURE 104 -# define RSA_R_BLOCK_TYPE_IS_NOT_01 106 -# define RSA_R_BLOCK_TYPE_IS_NOT_02 107 -# define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 -# define RSA_R_DATA_TOO_LARGE 109 -# define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 -# define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 -# define RSA_R_DATA_TOO_SMALL 111 -# define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 -# define RSA_R_DIGEST_DOES_NOT_MATCH 158 -# define RSA_R_DIGEST_NOT_ALLOWED 145 -# define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 -# define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 -# define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 -# define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 -# define RSA_R_FIRST_OCTET_INVALID 133 -# define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 -# define RSA_R_INVALID_DIGEST 157 -# define RSA_R_INVALID_DIGEST_LENGTH 143 -# define RSA_R_INVALID_HEADER 137 -# define RSA_R_INVALID_LABEL 160 -# define RSA_R_INVALID_MESSAGE_LENGTH 131 -# define RSA_R_INVALID_MGF1_MD 156 -# define RSA_R_INVALID_MULTI_PRIME_KEY 167 -# define RSA_R_INVALID_OAEP_PARAMETERS 161 -# define RSA_R_INVALID_PADDING 138 -# define RSA_R_INVALID_PADDING_MODE 141 -# define RSA_R_INVALID_PSS_PARAMETERS 149 -# define RSA_R_INVALID_PSS_SALTLEN 146 -# define RSA_R_INVALID_SALT_LENGTH 150 -# define RSA_R_INVALID_TRAILER 139 -# define RSA_R_INVALID_X931_DIGEST 142 -# define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 -# define RSA_R_KEY_PRIME_NUM_INVALID 165 -# define RSA_R_KEY_SIZE_TOO_SMALL 120 -# define RSA_R_LAST_OCTET_INVALID 134 -# define RSA_R_MISSING_PRIVATE_KEY 179 -# define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 -# define RSA_R_MODULUS_TOO_LARGE 105 -# define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 -# define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 -# define RSA_R_MP_R_NOT_PRIME 170 -# define RSA_R_NO_PUBLIC_EXPONENT 140 -# define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 -# define RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES 172 -# define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 -# define RSA_R_OAEP_DECODING_ERROR 121 -# define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 -# define RSA_R_PADDING_CHECK_FAILED 114 -# define RSA_R_PKCS_DECODING_ERROR 159 -# define RSA_R_PSS_SALTLEN_TOO_SMALL 164 -# define RSA_R_P_NOT_PRIME 128 -# define RSA_R_Q_NOT_PRIME 129 -# define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 -# define RSA_R_SLEN_CHECK_FAILED 136 -# define RSA_R_SLEN_RECOVERY_FAILED 135 -# define RSA_R_SSLV3_ROLLBACK_ATTACK 115 -# define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 -# define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 -# define RSA_R_UNKNOWN_DIGEST 166 -# define RSA_R_UNKNOWN_MASK_DIGEST 151 -# define RSA_R_UNKNOWN_PADDING_TYPE 118 -# define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162 -# define RSA_R_UNSUPPORTED_LABEL_SOURCE 163 -# define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 -# define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 -# define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 -# define RSA_R_VALUE_MISSING 147 -# define RSA_R_WRONG_SIGNATURE_LENGTH 119 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/safestack.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/safestack.h deleted file mode 100644 index 38b55789..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/safestack.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 1999-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_SAFESTACK_H -# define HEADER_SAFESTACK_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define STACK_OF(type) struct stack_st_##type - -# define SKM_DEFINE_STACK_OF(t1, t2, t3) \ - STACK_OF(t1); \ - typedef int (*sk_##t1##_compfunc)(const t3 * const *a, const t3 *const *b); \ - typedef void (*sk_##t1##_freefunc)(t3 *a); \ - typedef t3 * (*sk_##t1##_copyfunc)(const t3 *a); \ - static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk) \ - { \ - return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx) \ - { \ - return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n) \ - { \ - return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_free((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_zero((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i) \ - { \ - return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \ - (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \ - { \ - return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk) \ - { \ - return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc) \ - { \ - OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \ - { \ - return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \ - { \ - return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_sort((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk) \ - { \ - return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \ - sk_##t1##_copyfunc copyfunc, \ - sk_##t1##_freefunc freefunc) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \ - (OPENSSL_sk_copyfunc)copyfunc, \ - (OPENSSL_sk_freefunc)freefunc); \ - } \ - static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare) \ - { \ - return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare); \ - } - -# define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2) -# define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t) -# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \ - SKM_DEFINE_STACK_OF(t1, const t2, t2) -# define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t) - -/*- - * Strings are special: normally an lhash entry will point to a single - * (somewhat) mutable object. In the case of strings: - * - * a) Instead of a single char, there is an array of chars, NUL-terminated. - * b) The string may have be immutable. - * - * So, they need their own declarations. Especially important for - * type-checking tools, such as Deputy. - * - * In practice, however, it appears to be hard to have a const - * string. For now, I'm settling for dealing with the fact it is a - * string at all. - */ -typedef char *OPENSSL_STRING; -typedef const char *OPENSSL_CSTRING; - -/*- - * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but - * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned - * above, instead of a single char each entry is a NUL-terminated array of - * chars. So, we have to implement STRING specially for STACK_OF. This is - * dealt with in the autogenerated macros below. - */ -DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char) -DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char) - -/* - * Similarly, we sometimes use a block of characters, NOT nul-terminated. - * These should also be distinguished from "normal" stacks. - */ -typedef void *OPENSSL_BLOCK; -DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) - -/* - * If called without higher optimization (min. -xO3) the Oracle Developer - * Studio compiler generates code for the defined (static inline) functions - * above. - * This would later lead to the linker complaining about missing symbols when - * this header file is included but the resulting object is not linked against - * the Crypto library (openssl#6912). - */ -# ifdef __SUNPRO_C -# pragma weak OPENSSL_sk_num -# pragma weak OPENSSL_sk_value -# pragma weak OPENSSL_sk_new -# pragma weak OPENSSL_sk_new_null -# pragma weak OPENSSL_sk_new_reserve -# pragma weak OPENSSL_sk_reserve -# pragma weak OPENSSL_sk_free -# pragma weak OPENSSL_sk_zero -# pragma weak OPENSSL_sk_delete -# pragma weak OPENSSL_sk_delete_ptr -# pragma weak OPENSSL_sk_push -# pragma weak OPENSSL_sk_unshift -# pragma weak OPENSSL_sk_pop -# pragma weak OPENSSL_sk_shift -# pragma weak OPENSSL_sk_pop_free -# pragma weak OPENSSL_sk_insert -# pragma weak OPENSSL_sk_set -# pragma weak OPENSSL_sk_find -# pragma weak OPENSSL_sk_find_ex -# pragma weak OPENSSL_sk_sort -# pragma weak OPENSSL_sk_is_sorted -# pragma weak OPENSSL_sk_dup -# pragma weak OPENSSL_sk_deep_copy -# pragma weak OPENSSL_sk_set_cmp_func -# endif /* __SUNPRO_C */ - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/seed.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/seed.h deleted file mode 100644 index de10b085..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/seed.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2007-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 - */ - -/* - * Copyright (c) 2007 KISA(Korea Information Security Agency). 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. Neither the name of author nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``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 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. - */ - -#ifndef HEADER_SEED_H -# define HEADER_SEED_H - -# include - -# ifndef OPENSSL_NO_SEED -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* look whether we need 'long' to get 32 bits */ -# ifdef AES_LONG -# ifndef SEED_LONG -# define SEED_LONG 1 -# endif -# endif - -# include - -# define SEED_BLOCK_SIZE 16 -# define SEED_KEY_LENGTH 16 - -typedef struct seed_key_st { -# ifdef SEED_LONG - unsigned long data[32]; -# else - unsigned int data[32]; -# endif -} SEED_KEY_SCHEDULE; - -void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], - SEED_KEY_SCHEDULE *ks); - -void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], - unsigned char d[SEED_BLOCK_SIZE], - const SEED_KEY_SCHEDULE *ks); -void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], - unsigned char d[SEED_BLOCK_SIZE], - const SEED_KEY_SCHEDULE *ks); - -void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, - const SEED_KEY_SCHEDULE *ks, int enc); -void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, - const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int enc); -void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int *num, - int enc); -void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/sha.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/sha.h deleted file mode 100644 index 6a1eb0de..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/sha.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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_SHA_H -# define HEADER_SHA_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! SHA_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define SHA_LONG unsigned int - -# define SHA_LBLOCK 16 -# define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a - * contiguous array of 32 bit wide - * big-endian values. */ -# define SHA_LAST_BLOCK (SHA_CBLOCK-8) -# define SHA_DIGEST_LENGTH 20 - -typedef struct SHAstate_st { - SHA_LONG h0, h1, h2, h3, h4; - SHA_LONG Nl, Nh; - SHA_LONG data[SHA_LBLOCK]; - unsigned int num; -} SHA_CTX; - -int SHA1_Init(SHA_CTX *c); -int SHA1_Update(SHA_CTX *c, const void *data, size_t len); -int SHA1_Final(unsigned char *md, SHA_CTX *c); -unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); -void SHA1_Transform(SHA_CTX *c, const unsigned char *data); - -# define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a - * contiguous array of 32 bit wide - * big-endian values. */ - -typedef struct SHA256state_st { - SHA_LONG h[8]; - SHA_LONG Nl, Nh; - SHA_LONG data[SHA_LBLOCK]; - unsigned int num, md_len; -} SHA256_CTX; - -int SHA224_Init(SHA256_CTX *c); -int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA224_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); -int SHA256_Init(SHA256_CTX *c); -int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA256_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); -void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); - -# define SHA224_DIGEST_LENGTH 28 -# define SHA256_DIGEST_LENGTH 32 -# define SHA384_DIGEST_LENGTH 48 -# define SHA512_DIGEST_LENGTH 64 - -/* - * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 - * being exactly 64-bit wide. See Implementation Notes in sha512.c - * for further details. - */ -/* - * SHA-512 treats input data as a - * contiguous array of 64 bit - * wide big-endian values. - */ -# define SHA512_CBLOCK (SHA_LBLOCK*8) -# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -# define SHA_LONG64 unsigned __int64 -# define U64(C) C##UI64 -# elif defined(__arch64__) -# define SHA_LONG64 unsigned long -# define U64(C) C##UL -# else -# define SHA_LONG64 unsigned long long -# define U64(C) C##ULL -# endif - -typedef struct SHA512state_st { - SHA_LONG64 h[8]; - SHA_LONG64 Nl, Nh; - union { - SHA_LONG64 d[SHA_LBLOCK]; - unsigned char p[SHA512_CBLOCK]; - } u; - unsigned int num, md_len; -} SHA512_CTX; - -int SHA384_Init(SHA512_CTX *c); -int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA384_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); -int SHA512_Init(SHA512_CTX *c); -int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA512_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); -void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/srp.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/srp.h deleted file mode 100644 index aaf13558..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/srp.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2004, EdelKey Project. 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 - * - * Originally written by Christophe Renou and Peter Sylvester, - * for the EdelKey project. - */ - -#ifndef HEADER_SRP_H -# define HEADER_SRP_H - -#include - -#ifndef OPENSSL_NO_SRP -# include -# include -# include -# include -# include - -# ifdef __cplusplus -extern "C" { -# endif - -typedef struct SRP_gN_cache_st { - char *b64_bn; - BIGNUM *bn; -} SRP_gN_cache; - - -DEFINE_STACK_OF(SRP_gN_cache) - -typedef struct SRP_user_pwd_st { - /* Owned by us. */ - char *id; - BIGNUM *s; - BIGNUM *v; - /* Not owned by us. */ - const BIGNUM *g; - const BIGNUM *N; - /* Owned by us. */ - char *info; -} SRP_user_pwd; - -void SRP_user_pwd_free(SRP_user_pwd *user_pwd); - -DEFINE_STACK_OF(SRP_user_pwd) - -typedef struct SRP_VBASE_st { - STACK_OF(SRP_user_pwd) *users_pwd; - STACK_OF(SRP_gN_cache) *gN_cache; -/* to simulate a user */ - char *seed_key; - const BIGNUM *default_g; - const BIGNUM *default_N; -} SRP_VBASE; - -/* - * Internal structure storing N and g pair - */ -typedef struct SRP_gN_st { - char *id; - const BIGNUM *g; - const BIGNUM *N; -} SRP_gN; - -DEFINE_STACK_OF(SRP_gN) - -SRP_VBASE *SRP_VBASE_new(char *seed_key); -void SRP_VBASE_free(SRP_VBASE *vb); -int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); - -/* This method ignores the configured seed and fails for an unknown user. */ -DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)) -/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ -SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); - -char *SRP_create_verifier(const char *user, const char *pass, char **salt, - char **verifier, const char *N, const char *g); -int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, - BIGNUM **verifier, const BIGNUM *N, - const BIGNUM *g); - -# define SRP_NO_ERROR 0 -# define SRP_ERR_VBASE_INCOMPLETE_FILE 1 -# define SRP_ERR_VBASE_BN_LIB 2 -# define SRP_ERR_OPEN_FILE 3 -# define SRP_ERR_MEMORY 4 - -# define DB_srptype 0 -# define DB_srpverifier 1 -# define DB_srpsalt 2 -# define DB_srpid 3 -# define DB_srpgN 4 -# define DB_srpinfo 5 -# undef DB_NUMBER -# define DB_NUMBER 6 - -# define DB_SRP_INDEX 'I' -# define DB_SRP_VALID 'V' -# define DB_SRP_REVOKED 'R' -# define DB_SRP_MODIF 'v' - -/* see srp.c */ -char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N); -SRP_gN *SRP_get_default_gN(const char *id); - -/* server side .... */ -BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, - const BIGNUM *b, const BIGNUM *N); -BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, - const BIGNUM *v); -int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N); -BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N); - -/* client side .... */ -BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass); -BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g); -BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, - const BIGNUM *x, const BIGNUM *a, const BIGNUM *u); -int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N); - -# define SRP_MINIMAL_N 1024 - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/srtp.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/srtp.h deleted file mode 100644 index 0b57c235..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/srtp.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011-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 - */ - -/* - * DTLS code by Eric Rescorla - * - * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. - */ - -#ifndef HEADER_D1_SRTP_H -# define HEADER_D1_SRTP_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define SRTP_AES128_CM_SHA1_80 0x0001 -# define SRTP_AES128_CM_SHA1_32 0x0002 -# define SRTP_AES128_F8_SHA1_80 0x0003 -# define SRTP_AES128_F8_SHA1_32 0x0004 -# define SRTP_NULL_SHA1_80 0x0005 -# define SRTP_NULL_SHA1_32 0x0006 - -/* AEAD SRTP protection profiles from RFC 7714 */ -# define SRTP_AEAD_AES_128_GCM 0x0007 -# define SRTP_AEAD_AES_256_GCM 0x0008 - -# ifndef OPENSSL_NO_SRTP - -__owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); -__owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); - -__owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); -__owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); - -# endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ssl.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ssl.h deleted file mode 100644 index 6724ccf2..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ssl.h +++ /dev/null @@ -1,2438 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved - * Copyright 2005 Nokia. 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_SSL_H -# define HEADER_SSL_H - -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# endif -# include -# include -# include -# include - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* OpenSSL version number for ASN.1 encoding of the session information */ -/*- - * Version 0 - initial version - * Version 1 - added the optional peer certificate - */ -# define SSL_SESSION_ASN1_VERSION 0x0001 - -# define SSL_MAX_SSL_SESSION_ID_LENGTH 32 -# define SSL_MAX_SID_CTX_LENGTH 32 - -# define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) -# define SSL_MAX_KEY_ARG_LENGTH 8 -# define SSL_MAX_MASTER_KEY_LENGTH 48 - -/* The maximum number of encrypt/decrypt pipelines we can support */ -# define SSL_MAX_PIPELINES 32 - -/* text strings for the ciphers */ - -/* These are used to specify which ciphers to use and not to use */ - -# define SSL_TXT_LOW "LOW" -# define SSL_TXT_MEDIUM "MEDIUM" -# define SSL_TXT_HIGH "HIGH" -# define SSL_TXT_FIPS "FIPS" - -# define SSL_TXT_aNULL "aNULL" -# define SSL_TXT_eNULL "eNULL" -# define SSL_TXT_NULL "NULL" - -# define SSL_TXT_kRSA "kRSA" -# define SSL_TXT_kDHr "kDHr"/* this cipher class has been removed */ -# define SSL_TXT_kDHd "kDHd"/* this cipher class has been removed */ -# define SSL_TXT_kDH "kDH"/* this cipher class has been removed */ -# define SSL_TXT_kEDH "kEDH"/* alias for kDHE */ -# define SSL_TXT_kDHE "kDHE" -# define SSL_TXT_kECDHr "kECDHr"/* this cipher class has been removed */ -# define SSL_TXT_kECDHe "kECDHe"/* this cipher class has been removed */ -# define SSL_TXT_kECDH "kECDH"/* this cipher class has been removed */ -# define SSL_TXT_kEECDH "kEECDH"/* alias for kECDHE */ -# define SSL_TXT_kECDHE "kECDHE" -# define SSL_TXT_kPSK "kPSK" -# define SSL_TXT_kRSAPSK "kRSAPSK" -# define SSL_TXT_kECDHEPSK "kECDHEPSK" -# define SSL_TXT_kDHEPSK "kDHEPSK" -# define SSL_TXT_kGOST "kGOST" -# define SSL_TXT_kSRP "kSRP" - -# define SSL_TXT_aRSA "aRSA" -# define SSL_TXT_aDSS "aDSS" -# define SSL_TXT_aDH "aDH"/* this cipher class has been removed */ -# define SSL_TXT_aECDH "aECDH"/* this cipher class has been removed */ -# define SSL_TXT_aECDSA "aECDSA" -# define SSL_TXT_aPSK "aPSK" -# define SSL_TXT_aGOST94 "aGOST94" -# define SSL_TXT_aGOST01 "aGOST01" -# define SSL_TXT_aGOST12 "aGOST12" -# define SSL_TXT_aGOST "aGOST" -# define SSL_TXT_aSRP "aSRP" - -# define SSL_TXT_DSS "DSS" -# define SSL_TXT_DH "DH" -# define SSL_TXT_DHE "DHE"/* same as "kDHE:-ADH" */ -# define SSL_TXT_EDH "EDH"/* alias for DHE */ -# define SSL_TXT_ADH "ADH" -# define SSL_TXT_RSA "RSA" -# define SSL_TXT_ECDH "ECDH" -# define SSL_TXT_EECDH "EECDH"/* alias for ECDHE" */ -# define SSL_TXT_ECDHE "ECDHE"/* same as "kECDHE:-AECDH" */ -# define SSL_TXT_AECDH "AECDH" -# define SSL_TXT_ECDSA "ECDSA" -# define SSL_TXT_PSK "PSK" -# define SSL_TXT_SRP "SRP" - -# define SSL_TXT_DES "DES" -# define SSL_TXT_3DES "3DES" -# define SSL_TXT_RC4 "RC4" -# define SSL_TXT_RC2 "RC2" -# define SSL_TXT_IDEA "IDEA" -# define SSL_TXT_SEED "SEED" -# define SSL_TXT_AES128 "AES128" -# define SSL_TXT_AES256 "AES256" -# define SSL_TXT_AES "AES" -# define SSL_TXT_AES_GCM "AESGCM" -# define SSL_TXT_AES_CCM "AESCCM" -# define SSL_TXT_AES_CCM_8 "AESCCM8" -# define SSL_TXT_CAMELLIA128 "CAMELLIA128" -# define SSL_TXT_CAMELLIA256 "CAMELLIA256" -# define SSL_TXT_CAMELLIA "CAMELLIA" -# define SSL_TXT_CHACHA20 "CHACHA20" -# define SSL_TXT_GOST "GOST89" -# define SSL_TXT_ARIA "ARIA" -# define SSL_TXT_ARIA_GCM "ARIAGCM" -# define SSL_TXT_ARIA128 "ARIA128" -# define SSL_TXT_ARIA256 "ARIA256" - -# define SSL_TXT_MD5 "MD5" -# define SSL_TXT_SHA1 "SHA1" -# define SSL_TXT_SHA "SHA"/* same as "SHA1" */ -# define SSL_TXT_GOST94 "GOST94" -# define SSL_TXT_GOST89MAC "GOST89MAC" -# define SSL_TXT_GOST12 "GOST12" -# define SSL_TXT_GOST89MAC12 "GOST89MAC12" -# define SSL_TXT_SHA256 "SHA256" -# define SSL_TXT_SHA384 "SHA384" - -# define SSL_TXT_SSLV3 "SSLv3" -# define SSL_TXT_TLSV1 "TLSv1" -# define SSL_TXT_TLSV1_1 "TLSv1.1" -# define SSL_TXT_TLSV1_2 "TLSv1.2" - -# define SSL_TXT_ALL "ALL" - -/*- - * COMPLEMENTOF* definitions. These identifiers are used to (de-select) - * ciphers normally not being used. - * Example: "RC4" will activate all ciphers using RC4 including ciphers - * without authentication, which would normally disabled by DEFAULT (due - * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" - * will make sure that it is also disabled in the specific selection. - * COMPLEMENTOF* identifiers are portable between version, as adjustments - * to the default cipher setup will also be included here. - * - * COMPLEMENTOFDEFAULT does not experience the same special treatment that - * DEFAULT gets, as only selection is being done and no sorting as needed - * for DEFAULT. - */ -# define SSL_TXT_CMPALL "COMPLEMENTOFALL" -# define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" - -/* - * The following cipher list is used by default. It also is substituted when - * an application-defined cipher list string starts with 'DEFAULT'. - * This applies to ciphersuites for TLSv1.2 and below. - */ -# define SSL_DEFAULT_CIPHER_LIST "ALL:!COMPLEMENTOFDEFAULT:!eNULL" -/* This is the default set of TLSv1.3 ciphersuites */ -# if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) -# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ - "TLS_CHACHA20_POLY1305_SHA256:" \ - "TLS_AES_128_GCM_SHA256" -# else -# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ - "TLS_AES_128_GCM_SHA256" -#endif -/* - * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always - * starts with a reasonable order, and all we have to do for DEFAULT is - * throwing out anonymous and unencrypted ciphersuites! (The latter are not - * actually enabled by ALL, but "ALL:RSA" would enable some of them.) - */ - -/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ -# define SSL_SENT_SHUTDOWN 1 -# define SSL_RECEIVED_SHUTDOWN 2 - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -# define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 -# define SSL_FILETYPE_PEM X509_FILETYPE_PEM - -/* - * This is needed to stop compilers complaining about the 'struct ssl_st *' - * function parameters used to prototype callbacks in SSL_CTX. - */ -typedef struct ssl_st *ssl_crock_st; -typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; -typedef struct ssl_method_st SSL_METHOD; -typedef struct ssl_cipher_st SSL_CIPHER; -typedef struct ssl_session_st SSL_SESSION; -typedef struct tls_sigalgs_st TLS_SIGALGS; -typedef struct ssl_conf_ctx_st SSL_CONF_CTX; -typedef struct ssl_comp_st SSL_COMP; - -STACK_OF(SSL_CIPHER); -STACK_OF(SSL_COMP); - -/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ -typedef struct srtp_protection_profile_st { - const char *name; - unsigned long id; -} SRTP_PROTECTION_PROFILE; - -DEFINE_STACK_OF(SRTP_PROTECTION_PROFILE) - -typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, - int len, void *arg); -typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, - STACK_OF(SSL_CIPHER) *peer_ciphers, - const SSL_CIPHER **cipher, void *arg); - -/* Extension context codes */ -/* This extension is only allowed in TLS */ -#define SSL_EXT_TLS_ONLY 0x0001 -/* This extension is only allowed in DTLS */ -#define SSL_EXT_DTLS_ONLY 0x0002 -/* Some extensions may be allowed in DTLS but we don't implement them for it */ -#define SSL_EXT_TLS_IMPLEMENTATION_ONLY 0x0004 -/* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */ -#define SSL_EXT_SSL3_ALLOWED 0x0008 -/* Extension is only defined for TLS1.2 and below */ -#define SSL_EXT_TLS1_2_AND_BELOW_ONLY 0x0010 -/* Extension is only defined for TLS1.3 and above */ -#define SSL_EXT_TLS1_3_ONLY 0x0020 -/* Ignore this extension during parsing if we are resuming */ -#define SSL_EXT_IGNORE_ON_RESUMPTION 0x0040 -#define SSL_EXT_CLIENT_HELLO 0x0080 -/* Really means TLS1.2 or below */ -#define SSL_EXT_TLS1_2_SERVER_HELLO 0x0100 -#define SSL_EXT_TLS1_3_SERVER_HELLO 0x0200 -#define SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS 0x0400 -#define SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST 0x0800 -#define SSL_EXT_TLS1_3_CERTIFICATE 0x1000 -#define SSL_EXT_TLS1_3_NEW_SESSION_TICKET 0x2000 -#define SSL_EXT_TLS1_3_CERTIFICATE_REQUEST 0x4000 - -/* Typedefs for handling custom extensions */ - -typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type, - const unsigned char **out, size_t *outlen, - int *al, void *add_arg); - -typedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type, - const unsigned char *out, void *add_arg); - -typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type, - const unsigned char *in, size_t inlen, - int *al, void *parse_arg); - - -typedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char **out, - size_t *outlen, X509 *x, - size_t chainidx, - int *al, void *add_arg); - -typedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char *out, - void *add_arg); - -typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char *in, - size_t inlen, X509 *x, - size_t chainidx, - int *al, void *parse_arg); - -/* Typedef for verification callback */ -typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); - -/* - * Some values are reserved until OpenSSL 1.2.0 because they were previously - * included in SSL_OP_ALL in a 1.1.x release. - * - * Reserved value (until OpenSSL 1.2.0) 0x00000001U - * Reserved value (until OpenSSL 1.2.0) 0x00000002U - */ -/* Allow initial connection to servers that don't support RI */ -# define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004U - -/* Reserved value (until OpenSSL 1.2.0) 0x00000008U */ -# define SSL_OP_TLSEXT_PADDING 0x00000010U -/* Reserved value (until OpenSSL 1.2.0) 0x00000020U */ -# define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040U -/* - * Reserved value (until OpenSSL 1.2.0) 0x00000080U - * Reserved value (until OpenSSL 1.2.0) 0x00000100U - * Reserved value (until OpenSSL 1.2.0) 0x00000200U - */ - -/* In TLSv1.3 allow a non-(ec)dhe based kex_mode */ -# define SSL_OP_ALLOW_NO_DHE_KEX 0x00000400U - -/* - * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in - * OpenSSL 0.9.6d. Usually (depending on the application protocol) the - * workaround is not needed. Unfortunately some broken SSL/TLS - * implementations cannot handle it at all, which is why we include it in - * SSL_OP_ALL. Added in 0.9.6e - */ -# define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800U - -/* DTLS options */ -# define SSL_OP_NO_QUERY_MTU 0x00001000U -/* Turn on Cookie Exchange (on relevant for servers) */ -# define SSL_OP_COOKIE_EXCHANGE 0x00002000U -/* Don't use RFC4507 ticket extension */ -# define SSL_OP_NO_TICKET 0x00004000U -# ifndef OPENSSL_NO_DTLS1_METHOD -/* Use Cisco's "speshul" version of DTLS_BAD_VER - * (only with deprecated DTLSv1_client_method()) */ -# define SSL_OP_CISCO_ANYCONNECT 0x00008000U -# endif - -/* As server, disallow session resumption on renegotiation */ -# define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000U -/* Don't use compression even if supported */ -# define SSL_OP_NO_COMPRESSION 0x00020000U -/* Permit unsafe legacy renegotiation */ -# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000U -/* Disable encrypt-then-mac */ -# define SSL_OP_NO_ENCRYPT_THEN_MAC 0x00080000U - -/* - * Enable TLSv1.3 Compatibility mode. This is on by default. A future version - * of OpenSSL may have this disabled by default. - */ -# define SSL_OP_ENABLE_MIDDLEBOX_COMPAT 0x00100000U - -/* Prioritize Chacha20Poly1305 when client does. - * Modifies SSL_OP_CIPHER_SERVER_PREFERENCE */ -# define SSL_OP_PRIORITIZE_CHACHA 0x00200000U - -/* - * Set on servers to choose the cipher according to the server's preferences - */ -# define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000U -/* - * If set, a server will allow a client to issue a SSLv3.0 version number as - * latest version supported in the premaster secret, even when TLSv1.0 - * (version 3.1) was announced in the client hello. Normally this is - * forbidden to prevent version rollback attacks. - */ -# define SSL_OP_TLS_ROLLBACK_BUG 0x00800000U - -/* - * Switches off automatic TLSv1.3 anti-replay protection for early data. This - * is a server-side option only (no effect on the client). - */ -# define SSL_OP_NO_ANTI_REPLAY 0x01000000U - -# define SSL_OP_NO_SSLv3 0x02000000U -# define SSL_OP_NO_TLSv1 0x04000000U -# define SSL_OP_NO_TLSv1_2 0x08000000U -# define SSL_OP_NO_TLSv1_1 0x10000000U -# define SSL_OP_NO_TLSv1_3 0x20000000U - -# define SSL_OP_NO_DTLSv1 0x04000000U -# define SSL_OP_NO_DTLSv1_2 0x08000000U - -# define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv3|\ - SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2|SSL_OP_NO_TLSv1_3) -# define SSL_OP_NO_DTLS_MASK (SSL_OP_NO_DTLSv1|SSL_OP_NO_DTLSv1_2) - -/* Disallow all renegotiation */ -# define SSL_OP_NO_RENEGOTIATION 0x40000000U - -/* - * Make server add server-hello extension from early version of cryptopro - * draft, when GOST ciphersuite is negotiated. Required for interoperability - * with CryptoPro CSP 3.x - */ -# define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000U - -/* - * SSL_OP_ALL: various bug workarounds that should be rather harmless. - * This used to be 0x000FFFFFL before 0.9.7. - * This used to be 0x80000BFFU before 1.1.1. - */ -# define SSL_OP_ALL (SSL_OP_CRYPTOPRO_TLSEXT_BUG|\ - SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS|\ - SSL_OP_LEGACY_SERVER_CONNECT|\ - SSL_OP_TLSEXT_PADDING|\ - SSL_OP_SAFARI_ECDHE_ECDSA_BUG) - -/* OBSOLETE OPTIONS: retained for compatibility */ - -/* Removed from OpenSSL 1.1.0. Was 0x00000001L */ -/* Related to removed SSLv2. */ -# define SSL_OP_MICROSOFT_SESS_ID_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000002L */ -/* Related to removed SSLv2. */ -# define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x0 -/* Removed from OpenSSL 0.9.8q and 1.0.0c. Was 0x00000008L */ -/* Dead forever, see CVE-2010-4180 */ -# define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x0 -/* Removed from OpenSSL 1.0.1h and 1.0.2. Was 0x00000010L */ -/* Refers to ancient SSLREF and SSLv2. */ -# define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000020 */ -# define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x0 -/* Removed from OpenSSL 0.9.7h and 0.9.8b. Was 0x00000040L */ -# define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000080 */ -/* Ancient SSLeay version. */ -# define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000100L */ -# define SSL_OP_TLS_D5_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000200L */ -# define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00080000L */ -# define SSL_OP_SINGLE_ECDH_USE 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00100000L */ -# define SSL_OP_SINGLE_DH_USE 0x0 -/* Removed from OpenSSL 1.0.1k and 1.0.2. Was 0x00200000L */ -# define SSL_OP_EPHEMERAL_RSA 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x01000000L */ -# define SSL_OP_NO_SSLv2 0x0 -/* Removed from OpenSSL 1.0.1. Was 0x08000000L */ -# define SSL_OP_PKCS1_CHECK_1 0x0 -/* Removed from OpenSSL 1.0.1. Was 0x10000000L */ -# define SSL_OP_PKCS1_CHECK_2 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x20000000L */ -# define SSL_OP_NETSCAPE_CA_DN_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x40000000L */ -# define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x0 - -/* - * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success - * when just a single record has been written): - */ -# define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001U -/* - * Make it possible to retry SSL_write() with changed buffer location (buffer - * contents must stay the same!); this is not the default to avoid the - * misconception that non-blocking SSL_write() behaves like non-blocking - * write(): - */ -# define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002U -/* - * Never bother the application with retries if the transport is blocking: - */ -# define SSL_MODE_AUTO_RETRY 0x00000004U -/* Don't attempt to automatically build certificate chain */ -# define SSL_MODE_NO_AUTO_CHAIN 0x00000008U -/* - * Save RAM by releasing read and write buffers when they're empty. (SSL3 and - * TLS only.) Released buffers are freed. - */ -# define SSL_MODE_RELEASE_BUFFERS 0x00000010U -/* - * Send the current time in the Random fields of the ClientHello and - * ServerHello records for compatibility with hypothetical implementations - * that require it. - */ -# define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020U -# define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040U -/* - * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications - * that reconnect with a downgraded protocol version; see - * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your - * application attempts a normal handshake. Only use this in explicit - * fallback retries, following the guidance in - * draft-ietf-tls-downgrade-scsv-00. - */ -# define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U -/* - * Support Asynchronous operation - */ -# define SSL_MODE_ASYNC 0x00000100U - -/* - * When using DTLS/SCTP, include the terminating zero in the label - * used for computing the endpoint-pair shared secret. Required for - * interoperability with implementations having this bug like these - * older version of OpenSSL: - * - OpenSSL 1.0.0 series - * - OpenSSL 1.0.1 series - * - OpenSSL 1.0.2 series - * - OpenSSL 1.1.0 series - * - OpenSSL 1.1.1 and 1.1.1a - */ -# define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U - -/* Cert related flags */ -/* - * Many implementations ignore some aspects of the TLS standards such as - * enforcing certificate chain algorithms. When this is set we enforce them. - */ -# define SSL_CERT_FLAG_TLS_STRICT 0x00000001U - -/* Suite B modes, takes same values as certificate verify flags */ -# define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 -/* Suite B 192 bit only mode */ -# define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 -/* Suite B 128 bit mode allowing 192 bit algorithms */ -# define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 - -/* Perform all sorts of protocol violations for testing purposes */ -# define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 - -/* Flags for building certificate chains */ -/* Treat any existing certificates as untrusted CAs */ -# define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 -/* Don't include root CA in chain */ -# define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 -/* Just check certificates already there */ -# define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 -/* Ignore verification errors */ -# define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 -/* Clear verification errors from queue */ -# define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 - -/* Flags returned by SSL_check_chain */ -/* Certificate can be used with this session */ -# define CERT_PKEY_VALID 0x1 -/* Certificate can also be used for signing */ -# define CERT_PKEY_SIGN 0x2 -/* EE certificate signing algorithm OK */ -# define CERT_PKEY_EE_SIGNATURE 0x10 -/* CA signature algorithms OK */ -# define CERT_PKEY_CA_SIGNATURE 0x20 -/* EE certificate parameters OK */ -# define CERT_PKEY_EE_PARAM 0x40 -/* CA certificate parameters OK */ -# define CERT_PKEY_CA_PARAM 0x80 -/* Signing explicitly allowed as opposed to SHA1 fallback */ -# define CERT_PKEY_EXPLICIT_SIGN 0x100 -/* Client CA issuer names match (always set for server cert) */ -# define CERT_PKEY_ISSUER_NAME 0x200 -/* Cert type matches client types (always set for server cert) */ -# define CERT_PKEY_CERT_TYPE 0x400 -/* Cert chain suitable to Suite B */ -# define CERT_PKEY_SUITEB 0x800 - -# define SSL_CONF_FLAG_CMDLINE 0x1 -# define SSL_CONF_FLAG_FILE 0x2 -# define SSL_CONF_FLAG_CLIENT 0x4 -# define SSL_CONF_FLAG_SERVER 0x8 -# define SSL_CONF_FLAG_SHOW_ERRORS 0x10 -# define SSL_CONF_FLAG_CERTIFICATE 0x20 -# define SSL_CONF_FLAG_REQUIRE_PRIVATE 0x40 -/* Configuration value types */ -# define SSL_CONF_TYPE_UNKNOWN 0x0 -# define SSL_CONF_TYPE_STRING 0x1 -# define SSL_CONF_TYPE_FILE 0x2 -# define SSL_CONF_TYPE_DIR 0x3 -# define SSL_CONF_TYPE_NONE 0x4 - -/* Maximum length of the application-controlled segment of a a TLSv1.3 cookie */ -# define SSL_COOKIE_LENGTH 4096 - -/* - * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they - * cannot be used to clear bits. - */ - -unsigned long SSL_CTX_get_options(const SSL_CTX *ctx); -unsigned long SSL_get_options(const SSL *s); -unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op); -unsigned long SSL_clear_options(SSL *s, unsigned long op); -unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op); -unsigned long SSL_set_options(SSL *s, unsigned long op); - -# define SSL_CTX_set_mode(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) -# define SSL_CTX_clear_mode(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL) -# define SSL_CTX_get_mode(ctx) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) -# define SSL_clear_mode(ssl,op) \ - SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL) -# define SSL_set_mode(ssl,op) \ - SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) -# define SSL_get_mode(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) -# define SSL_set_mtu(ssl, mtu) \ - SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) -# define DTLS_set_link_mtu(ssl, mtu) \ - SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL) -# define DTLS_get_link_min_mtu(ssl) \ - SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL) - -# define SSL_get_secure_renegotiation_support(ssl) \ - SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) - -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_heartbeat(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT,0,NULL) -# endif - -# define SSL_CTX_set_cert_flags(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL) -# define SSL_set_cert_flags(s,op) \ - SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL) -# define SSL_CTX_clear_cert_flags(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) -# define SSL_clear_cert_flags(s,op) \ - SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) - -void SSL_CTX_set_msg_callback(SSL_CTX *ctx, - void (*cb) (int write_p, int version, - int content_type, const void *buf, - size_t len, SSL *ssl, void *arg)); -void SSL_set_msg_callback(SSL *ssl, - void (*cb) (int write_p, int version, - int content_type, const void *buf, - size_t len, SSL *ssl, void *arg)); -# define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) -# define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) - -# define SSL_get_extms_support(s) \ - SSL_ctrl((s),SSL_CTRL_GET_EXTMS_SUPPORT,0,NULL) - -# ifndef OPENSSL_NO_SRP - -/* see tls_srp.c */ -__owur int SSL_SRP_CTX_init(SSL *s); -__owur int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx); -int SSL_SRP_CTX_free(SSL *ctx); -int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); -__owur int SSL_srp_server_param_with_username(SSL *s, int *ad); -__owur int SRP_Calc_A_param(SSL *s); - -# endif - -/* 100k max cert list */ -# define SSL_MAX_CERT_LIST_DEFAULT 1024*100 - -# define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) - -/* - * This callback type is used inside SSL_CTX, SSL, and in the functions that - * set them. It is used to override the generation of SSL/TLS session IDs in - * a server. Return value should be zero on an error, non-zero to proceed. - * Also, callbacks should themselves check if the id they generate is unique - * otherwise the SSL handshake will fail with an error - callbacks can do - * this using the 'ssl' value they're passed by; - * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in - * is set at the maximum size the session ID can be. In SSLv3/TLSv1 it is 32 - * bytes. The callback can alter this length to be less if desired. It is - * also an error for the callback to set the size to zero. - */ -typedef int (*GEN_SESSION_CB) (SSL *ssl, unsigned char *id, - unsigned int *id_len); - -# define SSL_SESS_CACHE_OFF 0x0000 -# define SSL_SESS_CACHE_CLIENT 0x0001 -# define SSL_SESS_CACHE_SERVER 0x0002 -# define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) -# define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 -/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ -# define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 -# define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 -# define SSL_SESS_CACHE_NO_INTERNAL \ - (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) - -LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); -# define SSL_CTX_sess_number(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) -# define SSL_CTX_sess_connect(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) -# define SSL_CTX_sess_connect_good(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) -# define SSL_CTX_sess_connect_renegotiate(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) -# define SSL_CTX_sess_accept(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) -# define SSL_CTX_sess_accept_renegotiate(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) -# define SSL_CTX_sess_accept_good(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) -# define SSL_CTX_sess_hits(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) -# define SSL_CTX_sess_cb_hits(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) -# define SSL_CTX_sess_misses(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) -# define SSL_CTX_sess_timeouts(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) -# define SSL_CTX_sess_cache_full(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) - -void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, - int (*new_session_cb) (struct ssl_st *ssl, - SSL_SESSION *sess)); -int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, - SSL_SESSION *sess); -void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, - void (*remove_session_cb) (struct ssl_ctx_st - *ctx, - SSL_SESSION *sess)); -void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx, - SSL_SESSION *sess); -void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, - SSL_SESSION *(*get_session_cb) (struct ssl_st - *ssl, - const unsigned char - *data, int len, - int *copy)); -SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, - const unsigned char *data, - int len, int *copy); -void SSL_CTX_set_info_callback(SSL_CTX *ctx, - void (*cb) (const SSL *ssl, int type, int val)); -void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, - int val); -void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, - int (*client_cert_cb) (SSL *ssl, X509 **x509, - EVP_PKEY **pkey)); -int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509, - EVP_PKEY **pkey); -# ifndef OPENSSL_NO_ENGINE -__owur int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); -# endif -void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, - int (*app_gen_cookie_cb) (SSL *ssl, - unsigned char - *cookie, - unsigned int - *cookie_len)); -void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, - int (*app_verify_cookie_cb) (SSL *ssl, - const unsigned - char *cookie, - unsigned int - cookie_len)); - -void SSL_CTX_set_stateless_cookie_generate_cb( - SSL_CTX *ctx, - int (*gen_stateless_cookie_cb) (SSL *ssl, - unsigned char *cookie, - size_t *cookie_len)); -void SSL_CTX_set_stateless_cookie_verify_cb( - SSL_CTX *ctx, - int (*verify_stateless_cookie_cb) (SSL *ssl, - const unsigned char *cookie, - size_t cookie_len)); -# ifndef OPENSSL_NO_NEXTPROTONEG - -typedef int (*SSL_CTX_npn_advertised_cb_func)(SSL *ssl, - const unsigned char **out, - unsigned int *outlen, - void *arg); -void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, - SSL_CTX_npn_advertised_cb_func cb, - void *arg); -# define SSL_CTX_set_npn_advertised_cb SSL_CTX_set_next_protos_advertised_cb - -typedef int (*SSL_CTX_npn_select_cb_func)(SSL *s, - unsigned char **out, - unsigned char *outlen, - const unsigned char *in, - unsigned int inlen, - void *arg); -void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, - SSL_CTX_npn_select_cb_func cb, - void *arg); -# define SSL_CTX_set_npn_select_cb SSL_CTX_set_next_proto_select_cb - -void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, - unsigned *len); -# define SSL_get0_npn_negotiated SSL_get0_next_proto_negotiated -# endif - -__owur int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, - const unsigned char *in, unsigned int inlen, - const unsigned char *client, - unsigned int client_len); - -# define OPENSSL_NPN_UNSUPPORTED 0 -# define OPENSSL_NPN_NEGOTIATED 1 -# define OPENSSL_NPN_NO_OVERLAP 2 - -__owur int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, - unsigned int protos_len); -__owur int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, - unsigned int protos_len); -typedef int (*SSL_CTX_alpn_select_cb_func)(SSL *ssl, - const unsigned char **out, - unsigned char *outlen, - const unsigned char *in, - unsigned int inlen, - void *arg); -void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, - SSL_CTX_alpn_select_cb_func cb, - void *arg); -void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, - unsigned int *len); - -# ifndef OPENSSL_NO_PSK -/* - * the maximum length of the buffer given to callbacks containing the - * resulting identity/psk - */ -# define PSK_MAX_IDENTITY_LEN 128 -# define PSK_MAX_PSK_LEN 256 -typedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl, - const char *hint, - char *identity, - unsigned int max_identity_len, - unsigned char *psk, - unsigned int max_psk_len); -void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb); -void SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb); - -typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl, - const char *identity, - unsigned char *psk, - unsigned int max_psk_len); -void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb); -void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb); - -__owur int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); -__owur int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); -const char *SSL_get_psk_identity_hint(const SSL *s); -const char *SSL_get_psk_identity(const SSL *s); -# endif - -typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl, - const unsigned char *identity, - size_t identity_len, - SSL_SESSION **sess); -typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md, - const unsigned char **id, - size_t *idlen, - SSL_SESSION **sess); - -void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb); -void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, - SSL_psk_find_session_cb_func cb); -void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb); -void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, - SSL_psk_use_session_cb_func cb); - -/* Register callbacks to handle custom TLS Extensions for client or server. */ - -__owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, - unsigned int ext_type); - -__owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, - unsigned int ext_type, - custom_ext_add_cb add_cb, - custom_ext_free_cb free_cb, - void *add_arg, - custom_ext_parse_cb parse_cb, - void *parse_arg); - -__owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, - unsigned int ext_type, - custom_ext_add_cb add_cb, - custom_ext_free_cb free_cb, - void *add_arg, - custom_ext_parse_cb parse_cb, - void *parse_arg); - -__owur int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, - unsigned int context, - SSL_custom_ext_add_cb_ex add_cb, - SSL_custom_ext_free_cb_ex free_cb, - void *add_arg, - SSL_custom_ext_parse_cb_ex parse_cb, - void *parse_arg); - -__owur int SSL_extension_supported(unsigned int ext_type); - -# define SSL_NOTHING 1 -# define SSL_WRITING 2 -# define SSL_READING 3 -# define SSL_X509_LOOKUP 4 -# define SSL_ASYNC_PAUSED 5 -# define SSL_ASYNC_NO_JOBS 6 -# define SSL_CLIENT_HELLO_CB 7 - -/* These will only be used when doing non-blocking IO */ -# define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) -# define SSL_want_read(s) (SSL_want(s) == SSL_READING) -# define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) -# define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) -# define SSL_want_async(s) (SSL_want(s) == SSL_ASYNC_PAUSED) -# define SSL_want_async_job(s) (SSL_want(s) == SSL_ASYNC_NO_JOBS) -# define SSL_want_client_hello_cb(s) (SSL_want(s) == SSL_CLIENT_HELLO_CB) - -# define SSL_MAC_FLAG_READ_MAC_STREAM 1 -# define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 - -/* - * A callback for logging out TLS key material. This callback should log out - * |line| followed by a newline. - */ -typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line); - -/* - * SSL_CTX_set_keylog_callback configures a callback to log key material. This - * is intended for debugging use with tools like Wireshark. The cb function - * should log line followed by a newline. - */ -void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb); - -/* - * SSL_CTX_get_keylog_callback returns the callback configured by - * SSL_CTX_set_keylog_callback. - */ -SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx); - -int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data); -uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); -int SSL_set_max_early_data(SSL *s, uint32_t max_early_data); -uint32_t SSL_get_max_early_data(const SSL *s); -int SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data); -uint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx); -int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data); -uint32_t SSL_get_recv_max_early_data(const SSL *s); - -#ifdef __cplusplus -} -#endif - -# include -# include -# include /* This is mostly sslv3 with a few tweaks */ -# include /* Datagram TLS */ -# include /* Support for the use_srtp extension */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * These need to be after the above set of includes due to a compiler bug - * in VisualStudio 2015 - */ -DEFINE_STACK_OF_CONST(SSL_CIPHER) -DEFINE_STACK_OF(SSL_COMP) - -/* compatibility */ -# define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)(arg))) -# define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) -# define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0, \ - (char *)(a))) -# define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) -# define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) -# define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0, \ - (char *)(arg))) -DEPRECATEDIN_1_1_0(void SSL_set_debug(SSL *s, int debug)) - -/* TLSv1.3 KeyUpdate message types */ -/* -1 used so that this is an invalid value for the on-the-wire protocol */ -#define SSL_KEY_UPDATE_NONE -1 -/* Values as defined for the on-the-wire protocol */ -#define SSL_KEY_UPDATE_NOT_REQUESTED 0 -#define SSL_KEY_UPDATE_REQUESTED 1 - -/* - * The valid handshake states (one for each type message sent and one for each - * type of message received). There are also two "special" states: - * TLS = TLS or DTLS state - * DTLS = DTLS specific state - * CR/SR = Client Read/Server Read - * CW/SW = Client Write/Server Write - * - * The "special" states are: - * TLS_ST_BEFORE = No handshake has been initiated yet - * TLS_ST_OK = A handshake has been successfully completed - */ -typedef enum { - TLS_ST_BEFORE, - TLS_ST_OK, - DTLS_ST_CR_HELLO_VERIFY_REQUEST, - TLS_ST_CR_SRVR_HELLO, - TLS_ST_CR_CERT, - TLS_ST_CR_CERT_STATUS, - TLS_ST_CR_KEY_EXCH, - TLS_ST_CR_CERT_REQ, - TLS_ST_CR_SRVR_DONE, - TLS_ST_CR_SESSION_TICKET, - TLS_ST_CR_CHANGE, - TLS_ST_CR_FINISHED, - TLS_ST_CW_CLNT_HELLO, - TLS_ST_CW_CERT, - TLS_ST_CW_KEY_EXCH, - TLS_ST_CW_CERT_VRFY, - TLS_ST_CW_CHANGE, - TLS_ST_CW_NEXT_PROTO, - TLS_ST_CW_FINISHED, - TLS_ST_SW_HELLO_REQ, - TLS_ST_SR_CLNT_HELLO, - DTLS_ST_SW_HELLO_VERIFY_REQUEST, - TLS_ST_SW_SRVR_HELLO, - TLS_ST_SW_CERT, - TLS_ST_SW_KEY_EXCH, - TLS_ST_SW_CERT_REQ, - TLS_ST_SW_SRVR_DONE, - TLS_ST_SR_CERT, - TLS_ST_SR_KEY_EXCH, - TLS_ST_SR_CERT_VRFY, - TLS_ST_SR_NEXT_PROTO, - TLS_ST_SR_CHANGE, - TLS_ST_SR_FINISHED, - TLS_ST_SW_SESSION_TICKET, - TLS_ST_SW_CERT_STATUS, - TLS_ST_SW_CHANGE, - TLS_ST_SW_FINISHED, - TLS_ST_SW_ENCRYPTED_EXTENSIONS, - TLS_ST_CR_ENCRYPTED_EXTENSIONS, - TLS_ST_CR_CERT_VRFY, - TLS_ST_SW_CERT_VRFY, - TLS_ST_CR_HELLO_REQ, - TLS_ST_SW_KEY_UPDATE, - TLS_ST_CW_KEY_UPDATE, - TLS_ST_SR_KEY_UPDATE, - TLS_ST_CR_KEY_UPDATE, - TLS_ST_EARLY_DATA, - TLS_ST_PENDING_EARLY_DATA_END, - TLS_ST_CW_END_OF_EARLY_DATA, - TLS_ST_SR_END_OF_EARLY_DATA -} OSSL_HANDSHAKE_STATE; - -/* - * Most of the following state values are no longer used and are defined to be - * the closest equivalent value in the current state machine code. Not all - * defines have an equivalent and are set to a dummy value (-1). SSL_ST_CONNECT - * and SSL_ST_ACCEPT are still in use in the definition of SSL_CB_ACCEPT_LOOP, - * SSL_CB_ACCEPT_EXIT, SSL_CB_CONNECT_LOOP and SSL_CB_CONNECT_EXIT. - */ - -# define SSL_ST_CONNECT 0x1000 -# define SSL_ST_ACCEPT 0x2000 - -# define SSL_ST_MASK 0x0FFF - -# define SSL_CB_LOOP 0x01 -# define SSL_CB_EXIT 0x02 -# define SSL_CB_READ 0x04 -# define SSL_CB_WRITE 0x08 -# define SSL_CB_ALERT 0x4000/* used in callback */ -# define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) -# define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) -# define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) -# define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) -# define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) -# define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) -# define SSL_CB_HANDSHAKE_START 0x10 -# define SSL_CB_HANDSHAKE_DONE 0x20 - -/* Is the SSL_connection established? */ -# define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a)) -# define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a)) -int SSL_in_init(const SSL *s); -int SSL_in_before(const SSL *s); -int SSL_is_init_finished(const SSL *s); - -/* - * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you - * should not need these - */ -# define SSL_ST_READ_HEADER 0xF0 -# define SSL_ST_READ_BODY 0xF1 -# define SSL_ST_READ_DONE 0xF2 - -/*- - * Obtain latest Finished message - * -- that we sent (SSL_get_finished) - * -- that we expected from peer (SSL_get_peer_finished). - * Returns length (0 == no Finished so far), copies up to 'count' bytes. - */ -size_t SSL_get_finished(const SSL *s, void *buf, size_t count); -size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); - -/* - * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options are - * 'ored' with SSL_VERIFY_PEER if they are desired - */ -# define SSL_VERIFY_NONE 0x00 -# define SSL_VERIFY_PEER 0x01 -# define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 -# define SSL_VERIFY_CLIENT_ONCE 0x04 -# define SSL_VERIFY_POST_HANDSHAKE 0x08 - -# if OPENSSL_API_COMPAT < 0x10100000L -# define OpenSSL_add_ssl_algorithms() SSL_library_init() -# define SSLeay_add_ssl_algorithms() SSL_library_init() -# endif - -/* More backward compatibility */ -# define SSL_get_cipher(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) -# define SSL_get_cipher_bits(s,np) \ - SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) -# define SSL_get_cipher_version(s) \ - SSL_CIPHER_get_version(SSL_get_current_cipher(s)) -# define SSL_get_cipher_name(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) -# define SSL_get_time(a) SSL_SESSION_get_time(a) -# define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) -# define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) -# define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) - -# define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) -# define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) - -DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) -# define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value - * from SSL_AD_... */ -/* These alert types are for SSLv3 and TLSv1 */ -# define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY -/* fatal */ -# define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE -/* fatal */ -# define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC -# define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED -# define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW -/* fatal */ -# define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE -/* fatal */ -# define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE -/* Not for TLS */ -# define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE -# define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE -# define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE -# define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED -# define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED -# define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN -/* fatal */ -# define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER -/* fatal */ -# define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA -/* fatal */ -# define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED -/* fatal */ -# define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR -# define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR -/* fatal */ -# define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION -/* fatal */ -# define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION -/* fatal */ -# define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY -/* fatal */ -# define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR -# define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED -# define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION -# define SSL_AD_MISSING_EXTENSION TLS13_AD_MISSING_EXTENSION -# define SSL_AD_CERTIFICATE_REQUIRED TLS13_AD_CERTIFICATE_REQUIRED -# define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION -# define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE -# define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME -# define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE -# define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE -/* fatal */ -# define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY -/* fatal */ -# define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK -# define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL -# define SSL_ERROR_NONE 0 -# define SSL_ERROR_SSL 1 -# define SSL_ERROR_WANT_READ 2 -# define SSL_ERROR_WANT_WRITE 3 -# define SSL_ERROR_WANT_X509_LOOKUP 4 -# define SSL_ERROR_SYSCALL 5/* look at error stack/return - * value/errno */ -# define SSL_ERROR_ZERO_RETURN 6 -# define SSL_ERROR_WANT_CONNECT 7 -# define SSL_ERROR_WANT_ACCEPT 8 -# define SSL_ERROR_WANT_ASYNC 9 -# define SSL_ERROR_WANT_ASYNC_JOB 10 -# define SSL_ERROR_WANT_CLIENT_HELLO_CB 11 -# define SSL_CTRL_SET_TMP_DH 3 -# define SSL_CTRL_SET_TMP_ECDH 4 -# define SSL_CTRL_SET_TMP_DH_CB 6 -# define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 -# define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 -# define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 -# define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 -# define SSL_CTRL_GET_FLAGS 13 -# define SSL_CTRL_EXTRA_CHAIN_CERT 14 -# define SSL_CTRL_SET_MSG_CALLBACK 15 -# define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 -/* only applies to datagram connections */ -# define SSL_CTRL_SET_MTU 17 -/* Stats */ -# define SSL_CTRL_SESS_NUMBER 20 -# define SSL_CTRL_SESS_CONNECT 21 -# define SSL_CTRL_SESS_CONNECT_GOOD 22 -# define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 -# define SSL_CTRL_SESS_ACCEPT 24 -# define SSL_CTRL_SESS_ACCEPT_GOOD 25 -# define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 -# define SSL_CTRL_SESS_HIT 27 -# define SSL_CTRL_SESS_CB_HIT 28 -# define SSL_CTRL_SESS_MISSES 29 -# define SSL_CTRL_SESS_TIMEOUTS 30 -# define SSL_CTRL_SESS_CACHE_FULL 31 -# define SSL_CTRL_MODE 33 -# define SSL_CTRL_GET_READ_AHEAD 40 -# define SSL_CTRL_SET_READ_AHEAD 41 -# define SSL_CTRL_SET_SESS_CACHE_SIZE 42 -# define SSL_CTRL_GET_SESS_CACHE_SIZE 43 -# define SSL_CTRL_SET_SESS_CACHE_MODE 44 -# define SSL_CTRL_GET_SESS_CACHE_MODE 45 -# define SSL_CTRL_GET_MAX_CERT_LIST 50 -# define SSL_CTRL_SET_MAX_CERT_LIST 51 -# define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 -/* see tls1.h for macros based on these */ -# define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 -# define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 -# define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 -# define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 -# define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 -# define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 -# define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 */ -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 */ -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 */ -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 -# define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 -# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 -# define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 -# define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 -# define SSL_CTRL_SET_SRP_ARG 78 -# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 -# define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 -# define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT 85 -# define SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING 86 -# define SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS 87 -# endif -# define DTLS_CTRL_GET_TIMEOUT 73 -# define DTLS_CTRL_HANDLE_TIMEOUT 74 -# define SSL_CTRL_GET_RI_SUPPORT 76 -# define SSL_CTRL_CLEAR_MODE 78 -# define SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB 79 -# define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 -# define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 -# define SSL_CTRL_CHAIN 88 -# define SSL_CTRL_CHAIN_CERT 89 -# define SSL_CTRL_GET_GROUPS 90 -# define SSL_CTRL_SET_GROUPS 91 -# define SSL_CTRL_SET_GROUPS_LIST 92 -# define SSL_CTRL_GET_SHARED_GROUP 93 -# define SSL_CTRL_SET_SIGALGS 97 -# define SSL_CTRL_SET_SIGALGS_LIST 98 -# define SSL_CTRL_CERT_FLAGS 99 -# define SSL_CTRL_CLEAR_CERT_FLAGS 100 -# define SSL_CTRL_SET_CLIENT_SIGALGS 101 -# define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 -# define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 -# define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 -# define SSL_CTRL_BUILD_CERT_CHAIN 105 -# define SSL_CTRL_SET_VERIFY_CERT_STORE 106 -# define SSL_CTRL_SET_CHAIN_CERT_STORE 107 -# define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 -# define SSL_CTRL_GET_PEER_TMP_KEY 109 -# define SSL_CTRL_GET_RAW_CIPHERLIST 110 -# define SSL_CTRL_GET_EC_POINT_FORMATS 111 -# define SSL_CTRL_GET_CHAIN_CERTS 115 -# define SSL_CTRL_SELECT_CURRENT_CERT 116 -# define SSL_CTRL_SET_CURRENT_CERT 117 -# define SSL_CTRL_SET_DH_AUTO 118 -# define DTLS_CTRL_SET_LINK_MTU 120 -# define DTLS_CTRL_GET_LINK_MIN_MTU 121 -# define SSL_CTRL_GET_EXTMS_SUPPORT 122 -# define SSL_CTRL_SET_MIN_PROTO_VERSION 123 -# define SSL_CTRL_SET_MAX_PROTO_VERSION 124 -# define SSL_CTRL_SET_SPLIT_SEND_FRAGMENT 125 -# define SSL_CTRL_SET_MAX_PIPELINES 126 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 127 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129 -# define SSL_CTRL_GET_MIN_PROTO_VERSION 130 -# define SSL_CTRL_GET_MAX_PROTO_VERSION 131 -# define SSL_CTRL_GET_SIGNATURE_NID 132 -# define SSL_CTRL_GET_TMP_KEY 133 -# define SSL_CERT_SET_FIRST 1 -# define SSL_CERT_SET_NEXT 2 -# define SSL_CERT_SET_SERVER 3 -# define DTLSv1_get_timeout(ssl, arg) \ - SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)(arg)) -# define DTLSv1_handle_timeout(ssl) \ - SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL) -# define SSL_num_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) -# define SSL_clear_num_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) -# define SSL_total_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) -# define SSL_CTX_set_tmp_dh(ctx,dh) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) -# define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) -# define SSL_CTX_set_dh_auto(ctx, onoff) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_DH_AUTO,onoff,NULL) -# define SSL_set_dh_auto(s, onoff) \ - SSL_ctrl(s,SSL_CTRL_SET_DH_AUTO,onoff,NULL) -# define SSL_set_tmp_dh(ssl,dh) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) -# define SSL_set_tmp_ecdh(ssl,ecdh) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) -# define SSL_CTX_add_extra_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509)) -# define SSL_CTX_get_extra_chain_certs(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509) -# define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509) -# define SSL_CTX_clear_extra_chain_certs(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL) -# define SSL_CTX_set0_chain(ctx,sk) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk)) -# define SSL_CTX_set1_chain(ctx,sk) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)(sk)) -# define SSL_CTX_add0_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) -# define SSL_CTX_add1_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) -# define SSL_CTX_get0_chain_certs(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) -# define SSL_CTX_clear_chain_certs(ctx) \ - SSL_CTX_set0_chain(ctx,NULL) -# define SSL_CTX_build_cert_chain(ctx, flags) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) -# define SSL_CTX_select_current_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) -# define SSL_CTX_set_current_cert(ctx, op) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) -# define SSL_CTX_set0_verify_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) -# define SSL_CTX_set1_verify_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) -# define SSL_CTX_set0_chain_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) -# define SSL_CTX_set1_chain_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) -# define SSL_set0_chain(s,sk) \ - SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk)) -# define SSL_set1_chain(s,sk) \ - SSL_ctrl(s,SSL_CTRL_CHAIN,1,(char *)(sk)) -# define SSL_add0_chain_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) -# define SSL_add1_chain_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) -# define SSL_get0_chain_certs(s,px509) \ - SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERTS,0,px509) -# define SSL_clear_chain_certs(s) \ - SSL_set0_chain(s,NULL) -# define SSL_build_cert_chain(s, flags) \ - SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) -# define SSL_select_current_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) -# define SSL_set_current_cert(s,op) \ - SSL_ctrl(s,SSL_CTRL_SET_CURRENT_CERT, op, NULL) -# define SSL_set0_verify_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) -# define SSL_set1_verify_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) -# define SSL_set0_chain_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) -# define SSL_set1_chain_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) -# define SSL_get1_groups(s, glist) \ - SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist)) -# define SSL_CTX_set1_groups(ctx, glist, glistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) -# define SSL_CTX_set1_groups_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(s)) -# define SSL_set1_groups(s, glist, glistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) -# define SSL_set1_groups_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(str)) -# define SSL_get_shared_group(s, n) \ - SSL_ctrl(s,SSL_CTRL_GET_SHARED_GROUP,n,NULL) -# define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) -# define SSL_CTX_set1_sigalgs_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(s)) -# define SSL_set1_sigalgs(s, slist, slistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) -# define SSL_set1_sigalgs_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(str)) -# define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) -# define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(s)) -# define SSL_set1_client_sigalgs(s, slist, slistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) -# define SSL_set1_client_sigalgs_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(str)) -# define SSL_get0_certificate_types(s, clist) \ - SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)(clist)) -# define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen, \ - (char *)(clist)) -# define SSL_set1_client_certificate_types(s, clist, clistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)(clist)) -# define SSL_get_signature_nid(s, pn) \ - SSL_ctrl(s,SSL_CTRL_GET_SIGNATURE_NID,0,pn) -# define SSL_get_peer_signature_nid(s, pn) \ - SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn) -# define SSL_get_peer_tmp_key(s, pk) \ - SSL_ctrl(s,SSL_CTRL_GET_PEER_TMP_KEY,0,pk) -# define SSL_get_tmp_key(s, pk) \ - SSL_ctrl(s,SSL_CTRL_GET_TMP_KEY,0,pk) -# define SSL_get0_raw_cipherlist(s, plst) \ - SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,plst) -# define SSL_get0_ec_point_formats(s, plst) \ - SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,plst) -# define SSL_CTX_set_min_proto_version(ctx, version) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) -# define SSL_CTX_set_max_proto_version(ctx, version) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) -# define SSL_CTX_get_min_proto_version(ctx) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) -# define SSL_CTX_get_max_proto_version(ctx) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) -# define SSL_set_min_proto_version(s, version) \ - SSL_ctrl(s, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) -# define SSL_set_max_proto_version(s, version) \ - SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) -# define SSL_get_min_proto_version(s) \ - SSL_ctrl(s, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) -# define SSL_get_max_proto_version(s) \ - SSL_ctrl(s, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) - -/* Backwards compatibility, original 1.1.0 names */ -# define SSL_CTRL_GET_SERVER_TMP_KEY \ - SSL_CTRL_GET_PEER_TMP_KEY -# define SSL_get_server_tmp_key(s, pk) \ - SSL_get_peer_tmp_key(s, pk) - -/* - * The following symbol names are old and obsolete. They are kept - * for compatibility reasons only and should not be used anymore. - */ -# define SSL_CTRL_GET_CURVES SSL_CTRL_GET_GROUPS -# define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS -# define SSL_CTRL_SET_CURVES_LIST SSL_CTRL_SET_GROUPS_LIST -# define SSL_CTRL_GET_SHARED_CURVE SSL_CTRL_GET_SHARED_GROUP - -# define SSL_get1_curves SSL_get1_groups -# define SSL_CTX_set1_curves SSL_CTX_set1_groups -# define SSL_CTX_set1_curves_list SSL_CTX_set1_groups_list -# define SSL_set1_curves SSL_set1_groups -# define SSL_set1_curves_list SSL_set1_groups_list -# define SSL_get_shared_curve SSL_get_shared_group - - -# if OPENSSL_API_COMPAT < 0x10100000L -/* Provide some compatibility macros for removed functionality. */ -# define SSL_CTX_need_tmp_RSA(ctx) 0 -# define SSL_CTX_set_tmp_rsa(ctx,rsa) 1 -# define SSL_need_tmp_RSA(ssl) 0 -# define SSL_set_tmp_rsa(ssl,rsa) 1 -# define SSL_CTX_set_ecdh_auto(dummy, onoff) ((onoff) != 0) -# define SSL_set_ecdh_auto(dummy, onoff) ((onoff) != 0) -/* - * We "pretend" to call the callback to avoid warnings about unused static - * functions. - */ -# define SSL_CTX_set_tmp_rsa_callback(ctx, cb) while(0) (cb)(NULL, 0, 0) -# define SSL_set_tmp_rsa_callback(ssl, cb) while(0) (cb)(NULL, 0, 0) -# endif -__owur const BIO_METHOD *BIO_f_ssl(void); -__owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client); -__owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx); -__owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); -__owur int BIO_ssl_copy_session_id(BIO *to, BIO *from); -void BIO_ssl_shutdown(BIO *ssl_bio); - -__owur int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); -__owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); -int SSL_CTX_up_ref(SSL_CTX *ctx); -void SSL_CTX_free(SSL_CTX *); -__owur long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); -__owur long SSL_CTX_get_timeout(const SSL_CTX *ctx); -__owur X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); -void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); -void SSL_CTX_set1_cert_store(SSL_CTX *, X509_STORE *); -__owur int SSL_want(const SSL *s); -__owur int SSL_clear(SSL *s); - -void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); - -__owur const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); -__owur const SSL_CIPHER *SSL_get_pending_cipher(const SSL *s); -__owur int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); -__owur const char *SSL_CIPHER_get_version(const SSL_CIPHER *c); -__owur const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); -__owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); -__owur const char *OPENSSL_cipher_name(const char *rfc_name); -__owur uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c); -__owur uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c); -__owur int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c); -__owur int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c); -__owur const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c); -__owur int SSL_CIPHER_is_aead(const SSL_CIPHER *c); - -__owur int SSL_get_fd(const SSL *s); -__owur int SSL_get_rfd(const SSL *s); -__owur int SSL_get_wfd(const SSL *s); -__owur const char *SSL_get_cipher_list(const SSL *s, int n); -__owur char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size); -__owur int SSL_get_read_ahead(const SSL *s); -__owur int SSL_pending(const SSL *s); -__owur int SSL_has_pending(const SSL *s); -# ifndef OPENSSL_NO_SOCK -__owur int SSL_set_fd(SSL *s, int fd); -__owur int SSL_set_rfd(SSL *s, int fd); -__owur int SSL_set_wfd(SSL *s, int fd); -# endif -void SSL_set0_rbio(SSL *s, BIO *rbio); -void SSL_set0_wbio(SSL *s, BIO *wbio); -void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); -__owur BIO *SSL_get_rbio(const SSL *s); -__owur BIO *SSL_get_wbio(const SSL *s); -__owur int SSL_set_cipher_list(SSL *s, const char *str); -__owur int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); -__owur int SSL_set_ciphersuites(SSL *s, const char *str); -void SSL_set_read_ahead(SSL *s, int yes); -__owur int SSL_get_verify_mode(const SSL *s); -__owur int SSL_get_verify_depth(const SSL *s); -__owur SSL_verify_cb SSL_get_verify_callback(const SSL *s); -void SSL_set_verify(SSL *s, int mode, SSL_verify_cb callback); -void SSL_set_verify_depth(SSL *s, int depth); -void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg); -# ifndef OPENSSL_NO_RSA -__owur int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); -__owur int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, - long len); -# endif -__owur int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); -__owur int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, - long len); -__owur int SSL_use_certificate(SSL *ssl, X509 *x); -__owur int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); -__owur int SSL_use_cert_and_key(SSL *ssl, X509 *x509, EVP_PKEY *privatekey, - STACK_OF(X509) *chain, int override); - - -/* serverinfo file format versions */ -# define SSL_SERVERINFOV1 1 -# define SSL_SERVERINFOV2 2 - -/* Set serverinfo data for the current active cert. */ -__owur int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, - size_t serverinfo_length); -__owur int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version, - const unsigned char *serverinfo, - size_t serverinfo_length); -__owur int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); - -#ifndef OPENSSL_NO_RSA -__owur int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); -#endif - -__owur int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); -__owur int SSL_use_certificate_file(SSL *ssl, const char *file, int type); - -#ifndef OPENSSL_NO_RSA -__owur int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, - int type); -#endif -__owur int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, - int type); -__owur int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, - int type); -/* PEM type */ -__owur int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); -__owur int SSL_use_certificate_chain_file(SSL *ssl, const char *file); -__owur STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); -__owur int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, - const char *file); -int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, - const char *dir); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_load_error_strings() \ - OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ - | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) -# endif - -__owur const char *SSL_state_string(const SSL *s); -__owur const char *SSL_rstate_string(const SSL *s); -__owur const char *SSL_state_string_long(const SSL *s); -__owur const char *SSL_rstate_string_long(const SSL *s); -__owur long SSL_SESSION_get_time(const SSL_SESSION *s); -__owur long SSL_SESSION_set_time(SSL_SESSION *s, long t); -__owur long SSL_SESSION_get_timeout(const SSL_SESSION *s); -__owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); -__owur int SSL_SESSION_get_protocol_version(const SSL_SESSION *s); -__owur int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version); - -__owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s); -__owur int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname); -void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s, - const unsigned char **alpn, - size_t *len); -__owur int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, - const unsigned char *alpn, - size_t len); -__owur const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s); -__owur int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher); -__owur int SSL_SESSION_has_ticket(const SSL_SESSION *s); -__owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s); -void SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick, - size_t *len); -__owur uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s); -__owur int SSL_SESSION_set_max_early_data(SSL_SESSION *s, - uint32_t max_early_data); -__owur int SSL_copy_session_id(SSL *to, const SSL *from); -__owur X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); -__owur int SSL_SESSION_set1_id_context(SSL_SESSION *s, - const unsigned char *sid_ctx, - unsigned int sid_ctx_len); -__owur int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, - unsigned int sid_len); -__owur int SSL_SESSION_is_resumable(const SSL_SESSION *s); - -__owur SSL_SESSION *SSL_SESSION_new(void); -__owur SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src); -const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, - unsigned int *len); -const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s, - unsigned int *len); -__owur unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); -# ifndef OPENSSL_NO_STDIO -int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); -# endif -int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); -int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x); -int SSL_SESSION_up_ref(SSL_SESSION *ses); -void SSL_SESSION_free(SSL_SESSION *ses); -__owur int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); -__owur int SSL_set_session(SSL *to, SSL_SESSION *session); -int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session); -int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session); -__owur int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); -__owur int SSL_set_generate_session_id(SSL *s, GEN_SESSION_CB cb); -__owur int SSL_has_matching_session_id(const SSL *s, - const unsigned char *id, - unsigned int id_len); -SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, - long length); - -# ifdef HEADER_X509_H -__owur X509 *SSL_get_peer_certificate(const SSL *s); -# endif - -__owur STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); - -__owur int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); -__owur int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); -__owur SSL_verify_cb SSL_CTX_get_verify_callback(const SSL_CTX *ctx); -void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb callback); -void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); -void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, - int (*cb) (X509_STORE_CTX *, void *), - void *arg); -void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), - void *arg); -# ifndef OPENSSL_NO_RSA -__owur int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); -__owur int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, - long len); -# endif -__owur int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); -__owur int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, - const unsigned char *d, long len); -__owur int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); -__owur int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, - const unsigned char *d); -__owur int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey, - STACK_OF(X509) *chain, int override); - -void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); -void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); -pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx); -void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx); -void SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb); -void SSL_set_default_passwd_cb_userdata(SSL *s, void *u); -pem_password_cb *SSL_get_default_passwd_cb(SSL *s); -void *SSL_get_default_passwd_cb_userdata(SSL *s); - -__owur int SSL_CTX_check_private_key(const SSL_CTX *ctx); -__owur int SSL_check_private_key(const SSL *ctx); - -__owur int SSL_CTX_set_session_id_context(SSL_CTX *ctx, - const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - -SSL *SSL_new(SSL_CTX *ctx); -int SSL_up_ref(SSL *s); -int SSL_is_dtls(const SSL *s); -__owur int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - -__owur int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose); -__owur int SSL_set_purpose(SSL *ssl, int purpose); -__owur int SSL_CTX_set_trust(SSL_CTX *ctx, int trust); -__owur int SSL_set_trust(SSL *ssl, int trust); - -__owur int SSL_set1_host(SSL *s, const char *hostname); -__owur int SSL_add1_host(SSL *s, const char *hostname); -__owur const char *SSL_get0_peername(SSL *s); -void SSL_set_hostflags(SSL *s, unsigned int flags); - -__owur int SSL_CTX_dane_enable(SSL_CTX *ctx); -__owur int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, - uint8_t mtype, uint8_t ord); -__owur int SSL_dane_enable(SSL *s, const char *basedomain); -__owur int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector, - uint8_t mtype, unsigned const char *data, size_t dlen); -__owur int SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki); -__owur int SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector, - uint8_t *mtype, unsigned const char **data, - size_t *dlen); -/* - * Bridge opacity barrier between libcrypt and libssl, also needed to support - * offline testing in test/danetest.c - */ -SSL_DANE *SSL_get0_dane(SSL *ssl); -/* - * DANE flags - */ -unsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags); -unsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags); -unsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags); -unsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags); - -__owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); -__owur int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); - -__owur X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); -__owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); - -# ifndef OPENSSL_NO_SRP -int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); -int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); -int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); -int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, - char *(*cb) (SSL *, void *)); -int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, - int (*cb) (SSL *, void *)); -int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, - int (*cb) (SSL *, int *, void *)); -int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); - -int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, - BIGNUM *sa, BIGNUM *v, char *info); -int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, - const char *grp); - -__owur BIGNUM *SSL_get_srp_g(SSL *s); -__owur BIGNUM *SSL_get_srp_N(SSL *s); - -__owur char *SSL_get_srp_username(SSL *s); -__owur char *SSL_get_srp_userinfo(SSL *s); -# endif - -/* - * ClientHello callback and helpers. - */ - -# define SSL_CLIENT_HELLO_SUCCESS 1 -# define SSL_CLIENT_HELLO_ERROR 0 -# define SSL_CLIENT_HELLO_RETRY (-1) - -typedef int (*SSL_client_hello_cb_fn) (SSL *s, int *al, void *arg); -void SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn cb, - void *arg); -int SSL_client_hello_isv2(SSL *s); -unsigned int SSL_client_hello_get0_legacy_version(SSL *s); -size_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_compression_methods(SSL *s, - const unsigned char **out); -int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen); -int SSL_client_hello_get0_ext(SSL *s, unsigned int type, - const unsigned char **out, size_t *outlen); - -void SSL_certs_clear(SSL *s); -void SSL_free(SSL *ssl); -# ifdef OSSL_ASYNC_FD -/* - * Windows application developer has to include windows.h to use these. - */ -__owur int SSL_waiting_for_async(SSL *s); -__owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds); -__owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, - size_t *numaddfds, OSSL_ASYNC_FD *delfd, - size_t *numdelfds); -# endif -__owur int SSL_accept(SSL *ssl); -__owur int SSL_stateless(SSL *s); -__owur int SSL_connect(SSL *ssl); -__owur int SSL_read(SSL *ssl, void *buf, int num); -__owur int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); - -# define SSL_READ_EARLY_DATA_ERROR 0 -# define SSL_READ_EARLY_DATA_SUCCESS 1 -# define SSL_READ_EARLY_DATA_FINISH 2 - -__owur int SSL_read_early_data(SSL *s, void *buf, size_t num, - size_t *readbytes); -__owur int SSL_peek(SSL *ssl, void *buf, int num); -__owur int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); -__owur int SSL_write(SSL *ssl, const void *buf, int num); -__owur int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written); -__owur int SSL_write_early_data(SSL *s, const void *buf, size_t num, - size_t *written); -long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); -long SSL_callback_ctrl(SSL *, int, void (*)(void)); -long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); -long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); - -# define SSL_EARLY_DATA_NOT_SENT 0 -# define SSL_EARLY_DATA_REJECTED 1 -# define SSL_EARLY_DATA_ACCEPTED 2 - -__owur int SSL_get_early_data_status(const SSL *s); - -__owur int SSL_get_error(const SSL *s, int ret_code); -__owur const char *SSL_get_version(const SSL *s); - -/* This sets the 'default' SSL version that SSL_new() will create */ -__owur int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); - -# ifndef OPENSSL_NO_SSL3_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_method(void)) /* SSLv3 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_client_method(void)) -# endif - -#define SSLv23_method TLS_method -#define SSLv23_server_method TLS_server_method -#define SSLv23_client_method TLS_client_method - -/* Negotiate highest available SSL/TLS version */ -__owur const SSL_METHOD *TLS_method(void); -__owur const SSL_METHOD *TLS_server_method(void); -__owur const SSL_METHOD *TLS_client_method(void); - -# ifndef OPENSSL_NO_TLS1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_TLS1_1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_TLS1_2_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void)) -# endif - -# ifndef OPENSSL_NO_DTLS1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_DTLS1_2_METHOD -/* DTLSv1.2 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_client_method(void)) -# endif - -__owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ -__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ -__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ - -__owur size_t DTLS_get_data_mtu(const SSL *s); - -__owur STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); -__owur STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx); -__owur STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *s); -__owur STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s); - -__owur int SSL_do_handshake(SSL *s); -int SSL_key_update(SSL *s, int updatetype); -int SSL_get_key_update_type(const SSL *s); -int SSL_renegotiate(SSL *s); -int SSL_renegotiate_abbreviated(SSL *s); -__owur int SSL_renegotiate_pending(const SSL *s); -int SSL_shutdown(SSL *s); -__owur int SSL_verify_client_post_handshake(SSL *s); -void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val); -void SSL_set_post_handshake_auth(SSL *s, int val); - -__owur const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx); -__owur const SSL_METHOD *SSL_get_ssl_method(const SSL *s); -__owur int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); -__owur const char *SSL_alert_type_string_long(int value); -__owur const char *SSL_alert_type_string(int value); -__owur const char *SSL_alert_desc_string_long(int value); -__owur const char *SSL_alert_desc_string(int value); - -void SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); -void SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); -__owur const STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s); -__owur const STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx); -__owur int SSL_add1_to_CA_list(SSL *ssl, const X509 *x); -__owur int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x); -__owur const STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s); - -void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); -void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); -__owur STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); -__owur STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); -__owur int SSL_add_client_CA(SSL *ssl, X509 *x); -__owur int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); - -void SSL_set_connect_state(SSL *s); -void SSL_set_accept_state(SSL *s); - -__owur long SSL_get_default_timeout(const SSL *s); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_library_init() OPENSSL_init_ssl(0, NULL) -# endif - -__owur char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); -__owur STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk); - -__owur SSL *SSL_dup(SSL *ssl); - -__owur X509 *SSL_get_certificate(const SSL *ssl); -/* - * EVP_PKEY - */ -struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); - -__owur X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); -__owur EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); - -void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); -__owur int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); -void SSL_set_quiet_shutdown(SSL *ssl, int mode); -__owur int SSL_get_quiet_shutdown(const SSL *ssl); -void SSL_set_shutdown(SSL *ssl, int mode); -__owur int SSL_get_shutdown(const SSL *ssl); -__owur int SSL_version(const SSL *ssl); -__owur int SSL_client_version(const SSL *s); -__owur int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); -__owur int SSL_CTX_set_default_verify_dir(SSL_CTX *ctx); -__owur int SSL_CTX_set_default_verify_file(SSL_CTX *ctx); -__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, - const char *CApath); -# define SSL_get0_session SSL_get_session/* just peek at pointer */ -__owur SSL_SESSION *SSL_get_session(const SSL *ssl); -__owur SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ -__owur SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); -SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); -void SSL_set_info_callback(SSL *ssl, - void (*cb) (const SSL *ssl, int type, int val)); -void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, - int val); -__owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl); - -void SSL_set_verify_result(SSL *ssl, long v); -__owur long SSL_get_verify_result(const SSL *ssl); -__owur STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s); - -__owur size_t SSL_get_client_random(const SSL *ssl, unsigned char *out, - size_t outlen); -__owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out, - size_t outlen); -__owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess, - unsigned char *out, size_t outlen); -__owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess, - const unsigned char *in, size_t len); -uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *sess); - -#define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) -__owur int SSL_set_ex_data(SSL *ssl, int idx, void *data); -void *SSL_get_ex_data(const SSL *ssl, int idx); -#define SSL_SESSION_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef) -__owur int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); -void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); -#define SSL_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef) -__owur int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); -void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); - -__owur int SSL_get_ex_data_X509_STORE_CTX_idx(void); - -# define SSL_CTX_sess_set_cache_size(ctx,t) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) -# define SSL_CTX_sess_get_cache_size(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) -# define SSL_CTX_set_session_cache_mode(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) -# define SSL_CTX_get_session_cache_mode(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) - -# define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) -# define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) -# define SSL_CTX_get_read_ahead(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) -# define SSL_CTX_set_read_ahead(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) -# define SSL_CTX_get_max_cert_list(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) -# define SSL_CTX_set_max_cert_list(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) -# define SSL_get_max_cert_list(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) -# define SSL_set_max_cert_list(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) - -# define SSL_CTX_set_max_send_fragment(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) -# define SSL_set_max_send_fragment(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) -# define SSL_CTX_set_split_send_fragment(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) -# define SSL_set_split_send_fragment(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) -# define SSL_CTX_set_max_pipelines(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) -# define SSL_set_max_pipelines(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) - -void SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len); -void SSL_set_default_read_buffer_len(SSL *s, size_t len); - -# ifndef OPENSSL_NO_DH -/* NB: the |keylength| is only applicable when is_export is true */ -void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, - DH *(*dh) (SSL *ssl, int is_export, - int keylength)); -void SSL_set_tmp_dh_callback(SSL *ssl, - DH *(*dh) (SSL *ssl, int is_export, - int keylength)); -# endif - -__owur const COMP_METHOD *SSL_get_current_compression(const SSL *s); -__owur const COMP_METHOD *SSL_get_current_expansion(const SSL *s); -__owur const char *SSL_COMP_get_name(const COMP_METHOD *comp); -__owur const char *SSL_COMP_get0_name(const SSL_COMP *comp); -__owur int SSL_COMP_get_id(const SSL_COMP *comp); -STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); -__owur STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) - *meths); -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_COMP_free_compression_methods() while(0) continue -# endif -__owur int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); - -const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); -int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); -int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c); -int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len, - int isv2format, STACK_OF(SSL_CIPHER) **sk, - STACK_OF(SSL_CIPHER) **scsvs); - -/* TLS extensions functions */ -__owur int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); - -__owur int SSL_set_session_ticket_ext_cb(SSL *s, - tls_session_ticket_ext_cb_fn cb, - void *arg); - -/* Pre-shared secret session resumption functions */ -__owur int SSL_set_session_secret_cb(SSL *s, - tls_session_secret_cb_fn session_secret_cb, - void *arg); - -void SSL_CTX_set_not_resumable_session_callback(SSL_CTX *ctx, - int (*cb) (SSL *ssl, - int - is_forward_secure)); - -void SSL_set_not_resumable_session_callback(SSL *ssl, - int (*cb) (SSL *ssl, - int is_forward_secure)); - -void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, - size_t (*cb) (SSL *ssl, int type, - size_t len, void *arg)); -void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg); -void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx); -int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size); - -void SSL_set_record_padding_callback(SSL *ssl, - size_t (*cb) (SSL *ssl, int type, - size_t len, void *arg)); -void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg); -void *SSL_get_record_padding_callback_arg(const SSL *ssl); -int SSL_set_block_padding(SSL *ssl, size_t block_size); - -int SSL_set_num_tickets(SSL *s, size_t num_tickets); -size_t SSL_get_num_tickets(const SSL *s); -int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); -size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_cache_hit(s) SSL_session_reused(s) -# endif - -__owur int SSL_session_reused(const SSL *s); -__owur int SSL_is_server(const SSL *s); - -__owur __owur SSL_CONF_CTX *SSL_CONF_CTX_new(void); -int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); -void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); -unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); -__owur unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, - unsigned int flags); -__owur int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); - -void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); -void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); - -__owur int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); -__owur int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); -__owur int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); - -void SSL_add_ssl_module(void); -int SSL_config(SSL *s, const char *name); -int SSL_CTX_config(SSL_CTX *ctx, const char *name); - -# ifndef OPENSSL_NO_SSL_TRACE -void SSL_trace(int write_p, int version, int content_type, - const void *buf, size_t len, SSL *ssl, void *arg); -# endif - -# ifndef OPENSSL_NO_SOCK -int DTLSv1_listen(SSL *s, BIO_ADDR *client); -# endif - -# ifndef OPENSSL_NO_CT - -/* - * A callback for verifying that the received SCTs are sufficient. - * Expected to return 1 if they are sufficient, otherwise 0. - * May return a negative integer if an error occurs. - * A connection should be aborted if the SCTs are deemed insufficient. - */ -typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx, - const STACK_OF(SCT) *scts, void *arg); - -/* - * Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate - * the received SCTs. - * If the callback returns a non-positive result, the connection is terminated. - * Call this function before beginning a handshake. - * If a NULL |callback| is provided, SCT validation is disabled. - * |arg| is arbitrary userdata that will be passed to the callback whenever it - * is invoked. Ownership of |arg| remains with the caller. - * - * NOTE: A side-effect of setting a CT callback is that an OCSP stapled response - * will be requested. - */ -int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback, - void *arg); -int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx, - ssl_ct_validation_cb callback, - void *arg); -#define SSL_disable_ct(s) \ - ((void) SSL_set_validation_callback((s), NULL, NULL)) -#define SSL_CTX_disable_ct(ctx) \ - ((void) SSL_CTX_set_validation_callback((ctx), NULL, NULL)) - -/* - * The validation type enumerates the available behaviours of the built-in SSL - * CT validation callback selected via SSL_enable_ct() and SSL_CTX_enable_ct(). - * The underlying callback is a static function in libssl. - */ -enum { - SSL_CT_VALIDATION_PERMISSIVE = 0, - SSL_CT_VALIDATION_STRICT -}; - -/* - * Enable CT by setting up a callback that implements one of the built-in - * validation variants. The SSL_CT_VALIDATION_PERMISSIVE variant always - * continues the handshake, the application can make appropriate decisions at - * handshake completion. The SSL_CT_VALIDATION_STRICT variant requires at - * least one valid SCT, or else handshake termination will be requested. The - * handshake may continue anyway if SSL_VERIFY_NONE is in effect. - */ -int SSL_enable_ct(SSL *s, int validation_mode); -int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode); - -/* - * Report whether a non-NULL callback is enabled. - */ -int SSL_ct_is_enabled(const SSL *s); -int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx); - -/* Gets the SCTs received from a connection */ -const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s); - -/* - * Loads the CT log list from the default location. - * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, - * the log information loaded from this file will be appended to the - * CTLOG_STORE. - * Returns 1 on success, 0 otherwise. - */ -int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx); - -/* - * Loads the CT log list from the specified file path. - * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, - * the log information loaded from this file will be appended to the - * CTLOG_STORE. - * Returns 1 on success, 0 otherwise. - */ -int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path); - -/* - * Sets the CT log list used by all SSL connections created from this SSL_CTX. - * Ownership of the CTLOG_STORE is transferred to the SSL_CTX. - */ -void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs); - -/* - * Gets the CT log list used by all SSL connections created from this SSL_CTX. - * This will be NULL unless one of the following functions has been called: - * - SSL_CTX_set_default_ctlog_list_file - * - SSL_CTX_set_ctlog_list_file - * - SSL_CTX_set_ctlog_store - */ -const CTLOG_STORE *SSL_CTX_get0_ctlog_store(const SSL_CTX *ctx); - -# endif /* OPENSSL_NO_CT */ - -/* What the "other" parameter contains in security callback */ -/* Mask for type */ -# define SSL_SECOP_OTHER_TYPE 0xffff0000 -# define SSL_SECOP_OTHER_NONE 0 -# define SSL_SECOP_OTHER_CIPHER (1 << 16) -# define SSL_SECOP_OTHER_CURVE (2 << 16) -# define SSL_SECOP_OTHER_DH (3 << 16) -# define SSL_SECOP_OTHER_PKEY (4 << 16) -# define SSL_SECOP_OTHER_SIGALG (5 << 16) -# define SSL_SECOP_OTHER_CERT (6 << 16) - -/* Indicated operation refers to peer key or certificate */ -# define SSL_SECOP_PEER 0x1000 - -/* Values for "op" parameter in security callback */ - -/* Called to filter ciphers */ -/* Ciphers client supports */ -# define SSL_SECOP_CIPHER_SUPPORTED (1 | SSL_SECOP_OTHER_CIPHER) -/* Cipher shared by client/server */ -# define SSL_SECOP_CIPHER_SHARED (2 | SSL_SECOP_OTHER_CIPHER) -/* Sanity check of cipher server selects */ -# define SSL_SECOP_CIPHER_CHECK (3 | SSL_SECOP_OTHER_CIPHER) -/* Curves supported by client */ -# define SSL_SECOP_CURVE_SUPPORTED (4 | SSL_SECOP_OTHER_CURVE) -/* Curves shared by client/server */ -# define SSL_SECOP_CURVE_SHARED (5 | SSL_SECOP_OTHER_CURVE) -/* Sanity check of curve server selects */ -# define SSL_SECOP_CURVE_CHECK (6 | SSL_SECOP_OTHER_CURVE) -/* Temporary DH key */ -# define SSL_SECOP_TMP_DH (7 | SSL_SECOP_OTHER_PKEY) -/* SSL/TLS version */ -# define SSL_SECOP_VERSION (9 | SSL_SECOP_OTHER_NONE) -/* Session tickets */ -# define SSL_SECOP_TICKET (10 | SSL_SECOP_OTHER_NONE) -/* Supported signature algorithms sent to peer */ -# define SSL_SECOP_SIGALG_SUPPORTED (11 | SSL_SECOP_OTHER_SIGALG) -/* Shared signature algorithm */ -# define SSL_SECOP_SIGALG_SHARED (12 | SSL_SECOP_OTHER_SIGALG) -/* Sanity check signature algorithm allowed */ -# define SSL_SECOP_SIGALG_CHECK (13 | SSL_SECOP_OTHER_SIGALG) -/* Used to get mask of supported public key signature algorithms */ -# define SSL_SECOP_SIGALG_MASK (14 | SSL_SECOP_OTHER_SIGALG) -/* Use to see if compression is allowed */ -# define SSL_SECOP_COMPRESSION (15 | SSL_SECOP_OTHER_NONE) -/* EE key in certificate */ -# define SSL_SECOP_EE_KEY (16 | SSL_SECOP_OTHER_CERT) -/* CA key in certificate */ -# define SSL_SECOP_CA_KEY (17 | SSL_SECOP_OTHER_CERT) -/* CA digest algorithm in certificate */ -# define SSL_SECOP_CA_MD (18 | SSL_SECOP_OTHER_CERT) -/* Peer EE key in certificate */ -# define SSL_SECOP_PEER_EE_KEY (SSL_SECOP_EE_KEY | SSL_SECOP_PEER) -/* Peer CA key in certificate */ -# define SSL_SECOP_PEER_CA_KEY (SSL_SECOP_CA_KEY | SSL_SECOP_PEER) -/* Peer CA digest algorithm in certificate */ -# define SSL_SECOP_PEER_CA_MD (SSL_SECOP_CA_MD | SSL_SECOP_PEER) - -void SSL_set_security_level(SSL *s, int level); -__owur int SSL_get_security_level(const SSL *s); -void SSL_set_security_callback(SSL *s, - int (*cb) (const SSL *s, const SSL_CTX *ctx, - int op, int bits, int nid, - void *other, void *ex)); -int (*SSL_get_security_callback(const SSL *s)) (const SSL *s, - const SSL_CTX *ctx, int op, - int bits, int nid, void *other, - void *ex); -void SSL_set0_security_ex_data(SSL *s, void *ex); -__owur void *SSL_get0_security_ex_data(const SSL *s); - -void SSL_CTX_set_security_level(SSL_CTX *ctx, int level); -__owur int SSL_CTX_get_security_level(const SSL_CTX *ctx); -void SSL_CTX_set_security_callback(SSL_CTX *ctx, - int (*cb) (const SSL *s, const SSL_CTX *ctx, - int op, int bits, int nid, - void *other, void *ex)); -int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (const SSL *s, - const SSL_CTX *ctx, - int op, int bits, - int nid, - void *other, - void *ex); -void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex); -__owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx); - -/* OPENSSL_INIT flag 0x010000 reserved for internal use */ -# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x00100000L -# define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L - -# define OPENSSL_INIT_SSL_DEFAULT \ - (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS) - -int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); - -# ifndef OPENSSL_NO_UNIT_TEST -__owur const struct openssl_ssl_test_functions *SSL_test_functions(void); -# endif - -__owur int SSL_free_buffers(SSL *ssl); -__owur int SSL_alloc_buffers(SSL *ssl); - -/* Status codes passed to the decrypt session ticket callback. Some of these - * are for internal use only and are never passed to the callback. */ -typedef int SSL_TICKET_STATUS; - -/* Support for ticket appdata */ -/* fatal error, malloc failure */ -# define SSL_TICKET_FATAL_ERR_MALLOC 0 -/* fatal error, either from parsing or decrypting the ticket */ -# define SSL_TICKET_FATAL_ERR_OTHER 1 -/* No ticket present */ -# define SSL_TICKET_NONE 2 -/* Empty ticket present */ -# define SSL_TICKET_EMPTY 3 -/* the ticket couldn't be decrypted */ -# define SSL_TICKET_NO_DECRYPT 4 -/* a ticket was successfully decrypted */ -# define SSL_TICKET_SUCCESS 5 -/* same as above but the ticket needs to be renewed */ -# define SSL_TICKET_SUCCESS_RENEW 6 - -/* Return codes for the decrypt session ticket callback */ -typedef int SSL_TICKET_RETURN; - -/* An error occurred */ -#define SSL_TICKET_RETURN_ABORT 0 -/* Do not use the ticket, do not send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_IGNORE 1 -/* Do not use the ticket, send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_IGNORE_RENEW 2 -/* Use the ticket, do not send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_USE 3 -/* Use the ticket, send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_USE_RENEW 4 - -typedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg); -typedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss, - const unsigned char *keyname, - size_t keyname_length, - SSL_TICKET_STATUS status, - void *arg); -int SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx, - SSL_CTX_generate_session_ticket_fn gen_cb, - SSL_CTX_decrypt_session_ticket_fn dec_cb, - void *arg); -int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len); -int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len); - -extern const char SSL_version_str[]; - -typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us); - -void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb); - - -typedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg); -void SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx, - SSL_allow_early_data_cb_fn cb, - void *arg); -void SSL_set_allow_early_data_cb(SSL *s, - SSL_allow_early_data_cb_fn cb, - void *arg); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ssl2.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ssl2.h deleted file mode 100644 index 5321bd27..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ssl2.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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_SSL2_H -# define HEADER_SSL2_H - -#ifdef __cplusplus -extern "C" { -#endif - -# define SSL2_VERSION 0x0002 - -# define SSL2_MT_CLIENT_HELLO 1 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ssl3.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ssl3.h deleted file mode 100644 index 8d01fcc4..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ssl3.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_SSL3_H -# define HEADER_SSL3_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Signalling cipher suite value from RFC 5746 - * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) - */ -# define SSL3_CK_SCSV 0x030000FF - -/* - * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 - * (TLS_FALLBACK_SCSV) - */ -# define SSL3_CK_FALLBACK_SCSV 0x03005600 - -# define SSL3_CK_RSA_NULL_MD5 0x03000001 -# define SSL3_CK_RSA_NULL_SHA 0x03000002 -# define SSL3_CK_RSA_RC4_40_MD5 0x03000003 -# define SSL3_CK_RSA_RC4_128_MD5 0x03000004 -# define SSL3_CK_RSA_RC4_128_SHA 0x03000005 -# define SSL3_CK_RSA_RC2_40_MD5 0x03000006 -# define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 -# define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 -# define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 -# define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A - -# define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B -# define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C -# define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D -# define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E -# define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F -# define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 - -# define SSL3_CK_DHE_DSS_DES_40_CBC_SHA 0x03000011 -# define SSL3_CK_EDH_DSS_DES_40_CBC_SHA SSL3_CK_DHE_DSS_DES_40_CBC_SHA -# define SSL3_CK_DHE_DSS_DES_64_CBC_SHA 0x03000012 -# define SSL3_CK_EDH_DSS_DES_64_CBC_SHA SSL3_CK_DHE_DSS_DES_64_CBC_SHA -# define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA 0x03000013 -# define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA SSL3_CK_DHE_DSS_DES_192_CBC3_SHA -# define SSL3_CK_DHE_RSA_DES_40_CBC_SHA 0x03000014 -# define SSL3_CK_EDH_RSA_DES_40_CBC_SHA SSL3_CK_DHE_RSA_DES_40_CBC_SHA -# define SSL3_CK_DHE_RSA_DES_64_CBC_SHA 0x03000015 -# define SSL3_CK_EDH_RSA_DES_64_CBC_SHA SSL3_CK_DHE_RSA_DES_64_CBC_SHA -# define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA 0x03000016 -# define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA SSL3_CK_DHE_RSA_DES_192_CBC3_SHA - -# define SSL3_CK_ADH_RC4_40_MD5 0x03000017 -# define SSL3_CK_ADH_RC4_128_MD5 0x03000018 -# define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 -# define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A -# define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B - -/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ -# define SSL3_RFC_RSA_NULL_MD5 "TLS_RSA_WITH_NULL_MD5" -# define SSL3_RFC_RSA_NULL_SHA "TLS_RSA_WITH_NULL_SHA" -# define SSL3_RFC_RSA_DES_192_CBC3_SHA "TLS_RSA_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_DHE_DSS_DES_192_CBC3_SHA "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_DHE_RSA_DES_192_CBC3_SHA "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_ADH_DES_192_CBC_SHA "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_RSA_IDEA_128_SHA "TLS_RSA_WITH_IDEA_CBC_SHA" -# define SSL3_RFC_RSA_RC4_128_MD5 "TLS_RSA_WITH_RC4_128_MD5" -# define SSL3_RFC_RSA_RC4_128_SHA "TLS_RSA_WITH_RC4_128_SHA" -# define SSL3_RFC_ADH_RC4_128_MD5 "TLS_DH_anon_WITH_RC4_128_MD5" - -# define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" -# define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" -# define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" -# define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" -# define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" -# define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" -# define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" -# define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" -# define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" -# define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" - -# define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" -# define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" -# define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" -# define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" -# define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" -# define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" - -# define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" -# define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" -# define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" -# define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" -# define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" -# define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" - -/* - * This next block of six "EDH" labels is for backward compatibility with - * older versions of OpenSSL. New code should use the six "DHE" labels above - * instead: - */ -# define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" -# define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" -# define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" -# define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" -# define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" -# define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" - -# define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" -# define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" -# define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" -# define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" -# define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" - -# define SSL3_SSL_SESSION_ID_LENGTH 32 -# define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 - -# define SSL3_MASTER_SECRET_SIZE 48 -# define SSL3_RANDOM_SIZE 32 -# define SSL3_SESSION_ID_SIZE 32 -# define SSL3_RT_HEADER_LENGTH 5 - -# define SSL3_HM_HEADER_LENGTH 4 - -# ifndef SSL3_ALIGN_PAYLOAD - /* - * Some will argue that this increases memory footprint, but it's not - * actually true. Point is that malloc has to return at least 64-bit aligned - * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. - * Suggested pre-gaping simply moves these wasted bytes from the end of - * allocated region to its front, but makes data payload aligned, which - * improves performance:-) - */ -# define SSL3_ALIGN_PAYLOAD 8 -# else -# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0 -# error "insane SSL3_ALIGN_PAYLOAD" -# undef SSL3_ALIGN_PAYLOAD -# endif -# endif - -/* - * This is the maximum MAC (digest) size used by the SSL library. Currently - * maximum of 20 is used by SHA1, but we reserve for future extension for - * 512-bit hashes. - */ - -# define SSL3_RT_MAX_MD_SIZE 64 - -/* - * Maximum block size used in all ciphersuites. Currently 16 for AES. - */ - -# define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 - -# define SSL3_RT_MAX_EXTRA (16384) - -/* Maximum plaintext length: defined by SSL/TLS standards */ -# define SSL3_RT_MAX_PLAIN_LENGTH 16384 -/* Maximum compression overhead: defined by SSL/TLS standards */ -# define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 - -/* - * The standards give a maximum encryption overhead of 1024 bytes. In - * practice the value is lower than this. The overhead is the maximum number - * of padding bytes (256) plus the mac size. - */ -# define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) -# define SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD 256 - -/* - * OpenSSL currently only uses a padding length of at most one block so the - * send overhead is smaller. - */ - -# define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ - (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) - -/* If compression isn't used don't include the compression overhead */ - -# ifdef OPENSSL_NO_COMP -# define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH -# else -# define SSL3_RT_MAX_COMPRESSED_LENGTH \ - (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) -# endif -# define SSL3_RT_MAX_ENCRYPTED_LENGTH \ - (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) -# define SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH \ - (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD) -# define SSL3_RT_MAX_PACKET_SIZE \ - (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) - -# define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" -# define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" - -# define SSL3_VERSION 0x0300 -# define SSL3_VERSION_MAJOR 0x03 -# define SSL3_VERSION_MINOR 0x00 - -# define SSL3_RT_CHANGE_CIPHER_SPEC 20 -# define SSL3_RT_ALERT 21 -# define SSL3_RT_HANDSHAKE 22 -# define SSL3_RT_APPLICATION_DATA 23 -# define DTLS1_RT_HEARTBEAT 24 - -/* Pseudo content types to indicate additional parameters */ -# define TLS1_RT_CRYPTO 0x1000 -# define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) -# define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) -# define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) -# define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) - -# define TLS1_RT_CRYPTO_READ 0x0000 -# define TLS1_RT_CRYPTO_WRITE 0x0100 -# define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) -# define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) -# define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) -# define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) - -/* Pseudo content types for SSL/TLS header info */ -# define SSL3_RT_HEADER 0x100 -# define SSL3_RT_INNER_CONTENT_TYPE 0x101 - -# define SSL3_AL_WARNING 1 -# define SSL3_AL_FATAL 2 - -# define SSL3_AD_CLOSE_NOTIFY 0 -# define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */ -# define SSL3_AD_BAD_RECORD_MAC 20/* fatal */ -# define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */ -# define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */ -# define SSL3_AD_NO_CERTIFICATE 41 -# define SSL3_AD_BAD_CERTIFICATE 42 -# define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 -# define SSL3_AD_CERTIFICATE_REVOKED 44 -# define SSL3_AD_CERTIFICATE_EXPIRED 45 -# define SSL3_AD_CERTIFICATE_UNKNOWN 46 -# define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */ - -# define TLS1_HB_REQUEST 1 -# define TLS1_HB_RESPONSE 2 - - -# define SSL3_CT_RSA_SIGN 1 -# define SSL3_CT_DSS_SIGN 2 -# define SSL3_CT_RSA_FIXED_DH 3 -# define SSL3_CT_DSS_FIXED_DH 4 -# define SSL3_CT_RSA_EPHEMERAL_DH 5 -# define SSL3_CT_DSS_EPHEMERAL_DH 6 -# define SSL3_CT_FORTEZZA_DMS 20 -/* - * SSL3_CT_NUMBER is used to size arrays and it must be large enough to - * contain all of the cert types defined for *either* SSLv3 and TLSv1. - */ -# define SSL3_CT_NUMBER 10 - -# if defined(TLS_CT_NUMBER) -# if TLS_CT_NUMBER != SSL3_CT_NUMBER -# error "SSL/TLS CT_NUMBER values do not match" -# endif -# endif - -/* No longer used as of OpenSSL 1.1.1 */ -# define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 - -/* Removed from OpenSSL 1.1.0 */ -# define TLS1_FLAGS_TLS_PADDING_BUG 0x0 - -# define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 - -/* Set if we encrypt then mac instead of usual mac then encrypt */ -# define TLS1_FLAGS_ENCRYPT_THEN_MAC_READ 0x0100 -# define TLS1_FLAGS_ENCRYPT_THEN_MAC TLS1_FLAGS_ENCRYPT_THEN_MAC_READ - -/* Set if extended master secret extension received from peer */ -# define TLS1_FLAGS_RECEIVED_EXTMS 0x0200 - -# define TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE 0x0400 - -# define TLS1_FLAGS_STATELESS 0x0800 - -# define SSL3_MT_HELLO_REQUEST 0 -# define SSL3_MT_CLIENT_HELLO 1 -# define SSL3_MT_SERVER_HELLO 2 -# define SSL3_MT_NEWSESSION_TICKET 4 -# define SSL3_MT_END_OF_EARLY_DATA 5 -# define SSL3_MT_ENCRYPTED_EXTENSIONS 8 -# define SSL3_MT_CERTIFICATE 11 -# define SSL3_MT_SERVER_KEY_EXCHANGE 12 -# define SSL3_MT_CERTIFICATE_REQUEST 13 -# define SSL3_MT_SERVER_DONE 14 -# define SSL3_MT_CERTIFICATE_VERIFY 15 -# define SSL3_MT_CLIENT_KEY_EXCHANGE 16 -# define SSL3_MT_FINISHED 20 -# define SSL3_MT_CERTIFICATE_URL 21 -# define SSL3_MT_CERTIFICATE_STATUS 22 -# define SSL3_MT_SUPPLEMENTAL_DATA 23 -# define SSL3_MT_KEY_UPDATE 24 -# ifndef OPENSSL_NO_NEXTPROTONEG -# define SSL3_MT_NEXT_PROTO 67 -# endif -# define SSL3_MT_MESSAGE_HASH 254 -# define DTLS1_MT_HELLO_VERIFY_REQUEST 3 - -/* Dummy message type for handling CCS like a normal handshake message */ -# define SSL3_MT_CHANGE_CIPHER_SPEC 0x0101 - -# define SSL3_MT_CCS 1 - -/* These are used when changing over to a new cipher */ -# define SSL3_CC_READ 0x001 -# define SSL3_CC_WRITE 0x002 -# define SSL3_CC_CLIENT 0x010 -# define SSL3_CC_SERVER 0x020 -# define SSL3_CC_EARLY 0x040 -# define SSL3_CC_HANDSHAKE 0x080 -# define SSL3_CC_APPLICATION 0x100 -# define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) -# define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) -# define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) -# define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/sslerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/sslerr.h deleted file mode 100644 index 82983d3c..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/sslerr.h +++ /dev/null @@ -1,773 +0,0 @@ -/* - * 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_SSLERR_H -# define HEADER_SSLERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_SSL_strings(void); - -/* - * SSL function codes. - */ -# define SSL_F_ADD_CLIENT_KEY_SHARE_EXT 438 -# define SSL_F_ADD_KEY_SHARE 512 -# define SSL_F_BYTES_TO_CIPHER_LIST 519 -# define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 -# define SSL_F_CIPHERSUITE_CB 622 -# define SSL_F_CONSTRUCT_CA_NAMES 552 -# define SSL_F_CONSTRUCT_KEY_EXCHANGE_TBS 553 -# define SSL_F_CONSTRUCT_STATEFUL_TICKET 636 -# define SSL_F_CONSTRUCT_STATELESS_TICKET 637 -# define SSL_F_CREATE_SYNTHETIC_MESSAGE_HASH 539 -# define SSL_F_CREATE_TICKET_PREQUEL 638 -# define SSL_F_CT_MOVE_SCTS 345 -# define SSL_F_CT_STRICT 349 -# define SSL_F_CUSTOM_EXT_ADD 554 -# define SSL_F_CUSTOM_EXT_PARSE 555 -# define SSL_F_D2I_SSL_SESSION 103 -# define SSL_F_DANE_CTX_ENABLE 347 -# define SSL_F_DANE_MTYPE_SET 393 -# define SSL_F_DANE_TLSA_ADD 394 -# define SSL_F_DERIVE_SECRET_KEY_AND_IV 514 -# define SSL_F_DO_DTLS1_WRITE 245 -# define SSL_F_DO_SSL3_WRITE 104 -# define SSL_F_DTLS1_BUFFER_RECORD 247 -# define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 318 -# define SSL_F_DTLS1_HEARTBEAT 305 -# define SSL_F_DTLS1_HM_FRAGMENT_NEW 623 -# define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 -# define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 -# define SSL_F_DTLS1_PROCESS_RECORD 257 -# define SSL_F_DTLS1_READ_BYTES 258 -# define SSL_F_DTLS1_READ_FAILED 339 -# define SSL_F_DTLS1_RETRANSMIT_MESSAGE 390 -# define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 -# define SSL_F_DTLS1_WRITE_BYTES 545 -# define SSL_F_DTLSV1_LISTEN 350 -# define SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC 371 -# define SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST 385 -# define SSL_F_DTLS_GET_REASSEMBLED_MESSAGE 370 -# define SSL_F_DTLS_PROCESS_HELLO_VERIFY 386 -# define SSL_F_DTLS_RECORD_LAYER_NEW 635 -# define SSL_F_DTLS_WAIT_FOR_DRY 592 -# define SSL_F_EARLY_DATA_COUNT_OK 532 -# define SSL_F_FINAL_EARLY_DATA 556 -# define SSL_F_FINAL_EC_PT_FORMATS 485 -# define SSL_F_FINAL_EMS 486 -# define SSL_F_FINAL_KEY_SHARE 503 -# define SSL_F_FINAL_MAXFRAGMENTLEN 557 -# define SSL_F_FINAL_RENEGOTIATE 483 -# define SSL_F_FINAL_SERVER_NAME 558 -# define SSL_F_FINAL_SIG_ALGS 497 -# define SSL_F_GET_CERT_VERIFY_TBS_DATA 588 -# define SSL_F_NSS_KEYLOG_INT 500 -# define SSL_F_OPENSSL_INIT_SSL 342 -# define SSL_F_OSSL_STATEM_CLIENT13_READ_TRANSITION 436 -# define SSL_F_OSSL_STATEM_CLIENT13_WRITE_TRANSITION 598 -# define SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE 430 -# define SSL_F_OSSL_STATEM_CLIENT_POST_PROCESS_MESSAGE 593 -# define SSL_F_OSSL_STATEM_CLIENT_PROCESS_MESSAGE 594 -# define SSL_F_OSSL_STATEM_CLIENT_READ_TRANSITION 417 -# define SSL_F_OSSL_STATEM_CLIENT_WRITE_TRANSITION 599 -# define SSL_F_OSSL_STATEM_SERVER13_READ_TRANSITION 437 -# define SSL_F_OSSL_STATEM_SERVER13_WRITE_TRANSITION 600 -# define SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE 431 -# define SSL_F_OSSL_STATEM_SERVER_POST_PROCESS_MESSAGE 601 -# define SSL_F_OSSL_STATEM_SERVER_POST_WORK 602 -# define SSL_F_OSSL_STATEM_SERVER_PRE_WORK 640 -# define SSL_F_OSSL_STATEM_SERVER_PROCESS_MESSAGE 603 -# define SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION 418 -# define SSL_F_OSSL_STATEM_SERVER_WRITE_TRANSITION 604 -# define SSL_F_PARSE_CA_NAMES 541 -# define SSL_F_PITEM_NEW 624 -# define SSL_F_PQUEUE_NEW 625 -# define SSL_F_PROCESS_KEY_SHARE_EXT 439 -# define SSL_F_READ_STATE_MACHINE 352 -# define SSL_F_SET_CLIENT_CIPHERSUITE 540 -# define SSL_F_SRP_GENERATE_CLIENT_MASTER_SECRET 595 -# define SSL_F_SRP_GENERATE_SERVER_MASTER_SECRET 589 -# define SSL_F_SRP_VERIFY_SERVER_PARAM 596 -# define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 -# define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 -# define SSL_F_SSL3_CTRL 213 -# define SSL_F_SSL3_CTX_CTRL 133 -# define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 -# define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 -# define SSL_F_SSL3_ENC 608 -# define SSL_F_SSL3_FINAL_FINISH_MAC 285 -# define SSL_F_SSL3_FINISH_MAC 587 -# define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 -# define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 -# define SSL_F_SSL3_GET_RECORD 143 -# define SSL_F_SSL3_INIT_FINISHED_MAC 397 -# define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 -# define SSL_F_SSL3_READ_BYTES 148 -# define SSL_F_SSL3_READ_N 149 -# define SSL_F_SSL3_SETUP_KEY_BLOCK 157 -# define SSL_F_SSL3_SETUP_READ_BUFFER 156 -# define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 -# define SSL_F_SSL3_WRITE_BYTES 158 -# define SSL_F_SSL3_WRITE_PENDING 159 -# define SSL_F_SSL_ADD_CERT_CHAIN 316 -# define SSL_F_SSL_ADD_CERT_TO_BUF 319 -# define SSL_F_SSL_ADD_CERT_TO_WPACKET 493 -# define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 -# define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 -# define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 -# define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 -# define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 -# define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 -# define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 -# define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 -# define SSL_F_SSL_BAD_METHOD 160 -# define SSL_F_SSL_BUILD_CERT_CHAIN 332 -# define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 -# define SSL_F_SSL_CACHE_CIPHERLIST 520 -# define SSL_F_SSL_CERT_ADD0_CHAIN_CERT 346 -# define SSL_F_SSL_CERT_DUP 221 -# define SSL_F_SSL_CERT_NEW 162 -# define SSL_F_SSL_CERT_SET0_CHAIN 340 -# define SSL_F_SSL_CHECK_PRIVATE_KEY 163 -# define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 -# define SSL_F_SSL_CHECK_SRP_EXT_CLIENTHELLO 606 -# define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 -# define SSL_F_SSL_CHOOSE_CLIENT_VERSION 607 -# define SSL_F_SSL_CIPHER_DESCRIPTION 626 -# define SSL_F_SSL_CIPHER_LIST_TO_BYTES 425 -# define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 -# define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 -# define SSL_F_SSL_CLEAR 164 -# define SSL_F_SSL_CLIENT_HELLO_GET1_EXTENSIONS_PRESENT 627 -# define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 -# define SSL_F_SSL_CONF_CMD 334 -# define SSL_F_SSL_CREATE_CIPHER_LIST 166 -# define SSL_F_SSL_CTRL 232 -# define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 -# define SSL_F_SSL_CTX_ENABLE_CT 398 -# define SSL_F_SSL_CTX_MAKE_PROFILES 309 -# define SSL_F_SSL_CTX_NEW 169 -# define SSL_F_SSL_CTX_SET_ALPN_PROTOS 343 -# define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 -# define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 -# define SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK 396 -# define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 -# define SSL_F_SSL_CTX_SET_SSL_VERSION 170 -# define SSL_F_SSL_CTX_SET_TLSEXT_MAX_FRAGMENT_LENGTH 551 -# define SSL_F_SSL_CTX_USE_CERTIFICATE 171 -# define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 -# define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 -# define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 -# define SSL_F_SSL_CTX_USE_SERVERINFO 336 -# define SSL_F_SSL_CTX_USE_SERVERINFO_EX 543 -# define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 -# define SSL_F_SSL_DANE_DUP 403 -# define SSL_F_SSL_DANE_ENABLE 395 -# define SSL_F_SSL_DERIVE 590 -# define SSL_F_SSL_DO_CONFIG 391 -# define SSL_F_SSL_DO_HANDSHAKE 180 -# define SSL_F_SSL_DUP_CA_LIST 408 -# define SSL_F_SSL_ENABLE_CT 402 -# define SSL_F_SSL_GENERATE_PKEY_GROUP 559 -# define SSL_F_SSL_GENERATE_SESSION_ID 547 -# define SSL_F_SSL_GET_NEW_SESSION 181 -# define SSL_F_SSL_GET_PREV_SESSION 217 -# define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 -# define SSL_F_SSL_GET_SIGN_PKEY 183 -# define SSL_F_SSL_HANDSHAKE_HASH 560 -# define SSL_F_SSL_INIT_WBIO_BUFFER 184 -# define SSL_F_SSL_KEY_UPDATE 515 -# define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 -# define SSL_F_SSL_LOG_MASTER_SECRET 498 -# define SSL_F_SSL_LOG_RSA_CLIENT_KEY_EXCHANGE 499 -# define SSL_F_SSL_MODULE_INIT 392 -# define SSL_F_SSL_NEW 186 -# define SSL_F_SSL_NEXT_PROTO_VALIDATE 565 -# define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 -# define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 -# define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 -# define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 -# define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 -# define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 -# define SSL_F_SSL_PEEK 270 -# define SSL_F_SSL_PEEK_EX 432 -# define SSL_F_SSL_PEEK_INTERNAL 522 -# define SSL_F_SSL_READ 223 -# define SSL_F_SSL_READ_EARLY_DATA 529 -# define SSL_F_SSL_READ_EX 434 -# define SSL_F_SSL_READ_INTERNAL 523 -# define SSL_F_SSL_RENEGOTIATE 516 -# define SSL_F_SSL_RENEGOTIATE_ABBREVIATED 546 -# define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 -# define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 -# define SSL_F_SSL_SESSION_DUP 348 -# define SSL_F_SSL_SESSION_NEW 189 -# define SSL_F_SSL_SESSION_PRINT_FP 190 -# define SSL_F_SSL_SESSION_SET1_ID 423 -# define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 -# define SSL_F_SSL_SET_ALPN_PROTOS 344 -# define SSL_F_SSL_SET_CERT 191 -# define SSL_F_SSL_SET_CERT_AND_KEY 621 -# define SSL_F_SSL_SET_CIPHER_LIST 271 -# define SSL_F_SSL_SET_CT_VALIDATION_CALLBACK 399 -# define SSL_F_SSL_SET_FD 192 -# define SSL_F_SSL_SET_PKEY 193 -# define SSL_F_SSL_SET_RFD 194 -# define SSL_F_SSL_SET_SESSION 195 -# define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 -# define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 -# define SSL_F_SSL_SET_TLSEXT_MAX_FRAGMENT_LENGTH 550 -# define SSL_F_SSL_SET_WFD 196 -# define SSL_F_SSL_SHUTDOWN 224 -# define SSL_F_SSL_SRP_CTX_INIT 313 -# define SSL_F_SSL_START_ASYNC_JOB 389 -# define SSL_F_SSL_UNDEFINED_FUNCTION 197 -# define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 -# define SSL_F_SSL_USE_CERTIFICATE 198 -# define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 -# define SSL_F_SSL_USE_CERTIFICATE_FILE 200 -# define SSL_F_SSL_USE_PRIVATEKEY 201 -# define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 -# define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 -# define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 -# define SSL_F_SSL_USE_RSAPRIVATEKEY 204 -# define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 -# define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 -# define SSL_F_SSL_VALIDATE_CT 400 -# define SSL_F_SSL_VERIFY_CERT_CHAIN 207 -# define SSL_F_SSL_VERIFY_CLIENT_POST_HANDSHAKE 616 -# define SSL_F_SSL_WRITE 208 -# define SSL_F_SSL_WRITE_EARLY_DATA 526 -# define SSL_F_SSL_WRITE_EARLY_FINISH 527 -# define SSL_F_SSL_WRITE_EX 433 -# define SSL_F_SSL_WRITE_INTERNAL 524 -# define SSL_F_STATE_MACHINE 353 -# define SSL_F_TLS12_CHECK_PEER_SIGALG 333 -# define SSL_F_TLS12_COPY_SIGALGS 533 -# define SSL_F_TLS13_CHANGE_CIPHER_STATE 440 -# define SSL_F_TLS13_ENC 609 -# define SSL_F_TLS13_FINAL_FINISH_MAC 605 -# define SSL_F_TLS13_GENERATE_SECRET 591 -# define SSL_F_TLS13_HKDF_EXPAND 561 -# define SSL_F_TLS13_RESTORE_HANDSHAKE_DIGEST_FOR_PHA 617 -# define SSL_F_TLS13_SAVE_HANDSHAKE_DIGEST_FOR_PHA 618 -# define SSL_F_TLS13_SETUP_KEY_BLOCK 441 -# define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 -# define SSL_F_TLS1_CHECK_DUPLICATE_EXTENSIONS 341 -# define SSL_F_TLS1_ENC 401 -# define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 -# define SSL_F_TLS1_GET_CURVELIST 338 -# define SSL_F_TLS1_PRF 284 -# define SSL_F_TLS1_SAVE_U16 628 -# define SSL_F_TLS1_SETUP_KEY_BLOCK 211 -# define SSL_F_TLS1_SET_GROUPS 629 -# define SSL_F_TLS1_SET_RAW_SIGALGS 630 -# define SSL_F_TLS1_SET_SERVER_SIGALGS 335 -# define SSL_F_TLS1_SET_SHARED_SIGALGS 631 -# define SSL_F_TLS1_SET_SIGALGS 632 -# define SSL_F_TLS_CHOOSE_SIGALG 513 -# define SSL_F_TLS_CLIENT_KEY_EXCHANGE_POST_WORK 354 -# define SSL_F_TLS_COLLECT_EXTENSIONS 435 -# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES 542 -# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST 372 -# define SSL_F_TLS_CONSTRUCT_CERT_STATUS 429 -# define SSL_F_TLS_CONSTRUCT_CERT_STATUS_BODY 494 -# define SSL_F_TLS_CONSTRUCT_CERT_VERIFY 496 -# define SSL_F_TLS_CONSTRUCT_CHANGE_CIPHER_SPEC 427 -# define SSL_F_TLS_CONSTRUCT_CKE_DHE 404 -# define SSL_F_TLS_CONSTRUCT_CKE_ECDHE 405 -# define SSL_F_TLS_CONSTRUCT_CKE_GOST 406 -# define SSL_F_TLS_CONSTRUCT_CKE_PSK_PREAMBLE 407 -# define SSL_F_TLS_CONSTRUCT_CKE_RSA 409 -# define SSL_F_TLS_CONSTRUCT_CKE_SRP 410 -# define SSL_F_TLS_CONSTRUCT_CLIENT_CERTIFICATE 484 -# define SSL_F_TLS_CONSTRUCT_CLIENT_HELLO 487 -# define SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE 488 -# define SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY 489 -# define SSL_F_TLS_CONSTRUCT_CTOS_ALPN 466 -# define SSL_F_TLS_CONSTRUCT_CTOS_CERTIFICATE 355 -# define SSL_F_TLS_CONSTRUCT_CTOS_COOKIE 535 -# define SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA 530 -# define SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS 467 -# define SSL_F_TLS_CONSTRUCT_CTOS_EMS 468 -# define SSL_F_TLS_CONSTRUCT_CTOS_ETM 469 -# define SSL_F_TLS_CONSTRUCT_CTOS_HELLO 356 -# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_EXCHANGE 357 -# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE 470 -# define SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN 549 -# define SSL_F_TLS_CONSTRUCT_CTOS_NPN 471 -# define SSL_F_TLS_CONSTRUCT_CTOS_PADDING 472 -# define SSL_F_TLS_CONSTRUCT_CTOS_POST_HANDSHAKE_AUTH 619 -# define SSL_F_TLS_CONSTRUCT_CTOS_PSK 501 -# define SSL_F_TLS_CONSTRUCT_CTOS_PSK_KEX_MODES 509 -# define SSL_F_TLS_CONSTRUCT_CTOS_RENEGOTIATE 473 -# define SSL_F_TLS_CONSTRUCT_CTOS_SCT 474 -# define SSL_F_TLS_CONSTRUCT_CTOS_SERVER_NAME 475 -# define SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET 476 -# define SSL_F_TLS_CONSTRUCT_CTOS_SIG_ALGS 477 -# define SSL_F_TLS_CONSTRUCT_CTOS_SRP 478 -# define SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST 479 -# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS 480 -# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS 481 -# define SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP 482 -# define SSL_F_TLS_CONSTRUCT_CTOS_VERIFY 358 -# define SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS 443 -# define SSL_F_TLS_CONSTRUCT_END_OF_EARLY_DATA 536 -# define SSL_F_TLS_CONSTRUCT_EXTENSIONS 447 -# define SSL_F_TLS_CONSTRUCT_FINISHED 359 -# define SSL_F_TLS_CONSTRUCT_HELLO_REQUEST 373 -# define SSL_F_TLS_CONSTRUCT_HELLO_RETRY_REQUEST 510 -# define SSL_F_TLS_CONSTRUCT_KEY_UPDATE 517 -# define SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET 428 -# define SSL_F_TLS_CONSTRUCT_NEXT_PROTO 426 -# define SSL_F_TLS_CONSTRUCT_SERVER_CERTIFICATE 490 -# define SSL_F_TLS_CONSTRUCT_SERVER_HELLO 491 -# define SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE 492 -# define SSL_F_TLS_CONSTRUCT_STOC_ALPN 451 -# define SSL_F_TLS_CONSTRUCT_STOC_CERTIFICATE 374 -# define SSL_F_TLS_CONSTRUCT_STOC_COOKIE 613 -# define SSL_F_TLS_CONSTRUCT_STOC_CRYPTOPRO_BUG 452 -# define SSL_F_TLS_CONSTRUCT_STOC_DONE 375 -# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA 531 -# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA_INFO 525 -# define SSL_F_TLS_CONSTRUCT_STOC_EC_PT_FORMATS 453 -# define SSL_F_TLS_CONSTRUCT_STOC_EMS 454 -# define SSL_F_TLS_CONSTRUCT_STOC_ETM 455 -# define SSL_F_TLS_CONSTRUCT_STOC_HELLO 376 -# define SSL_F_TLS_CONSTRUCT_STOC_KEY_EXCHANGE 377 -# define SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE 456 -# define SSL_F_TLS_CONSTRUCT_STOC_MAXFRAGMENTLEN 548 -# define SSL_F_TLS_CONSTRUCT_STOC_NEXT_PROTO_NEG 457 -# define SSL_F_TLS_CONSTRUCT_STOC_PSK 504 -# define SSL_F_TLS_CONSTRUCT_STOC_RENEGOTIATE 458 -# define SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME 459 -# define SSL_F_TLS_CONSTRUCT_STOC_SESSION_TICKET 460 -# define SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST 461 -# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_GROUPS 544 -# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_VERSIONS 611 -# define SSL_F_TLS_CONSTRUCT_STOC_USE_SRTP 462 -# define SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO 521 -# define SSL_F_TLS_FINISH_HANDSHAKE 597 -# define SSL_F_TLS_GET_MESSAGE_BODY 351 -# define SSL_F_TLS_GET_MESSAGE_HEADER 387 -# define SSL_F_TLS_HANDLE_ALPN 562 -# define SSL_F_TLS_HANDLE_STATUS_REQUEST 563 -# define SSL_F_TLS_PARSE_CERTIFICATE_AUTHORITIES 566 -# define SSL_F_TLS_PARSE_CLIENTHELLO_TLSEXT 449 -# define SSL_F_TLS_PARSE_CTOS_ALPN 567 -# define SSL_F_TLS_PARSE_CTOS_COOKIE 614 -# define SSL_F_TLS_PARSE_CTOS_EARLY_DATA 568 -# define SSL_F_TLS_PARSE_CTOS_EC_PT_FORMATS 569 -# define SSL_F_TLS_PARSE_CTOS_EMS 570 -# define SSL_F_TLS_PARSE_CTOS_KEY_SHARE 463 -# define SSL_F_TLS_PARSE_CTOS_MAXFRAGMENTLEN 571 -# define SSL_F_TLS_PARSE_CTOS_POST_HANDSHAKE_AUTH 620 -# define SSL_F_TLS_PARSE_CTOS_PSK 505 -# define SSL_F_TLS_PARSE_CTOS_PSK_KEX_MODES 572 -# define SSL_F_TLS_PARSE_CTOS_RENEGOTIATE 464 -# define SSL_F_TLS_PARSE_CTOS_SERVER_NAME 573 -# define SSL_F_TLS_PARSE_CTOS_SESSION_TICKET 574 -# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS 575 -# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS_CERT 615 -# define SSL_F_TLS_PARSE_CTOS_SRP 576 -# define SSL_F_TLS_PARSE_CTOS_STATUS_REQUEST 577 -# define SSL_F_TLS_PARSE_CTOS_SUPPORTED_GROUPS 578 -# define SSL_F_TLS_PARSE_CTOS_USE_SRTP 465 -# define SSL_F_TLS_PARSE_STOC_ALPN 579 -# define SSL_F_TLS_PARSE_STOC_COOKIE 534 -# define SSL_F_TLS_PARSE_STOC_EARLY_DATA 538 -# define SSL_F_TLS_PARSE_STOC_EARLY_DATA_INFO 528 -# define SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS 580 -# define SSL_F_TLS_PARSE_STOC_KEY_SHARE 445 -# define SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN 581 -# define SSL_F_TLS_PARSE_STOC_NPN 582 -# define SSL_F_TLS_PARSE_STOC_PSK 502 -# define SSL_F_TLS_PARSE_STOC_RENEGOTIATE 448 -# define SSL_F_TLS_PARSE_STOC_SCT 564 -# define SSL_F_TLS_PARSE_STOC_SERVER_NAME 583 -# define SSL_F_TLS_PARSE_STOC_SESSION_TICKET 584 -# define SSL_F_TLS_PARSE_STOC_STATUS_REQUEST 585 -# define SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS 612 -# define SSL_F_TLS_PARSE_STOC_USE_SRTP 446 -# define SSL_F_TLS_POST_PROCESS_CLIENT_HELLO 378 -# define SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE 384 -# define SSL_F_TLS_PREPARE_CLIENT_CERTIFICATE 360 -# define SSL_F_TLS_PROCESS_AS_HELLO_RETRY_REQUEST 610 -# define SSL_F_TLS_PROCESS_CERTIFICATE_REQUEST 361 -# define SSL_F_TLS_PROCESS_CERT_STATUS 362 -# define SSL_F_TLS_PROCESS_CERT_STATUS_BODY 495 -# define SSL_F_TLS_PROCESS_CERT_VERIFY 379 -# define SSL_F_TLS_PROCESS_CHANGE_CIPHER_SPEC 363 -# define SSL_F_TLS_PROCESS_CKE_DHE 411 -# define SSL_F_TLS_PROCESS_CKE_ECDHE 412 -# define SSL_F_TLS_PROCESS_CKE_GOST 413 -# define SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE 414 -# define SSL_F_TLS_PROCESS_CKE_RSA 415 -# define SSL_F_TLS_PROCESS_CKE_SRP 416 -# define SSL_F_TLS_PROCESS_CLIENT_CERTIFICATE 380 -# define SSL_F_TLS_PROCESS_CLIENT_HELLO 381 -# define SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE 382 -# define SSL_F_TLS_PROCESS_ENCRYPTED_EXTENSIONS 444 -# define SSL_F_TLS_PROCESS_END_OF_EARLY_DATA 537 -# define SSL_F_TLS_PROCESS_FINISHED 364 -# define SSL_F_TLS_PROCESS_HELLO_REQ 507 -# define SSL_F_TLS_PROCESS_HELLO_RETRY_REQUEST 511 -# define SSL_F_TLS_PROCESS_INITIAL_SERVER_FLIGHT 442 -# define SSL_F_TLS_PROCESS_KEY_EXCHANGE 365 -# define SSL_F_TLS_PROCESS_KEY_UPDATE 518 -# define SSL_F_TLS_PROCESS_NEW_SESSION_TICKET 366 -# define SSL_F_TLS_PROCESS_NEXT_PROTO 383 -# define SSL_F_TLS_PROCESS_SERVER_CERTIFICATE 367 -# define SSL_F_TLS_PROCESS_SERVER_DONE 368 -# define SSL_F_TLS_PROCESS_SERVER_HELLO 369 -# define SSL_F_TLS_PROCESS_SKE_DHE 419 -# define SSL_F_TLS_PROCESS_SKE_ECDHE 420 -# define SSL_F_TLS_PROCESS_SKE_PSK_PREAMBLE 421 -# define SSL_F_TLS_PROCESS_SKE_SRP 422 -# define SSL_F_TLS_PSK_DO_BINDER 506 -# define SSL_F_TLS_SCAN_CLIENTHELLO_TLSEXT 450 -# define SSL_F_TLS_SETUP_HANDSHAKE 508 -# define SSL_F_USE_CERTIFICATE_CHAIN_FILE 220 -# define SSL_F_WPACKET_INTERN_INIT_LEN 633 -# define SSL_F_WPACKET_START_SUB_PACKET_LEN__ 634 -# define SSL_F_WRITE_STATE_MACHINE 586 - -/* - * SSL reason codes. - */ -# define SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY 291 -# define SSL_R_APP_DATA_IN_HANDSHAKE 100 -# define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 -# define SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE 143 -# define SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE 158 -# define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 -# define SSL_R_BAD_CIPHER 186 -# define SSL_R_BAD_DATA 390 -# define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 -# define SSL_R_BAD_DECOMPRESSION 107 -# define SSL_R_BAD_DH_VALUE 102 -# define SSL_R_BAD_DIGEST_LENGTH 111 -# define SSL_R_BAD_EARLY_DATA 233 -# define SSL_R_BAD_ECC_CERT 304 -# define SSL_R_BAD_ECPOINT 306 -# define SSL_R_BAD_EXTENSION 110 -# define SSL_R_BAD_HANDSHAKE_LENGTH 332 -# define SSL_R_BAD_HANDSHAKE_STATE 236 -# define SSL_R_BAD_HELLO_REQUEST 105 -# define SSL_R_BAD_HRR_VERSION 263 -# define SSL_R_BAD_KEY_SHARE 108 -# define SSL_R_BAD_KEY_UPDATE 122 -# define SSL_R_BAD_LEGACY_VERSION 292 -# define SSL_R_BAD_LENGTH 271 -# define SSL_R_BAD_PACKET 240 -# define SSL_R_BAD_PACKET_LENGTH 115 -# define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 -# define SSL_R_BAD_PSK 219 -# define SSL_R_BAD_PSK_IDENTITY 114 -# define SSL_R_BAD_RECORD_TYPE 443 -# define SSL_R_BAD_RSA_ENCRYPT 119 -# define SSL_R_BAD_SIGNATURE 123 -# define SSL_R_BAD_SRP_A_LENGTH 347 -# define SSL_R_BAD_SRP_PARAMETERS 371 -# define SSL_R_BAD_SRTP_MKI_VALUE 352 -# define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 -# define SSL_R_BAD_SSL_FILETYPE 124 -# define SSL_R_BAD_VALUE 384 -# define SSL_R_BAD_WRITE_RETRY 127 -# define SSL_R_BINDER_DOES_NOT_VERIFY 253 -# define SSL_R_BIO_NOT_SET 128 -# define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 -# define SSL_R_BN_LIB 130 -# define SSL_R_CALLBACK_FAILED 234 -# define SSL_R_CANNOT_CHANGE_CIPHER 109 -# define SSL_R_CA_DN_LENGTH_MISMATCH 131 -# define SSL_R_CA_KEY_TOO_SMALL 397 -# define SSL_R_CA_MD_TOO_WEAK 398 -# define SSL_R_CCS_RECEIVED_EARLY 133 -# define SSL_R_CERTIFICATE_VERIFY_FAILED 134 -# define SSL_R_CERT_CB_ERROR 377 -# define SSL_R_CERT_LENGTH_MISMATCH 135 -# define SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED 218 -# define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 -# define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 -# define SSL_R_CLIENTHELLO_TLSEXT 226 -# define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 -# define SSL_R_COMPRESSION_DISABLED 343 -# define SSL_R_COMPRESSION_FAILURE 141 -# define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 -# define SSL_R_COMPRESSION_LIBRARY_ERROR 142 -# define SSL_R_CONNECTION_TYPE_NOT_SET 144 -# define SSL_R_CONTEXT_NOT_DANE_ENABLED 167 -# define SSL_R_COOKIE_GEN_CALLBACK_FAILURE 400 -# define SSL_R_COOKIE_MISMATCH 308 -# define SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED 206 -# define SSL_R_DANE_ALREADY_ENABLED 172 -# define SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL 173 -# define SSL_R_DANE_NOT_ENABLED 175 -# define SSL_R_DANE_TLSA_BAD_CERTIFICATE 180 -# define SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE 184 -# define SSL_R_DANE_TLSA_BAD_DATA_LENGTH 189 -# define SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH 192 -# define SSL_R_DANE_TLSA_BAD_MATCHING_TYPE 200 -# define SSL_R_DANE_TLSA_BAD_PUBLIC_KEY 201 -# define SSL_R_DANE_TLSA_BAD_SELECTOR 202 -# define SSL_R_DANE_TLSA_NULL_DATA 203 -# define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 -# define SSL_R_DATA_LENGTH_TOO_LONG 146 -# define SSL_R_DECRYPTION_FAILED 147 -# define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 -# define SSL_R_DH_KEY_TOO_SMALL 394 -# define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 -# define SSL_R_DIGEST_CHECK_FAILED 149 -# define SSL_R_DTLS_MESSAGE_TOO_BIG 334 -# define SSL_R_DUPLICATE_COMPRESSION_ID 309 -# define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 -# define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 -# define SSL_R_EE_KEY_TOO_SMALL 399 -# define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 -# define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 -# define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 -# define SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN 204 -# define SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE 194 -# define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 -# define SSL_R_EXTENSION_NOT_RECEIVED 279 -# define SSL_R_EXTRA_DATA_IN_MESSAGE 153 -# define SSL_R_EXT_LENGTH_MISMATCH 163 -# define SSL_R_FAILED_TO_INIT_ASYNC 405 -# define SSL_R_FRAGMENTED_CLIENT_HELLO 401 -# define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 -# define SSL_R_HTTPS_PROXY_REQUEST 155 -# define SSL_R_HTTP_REQUEST 156 -# define SSL_R_ILLEGAL_POINT_COMPRESSION 162 -# define SSL_R_ILLEGAL_SUITEB_DIGEST 380 -# define SSL_R_INAPPROPRIATE_FALLBACK 373 -# define SSL_R_INCONSISTENT_COMPRESSION 340 -# define SSL_R_INCONSISTENT_EARLY_DATA_ALPN 222 -# define SSL_R_INCONSISTENT_EARLY_DATA_SNI 231 -# define SSL_R_INCONSISTENT_EXTMS 104 -# define SSL_R_INSUFFICIENT_SECURITY 241 -# define SSL_R_INVALID_ALERT 205 -# define SSL_R_INVALID_CCS_MESSAGE 260 -# define SSL_R_INVALID_CERTIFICATE_OR_ALG 238 -# define SSL_R_INVALID_COMMAND 280 -# define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 -# define SSL_R_INVALID_CONFIG 283 -# define SSL_R_INVALID_CONFIGURATION_NAME 113 -# define SSL_R_INVALID_CONTEXT 282 -# define SSL_R_INVALID_CT_VALIDATION_TYPE 212 -# define SSL_R_INVALID_KEY_UPDATE_TYPE 120 -# define SSL_R_INVALID_MAX_EARLY_DATA 174 -# define SSL_R_INVALID_NULL_CMD_NAME 385 -# define SSL_R_INVALID_SEQUENCE_NUMBER 402 -# define SSL_R_INVALID_SERVERINFO_DATA 388 -# define SSL_R_INVALID_SESSION_ID 999 -# define SSL_R_INVALID_SRP_USERNAME 357 -# define SSL_R_INVALID_STATUS_RESPONSE 328 -# define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 -# define SSL_R_LENGTH_MISMATCH 159 -# define SSL_R_LENGTH_TOO_LONG 404 -# define SSL_R_LENGTH_TOO_SHORT 160 -# define SSL_R_LIBRARY_BUG 274 -# define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 -# define SSL_R_MISSING_DSA_SIGNING_CERT 165 -# define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 -# define SSL_R_MISSING_FATAL 256 -# define SSL_R_MISSING_PARAMETERS 290 -# define SSL_R_MISSING_RSA_CERTIFICATE 168 -# define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 -# define SSL_R_MISSING_RSA_SIGNING_CERT 170 -# define SSL_R_MISSING_SIGALGS_EXTENSION 112 -# define SSL_R_MISSING_SIGNING_CERT 221 -# define SSL_R_MISSING_SRP_PARAM 358 -# define SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION 209 -# define SSL_R_MISSING_TMP_DH_KEY 171 -# define SSL_R_MISSING_TMP_ECDH_KEY 311 -# define SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA 293 -# define SSL_R_NOT_ON_RECORD_BOUNDARY 182 -# define SSL_R_NOT_REPLACING_CERTIFICATE 289 -# define SSL_R_NOT_SERVER 284 -# define SSL_R_NO_APPLICATION_PROTOCOL 235 -# define SSL_R_NO_CERTIFICATES_RETURNED 176 -# define SSL_R_NO_CERTIFICATE_ASSIGNED 177 -# define SSL_R_NO_CERTIFICATE_SET 179 -# define SSL_R_NO_CHANGE_FOLLOWING_HRR 214 -# define SSL_R_NO_CIPHERS_AVAILABLE 181 -# define SSL_R_NO_CIPHERS_SPECIFIED 183 -# define SSL_R_NO_CIPHER_MATCH 185 -# define SSL_R_NO_CLIENT_CERT_METHOD 331 -# define SSL_R_NO_COMPRESSION_SPECIFIED 187 -# define SSL_R_NO_COOKIE_CALLBACK_SET 287 -# define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 -# define SSL_R_NO_METHOD_SPECIFIED 188 -# define SSL_R_NO_PEM_EXTENSIONS 389 -# define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 -# define SSL_R_NO_PROTOCOLS_AVAILABLE 191 -# define SSL_R_NO_RENEGOTIATION 339 -# define SSL_R_NO_REQUIRED_DIGEST 324 -# define SSL_R_NO_SHARED_CIPHER 193 -# define SSL_R_NO_SHARED_GROUPS 410 -# define SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS 376 -# define SSL_R_NO_SRTP_PROFILES 359 -# define SSL_R_NO_SUITABLE_KEY_SHARE 101 -# define SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM 118 -# define SSL_R_NO_VALID_SCTS 216 -# define SSL_R_NO_VERIFY_COOKIE_CALLBACK 403 -# define SSL_R_NULL_SSL_CTX 195 -# define SSL_R_NULL_SSL_METHOD_PASSED 196 -# define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 -# define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 -# define SSL_R_OVERFLOW_ERROR 237 -# define SSL_R_PACKET_LENGTH_TOO_LONG 198 -# define SSL_R_PARSE_TLSEXT 227 -# define SSL_R_PATH_TOO_LONG 270 -# define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 -# define SSL_R_PEM_NAME_BAD_PREFIX 391 -# define SSL_R_PEM_NAME_TOO_SHORT 392 -# define SSL_R_PIPELINE_FAILURE 406 -# define SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR 278 -# define SSL_R_PRIVATE_KEY_MISMATCH 288 -# define SSL_R_PROTOCOL_IS_SHUTDOWN 207 -# define SSL_R_PSK_IDENTITY_NOT_FOUND 223 -# define SSL_R_PSK_NO_CLIENT_CB 224 -# define SSL_R_PSK_NO_SERVER_CB 225 -# define SSL_R_READ_BIO_NOT_SET 211 -# define SSL_R_READ_TIMEOUT_EXPIRED 312 -# define SSL_R_RECORD_LENGTH_MISMATCH 213 -# define SSL_R_RECORD_TOO_SMALL 298 -# define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 -# define SSL_R_RENEGOTIATION_ENCODING_ERR 336 -# define SSL_R_RENEGOTIATION_MISMATCH 337 -# define SSL_R_REQUEST_PENDING 285 -# define SSL_R_REQUEST_SENT 286 -# define SSL_R_REQUIRED_CIPHER_MISSING 215 -# define SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING 342 -# define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 -# define SSL_R_SCT_VERIFICATION_FAILED 208 -# define SSL_R_SERVERHELLO_TLSEXT 275 -# define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 -# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 -# define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 -# define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 -# define SSL_R_SRP_A_CALC 361 -# define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 -# define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 -# define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 -# define SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH 232 -# define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 -# define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 -# define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 -# define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 -# define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 -# define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 -# define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 -# define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 -# define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 -# define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 -# define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 -# define SSL_R_SSL_COMMAND_SECTION_EMPTY 117 -# define SSL_R_SSL_COMMAND_SECTION_NOT_FOUND 125 -# define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 -# define SSL_R_SSL_HANDSHAKE_FAILURE 229 -# define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 -# define SSL_R_SSL_NEGATIVE_LENGTH 372 -# define SSL_R_SSL_SECTION_EMPTY 126 -# define SSL_R_SSL_SECTION_NOT_FOUND 136 -# define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 -# define SSL_R_SSL_SESSION_ID_CONFLICT 302 -# define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 -# define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 -# define SSL_R_SSL_SESSION_ID_TOO_LONG 408 -# define SSL_R_SSL_SESSION_VERSION_MISMATCH 210 -# define SSL_R_STILL_IN_INIT 121 -# define SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED 1116 -# define SSL_R_TLSV13_ALERT_MISSING_EXTENSION 1109 -# define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 -# define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 -# define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 -# define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 -# define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 -# define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 -# define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 -# define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 -# define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 -# define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 -# define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 -# define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 -# define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 -# define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 -# define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 -# define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 -# define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 -# define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 -# define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 -# define SSL_R_TLS_HEARTBEAT_PENDING 366 -# define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 -# define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 -# define SSL_R_TOO_MANY_KEY_UPDATES 132 -# define SSL_R_TOO_MANY_WARN_ALERTS 409 -# define SSL_R_TOO_MUCH_EARLY_DATA 164 -# define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 -# define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 -# define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 -# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 -# define SSL_R_UNEXPECTED_CCS_MESSAGE 262 -# define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178 -# define SSL_R_UNEXPECTED_MESSAGE 244 -# define SSL_R_UNEXPECTED_RECORD 245 -# define SSL_R_UNINITIALIZED 276 -# define SSL_R_UNKNOWN_ALERT_TYPE 246 -# define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 -# define SSL_R_UNKNOWN_CIPHER_RETURNED 248 -# define SSL_R_UNKNOWN_CIPHER_TYPE 249 -# define SSL_R_UNKNOWN_CMD_NAME 386 -# define SSL_R_UNKNOWN_COMMAND 139 -# define SSL_R_UNKNOWN_DIGEST 368 -# define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 -# define SSL_R_UNKNOWN_PKEY_TYPE 251 -# define SSL_R_UNKNOWN_PROTOCOL 252 -# define SSL_R_UNKNOWN_SSL_VERSION 254 -# define SSL_R_UNKNOWN_STATE 255 -# define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 -# define SSL_R_UNSOLICITED_EXTENSION 217 -# define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 -# define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 -# define SSL_R_UNSUPPORTED_PROTOCOL 258 -# define SSL_R_UNSUPPORTED_SSL_VERSION 259 -# define SSL_R_UNSUPPORTED_STATUS_TYPE 329 -# define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 -# define SSL_R_VERSION_TOO_HIGH 166 -# define SSL_R_VERSION_TOO_LOW 396 -# define SSL_R_WRONG_CERTIFICATE_TYPE 383 -# define SSL_R_WRONG_CIPHER_RETURNED 261 -# define SSL_R_WRONG_CURVE 378 -# define SSL_R_WRONG_SIGNATURE_LENGTH 264 -# define SSL_R_WRONG_SIGNATURE_SIZE 265 -# define SSL_R_WRONG_SIGNATURE_TYPE 370 -# define SSL_R_WRONG_SSL_VERSION 266 -# define SSL_R_WRONG_VERSION_NUMBER 267 -# define SSL_R_X509_LIB 268 -# define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/stack.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/stack.h deleted file mode 100644 index cfc07505..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/stack.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 1995-2017 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_STACK_H -# define HEADER_STACK_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */ - -typedef int (*OPENSSL_sk_compfunc)(const void *, const void *); -typedef void (*OPENSSL_sk_freefunc)(void *); -typedef void *(*OPENSSL_sk_copyfunc)(const void *); - -int OPENSSL_sk_num(const OPENSSL_STACK *); -void *OPENSSL_sk_value(const OPENSSL_STACK *, int); - -void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data); - -OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp); -OPENSSL_STACK *OPENSSL_sk_new_null(void); -OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n); -int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n); -void OPENSSL_sk_free(OPENSSL_STACK *); -void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *)); -OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, - OPENSSL_sk_copyfunc c, - OPENSSL_sk_freefunc f); -int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where); -void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc); -void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p); -int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data); -void *OPENSSL_sk_shift(OPENSSL_STACK *st); -void *OPENSSL_sk_pop(OPENSSL_STACK *st); -void OPENSSL_sk_zero(OPENSSL_STACK *st); -OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, - OPENSSL_sk_compfunc cmp); -OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st); -void OPENSSL_sk_sort(OPENSSL_STACK *st); -int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define _STACK OPENSSL_STACK -# define sk_num OPENSSL_sk_num -# define sk_value OPENSSL_sk_value -# define sk_set OPENSSL_sk_set -# define sk_new OPENSSL_sk_new -# define sk_new_null OPENSSL_sk_new_null -# define sk_free OPENSSL_sk_free -# define sk_pop_free OPENSSL_sk_pop_free -# define sk_deep_copy OPENSSL_sk_deep_copy -# define sk_insert OPENSSL_sk_insert -# define sk_delete OPENSSL_sk_delete -# define sk_delete_ptr OPENSSL_sk_delete_ptr -# define sk_find OPENSSL_sk_find -# define sk_find_ex OPENSSL_sk_find_ex -# define sk_push OPENSSL_sk_push -# define sk_unshift OPENSSL_sk_unshift -# define sk_shift OPENSSL_sk_shift -# define sk_pop OPENSSL_sk_pop -# define sk_zero OPENSSL_sk_zero -# define sk_set_cmp_func OPENSSL_sk_set_cmp_func -# define sk_dup OPENSSL_sk_dup -# define sk_sort OPENSSL_sk_sort -# define sk_is_sorted OPENSSL_sk_is_sorted -# endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/store.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/store.h deleted file mode 100644 index a40a7339..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/store.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2016-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_OSSL_STORE_H -# define HEADER_OSSL_STORE_H - -# include -# include -# include -# include - -# ifdef __cplusplus -extern "C" { -# endif - -/*- - * The main OSSL_STORE functions. - * ------------------------------ - * - * These allow applications to open a channel to a resource with supported - * data (keys, certs, crls, ...), read the data a piece at a time and decide - * what to do with it, and finally close. - */ - -typedef struct ossl_store_ctx_st OSSL_STORE_CTX; - -/* - * Typedef for the OSSL_STORE_INFO post processing callback. This can be used - * to massage the given OSSL_STORE_INFO, or to drop it entirely (by returning - * NULL). - */ -typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *, - void *); - -/* - * Open a channel given a URI. The given UI method will be used any time the - * loader needs extra input, for example when a password or pin is needed, and - * will be passed the same user data every time it's needed in this context. - * - * Returns a context reference which represents the channel to communicate - * through. - */ -OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method, - void *ui_data, - OSSL_STORE_post_process_info_fn post_process, - void *post_process_data); - -/* - * Control / fine tune the OSSL_STORE channel. |cmd| determines what is to be - * done, and depends on the underlying loader (use OSSL_STORE_get0_scheme to - * determine which loader is used), except for common commands (see below). - * Each command takes different arguments. - */ -int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */); -int OSSL_STORE_vctrl(OSSL_STORE_CTX *ctx, int cmd, va_list args); - -/* - * Common ctrl commands that different loaders may choose to support. - */ -/* int on = 0 or 1; STORE_ctrl(ctx, STORE_C_USE_SECMEM, &on); */ -# define OSSL_STORE_C_USE_SECMEM 1 -/* Where custom commands start */ -# define OSSL_STORE_C_CUSTOM_START 100 - -/* - * Read one data item (a key, a cert, a CRL) that is supported by the OSSL_STORE - * functionality, given a context. - * Returns a OSSL_STORE_INFO pointer, from which OpenSSL typed data can be - * extracted with OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), ... - * NULL is returned on error, which may include that the data found at the URI - * can't be figured out for certain or is ambiguous. - */ -OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx); - -/* - * Check if end of data (end of file) is reached - * Returns 1 on end, 0 otherwise. - */ -int OSSL_STORE_eof(OSSL_STORE_CTX *ctx); - -/* - * Check if an error occurred - * Returns 1 if it did, 0 otherwise. - */ -int OSSL_STORE_error(OSSL_STORE_CTX *ctx); - -/* - * Close the channel - * Returns 1 on success, 0 on error. - */ -int OSSL_STORE_close(OSSL_STORE_CTX *ctx); - - -/*- - * Extracting OpenSSL types from and creating new OSSL_STORE_INFOs - * --------------------------------------------------------------- - */ - -/* - * Types of data that can be ossl_stored in a OSSL_STORE_INFO. - * OSSL_STORE_INFO_NAME is typically found when getting a listing of - * available "files" / "tokens" / what have you. - */ -# define OSSL_STORE_INFO_NAME 1 /* char * */ -# define OSSL_STORE_INFO_PARAMS 2 /* EVP_PKEY * */ -# define OSSL_STORE_INFO_PKEY 3 /* EVP_PKEY * */ -# define OSSL_STORE_INFO_CERT 4 /* X509 * */ -# define OSSL_STORE_INFO_CRL 5 /* X509_CRL * */ - -/* - * Functions to generate OSSL_STORE_INFOs, one function for each type we - * support having in them, as well as a generic constructor. - * - * In all cases, ownership of the object is transferred to the OSSL_STORE_INFO - * and will therefore be freed when the OSSL_STORE_INFO is freed. - */ -OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name); -int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(EVP_PKEY *params); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl); - -/* - * Functions to try to extract data from a OSSL_STORE_INFO. - */ -int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *info); -const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *info); -char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *info); -const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO *info); -char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *info); -X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *info); -X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *info); -X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *info); -X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *info); - -const char *OSSL_STORE_INFO_type_string(int type); - -/* - * Free the OSSL_STORE_INFO - */ -void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info); - - -/*- - * Functions to construct a search URI from a base URI and search criteria - * ----------------------------------------------------------------------- - */ - -/* OSSL_STORE search types */ -# define OSSL_STORE_SEARCH_BY_NAME 1 /* subject in certs, issuer in CRLs */ -# define OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 2 -# define OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 3 -# define OSSL_STORE_SEARCH_BY_ALIAS 4 - -/* To check what search types the scheme handler supports */ -int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type); - -/* Search term constructors */ -/* - * The input is considered to be owned by the caller, and must therefore - * remain present throughout the lifetime of the returned OSSL_STORE_SEARCH - */ -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name, - const ASN1_INTEGER - *serial); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest, - const unsigned char - *bytes, size_t len); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias); - -/* Search term destructor */ -void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search); - -/* Search term accessors */ -int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion); -X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion); -const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH - *criterion); -const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH - *criterion, size_t *length); -const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion); -const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH *criterion); - -/* - * Add search criterion and expected return type (which can be unspecified) - * to the loading channel. This MUST happen before the first OSSL_STORE_load(). - */ -int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type); -int OSSL_STORE_find(OSSL_STORE_CTX *ctx, OSSL_STORE_SEARCH *search); - - -/*- - * Function to register a loader for the given URI scheme. - * ------------------------------------------------------- - * - * The loader receives all the main components of an URI except for the - * scheme. - */ - -typedef struct ossl_store_loader_st OSSL_STORE_LOADER; -OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme); -const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader); -const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader); -/* struct ossl_store_loader_ctx_st is defined differently by each loader */ -typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX; -typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(const OSSL_STORE_LOADER - *loader, - const char *uri, - const UI_METHOD *ui_method, - void *ui_data); -int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader, - OSSL_STORE_open_fn open_function); -typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd, - va_list args); -int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader, - OSSL_STORE_ctrl_fn ctrl_function); -typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected); -int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader, - OSSL_STORE_expect_fn expect_function); -typedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx, - OSSL_STORE_SEARCH *criteria); -int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader, - OSSL_STORE_find_fn find_function); -typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx, - const UI_METHOD *ui_method, - void *ui_data); -int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *loader, - OSSL_STORE_load_fn load_function); -typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *loader, - OSSL_STORE_eof_fn eof_function); -typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader, - OSSL_STORE_error_fn error_function); -typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader, - OSSL_STORE_close_fn close_function); -void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader); - -int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader); -OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme); - -/*- - * Functions to list STORE loaders - * ------------------------------- - */ -int OSSL_STORE_do_all_loaders(void (*do_function) (const OSSL_STORE_LOADER - *loader, void *do_arg), - void *do_arg); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/storeerr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/storeerr.h deleted file mode 100644 index 190eab07..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/storeerr.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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_OSSL_STOREERR_H -# define HEADER_OSSL_STOREERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_OSSL_STORE_strings(void); - -/* - * OSSL_STORE function codes. - */ -# define OSSL_STORE_F_FILE_CTRL 129 -# define OSSL_STORE_F_FILE_FIND 138 -# define OSSL_STORE_F_FILE_GET_PASS 118 -# define OSSL_STORE_F_FILE_LOAD 119 -# define OSSL_STORE_F_FILE_LOAD_TRY_DECODE 124 -# define OSSL_STORE_F_FILE_NAME_TO_URI 126 -# define OSSL_STORE_F_FILE_OPEN 120 -# define OSSL_STORE_F_OSSL_STORE_ATTACH_PEM_BIO 127 -# define OSSL_STORE_F_OSSL_STORE_EXPECT 130 -# define OSSL_STORE_F_OSSL_STORE_FILE_ATTACH_PEM_BIO_INT 128 -# define OSSL_STORE_F_OSSL_STORE_FIND 131 -# define OSSL_STORE_F_OSSL_STORE_GET0_LOADER_INT 100 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CERT 101 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CRL 102 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME 103 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME_DESCRIPTION 135 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PARAMS 104 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PKEY 105 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CERT 106 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CRL 107 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_EMBEDDED 123 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_NAME 109 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PARAMS 110 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PKEY 111 -# define OSSL_STORE_F_OSSL_STORE_INFO_SET0_NAME_DESCRIPTION 134 -# define OSSL_STORE_F_OSSL_STORE_INIT_ONCE 112 -# define OSSL_STORE_F_OSSL_STORE_LOADER_NEW 113 -# define OSSL_STORE_F_OSSL_STORE_OPEN 114 -# define OSSL_STORE_F_OSSL_STORE_OPEN_INT 115 -# define OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT 117 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ALIAS 132 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 133 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 136 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_NAME 137 -# define OSSL_STORE_F_OSSL_STORE_UNREGISTER_LOADER_INT 116 -# define OSSL_STORE_F_TRY_DECODE_PARAMS 121 -# define OSSL_STORE_F_TRY_DECODE_PKCS12 122 -# define OSSL_STORE_F_TRY_DECODE_PKCS8ENCRYPTED 125 - -/* - * OSSL_STORE reason codes. - */ -# define OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE 107 -# define OSSL_STORE_R_BAD_PASSWORD_READ 115 -# define OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC 113 -# define OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST 121 -# define OSSL_STORE_R_INVALID_SCHEME 106 -# define OSSL_STORE_R_IS_NOT_A 112 -# define OSSL_STORE_R_LOADER_INCOMPLETE 116 -# define OSSL_STORE_R_LOADING_STARTED 117 -# define OSSL_STORE_R_NOT_A_CERTIFICATE 100 -# define OSSL_STORE_R_NOT_A_CRL 101 -# define OSSL_STORE_R_NOT_A_KEY 102 -# define OSSL_STORE_R_NOT_A_NAME 103 -# define OSSL_STORE_R_NOT_PARAMETERS 104 -# define OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR 114 -# define OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE 108 -# define OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 119 -# define OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED 109 -# define OSSL_STORE_R_UNREGISTERED_SCHEME 105 -# define OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE 110 -# define OSSL_STORE_R_UNSUPPORTED_OPERATION 118 -# define OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE 120 -# define OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED 111 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/symhacks.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/symhacks.h deleted file mode 100644 index 156ea6e4..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/symhacks.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 1999-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_SYMHACKS_H -# define HEADER_SYMHACKS_H - -# include - -/* Case insensitive linking causes problems.... */ -# if defined(OPENSSL_SYS_VMS) -# undef ERR_load_CRYPTO_strings -# define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings -# undef OCSP_crlID_new -# define OCSP_crlID_new OCSP_crlID2_new - -# undef d2i_ECPARAMETERS -# define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS -# undef i2d_ECPARAMETERS -# define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS -# undef d2i_ECPKPARAMETERS -# define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS -# undef i2d_ECPKPARAMETERS -# define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS - -/* This one clashes with CMS_data_create */ -# undef cms_Data_create -# define cms_Data_create priv_cms_Data_create - -# endif - -#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/tls1.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/tls1.h deleted file mode 100644 index 76d9fda4..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/tls1.h +++ /dev/null @@ -1,1237 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved - * Copyright 2005 Nokia. 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_TLS1_H -# define HEADER_TLS1_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Default security level if not overridden at config time */ -# ifndef OPENSSL_TLS_SECURITY_LEVEL -# define OPENSSL_TLS_SECURITY_LEVEL 1 -# endif - -# define TLS1_VERSION 0x0301 -# define TLS1_1_VERSION 0x0302 -# define TLS1_2_VERSION 0x0303 -# define TLS1_3_VERSION 0x0304 -# define TLS_MAX_VERSION TLS1_3_VERSION - -/* Special value for method supporting multiple versions */ -# define TLS_ANY_VERSION 0x10000 - -# define TLS1_VERSION_MAJOR 0x03 -# define TLS1_VERSION_MINOR 0x01 - -# define TLS1_1_VERSION_MAJOR 0x03 -# define TLS1_1_VERSION_MINOR 0x02 - -# define TLS1_2_VERSION_MAJOR 0x03 -# define TLS1_2_VERSION_MINOR 0x03 - -# define TLS1_get_version(s) \ - ((SSL_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_version(s) : 0) - -# define TLS1_get_client_version(s) \ - ((SSL_client_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_client_version(s) : 0) - -# define TLS1_AD_DECRYPTION_FAILED 21 -# define TLS1_AD_RECORD_OVERFLOW 22 -# define TLS1_AD_UNKNOWN_CA 48/* fatal */ -# define TLS1_AD_ACCESS_DENIED 49/* fatal */ -# define TLS1_AD_DECODE_ERROR 50/* fatal */ -# define TLS1_AD_DECRYPT_ERROR 51 -# define TLS1_AD_EXPORT_RESTRICTION 60/* fatal */ -# define TLS1_AD_PROTOCOL_VERSION 70/* fatal */ -# define TLS1_AD_INSUFFICIENT_SECURITY 71/* fatal */ -# define TLS1_AD_INTERNAL_ERROR 80/* fatal */ -# define TLS1_AD_INAPPROPRIATE_FALLBACK 86/* fatal */ -# define TLS1_AD_USER_CANCELLED 90 -# define TLS1_AD_NO_RENEGOTIATION 100 -/* TLSv1.3 alerts */ -# define TLS13_AD_MISSING_EXTENSION 109 /* fatal */ -# define TLS13_AD_CERTIFICATE_REQUIRED 116 /* fatal */ -/* codes 110-114 are from RFC3546 */ -# define TLS1_AD_UNSUPPORTED_EXTENSION 110 -# define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 -# define TLS1_AD_UNRECOGNIZED_NAME 112 -# define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 -# define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 -# define TLS1_AD_UNKNOWN_PSK_IDENTITY 115/* fatal */ -# define TLS1_AD_NO_APPLICATION_PROTOCOL 120 /* fatal */ - -/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ -# define TLSEXT_TYPE_server_name 0 -# define TLSEXT_TYPE_max_fragment_length 1 -# define TLSEXT_TYPE_client_certificate_url 2 -# define TLSEXT_TYPE_trusted_ca_keys 3 -# define TLSEXT_TYPE_truncated_hmac 4 -# define TLSEXT_TYPE_status_request 5 -/* ExtensionType values from RFC4681 */ -# define TLSEXT_TYPE_user_mapping 6 -/* ExtensionType values from RFC5878 */ -# define TLSEXT_TYPE_client_authz 7 -# define TLSEXT_TYPE_server_authz 8 -/* ExtensionType values from RFC6091 */ -# define TLSEXT_TYPE_cert_type 9 - -/* ExtensionType values from RFC4492 */ -/* - * Prior to TLSv1.3 the supported_groups extension was known as - * elliptic_curves - */ -# define TLSEXT_TYPE_supported_groups 10 -# define TLSEXT_TYPE_elliptic_curves TLSEXT_TYPE_supported_groups -# define TLSEXT_TYPE_ec_point_formats 11 - - -/* ExtensionType value from RFC5054 */ -# define TLSEXT_TYPE_srp 12 - -/* ExtensionType values from RFC5246 */ -# define TLSEXT_TYPE_signature_algorithms 13 - -/* ExtensionType value from RFC5764 */ -# define TLSEXT_TYPE_use_srtp 14 - -/* ExtensionType value from RFC5620 */ -# define TLSEXT_TYPE_heartbeat 15 - -/* ExtensionType value from RFC7301 */ -# define TLSEXT_TYPE_application_layer_protocol_negotiation 16 - -/* - * Extension type for Certificate Transparency - * https://tools.ietf.org/html/rfc6962#section-3.3.1 - */ -# define TLSEXT_TYPE_signed_certificate_timestamp 18 - -/* - * ExtensionType value for TLS padding extension. - * http://tools.ietf.org/html/draft-agl-tls-padding - */ -# define TLSEXT_TYPE_padding 21 - -/* ExtensionType value from RFC7366 */ -# define TLSEXT_TYPE_encrypt_then_mac 22 - -/* ExtensionType value from RFC7627 */ -# define TLSEXT_TYPE_extended_master_secret 23 - -/* ExtensionType value from RFC4507 */ -# define TLSEXT_TYPE_session_ticket 35 - -/* As defined for TLS1.3 */ -# define TLSEXT_TYPE_psk 41 -# define TLSEXT_TYPE_early_data 42 -# define TLSEXT_TYPE_supported_versions 43 -# define TLSEXT_TYPE_cookie 44 -# define TLSEXT_TYPE_psk_kex_modes 45 -# define TLSEXT_TYPE_certificate_authorities 47 -# define TLSEXT_TYPE_post_handshake_auth 49 -# define TLSEXT_TYPE_signature_algorithms_cert 50 -# define TLSEXT_TYPE_key_share 51 - -/* Temporary extension type */ -# define TLSEXT_TYPE_renegotiate 0xff01 - -# ifndef OPENSSL_NO_NEXTPROTONEG -/* This is not an IANA defined extension number */ -# define TLSEXT_TYPE_next_proto_neg 13172 -# endif - -/* NameType value from RFC3546 */ -# define TLSEXT_NAMETYPE_host_name 0 -/* status request value from RFC3546 */ -# define TLSEXT_STATUSTYPE_ocsp 1 - -/* ECPointFormat values from RFC4492 */ -# define TLSEXT_ECPOINTFORMAT_first 0 -# define TLSEXT_ECPOINTFORMAT_uncompressed 0 -# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 -# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 -# define TLSEXT_ECPOINTFORMAT_last 2 - -/* Signature and hash algorithms from RFC5246 */ -# define TLSEXT_signature_anonymous 0 -# define TLSEXT_signature_rsa 1 -# define TLSEXT_signature_dsa 2 -# define TLSEXT_signature_ecdsa 3 -# define TLSEXT_signature_gostr34102001 237 -# define TLSEXT_signature_gostr34102012_256 238 -# define TLSEXT_signature_gostr34102012_512 239 - -/* Total number of different signature algorithms */ -# define TLSEXT_signature_num 7 - -# define TLSEXT_hash_none 0 -# define TLSEXT_hash_md5 1 -# define TLSEXT_hash_sha1 2 -# define TLSEXT_hash_sha224 3 -# define TLSEXT_hash_sha256 4 -# define TLSEXT_hash_sha384 5 -# define TLSEXT_hash_sha512 6 -# define TLSEXT_hash_gostr3411 237 -# define TLSEXT_hash_gostr34112012_256 238 -# define TLSEXT_hash_gostr34112012_512 239 - -/* Total number of different digest algorithms */ - -# define TLSEXT_hash_num 10 - -/* Flag set for unrecognised algorithms */ -# define TLSEXT_nid_unknown 0x1000000 - -/* ECC curves */ - -# define TLSEXT_curve_P_256 23 -# define TLSEXT_curve_P_384 24 - -/* OpenSSL value to disable maximum fragment length extension */ -# define TLSEXT_max_fragment_length_DISABLED 0 -/* Allowed values for max fragment length extension */ -# define TLSEXT_max_fragment_length_512 1 -# define TLSEXT_max_fragment_length_1024 2 -# define TLSEXT_max_fragment_length_2048 3 -# define TLSEXT_max_fragment_length_4096 4 - -int SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode); -int SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode); - -# define TLSEXT_MAXLEN_host_name 255 - -__owur const char *SSL_get_servername(const SSL *s, const int type); -__owur int SSL_get_servername_type(const SSL *s); -/* - * SSL_export_keying_material exports a value derived from the master secret, - * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and - * optional context. (Since a zero length context is allowed, the |use_context| - * flag controls whether a context is included.) It returns 1 on success and - * 0 or -1 otherwise. - */ -__owur int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, - const char *label, size_t llen, - const unsigned char *context, - size_t contextlen, int use_context); - -/* - * SSL_export_keying_material_early exports a value derived from the - * early exporter master secret, as specified in - * https://tools.ietf.org/html/draft-ietf-tls-tls13-23. It writes - * |olen| bytes to |out| given a label and optional context. It - * returns 1 on success and 0 otherwise. - */ -__owur int SSL_export_keying_material_early(SSL *s, unsigned char *out, - size_t olen, const char *label, - size_t llen, - const unsigned char *context, - size_t contextlen); - -int SSL_get_peer_signature_type_nid(const SSL *s, int *pnid); -int SSL_get_signature_type_nid(const SSL *s, int *pnid); - -int SSL_get_sigalgs(SSL *s, int idx, - int *psign, int *phash, int *psignandhash, - unsigned char *rsig, unsigned char *rhash); - -int SSL_get_shared_sigalgs(SSL *s, int idx, - int *psign, int *phash, int *psignandhash, - unsigned char *rsig, unsigned char *rhash); - -__owur int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain); - -# define SSL_set_tlsext_host_name(s,name) \ - SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,\ - (void *)name) - -# define SSL_set_tlsext_debug_callback(ssl, cb) \ - SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,\ - (void (*)(void))cb) - -# define SSL_set_tlsext_debug_arg(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0,arg) - -# define SSL_get_tlsext_status_type(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) - -# define SSL_set_tlsext_status_type(ssl, type) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) - -# define SSL_get_tlsext_status_exts(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0,arg) - -# define SSL_set_tlsext_status_exts(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0,arg) - -# define SSL_get_tlsext_status_ids(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0,arg) - -# define SSL_set_tlsext_status_ids(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0,arg) - -# define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0,arg) - -# define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen,arg) - -# define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ - SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,\ - (void (*)(void))cb) - -# define SSL_TLSEXT_ERR_OK 0 -# define SSL_TLSEXT_ERR_ALERT_WARNING 1 -# define SSL_TLSEXT_ERR_ALERT_FATAL 2 -# define SSL_TLSEXT_ERR_NOACK 3 - -# define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0,arg) - -# define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_TLSEXT_TICKET_KEYS,keylen,keys) -# define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_TICKET_KEYS,keylen,keys) - -# define SSL_CTX_get_tlsext_status_cb(ssl, cb) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB,0,(void *)cb) -# define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ - SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,\ - (void (*)(void))cb) - -# define SSL_CTX_get_tlsext_status_arg(ssl, arg) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) -# define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) - -# define SSL_CTX_set_tlsext_status_type(ssl, type) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) - -# define SSL_CTX_get_tlsext_status_type(ssl) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) - -# define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ - SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,\ - (void (*)(void))cb) - -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_DTLSEXT_HB_ENABLED 0x01 -# define SSL_DTLSEXT_HB_DONT_SEND_REQUESTS 0x02 -# define SSL_DTLSEXT_HB_DONT_RECV_REQUESTS 0x04 -# define SSL_get_dtlsext_heartbeat_pending(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING,0,NULL) -# define SSL_set_dtlsext_heartbeat_no_requests(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL) - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT \ - SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT -# define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING \ - SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING -# define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS \ - SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS -# define SSL_TLSEXT_HB_ENABLED \ - SSL_DTLSEXT_HB_ENABLED -# define SSL_TLSEXT_HB_DONT_SEND_REQUESTS \ - SSL_DTLSEXT_HB_DONT_SEND_REQUESTS -# define SSL_TLSEXT_HB_DONT_RECV_REQUESTS \ - SSL_DTLSEXT_HB_DONT_RECV_REQUESTS -# define SSL_get_tlsext_heartbeat_pending(ssl) \ - SSL_get_dtlsext_heartbeat_pending(ssl) -# define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \ - SSL_set_dtlsext_heartbeat_no_requests(ssl,arg) -# endif -# endif - -/* PSK ciphersuites from 4279 */ -# define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A -# define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B -# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C -# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D -# define TLS1_CK_DHE_PSK_WITH_RC4_128_SHA 0x0300008E -# define TLS1_CK_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008F -# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA 0x03000090 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA 0x03000091 -# define TLS1_CK_RSA_PSK_WITH_RC4_128_SHA 0x03000092 -# define TLS1_CK_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x03000093 -# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA 0x03000094 -# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA 0x03000095 - -/* PSK ciphersuites from 5487 */ -# define TLS1_CK_PSK_WITH_AES_128_GCM_SHA256 0x030000A8 -# define TLS1_CK_PSK_WITH_AES_256_GCM_SHA384 0x030000A9 -# define TLS1_CK_DHE_PSK_WITH_AES_128_GCM_SHA256 0x030000AA -# define TLS1_CK_DHE_PSK_WITH_AES_256_GCM_SHA384 0x030000AB -# define TLS1_CK_RSA_PSK_WITH_AES_128_GCM_SHA256 0x030000AC -# define TLS1_CK_RSA_PSK_WITH_AES_256_GCM_SHA384 0x030000AD -# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA256 0x030000AE -# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA384 0x030000AF -# define TLS1_CK_PSK_WITH_NULL_SHA256 0x030000B0 -# define TLS1_CK_PSK_WITH_NULL_SHA384 0x030000B1 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA256 0x030000B2 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA384 0x030000B3 -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA256 0x030000B4 -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA384 0x030000B5 -# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA256 0x030000B6 -# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA384 0x030000B7 -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA256 0x030000B8 -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA384 0x030000B9 - -/* NULL PSK ciphersuites from RFC4785 */ -# define TLS1_CK_PSK_WITH_NULL_SHA 0x0300002C -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA 0x0300002D -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA 0x0300002E - -/* AES ciphersuites from RFC3268 */ -# define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F -# define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 -# define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 -# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 -# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 -# define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 -# define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 -# define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 -# define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 -# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 -# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 -# define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A - -/* TLS v1.2 ciphersuites */ -# define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B -# define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C -# define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D -# define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E -# define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F -# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 -# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 - -/* TLS v1.2 ciphersuites */ -# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 -# define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 -# define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 -# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A -# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B -# define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C -# define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 -# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 - -/* SEED ciphersuites from RFC4162 */ -# define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 -# define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 -# define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 -# define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 -# define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A -# define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B - -/* TLS v1.2 GCM ciphersuites from RFC5288 */ -# define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C -# define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D -# define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E -# define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F -# define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 -# define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 -# define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 -# define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 -# define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 -# define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 -# define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 -# define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 - -/* CCM ciphersuites from RFC6655 */ -# define TLS1_CK_RSA_WITH_AES_128_CCM 0x0300C09C -# define TLS1_CK_RSA_WITH_AES_256_CCM 0x0300C09D -# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM 0x0300C09E -# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM 0x0300C09F -# define TLS1_CK_RSA_WITH_AES_128_CCM_8 0x0300C0A0 -# define TLS1_CK_RSA_WITH_AES_256_CCM_8 0x0300C0A1 -# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM_8 0x0300C0A2 -# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM_8 0x0300C0A3 -# define TLS1_CK_PSK_WITH_AES_128_CCM 0x0300C0A4 -# define TLS1_CK_PSK_WITH_AES_256_CCM 0x0300C0A5 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM 0x0300C0A6 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM 0x0300C0A7 -# define TLS1_CK_PSK_WITH_AES_128_CCM_8 0x0300C0A8 -# define TLS1_CK_PSK_WITH_AES_256_CCM_8 0x0300C0A9 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM_8 0x0300C0AA -# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM_8 0x0300C0AB - -/* CCM ciphersuites from RFC7251 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM 0x0300C0AC -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM 0x0300C0AD -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM_8 0x0300C0AE -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM_8 0x0300C0AF - -/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BA -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BB -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BC -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BD -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BE -# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256 0x030000BF - -# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C0 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C1 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C2 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C3 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4 -# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5 - -/* ECC ciphersuites from RFC4492 */ -# define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 -# define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 -# define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 - -# define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 -# define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 -# define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A - -# define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B -# define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C -# define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D -# define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E -# define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F - -# define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 -# define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 -# define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 - -# define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 -# define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 -# define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 -# define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 -# define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 - -/* SRP ciphersuites from RFC 5054 */ -# define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A -# define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B -# define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C -# define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D -# define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E -# define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F -# define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 -# define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 -# define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 - -/* ECDH HMAC based ciphersuites from RFC5289 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 -# define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 -# define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A - -/* ECDH GCM based ciphersuites from RFC5289 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 -# define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 -# define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 - -/* ECDHE PSK ciphersuites from RFC5489 */ -# define TLS1_CK_ECDHE_PSK_WITH_RC4_128_SHA 0x0300C033 -# define TLS1_CK_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300C034 -# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035 -# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036 - -# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0x0300C037 -# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0x0300C038 - -/* NULL PSK ciphersuites from RFC4785 */ -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA 0x0300C039 -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA256 0x0300C03A -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA384 0x0300C03B - -/* Camellia-CBC ciphersuites from RFC6367 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C072 -# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C073 -# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C074 -# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C075 -# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C076 -# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C077 -# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C078 -# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C079 - -# define TLS1_CK_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C094 -# define TLS1_CK_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C095 -# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C096 -# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C097 -# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C098 -# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C099 -# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C09A -# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C09B - -/* draft-ietf-tls-chacha20-poly1305-03 */ -# define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCA8 -# define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0x0300CCA9 -# define TLS1_CK_DHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCAA -# define TLS1_CK_PSK_WITH_CHACHA20_POLY1305 0x0300CCAB -# define TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAC -# define TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAD -# define TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305 0x0300CCAE - -/* TLS v1.3 ciphersuites */ -# define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301 -# define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302 -# define TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x03001303 -# define TLS1_3_CK_AES_128_CCM_SHA256 0x03001304 -# define TLS1_3_CK_AES_128_CCM_8_SHA256 0x03001305 - -/* Aria ciphersuites from RFC6209 */ -# define TLS1_CK_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C050 -# define TLS1_CK_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C051 -# define TLS1_CK_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C052 -# define TLS1_CK_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C053 -# define TLS1_CK_DH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C054 -# define TLS1_CK_DH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C055 -# define TLS1_CK_DHE_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C056 -# define TLS1_CK_DHE_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C057 -# define TLS1_CK_DH_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C058 -# define TLS1_CK_DH_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C059 -# define TLS1_CK_DH_anon_WITH_ARIA_128_GCM_SHA256 0x0300C05A -# define TLS1_CK_DH_anon_WITH_ARIA_256_GCM_SHA384 0x0300C05B -# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05C -# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05D -# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05E -# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05F -# define TLS1_CK_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C060 -# define TLS1_CK_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C061 -# define TLS1_CK_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C062 -# define TLS1_CK_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C063 -# define TLS1_CK_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06A -# define TLS1_CK_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06B -# define TLS1_CK_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06C -# define TLS1_CK_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06D -# define TLS1_CK_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06E -# define TLS1_CK_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06F - -/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ -# define TLS1_RFC_RSA_WITH_AES_128_SHA "TLS_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ADH_WITH_AES_128_SHA "TLS_DH_anon_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_RSA_WITH_AES_256_SHA "TLS_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ADH_WITH_AES_256_SHA "TLS_DH_anon_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_RSA_WITH_NULL_SHA256 "TLS_RSA_WITH_NULL_SHA256" -# define TLS1_RFC_RSA_WITH_AES_128_SHA256 "TLS_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_AES_256_SHA256 "TLS_RSA_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA256 "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA256 "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA256 "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA256 "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_AES_128_SHA256 "TLS_DH_anon_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_AES_256_SHA256 "TLS_DH_anon_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_AES_128_GCM_SHA256 "TLS_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_RSA_WITH_AES_256_GCM_SHA384 "TLS_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_GCM_SHA256 "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_GCM_SHA384 "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_ADH_WITH_AES_128_GCM_SHA256 "TLS_DH_anon_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ADH_WITH_AES_256_GCM_SHA384 "TLS_DH_anon_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_RSA_WITH_AES_128_CCM "TLS_RSA_WITH_AES_128_CCM" -# define TLS1_RFC_RSA_WITH_AES_256_CCM "TLS_RSA_WITH_AES_256_CCM" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM "TLS_DHE_RSA_WITH_AES_128_CCM" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM "TLS_DHE_RSA_WITH_AES_256_CCM" -# define TLS1_RFC_RSA_WITH_AES_128_CCM_8 "TLS_RSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_RSA_WITH_AES_256_CCM_8 "TLS_RSA_WITH_AES_256_CCM_8" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM_8 "TLS_DHE_RSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM_8 "TLS_DHE_RSA_WITH_AES_256_CCM_8" -# define TLS1_RFC_PSK_WITH_AES_128_CCM "TLS_PSK_WITH_AES_128_CCM" -# define TLS1_RFC_PSK_WITH_AES_256_CCM "TLS_PSK_WITH_AES_256_CCM" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM "TLS_DHE_PSK_WITH_AES_128_CCM" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM "TLS_DHE_PSK_WITH_AES_256_CCM" -# define TLS1_RFC_PSK_WITH_AES_128_CCM_8 "TLS_PSK_WITH_AES_128_CCM_8" -# define TLS1_RFC_PSK_WITH_AES_256_CCM_8 "TLS_PSK_WITH_AES_256_CCM_8" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM_8 "TLS_PSK_DHE_WITH_AES_128_CCM_8" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM_8 "TLS_PSK_DHE_WITH_AES_256_CCM_8" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM "TLS_ECDHE_ECDSA_WITH_AES_128_CCM" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM "TLS_ECDHE_ECDSA_WITH_AES_256_CCM" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8" -# define TLS1_3_RFC_AES_128_GCM_SHA256 "TLS_AES_128_GCM_SHA256" -# define TLS1_3_RFC_AES_256_GCM_SHA384 "TLS_AES_256_GCM_SHA384" -# define TLS1_3_RFC_CHACHA20_POLY1305_SHA256 "TLS_CHACHA20_POLY1305_SHA256" -# define TLS1_3_RFC_AES_128_CCM_SHA256 "TLS_AES_128_CCM_SHA256" -# define TLS1_3_RFC_AES_128_CCM_8_SHA256 "TLS_AES_128_CCM_8_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_NULL_SHA "TLS_ECDHE_ECDSA_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_NULL_SHA "TLS_ECDHE_RSA_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_NULL_SHA "TLS_ECDH_anon_WITH_NULL_SHA" -# define TLS1_RFC_ECDH_anon_WITH_DES_192_CBC3_SHA "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_AES_128_CBC_SHA "TLS_ECDH_anon_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_AES_256_CBC_SHA "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_NULL_SHA "TLS_PSK_WITH_NULL_SHA" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA "TLS_DHE_PSK_WITH_NULL_SHA" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA "TLS_RSA_PSK_WITH_NULL_SHA" -# define TLS1_RFC_PSK_WITH_3DES_EDE_CBC_SHA "TLS_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA "TLS_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA "TLS_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA "TLS_DHE_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA "TLS_DHE_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_3DES_EDE_CBC_SHA "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA "TLS_RSA_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA "TLS_RSA_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_128_GCM_SHA256 "TLS_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_PSK_WITH_AES_256_GCM_SHA384 "TLS_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_GCM_SHA256 "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_GCM_SHA384 "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_GCM_SHA256 "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_GCM_SHA384 "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA256 "TLS_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA384 "TLS_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_PSK_WITH_NULL_SHA256 "TLS_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_PSK_WITH_NULL_SHA384 "TLS_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA256 "TLS_DHE_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA384 "TLS_DHE_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA256 "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA384 "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA256 "TLS_RSA_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA384 "TLS_RSA_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA "TLS_ECDHE_PSK_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA256 "TLS_ECDHE_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA384 "TLS_ECDHE_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_SRP_SHA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CHACHA20_POLY1305 "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_PSK_WITH_CHACHA20_POLY1305 "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_CHACHA20_POLY1305 "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_CHACHA20_POLY1305 "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_CHACHA20_POLY1305 "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_RSA_WITH_SEED_SHA "TLS_RSA_WITH_SEED_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_SEED_SHA "TLS_DHE_DSS_WITH_SEED_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_SEED_SHA "TLS_DHE_RSA_WITH_SEED_CBC_SHA" -# define TLS1_RFC_ADH_WITH_SEED_SHA "TLS_DH_anon_WITH_SEED_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_RC4_128_SHA "TLS_ECDHE_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDH_anon_WITH_RC4_128_SHA "TLS_ECDH_anon_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_RC4_128_SHA "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_RC4_128_SHA "TLS_ECDHE_RSA_WITH_RC4_128_SHA" -# define TLS1_RFC_PSK_WITH_RC4_128_SHA "TLS_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_RSA_PSK_WITH_RC4_128_SHA "TLS_RSA_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_DHE_PSK_WITH_RC4_128_SHA "TLS_DHE_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_anon_WITH_ARIA_128_GCM_SHA256 "TLS_DH_anon_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_anon_WITH_ARIA_256_GCM_SHA384 "TLS_DH_anon_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_PSK_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384" - - -/* - * XXX Backward compatibility alert: Older versions of OpenSSL gave some DHE - * ciphers names with "EDH" instead of "DHE". Going forward, we should be - * using DHE everywhere, though we may indefinitely maintain aliases for - * users or configurations that used "EDH" - */ -# define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" - -# define TLS1_TXT_PSK_WITH_NULL_SHA "PSK-NULL-SHA" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA "DHE-PSK-NULL-SHA" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA "RSA-PSK-NULL-SHA" - -/* AES ciphersuites from RFC3268 */ -# define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" -# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" -# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" -# define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" - -# define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" -# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" -# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" -# define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" - -/* ECC ciphersuites from RFC4492 */ -# define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" - -# define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" - -# define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" - -# define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" - -# define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" -# define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" -# define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" -# define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" - -/* PSK ciphersuites from RFC 4279 */ -# define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" -# define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" -# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" - -# define TLS1_TXT_DHE_PSK_WITH_RC4_128_SHA "DHE-PSK-RC4-SHA" -# define TLS1_TXT_DHE_PSK_WITH_3DES_EDE_CBC_SHA "DHE-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA "DHE-PSK-AES128-CBC-SHA" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA "DHE-PSK-AES256-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_RC4_128_SHA "RSA-PSK-RC4-SHA" -# define TLS1_TXT_RSA_PSK_WITH_3DES_EDE_CBC_SHA "RSA-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA "RSA-PSK-AES128-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA "RSA-PSK-AES256-CBC-SHA" - -/* PSK ciphersuites from RFC 5487 */ -# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_GCM_SHA256 "DHE-PSK-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_GCM_SHA384 "DHE-PSK-AES256-GCM-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_AES_128_GCM_SHA256 "RSA-PSK-AES128-GCM-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_GCM_SHA384 "RSA-PSK-AES256-GCM-SHA384" - -# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA256 "PSK-AES128-CBC-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA384 "PSK-AES256-CBC-SHA384" -# define TLS1_TXT_PSK_WITH_NULL_SHA256 "PSK-NULL-SHA256" -# define TLS1_TXT_PSK_WITH_NULL_SHA384 "PSK-NULL-SHA384" - -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA256 "DHE-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA384 "DHE-PSK-AES256-CBC-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA256 "DHE-PSK-NULL-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA384 "DHE-PSK-NULL-SHA384" - -# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA256 "RSA-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA384 "RSA-PSK-AES256-CBC-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA256 "RSA-PSK-NULL-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA384 "RSA-PSK-NULL-SHA384" - -/* SRP ciphersuite from RFC 5054 */ -# define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" -# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" - -# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" -# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" - -/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ -# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256 "CAMELLIA128-SHA256" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DH-DSS-CAMELLIA128-SHA256" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DH-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DHE-DSS-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DHE-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256 "ADH-CAMELLIA128-SHA256" - -# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256 "CAMELLIA256-SHA256" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DH-DSS-CAMELLIA256-SHA256" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DH-RSA-CAMELLIA256-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DHE-DSS-CAMELLIA256-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DHE-RSA-CAMELLIA256-SHA256" -# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256 "ADH-CAMELLIA256-SHA256" - -# define TLS1_TXT_PSK_WITH_CAMELLIA_128_CBC_SHA256 "PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_PSK_WITH_CAMELLIA_256_CBC_SHA384 "PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "DHE-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "DHE-PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "RSA-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "RSA-PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-PSK-CAMELLIA256-SHA384" - -/* SEED ciphersuites from RFC4162 */ -# define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" -# define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" -# define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" -# define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" -# define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" -# define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" - -/* TLS v1.2 ciphersuites */ -# define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" -# define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" -# define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" -# define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" -# define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" - -/* TLS v1.2 GCM ciphersuites from RFC5288 */ -# define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" -# define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" -# define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" -# define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" -# define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" - -/* CCM ciphersuites from RFC6655 */ -# define TLS1_TXT_RSA_WITH_AES_128_CCM "AES128-CCM" -# define TLS1_TXT_RSA_WITH_AES_256_CCM "AES256-CCM" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM "DHE-RSA-AES128-CCM" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM "DHE-RSA-AES256-CCM" - -# define TLS1_TXT_RSA_WITH_AES_128_CCM_8 "AES128-CCM8" -# define TLS1_TXT_RSA_WITH_AES_256_CCM_8 "AES256-CCM8" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM_8 "DHE-RSA-AES128-CCM8" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM_8 "DHE-RSA-AES256-CCM8" - -# define TLS1_TXT_PSK_WITH_AES_128_CCM "PSK-AES128-CCM" -# define TLS1_TXT_PSK_WITH_AES_256_CCM "PSK-AES256-CCM" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM "DHE-PSK-AES128-CCM" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM "DHE-PSK-AES256-CCM" - -# define TLS1_TXT_PSK_WITH_AES_128_CCM_8 "PSK-AES128-CCM8" -# define TLS1_TXT_PSK_WITH_AES_256_CCM_8 "PSK-AES256-CCM8" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM_8 "DHE-PSK-AES128-CCM8" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM_8 "DHE-PSK-AES256-CCM8" - -/* CCM ciphersuites from RFC7251 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM "ECDHE-ECDSA-AES128-CCM" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM "ECDHE-ECDSA-AES256-CCM" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM_8 "ECDHE-ECDSA-AES128-CCM8" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8 "ECDHE-ECDSA-AES256-CCM8" - -/* ECDH HMAC based ciphersuites from RFC5289 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" - -/* ECDH GCM based ciphersuites from RFC5289 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" - -/* TLS v1.2 PSK GCM ciphersuites from RFC5487 */ -# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" - -/* ECDHE PSK ciphersuites from RFC 5489 */ -# define TLS1_TXT_ECDHE_PSK_WITH_RC4_128_SHA "ECDHE-PSK-RC4-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "ECDHE-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA "ECDHE-PSK-AES256-CBC-SHA" - -# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "ECDHE-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "ECDHE-PSK-AES256-CBC-SHA384" - -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA "ECDHE-PSK-NULL-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA256 "ECDHE-PSK-NULL-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA384 "ECDHE-PSK-NULL-SHA384" - -/* Camellia-CBC ciphersuites from RFC6367 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-ECDSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-ECDSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-ECDSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-ECDSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-RSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-RSA-CAMELLIA256-SHA384" - -/* draft-ietf-tls-chacha20-poly1305-03 */ -# define TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305 "ECDHE-RSA-CHACHA20-POLY1305" -# define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305" -# define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" -# define TLS1_TXT_PSK_WITH_CHACHA20_POLY1305 "PSK-CHACHA20-POLY1305" -# define TLS1_TXT_ECDHE_PSK_WITH_CHACHA20_POLY1305 "ECDHE-PSK-CHACHA20-POLY1305" -# define TLS1_TXT_DHE_PSK_WITH_CHACHA20_POLY1305 "DHE-PSK-CHACHA20-POLY1305" -# define TLS1_TXT_RSA_PSK_WITH_CHACHA20_POLY1305 "RSA-PSK-CHACHA20-POLY1305" - -/* Aria ciphersuites from RFC6209 */ -# define TLS1_TXT_RSA_WITH_ARIA_128_GCM_SHA256 "ARIA128-GCM-SHA256" -# define TLS1_TXT_RSA_WITH_ARIA_256_GCM_SHA384 "ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "DHE-RSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "DHE-RSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_RSA_WITH_ARIA_128_GCM_SHA256 "DH-RSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_RSA_WITH_ARIA_256_GCM_SHA384 "DH-RSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "DHE-DSS-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "DHE-DSS-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_DSS_WITH_ARIA_128_GCM_SHA256 "DH-DSS-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_DSS_WITH_ARIA_256_GCM_SHA384 "DH-DSS-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_anon_WITH_ARIA_128_GCM_SHA256 "ADH-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_anon_WITH_ARIA_256_GCM_SHA384 "ADH-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ECDSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ECDSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ECDSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ECDSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ARIA256-GCM-SHA384" -# define TLS1_TXT_PSK_WITH_ARIA_128_GCM_SHA256 "PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_ARIA_256_GCM_SHA384 "PSK-ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "DHE-PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "DHE-PSK-ARIA256-GCM-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "RSA-PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "RSA-PSK-ARIA256-GCM-SHA384" - -# define TLS_CT_RSA_SIGN 1 -# define TLS_CT_DSS_SIGN 2 -# define TLS_CT_RSA_FIXED_DH 3 -# define TLS_CT_DSS_FIXED_DH 4 -# define TLS_CT_ECDSA_SIGN 64 -# define TLS_CT_RSA_FIXED_ECDH 65 -# define TLS_CT_ECDSA_FIXED_ECDH 66 -# define TLS_CT_GOST01_SIGN 22 -# define TLS_CT_GOST12_SIGN 238 -# define TLS_CT_GOST12_512_SIGN 239 - -/* - * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see - * comment there) - */ -# define TLS_CT_NUMBER 10 - -# if defined(SSL3_CT_NUMBER) -# if TLS_CT_NUMBER != SSL3_CT_NUMBER -# error "SSL/TLS CT_NUMBER values do not match" -# endif -# endif - -# define TLS1_FINISH_MAC_LENGTH 12 - -# define TLS_MD_MAX_CONST_SIZE 22 -# define TLS_MD_CLIENT_FINISH_CONST "client finished" -# define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 -# define TLS_MD_SERVER_FINISH_CONST "server finished" -# define TLS_MD_SERVER_FINISH_CONST_SIZE 15 -# define TLS_MD_KEY_EXPANSION_CONST "key expansion" -# define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 -# define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" -# define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 -# define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" -# define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 -# define TLS_MD_IV_BLOCK_CONST "IV block" -# define TLS_MD_IV_BLOCK_CONST_SIZE 8 -# define TLS_MD_MASTER_SECRET_CONST "master secret" -# define TLS_MD_MASTER_SECRET_CONST_SIZE 13 -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "extended master secret" -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE 22 - -# ifdef CHARSET_EBCDIC -# undef TLS_MD_CLIENT_FINISH_CONST -/* - * client finished - */ -# define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" - -# undef TLS_MD_SERVER_FINISH_CONST -/* - * server finished - */ -# define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" - -# undef TLS_MD_SERVER_WRITE_KEY_CONST -/* - * server write key - */ -# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_KEY_EXPANSION_CONST -/* - * key expansion - */ -# define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" - -# undef TLS_MD_CLIENT_WRITE_KEY_CONST -/* - * client write key - */ -# define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_SERVER_WRITE_KEY_CONST -/* - * server write key - */ -# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_IV_BLOCK_CONST -/* - * IV block - */ -# define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" - -# undef TLS_MD_MASTER_SECRET_CONST -/* - * master secret - */ -# define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" -# undef TLS_MD_EXTENDED_MASTER_SECRET_CONST -/* - * extended master secret - */ -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" -# endif - -/* TLS Session Ticket extension struct */ -struct tls_session_ticket_ext_st { - unsigned short length; - void *data; -}; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ts.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ts.h deleted file mode 100644 index 3b58aa52..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ts.h +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Copyright 2006-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_TS_H -# define HEADER_TS_H - -# include - -# ifndef OPENSSL_NO_TS -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# include -# include - -typedef struct TS_msg_imprint_st TS_MSG_IMPRINT; -typedef struct TS_req_st TS_REQ; -typedef struct TS_accuracy_st TS_ACCURACY; -typedef struct TS_tst_info_st TS_TST_INFO; - -/* Possible values for status. */ -# define TS_STATUS_GRANTED 0 -# define TS_STATUS_GRANTED_WITH_MODS 1 -# define TS_STATUS_REJECTION 2 -# define TS_STATUS_WAITING 3 -# define TS_STATUS_REVOCATION_WARNING 4 -# define TS_STATUS_REVOCATION_NOTIFICATION 5 - -/* Possible values for failure_info. */ -# define TS_INFO_BAD_ALG 0 -# define TS_INFO_BAD_REQUEST 2 -# define TS_INFO_BAD_DATA_FORMAT 5 -# define TS_INFO_TIME_NOT_AVAILABLE 14 -# define TS_INFO_UNACCEPTED_POLICY 15 -# define TS_INFO_UNACCEPTED_EXTENSION 16 -# define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 -# define TS_INFO_SYSTEM_FAILURE 25 - - -typedef struct TS_status_info_st TS_STATUS_INFO; -typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL; -typedef struct ESS_cert_id ESS_CERT_ID; -typedef struct ESS_signing_cert ESS_SIGNING_CERT; - -DEFINE_STACK_OF(ESS_CERT_ID) - -typedef struct ESS_cert_id_v2_st ESS_CERT_ID_V2; -typedef struct ESS_signing_cert_v2_st ESS_SIGNING_CERT_V2; - -DEFINE_STACK_OF(ESS_CERT_ID_V2) - -typedef struct TS_resp_st TS_RESP; - -TS_REQ *TS_REQ_new(void); -void TS_REQ_free(TS_REQ *a); -int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); -TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); - -TS_REQ *TS_REQ_dup(TS_REQ *a); - -#ifndef OPENSSL_NO_STDIO -TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); -int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); -#endif -TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); -int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); - -TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); -void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); -int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, - const unsigned char **pp, long length); - -TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); - -#ifndef OPENSSL_NO_STDIO -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); -int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); -#endif -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a); -int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a); - -TS_RESP *TS_RESP_new(void); -void TS_RESP_free(TS_RESP *a); -int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); -TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); -TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); -TS_RESP *TS_RESP_dup(TS_RESP *a); - -#ifndef OPENSSL_NO_STDIO -TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); -int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); -#endif -TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a); -int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a); - -TS_STATUS_INFO *TS_STATUS_INFO_new(void); -void TS_STATUS_INFO_free(TS_STATUS_INFO *a); -int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); -TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, - const unsigned char **pp, long length); -TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); - -TS_TST_INFO *TS_TST_INFO_new(void); -void TS_TST_INFO_free(TS_TST_INFO *a); -int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); -TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, - long length); -TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); - -#ifndef OPENSSL_NO_STDIO -TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); -int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); -#endif -TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a); -int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a); - -TS_ACCURACY *TS_ACCURACY_new(void); -void TS_ACCURACY_free(TS_ACCURACY *a); -int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); -TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, - long length); -TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); - -ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); -void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); -int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp); -ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, - const unsigned char **pp, - long length); -ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); - -ESS_CERT_ID *ESS_CERT_ID_new(void); -void ESS_CERT_ID_free(ESS_CERT_ID *a); -int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); -ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, - long length); -ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); - -ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); -void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); -int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp); -ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, - const unsigned char **pp, long length); -ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); - -ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new(void); -void ESS_CERT_ID_V2_free(ESS_CERT_ID_V2 *a); -int i2d_ESS_CERT_ID_V2(const ESS_CERT_ID_V2 *a, unsigned char **pp); -ESS_CERT_ID_V2 *d2i_ESS_CERT_ID_V2(ESS_CERT_ID_V2 **a, - const unsigned char **pp, long length); -ESS_CERT_ID_V2 *ESS_CERT_ID_V2_dup(ESS_CERT_ID_V2 *a); - -ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new(void); -void ESS_SIGNING_CERT_V2_free(ESS_SIGNING_CERT_V2 *a); -int i2d_ESS_SIGNING_CERT_V2(const ESS_SIGNING_CERT_V2 *a, unsigned char **pp); -ESS_SIGNING_CERT_V2 *d2i_ESS_SIGNING_CERT_V2(ESS_SIGNING_CERT_V2 **a, - const unsigned char **pp, - long length); -ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_dup(ESS_SIGNING_CERT_V2 *a); - -int TS_REQ_set_version(TS_REQ *a, long version); -long TS_REQ_get_version(const TS_REQ *a); - -int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i); -const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a); - -const STACK_OF(ASN1_UTF8STRING) * -TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a); - -const ASN1_BIT_STRING * -TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a); - -int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); -TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); - -int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); -X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); - -int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); -ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); - -int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy); -ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); - -int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); -const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); - -int TS_REQ_set_cert_req(TS_REQ *a, int cert_req); -int TS_REQ_get_cert_req(const TS_REQ *a); - -STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); -void TS_REQ_ext_free(TS_REQ *a); -int TS_REQ_get_ext_count(TS_REQ *a); -int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); -int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos); -int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); -X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); -X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); -int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); -void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); - -/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ - -int TS_REQ_print_bio(BIO *bio, TS_REQ *a); - -/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ - -int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); -TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); - -/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ -void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); -PKCS7 *TS_RESP_get_token(TS_RESP *a); -TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); - -int TS_TST_INFO_set_version(TS_TST_INFO *a, long version); -long TS_TST_INFO_get_version(const TS_TST_INFO *a); - -int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); -ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); - -int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); -TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); - -int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); -const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); - -int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); -const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); - -int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); -TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); - -int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); -const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); - -int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); -const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); - -int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); -const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); - -int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); -int TS_TST_INFO_get_ordering(const TS_TST_INFO *a); - -int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); -const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); - -int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); -GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); - -STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); -void TS_TST_INFO_ext_free(TS_TST_INFO *a); -int TS_TST_INFO_get_ext_count(TS_TST_INFO *a); -int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); -int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, - int lastpos); -int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); -X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); -X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); -int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); -void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); - -/* - * Declarations related to response generation, defined in ts/ts_resp_sign.c. - */ - -/* Optional flags for response generation. */ - -/* Don't include the TSA name in response. */ -# define TS_TSA_NAME 0x01 - -/* Set ordering to true in response. */ -# define TS_ORDERING 0x02 - -/* - * Include the signer certificate and the other specified certificates in - * the ESS signing certificate attribute beside the PKCS7 signed data. - * Only the signer certificates is included by default. - */ -# define TS_ESS_CERT_ID_CHAIN 0x04 - -/* Forward declaration. */ -struct TS_resp_ctx; - -/* This must return a unique number less than 160 bits long. */ -typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *); - -/* - * This must return the seconds and microseconds since Jan 1, 1970 in the sec - * and usec variables allocated by the caller. Return non-zero for success - * and zero for failure. - */ -typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec, - long *usec); - -/* - * This must process the given extension. It can modify the TS_TST_INFO - * object of the context. Return values: !0 (processed), 0 (error, it must - * set the status info/failure info of the response). - */ -typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *, - void *); - -typedef struct TS_resp_ctx TS_RESP_CTX; - -DEFINE_STACK_OF_CONST(EVP_MD) - -/* Creates a response context that can be used for generating responses. */ -TS_RESP_CTX *TS_RESP_CTX_new(void); -void TS_RESP_CTX_free(TS_RESP_CTX *ctx); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); - -int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx, - const EVP_MD *signer_digest); -int TS_RESP_CTX_set_ess_cert_id_digest(TS_RESP_CTX *ctx, const EVP_MD *md); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy); - -/* No additional certs are included in the response by default. */ -int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); - -/* - * Adds a new acceptable policy, only the default policy is accepted by - * default. - */ -int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy); - -/* - * Adds a new acceptable message digest. Note that no message digests are - * accepted by default. The md argument is shared with the caller. - */ -int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); - -/* Accuracy is not included by default. */ -int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, - int secs, int millis, int micros); - -/* - * Clock precision digits, i.e. the number of decimal digits: '0' means sec, - * '3' msec, '6' usec, and so on. Default is 0. - */ -int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, - unsigned clock_precision_digits); -/* At most we accept usec precision. */ -# define TS_MAX_CLOCK_PRECISION_DIGITS 6 - -/* Maximum status message length */ -# define TS_MAX_STATUS_LENGTH (1024 * 1024) - -/* No flags are set by default. */ -void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); - -/* Default callback always returns a constant. */ -void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); - -/* Default callback uses the gettimeofday() and gmtime() system calls. */ -void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); - -/* - * Default callback rejects all extensions. The extension callback is called - * when the TS_TST_INFO object is already set up and not signed yet. - */ -/* FIXME: extension handling is not tested yet. */ -void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, - TS_extension_cb cb, void *data); - -/* The following methods can be used in the callbacks. */ -int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, - int status, const char *text); - -/* Sets the status info only if it is still TS_STATUS_GRANTED. */ -int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, - int status, const char *text); - -int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); - -/* The get methods below can be used in the extension callback. */ -TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); - -TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); - -/* - * Creates the signed TS_TST_INFO and puts it in TS_RESP. - * In case of errors it sets the status info properly. - * Returns NULL only in case of memory allocation/fatal error. - */ -TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); - -/* - * Declarations related to response verification, - * they are defined in ts/ts_resp_verify.c. - */ - -int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, - X509_STORE *store, X509 **signer_out); - -/* Context structure for the generic verify method. */ - -/* Verify the signer's certificate and the signature of the response. */ -# define TS_VFY_SIGNATURE (1u << 0) -/* Verify the version number of the response. */ -# define TS_VFY_VERSION (1u << 1) -/* Verify if the policy supplied by the user matches the policy of the TSA. */ -# define TS_VFY_POLICY (1u << 2) -/* - * Verify the message imprint provided by the user. This flag should not be - * specified with TS_VFY_DATA. - */ -# define TS_VFY_IMPRINT (1u << 3) -/* - * Verify the message imprint computed by the verify method from the user - * provided data and the MD algorithm of the response. This flag should not - * be specified with TS_VFY_IMPRINT. - */ -# define TS_VFY_DATA (1u << 4) -/* Verify the nonce value. */ -# define TS_VFY_NONCE (1u << 5) -/* Verify if the TSA name field matches the signer certificate. */ -# define TS_VFY_SIGNER (1u << 6) -/* Verify if the TSA name field equals to the user provided name. */ -# define TS_VFY_TSA_NAME (1u << 7) - -/* You can use the following convenience constants. */ -# define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ - | TS_VFY_VERSION \ - | TS_VFY_POLICY \ - | TS_VFY_IMPRINT \ - | TS_VFY_NONCE \ - | TS_VFY_SIGNER \ - | TS_VFY_TSA_NAME) -# define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ - | TS_VFY_VERSION \ - | TS_VFY_POLICY \ - | TS_VFY_DATA \ - | TS_VFY_NONCE \ - | TS_VFY_SIGNER \ - | TS_VFY_TSA_NAME) - -typedef struct TS_verify_ctx TS_VERIFY_CTX; - -int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); -int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); - -/* - * Declarations related to response verification context, - */ -TS_VERIFY_CTX *TS_VERIFY_CTX_new(void); -void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); -void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); -void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); -int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f); -int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f); -BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b); -unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, - unsigned char *hexstr, long len); -X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s); -STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs); - -/*- - * If ctx is NULL, it allocates and returns a new object, otherwise - * it returns ctx. It initialises all the members as follows: - * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) - * certs = NULL - * store = NULL - * policy = policy from the request or NULL if absent (in this case - * TS_VFY_POLICY is cleared from flags as well) - * md_alg = MD algorithm from request - * imprint, imprint_len = imprint from request - * data = NULL - * nonce, nonce_len = nonce from the request or NULL if absent (in this case - * TS_VFY_NONCE is cleared from flags as well) - * tsa_name = NULL - * Important: after calling this method TS_VFY_SIGNATURE should be added! - */ -TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); - -/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ - -int TS_RESP_print_bio(BIO *bio, TS_RESP *a); -int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); -int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); - -/* Common utility functions defined in ts/ts_lib.c */ - -int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); -int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); -int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); -int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); -int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); - -/* - * Function declarations for handling configuration options, defined in - * ts/ts_conf.c - */ - -X509 *TS_CONF_load_cert(const char *file); -STACK_OF(X509) *TS_CONF_load_certs(const char *file); -EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); -const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); -int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, - TS_RESP_CTX *ctx); -#ifndef OPENSSL_NO_ENGINE -int TS_CONF_set_crypto_device(CONF *conf, const char *section, - const char *device); -int TS_CONF_set_default_engine(const char *name); -#endif -int TS_CONF_set_signer_cert(CONF *conf, const char *section, - const char *cert, TS_RESP_CTX *ctx); -int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, - TS_RESP_CTX *ctx); -int TS_CONF_set_signer_key(CONF *conf, const char *section, - const char *key, const char *pass, - TS_RESP_CTX *ctx); -int TS_CONF_set_signer_digest(CONF *conf, const char *section, - const char *md, TS_RESP_CTX *ctx); -int TS_CONF_set_def_policy(CONF *conf, const char *section, - const char *policy, TS_RESP_CTX *ctx); -int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, - TS_RESP_CTX *ctx); -int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, - TS_RESP_CTX *ctx); -int TS_CONF_set_ess_cert_id_digest(CONF *conf, const char *section, - TS_RESP_CTX *ctx); - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/tserr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/tserr.h deleted file mode 100644 index 07f23339..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/tserr.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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_TSERR_H -# define HEADER_TSERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# include - -# ifndef OPENSSL_NO_TS - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_TS_strings(void); - -/* - * TS function codes. - */ -# define TS_F_DEF_SERIAL_CB 110 -# define TS_F_DEF_TIME_CB 111 -# define TS_F_ESS_ADD_SIGNING_CERT 112 -# define TS_F_ESS_ADD_SIGNING_CERT_V2 147 -# define TS_F_ESS_CERT_ID_NEW_INIT 113 -# define TS_F_ESS_CERT_ID_V2_NEW_INIT 156 -# define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 -# define TS_F_ESS_SIGNING_CERT_V2_NEW_INIT 157 -# define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 -# define TS_F_PKCS7_TO_TS_TST_INFO 148 -# define TS_F_TS_ACCURACY_SET_MICROS 115 -# define TS_F_TS_ACCURACY_SET_MILLIS 116 -# define TS_F_TS_ACCURACY_SET_SECONDS 117 -# define TS_F_TS_CHECK_IMPRINTS 100 -# define TS_F_TS_CHECK_NONCES 101 -# define TS_F_TS_CHECK_POLICY 102 -# define TS_F_TS_CHECK_SIGNING_CERTS 103 -# define TS_F_TS_CHECK_STATUS_INFO 104 -# define TS_F_TS_COMPUTE_IMPRINT 145 -# define TS_F_TS_CONF_INVALID 151 -# define TS_F_TS_CONF_LOAD_CERT 153 -# define TS_F_TS_CONF_LOAD_CERTS 154 -# define TS_F_TS_CONF_LOAD_KEY 155 -# define TS_F_TS_CONF_LOOKUP_FAIL 152 -# define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 -# define TS_F_TS_GET_STATUS_TEXT 105 -# define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 -# define TS_F_TS_REQ_SET_MSG_IMPRINT 119 -# define TS_F_TS_REQ_SET_NONCE 120 -# define TS_F_TS_REQ_SET_POLICY_ID 121 -# define TS_F_TS_RESP_CREATE_RESPONSE 122 -# define TS_F_TS_RESP_CREATE_TST_INFO 123 -# define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 -# define TS_F_TS_RESP_CTX_ADD_MD 125 -# define TS_F_TS_RESP_CTX_ADD_POLICY 126 -# define TS_F_TS_RESP_CTX_NEW 127 -# define TS_F_TS_RESP_CTX_SET_ACCURACY 128 -# define TS_F_TS_RESP_CTX_SET_CERTS 129 -# define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 -# define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 -# define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 -# define TS_F_TS_RESP_GET_POLICY 133 -# define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 -# define TS_F_TS_RESP_SET_STATUS_INFO 135 -# define TS_F_TS_RESP_SET_TST_INFO 150 -# define TS_F_TS_RESP_SIGN 136 -# define TS_F_TS_RESP_VERIFY_SIGNATURE 106 -# define TS_F_TS_TST_INFO_SET_ACCURACY 137 -# define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 -# define TS_F_TS_TST_INFO_SET_NONCE 139 -# define TS_F_TS_TST_INFO_SET_POLICY_ID 140 -# define TS_F_TS_TST_INFO_SET_SERIAL 141 -# define TS_F_TS_TST_INFO_SET_TIME 142 -# define TS_F_TS_TST_INFO_SET_TSA 143 -# define TS_F_TS_VERIFY 108 -# define TS_F_TS_VERIFY_CERT 109 -# define TS_F_TS_VERIFY_CTX_NEW 144 - -/* - * TS reason codes. - */ -# define TS_R_BAD_PKCS7_TYPE 132 -# define TS_R_BAD_TYPE 133 -# define TS_R_CANNOT_LOAD_CERT 137 -# define TS_R_CANNOT_LOAD_KEY 138 -# define TS_R_CERTIFICATE_VERIFY_ERROR 100 -# define TS_R_COULD_NOT_SET_ENGINE 127 -# define TS_R_COULD_NOT_SET_TIME 115 -# define TS_R_DETACHED_CONTENT 134 -# define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 -# define TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR 139 -# define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 -# define TS_R_INVALID_NULL_POINTER 102 -# define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 -# define TS_R_MESSAGE_IMPRINT_MISMATCH 103 -# define TS_R_NONCE_MISMATCH 104 -# define TS_R_NONCE_NOT_RETURNED 105 -# define TS_R_NO_CONTENT 106 -# define TS_R_NO_TIME_STAMP_TOKEN 107 -# define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 -# define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 -# define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 -# define TS_R_POLICY_MISMATCH 108 -# define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 -# define TS_R_RESPONSE_SETUP_ERROR 121 -# define TS_R_SIGNATURE_FAILURE 109 -# define TS_R_THERE_MUST_BE_ONE_SIGNER 110 -# define TS_R_TIME_SYSCALL_ERROR 122 -# define TS_R_TOKEN_NOT_PRESENT 130 -# define TS_R_TOKEN_PRESENT 131 -# define TS_R_TSA_NAME_MISMATCH 111 -# define TS_R_TSA_UNTRUSTED 112 -# define TS_R_TST_INFO_SETUP_ERROR 123 -# define TS_R_TS_DATASIGN 124 -# define TS_R_UNACCEPTABLE_POLICY 125 -# define TS_R_UNSUPPORTED_MD_ALGORITHM 126 -# define TS_R_UNSUPPORTED_VERSION 113 -# define TS_R_VAR_BAD_VALUE 135 -# define TS_R_VAR_LOOKUP_FAILURE 136 -# define TS_R_WRONG_CONTENT_TYPE 114 - -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/txt_db.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/txt_db.h deleted file mode 100644 index ec981a43..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/txt_db.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 1995-2017 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_TXT_DB_H -# define HEADER_TXT_DB_H - -# include -# include -# include -# include - -# define DB_ERROR_OK 0 -# define DB_ERROR_MALLOC 1 -# define DB_ERROR_INDEX_CLASH 2 -# define DB_ERROR_INDEX_OUT_OF_RANGE 3 -# define DB_ERROR_NO_INDEX 4 -# define DB_ERROR_INSERT_INDEX_CLASH 5 -# define DB_ERROR_WRONG_NUM_FIELDS 6 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef OPENSSL_STRING *OPENSSL_PSTRING; -DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) - -typedef struct txt_db_st { - int num_fields; - STACK_OF(OPENSSL_PSTRING) *data; - LHASH_OF(OPENSSL_STRING) **index; - int (**qual) (OPENSSL_STRING *); - long error; - long arg1; - long arg2; - OPENSSL_STRING *arg_row; -} TXT_DB; - -TXT_DB *TXT_DB_read(BIO *in, int num); -long TXT_DB_write(BIO *out, TXT_DB *db); -int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), - OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); -void TXT_DB_free(TXT_DB *db); -OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, - OPENSSL_STRING *value); -int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ui.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ui.h deleted file mode 100644 index 7c721ec8..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/ui.h +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright 2001-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_UI_H -# define HEADER_UI_H - -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# include -# include -# include - -/* For compatibility reasons, the macro OPENSSL_NO_UI is currently retained */ -# if OPENSSL_API_COMPAT < 0x10200000L -# ifdef OPENSSL_NO_UI_CONSOLE -# define OPENSSL_NO_UI -# endif -# endif - -# ifdef __cplusplus -extern "C" { -# endif - -/* - * All the following functions return -1 or NULL on error and in some cases - * (UI_process()) -2 if interrupted or in some other way cancelled. When - * everything is fine, they return 0, a positive value or a non-NULL pointer, - * all depending on their purpose. - */ - -/* Creators and destructor. */ -UI *UI_new(void); -UI *UI_new_method(const UI_METHOD *method); -void UI_free(UI *ui); - -/*- - The following functions are used to add strings to be printed and prompt - strings to prompt for data. The names are UI_{add,dup}__string - and UI_{add,dup}_input_boolean. - - UI_{add,dup}__string have the following meanings: - add add a text or prompt string. The pointers given to these - functions are used verbatim, no copying is done. - dup make a copy of the text or prompt string, then add the copy - to the collection of strings in the user interface. - - The function is a name for the functionality that the given - string shall be used for. It can be one of: - input use the string as data prompt. - verify use the string as verification prompt. This - is used to verify a previous input. - info use the string for informational output. - error use the string for error output. - Honestly, there's currently no difference between info and error for the - moment. - - UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", - and are typically used when one wants to prompt for a yes/no response. - - All of the functions in this group take a UI and a prompt string. - The string input and verify addition functions also take a flag argument, - a buffer for the result to end up with, a minimum input size and a maximum - input size (the result buffer MUST be large enough to be able to contain - the maximum number of characters). Additionally, the verify addition - functions takes another buffer to compare the result against. - The boolean input functions take an action description string (which should - be safe to ignore if the expected user action is obvious, for example with - a dialog box with an OK button and a Cancel button), a string of acceptable - characters to mean OK and to mean Cancel. The two last strings are checked - to make sure they don't have common characters. Additionally, the same - flag argument as for the string input is taken, as well as a result buffer. - The result buffer is required to be at least one byte long. Depending on - the answer, the first character from the OK or the Cancel character strings - will be stored in the first byte of the result buffer. No NUL will be - added, so the result is *not* a string. - - On success, the all return an index of the added information. That index - is useful when retrieving results with UI_get0_result(). */ -int UI_add_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); -int UI_dup_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); -int UI_add_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, - const char *test_buf); -int UI_dup_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, - const char *test_buf); -int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); -int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); -int UI_add_info_string(UI *ui, const char *text); -int UI_dup_info_string(UI *ui, const char *text); -int UI_add_error_string(UI *ui, const char *text); -int UI_dup_error_string(UI *ui, const char *text); - -/* These are the possible flags. They can be or'ed together. */ -/* Use to have echoing of input */ -# define UI_INPUT_FLAG_ECHO 0x01 -/* - * Use a default password. Where that password is found is completely up to - * the application, it might for example be in the user data set with - * UI_add_user_data(). It is not recommended to have more than one input in - * each UI being marked with this flag, or the application might get - * confused. - */ -# define UI_INPUT_FLAG_DEFAULT_PWD 0x02 - -/*- - * The user of these routines may want to define flags of their own. The core - * UI won't look at those, but will pass them on to the method routines. They - * must use higher bits so they don't get confused with the UI bits above. - * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good - * example of use is this: - * - * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) - * -*/ -# define UI_INPUT_FLAG_USER_BASE 16 - -/*- - * The following function helps construct a prompt. object_desc is a - * textual short description of the object, for example "pass phrase", - * and object_name is the name of the object (might be a card name or - * a file name. - * The returned string shall always be allocated on the heap with - * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). - * - * If the ui_method doesn't contain a pointer to a user-defined prompt - * constructor, a default string is built, looking like this: - * - * "Enter {object_desc} for {object_name}:" - * - * So, if object_desc has the value "pass phrase" and object_name has - * the value "foo.key", the resulting string is: - * - * "Enter pass phrase for foo.key:" -*/ -char *UI_construct_prompt(UI *ui_method, - const char *object_desc, const char *object_name); - -/* - * The following function is used to store a pointer to user-specific data. - * Any previous such pointer will be returned and replaced. - * - * For callback purposes, this function makes a lot more sense than using - * ex_data, since the latter requires that different parts of OpenSSL or - * applications share the same ex_data index. - * - * Note that the UI_OpenSSL() method completely ignores the user data. Other - * methods may not, however. - */ -void *UI_add_user_data(UI *ui, void *user_data); -/* - * Alternatively, this function is used to duplicate the user data. - * This uses the duplicator method function. The destroy function will - * be used to free the user data in this case. - */ -int UI_dup_user_data(UI *ui, void *user_data); -/* We need a user data retrieving function as well. */ -void *UI_get0_user_data(UI *ui); - -/* Return the result associated with a prompt given with the index i. */ -const char *UI_get0_result(UI *ui, int i); -int UI_get_result_length(UI *ui, int i); - -/* When all strings have been added, process the whole thing. */ -int UI_process(UI *ui); - -/* - * Give a user interface parameterised control commands. This can be used to - * send down an integer, a data pointer or a function pointer, as well as be - * used to get information from a UI. - */ -int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void)); - -/* The commands */ -/* - * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the - * OpenSSL error stack before printing any info or added error messages and - * before any prompting. - */ -# define UI_CTRL_PRINT_ERRORS 1 -/* - * Check if a UI_process() is possible to do again with the same instance of - * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 - * if not. - */ -# define UI_CTRL_IS_REDOABLE 2 - -/* Some methods may use extra data */ -# define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) -# define UI_get_app_data(s) UI_get_ex_data(s,0) - -# define UI_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef) -int UI_set_ex_data(UI *r, int idx, void *arg); -void *UI_get_ex_data(UI *r, int idx); - -/* Use specific methods instead of the built-in one */ -void UI_set_default_method(const UI_METHOD *meth); -const UI_METHOD *UI_get_default_method(void); -const UI_METHOD *UI_get_method(UI *ui); -const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); - -# ifndef OPENSSL_NO_UI_CONSOLE - -/* The method with all the built-in thingies */ -UI_METHOD *UI_OpenSSL(void); - -# endif - -/* - * NULL method. Literally does nothing, but may serve as a placeholder - * to avoid internal default. - */ -const UI_METHOD *UI_null(void); - -/* ---------- For method writers ---------- */ -/*- - A method contains a number of functions that implement the low level - of the User Interface. The functions are: - - an opener This function starts a session, maybe by opening - a channel to a tty, or by opening a window. - a writer This function is called to write a given string, - maybe to the tty, maybe as a field label in a - window. - a flusher This function is called to flush everything that - has been output so far. It can be used to actually - display a dialog box after it has been built. - a reader This function is called to read a given prompt, - maybe from the tty, maybe from a field in a - window. Note that it's called with all string - structures, not only the prompt ones, so it must - check such things itself. - a closer This function closes the session, maybe by closing - the channel to the tty, or closing the window. - - All these functions are expected to return: - - 0 on error. - 1 on success. - -1 on out-of-band events, for example if some prompting has - been canceled (by pressing Ctrl-C, for example). This is - only checked when returned by the flusher or the reader. - - The way this is used, the opener is first called, then the writer for all - strings, then the flusher, then the reader for all strings and finally the - closer. Note that if you want to prompt from a terminal or other command - line interface, the best is to have the reader also write the prompts - instead of having the writer do it. If you want to prompt from a dialog - box, the writer can be used to build up the contents of the box, and the - flusher to actually display the box and run the event loop until all data - has been given, after which the reader only grabs the given data and puts - them back into the UI strings. - - All method functions take a UI as argument. Additionally, the writer and - the reader take a UI_STRING. -*/ - -/* - * The UI_STRING type is the data structure that contains all the needed info - * about a string or a prompt, including test data for a verification prompt. - */ -typedef struct ui_string_st UI_STRING; -DEFINE_STACK_OF(UI_STRING) - -/* - * The different types of strings that are currently supported. This is only - * needed by method authors. - */ -enum UI_string_types { - UIT_NONE = 0, - UIT_PROMPT, /* Prompt for a string */ - UIT_VERIFY, /* Prompt for a string and verify */ - UIT_BOOLEAN, /* Prompt for a yes/no response */ - UIT_INFO, /* Send info to the user */ - UIT_ERROR /* Send an error message to the user */ -}; - -/* Create and manipulate methods */ -UI_METHOD *UI_create_method(const char *name); -void UI_destroy_method(UI_METHOD *ui_method); -int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui)); -int UI_method_set_writer(UI_METHOD *method, - int (*writer) (UI *ui, UI_STRING *uis)); -int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui)); -int UI_method_set_reader(UI_METHOD *method, - int (*reader) (UI *ui, UI_STRING *uis)); -int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui)); -int UI_method_set_data_duplicator(UI_METHOD *method, - void *(*duplicator) (UI *ui, void *ui_data), - void (*destructor)(UI *ui, void *ui_data)); -int UI_method_set_prompt_constructor(UI_METHOD *method, - char *(*prompt_constructor) (UI *ui, - const char - *object_desc, - const char - *object_name)); -int UI_method_set_ex_data(UI_METHOD *method, int idx, void *data); -int (*UI_method_get_opener(const UI_METHOD *method)) (UI *); -int (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *); -int (*UI_method_get_flusher(const UI_METHOD *method)) (UI *); -int (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *); -int (*UI_method_get_closer(const UI_METHOD *method)) (UI *); -char *(*UI_method_get_prompt_constructor(const UI_METHOD *method)) - (UI *, const char *, const char *); -void *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *); -void (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *); -const void *UI_method_get_ex_data(const UI_METHOD *method, int idx); - -/* - * The following functions are helpers for method writers to access relevant - * data from a UI_STRING. - */ - -/* Return type of the UI_STRING */ -enum UI_string_types UI_get_string_type(UI_STRING *uis); -/* Return input flags of the UI_STRING */ -int UI_get_input_flags(UI_STRING *uis); -/* Return the actual string to output (the prompt, info or error) */ -const char *UI_get0_output_string(UI_STRING *uis); -/* - * Return the optional action string to output (the boolean prompt - * instruction) - */ -const char *UI_get0_action_string(UI_STRING *uis); -/* Return the result of a prompt */ -const char *UI_get0_result_string(UI_STRING *uis); -int UI_get_result_string_length(UI_STRING *uis); -/* - * Return the string to test the result against. Only useful with verifies. - */ -const char *UI_get0_test_string(UI_STRING *uis); -/* Return the required minimum size of the result */ -int UI_get_result_minsize(UI_STRING *uis); -/* Return the required maximum size of the result */ -int UI_get_result_maxsize(UI_STRING *uis); -/* Set the result of a UI_STRING. */ -int UI_set_result(UI *ui, UI_STRING *uis, const char *result); -int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len); - -/* A couple of popular utility functions */ -int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, - int verify); -int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, - int verify); -UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/uierr.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/uierr.h deleted file mode 100644 index bd68864d..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/uierr.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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_UIERR_H -# define HEADER_UIERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_UI_strings(void); - -/* - * UI function codes. - */ -# define UI_F_CLOSE_CONSOLE 115 -# define UI_F_ECHO_CONSOLE 116 -# define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 -# define UI_F_GENERAL_ALLOCATE_PROMPT 109 -# define UI_F_NOECHO_CONSOLE 117 -# define UI_F_OPEN_CONSOLE 114 -# define UI_F_UI_CONSTRUCT_PROMPT 121 -# define UI_F_UI_CREATE_METHOD 112 -# define UI_F_UI_CTRL 111 -# define UI_F_UI_DUP_ERROR_STRING 101 -# define UI_F_UI_DUP_INFO_STRING 102 -# define UI_F_UI_DUP_INPUT_BOOLEAN 110 -# define UI_F_UI_DUP_INPUT_STRING 103 -# define UI_F_UI_DUP_USER_DATA 118 -# define UI_F_UI_DUP_VERIFY_STRING 106 -# define UI_F_UI_GET0_RESULT 107 -# define UI_F_UI_GET_RESULT_LENGTH 119 -# define UI_F_UI_NEW_METHOD 104 -# define UI_F_UI_PROCESS 113 -# define UI_F_UI_SET_RESULT 105 -# define UI_F_UI_SET_RESULT_EX 120 - -/* - * UI reason codes. - */ -# define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 -# define UI_R_INDEX_TOO_LARGE 102 -# define UI_R_INDEX_TOO_SMALL 103 -# define UI_R_NO_RESULT_BUFFER 105 -# define UI_R_PROCESSING_ERROR 107 -# define UI_R_RESULT_TOO_LARGE 100 -# define UI_R_RESULT_TOO_SMALL 101 -# define UI_R_SYSASSIGN_ERROR 109 -# define UI_R_SYSDASSGN_ERROR 110 -# define UI_R_SYSQIOW_ERROR 111 -# define UI_R_UNKNOWN_CONTROL_COMMAND 106 -# define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 -# define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/whrlpool.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/whrlpool.h deleted file mode 100644 index 20ea3503..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/whrlpool.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-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_WHRLPOOL_H -# define HEADER_WHRLPOOL_H - -#include - -# ifndef OPENSSL_NO_WHIRLPOOL -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define WHIRLPOOL_DIGEST_LENGTH (512/8) -# define WHIRLPOOL_BBLOCK 512 -# define WHIRLPOOL_COUNTER (256/8) - -typedef struct { - union { - unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; - /* double q is here to ensure 64-bit alignment */ - double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; - } H; - unsigned char data[WHIRLPOOL_BBLOCK / 8]; - unsigned int bitoff; - size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; -} WHIRLPOOL_CTX; - -int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); -int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); -void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); -int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); -unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509.h deleted file mode 100644 index 39ca0ba5..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509.h +++ /dev/null @@ -1,1047 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_X509_H -# define HEADER_X509_H - -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# endif - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Flags for X509_get_signature_info() */ -/* Signature info is valid */ -# define X509_SIG_INFO_VALID 0x1 -/* Signature is suitable for TLS use */ -# define X509_SIG_INFO_TLS 0x2 - -# define X509_FILETYPE_PEM 1 -# define X509_FILETYPE_ASN1 2 -# define X509_FILETYPE_DEFAULT 3 - -# define X509v3_KU_DIGITAL_SIGNATURE 0x0080 -# define X509v3_KU_NON_REPUDIATION 0x0040 -# define X509v3_KU_KEY_ENCIPHERMENT 0x0020 -# define X509v3_KU_DATA_ENCIPHERMENT 0x0010 -# define X509v3_KU_KEY_AGREEMENT 0x0008 -# define X509v3_KU_KEY_CERT_SIGN 0x0004 -# define X509v3_KU_CRL_SIGN 0x0002 -# define X509v3_KU_ENCIPHER_ONLY 0x0001 -# define X509v3_KU_DECIPHER_ONLY 0x8000 -# define X509v3_KU_UNDEF 0xffff - -struct X509_algor_st { - ASN1_OBJECT *algorithm; - ASN1_TYPE *parameter; -} /* X509_ALGOR */ ; - -typedef STACK_OF(X509_ALGOR) X509_ALGORS; - -typedef struct X509_val_st { - ASN1_TIME *notBefore; - ASN1_TIME *notAfter; -} X509_VAL; - -typedef struct X509_sig_st X509_SIG; - -typedef struct X509_name_entry_st X509_NAME_ENTRY; - -DEFINE_STACK_OF(X509_NAME_ENTRY) - -DEFINE_STACK_OF(X509_NAME) - -# define X509_EX_V_NETSCAPE_HACK 0x8000 -# define X509_EX_V_INIT 0x0001 -typedef struct X509_extension_st X509_EXTENSION; - -typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; - -DEFINE_STACK_OF(X509_EXTENSION) - -typedef struct x509_attributes_st X509_ATTRIBUTE; - -DEFINE_STACK_OF(X509_ATTRIBUTE) - -typedef struct X509_req_info_st X509_REQ_INFO; - -typedef struct X509_req_st X509_REQ; - -typedef struct x509_cert_aux_st X509_CERT_AUX; - -typedef struct x509_cinf_st X509_CINF; - -DEFINE_STACK_OF(X509) - -/* This is used for a table of trust checking functions */ - -typedef struct x509_trust_st { - int trust; - int flags; - int (*check_trust) (struct x509_trust_st *, X509 *, int); - char *name; - int arg1; - void *arg2; -} X509_TRUST; - -DEFINE_STACK_OF(X509_TRUST) - -/* standard trust ids */ - -# define X509_TRUST_DEFAULT 0 /* Only valid in purpose settings */ - -# define X509_TRUST_COMPAT 1 -# define X509_TRUST_SSL_CLIENT 2 -# define X509_TRUST_SSL_SERVER 3 -# define X509_TRUST_EMAIL 4 -# define X509_TRUST_OBJECT_SIGN 5 -# define X509_TRUST_OCSP_SIGN 6 -# define X509_TRUST_OCSP_REQUEST 7 -# define X509_TRUST_TSA 8 - -/* Keep these up to date! */ -# define X509_TRUST_MIN 1 -# define X509_TRUST_MAX 8 - -/* trust_flags values */ -# define X509_TRUST_DYNAMIC (1U << 0) -# define X509_TRUST_DYNAMIC_NAME (1U << 1) -/* No compat trust if self-signed, preempts "DO_SS" */ -# define X509_TRUST_NO_SS_COMPAT (1U << 2) -/* Compat trust if no explicit accepted trust EKUs */ -# define X509_TRUST_DO_SS_COMPAT (1U << 3) -/* Accept "anyEKU" as a wildcard trust OID */ -# define X509_TRUST_OK_ANY_EKU (1U << 4) - -/* check_trust return codes */ - -# define X509_TRUST_TRUSTED 1 -# define X509_TRUST_REJECTED 2 -# define X509_TRUST_UNTRUSTED 3 - -/* Flags for X509_print_ex() */ - -# define X509_FLAG_COMPAT 0 -# define X509_FLAG_NO_HEADER 1L -# define X509_FLAG_NO_VERSION (1L << 1) -# define X509_FLAG_NO_SERIAL (1L << 2) -# define X509_FLAG_NO_SIGNAME (1L << 3) -# define X509_FLAG_NO_ISSUER (1L << 4) -# define X509_FLAG_NO_VALIDITY (1L << 5) -# define X509_FLAG_NO_SUBJECT (1L << 6) -# define X509_FLAG_NO_PUBKEY (1L << 7) -# define X509_FLAG_NO_EXTENSIONS (1L << 8) -# define X509_FLAG_NO_SIGDUMP (1L << 9) -# define X509_FLAG_NO_AUX (1L << 10) -# define X509_FLAG_NO_ATTRIBUTES (1L << 11) -# define X509_FLAG_NO_IDS (1L << 12) - -/* Flags specific to X509_NAME_print_ex() */ - -/* The field separator information */ - -# define XN_FLAG_SEP_MASK (0xf << 16) - -# define XN_FLAG_COMPAT 0/* Traditional; use old X509_NAME_print */ -# define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */ -# define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */ -# define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */ -# define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */ - -# define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */ - -/* How the field name is shown */ - -# define XN_FLAG_FN_MASK (0x3 << 21) - -# define XN_FLAG_FN_SN 0/* Object short name */ -# define XN_FLAG_FN_LN (1 << 21)/* Object long name */ -# define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */ -# define XN_FLAG_FN_NONE (3 << 21)/* No field names */ - -# define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */ - -/* - * This determines if we dump fields we don't recognise: RFC2253 requires - * this. - */ - -# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) - -# define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20 - * characters */ - -/* Complete set of RFC2253 flags */ - -# define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ - XN_FLAG_SEP_COMMA_PLUS | \ - XN_FLAG_DN_REV | \ - XN_FLAG_FN_SN | \ - XN_FLAG_DUMP_UNKNOWN_FIELDS) - -/* readable oneline form */ - -# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ - ASN1_STRFLGS_ESC_QUOTE | \ - XN_FLAG_SEP_CPLUS_SPC | \ - XN_FLAG_SPC_EQ | \ - XN_FLAG_FN_SN) - -/* readable multiline form */ - -# define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ - ASN1_STRFLGS_ESC_MSB | \ - XN_FLAG_SEP_MULTILINE | \ - XN_FLAG_SPC_EQ | \ - XN_FLAG_FN_LN | \ - XN_FLAG_FN_ALIGN) - -DEFINE_STACK_OF(X509_REVOKED) - -typedef struct X509_crl_info_st X509_CRL_INFO; - -DEFINE_STACK_OF(X509_CRL) - -typedef struct private_key_st { - int version; - /* The PKCS#8 data types */ - X509_ALGOR *enc_algor; - ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ - /* When decrypted, the following will not be NULL */ - EVP_PKEY *dec_pkey; - /* used to encrypt and decrypt */ - int key_length; - char *key_data; - int key_free; /* true if we should auto free key_data */ - /* expanded version of 'enc_algor' */ - EVP_CIPHER_INFO cipher; -} X509_PKEY; - -typedef struct X509_info_st { - X509 *x509; - X509_CRL *crl; - X509_PKEY *x_pkey; - EVP_CIPHER_INFO enc_cipher; - int enc_len; - char *enc_data; -} X509_INFO; - -DEFINE_STACK_OF(X509_INFO) - -/* - * The next 2 structures and their 8 routines are used to manipulate Netscape's - * spki structures - useful if you are writing a CA web page - */ -typedef struct Netscape_spkac_st { - X509_PUBKEY *pubkey; - ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ -} NETSCAPE_SPKAC; - -typedef struct Netscape_spki_st { - NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ - X509_ALGOR sig_algor; - ASN1_BIT_STRING *signature; -} NETSCAPE_SPKI; - -/* Netscape certificate sequence structure */ -typedef struct Netscape_certificate_sequence { - ASN1_OBJECT *type; - STACK_OF(X509) *certs; -} NETSCAPE_CERT_SEQUENCE; - -/*- Unused (and iv length is wrong) -typedef struct CBCParameter_st - { - unsigned char iv[8]; - } CBC_PARAM; -*/ - -/* Password based encryption structure */ - -typedef struct PBEPARAM_st { - ASN1_OCTET_STRING *salt; - ASN1_INTEGER *iter; -} PBEPARAM; - -/* Password based encryption V2 structures */ - -typedef struct PBE2PARAM_st { - X509_ALGOR *keyfunc; - X509_ALGOR *encryption; -} PBE2PARAM; - -typedef struct PBKDF2PARAM_st { -/* Usually OCTET STRING but could be anything */ - ASN1_TYPE *salt; - ASN1_INTEGER *iter; - ASN1_INTEGER *keylength; - X509_ALGOR *prf; -} PBKDF2PARAM; - -#ifndef OPENSSL_NO_SCRYPT -typedef struct SCRYPT_PARAMS_st { - ASN1_OCTET_STRING *salt; - ASN1_INTEGER *costParameter; - ASN1_INTEGER *blockSize; - ASN1_INTEGER *parallelizationParameter; - ASN1_INTEGER *keyLength; -} SCRYPT_PARAMS; -#endif - -#ifdef __cplusplus -} -#endif - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define X509_EXT_PACK_UNKNOWN 1 -# define X509_EXT_PACK_STRING 2 - -# define X509_extract_key(x) X509_get_pubkey(x)/*****/ -# define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) -# define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) - -void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); -X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl), - int (*crl_free) (X509_CRL *crl), - int (*crl_lookup) (X509_CRL *crl, - X509_REVOKED **ret, - ASN1_INTEGER *ser, - X509_NAME *issuer), - int (*crl_verify) (X509_CRL *crl, - EVP_PKEY *pk)); -void X509_CRL_METHOD_free(X509_CRL_METHOD *m); - -void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); -void *X509_CRL_get_meth_data(X509_CRL *crl); - -const char *X509_verify_cert_error_string(long n); - -int X509_verify(X509 *a, EVP_PKEY *r); - -int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); -int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); -int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); - -NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); -char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); -EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); -int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); - -int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); - -int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); -int X509_signature_print(BIO *bp, const X509_ALGOR *alg, - const ASN1_STRING *sig); - -int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); -# ifndef OPENSSL_NO_OCSP -int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert); -# endif -int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); -int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); -# ifndef OPENSSL_NO_OCSP -int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl); -# endif -int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); - -int X509_pubkey_digest(const X509 *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_digest(const X509 *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); - -# ifndef OPENSSL_NO_STDIO -X509 *d2i_X509_fp(FILE *fp, X509 **x509); -int i2d_X509_fp(FILE *fp, X509 *x509); -X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); -int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl); -X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); -int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req); -# ifndef OPENSSL_NO_RSA -RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); -int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa); -RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); -int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa); -RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); -int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa); -# endif -# ifndef OPENSSL_NO_DSA -DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); -int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); -DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); -int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); -# endif -# ifndef OPENSSL_NO_EC -EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); -int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); -EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); -int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); -# endif -X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); -int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8); -PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, - PKCS8_PRIV_KEY_INFO **p8inf); -int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf); -int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); -int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); -int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); -# endif - -X509 *d2i_X509_bio(BIO *bp, X509 **x509); -int i2d_X509_bio(BIO *bp, X509 *x509); -X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); -int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl); -X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); -int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req); -# ifndef OPENSSL_NO_RSA -RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); -int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa); -RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); -int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa); -RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); -int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa); -# endif -# ifndef OPENSSL_NO_DSA -DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); -int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); -DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); -int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); -# endif -# ifndef OPENSSL_NO_EC -EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); -int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); -EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); -int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); -# endif -X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); -int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8); -PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, - PKCS8_PRIV_KEY_INFO **p8inf); -int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf); -int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); -int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); -int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); - -X509 *X509_dup(X509 *x509); -X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); -X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); -X509_CRL *X509_CRL_dup(X509_CRL *crl); -X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev); -X509_REQ *X509_REQ_dup(X509_REQ *req); -X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); -int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, - void *pval); -void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, - const void **ppval, const X509_ALGOR *algor); -void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); -int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); - -X509_NAME *X509_NAME_dup(X509_NAME *xn); -X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); - -int X509_cmp_time(const ASN1_TIME *s, time_t *t); -int X509_cmp_current_time(const ASN1_TIME *s); -ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t); -ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, - int offset_day, long offset_sec, time_t *t); -ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); - -const char *X509_get_default_cert_area(void); -const char *X509_get_default_cert_dir(void); -const char *X509_get_default_cert_file(void); -const char *X509_get_default_cert_dir_env(void); -const char *X509_get_default_cert_file_env(void); -const char *X509_get_default_private_dir(void); - -X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); -X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); - -DECLARE_ASN1_FUNCTIONS(X509_ALGOR) -DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) -DECLARE_ASN1_FUNCTIONS(X509_VAL) - -DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) - -int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); -EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key); -EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key); -int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain); -long X509_get_pathlen(X509 *x); -int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp); -EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length); -# ifndef OPENSSL_NO_RSA -int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); -RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length); -# endif -# ifndef OPENSSL_NO_DSA -int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp); -DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length); -# endif -# ifndef OPENSSL_NO_EC -int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); -EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length); -# endif - -DECLARE_ASN1_FUNCTIONS(X509_SIG) -void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, - const ASN1_OCTET_STRING **pdigest); -void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, - ASN1_OCTET_STRING **pdigest); - -DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) -DECLARE_ASN1_FUNCTIONS(X509_REQ) - -DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) -X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); - -DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) -DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) - -DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) - -DECLARE_ASN1_FUNCTIONS(X509_NAME) - -int X509_NAME_set(X509_NAME **xn, X509_NAME *name); - -DECLARE_ASN1_FUNCTIONS(X509_CINF) - -DECLARE_ASN1_FUNCTIONS(X509) -DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) - -#define X509_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef) -int X509_set_ex_data(X509 *r, int idx, void *arg); -void *X509_get_ex_data(X509 *r, int idx); -int i2d_X509_AUX(X509 *a, unsigned char **pp); -X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length); - -int i2d_re_X509_tbs(X509 *x, unsigned char **pp); - -int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid, - int *secbits, uint32_t *flags); -void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid, - int secbits, uint32_t flags); - -int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits, - uint32_t *flags); - -void X509_get0_signature(const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg, const X509 *x); -int X509_get_signature_nid(const X509 *x); - -int X509_trusted(const X509 *x); -int X509_alias_set1(X509 *x, const unsigned char *name, int len); -int X509_keyid_set1(X509 *x, const unsigned char *id, int len); -unsigned char *X509_alias_get0(X509 *x, int *len); -unsigned char *X509_keyid_get0(X509 *x, int *len); -int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *, - int); -int X509_TRUST_set(int *t, int trust); -int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); -int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj); -void X509_trust_clear(X509 *x); -void X509_reject_clear(X509 *x); - -STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x); -STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x); - -DECLARE_ASN1_FUNCTIONS(X509_REVOKED) -DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) -DECLARE_ASN1_FUNCTIONS(X509_CRL) - -int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); -int X509_CRL_get0_by_serial(X509_CRL *crl, - X509_REVOKED **ret, ASN1_INTEGER *serial); -int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); - -X509_PKEY *X509_PKEY_new(void); -void X509_PKEY_free(X509_PKEY *a); - -DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) -DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) -DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) - -X509_INFO *X509_INFO_new(void); -void X509_INFO_free(X509_INFO *a); -char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size); - -int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, - ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); - -int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, - unsigned char *md, unsigned int *len); - -int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, - char *data, EVP_PKEY *pkey, const EVP_MD *type); - -int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, - unsigned char *md, unsigned int *len); - -int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, - ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey); - -int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data, - EVP_PKEY *pkey, const EVP_MD *type); -int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, - void *asn, EVP_MD_CTX *ctx); - -long X509_get_version(const X509 *x); -int X509_set_version(X509 *x, long version); -int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); -ASN1_INTEGER *X509_get_serialNumber(X509 *x); -const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); -int X509_set_issuer_name(X509 *x, X509_NAME *name); -X509_NAME *X509_get_issuer_name(const X509 *a); -int X509_set_subject_name(X509 *x, X509_NAME *name); -X509_NAME *X509_get_subject_name(const X509 *a); -const ASN1_TIME * X509_get0_notBefore(const X509 *x); -ASN1_TIME *X509_getm_notBefore(const X509 *x); -int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); -const ASN1_TIME *X509_get0_notAfter(const X509 *x); -ASN1_TIME *X509_getm_notAfter(const X509 *x); -int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); -int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); -int X509_up_ref(X509 *x); -int X509_get_signature_type(const X509 *x); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_get_notBefore X509_getm_notBefore -# define X509_get_notAfter X509_getm_notAfter -# define X509_set_notBefore X509_set1_notBefore -# define X509_set_notAfter X509_set1_notAfter -#endif - - -/* - * This one is only used so that a binary form can output, as in - * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf) - */ -X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); -const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); -void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid, - const ASN1_BIT_STRING **psuid); -const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); - -EVP_PKEY *X509_get0_pubkey(const X509 *x); -EVP_PKEY *X509_get_pubkey(X509 *x); -ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); -int X509_certificate_type(const X509 *x, const EVP_PKEY *pubkey); - -long X509_REQ_get_version(const X509_REQ *req); -int X509_REQ_set_version(X509_REQ *x, long version); -X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req); -int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); -void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg); -int X509_REQ_get_signature_nid(const X509_REQ *req); -int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); -int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); -EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); -EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req); -X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req); -int X509_REQ_extension_nid(int nid); -int *X509_REQ_get_extension_nids(void); -void X509_REQ_set_extension_nids(int *nids); -STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); -int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, - int nid); -int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); -int X509_REQ_get_attr_count(const X509_REQ *req); -int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); -int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); -X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); -int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); -int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len); -int X509_REQ_add1_attr_by_NID(X509_REQ *req, - int nid, int type, - const unsigned char *bytes, int len); -int X509_REQ_add1_attr_by_txt(X509_REQ *req, - const char *attrname, int type, - const unsigned char *bytes, int len); - -int X509_CRL_set_version(X509_CRL *x, long version); -int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); -int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); -int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); -int X509_CRL_sort(X509_CRL *crl); -int X509_CRL_up_ref(X509_CRL *crl); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate -# define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate -#endif - -long X509_CRL_get_version(const X509_CRL *crl); -const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); -const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); -DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl)) -DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl)) -X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); -const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); -STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); -void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg); -int X509_CRL_get_signature_nid(const X509_CRL *crl); -int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); - -const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); -int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); -const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); -int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); -const STACK_OF(X509_EXTENSION) * -X509_REVOKED_get0_extensions(const X509_REVOKED *r); - -X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, - EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); - -int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey); - -int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); -int X509_chain_check_suiteb(int *perror_depth, - X509 *x, STACK_OF(X509) *chain, - unsigned long flags); -int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); -STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); - -int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); -unsigned long X509_issuer_and_serial_hash(X509 *a); - -int X509_issuer_name_cmp(const X509 *a, const X509 *b); -unsigned long X509_issuer_name_hash(X509 *a); - -int X509_subject_name_cmp(const X509 *a, const X509 *b); -unsigned long X509_subject_name_hash(X509 *x); - -# ifndef OPENSSL_NO_MD5 -unsigned long X509_issuer_name_hash_old(X509 *a); -unsigned long X509_subject_name_hash_old(X509 *x); -# endif - -int X509_cmp(const X509 *a, const X509 *b); -int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); -unsigned long X509_NAME_hash(X509_NAME *x); -unsigned long X509_NAME_hash_old(X509_NAME *x); - -int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); -int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); -int X509_aux_print(BIO *out, X509 *x, int indent); -# ifndef OPENSSL_NO_STDIO -int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, - unsigned long cflag); -int X509_print_fp(FILE *bp, X509 *x); -int X509_CRL_print_fp(FILE *bp, X509_CRL *x); -int X509_REQ_print_fp(FILE *bp, X509_REQ *req); -int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, - unsigned long flags); -# endif - -int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase); -int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, - unsigned long flags); -int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, - unsigned long cflag); -int X509_print(BIO *bp, X509 *x); -int X509_ocspid_print(BIO *bp, X509 *x); -int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag); -int X509_CRL_print(BIO *bp, X509_CRL *x); -int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, - unsigned long cflag); -int X509_REQ_print(BIO *bp, X509_REQ *req); - -int X509_NAME_entry_count(const X509_NAME *name); -int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len); -int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, - char *buf, int len); - -/* - * NOTE: you should be passing -1, not 0 as lastpos. The functions that use - * lastpos, search after that position on. - */ -int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos); -int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, - int lastpos); -X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); -X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); -int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, - int loc, int set); -int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len, int loc, - int set); -int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, - const unsigned char *bytes, int len, int loc, - int set); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, - const char *field, int type, - const unsigned char *bytes, - int len); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, - int type, - const unsigned char *bytes, - int len); -int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, - const unsigned char *bytes, int len, int loc, - int set); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, - int len); -int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj); -int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, - const unsigned char *bytes, int len); -ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); -ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); -int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); - -int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, - size_t *pderlen); - -int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); -int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, - int nid, int lastpos); -int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, - const ASN1_OBJECT *obj, int lastpos); -int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, - int crit, int lastpos); -X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); -X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); -STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, - X509_EXTENSION *ex, int loc); - -int X509_get_ext_count(const X509 *x); -int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); -int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos); -int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); -X509_EXTENSION *X509_get_ext(const X509 *x, int loc); -X509_EXTENSION *X509_delete_ext(X509 *x, int loc); -int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); -void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); -int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, - unsigned long flags); - -int X509_CRL_get_ext_count(const X509_CRL *x); -int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos); -int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, - int lastpos); -int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos); -X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); -X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); -int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); -void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx); -int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, - unsigned long flags); - -int X509_REVOKED_get_ext_count(const X509_REVOKED *x); -int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos); -int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj, - int lastpos); -int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, - int lastpos); -X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); -X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); -int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); -void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, - int *idx); -int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, - unsigned long flags); - -X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, - int nid, int crit, - ASN1_OCTET_STRING *data); -X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, - const ASN1_OBJECT *obj, int crit, - ASN1_OCTET_STRING *data); -int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); -int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); -int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); -ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); -ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); -int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); - -int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); -int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, - int lastpos); -int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, - const ASN1_OBJECT *obj, int lastpos); -X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); -X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, - X509_ATTRIBUTE *attr); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) - **x, const ASN1_OBJECT *obj, - int type, - const unsigned char *bytes, - int len); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) - **x, int nid, int type, - const unsigned char *bytes, - int len); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) - **x, const char *attrname, - int type, - const unsigned char *bytes, - int len); -void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, - const ASN1_OBJECT *obj, int lastpos, int type); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, - int atrtype, const void *data, - int len); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, - const ASN1_OBJECT *obj, - int atrtype, const void *data, - int len); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, - const char *atrname, int type, - const unsigned char *bytes, - int len); -int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); -int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, - const void *data, int len); -void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype, - void *data); -int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); -ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); -ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); - -int EVP_PKEY_get_attr_count(const EVP_PKEY *key); -int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); -int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); -X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); -int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); -int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len); -int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, - int nid, int type, - const unsigned char *bytes, int len); -int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, - const char *attrname, int type, - const unsigned char *bytes, int len); - -int X509_verify_cert(X509_STORE_CTX *ctx); - -/* lookup a cert from a X509 STACK */ -X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name, - ASN1_INTEGER *serial); -X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name); - -DECLARE_ASN1_FUNCTIONS(PBEPARAM) -DECLARE_ASN1_FUNCTIONS(PBE2PARAM) -DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) -#ifndef OPENSSL_NO_SCRYPT -DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS) -#endif - -int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, - const unsigned char *salt, int saltlen); - -X509_ALGOR *PKCS5_pbe_set(int alg, int iter, - const unsigned char *salt, int saltlen); -X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, - unsigned char *salt, int saltlen); -X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, - unsigned char *salt, int saltlen, - unsigned char *aiv, int prf_nid); - -#ifndef OPENSSL_NO_SCRYPT -X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, - const unsigned char *salt, int saltlen, - unsigned char *aiv, uint64_t N, uint64_t r, - uint64_t p); -#endif - -X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, - int prf_nid, int keylen); - -/* PKCS#8 utilities */ - -DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) - -EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); -PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); - -int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, - int version, int ptype, void *pval, - unsigned char *penc, int penclen); -int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, - const unsigned char **pk, int *ppklen, - const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); - -const STACK_OF(X509_ATTRIBUTE) * -PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); -int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, - const unsigned char *bytes, int len); - -int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, - int ptype, void *pval, - unsigned char *penc, int penclen); -int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, - const unsigned char **pk, int *ppklen, - X509_ALGOR **pa, X509_PUBKEY *pub); - -int X509_check_trust(X509 *x, int id, int flags); -int X509_TRUST_get_count(void); -X509_TRUST *X509_TRUST_get0(int idx); -int X509_TRUST_get_by_id(int id); -int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), - const char *name, int arg1, void *arg2); -void X509_TRUST_cleanup(void); -int X509_TRUST_get_flags(const X509_TRUST *xp); -char *X509_TRUST_get0_name(const X509_TRUST *xp); -int X509_TRUST_get_trust(const X509_TRUST *xp); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509_vfy.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509_vfy.h deleted file mode 100644 index adb8bce7..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509_vfy.h +++ /dev/null @@ -1,628 +0,0 @@ -/* - * 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_X509_VFY_H -# define HEADER_X509_VFY_H - -/* - * Protect against recursion, x509.h and x509_vfy.h each include the other. - */ -# ifndef HEADER_X509_H -# include -# endif - -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- -SSL_CTX -> X509_STORE - -> X509_LOOKUP - ->X509_LOOKUP_METHOD - -> X509_LOOKUP - ->X509_LOOKUP_METHOD - -SSL -> X509_STORE_CTX - ->X509_STORE - -The X509_STORE holds the tables etc for verification stuff. -A X509_STORE_CTX is used while validating a single certificate. -The X509_STORE has X509_LOOKUPs for looking up certs. -The X509_STORE then calls a function to actually verify the -certificate chain. -*/ - -typedef enum { - X509_LU_NONE = 0, - X509_LU_X509, X509_LU_CRL -} X509_LOOKUP_TYPE; - -#if OPENSSL_API_COMPAT < 0x10100000L -#define X509_LU_RETRY -1 -#define X509_LU_FAIL 0 -#endif - -DEFINE_STACK_OF(X509_LOOKUP) -DEFINE_STACK_OF(X509_OBJECT) -DEFINE_STACK_OF(X509_VERIFY_PARAM) - -int X509_STORE_set_depth(X509_STORE *store, int depth); - -typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *); -typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); -typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer, - X509_STORE_CTX *ctx, X509 *x); -typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx, - X509 *x, X509 *issuer); -typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx); -typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx, - X509_CRL **crl, X509 *x); -typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl); -typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx, - X509_CRL *crl, X509 *x); -typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx); -typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx, - X509_NAME *nm); -typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx, - X509_NAME *nm); -typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx); - - -void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); - -# define X509_STORE_CTX_set_app_data(ctx,data) \ - X509_STORE_CTX_set_ex_data(ctx,0,data) -# define X509_STORE_CTX_get_app_data(ctx) \ - X509_STORE_CTX_get_ex_data(ctx,0) - -# define X509_L_FILE_LOAD 1 -# define X509_L_ADD_DIR 2 - -# define X509_LOOKUP_load_file(x,name,type) \ - X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) - -# define X509_LOOKUP_add_dir(x,name,type) \ - X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) - -# define X509_V_OK 0 -# define X509_V_ERR_UNSPECIFIED 1 -# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 -# define X509_V_ERR_UNABLE_TO_GET_CRL 3 -# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 -# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 -# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 -# define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 -# define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 -# define X509_V_ERR_CERT_NOT_YET_VALID 9 -# define X509_V_ERR_CERT_HAS_EXPIRED 10 -# define X509_V_ERR_CRL_NOT_YET_VALID 11 -# define X509_V_ERR_CRL_HAS_EXPIRED 12 -# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 -# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 -# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 -# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 -# define X509_V_ERR_OUT_OF_MEM 17 -# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 -# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 -# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 -# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 -# define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 -# define X509_V_ERR_CERT_REVOKED 23 -# define X509_V_ERR_INVALID_CA 24 -# define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 -# define X509_V_ERR_INVALID_PURPOSE 26 -# define X509_V_ERR_CERT_UNTRUSTED 27 -# define X509_V_ERR_CERT_REJECTED 28 -/* These are 'informational' when looking for issuer cert */ -# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 -# define X509_V_ERR_AKID_SKID_MISMATCH 30 -# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 -# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 -# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 -# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 -# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 -# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 -# define X509_V_ERR_INVALID_NON_CA 37 -# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 -# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 -# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 -# define X509_V_ERR_INVALID_EXTENSION 41 -# define X509_V_ERR_INVALID_POLICY_EXTENSION 42 -# define X509_V_ERR_NO_EXPLICIT_POLICY 43 -# define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 -# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 -# define X509_V_ERR_UNNESTED_RESOURCE 46 -# define X509_V_ERR_PERMITTED_VIOLATION 47 -# define X509_V_ERR_EXCLUDED_VIOLATION 48 -# define X509_V_ERR_SUBTREE_MINMAX 49 -/* The application is not happy */ -# define X509_V_ERR_APPLICATION_VERIFICATION 50 -# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 -# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 -# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 -# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 -/* Another issuer check debug option */ -# define X509_V_ERR_PATH_LOOP 55 -/* Suite B mode algorithm violation */ -# define X509_V_ERR_SUITE_B_INVALID_VERSION 56 -# define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 -# define X509_V_ERR_SUITE_B_INVALID_CURVE 58 -# define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 -# define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 -# define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 -/* Host, email and IP check errors */ -# define X509_V_ERR_HOSTNAME_MISMATCH 62 -# define X509_V_ERR_EMAIL_MISMATCH 63 -# define X509_V_ERR_IP_ADDRESS_MISMATCH 64 -/* DANE TLSA errors */ -# define X509_V_ERR_DANE_NO_MATCH 65 -/* security level errors */ -# define X509_V_ERR_EE_KEY_TOO_SMALL 66 -# define X509_V_ERR_CA_KEY_TOO_SMALL 67 -# define X509_V_ERR_CA_MD_TOO_WEAK 68 -/* Caller error */ -# define X509_V_ERR_INVALID_CALL 69 -/* Issuer lookup error */ -# define X509_V_ERR_STORE_LOOKUP 70 -/* Certificate transparency */ -# define X509_V_ERR_NO_VALID_SCTS 71 - -# define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72 -/* OCSP status errors */ -# define X509_V_ERR_OCSP_VERIFY_NEEDED 73 /* Need OCSP verification */ -# define X509_V_ERR_OCSP_VERIFY_FAILED 74 /* Couldn't verify cert through OCSP */ -# define X509_V_ERR_OCSP_CERT_UNKNOWN 75 /* Certificate wasn't recognized by the OCSP responder */ - -/* Certificate verify flags */ - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_V_FLAG_CB_ISSUER_CHECK 0x0 /* Deprecated */ -# endif -/* Use check time instead of current time */ -# define X509_V_FLAG_USE_CHECK_TIME 0x2 -/* Lookup CRLs */ -# define X509_V_FLAG_CRL_CHECK 0x4 -/* Lookup CRLs for whole chain */ -# define X509_V_FLAG_CRL_CHECK_ALL 0x8 -/* Ignore unhandled critical extensions */ -# define X509_V_FLAG_IGNORE_CRITICAL 0x10 -/* Disable workarounds for broken certificates */ -# define X509_V_FLAG_X509_STRICT 0x20 -/* Enable proxy certificate validation */ -# define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 -/* Enable policy checking */ -# define X509_V_FLAG_POLICY_CHECK 0x80 -/* Policy variable require-explicit-policy */ -# define X509_V_FLAG_EXPLICIT_POLICY 0x100 -/* Policy variable inhibit-any-policy */ -# define X509_V_FLAG_INHIBIT_ANY 0x200 -/* Policy variable inhibit-policy-mapping */ -# define X509_V_FLAG_INHIBIT_MAP 0x400 -/* Notify callback that policy is OK */ -# define X509_V_FLAG_NOTIFY_POLICY 0x800 -/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ -# define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 -/* Delta CRL support */ -# define X509_V_FLAG_USE_DELTAS 0x2000 -/* Check self-signed CA signature */ -# define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 -/* Use trusted store first */ -# define X509_V_FLAG_TRUSTED_FIRST 0x8000 -/* Suite B 128 bit only mode: not normally used */ -# define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 -/* Suite B 192 bit only mode */ -# define X509_V_FLAG_SUITEB_192_LOS 0x20000 -/* Suite B 128 bit mode allowing 192 bit algorithms */ -# define X509_V_FLAG_SUITEB_128_LOS 0x30000 -/* Allow partial chains if at least one certificate is in trusted store */ -# define X509_V_FLAG_PARTIAL_CHAIN 0x80000 -/* - * If the initial chain is not trusted, do not attempt to build an alternative - * chain. Alternate chain checking was introduced in 1.1.0. Setting this flag - * will force the behaviour to match that of previous versions. - */ -# define X509_V_FLAG_NO_ALT_CHAINS 0x100000 -/* Do not check certificate/CRL validity against current time */ -# define X509_V_FLAG_NO_CHECK_TIME 0x200000 - -# define X509_VP_FLAG_DEFAULT 0x1 -# define X509_VP_FLAG_OVERWRITE 0x2 -# define X509_VP_FLAG_RESET_FLAGS 0x4 -# define X509_VP_FLAG_LOCKED 0x8 -# define X509_VP_FLAG_ONCE 0x10 - -/* Internal use: mask of policy related options */ -# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ - | X509_V_FLAG_EXPLICIT_POLICY \ - | X509_V_FLAG_INHIBIT_ANY \ - | X509_V_FLAG_INHIBIT_MAP) - -int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, - X509_NAME *name); -X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, - X509_LOOKUP_TYPE type, - X509_NAME *name); -X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, - X509_OBJECT *x); -int X509_OBJECT_up_ref_count(X509_OBJECT *a); -X509_OBJECT *X509_OBJECT_new(void); -void X509_OBJECT_free(X509_OBJECT *a); -X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); -X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a); -int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj); -X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a); -int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj); -X509_STORE *X509_STORE_new(void); -void X509_STORE_free(X509_STORE *v); -int X509_STORE_lock(X509_STORE *ctx); -int X509_STORE_unlock(X509_STORE *ctx); -int X509_STORE_up_ref(X509_STORE *v); -STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v); - -STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); -STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); -int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); -int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); -int X509_STORE_set_trust(X509_STORE *ctx, int trust); -int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); -X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx); - -void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify); -#define X509_STORE_set_verify_func(ctx, func) \ - X509_STORE_set_verify((ctx),(func)) -void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, - X509_STORE_CTX_verify_fn verify); -X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx); -void X509_STORE_set_verify_cb(X509_STORE *ctx, - X509_STORE_CTX_verify_cb verify_cb); -# define X509_STORE_set_verify_cb_func(ctx,func) \ - X509_STORE_set_verify_cb((ctx),(func)) -X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx); -void X509_STORE_set_get_issuer(X509_STORE *ctx, - X509_STORE_CTX_get_issuer_fn get_issuer); -X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE *ctx); -void X509_STORE_set_check_issued(X509_STORE *ctx, - X509_STORE_CTX_check_issued_fn check_issued); -X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *ctx); -void X509_STORE_set_check_revocation(X509_STORE *ctx, - X509_STORE_CTX_check_revocation_fn check_revocation); -X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE *ctx); -void X509_STORE_set_get_crl(X509_STORE *ctx, - X509_STORE_CTX_get_crl_fn get_crl); -X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE *ctx); -void X509_STORE_set_check_crl(X509_STORE *ctx, - X509_STORE_CTX_check_crl_fn check_crl); -X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE *ctx); -void X509_STORE_set_cert_crl(X509_STORE *ctx, - X509_STORE_CTX_cert_crl_fn cert_crl); -X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE *ctx); -void X509_STORE_set_check_policy(X509_STORE *ctx, - X509_STORE_CTX_check_policy_fn check_policy); -X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE *ctx); -void X509_STORE_set_lookup_certs(X509_STORE *ctx, - X509_STORE_CTX_lookup_certs_fn lookup_certs); -X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE *ctx); -void X509_STORE_set_lookup_crls(X509_STORE *ctx, - X509_STORE_CTX_lookup_crls_fn lookup_crls); -#define X509_STORE_set_lookup_crls_cb(ctx, func) \ - X509_STORE_set_lookup_crls((ctx), (func)) -X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE *ctx); -void X509_STORE_set_cleanup(X509_STORE *ctx, - X509_STORE_CTX_cleanup_fn cleanup); -X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE *ctx); - -#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, l, p, newf, dupf, freef) -int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data); -void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx); - -X509_STORE_CTX *X509_STORE_CTX_new(void); - -int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); - -void X509_STORE_CTX_free(X509_STORE_CTX *ctx); -int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, - X509 *x509, STACK_OF(X509) *chain); -void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); -void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); - -X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); -X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx); -STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); -void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, - X509_STORE_CTX_verify_cb verify); -X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx); -X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx); -X509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx); -X509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx); -X509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx); -X509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx); -X509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define X509_STORE_CTX_get_chain X509_STORE_CTX_get0_chain -# define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted -# define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack -# define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject -# define X509_STORE_get1_certs X509_STORE_CTX_get1_certs -# define X509_STORE_get1_crls X509_STORE_CTX_get1_crls -/* the following macro is misspelled; use X509_STORE_get1_certs instead */ -# define X509_STORE_get1_cert X509_STORE_CTX_get1_certs -/* the following macro is misspelled; use X509_STORE_get1_crls instead */ -# define X509_STORE_get1_crl X509_STORE_CTX_get1_crls -#endif - -X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); -X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); -X509_LOOKUP_METHOD *X509_LOOKUP_file(void); - -typedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc, - long argl, char **ret); -typedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - X509_NAME *name, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - X509_NAME *name, - ASN1_INTEGER *serial, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - const unsigned char* bytes, - int len, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - const char *str, - int len, - X509_OBJECT *ret); - -X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name); -void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method, - int (*new_item) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method, - void (*free_fn) (X509_LOOKUP *ctx)); -void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method, - int (*init) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method, - int (*shutdown) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method, - X509_LOOKUP_ctrl_fn ctrl_fn); -X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_subject_fn fn); -X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_issuer_serial(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_issuer_serial_fn fn); -X509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_fingerprint_fn fn); -X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_alias_fn fn); -X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias( - const X509_LOOKUP_METHOD *method); - - -int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); -int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); - -int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, - X509_NAME *name, X509_OBJECT *ret); -X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, - X509_LOOKUP_TYPE type, - X509_NAME *name); - -int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, - long argl, char **ret); - -int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); -int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); -int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); - -X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); -void X509_LOOKUP_free(X509_LOOKUP *ctx); -int X509_LOOKUP_init(X509_LOOKUP *ctx); -int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - X509_NAME *name, X509_OBJECT *ret); -int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - X509_NAME *name, ASN1_INTEGER *serial, - X509_OBJECT *ret); -int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const unsigned char *bytes, int len, - X509_OBJECT *ret); -int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const char *str, int len, X509_OBJECT *ret); -int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data); -void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx); -X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx); -int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); - -int X509_STORE_load_locations(X509_STORE *ctx, - const char *file, const char *dir); -int X509_STORE_set_default_paths(X509_STORE *ctx); - -#define X509_STORE_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE_CTX, l, p, newf, dupf, freef) -int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data); -void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx); -int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s); -int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth); -X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x); -X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); -X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); -STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx); -STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x); -void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk); -void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk); -int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); -int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); -int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, - int purpose, int trust); -void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); -void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, - time_t t); - -X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); -int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); -int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx); - -X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); -int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); - -/* - * Bridge opacity barrier between libcrypt and libssl, also needed to support - * offline testing in test/danetest.c - */ -void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane); -#define DANE_FLAG_NO_DANE_EE_NAMECHECKS (1L << 0) - -/* X509_VERIFY_PARAM functions */ - -X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); -void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, - const X509_VERIFY_PARAM *from); -int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, - const X509_VERIFY_PARAM *from); -int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); -int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, - unsigned long flags); -int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, - unsigned long flags); -unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); -int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); -void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); -void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level); -time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param); -void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); -int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, - ASN1_OBJECT *policy); -int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, - STACK_OF(ASN1_OBJECT) *policies); - -int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, - uint32_t flags); -uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param); - -int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, - const char *name, size_t namelen); -int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, - const char *name, size_t namelen); -void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, - unsigned int flags); -unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param); -char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *); -void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *, X509_VERIFY_PARAM *); -int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, - const char *email, size_t emaillen); -int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, - const unsigned char *ip, size_t iplen); -int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, - const char *ipasc); - -int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param); -const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); - -int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_get_count(void); -const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); -const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); -void X509_VERIFY_PARAM_table_cleanup(void); - -/* Non positive return values are errors */ -#define X509_PCY_TREE_FAILURE -2 /* Failure to satisfy explicit policy */ -#define X509_PCY_TREE_INVALID -1 /* Inconsistent or invalid extensions */ -#define X509_PCY_TREE_INTERNAL 0 /* Internal error, most likely malloc */ - -/* - * Positive return values form a bit mask, all but the first are internal to - * the library and don't appear in results from X509_policy_check(). - */ -#define X509_PCY_TREE_VALID 1 /* The policy tree is valid */ -#define X509_PCY_TREE_EMPTY 2 /* The policy tree is empty */ -#define X509_PCY_TREE_EXPLICIT 4 /* Explicit policy required */ - -int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, - STACK_OF(X509) *certs, - STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags); - -void X509_policy_tree_free(X509_POLICY_TREE *tree); - -int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); -X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, - int i); - -STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const - X509_POLICY_TREE - *tree); - -STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const - X509_POLICY_TREE - *tree); - -int X509_policy_level_node_count(X509_POLICY_LEVEL *level); - -X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, - int i); - -const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); - -STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const - X509_POLICY_NODE - *node); -const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE - *node); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509err.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509err.h deleted file mode 100644 index 02738531..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509err.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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_X509ERR_H -# define HEADER_X509ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_X509_strings(void); - -/* - * X509 function codes. - */ -# define X509_F_ADD_CERT_DIR 100 -# define X509_F_BUILD_CHAIN 106 -# define X509_F_BY_FILE_CTRL 101 -# define X509_F_CHECK_NAME_CONSTRAINTS 149 -# define X509_F_CHECK_POLICY 145 -# define X509_F_DANE_I2D 107 -# define X509_F_DIR_CTRL 102 -# define X509_F_GET_CERT_BY_SUBJECT 103 -# define X509_F_I2D_X509_AUX 151 -# define X509_F_LOOKUP_CERTS_SK 152 -# define X509_F_NETSCAPE_SPKI_B64_DECODE 129 -# define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 -# define X509_F_NEW_DIR 153 -# define X509_F_X509AT_ADD1_ATTR 135 -# define X509_F_X509V3_ADD_EXT 104 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 -# define X509_F_X509_ATTRIBUTE_GET0_DATA 139 -# define X509_F_X509_ATTRIBUTE_SET1_DATA 138 -# define X509_F_X509_CHECK_PRIVATE_KEY 128 -# define X509_F_X509_CRL_DIFF 105 -# define X509_F_X509_CRL_METHOD_NEW 154 -# define X509_F_X509_CRL_PRINT_FP 147 -# define X509_F_X509_EXTENSION_CREATE_BY_NID 108 -# define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 -# define X509_F_X509_GET_PUBKEY_PARAMETERS 110 -# define X509_F_X509_LOAD_CERT_CRL_FILE 132 -# define X509_F_X509_LOAD_CERT_FILE 111 -# define X509_F_X509_LOAD_CRL_FILE 112 -# define X509_F_X509_LOOKUP_METH_NEW 160 -# define X509_F_X509_LOOKUP_NEW 155 -# define X509_F_X509_NAME_ADD_ENTRY 113 -# define X509_F_X509_NAME_CANON 156 -# define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 -# define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 -# define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 -# define X509_F_X509_NAME_ONELINE 116 -# define X509_F_X509_NAME_PRINT 117 -# define X509_F_X509_OBJECT_NEW 150 -# define X509_F_X509_PRINT_EX_FP 118 -# define X509_F_X509_PUBKEY_DECODE 148 -# define X509_F_X509_PUBKEY_GET0 119 -# define X509_F_X509_PUBKEY_SET 120 -# define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 -# define X509_F_X509_REQ_PRINT_EX 121 -# define X509_F_X509_REQ_PRINT_FP 122 -# define X509_F_X509_REQ_TO_X509 123 -# define X509_F_X509_STORE_ADD_CERT 124 -# define X509_F_X509_STORE_ADD_CRL 125 -# define X509_F_X509_STORE_ADD_LOOKUP 157 -# define X509_F_X509_STORE_CTX_GET1_ISSUER 146 -# define X509_F_X509_STORE_CTX_INIT 143 -# define X509_F_X509_STORE_CTX_NEW 142 -# define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 -# define X509_F_X509_STORE_NEW 158 -# define X509_F_X509_TO_X509_REQ 126 -# define X509_F_X509_TRUST_ADD 133 -# define X509_F_X509_TRUST_SET 141 -# define X509_F_X509_VERIFY_CERT 127 -# define X509_F_X509_VERIFY_PARAM_NEW 159 - -/* - * X509 reason codes. - */ -# define X509_R_AKID_MISMATCH 110 -# define X509_R_BAD_SELECTOR 133 -# define X509_R_BAD_X509_FILETYPE 100 -# define X509_R_BASE64_DECODE_ERROR 118 -# define X509_R_CANT_CHECK_DH_KEY 114 -# define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 -# define X509_R_CRL_ALREADY_DELTA 127 -# define X509_R_CRL_VERIFY_FAILURE 131 -# define X509_R_IDP_MISMATCH 128 -# define X509_R_INVALID_ATTRIBUTES 138 -# define X509_R_INVALID_DIRECTORY 113 -# define X509_R_INVALID_FIELD_NAME 119 -# define X509_R_INVALID_TRUST 123 -# define X509_R_ISSUER_MISMATCH 129 -# define X509_R_KEY_TYPE_MISMATCH 115 -# define X509_R_KEY_VALUES_MISMATCH 116 -# define X509_R_LOADING_CERT_DIR 103 -# define X509_R_LOADING_DEFAULTS 104 -# define X509_R_METHOD_NOT_SUPPORTED 124 -# define X509_R_NAME_TOO_LONG 134 -# define X509_R_NEWER_CRL_NOT_NEWER 132 -# define X509_R_NO_CERTIFICATE_FOUND 135 -# define X509_R_NO_CERTIFICATE_OR_CRL_FOUND 136 -# define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 -# define X509_R_NO_CRL_FOUND 137 -# define X509_R_NO_CRL_NUMBER 130 -# define X509_R_PUBLIC_KEY_DECODE_ERROR 125 -# define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 -# define X509_R_SHOULD_RETRY 106 -# define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 -# define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 -# define X509_R_UNKNOWN_KEY_TYPE 117 -# define X509_R_UNKNOWN_NID 109 -# define X509_R_UNKNOWN_PURPOSE_ID 121 -# define X509_R_UNKNOWN_TRUST_ID 120 -# define X509_R_UNSUPPORTED_ALGORITHM 111 -# define X509_R_WRONG_LOOKUP_TYPE 112 -# define X509_R_WRONG_TYPE 122 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509v3.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509v3.h deleted file mode 100644 index 6c6eca38..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509v3.h +++ /dev/null @@ -1,937 +0,0 @@ -/* - * Copyright 1999-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_X509V3_H -# define HEADER_X509V3_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward reference */ -struct v3_ext_method; -struct v3_ext_ctx; - -/* Useful typedefs */ - -typedef void *(*X509V3_EXT_NEW)(void); -typedef void (*X509V3_EXT_FREE) (void *); -typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); -typedef int (*X509V3_EXT_I2D) (void *, unsigned char **); -typedef STACK_OF(CONF_VALUE) * - (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, - STACK_OF(CONF_VALUE) *extlist); -typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, - STACK_OF(CONF_VALUE) *values); -typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, - void *ext); -typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, const char *str); -typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, - BIO *out, int indent); -typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, const char *str); - -/* V3 extension structure */ - -struct v3_ext_method { - int ext_nid; - int ext_flags; -/* If this is set the following four fields are ignored */ - ASN1_ITEM_EXP *it; -/* Old style ASN1 calls */ - X509V3_EXT_NEW ext_new; - X509V3_EXT_FREE ext_free; - X509V3_EXT_D2I d2i; - X509V3_EXT_I2D i2d; -/* The following pair is used for string extensions */ - X509V3_EXT_I2S i2s; - X509V3_EXT_S2I s2i; -/* The following pair is used for multi-valued extensions */ - X509V3_EXT_I2V i2v; - X509V3_EXT_V2I v2i; -/* The following are used for raw extensions */ - X509V3_EXT_I2R i2r; - X509V3_EXT_R2I r2i; - void *usr_data; /* Any extension specific data */ -}; - -typedef struct X509V3_CONF_METHOD_st { - char *(*get_string) (void *db, const char *section, const char *value); - STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section); - void (*free_string) (void *db, char *string); - void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); -} X509V3_CONF_METHOD; - -/* Context specific info */ -struct v3_ext_ctx { -# define CTX_TEST 0x1 -# define X509V3_CTX_REPLACE 0x2 - int flags; - X509 *issuer_cert; - X509 *subject_cert; - X509_REQ *subject_req; - X509_CRL *crl; - X509V3_CONF_METHOD *db_meth; - void *db; -/* Maybe more here */ -}; - -typedef struct v3_ext_method X509V3_EXT_METHOD; - -DEFINE_STACK_OF(X509V3_EXT_METHOD) - -/* ext_flags values */ -# define X509V3_EXT_DYNAMIC 0x1 -# define X509V3_EXT_CTX_DEP 0x2 -# define X509V3_EXT_MULTILINE 0x4 - -typedef BIT_STRING_BITNAME ENUMERATED_NAMES; - -typedef struct BASIC_CONSTRAINTS_st { - int ca; - ASN1_INTEGER *pathlen; -} BASIC_CONSTRAINTS; - -typedef struct PKEY_USAGE_PERIOD_st { - ASN1_GENERALIZEDTIME *notBefore; - ASN1_GENERALIZEDTIME *notAfter; -} PKEY_USAGE_PERIOD; - -typedef struct otherName_st { - ASN1_OBJECT *type_id; - ASN1_TYPE *value; -} OTHERNAME; - -typedef struct EDIPartyName_st { - ASN1_STRING *nameAssigner; - ASN1_STRING *partyName; -} EDIPARTYNAME; - -typedef struct GENERAL_NAME_st { -# define GEN_OTHERNAME 0 -# define GEN_EMAIL 1 -# define GEN_DNS 2 -# define GEN_X400 3 -# define GEN_DIRNAME 4 -# define GEN_EDIPARTY 5 -# define GEN_URI 6 -# define GEN_IPADD 7 -# define GEN_RID 8 - int type; - union { - char *ptr; - OTHERNAME *otherName; /* otherName */ - ASN1_IA5STRING *rfc822Name; - ASN1_IA5STRING *dNSName; - ASN1_TYPE *x400Address; - X509_NAME *directoryName; - EDIPARTYNAME *ediPartyName; - ASN1_IA5STRING *uniformResourceIdentifier; - ASN1_OCTET_STRING *iPAddress; - ASN1_OBJECT *registeredID; - /* Old names */ - ASN1_OCTET_STRING *ip; /* iPAddress */ - X509_NAME *dirn; /* dirn */ - ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, - * uniformResourceIdentifier */ - ASN1_OBJECT *rid; /* registeredID */ - ASN1_TYPE *other; /* x400Address */ - } d; -} GENERAL_NAME; - -typedef struct ACCESS_DESCRIPTION_st { - ASN1_OBJECT *method; - GENERAL_NAME *location; -} ACCESS_DESCRIPTION; - -typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; - -typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; - -typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; - -DEFINE_STACK_OF(GENERAL_NAME) -typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; -DEFINE_STACK_OF(GENERAL_NAMES) - -DEFINE_STACK_OF(ACCESS_DESCRIPTION) - -typedef struct DIST_POINT_NAME_st { - int type; - union { - GENERAL_NAMES *fullname; - STACK_OF(X509_NAME_ENTRY) *relativename; - } name; -/* If relativename then this contains the full distribution point name */ - X509_NAME *dpname; -} DIST_POINT_NAME; -/* All existing reasons */ -# define CRLDP_ALL_REASONS 0x807f - -# define CRL_REASON_NONE -1 -# define CRL_REASON_UNSPECIFIED 0 -# define CRL_REASON_KEY_COMPROMISE 1 -# define CRL_REASON_CA_COMPROMISE 2 -# define CRL_REASON_AFFILIATION_CHANGED 3 -# define CRL_REASON_SUPERSEDED 4 -# define CRL_REASON_CESSATION_OF_OPERATION 5 -# define CRL_REASON_CERTIFICATE_HOLD 6 -# define CRL_REASON_REMOVE_FROM_CRL 8 -# define CRL_REASON_PRIVILEGE_WITHDRAWN 9 -# define CRL_REASON_AA_COMPROMISE 10 - -struct DIST_POINT_st { - DIST_POINT_NAME *distpoint; - ASN1_BIT_STRING *reasons; - GENERAL_NAMES *CRLissuer; - int dp_reasons; -}; - -typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; - -DEFINE_STACK_OF(DIST_POINT) - -struct AUTHORITY_KEYID_st { - ASN1_OCTET_STRING *keyid; - GENERAL_NAMES *issuer; - ASN1_INTEGER *serial; -}; - -/* Strong extranet structures */ - -typedef struct SXNET_ID_st { - ASN1_INTEGER *zone; - ASN1_OCTET_STRING *user; -} SXNETID; - -DEFINE_STACK_OF(SXNETID) - -typedef struct SXNET_st { - ASN1_INTEGER *version; - STACK_OF(SXNETID) *ids; -} SXNET; - -typedef struct NOTICEREF_st { - ASN1_STRING *organization; - STACK_OF(ASN1_INTEGER) *noticenos; -} NOTICEREF; - -typedef struct USERNOTICE_st { - NOTICEREF *noticeref; - ASN1_STRING *exptext; -} USERNOTICE; - -typedef struct POLICYQUALINFO_st { - ASN1_OBJECT *pqualid; - union { - ASN1_IA5STRING *cpsuri; - USERNOTICE *usernotice; - ASN1_TYPE *other; - } d; -} POLICYQUALINFO; - -DEFINE_STACK_OF(POLICYQUALINFO) - -typedef struct POLICYINFO_st { - ASN1_OBJECT *policyid; - STACK_OF(POLICYQUALINFO) *qualifiers; -} POLICYINFO; - -typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; - -DEFINE_STACK_OF(POLICYINFO) - -typedef struct POLICY_MAPPING_st { - ASN1_OBJECT *issuerDomainPolicy; - ASN1_OBJECT *subjectDomainPolicy; -} POLICY_MAPPING; - -DEFINE_STACK_OF(POLICY_MAPPING) - -typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; - -typedef struct GENERAL_SUBTREE_st { - GENERAL_NAME *base; - ASN1_INTEGER *minimum; - ASN1_INTEGER *maximum; -} GENERAL_SUBTREE; - -DEFINE_STACK_OF(GENERAL_SUBTREE) - -struct NAME_CONSTRAINTS_st { - STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; - STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; -}; - -typedef struct POLICY_CONSTRAINTS_st { - ASN1_INTEGER *requireExplicitPolicy; - ASN1_INTEGER *inhibitPolicyMapping; -} POLICY_CONSTRAINTS; - -/* Proxy certificate structures, see RFC 3820 */ -typedef struct PROXY_POLICY_st { - ASN1_OBJECT *policyLanguage; - ASN1_OCTET_STRING *policy; -} PROXY_POLICY; - -typedef struct PROXY_CERT_INFO_EXTENSION_st { - ASN1_INTEGER *pcPathLengthConstraint; - PROXY_POLICY *proxyPolicy; -} PROXY_CERT_INFO_EXTENSION; - -DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) -DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) - -struct ISSUING_DIST_POINT_st { - DIST_POINT_NAME *distpoint; - int onlyuser; - int onlyCA; - ASN1_BIT_STRING *onlysomereasons; - int indirectCRL; - int onlyattr; -}; - -/* Values in idp_flags field */ -/* IDP present */ -# define IDP_PRESENT 0x1 -/* IDP values inconsistent */ -# define IDP_INVALID 0x2 -/* onlyuser true */ -# define IDP_ONLYUSER 0x4 -/* onlyCA true */ -# define IDP_ONLYCA 0x8 -/* onlyattr true */ -# define IDP_ONLYATTR 0x10 -/* indirectCRL true */ -# define IDP_INDIRECT 0x20 -/* onlysomereasons present */ -# define IDP_REASONS 0x40 - -# define X509V3_conf_err(val) ERR_add_error_data(6, \ - "section:", (val)->section, \ - ",name:", (val)->name, ",value:", (val)->value) - -# define X509V3_set_ctx_test(ctx) \ - X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) -# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; - -# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ - 0,0,0,0, \ - 0,0, \ - (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ - (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ - NULL, NULL, \ - table} - -# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ - 0,0,0,0, \ - (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ - (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ - 0,0,0,0, \ - NULL} - -# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - -/* X509_PURPOSE stuff */ - -# define EXFLAG_BCONS 0x1 -# define EXFLAG_KUSAGE 0x2 -# define EXFLAG_XKUSAGE 0x4 -# define EXFLAG_NSCERT 0x8 - -# define EXFLAG_CA 0x10 -/* Really self issued not necessarily self signed */ -# define EXFLAG_SI 0x20 -# define EXFLAG_V1 0x40 -# define EXFLAG_INVALID 0x80 -/* EXFLAG_SET is set to indicate that some values have been precomputed */ -# define EXFLAG_SET 0x100 -# define EXFLAG_CRITICAL 0x200 -# define EXFLAG_PROXY 0x400 - -# define EXFLAG_INVALID_POLICY 0x800 -# define EXFLAG_FRESHEST 0x1000 -/* Self signed */ -# define EXFLAG_SS 0x2000 - -# define KU_DIGITAL_SIGNATURE 0x0080 -# define KU_NON_REPUDIATION 0x0040 -# define KU_KEY_ENCIPHERMENT 0x0020 -# define KU_DATA_ENCIPHERMENT 0x0010 -# define KU_KEY_AGREEMENT 0x0008 -# define KU_KEY_CERT_SIGN 0x0004 -# define KU_CRL_SIGN 0x0002 -# define KU_ENCIPHER_ONLY 0x0001 -# define KU_DECIPHER_ONLY 0x8000 - -# define NS_SSL_CLIENT 0x80 -# define NS_SSL_SERVER 0x40 -# define NS_SMIME 0x20 -# define NS_OBJSIGN 0x10 -# define NS_SSL_CA 0x04 -# define NS_SMIME_CA 0x02 -# define NS_OBJSIGN_CA 0x01 -# define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) - -# define XKU_SSL_SERVER 0x1 -# define XKU_SSL_CLIENT 0x2 -# define XKU_SMIME 0x4 -# define XKU_CODE_SIGN 0x8 -# define XKU_SGC 0x10 -# define XKU_OCSP_SIGN 0x20 -# define XKU_TIMESTAMP 0x40 -# define XKU_DVCS 0x80 -# define XKU_ANYEKU 0x100 - -# define X509_PURPOSE_DYNAMIC 0x1 -# define X509_PURPOSE_DYNAMIC_NAME 0x2 - -typedef struct x509_purpose_st { - int purpose; - int trust; /* Default trust ID */ - int flags; - int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); - char *name; - char *sname; - void *usr_data; -} X509_PURPOSE; - -# define X509_PURPOSE_SSL_CLIENT 1 -# define X509_PURPOSE_SSL_SERVER 2 -# define X509_PURPOSE_NS_SSL_SERVER 3 -# define X509_PURPOSE_SMIME_SIGN 4 -# define X509_PURPOSE_SMIME_ENCRYPT 5 -# define X509_PURPOSE_CRL_SIGN 6 -# define X509_PURPOSE_ANY 7 -# define X509_PURPOSE_OCSP_HELPER 8 -# define X509_PURPOSE_TIMESTAMP_SIGN 9 - -# define X509_PURPOSE_MIN 1 -# define X509_PURPOSE_MAX 9 - -/* Flags for X509V3_EXT_print() */ - -# define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) -/* Return error for unknown extensions */ -# define X509V3_EXT_DEFAULT 0 -/* Print error for unknown extensions */ -# define X509V3_EXT_ERROR_UNKNOWN (1L << 16) -/* ASN1 parse unknown extensions */ -# define X509V3_EXT_PARSE_UNKNOWN (2L << 16) -/* BIO_dump unknown extensions */ -# define X509V3_EXT_DUMP_UNKNOWN (3L << 16) - -/* Flags for X509V3_add1_i2d */ - -# define X509V3_ADD_OP_MASK 0xfL -# define X509V3_ADD_DEFAULT 0L -# define X509V3_ADD_APPEND 1L -# define X509V3_ADD_REPLACE 2L -# define X509V3_ADD_REPLACE_EXISTING 3L -# define X509V3_ADD_KEEP_EXISTING 4L -# define X509V3_ADD_DELETE 5L -# define X509V3_ADD_SILENT 0x10 - -DEFINE_STACK_OF(X509_PURPOSE) - -DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) - -DECLARE_ASN1_FUNCTIONS(SXNET) -DECLARE_ASN1_FUNCTIONS(SXNETID) - -int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); -int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, - int userlen); -int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, - int userlen); - -ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); -ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); -ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); - -DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) - -DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) - -DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) -GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); -int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); - -ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, - STACK_OF(CONF_VALUE) *nval); -STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, - ASN1_BIT_STRING *bits, - STACK_OF(CONF_VALUE) *extlist); -char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); -ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, const char *str); - -STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, - GENERAL_NAME *gen, - STACK_OF(CONF_VALUE) *ret); -int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); - -DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) - -STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, - GENERAL_NAMES *gen, - STACK_OF(CONF_VALUE) *extlist); -GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); - -DECLARE_ASN1_FUNCTIONS(OTHERNAME) -DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) -int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); -void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); -void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); -int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, - ASN1_OBJECT *oid, ASN1_TYPE *value); -int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, - ASN1_OBJECT **poid, ASN1_TYPE **pvalue); - -char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, - const ASN1_OCTET_STRING *ia5); -ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, const char *str); - -DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) -int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); - -DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) - -DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) -DECLARE_ASN1_FUNCTIONS(POLICYINFO) -DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) -DECLARE_ASN1_FUNCTIONS(USERNOTICE) -DECLARE_ASN1_FUNCTIONS(NOTICEREF) - -DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) -DECLARE_ASN1_FUNCTIONS(DIST_POINT) -DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) -DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) - -int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); - -int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); -int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); - -DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) -DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) - -DECLARE_ASN1_ITEM(POLICY_MAPPING) -DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) -DECLARE_ASN1_ITEM(POLICY_MAPPINGS) - -DECLARE_ASN1_ITEM(GENERAL_SUBTREE) -DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) - -DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) -DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) - -DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) -DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) - -GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, - const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, int gen_type, - const char *value, int is_nc); - -# ifdef HEADER_CONF_H -GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, CONF_VALUE *cnf); -GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, - const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, CONF_VALUE *cnf, - int is_nc); -void X509V3_conf_free(CONF_VALUE *val); - -X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, - const char *value); -X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, - const char *value); -int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, - STACK_OF(X509_EXTENSION) **sk); -int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509 *cert); -int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509_REQ *req); -int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509_CRL *crl); - -X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, - X509V3_CTX *ctx, int ext_nid, - const char *value); -X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *name, const char *value); -int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509 *cert); -int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509_REQ *req); -int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509_CRL *crl); - -int X509V3_add_value_bool_nf(const char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); -int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); -void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); -void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); -# endif - -char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); -STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); -void X509V3_string_free(X509V3_CTX *ctx, char *str); -void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); -void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, - X509_REQ *req, X509_CRL *crl, int flags); - -int X509V3_add_value(const char *name, const char *value, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_uchar(const char *name, const unsigned char *value, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_bool(const char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, - STACK_OF(CONF_VALUE) **extlist); -char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); -ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); -char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); -char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, - const ASN1_ENUMERATED *aint); -int X509V3_EXT_add(X509V3_EXT_METHOD *ext); -int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); -int X509V3_EXT_add_alias(int nid_to, int nid_from); -void X509V3_EXT_cleanup(void); - -const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); -const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); -int X509V3_add_standard_extensions(void); -STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); -void *X509V3_EXT_d2i(X509_EXTENSION *ext); -void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, - int *idx); - -X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); -int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, - int crit, unsigned long flags); - -#if OPENSSL_API_COMPAT < 0x10100000L -/* The new declarations are in crypto.h, but the old ones were here. */ -# define hex_to_string OPENSSL_buf2hexstr -# define string_to_hex OPENSSL_hexstr2buf -#endif - -void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, - int ml); -int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, - int indent); -#ifndef OPENSSL_NO_STDIO -int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); -#endif -int X509V3_extensions_print(BIO *out, const char *title, - const STACK_OF(X509_EXTENSION) *exts, - unsigned long flag, int indent); - -int X509_check_ca(X509 *x); -int X509_check_purpose(X509 *x, int id, int ca); -int X509_supported_extension(X509_EXTENSION *ex); -int X509_PURPOSE_set(int *p, int purpose); -int X509_check_issued(X509 *issuer, X509 *subject); -int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); -void X509_set_proxy_flag(X509 *x); -void X509_set_proxy_pathlen(X509 *x, long l); -long X509_get_proxy_pathlen(X509 *x); - -uint32_t X509_get_extension_flags(X509 *x); -uint32_t X509_get_key_usage(X509 *x); -uint32_t X509_get_extended_key_usage(X509 *x); -const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); -const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); -const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); -const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); - -int X509_PURPOSE_get_count(void); -X509_PURPOSE *X509_PURPOSE_get0(int idx); -int X509_PURPOSE_get_by_sname(const char *sname); -int X509_PURPOSE_get_by_id(int id); -int X509_PURPOSE_add(int id, int trust, int flags, - int (*ck) (const X509_PURPOSE *, const X509 *, int), - const char *name, const char *sname, void *arg); -char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); -char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); -int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); -void X509_PURPOSE_cleanup(void); -int X509_PURPOSE_get_id(const X509_PURPOSE *); - -STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); -STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); -void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); -STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); -/* Flags for X509_check_* functions */ - -/* - * Always check subject name for host match even if subject alt names present - */ -# define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 -/* Disable wildcard matching for dnsName fields and common name. */ -# define X509_CHECK_FLAG_NO_WILDCARDS 0x2 -/* Wildcards must not match a partial label. */ -# define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 -/* Allow (non-partial) wildcards to match multiple labels. */ -# define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 -/* Constraint verifier subdomain patterns to match a single labels. */ -# define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 -/* Never check the subject CN */ -# define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 -/* - * Match reference identifiers starting with "." to any sub-domain. - * This is a non-public flag, turned on implicitly when the subject - * reference identity is a DNS name. - */ -# define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 - -int X509_check_host(X509 *x, const char *chk, size_t chklen, - unsigned int flags, char **peername); -int X509_check_email(X509 *x, const char *chk, size_t chklen, - unsigned int flags); -int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags); -int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); - -ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); -ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); -int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, - unsigned long chtype); - -void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); -DEFINE_STACK_OF(X509_POLICY_NODE) - -#ifndef OPENSSL_NO_RFC3779 -typedef struct ASRange_st { - ASN1_INTEGER *min, *max; -} ASRange; - -# define ASIdOrRange_id 0 -# define ASIdOrRange_range 1 - -typedef struct ASIdOrRange_st { - int type; - union { - ASN1_INTEGER *id; - ASRange *range; - } u; -} ASIdOrRange; - -typedef STACK_OF(ASIdOrRange) ASIdOrRanges; -DEFINE_STACK_OF(ASIdOrRange) - -# define ASIdentifierChoice_inherit 0 -# define ASIdentifierChoice_asIdsOrRanges 1 - -typedef struct ASIdentifierChoice_st { - int type; - union { - ASN1_NULL *inherit; - ASIdOrRanges *asIdsOrRanges; - } u; -} ASIdentifierChoice; - -typedef struct ASIdentifiers_st { - ASIdentifierChoice *asnum, *rdi; -} ASIdentifiers; - -DECLARE_ASN1_FUNCTIONS(ASRange) -DECLARE_ASN1_FUNCTIONS(ASIdOrRange) -DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) -DECLARE_ASN1_FUNCTIONS(ASIdentifiers) - -typedef struct IPAddressRange_st { - ASN1_BIT_STRING *min, *max; -} IPAddressRange; - -# define IPAddressOrRange_addressPrefix 0 -# define IPAddressOrRange_addressRange 1 - -typedef struct IPAddressOrRange_st { - int type; - union { - ASN1_BIT_STRING *addressPrefix; - IPAddressRange *addressRange; - } u; -} IPAddressOrRange; - -typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; -DEFINE_STACK_OF(IPAddressOrRange) - -# define IPAddressChoice_inherit 0 -# define IPAddressChoice_addressesOrRanges 1 - -typedef struct IPAddressChoice_st { - int type; - union { - ASN1_NULL *inherit; - IPAddressOrRanges *addressesOrRanges; - } u; -} IPAddressChoice; - -typedef struct IPAddressFamily_st { - ASN1_OCTET_STRING *addressFamily; - IPAddressChoice *ipAddressChoice; -} IPAddressFamily; - -typedef STACK_OF(IPAddressFamily) IPAddrBlocks; -DEFINE_STACK_OF(IPAddressFamily) - -DECLARE_ASN1_FUNCTIONS(IPAddressRange) -DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) -DECLARE_ASN1_FUNCTIONS(IPAddressChoice) -DECLARE_ASN1_FUNCTIONS(IPAddressFamily) - -/* - * API tag for elements of the ASIdentifer SEQUENCE. - */ -# define V3_ASID_ASNUM 0 -# define V3_ASID_RDI 1 - -/* - * AFI values, assigned by IANA. It'd be nice to make the AFI - * handling code totally generic, but there are too many little things - * that would need to be defined for other address families for it to - * be worth the trouble. - */ -# define IANA_AFI_IPV4 1 -# define IANA_AFI_IPV6 2 - -/* - * Utilities to construct and extract values from RFC3779 extensions, - * since some of the encodings (particularly for IP address prefixes - * and ranges) are a bit tedious to work with directly. - */ -int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); -int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, - ASN1_INTEGER *min, ASN1_INTEGER *max); -int X509v3_addr_add_inherit(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi); -int X509v3_addr_add_prefix(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi, - unsigned char *a, const int prefixlen); -int X509v3_addr_add_range(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi, - unsigned char *min, unsigned char *max); -unsigned X509v3_addr_get_afi(const IPAddressFamily *f); -int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, - unsigned char *min, unsigned char *max, - const int length); - -/* - * Canonical forms. - */ -int X509v3_asid_is_canonical(ASIdentifiers *asid); -int X509v3_addr_is_canonical(IPAddrBlocks *addr); -int X509v3_asid_canonize(ASIdentifiers *asid); -int X509v3_addr_canonize(IPAddrBlocks *addr); - -/* - * Tests for inheritance and containment. - */ -int X509v3_asid_inherits(ASIdentifiers *asid); -int X509v3_addr_inherits(IPAddrBlocks *addr); -int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); -int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); - -/* - * Check whether RFC 3779 extensions nest properly in chains. - */ -int X509v3_asid_validate_path(X509_STORE_CTX *); -int X509v3_addr_validate_path(X509_STORE_CTX *); -int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, - ASIdentifiers *ext, - int allow_inheritance); -int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, - IPAddrBlocks *ext, int allow_inheritance); - -#endif /* OPENSSL_NO_RFC3779 */ - -DEFINE_STACK_OF(ASN1_STRING) - -/* - * Admission Syntax - */ -typedef struct NamingAuthority_st NAMING_AUTHORITY; -typedef struct ProfessionInfo_st PROFESSION_INFO; -typedef struct Admissions_st ADMISSIONS; -typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; -DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) -DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) -DECLARE_ASN1_FUNCTIONS(ADMISSIONS) -DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) -DEFINE_STACK_OF(ADMISSIONS) -DEFINE_STACK_OF(PROFESSION_INFO) -typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; - -const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( - const NAMING_AUTHORITY *n); -const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( - const NAMING_AUTHORITY *n); -const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( - const NAMING_AUTHORITY *n); -void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, - ASN1_OBJECT* namingAuthorityId); -void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, - ASN1_IA5STRING* namingAuthorityUrl); -void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, - ASN1_STRING* namingAuthorityText); - -const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( - const ADMISSION_SYNTAX *as); -void ADMISSION_SYNTAX_set0_admissionAuthority( - ADMISSION_SYNTAX *as, GENERAL_NAME *aa); -const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( - const ADMISSION_SYNTAX *as); -void ADMISSION_SYNTAX_set0_contentsOfAdmissions( - ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); -const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); -void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); -const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); -void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); -const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); -void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); -const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_addProfessionInfo( - PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); -const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_namingAuthority( - PROFESSION_INFO *pi, NAMING_AUTHORITY *na); -const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_professionItems( - PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); -const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_professionOIDs( - PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); -const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_registrationNumber( - PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509v3err.h b/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509v3err.h deleted file mode 100644 index 5f25442f..00000000 --- a/Hin2n/src/main/jniLibs/armeabi-v7a/include/openssl/x509v3err.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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_X509V3ERR_H -# define HEADER_X509V3ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_X509V3_strings(void); - -/* - * X509V3 function codes. - */ -# define X509V3_F_A2I_GENERAL_NAME 164 -# define X509V3_F_ADDR_VALIDATE_PATH_INTERNAL 166 -# define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 -# define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 -# define X509V3_F_BIGNUM_TO_STRING 167 -# define X509V3_F_COPY_EMAIL 122 -# define X509V3_F_COPY_ISSUER 123 -# define X509V3_F_DO_DIRNAME 144 -# define X509V3_F_DO_EXT_I2D 135 -# define X509V3_F_DO_EXT_NCONF 151 -# define X509V3_F_GNAMES_FROM_SECTNAME 156 -# define X509V3_F_I2S_ASN1_ENUMERATED 121 -# define X509V3_F_I2S_ASN1_IA5STRING 149 -# define X509V3_F_I2S_ASN1_INTEGER 120 -# define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 -# define X509V3_F_LEVEL_ADD_NODE 168 -# define X509V3_F_NOTICE_SECTION 132 -# define X509V3_F_NREF_NOS 133 -# define X509V3_F_POLICY_CACHE_CREATE 169 -# define X509V3_F_POLICY_CACHE_NEW 170 -# define X509V3_F_POLICY_DATA_NEW 171 -# define X509V3_F_POLICY_SECTION 131 -# define X509V3_F_PROCESS_PCI_VALUE 150 -# define X509V3_F_R2I_CERTPOL 130 -# define X509V3_F_R2I_PCI 155 -# define X509V3_F_S2I_ASN1_IA5STRING 100 -# define X509V3_F_S2I_ASN1_INTEGER 108 -# define X509V3_F_S2I_ASN1_OCTET_STRING 112 -# define X509V3_F_S2I_SKEY_ID 115 -# define X509V3_F_SET_DIST_POINT_NAME 158 -# define X509V3_F_SXNET_ADD_ID_ASC 125 -# define X509V3_F_SXNET_ADD_ID_INTEGER 126 -# define X509V3_F_SXNET_ADD_ID_ULONG 127 -# define X509V3_F_SXNET_GET_ID_ASC 128 -# define X509V3_F_SXNET_GET_ID_ULONG 129 -# define X509V3_F_TREE_INIT 172 -# define X509V3_F_V2I_ASIDENTIFIERS 163 -# define X509V3_F_V2I_ASN1_BIT_STRING 101 -# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 -# define X509V3_F_V2I_AUTHORITY_KEYID 119 -# define X509V3_F_V2I_BASIC_CONSTRAINTS 102 -# define X509V3_F_V2I_CRLD 134 -# define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 -# define X509V3_F_V2I_GENERAL_NAMES 118 -# define X509V3_F_V2I_GENERAL_NAME_EX 117 -# define X509V3_F_V2I_IDP 157 -# define X509V3_F_V2I_IPADDRBLOCKS 159 -# define X509V3_F_V2I_ISSUER_ALT 153 -# define X509V3_F_V2I_NAME_CONSTRAINTS 147 -# define X509V3_F_V2I_POLICY_CONSTRAINTS 146 -# define X509V3_F_V2I_POLICY_MAPPINGS 145 -# define X509V3_F_V2I_SUBJECT_ALT 154 -# define X509V3_F_V2I_TLS_FEATURE 165 -# define X509V3_F_V3_GENERIC_EXTENSION 116 -# define X509V3_F_X509V3_ADD1_I2D 140 -# define X509V3_F_X509V3_ADD_VALUE 105 -# define X509V3_F_X509V3_EXT_ADD 104 -# define X509V3_F_X509V3_EXT_ADD_ALIAS 106 -# define X509V3_F_X509V3_EXT_I2D 136 -# define X509V3_F_X509V3_EXT_NCONF 152 -# define X509V3_F_X509V3_GET_SECTION 142 -# define X509V3_F_X509V3_GET_STRING 143 -# define X509V3_F_X509V3_GET_VALUE_BOOL 110 -# define X509V3_F_X509V3_PARSE_LIST 109 -# define X509V3_F_X509_PURPOSE_ADD 137 -# define X509V3_F_X509_PURPOSE_SET 141 - -/* - * X509V3 reason codes. - */ -# define X509V3_R_BAD_IP_ADDRESS 118 -# define X509V3_R_BAD_OBJECT 119 -# define X509V3_R_BN_DEC2BN_ERROR 100 -# define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 -# define X509V3_R_DIRNAME_ERROR 149 -# define X509V3_R_DISTPOINT_ALREADY_SET 160 -# define X509V3_R_DUPLICATE_ZONE_ID 133 -# define X509V3_R_ERROR_CONVERTING_ZONE 131 -# define X509V3_R_ERROR_CREATING_EXTENSION 144 -# define X509V3_R_ERROR_IN_EXTENSION 128 -# define X509V3_R_EXPECTED_A_SECTION_NAME 137 -# define X509V3_R_EXTENSION_EXISTS 145 -# define X509V3_R_EXTENSION_NAME_ERROR 115 -# define X509V3_R_EXTENSION_NOT_FOUND 102 -# define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 -# define X509V3_R_EXTENSION_VALUE_ERROR 116 -# define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 -# define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 -# define X509V3_R_INVALID_ASNUMBER 162 -# define X509V3_R_INVALID_ASRANGE 163 -# define X509V3_R_INVALID_BOOLEAN_STRING 104 -# define X509V3_R_INVALID_EXTENSION_STRING 105 -# define X509V3_R_INVALID_INHERITANCE 165 -# define X509V3_R_INVALID_IPADDRESS 166 -# define X509V3_R_INVALID_MULTIPLE_RDNS 161 -# define X509V3_R_INVALID_NAME 106 -# define X509V3_R_INVALID_NULL_ARGUMENT 107 -# define X509V3_R_INVALID_NULL_NAME 108 -# define X509V3_R_INVALID_NULL_VALUE 109 -# define X509V3_R_INVALID_NUMBER 140 -# define X509V3_R_INVALID_NUMBERS 141 -# define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 -# define X509V3_R_INVALID_OPTION 138 -# define X509V3_R_INVALID_POLICY_IDENTIFIER 134 -# define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 -# define X509V3_R_INVALID_PURPOSE 146 -# define X509V3_R_INVALID_SAFI 164 -# define X509V3_R_INVALID_SECTION 135 -# define X509V3_R_INVALID_SYNTAX 143 -# define X509V3_R_ISSUER_DECODE_ERROR 126 -# define X509V3_R_MISSING_VALUE 124 -# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 -# define X509V3_R_NO_CONFIG_DATABASE 136 -# define X509V3_R_NO_ISSUER_CERTIFICATE 121 -# define X509V3_R_NO_ISSUER_DETAILS 127 -# define X509V3_R_NO_POLICY_IDENTIFIER 139 -# define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 -# define X509V3_R_NO_PUBLIC_KEY 114 -# define X509V3_R_NO_SUBJECT_DETAILS 125 -# define X509V3_R_OPERATION_NOT_DEFINED 148 -# define X509V3_R_OTHERNAME_ERROR 147 -# define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 -# define X509V3_R_POLICY_PATH_LENGTH 156 -# define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 -# define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 -# define X509V3_R_SECTION_NOT_FOUND 150 -# define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 -# define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 -# define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 -# define X509V3_R_UNKNOWN_EXTENSION 129 -# define X509V3_R_UNKNOWN_EXTENSION_NAME 130 -# define X509V3_R_UNKNOWN_OPTION 120 -# define X509V3_R_UNSUPPORTED_OPTION 117 -# define X509V3_R_UNSUPPORTED_TYPE 167 -# define X509V3_R_USER_TOO_LONG 132 - -#endif diff --git a/Hin2n/src/main/jniLibs/armeabi-v7a/libcrypto.so b/Hin2n/src/main/jniLibs/armeabi-v7a/libcrypto.so deleted file mode 100644 index 56aa5d21..00000000 Binary files a/Hin2n/src/main/jniLibs/armeabi-v7a/libcrypto.so and /dev/null differ diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/aes.h b/Hin2n/src/main/jniLibs/x86/include/openssl/aes.h deleted file mode 100644 index 245c552a..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/aes.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_AES_H -# define HEADER_AES_H - -# include - -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define AES_ENCRYPT 1 -# define AES_DECRYPT 0 - -/* - * Because array size can't be a const in C, the following two are macros. - * Both sizes are in bytes. - */ -# define AES_MAXNR 14 -# define AES_BLOCK_SIZE 16 - -/* This should be a hidden type, but EVP requires that the size be known */ -struct aes_key_st { -# ifdef AES_LONG - unsigned long rd_key[4 * (AES_MAXNR + 1)]; -# else - unsigned int rd_key[4 * (AES_MAXNR + 1)]; -# endif - int rounds; -}; -typedef struct aes_key_st AES_KEY; - -const char *AES_options(void); - -int AES_set_encrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); -int AES_set_decrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); - -void AES_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); -void AES_decrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); - -void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key, const int enc); -void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, const int enc); -void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num); -/* NB: the IV is _two_ blocks long */ -void AES_ige_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, const int enc); -/* NB: the IV is _four_ blocks long */ -void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - const AES_KEY *key2, const unsigned char *ivec, - const int enc); - -int AES_wrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); -int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); - - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/asn1.h b/Hin2n/src/main/jniLibs/x86/include/openssl/asn1.h deleted file mode 100644 index 9522eec1..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/asn1.h +++ /dev/null @@ -1,886 +0,0 @@ -/* - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_ASN1_H -# define HEADER_ASN1_H - -# include -# include -# include -# include -# include -# include -# include - -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -# define V_ASN1_UNIVERSAL 0x00 -# define V_ASN1_APPLICATION 0x40 -# define V_ASN1_CONTEXT_SPECIFIC 0x80 -# define V_ASN1_PRIVATE 0xc0 - -# define V_ASN1_CONSTRUCTED 0x20 -# define V_ASN1_PRIMITIVE_TAG 0x1f -# define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG - -# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */ -# define V_ASN1_OTHER -3/* used in ASN1_TYPE */ -# define V_ASN1_ANY -4/* used in ASN1 template code */ - -# define V_ASN1_UNDEF -1 -/* ASN.1 tag values */ -# define V_ASN1_EOC 0 -# define V_ASN1_BOOLEAN 1 /**/ -# define V_ASN1_INTEGER 2 -# define V_ASN1_BIT_STRING 3 -# define V_ASN1_OCTET_STRING 4 -# define V_ASN1_NULL 5 -# define V_ASN1_OBJECT 6 -# define V_ASN1_OBJECT_DESCRIPTOR 7 -# define V_ASN1_EXTERNAL 8 -# define V_ASN1_REAL 9 -# define V_ASN1_ENUMERATED 10 -# define V_ASN1_UTF8STRING 12 -# define V_ASN1_SEQUENCE 16 -# define V_ASN1_SET 17 -# define V_ASN1_NUMERICSTRING 18 /**/ -# define V_ASN1_PRINTABLESTRING 19 -# define V_ASN1_T61STRING 20 -# define V_ASN1_TELETEXSTRING 20/* alias */ -# define V_ASN1_VIDEOTEXSTRING 21 /**/ -# define V_ASN1_IA5STRING 22 -# define V_ASN1_UTCTIME 23 -# define V_ASN1_GENERALIZEDTIME 24 /**/ -# define V_ASN1_GRAPHICSTRING 25 /**/ -# define V_ASN1_ISO64STRING 26 /**/ -# define V_ASN1_VISIBLESTRING 26/* alias */ -# define V_ASN1_GENERALSTRING 27 /**/ -# define V_ASN1_UNIVERSALSTRING 28 /**/ -# define V_ASN1_BMPSTRING 30 - -/* - * NB the constants below are used internally by ASN1_INTEGER - * and ASN1_ENUMERATED to indicate the sign. They are *not* on - * the wire tag values. - */ - -# define V_ASN1_NEG 0x100 -# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) -# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) - -/* For use with d2i_ASN1_type_bytes() */ -# define B_ASN1_NUMERICSTRING 0x0001 -# define B_ASN1_PRINTABLESTRING 0x0002 -# define B_ASN1_T61STRING 0x0004 -# define B_ASN1_TELETEXSTRING 0x0004 -# define B_ASN1_VIDEOTEXSTRING 0x0008 -# define B_ASN1_IA5STRING 0x0010 -# define B_ASN1_GRAPHICSTRING 0x0020 -# define B_ASN1_ISO64STRING 0x0040 -# define B_ASN1_VISIBLESTRING 0x0040 -# define B_ASN1_GENERALSTRING 0x0080 -# define B_ASN1_UNIVERSALSTRING 0x0100 -# define B_ASN1_OCTET_STRING 0x0200 -# define B_ASN1_BIT_STRING 0x0400 -# define B_ASN1_BMPSTRING 0x0800 -# define B_ASN1_UNKNOWN 0x1000 -# define B_ASN1_UTF8STRING 0x2000 -# define B_ASN1_UTCTIME 0x4000 -# define B_ASN1_GENERALIZEDTIME 0x8000 -# define B_ASN1_SEQUENCE 0x10000 -/* For use with ASN1_mbstring_copy() */ -# define MBSTRING_FLAG 0x1000 -# define MBSTRING_UTF8 (MBSTRING_FLAG) -# define MBSTRING_ASC (MBSTRING_FLAG|1) -# define MBSTRING_BMP (MBSTRING_FLAG|2) -# define MBSTRING_UNIV (MBSTRING_FLAG|4) -# define SMIME_OLDMIME 0x400 -# define SMIME_CRLFEOL 0x800 -# define SMIME_STREAM 0x1000 - struct X509_algor_st; -DEFINE_STACK_OF(X509_ALGOR) - -# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */ -/* - * This indicates that the ASN1_STRING is not a real value but just a place - * holder for the location where indefinite length constructed data should be - * inserted in the memory buffer - */ -# define ASN1_STRING_FLAG_NDEF 0x010 - -/* - * This flag is used by the CMS code to indicate that a string is not - * complete and is a place holder for content when it had all been accessed. - * The flag will be reset when content has been written to it. - */ - -# define ASN1_STRING_FLAG_CONT 0x020 -/* - * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING - * type. - */ -# define ASN1_STRING_FLAG_MSTRING 0x040 -/* String is embedded and only content should be freed */ -# define ASN1_STRING_FLAG_EMBED 0x080 -/* String should be parsed in RFC 5280's time format */ -# define ASN1_STRING_FLAG_X509_TIME 0x100 -/* This is the base type that holds just about everything :-) */ -struct asn1_string_st { - int length; - int type; - unsigned char *data; - /* - * The value of the following field depends on the type being held. It - * is mostly being used for BIT_STRING so if the input data has a - * non-zero 'unused bits' value, it will be handled correctly - */ - long flags; -}; - -/* - * ASN1_ENCODING structure: this is used to save the received encoding of an - * ASN1 type. This is useful to get round problems with invalid encodings - * which can break signatures. - */ - -typedef struct ASN1_ENCODING_st { - unsigned char *enc; /* DER encoding */ - long len; /* Length of encoding */ - int modified; /* set to 1 if 'enc' is invalid */ -} ASN1_ENCODING; - -/* Used with ASN1 LONG type: if a long is set to this it is omitted */ -# define ASN1_LONG_UNDEF 0x7fffffffL - -# define STABLE_FLAGS_MALLOC 0x01 -/* - * A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted - * as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting - * STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias - * STABLE_FLAGS_CLEAR to reflect this. - */ -# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC -# define STABLE_NO_MASK 0x02 -# define DIRSTRING_TYPE \ - (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) -# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) - -typedef struct asn1_string_table_st { - int nid; - long minsize; - long maxsize; - unsigned long mask; - unsigned long flags; -} ASN1_STRING_TABLE; - -DEFINE_STACK_OF(ASN1_STRING_TABLE) - -/* size limits: this stuff is taken straight from RFC2459 */ - -# define ub_name 32768 -# define ub_common_name 64 -# define ub_locality_name 128 -# define ub_state_name 128 -# define ub_organization_name 64 -# define ub_organization_unit_name 64 -# define ub_title 64 -# define ub_email_address 128 - -/* - * Declarations for template structures: for full definitions see asn1t.h - */ -typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; -typedef struct ASN1_TLC_st ASN1_TLC; -/* This is just an opaque pointer */ -typedef struct ASN1_VALUE_st ASN1_VALUE; - -/* Declare ASN1 functions: the implement macro in in asn1t.h */ - -# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) - -# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) - -# define DECLARE_ASN1_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) - -# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) - -# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ - type *d2i_##name(type **a, const unsigned char **in, long len); \ - int i2d_##name(type *a, unsigned char **out); \ - DECLARE_ASN1_ITEM(itname) - -# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ - type *d2i_##name(type **a, const unsigned char **in, long len); \ - int i2d_##name(const type *a, unsigned char **out); \ - DECLARE_ASN1_ITEM(name) - -# define DECLARE_ASN1_NDEF_FUNCTION(name) \ - int i2d_##name##_NDEF(name *a, unsigned char **out); - -# define DECLARE_ASN1_FUNCTIONS_const(name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) - -# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - type *name##_new(void); \ - void name##_free(type *a); - -# define DECLARE_ASN1_PRINT_FUNCTION(stname) \ - DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) - -# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ - int fname##_print_ctx(BIO *out, stname *x, int indent, \ - const ASN1_PCTX *pctx); - -# define D2I_OF(type) type *(*)(type **,const unsigned char **,long) -# define I2D_OF(type) int (*)(type *,unsigned char **) -# define I2D_OF_const(type) int (*)(const type *,unsigned char **) - -# define CHECKED_D2I_OF(type, d2i) \ - ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) -# define CHECKED_I2D_OF(type, i2d) \ - ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) -# define CHECKED_NEW_OF(type, xnew) \ - ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) -# define CHECKED_PTR_OF(type, p) \ - ((void*) (1 ? p : (type*)0)) -# define CHECKED_PPTR_OF(type, p) \ - ((void**) (1 ? p : (type**)0)) - -# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) -# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) -# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) - -TYPEDEF_D2I2D_OF(void); - -/*- - * The following macros and typedefs allow an ASN1_ITEM - * to be embedded in a structure and referenced. Since - * the ASN1_ITEM pointers need to be globally accessible - * (possibly from shared libraries) they may exist in - * different forms. On platforms that support it the - * ASN1_ITEM structure itself will be globally exported. - * Other platforms will export a function that returns - * an ASN1_ITEM pointer. - * - * To handle both cases transparently the macros below - * should be used instead of hard coding an ASN1_ITEM - * pointer in a structure. - * - * The structure will look like this: - * - * typedef struct SOMETHING_st { - * ... - * ASN1_ITEM_EXP *iptr; - * ... - * } SOMETHING; - * - * It would be initialised as e.g.: - * - * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; - * - * and the actual pointer extracted with: - * - * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); - * - * Finally an ASN1_ITEM pointer can be extracted from an - * appropriate reference with: ASN1_ITEM_rptr(X509). This - * would be used when a function takes an ASN1_ITEM * argument. - * - */ - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM ASN1_ITEM_EXP; - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -# define ASN1_ITEM_ptr(iptr) (iptr) - -/* Macro to include ASN1_ITEM pointer from base type */ -# define ASN1_ITEM_ref(iptr) (&(iptr##_it)) - -# define ASN1_ITEM_rptr(ref) (&(ref##_it)) - -# define DECLARE_ASN1_ITEM(name) \ - OPENSSL_EXTERN const ASN1_ITEM name##_it; - -# else - -/* - * Platforms that can't easily handle shared global variables are declared as - * functions returning ASN1_ITEM pointers. - */ - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM *ASN1_ITEM_EXP (void); - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -# define ASN1_ITEM_ptr(iptr) (iptr()) - -/* Macro to include ASN1_ITEM pointer from base type */ -# define ASN1_ITEM_ref(iptr) (iptr##_it) - -# define ASN1_ITEM_rptr(ref) (ref##_it()) - -# define DECLARE_ASN1_ITEM(name) \ - const ASN1_ITEM * name##_it(void); - -# endif - -/* Parameters used by ASN1_STRING_print_ex() */ - -/* - * These determine which characters to escape: RFC2253 special characters, - * control characters and MSB set characters - */ - -# define ASN1_STRFLGS_ESC_2253 1 -# define ASN1_STRFLGS_ESC_CTRL 2 -# define ASN1_STRFLGS_ESC_MSB 4 - -/* - * This flag determines how we do escaping: normally RC2253 backslash only, - * set this to use backslash and quote. - */ - -# define ASN1_STRFLGS_ESC_QUOTE 8 - -/* These three flags are internal use only. */ - -/* Character is a valid PrintableString character */ -# define CHARTYPE_PRINTABLESTRING 0x10 -/* Character needs escaping if it is the first character */ -# define CHARTYPE_FIRST_ESC_2253 0x20 -/* Character needs escaping if it is the last character */ -# define CHARTYPE_LAST_ESC_2253 0x40 - -/* - * NB the internal flags are safely reused below by flags handled at the top - * level. - */ - -/* - * If this is set we convert all character strings to UTF8 first - */ - -# define ASN1_STRFLGS_UTF8_CONVERT 0x10 - -/* - * If this is set we don't attempt to interpret content: just assume all - * strings are 1 byte per character. This will produce some pretty odd - * looking output! - */ - -# define ASN1_STRFLGS_IGNORE_TYPE 0x20 - -/* If this is set we include the string type in the output */ -# define ASN1_STRFLGS_SHOW_TYPE 0x40 - -/* - * This determines which strings to display and which to 'dump' (hex dump of - * content octets or DER encoding). We can only dump non character strings or - * everything. If we don't dump 'unknown' they are interpreted as character - * strings with 1 octet per character and are subject to the usual escaping - * options. - */ - -# define ASN1_STRFLGS_DUMP_ALL 0x80 -# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 - -/* - * These determine what 'dumping' does, we can dump the content octets or the - * DER encoding: both use the RFC2253 #XXXXX notation. - */ - -# define ASN1_STRFLGS_DUMP_DER 0x200 - -/* - * This flag specifies that RC2254 escaping shall be performed. - */ -#define ASN1_STRFLGS_ESC_2254 0x400 - -/* - * All the string flags consistent with RFC2253, escaping control characters - * isn't essential in RFC2253 but it is advisable anyway. - */ - -# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ - ASN1_STRFLGS_ESC_CTRL | \ - ASN1_STRFLGS_ESC_MSB | \ - ASN1_STRFLGS_UTF8_CONVERT | \ - ASN1_STRFLGS_DUMP_UNKNOWN | \ - ASN1_STRFLGS_DUMP_DER) - -DEFINE_STACK_OF(ASN1_INTEGER) - -DEFINE_STACK_OF(ASN1_GENERALSTRING) - -DEFINE_STACK_OF(ASN1_UTF8STRING) - -typedef struct asn1_type_st { - int type; - union { - char *ptr; - ASN1_BOOLEAN boolean; - ASN1_STRING *asn1_string; - ASN1_OBJECT *object; - ASN1_INTEGER *integer; - ASN1_ENUMERATED *enumerated; - ASN1_BIT_STRING *bit_string; - ASN1_OCTET_STRING *octet_string; - ASN1_PRINTABLESTRING *printablestring; - ASN1_T61STRING *t61string; - ASN1_IA5STRING *ia5string; - ASN1_GENERALSTRING *generalstring; - ASN1_BMPSTRING *bmpstring; - ASN1_UNIVERSALSTRING *universalstring; - ASN1_UTCTIME *utctime; - ASN1_GENERALIZEDTIME *generalizedtime; - ASN1_VISIBLESTRING *visiblestring; - ASN1_UTF8STRING *utf8string; - /* - * set and sequence are left complete and still contain the set or - * sequence bytes - */ - ASN1_STRING *set; - ASN1_STRING *sequence; - ASN1_VALUE *asn1_value; - } value; -} ASN1_TYPE; - -DEFINE_STACK_OF(ASN1_TYPE) - -typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; - -DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) -DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) - -/* This is used to contain a list of bit names */ -typedef struct BIT_STRING_BITNAME_st { - int bitnum; - const char *lname; - const char *sname; -} BIT_STRING_BITNAME; - -# define B_ASN1_TIME \ - B_ASN1_UTCTIME | \ - B_ASN1_GENERALIZEDTIME - -# define B_ASN1_PRINTABLE \ - B_ASN1_NUMERICSTRING| \ - B_ASN1_PRINTABLESTRING| \ - B_ASN1_T61STRING| \ - B_ASN1_IA5STRING| \ - B_ASN1_BIT_STRING| \ - B_ASN1_UNIVERSALSTRING|\ - B_ASN1_BMPSTRING|\ - B_ASN1_UTF8STRING|\ - B_ASN1_SEQUENCE|\ - B_ASN1_UNKNOWN - -# define B_ASN1_DIRECTORYSTRING \ - B_ASN1_PRINTABLESTRING| \ - B_ASN1_TELETEXSTRING|\ - B_ASN1_BMPSTRING|\ - B_ASN1_UNIVERSALSTRING|\ - B_ASN1_UTF8STRING - -# define B_ASN1_DISPLAYTEXT \ - B_ASN1_IA5STRING| \ - B_ASN1_VISIBLESTRING| \ - B_ASN1_BMPSTRING|\ - B_ASN1_UTF8STRING - -DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) - -int ASN1_TYPE_get(const ASN1_TYPE *a); -void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); -int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); -int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); - -ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t); -void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t); - -ASN1_OBJECT *ASN1_OBJECT_new(void); -void ASN1_OBJECT_free(ASN1_OBJECT *a); -int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp); -ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, - long length); - -DECLARE_ASN1_ITEM(ASN1_OBJECT) - -DEFINE_STACK_OF(ASN1_OBJECT) - -ASN1_STRING *ASN1_STRING_new(void); -void ASN1_STRING_free(ASN1_STRING *a); -void ASN1_STRING_clear_free(ASN1_STRING *a); -int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); -ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a); -ASN1_STRING *ASN1_STRING_type_new(int type); -int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); - /* - * Since this is used to store all sorts of things, via macros, for now, - * make its data void * - */ -int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); -void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); -int ASN1_STRING_length(const ASN1_STRING *x); -void ASN1_STRING_length_set(ASN1_STRING *x, int n); -int ASN1_STRING_type(const ASN1_STRING *x); -DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) -const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); - -DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) -int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); -int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); -int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); -int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, - const unsigned char *flags, int flags_len); - -int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, - BIT_STRING_BITNAME *tbl, int indent); -int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); -int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, - BIT_STRING_BITNAME *tbl); - -DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) -ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, - long length); -ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x); -int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); - -DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) - -int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); -ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); -ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, - int offset_day, long offset_sec); -int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); -int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); - -int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); -ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, - time_t t); -ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, - time_t t, int offset_day, - long offset_sec); -int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); - -int ASN1_TIME_diff(int *pday, int *psec, - const ASN1_TIME *from, const ASN1_TIME *to); - -DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) -ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); -int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, - const ASN1_OCTET_STRING *b); -int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, - int len); - -DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_NULL) -DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) - -int UTF8_getc(const unsigned char *str, int len, unsigned long *val); -int UTF8_putc(unsigned char *str, int len, unsigned long value); - -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) - -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) -DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) -DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) -DECLARE_ASN1_FUNCTIONS(ASN1_TIME) - -DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) - -ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); -ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, - int offset_day, long offset_sec); -int ASN1_TIME_check(const ASN1_TIME *t); -ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, - ASN1_GENERALIZEDTIME **out); -int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); -int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str); -int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm); -int ASN1_TIME_normalize(ASN1_TIME *s); -int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t); -int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b); - -int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); -int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); -int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a); -int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); -int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a); -int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); -int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type); -int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a); - -int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); -ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, - const char *sn, const char *ln); - -int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); -int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); -int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); -int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); - -int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); -long ASN1_INTEGER_get(const ASN1_INTEGER *a); -ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); -BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); - -int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); -int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); - - -int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); -long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); -ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); -BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn); - -/* General */ -/* given a string, return the correct type, max is the maximum length */ -int ASN1_PRINTABLE_type(const unsigned char *s, int max); - -unsigned long ASN1_tag2bit(int tag); - -/* SPECIALS */ -int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, - int *pclass, long omax); -int ASN1_check_infinite_end(unsigned char **p, long len); -int ASN1_const_check_infinite_end(const unsigned char **p, long len); -void ASN1_put_object(unsigned char **pp, int constructed, int length, - int tag, int xclass); -int ASN1_put_eoc(unsigned char **pp); -int ASN1_object_size(int constructed, int length, int tag); - -/* Used to implement other functions */ -void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); - -# define ASN1_dup_of(type,i2d,d2i,x) \ - ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ - CHECKED_D2I_OF(type, d2i), \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_dup_of_const(type,i2d,d2i,x) \ - ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ - CHECKED_D2I_OF(type, d2i), \ - CHECKED_PTR_OF(const type, x))) - -void *ASN1_item_dup(const ASN1_ITEM *it, void *x); - -/* ASN1 alloc/free macros for when a type is only used internally */ - -# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) -# define M_ASN1_free_of(x, type) \ - ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) - -# ifndef OPENSSL_NO_STDIO -void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x); - -# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ - ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ - CHECKED_D2I_OF(type, d2i), \ - in, \ - CHECKED_PPTR_OF(type, x))) - -void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); -int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x); - -# define ASN1_i2d_fp_of(type,i2d,out,x) \ - (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ - out, \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_i2d_fp_of_const(type,i2d,out,x) \ - (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ - out, \ - CHECKED_PTR_OF(const type, x))) - -int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); -int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); -# endif - -int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in); - -void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x); - -# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ - ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ - CHECKED_D2I_OF(type, d2i), \ - in, \ - CHECKED_PPTR_OF(type, x))) - -void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); -int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x); - -# define ASN1_i2d_bio_of(type,i2d,out,x) \ - (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ - out, \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_i2d_bio_of_const(type,i2d,out,x) \ - (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ - out, \ - CHECKED_PTR_OF(const type, x))) - -int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); -int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); -int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); -int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); -int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); -int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); -int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off); -int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, - unsigned char *buf, int off); -int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); -int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, - int dump); -const char *ASN1_tag2str(int tag); - -/* Used to load and write Netscape format cert */ - -int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); - -int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); -int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len); -int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, - unsigned char *data, int len); -int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, - unsigned char *data, int max_len); - -void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it); - -ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, - ASN1_OCTET_STRING **oct); - -void ASN1_STRING_set_default_mask(unsigned long mask); -int ASN1_STRING_set_default_mask_asc(const char *p); -unsigned long ASN1_STRING_get_default_mask(void); -int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask); -int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask, - long minsize, long maxsize); - -ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, - const unsigned char *in, int inlen, - int inform, int nid); -ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); -int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); -void ASN1_STRING_TABLE_cleanup(void); - -/* ASN1 template functions */ - -/* Old API compatible functions */ -ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); -void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); -ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, - long len, const ASN1_ITEM *it); -int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); -int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, - const ASN1_ITEM *it); - -void ASN1_add_oid_module(void); -void ASN1_add_stable_module(void); - -ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf); -ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf); -int ASN1_str2mask(const char *str, unsigned long *pmask); - -/* ASN1 Print flags */ - -/* Indicate missing OPTIONAL fields */ -# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 -/* Mark start and end of SEQUENCE */ -# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 -/* Mark start and end of SEQUENCE/SET OF */ -# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 -/* Show the ASN1 type of primitives */ -# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 -/* Don't show ASN1 type of ANY */ -# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 -/* Don't show ASN1 type of MSTRINGs */ -# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 -/* Don't show field names in SEQUENCE */ -# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 -/* Show structure names of each SEQUENCE field */ -# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 -/* Don't show structure name even at top level */ -# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 - -int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, - const ASN1_ITEM *it, const ASN1_PCTX *pctx); -ASN1_PCTX *ASN1_PCTX_new(void); -void ASN1_PCTX_free(ASN1_PCTX *p); -unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); - -ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx)); -void ASN1_SCTX_free(ASN1_SCTX *p); -const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p); -const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p); -unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); -void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); -void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); - -const BIO_METHOD *BIO_f_asn1(void); - -BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); - -int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, - const ASN1_ITEM *it); -int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, - const char *hdr, const ASN1_ITEM *it); -int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, - int ctype_nid, int econt_nid, - STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); -ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); -int SMIME_crlf_copy(BIO *in, BIO *out, int flags); -int SMIME_text(BIO *in, BIO *out); - -const ASN1_ITEM *ASN1_ITEM_lookup(const char *name); -const ASN1_ITEM *ASN1_ITEM_get(size_t i); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/asn1_mac.h b/Hin2n/src/main/jniLibs/x86/include/openssl/asn1_mac.h deleted file mode 100644 index 7ac1782a..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/asn1_mac.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2015-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 - */ - -#error "This file is obsolete; please update your software." diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/asn1err.h b/Hin2n/src/main/jniLibs/x86/include/openssl/asn1err.h deleted file mode 100644 index faed5a55..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/asn1err.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - * 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_ASN1ERR_H -# define HEADER_ASN1ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# 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_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_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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/asn1t.h b/Hin2n/src/main/jniLibs/x86/include/openssl/asn1t.h deleted file mode 100644 index a450ba0d..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/asn1t.h +++ /dev/null @@ -1,945 +0,0 @@ -/* - * Copyright 2000-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_ASN1T_H -# define HEADER_ASN1T_H - -# include -# include -# include - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -/* ASN1 template defines, structures and functions */ - -#ifdef __cplusplus -extern "C" { -#endif - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) - -/* Macros for start and end of ASN1_ITEM definition */ - -# define ASN1_ITEM_start(itname) \ - const ASN1_ITEM itname##_it = { - -# define static_ASN1_ITEM_start(itname) \ - static const ASN1_ITEM itname##_it = { - -# define ASN1_ITEM_end(itname) \ - }; - -# else - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)())) - -/* Macros for start and end of ASN1_ITEM definition */ - -# define ASN1_ITEM_start(itname) \ - const ASN1_ITEM * itname##_it(void) \ - { \ - static const ASN1_ITEM local_it = { - -# define static_ASN1_ITEM_start(itname) \ - static ASN1_ITEM_start(itname) - -# define ASN1_ITEM_end(itname) \ - }; \ - return &local_it; \ - } - -# endif - -/* Macros to aid ASN1 template writing */ - -# define ASN1_ITEM_TEMPLATE(tname) \ - static const ASN1_TEMPLATE tname##_item_tt - -# define ASN1_ITEM_TEMPLATE_END(tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_PRIMITIVE,\ - -1,\ - &tname##_item_tt,\ - 0,\ - NULL,\ - 0,\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_ITEM_TEMPLATE_END(tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_PRIMITIVE,\ - -1,\ - &tname##_item_tt,\ - 0,\ - NULL,\ - 0,\ - #tname \ - ASN1_ITEM_end(tname) - -/* This is a ASN1 type which just embeds a template */ - -/*- - * This pair helps declare a SEQUENCE. We can do: - * - * ASN1_SEQUENCE(stname) = { - * ... SEQUENCE components ... - * } ASN1_SEQUENCE_END(stname) - * - * This will produce an ASN1_ITEM called stname_it - * for a structure called stname. - * - * If you want the same structure but a different - * name then use: - * - * ASN1_SEQUENCE(itname) = { - * ... SEQUENCE components ... - * } ASN1_SEQUENCE_END_name(stname, itname) - * - * This will create an item called itname_it using - * a structure called stname. - */ - -# define ASN1_SEQUENCE(tname) \ - static const ASN1_TEMPLATE tname##_seq_tt[] - -# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) - -# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) - -# define ASN1_SEQUENCE_END_name(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #tname \ - ASN1_ITEM_end(tname) - -# define static_ASN1_SEQUENCE_END_name(stname, tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_NDEF_SEQUENCE(tname) \ - ASN1_SEQUENCE(tname) - -# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ - ASN1_SEQUENCE_cb(tname, cb) - -# define ASN1_SEQUENCE_cb(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_BROKEN_SEQUENCE(tname) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_SEQUENCE_ref(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_SEQUENCE_enc(tname, enc, cb) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_NDEF_SEQUENCE_END(tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(tname),\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_NDEF_SEQUENCE_END(tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(tname),\ - #tname \ - ASN1_ITEM_end(tname) - -# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) -# define static_ASN1_BROKEN_SEQUENCE_END(stname) \ - static_ASN1_SEQUENCE_END_ref(stname, stname) - -# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) - -# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) -# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) - -# define ASN1_SEQUENCE_END_ref(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_SEQUENCE_END_ref(stname, tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -/*- - * This pair helps declare a CHOICE type. We can do: - * - * ASN1_CHOICE(chname) = { - * ... CHOICE options ... - * ASN1_CHOICE_END(chname) - * - * This will produce an ASN1_ITEM called chname_it - * for a structure called chname. The structure - * definition must look like this: - * typedef struct { - * int type; - * union { - * ASN1_SOMETHING *opt1; - * ASN1_SOMEOTHER *opt2; - * } value; - * } chname; - * - * the name of the selector must be 'type'. - * to use an alternative selector name use the - * ASN1_CHOICE_END_selector() version. - */ - -# define ASN1_CHOICE(tname) \ - static const ASN1_TEMPLATE tname##_ch_tt[] - -# define ASN1_CHOICE_cb(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ - ASN1_CHOICE(tname) - -# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) - -# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) - -# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) - -# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) - -# define ASN1_CHOICE_END_selector(stname, tname, selname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_CHOICE_END_cb(stname, tname, selname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -/* This helps with the template wrapper form of ASN1_ITEM */ - -# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ - (flags), (tag), 0,\ - #name, ASN1_ITEM_ref(type) } - -/* These help with SEQUENCE or CHOICE components */ - -/* used to declare other types */ - -# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ - (flags), (tag), offsetof(stname, field),\ - #field, ASN1_ITEM_ref(type) } - -/* implicit and explicit helper macros */ - -# define ASN1_IMP_EX(stname, field, type, tag, ex) \ - ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type) - -# define ASN1_EXP_EX(stname, field, type, tag, ex) \ - ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type) - -/* Any defined by macros: the field used is in the table itself */ - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -# else -# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } -# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } -# endif -/* Plain simple type */ -# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) -/* Embedded simple type */ -# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type) - -/* OPTIONAL simple type */ -# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) -# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type) - -/* IMPLICIT tagged simple type */ -# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) -# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) - -/* IMPLICIT tagged OPTIONAL simple type */ -# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) -# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) - -/* Same as above but EXPLICIT */ - -# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) -# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) -# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) -# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) - -/* SEQUENCE OF type */ -# define ASN1_SEQUENCE_OF(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) - -/* OPTIONAL SEQUENCE OF */ -# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) - -/* Same as above but for SET OF */ - -# define ASN1_SET_OF(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) - -# define ASN1_SET_OF_OPT(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) - -/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ - -# define ASN1_IMP_SET_OF(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) - -# define ASN1_EXP_SET_OF(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) - -# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) - -# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) - -# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) - -/* EXPLICIT using indefinite length constructed form */ -# define ASN1_NDEF_EXP(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) - -/* EXPLICIT OPTIONAL using indefinite length constructed form */ -# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) - -/* Macros for the ASN1_ADB structure */ - -# define ASN1_ADB(name) \ - static const ASN1_ADB_TABLE name##_adbtbl[] - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ - ;\ - static const ASN1_ADB name##_adb = {\ - flags,\ - offsetof(name, field),\ - adb_cb,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - } - -# else - -# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ - ;\ - static const ASN1_ITEM *name##_adb(void) \ - { \ - static const ASN1_ADB internal_adb = \ - {\ - flags,\ - offsetof(name, field),\ - adb_cb,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - }; \ - return (const ASN1_ITEM *) &internal_adb; \ - } \ - void dummy_function(void) - -# endif - -# define ADB_ENTRY(val, template) {val, template} - -# define ASN1_ADB_TEMPLATE(name) \ - static const ASN1_TEMPLATE name##_tt - -/* - * This is the ASN1 template structure that defines a wrapper round the - * actual type. It determines the actual position of the field in the value - * structure, various flags such as OPTIONAL and the field name. - */ - -struct ASN1_TEMPLATE_st { - unsigned long flags; /* Various flags */ - long tag; /* tag, not used if no tagging */ - unsigned long offset; /* Offset of this field in structure */ - const char *field_name; /* Field name */ - ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ -}; - -/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ - -# define ASN1_TEMPLATE_item(t) (t->item_ptr) -# define ASN1_TEMPLATE_adb(t) (t->item_ptr) - -typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; -typedef struct ASN1_ADB_st ASN1_ADB; - -struct ASN1_ADB_st { - unsigned long flags; /* Various flags */ - unsigned long offset; /* Offset of selector field */ - int (*adb_cb)(long *psel); /* Application callback */ - const ASN1_ADB_TABLE *tbl; /* Table of possible types */ - long tblcount; /* Number of entries in tbl */ - const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ - const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ -}; - -struct ASN1_ADB_TABLE_st { - long value; /* NID for an object or value for an int */ - const ASN1_TEMPLATE tt; /* item for this value */ -}; - -/* template flags */ - -/* Field is optional */ -# define ASN1_TFLG_OPTIONAL (0x1) - -/* Field is a SET OF */ -# define ASN1_TFLG_SET_OF (0x1 << 1) - -/* Field is a SEQUENCE OF */ -# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) - -/* - * Special case: this refers to a SET OF that will be sorted into DER order - * when encoded *and* the corresponding STACK will be modified to match the - * new order. - */ -# define ASN1_TFLG_SET_ORDER (0x3 << 1) - -/* Mask for SET OF or SEQUENCE OF */ -# define ASN1_TFLG_SK_MASK (0x3 << 1) - -/* - * These flags mean the tag should be taken from the tag field. If EXPLICIT - * then the underlying type is used for the inner tag. - */ - -/* IMPLICIT tagging */ -# define ASN1_TFLG_IMPTAG (0x1 << 3) - -/* EXPLICIT tagging, inner tag from underlying type */ -# define ASN1_TFLG_EXPTAG (0x2 << 3) - -# define ASN1_TFLG_TAG_MASK (0x3 << 3) - -/* context specific IMPLICIT */ -# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT) - -/* context specific EXPLICIT */ -# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT) - -/* - * If tagging is in force these determine the type of tag to use. Otherwise - * the tag is determined by the underlying type. These values reflect the - * actual octet format. - */ - -/* Universal tag */ -# define ASN1_TFLG_UNIVERSAL (0x0<<6) -/* Application tag */ -# define ASN1_TFLG_APPLICATION (0x1<<6) -/* Context specific tag */ -# define ASN1_TFLG_CONTEXT (0x2<<6) -/* Private tag */ -# define ASN1_TFLG_PRIVATE (0x3<<6) - -# define ASN1_TFLG_TAG_CLASS (0x3<<6) - -/* - * These are for ANY DEFINED BY type. In this case the 'item' field points to - * an ASN1_ADB structure which contains a table of values to decode the - * relevant type - */ - -# define ASN1_TFLG_ADB_MASK (0x3<<8) - -# define ASN1_TFLG_ADB_OID (0x1<<8) - -# define ASN1_TFLG_ADB_INT (0x1<<9) - -/* - * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes - * indefinite length constructed encoding to be used if required. - */ - -# define ASN1_TFLG_NDEF (0x1<<11) - -/* Field is embedded and not a pointer */ -# define ASN1_TFLG_EMBED (0x1 << 12) - -/* This is the actual ASN1 item itself */ - -struct ASN1_ITEM_st { - char itype; /* The item type, primitive, SEQUENCE, CHOICE - * or extern */ - long utype; /* underlying type */ - const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains - * the contents */ - long tcount; /* Number of templates if SEQUENCE or CHOICE */ - const void *funcs; /* functions that handle this type */ - long size; /* Structure size (usually) */ - const char *sname; /* Structure name */ -}; - -/*- - * These are values for the itype field and - * determine how the type is interpreted. - * - * For PRIMITIVE types the underlying type - * determines the behaviour if items is NULL. - * - * Otherwise templates must contain a single - * template and the type is treated in the - * same way as the type specified in the template. - * - * For SEQUENCE types the templates field points - * to the members, the size field is the - * structure size. - * - * For CHOICE types the templates field points - * to each possible member (typically a union) - * and the 'size' field is the offset of the - * selector. - * - * The 'funcs' field is used for application - * specific functions. - * - * The EXTERN type uses a new style d2i/i2d. - * The new style should be used where possible - * because it avoids things like the d2i IMPLICIT - * hack. - * - * MSTRING is a multiple string type, it is used - * for a CHOICE of character strings where the - * actual strings all occupy an ASN1_STRING - * structure. In this case the 'utype' field - * has a special meaning, it is used as a mask - * of acceptable types using the B_ASN1 constants. - * - * NDEF_SEQUENCE is the same as SEQUENCE except - * that it will use indefinite length constructed - * encoding if requested. - * - */ - -# define ASN1_ITYPE_PRIMITIVE 0x0 - -# define ASN1_ITYPE_SEQUENCE 0x1 - -# define ASN1_ITYPE_CHOICE 0x2 - -# define ASN1_ITYPE_EXTERN 0x4 - -# define ASN1_ITYPE_MSTRING 0x5 - -# define ASN1_ITYPE_NDEF_SEQUENCE 0x6 - -/* - * Cache for ASN1 tag and length, so we don't keep re-reading it for things - * like CHOICE - */ - -struct ASN1_TLC_st { - char valid; /* Values below are valid */ - int ret; /* return value */ - long plen; /* length */ - int ptag; /* class value */ - int pclass; /* class value */ - int hdrlen; /* header length */ -}; - -/* Typedefs for ASN1 function pointers */ -typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, - const ASN1_ITEM *it, int tag, int aclass, char opt, - ASN1_TLC *ctx); - -typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, - const ASN1_ITEM *it, int tag, int aclass); -typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); -typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); - -typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, - int indent, const char *fname, - const ASN1_PCTX *pctx); - -typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, - int *putype, const ASN1_ITEM *it); -typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, - int len, int utype, char *free_cont, - const ASN1_ITEM *it); -typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, - const ASN1_ITEM *it, int indent, - const ASN1_PCTX *pctx); - -typedef struct ASN1_EXTERN_FUNCS_st { - void *app_data; - ASN1_ex_new_func *asn1_ex_new; - ASN1_ex_free_func *asn1_ex_free; - ASN1_ex_free_func *asn1_ex_clear; - ASN1_ex_d2i *asn1_ex_d2i; - ASN1_ex_i2d *asn1_ex_i2d; - ASN1_ex_print_func *asn1_ex_print; -} ASN1_EXTERN_FUNCS; - -typedef struct ASN1_PRIMITIVE_FUNCS_st { - void *app_data; - unsigned long flags; - ASN1_ex_new_func *prim_new; - ASN1_ex_free_func *prim_free; - ASN1_ex_free_func *prim_clear; - ASN1_primitive_c2i *prim_c2i; - ASN1_primitive_i2c *prim_i2c; - ASN1_primitive_print *prim_print; -} ASN1_PRIMITIVE_FUNCS; - -/* - * This is the ASN1_AUX structure: it handles various miscellaneous - * requirements. For example the use of reference counts and an informational - * callback. The "informational callback" is called at various points during - * the ASN1 encoding and decoding. It can be used to provide minor - * customisation of the structures used. This is most useful where the - * supplied routines *almost* do the right thing but need some extra help at - * a few points. If the callback returns zero then it is assumed a fatal - * error has occurred and the main operation should be abandoned. If major - * changes in the default behaviour are required then an external type is - * more appropriate. - */ - -typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, - void *exarg); - -typedef struct ASN1_AUX_st { - void *app_data; - int flags; - int ref_offset; /* Offset of reference value */ - int ref_lock; /* Lock type to use */ - ASN1_aux_cb *asn1_cb; - int enc_offset; /* Offset of ASN1_ENCODING structure */ -} ASN1_AUX; - -/* For print related callbacks exarg points to this structure */ -typedef struct ASN1_PRINT_ARG_st { - BIO *out; - int indent; - const ASN1_PCTX *pctx; -} ASN1_PRINT_ARG; - -/* For streaming related callbacks exarg points to this structure */ -typedef struct ASN1_STREAM_ARG_st { - /* BIO to stream through */ - BIO *out; - /* BIO with filters appended */ - BIO *ndef_bio; - /* Streaming I/O boundary */ - unsigned char **boundary; -} ASN1_STREAM_ARG; - -/* Flags in ASN1_AUX */ - -/* Use a reference count */ -# define ASN1_AFLG_REFCOUNT 1 -/* Save the encoding of structure (useful for signatures) */ -# define ASN1_AFLG_ENCODING 2 -/* The Sequence length is invalid */ -# define ASN1_AFLG_BROKEN 4 - -/* operation values for asn1_cb */ - -# define ASN1_OP_NEW_PRE 0 -# define ASN1_OP_NEW_POST 1 -# define ASN1_OP_FREE_PRE 2 -# define ASN1_OP_FREE_POST 3 -# define ASN1_OP_D2I_PRE 4 -# define ASN1_OP_D2I_POST 5 -# define ASN1_OP_I2D_PRE 6 -# define ASN1_OP_I2D_POST 7 -# define ASN1_OP_PRINT_PRE 8 -# define ASN1_OP_PRINT_POST 9 -# define ASN1_OP_STREAM_PRE 10 -# define ASN1_OP_STREAM_POST 11 -# define ASN1_OP_DETACHED_PRE 12 -# define ASN1_OP_DETACHED_POST 13 - -/* Macro to implement a primitive type */ -# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) -# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ - ASN1_ITEM_start(itname) \ - ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ - ASN1_ITEM_end(itname) - -/* Macro to implement a multi string type */ -# define IMPLEMENT_ASN1_MSTRING(itname, mask) \ - ASN1_ITEM_start(itname) \ - ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ - ASN1_ITEM_end(itname) - -# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ - ASN1_ITEM_start(sname) \ - ASN1_ITYPE_EXTERN, \ - tag, \ - NULL, \ - 0, \ - &fptrs, \ - 0, \ - #sname \ - ASN1_ITEM_end(sname) - -/* Macro to implement standard functions in terms of ASN1_ITEM structures */ - -# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) - -# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ - IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) - -# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ - pre stname *fname##_new(void) \ - { \ - return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ - } \ - pre void fname##_free(stname *a) \ - { \ - ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ - } - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ - stname *fname##_new(void) \ - { \ - return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ - } \ - void fname##_free(stname *a) \ - { \ - ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ - } - -# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) - -# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ - } \ - int i2d_##fname(stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ - } - -# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ - int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ - { \ - return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ - } - -# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \ - static stname *d2i_##stname(stname **a, \ - const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \ - ASN1_ITEM_rptr(stname)); \ - } \ - static int i2d_##stname(stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, \ - ASN1_ITEM_rptr(stname)); \ - } - -/* - * This includes evil casts to remove const: they will go away when full ASN1 - * constification is done. - */ -# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ - } \ - int i2d_##fname(const stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ - } - -# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ - stname * stname##_dup(stname *x) \ - { \ - return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ - } - -# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ - IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ - int fname##_print_ctx(BIO *out, stname *x, int indent, \ - const ASN1_PCTX *pctx) \ - { \ - return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ - ASN1_ITEM_rptr(itname), pctx); \ - } - -# define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ - IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) - -# define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) - -/* external definitions for primitive types */ - -DECLARE_ASN1_ITEM(ASN1_BOOLEAN) -DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) -DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) -DECLARE_ASN1_ITEM(ASN1_SEQUENCE) -DECLARE_ASN1_ITEM(CBIGNUM) -DECLARE_ASN1_ITEM(BIGNUM) -DECLARE_ASN1_ITEM(INT32) -DECLARE_ASN1_ITEM(ZINT32) -DECLARE_ASN1_ITEM(UINT32) -DECLARE_ASN1_ITEM(ZUINT32) -DECLARE_ASN1_ITEM(INT64) -DECLARE_ASN1_ITEM(ZINT64) -DECLARE_ASN1_ITEM(UINT64) -DECLARE_ASN1_ITEM(ZUINT64) - -# if OPENSSL_API_COMPAT < 0x10200000L -/* - * LONG and ZLONG are strongly discouraged for use as stored data, as the - * underlying C type (long) differs in size depending on the architecture. - * They are designed with 32-bit longs in mind. - */ -DECLARE_ASN1_ITEM(LONG) -DECLARE_ASN1_ITEM(ZLONG) -# endif - -DEFINE_STACK_OF(ASN1_VALUE) - -/* Functions used internally by the ASN1 code */ - -int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); -void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); - -int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, - const ASN1_ITEM *it, int tag, int aclass, char opt, - ASN1_TLC *ctx); - -int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, - const ASN1_ITEM *it, int tag, int aclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/async.h b/Hin2n/src/main/jniLibs/x86/include/openssl/async.h deleted file mode 100644 index 7052b890..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/async.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 - -#ifndef HEADER_ASYNC_H -# define HEADER_ASYNC_H - -#if defined(_WIN32) -# if defined(BASETYPES) || defined(_WINDEF_H) -/* application has to include 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 - - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/asyncerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/asyncerr.h deleted file mode 100644 index 91afbbb2..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/asyncerr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/bio.h b/Hin2n/src/main/jniLibs/x86/include/openssl/bio.h deleted file mode 100644 index ae559a51..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/bio.h +++ /dev/null @@ -1,801 +0,0 @@ -/* - * 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_BIO_H -# define HEADER_BIO_H - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# endif -# include - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* There are the classes of BIOs */ -# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ -# define BIO_TYPE_FILTER 0x0200 -# define BIO_TYPE_SOURCE_SINK 0x0400 - -/* These are the 'types' of BIOs */ -# define BIO_TYPE_NONE 0 -# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK) -# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK) - -# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK) -# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER) -# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER) -# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER) -# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER) -# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER) -# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) - -# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */ -# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER) -# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */ -# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER) -# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER) -# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER) -# ifndef OPENSSL_NO_SCTP -# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# endif - -#define BIO_TYPE_START 128 - -/* - * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. - * BIO_set_fp(in,stdin,BIO_NOCLOSE); - */ -# define BIO_NOCLOSE 0x00 -# define BIO_CLOSE 0x01 - -/* - * These are used in the following macros and are passed to BIO_ctrl() - */ -# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ -# define BIO_CTRL_EOF 2/* opt - are we at the eof */ -# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ -# define BIO_CTRL_SET 4/* man - set the 'IO' type */ -# define BIO_CTRL_GET 5/* man - get the 'IO' type */ -# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ -# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ -# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ -# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ -# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ -# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ -# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ -# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ -# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ -# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ - -# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ -# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ - -/* dgram BIO stuff */ -# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ -# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected - * socket to be passed in */ -# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ -# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ -# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ -# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ - -# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ -# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ - -/* #ifdef IP_MTU_DISCOVER */ -# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ -/* #endif */ - -# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ -# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 -# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ -# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. - * want to use this if asking - * the kernel fails */ - -# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was - * exceed in the previous write - * operation */ - -# define BIO_CTRL_DGRAM_GET_PEER 46 -# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ - -# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout - * to adjust socket timeouts */ -# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 - -# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 - -/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ -# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 -# ifndef OPENSSL_NO_SCTP -/* SCTP stuff */ -# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 -# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 -# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 -# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 -# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 -# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 -# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 -# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 -# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 -# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 -# endif - -# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71 - -/* modifiers */ -# define BIO_FP_READ 0x02 -# define BIO_FP_WRITE 0x04 -# define BIO_FP_APPEND 0x08 -# define BIO_FP_TEXT 0x10 - -# define BIO_FLAGS_READ 0x01 -# define BIO_FLAGS_WRITE 0x02 -# define BIO_FLAGS_IO_SPECIAL 0x04 -# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) -# define BIO_FLAGS_SHOULD_RETRY 0x08 -# ifndef BIO_FLAGS_UPLINK -/* - * "UPLINK" flag denotes file descriptors provided by application. It - * defaults to 0, as most platforms don't require UPLINK interface. - */ -# define BIO_FLAGS_UPLINK 0 -# endif - -# define BIO_FLAGS_BASE64_NO_NL 0x100 - -/* - * This is used with memory BIOs: - * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; - * BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. - */ -# define BIO_FLAGS_MEM_RDONLY 0x200 -# define BIO_FLAGS_NONCLEAR_RST 0x400 -# define BIO_FLAGS_IN_EOF 0x800 - -typedef union bio_addr_st BIO_ADDR; -typedef struct bio_addrinfo_st BIO_ADDRINFO; - -int BIO_get_new_index(void); -void BIO_set_flags(BIO *b, int flags); -int BIO_test_flags(const BIO *b, int flags); -void BIO_clear_flags(BIO *b, int flags); - -# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) -# define BIO_set_retry_special(b) \ - BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_set_retry_read(b) \ - BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_set_retry_write(b) \ - BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) - -/* These are normally used internally in BIOs */ -# define BIO_clear_retry_flags(b) \ - BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_get_retry_flags(b) \ - BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) - -/* These should be used by the application to tell why we should retry */ -# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) -# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) -# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) -# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) -# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) - -/* - * The next three are used in conjunction with the BIO_should_io_special() - * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int - * *reason); will walk the BIO stack and return the 'reason' for the special - * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return - * the code. - */ -/* - * Returned from the SSL bio when the certificate retrieval code had an error - */ -# define BIO_RR_SSL_X509_LOOKUP 0x01 -/* Returned from the connect BIO when a connect would have blocked */ -# define BIO_RR_CONNECT 0x02 -/* Returned from the accept BIO when an accept would have blocked */ -# define BIO_RR_ACCEPT 0x03 - -/* These are passed by the BIO callback */ -# define BIO_CB_FREE 0x01 -# define BIO_CB_READ 0x02 -# define BIO_CB_WRITE 0x03 -# define BIO_CB_PUTS 0x04 -# define BIO_CB_GETS 0x05 -# define BIO_CB_CTRL 0x06 - -/* - * The callback is called before and after the underling operation, The - * BIO_CB_RETURN flag indicates if it is after the call - */ -# define BIO_CB_RETURN 0x80 -# define BIO_CB_return(a) ((a)|BIO_CB_RETURN) -# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) -# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) - -typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, - long argl, long ret); -typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, - size_t len, int argi, - long argl, int ret, size_t *processed); -BIO_callback_fn BIO_get_callback(const BIO *b); -void BIO_set_callback(BIO *b, BIO_callback_fn callback); - -BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); -void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); - -char *BIO_get_callback_arg(const BIO *b); -void BIO_set_callback_arg(BIO *b, char *arg); - -typedef struct bio_method_st BIO_METHOD; - -const char *BIO_method_name(const BIO *b); -int BIO_method_type(const BIO *b); - -typedef int BIO_info_cb(BIO *, int, int); -typedef BIO_info_cb bio_info_cb; /* backward compatibility */ - -DEFINE_STACK_OF(BIO) - -/* Prefix and suffix callback in ASN1 BIO */ -typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, - void *parg); - -# ifndef OPENSSL_NO_SCTP -/* SCTP parameter structs */ -struct bio_dgram_sctp_sndinfo { - uint16_t snd_sid; - uint16_t snd_flags; - uint32_t snd_ppid; - uint32_t snd_context; -}; - -struct bio_dgram_sctp_rcvinfo { - uint16_t rcv_sid; - uint16_t rcv_ssn; - uint16_t rcv_flags; - uint32_t rcv_ppid; - uint32_t rcv_tsn; - uint32_t rcv_cumtsn; - uint32_t rcv_context; -}; - -struct bio_dgram_sctp_prinfo { - uint16_t pr_policy; - uint32_t pr_value; -}; -# endif - -/* - * #define BIO_CONN_get_param_hostname BIO_ctrl - */ - -# define BIO_C_SET_CONNECT 100 -# define BIO_C_DO_STATE_MACHINE 101 -# define BIO_C_SET_NBIO 102 -/* # define BIO_C_SET_PROXY_PARAM 103 */ -# define BIO_C_SET_FD 104 -# define BIO_C_GET_FD 105 -# define BIO_C_SET_FILE_PTR 106 -# define BIO_C_GET_FILE_PTR 107 -# define BIO_C_SET_FILENAME 108 -# define BIO_C_SET_SSL 109 -# define BIO_C_GET_SSL 110 -# define BIO_C_SET_MD 111 -# define BIO_C_GET_MD 112 -# define BIO_C_GET_CIPHER_STATUS 113 -# define BIO_C_SET_BUF_MEM 114 -# define BIO_C_GET_BUF_MEM_PTR 115 -# define BIO_C_GET_BUFF_NUM_LINES 116 -# define BIO_C_SET_BUFF_SIZE 117 -# define BIO_C_SET_ACCEPT 118 -# define BIO_C_SSL_MODE 119 -# define BIO_C_GET_MD_CTX 120 -/* # define BIO_C_GET_PROXY_PARAM 121 */ -# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ -# define BIO_C_GET_CONNECT 123 -# define BIO_C_GET_ACCEPT 124 -# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 -# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 -# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 -# define BIO_C_FILE_SEEK 128 -# define BIO_C_GET_CIPHER_CTX 129 -# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input - * value */ -# define BIO_C_SET_BIND_MODE 131 -# define BIO_C_GET_BIND_MODE 132 -# define BIO_C_FILE_TELL 133 -# define BIO_C_GET_SOCKS 134 -# define BIO_C_SET_SOCKS 135 - -# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ -# define BIO_C_GET_WRITE_BUF_SIZE 137 -# define BIO_C_MAKE_BIO_PAIR 138 -# define BIO_C_DESTROY_BIO_PAIR 139 -# define BIO_C_GET_WRITE_GUARANTEE 140 -# define BIO_C_GET_READ_REQUEST 141 -# define BIO_C_SHUTDOWN_WR 142 -# define BIO_C_NREAD0 143 -# define BIO_C_NREAD 144 -# define BIO_C_NWRITE0 145 -# define BIO_C_NWRITE 146 -# define BIO_C_RESET_READ_REQUEST 147 -# define BIO_C_SET_MD_CTX 148 - -# define BIO_C_SET_PREFIX 149 -# define BIO_C_GET_PREFIX 150 -# define BIO_C_SET_SUFFIX 151 -# define BIO_C_GET_SUFFIX 152 - -# define BIO_C_SET_EX_ARG 153 -# define BIO_C_GET_EX_ARG 154 - -# define BIO_C_SET_CONNECT_MODE 155 - -# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) -# define BIO_get_app_data(s) BIO_get_ex_data(s,0) - -# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) - -# ifndef OPENSSL_NO_SOCK -/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ -/* Note: the underlying operating system may not support some of them */ -# define BIO_FAMILY_IPV4 4 -# define BIO_FAMILY_IPV6 6 -# define BIO_FAMILY_IPANY 256 - -/* BIO_s_connect() */ -# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \ - (char *)(name)) -# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \ - (char *)(port)) -# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \ - (char *)(addr)) -# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f) -# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)) -# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)) -# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)) -# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) -# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL) - -/* BIO_s_accept() */ -# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \ - (char *)(name)) -# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \ - (char *)(port)) -# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)) -# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1)) -# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2)) -# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3)) -/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ -# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL) -# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \ - (char *)(bio)) -# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f) -# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL) - -/* Aliases kept for backward compatibility */ -# define BIO_BIND_NORMAL 0 -# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR -# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR -# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) -# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) - -/* BIO_s_accept() and BIO_s_connect() */ -# define BIO_do_connect(b) BIO_do_handshake(b) -# define BIO_do_accept(b) BIO_do_handshake(b) -# endif /* OPENSSL_NO_SOCK */ - -# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) - -/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ -# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) -# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c)) - -/* BIO_s_file() */ -# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp)) -# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp)) - -/* BIO_s_fd() and BIO_s_file() */ -# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) -# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) - -/* - * name is cast to lose const, but might be better to route through a - * function so we can do it safely - */ -# ifdef CONST_STRICT -/* - * If you are wondering why this isn't defined, its because CONST_STRICT is - * purely a compile-time kludge to allow const to be checked. - */ -int BIO_read_filename(BIO *b, const char *name); -# else -# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_READ,(char *)(name)) -# endif -# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_WRITE,name) -# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_APPEND,name) -# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) - -/* - * WARNING WARNING, this ups the reference count on the read bio of the SSL - * structure. This is because the ssl read BIO is now pointed to by the - * next_bio field in the bio. So when you free the BIO, make sure you are - * doing a BIO_free_all() to catch the underlying BIO. - */ -# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl)) -# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp)) -# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) -# define BIO_set_ssl_renegotiate_bytes(b,num) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) -# define BIO_get_num_renegotiates(b) \ - BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL) -# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) - -/* defined in evp.h */ -/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ - -# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp)) -# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm)) -# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \ - (char *)(pp)) -# define BIO_set_mem_eof_return(b,v) \ - BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) - -/* For the BIO_f_buffer() type */ -# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) -# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) -# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) -# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) -# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) - -/* Don't use the next one unless you know what you are doing :-) */ -# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) - -# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) -# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) -# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) -# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) -# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) -# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) -/* ...pending macros have inappropriate return type */ -size_t BIO_ctrl_pending(BIO *b); -size_t BIO_ctrl_wpending(BIO *b); -# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) -# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ - cbp) -# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) - -/* For the BIO_f_buffer() type */ -# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) -# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) - -/* For BIO_s_bio() */ -# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) -# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) -# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) -# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) -# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) -/* macros with inappropriate type -- but ...pending macros use int too: */ -# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) -# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) -size_t BIO_ctrl_get_write_guarantee(BIO *b); -size_t BIO_ctrl_get_read_request(BIO *b); -int BIO_ctrl_reset_read_request(BIO *b); - -/* ctrl macros for dgram */ -# define BIO_ctrl_dgram_connect(b,peer) \ - (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer)) -# define BIO_ctrl_set_connected(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer)) -# define BIO_dgram_recv_timedout(b) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) -# define BIO_dgram_send_timedout(b) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) -# define BIO_dgram_get_peer(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer)) -# define BIO_dgram_set_peer(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer)) -# define BIO_dgram_get_mtu_overhead(b) \ - (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) - -#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef) -int BIO_set_ex_data(BIO *bio, int idx, void *data); -void *BIO_get_ex_data(BIO *bio, int idx); -uint64_t BIO_number_read(BIO *bio); -uint64_t BIO_number_written(BIO *bio); - -/* For BIO_f_asn1() */ -int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, - asn1_ps_func *prefix_free); -int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, - asn1_ps_func **pprefix_free); -int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, - asn1_ps_func *suffix_free); -int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, - asn1_ps_func **psuffix_free); - -const BIO_METHOD *BIO_s_file(void); -BIO *BIO_new_file(const char *filename, const char *mode); -# ifndef OPENSSL_NO_STDIO -BIO *BIO_new_fp(FILE *stream, int close_flag); -# endif -BIO *BIO_new(const BIO_METHOD *type); -int BIO_free(BIO *a); -void BIO_set_data(BIO *a, void *ptr); -void *BIO_get_data(BIO *a); -void BIO_set_init(BIO *a, int init); -int BIO_get_init(BIO *a); -void BIO_set_shutdown(BIO *a, int shut); -int BIO_get_shutdown(BIO *a); -void BIO_vfree(BIO *a); -int BIO_up_ref(BIO *a); -int BIO_read(BIO *b, void *data, int dlen); -int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); -int BIO_gets(BIO *bp, char *buf, int size); -int BIO_write(BIO *b, const void *data, int dlen); -int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); -int BIO_puts(BIO *bp, const char *buf); -int BIO_indent(BIO *b, int indent, int max); -long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); -long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); -void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); -long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); -BIO *BIO_push(BIO *b, BIO *append); -BIO *BIO_pop(BIO *b); -void BIO_free_all(BIO *a); -BIO *BIO_find_type(BIO *b, int bio_type); -BIO *BIO_next(BIO *b); -void BIO_set_next(BIO *b, BIO *next); -BIO *BIO_get_retry_BIO(BIO *bio, int *reason); -int BIO_get_retry_reason(BIO *bio); -void BIO_set_retry_reason(BIO *bio, int reason); -BIO *BIO_dup_chain(BIO *in); - -int BIO_nread0(BIO *bio, char **buf); -int BIO_nread(BIO *bio, char **buf, int num); -int BIO_nwrite0(BIO *bio, char **buf); -int BIO_nwrite(BIO *bio, char **buf, int num); - -long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, - long argl, long ret); - -const BIO_METHOD *BIO_s_mem(void); -const BIO_METHOD *BIO_s_secmem(void); -BIO *BIO_new_mem_buf(const void *buf, int len); -# ifndef OPENSSL_NO_SOCK -const BIO_METHOD *BIO_s_socket(void); -const BIO_METHOD *BIO_s_connect(void); -const BIO_METHOD *BIO_s_accept(void); -# endif -const BIO_METHOD *BIO_s_fd(void); -const BIO_METHOD *BIO_s_log(void); -const BIO_METHOD *BIO_s_bio(void); -const BIO_METHOD *BIO_s_null(void); -const BIO_METHOD *BIO_f_null(void); -const BIO_METHOD *BIO_f_buffer(void); -const BIO_METHOD *BIO_f_linebuffer(void); -const BIO_METHOD *BIO_f_nbio_test(void); -# ifndef OPENSSL_NO_DGRAM -const BIO_METHOD *BIO_s_datagram(void); -int BIO_dgram_non_fatal_error(int error); -BIO *BIO_new_dgram(int fd, int close_flag); -# ifndef OPENSSL_NO_SCTP -const BIO_METHOD *BIO_s_datagram_sctp(void); -BIO *BIO_new_dgram_sctp(int fd, int close_flag); -int BIO_dgram_is_sctp(BIO *bio); -int BIO_dgram_sctp_notification_cb(BIO *b, - void (*handle_notifications) (BIO *bio, - void *context, - void *buf), - void *context); -int BIO_dgram_sctp_wait_for_dry(BIO *b); -int BIO_dgram_sctp_msg_waiting(BIO *b); -# endif -# endif - -# ifndef OPENSSL_NO_SOCK -int BIO_sock_should_retry(int i); -int BIO_sock_non_fatal_error(int error); -# endif - -int BIO_fd_should_retry(int i); -int BIO_fd_non_fatal_error(int error); -int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), - void *u, const char *s, int len); -int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), - void *u, const char *s, int len, int indent); -int BIO_dump(BIO *b, const char *bytes, int len); -int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); -# ifndef OPENSSL_NO_STDIO -int BIO_dump_fp(FILE *fp, const char *s, int len); -int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); -# endif -int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data, - int datalen); - -# ifndef OPENSSL_NO_SOCK -BIO_ADDR *BIO_ADDR_new(void); -int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, - const void *where, size_t wherelen, unsigned short port); -void BIO_ADDR_free(BIO_ADDR *); -void BIO_ADDR_clear(BIO_ADDR *ap); -int BIO_ADDR_family(const BIO_ADDR *ap); -int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); -unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); -char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); -char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); -char *BIO_ADDR_path_string(const BIO_ADDR *ap); - -const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); -const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); -void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); - -enum BIO_hostserv_priorities { - BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV -}; -int BIO_parse_hostserv(const char *hostserv, char **host, char **service, - enum BIO_hostserv_priorities hostserv_prio); -enum BIO_lookup_type { - BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER -}; -int BIO_lookup(const char *host, const char *service, - enum BIO_lookup_type lookup_type, - int family, int socktype, BIO_ADDRINFO **res); -int BIO_lookup_ex(const char *host, const char *service, - int lookup_type, int family, int socktype, int protocol, - BIO_ADDRINFO **res); -int BIO_sock_error(int sock); -int BIO_socket_ioctl(int fd, long type, void *arg); -int BIO_socket_nbio(int fd, int mode); -int BIO_sock_init(void); -# if OPENSSL_API_COMPAT < 0x10100000L -# define BIO_sock_cleanup() while(0) continue -# endif -int BIO_set_tcp_ndelay(int sock, int turn_on); - -DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name)) -DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr)) -DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip)) -DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode)) -DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port)) - -union BIO_sock_info_u { - BIO_ADDR *addr; -}; -enum BIO_sock_info_type { - BIO_SOCK_INFO_ADDRESS -}; -int BIO_sock_info(int sock, - enum BIO_sock_info_type type, union BIO_sock_info_u *info); - -# define BIO_SOCK_REUSEADDR 0x01 -# define BIO_SOCK_V6_ONLY 0x02 -# define BIO_SOCK_KEEPALIVE 0x04 -# define BIO_SOCK_NONBLOCK 0x08 -# define BIO_SOCK_NODELAY 0x10 - -int BIO_socket(int domain, int socktype, int protocol, int options); -int BIO_connect(int sock, const BIO_ADDR *addr, int options); -int BIO_bind(int sock, const BIO_ADDR *addr, int options); -int BIO_listen(int sock, const BIO_ADDR *addr, int options); -int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); -int BIO_closesocket(int sock); - -BIO *BIO_new_socket(int sock, int close_flag); -BIO *BIO_new_connect(const char *host_port); -BIO *BIO_new_accept(const char *host_port); -# endif /* OPENSSL_NO_SOCK*/ - -BIO *BIO_new_fd(int fd, int close_flag); - -int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, - BIO **bio2, size_t writebuf2); -/* - * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. - * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default - * value. - */ - -void BIO_copy_next_retry(BIO *b); - -/* - * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); - */ - -# define ossl_bio__attr__(x) -# if defined(__GNUC__) && defined(__STDC_VERSION__) \ - && !defined(__APPLE__) - /* - * Because we support the 'z' modifier, which made its appearance in C99, - * we can't use __attribute__ with pre C99 dialects. - */ -# if __STDC_VERSION__ >= 199901L -# undef ossl_bio__attr__ -# define ossl_bio__attr__ __attribute__ -# if __GNUC__*10 + __GNUC_MINOR__ >= 44 -# define ossl_bio__printf__ __gnu_printf__ -# else -# define ossl_bio__printf__ __printf__ -# endif -# endif -# endif -int BIO_printf(BIO *bio, const char *format, ...) -ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); -int BIO_vprintf(BIO *bio, const char *format, va_list args) -ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); -int BIO_snprintf(char *buf, size_t n, const char *format, ...) -ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); -int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) -ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); -# undef ossl_bio__attr__ -# undef ossl_bio__printf__ - - -BIO_METHOD *BIO_meth_new(int type, const char *name); -void BIO_meth_free(BIO_METHOD *biom); -int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int); -int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, - size_t *); -int BIO_meth_set_write(BIO_METHOD *biom, - int (*write) (BIO *, const char *, int)); -int BIO_meth_set_write_ex(BIO_METHOD *biom, - int (*bwrite) (BIO *, const char *, size_t, size_t *)); -int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int); -int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *); -int BIO_meth_set_read(BIO_METHOD *biom, - int (*read) (BIO *, char *, int)); -int BIO_meth_set_read_ex(BIO_METHOD *biom, - int (*bread) (BIO *, char *, size_t, size_t *)); -int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *); -int BIO_meth_set_puts(BIO_METHOD *biom, - int (*puts) (BIO *, const char *)); -int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int); -int BIO_meth_set_gets(BIO_METHOD *biom, - int (*gets) (BIO *, char *, int)); -long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *); -int BIO_meth_set_ctrl(BIO_METHOD *biom, - long (*ctrl) (BIO *, int, long, void *)); -int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *); -int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); -int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *); -int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); -long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) - (BIO *, int, BIO_info_cb *); -int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, - long (*callback_ctrl) (BIO *, int, - BIO_info_cb *)); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/bioerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/bioerr.h deleted file mode 100644 index 46e2c96e..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/bioerr.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/blowfish.h b/Hin2n/src/main/jniLibs/x86/include/openssl/blowfish.h deleted file mode 100644 index cd3e460e..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/blowfish.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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_BLOWFISH_H -# define HEADER_BLOWFISH_H - -# include - -# ifndef OPENSSL_NO_BF -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define BF_ENCRYPT 1 -# define BF_DECRYPT 0 - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! BF_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define BF_LONG unsigned int - -# define BF_ROUNDS 16 -# define BF_BLOCK 8 - -typedef struct bf_key_st { - BF_LONG P[BF_ROUNDS + 2]; - BF_LONG S[4 * 256]; -} BF_KEY; - -void BF_set_key(BF_KEY *key, int len, const unsigned char *data); - -void BF_encrypt(BF_LONG *data, const BF_KEY *key); -void BF_decrypt(BF_LONG *data, const BF_KEY *key); - -void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, - const BF_KEY *key, int enc); -void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - const BF_KEY *schedule, unsigned char *ivec, int enc); -void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num); -const char *BF_options(void); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/bn.h b/Hin2n/src/main/jniLibs/x86/include/openssl/bn.h deleted file mode 100644 index 8af05d00..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/bn.h +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_BN_H -# define HEADER_BN_H - -# include -# ifndef OPENSSL_NO_STDIO -# include -# endif -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * 64-bit processor with LP64 ABI - */ -# ifdef SIXTY_FOUR_BIT_LONG -# define BN_ULONG unsigned long -# define BN_BYTES 8 -# endif - -/* - * 64-bit processor other than LP64 ABI - */ -# ifdef SIXTY_FOUR_BIT -# define BN_ULONG unsigned long long -# define BN_BYTES 8 -# endif - -# ifdef THIRTY_TWO_BIT -# define BN_ULONG unsigned int -# define BN_BYTES 4 -# endif - -# define BN_BITS2 (BN_BYTES * 8) -# define BN_BITS (BN_BITS2 * 2) -# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1)) - -# define BN_FLG_MALLOCED 0x01 -# define BN_FLG_STATIC_DATA 0x02 - -/* - * avoid leaking exponent information through timing, - * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, - * BN_div() will call BN_div_no_branch, - * BN_mod_inverse() will call BN_mod_inverse_no_branch. - */ -# define BN_FLG_CONSTTIME 0x04 -# define BN_FLG_SECURE 0x08 - -# if OPENSSL_API_COMPAT < 0x00908000L -/* deprecated name for the flag */ -# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME -# define BN_FLG_FREE 0x8000 /* used for debugging */ -# endif - -void BN_set_flags(BIGNUM *b, int n); -int BN_get_flags(const BIGNUM *b, int n); - -/* Values for |top| in BN_rand() */ -#define BN_RAND_TOP_ANY -1 -#define BN_RAND_TOP_ONE 0 -#define BN_RAND_TOP_TWO 1 - -/* Values for |bottom| in BN_rand() */ -#define BN_RAND_BOTTOM_ANY 0 -#define BN_RAND_BOTTOM_ODD 1 - -/* - * get a clone of a BIGNUM with changed flags, for *temporary* use only (the - * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The - * value |dest| should be a newly allocated BIGNUM obtained via BN_new() that - * has not been otherwise initialised or used. - */ -void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); - -/* Wrapper function to make using BN_GENCB easier */ -int BN_GENCB_call(BN_GENCB *cb, int a, int b); - -BN_GENCB *BN_GENCB_new(void); -void BN_GENCB_free(BN_GENCB *cb); - -/* Populate a BN_GENCB structure with an "old"-style callback */ -void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *), - void *cb_arg); - -/* Populate a BN_GENCB structure with a "new"-style callback */ -void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), - void *cb_arg); - -void *BN_GENCB_get_arg(BN_GENCB *cb); - -# define BN_prime_checks 0 /* default: select number of iterations based - * on the size of the number */ - -/* - * BN_prime_checks_for_size() returns the number of Miller-Rabin iterations - * that will be done for checking that a random number is probably prime. The - * error rate for accepting a composite number as prime depends on the size of - * the prime |b|. The error rates used are for calculating an RSA key with 2 primes, - * and so the level is what you would expect for a key of double the size of the - * prime. - * - * This table is generated using the algorithm of FIPS PUB 186-4 - * Digital Signature Standard (DSS), section F.1, page 117. - * (https://dx.doi.org/10.6028/NIST.FIPS.186-4) - * - * The following magma script was used to generate the output: - * securitybits:=125; - * k:=1024; - * for t:=1 to 65 do - * for M:=3 to Floor(2*Sqrt(k-1)-1) do - * S:=0; - * // Sum over m - * for m:=3 to M do - * s:=0; - * // Sum over j - * for j:=2 to m do - * s+:=(RealField(32)!2)^-(j+(k-1)/j); - * end for; - * S+:=2^(m-(m-1)*t)*s; - * end for; - * A:=2^(k-2-M*t); - * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S; - * pkt:=2.00743*Log(2)*k*2^-k*(A+B); - * seclevel:=Floor(-Log(2,pkt)); - * if seclevel ge securitybits then - * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M; - * break; - * end if; - * end for; - * if seclevel ge securitybits then break; end if; - * end for; - * - * It can be run online at: - * http://magma.maths.usyd.edu.au/calc - * - * And will output: - * k: 1024, security: 129 bits (t: 6, M: 23) - * - * k is the number of bits of the prime, securitybits is the level we want to - * reach. - * - * prime length | RSA key size | # MR tests | security level - * -------------+--------------|------------+--------------- - * (b) >= 6394 | >= 12788 | 3 | 256 bit - * (b) >= 3747 | >= 7494 | 3 | 192 bit - * (b) >= 1345 | >= 2690 | 4 | 128 bit - * (b) >= 1080 | >= 2160 | 5 | 128 bit - * (b) >= 852 | >= 1704 | 5 | 112 bit - * (b) >= 476 | >= 952 | 5 | 80 bit - * (b) >= 400 | >= 800 | 6 | 80 bit - * (b) >= 347 | >= 694 | 7 | 80 bit - * (b) >= 308 | >= 616 | 8 | 80 bit - * (b) >= 55 | >= 110 | 27 | 64 bit - * (b) >= 6 | >= 12 | 34 | 64 bit - */ - -# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \ - (b) >= 1345 ? 4 : \ - (b) >= 476 ? 5 : \ - (b) >= 400 ? 6 : \ - (b) >= 347 ? 7 : \ - (b) >= 308 ? 8 : \ - (b) >= 55 ? 27 : \ - /* b >= 6 */ 34) - -# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) - -int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); -int BN_is_zero(const BIGNUM *a); -int BN_is_one(const BIGNUM *a); -int BN_is_word(const BIGNUM *a, const BN_ULONG w); -int BN_is_odd(const BIGNUM *a); - -# define BN_one(a) (BN_set_word((a),1)) - -void BN_zero_ex(BIGNUM *a); - -# if OPENSSL_API_COMPAT >= 0x00908000L -# define BN_zero(a) BN_zero_ex(a) -# else -# define BN_zero(a) (BN_set_word((a),0)) -# endif - -const BIGNUM *BN_value_one(void); -char *BN_options(void); -BN_CTX *BN_CTX_new(void); -BN_CTX *BN_CTX_secure_new(void); -void BN_CTX_free(BN_CTX *c); -void BN_CTX_start(BN_CTX *ctx); -BIGNUM *BN_CTX_get(BN_CTX *ctx); -void BN_CTX_end(BN_CTX *ctx); -int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_num_bits(const BIGNUM *a); -int BN_num_bits_word(BN_ULONG l); -int BN_security_bits(int L, int N); -BIGNUM *BN_new(void); -BIGNUM *BN_secure_new(void); -void BN_clear_free(BIGNUM *a); -BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); -void BN_swap(BIGNUM *a, BIGNUM *b); -BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2bin(const BIGNUM *a, unsigned char *to); -int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); -BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); -BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2mpi(const BIGNUM *a, unsigned char *to); -int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); -int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); -/** BN_set_negative sets sign of a BIGNUM - * \param b pointer to the BIGNUM object - * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise - */ -void BN_set_negative(BIGNUM *b, int n); -/** BN_is_negative returns 1 if the BIGNUM is negative - * \param b pointer to the BIGNUM object - * \return 1 if a < 0 and 0 otherwise - */ -int BN_is_negative(const BIGNUM *b); - -int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, - BN_CTX *ctx); -# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) -int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); -int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); -int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); -int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); -int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); - -BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); -BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); -int BN_mul_word(BIGNUM *a, BN_ULONG w); -int BN_add_word(BIGNUM *a, BN_ULONG w); -int BN_sub_word(BIGNUM *a, BN_ULONG w); -int BN_set_word(BIGNUM *a, BN_ULONG w); -BN_ULONG BN_get_word(const BIGNUM *a); - -int BN_cmp(const BIGNUM *a, const BIGNUM *b); -void BN_free(BIGNUM *a); -int BN_is_bit_set(const BIGNUM *a, int n); -int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); -int BN_lshift1(BIGNUM *r, const BIGNUM *a); -int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - -int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); -int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, - BN_MONT_CTX *in_mont); -int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, - const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, - BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); - -int BN_mask_bits(BIGNUM *a, int n); -# ifndef OPENSSL_NO_STDIO -int BN_print_fp(FILE *fp, const BIGNUM *a); -# endif -int BN_print(BIO *bio, const BIGNUM *a); -int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); -int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); -int BN_rshift1(BIGNUM *r, const BIGNUM *a); -void BN_clear(BIGNUM *a); -BIGNUM *BN_dup(const BIGNUM *a); -int BN_ucmp(const BIGNUM *a, const BIGNUM *b); -int BN_set_bit(BIGNUM *a, int n); -int BN_clear_bit(BIGNUM *a, int n); -char *BN_bn2hex(const BIGNUM *a); -char *BN_bn2dec(const BIGNUM *a); -int BN_hex2bn(BIGNUM **a, const char *str); -int BN_dec2bn(BIGNUM **a, const char *str); -int BN_asc2bn(BIGNUM **a, const char *str); -int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); -int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns - * -2 for - * error */ -BIGNUM *BN_mod_inverse(BIGNUM *ret, - const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); -BIGNUM *BN_mod_sqrt(BIGNUM *ret, - const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); - -void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); - -/* Deprecated versions */ -DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, - const BIGNUM *add, - const BIGNUM *rem, - void (*callback) (int, int, - void *), - void *cb_arg)) -DEPRECATEDIN_0_9_8(int - BN_is_prime(const BIGNUM *p, int nchecks, - void (*callback) (int, int, void *), - BN_CTX *ctx, void *cb_arg)) -DEPRECATEDIN_0_9_8(int - BN_is_prime_fasttest(const BIGNUM *p, int nchecks, - void (*callback) (int, int, void *), - BN_CTX *ctx, void *cb_arg, - int do_trial_division)) - -/* Newer versions */ -int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, - const BIGNUM *rem, BN_GENCB *cb); -int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); -int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, - int do_trial_division, BN_GENCB *cb); - -int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); - -int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, - const BIGNUM *Xp, const BIGNUM *Xp1, - const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, - BN_GENCB *cb); -int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, - BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, - BN_CTX *ctx, BN_GENCB *cb); - -BN_MONT_CTX *BN_MONT_CTX_new(void); -int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - BN_MONT_CTX *mont, BN_CTX *ctx); -int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -void BN_MONT_CTX_free(BN_MONT_CTX *mont); -int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); -BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); -BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, - const BIGNUM *mod, BN_CTX *ctx); - -/* BN_BLINDING flags */ -# define BN_BLINDING_NO_UPDATE 0x00000001 -# define BN_BLINDING_NO_RECREATE 0x00000002 - -BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); -void BN_BLINDING_free(BN_BLINDING *b); -int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); -int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, - BN_CTX *); - -int BN_BLINDING_is_current_thread(BN_BLINDING *b); -void BN_BLINDING_set_current_thread(BN_BLINDING *b); -int BN_BLINDING_lock(BN_BLINDING *b); -int BN_BLINDING_unlock(BN_BLINDING *b); - -unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); -void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); -BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, - const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, - int (*bn_mod_exp) (BIGNUM *r, - const BIGNUM *a, - const BIGNUM *p, - const BIGNUM *m, - BN_CTX *ctx, - BN_MONT_CTX *m_ctx), - BN_MONT_CTX *m_ctx); - -DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont)) -DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3 - * mont */ - -BN_RECP_CTX *BN_RECP_CTX_new(void); -void BN_RECP_CTX_free(BN_RECP_CTX *recp); -int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); -int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, - BN_RECP_CTX *recp, BN_CTX *ctx); -int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); -int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, - BN_RECP_CTX *recp, BN_CTX *ctx); - -# ifndef OPENSSL_NO_EC2M - -/* - * Functions for arithmetic over binary polynomials represented by BIGNUMs. - * The BIGNUM::neg property of BIGNUMs representing binary polynomials is - * ignored. Note that input arguments are not const so that their bit arrays - * can be expanded to the appropriate size if needed. - */ - -/* - * r = a + b - */ -int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) -/* - * r=a mod p - */ -int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); -/* r = (a * b) mod p */ -int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = (a * a) mod p */ -int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -/* r = (1 / b) mod p */ -int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); -/* r = (a / b) mod p */ -int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = (a ^ b) mod p */ -int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = sqrt(a) mod p */ -int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - BN_CTX *ctx); -/* r^2 + r = a mod p */ -int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - BN_CTX *ctx); -# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) -/*- - * Some functions allow for representation of the irreducible polynomials - * as an unsigned int[], say p. The irreducible f(t) is then of the form: - * t^p[0] + t^p[1] + ... + t^p[k] - * where m = p[0] > p[1] > ... > p[k] = 0. - */ -/* r = a mod p */ -int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); -/* r = (a * b) mod p */ -int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = (a * a) mod p */ -int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], - BN_CTX *ctx); -/* r = (1 / b) mod p */ -int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], - BN_CTX *ctx); -/* r = (a / b) mod p */ -int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = (a ^ b) mod p */ -int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = sqrt(a) mod p */ -int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, - const int p[], BN_CTX *ctx); -/* r^2 + r = a mod p */ -int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, - const int p[], BN_CTX *ctx); -int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); -int BN_GF2m_arr2poly(const int p[], BIGNUM *a); - -# endif - -/* - * faster mod functions for the 'NIST primes' 0 <= a < p^2 - */ -int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - -const BIGNUM *BN_get0_nist_prime_192(void); -const BIGNUM *BN_get0_nist_prime_224(void); -const BIGNUM *BN_get0_nist_prime_256(void); -const BIGNUM *BN_get0_nist_prime_384(void); -const BIGNUM *BN_get0_nist_prime_521(void); - -int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a, - const BIGNUM *field, BN_CTX *ctx); - -int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, - const BIGNUM *priv, const unsigned char *message, - size_t message_len, BN_CTX *ctx); - -/* Primes from RFC 2409 */ -BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn); -BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn); - -/* Primes from RFC 3526 */ -BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768 -# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024 -# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536 -# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048 -# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072 -# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096 -# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144 -# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192 -# endif - -int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/bnerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/bnerr.h deleted file mode 100644 index 9f3c7cfa..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/bnerr.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/buffer.h b/Hin2n/src/main/jniLibs/x86/include/openssl/buffer.h deleted file mode 100644 index d2765766..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/buffer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 1995-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_BUFFER_H -# define HEADER_BUFFER_H - -# include -# ifndef HEADER_CRYPTO_H -# include -# endif -# include - - -#ifdef __cplusplus -extern "C" { -#endif - -# include -# include - -/* - * 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 { - size_t length; /* current number of bytes */ - char *data; - 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_ex(unsigned long flags); -void BUF_MEM_free(BUF_MEM *a); -size_t BUF_MEM_grow(BUF_MEM *str, size_t len); -size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); -void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/buffererr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/buffererr.h deleted file mode 100644 index 04f6ff7a..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/buffererr.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/camellia.h b/Hin2n/src/main/jniLibs/x86/include/openssl/camellia.h deleted file mode 100644 index 151f3c13..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/camellia.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2006-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_CAMELLIA_H -# define HEADER_CAMELLIA_H - -# include - -# ifndef OPENSSL_NO_CAMELLIA -# include -#ifdef __cplusplus -extern "C" { -#endif - -# define CAMELLIA_ENCRYPT 1 -# define CAMELLIA_DECRYPT 0 - -/* - * Because array size can't be a const in C, the following two are macros. - * Both sizes are in bytes. - */ - -/* This should be a hidden type, but EVP requires that the size be known */ - -# define CAMELLIA_BLOCK_SIZE 16 -# define CAMELLIA_TABLE_BYTE_LEN 272 -# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) - -typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match - * with WORD */ - -struct camellia_key_st { - union { - double d; /* ensures 64-bit align */ - KEY_TABLE_TYPE rd_key; - } u; - int grand_rounds; -}; -typedef struct camellia_key_st CAMELLIA_KEY; - -int Camellia_set_key(const unsigned char *userKey, const int bits, - CAMELLIA_KEY *key); - -void Camellia_encrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key); -void Camellia_decrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key); - -void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key, const int enc); -void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, const int enc); -void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num); -void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char ivec[CAMELLIA_BLOCK_SIZE], - unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], - unsigned int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/cast.h b/Hin2n/src/main/jniLibs/x86/include/openssl/cast.h deleted file mode 100644 index 2cc89ae0..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/cast.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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_CAST_H -# define HEADER_CAST_H - -# include - -# ifndef OPENSSL_NO_CAST -# ifdef __cplusplus -extern "C" { -# endif - -# define CAST_ENCRYPT 1 -# define CAST_DECRYPT 0 - -# define CAST_LONG unsigned int - -# define CAST_BLOCK 8 -# define CAST_KEY_LENGTH 16 - -typedef struct cast_key_st { - CAST_LONG data[32]; - int short_key; /* Use reduced rounds for short key */ -} CAST_KEY; - -void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); -void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, - const CAST_KEY *key, int enc); -void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); -void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); -void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *ks, unsigned char *iv, - int enc); -void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, - unsigned char *ivec, int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/cmac.h b/Hin2n/src/main/jniLibs/x86/include/openssl/cmac.h deleted file mode 100644 index 3535a9ab..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/cmac.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2010-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_CMAC_H -# define HEADER_CMAC_H - -# ifndef OPENSSL_NO_CMAC - -#ifdef __cplusplus -extern "C" { -#endif - -# include - -/* Opaque */ -typedef struct CMAC_CTX_st CMAC_CTX; - -CMAC_CTX *CMAC_CTX_new(void); -void CMAC_CTX_cleanup(CMAC_CTX *ctx); -void CMAC_CTX_free(CMAC_CTX *ctx); -EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); -int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); - -int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, - const EVP_CIPHER *cipher, ENGINE *impl); -int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); -int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); -int CMAC_resume(CMAC_CTX *ctx); - -#ifdef __cplusplus -} -#endif - -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/cms.h b/Hin2n/src/main/jniLibs/x86/include/openssl/cms.h deleted file mode 100644 index c7627968..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/cms.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 2008-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_CMS_H -# define HEADER_CMS_H - -# include - -# ifndef OPENSSL_NO_CMS -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -typedef struct CMS_ContentInfo_st CMS_ContentInfo; -typedef struct CMS_SignerInfo_st CMS_SignerInfo; -typedef struct CMS_CertificateChoices CMS_CertificateChoices; -typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; -typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; -typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; -typedef struct CMS_Receipt_st CMS_Receipt; -typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; -typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; - -DEFINE_STACK_OF(CMS_SignerInfo) -DEFINE_STACK_OF(CMS_RecipientEncryptedKey) -DEFINE_STACK_OF(CMS_RecipientInfo) -DEFINE_STACK_OF(CMS_RevocationInfoChoice) -DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) -DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) -DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) - -# define CMS_SIGNERINFO_ISSUER_SERIAL 0 -# define CMS_SIGNERINFO_KEYIDENTIFIER 1 - -# define CMS_RECIPINFO_NONE -1 -# define CMS_RECIPINFO_TRANS 0 -# define CMS_RECIPINFO_AGREE 1 -# define CMS_RECIPINFO_KEK 2 -# define CMS_RECIPINFO_PASS 3 -# define CMS_RECIPINFO_OTHER 4 - -/* S/MIME related flags */ - -# define CMS_TEXT 0x1 -# define CMS_NOCERTS 0x2 -# define CMS_NO_CONTENT_VERIFY 0x4 -# define CMS_NO_ATTR_VERIFY 0x8 -# define CMS_NOSIGS \ - (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY) -# define CMS_NOINTERN 0x10 -# define CMS_NO_SIGNER_CERT_VERIFY 0x20 -# define CMS_NOVERIFY 0x20 -# define CMS_DETACHED 0x40 -# define CMS_BINARY 0x80 -# define CMS_NOATTR 0x100 -# define CMS_NOSMIMECAP 0x200 -# define CMS_NOOLDMIMETYPE 0x400 -# define CMS_CRLFEOL 0x800 -# define CMS_STREAM 0x1000 -# define CMS_NOCRL 0x2000 -# define CMS_PARTIAL 0x4000 -# define CMS_REUSE_DIGEST 0x8000 -# define CMS_USE_KEYID 0x10000 -# define CMS_DEBUG_DECRYPT 0x20000 -# define CMS_KEY_PARAM 0x40000 -# define CMS_ASCIICRLF 0x80000 - -const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms); - -BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); -int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); - -ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); -int CMS_is_detached(CMS_ContentInfo *cms); -int CMS_set_detached(CMS_ContentInfo *cms, int detached); - -# ifdef HEADER_PEM_H -DECLARE_PEM_rw_const(CMS, CMS_ContentInfo) -# endif -int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms); -CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms); -int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms); - -BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); -int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); -int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, - int flags); -CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont); -int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags); - -int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, - unsigned int flags); - -CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, BIO *data, - unsigned int flags); - -CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, - X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, unsigned int flags); - -int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags); -CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags); - -int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, - unsigned int flags); -CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, - unsigned int flags); - -int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, - const unsigned char *key, size_t keylen, - BIO *dcont, BIO *out, unsigned int flags); - -CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, - const unsigned char *key, - size_t keylen, unsigned int flags); - -int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, - const unsigned char *key, size_t keylen); - -int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, - X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags); - -int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, - STACK_OF(X509) *certs, - X509_STORE *store, unsigned int flags); - -STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); - -CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, - const EVP_CIPHER *cipher, unsigned int flags); - -int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, - BIO *dcont, BIO *out, unsigned int flags); - -int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert); -int CMS_decrypt_set1_key(CMS_ContentInfo *cms, - unsigned char *key, size_t keylen, - const unsigned char *id, size_t idlen); -int CMS_decrypt_set1_password(CMS_ContentInfo *cms, - unsigned char *pass, ossl_ssize_t passlen); - -STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); -int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); -EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri); -CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); -CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, - X509 *recip, unsigned int flags); -int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); -int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); -int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, - EVP_PKEY **pk, X509 **recip, - X509_ALGOR **palg); -int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, - ASN1_INTEGER **sno); - -CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, - unsigned char *key, size_t keylen, - unsigned char *id, size_t idlen, - ASN1_GENERALIZEDTIME *date, - ASN1_OBJECT *otherTypeId, - ASN1_TYPE *otherType); - -int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, - X509_ALGOR **palg, - ASN1_OCTET_STRING **pid, - ASN1_GENERALIZEDTIME **pdate, - ASN1_OBJECT **potherid, - ASN1_TYPE **pothertype); - -int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, - unsigned char *key, size_t keylen); - -int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, - const unsigned char *id, size_t idlen); - -int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, - unsigned char *pass, - ossl_ssize_t passlen); - -CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, - int iter, int wrap_nid, - int pbe_nid, - unsigned char *pass, - ossl_ssize_t passlen, - const EVP_CIPHER *kekciph); - -int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); -int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); - -int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, - unsigned int flags); -CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); - -int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); -const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); - -CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms); -int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); -int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); -STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); - -CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms); -int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); -int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); -STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); - -int CMS_SignedData_init(CMS_ContentInfo *cms); -CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, - X509 *signer, EVP_PKEY *pk, const EVP_MD *md, - unsigned int flags); -EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si); -EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si); -STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); - -void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); -int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, ASN1_INTEGER **sno); -int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); -int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs, - unsigned int flags); -void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, - X509 **signer, X509_ALGOR **pdig, - X509_ALGOR **psig); -ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); -int CMS_SignerInfo_sign(CMS_SignerInfo *si); -int CMS_SignerInfo_verify(CMS_SignerInfo *si); -int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain); - -int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs); -int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, - int algnid, int keysize); -int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap); - -int CMS_signed_get_attr_count(const CMS_SignerInfo *si); -int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, - int lastpos); -int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc); -X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc); -int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); -int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int type, - const void *bytes, int len); -int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, - int nid, int type, - const void *bytes, int len); -int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, - const char *attrname, int type, - const void *bytes, int len); -void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, - int lastpos, int type); - -int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si); -int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, - int lastpos); -int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int lastpos); -X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc); -X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc); -int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); -int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int type, - const void *bytes, int len); -int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, - int nid, int type, - const void *bytes, int len); -int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, - const char *attrname, int type, - const void *bytes, int len); -void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, - int lastpos, int type); - -int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); -CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, - int allorfirst, - STACK_OF(GENERAL_NAMES) - *receiptList, STACK_OF(GENERAL_NAMES) - *receiptsTo); -int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); -void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, - ASN1_STRING **pcid, - int *pallorfirst, - STACK_OF(GENERAL_NAMES) **plist, - STACK_OF(GENERAL_NAMES) **prto); -int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, - X509_ALGOR **palg, - ASN1_OCTET_STRING **pukm); -STACK_OF(CMS_RecipientEncryptedKey) -*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri); - -int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, - X509_ALGOR **pubalg, - ASN1_BIT_STRING **pubkey, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, - ASN1_INTEGER **sno); - -int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert); - -int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, - ASN1_OCTET_STRING **keyid, - ASN1_GENERALIZEDTIME **tm, - CMS_OtherKeyAttribute **other, - X509_NAME **issuer, ASN1_INTEGER **sno); -int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, - X509 *cert); -int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); -EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri); -int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, - CMS_RecipientInfo *ri, - CMS_RecipientEncryptedKey *rek); - -int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, - ASN1_OCTET_STRING *ukm, int keylen); - -/* Backward compatibility for spelling errors. */ -# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM -# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \ - CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/cmserr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/cmserr.h deleted file mode 100644 index 7dbc13dc..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/cmserr.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/comp.h b/Hin2n/src/main/jniLibs/x86/include/openssl/comp.h deleted file mode 100644 index d814d3cf..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/comp.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 -# define HEADER_COMP_H - -# include - -# ifndef OPENSSL_NO_COMP -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - - - -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); - -int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); -int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); - -COMP_METHOD *COMP_zlib(void); - -#if OPENSSL_API_COMPAT < 0x10100000L -#define COMP_zlib_cleanup() while(0) continue -#endif - -# ifdef HEADER_BIO_H -# ifdef ZLIB -const BIO_METHOD *BIO_f_zlib(void); -# endif -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/comperr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/comperr.h deleted file mode 100644 index 90231e9a..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/comperr.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/conf.h b/Hin2n/src/main/jniLibs/x86/include/openssl/conf.h deleted file mode 100644 index 7336cd2f..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/conf.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 1995-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_CONF_H -# define HEADER_CONF_H - -# include -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - char *section; - char *name; - char *value; -} CONF_VALUE; - -DEFINE_STACK_OF(CONF_VALUE) -DEFINE_LHASH_OF(CONF_VALUE); - -struct conf_st; -struct conf_method_st; -typedef struct conf_method_st CONF_METHOD; - -struct conf_method_st { - const char *name; - CONF *(*create) (CONF_METHOD *meth); - int (*init) (CONF *conf); - int (*destroy) (CONF *conf); - int (*destroy_data) (CONF *conf); - int (*load_bio) (CONF *conf, BIO *bp, long *eline); - int (*dump) (const CONF *conf, BIO *bp); - int (*is_number) (const CONF *conf, char c); - int (*to_int) (const CONF *conf, char c); - int (*load) (CONF *conf, const char *name, long *eline); -}; - -/* Module definitions */ - -typedef struct conf_imodule_st CONF_IMODULE; -typedef struct conf_module_st CONF_MODULE; - -DEFINE_STACK_OF(CONF_MODULE) -DEFINE_STACK_OF(CONF_IMODULE) - -/* DSO module function typedefs */ -typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); -typedef void conf_finish_func (CONF_IMODULE *md); - -# define CONF_MFLAGS_IGNORE_ERRORS 0x1 -# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 -# define CONF_MFLAGS_SILENT 0x4 -# define CONF_MFLAGS_NO_DSO 0x8 -# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 -# define CONF_MFLAGS_DEFAULT_SECTION 0x20 - -int CONF_set_default_method(CONF_METHOD *meth); -void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); -LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, - long *eline); -# ifndef OPENSSL_NO_STDIO -LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, - long *eline); -# endif -LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, - long *eline); -STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, - const char *section); -char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -void CONF_free(LHASH_OF(CONF_VALUE) *conf); -#ifndef OPENSSL_NO_STDIO -int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); -#endif -int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); - -DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name)) - -#if OPENSSL_API_COMPAT < 0x10100000L -# define OPENSSL_no_config() \ - OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) -#endif - -/* - * New conf code. The semantics are different from the functions above. If - * that wasn't the case, the above functions would have been replaced - */ - -struct conf_st { - CONF_METHOD *meth; - void *meth_data; - LHASH_OF(CONF_VALUE) *data; -}; - -CONF *NCONF_new(CONF_METHOD *meth); -CONF_METHOD *NCONF_default(void); -CONF_METHOD *NCONF_WIN32(void); -void NCONF_free(CONF *conf); -void NCONF_free_data(CONF *conf); - -int NCONF_load(CONF *conf, const char *file, long *eline); -# ifndef OPENSSL_NO_STDIO -int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); -# endif -int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); -STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, - const char *section); -char *NCONF_get_string(const CONF *conf, const char *group, const char *name); -int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, - long *result); -#ifndef OPENSSL_NO_STDIO -int NCONF_dump_fp(const CONF *conf, FILE *out); -#endif -int NCONF_dump_bio(const CONF *conf, BIO *out); - -#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) - -/* Module functions */ - -int CONF_modules_load(const CONF *cnf, const char *appname, - unsigned long flags); -int CONF_modules_load_file(const char *filename, const char *appname, - unsigned long flags); -void CONF_modules_unload(int all); -void CONF_modules_finish(void); -#if OPENSSL_API_COMPAT < 0x10100000L -# define CONF_modules_free() while(0) continue -#endif -int CONF_module_add(const char *name, conf_init_func *ifunc, - conf_finish_func *ffunc); - -const char *CONF_imodule_get_name(const CONF_IMODULE *md); -const char *CONF_imodule_get_value(const CONF_IMODULE *md); -void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); -void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); -CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); -unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); -void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); -void *CONF_module_get_usr_data(CONF_MODULE *pmod); -void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); - -char *CONF_get1_default_config_file(void); - -int CONF_parse_list(const char *list, int sep, int nospc, - int (*list_cb) (const char *elem, int len, void *usr), - void *arg); - -void OPENSSL_load_builtin_modules(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/conf_api.h b/Hin2n/src/main/jniLibs/x86/include/openssl/conf_api.h deleted file mode 100644 index a0275ad7..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/conf_api.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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_CONF_API_H -# define HEADER_CONF_API_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Up until OpenSSL 0.9.5a, this was new_section */ -CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); -/* Up until OpenSSL 0.9.5a, this was get_section */ -CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); -/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ -STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, - const char *section); - -int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); -char *_CONF_get_string(const CONF *conf, const char *section, - const char *name); -long _CONF_get_number(const CONF *conf, const char *section, - const char *name); - -int _CONF_new_data(CONF *conf); -void _CONF_free_data(CONF *conf); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/conferr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/conferr.h deleted file mode 100644 index 32b92291..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/conferr.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/crypto.h b/Hin2n/src/main/jniLibs/x86/include/openssl/crypto.h deleted file mode 100644 index 7d0b5262..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/crypto.h +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_CRYPTO_H -# define HEADER_CRYPTO_H - -# include -# include - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# endif - -# include -# include -# include -# include -# include - -# ifdef CHARSET_EBCDIC -# include -# endif - -/* - * Resolve problems on some operating systems with symbol names that clash - * one way or another - */ -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSLeay OpenSSL_version_num -# define SSLeay_version OpenSSL_version -# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER -# define SSLEAY_VERSION OPENSSL_VERSION -# define SSLEAY_CFLAGS OPENSSL_CFLAGS -# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON -# define SSLEAY_PLATFORM OPENSSL_PLATFORM -# define SSLEAY_DIR OPENSSL_DIR - -/* - * Old type for allocating dynamic locks. No longer used. Use the new thread - * API instead. - */ -typedef struct { - int dummy; -} CRYPTO_dynlock; - -# endif /* OPENSSL_API_COMPAT */ - -typedef void CRYPTO_RWLOCK; - -CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void); -int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock); -int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock); -int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock); -void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock); - -int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock); - -/* - * The following can be used to detect memory leaks in the library. If - * used, it turns on malloc checking - */ -# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */ -# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */ -# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */ -# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */ - -struct crypto_ex_data_st { - STACK_OF(void) *sk; -}; -DEFINE_STACK_OF(void) - -/* - * Per class, we have a STACK of function pointers. - */ -# define CRYPTO_EX_INDEX_SSL 0 -# define CRYPTO_EX_INDEX_SSL_CTX 1 -# define CRYPTO_EX_INDEX_SSL_SESSION 2 -# define CRYPTO_EX_INDEX_X509 3 -# define CRYPTO_EX_INDEX_X509_STORE 4 -# define CRYPTO_EX_INDEX_X509_STORE_CTX 5 -# define CRYPTO_EX_INDEX_DH 6 -# define CRYPTO_EX_INDEX_DSA 7 -# define CRYPTO_EX_INDEX_EC_KEY 8 -# define CRYPTO_EX_INDEX_RSA 9 -# define CRYPTO_EX_INDEX_ENGINE 10 -# define CRYPTO_EX_INDEX_UI 11 -# define CRYPTO_EX_INDEX_BIO 12 -# define CRYPTO_EX_INDEX_APP 13 -# define CRYPTO_EX_INDEX_UI_METHOD 14 -# define CRYPTO_EX_INDEX_DRBG 15 -# define CRYPTO_EX_INDEX__COUNT 16 - -/* No longer needed, so this is a no-op */ -#define OPENSSL_malloc_init() while(0) continue - -int CRYPTO_mem_ctrl(int mode); - -# define OPENSSL_malloc(num) \ - CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_zalloc(num) \ - CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_realloc(addr, num) \ - CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_clear_realloc(addr, old_num, num) \ - CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_clear_free(addr, num) \ - CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_free(addr) \ - CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_memdup(str, s) \ - CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_strdup(str) \ - CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_strndup(str, n) \ - CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_malloc(num) \ - CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_zalloc(num) \ - CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_free(addr) \ - CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_clear_free(addr, num) \ - CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_actual_size(ptr) \ - CRYPTO_secure_actual_size(ptr) - -size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz); -size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz); -size_t OPENSSL_strnlen(const char *str, size_t maxlen); -char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len); -unsigned char *OPENSSL_hexstr2buf(const char *str, long *len); -int OPENSSL_hexchar2int(unsigned char c); - -# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type)) - -unsigned long OpenSSL_version_num(void); -const char *OpenSSL_version(int type); -# define OPENSSL_VERSION 0 -# define OPENSSL_CFLAGS 1 -# define OPENSSL_BUILT_ON 2 -# define OPENSSL_PLATFORM 3 -# define OPENSSL_DIR 4 -# define OPENSSL_ENGINES_DIR 5 - -int OPENSSL_issetugid(void); - -typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); -typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); -typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, - void *from_d, int idx, long argl, void *argp); -__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, - CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); -/* No longer use an index. */ -int CRYPTO_free_ex_index(int class_index, int idx); - -/* - * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a - * given class (invokes whatever per-class callbacks are applicable) - */ -int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); -int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, - const CRYPTO_EX_DATA *from); - -void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); - -/* - * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular - * index (relative to the class type involved) - */ -int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); -void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); - -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * This function cleans up all "ex_data" state. It mustn't be called under - * potential race-conditions. - */ -# define CRYPTO_cleanup_all_ex_data() while(0) continue - -/* - * The old locking functions have been removed completely without compatibility - * macros. This is because the old functions either could not properly report - * errors, or the returned error values were not clearly documented. - * Replacing the locking functions with no-ops would cause race condition - * issues in the affected applications. It is far better for them to fail at - * compile time. - * On the other hand, the locking callbacks are no longer used. Consequently, - * the callback management functions can be safely replaced with no-op macros. - */ -# define CRYPTO_num_locks() (1) -# define CRYPTO_set_locking_callback(func) -# define CRYPTO_get_locking_callback() (NULL) -# define CRYPTO_set_add_lock_callback(func) -# define CRYPTO_get_add_lock_callback() (NULL) - -/* - * These defines where used in combination with the old locking callbacks, - * they are not called anymore, but old code that's not called might still - * use them. - */ -# define CRYPTO_LOCK 1 -# define CRYPTO_UNLOCK 2 -# define CRYPTO_READ 4 -# define CRYPTO_WRITE 8 - -/* This structure is no longer used */ -typedef struct crypto_threadid_st { - int dummy; -} CRYPTO_THREADID; -/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ -# define CRYPTO_THREADID_set_numeric(id, val) -# define CRYPTO_THREADID_set_pointer(id, ptr) -# define CRYPTO_THREADID_set_callback(threadid_func) (0) -# define CRYPTO_THREADID_get_callback() (NULL) -# define CRYPTO_THREADID_current(id) -# define CRYPTO_THREADID_cmp(a, b) (-1) -# define CRYPTO_THREADID_cpy(dest, src) -# define CRYPTO_THREADID_hash(id) (0UL) - -# if OPENSSL_API_COMPAT < 0x10000000L -# define CRYPTO_set_id_callback(func) -# define CRYPTO_get_id_callback() (NULL) -# define CRYPTO_thread_id() (0UL) -# endif /* OPENSSL_API_COMPAT < 0x10000000L */ - -# define CRYPTO_set_dynlock_create_callback(dyn_create_function) -# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function) -# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function) -# define CRYPTO_get_dynlock_create_callback() (NULL) -# define CRYPTO_get_dynlock_lock_callback() (NULL) -# define CRYPTO_get_dynlock_destroy_callback() (NULL) -# endif /* OPENSSL_API_COMPAT < 0x10100000L */ - -int CRYPTO_set_mem_functions( - void *(*m) (size_t, const char *, int), - void *(*r) (void *, size_t, const char *, int), - void (*f) (void *, const char *, int)); -int CRYPTO_set_mem_debug(int flag); -void CRYPTO_get_mem_functions( - void *(**m) (size_t, const char *, int), - void *(**r) (void *, size_t, const char *, int), - void (**f) (void *, const char *, int)); - -void *CRYPTO_malloc(size_t num, const char *file, int line); -void *CRYPTO_zalloc(size_t num, const char *file, int line); -void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); -char *CRYPTO_strdup(const char *str, const char *file, int line); -char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); -void CRYPTO_free(void *ptr, const char *file, int line); -void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line); -void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); -void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num, - const char *file, int line); - -int CRYPTO_secure_malloc_init(size_t sz, int minsize); -int CRYPTO_secure_malloc_done(void); -void *CRYPTO_secure_malloc(size_t num, const char *file, int line); -void *CRYPTO_secure_zalloc(size_t num, const char *file, int line); -void CRYPTO_secure_free(void *ptr, const char *file, int line); -void CRYPTO_secure_clear_free(void *ptr, size_t num, - const char *file, int line); -int CRYPTO_secure_allocated(const void *ptr); -int CRYPTO_secure_malloc_initialized(void); -size_t CRYPTO_secure_actual_size(void *ptr); -size_t CRYPTO_secure_used(void); - -void OPENSSL_cleanse(void *ptr, size_t len); - -# ifndef OPENSSL_NO_CRYPTO_MDEBUG -# define OPENSSL_mem_debug_push(info) \ - CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_mem_debug_pop() \ - CRYPTO_mem_debug_pop() -int CRYPTO_mem_debug_push(const char *info, const char *file, int line); -int CRYPTO_mem_debug_pop(void); -void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount); - -/*- - * Debugging functions (enabled by CRYPTO_set_mem_debug(1)) - * The flag argument has the following significance: - * 0: called before the actual memory allocation has taken place - * 1: called after the actual memory allocation has taken place - */ -void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag, - const char *file, int line); -void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag, - const char *file, int line); -void CRYPTO_mem_debug_free(void *addr, int flag, - const char *file, int line); - -int CRYPTO_mem_leaks_cb(int (*cb) (const char *str, size_t len, void *u), - void *u); -# ifndef OPENSSL_NO_STDIO -int CRYPTO_mem_leaks_fp(FILE *); -# endif -int CRYPTO_mem_leaks(BIO *bio); -# endif - -/* die if we have to */ -ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line); -# if OPENSSL_API_COMPAT < 0x10100000L -# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l)) -# endif -# define OPENSSL_assert(e) \ - (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1)) - -int OPENSSL_isservice(void); - -int FIPS_mode(void); -int FIPS_mode_set(int r); - -void OPENSSL_init(void); -# ifdef OPENSSL_SYS_UNIX -void OPENSSL_fork_prepare(void); -void OPENSSL_fork_parent(void); -void OPENSSL_fork_child(void); -# endif - -struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); -int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); -int OPENSSL_gmtime_diff(int *pday, int *psec, - const struct tm *from, const struct tm *to); - -/* - * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. - * It takes an amount of time dependent on |len|, but independent of the - * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements - * into a defined order as the return value when a != b is undefined, other - * than to be non-zero. - */ -int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len); - -/* Standard initialisation options */ -# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L -# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L -# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L -# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L -# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L -# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L -# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L -# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L -# define OPENSSL_INIT_ASYNC 0x00000100L -# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L -# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L -# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L -# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L -# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L -# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L -# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L -/* OPENSSL_INIT_ZLIB 0x00010000L */ -# define OPENSSL_INIT_ATFORK 0x00020000L -/* OPENSSL_INIT_BASE_ONLY 0x00040000L */ -# define OPENSSL_INIT_NO_ATEXIT 0x00080000L -/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */ -/* Max OPENSSL_INIT flag value is 0x80000000 */ - -/* openssl and dasync not counted as builtin */ -# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \ - (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \ - | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \ - OPENSSL_INIT_ENGINE_PADLOCK) - - -/* Library initialisation functions */ -void OPENSSL_cleanup(void); -int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); -int OPENSSL_atexit(void (*handler)(void)); -void OPENSSL_thread_stop(void); - -/* Low-level control of initialization */ -OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void); -# ifndef OPENSSL_NO_STDIO -int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, - const char *config_filename); -void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, - unsigned long flags); -int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, - const char *config_appname); -# endif -void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings); - -# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) -# if defined(_WIN32) -# if defined(BASETYPES) || defined(_WINDEF_H) -/* application has to include in order to use this */ -typedef DWORD CRYPTO_THREAD_LOCAL; -typedef DWORD CRYPTO_THREAD_ID; - -typedef LONG CRYPTO_ONCE; -# define CRYPTO_ONCE_STATIC_INIT 0 -# endif -# else -# include -typedef pthread_once_t CRYPTO_ONCE; -typedef pthread_key_t CRYPTO_THREAD_LOCAL; -typedef pthread_t CRYPTO_THREAD_ID; - -# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT -# endif -# endif - -# if !defined(CRYPTO_ONCE_STATIC_INIT) -typedef unsigned int CRYPTO_ONCE; -typedef unsigned int CRYPTO_THREAD_LOCAL; -typedef unsigned int CRYPTO_THREAD_ID; -# define CRYPTO_ONCE_STATIC_INIT 0 -# endif - -int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)); - -int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)); -void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key); -int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val); -int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key); - -CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void); -int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/cryptoerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/cryptoerr.h deleted file mode 100644 index 3db5a4ee..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/cryptoerr.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ct.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ct.h deleted file mode 100644 index ebdba34d..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ct.h +++ /dev/null @@ -1,474 +0,0 @@ -/* - * 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 - -# ifndef OPENSSL_NO_CT -# include -# include -# include -# include -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/cterr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/cterr.h deleted file mode 100644 index feb7bc56..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/cterr.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/des.h b/Hin2n/src/main/jniLibs/x86/include/openssl/des.h deleted file mode 100644 index be4abbdf..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/des.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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_DES_H -# define HEADER_DES_H - -# include - -# ifndef OPENSSL_NO_DES -# ifdef __cplusplus -extern "C" { -# endif -# include - -typedef unsigned int DES_LONG; - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -typedef unsigned char DES_cblock[8]; -typedef /* const */ unsigned char const_DES_cblock[8]; -/* - * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and - * const_DES_cblock * are incompatible pointer types. - */ - -typedef struct DES_ks { - union { - DES_cblock cblock; - /* - * make sure things are correct size on machines with 8 byte longs - */ - DES_LONG deslong[2]; - } ks[16]; -} DES_key_schedule; - -# define DES_KEY_SZ (sizeof(DES_cblock)) -# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) - -# define DES_ENCRYPT 1 -# define DES_DECRYPT 0 - -# define DES_CBC_MODE 0 -# define DES_PCBC_MODE 1 - -# 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)) - -OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */ -# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) - -const char *DES_options(void); -void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, int enc); -DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, - long length, DES_key_schedule *schedule, - const_DES_cblock *ivec); -/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ -void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, const_DES_cblock *inw, - const_DES_cblock *outw, int enc); -void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks, int enc); - -/* - * This is the DES encryption function that gets called by just about every - * other DES routine in the library. You should not use this function except - * to implement 'modes' of DES. I say this because the functions that call - * this routine do the conversion from 'char *' to long, and this needs to be - * done to make sure 'non-aligned' memory access do not occur. The - * characters are loaded 'little endian'. Data is a pointer to 2 unsigned - * long's and ks is the DES_key_schedule to use. enc, is non zero specifies - * encryption, zero if decryption. - */ -void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); - -/* - * This functions is the same as DES_encrypt1() except that the DES initial - * permutation (IP) and final permutation (FP) have been left out. As for - * DES_encrypt1(), you should not use this function. It is used by the - * routines in the library that implement triple DES. IP() DES_encrypt2() - * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() - * DES_encrypt1() DES_encrypt1() except faster :-). - */ -void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); - -void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, DES_cblock *ivec, int enc); -void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num, int enc); -void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, - int numbits, long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int enc); -void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num); -char *DES_fcrypt(const char *buf, const char *salt, char *ret); -char *DES_crypt(const char *buf, const char *salt); -void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, - DES_cblock *ivec); -void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], - long length, int out_count, DES_cblock *seed); -int DES_random_key(DES_cblock *ret); -void DES_set_odd_parity(DES_cblock *key); -int DES_check_key_parity(const_DES_cblock *key); -int DES_is_weak_key(const_DES_cblock *key); -/* - * DES_set_key (= set_key = DES_key_sched = key_sched) calls - * DES_set_key_checked if global variable DES_check_key is set, - * DES_set_key_unchecked otherwise. - */ -int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); -int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); -int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); -void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); -void DES_string_to_key(const char *str, DES_cblock *key); -void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); -void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int *num, int enc); -void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int *num); - -# define DES_fixup_key_parity DES_set_odd_parity - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/dh.h b/Hin2n/src/main/jniLibs/x86/include/openssl/dh.h deleted file mode 100644 index 3527540c..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/dh.h +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright 1995-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_DH_H -# define HEADER_DH_H - -# include - -# ifndef OPENSSL_NO_DH -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include - -# ifdef __cplusplus -extern "C" { -# endif - -# ifndef OPENSSL_DH_MAX_MODULUS_BITS -# define OPENSSL_DH_MAX_MODULUS_BITS 10000 -# endif - -# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 - -# define DH_FLAG_CACHE_MONT_P 0x01 - -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define DH_FLAG_NO_EXP_CONSTTIME 0x00 -# endif - -/* - * If this flag is set the DH method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define DH_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define DH_FLAG_NON_FIPS_ALLOW 0x0400 - -/* Already defined in ossl_typ.h */ -/* typedef struct dh_st DH; */ -/* typedef struct dh_method DH_METHOD; */ - -DECLARE_ASN1_ITEM(DHparams) - -# define DH_GENERATOR_2 2 -/* #define DH_GENERATOR_3 3 */ -# define DH_GENERATOR_5 5 - -/* DH_check error codes */ -# define DH_CHECK_P_NOT_PRIME 0x01 -# define DH_CHECK_P_NOT_SAFE_PRIME 0x02 -# define DH_UNABLE_TO_CHECK_GENERATOR 0x04 -# define DH_NOT_SUITABLE_GENERATOR 0x08 -# define DH_CHECK_Q_NOT_PRIME 0x10 -# define DH_CHECK_INVALID_Q_VALUE 0x20 -# define DH_CHECK_INVALID_J_VALUE 0x40 - -/* DH_check_pub_key error codes */ -# define DH_CHECK_PUBKEY_TOO_SMALL 0x01 -# define DH_CHECK_PUBKEY_TOO_LARGE 0x02 -# define DH_CHECK_PUBKEY_INVALID 0x04 - -/* - * primes p where (p-1)/2 is prime too are called "safe"; we define this for - * backward compatibility: - */ -# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME - -# define d2i_DHparams_fp(fp,x) \ - (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ - (char *(*)())d2i_DHparams, \ - (fp), \ - (unsigned char **)(x)) -# define i2d_DHparams_fp(fp,x) \ - ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x)) -# define d2i_DHparams_bio(bp,x) \ - ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) -# define i2d_DHparams_bio(bp,x) \ - ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) - -# define d2i_DHxparams_fp(fp,x) \ - (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ - (char *(*)())d2i_DHxparams, \ - (fp), \ - (unsigned char **)(x)) -# define i2d_DHxparams_fp(fp,x) \ - ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x)) -# define d2i_DHxparams_bio(bp,x) \ - ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) -# define i2d_DHxparams_bio(bp,x) \ - ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x) - -DH *DHparams_dup(DH *); - -const DH_METHOD *DH_OpenSSL(void); - -void DH_set_default_method(const DH_METHOD *meth); -const DH_METHOD *DH_get_default_method(void); -int DH_set_method(DH *dh, const DH_METHOD *meth); -DH *DH_new_method(ENGINE *engine); - -DH *DH_new(void); -void DH_free(DH *dh); -int DH_up_ref(DH *dh); -int DH_bits(const DH *dh); -int DH_size(const DH *dh); -int DH_security_bits(const DH *dh); -#define DH_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef) -int DH_set_ex_data(DH *d, int idx, void *arg); -void *DH_get_ex_data(DH *d, int idx); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator, - void (*callback) (int, int, - void *), - void *cb_arg)) - -/* New version */ -int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, - BN_GENCB *cb); - -int DH_check_params_ex(const DH *dh); -int DH_check_ex(const DH *dh); -int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key); -int DH_check_params(const DH *dh, int *ret); -int DH_check(const DH *dh, int *codes); -int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes); -int DH_generate_key(DH *dh); -int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); -int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh); -DH *d2i_DHparams(DH **a, const unsigned char **pp, long length); -int i2d_DHparams(const DH *a, unsigned char **pp); -DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length); -int i2d_DHxparams(const DH *a, unsigned char **pp); -# ifndef OPENSSL_NO_STDIO -int DHparams_print_fp(FILE *fp, const DH *x); -# endif -int DHparams_print(BIO *bp, const DH *x); - -/* RFC 5114 parameters */ -DH *DH_get_1024_160(void); -DH *DH_get_2048_224(void); -DH *DH_get_2048_256(void); - -/* Named parameters, currently RFC7919 */ -DH *DH_new_by_nid(int nid); -int DH_get_nid(const DH *dh); - -# ifndef OPENSSL_NO_CMS -/* RFC2631 KDF */ -int DH_KDF_X9_42(unsigned char *out, size_t outlen, - const unsigned char *Z, size_t Zlen, - ASN1_OBJECT *key_oid, - const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); -# endif - -void DH_get0_pqg(const DH *dh, - const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); -void DH_get0_key(const DH *dh, - const BIGNUM **pub_key, const BIGNUM **priv_key); -int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); -const BIGNUM *DH_get0_p(const DH *dh); -const BIGNUM *DH_get0_q(const DH *dh); -const BIGNUM *DH_get0_g(const DH *dh); -const BIGNUM *DH_get0_priv_key(const DH *dh); -const BIGNUM *DH_get0_pub_key(const DH *dh); -void DH_clear_flags(DH *dh, int flags); -int DH_test_flags(const DH *dh, int flags); -void DH_set_flags(DH *dh, int flags); -ENGINE *DH_get0_engine(DH *d); -long DH_get_length(const DH *dh); -int DH_set_length(DH *dh, long length); - -DH_METHOD *DH_meth_new(const char *name, int flags); -void DH_meth_free(DH_METHOD *dhm); -DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); -const char *DH_meth_get0_name(const DH_METHOD *dhm); -int DH_meth_set1_name(DH_METHOD *dhm, const char *name); -int DH_meth_get_flags(const DH_METHOD *dhm); -int DH_meth_set_flags(DH_METHOD *dhm, int flags); -void *DH_meth_get0_app_data(const DH_METHOD *dhm); -int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); -int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); -int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); -int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) - (unsigned char *key, const BIGNUM *pub_key, DH *dh); -int DH_meth_set_compute_key(DH_METHOD *dhm, - int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); -int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) - (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - BN_CTX *, BN_MONT_CTX *); -int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, - int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); -int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); -int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); -int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); -int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); -int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) - (DH *, int, int, BN_GENCB *); -int DH_meth_set_generate_params(DH_METHOD *dhm, - int (*generate_params) (DH *, int, int, BN_GENCB *)); - - -# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) - -# define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) - -# define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) - -# define EVP_PKEY_CTX_set_dh_nid(ctx, nid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, \ - EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_DH_NID, nid, NULL) - -# define EVP_PKEY_CTX_set_dh_pad(ctx, pad) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_PAD, pad, NULL) - -# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL) - -# define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL) - -# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)(oid)) - -# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)(poid)) - -# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)(plen)) - -# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)(p)) - -# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)(p)) - -# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) -# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) -# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) -# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) -# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) -# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) -# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15) -# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16) - -/* KDF types */ -# define EVP_PKEY_DH_KDF_NONE 1 -# ifndef OPENSSL_NO_CMS -# define EVP_PKEY_DH_KDF_X9_42 2 -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/dherr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/dherr.h deleted file mode 100644 index 916b3bed..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/dherr.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/dsa.h b/Hin2n/src/main/jniLibs/x86/include/openssl/dsa.h deleted file mode 100644 index 6d8a18a4..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/dsa.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 1995-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_DSA_H -# define HEADER_DSA_H - -# include - -# ifndef OPENSSL_NO_DSA -# ifdef __cplusplus -extern "C" { -# endif -# include -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include - -# ifndef OPENSSL_DSA_MAX_MODULUS_BITS -# define OPENSSL_DSA_MAX_MODULUS_BITS 10000 -# endif - -# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 - -# define DSA_FLAG_CACHE_MONT_P 0x01 -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define DSA_FLAG_NO_EXP_CONSTTIME 0x00 -# endif - -/* - * If this flag is set the DSA method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define DSA_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define DSA_FLAG_NON_FIPS_ALLOW 0x0400 -# define DSA_FLAG_FIPS_CHECKED 0x0800 - -/* Already defined in ossl_typ.h */ -/* typedef struct dsa_st DSA; */ -/* typedef struct dsa_method DSA_METHOD; */ - -typedef struct DSA_SIG_st DSA_SIG; - -# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ - (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) -# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ - (unsigned char *)(x)) -# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) -# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) - -DSA *DSAparams_dup(DSA *x); -DSA_SIG *DSA_SIG_new(void); -void DSA_SIG_free(DSA_SIG *a); -int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); -DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); -void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); -int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); - -DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); -int DSA_do_verify(const unsigned char *dgst, int dgst_len, - DSA_SIG *sig, DSA *dsa); - -const DSA_METHOD *DSA_OpenSSL(void); - -void DSA_set_default_method(const DSA_METHOD *); -const DSA_METHOD *DSA_get_default_method(void); -int DSA_set_method(DSA *dsa, const DSA_METHOD *); -const DSA_METHOD *DSA_get_method(DSA *d); - -DSA *DSA_new(void); -DSA *DSA_new_method(ENGINE *engine); -void DSA_free(DSA *r); -/* "up" the DSA object's reference count */ -int DSA_up_ref(DSA *r); -int DSA_size(const DSA *); -int DSA_bits(const DSA *d); -int DSA_security_bits(const DSA *d); - /* next 4 return -1 on error */ -DEPRECATEDIN_1_2_0(int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)) -int DSA_sign(int type, const unsigned char *dgst, int dlen, - unsigned char *sig, unsigned int *siglen, DSA *dsa); -int DSA_verify(int type, const unsigned char *dgst, int dgst_len, - const unsigned char *sigbuf, int siglen, DSA *dsa); -#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef) -int DSA_set_ex_data(DSA *d, int idx, void *arg); -void *DSA_get_ex_data(DSA *d, int idx); - -DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); -DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); -DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits, - unsigned char *seed, - int seed_len, - int *counter_ret, - unsigned long *h_ret, void - (*callback) (int, int, - void *), - void *cb_arg)) - -/* New version */ -int DSA_generate_parameters_ex(DSA *dsa, int bits, - const unsigned char *seed, int seed_len, - int *counter_ret, unsigned long *h_ret, - BN_GENCB *cb); - -int DSA_generate_key(DSA *a); -int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); -int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); -int i2d_DSAparams(const DSA *a, unsigned char **pp); - -int DSAparams_print(BIO *bp, const DSA *x); -int DSA_print(BIO *bp, const DSA *x, int off); -# ifndef OPENSSL_NO_STDIO -int DSAparams_print_fp(FILE *fp, const DSA *x); -int DSA_print_fp(FILE *bp, const DSA *x, int off); -# endif - -# define DSS_prime_checks 64 -/* - * Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only - * have one value here we set the number of checks to 64 which is the 128 bit - * security level that is the highest level and valid for creating a 3072 bit - * DSA key. - */ -# define DSA_is_prime(n, callback, cb_arg) \ - BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) - -# ifndef OPENSSL_NO_DH -/* - * Convert DSA structure (key or just parameters) into DH structure (be - * careful to avoid small subgroup attacks when using this!) - */ -DH *DSA_dup_DH(const DSA *r); -# endif - -# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) -# define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits, NULL) -# define EVP_PKEY_CTX_set_dsa_paramgen_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) - -void DSA_get0_pqg(const DSA *d, - const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); -void DSA_get0_key(const DSA *d, - const BIGNUM **pub_key, const BIGNUM **priv_key); -int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); -const BIGNUM *DSA_get0_p(const DSA *d); -const BIGNUM *DSA_get0_q(const DSA *d); -const BIGNUM *DSA_get0_g(const DSA *d); -const BIGNUM *DSA_get0_pub_key(const DSA *d); -const BIGNUM *DSA_get0_priv_key(const DSA *d); -void DSA_clear_flags(DSA *d, int flags); -int DSA_test_flags(const DSA *d, int flags); -void DSA_set_flags(DSA *d, int flags); -ENGINE *DSA_get0_engine(DSA *d); - -DSA_METHOD *DSA_meth_new(const char *name, int flags); -void DSA_meth_free(DSA_METHOD *dsam); -DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam); -const char *DSA_meth_get0_name(const DSA_METHOD *dsam); -int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name); -int DSA_meth_get_flags(const DSA_METHOD *dsam); -int DSA_meth_set_flags(DSA_METHOD *dsam, int flags); -void *DSA_meth_get0_app_data(const DSA_METHOD *dsam); -int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data); -DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam)) - (const unsigned char *, int, DSA *); -int DSA_meth_set_sign(DSA_METHOD *dsam, - DSA_SIG *(*sign) (const unsigned char *, int, DSA *)); -int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam)) - (DSA *, BN_CTX *, BIGNUM **, BIGNUM **); -int DSA_meth_set_sign_setup(DSA_METHOD *dsam, - int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)); -int (*DSA_meth_get_verify(const DSA_METHOD *dsam)) - (const unsigned char *, int, DSA_SIG *, DSA *); -int DSA_meth_set_verify(DSA_METHOD *dsam, - int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *)); -int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam)) - (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); -int DSA_meth_set_mod_exp(DSA_METHOD *dsam, - int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, - BN_MONT_CTX *)); -int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam)) - (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - BN_CTX *, BN_MONT_CTX *); -int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, - int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); -int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *); -int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *)); -int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *); -int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *)); -int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam)) - (DSA *, int, const unsigned char *, int, int *, unsigned long *, - BN_GENCB *); -int DSA_meth_set_paramgen(DSA_METHOD *dsam, - int (*paramgen) (DSA *, int, const unsigned char *, int, int *, - unsigned long *, BN_GENCB *)); -int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *); -int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *)); - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/dsaerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/dsaerr.h deleted file mode 100644 index 495a1ac8..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/dsaerr.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/dtls1.h b/Hin2n/src/main/jniLibs/x86/include/openssl/dtls1.h deleted file mode 100644 index d55ca9c3..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/dtls1.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2005-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_DTLS1_H -# define HEADER_DTLS1_H - -#ifdef __cplusplus -extern "C" { -#endif - -# define DTLS1_VERSION 0xFEFF -# define DTLS1_2_VERSION 0xFEFD -# define DTLS_MIN_VERSION DTLS1_VERSION -# define DTLS_MAX_VERSION DTLS1_2_VERSION -# define DTLS1_VERSION_MAJOR 0xFE - -# define DTLS1_BAD_VER 0x0100 - -/* Special value for method supporting multiple versions */ -# define DTLS_ANY_VERSION 0x1FFFF - -/* lengths of messages */ -/* - * Actually the max cookie length in DTLS is 255. But we can't change this now - * due to compatibility concerns. - */ -# define DTLS1_COOKIE_LENGTH 256 - -# define DTLS1_RT_HEADER_LENGTH 13 - -# define DTLS1_HM_HEADER_LENGTH 12 - -# define DTLS1_HM_BAD_FRAGMENT -2 -# define DTLS1_HM_FRAGMENT_RETRY -3 - -# define DTLS1_CCS_HEADER_LENGTH 1 - -# define DTLS1_AL_HEADER_LENGTH 2 - -/* Timeout multipliers */ -# define DTLS1_TMO_READ_COUNT 2 -# define DTLS1_TMO_WRITE_COUNT 2 - -# define DTLS1_TMO_ALERT_COUNT 12 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/e_os2.h b/Hin2n/src/main/jniLibs/x86/include/openssl/e_os2.h deleted file mode 100644 index 97a776cd..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/e_os2.h +++ /dev/null @@ -1,300 +0,0 @@ -/* - * 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_E_OS2_H -# define HEADER_E_OS2_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/****************************************************************************** - * Detect operating systems. This probably needs completing. - * The result is that at least one OPENSSL_SYS_os macro should be defined. - * However, if none is defined, Unix is assumed. - **/ - -# define OPENSSL_SYS_UNIX - -/* --------------------- Microsoft operating systems ---------------------- */ - -/* - * Note that MSDOS actually denotes 32-bit environments running on top of - * MS-DOS, such as DJGPP one. - */ -# if defined(OPENSSL_SYS_MSDOS) -# undef OPENSSL_SYS_UNIX -# endif - -/* - * For 32 bit environment, there seems to be the CygWin environment and then - * all the others that try to do the same thing Microsoft does... - */ -/* - * UEFI lives here because it might be built with a Microsoft toolchain and - * we need to avoid the false positive match on Windows. - */ -# if defined(OPENSSL_SYS_UEFI) -# undef OPENSSL_SYS_UNIX -# elif defined(OPENSSL_SYS_UWIN) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WIN32_UWIN -# else -# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN) -# define OPENSSL_SYS_WIN32_CYGWIN -# else -# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32) -# undef OPENSSL_SYS_UNIX -# if !defined(OPENSSL_SYS_WIN32) -# define OPENSSL_SYS_WIN32 -# endif -# endif -# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64) -# undef OPENSSL_SYS_UNIX -# if !defined(OPENSSL_SYS_WIN64) -# define OPENSSL_SYS_WIN64 -# endif -# endif -# if defined(OPENSSL_SYS_WINNT) -# undef OPENSSL_SYS_UNIX -# endif -# if defined(OPENSSL_SYS_WINCE) -# undef OPENSSL_SYS_UNIX -# endif -# endif -# endif - -/* Anything that tries to look like Microsoft is "Windows" */ -# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_SYS_MSDOS -# define OPENSSL_SYS_MSDOS -# endif -# endif - -/* - * DLL settings. This part is a bit tough, because it's up to the - * application implementor how he or she will link the application, so it - * requires some macro to be used. - */ -# ifdef OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_OPT_WINDLL -# if defined(_WINDLL) /* This is used when building OpenSSL to - * indicate that DLL linkage should be used */ -# define OPENSSL_OPT_WINDLL -# endif -# endif -# endif - -/* ------------------------------- OpenVMS -------------------------------- */ -# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS) -# if !defined(OPENSSL_SYS_VMS) -# undef OPENSSL_SYS_UNIX -# endif -# define OPENSSL_SYS_VMS -# if defined(__DECC) -# define OPENSSL_SYS_VMS_DECC -# elif defined(__DECCXX) -# define OPENSSL_SYS_VMS_DECC -# define OPENSSL_SYS_VMS_DECCXX -# else -# define OPENSSL_SYS_VMS_NODECC -# endif -# endif - -/* -------------------------------- Unix ---------------------------------- */ -# ifdef OPENSSL_SYS_UNIX -# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX) -# define OPENSSL_SYS_LINUX -# endif -# if defined(_AIX) && !defined(OPENSSL_SYS_AIX) -# define OPENSSL_SYS_AIX -# endif -# endif - -/* -------------------------------- VOS ----------------------------------- */ -# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS) -# define OPENSSL_SYS_VOS -# ifdef __HPPA__ -# define OPENSSL_SYS_VOS_HPPA -# endif -# ifdef __IA32__ -# define OPENSSL_SYS_VOS_IA32 -# endif -# endif - -/** - * That's it for OS-specific stuff - *****************************************************************************/ - -/* Specials for I/O an exit */ -# ifdef OPENSSL_SYS_MSDOS -# define OPENSSL_UNISTD_IO -# define OPENSSL_DECLARE_EXIT extern void exit(int); -# else -# define OPENSSL_UNISTD_IO OPENSSL_UNISTD -# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ -# endif - -/*- - * OPENSSL_EXTERN is normally used to declare a symbol with possible extra - * attributes to handle its presence in a shared library. - * OPENSSL_EXPORT is used to define a symbol with extra possible attributes - * to make it visible in a shared library. - * Care needs to be taken when a header file is used both to declare and - * define symbols. Basically, for any library that exports some global - * variables, the following code must be present in the header file that - * declares them, before OPENSSL_EXTERN is used: - * - * #ifdef SOME_BUILD_FLAG_MACRO - * # undef OPENSSL_EXTERN - * # define OPENSSL_EXTERN OPENSSL_EXPORT - * #endif - * - * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN - * have some generally sensible values. - */ - -# if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) -# define OPENSSL_EXPORT extern __declspec(dllexport) -# define OPENSSL_EXTERN extern __declspec(dllimport) -# else -# define OPENSSL_EXPORT extern -# define OPENSSL_EXTERN extern -# endif - -/*- - * Macros to allow global variables to be reached through function calls when - * required (if a shared library version requires it, for example. - * The way it's done allows definitions like this: - * - * // in foobar.c - * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) - * // in foobar.h - * OPENSSL_DECLARE_GLOBAL(int,foobar); - * #define foobar OPENSSL_GLOBAL_REF(foobar) - */ -# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ - type *_shadow_##name(void) \ - { static type _hide_##name=value; return &_hide_##name; } -# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) -# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) -# else -# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) type _shadow_##name=value; -# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name -# define OPENSSL_GLOBAL_REF(name) _shadow_##name -# endif - -# ifdef _WIN32 -# ifdef _WIN64 -# define ossl_ssize_t __int64 -# define OSSL_SSIZE_MAX _I64_MAX -# else -# define ossl_ssize_t int -# define OSSL_SSIZE_MAX INT_MAX -# endif -# endif - -# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t) -# define ossl_ssize_t INTN -# define OSSL_SSIZE_MAX MAX_INTN -# endif - -# ifndef ossl_ssize_t -# define ossl_ssize_t ssize_t -# if defined(SSIZE_MAX) -# define OSSL_SSIZE_MAX SSIZE_MAX -# elif defined(_POSIX_SSIZE_MAX) -# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX -# else -# define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1)) -# endif -# endif - -# ifdef DEBUG_UNUSED -# define __owur __attribute__((__warn_unused_result__)) -# else -# define __owur -# endif - -/* Standard integer types */ -# if defined(OPENSSL_SYS_UEFI) -typedef INT8 int8_t; -typedef UINT8 uint8_t; -typedef INT16 int16_t; -typedef UINT16 uint16_t; -typedef INT32 int32_t; -typedef UINT32 uint32_t; -typedef INT64 int64_t; -typedef UINT64 uint64_t; -# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ - defined(__osf__) || defined(__sgi) || defined(__hpux) || \ - defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__) -# include -# elif defined(_MSC_VER) && _MSC_VER<=1500 -/* - * minimally required typdefs for systems not supporting inttypes.h or - * stdint.h: currently just older VC++ - */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -# else -# include -# endif - -/* ossl_inline: portable inline definition usable in public headers */ -# if !defined(inline) && !defined(__cplusplus) -# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L - /* just use inline */ -# define ossl_inline inline -# elif defined(__GNUC__) && __GNUC__>=2 -# define ossl_inline __inline__ -# elif defined(_MSC_VER) - /* - * Visual Studio: inline is available in C++ only, however - * __inline is available for C, see - * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx - */ -# define ossl_inline __inline -# else -# define ossl_inline -# endif -# else -# define ossl_inline inline -# endif - -# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -# define ossl_noreturn _Noreturn -# elif defined(__GNUC__) && __GNUC__ >= 2 -# define ossl_noreturn __attribute__((noreturn)) -# else -# define ossl_noreturn -# endif - -/* ossl_unused: portable unused attribute for use in public headers */ -# if defined(__GNUC__) -# define ossl_unused __attribute__((unused)) -# else -# define ossl_unused -# endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ebcdic.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ebcdic.h deleted file mode 100644 index aa012855..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ebcdic.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 1999-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_EBCDIC_H -# define HEADER_EBCDIC_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Avoid name clashes with other applications */ -# define os_toascii _openssl_os_toascii -# define os_toebcdic _openssl_os_toebcdic -# define ebcdic2ascii _openssl_ebcdic2ascii -# define ascii2ebcdic _openssl_ascii2ebcdic - -extern const unsigned char os_toascii[256]; -extern const unsigned char os_toebcdic[256]; -void *ebcdic2ascii(void *dest, const void *srce, size_t count); -void *ascii2ebcdic(void *dest, const void *srce, size_t count); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ec.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ec.h deleted file mode 100644 index 5af9ebdc..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ec.h +++ /dev/null @@ -1,1479 +0,0 @@ -/* - * Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_EC_H -# define HEADER_EC_H - -# include - -# ifndef OPENSSL_NO_EC -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# ifdef __cplusplus -extern "C" { -# endif - -# ifndef OPENSSL_ECC_MAX_FIELD_BITS -# define OPENSSL_ECC_MAX_FIELD_BITS 661 -# endif - -/** Enum for the point conversion form as defined in X9.62 (ECDSA) - * for the encoding of a elliptic curve point (x,y) */ -typedef enum { - /** the point is encoded as z||x, where the octet z specifies - * which solution of the quadratic equation y is */ - POINT_CONVERSION_COMPRESSED = 2, - /** the point is encoded as z||x||y, where z is the octet 0x04 */ - POINT_CONVERSION_UNCOMPRESSED = 4, - /** the point is encoded as z||x||y, where the octet z specifies - * which solution of the quadratic equation y is */ - POINT_CONVERSION_HYBRID = 6 -} point_conversion_form_t; - -typedef struct ec_method_st EC_METHOD; -typedef struct ec_group_st EC_GROUP; -typedef struct ec_point_st EC_POINT; -typedef struct ecpk_parameters_st ECPKPARAMETERS; -typedef struct ec_parameters_st ECPARAMETERS; - -/********************************************************************/ -/* EC_METHODs for curves over GF(p) */ -/********************************************************************/ - -/** Returns the basic GFp ec methods which provides the basis for the - * optimized methods. - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_simple_method(void); - -/** Returns GFp methods using montgomery multiplication. - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_mont_method(void); - -/** Returns GFp methods using optimized methods for NIST recommended curves - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nist_method(void); - -# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -/** Returns 64-bit optimized methods for nistp224 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp224_method(void); - -/** Returns 64-bit optimized methods for nistp256 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp256_method(void); - -/** Returns 64-bit optimized methods for nistp521 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp521_method(void); -# endif - -# ifndef OPENSSL_NO_EC2M -/********************************************************************/ -/* EC_METHOD for curves over GF(2^m) */ -/********************************************************************/ - -/** Returns the basic GF2m ec method - * \return EC_METHOD object - */ -const EC_METHOD *EC_GF2m_simple_method(void); - -# endif - -/********************************************************************/ -/* EC_GROUP functions */ -/********************************************************************/ - -/** Creates a new EC_GROUP object - * \param meth EC_METHOD to use - * \return newly created EC_GROUP object or NULL in case of an error. - */ -EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); - -/** Frees a EC_GROUP object - * \param group EC_GROUP object to be freed. - */ -void EC_GROUP_free(EC_GROUP *group); - -/** Clears and frees a EC_GROUP object - * \param group EC_GROUP object to be cleared and freed. - */ -void EC_GROUP_clear_free(EC_GROUP *group); - -/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. - * \param dst destination EC_GROUP object - * \param src source EC_GROUP object - * \return 1 on success and 0 if an error occurred. - */ -int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); - -/** Creates a new EC_GROUP object and copies the copies the content - * form src to the newly created EC_KEY object - * \param src source EC_GROUP object - * \return newly created EC_GROUP object or NULL in case of an error. - */ -EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); - -/** Returns the EC_METHOD of the EC_GROUP object. - * \param group EC_GROUP object - * \return EC_METHOD used in this EC_GROUP object. - */ -const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); - -/** Returns the field type of the EC_METHOD. - * \param meth EC_METHOD object - * \return NID of the underlying field type OID. - */ -int EC_METHOD_get_field_type(const EC_METHOD *meth); - -/** Sets the generator and its order/cofactor of a EC_GROUP object. - * \param group EC_GROUP object - * \param generator EC_POINT object with the generator. - * \param order the order of the group generated by the generator. - * \param cofactor the index of the sub-group generated by the generator - * in the group of all points on the elliptic curve. - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, - const BIGNUM *order, const BIGNUM *cofactor); - -/** Returns the generator of a EC_GROUP object. - * \param group EC_GROUP object - * \return the currently used generator (possibly NULL). - */ -const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); - -/** Returns the montgomery data for order(Generator) - * \param group EC_GROUP object - * \return the currently used montgomery data (possibly NULL). -*/ -BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); - -/** Gets the order of a EC_GROUP - * \param group EC_GROUP object - * \param order BIGNUM to which the order is copied - * \param ctx unused - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); - -/** Gets the order of an EC_GROUP - * \param group EC_GROUP object - * \return the group order - */ -const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); - -/** Gets the number of bits of the order of an EC_GROUP - * \param group EC_GROUP object - * \return number of bits of group order. - */ -int EC_GROUP_order_bits(const EC_GROUP *group); - -/** Gets the cofactor of a EC_GROUP - * \param group EC_GROUP object - * \param cofactor BIGNUM to which the cofactor is copied - * \param ctx unused - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, - BN_CTX *ctx); - -/** Gets the cofactor of an EC_GROUP - * \param group EC_GROUP object - * \return the group cofactor - */ -const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group); - -/** Sets the name of a EC_GROUP object - * \param group EC_GROUP object - * \param nid NID of the curve name OID - */ -void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); - -/** Returns the curve name of a EC_GROUP object - * \param group EC_GROUP object - * \return NID of the curve name OID or 0 if not set. - */ -int EC_GROUP_get_curve_name(const EC_GROUP *group); - -void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); -int EC_GROUP_get_asn1_flag(const EC_GROUP *group); - -void EC_GROUP_set_point_conversion_form(EC_GROUP *group, - point_conversion_form_t form); -point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); - -unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); -size_t EC_GROUP_get_seed_len(const EC_GROUP *); -size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); - -/** Sets the parameters of a ec curve defined by y^2 = x^3 + a*x + b (for GFp) - * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); - -/** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp) - * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, - BN_CTX *ctx); - -/** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, - const BIGNUM *a, const BIGNUM *b, - BN_CTX *ctx)) - -/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, - BIGNUM *a, BIGNUM *b, - BN_CTX *ctx)) - -# ifndef OPENSSL_NO_EC2M -/** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, - const BIGNUM *a, const BIGNUM *b, - BN_CTX *ctx)) - -/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, - BIGNUM *a, BIGNUM *b, - BN_CTX *ctx)) -# endif -/** Returns the number of bits needed to represent a field element - * \param group EC_GROUP object - * \return number of bits needed to represent a field element - */ -int EC_GROUP_get_degree(const EC_GROUP *group); - -/** Checks whether the parameter in the EC_GROUP define a valid ec group - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 if group is a valid ec group and 0 otherwise - */ -int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); - -/** Checks whether the discriminant of the elliptic curve is zero or not - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 if the discriminant is not zero and 0 otherwise - */ -int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); - -/** Compares two EC_GROUP objects - * \param a first EC_GROUP object - * \param b second EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 0 if the groups are equal, 1 if not, or -1 on error - */ -int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); - -/* - * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after - * choosing an appropriate EC_METHOD - */ - -/** Creates a new EC_GROUP object with the specified parameters defined - * over GFp (defined by the equation y^2 = x^3 + a*x + b) - * \param p BIGNUM with the prime number - * \param a BIGNUM with the parameter a of the equation - * \param b BIGNUM with the parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return newly created EC_GROUP object with the specified parameters - */ -EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); -# ifndef OPENSSL_NO_EC2M -/** Creates a new EC_GROUP object with the specified parameters defined - * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) - * \param p BIGNUM with the polynomial defining the underlying field - * \param a BIGNUM with the parameter a of the equation - * \param b BIGNUM with the parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return newly created EC_GROUP object with the specified parameters - */ -EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); -# endif - -/** Creates a EC_GROUP object with a curve specified by a NID - * \param nid NID of the OID of the curve name - * \return newly created EC_GROUP object with specified curve or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_by_curve_name(int nid); - -/** Creates a new EC_GROUP object from an ECPARAMETERS object - * \param params pointer to the ECPARAMETERS object - * \return newly created EC_GROUP object with specified curve or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params); - -/** Creates an ECPARAMETERS object for the given EC_GROUP object. - * \param group pointer to the EC_GROUP object - * \param params pointer to an existing ECPARAMETERS object or NULL - * \return pointer to the new ECPARAMETERS object or NULL - * if an error occurred. - */ -ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, - ECPARAMETERS *params); - -/** Creates a new EC_GROUP object from an ECPKPARAMETERS object - * \param params pointer to an existing ECPKPARAMETERS object, or NULL - * \return newly created EC_GROUP object with specified curve, or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params); - -/** Creates an ECPKPARAMETERS object for the given EC_GROUP object. - * \param group pointer to the EC_GROUP object - * \param params pointer to an existing ECPKPARAMETERS object or NULL - * \return pointer to the new ECPKPARAMETERS object or NULL - * if an error occurred. - */ -ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, - ECPKPARAMETERS *params); - -/********************************************************************/ -/* handling of internal curves */ -/********************************************************************/ - -typedef struct { - int nid; - const char *comment; -} EC_builtin_curve; - -/* - * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all - * available curves or zero if a error occurred. In case r is not zero, - * nitems EC_builtin_curve structures are filled with the data of the first - * nitems internal groups - */ -size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); - -const char *EC_curve_nid2nist(int nid); -int EC_curve_nist2nid(const char *name); - -/********************************************************************/ -/* EC_POINT functions */ -/********************************************************************/ - -/** Creates a new EC_POINT object for the specified EC_GROUP - * \param group EC_GROUP the underlying EC_GROUP object - * \return newly created EC_POINT object or NULL if an error occurred - */ -EC_POINT *EC_POINT_new(const EC_GROUP *group); - -/** Frees a EC_POINT object - * \param point EC_POINT object to be freed - */ -void EC_POINT_free(EC_POINT *point); - -/** Clears and frees a EC_POINT object - * \param point EC_POINT object to be cleared and freed - */ -void EC_POINT_clear_free(EC_POINT *point); - -/** Copies EC_POINT object - * \param dst destination EC_POINT object - * \param src source EC_POINT object - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); - -/** Creates a new EC_POINT object and copies the content of the supplied - * EC_POINT - * \param src source EC_POINT object - * \param group underlying the EC_GROUP object - * \return newly created EC_POINT object or NULL if an error occurred - */ -EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); - -/** Returns the EC_METHOD used in EC_POINT object - * \param point EC_POINT object - * \return the EC_METHOD used - */ -const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); - -/** Sets a point to infinity (neutral element) - * \param group underlying EC_GROUP object - * \param point EC_POINT to set to infinity - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); - -/** Sets the jacobian projective coordinates of a EC_POINT over GFp - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param z BIGNUM with the z-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, const BIGNUM *x, - const BIGNUM *y, const BIGNUM *z, - BN_CTX *ctx); - -/** Gets the jacobian projective coordinates of a EC_POINT over GFp - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param z BIGNUM for the z-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, - const EC_POINT *p, BIGNUM *x, - BIGNUM *y, BIGNUM *z, - BN_CTX *ctx); - -/** Sets the affine coordinates of an EC_POINT - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, - const BIGNUM *x, const BIGNUM *y, - BN_CTX *ctx); - -/** Gets the affine coordinates of an EC_POINT. - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p, - BIGNUM *x, BIGNUM *y, BN_CTX *ctx); - -/** Sets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_set_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - const BIGNUM *y, - BN_CTX *ctx)) - -/** Gets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_get_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, - const EC_POINT *p, - BIGNUM *x, - BIGNUM *y, - BN_CTX *ctx)) - -/** Sets the x9.62 compressed coordinates of a EC_POINT - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p, - const BIGNUM *x, int y_bit, - BN_CTX *ctx); - -/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of - * EC_POINT_set_compressed_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - int y_bit, - BN_CTX *ctx)) -# ifndef OPENSSL_NO_EC2M -/** Sets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_set_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - const BIGNUM *y, - BN_CTX *ctx)) - -/** Gets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_get_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, - const EC_POINT *p, - BIGNUM *x, - BIGNUM *y, - BN_CTX *ctx)) - -/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of - * EC_POINT_set_compressed_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - int y_bit, - BN_CTX *ctx)) -# endif -/** Encodes a EC_POINT object to a octet string - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param form point conversion form - * \param buf memory buffer for the result. If NULL the function returns - * required buffer size. - * \param len length of the memory buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, - point_conversion_form_t form, - unsigned char *buf, size_t len, BN_CTX *ctx); - -/** Decodes a EC_POINT from a octet string - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param buf memory buffer with the encoded ec point - * \param len length of the encoded ec point - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, - const unsigned char *buf, size_t len, BN_CTX *ctx); - -/** Encodes an EC_POINT object to an allocated octet string - * \param group underlying EC_GROUP object - * \param point EC_POINT object - * \param form point conversion form - * \param pbuf returns pointer to allocated buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point, - point_conversion_form_t form, - unsigned char **pbuf, BN_CTX *ctx); - -/* other interfaces to point2oct/oct2point: */ -BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, - point_conversion_form_t form, BIGNUM *, BN_CTX *); -EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, - EC_POINT *, BN_CTX *); -char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, - point_conversion_form_t form, BN_CTX *); -EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, - EC_POINT *, BN_CTX *); - -/********************************************************************/ -/* functions for doing EC_POINT arithmetic */ -/********************************************************************/ - -/** Computes the sum of two EC_POINT - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result (r = a + b) - * \param a EC_POINT object with the first summand - * \param b EC_POINT object with the second summand - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, - const EC_POINT *b, BN_CTX *ctx); - -/** Computes the double of a EC_POINT - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result (r = 2 * a) - * \param a EC_POINT object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, - BN_CTX *ctx); - -/** Computes the inverse of a EC_POINT - * \param group underlying EC_GROUP object - * \param a EC_POINT object to be inverted (it's used for the result as well) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); - -/** Checks whether the point is the neutral element of the group - * \param group the underlying EC_GROUP object - * \param p EC_POINT object - * \return 1 if the point is the neutral element and 0 otherwise - */ -int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); - -/** Checks whether the point is on the curve - * \param group underlying EC_GROUP object - * \param point EC_POINT object to check - * \param ctx BN_CTX object (optional) - * \return 1 if the point is on the curve, 0 if not, or -1 on error - */ -int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, - BN_CTX *ctx); - -/** Compares two EC_POINTs - * \param group underlying EC_GROUP object - * \param a first EC_POINT object - * \param b second EC_POINT object - * \param ctx BN_CTX object (optional) - * \return 1 if the points are not equal, 0 if they are, or -1 on error - */ -int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, - BN_CTX *ctx); - -int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); -int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, - EC_POINT *points[], BN_CTX *ctx); - -/** Computes r = generator * n + sum_{i=0}^{num-1} p[i] * m[i] - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result - * \param n BIGNUM with the multiplier for the group generator (optional) - * \param num number further summands - * \param p array of size num of EC_POINT objects - * \param m array of size num of BIGNUM objects - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, - size_t num, const EC_POINT *p[], const BIGNUM *m[], - BN_CTX *ctx); - -/** Computes r = generator * n + q * m - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result - * \param n BIGNUM with the multiplier for the group generator (optional) - * \param q EC_POINT object with the first factor of the second summand - * \param m BIGNUM with the second factor of the second summand - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, - const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); - -/** Stores multiples of generator for faster point multiplication - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); - -/** Reports whether a precomputation has been done - * \param group EC_GROUP object - * \return 1 if a pre-computation has been done and 0 otherwise - */ -int EC_GROUP_have_precompute_mult(const EC_GROUP *group); - -/********************************************************************/ -/* ASN1 stuff */ -/********************************************************************/ - -DECLARE_ASN1_ITEM(ECPKPARAMETERS) -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPKPARAMETERS) -DECLARE_ASN1_ITEM(ECPARAMETERS) -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) - -/* - * EC_GROUP_get_basis_type() returns the NID of the basis type used to - * represent the field elements - */ -int EC_GROUP_get_basis_type(const EC_GROUP *); -# ifndef OPENSSL_NO_EC2M -int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); -int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, - unsigned int *k2, unsigned int *k3); -# endif - -# define OPENSSL_EC_EXPLICIT_CURVE 0x000 -# define OPENSSL_EC_NAMED_CURVE 0x001 - -EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); -int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); - -# define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) -# define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) -# define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ - (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) -# define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ - (unsigned char *)(x)) - -int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); -# ifndef OPENSSL_NO_STDIO -int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); -# endif - -/********************************************************************/ -/* EC_KEY functions */ -/********************************************************************/ - -/* some values for the encoding_flag */ -# define EC_PKEY_NO_PARAMETERS 0x001 -# define EC_PKEY_NO_PUBKEY 0x002 - -/* some values for the flags field */ -# define EC_FLAG_NON_FIPS_ALLOW 0x1 -# define EC_FLAG_FIPS_CHECKED 0x2 -# define EC_FLAG_COFACTOR_ECDH 0x1000 - -/** Creates a new EC_KEY object. - * \return EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_new(void); - -int EC_KEY_get_flags(const EC_KEY *key); - -void EC_KEY_set_flags(EC_KEY *key, int flags); - -void EC_KEY_clear_flags(EC_KEY *key, int flags); - -/** Creates a new EC_KEY object using a named curve as underlying - * EC_GROUP object. - * \param nid NID of the named curve. - * \return EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_new_by_curve_name(int nid); - -/** Frees a EC_KEY object. - * \param key EC_KEY object to be freed. - */ -void EC_KEY_free(EC_KEY *key); - -/** Copies a EC_KEY object. - * \param dst destination EC_KEY object - * \param src src EC_KEY object - * \return dst or NULL if an error occurred. - */ -EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); - -/** Creates a new EC_KEY object and copies the content from src to it. - * \param src the source EC_KEY object - * \return newly created EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_dup(const EC_KEY *src); - -/** Increases the internal reference count of a EC_KEY object. - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_up_ref(EC_KEY *key); - -/** Returns the ENGINE object of a EC_KEY object - * \param eckey EC_KEY object - * \return the ENGINE object (possibly NULL). - */ -ENGINE *EC_KEY_get0_engine(const EC_KEY *eckey); - -/** Returns the EC_GROUP object of a EC_KEY object - * \param key EC_KEY object - * \return the EC_GROUP object (possibly NULL). - */ -const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); - -/** Sets the EC_GROUP of a EC_KEY object. - * \param key EC_KEY object - * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY - * object will use an own copy of the EC_GROUP). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); - -/** Returns the private key of a EC_KEY object. - * \param key EC_KEY object - * \return a BIGNUM with the private key (possibly NULL). - */ -const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); - -/** Sets the private key of a EC_KEY object. - * \param key EC_KEY object - * \param prv BIGNUM with the private key (note: the EC_KEY object - * will use an own copy of the BIGNUM). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); - -/** Returns the public key of a EC_KEY object. - * \param key the EC_KEY object - * \return a EC_POINT object with the public key (possibly NULL) - */ -const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); - -/** Sets the public key of a EC_KEY object. - * \param key EC_KEY object - * \param pub EC_POINT object with the public key (note: the EC_KEY object - * will use an own copy of the EC_POINT object). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); - -unsigned EC_KEY_get_enc_flags(const EC_KEY *key); -void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); -point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); -void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); - -#define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef) -int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg); -void *EC_KEY_get_ex_data(const EC_KEY *key, int idx); - -/* wrapper functions for the underlying EC_GROUP object */ -void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); - -/** Creates a table of pre-computed multiples of the generator to - * accelerate further EC_KEY operations. - * \param key EC_KEY object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); - -/** Creates a new ec private (and optional a new public) key. - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_generate_key(EC_KEY *key); - -/** Verifies that a private and/or public key is valid. - * \param key the EC_KEY object - * \return 1 on success and 0 otherwise. - */ -int EC_KEY_check_key(const EC_KEY *key); - -/** Indicates if an EC_KEY can be used for signing. - * \param eckey the EC_KEY object - * \return 1 if can can sign and 0 otherwise. - */ -int EC_KEY_can_sign(const EC_KEY *eckey); - -/** Sets a public key from affine coordinates performing - * necessary NIST PKV tests. - * \param key the EC_KEY object - * \param x public key x coordinate - * \param y public key y coordinate - * \return 1 on success and 0 otherwise. - */ -int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, - BIGNUM *y); - -/** Encodes an EC_KEY public key to an allocated octet string - * \param key key to encode - * \param form point conversion form - * \param pbuf returns pointer to allocated buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form, - unsigned char **pbuf, BN_CTX *ctx); - -/** Decodes a EC_KEY public key from a octet string - * \param key key to decode - * \param buf memory buffer with the encoded ec point - * \param len length of the encoded ec point - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ - -int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, - BN_CTX *ctx); - -/** Decodes an EC_KEY private key from an octet string - * \param key key to decode - * \param buf memory buffer with the encoded private key - * \param len length of the encoded key - * \return 1 on success and 0 if an error occurred - */ - -int EC_KEY_oct2priv(EC_KEY *key, const unsigned char *buf, size_t len); - -/** Encodes a EC_KEY private key to an octet string - * \param key key to encode - * \param buf memory buffer for the result. If NULL the function returns - * required buffer size. - * \param len length of the memory buffer - * \return the length of the encoded octet string or 0 if an error occurred - */ - -size_t EC_KEY_priv2oct(const EC_KEY *key, unsigned char *buf, size_t len); - -/** Encodes an EC_KEY private key to an allocated octet string - * \param eckey key to encode - * \param pbuf returns pointer to allocated buffer - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf); - -/********************************************************************/ -/* de- and encoding functions for SEC1 ECPrivateKey */ -/********************************************************************/ - -/** Decodes a private key from a memory buffer. - * \param key a pointer to a EC_KEY object which should be used (or NULL) - * \param in pointer to memory with the DER encoded private key - * \param len length of the DER encoded private key - * \return the decoded private key or NULL if an error occurred. - */ -EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes a private key object and stores the result in a buffer. - * \param key the EC_KEY object to encode - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred. - */ -int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); - -/********************************************************************/ -/* de- and encoding functions for EC parameters */ -/********************************************************************/ - -/** Decodes ec parameter from a memory buffer. - * \param key a pointer to a EC_KEY object which should be used (or NULL) - * \param in pointer to memory with the DER encoded ec parameters - * \param len length of the DER encoded ec parameters - * \return a EC_KEY object with the decoded parameters or NULL if an error - * occurred. - */ -EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes ec parameter and stores the result in a buffer. - * \param key the EC_KEY object with ec parameters to encode - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred. - */ -int i2d_ECParameters(EC_KEY *key, unsigned char **out); - -/********************************************************************/ -/* de- and encoding functions for EC public key */ -/* (octet string, not DER -- hence 'o2i' and 'i2o') */ -/********************************************************************/ - -/** Decodes a ec public key from a octet string. - * \param key a pointer to a EC_KEY object which should be used - * \param in memory buffer with the encoded public key - * \param len length of the encoded public key - * \return EC_KEY object with decoded public key or NULL if an error - * occurred. - */ -EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes a ec public key in an octet string. - * \param key the EC_KEY object with the public key - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred - */ -int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out); - -/** Prints out the ec parameters on human readable form. - * \param bp BIO object to which the information is printed - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred - */ -int ECParameters_print(BIO *bp, const EC_KEY *key); - -/** Prints out the contents of a EC_KEY object - * \param bp BIO object to which the information is printed - * \param key EC_KEY object - * \param off line offset - * \return 1 on success and 0 if an error occurred - */ -int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); - -# ifndef OPENSSL_NO_STDIO -/** Prints out the ec parameters on human readable form. - * \param fp file descriptor to which the information is printed - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred - */ -int ECParameters_print_fp(FILE *fp, const EC_KEY *key); - -/** Prints out the contents of a EC_KEY object - * \param fp file descriptor to which the information is printed - * \param key EC_KEY object - * \param off line offset - * \return 1 on success and 0 if an error occurred - */ -int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); - -# endif - -const EC_KEY_METHOD *EC_KEY_OpenSSL(void); -const EC_KEY_METHOD *EC_KEY_get_default_method(void); -void EC_KEY_set_default_method(const EC_KEY_METHOD *meth); -const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key); -int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth); -EC_KEY *EC_KEY_new_method(ENGINE *engine); - -/** The old name for ecdh_KDF_X9_63 - * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, - * it is actually specified in ANSI X9.63. - * This identifier is retained for backwards compatibility - */ -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); - -int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, - const EC_KEY *ecdh, - void *(*KDF) (const void *in, size_t inlen, - void *out, size_t *outlen)); - -typedef struct ECDSA_SIG_st 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 a negative value - * on error - */ -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); - -/** Accessor for r and s fields of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - * \param pr pointer to BIGNUM pointer for r (may be NULL) - * \param ps pointer to BIGNUM pointer for s (may be NULL) - */ -void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); - -/** Accessor for r field of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - */ -const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); - -/** Accessor for s field of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - */ -const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); - -/** Setter for r and s fields of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - * \param r pointer to BIGNUM for r (may be NULL) - * \param s pointer to BIGNUM for s (may be NULL) - */ -int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); - -/** 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 (optional), - * 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); - -/** 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 (optional), - * 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); - -/** 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); - -/********************************************************************/ -/* EC_KEY_METHOD constructors, destructors, writers and accessors */ -/********************************************************************/ - -EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth); -void EC_KEY_METHOD_free(EC_KEY_METHOD *meth); -void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, - int (*init)(EC_KEY *key), - void (*finish)(EC_KEY *key), - int (*copy)(EC_KEY *dest, const EC_KEY *src), - int (*set_group)(EC_KEY *key, const EC_GROUP *grp), - int (*set_private)(EC_KEY *key, - const BIGNUM *priv_key), - int (*set_public)(EC_KEY *key, - const EC_POINT *pub_key)); - -void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, - int (*keygen)(EC_KEY *key)); - -void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, - int (*ckey)(unsigned char **psec, - size_t *pseclen, - const EC_POINT *pub_key, - const EC_KEY *ecdh)); - -void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, - int (*sign)(int type, const unsigned char *dgst, - int dlen, unsigned char *sig, - unsigned int *siglen, - const BIGNUM *kinv, const BIGNUM *r, - EC_KEY *eckey), - int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, - BIGNUM **kinvp, BIGNUM **rp), - ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, - int dgst_len, - const BIGNUM *in_kinv, - const BIGNUM *in_r, - EC_KEY *eckey)); - -void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, - int (*verify)(int type, const unsigned - char *dgst, int dgst_len, - const unsigned char *sigbuf, - int sig_len, EC_KEY *eckey), - int (*verify_sig)(const unsigned char *dgst, - int dgst_len, - const ECDSA_SIG *sig, - EC_KEY *eckey)); - -void EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth, - int (**pinit)(EC_KEY *key), - void (**pfinish)(EC_KEY *key), - int (**pcopy)(EC_KEY *dest, const EC_KEY *src), - int (**pset_group)(EC_KEY *key, - const EC_GROUP *grp), - int (**pset_private)(EC_KEY *key, - const BIGNUM *priv_key), - int (**pset_public)(EC_KEY *key, - const EC_POINT *pub_key)); - -void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, - int (**pkeygen)(EC_KEY *key)); - -void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, - int (**pck)(unsigned char **psec, - size_t *pseclen, - const EC_POINT *pub_key, - const EC_KEY *ecdh)); - -void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, - int (**psign)(int type, const unsigned char *dgst, - int dlen, unsigned char *sig, - unsigned int *siglen, - const BIGNUM *kinv, const BIGNUM *r, - EC_KEY *eckey), - int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, - BIGNUM **kinvp, BIGNUM **rp), - ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, - int dgst_len, - const BIGNUM *in_kinv, - const BIGNUM *in_r, - EC_KEY *eckey)); - -void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, - int (**pverify)(int type, const unsigned - char *dgst, int dgst_len, - const unsigned char *sigbuf, - int sig_len, EC_KEY *eckey), - int (**pverify_sig)(const unsigned char *dgst, - int dgst_len, - const ECDSA_SIG *sig, - EC_KEY *eckey)); - -# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) - -# ifndef __cplusplus -# if defined(__SUNPRO_C) -# if __SUNPRO_C >= 0x520 -# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) -# endif -# endif -# endif - -# define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) - -# define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_EC_PARAM_ENC, flag, NULL) - -# define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_ECDH_COFACTOR, flag, NULL) - -# define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_ECDH_COFACTOR, -2, NULL) - -# define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_TYPE, kdf, NULL) - -# define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_TYPE, -2, NULL) - -# define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_OUTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, 0, \ - (void *)(plen)) - -# define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_UKM, plen, (void *)(p)) - -# define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_UKM, 0, (void *)(p)) - -/* SM2 will skip the operation check so no need to pass operation here */ -# define EVP_PKEY_CTX_set1_id(ctx, id, id_len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_SET1_ID, (int)id_len, (void*)(id)) - -# define EVP_PKEY_CTX_get1_id(ctx, id) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_GET1_ID, 0, (void*)(id)) - -# define EVP_PKEY_CTX_get1_id_len(ctx, id_len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_GET1_ID_LEN, 0, (void*)(id_len)) - -# define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) -# define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) -# define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) -# define EVP_PKEY_CTRL_SET1_ID (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET1_ID (EVP_PKEY_ALG_CTRL + 12) -# define EVP_PKEY_CTRL_GET1_ID_LEN (EVP_PKEY_ALG_CTRL + 13) -/* KDF types */ -# define EVP_PKEY_ECDH_KDF_NONE 1 -# define EVP_PKEY_ECDH_KDF_X9_63 2 -/** The old name for EVP_PKEY_ECDH_KDF_X9_63 - * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, - * it is actually specified in ANSI X9.63. - * This identifier is retained for backwards compatibility - */ -# define EVP_PKEY_ECDH_KDF_X9_62 EVP_PKEY_ECDH_KDF_X9_63 - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ecdh.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ecdh.h deleted file mode 100644 index 681f3d5e..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ecdh.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ecdsa.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ecdsa.h deleted file mode 100644 index 681f3d5e..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ecdsa.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ecerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ecerr.h deleted file mode 100644 index f7b91834..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ecerr.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * 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_ECERR_H -# define HEADER_ECERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# include - -# 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_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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/engine.h b/Hin2n/src/main/jniLibs/x86/include/openssl/engine.h deleted file mode 100644 index 0780f0fb..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/engine.h +++ /dev/null @@ -1,751 +0,0 @@ -/* - * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_ENGINE_H -# define HEADER_ENGINE_H - -# include - -# ifndef OPENSSL_NO_ENGINE -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# include -# include -# include -# include -# include -# endif -# include -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* - * These flags are used to control combinations of algorithm (methods) by - * bitwise "OR"ing. - */ -# define ENGINE_METHOD_RSA (unsigned int)0x0001 -# define ENGINE_METHOD_DSA (unsigned int)0x0002 -# define ENGINE_METHOD_DH (unsigned int)0x0004 -# define ENGINE_METHOD_RAND (unsigned int)0x0008 -# define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 -# define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 -# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 -# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 -# define ENGINE_METHOD_EC (unsigned int)0x0800 -/* Obvious all-or-nothing cases. */ -# define ENGINE_METHOD_ALL (unsigned int)0xFFFF -# define ENGINE_METHOD_NONE (unsigned int)0x0000 - -/* - * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used - * internally to control registration of ENGINE implementations, and can be - * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to - * initialise registered ENGINEs if they are not already initialised. - */ -# define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 - -/* ENGINE flags that can be set by ENGINE_set_flags(). */ -/* Not used */ -/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ - -/* - * This flag is for ENGINEs that wish to handle the various 'CMD'-related - * control commands on their own. Without this flag, ENGINE_ctrl() handles - * these control commands on behalf of the ENGINE using their "cmd_defns" - * data. - */ -# define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 - -/* - * This flag is for ENGINEs who return new duplicate structures when found - * via "ENGINE_by_id()". When an ENGINE must store state (eg. if - * ENGINE_ctrl() commands are called in sequence as part of some stateful - * process like key-generation setup and execution), it can set this flag - - * then each attempt to obtain the ENGINE will result in it being copied into - * a new structure. Normally, ENGINEs don't declare this flag so - * ENGINE_by_id() just increments the existing ENGINE's structural reference - * count. - */ -# define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 - -/* - * This flag if for an ENGINE that does not want its methods registered as - * part of ENGINE_register_all_complete() for example if the methods are not - * usable as default methods. - */ - -# define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 - -/* - * ENGINEs can support their own command types, and these flags are used in - * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input - * each command expects. Currently only numeric and string input is - * supported. If a control command supports none of the _NUMERIC, _STRING, or - * _NO_INPUT options, then it is regarded as an "internal" control command - - * and not for use in config setting situations. As such, they're not - * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() - * access. Changes to this list of 'command types' should be reflected - * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). - */ - -/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ -# define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 -/* - * accepts string input (cast from 'void*' to 'const char *', 4th parameter - * to ENGINE_ctrl) - */ -# define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 -/* - * Indicates that the control command takes *no* input. Ie. the control - * command is unparameterised. - */ -# define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 -/* - * Indicates that the control command is internal. This control command won't - * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() - * function. - */ -# define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 - -/* - * NB: These 3 control commands are deprecated and should not be used. - * ENGINEs relying on these commands should compile conditional support for - * compatibility (eg. if these symbols are defined) but should also migrate - * the same functionality to their own ENGINE-specific control functions that - * can be "discovered" by calling applications. The fact these control - * commands wouldn't be "executable" (ie. usable by text-based config) - * doesn't change the fact that application code can find and use them - * without requiring per-ENGINE hacking. - */ - -/* - * These flags are used to tell the ctrl function what should be done. All - * command numbers are shared between all engines, even if some don't make - * sense to some engines. In such a case, they do nothing but return the - * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. - */ -# define ENGINE_CTRL_SET_LOGSTREAM 1 -# define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 -# define ENGINE_CTRL_HUP 3/* Close and reinitialise - * any handles/connections - * etc. */ -# define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */ -# define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used - * when calling the password - * callback and the user - * interface */ -# define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration, - * given a string that - * represents a file name - * or so */ -# define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given - * section in the already - * loaded configuration */ - -/* - * These control commands allow an application to deal with an arbitrary - * engine in a dynamic way. Warn: Negative return values indicate errors FOR - * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other - * commands, including ENGINE-specific command types, return zero for an - * error. An ENGINE can choose to implement these ctrl functions, and can - * internally manage things however it chooses - it does so by setting the - * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise - * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the - * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's - * ctrl() handler need only implement its own commands - the above "meta" - * commands will be taken care of. - */ - -/* - * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", - * then all the remaining control commands will return failure, so it is - * worth checking this first if the caller is trying to "discover" the - * engine's capabilities and doesn't want errors generated unnecessarily. - */ -# define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 -/* - * Returns a positive command number for the first command supported by the - * engine. Returns zero if no ctrl commands are supported. - */ -# define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 -/* - * The 'long' argument specifies a command implemented by the engine, and the - * return value is the next command supported, or zero if there are no more. - */ -# define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 -/* - * The 'void*' argument is a command name (cast from 'const char *'), and the - * return value is the command that corresponds to it. - */ -# define ENGINE_CTRL_GET_CMD_FROM_NAME 13 -/* - * The next two allow a command to be converted into its corresponding string - * form. In each case, the 'long' argument supplies the command. In the - * NAME_LEN case, the return value is the length of the command name (not - * counting a trailing EOL). In the NAME case, the 'void*' argument must be a - * string buffer large enough, and it will be populated with the name of the - * command (WITH a trailing EOL). - */ -# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 -# define ENGINE_CTRL_GET_NAME_FROM_CMD 15 -/* The next two are similar but give a "short description" of a command. */ -# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 -# define ENGINE_CTRL_GET_DESC_FROM_CMD 17 -/* - * With this command, the return value is the OR'd combination of - * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given - * engine-specific ctrl command expects. - */ -# define ENGINE_CTRL_GET_CMD_FLAGS 18 - -/* - * ENGINE implementations should start the numbering of their own control - * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). - */ -# define ENGINE_CMD_BASE 200 - -/* - * NB: These 2 nCipher "chil" control commands are deprecated, and their - * functionality is now available through ENGINE-specific control commands - * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 - * commands should be migrated to the more general command handling before - * these are removed. - */ - -/* Flags specific to the nCipher "chil" engine */ -# define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 - /* - * Depending on the value of the (long)i argument, this sets or - * unsets the SimpleForkCheck flag in the CHIL API to enable or - * disable checking and workarounds for applications that fork(). - */ -# define ENGINE_CTRL_CHIL_NO_LOCKING 101 - /* - * This prevents the initialisation function from providing mutex - * callbacks to the nCipher library. - */ - -/* - * If an ENGINE supports its own specific control commands and wishes the - * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on - * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN - * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() - * handler that supports the stated commands (ie. the "cmd_num" entries as - * described by the array). NB: The array must be ordered in increasing order - * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element - * has cmd_num set to zero and/or cmd_name set to NULL. - */ -typedef struct ENGINE_CMD_DEFN_st { - unsigned int cmd_num; /* The command number */ - const char *cmd_name; /* The command name itself */ - const char *cmd_desc; /* A short description of the command */ - unsigned int cmd_flags; /* The input the command expects */ -} ENGINE_CMD_DEFN; - -/* Generic function pointer */ -typedef int (*ENGINE_GEN_FUNC_PTR) (void); -/* Generic function pointer taking no arguments */ -typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *); -/* Specific control function pointer */ -typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *, - void (*f) (void)); -/* Generic load_key function pointer */ -typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, - UI_METHOD *ui_method, - void *callback_data); -typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl, - STACK_OF(X509_NAME) *ca_dn, - X509 **pcert, EVP_PKEY **pkey, - STACK_OF(X509) **pother, - UI_METHOD *ui_method, - void *callback_data); -/*- - * These callback types are for an ENGINE's handler for cipher and digest logic. - * These handlers have these prototypes; - * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); - * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); - * Looking at how to implement these handlers in the case of cipher support, if - * the framework wants the EVP_CIPHER for 'nid', it will call; - * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) - * If the framework wants a list of supported 'nid's, it will call; - * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) - */ -/* - * Returns to a pointer to the array of supported cipher 'nid's. If the - * second parameter is non-NULL it is set to the size of the returned array. - */ -typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **, - const int **, int); -typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **, - int); -typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **, - const int **, int); -typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **, - const int **, int); -/* - * STRUCTURE functions ... all of these functions deal with pointers to - * ENGINE structures where the pointers have a "structural reference". This - * means that their reference is to allowed access to the structure but it - * does not imply that the structure is functional. To simply increment or - * decrement the structural reference count, use ENGINE_by_id and - * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next - * as it will automatically decrement the structural reference count of the - * "current" ENGINE and increment the structural reference count of the - * ENGINE it returns (unless it is NULL). - */ - -/* Get the first/last "ENGINE" type available. */ -ENGINE *ENGINE_get_first(void); -ENGINE *ENGINE_get_last(void); -/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ -ENGINE *ENGINE_get_next(ENGINE *e); -ENGINE *ENGINE_get_prev(ENGINE *e); -/* Add another "ENGINE" type into the array. */ -int ENGINE_add(ENGINE *e); -/* Remove an existing "ENGINE" type from the array. */ -int ENGINE_remove(ENGINE *e); -/* Retrieve an engine from the list by its unique "id" value. */ -ENGINE *ENGINE_by_id(const char *id); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define ENGINE_load_openssl() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL) -# define ENGINE_load_dynamic() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL) -# ifndef OPENSSL_NO_STATIC_ENGINE -# define ENGINE_load_padlock() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL) -# define ENGINE_load_capi() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL) -# define ENGINE_load_afalg() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL) -# endif -# define ENGINE_load_cryptodev() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) -# define ENGINE_load_rdrand() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL) -#endif -void ENGINE_load_builtin_engines(void); - -/* - * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation - * "registry" handling. - */ -unsigned int ENGINE_get_table_flags(void); -void ENGINE_set_table_flags(unsigned int flags); - -/*- Manage registration of ENGINEs per "table". For each type, there are 3 - * functions; - * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) - * ENGINE_unregister_***(e) - unregister the implementation from 'e' - * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list - * Cleanup is automatically registered from each table when required. - */ - -int ENGINE_register_RSA(ENGINE *e); -void ENGINE_unregister_RSA(ENGINE *e); -void ENGINE_register_all_RSA(void); - -int ENGINE_register_DSA(ENGINE *e); -void ENGINE_unregister_DSA(ENGINE *e); -void ENGINE_register_all_DSA(void); - -int ENGINE_register_EC(ENGINE *e); -void ENGINE_unregister_EC(ENGINE *e); -void ENGINE_register_all_EC(void); - -int ENGINE_register_DH(ENGINE *e); -void ENGINE_unregister_DH(ENGINE *e); -void ENGINE_register_all_DH(void); - -int ENGINE_register_RAND(ENGINE *e); -void ENGINE_unregister_RAND(ENGINE *e); -void ENGINE_register_all_RAND(void); - -int ENGINE_register_ciphers(ENGINE *e); -void ENGINE_unregister_ciphers(ENGINE *e); -void ENGINE_register_all_ciphers(void); - -int ENGINE_register_digests(ENGINE *e); -void ENGINE_unregister_digests(ENGINE *e); -void ENGINE_register_all_digests(void); - -int ENGINE_register_pkey_meths(ENGINE *e); -void ENGINE_unregister_pkey_meths(ENGINE *e); -void ENGINE_register_all_pkey_meths(void); - -int ENGINE_register_pkey_asn1_meths(ENGINE *e); -void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); -void ENGINE_register_all_pkey_asn1_meths(void); - -/* - * These functions register all support from the above categories. Note, use - * of these functions can result in static linkage of code your application - * may not need. If you only need a subset of functionality, consider using - * more selective initialisation. - */ -int ENGINE_register_complete(ENGINE *e); -int ENGINE_register_all_complete(void); - -/* - * Send parameterised control commands to the engine. The possibilities to - * send down an integer, a pointer to data or a function pointer are - * provided. Any of the parameters may or may not be NULL, depending on the - * command number. In actuality, this function only requires a structural - * (rather than functional) reference to an engine, but many control commands - * may require the engine be functional. The caller should be aware of trying - * commands that require an operational ENGINE, and only use functional - * references in such situations. - */ -int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)); - -/* - * This function tests if an ENGINE-specific command is usable as a - * "setting". Eg. in an application's config file that gets processed through - * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to - * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). - */ -int ENGINE_cmd_is_executable(ENGINE *e, int cmd); - -/* - * This function works like ENGINE_ctrl() with the exception of taking a - * command name instead of a command number, and can handle optional - * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation - * on how to use the cmd_name and cmd_optional. - */ -int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, - long i, void *p, void (*f) (void), int cmd_optional); - -/* - * This function passes a command-name and argument to an ENGINE. The - * cmd_name is converted to a command number and the control command is - * called using 'arg' as an argument (unless the ENGINE doesn't support such - * a command, in which case no control command is called). The command is - * checked for input flags, and if necessary the argument will be converted - * to a numeric value. If cmd_optional is non-zero, then if the ENGINE - * doesn't support the given cmd_name the return value will be success - * anyway. This function is intended for applications to use so that users - * (or config files) can supply engine-specific config data to the ENGINE at - * run-time to control behaviour of specific engines. As such, it shouldn't - * be used for calling ENGINE_ctrl() functions that return data, deal with - * binary data, or that are otherwise supposed to be used directly through - * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() - * operation in this function will be lost - the return value is interpreted - * as failure if the return value is zero, success otherwise, and this - * function returns a boolean value as a result. In other words, vendors of - * 'ENGINE'-enabled devices should write ENGINE implementations with - * parameterisations that work in this scheme, so that compliant ENGINE-based - * applications can work consistently with the same configuration for the - * same ENGINE-enabled devices, across applications. - */ -int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, - int cmd_optional); - -/* - * These functions are useful for manufacturing new ENGINE structures. They - * don't address reference counting at all - one uses them to populate an - * ENGINE structure with personalised implementations of things prior to - * using it directly or adding it to the builtin ENGINE list in OpenSSL. - * These are also here so that the ENGINE structure doesn't have to be - * exposed and break binary compatibility! - */ -ENGINE *ENGINE_new(void); -int ENGINE_free(ENGINE *e); -int ENGINE_up_ref(ENGINE *e); -int ENGINE_set_id(ENGINE *e, const char *id); -int ENGINE_set_name(ENGINE *e, const char *name); -int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); -int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); -int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth); -int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); -int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); -int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); -int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); -int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); -int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); -int ENGINE_set_load_privkey_function(ENGINE *e, - ENGINE_LOAD_KEY_PTR loadpriv_f); -int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); -int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, - ENGINE_SSL_CLIENT_CERT_PTR - loadssl_f); -int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); -int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); -int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); -int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); -int ENGINE_set_flags(ENGINE *e, int flags); -int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); -/* These functions allow control over any per-structure ENGINE data. */ -#define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef) -int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); -void *ENGINE_get_ex_data(const ENGINE *e, int idx); - -#if OPENSSL_API_COMPAT < 0x10100000L -/* - * This function previously cleaned up anything that needs it. Auto-deinit will - * now take care of it so it is no longer required to call this function. - */ -# define ENGINE_cleanup() while(0) continue -#endif - -/* - * These return values from within the ENGINE structure. These can be useful - * with functional references as well as structural references - it depends - * which you obtained. Using the result for functional purposes if you only - * obtained a structural reference may be problematic! - */ -const char *ENGINE_get_id(const ENGINE *e); -const char *ENGINE_get_name(const ENGINE *e); -const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); -const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); -const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); -const DH_METHOD *ENGINE_get_DH(const ENGINE *e); -const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); -ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); -ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); -ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); -ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE - *e); -ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); -ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); -ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); -ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); -const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); -const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); -const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); -const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); -const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, - const char *str, - int len); -const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, - const char *str, - int len); -const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); -int ENGINE_get_flags(const ENGINE *e); - -/* - * FUNCTIONAL functions. These functions deal with ENGINE structures that - * have (or will) be initialised for use. Broadly speaking, the structural - * functions are useful for iterating the list of available engine types, - * creating new engine types, and other "list" operations. These functions - * actually deal with ENGINEs that are to be used. As such these functions - * can fail (if applicable) when particular engines are unavailable - eg. if - * a hardware accelerator is not attached or not functioning correctly. Each - * ENGINE has 2 reference counts; structural and functional. Every time a - * functional reference is obtained or released, a corresponding structural - * reference is automatically obtained or released too. - */ - -/* - * Initialise a engine type for use (or up its reference count if it's - * already in use). This will fail if the engine is not currently operational - * and cannot initialise. - */ -int ENGINE_init(ENGINE *e); -/* - * Free a functional reference to a engine type. This does not require a - * corresponding call to ENGINE_free as it also releases a structural - * reference. - */ -int ENGINE_finish(ENGINE *e); - -/* - * The following functions handle keys that are stored in some secondary - * location, handled by the engine. The storage may be on a card or - * whatever. - */ -EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); -EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); -int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, - STACK_OF(X509_NAME) *ca_dn, X509 **pcert, - EVP_PKEY **ppkey, STACK_OF(X509) **pother, - UI_METHOD *ui_method, void *callback_data); - -/* - * This returns a pointer for the current ENGINE structure that is (by - * default) performing any RSA operations. The value returned is an - * incremented reference, so it should be free'd (ENGINE_finish) before it is - * discarded. - */ -ENGINE *ENGINE_get_default_RSA(void); -/* Same for the other "methods" */ -ENGINE *ENGINE_get_default_DSA(void); -ENGINE *ENGINE_get_default_EC(void); -ENGINE *ENGINE_get_default_DH(void); -ENGINE *ENGINE_get_default_RAND(void); -/* - * These functions can be used to get a functional reference to perform - * ciphering or digesting corresponding to "nid". - */ -ENGINE *ENGINE_get_cipher_engine(int nid); -ENGINE *ENGINE_get_digest_engine(int nid); -ENGINE *ENGINE_get_pkey_meth_engine(int nid); -ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); - -/* - * This sets a new default ENGINE structure for performing RSA operations. If - * the result is non-zero (success) then the ENGINE structure will have had - * its reference count up'd so the caller should still free their own - * reference 'e'. - */ -int ENGINE_set_default_RSA(ENGINE *e); -int ENGINE_set_default_string(ENGINE *e, const char *def_list); -/* Same for the other "methods" */ -int ENGINE_set_default_DSA(ENGINE *e); -int ENGINE_set_default_EC(ENGINE *e); -int ENGINE_set_default_DH(ENGINE *e); -int ENGINE_set_default_RAND(ENGINE *e); -int ENGINE_set_default_ciphers(ENGINE *e); -int ENGINE_set_default_digests(ENGINE *e); -int ENGINE_set_default_pkey_meths(ENGINE *e); -int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); - -/* - * The combination "set" - the flags are bitwise "OR"d from the - * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" - * function, this function can result in unnecessary static linkage. If your - * application requires only specific functionality, consider using more - * selective functions. - */ -int ENGINE_set_default(ENGINE *e, unsigned int flags); - -void ENGINE_add_conf_module(void); - -/* Deprecated functions ... */ -/* int ENGINE_clear_defaults(void); */ - -/**************************/ -/* DYNAMIC ENGINE SUPPORT */ -/**************************/ - -/* Binary/behaviour compatibility levels */ -# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000 -/* - * Binary versions older than this are too old for us (whether we're a loader - * or a loadee) - */ -# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000 - -/* - * When compiling an ENGINE entirely as an external shared library, loadable - * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' - * structure type provides the calling application's (or library's) error - * functionality and memory management function pointers to the loaded - * library. These should be used/set in the loaded library code so that the - * loading application's 'state' will be used/changed in all operations. The - * 'static_state' pointer allows the loaded library to know if it shares the - * same static data as the calling application (or library), and thus whether - * these callbacks need to be set or not. - */ -typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int); -typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int); -typedef void (*dyn_MEM_free_fn) (void *, const char *, int); -typedef struct st_dynamic_MEM_fns { - dyn_MEM_malloc_fn malloc_fn; - dyn_MEM_realloc_fn realloc_fn; - dyn_MEM_free_fn free_fn; -} dynamic_MEM_fns; -/* - * FIXME: Perhaps the memory and locking code (crypto.h) should declare and - * use these types so we (and any other dependent code) can simplify a bit?? - */ -/* The top-level structure */ -typedef struct st_dynamic_fns { - void *static_state; - dynamic_MEM_fns mem_fns; -} dynamic_fns; - -/* - * The version checking function should be of this prototype. NB: The - * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading - * code. If this function returns zero, it indicates a (potential) version - * incompatibility and the loaded library doesn't believe it can proceed. - * Otherwise, the returned value is the (latest) version supported by the - * loading library. The loader may still decide that the loaded code's - * version is unsatisfactory and could veto the load. The function is - * expected to be implemented with the symbol name "v_check", and a default - * implementation can be fully instantiated with - * IMPLEMENT_DYNAMIC_CHECK_FN(). - */ -typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version); -# define IMPLEMENT_DYNAMIC_CHECK_FN() \ - OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ - OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ - if (v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ - return 0; } - -/* - * This function is passed the ENGINE structure to initialise with its own - * function and command settings. It should not adjust the structural or - * functional reference counts. If this function returns zero, (a) the load - * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto - * the structure, and (c) the shared library will be unloaded. So - * implementations should do their own internal cleanup in failure - * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, - * represents the ENGINE id that the loader is looking for. If this is NULL, - * the shared library can choose to return failure or to initialise a - * 'default' ENGINE. If non-NULL, the shared library must initialise only an - * ENGINE matching the passed 'id'. The function is expected to be - * implemented with the symbol name "bind_engine". A standard implementation - * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter - * 'fn' is a callback function that populates the ENGINE structure and - * returns an int value (zero for failure). 'fn' should have prototype; - * [static] int fn(ENGINE *e, const char *id); - */ -typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, - const dynamic_fns *fns); -# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ - OPENSSL_EXPORT \ - int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ - OPENSSL_EXPORT \ - int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ - if (ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ - CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \ - fns->mem_fns.realloc_fn, \ - fns->mem_fns.free_fn); \ - skip_cbs: \ - if (!fn(e, id)) return 0; \ - return 1; } - -/* - * If the loading application (or library) and the loaded ENGINE library - * share the same static data (eg. they're both dynamically linked to the - * same libcrypto.so) we need a way to avoid trying to set system callbacks - - * this would fail, and for the same reason that it's unnecessary to try. If - * the loaded ENGINE has (or gets from through the loader) its own copy of - * the libcrypto static data, we will need to set the callbacks. The easiest - * way to detect this is to have a function that returns a pointer to some - * static data and let the loading application and loaded ENGINE compare - * their respective values. - */ -void *ENGINE_get_static_state(void); - -# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void)) -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/engineerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/engineerr.h deleted file mode 100644 index 05e84bd2..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/engineerr.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/err.h b/Hin2n/src/main/jniLibs/x86/include/openssl/err.h deleted file mode 100644 index b49f8812..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/err.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * 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_ERR_H -# define HEADER_ERR_H - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# include -# endif - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# ifndef OPENSSL_NO_ERR -# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) -# else -# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) -# endif - -# include - -# define ERR_TXT_MALLOCED 0x01 -# define ERR_TXT_STRING 0x02 - -# define ERR_FLAG_MARK 0x01 -# define ERR_FLAG_CLEAR 0x02 - -# define ERR_NUM_ERRORS 16 -typedef struct err_state_st { - int err_flags[ERR_NUM_ERRORS]; - unsigned long err_buffer[ERR_NUM_ERRORS]; - char *err_data[ERR_NUM_ERRORS]; - int err_data_flags[ERR_NUM_ERRORS]; - const char *err_file[ERR_NUM_ERRORS]; - int err_line[ERR_NUM_ERRORS]; - int top, bottom; -} ERR_STATE; - -/* library */ -# define ERR_LIB_NONE 1 -# define ERR_LIB_SYS 2 -# define ERR_LIB_BN 3 -# define ERR_LIB_RSA 4 -# define ERR_LIB_DH 5 -# define ERR_LIB_EVP 6 -# define ERR_LIB_BUF 7 -# define ERR_LIB_OBJ 8 -# define ERR_LIB_PEM 9 -# define ERR_LIB_DSA 10 -# define ERR_LIB_X509 11 -/* #define ERR_LIB_METH 12 */ -# define ERR_LIB_ASN1 13 -# define ERR_LIB_CONF 14 -# define ERR_LIB_CRYPTO 15 -# define ERR_LIB_EC 16 -# define ERR_LIB_SSL 20 -/* #define ERR_LIB_SSL23 21 */ -/* #define ERR_LIB_SSL2 22 */ -/* #define ERR_LIB_SSL3 23 */ -/* #define ERR_LIB_RSAREF 30 */ -/* #define ERR_LIB_PROXY 31 */ -# define ERR_LIB_BIO 32 -# define ERR_LIB_PKCS7 33 -# define ERR_LIB_X509V3 34 -# define ERR_LIB_PKCS12 35 -# define ERR_LIB_RAND 36 -# define ERR_LIB_DSO 37 -# define ERR_LIB_ENGINE 38 -# define ERR_LIB_OCSP 39 -# define ERR_LIB_UI 40 -# define ERR_LIB_COMP 41 -# define ERR_LIB_ECDSA 42 -# define ERR_LIB_ECDH 43 -# define ERR_LIB_OSSL_STORE 44 -# define ERR_LIB_FIPS 45 -# define ERR_LIB_CMS 46 -# define ERR_LIB_TS 47 -# define ERR_LIB_HMAC 48 -/* # define ERR_LIB_JPAKE 49 */ -# define ERR_LIB_CT 50 -# define ERR_LIB_ASYNC 51 -# define ERR_LIB_KDF 52 -# define ERR_LIB_SM2 53 - -# define ERR_LIB_USER 128 - -# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE) - -# define ERR_PACK(l,f,r) ( \ - (((unsigned int)(l) & 0x0FF) << 24L) | \ - (((unsigned int)(f) & 0xFFF) << 12L) | \ - (((unsigned int)(r) & 0xFFF) ) ) -# define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL) -# define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL) -# define ERR_GET_REASON(l) (int)( (l) & 0xFFFL) -# define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL) - -/* OS functions */ -# define SYS_F_FOPEN 1 -# define SYS_F_CONNECT 2 -# define SYS_F_GETSERVBYNAME 3 -# define SYS_F_SOCKET 4 -# define SYS_F_IOCTLSOCKET 5 -# define SYS_F_BIND 6 -# define SYS_F_LISTEN 7 -# define SYS_F_ACCEPT 8 -# define SYS_F_WSASTARTUP 9/* Winsock stuff */ -# define SYS_F_OPENDIR 10 -# define SYS_F_FREAD 11 -# define SYS_F_GETADDRINFO 12 -# define SYS_F_GETNAMEINFO 13 -# define SYS_F_SETSOCKOPT 14 -# define SYS_F_GETSOCKOPT 15 -# define SYS_F_GETSOCKNAME 16 -# define SYS_F_GETHOSTBYNAME 17 -# define SYS_F_FFLUSH 18 -# define SYS_F_OPEN 19 -# define SYS_F_CLOSE 20 -# define SYS_F_IOCTL 21 -# define SYS_F_STAT 22 -# define SYS_F_FCNTL 23 -# define SYS_F_FSTAT 24 - -/* reasons */ -# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ -# define ERR_R_BN_LIB ERR_LIB_BN/* 3 */ -# define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */ -# define ERR_R_DH_LIB ERR_LIB_DH/* 5 */ -# define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */ -# define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */ -# define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */ -# define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */ -# define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */ -# define ERR_R_X509_LIB ERR_LIB_X509/* 11 */ -# define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */ -# define ERR_R_EC_LIB ERR_LIB_EC/* 16 */ -# define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */ -# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */ -# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */ -# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */ -# define ERR_R_UI_LIB ERR_LIB_UI/* 40 */ -# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */ -# define ERR_R_OSSL_STORE_LIB ERR_LIB_OSSL_STORE/* 44 */ - -# define ERR_R_NESTED_ASN1_ERROR 58 -# define ERR_R_MISSING_ASN1_EOS 63 - -/* fatal error */ -# define ERR_R_FATAL 64 -# define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) -# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) -# define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) -# define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) -# define ERR_R_DISABLED (5|ERR_R_FATAL) -# define ERR_R_INIT_FAIL (6|ERR_R_FATAL) -# define ERR_R_PASSED_INVALID_ARGUMENT (7) -# define ERR_R_OPERATION_FAIL (8|ERR_R_FATAL) - -/* - * 99 is the maximum possible ERR_R_... code, higher values are reserved for - * the individual libraries - */ - -typedef struct ERR_string_data_st { - unsigned long error; - const char *string; -} ERR_STRING_DATA; - -DEFINE_LHASH_OF(ERR_STRING_DATA); - -void ERR_put_error(int lib, int func, int reason, const char *file, int line); -void ERR_set_error_data(char *data, int flags); - -unsigned long ERR_get_error(void); -unsigned long ERR_get_error_line(const char **file, int *line); -unsigned long ERR_get_error_line_data(const char **file, int *line, - const char **data, int *flags); -unsigned long ERR_peek_error(void); -unsigned long ERR_peek_error_line(const char **file, int *line); -unsigned long ERR_peek_error_line_data(const char **file, int *line, - const char **data, int *flags); -unsigned long ERR_peek_last_error(void); -unsigned long ERR_peek_last_error_line(const char **file, int *line); -unsigned long ERR_peek_last_error_line_data(const char **file, int *line, - const char **data, int *flags); -void ERR_clear_error(void); -char *ERR_error_string(unsigned long e, char *buf); -void ERR_error_string_n(unsigned long e, char *buf, size_t len); -const char *ERR_lib_error_string(unsigned long e); -const char *ERR_func_error_string(unsigned long e); -const char *ERR_reason_error_string(unsigned long e); -void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), - void *u); -# ifndef OPENSSL_NO_STDIO -void ERR_print_errors_fp(FILE *fp); -# endif -void ERR_print_errors(BIO *bp); -void ERR_add_error_data(int num, ...); -void ERR_add_error_vdata(int num, va_list args); -int ERR_load_strings(int lib, ERR_STRING_DATA *str); -int ERR_load_strings_const(const ERR_STRING_DATA *str); -int ERR_unload_strings(int lib, ERR_STRING_DATA *str); -int ERR_load_ERR_strings(void); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define ERR_load_crypto_strings() \ - OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) -# define ERR_free_strings() while(0) continue -#endif - -DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *)) -DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid)) -ERR_STATE *ERR_get_state(void); - -int ERR_get_next_error_library(void); - -int ERR_set_mark(void); -int ERR_pop_to_mark(void); -int ERR_clear_last_mark(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/evp.h b/Hin2n/src/main/jniLibs/x86/include/openssl/evp.h deleted file mode 100644 index a411f3f2..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/evp.h +++ /dev/null @@ -1,1666 +0,0 @@ -/* - * 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_ENVELOPE_H -# define HEADER_ENVELOPE_H - -# include -# include -# include -# include -# include - -# define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ -# define EVP_MAX_KEY_LENGTH 64 -# define EVP_MAX_IV_LENGTH 16 -# define EVP_MAX_BLOCK_LENGTH 32 - -# define PKCS5_SALT_LEN 8 -/* Default PKCS#5 iteration count */ -# define PKCS5_DEFAULT_ITER 2048 - -# include - -# define EVP_PK_RSA 0x0001 -# define EVP_PK_DSA 0x0002 -# define EVP_PK_DH 0x0004 -# define EVP_PK_EC 0x0008 -# define EVP_PKT_SIGN 0x0010 -# define EVP_PKT_ENC 0x0020 -# define EVP_PKT_EXCH 0x0040 -# define EVP_PKS_RSA 0x0100 -# define EVP_PKS_DSA 0x0200 -# define EVP_PKS_EC 0x0400 - -# define EVP_PKEY_NONE NID_undef -# define EVP_PKEY_RSA NID_rsaEncryption -# define EVP_PKEY_RSA2 NID_rsa -# define EVP_PKEY_RSA_PSS NID_rsassaPss -# define EVP_PKEY_DSA NID_dsa -# define EVP_PKEY_DSA1 NID_dsa_2 -# define EVP_PKEY_DSA2 NID_dsaWithSHA -# define EVP_PKEY_DSA3 NID_dsaWithSHA1 -# define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 -# define EVP_PKEY_DH NID_dhKeyAgreement -# define EVP_PKEY_DHX NID_dhpublicnumber -# define EVP_PKEY_EC NID_X9_62_id_ecPublicKey -# define EVP_PKEY_SM2 NID_sm2 -# define EVP_PKEY_HMAC NID_hmac -# define EVP_PKEY_CMAC NID_cmac -# define EVP_PKEY_SCRYPT NID_id_scrypt -# define EVP_PKEY_TLS1_PRF NID_tls1_prf -# define EVP_PKEY_HKDF NID_hkdf -# define EVP_PKEY_POLY1305 NID_poly1305 -# define EVP_PKEY_SIPHASH NID_siphash -# define EVP_PKEY_X25519 NID_X25519 -# define EVP_PKEY_ED25519 NID_ED25519 -# define EVP_PKEY_X448 NID_X448 -# define EVP_PKEY_ED448 NID_ED448 - -#ifdef __cplusplus -extern "C" { -#endif - -# define EVP_PKEY_MO_SIGN 0x0001 -# define EVP_PKEY_MO_VERIFY 0x0002 -# define EVP_PKEY_MO_ENCRYPT 0x0004 -# define EVP_PKEY_MO_DECRYPT 0x0008 - -# ifndef EVP_MD -EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); -EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); -void EVP_MD_meth_free(EVP_MD *md); - -int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); -int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); -int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); -int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); -int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); -int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, - const void *data, - size_t count)); -int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, - unsigned char *md)); -int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, - const EVP_MD_CTX *from)); -int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); -int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, - int p1, void *p2)); - -int EVP_MD_meth_get_input_blocksize(const EVP_MD *md); -int EVP_MD_meth_get_result_size(const EVP_MD *md); -int EVP_MD_meth_get_app_datasize(const EVP_MD *md); -unsigned long EVP_MD_meth_get_flags(const EVP_MD *md); -int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); -int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, - const void *data, - size_t count); -int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, - unsigned char *md); -int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, - const EVP_MD_CTX *from); -int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); -int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, - int p1, void *p2); - -/* digest can only handle a single block */ -# define EVP_MD_FLAG_ONESHOT 0x0001 - -/* digest is extensible-output function, XOF */ -# define EVP_MD_FLAG_XOF 0x0002 - -/* DigestAlgorithmIdentifier flags... */ - -# define EVP_MD_FLAG_DIGALGID_MASK 0x0018 - -/* NULL or absent parameter accepted. Use NULL */ - -# define EVP_MD_FLAG_DIGALGID_NULL 0x0000 - -/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ - -# define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 - -/* Custom handling via ctrl */ - -# define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 - -/* Note if suitable for use in FIPS mode */ -# define EVP_MD_FLAG_FIPS 0x0400 - -/* Digest ctrls */ - -# define EVP_MD_CTRL_DIGALGID 0x1 -# define EVP_MD_CTRL_MICALG 0x2 -# define EVP_MD_CTRL_XOF_LEN 0x3 - -/* Minimum Algorithm specific ctrl value */ - -# define EVP_MD_CTRL_ALG_CTRL 0x1000 - -# endif /* !EVP_MD */ - -/* values for EVP_MD_CTX flags */ - -# define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be - * called once only */ -# define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been - * cleaned */ -# define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data - * in EVP_MD_CTX_reset */ -/* - * FIPS and pad options are ignored in 1.0.0, definitions are here so we - * don't accidentally reuse the values for other purposes. - */ - -# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS - * digest in FIPS mode */ - -/* - * The following PAD options are also currently ignored in 1.0.0, digest - * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() - * instead. - */ -# define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ -# define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ -# define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ -# define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ - -# define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ -/* - * Some functions such as EVP_DigestSign only finalise copies of internal - * contexts so additional data can be included after the finalisation call. - * This is inefficient if this functionality is not required: it is disabled - * if the following flag is set. - */ -# define EVP_MD_CTX_FLAG_FINALISE 0x0200 -/* NOTE: 0x0400 is reserved for internal usage */ - -EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); -EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); -void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); - -int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); -int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); -int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); -int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, - int (*init) (EVP_CIPHER_CTX *ctx, - const unsigned char *key, - const unsigned char *iv, - int enc)); -int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, - int (*do_cipher) (EVP_CIPHER_CTX *ctx, - unsigned char *out, - const unsigned char *in, - size_t inl)); -int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, - int (*cleanup) (EVP_CIPHER_CTX *)); -int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, - int (*set_asn1_parameters) (EVP_CIPHER_CTX *, - ASN1_TYPE *)); -int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, - int (*get_asn1_parameters) (EVP_CIPHER_CTX *, - ASN1_TYPE *)); -int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, - int (*ctrl) (EVP_CIPHER_CTX *, int type, - int arg, void *ptr)); - -int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, - const unsigned char *key, - const unsigned char *iv, - int enc); -int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, - unsigned char *out, - const unsigned char *in, - size_t inl); -int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); -int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - ASN1_TYPE *); -int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - ASN1_TYPE *); -int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - int type, int arg, - void *ptr); - -/* Values for cipher flags */ - -/* Modes for ciphers */ - -# define EVP_CIPH_STREAM_CIPHER 0x0 -# define EVP_CIPH_ECB_MODE 0x1 -# define EVP_CIPH_CBC_MODE 0x2 -# define EVP_CIPH_CFB_MODE 0x3 -# define EVP_CIPH_OFB_MODE 0x4 -# define EVP_CIPH_CTR_MODE 0x5 -# define EVP_CIPH_GCM_MODE 0x6 -# define EVP_CIPH_CCM_MODE 0x7 -# define EVP_CIPH_XTS_MODE 0x10001 -# define EVP_CIPH_WRAP_MODE 0x10002 -# define EVP_CIPH_OCB_MODE 0x10003 -# define EVP_CIPH_MODE 0xF0007 -/* Set if variable length cipher */ -# define EVP_CIPH_VARIABLE_LENGTH 0x8 -/* Set if the iv handling should be done by the cipher itself */ -# define EVP_CIPH_CUSTOM_IV 0x10 -/* Set if the cipher's init() function should be called if key is NULL */ -# define EVP_CIPH_ALWAYS_CALL_INIT 0x20 -/* Call ctrl() to init cipher parameters */ -# define EVP_CIPH_CTRL_INIT 0x40 -/* Don't use standard key length function */ -# define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 -/* Don't use standard block padding */ -# define EVP_CIPH_NO_PADDING 0x100 -/* cipher handles random key generation */ -# define EVP_CIPH_RAND_KEY 0x200 -/* cipher has its own additional copying logic */ -# define EVP_CIPH_CUSTOM_COPY 0x400 -/* Don't use standard iv length function */ -# define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 -/* Allow use default ASN1 get/set iv */ -# define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 -/* Buffer length in bits not bytes: CFB1 mode only */ -# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 -/* Note if suitable for use in FIPS mode */ -# define EVP_CIPH_FLAG_FIPS 0x4000 -/* Allow non FIPS cipher in FIPS mode */ -# define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 -/* - * Cipher handles any and all padding logic as well as finalisation. - */ -# define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 -# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 -# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 -/* Cipher can handle pipeline operations */ -# define EVP_CIPH_FLAG_PIPELINE 0X800000 - -/* - * Cipher context flag to indicate we can handle wrap mode: if allowed in - * older applications it could overflow buffers. - */ - -# define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 - -/* ctrl() values */ - -# define EVP_CTRL_INIT 0x0 -# define EVP_CTRL_SET_KEY_LENGTH 0x1 -# define EVP_CTRL_GET_RC2_KEY_BITS 0x2 -# define EVP_CTRL_SET_RC2_KEY_BITS 0x3 -# define EVP_CTRL_GET_RC5_ROUNDS 0x4 -# define EVP_CTRL_SET_RC5_ROUNDS 0x5 -# define EVP_CTRL_RAND_KEY 0x6 -# define EVP_CTRL_PBE_PRF_NID 0x7 -# define EVP_CTRL_COPY 0x8 -# define EVP_CTRL_AEAD_SET_IVLEN 0x9 -# define EVP_CTRL_AEAD_GET_TAG 0x10 -# define EVP_CTRL_AEAD_SET_TAG 0x11 -# define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 -# define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN -# define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED -# define EVP_CTRL_GCM_IV_GEN 0x13 -# define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN -# define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED -# define EVP_CTRL_CCM_SET_L 0x14 -# define EVP_CTRL_CCM_SET_MSGLEN 0x15 -/* - * AEAD cipher deduces payload length and returns number of bytes required to - * store MAC and eventual padding. Subsequent call to EVP_Cipher even - * appends/verifies MAC. - */ -# define EVP_CTRL_AEAD_TLS1_AAD 0x16 -/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ -# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 -/* Set the GCM invocation field, decrypt only */ -# define EVP_CTRL_GCM_SET_IV_INV 0x18 - -# define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 -# define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a -# define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b -# define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c - -# define EVP_CTRL_SSL3_MASTER_SECRET 0x1d - -/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ -# define EVP_CTRL_SET_SBOX 0x1e -/* - * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a - * pre-allocated buffer with specified size - */ -# define EVP_CTRL_SBOX_USED 0x1f -/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, - * 0 switches meshing off - */ -# define EVP_CTRL_KEY_MESH 0x20 -/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ -# define EVP_CTRL_BLOCK_PADDING_MODE 0x21 - -/* Set the output buffers to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 -/* Set the input buffers to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 -/* Set the input buffer lengths to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 - -# define EVP_CTRL_GET_IVLEN 0x25 - -/* Padding modes */ -#define EVP_PADDING_PKCS7 1 -#define EVP_PADDING_ISO7816_4 2 -#define EVP_PADDING_ANSI923 3 -#define EVP_PADDING_ISO10126 4 -#define EVP_PADDING_ZERO 5 - -/* RFC 5246 defines additional data to be 13 bytes in length */ -# define EVP_AEAD_TLS1_AAD_LEN 13 - -typedef struct { - unsigned char *out; - const unsigned char *inp; - size_t len; - unsigned int interleave; -} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; - -/* GCM TLS constants */ -/* Length of fixed part of IV derived from PRF */ -# define EVP_GCM_TLS_FIXED_IV_LEN 4 -/* Length of explicit part of IV part of TLS records */ -# define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 -/* Length of tag for TLS */ -# define EVP_GCM_TLS_TAG_LEN 16 - -/* CCM TLS constants */ -/* Length of fixed part of IV derived from PRF */ -# define EVP_CCM_TLS_FIXED_IV_LEN 4 -/* Length of explicit part of IV part of TLS records */ -# define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 -/* Total length of CCM IV length for TLS */ -# define EVP_CCM_TLS_IV_LEN 12 -/* Length of tag for TLS */ -# define EVP_CCM_TLS_TAG_LEN 16 -/* Length of CCM8 tag for TLS */ -# define EVP_CCM8_TLS_TAG_LEN 8 - -/* Length of tag for TLS */ -# define EVP_CHACHAPOLY_TLS_TAG_LEN 16 - -typedef struct evp_cipher_info_st { - const EVP_CIPHER *cipher; - unsigned char iv[EVP_MAX_IV_LENGTH]; -} EVP_CIPHER_INFO; - - -/* Password based encryption function */ -typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, - int passlen, ASN1_TYPE *param, - const EVP_CIPHER *cipher, const EVP_MD *md, - int en_de); - -# ifndef OPENSSL_NO_RSA -# define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ - (char *)(rsa)) -# endif - -# ifndef OPENSSL_NO_DSA -# define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ - (char *)(dsa)) -# endif - -# ifndef OPENSSL_NO_DH -# define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ - (char *)(dh)) -# endif - -# ifndef OPENSSL_NO_EC -# define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ - (char *)(eckey)) -# endif -# ifndef OPENSSL_NO_SIPHASH -# define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),EVP_PKEY_SIPHASH,\ - (char *)(shkey)) -# endif - -# ifndef OPENSSL_NO_POLY1305 -# define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),EVP_PKEY_POLY1305,\ - (char *)(polykey)) -# endif - -/* Add some extra combinations */ -# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) -# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) -# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) -# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) - -int EVP_MD_type(const EVP_MD *md); -# define EVP_MD_nid(e) EVP_MD_type(e) -# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) -int EVP_MD_pkey_type(const EVP_MD *md); -int EVP_MD_size(const EVP_MD *md); -int EVP_MD_block_size(const EVP_MD *md); -unsigned long EVP_MD_flags(const EVP_MD *md); - -const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); -int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, - const void *data, size_t count); -void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, - int (*update) (EVP_MD_CTX *ctx, - const void *data, size_t count)); -# define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) -# define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) -# define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) -EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); -void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); -void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); - -int EVP_CIPHER_nid(const EVP_CIPHER *cipher); -# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) -int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); -int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); -int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); -int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); -unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); -# define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) - -const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); -const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); -const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); -unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); -unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx); -void EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); -int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); -void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); -void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); -void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); -void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); -# define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) -# if OPENSSL_API_COMPAT < 0x10100000L -# define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) -# endif -# define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c)) - -# define EVP_ENCODE_LENGTH(l) ((((l)+2)/3*4)+((l)/48+1)*2+80) -# define EVP_DECODE_LENGTH(l) (((l)+3)/4*3+80) - -# define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) -# define EVP_SignInit(a,b) EVP_DigestInit(a,b) -# define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) -# define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) -# define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) -# define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) -# define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) - -# ifdef CONST_STRICT -void BIO_set_md(BIO *, const EVP_MD *md); -# else -# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)(md)) -# endif -# define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)(mdp)) -# define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0, \ - (char *)(mdcp)) -# define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0, \ - (char *)(mdcp)) -# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) -# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0, \ - (char *)(c_pp)) - -/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c, - unsigned char *out, - const unsigned char *in, unsigned int inl); - -# define EVP_add_cipher_alias(n,alias) \ - OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) -# define EVP_add_digest_alias(n,alias) \ - OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) -# define EVP_delete_cipher_alias(alias) \ - OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); -# define EVP_delete_digest_alias(alias) \ - OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); - -int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); -EVP_MD_CTX *EVP_MD_CTX_new(void); -int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); -void EVP_MD_CTX_free(EVP_MD_CTX *ctx); -# define EVP_MD_CTX_create() EVP_MD_CTX_new() -# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) -# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) -__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); -void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); -void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); -int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); -__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, - ENGINE *impl); -__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, - size_t cnt); -__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); -__owur int EVP_Digest(const void *data, size_t count, - unsigned char *md, unsigned int *size, - const EVP_MD *type, ENGINE *impl); - -__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); -__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); -__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); -__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, - size_t len); - -int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); -int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, - const char *prompt, int verify); -void EVP_set_pw_prompt(const char *prompt); -char *EVP_get_pw_prompt(void); - -__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, - const unsigned char *salt, - const unsigned char *data, int datal, int count, - unsigned char *key, unsigned char *iv); - -void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); -void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); -int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); - -__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv); -/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv); -/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); -/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); - -__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv); -/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv); -/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); -/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - -__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv, - int enc); -/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv, int enc); -__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); -__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - -__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, - EVP_PKEY *pkey); - -__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen, const unsigned char *tbs, - size_t tbslen); - -__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, - unsigned int siglen, EVP_PKEY *pkey); - -__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, - size_t siglen, const unsigned char *tbs, - size_t tbslen); - -/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, - EVP_PKEY *pkey); -__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen); - -__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, - EVP_PKEY *pkey); -__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, - size_t siglen); - -# ifndef OPENSSL_NO_RSA -__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - const unsigned char *ek, int ekl, - const unsigned char *iv, EVP_PKEY *priv); -__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); - -__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - unsigned char **ek, int *ekl, unsigned char *iv, - EVP_PKEY **pubk, int npubk); -__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); -# endif - -EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); -void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); -int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx); -int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); -void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); -int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, - const unsigned char *in, int inl); -void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); -int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); - -void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); -int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, - const unsigned char *in, int inl); -int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned - char *out, int *outl); -int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) -# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) -# endif -EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); -int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); -void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); -int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); -int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); -int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); -int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); - -const BIO_METHOD *BIO_f_md(void); -const BIO_METHOD *BIO_f_base64(void); -const BIO_METHOD *BIO_f_cipher(void); -const BIO_METHOD *BIO_f_reliable(void); -__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, - const unsigned char *i, int enc); - -const EVP_MD *EVP_md_null(void); -# ifndef OPENSSL_NO_MD2 -const EVP_MD *EVP_md2(void); -# endif -# ifndef OPENSSL_NO_MD4 -const EVP_MD *EVP_md4(void); -# endif -# ifndef OPENSSL_NO_MD5 -const EVP_MD *EVP_md5(void); -const EVP_MD *EVP_md5_sha1(void); -# endif -# ifndef OPENSSL_NO_BLAKE2 -const EVP_MD *EVP_blake2b512(void); -const EVP_MD *EVP_blake2s256(void); -# endif -const EVP_MD *EVP_sha1(void); -const EVP_MD *EVP_sha224(void); -const EVP_MD *EVP_sha256(void); -const EVP_MD *EVP_sha384(void); -const EVP_MD *EVP_sha512(void); -const EVP_MD *EVP_sha512_224(void); -const EVP_MD *EVP_sha512_256(void); -const EVP_MD *EVP_sha3_224(void); -const EVP_MD *EVP_sha3_256(void); -const EVP_MD *EVP_sha3_384(void); -const EVP_MD *EVP_sha3_512(void); -const EVP_MD *EVP_shake128(void); -const EVP_MD *EVP_shake256(void); -# ifndef OPENSSL_NO_MDC2 -const EVP_MD *EVP_mdc2(void); -# endif -# ifndef OPENSSL_NO_RMD160 -const EVP_MD *EVP_ripemd160(void); -# endif -# ifndef OPENSSL_NO_WHIRLPOOL -const EVP_MD *EVP_whirlpool(void); -# endif -# ifndef OPENSSL_NO_SM3 -const EVP_MD *EVP_sm3(void); -# endif -const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ -# ifndef OPENSSL_NO_DES -const EVP_CIPHER *EVP_des_ecb(void); -const EVP_CIPHER *EVP_des_ede(void); -const EVP_CIPHER *EVP_des_ede3(void); -const EVP_CIPHER *EVP_des_ede_ecb(void); -const EVP_CIPHER *EVP_des_ede3_ecb(void); -const EVP_CIPHER *EVP_des_cfb64(void); -# define EVP_des_cfb EVP_des_cfb64 -const EVP_CIPHER *EVP_des_cfb1(void); -const EVP_CIPHER *EVP_des_cfb8(void); -const EVP_CIPHER *EVP_des_ede_cfb64(void); -# define EVP_des_ede_cfb EVP_des_ede_cfb64 -const EVP_CIPHER *EVP_des_ede3_cfb64(void); -# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 -const EVP_CIPHER *EVP_des_ede3_cfb1(void); -const EVP_CIPHER *EVP_des_ede3_cfb8(void); -const EVP_CIPHER *EVP_des_ofb(void); -const EVP_CIPHER *EVP_des_ede_ofb(void); -const EVP_CIPHER *EVP_des_ede3_ofb(void); -const EVP_CIPHER *EVP_des_cbc(void); -const EVP_CIPHER *EVP_des_ede_cbc(void); -const EVP_CIPHER *EVP_des_ede3_cbc(void); -const EVP_CIPHER *EVP_desx_cbc(void); -const EVP_CIPHER *EVP_des_ede3_wrap(void); -/* - * This should now be supported through the dev_crypto ENGINE. But also, why - * are rc4 and md5 declarations made here inside a "NO_DES" precompiler - * branch? - */ -# endif -# ifndef OPENSSL_NO_RC4 -const EVP_CIPHER *EVP_rc4(void); -const EVP_CIPHER *EVP_rc4_40(void); -# ifndef OPENSSL_NO_MD5 -const EVP_CIPHER *EVP_rc4_hmac_md5(void); -# endif -# endif -# ifndef OPENSSL_NO_IDEA -const EVP_CIPHER *EVP_idea_ecb(void); -const EVP_CIPHER *EVP_idea_cfb64(void); -# define EVP_idea_cfb EVP_idea_cfb64 -const EVP_CIPHER *EVP_idea_ofb(void); -const EVP_CIPHER *EVP_idea_cbc(void); -# endif -# ifndef OPENSSL_NO_RC2 -const EVP_CIPHER *EVP_rc2_ecb(void); -const EVP_CIPHER *EVP_rc2_cbc(void); -const EVP_CIPHER *EVP_rc2_40_cbc(void); -const EVP_CIPHER *EVP_rc2_64_cbc(void); -const EVP_CIPHER *EVP_rc2_cfb64(void); -# define EVP_rc2_cfb EVP_rc2_cfb64 -const EVP_CIPHER *EVP_rc2_ofb(void); -# endif -# ifndef OPENSSL_NO_BF -const EVP_CIPHER *EVP_bf_ecb(void); -const EVP_CIPHER *EVP_bf_cbc(void); -const EVP_CIPHER *EVP_bf_cfb64(void); -# define EVP_bf_cfb EVP_bf_cfb64 -const EVP_CIPHER *EVP_bf_ofb(void); -# endif -# ifndef OPENSSL_NO_CAST -const EVP_CIPHER *EVP_cast5_ecb(void); -const EVP_CIPHER *EVP_cast5_cbc(void); -const EVP_CIPHER *EVP_cast5_cfb64(void); -# define EVP_cast5_cfb EVP_cast5_cfb64 -const EVP_CIPHER *EVP_cast5_ofb(void); -# endif -# ifndef OPENSSL_NO_RC5 -const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); -const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); -const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); -# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 -const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); -# endif -const EVP_CIPHER *EVP_aes_128_ecb(void); -const EVP_CIPHER *EVP_aes_128_cbc(void); -const EVP_CIPHER *EVP_aes_128_cfb1(void); -const EVP_CIPHER *EVP_aes_128_cfb8(void); -const EVP_CIPHER *EVP_aes_128_cfb128(void); -# define EVP_aes_128_cfb EVP_aes_128_cfb128 -const EVP_CIPHER *EVP_aes_128_ofb(void); -const EVP_CIPHER *EVP_aes_128_ctr(void); -const EVP_CIPHER *EVP_aes_128_ccm(void); -const EVP_CIPHER *EVP_aes_128_gcm(void); -const EVP_CIPHER *EVP_aes_128_xts(void); -const EVP_CIPHER *EVP_aes_128_wrap(void); -const EVP_CIPHER *EVP_aes_128_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_128_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_192_ecb(void); -const EVP_CIPHER *EVP_aes_192_cbc(void); -const EVP_CIPHER *EVP_aes_192_cfb1(void); -const EVP_CIPHER *EVP_aes_192_cfb8(void); -const EVP_CIPHER *EVP_aes_192_cfb128(void); -# define EVP_aes_192_cfb EVP_aes_192_cfb128 -const EVP_CIPHER *EVP_aes_192_ofb(void); -const EVP_CIPHER *EVP_aes_192_ctr(void); -const EVP_CIPHER *EVP_aes_192_ccm(void); -const EVP_CIPHER *EVP_aes_192_gcm(void); -const EVP_CIPHER *EVP_aes_192_wrap(void); -const EVP_CIPHER *EVP_aes_192_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_192_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_256_ecb(void); -const EVP_CIPHER *EVP_aes_256_cbc(void); -const EVP_CIPHER *EVP_aes_256_cfb1(void); -const EVP_CIPHER *EVP_aes_256_cfb8(void); -const EVP_CIPHER *EVP_aes_256_cfb128(void); -# define EVP_aes_256_cfb EVP_aes_256_cfb128 -const EVP_CIPHER *EVP_aes_256_ofb(void); -const EVP_CIPHER *EVP_aes_256_ctr(void); -const EVP_CIPHER *EVP_aes_256_ccm(void); -const EVP_CIPHER *EVP_aes_256_gcm(void); -const EVP_CIPHER *EVP_aes_256_xts(void); -const EVP_CIPHER *EVP_aes_256_wrap(void); -const EVP_CIPHER *EVP_aes_256_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_256_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); -const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); -const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); -const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); -# ifndef OPENSSL_NO_ARIA -const EVP_CIPHER *EVP_aria_128_ecb(void); -const EVP_CIPHER *EVP_aria_128_cbc(void); -const EVP_CIPHER *EVP_aria_128_cfb1(void); -const EVP_CIPHER *EVP_aria_128_cfb8(void); -const EVP_CIPHER *EVP_aria_128_cfb128(void); -# define EVP_aria_128_cfb EVP_aria_128_cfb128 -const EVP_CIPHER *EVP_aria_128_ctr(void); -const EVP_CIPHER *EVP_aria_128_ofb(void); -const EVP_CIPHER *EVP_aria_128_gcm(void); -const EVP_CIPHER *EVP_aria_128_ccm(void); -const EVP_CIPHER *EVP_aria_192_ecb(void); -const EVP_CIPHER *EVP_aria_192_cbc(void); -const EVP_CIPHER *EVP_aria_192_cfb1(void); -const EVP_CIPHER *EVP_aria_192_cfb8(void); -const EVP_CIPHER *EVP_aria_192_cfb128(void); -# define EVP_aria_192_cfb EVP_aria_192_cfb128 -const EVP_CIPHER *EVP_aria_192_ctr(void); -const EVP_CIPHER *EVP_aria_192_ofb(void); -const EVP_CIPHER *EVP_aria_192_gcm(void); -const EVP_CIPHER *EVP_aria_192_ccm(void); -const EVP_CIPHER *EVP_aria_256_ecb(void); -const EVP_CIPHER *EVP_aria_256_cbc(void); -const EVP_CIPHER *EVP_aria_256_cfb1(void); -const EVP_CIPHER *EVP_aria_256_cfb8(void); -const EVP_CIPHER *EVP_aria_256_cfb128(void); -# define EVP_aria_256_cfb EVP_aria_256_cfb128 -const EVP_CIPHER *EVP_aria_256_ctr(void); -const EVP_CIPHER *EVP_aria_256_ofb(void); -const EVP_CIPHER *EVP_aria_256_gcm(void); -const EVP_CIPHER *EVP_aria_256_ccm(void); -# endif -# ifndef OPENSSL_NO_CAMELLIA -const EVP_CIPHER *EVP_camellia_128_ecb(void); -const EVP_CIPHER *EVP_camellia_128_cbc(void); -const EVP_CIPHER *EVP_camellia_128_cfb1(void); -const EVP_CIPHER *EVP_camellia_128_cfb8(void); -const EVP_CIPHER *EVP_camellia_128_cfb128(void); -# define EVP_camellia_128_cfb EVP_camellia_128_cfb128 -const EVP_CIPHER *EVP_camellia_128_ofb(void); -const EVP_CIPHER *EVP_camellia_128_ctr(void); -const EVP_CIPHER *EVP_camellia_192_ecb(void); -const EVP_CIPHER *EVP_camellia_192_cbc(void); -const EVP_CIPHER *EVP_camellia_192_cfb1(void); -const EVP_CIPHER *EVP_camellia_192_cfb8(void); -const EVP_CIPHER *EVP_camellia_192_cfb128(void); -# define EVP_camellia_192_cfb EVP_camellia_192_cfb128 -const EVP_CIPHER *EVP_camellia_192_ofb(void); -const EVP_CIPHER *EVP_camellia_192_ctr(void); -const EVP_CIPHER *EVP_camellia_256_ecb(void); -const EVP_CIPHER *EVP_camellia_256_cbc(void); -const EVP_CIPHER *EVP_camellia_256_cfb1(void); -const EVP_CIPHER *EVP_camellia_256_cfb8(void); -const EVP_CIPHER *EVP_camellia_256_cfb128(void); -# define EVP_camellia_256_cfb EVP_camellia_256_cfb128 -const EVP_CIPHER *EVP_camellia_256_ofb(void); -const EVP_CIPHER *EVP_camellia_256_ctr(void); -# endif -# ifndef OPENSSL_NO_CHACHA -const EVP_CIPHER *EVP_chacha20(void); -# ifndef OPENSSL_NO_POLY1305 -const EVP_CIPHER *EVP_chacha20_poly1305(void); -# endif -# endif - -# ifndef OPENSSL_NO_SEED -const EVP_CIPHER *EVP_seed_ecb(void); -const EVP_CIPHER *EVP_seed_cbc(void); -const EVP_CIPHER *EVP_seed_cfb128(void); -# define EVP_seed_cfb EVP_seed_cfb128 -const EVP_CIPHER *EVP_seed_ofb(void); -# endif - -# ifndef OPENSSL_NO_SM4 -const EVP_CIPHER *EVP_sm4_ecb(void); -const EVP_CIPHER *EVP_sm4_cbc(void); -const EVP_CIPHER *EVP_sm4_cfb128(void); -# define EVP_sm4_cfb EVP_sm4_cfb128 -const EVP_CIPHER *EVP_sm4_ofb(void); -const EVP_CIPHER *EVP_sm4_ctr(void); -# endif - -# if OPENSSL_API_COMPAT < 0x10100000L -# define OPENSSL_add_all_algorithms_conf() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ - | OPENSSL_INIT_ADD_ALL_DIGESTS \ - | OPENSSL_INIT_LOAD_CONFIG, NULL) -# define OPENSSL_add_all_algorithms_noconf() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ - | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) - -# ifdef OPENSSL_LOAD_CONF -# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() -# else -# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() -# endif - -# define OpenSSL_add_all_ciphers() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) -# define OpenSSL_add_all_digests() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) - -# define EVP_cleanup() while(0) continue -# endif - -int EVP_add_cipher(const EVP_CIPHER *cipher); -int EVP_add_digest(const EVP_MD *digest); - -const EVP_CIPHER *EVP_get_cipherbyname(const char *name); -const EVP_MD *EVP_get_digestbyname(const char *name); - -void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, - const char *from, const char *to, void *x), - void *arg); -void EVP_CIPHER_do_all_sorted(void (*fn) - (const EVP_CIPHER *ciph, const char *from, - const char *to, void *x), void *arg); - -void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, - const char *from, const char *to, void *x), - void *arg); -void EVP_MD_do_all_sorted(void (*fn) - (const EVP_MD *ciph, const char *from, - const char *to, void *x), void *arg); - -int EVP_PKEY_decrypt_old(unsigned char *dec_key, - const unsigned char *enc_key, int enc_key_len, - EVP_PKEY *private_key); -int EVP_PKEY_encrypt_old(unsigned char *enc_key, - const unsigned char *key, int key_len, - EVP_PKEY *pub_key); -int EVP_PKEY_type(int type); -int EVP_PKEY_id(const EVP_PKEY *pkey); -int EVP_PKEY_base_id(const EVP_PKEY *pkey); -int EVP_PKEY_bits(const EVP_PKEY *pkey); -int EVP_PKEY_security_bits(const EVP_PKEY *pkey); -int EVP_PKEY_size(const EVP_PKEY *pkey); -int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); -int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); -int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); -# ifndef OPENSSL_NO_ENGINE -int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); -ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); -# endif -int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); -void *EVP_PKEY_get0(const EVP_PKEY *pkey); -const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); -# ifndef OPENSSL_NO_POLY1305 -const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); -# endif -# ifndef OPENSSL_NO_SIPHASH -const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); -# endif - -# ifndef OPENSSL_NO_RSA -struct rsa_st; -int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); -struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); -struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_DSA -struct dsa_st; -int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); -struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); -struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_DH -struct dh_st; -int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); -struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); -struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_EC -struct ec_key_st; -int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); -struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); -struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); -# endif - -EVP_PKEY *EVP_PKEY_new(void); -int EVP_PKEY_up_ref(EVP_PKEY *pkey); -void EVP_PKEY_free(EVP_PKEY *pkey); - -EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, - long length); -int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); - -EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, - long length); -EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, - long length); -int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); - -int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); -int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); -int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); -int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); - -int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); - -int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); -int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); -int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); - -int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); - -int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, - const unsigned char *pt, size_t ptlen); -size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); - -int EVP_CIPHER_type(const EVP_CIPHER *ctx); - -/* calls methods */ -int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -/* These are used by EVP_CIPHER methods */ -int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -/* PKCS5 password based encryption */ -int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md, int en_de); -int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, - const unsigned char *salt, int saltlen, int iter, - int keylen, unsigned char *out); -int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, - const unsigned char *salt, int saltlen, int iter, - const EVP_MD *digest, int keylen, unsigned char *out); -int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md, int en_de); - -#ifndef OPENSSL_NO_SCRYPT -int EVP_PBE_scrypt(const char *pass, size_t passlen, - const unsigned char *salt, size_t saltlen, - uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, - unsigned char *key, size_t keylen); - -int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, - int passlen, ASN1_TYPE *param, - const EVP_CIPHER *c, const EVP_MD *md, int en_de); -#endif - -void PKCS5_PBE_add(void); - -int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, - ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); - -/* PBE type */ - -/* Can appear as the outermost AlgorithmIdentifier */ -# define EVP_PBE_TYPE_OUTER 0x0 -/* Is an PRF type OID */ -# define EVP_PBE_TYPE_PRF 0x1 -/* Is a PKCS#5 v2.0 KDF */ -# define EVP_PBE_TYPE_KDF 0x2 - -int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, - int md_nid, EVP_PBE_KEYGEN *keygen); -int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, - EVP_PBE_KEYGEN *keygen); -int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, - EVP_PBE_KEYGEN **pkeygen); -void EVP_PBE_cleanup(void); -int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); - -# define ASN1_PKEY_ALIAS 0x1 -# define ASN1_PKEY_DYNAMIC 0x2 -# define ASN1_PKEY_SIGPARAM_NULL 0x4 - -# define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 -# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 -# define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 -# define ASN1_PKEY_CTRL_CMS_SIGN 0x5 -# define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 -# define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 - -# define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 -# define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa - -int EVP_PKEY_asn1_get_count(void); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, - const char *str, int len); -int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); -int EVP_PKEY_asn1_add_alias(int to, int from); -int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, - int *ppkey_flags, const char **pinfo, - const char **ppem_str, - const EVP_PKEY_ASN1_METHOD *ameth); - -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); -EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, - const char *pem_str, - const char *info); -void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, - const EVP_PKEY_ASN1_METHOD *src); -void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); -void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, - int (*pub_decode) (EVP_PKEY *pk, - X509_PUBKEY *pub), - int (*pub_encode) (X509_PUBKEY *pub, - const EVP_PKEY *pk), - int (*pub_cmp) (const EVP_PKEY *a, - const EVP_PKEY *b), - int (*pub_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx), - int (*pkey_size) (const EVP_PKEY *pk), - int (*pkey_bits) (const EVP_PKEY *pk)); -void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, - int (*priv_decode) (EVP_PKEY *pk, - const PKCS8_PRIV_KEY_INFO - *p8inf), - int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, - const EVP_PKEY *pk), - int (*priv_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, - ASN1_PCTX *pctx)); -void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, - int (*param_decode) (EVP_PKEY *pkey, - const unsigned char **pder, - int derlen), - int (*param_encode) (const EVP_PKEY *pkey, - unsigned char **pder), - int (*param_missing) (const EVP_PKEY *pk), - int (*param_copy) (EVP_PKEY *to, - const EVP_PKEY *from), - int (*param_cmp) (const EVP_PKEY *a, - const EVP_PKEY *b), - int (*param_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, - ASN1_PCTX *pctx)); - -void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, - void (*pkey_free) (EVP_PKEY *pkey)); -void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_ctrl) (EVP_PKEY *pkey, int op, - long arg1, void *arg2)); -void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, - int (*item_verify) (EVP_MD_CTX *ctx, - const ASN1_ITEM *it, - void *asn, - X509_ALGOR *a, - ASN1_BIT_STRING *sig, - EVP_PKEY *pkey), - int (*item_sign) (EVP_MD_CTX *ctx, - const ASN1_ITEM *it, - void *asn, - X509_ALGOR *alg1, - X509_ALGOR *alg2, - ASN1_BIT_STRING *sig)); - -void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, - int (*siginf_set) (X509_SIG_INFO *siginf, - const X509_ALGOR *alg, - const ASN1_STRING *sig)); - -void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_pub_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_param_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*set_priv_key) (EVP_PKEY *pk, - const unsigned char - *priv, - size_t len)); -void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*set_pub_key) (EVP_PKEY *pk, - const unsigned char *pub, - size_t len)); -void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*get_priv_key) (const EVP_PKEY *pk, - unsigned char *priv, - size_t *len)); -void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*get_pub_key) (const EVP_PKEY *pk, - unsigned char *pub, - size_t *len)); - -void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_security_bits) (const EVP_PKEY - *pk)); - -# define EVP_PKEY_OP_UNDEFINED 0 -# define EVP_PKEY_OP_PARAMGEN (1<<1) -# define EVP_PKEY_OP_KEYGEN (1<<2) -# define EVP_PKEY_OP_SIGN (1<<3) -# define EVP_PKEY_OP_VERIFY (1<<4) -# define EVP_PKEY_OP_VERIFYRECOVER (1<<5) -# define EVP_PKEY_OP_SIGNCTX (1<<6) -# define EVP_PKEY_OP_VERIFYCTX (1<<7) -# define EVP_PKEY_OP_ENCRYPT (1<<8) -# define EVP_PKEY_OP_DECRYPT (1<<9) -# define EVP_PKEY_OP_DERIVE (1<<10) - -# define EVP_PKEY_OP_TYPE_SIG \ - (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ - | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) - -# define EVP_PKEY_OP_TYPE_CRYPT \ - (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) - -# define EVP_PKEY_OP_TYPE_NOGEN \ - (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE) - -# define EVP_PKEY_OP_TYPE_GEN \ - (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) - -# define EVP_PKEY_CTX_set_signature_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ - EVP_PKEY_CTRL_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ - EVP_PKEY_CTRL_GET_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)(key)) - -# define EVP_PKEY_CTRL_MD 1 -# define EVP_PKEY_CTRL_PEER_KEY 2 - -# define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 -# define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 - -# define EVP_PKEY_CTRL_PKCS7_SIGN 5 - -# define EVP_PKEY_CTRL_SET_MAC_KEY 6 - -# define EVP_PKEY_CTRL_DIGESTINIT 7 - -/* Used by GOST key encryption in TLS */ -# define EVP_PKEY_CTRL_SET_IV 8 - -# define EVP_PKEY_CTRL_CMS_ENCRYPT 9 -# define EVP_PKEY_CTRL_CMS_DECRYPT 10 -# define EVP_PKEY_CTRL_CMS_SIGN 11 - -# define EVP_PKEY_CTRL_CIPHER 12 - -# define EVP_PKEY_CTRL_GET_MD 13 - -# define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 - -# define EVP_PKEY_ALG_CTRL 0x1000 - -# define EVP_PKEY_FLAG_AUTOARGLEN 2 -/* - * Method handles all operations: don't assume any digest related defaults. - */ -# define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 - -const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); -EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); -void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, - const EVP_PKEY_METHOD *meth); -void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); -void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); -int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); -int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); -size_t EVP_PKEY_meth_get_count(void); -const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); - -EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); -EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); -EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); -void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, - int cmd, int p1, void *p2); -int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, - const char *value); -int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, - int cmd, uint64_t value); - -int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); -int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); - -int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); - -int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); -void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); - -EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, - const unsigned char *key, int keylen); -EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, - const unsigned char *priv, - size_t len); -EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, - const unsigned char *pub, - size_t len); -int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, - size_t *len); -int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, - size_t *len); - -EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, - size_t len, const EVP_CIPHER *cipher); - -void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); -void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); -EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); - -EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); - -void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); -void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, size_t tbslen); -int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, - const unsigned char *sig, size_t siglen, - const unsigned char *tbs, size_t tbslen); -int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, - unsigned char *rout, size_t *routlen, - const unsigned char *sig, size_t siglen); -int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); -int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); - -int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); -int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); - -typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); -int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); -int EVP_PKEY_check(EVP_PKEY_CTX *ctx); -int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); -int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); - -void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); -EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); - -void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, - int (*init) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, - int (*copy) (EVP_PKEY_CTX *dst, - EVP_PKEY_CTX *src)); - -void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, - void (*cleanup) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, - int (*paramgen_init) (EVP_PKEY_CTX *ctx), - int (*paramgen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, - int (*keygen_init) (EVP_PKEY_CTX *ctx), - int (*keygen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, - int (*sign_init) (EVP_PKEY_CTX *ctx), - int (*sign) (EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, - int (*verify_init) (EVP_PKEY_CTX *ctx), - int (*verify) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, - int (*verify_recover_init) (EVP_PKEY_CTX - *ctx), - int (*verify_recover) (EVP_PKEY_CTX - *ctx, - unsigned char - *sig, - size_t *siglen, - const unsigned - char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, - int (*signctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (*signctx) (EVP_PKEY_CTX *ctx, - unsigned char *sig, - size_t *siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, - int (*verifyctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (*verifyctx) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - int siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, - int (*encrypt_init) (EVP_PKEY_CTX *ctx), - int (*encryptfn) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, - int (*decrypt_init) (EVP_PKEY_CTX *ctx), - int (*decrypt) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, - int (*derive_init) (EVP_PKEY_CTX *ctx), - int (*derive) (EVP_PKEY_CTX *ctx, - unsigned char *key, - size_t *keylen)); - -void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, - int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, - void *p2), - int (*ctrl_str) (EVP_PKEY_CTX *ctx, - const char *type, - const char *value)); - -void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth, - int (*digestsign) (EVP_MD_CTX *ctx, - unsigned char *sig, - size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth, - int (*digestverify) (EVP_MD_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, - int (*digest_custom) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, - int (**pinit) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, - int (**pcopy) (EVP_PKEY_CTX *dst, - EVP_PKEY_CTX *src)); - -void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, - void (**pcleanup) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, - int (**pparamgen_init) (EVP_PKEY_CTX *ctx), - int (**pparamgen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, - int (**pkeygen_init) (EVP_PKEY_CTX *ctx), - int (**pkeygen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, - int (**psign_init) (EVP_PKEY_CTX *ctx), - int (**psign) (EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, - int (**pverify_init) (EVP_PKEY_CTX *ctx), - int (**pverify) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, - int (**pverify_recover_init) (EVP_PKEY_CTX - *ctx), - int (**pverify_recover) (EVP_PKEY_CTX - *ctx, - unsigned char - *sig, - size_t *siglen, - const unsigned - char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, - int (**psignctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (**psignctx) (EVP_PKEY_CTX *ctx, - unsigned char *sig, - size_t *siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, - int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (**pverifyctx) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - int siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, - int (**pencrypt_init) (EVP_PKEY_CTX *ctx), - int (**pencryptfn) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, - int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), - int (**pdecrypt) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, - int (**pderive_init) (EVP_PKEY_CTX *ctx), - int (**pderive) (EVP_PKEY_CTX *ctx, - unsigned char *key, - size_t *keylen)); - -void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, - int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, - void *p2), - int (**pctrl_str) (EVP_PKEY_CTX *ctx, - const char *type, - const char *value)); - -void EVP_PKEY_meth_get_digestsign(EVP_PKEY_METHOD *pmeth, - int (**digestsign) (EVP_MD_CTX *ctx, - unsigned char *sig, - size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_digestverify(EVP_PKEY_METHOD *pmeth, - int (**digestverify) (EVP_MD_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_digest_custom(EVP_PKEY_METHOD *pmeth, - int (**pdigest_custom) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx)); -void EVP_add_alg_module(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/evperr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/evperr.h deleted file mode 100644 index d2b26ea5..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/evperr.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/hmac.h b/Hin2n/src/main/jniLibs/x86/include/openssl/hmac.h deleted file mode 100644 index 458efc1d..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/hmac.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 1995-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_HMAC_H -# define HEADER_HMAC_H - -# include - -# include - -# if OPENSSL_API_COMPAT < 0x10200000L -# define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */ -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -size_t HMAC_size(const HMAC_CTX *e); -HMAC_CTX *HMAC_CTX_new(void); -int HMAC_CTX_reset(HMAC_CTX *ctx); -void HMAC_CTX_free(HMAC_CTX *ctx); - -DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md)) - -/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md, ENGINE *impl); -/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, - size_t len); -/*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, - unsigned int *len); -unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, - const unsigned char *d, size_t n, unsigned char *md, - unsigned int *md_len); -__owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); - -void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); -const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/idea.h b/Hin2n/src/main/jniLibs/x86/include/openssl/idea.h deleted file mode 100644 index 4334f3ea..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/idea.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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_IDEA_H -# define HEADER_IDEA_H - -# include - -# ifndef OPENSSL_NO_IDEA -# ifdef __cplusplus -extern "C" { -# endif - -typedef unsigned int IDEA_INT; - -# define IDEA_ENCRYPT 1 -# define IDEA_DECRYPT 0 - -# define IDEA_BLOCK 8 -# define IDEA_KEY_LENGTH 16 - -typedef struct idea_key_st { - IDEA_INT data[9][6]; -} IDEA_KEY_SCHEDULE; - -const char *IDEA_options(void); -void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, - 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_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int enc); -void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int *num, int enc); -void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int *num); -void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/kdf.h b/Hin2n/src/main/jniLibs/x86/include/openssl/kdf.h deleted file mode 100644 index 5abd4c37..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/kdf.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 -#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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/kdferr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/kdferr.h deleted file mode 100644 index 3f51bd02..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/kdferr.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/lhash.h b/Hin2n/src/main/jniLibs/x86/include/openssl/lhash.h deleted file mode 100644 index 2e42d727..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/lhash.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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 - */ - -/* - * Header for dynamic hash table routines Author - Eric Young - */ - -#ifndef HEADER_LHASH_H -# define HEADER_LHASH_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct lhash_node_st OPENSSL_LH_NODE; -typedef int (*OPENSSL_LH_COMPFUNC) (const void *, const void *); -typedef unsigned long (*OPENSSL_LH_HASHFUNC) (const void *); -typedef void (*OPENSSL_LH_DOALL_FUNC) (void *); -typedef void (*OPENSSL_LH_DOALL_FUNCARG) (void *, void *); -typedef struct lhash_st OPENSSL_LHASH; - -/* - * Macros for declaring and implementing type-safe wrappers for LHASH - * callbacks. This way, callbacks can be provided to LHASH structures without - * function pointer casting and the macro-defined callbacks provide - * per-variable casting before deferring to the underlying type-specific - * callbacks. NB: It is possible to place a "static" in front of both the - * DECLARE and IMPLEMENT macros if the functions are strictly internal. - */ - -/* First: "hash" functions */ -# define DECLARE_LHASH_HASH_FN(name, o_type) \ - unsigned long name##_LHASH_HASH(const void *); -# define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ - unsigned long name##_LHASH_HASH(const void *arg) { \ - const o_type *a = arg; \ - return name##_hash(a); } -# define LHASH_HASH_FN(name) name##_LHASH_HASH - -/* Second: "compare" functions */ -# define DECLARE_LHASH_COMP_FN(name, o_type) \ - int name##_LHASH_COMP(const void *, const void *); -# define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ - int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ - const o_type *a = arg1; \ - const o_type *b = arg2; \ - return name##_cmp(a,b); } -# define LHASH_COMP_FN(name) name##_LHASH_COMP - -/* Fourth: "doall_arg" functions */ -# define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ - void name##_LHASH_DOALL_ARG(void *, void *); -# define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ - void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ - o_type *a = arg1; \ - a_type *b = arg2; \ - name##_doall_arg(a, b); } -# define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG - - -# define LH_LOAD_MULT 256 - -int OPENSSL_LH_error(OPENSSL_LHASH *lh); -OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c); -void OPENSSL_LH_free(OPENSSL_LHASH *lh); -void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data); -void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data); -void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data); -void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func); -void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg); -unsigned long OPENSSL_LH_strhash(const char *c); -unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh); -unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh); -void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load); - -# ifndef OPENSSL_NO_STDIO -void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp); -void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp); -void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp); -# endif -void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out); -void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out); -void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define _LHASH OPENSSL_LHASH -# define LHASH_NODE OPENSSL_LH_NODE -# define lh_error OPENSSL_LH_error -# define lh_new OPENSSL_LH_new -# define lh_free OPENSSL_LH_free -# define lh_insert OPENSSL_LH_insert -# define lh_delete OPENSSL_LH_delete -# define lh_retrieve OPENSSL_LH_retrieve -# define lh_doall OPENSSL_LH_doall -# define lh_doall_arg OPENSSL_LH_doall_arg -# define lh_strhash OPENSSL_LH_strhash -# define lh_num_items OPENSSL_LH_num_items -# ifndef OPENSSL_NO_STDIO -# define lh_stats OPENSSL_LH_stats -# define lh_node_stats OPENSSL_LH_node_stats -# define lh_node_usage_stats OPENSSL_LH_node_usage_stats -# endif -# define lh_stats_bio OPENSSL_LH_stats_bio -# define lh_node_stats_bio OPENSSL_LH_node_stats_bio -# define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio -# endif - -/* Type checking... */ - -# define LHASH_OF(type) struct lhash_st_##type - -# define DEFINE_LHASH_OF(type) \ - LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \ - static ossl_unused ossl_inline LHASH_OF(type) *lh_##type##_new(unsigned long (*hfn)(const type *), \ - int (*cfn)(const type *, const type *)) \ - { \ - return (LHASH_OF(type) *) \ - OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \ - } \ - static ossl_unused ossl_inline void lh_##type##_free(LHASH_OF(type) *lh) \ - { \ - OPENSSL_LH_free((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_insert(LHASH_OF(type) *lh, type *d) \ - { \ - return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *d) \ - { \ - return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d) \ - { \ - return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline int lh_##type##_error(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline unsigned long lh_##type##_num_items(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline void lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline void lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline void lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline unsigned long lh_##type##_get_down_load(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline void lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl) \ - { \ - OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \ - } \ - static ossl_unused ossl_inline void lh_##type##_doall(LHASH_OF(type) *lh, \ - void (*doall)(type *)) \ - { \ - OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \ - } \ - LHASH_OF(type) - -#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \ - int_implement_lhash_doall(type, argtype, const type) - -#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \ - int_implement_lhash_doall(type, argtype, type) - -#define int_implement_lhash_doall(type, argtype, cbargtype) \ - static ossl_unused ossl_inline void \ - lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \ - void (*fn)(cbargtype *, argtype *), \ - argtype *arg) \ - { \ - OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \ - } \ - LHASH_OF(type) - -DEFINE_LHASH_OF(OPENSSL_STRING); -# ifdef _MSC_VER -/* - * push and pop this warning: - * warning C4090: 'function': different 'const' qualifiers - */ -# pragma warning (push) -# pragma warning (disable: 4090) -# endif - -DEFINE_LHASH_OF(OPENSSL_CSTRING); - -# ifdef _MSC_VER -# pragma warning (pop) -# endif - -/* - * If called without higher optimization (min. -xO3) the Oracle Developer - * Studio compiler generates code for the defined (static inline) functions - * above. - * This would later lead to the linker complaining about missing symbols when - * this header file is included but the resulting object is not linked against - * the Crypto library (openssl#6912). - */ -# ifdef __SUNPRO_C -# pragma weak OPENSSL_LH_new -# pragma weak OPENSSL_LH_free -# pragma weak OPENSSL_LH_insert -# pragma weak OPENSSL_LH_delete -# pragma weak OPENSSL_LH_retrieve -# pragma weak OPENSSL_LH_error -# pragma weak OPENSSL_LH_num_items -# pragma weak OPENSSL_LH_node_stats_bio -# pragma weak OPENSSL_LH_node_usage_stats_bio -# pragma weak OPENSSL_LH_stats_bio -# pragma weak OPENSSL_LH_get_down_load -# pragma weak OPENSSL_LH_set_down_load -# pragma weak OPENSSL_LH_doall -# pragma weak OPENSSL_LH_doall_arg -# endif /* __SUNPRO_C */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/md2.h b/Hin2n/src/main/jniLibs/x86/include/openssl/md2.h deleted file mode 100644 index 7faf8e3d..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/md2.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 - -# ifndef OPENSSL_NO_MD2 -# include -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/md4.h b/Hin2n/src/main/jniLibs/x86/include/openssl/md4.h deleted file mode 100644 index 940e29db..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/md4.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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_MD4_H -# define HEADER_MD4_H - -# include - -# ifndef OPENSSL_NO_MD4 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! MD4_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define MD4_LONG unsigned int - -# define MD4_CBLOCK 64 -# define MD4_LBLOCK (MD4_CBLOCK/4) -# define MD4_DIGEST_LENGTH 16 - -typedef struct MD4state_st { - MD4_LONG A, B, C, D; - MD4_LONG Nl, Nh; - MD4_LONG data[MD4_LBLOCK]; - unsigned int num; -} MD4_CTX; - -int MD4_Init(MD4_CTX *c); -int MD4_Update(MD4_CTX *c, const void *data, size_t len); -int MD4_Final(unsigned char *md, MD4_CTX *c); -unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); -void MD4_Transform(MD4_CTX *c, const unsigned char *b); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/md5.h b/Hin2n/src/main/jniLibs/x86/include/openssl/md5.h deleted file mode 100644 index 2deb7721..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/md5.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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_MD5_H -# define HEADER_MD5_H - -# include - -# ifndef OPENSSL_NO_MD5 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! MD5_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define MD5_LONG unsigned int - -# define MD5_CBLOCK 64 -# define MD5_LBLOCK (MD5_CBLOCK/4) -# define MD5_DIGEST_LENGTH 16 - -typedef struct MD5state_st { - MD5_LONG A, B, C, D; - MD5_LONG Nl, Nh; - MD5_LONG data[MD5_LBLOCK]; - unsigned int num; -} MD5_CTX; - -int MD5_Init(MD5_CTX *c); -int MD5_Update(MD5_CTX *c, const void *data, size_t len); -int MD5_Final(unsigned char *md, MD5_CTX *c); -unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); -void MD5_Transform(MD5_CTX *c, const unsigned char *b); -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/mdc2.h b/Hin2n/src/main/jniLibs/x86/include/openssl/mdc2.h deleted file mode 100644 index aabd2bfa..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/mdc2.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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_MDC2_H -# define HEADER_MDC2_H - -# include - -#ifndef OPENSSL_NO_MDC2 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define MDC2_BLOCK 8 -# define MDC2_DIGEST_LENGTH 16 - -typedef struct mdc2_ctx_st { - unsigned int num; - unsigned char data[MDC2_BLOCK]; - DES_cblock h, hh; - int pad_type; /* either 1 or 2, default 1 */ -} MDC2_CTX; - -int MDC2_Init(MDC2_CTX *c); -int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); -int MDC2_Final(unsigned char *md, MDC2_CTX *c); -unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/modes.h b/Hin2n/src/main/jniLibs/x86/include/openssl/modes.h deleted file mode 100644 index d544f98d..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/modes.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright 2008-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_MODES_H -# define HEADER_MODES_H - -# include - -# ifdef __cplusplus -extern "C" { -# endif -typedef void (*block128_f) (const unsigned char in[16], - unsigned char out[16], const void *key); - -typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int enc); - -typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16]); - -typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16], - unsigned char cmac[16]); - -void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); -void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); - -void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], - unsigned char ecount_buf[16], unsigned int *num, - block128_f block); - -void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], - unsigned char ecount_buf[16], - unsigned int *num, ctr128_f ctr); - -void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - block128_f block); - -void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); -void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); -void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, - size_t bits, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); - -size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, unsigned char ivec[16], - block128_f block); -size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); -size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, unsigned char ivec[16], - block128_f block); -size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); - -size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, - unsigned char ivec[16], - block128_f block); -size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); -size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, - unsigned char ivec[16], - block128_f block); -size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); - -typedef struct gcm128_context GCM128_CONTEXT; - -GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); -void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); -void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, - size_t len); -int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, - size_t len); -int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); -int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); -int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); -int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); -int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, - size_t len); -void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); -void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); - -typedef struct ccm128_context CCM128_CONTEXT; - -void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, - unsigned int M, unsigned int L, void *key, - block128_f block); -int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, - size_t nlen, size_t mlen); -void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, - size_t alen); -int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len); -int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len); -int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len, - ccm128_f stream); -int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len, - ccm128_f stream); -size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); - -typedef struct xts128_context XTS128_CONTEXT; - -int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, - const unsigned char iv[16], - const unsigned char *inp, unsigned char *out, - size_t len, int enc); - -size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, size_t inlen, - block128_f block); - -size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, size_t inlen, - block128_f block); -size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, - unsigned char *out, const unsigned char *in, - size_t inlen, block128_f block); -size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, - unsigned char *out, const unsigned char *in, - size_t inlen, block128_f block); - -# ifndef OPENSSL_NO_OCB -typedef struct ocb128_context OCB128_CONTEXT; - -typedef void (*ocb128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - size_t start_block_num, - unsigned char offset_i[16], - const unsigned char L_[][16], - unsigned char checksum[16]); - -OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, - block128_f encrypt, block128_f decrypt, - ocb128_f stream); -int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, - block128_f encrypt, block128_f decrypt, - ocb128_f stream); -int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, - void *keyenc, void *keydec); -int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, - size_t len, size_t taglen); -int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, - size_t len); -int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in, - unsigned char *out, size_t len); -int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in, - unsigned char *out, size_t len); -int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag, - size_t len); -int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len); -void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx); -# endif /* OPENSSL_NO_OCB */ - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/obj_mac.h b/Hin2n/src/main/jniLibs/x86/include/openssl/obj_mac.h deleted file mode 100644 index 483fc050..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/obj_mac.h +++ /dev/null @@ -1,5198 +0,0 @@ -/* - * WARNING: do not edit! - * Generated by crypto/objects/objects.pl - * - * Copyright 2000-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 - */ - -#define SN_undef "UNDEF" -#define LN_undef "undefined" -#define NID_undef 0 -#define OBJ_undef 0L - -#define SN_itu_t "ITU-T" -#define LN_itu_t "itu-t" -#define NID_itu_t 645 -#define OBJ_itu_t 0L - -#define NID_ccitt 404 -#define OBJ_ccitt OBJ_itu_t - -#define SN_iso "ISO" -#define LN_iso "iso" -#define NID_iso 181 -#define OBJ_iso 1L - -#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" -#define LN_joint_iso_itu_t "joint-iso-itu-t" -#define NID_joint_iso_itu_t 646 -#define OBJ_joint_iso_itu_t 2L - -#define NID_joint_iso_ccitt 393 -#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t - -#define SN_member_body "member-body" -#define LN_member_body "ISO Member Body" -#define NID_member_body 182 -#define OBJ_member_body OBJ_iso,2L - -#define SN_identified_organization "identified-organization" -#define NID_identified_organization 676 -#define OBJ_identified_organization OBJ_iso,3L - -#define SN_hmac_md5 "HMAC-MD5" -#define LN_hmac_md5 "hmac-md5" -#define NID_hmac_md5 780 -#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L - -#define SN_hmac_sha1 "HMAC-SHA1" -#define LN_hmac_sha1 "hmac-sha1" -#define NID_hmac_sha1 781 -#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L - -#define SN_x509ExtAdmission "x509ExtAdmission" -#define LN_x509ExtAdmission "Professional Information or basis for Admission" -#define NID_x509ExtAdmission 1093 -#define OBJ_x509ExtAdmission OBJ_identified_organization,36L,8L,3L,3L - -#define SN_certicom_arc "certicom-arc" -#define NID_certicom_arc 677 -#define OBJ_certicom_arc OBJ_identified_organization,132L - -#define SN_ieee "ieee" -#define NID_ieee 1170 -#define OBJ_ieee OBJ_identified_organization,111L - -#define SN_ieee_siswg "ieee-siswg" -#define LN_ieee_siswg "IEEE Security in Storage Working Group" -#define NID_ieee_siswg 1171 -#define OBJ_ieee_siswg OBJ_ieee,2L,1619L - -#define SN_international_organizations "international-organizations" -#define LN_international_organizations "International Organizations" -#define NID_international_organizations 647 -#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L - -#define SN_wap "wap" -#define NID_wap 678 -#define OBJ_wap OBJ_international_organizations,43L - -#define SN_wap_wsg "wap-wsg" -#define NID_wap_wsg 679 -#define OBJ_wap_wsg OBJ_wap,1L - -#define SN_selected_attribute_types "selected-attribute-types" -#define LN_selected_attribute_types "Selected Attribute Types" -#define NID_selected_attribute_types 394 -#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L - -#define SN_clearance "clearance" -#define NID_clearance 395 -#define OBJ_clearance OBJ_selected_attribute_types,55L - -#define SN_ISO_US "ISO-US" -#define LN_ISO_US "ISO US Member Body" -#define NID_ISO_US 183 -#define OBJ_ISO_US OBJ_member_body,840L - -#define SN_X9_57 "X9-57" -#define LN_X9_57 "X9.57" -#define NID_X9_57 184 -#define OBJ_X9_57 OBJ_ISO_US,10040L - -#define SN_X9cm "X9cm" -#define LN_X9cm "X9.57 CM ?" -#define NID_X9cm 185 -#define OBJ_X9cm OBJ_X9_57,4L - -#define SN_ISO_CN "ISO-CN" -#define LN_ISO_CN "ISO CN Member Body" -#define NID_ISO_CN 1140 -#define OBJ_ISO_CN OBJ_member_body,156L - -#define SN_oscca "oscca" -#define NID_oscca 1141 -#define OBJ_oscca OBJ_ISO_CN,10197L - -#define SN_sm_scheme "sm-scheme" -#define NID_sm_scheme 1142 -#define OBJ_sm_scheme OBJ_oscca,1L - -#define SN_dsa "DSA" -#define LN_dsa "dsaEncryption" -#define NID_dsa 116 -#define OBJ_dsa OBJ_X9cm,1L - -#define SN_dsaWithSHA1 "DSA-SHA1" -#define LN_dsaWithSHA1 "dsaWithSHA1" -#define NID_dsaWithSHA1 113 -#define OBJ_dsaWithSHA1 OBJ_X9cm,3L - -#define SN_ansi_X9_62 "ansi-X9-62" -#define LN_ansi_X9_62 "ANSI X9.62" -#define NID_ansi_X9_62 405 -#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L - -#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L - -#define SN_X9_62_prime_field "prime-field" -#define NID_X9_62_prime_field 406 -#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L - -#define SN_X9_62_characteristic_two_field "characteristic-two-field" -#define NID_X9_62_characteristic_two_field 407 -#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L - -#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" -#define NID_X9_62_id_characteristic_two_basis 680 -#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L - -#define SN_X9_62_onBasis "onBasis" -#define NID_X9_62_onBasis 681 -#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L - -#define SN_X9_62_tpBasis "tpBasis" -#define NID_X9_62_tpBasis 682 -#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L - -#define SN_X9_62_ppBasis "ppBasis" -#define NID_X9_62_ppBasis 683 -#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L - -#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L - -#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" -#define NID_X9_62_id_ecPublicKey 408 -#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L - -#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L - -#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L - -#define SN_X9_62_c2pnb163v1 "c2pnb163v1" -#define NID_X9_62_c2pnb163v1 684 -#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L - -#define SN_X9_62_c2pnb163v2 "c2pnb163v2" -#define NID_X9_62_c2pnb163v2 685 -#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L - -#define SN_X9_62_c2pnb163v3 "c2pnb163v3" -#define NID_X9_62_c2pnb163v3 686 -#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L - -#define SN_X9_62_c2pnb176v1 "c2pnb176v1" -#define NID_X9_62_c2pnb176v1 687 -#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L - -#define SN_X9_62_c2tnb191v1 "c2tnb191v1" -#define NID_X9_62_c2tnb191v1 688 -#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L - -#define SN_X9_62_c2tnb191v2 "c2tnb191v2" -#define NID_X9_62_c2tnb191v2 689 -#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L - -#define SN_X9_62_c2tnb191v3 "c2tnb191v3" -#define NID_X9_62_c2tnb191v3 690 -#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L - -#define SN_X9_62_c2onb191v4 "c2onb191v4" -#define NID_X9_62_c2onb191v4 691 -#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L - -#define SN_X9_62_c2onb191v5 "c2onb191v5" -#define NID_X9_62_c2onb191v5 692 -#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L - -#define SN_X9_62_c2pnb208w1 "c2pnb208w1" -#define NID_X9_62_c2pnb208w1 693 -#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L - -#define SN_X9_62_c2tnb239v1 "c2tnb239v1" -#define NID_X9_62_c2tnb239v1 694 -#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L - -#define SN_X9_62_c2tnb239v2 "c2tnb239v2" -#define NID_X9_62_c2tnb239v2 695 -#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L - -#define SN_X9_62_c2tnb239v3 "c2tnb239v3" -#define NID_X9_62_c2tnb239v3 696 -#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L - -#define SN_X9_62_c2onb239v4 "c2onb239v4" -#define NID_X9_62_c2onb239v4 697 -#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L - -#define SN_X9_62_c2onb239v5 "c2onb239v5" -#define NID_X9_62_c2onb239v5 698 -#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L - -#define SN_X9_62_c2pnb272w1 "c2pnb272w1" -#define NID_X9_62_c2pnb272w1 699 -#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L - -#define SN_X9_62_c2pnb304w1 "c2pnb304w1" -#define NID_X9_62_c2pnb304w1 700 -#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L - -#define SN_X9_62_c2tnb359v1 "c2tnb359v1" -#define NID_X9_62_c2tnb359v1 701 -#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L - -#define SN_X9_62_c2pnb368w1 "c2pnb368w1" -#define NID_X9_62_c2pnb368w1 702 -#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L - -#define SN_X9_62_c2tnb431r1 "c2tnb431r1" -#define NID_X9_62_c2tnb431r1 703 -#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L - -#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L - -#define SN_X9_62_prime192v1 "prime192v1" -#define NID_X9_62_prime192v1 409 -#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L - -#define SN_X9_62_prime192v2 "prime192v2" -#define NID_X9_62_prime192v2 410 -#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L - -#define SN_X9_62_prime192v3 "prime192v3" -#define NID_X9_62_prime192v3 411 -#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L - -#define SN_X9_62_prime239v1 "prime239v1" -#define NID_X9_62_prime239v1 412 -#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L - -#define SN_X9_62_prime239v2 "prime239v2" -#define NID_X9_62_prime239v2 413 -#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L - -#define SN_X9_62_prime239v3 "prime239v3" -#define NID_X9_62_prime239v3 414 -#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L - -#define SN_X9_62_prime256v1 "prime256v1" -#define NID_X9_62_prime256v1 415 -#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L - -#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L - -#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" -#define NID_ecdsa_with_SHA1 416 -#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L - -#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" -#define NID_ecdsa_with_Recommended 791 -#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L - -#define SN_ecdsa_with_Specified "ecdsa-with-Specified" -#define NID_ecdsa_with_Specified 792 -#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L - -#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" -#define NID_ecdsa_with_SHA224 793 -#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L - -#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" -#define NID_ecdsa_with_SHA256 794 -#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L - -#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" -#define NID_ecdsa_with_SHA384 795 -#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L - -#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" -#define NID_ecdsa_with_SHA512 796 -#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L - -#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L - -#define SN_secp112r1 "secp112r1" -#define NID_secp112r1 704 -#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L - -#define SN_secp112r2 "secp112r2" -#define NID_secp112r2 705 -#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L - -#define SN_secp128r1 "secp128r1" -#define NID_secp128r1 706 -#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L - -#define SN_secp128r2 "secp128r2" -#define NID_secp128r2 707 -#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L - -#define SN_secp160k1 "secp160k1" -#define NID_secp160k1 708 -#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L - -#define SN_secp160r1 "secp160r1" -#define NID_secp160r1 709 -#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L - -#define SN_secp160r2 "secp160r2" -#define NID_secp160r2 710 -#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L - -#define SN_secp192k1 "secp192k1" -#define NID_secp192k1 711 -#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L - -#define SN_secp224k1 "secp224k1" -#define NID_secp224k1 712 -#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L - -#define SN_secp224r1 "secp224r1" -#define NID_secp224r1 713 -#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L - -#define SN_secp256k1 "secp256k1" -#define NID_secp256k1 714 -#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L - -#define SN_secp384r1 "secp384r1" -#define NID_secp384r1 715 -#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L - -#define SN_secp521r1 "secp521r1" -#define NID_secp521r1 716 -#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L - -#define SN_sect113r1 "sect113r1" -#define NID_sect113r1 717 -#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L - -#define SN_sect113r2 "sect113r2" -#define NID_sect113r2 718 -#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L - -#define SN_sect131r1 "sect131r1" -#define NID_sect131r1 719 -#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L - -#define SN_sect131r2 "sect131r2" -#define NID_sect131r2 720 -#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L - -#define SN_sect163k1 "sect163k1" -#define NID_sect163k1 721 -#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L - -#define SN_sect163r1 "sect163r1" -#define NID_sect163r1 722 -#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L - -#define SN_sect163r2 "sect163r2" -#define NID_sect163r2 723 -#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L - -#define SN_sect193r1 "sect193r1" -#define NID_sect193r1 724 -#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L - -#define SN_sect193r2 "sect193r2" -#define NID_sect193r2 725 -#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L - -#define SN_sect233k1 "sect233k1" -#define NID_sect233k1 726 -#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L - -#define SN_sect233r1 "sect233r1" -#define NID_sect233r1 727 -#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L - -#define SN_sect239k1 "sect239k1" -#define NID_sect239k1 728 -#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L - -#define SN_sect283k1 "sect283k1" -#define NID_sect283k1 729 -#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L - -#define SN_sect283r1 "sect283r1" -#define NID_sect283r1 730 -#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L - -#define SN_sect409k1 "sect409k1" -#define NID_sect409k1 731 -#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L - -#define SN_sect409r1 "sect409r1" -#define NID_sect409r1 732 -#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L - -#define SN_sect571k1 "sect571k1" -#define NID_sect571k1 733 -#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L - -#define SN_sect571r1 "sect571r1" -#define NID_sect571r1 734 -#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L - -#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L - -#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" -#define NID_wap_wsg_idm_ecid_wtls1 735 -#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L - -#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" -#define NID_wap_wsg_idm_ecid_wtls3 736 -#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L - -#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" -#define NID_wap_wsg_idm_ecid_wtls4 737 -#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L - -#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" -#define NID_wap_wsg_idm_ecid_wtls5 738 -#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L - -#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" -#define NID_wap_wsg_idm_ecid_wtls6 739 -#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L - -#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" -#define NID_wap_wsg_idm_ecid_wtls7 740 -#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L - -#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" -#define NID_wap_wsg_idm_ecid_wtls8 741 -#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L - -#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" -#define NID_wap_wsg_idm_ecid_wtls9 742 -#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L - -#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" -#define NID_wap_wsg_idm_ecid_wtls10 743 -#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L - -#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" -#define NID_wap_wsg_idm_ecid_wtls11 744 -#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L - -#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" -#define NID_wap_wsg_idm_ecid_wtls12 745 -#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L - -#define SN_cast5_cbc "CAST5-CBC" -#define LN_cast5_cbc "cast5-cbc" -#define NID_cast5_cbc 108 -#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L - -#define SN_cast5_ecb "CAST5-ECB" -#define LN_cast5_ecb "cast5-ecb" -#define NID_cast5_ecb 109 - -#define SN_cast5_cfb64 "CAST5-CFB" -#define LN_cast5_cfb64 "cast5-cfb" -#define NID_cast5_cfb64 110 - -#define SN_cast5_ofb64 "CAST5-OFB" -#define LN_cast5_ofb64 "cast5-ofb" -#define NID_cast5_ofb64 111 - -#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" -#define NID_pbeWithMD5AndCast5_CBC 112 -#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L - -#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" -#define LN_id_PasswordBasedMAC "password based MAC" -#define NID_id_PasswordBasedMAC 782 -#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L - -#define SN_id_DHBasedMac "id-DHBasedMac" -#define LN_id_DHBasedMac "Diffie-Hellman based MAC" -#define NID_id_DHBasedMac 783 -#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L - -#define SN_rsadsi "rsadsi" -#define LN_rsadsi "RSA Data Security, Inc." -#define NID_rsadsi 1 -#define OBJ_rsadsi OBJ_ISO_US,113549L - -#define SN_pkcs "pkcs" -#define LN_pkcs "RSA Data Security, Inc. PKCS" -#define NID_pkcs 2 -#define OBJ_pkcs OBJ_rsadsi,1L - -#define SN_pkcs1 "pkcs1" -#define NID_pkcs1 186 -#define OBJ_pkcs1 OBJ_pkcs,1L - -#define LN_rsaEncryption "rsaEncryption" -#define NID_rsaEncryption 6 -#define OBJ_rsaEncryption OBJ_pkcs1,1L - -#define SN_md2WithRSAEncryption "RSA-MD2" -#define LN_md2WithRSAEncryption "md2WithRSAEncryption" -#define NID_md2WithRSAEncryption 7 -#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L - -#define SN_md4WithRSAEncryption "RSA-MD4" -#define LN_md4WithRSAEncryption "md4WithRSAEncryption" -#define NID_md4WithRSAEncryption 396 -#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L - -#define SN_md5WithRSAEncryption "RSA-MD5" -#define LN_md5WithRSAEncryption "md5WithRSAEncryption" -#define NID_md5WithRSAEncryption 8 -#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L - -#define SN_sha1WithRSAEncryption "RSA-SHA1" -#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" -#define NID_sha1WithRSAEncryption 65 -#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L - -#define SN_rsaesOaep "RSAES-OAEP" -#define LN_rsaesOaep "rsaesOaep" -#define NID_rsaesOaep 919 -#define OBJ_rsaesOaep OBJ_pkcs1,7L - -#define SN_mgf1 "MGF1" -#define LN_mgf1 "mgf1" -#define NID_mgf1 911 -#define OBJ_mgf1 OBJ_pkcs1,8L - -#define SN_pSpecified "PSPECIFIED" -#define LN_pSpecified "pSpecified" -#define NID_pSpecified 935 -#define OBJ_pSpecified OBJ_pkcs1,9L - -#define SN_rsassaPss "RSASSA-PSS" -#define LN_rsassaPss "rsassaPss" -#define NID_rsassaPss 912 -#define OBJ_rsassaPss OBJ_pkcs1,10L - -#define SN_sha256WithRSAEncryption "RSA-SHA256" -#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" -#define NID_sha256WithRSAEncryption 668 -#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L - -#define SN_sha384WithRSAEncryption "RSA-SHA384" -#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" -#define NID_sha384WithRSAEncryption 669 -#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L - -#define SN_sha512WithRSAEncryption "RSA-SHA512" -#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" -#define NID_sha512WithRSAEncryption 670 -#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L - -#define SN_sha224WithRSAEncryption "RSA-SHA224" -#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" -#define NID_sha224WithRSAEncryption 671 -#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L - -#define SN_sha512_224WithRSAEncryption "RSA-SHA512/224" -#define LN_sha512_224WithRSAEncryption "sha512-224WithRSAEncryption" -#define NID_sha512_224WithRSAEncryption 1145 -#define OBJ_sha512_224WithRSAEncryption OBJ_pkcs1,15L - -#define SN_sha512_256WithRSAEncryption "RSA-SHA512/256" -#define LN_sha512_256WithRSAEncryption "sha512-256WithRSAEncryption" -#define NID_sha512_256WithRSAEncryption 1146 -#define OBJ_sha512_256WithRSAEncryption OBJ_pkcs1,16L - -#define SN_pkcs3 "pkcs3" -#define NID_pkcs3 27 -#define OBJ_pkcs3 OBJ_pkcs,3L - -#define LN_dhKeyAgreement "dhKeyAgreement" -#define NID_dhKeyAgreement 28 -#define OBJ_dhKeyAgreement OBJ_pkcs3,1L - -#define SN_pkcs5 "pkcs5" -#define NID_pkcs5 187 -#define OBJ_pkcs5 OBJ_pkcs,5L - -#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" -#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" -#define NID_pbeWithMD2AndDES_CBC 9 -#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L - -#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" -#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" -#define NID_pbeWithMD5AndDES_CBC 10 -#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L - -#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" -#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" -#define NID_pbeWithMD2AndRC2_CBC 168 -#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L - -#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" -#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" -#define NID_pbeWithMD5AndRC2_CBC 169 -#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L - -#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" -#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" -#define NID_pbeWithSHA1AndDES_CBC 170 -#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L - -#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" -#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" -#define NID_pbeWithSHA1AndRC2_CBC 68 -#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L - -#define LN_id_pbkdf2 "PBKDF2" -#define NID_id_pbkdf2 69 -#define OBJ_id_pbkdf2 OBJ_pkcs5,12L - -#define LN_pbes2 "PBES2" -#define NID_pbes2 161 -#define OBJ_pbes2 OBJ_pkcs5,13L - -#define LN_pbmac1 "PBMAC1" -#define NID_pbmac1 162 -#define OBJ_pbmac1 OBJ_pkcs5,14L - -#define SN_pkcs7 "pkcs7" -#define NID_pkcs7 20 -#define OBJ_pkcs7 OBJ_pkcs,7L - -#define LN_pkcs7_data "pkcs7-data" -#define NID_pkcs7_data 21 -#define OBJ_pkcs7_data OBJ_pkcs7,1L - -#define LN_pkcs7_signed "pkcs7-signedData" -#define NID_pkcs7_signed 22 -#define OBJ_pkcs7_signed OBJ_pkcs7,2L - -#define LN_pkcs7_enveloped "pkcs7-envelopedData" -#define NID_pkcs7_enveloped 23 -#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L - -#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" -#define NID_pkcs7_signedAndEnveloped 24 -#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L - -#define LN_pkcs7_digest "pkcs7-digestData" -#define NID_pkcs7_digest 25 -#define OBJ_pkcs7_digest OBJ_pkcs7,5L - -#define LN_pkcs7_encrypted "pkcs7-encryptedData" -#define NID_pkcs7_encrypted 26 -#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L - -#define SN_pkcs9 "pkcs9" -#define NID_pkcs9 47 -#define OBJ_pkcs9 OBJ_pkcs,9L - -#define LN_pkcs9_emailAddress "emailAddress" -#define NID_pkcs9_emailAddress 48 -#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L - -#define LN_pkcs9_unstructuredName "unstructuredName" -#define NID_pkcs9_unstructuredName 49 -#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L - -#define LN_pkcs9_contentType "contentType" -#define NID_pkcs9_contentType 50 -#define OBJ_pkcs9_contentType OBJ_pkcs9,3L - -#define LN_pkcs9_messageDigest "messageDigest" -#define NID_pkcs9_messageDigest 51 -#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L - -#define LN_pkcs9_signingTime "signingTime" -#define NID_pkcs9_signingTime 52 -#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L - -#define LN_pkcs9_countersignature "countersignature" -#define NID_pkcs9_countersignature 53 -#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L - -#define LN_pkcs9_challengePassword "challengePassword" -#define NID_pkcs9_challengePassword 54 -#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L - -#define LN_pkcs9_unstructuredAddress "unstructuredAddress" -#define NID_pkcs9_unstructuredAddress 55 -#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L - -#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" -#define NID_pkcs9_extCertAttributes 56 -#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L - -#define SN_ext_req "extReq" -#define LN_ext_req "Extension Request" -#define NID_ext_req 172 -#define OBJ_ext_req OBJ_pkcs9,14L - -#define SN_SMIMECapabilities "SMIME-CAPS" -#define LN_SMIMECapabilities "S/MIME Capabilities" -#define NID_SMIMECapabilities 167 -#define OBJ_SMIMECapabilities OBJ_pkcs9,15L - -#define SN_SMIME "SMIME" -#define LN_SMIME "S/MIME" -#define NID_SMIME 188 -#define OBJ_SMIME OBJ_pkcs9,16L - -#define SN_id_smime_mod "id-smime-mod" -#define NID_id_smime_mod 189 -#define OBJ_id_smime_mod OBJ_SMIME,0L - -#define SN_id_smime_ct "id-smime-ct" -#define NID_id_smime_ct 190 -#define OBJ_id_smime_ct OBJ_SMIME,1L - -#define SN_id_smime_aa "id-smime-aa" -#define NID_id_smime_aa 191 -#define OBJ_id_smime_aa OBJ_SMIME,2L - -#define SN_id_smime_alg "id-smime-alg" -#define NID_id_smime_alg 192 -#define OBJ_id_smime_alg OBJ_SMIME,3L - -#define SN_id_smime_cd "id-smime-cd" -#define NID_id_smime_cd 193 -#define OBJ_id_smime_cd OBJ_SMIME,4L - -#define SN_id_smime_spq "id-smime-spq" -#define NID_id_smime_spq 194 -#define OBJ_id_smime_spq OBJ_SMIME,5L - -#define SN_id_smime_cti "id-smime-cti" -#define NID_id_smime_cti 195 -#define OBJ_id_smime_cti OBJ_SMIME,6L - -#define SN_id_smime_mod_cms "id-smime-mod-cms" -#define NID_id_smime_mod_cms 196 -#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L - -#define SN_id_smime_mod_ess "id-smime-mod-ess" -#define NID_id_smime_mod_ess 197 -#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L - -#define SN_id_smime_mod_oid "id-smime-mod-oid" -#define NID_id_smime_mod_oid 198 -#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L - -#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" -#define NID_id_smime_mod_msg_v3 199 -#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L - -#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" -#define NID_id_smime_mod_ets_eSignature_88 200 -#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L - -#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" -#define NID_id_smime_mod_ets_eSignature_97 201 -#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L - -#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" -#define NID_id_smime_mod_ets_eSigPolicy_88 202 -#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L - -#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" -#define NID_id_smime_mod_ets_eSigPolicy_97 203 -#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L - -#define SN_id_smime_ct_receipt "id-smime-ct-receipt" -#define NID_id_smime_ct_receipt 204 -#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L - -#define SN_id_smime_ct_authData "id-smime-ct-authData" -#define NID_id_smime_ct_authData 205 -#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L - -#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" -#define NID_id_smime_ct_publishCert 206 -#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L - -#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" -#define NID_id_smime_ct_TSTInfo 207 -#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L - -#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" -#define NID_id_smime_ct_TDTInfo 208 -#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L - -#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" -#define NID_id_smime_ct_contentInfo 209 -#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L - -#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" -#define NID_id_smime_ct_DVCSRequestData 210 -#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L - -#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" -#define NID_id_smime_ct_DVCSResponseData 211 -#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L - -#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" -#define NID_id_smime_ct_compressedData 786 -#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L - -#define SN_id_smime_ct_contentCollection "id-smime-ct-contentCollection" -#define NID_id_smime_ct_contentCollection 1058 -#define OBJ_id_smime_ct_contentCollection OBJ_id_smime_ct,19L - -#define SN_id_smime_ct_authEnvelopedData "id-smime-ct-authEnvelopedData" -#define NID_id_smime_ct_authEnvelopedData 1059 -#define OBJ_id_smime_ct_authEnvelopedData OBJ_id_smime_ct,23L - -#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" -#define NID_id_ct_asciiTextWithCRLF 787 -#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L - -#define SN_id_ct_xml "id-ct-xml" -#define NID_id_ct_xml 1060 -#define OBJ_id_ct_xml OBJ_id_smime_ct,28L - -#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" -#define NID_id_smime_aa_receiptRequest 212 -#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L - -#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" -#define NID_id_smime_aa_securityLabel 213 -#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L - -#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" -#define NID_id_smime_aa_mlExpandHistory 214 -#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L - -#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" -#define NID_id_smime_aa_contentHint 215 -#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L - -#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" -#define NID_id_smime_aa_msgSigDigest 216 -#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L - -#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" -#define NID_id_smime_aa_encapContentType 217 -#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L - -#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" -#define NID_id_smime_aa_contentIdentifier 218 -#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L - -#define SN_id_smime_aa_macValue "id-smime-aa-macValue" -#define NID_id_smime_aa_macValue 219 -#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L - -#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" -#define NID_id_smime_aa_equivalentLabels 220 -#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L - -#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" -#define NID_id_smime_aa_contentReference 221 -#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L - -#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" -#define NID_id_smime_aa_encrypKeyPref 222 -#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L - -#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" -#define NID_id_smime_aa_signingCertificate 223 -#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L - -#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" -#define NID_id_smime_aa_smimeEncryptCerts 224 -#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L - -#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" -#define NID_id_smime_aa_timeStampToken 225 -#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L - -#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" -#define NID_id_smime_aa_ets_sigPolicyId 226 -#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L - -#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" -#define NID_id_smime_aa_ets_commitmentType 227 -#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L - -#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" -#define NID_id_smime_aa_ets_signerLocation 228 -#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L - -#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" -#define NID_id_smime_aa_ets_signerAttr 229 -#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L - -#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" -#define NID_id_smime_aa_ets_otherSigCert 230 -#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L - -#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" -#define NID_id_smime_aa_ets_contentTimestamp 231 -#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L - -#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" -#define NID_id_smime_aa_ets_CertificateRefs 232 -#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L - -#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" -#define NID_id_smime_aa_ets_RevocationRefs 233 -#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L - -#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" -#define NID_id_smime_aa_ets_certValues 234 -#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L - -#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" -#define NID_id_smime_aa_ets_revocationValues 235 -#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L - -#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" -#define NID_id_smime_aa_ets_escTimeStamp 236 -#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L - -#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" -#define NID_id_smime_aa_ets_certCRLTimestamp 237 -#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L - -#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" -#define NID_id_smime_aa_ets_archiveTimeStamp 238 -#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L - -#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" -#define NID_id_smime_aa_signatureType 239 -#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L - -#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" -#define NID_id_smime_aa_dvcs_dvc 240 -#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L - -#define SN_id_smime_aa_signingCertificateV2 "id-smime-aa-signingCertificateV2" -#define NID_id_smime_aa_signingCertificateV2 1086 -#define OBJ_id_smime_aa_signingCertificateV2 OBJ_id_smime_aa,47L - -#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" -#define NID_id_smime_alg_ESDHwith3DES 241 -#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L - -#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" -#define NID_id_smime_alg_ESDHwithRC2 242 -#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L - -#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" -#define NID_id_smime_alg_3DESwrap 243 -#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L - -#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" -#define NID_id_smime_alg_RC2wrap 244 -#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L - -#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" -#define NID_id_smime_alg_ESDH 245 -#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L - -#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" -#define NID_id_smime_alg_CMS3DESwrap 246 -#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L - -#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" -#define NID_id_smime_alg_CMSRC2wrap 247 -#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L - -#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" -#define NID_id_alg_PWRI_KEK 893 -#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L - -#define SN_id_smime_cd_ldap "id-smime-cd-ldap" -#define NID_id_smime_cd_ldap 248 -#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L - -#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" -#define NID_id_smime_spq_ets_sqt_uri 249 -#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L - -#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" -#define NID_id_smime_spq_ets_sqt_unotice 250 -#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L - -#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" -#define NID_id_smime_cti_ets_proofOfOrigin 251 -#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L - -#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" -#define NID_id_smime_cti_ets_proofOfReceipt 252 -#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L - -#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" -#define NID_id_smime_cti_ets_proofOfDelivery 253 -#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L - -#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" -#define NID_id_smime_cti_ets_proofOfSender 254 -#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L - -#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" -#define NID_id_smime_cti_ets_proofOfApproval 255 -#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L - -#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" -#define NID_id_smime_cti_ets_proofOfCreation 256 -#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L - -#define LN_friendlyName "friendlyName" -#define NID_friendlyName 156 -#define OBJ_friendlyName OBJ_pkcs9,20L - -#define LN_localKeyID "localKeyID" -#define NID_localKeyID 157 -#define OBJ_localKeyID OBJ_pkcs9,21L - -#define SN_ms_csp_name "CSPName" -#define LN_ms_csp_name "Microsoft CSP Name" -#define NID_ms_csp_name 417 -#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L - -#define SN_LocalKeySet "LocalKeySet" -#define LN_LocalKeySet "Microsoft Local Key set" -#define NID_LocalKeySet 856 -#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L - -#define OBJ_certTypes OBJ_pkcs9,22L - -#define LN_x509Certificate "x509Certificate" -#define NID_x509Certificate 158 -#define OBJ_x509Certificate OBJ_certTypes,1L - -#define LN_sdsiCertificate "sdsiCertificate" -#define NID_sdsiCertificate 159 -#define OBJ_sdsiCertificate OBJ_certTypes,2L - -#define OBJ_crlTypes OBJ_pkcs9,23L - -#define LN_x509Crl "x509Crl" -#define NID_x509Crl 160 -#define OBJ_x509Crl OBJ_crlTypes,1L - -#define OBJ_pkcs12 OBJ_pkcs,12L - -#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L - -#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" -#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" -#define NID_pbe_WithSHA1And128BitRC4 144 -#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L - -#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" -#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" -#define NID_pbe_WithSHA1And40BitRC4 145 -#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L - -#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" -#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 -#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L - -#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" -#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 -#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L - -#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" -#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" -#define NID_pbe_WithSHA1And128BitRC2_CBC 148 -#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L - -#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" -#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" -#define NID_pbe_WithSHA1And40BitRC2_CBC 149 -#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L - -#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L - -#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L - -#define LN_keyBag "keyBag" -#define NID_keyBag 150 -#define OBJ_keyBag OBJ_pkcs12_BagIds,1L - -#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" -#define NID_pkcs8ShroudedKeyBag 151 -#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L - -#define LN_certBag "certBag" -#define NID_certBag 152 -#define OBJ_certBag OBJ_pkcs12_BagIds,3L - -#define LN_crlBag "crlBag" -#define NID_crlBag 153 -#define OBJ_crlBag OBJ_pkcs12_BagIds,4L - -#define LN_secretBag "secretBag" -#define NID_secretBag 154 -#define OBJ_secretBag OBJ_pkcs12_BagIds,5L - -#define LN_safeContentsBag "safeContentsBag" -#define NID_safeContentsBag 155 -#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L - -#define SN_md2 "MD2" -#define LN_md2 "md2" -#define NID_md2 3 -#define OBJ_md2 OBJ_rsadsi,2L,2L - -#define SN_md4 "MD4" -#define LN_md4 "md4" -#define NID_md4 257 -#define OBJ_md4 OBJ_rsadsi,2L,4L - -#define SN_md5 "MD5" -#define LN_md5 "md5" -#define NID_md5 4 -#define OBJ_md5 OBJ_rsadsi,2L,5L - -#define SN_md5_sha1 "MD5-SHA1" -#define LN_md5_sha1 "md5-sha1" -#define NID_md5_sha1 114 - -#define LN_hmacWithMD5 "hmacWithMD5" -#define NID_hmacWithMD5 797 -#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L - -#define LN_hmacWithSHA1 "hmacWithSHA1" -#define NID_hmacWithSHA1 163 -#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L - -#define SN_sm2 "SM2" -#define LN_sm2 "sm2" -#define NID_sm2 1172 -#define OBJ_sm2 OBJ_sm_scheme,301L - -#define SN_sm3 "SM3" -#define LN_sm3 "sm3" -#define NID_sm3 1143 -#define OBJ_sm3 OBJ_sm_scheme,401L - -#define SN_sm3WithRSAEncryption "RSA-SM3" -#define LN_sm3WithRSAEncryption "sm3WithRSAEncryption" -#define NID_sm3WithRSAEncryption 1144 -#define OBJ_sm3WithRSAEncryption OBJ_sm_scheme,504L - -#define LN_hmacWithSHA224 "hmacWithSHA224" -#define NID_hmacWithSHA224 798 -#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L - -#define LN_hmacWithSHA256 "hmacWithSHA256" -#define NID_hmacWithSHA256 799 -#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L - -#define LN_hmacWithSHA384 "hmacWithSHA384" -#define NID_hmacWithSHA384 800 -#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L - -#define LN_hmacWithSHA512 "hmacWithSHA512" -#define NID_hmacWithSHA512 801 -#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L - -#define LN_hmacWithSHA512_224 "hmacWithSHA512-224" -#define NID_hmacWithSHA512_224 1193 -#define OBJ_hmacWithSHA512_224 OBJ_rsadsi,2L,12L - -#define LN_hmacWithSHA512_256 "hmacWithSHA512-256" -#define NID_hmacWithSHA512_256 1194 -#define OBJ_hmacWithSHA512_256 OBJ_rsadsi,2L,13L - -#define SN_rc2_cbc "RC2-CBC" -#define LN_rc2_cbc "rc2-cbc" -#define NID_rc2_cbc 37 -#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L - -#define SN_rc2_ecb "RC2-ECB" -#define LN_rc2_ecb "rc2-ecb" -#define NID_rc2_ecb 38 - -#define SN_rc2_cfb64 "RC2-CFB" -#define LN_rc2_cfb64 "rc2-cfb" -#define NID_rc2_cfb64 39 - -#define SN_rc2_ofb64 "RC2-OFB" -#define LN_rc2_ofb64 "rc2-ofb" -#define NID_rc2_ofb64 40 - -#define SN_rc2_40_cbc "RC2-40-CBC" -#define LN_rc2_40_cbc "rc2-40-cbc" -#define NID_rc2_40_cbc 98 - -#define SN_rc2_64_cbc "RC2-64-CBC" -#define LN_rc2_64_cbc "rc2-64-cbc" -#define NID_rc2_64_cbc 166 - -#define SN_rc4 "RC4" -#define LN_rc4 "rc4" -#define NID_rc4 5 -#define OBJ_rc4 OBJ_rsadsi,3L,4L - -#define SN_rc4_40 "RC4-40" -#define LN_rc4_40 "rc4-40" -#define NID_rc4_40 97 - -#define SN_des_ede3_cbc "DES-EDE3-CBC" -#define LN_des_ede3_cbc "des-ede3-cbc" -#define NID_des_ede3_cbc 44 -#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L - -#define SN_rc5_cbc "RC5-CBC" -#define LN_rc5_cbc "rc5-cbc" -#define NID_rc5_cbc 120 -#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L - -#define SN_rc5_ecb "RC5-ECB" -#define LN_rc5_ecb "rc5-ecb" -#define NID_rc5_ecb 121 - -#define SN_rc5_cfb64 "RC5-CFB" -#define LN_rc5_cfb64 "rc5-cfb" -#define NID_rc5_cfb64 122 - -#define SN_rc5_ofb64 "RC5-OFB" -#define LN_rc5_ofb64 "rc5-ofb" -#define NID_rc5_ofb64 123 - -#define SN_ms_ext_req "msExtReq" -#define LN_ms_ext_req "Microsoft Extension Request" -#define NID_ms_ext_req 171 -#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L - -#define SN_ms_code_ind "msCodeInd" -#define LN_ms_code_ind "Microsoft Individual Code Signing" -#define NID_ms_code_ind 134 -#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L - -#define SN_ms_code_com "msCodeCom" -#define LN_ms_code_com "Microsoft Commercial Code Signing" -#define NID_ms_code_com 135 -#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L - -#define SN_ms_ctl_sign "msCTLSign" -#define LN_ms_ctl_sign "Microsoft Trust List Signing" -#define NID_ms_ctl_sign 136 -#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L - -#define SN_ms_sgc "msSGC" -#define LN_ms_sgc "Microsoft Server Gated Crypto" -#define NID_ms_sgc 137 -#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L - -#define SN_ms_efs "msEFS" -#define LN_ms_efs "Microsoft Encrypted File System" -#define NID_ms_efs 138 -#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L - -#define SN_ms_smartcard_login "msSmartcardLogin" -#define LN_ms_smartcard_login "Microsoft Smartcard Login" -#define NID_ms_smartcard_login 648 -#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L - -#define SN_ms_upn "msUPN" -#define LN_ms_upn "Microsoft User Principal Name" -#define NID_ms_upn 649 -#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L - -#define SN_idea_cbc "IDEA-CBC" -#define LN_idea_cbc "idea-cbc" -#define NID_idea_cbc 34 -#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L - -#define SN_idea_ecb "IDEA-ECB" -#define LN_idea_ecb "idea-ecb" -#define NID_idea_ecb 36 - -#define SN_idea_cfb64 "IDEA-CFB" -#define LN_idea_cfb64 "idea-cfb" -#define NID_idea_cfb64 35 - -#define SN_idea_ofb64 "IDEA-OFB" -#define LN_idea_ofb64 "idea-ofb" -#define NID_idea_ofb64 46 - -#define SN_bf_cbc "BF-CBC" -#define LN_bf_cbc "bf-cbc" -#define NID_bf_cbc 91 -#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L - -#define SN_bf_ecb "BF-ECB" -#define LN_bf_ecb "bf-ecb" -#define NID_bf_ecb 92 - -#define SN_bf_cfb64 "BF-CFB" -#define LN_bf_cfb64 "bf-cfb" -#define NID_bf_cfb64 93 - -#define SN_bf_ofb64 "BF-OFB" -#define LN_bf_ofb64 "bf-ofb" -#define NID_bf_ofb64 94 - -#define SN_id_pkix "PKIX" -#define NID_id_pkix 127 -#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L - -#define SN_id_pkix_mod "id-pkix-mod" -#define NID_id_pkix_mod 258 -#define OBJ_id_pkix_mod OBJ_id_pkix,0L - -#define SN_id_pe "id-pe" -#define NID_id_pe 175 -#define OBJ_id_pe OBJ_id_pkix,1L - -#define SN_id_qt "id-qt" -#define NID_id_qt 259 -#define OBJ_id_qt OBJ_id_pkix,2L - -#define SN_id_kp "id-kp" -#define NID_id_kp 128 -#define OBJ_id_kp OBJ_id_pkix,3L - -#define SN_id_it "id-it" -#define NID_id_it 260 -#define OBJ_id_it OBJ_id_pkix,4L - -#define SN_id_pkip "id-pkip" -#define NID_id_pkip 261 -#define OBJ_id_pkip OBJ_id_pkix,5L - -#define SN_id_alg "id-alg" -#define NID_id_alg 262 -#define OBJ_id_alg OBJ_id_pkix,6L - -#define SN_id_cmc "id-cmc" -#define NID_id_cmc 263 -#define OBJ_id_cmc OBJ_id_pkix,7L - -#define SN_id_on "id-on" -#define NID_id_on 264 -#define OBJ_id_on OBJ_id_pkix,8L - -#define SN_id_pda "id-pda" -#define NID_id_pda 265 -#define OBJ_id_pda OBJ_id_pkix,9L - -#define SN_id_aca "id-aca" -#define NID_id_aca 266 -#define OBJ_id_aca OBJ_id_pkix,10L - -#define SN_id_qcs "id-qcs" -#define NID_id_qcs 267 -#define OBJ_id_qcs OBJ_id_pkix,11L - -#define SN_id_cct "id-cct" -#define NID_id_cct 268 -#define OBJ_id_cct OBJ_id_pkix,12L - -#define SN_id_ppl "id-ppl" -#define NID_id_ppl 662 -#define OBJ_id_ppl OBJ_id_pkix,21L - -#define SN_id_ad "id-ad" -#define NID_id_ad 176 -#define OBJ_id_ad OBJ_id_pkix,48L - -#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" -#define NID_id_pkix1_explicit_88 269 -#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L - -#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" -#define NID_id_pkix1_implicit_88 270 -#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L - -#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" -#define NID_id_pkix1_explicit_93 271 -#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L - -#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" -#define NID_id_pkix1_implicit_93 272 -#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L - -#define SN_id_mod_crmf "id-mod-crmf" -#define NID_id_mod_crmf 273 -#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L - -#define SN_id_mod_cmc "id-mod-cmc" -#define NID_id_mod_cmc 274 -#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L - -#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" -#define NID_id_mod_kea_profile_88 275 -#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L - -#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" -#define NID_id_mod_kea_profile_93 276 -#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L - -#define SN_id_mod_cmp "id-mod-cmp" -#define NID_id_mod_cmp 277 -#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L - -#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" -#define NID_id_mod_qualified_cert_88 278 -#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L - -#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" -#define NID_id_mod_qualified_cert_93 279 -#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L - -#define SN_id_mod_attribute_cert "id-mod-attribute-cert" -#define NID_id_mod_attribute_cert 280 -#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L - -#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" -#define NID_id_mod_timestamp_protocol 281 -#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L - -#define SN_id_mod_ocsp "id-mod-ocsp" -#define NID_id_mod_ocsp 282 -#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L - -#define SN_id_mod_dvcs "id-mod-dvcs" -#define NID_id_mod_dvcs 283 -#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L - -#define SN_id_mod_cmp2000 "id-mod-cmp2000" -#define NID_id_mod_cmp2000 284 -#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L - -#define SN_info_access "authorityInfoAccess" -#define LN_info_access "Authority Information Access" -#define NID_info_access 177 -#define OBJ_info_access OBJ_id_pe,1L - -#define SN_biometricInfo "biometricInfo" -#define LN_biometricInfo "Biometric Info" -#define NID_biometricInfo 285 -#define OBJ_biometricInfo OBJ_id_pe,2L - -#define SN_qcStatements "qcStatements" -#define NID_qcStatements 286 -#define OBJ_qcStatements OBJ_id_pe,3L - -#define SN_ac_auditEntity "ac-auditEntity" -#define NID_ac_auditEntity 287 -#define OBJ_ac_auditEntity OBJ_id_pe,4L - -#define SN_ac_targeting "ac-targeting" -#define NID_ac_targeting 288 -#define OBJ_ac_targeting OBJ_id_pe,5L - -#define SN_aaControls "aaControls" -#define NID_aaControls 289 -#define OBJ_aaControls OBJ_id_pe,6L - -#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" -#define NID_sbgp_ipAddrBlock 290 -#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L - -#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" -#define NID_sbgp_autonomousSysNum 291 -#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L - -#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" -#define NID_sbgp_routerIdentifier 292 -#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L - -#define SN_ac_proxying "ac-proxying" -#define NID_ac_proxying 397 -#define OBJ_ac_proxying OBJ_id_pe,10L - -#define SN_sinfo_access "subjectInfoAccess" -#define LN_sinfo_access "Subject Information Access" -#define NID_sinfo_access 398 -#define OBJ_sinfo_access OBJ_id_pe,11L - -#define SN_proxyCertInfo "proxyCertInfo" -#define LN_proxyCertInfo "Proxy Certificate Information" -#define NID_proxyCertInfo 663 -#define OBJ_proxyCertInfo OBJ_id_pe,14L - -#define SN_tlsfeature "tlsfeature" -#define LN_tlsfeature "TLS Feature" -#define NID_tlsfeature 1020 -#define OBJ_tlsfeature OBJ_id_pe,24L - -#define SN_id_qt_cps "id-qt-cps" -#define LN_id_qt_cps "Policy Qualifier CPS" -#define NID_id_qt_cps 164 -#define OBJ_id_qt_cps OBJ_id_qt,1L - -#define SN_id_qt_unotice "id-qt-unotice" -#define LN_id_qt_unotice "Policy Qualifier User Notice" -#define NID_id_qt_unotice 165 -#define OBJ_id_qt_unotice OBJ_id_qt,2L - -#define SN_textNotice "textNotice" -#define NID_textNotice 293 -#define OBJ_textNotice OBJ_id_qt,3L - -#define SN_server_auth "serverAuth" -#define LN_server_auth "TLS Web Server Authentication" -#define NID_server_auth 129 -#define OBJ_server_auth OBJ_id_kp,1L - -#define SN_client_auth "clientAuth" -#define LN_client_auth "TLS Web Client Authentication" -#define NID_client_auth 130 -#define OBJ_client_auth OBJ_id_kp,2L - -#define SN_code_sign "codeSigning" -#define LN_code_sign "Code Signing" -#define NID_code_sign 131 -#define OBJ_code_sign OBJ_id_kp,3L - -#define SN_email_protect "emailProtection" -#define LN_email_protect "E-mail Protection" -#define NID_email_protect 132 -#define OBJ_email_protect OBJ_id_kp,4L - -#define SN_ipsecEndSystem "ipsecEndSystem" -#define LN_ipsecEndSystem "IPSec End System" -#define NID_ipsecEndSystem 294 -#define OBJ_ipsecEndSystem OBJ_id_kp,5L - -#define SN_ipsecTunnel "ipsecTunnel" -#define LN_ipsecTunnel "IPSec Tunnel" -#define NID_ipsecTunnel 295 -#define OBJ_ipsecTunnel OBJ_id_kp,6L - -#define SN_ipsecUser "ipsecUser" -#define LN_ipsecUser "IPSec User" -#define NID_ipsecUser 296 -#define OBJ_ipsecUser OBJ_id_kp,7L - -#define SN_time_stamp "timeStamping" -#define LN_time_stamp "Time Stamping" -#define NID_time_stamp 133 -#define OBJ_time_stamp OBJ_id_kp,8L - -#define SN_OCSP_sign "OCSPSigning" -#define LN_OCSP_sign "OCSP Signing" -#define NID_OCSP_sign 180 -#define OBJ_OCSP_sign OBJ_id_kp,9L - -#define SN_dvcs "DVCS" -#define LN_dvcs "dvcs" -#define NID_dvcs 297 -#define OBJ_dvcs OBJ_id_kp,10L - -#define SN_ipsec_IKE "ipsecIKE" -#define LN_ipsec_IKE "ipsec Internet Key Exchange" -#define NID_ipsec_IKE 1022 -#define OBJ_ipsec_IKE OBJ_id_kp,17L - -#define SN_capwapAC "capwapAC" -#define LN_capwapAC "Ctrl/provision WAP Access" -#define NID_capwapAC 1023 -#define OBJ_capwapAC OBJ_id_kp,18L - -#define SN_capwapWTP "capwapWTP" -#define LN_capwapWTP "Ctrl/Provision WAP Termination" -#define NID_capwapWTP 1024 -#define OBJ_capwapWTP OBJ_id_kp,19L - -#define SN_sshClient "secureShellClient" -#define LN_sshClient "SSH Client" -#define NID_sshClient 1025 -#define OBJ_sshClient OBJ_id_kp,21L - -#define SN_sshServer "secureShellServer" -#define LN_sshServer "SSH Server" -#define NID_sshServer 1026 -#define OBJ_sshServer OBJ_id_kp,22L - -#define SN_sendRouter "sendRouter" -#define LN_sendRouter "Send Router" -#define NID_sendRouter 1027 -#define OBJ_sendRouter OBJ_id_kp,23L - -#define SN_sendProxiedRouter "sendProxiedRouter" -#define LN_sendProxiedRouter "Send Proxied Router" -#define NID_sendProxiedRouter 1028 -#define OBJ_sendProxiedRouter OBJ_id_kp,24L - -#define SN_sendOwner "sendOwner" -#define LN_sendOwner "Send Owner" -#define NID_sendOwner 1029 -#define OBJ_sendOwner OBJ_id_kp,25L - -#define SN_sendProxiedOwner "sendProxiedOwner" -#define LN_sendProxiedOwner "Send Proxied Owner" -#define NID_sendProxiedOwner 1030 -#define OBJ_sendProxiedOwner OBJ_id_kp,26L - -#define SN_cmcCA "cmcCA" -#define LN_cmcCA "CMC Certificate Authority" -#define NID_cmcCA 1131 -#define OBJ_cmcCA OBJ_id_kp,27L - -#define SN_cmcRA "cmcRA" -#define LN_cmcRA "CMC Registration Authority" -#define NID_cmcRA 1132 -#define OBJ_cmcRA OBJ_id_kp,28L - -#define SN_id_it_caProtEncCert "id-it-caProtEncCert" -#define NID_id_it_caProtEncCert 298 -#define OBJ_id_it_caProtEncCert OBJ_id_it,1L - -#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" -#define NID_id_it_signKeyPairTypes 299 -#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L - -#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" -#define NID_id_it_encKeyPairTypes 300 -#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L - -#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" -#define NID_id_it_preferredSymmAlg 301 -#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L - -#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" -#define NID_id_it_caKeyUpdateInfo 302 -#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L - -#define SN_id_it_currentCRL "id-it-currentCRL" -#define NID_id_it_currentCRL 303 -#define OBJ_id_it_currentCRL OBJ_id_it,6L - -#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" -#define NID_id_it_unsupportedOIDs 304 -#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L - -#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" -#define NID_id_it_subscriptionRequest 305 -#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L - -#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" -#define NID_id_it_subscriptionResponse 306 -#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L - -#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" -#define NID_id_it_keyPairParamReq 307 -#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L - -#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" -#define NID_id_it_keyPairParamRep 308 -#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L - -#define SN_id_it_revPassphrase "id-it-revPassphrase" -#define NID_id_it_revPassphrase 309 -#define OBJ_id_it_revPassphrase OBJ_id_it,12L - -#define SN_id_it_implicitConfirm "id-it-implicitConfirm" -#define NID_id_it_implicitConfirm 310 -#define OBJ_id_it_implicitConfirm OBJ_id_it,13L - -#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" -#define NID_id_it_confirmWaitTime 311 -#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L - -#define SN_id_it_origPKIMessage "id-it-origPKIMessage" -#define NID_id_it_origPKIMessage 312 -#define OBJ_id_it_origPKIMessage OBJ_id_it,15L - -#define SN_id_it_suppLangTags "id-it-suppLangTags" -#define NID_id_it_suppLangTags 784 -#define OBJ_id_it_suppLangTags OBJ_id_it,16L - -#define SN_id_regCtrl "id-regCtrl" -#define NID_id_regCtrl 313 -#define OBJ_id_regCtrl OBJ_id_pkip,1L - -#define SN_id_regInfo "id-regInfo" -#define NID_id_regInfo 314 -#define OBJ_id_regInfo OBJ_id_pkip,2L - -#define SN_id_regCtrl_regToken "id-regCtrl-regToken" -#define NID_id_regCtrl_regToken 315 -#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L - -#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" -#define NID_id_regCtrl_authenticator 316 -#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L - -#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" -#define NID_id_regCtrl_pkiPublicationInfo 317 -#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L - -#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" -#define NID_id_regCtrl_pkiArchiveOptions 318 -#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L - -#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" -#define NID_id_regCtrl_oldCertID 319 -#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L - -#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" -#define NID_id_regCtrl_protocolEncrKey 320 -#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L - -#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" -#define NID_id_regInfo_utf8Pairs 321 -#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L - -#define SN_id_regInfo_certReq "id-regInfo-certReq" -#define NID_id_regInfo_certReq 322 -#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L - -#define SN_id_alg_des40 "id-alg-des40" -#define NID_id_alg_des40 323 -#define OBJ_id_alg_des40 OBJ_id_alg,1L - -#define SN_id_alg_noSignature "id-alg-noSignature" -#define NID_id_alg_noSignature 324 -#define OBJ_id_alg_noSignature OBJ_id_alg,2L - -#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" -#define NID_id_alg_dh_sig_hmac_sha1 325 -#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L - -#define SN_id_alg_dh_pop "id-alg-dh-pop" -#define NID_id_alg_dh_pop 326 -#define OBJ_id_alg_dh_pop OBJ_id_alg,4L - -#define SN_id_cmc_statusInfo "id-cmc-statusInfo" -#define NID_id_cmc_statusInfo 327 -#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L - -#define SN_id_cmc_identification "id-cmc-identification" -#define NID_id_cmc_identification 328 -#define OBJ_id_cmc_identification OBJ_id_cmc,2L - -#define SN_id_cmc_identityProof "id-cmc-identityProof" -#define NID_id_cmc_identityProof 329 -#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L - -#define SN_id_cmc_dataReturn "id-cmc-dataReturn" -#define NID_id_cmc_dataReturn 330 -#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L - -#define SN_id_cmc_transactionId "id-cmc-transactionId" -#define NID_id_cmc_transactionId 331 -#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L - -#define SN_id_cmc_senderNonce "id-cmc-senderNonce" -#define NID_id_cmc_senderNonce 332 -#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L - -#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" -#define NID_id_cmc_recipientNonce 333 -#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L - -#define SN_id_cmc_addExtensions "id-cmc-addExtensions" -#define NID_id_cmc_addExtensions 334 -#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L - -#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" -#define NID_id_cmc_encryptedPOP 335 -#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L - -#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" -#define NID_id_cmc_decryptedPOP 336 -#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L - -#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" -#define NID_id_cmc_lraPOPWitness 337 -#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L - -#define SN_id_cmc_getCert "id-cmc-getCert" -#define NID_id_cmc_getCert 338 -#define OBJ_id_cmc_getCert OBJ_id_cmc,15L - -#define SN_id_cmc_getCRL "id-cmc-getCRL" -#define NID_id_cmc_getCRL 339 -#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L - -#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" -#define NID_id_cmc_revokeRequest 340 -#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L - -#define SN_id_cmc_regInfo "id-cmc-regInfo" -#define NID_id_cmc_regInfo 341 -#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L - -#define SN_id_cmc_responseInfo "id-cmc-responseInfo" -#define NID_id_cmc_responseInfo 342 -#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L - -#define SN_id_cmc_queryPending "id-cmc-queryPending" -#define NID_id_cmc_queryPending 343 -#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L - -#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" -#define NID_id_cmc_popLinkRandom 344 -#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L - -#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" -#define NID_id_cmc_popLinkWitness 345 -#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L - -#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" -#define NID_id_cmc_confirmCertAcceptance 346 -#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L - -#define SN_id_on_personalData "id-on-personalData" -#define NID_id_on_personalData 347 -#define OBJ_id_on_personalData OBJ_id_on,1L - -#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" -#define LN_id_on_permanentIdentifier "Permanent Identifier" -#define NID_id_on_permanentIdentifier 858 -#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L - -#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" -#define NID_id_pda_dateOfBirth 348 -#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L - -#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" -#define NID_id_pda_placeOfBirth 349 -#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L - -#define SN_id_pda_gender "id-pda-gender" -#define NID_id_pda_gender 351 -#define OBJ_id_pda_gender OBJ_id_pda,3L - -#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" -#define NID_id_pda_countryOfCitizenship 352 -#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L - -#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" -#define NID_id_pda_countryOfResidence 353 -#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L - -#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" -#define NID_id_aca_authenticationInfo 354 -#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L - -#define SN_id_aca_accessIdentity "id-aca-accessIdentity" -#define NID_id_aca_accessIdentity 355 -#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L - -#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" -#define NID_id_aca_chargingIdentity 356 -#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L - -#define SN_id_aca_group "id-aca-group" -#define NID_id_aca_group 357 -#define OBJ_id_aca_group OBJ_id_aca,4L - -#define SN_id_aca_role "id-aca-role" -#define NID_id_aca_role 358 -#define OBJ_id_aca_role OBJ_id_aca,5L - -#define SN_id_aca_encAttrs "id-aca-encAttrs" -#define NID_id_aca_encAttrs 399 -#define OBJ_id_aca_encAttrs OBJ_id_aca,6L - -#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" -#define NID_id_qcs_pkixQCSyntax_v1 359 -#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L - -#define SN_id_cct_crs "id-cct-crs" -#define NID_id_cct_crs 360 -#define OBJ_id_cct_crs OBJ_id_cct,1L - -#define SN_id_cct_PKIData "id-cct-PKIData" -#define NID_id_cct_PKIData 361 -#define OBJ_id_cct_PKIData OBJ_id_cct,2L - -#define SN_id_cct_PKIResponse "id-cct-PKIResponse" -#define NID_id_cct_PKIResponse 362 -#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L - -#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" -#define LN_id_ppl_anyLanguage "Any language" -#define NID_id_ppl_anyLanguage 664 -#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L - -#define SN_id_ppl_inheritAll "id-ppl-inheritAll" -#define LN_id_ppl_inheritAll "Inherit all" -#define NID_id_ppl_inheritAll 665 -#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L - -#define SN_Independent "id-ppl-independent" -#define LN_Independent "Independent" -#define NID_Independent 667 -#define OBJ_Independent OBJ_id_ppl,2L - -#define SN_ad_OCSP "OCSP" -#define LN_ad_OCSP "OCSP" -#define NID_ad_OCSP 178 -#define OBJ_ad_OCSP OBJ_id_ad,1L - -#define SN_ad_ca_issuers "caIssuers" -#define LN_ad_ca_issuers "CA Issuers" -#define NID_ad_ca_issuers 179 -#define OBJ_ad_ca_issuers OBJ_id_ad,2L - -#define SN_ad_timeStamping "ad_timestamping" -#define LN_ad_timeStamping "AD Time Stamping" -#define NID_ad_timeStamping 363 -#define OBJ_ad_timeStamping OBJ_id_ad,3L - -#define SN_ad_dvcs "AD_DVCS" -#define LN_ad_dvcs "ad dvcs" -#define NID_ad_dvcs 364 -#define OBJ_ad_dvcs OBJ_id_ad,4L - -#define SN_caRepository "caRepository" -#define LN_caRepository "CA Repository" -#define NID_caRepository 785 -#define OBJ_caRepository OBJ_id_ad,5L - -#define OBJ_id_pkix_OCSP OBJ_ad_OCSP - -#define SN_id_pkix_OCSP_basic "basicOCSPResponse" -#define LN_id_pkix_OCSP_basic "Basic OCSP Response" -#define NID_id_pkix_OCSP_basic 365 -#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L - -#define SN_id_pkix_OCSP_Nonce "Nonce" -#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" -#define NID_id_pkix_OCSP_Nonce 366 -#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L - -#define SN_id_pkix_OCSP_CrlID "CrlID" -#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" -#define NID_id_pkix_OCSP_CrlID 367 -#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L - -#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" -#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" -#define NID_id_pkix_OCSP_acceptableResponses 368 -#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L - -#define SN_id_pkix_OCSP_noCheck "noCheck" -#define LN_id_pkix_OCSP_noCheck "OCSP No Check" -#define NID_id_pkix_OCSP_noCheck 369 -#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L - -#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" -#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" -#define NID_id_pkix_OCSP_archiveCutoff 370 -#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L - -#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" -#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" -#define NID_id_pkix_OCSP_serviceLocator 371 -#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L - -#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" -#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" -#define NID_id_pkix_OCSP_extendedStatus 372 -#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L - -#define SN_id_pkix_OCSP_valid "valid" -#define NID_id_pkix_OCSP_valid 373 -#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L - -#define SN_id_pkix_OCSP_path "path" -#define NID_id_pkix_OCSP_path 374 -#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L - -#define SN_id_pkix_OCSP_trustRoot "trustRoot" -#define LN_id_pkix_OCSP_trustRoot "Trust Root" -#define NID_id_pkix_OCSP_trustRoot 375 -#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L - -#define SN_algorithm "algorithm" -#define LN_algorithm "algorithm" -#define NID_algorithm 376 -#define OBJ_algorithm 1L,3L,14L,3L,2L - -#define SN_md5WithRSA "RSA-NP-MD5" -#define LN_md5WithRSA "md5WithRSA" -#define NID_md5WithRSA 104 -#define OBJ_md5WithRSA OBJ_algorithm,3L - -#define SN_des_ecb "DES-ECB" -#define LN_des_ecb "des-ecb" -#define NID_des_ecb 29 -#define OBJ_des_ecb OBJ_algorithm,6L - -#define SN_des_cbc "DES-CBC" -#define LN_des_cbc "des-cbc" -#define NID_des_cbc 31 -#define OBJ_des_cbc OBJ_algorithm,7L - -#define SN_des_ofb64 "DES-OFB" -#define LN_des_ofb64 "des-ofb" -#define NID_des_ofb64 45 -#define OBJ_des_ofb64 OBJ_algorithm,8L - -#define SN_des_cfb64 "DES-CFB" -#define LN_des_cfb64 "des-cfb" -#define NID_des_cfb64 30 -#define OBJ_des_cfb64 OBJ_algorithm,9L - -#define SN_rsaSignature "rsaSignature" -#define NID_rsaSignature 377 -#define OBJ_rsaSignature OBJ_algorithm,11L - -#define SN_dsa_2 "DSA-old" -#define LN_dsa_2 "dsaEncryption-old" -#define NID_dsa_2 67 -#define OBJ_dsa_2 OBJ_algorithm,12L - -#define SN_dsaWithSHA "DSA-SHA" -#define LN_dsaWithSHA "dsaWithSHA" -#define NID_dsaWithSHA 66 -#define OBJ_dsaWithSHA OBJ_algorithm,13L - -#define SN_shaWithRSAEncryption "RSA-SHA" -#define LN_shaWithRSAEncryption "shaWithRSAEncryption" -#define NID_shaWithRSAEncryption 42 -#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L - -#define SN_des_ede_ecb "DES-EDE" -#define LN_des_ede_ecb "des-ede" -#define NID_des_ede_ecb 32 -#define OBJ_des_ede_ecb OBJ_algorithm,17L - -#define SN_des_ede3_ecb "DES-EDE3" -#define LN_des_ede3_ecb "des-ede3" -#define NID_des_ede3_ecb 33 - -#define SN_des_ede_cbc "DES-EDE-CBC" -#define LN_des_ede_cbc "des-ede-cbc" -#define NID_des_ede_cbc 43 - -#define SN_des_ede_cfb64 "DES-EDE-CFB" -#define LN_des_ede_cfb64 "des-ede-cfb" -#define NID_des_ede_cfb64 60 - -#define SN_des_ede3_cfb64 "DES-EDE3-CFB" -#define LN_des_ede3_cfb64 "des-ede3-cfb" -#define NID_des_ede3_cfb64 61 - -#define SN_des_ede_ofb64 "DES-EDE-OFB" -#define LN_des_ede_ofb64 "des-ede-ofb" -#define NID_des_ede_ofb64 62 - -#define SN_des_ede3_ofb64 "DES-EDE3-OFB" -#define LN_des_ede3_ofb64 "des-ede3-ofb" -#define NID_des_ede3_ofb64 63 - -#define SN_desx_cbc "DESX-CBC" -#define LN_desx_cbc "desx-cbc" -#define NID_desx_cbc 80 - -#define SN_sha "SHA" -#define LN_sha "sha" -#define NID_sha 41 -#define OBJ_sha OBJ_algorithm,18L - -#define SN_sha1 "SHA1" -#define LN_sha1 "sha1" -#define NID_sha1 64 -#define OBJ_sha1 OBJ_algorithm,26L - -#define SN_dsaWithSHA1_2 "DSA-SHA1-old" -#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" -#define NID_dsaWithSHA1_2 70 -#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L - -#define SN_sha1WithRSA "RSA-SHA1-2" -#define LN_sha1WithRSA "sha1WithRSA" -#define NID_sha1WithRSA 115 -#define OBJ_sha1WithRSA OBJ_algorithm,29L - -#define SN_ripemd160 "RIPEMD160" -#define LN_ripemd160 "ripemd160" -#define NID_ripemd160 117 -#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L - -#define SN_ripemd160WithRSA "RSA-RIPEMD160" -#define LN_ripemd160WithRSA "ripemd160WithRSA" -#define NID_ripemd160WithRSA 119 -#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L - -#define SN_blake2b512 "BLAKE2b512" -#define LN_blake2b512 "blake2b512" -#define NID_blake2b512 1056 -#define OBJ_blake2b512 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L,16L - -#define SN_blake2s256 "BLAKE2s256" -#define LN_blake2s256 "blake2s256" -#define NID_blake2s256 1057 -#define OBJ_blake2s256 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L,8L - -#define SN_sxnet "SXNetID" -#define LN_sxnet "Strong Extranet ID" -#define NID_sxnet 143 -#define OBJ_sxnet 1L,3L,101L,1L,4L,1L - -#define SN_X500 "X500" -#define LN_X500 "directory services (X.500)" -#define NID_X500 11 -#define OBJ_X500 2L,5L - -#define SN_X509 "X509" -#define NID_X509 12 -#define OBJ_X509 OBJ_X500,4L - -#define SN_commonName "CN" -#define LN_commonName "commonName" -#define NID_commonName 13 -#define OBJ_commonName OBJ_X509,3L - -#define SN_surname "SN" -#define LN_surname "surname" -#define NID_surname 100 -#define OBJ_surname OBJ_X509,4L - -#define LN_serialNumber "serialNumber" -#define NID_serialNumber 105 -#define OBJ_serialNumber OBJ_X509,5L - -#define SN_countryName "C" -#define LN_countryName "countryName" -#define NID_countryName 14 -#define OBJ_countryName OBJ_X509,6L - -#define SN_localityName "L" -#define LN_localityName "localityName" -#define NID_localityName 15 -#define OBJ_localityName OBJ_X509,7L - -#define SN_stateOrProvinceName "ST" -#define LN_stateOrProvinceName "stateOrProvinceName" -#define NID_stateOrProvinceName 16 -#define OBJ_stateOrProvinceName OBJ_X509,8L - -#define SN_streetAddress "street" -#define LN_streetAddress "streetAddress" -#define NID_streetAddress 660 -#define OBJ_streetAddress OBJ_X509,9L - -#define SN_organizationName "O" -#define LN_organizationName "organizationName" -#define NID_organizationName 17 -#define OBJ_organizationName OBJ_X509,10L - -#define SN_organizationalUnitName "OU" -#define LN_organizationalUnitName "organizationalUnitName" -#define NID_organizationalUnitName 18 -#define OBJ_organizationalUnitName OBJ_X509,11L - -#define SN_title "title" -#define LN_title "title" -#define NID_title 106 -#define OBJ_title OBJ_X509,12L - -#define LN_description "description" -#define NID_description 107 -#define OBJ_description OBJ_X509,13L - -#define LN_searchGuide "searchGuide" -#define NID_searchGuide 859 -#define OBJ_searchGuide OBJ_X509,14L - -#define LN_businessCategory "businessCategory" -#define NID_businessCategory 860 -#define OBJ_businessCategory OBJ_X509,15L - -#define LN_postalAddress "postalAddress" -#define NID_postalAddress 861 -#define OBJ_postalAddress OBJ_X509,16L - -#define LN_postalCode "postalCode" -#define NID_postalCode 661 -#define OBJ_postalCode OBJ_X509,17L - -#define LN_postOfficeBox "postOfficeBox" -#define NID_postOfficeBox 862 -#define OBJ_postOfficeBox OBJ_X509,18L - -#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" -#define NID_physicalDeliveryOfficeName 863 -#define OBJ_physicalDeliveryOfficeName OBJ_X509,19L - -#define LN_telephoneNumber "telephoneNumber" -#define NID_telephoneNumber 864 -#define OBJ_telephoneNumber OBJ_X509,20L - -#define LN_telexNumber "telexNumber" -#define NID_telexNumber 865 -#define OBJ_telexNumber OBJ_X509,21L - -#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" -#define NID_teletexTerminalIdentifier 866 -#define OBJ_teletexTerminalIdentifier OBJ_X509,22L - -#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" -#define NID_facsimileTelephoneNumber 867 -#define OBJ_facsimileTelephoneNumber OBJ_X509,23L - -#define LN_x121Address "x121Address" -#define NID_x121Address 868 -#define OBJ_x121Address OBJ_X509,24L - -#define LN_internationaliSDNNumber "internationaliSDNNumber" -#define NID_internationaliSDNNumber 869 -#define OBJ_internationaliSDNNumber OBJ_X509,25L - -#define LN_registeredAddress "registeredAddress" -#define NID_registeredAddress 870 -#define OBJ_registeredAddress OBJ_X509,26L - -#define LN_destinationIndicator "destinationIndicator" -#define NID_destinationIndicator 871 -#define OBJ_destinationIndicator OBJ_X509,27L - -#define LN_preferredDeliveryMethod "preferredDeliveryMethod" -#define NID_preferredDeliveryMethod 872 -#define OBJ_preferredDeliveryMethod OBJ_X509,28L - -#define LN_presentationAddress "presentationAddress" -#define NID_presentationAddress 873 -#define OBJ_presentationAddress OBJ_X509,29L - -#define LN_supportedApplicationContext "supportedApplicationContext" -#define NID_supportedApplicationContext 874 -#define OBJ_supportedApplicationContext OBJ_X509,30L - -#define SN_member "member" -#define NID_member 875 -#define OBJ_member OBJ_X509,31L - -#define SN_owner "owner" -#define NID_owner 876 -#define OBJ_owner OBJ_X509,32L - -#define LN_roleOccupant "roleOccupant" -#define NID_roleOccupant 877 -#define OBJ_roleOccupant OBJ_X509,33L - -#define SN_seeAlso "seeAlso" -#define NID_seeAlso 878 -#define OBJ_seeAlso OBJ_X509,34L - -#define LN_userPassword "userPassword" -#define NID_userPassword 879 -#define OBJ_userPassword OBJ_X509,35L - -#define LN_userCertificate "userCertificate" -#define NID_userCertificate 880 -#define OBJ_userCertificate OBJ_X509,36L - -#define LN_cACertificate "cACertificate" -#define NID_cACertificate 881 -#define OBJ_cACertificate OBJ_X509,37L - -#define LN_authorityRevocationList "authorityRevocationList" -#define NID_authorityRevocationList 882 -#define OBJ_authorityRevocationList OBJ_X509,38L - -#define LN_certificateRevocationList "certificateRevocationList" -#define NID_certificateRevocationList 883 -#define OBJ_certificateRevocationList OBJ_X509,39L - -#define LN_crossCertificatePair "crossCertificatePair" -#define NID_crossCertificatePair 884 -#define OBJ_crossCertificatePair OBJ_X509,40L - -#define SN_name "name" -#define LN_name "name" -#define NID_name 173 -#define OBJ_name OBJ_X509,41L - -#define SN_givenName "GN" -#define LN_givenName "givenName" -#define NID_givenName 99 -#define OBJ_givenName OBJ_X509,42L - -#define SN_initials "initials" -#define LN_initials "initials" -#define NID_initials 101 -#define OBJ_initials OBJ_X509,43L - -#define LN_generationQualifier "generationQualifier" -#define NID_generationQualifier 509 -#define OBJ_generationQualifier OBJ_X509,44L - -#define LN_x500UniqueIdentifier "x500UniqueIdentifier" -#define NID_x500UniqueIdentifier 503 -#define OBJ_x500UniqueIdentifier OBJ_X509,45L - -#define SN_dnQualifier "dnQualifier" -#define LN_dnQualifier "dnQualifier" -#define NID_dnQualifier 174 -#define OBJ_dnQualifier OBJ_X509,46L - -#define LN_enhancedSearchGuide "enhancedSearchGuide" -#define NID_enhancedSearchGuide 885 -#define OBJ_enhancedSearchGuide OBJ_X509,47L - -#define LN_protocolInformation "protocolInformation" -#define NID_protocolInformation 886 -#define OBJ_protocolInformation OBJ_X509,48L - -#define LN_distinguishedName "distinguishedName" -#define NID_distinguishedName 887 -#define OBJ_distinguishedName OBJ_X509,49L - -#define LN_uniqueMember "uniqueMember" -#define NID_uniqueMember 888 -#define OBJ_uniqueMember OBJ_X509,50L - -#define LN_houseIdentifier "houseIdentifier" -#define NID_houseIdentifier 889 -#define OBJ_houseIdentifier OBJ_X509,51L - -#define LN_supportedAlgorithms "supportedAlgorithms" -#define NID_supportedAlgorithms 890 -#define OBJ_supportedAlgorithms OBJ_X509,52L - -#define LN_deltaRevocationList "deltaRevocationList" -#define NID_deltaRevocationList 891 -#define OBJ_deltaRevocationList OBJ_X509,53L - -#define SN_dmdName "dmdName" -#define NID_dmdName 892 -#define OBJ_dmdName OBJ_X509,54L - -#define LN_pseudonym "pseudonym" -#define NID_pseudonym 510 -#define OBJ_pseudonym OBJ_X509,65L - -#define SN_role "role" -#define LN_role "role" -#define NID_role 400 -#define OBJ_role OBJ_X509,72L - -#define LN_organizationIdentifier "organizationIdentifier" -#define NID_organizationIdentifier 1089 -#define OBJ_organizationIdentifier OBJ_X509,97L - -#define SN_countryCode3c "c3" -#define LN_countryCode3c "countryCode3c" -#define NID_countryCode3c 1090 -#define OBJ_countryCode3c OBJ_X509,98L - -#define SN_countryCode3n "n3" -#define LN_countryCode3n "countryCode3n" -#define NID_countryCode3n 1091 -#define OBJ_countryCode3n OBJ_X509,99L - -#define LN_dnsName "dnsName" -#define NID_dnsName 1092 -#define OBJ_dnsName OBJ_X509,100L - -#define SN_X500algorithms "X500algorithms" -#define LN_X500algorithms "directory services - algorithms" -#define NID_X500algorithms 378 -#define OBJ_X500algorithms OBJ_X500,8L - -#define SN_rsa "RSA" -#define LN_rsa "rsa" -#define NID_rsa 19 -#define OBJ_rsa OBJ_X500algorithms,1L,1L - -#define SN_mdc2WithRSA "RSA-MDC2" -#define LN_mdc2WithRSA "mdc2WithRSA" -#define NID_mdc2WithRSA 96 -#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L - -#define SN_mdc2 "MDC2" -#define LN_mdc2 "mdc2" -#define NID_mdc2 95 -#define OBJ_mdc2 OBJ_X500algorithms,3L,101L - -#define SN_id_ce "id-ce" -#define NID_id_ce 81 -#define OBJ_id_ce OBJ_X500,29L - -#define SN_subject_directory_attributes "subjectDirectoryAttributes" -#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" -#define NID_subject_directory_attributes 769 -#define OBJ_subject_directory_attributes OBJ_id_ce,9L - -#define SN_subject_key_identifier "subjectKeyIdentifier" -#define LN_subject_key_identifier "X509v3 Subject Key Identifier" -#define NID_subject_key_identifier 82 -#define OBJ_subject_key_identifier OBJ_id_ce,14L - -#define SN_key_usage "keyUsage" -#define LN_key_usage "X509v3 Key Usage" -#define NID_key_usage 83 -#define OBJ_key_usage OBJ_id_ce,15L - -#define SN_private_key_usage_period "privateKeyUsagePeriod" -#define LN_private_key_usage_period "X509v3 Private Key Usage Period" -#define NID_private_key_usage_period 84 -#define OBJ_private_key_usage_period OBJ_id_ce,16L - -#define SN_subject_alt_name "subjectAltName" -#define LN_subject_alt_name "X509v3 Subject Alternative Name" -#define NID_subject_alt_name 85 -#define OBJ_subject_alt_name OBJ_id_ce,17L - -#define SN_issuer_alt_name "issuerAltName" -#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" -#define NID_issuer_alt_name 86 -#define OBJ_issuer_alt_name OBJ_id_ce,18L - -#define SN_basic_constraints "basicConstraints" -#define LN_basic_constraints "X509v3 Basic Constraints" -#define NID_basic_constraints 87 -#define OBJ_basic_constraints OBJ_id_ce,19L - -#define SN_crl_number "crlNumber" -#define LN_crl_number "X509v3 CRL Number" -#define NID_crl_number 88 -#define OBJ_crl_number OBJ_id_ce,20L - -#define SN_crl_reason "CRLReason" -#define LN_crl_reason "X509v3 CRL Reason Code" -#define NID_crl_reason 141 -#define OBJ_crl_reason OBJ_id_ce,21L - -#define SN_invalidity_date "invalidityDate" -#define LN_invalidity_date "Invalidity Date" -#define NID_invalidity_date 142 -#define OBJ_invalidity_date OBJ_id_ce,24L - -#define SN_delta_crl "deltaCRL" -#define LN_delta_crl "X509v3 Delta CRL Indicator" -#define NID_delta_crl 140 -#define OBJ_delta_crl OBJ_id_ce,27L - -#define SN_issuing_distribution_point "issuingDistributionPoint" -#define LN_issuing_distribution_point "X509v3 Issuing Distribution Point" -#define NID_issuing_distribution_point 770 -#define OBJ_issuing_distribution_point OBJ_id_ce,28L - -#define SN_certificate_issuer "certificateIssuer" -#define LN_certificate_issuer "X509v3 Certificate Issuer" -#define NID_certificate_issuer 771 -#define OBJ_certificate_issuer OBJ_id_ce,29L - -#define SN_name_constraints "nameConstraints" -#define LN_name_constraints "X509v3 Name Constraints" -#define NID_name_constraints 666 -#define OBJ_name_constraints OBJ_id_ce,30L - -#define SN_crl_distribution_points "crlDistributionPoints" -#define LN_crl_distribution_points "X509v3 CRL Distribution Points" -#define NID_crl_distribution_points 103 -#define OBJ_crl_distribution_points OBJ_id_ce,31L - -#define SN_certificate_policies "certificatePolicies" -#define LN_certificate_policies "X509v3 Certificate Policies" -#define NID_certificate_policies 89 -#define OBJ_certificate_policies OBJ_id_ce,32L - -#define SN_any_policy "anyPolicy" -#define LN_any_policy "X509v3 Any Policy" -#define NID_any_policy 746 -#define OBJ_any_policy OBJ_certificate_policies,0L - -#define SN_policy_mappings "policyMappings" -#define LN_policy_mappings "X509v3 Policy Mappings" -#define NID_policy_mappings 747 -#define OBJ_policy_mappings OBJ_id_ce,33L - -#define SN_authority_key_identifier "authorityKeyIdentifier" -#define LN_authority_key_identifier "X509v3 Authority Key Identifier" -#define NID_authority_key_identifier 90 -#define OBJ_authority_key_identifier OBJ_id_ce,35L - -#define SN_policy_constraints "policyConstraints" -#define LN_policy_constraints "X509v3 Policy Constraints" -#define NID_policy_constraints 401 -#define OBJ_policy_constraints OBJ_id_ce,36L - -#define SN_ext_key_usage "extendedKeyUsage" -#define LN_ext_key_usage "X509v3 Extended Key Usage" -#define NID_ext_key_usage 126 -#define OBJ_ext_key_usage OBJ_id_ce,37L - -#define SN_freshest_crl "freshestCRL" -#define LN_freshest_crl "X509v3 Freshest CRL" -#define NID_freshest_crl 857 -#define OBJ_freshest_crl OBJ_id_ce,46L - -#define SN_inhibit_any_policy "inhibitAnyPolicy" -#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" -#define NID_inhibit_any_policy 748 -#define OBJ_inhibit_any_policy OBJ_id_ce,54L - -#define SN_target_information "targetInformation" -#define LN_target_information "X509v3 AC Targeting" -#define NID_target_information 402 -#define OBJ_target_information OBJ_id_ce,55L - -#define SN_no_rev_avail "noRevAvail" -#define LN_no_rev_avail "X509v3 No Revocation Available" -#define NID_no_rev_avail 403 -#define OBJ_no_rev_avail OBJ_id_ce,56L - -#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" -#define LN_anyExtendedKeyUsage "Any Extended Key Usage" -#define NID_anyExtendedKeyUsage 910 -#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L - -#define SN_netscape "Netscape" -#define LN_netscape "Netscape Communications Corp." -#define NID_netscape 57 -#define OBJ_netscape 2L,16L,840L,1L,113730L - -#define SN_netscape_cert_extension "nsCertExt" -#define LN_netscape_cert_extension "Netscape Certificate Extension" -#define NID_netscape_cert_extension 58 -#define OBJ_netscape_cert_extension OBJ_netscape,1L - -#define SN_netscape_data_type "nsDataType" -#define LN_netscape_data_type "Netscape Data Type" -#define NID_netscape_data_type 59 -#define OBJ_netscape_data_type OBJ_netscape,2L - -#define SN_netscape_cert_type "nsCertType" -#define LN_netscape_cert_type "Netscape Cert Type" -#define NID_netscape_cert_type 71 -#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L - -#define SN_netscape_base_url "nsBaseUrl" -#define LN_netscape_base_url "Netscape Base Url" -#define NID_netscape_base_url 72 -#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L - -#define SN_netscape_revocation_url "nsRevocationUrl" -#define LN_netscape_revocation_url "Netscape Revocation Url" -#define NID_netscape_revocation_url 73 -#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L - -#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" -#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" -#define NID_netscape_ca_revocation_url 74 -#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L - -#define SN_netscape_renewal_url "nsRenewalUrl" -#define LN_netscape_renewal_url "Netscape Renewal Url" -#define NID_netscape_renewal_url 75 -#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L - -#define SN_netscape_ca_policy_url "nsCaPolicyUrl" -#define LN_netscape_ca_policy_url "Netscape CA Policy Url" -#define NID_netscape_ca_policy_url 76 -#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L - -#define SN_netscape_ssl_server_name "nsSslServerName" -#define LN_netscape_ssl_server_name "Netscape SSL Server Name" -#define NID_netscape_ssl_server_name 77 -#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L - -#define SN_netscape_comment "nsComment" -#define LN_netscape_comment "Netscape Comment" -#define NID_netscape_comment 78 -#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L - -#define SN_netscape_cert_sequence "nsCertSequence" -#define LN_netscape_cert_sequence "Netscape Certificate Sequence" -#define NID_netscape_cert_sequence 79 -#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L - -#define SN_ns_sgc "nsSGC" -#define LN_ns_sgc "Netscape Server Gated Crypto" -#define NID_ns_sgc 139 -#define OBJ_ns_sgc OBJ_netscape,4L,1L - -#define SN_org "ORG" -#define LN_org "org" -#define NID_org 379 -#define OBJ_org OBJ_iso,3L - -#define SN_dod "DOD" -#define LN_dod "dod" -#define NID_dod 380 -#define OBJ_dod OBJ_org,6L - -#define SN_iana "IANA" -#define LN_iana "iana" -#define NID_iana 381 -#define OBJ_iana OBJ_dod,1L - -#define OBJ_internet OBJ_iana - -#define SN_Directory "directory" -#define LN_Directory "Directory" -#define NID_Directory 382 -#define OBJ_Directory OBJ_internet,1L - -#define SN_Management "mgmt" -#define LN_Management "Management" -#define NID_Management 383 -#define OBJ_Management OBJ_internet,2L - -#define SN_Experimental "experimental" -#define LN_Experimental "Experimental" -#define NID_Experimental 384 -#define OBJ_Experimental OBJ_internet,3L - -#define SN_Private "private" -#define LN_Private "Private" -#define NID_Private 385 -#define OBJ_Private OBJ_internet,4L - -#define SN_Security "security" -#define LN_Security "Security" -#define NID_Security 386 -#define OBJ_Security OBJ_internet,5L - -#define SN_SNMPv2 "snmpv2" -#define LN_SNMPv2 "SNMPv2" -#define NID_SNMPv2 387 -#define OBJ_SNMPv2 OBJ_internet,6L - -#define LN_Mail "Mail" -#define NID_Mail 388 -#define OBJ_Mail OBJ_internet,7L - -#define SN_Enterprises "enterprises" -#define LN_Enterprises "Enterprises" -#define NID_Enterprises 389 -#define OBJ_Enterprises OBJ_Private,1L - -#define SN_dcObject "dcobject" -#define LN_dcObject "dcObject" -#define NID_dcObject 390 -#define OBJ_dcObject OBJ_Enterprises,1466L,344L - -#define SN_mime_mhs "mime-mhs" -#define LN_mime_mhs "MIME MHS" -#define NID_mime_mhs 504 -#define OBJ_mime_mhs OBJ_Mail,1L - -#define SN_mime_mhs_headings "mime-mhs-headings" -#define LN_mime_mhs_headings "mime-mhs-headings" -#define NID_mime_mhs_headings 505 -#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L - -#define SN_mime_mhs_bodies "mime-mhs-bodies" -#define LN_mime_mhs_bodies "mime-mhs-bodies" -#define NID_mime_mhs_bodies 506 -#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L - -#define SN_id_hex_partial_message "id-hex-partial-message" -#define LN_id_hex_partial_message "id-hex-partial-message" -#define NID_id_hex_partial_message 507 -#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L - -#define SN_id_hex_multipart_message "id-hex-multipart-message" -#define LN_id_hex_multipart_message "id-hex-multipart-message" -#define NID_id_hex_multipart_message 508 -#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L - -#define SN_zlib_compression "ZLIB" -#define LN_zlib_compression "zlib compression" -#define NID_zlib_compression 125 -#define OBJ_zlib_compression OBJ_id_smime_alg,8L - -#define OBJ_csor 2L,16L,840L,1L,101L,3L - -#define OBJ_nistAlgorithms OBJ_csor,4L - -#define OBJ_aes OBJ_nistAlgorithms,1L - -#define SN_aes_128_ecb "AES-128-ECB" -#define LN_aes_128_ecb "aes-128-ecb" -#define NID_aes_128_ecb 418 -#define OBJ_aes_128_ecb OBJ_aes,1L - -#define SN_aes_128_cbc "AES-128-CBC" -#define LN_aes_128_cbc "aes-128-cbc" -#define NID_aes_128_cbc 419 -#define OBJ_aes_128_cbc OBJ_aes,2L - -#define SN_aes_128_ofb128 "AES-128-OFB" -#define LN_aes_128_ofb128 "aes-128-ofb" -#define NID_aes_128_ofb128 420 -#define OBJ_aes_128_ofb128 OBJ_aes,3L - -#define SN_aes_128_cfb128 "AES-128-CFB" -#define LN_aes_128_cfb128 "aes-128-cfb" -#define NID_aes_128_cfb128 421 -#define OBJ_aes_128_cfb128 OBJ_aes,4L - -#define SN_id_aes128_wrap "id-aes128-wrap" -#define NID_id_aes128_wrap 788 -#define OBJ_id_aes128_wrap OBJ_aes,5L - -#define SN_aes_128_gcm "id-aes128-GCM" -#define LN_aes_128_gcm "aes-128-gcm" -#define NID_aes_128_gcm 895 -#define OBJ_aes_128_gcm OBJ_aes,6L - -#define SN_aes_128_ccm "id-aes128-CCM" -#define LN_aes_128_ccm "aes-128-ccm" -#define NID_aes_128_ccm 896 -#define OBJ_aes_128_ccm OBJ_aes,7L - -#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" -#define NID_id_aes128_wrap_pad 897 -#define OBJ_id_aes128_wrap_pad OBJ_aes,8L - -#define SN_aes_192_ecb "AES-192-ECB" -#define LN_aes_192_ecb "aes-192-ecb" -#define NID_aes_192_ecb 422 -#define OBJ_aes_192_ecb OBJ_aes,21L - -#define SN_aes_192_cbc "AES-192-CBC" -#define LN_aes_192_cbc "aes-192-cbc" -#define NID_aes_192_cbc 423 -#define OBJ_aes_192_cbc OBJ_aes,22L - -#define SN_aes_192_ofb128 "AES-192-OFB" -#define LN_aes_192_ofb128 "aes-192-ofb" -#define NID_aes_192_ofb128 424 -#define OBJ_aes_192_ofb128 OBJ_aes,23L - -#define SN_aes_192_cfb128 "AES-192-CFB" -#define LN_aes_192_cfb128 "aes-192-cfb" -#define NID_aes_192_cfb128 425 -#define OBJ_aes_192_cfb128 OBJ_aes,24L - -#define SN_id_aes192_wrap "id-aes192-wrap" -#define NID_id_aes192_wrap 789 -#define OBJ_id_aes192_wrap OBJ_aes,25L - -#define SN_aes_192_gcm "id-aes192-GCM" -#define LN_aes_192_gcm "aes-192-gcm" -#define NID_aes_192_gcm 898 -#define OBJ_aes_192_gcm OBJ_aes,26L - -#define SN_aes_192_ccm "id-aes192-CCM" -#define LN_aes_192_ccm "aes-192-ccm" -#define NID_aes_192_ccm 899 -#define OBJ_aes_192_ccm OBJ_aes,27L - -#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" -#define NID_id_aes192_wrap_pad 900 -#define OBJ_id_aes192_wrap_pad OBJ_aes,28L - -#define SN_aes_256_ecb "AES-256-ECB" -#define LN_aes_256_ecb "aes-256-ecb" -#define NID_aes_256_ecb 426 -#define OBJ_aes_256_ecb OBJ_aes,41L - -#define SN_aes_256_cbc "AES-256-CBC" -#define LN_aes_256_cbc "aes-256-cbc" -#define NID_aes_256_cbc 427 -#define OBJ_aes_256_cbc OBJ_aes,42L - -#define SN_aes_256_ofb128 "AES-256-OFB" -#define LN_aes_256_ofb128 "aes-256-ofb" -#define NID_aes_256_ofb128 428 -#define OBJ_aes_256_ofb128 OBJ_aes,43L - -#define SN_aes_256_cfb128 "AES-256-CFB" -#define LN_aes_256_cfb128 "aes-256-cfb" -#define NID_aes_256_cfb128 429 -#define OBJ_aes_256_cfb128 OBJ_aes,44L - -#define SN_id_aes256_wrap "id-aes256-wrap" -#define NID_id_aes256_wrap 790 -#define OBJ_id_aes256_wrap OBJ_aes,45L - -#define SN_aes_256_gcm "id-aes256-GCM" -#define LN_aes_256_gcm "aes-256-gcm" -#define NID_aes_256_gcm 901 -#define OBJ_aes_256_gcm OBJ_aes,46L - -#define SN_aes_256_ccm "id-aes256-CCM" -#define LN_aes_256_ccm "aes-256-ccm" -#define NID_aes_256_ccm 902 -#define OBJ_aes_256_ccm OBJ_aes,47L - -#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" -#define NID_id_aes256_wrap_pad 903 -#define OBJ_id_aes256_wrap_pad OBJ_aes,48L - -#define SN_aes_128_xts "AES-128-XTS" -#define LN_aes_128_xts "aes-128-xts" -#define NID_aes_128_xts 913 -#define OBJ_aes_128_xts OBJ_ieee_siswg,0L,1L,1L - -#define SN_aes_256_xts "AES-256-XTS" -#define LN_aes_256_xts "aes-256-xts" -#define NID_aes_256_xts 914 -#define OBJ_aes_256_xts OBJ_ieee_siswg,0L,1L,2L - -#define SN_aes_128_cfb1 "AES-128-CFB1" -#define LN_aes_128_cfb1 "aes-128-cfb1" -#define NID_aes_128_cfb1 650 - -#define SN_aes_192_cfb1 "AES-192-CFB1" -#define LN_aes_192_cfb1 "aes-192-cfb1" -#define NID_aes_192_cfb1 651 - -#define SN_aes_256_cfb1 "AES-256-CFB1" -#define LN_aes_256_cfb1 "aes-256-cfb1" -#define NID_aes_256_cfb1 652 - -#define SN_aes_128_cfb8 "AES-128-CFB8" -#define LN_aes_128_cfb8 "aes-128-cfb8" -#define NID_aes_128_cfb8 653 - -#define SN_aes_192_cfb8 "AES-192-CFB8" -#define LN_aes_192_cfb8 "aes-192-cfb8" -#define NID_aes_192_cfb8 654 - -#define SN_aes_256_cfb8 "AES-256-CFB8" -#define LN_aes_256_cfb8 "aes-256-cfb8" -#define NID_aes_256_cfb8 655 - -#define SN_aes_128_ctr "AES-128-CTR" -#define LN_aes_128_ctr "aes-128-ctr" -#define NID_aes_128_ctr 904 - -#define SN_aes_192_ctr "AES-192-CTR" -#define LN_aes_192_ctr "aes-192-ctr" -#define NID_aes_192_ctr 905 - -#define SN_aes_256_ctr "AES-256-CTR" -#define LN_aes_256_ctr "aes-256-ctr" -#define NID_aes_256_ctr 906 - -#define SN_aes_128_ocb "AES-128-OCB" -#define LN_aes_128_ocb "aes-128-ocb" -#define NID_aes_128_ocb 958 - -#define SN_aes_192_ocb "AES-192-OCB" -#define LN_aes_192_ocb "aes-192-ocb" -#define NID_aes_192_ocb 959 - -#define SN_aes_256_ocb "AES-256-OCB" -#define LN_aes_256_ocb "aes-256-ocb" -#define NID_aes_256_ocb 960 - -#define SN_des_cfb1 "DES-CFB1" -#define LN_des_cfb1 "des-cfb1" -#define NID_des_cfb1 656 - -#define SN_des_cfb8 "DES-CFB8" -#define LN_des_cfb8 "des-cfb8" -#define NID_des_cfb8 657 - -#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" -#define LN_des_ede3_cfb1 "des-ede3-cfb1" -#define NID_des_ede3_cfb1 658 - -#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" -#define LN_des_ede3_cfb8 "des-ede3-cfb8" -#define NID_des_ede3_cfb8 659 - -#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L - -#define SN_sha256 "SHA256" -#define LN_sha256 "sha256" -#define NID_sha256 672 -#define OBJ_sha256 OBJ_nist_hashalgs,1L - -#define SN_sha384 "SHA384" -#define LN_sha384 "sha384" -#define NID_sha384 673 -#define OBJ_sha384 OBJ_nist_hashalgs,2L - -#define SN_sha512 "SHA512" -#define LN_sha512 "sha512" -#define NID_sha512 674 -#define OBJ_sha512 OBJ_nist_hashalgs,3L - -#define SN_sha224 "SHA224" -#define LN_sha224 "sha224" -#define NID_sha224 675 -#define OBJ_sha224 OBJ_nist_hashalgs,4L - -#define SN_sha512_224 "SHA512-224" -#define LN_sha512_224 "sha512-224" -#define NID_sha512_224 1094 -#define OBJ_sha512_224 OBJ_nist_hashalgs,5L - -#define SN_sha512_256 "SHA512-256" -#define LN_sha512_256 "sha512-256" -#define NID_sha512_256 1095 -#define OBJ_sha512_256 OBJ_nist_hashalgs,6L - -#define SN_sha3_224 "SHA3-224" -#define LN_sha3_224 "sha3-224" -#define NID_sha3_224 1096 -#define OBJ_sha3_224 OBJ_nist_hashalgs,7L - -#define SN_sha3_256 "SHA3-256" -#define LN_sha3_256 "sha3-256" -#define NID_sha3_256 1097 -#define OBJ_sha3_256 OBJ_nist_hashalgs,8L - -#define SN_sha3_384 "SHA3-384" -#define LN_sha3_384 "sha3-384" -#define NID_sha3_384 1098 -#define OBJ_sha3_384 OBJ_nist_hashalgs,9L - -#define SN_sha3_512 "SHA3-512" -#define LN_sha3_512 "sha3-512" -#define NID_sha3_512 1099 -#define OBJ_sha3_512 OBJ_nist_hashalgs,10L - -#define SN_shake128 "SHAKE128" -#define LN_shake128 "shake128" -#define NID_shake128 1100 -#define OBJ_shake128 OBJ_nist_hashalgs,11L - -#define SN_shake256 "SHAKE256" -#define LN_shake256 "shake256" -#define NID_shake256 1101 -#define OBJ_shake256 OBJ_nist_hashalgs,12L - -#define SN_hmac_sha3_224 "id-hmacWithSHA3-224" -#define LN_hmac_sha3_224 "hmac-sha3-224" -#define NID_hmac_sha3_224 1102 -#define OBJ_hmac_sha3_224 OBJ_nist_hashalgs,13L - -#define SN_hmac_sha3_256 "id-hmacWithSHA3-256" -#define LN_hmac_sha3_256 "hmac-sha3-256" -#define NID_hmac_sha3_256 1103 -#define OBJ_hmac_sha3_256 OBJ_nist_hashalgs,14L - -#define SN_hmac_sha3_384 "id-hmacWithSHA3-384" -#define LN_hmac_sha3_384 "hmac-sha3-384" -#define NID_hmac_sha3_384 1104 -#define OBJ_hmac_sha3_384 OBJ_nist_hashalgs,15L - -#define SN_hmac_sha3_512 "id-hmacWithSHA3-512" -#define LN_hmac_sha3_512 "hmac-sha3-512" -#define NID_hmac_sha3_512 1105 -#define OBJ_hmac_sha3_512 OBJ_nist_hashalgs,16L - -#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L - -#define SN_dsa_with_SHA224 "dsa_with_SHA224" -#define NID_dsa_with_SHA224 802 -#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L - -#define SN_dsa_with_SHA256 "dsa_with_SHA256" -#define NID_dsa_with_SHA256 803 -#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L - -#define OBJ_sigAlgs OBJ_nistAlgorithms,3L - -#define SN_dsa_with_SHA384 "id-dsa-with-sha384" -#define LN_dsa_with_SHA384 "dsa_with_SHA384" -#define NID_dsa_with_SHA384 1106 -#define OBJ_dsa_with_SHA384 OBJ_sigAlgs,3L - -#define SN_dsa_with_SHA512 "id-dsa-with-sha512" -#define LN_dsa_with_SHA512 "dsa_with_SHA512" -#define NID_dsa_with_SHA512 1107 -#define OBJ_dsa_with_SHA512 OBJ_sigAlgs,4L - -#define SN_dsa_with_SHA3_224 "id-dsa-with-sha3-224" -#define LN_dsa_with_SHA3_224 "dsa_with_SHA3-224" -#define NID_dsa_with_SHA3_224 1108 -#define OBJ_dsa_with_SHA3_224 OBJ_sigAlgs,5L - -#define SN_dsa_with_SHA3_256 "id-dsa-with-sha3-256" -#define LN_dsa_with_SHA3_256 "dsa_with_SHA3-256" -#define NID_dsa_with_SHA3_256 1109 -#define OBJ_dsa_with_SHA3_256 OBJ_sigAlgs,6L - -#define SN_dsa_with_SHA3_384 "id-dsa-with-sha3-384" -#define LN_dsa_with_SHA3_384 "dsa_with_SHA3-384" -#define NID_dsa_with_SHA3_384 1110 -#define OBJ_dsa_with_SHA3_384 OBJ_sigAlgs,7L - -#define SN_dsa_with_SHA3_512 "id-dsa-with-sha3-512" -#define LN_dsa_with_SHA3_512 "dsa_with_SHA3-512" -#define NID_dsa_with_SHA3_512 1111 -#define OBJ_dsa_with_SHA3_512 OBJ_sigAlgs,8L - -#define SN_ecdsa_with_SHA3_224 "id-ecdsa-with-sha3-224" -#define LN_ecdsa_with_SHA3_224 "ecdsa_with_SHA3-224" -#define NID_ecdsa_with_SHA3_224 1112 -#define OBJ_ecdsa_with_SHA3_224 OBJ_sigAlgs,9L - -#define SN_ecdsa_with_SHA3_256 "id-ecdsa-with-sha3-256" -#define LN_ecdsa_with_SHA3_256 "ecdsa_with_SHA3-256" -#define NID_ecdsa_with_SHA3_256 1113 -#define OBJ_ecdsa_with_SHA3_256 OBJ_sigAlgs,10L - -#define SN_ecdsa_with_SHA3_384 "id-ecdsa-with-sha3-384" -#define LN_ecdsa_with_SHA3_384 "ecdsa_with_SHA3-384" -#define NID_ecdsa_with_SHA3_384 1114 -#define OBJ_ecdsa_with_SHA3_384 OBJ_sigAlgs,11L - -#define SN_ecdsa_with_SHA3_512 "id-ecdsa-with-sha3-512" -#define LN_ecdsa_with_SHA3_512 "ecdsa_with_SHA3-512" -#define NID_ecdsa_with_SHA3_512 1115 -#define OBJ_ecdsa_with_SHA3_512 OBJ_sigAlgs,12L - -#define SN_RSA_SHA3_224 "id-rsassa-pkcs1-v1_5-with-sha3-224" -#define LN_RSA_SHA3_224 "RSA-SHA3-224" -#define NID_RSA_SHA3_224 1116 -#define OBJ_RSA_SHA3_224 OBJ_sigAlgs,13L - -#define SN_RSA_SHA3_256 "id-rsassa-pkcs1-v1_5-with-sha3-256" -#define LN_RSA_SHA3_256 "RSA-SHA3-256" -#define NID_RSA_SHA3_256 1117 -#define OBJ_RSA_SHA3_256 OBJ_sigAlgs,14L - -#define SN_RSA_SHA3_384 "id-rsassa-pkcs1-v1_5-with-sha3-384" -#define LN_RSA_SHA3_384 "RSA-SHA3-384" -#define NID_RSA_SHA3_384 1118 -#define OBJ_RSA_SHA3_384 OBJ_sigAlgs,15L - -#define SN_RSA_SHA3_512 "id-rsassa-pkcs1-v1_5-with-sha3-512" -#define LN_RSA_SHA3_512 "RSA-SHA3-512" -#define NID_RSA_SHA3_512 1119 -#define OBJ_RSA_SHA3_512 OBJ_sigAlgs,16L - -#define SN_hold_instruction_code "holdInstructionCode" -#define LN_hold_instruction_code "Hold Instruction Code" -#define NID_hold_instruction_code 430 -#define OBJ_hold_instruction_code OBJ_id_ce,23L - -#define OBJ_holdInstruction OBJ_X9_57,2L - -#define SN_hold_instruction_none "holdInstructionNone" -#define LN_hold_instruction_none "Hold Instruction None" -#define NID_hold_instruction_none 431 -#define OBJ_hold_instruction_none OBJ_holdInstruction,1L - -#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" -#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" -#define NID_hold_instruction_call_issuer 432 -#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L - -#define SN_hold_instruction_reject "holdInstructionReject" -#define LN_hold_instruction_reject "Hold Instruction Reject" -#define NID_hold_instruction_reject 433 -#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L - -#define SN_data "data" -#define NID_data 434 -#define OBJ_data OBJ_itu_t,9L - -#define SN_pss "pss" -#define NID_pss 435 -#define OBJ_pss OBJ_data,2342L - -#define SN_ucl "ucl" -#define NID_ucl 436 -#define OBJ_ucl OBJ_pss,19200300L - -#define SN_pilot "pilot" -#define NID_pilot 437 -#define OBJ_pilot OBJ_ucl,100L - -#define LN_pilotAttributeType "pilotAttributeType" -#define NID_pilotAttributeType 438 -#define OBJ_pilotAttributeType OBJ_pilot,1L - -#define LN_pilotAttributeSyntax "pilotAttributeSyntax" -#define NID_pilotAttributeSyntax 439 -#define OBJ_pilotAttributeSyntax OBJ_pilot,3L - -#define LN_pilotObjectClass "pilotObjectClass" -#define NID_pilotObjectClass 440 -#define OBJ_pilotObjectClass OBJ_pilot,4L - -#define LN_pilotGroups "pilotGroups" -#define NID_pilotGroups 441 -#define OBJ_pilotGroups OBJ_pilot,10L - -#define LN_iA5StringSyntax "iA5StringSyntax" -#define NID_iA5StringSyntax 442 -#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L - -#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" -#define NID_caseIgnoreIA5StringSyntax 443 -#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L - -#define LN_pilotObject "pilotObject" -#define NID_pilotObject 444 -#define OBJ_pilotObject OBJ_pilotObjectClass,3L - -#define LN_pilotPerson "pilotPerson" -#define NID_pilotPerson 445 -#define OBJ_pilotPerson OBJ_pilotObjectClass,4L - -#define SN_account "account" -#define NID_account 446 -#define OBJ_account OBJ_pilotObjectClass,5L - -#define SN_document "document" -#define NID_document 447 -#define OBJ_document OBJ_pilotObjectClass,6L - -#define SN_room "room" -#define NID_room 448 -#define OBJ_room OBJ_pilotObjectClass,7L - -#define LN_documentSeries "documentSeries" -#define NID_documentSeries 449 -#define OBJ_documentSeries OBJ_pilotObjectClass,9L - -#define SN_Domain "domain" -#define LN_Domain "Domain" -#define NID_Domain 392 -#define OBJ_Domain OBJ_pilotObjectClass,13L - -#define LN_rFC822localPart "rFC822localPart" -#define NID_rFC822localPart 450 -#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L - -#define LN_dNSDomain "dNSDomain" -#define NID_dNSDomain 451 -#define OBJ_dNSDomain OBJ_pilotObjectClass,15L - -#define LN_domainRelatedObject "domainRelatedObject" -#define NID_domainRelatedObject 452 -#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L - -#define LN_friendlyCountry "friendlyCountry" -#define NID_friendlyCountry 453 -#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L - -#define LN_simpleSecurityObject "simpleSecurityObject" -#define NID_simpleSecurityObject 454 -#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L - -#define LN_pilotOrganization "pilotOrganization" -#define NID_pilotOrganization 455 -#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L - -#define LN_pilotDSA "pilotDSA" -#define NID_pilotDSA 456 -#define OBJ_pilotDSA OBJ_pilotObjectClass,21L - -#define LN_qualityLabelledData "qualityLabelledData" -#define NID_qualityLabelledData 457 -#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L - -#define SN_userId "UID" -#define LN_userId "userId" -#define NID_userId 458 -#define OBJ_userId OBJ_pilotAttributeType,1L - -#define LN_textEncodedORAddress "textEncodedORAddress" -#define NID_textEncodedORAddress 459 -#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L - -#define SN_rfc822Mailbox "mail" -#define LN_rfc822Mailbox "rfc822Mailbox" -#define NID_rfc822Mailbox 460 -#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L - -#define SN_info "info" -#define NID_info 461 -#define OBJ_info OBJ_pilotAttributeType,4L - -#define LN_favouriteDrink "favouriteDrink" -#define NID_favouriteDrink 462 -#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L - -#define LN_roomNumber "roomNumber" -#define NID_roomNumber 463 -#define OBJ_roomNumber OBJ_pilotAttributeType,6L - -#define SN_photo "photo" -#define NID_photo 464 -#define OBJ_photo OBJ_pilotAttributeType,7L - -#define LN_userClass "userClass" -#define NID_userClass 465 -#define OBJ_userClass OBJ_pilotAttributeType,8L - -#define SN_host "host" -#define NID_host 466 -#define OBJ_host OBJ_pilotAttributeType,9L - -#define SN_manager "manager" -#define NID_manager 467 -#define OBJ_manager OBJ_pilotAttributeType,10L - -#define LN_documentIdentifier "documentIdentifier" -#define NID_documentIdentifier 468 -#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L - -#define LN_documentTitle "documentTitle" -#define NID_documentTitle 469 -#define OBJ_documentTitle OBJ_pilotAttributeType,12L - -#define LN_documentVersion "documentVersion" -#define NID_documentVersion 470 -#define OBJ_documentVersion OBJ_pilotAttributeType,13L - -#define LN_documentAuthor "documentAuthor" -#define NID_documentAuthor 471 -#define OBJ_documentAuthor OBJ_pilotAttributeType,14L - -#define LN_documentLocation "documentLocation" -#define NID_documentLocation 472 -#define OBJ_documentLocation OBJ_pilotAttributeType,15L - -#define LN_homeTelephoneNumber "homeTelephoneNumber" -#define NID_homeTelephoneNumber 473 -#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L - -#define SN_secretary "secretary" -#define NID_secretary 474 -#define OBJ_secretary OBJ_pilotAttributeType,21L - -#define LN_otherMailbox "otherMailbox" -#define NID_otherMailbox 475 -#define OBJ_otherMailbox OBJ_pilotAttributeType,22L - -#define LN_lastModifiedTime "lastModifiedTime" -#define NID_lastModifiedTime 476 -#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L - -#define LN_lastModifiedBy "lastModifiedBy" -#define NID_lastModifiedBy 477 -#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L - -#define SN_domainComponent "DC" -#define LN_domainComponent "domainComponent" -#define NID_domainComponent 391 -#define OBJ_domainComponent OBJ_pilotAttributeType,25L - -#define LN_aRecord "aRecord" -#define NID_aRecord 478 -#define OBJ_aRecord OBJ_pilotAttributeType,26L - -#define LN_pilotAttributeType27 "pilotAttributeType27" -#define NID_pilotAttributeType27 479 -#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L - -#define LN_mXRecord "mXRecord" -#define NID_mXRecord 480 -#define OBJ_mXRecord OBJ_pilotAttributeType,28L - -#define LN_nSRecord "nSRecord" -#define NID_nSRecord 481 -#define OBJ_nSRecord OBJ_pilotAttributeType,29L - -#define LN_sOARecord "sOARecord" -#define NID_sOARecord 482 -#define OBJ_sOARecord OBJ_pilotAttributeType,30L - -#define LN_cNAMERecord "cNAMERecord" -#define NID_cNAMERecord 483 -#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L - -#define LN_associatedDomain "associatedDomain" -#define NID_associatedDomain 484 -#define OBJ_associatedDomain OBJ_pilotAttributeType,37L - -#define LN_associatedName "associatedName" -#define NID_associatedName 485 -#define OBJ_associatedName OBJ_pilotAttributeType,38L - -#define LN_homePostalAddress "homePostalAddress" -#define NID_homePostalAddress 486 -#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L - -#define LN_personalTitle "personalTitle" -#define NID_personalTitle 487 -#define OBJ_personalTitle OBJ_pilotAttributeType,40L - -#define LN_mobileTelephoneNumber "mobileTelephoneNumber" -#define NID_mobileTelephoneNumber 488 -#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L - -#define LN_pagerTelephoneNumber "pagerTelephoneNumber" -#define NID_pagerTelephoneNumber 489 -#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L - -#define LN_friendlyCountryName "friendlyCountryName" -#define NID_friendlyCountryName 490 -#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L - -#define SN_uniqueIdentifier "uid" -#define LN_uniqueIdentifier "uniqueIdentifier" -#define NID_uniqueIdentifier 102 -#define OBJ_uniqueIdentifier OBJ_pilotAttributeType,44L - -#define LN_organizationalStatus "organizationalStatus" -#define NID_organizationalStatus 491 -#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L - -#define LN_janetMailbox "janetMailbox" -#define NID_janetMailbox 492 -#define OBJ_janetMailbox OBJ_pilotAttributeType,46L - -#define LN_mailPreferenceOption "mailPreferenceOption" -#define NID_mailPreferenceOption 493 -#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L - -#define LN_buildingName "buildingName" -#define NID_buildingName 494 -#define OBJ_buildingName OBJ_pilotAttributeType,48L - -#define LN_dSAQuality "dSAQuality" -#define NID_dSAQuality 495 -#define OBJ_dSAQuality OBJ_pilotAttributeType,49L - -#define LN_singleLevelQuality "singleLevelQuality" -#define NID_singleLevelQuality 496 -#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L - -#define LN_subtreeMinimumQuality "subtreeMinimumQuality" -#define NID_subtreeMinimumQuality 497 -#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L - -#define LN_subtreeMaximumQuality "subtreeMaximumQuality" -#define NID_subtreeMaximumQuality 498 -#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L - -#define LN_personalSignature "personalSignature" -#define NID_personalSignature 499 -#define OBJ_personalSignature OBJ_pilotAttributeType,53L - -#define LN_dITRedirect "dITRedirect" -#define NID_dITRedirect 500 -#define OBJ_dITRedirect OBJ_pilotAttributeType,54L - -#define SN_audio "audio" -#define NID_audio 501 -#define OBJ_audio OBJ_pilotAttributeType,55L - -#define LN_documentPublisher "documentPublisher" -#define NID_documentPublisher 502 -#define OBJ_documentPublisher OBJ_pilotAttributeType,56L - -#define SN_id_set "id-set" -#define LN_id_set "Secure Electronic Transactions" -#define NID_id_set 512 -#define OBJ_id_set OBJ_international_organizations,42L - -#define SN_set_ctype "set-ctype" -#define LN_set_ctype "content types" -#define NID_set_ctype 513 -#define OBJ_set_ctype OBJ_id_set,0L - -#define SN_set_msgExt "set-msgExt" -#define LN_set_msgExt "message extensions" -#define NID_set_msgExt 514 -#define OBJ_set_msgExt OBJ_id_set,1L - -#define SN_set_attr "set-attr" -#define NID_set_attr 515 -#define OBJ_set_attr OBJ_id_set,3L - -#define SN_set_policy "set-policy" -#define NID_set_policy 516 -#define OBJ_set_policy OBJ_id_set,5L - -#define SN_set_certExt "set-certExt" -#define LN_set_certExt "certificate extensions" -#define NID_set_certExt 517 -#define OBJ_set_certExt OBJ_id_set,7L - -#define SN_set_brand "set-brand" -#define NID_set_brand 518 -#define OBJ_set_brand OBJ_id_set,8L - -#define SN_setct_PANData "setct-PANData" -#define NID_setct_PANData 519 -#define OBJ_setct_PANData OBJ_set_ctype,0L - -#define SN_setct_PANToken "setct-PANToken" -#define NID_setct_PANToken 520 -#define OBJ_setct_PANToken OBJ_set_ctype,1L - -#define SN_setct_PANOnly "setct-PANOnly" -#define NID_setct_PANOnly 521 -#define OBJ_setct_PANOnly OBJ_set_ctype,2L - -#define SN_setct_OIData "setct-OIData" -#define NID_setct_OIData 522 -#define OBJ_setct_OIData OBJ_set_ctype,3L - -#define SN_setct_PI "setct-PI" -#define NID_setct_PI 523 -#define OBJ_setct_PI OBJ_set_ctype,4L - -#define SN_setct_PIData "setct-PIData" -#define NID_setct_PIData 524 -#define OBJ_setct_PIData OBJ_set_ctype,5L - -#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" -#define NID_setct_PIDataUnsigned 525 -#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L - -#define SN_setct_HODInput "setct-HODInput" -#define NID_setct_HODInput 526 -#define OBJ_setct_HODInput OBJ_set_ctype,7L - -#define SN_setct_AuthResBaggage "setct-AuthResBaggage" -#define NID_setct_AuthResBaggage 527 -#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L - -#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" -#define NID_setct_AuthRevReqBaggage 528 -#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L - -#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" -#define NID_setct_AuthRevResBaggage 529 -#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L - -#define SN_setct_CapTokenSeq "setct-CapTokenSeq" -#define NID_setct_CapTokenSeq 530 -#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L - -#define SN_setct_PInitResData "setct-PInitResData" -#define NID_setct_PInitResData 531 -#define OBJ_setct_PInitResData OBJ_set_ctype,12L - -#define SN_setct_PI_TBS "setct-PI-TBS" -#define NID_setct_PI_TBS 532 -#define OBJ_setct_PI_TBS OBJ_set_ctype,13L - -#define SN_setct_PResData "setct-PResData" -#define NID_setct_PResData 533 -#define OBJ_setct_PResData OBJ_set_ctype,14L - -#define SN_setct_AuthReqTBS "setct-AuthReqTBS" -#define NID_setct_AuthReqTBS 534 -#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L - -#define SN_setct_AuthResTBS "setct-AuthResTBS" -#define NID_setct_AuthResTBS 535 -#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L - -#define SN_setct_AuthResTBSX "setct-AuthResTBSX" -#define NID_setct_AuthResTBSX 536 -#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L - -#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" -#define NID_setct_AuthTokenTBS 537 -#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L - -#define SN_setct_CapTokenData "setct-CapTokenData" -#define NID_setct_CapTokenData 538 -#define OBJ_setct_CapTokenData OBJ_set_ctype,20L - -#define SN_setct_CapTokenTBS "setct-CapTokenTBS" -#define NID_setct_CapTokenTBS 539 -#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L - -#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" -#define NID_setct_AcqCardCodeMsg 540 -#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L - -#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" -#define NID_setct_AuthRevReqTBS 541 -#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L - -#define SN_setct_AuthRevResData "setct-AuthRevResData" -#define NID_setct_AuthRevResData 542 -#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L - -#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" -#define NID_setct_AuthRevResTBS 543 -#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L - -#define SN_setct_CapReqTBS "setct-CapReqTBS" -#define NID_setct_CapReqTBS 544 -#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L - -#define SN_setct_CapReqTBSX "setct-CapReqTBSX" -#define NID_setct_CapReqTBSX 545 -#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L - -#define SN_setct_CapResData "setct-CapResData" -#define NID_setct_CapResData 546 -#define OBJ_setct_CapResData OBJ_set_ctype,28L - -#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" -#define NID_setct_CapRevReqTBS 547 -#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L - -#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" -#define NID_setct_CapRevReqTBSX 548 -#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L - -#define SN_setct_CapRevResData "setct-CapRevResData" -#define NID_setct_CapRevResData 549 -#define OBJ_setct_CapRevResData OBJ_set_ctype,31L - -#define SN_setct_CredReqTBS "setct-CredReqTBS" -#define NID_setct_CredReqTBS 550 -#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L - -#define SN_setct_CredReqTBSX "setct-CredReqTBSX" -#define NID_setct_CredReqTBSX 551 -#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L - -#define SN_setct_CredResData "setct-CredResData" -#define NID_setct_CredResData 552 -#define OBJ_setct_CredResData OBJ_set_ctype,34L - -#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" -#define NID_setct_CredRevReqTBS 553 -#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L - -#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" -#define NID_setct_CredRevReqTBSX 554 -#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L - -#define SN_setct_CredRevResData "setct-CredRevResData" -#define NID_setct_CredRevResData 555 -#define OBJ_setct_CredRevResData OBJ_set_ctype,37L - -#define SN_setct_PCertReqData "setct-PCertReqData" -#define NID_setct_PCertReqData 556 -#define OBJ_setct_PCertReqData OBJ_set_ctype,38L - -#define SN_setct_PCertResTBS "setct-PCertResTBS" -#define NID_setct_PCertResTBS 557 -#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L - -#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" -#define NID_setct_BatchAdminReqData 558 -#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L - -#define SN_setct_BatchAdminResData "setct-BatchAdminResData" -#define NID_setct_BatchAdminResData 559 -#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L - -#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" -#define NID_setct_CardCInitResTBS 560 -#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L - -#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" -#define NID_setct_MeAqCInitResTBS 561 -#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L - -#define SN_setct_RegFormResTBS "setct-RegFormResTBS" -#define NID_setct_RegFormResTBS 562 -#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L - -#define SN_setct_CertReqData "setct-CertReqData" -#define NID_setct_CertReqData 563 -#define OBJ_setct_CertReqData OBJ_set_ctype,45L - -#define SN_setct_CertReqTBS "setct-CertReqTBS" -#define NID_setct_CertReqTBS 564 -#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L - -#define SN_setct_CertResData "setct-CertResData" -#define NID_setct_CertResData 565 -#define OBJ_setct_CertResData OBJ_set_ctype,47L - -#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" -#define NID_setct_CertInqReqTBS 566 -#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L - -#define SN_setct_ErrorTBS "setct-ErrorTBS" -#define NID_setct_ErrorTBS 567 -#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L - -#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" -#define NID_setct_PIDualSignedTBE 568 -#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L - -#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" -#define NID_setct_PIUnsignedTBE 569 -#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L - -#define SN_setct_AuthReqTBE "setct-AuthReqTBE" -#define NID_setct_AuthReqTBE 570 -#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L - -#define SN_setct_AuthResTBE "setct-AuthResTBE" -#define NID_setct_AuthResTBE 571 -#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L - -#define SN_setct_AuthResTBEX "setct-AuthResTBEX" -#define NID_setct_AuthResTBEX 572 -#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L - -#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" -#define NID_setct_AuthTokenTBE 573 -#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L - -#define SN_setct_CapTokenTBE "setct-CapTokenTBE" -#define NID_setct_CapTokenTBE 574 -#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L - -#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" -#define NID_setct_CapTokenTBEX 575 -#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L - -#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" -#define NID_setct_AcqCardCodeMsgTBE 576 -#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L - -#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" -#define NID_setct_AuthRevReqTBE 577 -#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L - -#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" -#define NID_setct_AuthRevResTBE 578 -#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L - -#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" -#define NID_setct_AuthRevResTBEB 579 -#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L - -#define SN_setct_CapReqTBE "setct-CapReqTBE" -#define NID_setct_CapReqTBE 580 -#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L - -#define SN_setct_CapReqTBEX "setct-CapReqTBEX" -#define NID_setct_CapReqTBEX 581 -#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L - -#define SN_setct_CapResTBE "setct-CapResTBE" -#define NID_setct_CapResTBE 582 -#define OBJ_setct_CapResTBE OBJ_set_ctype,64L - -#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" -#define NID_setct_CapRevReqTBE 583 -#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L - -#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" -#define NID_setct_CapRevReqTBEX 584 -#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L - -#define SN_setct_CapRevResTBE "setct-CapRevResTBE" -#define NID_setct_CapRevResTBE 585 -#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L - -#define SN_setct_CredReqTBE "setct-CredReqTBE" -#define NID_setct_CredReqTBE 586 -#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L - -#define SN_setct_CredReqTBEX "setct-CredReqTBEX" -#define NID_setct_CredReqTBEX 587 -#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L - -#define SN_setct_CredResTBE "setct-CredResTBE" -#define NID_setct_CredResTBE 588 -#define OBJ_setct_CredResTBE OBJ_set_ctype,70L - -#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" -#define NID_setct_CredRevReqTBE 589 -#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L - -#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" -#define NID_setct_CredRevReqTBEX 590 -#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L - -#define SN_setct_CredRevResTBE "setct-CredRevResTBE" -#define NID_setct_CredRevResTBE 591 -#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L - -#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" -#define NID_setct_BatchAdminReqTBE 592 -#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L - -#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" -#define NID_setct_BatchAdminResTBE 593 -#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L - -#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" -#define NID_setct_RegFormReqTBE 594 -#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L - -#define SN_setct_CertReqTBE "setct-CertReqTBE" -#define NID_setct_CertReqTBE 595 -#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L - -#define SN_setct_CertReqTBEX "setct-CertReqTBEX" -#define NID_setct_CertReqTBEX 596 -#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L - -#define SN_setct_CertResTBE "setct-CertResTBE" -#define NID_setct_CertResTBE 597 -#define OBJ_setct_CertResTBE OBJ_set_ctype,79L - -#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" -#define NID_setct_CRLNotificationTBS 598 -#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L - -#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" -#define NID_setct_CRLNotificationResTBS 599 -#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L - -#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" -#define NID_setct_BCIDistributionTBS 600 -#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L - -#define SN_setext_genCrypt "setext-genCrypt" -#define LN_setext_genCrypt "generic cryptogram" -#define NID_setext_genCrypt 601 -#define OBJ_setext_genCrypt OBJ_set_msgExt,1L - -#define SN_setext_miAuth "setext-miAuth" -#define LN_setext_miAuth "merchant initiated auth" -#define NID_setext_miAuth 602 -#define OBJ_setext_miAuth OBJ_set_msgExt,3L - -#define SN_setext_pinSecure "setext-pinSecure" -#define NID_setext_pinSecure 603 -#define OBJ_setext_pinSecure OBJ_set_msgExt,4L - -#define SN_setext_pinAny "setext-pinAny" -#define NID_setext_pinAny 604 -#define OBJ_setext_pinAny OBJ_set_msgExt,5L - -#define SN_setext_track2 "setext-track2" -#define NID_setext_track2 605 -#define OBJ_setext_track2 OBJ_set_msgExt,7L - -#define SN_setext_cv "setext-cv" -#define LN_setext_cv "additional verification" -#define NID_setext_cv 606 -#define OBJ_setext_cv OBJ_set_msgExt,8L - -#define SN_set_policy_root "set-policy-root" -#define NID_set_policy_root 607 -#define OBJ_set_policy_root OBJ_set_policy,0L - -#define SN_setCext_hashedRoot "setCext-hashedRoot" -#define NID_setCext_hashedRoot 608 -#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L - -#define SN_setCext_certType "setCext-certType" -#define NID_setCext_certType 609 -#define OBJ_setCext_certType OBJ_set_certExt,1L - -#define SN_setCext_merchData "setCext-merchData" -#define NID_setCext_merchData 610 -#define OBJ_setCext_merchData OBJ_set_certExt,2L - -#define SN_setCext_cCertRequired "setCext-cCertRequired" -#define NID_setCext_cCertRequired 611 -#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L - -#define SN_setCext_tunneling "setCext-tunneling" -#define NID_setCext_tunneling 612 -#define OBJ_setCext_tunneling OBJ_set_certExt,4L - -#define SN_setCext_setExt "setCext-setExt" -#define NID_setCext_setExt 613 -#define OBJ_setCext_setExt OBJ_set_certExt,5L - -#define SN_setCext_setQualf "setCext-setQualf" -#define NID_setCext_setQualf 614 -#define OBJ_setCext_setQualf OBJ_set_certExt,6L - -#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" -#define NID_setCext_PGWYcapabilities 615 -#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L - -#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" -#define NID_setCext_TokenIdentifier 616 -#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L - -#define SN_setCext_Track2Data "setCext-Track2Data" -#define NID_setCext_Track2Data 617 -#define OBJ_setCext_Track2Data OBJ_set_certExt,9L - -#define SN_setCext_TokenType "setCext-TokenType" -#define NID_setCext_TokenType 618 -#define OBJ_setCext_TokenType OBJ_set_certExt,10L - -#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" -#define NID_setCext_IssuerCapabilities 619 -#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L - -#define SN_setAttr_Cert "setAttr-Cert" -#define NID_setAttr_Cert 620 -#define OBJ_setAttr_Cert OBJ_set_attr,0L - -#define SN_setAttr_PGWYcap "setAttr-PGWYcap" -#define LN_setAttr_PGWYcap "payment gateway capabilities" -#define NID_setAttr_PGWYcap 621 -#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L - -#define SN_setAttr_TokenType "setAttr-TokenType" -#define NID_setAttr_TokenType 622 -#define OBJ_setAttr_TokenType OBJ_set_attr,2L - -#define SN_setAttr_IssCap "setAttr-IssCap" -#define LN_setAttr_IssCap "issuer capabilities" -#define NID_setAttr_IssCap 623 -#define OBJ_setAttr_IssCap OBJ_set_attr,3L - -#define SN_set_rootKeyThumb "set-rootKeyThumb" -#define NID_set_rootKeyThumb 624 -#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L - -#define SN_set_addPolicy "set-addPolicy" -#define NID_set_addPolicy 625 -#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L - -#define SN_setAttr_Token_EMV "setAttr-Token-EMV" -#define NID_setAttr_Token_EMV 626 -#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L - -#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" -#define NID_setAttr_Token_B0Prime 627 -#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L - -#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" -#define NID_setAttr_IssCap_CVM 628 -#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L - -#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" -#define NID_setAttr_IssCap_T2 629 -#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L - -#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" -#define NID_setAttr_IssCap_Sig 630 -#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L - -#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" -#define LN_setAttr_GenCryptgrm "generate cryptogram" -#define NID_setAttr_GenCryptgrm 631 -#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L - -#define SN_setAttr_T2Enc "setAttr-T2Enc" -#define LN_setAttr_T2Enc "encrypted track 2" -#define NID_setAttr_T2Enc 632 -#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L - -#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" -#define LN_setAttr_T2cleartxt "cleartext track 2" -#define NID_setAttr_T2cleartxt 633 -#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L - -#define SN_setAttr_TokICCsig "setAttr-TokICCsig" -#define LN_setAttr_TokICCsig "ICC or token signature" -#define NID_setAttr_TokICCsig 634 -#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L - -#define SN_setAttr_SecDevSig "setAttr-SecDevSig" -#define LN_setAttr_SecDevSig "secure device signature" -#define NID_setAttr_SecDevSig 635 -#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L - -#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" -#define NID_set_brand_IATA_ATA 636 -#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L - -#define SN_set_brand_Diners "set-brand-Diners" -#define NID_set_brand_Diners 637 -#define OBJ_set_brand_Diners OBJ_set_brand,30L - -#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" -#define NID_set_brand_AmericanExpress 638 -#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L - -#define SN_set_brand_JCB "set-brand-JCB" -#define NID_set_brand_JCB 639 -#define OBJ_set_brand_JCB OBJ_set_brand,35L - -#define SN_set_brand_Visa "set-brand-Visa" -#define NID_set_brand_Visa 640 -#define OBJ_set_brand_Visa OBJ_set_brand,4L - -#define SN_set_brand_MasterCard "set-brand-MasterCard" -#define NID_set_brand_MasterCard 641 -#define OBJ_set_brand_MasterCard OBJ_set_brand,5L - -#define SN_set_brand_Novus "set-brand-Novus" -#define NID_set_brand_Novus 642 -#define OBJ_set_brand_Novus OBJ_set_brand,6011L - -#define SN_des_cdmf "DES-CDMF" -#define LN_des_cdmf "des-cdmf" -#define NID_des_cdmf 643 -#define OBJ_des_cdmf OBJ_rsadsi,3L,10L - -#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" -#define NID_rsaOAEPEncryptionSET 644 -#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L - -#define SN_ipsec3 "Oakley-EC2N-3" -#define LN_ipsec3 "ipsec3" -#define NID_ipsec3 749 - -#define SN_ipsec4 "Oakley-EC2N-4" -#define LN_ipsec4 "ipsec4" -#define NID_ipsec4 750 - -#define SN_whirlpool "whirlpool" -#define NID_whirlpool 804 -#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L - -#define SN_cryptopro "cryptopro" -#define NID_cryptopro 805 -#define OBJ_cryptopro OBJ_member_body,643L,2L,2L - -#define SN_cryptocom "cryptocom" -#define NID_cryptocom 806 -#define OBJ_cryptocom OBJ_member_body,643L,2L,9L - -#define SN_id_tc26 "id-tc26" -#define NID_id_tc26 974 -#define OBJ_id_tc26 OBJ_member_body,643L,7L,1L - -#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" -#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" -#define NID_id_GostR3411_94_with_GostR3410_2001 807 -#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L - -#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" -#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" -#define NID_id_GostR3411_94_with_GostR3410_94 808 -#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L - -#define SN_id_GostR3411_94 "md_gost94" -#define LN_id_GostR3411_94 "GOST R 34.11-94" -#define NID_id_GostR3411_94 809 -#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L - -#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" -#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" -#define NID_id_HMACGostR3411_94 810 -#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L - -#define SN_id_GostR3410_2001 "gost2001" -#define LN_id_GostR3410_2001 "GOST R 34.10-2001" -#define NID_id_GostR3410_2001 811 -#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L - -#define SN_id_GostR3410_94 "gost94" -#define LN_id_GostR3410_94 "GOST R 34.10-94" -#define NID_id_GostR3410_94 812 -#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L - -#define SN_id_Gost28147_89 "gost89" -#define LN_id_Gost28147_89 "GOST 28147-89" -#define NID_id_Gost28147_89 813 -#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L - -#define SN_gost89_cnt "gost89-cnt" -#define NID_gost89_cnt 814 - -#define SN_gost89_cnt_12 "gost89-cnt-12" -#define NID_gost89_cnt_12 975 - -#define SN_gost89_cbc "gost89-cbc" -#define NID_gost89_cbc 1009 - -#define SN_gost89_ecb "gost89-ecb" -#define NID_gost89_ecb 1010 - -#define SN_gost89_ctr "gost89-ctr" -#define NID_gost89_ctr 1011 - -#define SN_id_Gost28147_89_MAC "gost-mac" -#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" -#define NID_id_Gost28147_89_MAC 815 -#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L - -#define SN_gost_mac_12 "gost-mac-12" -#define NID_gost_mac_12 976 - -#define SN_id_GostR3411_94_prf "prf-gostr3411-94" -#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" -#define NID_id_GostR3411_94_prf 816 -#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L - -#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" -#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" -#define NID_id_GostR3410_2001DH 817 -#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L - -#define SN_id_GostR3410_94DH "id-GostR3410-94DH" -#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" -#define NID_id_GostR3410_94DH 818 -#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L - -#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" -#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 -#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L - -#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" -#define NID_id_Gost28147_89_None_KeyMeshing 820 -#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L - -#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" -#define NID_id_GostR3411_94_TestParamSet 821 -#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L - -#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" -#define NID_id_GostR3411_94_CryptoProParamSet 822 -#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L - -#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" -#define NID_id_Gost28147_89_TestParamSet 823 -#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L - -#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 -#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L - -#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 -#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L - -#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 -#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L - -#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 -#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L - -#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 -#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L - -#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 -#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L - -#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 -#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L - -#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" -#define NID_id_GostR3410_94_TestParamSet 831 -#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L - -#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 -#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L - -#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 -#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L - -#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 -#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L - -#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 -#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L - -#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 -#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L - -#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 -#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L - -#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 -#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L - -#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" -#define NID_id_GostR3410_2001_TestParamSet 839 -#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L - -#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 -#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L - -#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 -#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L - -#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 -#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L - -#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 -#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L - -#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 -#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L - -#define SN_id_GostR3410_94_a "id-GostR3410-94-a" -#define NID_id_GostR3410_94_a 845 -#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L - -#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" -#define NID_id_GostR3410_94_aBis 846 -#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L - -#define SN_id_GostR3410_94_b "id-GostR3410-94-b" -#define NID_id_GostR3410_94_b 847 -#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L - -#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" -#define NID_id_GostR3410_94_bBis 848 -#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L - -#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" -#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" -#define NID_id_Gost28147_89_cc 849 -#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L - -#define SN_id_GostR3410_94_cc "gost94cc" -#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" -#define NID_id_GostR3410_94_cc 850 -#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L - -#define SN_id_GostR3410_2001_cc "gost2001cc" -#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" -#define NID_id_GostR3410_2001_cc 851 -#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L - -#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" -#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" -#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 -#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L - -#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" -#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" -#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 -#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L - -#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" -#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" -#define NID_id_GostR3410_2001_ParamSet_cc 854 -#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L - -#define SN_id_tc26_algorithms "id-tc26-algorithms" -#define NID_id_tc26_algorithms 977 -#define OBJ_id_tc26_algorithms OBJ_id_tc26,1L - -#define SN_id_tc26_sign "id-tc26-sign" -#define NID_id_tc26_sign 978 -#define OBJ_id_tc26_sign OBJ_id_tc26_algorithms,1L - -#define SN_id_GostR3410_2012_256 "gost2012_256" -#define LN_id_GostR3410_2012_256 "GOST R 34.10-2012 with 256 bit modulus" -#define NID_id_GostR3410_2012_256 979 -#define OBJ_id_GostR3410_2012_256 OBJ_id_tc26_sign,1L - -#define SN_id_GostR3410_2012_512 "gost2012_512" -#define LN_id_GostR3410_2012_512 "GOST R 34.10-2012 with 512 bit modulus" -#define NID_id_GostR3410_2012_512 980 -#define OBJ_id_GostR3410_2012_512 OBJ_id_tc26_sign,2L - -#define SN_id_tc26_digest "id-tc26-digest" -#define NID_id_tc26_digest 981 -#define OBJ_id_tc26_digest OBJ_id_tc26_algorithms,2L - -#define SN_id_GostR3411_2012_256 "md_gost12_256" -#define LN_id_GostR3411_2012_256 "GOST R 34.11-2012 with 256 bit hash" -#define NID_id_GostR3411_2012_256 982 -#define OBJ_id_GostR3411_2012_256 OBJ_id_tc26_digest,2L - -#define SN_id_GostR3411_2012_512 "md_gost12_512" -#define LN_id_GostR3411_2012_512 "GOST R 34.11-2012 with 512 bit hash" -#define NID_id_GostR3411_2012_512 983 -#define OBJ_id_GostR3411_2012_512 OBJ_id_tc26_digest,3L - -#define SN_id_tc26_signwithdigest "id-tc26-signwithdigest" -#define NID_id_tc26_signwithdigest 984 -#define OBJ_id_tc26_signwithdigest OBJ_id_tc26_algorithms,3L - -#define SN_id_tc26_signwithdigest_gost3410_2012_256 "id-tc26-signwithdigest-gost3410-2012-256" -#define LN_id_tc26_signwithdigest_gost3410_2012_256 "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" -#define NID_id_tc26_signwithdigest_gost3410_2012_256 985 -#define OBJ_id_tc26_signwithdigest_gost3410_2012_256 OBJ_id_tc26_signwithdigest,2L - -#define SN_id_tc26_signwithdigest_gost3410_2012_512 "id-tc26-signwithdigest-gost3410-2012-512" -#define LN_id_tc26_signwithdigest_gost3410_2012_512 "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" -#define NID_id_tc26_signwithdigest_gost3410_2012_512 986 -#define OBJ_id_tc26_signwithdigest_gost3410_2012_512 OBJ_id_tc26_signwithdigest,3L - -#define SN_id_tc26_mac "id-tc26-mac" -#define NID_id_tc26_mac 987 -#define OBJ_id_tc26_mac OBJ_id_tc26_algorithms,4L - -#define SN_id_tc26_hmac_gost_3411_2012_256 "id-tc26-hmac-gost-3411-2012-256" -#define LN_id_tc26_hmac_gost_3411_2012_256 "HMAC GOST 34.11-2012 256 bit" -#define NID_id_tc26_hmac_gost_3411_2012_256 988 -#define OBJ_id_tc26_hmac_gost_3411_2012_256 OBJ_id_tc26_mac,1L - -#define SN_id_tc26_hmac_gost_3411_2012_512 "id-tc26-hmac-gost-3411-2012-512" -#define LN_id_tc26_hmac_gost_3411_2012_512 "HMAC GOST 34.11-2012 512 bit" -#define NID_id_tc26_hmac_gost_3411_2012_512 989 -#define OBJ_id_tc26_hmac_gost_3411_2012_512 OBJ_id_tc26_mac,2L - -#define SN_id_tc26_cipher "id-tc26-cipher" -#define NID_id_tc26_cipher 990 -#define OBJ_id_tc26_cipher OBJ_id_tc26_algorithms,5L - -#define SN_id_tc26_cipher_gostr3412_2015_magma "id-tc26-cipher-gostr3412-2015-magma" -#define NID_id_tc26_cipher_gostr3412_2015_magma 1173 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma OBJ_id_tc26_cipher,1L - -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm "id-tc26-cipher-gostr3412-2015-magma-ctracpkm" -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm 1174 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_magma,1L - -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-magma-ctracpkm-omac" -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac 1175 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_magma,2L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik "id-tc26-cipher-gostr3412-2015-kuznyechik" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik 1176 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik OBJ_id_tc26_cipher,2L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm 1177 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,1L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm-omac" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac 1178 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,2L - -#define SN_id_tc26_agreement "id-tc26-agreement" -#define NID_id_tc26_agreement 991 -#define OBJ_id_tc26_agreement OBJ_id_tc26_algorithms,6L - -#define SN_id_tc26_agreement_gost_3410_2012_256 "id-tc26-agreement-gost-3410-2012-256" -#define NID_id_tc26_agreement_gost_3410_2012_256 992 -#define OBJ_id_tc26_agreement_gost_3410_2012_256 OBJ_id_tc26_agreement,1L - -#define SN_id_tc26_agreement_gost_3410_2012_512 "id-tc26-agreement-gost-3410-2012-512" -#define NID_id_tc26_agreement_gost_3410_2012_512 993 -#define OBJ_id_tc26_agreement_gost_3410_2012_512 OBJ_id_tc26_agreement,2L - -#define SN_id_tc26_wrap "id-tc26-wrap" -#define NID_id_tc26_wrap 1179 -#define OBJ_id_tc26_wrap OBJ_id_tc26_algorithms,7L - -#define SN_id_tc26_wrap_gostr3412_2015_magma "id-tc26-wrap-gostr3412-2015-magma" -#define NID_id_tc26_wrap_gostr3412_2015_magma 1180 -#define OBJ_id_tc26_wrap_gostr3412_2015_magma OBJ_id_tc26_wrap,1L - -#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 "id-tc26-wrap-gostr3412-2015-magma-kexp15" -#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 1181 -#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_magma,1L - -#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik "id-tc26-wrap-gostr3412-2015-kuznyechik" -#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik 1182 -#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik OBJ_id_tc26_wrap,2L - -#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 "id-tc26-wrap-gostr3412-2015-kuznyechik-kexp15" -#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 1183 -#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik,1L - -#define SN_id_tc26_constants "id-tc26-constants" -#define NID_id_tc26_constants 994 -#define OBJ_id_tc26_constants OBJ_id_tc26,2L - -#define SN_id_tc26_sign_constants "id-tc26-sign-constants" -#define NID_id_tc26_sign_constants 995 -#define OBJ_id_tc26_sign_constants OBJ_id_tc26_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_constants "id-tc26-gost-3410-2012-256-constants" -#define NID_id_tc26_gost_3410_2012_256_constants 1147 -#define OBJ_id_tc26_gost_3410_2012_256_constants OBJ_id_tc26_sign_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_paramSetA "id-tc26-gost-3410-2012-256-paramSetA" -#define LN_id_tc26_gost_3410_2012_256_paramSetA "GOST R 34.10-2012 (256 bit) ParamSet A" -#define NID_id_tc26_gost_3410_2012_256_paramSetA 1148 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetA OBJ_id_tc26_gost_3410_2012_256_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_paramSetB "id-tc26-gost-3410-2012-256-paramSetB" -#define LN_id_tc26_gost_3410_2012_256_paramSetB "GOST R 34.10-2012 (256 bit) ParamSet B" -#define NID_id_tc26_gost_3410_2012_256_paramSetB 1184 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetB OBJ_id_tc26_gost_3410_2012_256_constants,2L - -#define SN_id_tc26_gost_3410_2012_256_paramSetC "id-tc26-gost-3410-2012-256-paramSetC" -#define LN_id_tc26_gost_3410_2012_256_paramSetC "GOST R 34.10-2012 (256 bit) ParamSet C" -#define NID_id_tc26_gost_3410_2012_256_paramSetC 1185 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetC OBJ_id_tc26_gost_3410_2012_256_constants,3L - -#define SN_id_tc26_gost_3410_2012_256_paramSetD "id-tc26-gost-3410-2012-256-paramSetD" -#define LN_id_tc26_gost_3410_2012_256_paramSetD "GOST R 34.10-2012 (256 bit) ParamSet D" -#define NID_id_tc26_gost_3410_2012_256_paramSetD 1186 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetD OBJ_id_tc26_gost_3410_2012_256_constants,4L - -#define SN_id_tc26_gost_3410_2012_512_constants "id-tc26-gost-3410-2012-512-constants" -#define NID_id_tc26_gost_3410_2012_512_constants 996 -#define OBJ_id_tc26_gost_3410_2012_512_constants OBJ_id_tc26_sign_constants,2L - -#define SN_id_tc26_gost_3410_2012_512_paramSetTest "id-tc26-gost-3410-2012-512-paramSetTest" -#define LN_id_tc26_gost_3410_2012_512_paramSetTest "GOST R 34.10-2012 (512 bit) testing parameter set" -#define NID_id_tc26_gost_3410_2012_512_paramSetTest 997 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetTest OBJ_id_tc26_gost_3410_2012_512_constants,0L - -#define SN_id_tc26_gost_3410_2012_512_paramSetA "id-tc26-gost-3410-2012-512-paramSetA" -#define LN_id_tc26_gost_3410_2012_512_paramSetA "GOST R 34.10-2012 (512 bit) ParamSet A" -#define NID_id_tc26_gost_3410_2012_512_paramSetA 998 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetA OBJ_id_tc26_gost_3410_2012_512_constants,1L - -#define SN_id_tc26_gost_3410_2012_512_paramSetB "id-tc26-gost-3410-2012-512-paramSetB" -#define LN_id_tc26_gost_3410_2012_512_paramSetB "GOST R 34.10-2012 (512 bit) ParamSet B" -#define NID_id_tc26_gost_3410_2012_512_paramSetB 999 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetB OBJ_id_tc26_gost_3410_2012_512_constants,2L - -#define SN_id_tc26_gost_3410_2012_512_paramSetC "id-tc26-gost-3410-2012-512-paramSetC" -#define LN_id_tc26_gost_3410_2012_512_paramSetC "GOST R 34.10-2012 (512 bit) ParamSet C" -#define NID_id_tc26_gost_3410_2012_512_paramSetC 1149 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetC OBJ_id_tc26_gost_3410_2012_512_constants,3L - -#define SN_id_tc26_digest_constants "id-tc26-digest-constants" -#define NID_id_tc26_digest_constants 1000 -#define OBJ_id_tc26_digest_constants OBJ_id_tc26_constants,2L - -#define SN_id_tc26_cipher_constants "id-tc26-cipher-constants" -#define NID_id_tc26_cipher_constants 1001 -#define OBJ_id_tc26_cipher_constants OBJ_id_tc26_constants,5L - -#define SN_id_tc26_gost_28147_constants "id-tc26-gost-28147-constants" -#define NID_id_tc26_gost_28147_constants 1002 -#define OBJ_id_tc26_gost_28147_constants OBJ_id_tc26_cipher_constants,1L - -#define SN_id_tc26_gost_28147_param_Z "id-tc26-gost-28147-param-Z" -#define LN_id_tc26_gost_28147_param_Z "GOST 28147-89 TC26 parameter set" -#define NID_id_tc26_gost_28147_param_Z 1003 -#define OBJ_id_tc26_gost_28147_param_Z OBJ_id_tc26_gost_28147_constants,1L - -#define SN_INN "INN" -#define LN_INN "INN" -#define NID_INN 1004 -#define OBJ_INN OBJ_member_body,643L,3L,131L,1L,1L - -#define SN_OGRN "OGRN" -#define LN_OGRN "OGRN" -#define NID_OGRN 1005 -#define OBJ_OGRN OBJ_member_body,643L,100L,1L - -#define SN_SNILS "SNILS" -#define LN_SNILS "SNILS" -#define NID_SNILS 1006 -#define OBJ_SNILS OBJ_member_body,643L,100L,3L - -#define SN_subjectSignTool "subjectSignTool" -#define LN_subjectSignTool "Signing Tool of Subject" -#define NID_subjectSignTool 1007 -#define OBJ_subjectSignTool OBJ_member_body,643L,100L,111L - -#define SN_issuerSignTool "issuerSignTool" -#define LN_issuerSignTool "Signing Tool of Issuer" -#define NID_issuerSignTool 1008 -#define OBJ_issuerSignTool OBJ_member_body,643L,100L,112L - -#define SN_grasshopper_ecb "grasshopper-ecb" -#define NID_grasshopper_ecb 1012 - -#define SN_grasshopper_ctr "grasshopper-ctr" -#define NID_grasshopper_ctr 1013 - -#define SN_grasshopper_ofb "grasshopper-ofb" -#define NID_grasshopper_ofb 1014 - -#define SN_grasshopper_cbc "grasshopper-cbc" -#define NID_grasshopper_cbc 1015 - -#define SN_grasshopper_cfb "grasshopper-cfb" -#define NID_grasshopper_cfb 1016 - -#define SN_grasshopper_mac "grasshopper-mac" -#define NID_grasshopper_mac 1017 - -#define SN_magma_ecb "magma-ecb" -#define NID_magma_ecb 1187 - -#define SN_magma_ctr "magma-ctr" -#define NID_magma_ctr 1188 - -#define SN_magma_ofb "magma-ofb" -#define NID_magma_ofb 1189 - -#define SN_magma_cbc "magma-cbc" -#define NID_magma_cbc 1190 - -#define SN_magma_cfb "magma-cfb" -#define NID_magma_cfb 1191 - -#define SN_magma_mac "magma-mac" -#define NID_magma_mac 1192 - -#define SN_camellia_128_cbc "CAMELLIA-128-CBC" -#define LN_camellia_128_cbc "camellia-128-cbc" -#define NID_camellia_128_cbc 751 -#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L - -#define SN_camellia_192_cbc "CAMELLIA-192-CBC" -#define LN_camellia_192_cbc "camellia-192-cbc" -#define NID_camellia_192_cbc 752 -#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L - -#define SN_camellia_256_cbc "CAMELLIA-256-CBC" -#define LN_camellia_256_cbc "camellia-256-cbc" -#define NID_camellia_256_cbc 753 -#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L - -#define SN_id_camellia128_wrap "id-camellia128-wrap" -#define NID_id_camellia128_wrap 907 -#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L - -#define SN_id_camellia192_wrap "id-camellia192-wrap" -#define NID_id_camellia192_wrap 908 -#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L - -#define SN_id_camellia256_wrap "id-camellia256-wrap" -#define NID_id_camellia256_wrap 909 -#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L - -#define OBJ_ntt_ds 0L,3L,4401L,5L - -#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L - -#define SN_camellia_128_ecb "CAMELLIA-128-ECB" -#define LN_camellia_128_ecb "camellia-128-ecb" -#define NID_camellia_128_ecb 754 -#define OBJ_camellia_128_ecb OBJ_camellia,1L - -#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" -#define LN_camellia_128_ofb128 "camellia-128-ofb" -#define NID_camellia_128_ofb128 766 -#define OBJ_camellia_128_ofb128 OBJ_camellia,3L - -#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" -#define LN_camellia_128_cfb128 "camellia-128-cfb" -#define NID_camellia_128_cfb128 757 -#define OBJ_camellia_128_cfb128 OBJ_camellia,4L - -#define SN_camellia_128_gcm "CAMELLIA-128-GCM" -#define LN_camellia_128_gcm "camellia-128-gcm" -#define NID_camellia_128_gcm 961 -#define OBJ_camellia_128_gcm OBJ_camellia,6L - -#define SN_camellia_128_ccm "CAMELLIA-128-CCM" -#define LN_camellia_128_ccm "camellia-128-ccm" -#define NID_camellia_128_ccm 962 -#define OBJ_camellia_128_ccm OBJ_camellia,7L - -#define SN_camellia_128_ctr "CAMELLIA-128-CTR" -#define LN_camellia_128_ctr "camellia-128-ctr" -#define NID_camellia_128_ctr 963 -#define OBJ_camellia_128_ctr OBJ_camellia,9L - -#define SN_camellia_128_cmac "CAMELLIA-128-CMAC" -#define LN_camellia_128_cmac "camellia-128-cmac" -#define NID_camellia_128_cmac 964 -#define OBJ_camellia_128_cmac OBJ_camellia,10L - -#define SN_camellia_192_ecb "CAMELLIA-192-ECB" -#define LN_camellia_192_ecb "camellia-192-ecb" -#define NID_camellia_192_ecb 755 -#define OBJ_camellia_192_ecb OBJ_camellia,21L - -#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" -#define LN_camellia_192_ofb128 "camellia-192-ofb" -#define NID_camellia_192_ofb128 767 -#define OBJ_camellia_192_ofb128 OBJ_camellia,23L - -#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" -#define LN_camellia_192_cfb128 "camellia-192-cfb" -#define NID_camellia_192_cfb128 758 -#define OBJ_camellia_192_cfb128 OBJ_camellia,24L - -#define SN_camellia_192_gcm "CAMELLIA-192-GCM" -#define LN_camellia_192_gcm "camellia-192-gcm" -#define NID_camellia_192_gcm 965 -#define OBJ_camellia_192_gcm OBJ_camellia,26L - -#define SN_camellia_192_ccm "CAMELLIA-192-CCM" -#define LN_camellia_192_ccm "camellia-192-ccm" -#define NID_camellia_192_ccm 966 -#define OBJ_camellia_192_ccm OBJ_camellia,27L - -#define SN_camellia_192_ctr "CAMELLIA-192-CTR" -#define LN_camellia_192_ctr "camellia-192-ctr" -#define NID_camellia_192_ctr 967 -#define OBJ_camellia_192_ctr OBJ_camellia,29L - -#define SN_camellia_192_cmac "CAMELLIA-192-CMAC" -#define LN_camellia_192_cmac "camellia-192-cmac" -#define NID_camellia_192_cmac 968 -#define OBJ_camellia_192_cmac OBJ_camellia,30L - -#define SN_camellia_256_ecb "CAMELLIA-256-ECB" -#define LN_camellia_256_ecb "camellia-256-ecb" -#define NID_camellia_256_ecb 756 -#define OBJ_camellia_256_ecb OBJ_camellia,41L - -#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" -#define LN_camellia_256_ofb128 "camellia-256-ofb" -#define NID_camellia_256_ofb128 768 -#define OBJ_camellia_256_ofb128 OBJ_camellia,43L - -#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" -#define LN_camellia_256_cfb128 "camellia-256-cfb" -#define NID_camellia_256_cfb128 759 -#define OBJ_camellia_256_cfb128 OBJ_camellia,44L - -#define SN_camellia_256_gcm "CAMELLIA-256-GCM" -#define LN_camellia_256_gcm "camellia-256-gcm" -#define NID_camellia_256_gcm 969 -#define OBJ_camellia_256_gcm OBJ_camellia,46L - -#define SN_camellia_256_ccm "CAMELLIA-256-CCM" -#define LN_camellia_256_ccm "camellia-256-ccm" -#define NID_camellia_256_ccm 970 -#define OBJ_camellia_256_ccm OBJ_camellia,47L - -#define SN_camellia_256_ctr "CAMELLIA-256-CTR" -#define LN_camellia_256_ctr "camellia-256-ctr" -#define NID_camellia_256_ctr 971 -#define OBJ_camellia_256_ctr OBJ_camellia,49L - -#define SN_camellia_256_cmac "CAMELLIA-256-CMAC" -#define LN_camellia_256_cmac "camellia-256-cmac" -#define NID_camellia_256_cmac 972 -#define OBJ_camellia_256_cmac OBJ_camellia,50L - -#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" -#define LN_camellia_128_cfb1 "camellia-128-cfb1" -#define NID_camellia_128_cfb1 760 - -#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" -#define LN_camellia_192_cfb1 "camellia-192-cfb1" -#define NID_camellia_192_cfb1 761 - -#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" -#define LN_camellia_256_cfb1 "camellia-256-cfb1" -#define NID_camellia_256_cfb1 762 - -#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" -#define LN_camellia_128_cfb8 "camellia-128-cfb8" -#define NID_camellia_128_cfb8 763 - -#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" -#define LN_camellia_192_cfb8 "camellia-192-cfb8" -#define NID_camellia_192_cfb8 764 - -#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" -#define LN_camellia_256_cfb8 "camellia-256-cfb8" -#define NID_camellia_256_cfb8 765 - -#define OBJ_aria 1L,2L,410L,200046L,1L,1L - -#define SN_aria_128_ecb "ARIA-128-ECB" -#define LN_aria_128_ecb "aria-128-ecb" -#define NID_aria_128_ecb 1065 -#define OBJ_aria_128_ecb OBJ_aria,1L - -#define SN_aria_128_cbc "ARIA-128-CBC" -#define LN_aria_128_cbc "aria-128-cbc" -#define NID_aria_128_cbc 1066 -#define OBJ_aria_128_cbc OBJ_aria,2L - -#define SN_aria_128_cfb128 "ARIA-128-CFB" -#define LN_aria_128_cfb128 "aria-128-cfb" -#define NID_aria_128_cfb128 1067 -#define OBJ_aria_128_cfb128 OBJ_aria,3L - -#define SN_aria_128_ofb128 "ARIA-128-OFB" -#define LN_aria_128_ofb128 "aria-128-ofb" -#define NID_aria_128_ofb128 1068 -#define OBJ_aria_128_ofb128 OBJ_aria,4L - -#define SN_aria_128_ctr "ARIA-128-CTR" -#define LN_aria_128_ctr "aria-128-ctr" -#define NID_aria_128_ctr 1069 -#define OBJ_aria_128_ctr OBJ_aria,5L - -#define SN_aria_192_ecb "ARIA-192-ECB" -#define LN_aria_192_ecb "aria-192-ecb" -#define NID_aria_192_ecb 1070 -#define OBJ_aria_192_ecb OBJ_aria,6L - -#define SN_aria_192_cbc "ARIA-192-CBC" -#define LN_aria_192_cbc "aria-192-cbc" -#define NID_aria_192_cbc 1071 -#define OBJ_aria_192_cbc OBJ_aria,7L - -#define SN_aria_192_cfb128 "ARIA-192-CFB" -#define LN_aria_192_cfb128 "aria-192-cfb" -#define NID_aria_192_cfb128 1072 -#define OBJ_aria_192_cfb128 OBJ_aria,8L - -#define SN_aria_192_ofb128 "ARIA-192-OFB" -#define LN_aria_192_ofb128 "aria-192-ofb" -#define NID_aria_192_ofb128 1073 -#define OBJ_aria_192_ofb128 OBJ_aria,9L - -#define SN_aria_192_ctr "ARIA-192-CTR" -#define LN_aria_192_ctr "aria-192-ctr" -#define NID_aria_192_ctr 1074 -#define OBJ_aria_192_ctr OBJ_aria,10L - -#define SN_aria_256_ecb "ARIA-256-ECB" -#define LN_aria_256_ecb "aria-256-ecb" -#define NID_aria_256_ecb 1075 -#define OBJ_aria_256_ecb OBJ_aria,11L - -#define SN_aria_256_cbc "ARIA-256-CBC" -#define LN_aria_256_cbc "aria-256-cbc" -#define NID_aria_256_cbc 1076 -#define OBJ_aria_256_cbc OBJ_aria,12L - -#define SN_aria_256_cfb128 "ARIA-256-CFB" -#define LN_aria_256_cfb128 "aria-256-cfb" -#define NID_aria_256_cfb128 1077 -#define OBJ_aria_256_cfb128 OBJ_aria,13L - -#define SN_aria_256_ofb128 "ARIA-256-OFB" -#define LN_aria_256_ofb128 "aria-256-ofb" -#define NID_aria_256_ofb128 1078 -#define OBJ_aria_256_ofb128 OBJ_aria,14L - -#define SN_aria_256_ctr "ARIA-256-CTR" -#define LN_aria_256_ctr "aria-256-ctr" -#define NID_aria_256_ctr 1079 -#define OBJ_aria_256_ctr OBJ_aria,15L - -#define SN_aria_128_cfb1 "ARIA-128-CFB1" -#define LN_aria_128_cfb1 "aria-128-cfb1" -#define NID_aria_128_cfb1 1080 - -#define SN_aria_192_cfb1 "ARIA-192-CFB1" -#define LN_aria_192_cfb1 "aria-192-cfb1" -#define NID_aria_192_cfb1 1081 - -#define SN_aria_256_cfb1 "ARIA-256-CFB1" -#define LN_aria_256_cfb1 "aria-256-cfb1" -#define NID_aria_256_cfb1 1082 - -#define SN_aria_128_cfb8 "ARIA-128-CFB8" -#define LN_aria_128_cfb8 "aria-128-cfb8" -#define NID_aria_128_cfb8 1083 - -#define SN_aria_192_cfb8 "ARIA-192-CFB8" -#define LN_aria_192_cfb8 "aria-192-cfb8" -#define NID_aria_192_cfb8 1084 - -#define SN_aria_256_cfb8 "ARIA-256-CFB8" -#define LN_aria_256_cfb8 "aria-256-cfb8" -#define NID_aria_256_cfb8 1085 - -#define SN_aria_128_ccm "ARIA-128-CCM" -#define LN_aria_128_ccm "aria-128-ccm" -#define NID_aria_128_ccm 1120 -#define OBJ_aria_128_ccm OBJ_aria,37L - -#define SN_aria_192_ccm "ARIA-192-CCM" -#define LN_aria_192_ccm "aria-192-ccm" -#define NID_aria_192_ccm 1121 -#define OBJ_aria_192_ccm OBJ_aria,38L - -#define SN_aria_256_ccm "ARIA-256-CCM" -#define LN_aria_256_ccm "aria-256-ccm" -#define NID_aria_256_ccm 1122 -#define OBJ_aria_256_ccm OBJ_aria,39L - -#define SN_aria_128_gcm "ARIA-128-GCM" -#define LN_aria_128_gcm "aria-128-gcm" -#define NID_aria_128_gcm 1123 -#define OBJ_aria_128_gcm OBJ_aria,34L - -#define SN_aria_192_gcm "ARIA-192-GCM" -#define LN_aria_192_gcm "aria-192-gcm" -#define NID_aria_192_gcm 1124 -#define OBJ_aria_192_gcm OBJ_aria,35L - -#define SN_aria_256_gcm "ARIA-256-GCM" -#define LN_aria_256_gcm "aria-256-gcm" -#define NID_aria_256_gcm 1125 -#define OBJ_aria_256_gcm OBJ_aria,36L - -#define SN_kisa "KISA" -#define LN_kisa "kisa" -#define NID_kisa 773 -#define OBJ_kisa OBJ_member_body,410L,200004L - -#define SN_seed_ecb "SEED-ECB" -#define LN_seed_ecb "seed-ecb" -#define NID_seed_ecb 776 -#define OBJ_seed_ecb OBJ_kisa,1L,3L - -#define SN_seed_cbc "SEED-CBC" -#define LN_seed_cbc "seed-cbc" -#define NID_seed_cbc 777 -#define OBJ_seed_cbc OBJ_kisa,1L,4L - -#define SN_seed_cfb128 "SEED-CFB" -#define LN_seed_cfb128 "seed-cfb" -#define NID_seed_cfb128 779 -#define OBJ_seed_cfb128 OBJ_kisa,1L,5L - -#define SN_seed_ofb128 "SEED-OFB" -#define LN_seed_ofb128 "seed-ofb" -#define NID_seed_ofb128 778 -#define OBJ_seed_ofb128 OBJ_kisa,1L,6L - -#define SN_sm4_ecb "SM4-ECB" -#define LN_sm4_ecb "sm4-ecb" -#define NID_sm4_ecb 1133 -#define OBJ_sm4_ecb OBJ_sm_scheme,104L,1L - -#define SN_sm4_cbc "SM4-CBC" -#define LN_sm4_cbc "sm4-cbc" -#define NID_sm4_cbc 1134 -#define OBJ_sm4_cbc OBJ_sm_scheme,104L,2L - -#define SN_sm4_ofb128 "SM4-OFB" -#define LN_sm4_ofb128 "sm4-ofb" -#define NID_sm4_ofb128 1135 -#define OBJ_sm4_ofb128 OBJ_sm_scheme,104L,3L - -#define SN_sm4_cfb128 "SM4-CFB" -#define LN_sm4_cfb128 "sm4-cfb" -#define NID_sm4_cfb128 1137 -#define OBJ_sm4_cfb128 OBJ_sm_scheme,104L,4L - -#define SN_sm4_cfb1 "SM4-CFB1" -#define LN_sm4_cfb1 "sm4-cfb1" -#define NID_sm4_cfb1 1136 -#define OBJ_sm4_cfb1 OBJ_sm_scheme,104L,5L - -#define SN_sm4_cfb8 "SM4-CFB8" -#define LN_sm4_cfb8 "sm4-cfb8" -#define NID_sm4_cfb8 1138 -#define OBJ_sm4_cfb8 OBJ_sm_scheme,104L,6L - -#define SN_sm4_ctr "SM4-CTR" -#define LN_sm4_ctr "sm4-ctr" -#define NID_sm4_ctr 1139 -#define OBJ_sm4_ctr OBJ_sm_scheme,104L,7L - -#define SN_hmac "HMAC" -#define LN_hmac "hmac" -#define NID_hmac 855 - -#define SN_cmac "CMAC" -#define LN_cmac "cmac" -#define NID_cmac 894 - -#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" -#define LN_rc4_hmac_md5 "rc4-hmac-md5" -#define NID_rc4_hmac_md5 915 - -#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" -#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" -#define NID_aes_128_cbc_hmac_sha1 916 - -#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" -#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" -#define NID_aes_192_cbc_hmac_sha1 917 - -#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" -#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" -#define NID_aes_256_cbc_hmac_sha1 918 - -#define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" -#define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" -#define NID_aes_128_cbc_hmac_sha256 948 - -#define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" -#define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" -#define NID_aes_192_cbc_hmac_sha256 949 - -#define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" -#define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" -#define NID_aes_256_cbc_hmac_sha256 950 - -#define SN_chacha20_poly1305 "ChaCha20-Poly1305" -#define LN_chacha20_poly1305 "chacha20-poly1305" -#define NID_chacha20_poly1305 1018 - -#define SN_chacha20 "ChaCha20" -#define LN_chacha20 "chacha20" -#define NID_chacha20 1019 - -#define SN_dhpublicnumber "dhpublicnumber" -#define LN_dhpublicnumber "X9.42 DH" -#define NID_dhpublicnumber 920 -#define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L - -#define SN_brainpoolP160r1 "brainpoolP160r1" -#define NID_brainpoolP160r1 921 -#define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L - -#define SN_brainpoolP160t1 "brainpoolP160t1" -#define NID_brainpoolP160t1 922 -#define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L - -#define SN_brainpoolP192r1 "brainpoolP192r1" -#define NID_brainpoolP192r1 923 -#define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L - -#define SN_brainpoolP192t1 "brainpoolP192t1" -#define NID_brainpoolP192t1 924 -#define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L - -#define SN_brainpoolP224r1 "brainpoolP224r1" -#define NID_brainpoolP224r1 925 -#define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L - -#define SN_brainpoolP224t1 "brainpoolP224t1" -#define NID_brainpoolP224t1 926 -#define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L - -#define SN_brainpoolP256r1 "brainpoolP256r1" -#define NID_brainpoolP256r1 927 -#define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L - -#define SN_brainpoolP256t1 "brainpoolP256t1" -#define NID_brainpoolP256t1 928 -#define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L - -#define SN_brainpoolP320r1 "brainpoolP320r1" -#define NID_brainpoolP320r1 929 -#define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L - -#define SN_brainpoolP320t1 "brainpoolP320t1" -#define NID_brainpoolP320t1 930 -#define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L - -#define SN_brainpoolP384r1 "brainpoolP384r1" -#define NID_brainpoolP384r1 931 -#define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L - -#define SN_brainpoolP384t1 "brainpoolP384t1" -#define NID_brainpoolP384t1 932 -#define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L - -#define SN_brainpoolP512r1 "brainpoolP512r1" -#define NID_brainpoolP512r1 933 -#define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L - -#define SN_brainpoolP512t1 "brainpoolP512t1" -#define NID_brainpoolP512t1 934 -#define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L - -#define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L - -#define OBJ_secg_scheme OBJ_certicom_arc,1L - -#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" -#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 -#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L - -#define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" -#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 -#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L - -#define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" -#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 -#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L - -#define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" -#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 -#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L - -#define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" -#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 -#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L - -#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 -#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L - -#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 -#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L - -#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 -#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L - -#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 -#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L - -#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 -#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L - -#define SN_dh_std_kdf "dh-std-kdf" -#define NID_dh_std_kdf 946 - -#define SN_dh_cofactor_kdf "dh-cofactor-kdf" -#define NID_dh_cofactor_kdf 947 - -#define SN_ct_precert_scts "ct_precert_scts" -#define LN_ct_precert_scts "CT Precertificate SCTs" -#define NID_ct_precert_scts 951 -#define OBJ_ct_precert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,2L - -#define SN_ct_precert_poison "ct_precert_poison" -#define LN_ct_precert_poison "CT Precertificate Poison" -#define NID_ct_precert_poison 952 -#define OBJ_ct_precert_poison 1L,3L,6L,1L,4L,1L,11129L,2L,4L,3L - -#define SN_ct_precert_signer "ct_precert_signer" -#define LN_ct_precert_signer "CT Precertificate Signer" -#define NID_ct_precert_signer 953 -#define OBJ_ct_precert_signer 1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L - -#define SN_ct_cert_scts "ct_cert_scts" -#define LN_ct_cert_scts "CT Certificate SCTs" -#define NID_ct_cert_scts 954 -#define OBJ_ct_cert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L - -#define SN_jurisdictionLocalityName "jurisdictionL" -#define LN_jurisdictionLocalityName "jurisdictionLocalityName" -#define NID_jurisdictionLocalityName 955 -#define OBJ_jurisdictionLocalityName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,1L - -#define SN_jurisdictionStateOrProvinceName "jurisdictionST" -#define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" -#define NID_jurisdictionStateOrProvinceName 956 -#define OBJ_jurisdictionStateOrProvinceName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,2L - -#define SN_jurisdictionCountryName "jurisdictionC" -#define LN_jurisdictionCountryName "jurisdictionCountryName" -#define NID_jurisdictionCountryName 957 -#define OBJ_jurisdictionCountryName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,3L - -#define SN_id_scrypt "id-scrypt" -#define LN_id_scrypt "scrypt" -#define NID_id_scrypt 973 -#define OBJ_id_scrypt 1L,3L,6L,1L,4L,1L,11591L,4L,11L - -#define SN_tls1_prf "TLS1-PRF" -#define LN_tls1_prf "tls1-prf" -#define NID_tls1_prf 1021 - -#define SN_hkdf "HKDF" -#define LN_hkdf "hkdf" -#define NID_hkdf 1036 - -#define SN_id_pkinit "id-pkinit" -#define NID_id_pkinit 1031 -#define OBJ_id_pkinit 1L,3L,6L,1L,5L,2L,3L - -#define SN_pkInitClientAuth "pkInitClientAuth" -#define LN_pkInitClientAuth "PKINIT Client Auth" -#define NID_pkInitClientAuth 1032 -#define OBJ_pkInitClientAuth OBJ_id_pkinit,4L - -#define SN_pkInitKDC "pkInitKDC" -#define LN_pkInitKDC "Signing KDC Response" -#define NID_pkInitKDC 1033 -#define OBJ_pkInitKDC OBJ_id_pkinit,5L - -#define SN_X25519 "X25519" -#define NID_X25519 1034 -#define OBJ_X25519 1L,3L,101L,110L - -#define SN_X448 "X448" -#define NID_X448 1035 -#define OBJ_X448 1L,3L,101L,111L - -#define SN_ED25519 "ED25519" -#define NID_ED25519 1087 -#define OBJ_ED25519 1L,3L,101L,112L - -#define SN_ED448 "ED448" -#define NID_ED448 1088 -#define OBJ_ED448 1L,3L,101L,113L - -#define SN_kx_rsa "KxRSA" -#define LN_kx_rsa "kx-rsa" -#define NID_kx_rsa 1037 - -#define SN_kx_ecdhe "KxECDHE" -#define LN_kx_ecdhe "kx-ecdhe" -#define NID_kx_ecdhe 1038 - -#define SN_kx_dhe "KxDHE" -#define LN_kx_dhe "kx-dhe" -#define NID_kx_dhe 1039 - -#define SN_kx_ecdhe_psk "KxECDHE-PSK" -#define LN_kx_ecdhe_psk "kx-ecdhe-psk" -#define NID_kx_ecdhe_psk 1040 - -#define SN_kx_dhe_psk "KxDHE-PSK" -#define LN_kx_dhe_psk "kx-dhe-psk" -#define NID_kx_dhe_psk 1041 - -#define SN_kx_rsa_psk "KxRSA_PSK" -#define LN_kx_rsa_psk "kx-rsa-psk" -#define NID_kx_rsa_psk 1042 - -#define SN_kx_psk "KxPSK" -#define LN_kx_psk "kx-psk" -#define NID_kx_psk 1043 - -#define SN_kx_srp "KxSRP" -#define LN_kx_srp "kx-srp" -#define NID_kx_srp 1044 - -#define SN_kx_gost "KxGOST" -#define LN_kx_gost "kx-gost" -#define NID_kx_gost 1045 - -#define SN_kx_any "KxANY" -#define LN_kx_any "kx-any" -#define NID_kx_any 1063 - -#define SN_auth_rsa "AuthRSA" -#define LN_auth_rsa "auth-rsa" -#define NID_auth_rsa 1046 - -#define SN_auth_ecdsa "AuthECDSA" -#define LN_auth_ecdsa "auth-ecdsa" -#define NID_auth_ecdsa 1047 - -#define SN_auth_psk "AuthPSK" -#define LN_auth_psk "auth-psk" -#define NID_auth_psk 1048 - -#define SN_auth_dss "AuthDSS" -#define LN_auth_dss "auth-dss" -#define NID_auth_dss 1049 - -#define SN_auth_gost01 "AuthGOST01" -#define LN_auth_gost01 "auth-gost01" -#define NID_auth_gost01 1050 - -#define SN_auth_gost12 "AuthGOST12" -#define LN_auth_gost12 "auth-gost12" -#define NID_auth_gost12 1051 - -#define SN_auth_srp "AuthSRP" -#define LN_auth_srp "auth-srp" -#define NID_auth_srp 1052 - -#define SN_auth_null "AuthNULL" -#define LN_auth_null "auth-null" -#define NID_auth_null 1053 - -#define SN_auth_any "AuthANY" -#define LN_auth_any "auth-any" -#define NID_auth_any 1064 - -#define SN_poly1305 "Poly1305" -#define LN_poly1305 "poly1305" -#define NID_poly1305 1061 - -#define SN_siphash "SipHash" -#define LN_siphash "siphash" -#define NID_siphash 1062 - -#define SN_ffdhe2048 "ffdhe2048" -#define NID_ffdhe2048 1126 - -#define SN_ffdhe3072 "ffdhe3072" -#define NID_ffdhe3072 1127 - -#define SN_ffdhe4096 "ffdhe4096" -#define NID_ffdhe4096 1128 - -#define SN_ffdhe6144 "ffdhe6144" -#define NID_ffdhe6144 1129 - -#define SN_ffdhe8192 "ffdhe8192" -#define NID_ffdhe8192 1130 - -#define SN_ISO_UA "ISO-UA" -#define NID_ISO_UA 1150 -#define OBJ_ISO_UA OBJ_member_body,804L - -#define SN_ua_pki "ua-pki" -#define NID_ua_pki 1151 -#define OBJ_ua_pki OBJ_ISO_UA,2L,1L,1L,1L - -#define SN_dstu28147 "dstu28147" -#define LN_dstu28147 "DSTU Gost 28147-2009" -#define NID_dstu28147 1152 -#define OBJ_dstu28147 OBJ_ua_pki,1L,1L,1L - -#define SN_dstu28147_ofb "dstu28147-ofb" -#define LN_dstu28147_ofb "DSTU Gost 28147-2009 OFB mode" -#define NID_dstu28147_ofb 1153 -#define OBJ_dstu28147_ofb OBJ_dstu28147,2L - -#define SN_dstu28147_cfb "dstu28147-cfb" -#define LN_dstu28147_cfb "DSTU Gost 28147-2009 CFB mode" -#define NID_dstu28147_cfb 1154 -#define OBJ_dstu28147_cfb OBJ_dstu28147,3L - -#define SN_dstu28147_wrap "dstu28147-wrap" -#define LN_dstu28147_wrap "DSTU Gost 28147-2009 key wrap" -#define NID_dstu28147_wrap 1155 -#define OBJ_dstu28147_wrap OBJ_dstu28147,5L - -#define SN_hmacWithDstu34311 "hmacWithDstu34311" -#define LN_hmacWithDstu34311 "HMAC DSTU Gost 34311-95" -#define NID_hmacWithDstu34311 1156 -#define OBJ_hmacWithDstu34311 OBJ_ua_pki,1L,1L,2L - -#define SN_dstu34311 "dstu34311" -#define LN_dstu34311 "DSTU Gost 34311-95" -#define NID_dstu34311 1157 -#define OBJ_dstu34311 OBJ_ua_pki,1L,2L,1L - -#define SN_dstu4145le "dstu4145le" -#define LN_dstu4145le "DSTU 4145-2002 little endian" -#define NID_dstu4145le 1158 -#define OBJ_dstu4145le OBJ_ua_pki,1L,3L,1L,1L - -#define SN_dstu4145be "dstu4145be" -#define LN_dstu4145be "DSTU 4145-2002 big endian" -#define NID_dstu4145be 1159 -#define OBJ_dstu4145be OBJ_dstu4145le,1L,1L - -#define SN_uacurve0 "uacurve0" -#define LN_uacurve0 "DSTU curve 0" -#define NID_uacurve0 1160 -#define OBJ_uacurve0 OBJ_dstu4145le,2L,0L - -#define SN_uacurve1 "uacurve1" -#define LN_uacurve1 "DSTU curve 1" -#define NID_uacurve1 1161 -#define OBJ_uacurve1 OBJ_dstu4145le,2L,1L - -#define SN_uacurve2 "uacurve2" -#define LN_uacurve2 "DSTU curve 2" -#define NID_uacurve2 1162 -#define OBJ_uacurve2 OBJ_dstu4145le,2L,2L - -#define SN_uacurve3 "uacurve3" -#define LN_uacurve3 "DSTU curve 3" -#define NID_uacurve3 1163 -#define OBJ_uacurve3 OBJ_dstu4145le,2L,3L - -#define SN_uacurve4 "uacurve4" -#define LN_uacurve4 "DSTU curve 4" -#define NID_uacurve4 1164 -#define OBJ_uacurve4 OBJ_dstu4145le,2L,4L - -#define SN_uacurve5 "uacurve5" -#define LN_uacurve5 "DSTU curve 5" -#define NID_uacurve5 1165 -#define OBJ_uacurve5 OBJ_dstu4145le,2L,5L - -#define SN_uacurve6 "uacurve6" -#define LN_uacurve6 "DSTU curve 6" -#define NID_uacurve6 1166 -#define OBJ_uacurve6 OBJ_dstu4145le,2L,6L - -#define SN_uacurve7 "uacurve7" -#define LN_uacurve7 "DSTU curve 7" -#define NID_uacurve7 1167 -#define OBJ_uacurve7 OBJ_dstu4145le,2L,7L - -#define SN_uacurve8 "uacurve8" -#define LN_uacurve8 "DSTU curve 8" -#define NID_uacurve8 1168 -#define OBJ_uacurve8 OBJ_dstu4145le,2L,8L - -#define SN_uacurve9 "uacurve9" -#define LN_uacurve9 "DSTU curve 9" -#define NID_uacurve9 1169 -#define OBJ_uacurve9 OBJ_dstu4145le,2L,9L diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/objects.h b/Hin2n/src/main/jniLibs/x86/include/openssl/objects.h deleted file mode 100644 index 5e8b5762..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/objects.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 1995-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_OBJECTS_H -# define HEADER_OBJECTS_H - -# include -# include -# include -# include - -# define OBJ_NAME_TYPE_UNDEF 0x00 -# define OBJ_NAME_TYPE_MD_METH 0x01 -# define OBJ_NAME_TYPE_CIPHER_METH 0x02 -# define OBJ_NAME_TYPE_PKEY_METH 0x03 -# define OBJ_NAME_TYPE_COMP_METH 0x04 -# define OBJ_NAME_TYPE_NUM 0x05 - -# define OBJ_NAME_ALIAS 0x8000 - -# define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 -# define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct obj_name_st { - int type; - int alias; - const char *name; - const char *data; -} OBJ_NAME; - -# define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) - -int OBJ_NAME_init(void); -int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), - int (*cmp_func) (const char *, const char *), - void (*free_func) (const char *, int, const char *)); -const char *OBJ_NAME_get(const char *name, int type); -int OBJ_NAME_add(const char *name, int type, const char *data); -int OBJ_NAME_remove(const char *name, int type); -void OBJ_NAME_cleanup(int type); /* -1 for everything */ -void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), - void *arg); -void OBJ_NAME_do_all_sorted(int type, - void (*fn) (const OBJ_NAME *, void *arg), - void *arg); - -ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o); -ASN1_OBJECT *OBJ_nid2obj(int n); -const char *OBJ_nid2ln(int n); -const char *OBJ_nid2sn(int n); -int OBJ_obj2nid(const ASN1_OBJECT *o); -ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); -int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); -int OBJ_txt2nid(const char *s); -int OBJ_ln2nid(const char *s); -int OBJ_sn2nid(const char *s); -int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); -const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, - int (*cmp) (const void *, const void *)); -const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, - int size, - int (*cmp) (const void *, const void *), - int flags); - -# define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ - static int nm##_cmp(type1 const *, type2 const *); \ - scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) - -# define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ - _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) -# define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ - type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) - -/*- - * Unsolved problem: if a type is actually a pointer type, like - * nid_triple is, then its impossible to get a const where you need - * it. Consider: - * - * typedef int nid_triple[3]; - * const void *a_; - * const nid_triple const *a = a_; - * - * The assignment discards a const because what you really want is: - * - * const int const * const *a = a_; - * - * But if you do that, you lose the fact that a is an array of 3 ints, - * which breaks comparison functions. - * - * Thus we end up having to cast, sadly, or unpack the - * declarations. Or, as I finally did in this case, declare nid_triple - * to be a struct, which it should have been in the first place. - * - * Ben, August 2008. - * - * Also, strictly speaking not all types need be const, but handling - * the non-constness means a lot of complication, and in practice - * comparison routines do always not touch their arguments. - */ - -# define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ - { \ - type1 const *a = a_; \ - type2 const *b = b_; \ - return nm##_cmp(a,b); \ - } \ - static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ - { \ - return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ - nm##_cmp_BSEARCH_CMP_FN); \ - } \ - extern void dummy_prototype(void) - -# define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ - { \ - type1 const *a = a_; \ - type2 const *b = b_; \ - return nm##_cmp(a,b); \ - } \ - type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ - { \ - return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ - nm##_cmp_BSEARCH_CMP_FN); \ - } \ - extern void dummy_prototype(void) - -# define OBJ_bsearch(type1,key,type2,base,num,cmp) \ - ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ - num,sizeof(type2), \ - ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ - (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ - cmp##_BSEARCH_CMP_FN))) - -# define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ - ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ - num,sizeof(type2), \ - ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ - (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ - cmp##_BSEARCH_CMP_FN)),flags) - -int OBJ_new_nid(int num); -int OBJ_add_object(const ASN1_OBJECT *obj); -int OBJ_create(const char *oid, const char *sn, const char *ln); -#if OPENSSL_API_COMPAT < 0x10100000L -# define OBJ_cleanup() while(0) continue -#endif -int OBJ_create_objects(BIO *in); - -size_t OBJ_length(const ASN1_OBJECT *obj); -const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); - -int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); -int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); -int OBJ_add_sigid(int signid, int dig_id, int pkey_id); -void OBJ_sigid_free(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/objectserr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/objectserr.h deleted file mode 100644 index 02e166f1..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/objectserr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ocsp.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ocsp.h deleted file mode 100644 index 4d759a49..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ocsp.h +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright 2000-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_OCSP_H -# define HEADER_OCSP_H - -#include - -/* - * These definitions are outside the OPENSSL_NO_OCSP guard because although for - * historical reasons they have OCSP_* names, they can actually be used - * independently of OCSP. E.g. see RFC5280 - */ -/*- - * CRLReason ::= ENUMERATED { - * unspecified (0), - * keyCompromise (1), - * cACompromise (2), - * affiliationChanged (3), - * superseded (4), - * cessationOfOperation (5), - * certificateHold (6), - * removeFromCRL (8) } - */ -# define OCSP_REVOKED_STATUS_NOSTATUS -1 -# define OCSP_REVOKED_STATUS_UNSPECIFIED 0 -# define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 -# define OCSP_REVOKED_STATUS_CACOMPROMISE 2 -# define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 -# define OCSP_REVOKED_STATUS_SUPERSEDED 4 -# define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 -# define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 -# define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 - - -# ifndef OPENSSL_NO_OCSP - -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Various flags and values */ - -# define OCSP_DEFAULT_NONCE_LENGTH 16 - -# define OCSP_NOCERTS 0x1 -# define OCSP_NOINTERN 0x2 -# define OCSP_NOSIGS 0x4 -# define OCSP_NOCHAIN 0x8 -# define OCSP_NOVERIFY 0x10 -# define OCSP_NOEXPLICIT 0x20 -# define OCSP_NOCASIGN 0x40 -# define OCSP_NODELEGATED 0x80 -# define OCSP_NOCHECKS 0x100 -# define OCSP_TRUSTOTHER 0x200 -# define OCSP_RESPID_KEY 0x400 -# define OCSP_NOTIME 0x800 - -typedef struct ocsp_cert_id_st OCSP_CERTID; - -DEFINE_STACK_OF(OCSP_CERTID) - -typedef struct ocsp_one_request_st OCSP_ONEREQ; - -DEFINE_STACK_OF(OCSP_ONEREQ) - -typedef struct ocsp_req_info_st OCSP_REQINFO; -typedef struct ocsp_signature_st OCSP_SIGNATURE; -typedef struct ocsp_request_st OCSP_REQUEST; - -# define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 -# define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 -# define OCSP_RESPONSE_STATUS_INTERNALERROR 2 -# define OCSP_RESPONSE_STATUS_TRYLATER 3 -# define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 -# define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 - -typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES; - -# define V_OCSP_RESPID_NAME 0 -# define V_OCSP_RESPID_KEY 1 - -DEFINE_STACK_OF(OCSP_RESPID) - -typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO; - -# define V_OCSP_CERTSTATUS_GOOD 0 -# define V_OCSP_CERTSTATUS_REVOKED 1 -# define V_OCSP_CERTSTATUS_UNKNOWN 2 - -typedef struct ocsp_cert_status_st OCSP_CERTSTATUS; -typedef struct ocsp_single_response_st OCSP_SINGLERESP; - -DEFINE_STACK_OF(OCSP_SINGLERESP) - -typedef struct ocsp_response_data_st OCSP_RESPDATA; - -typedef struct ocsp_basic_response_st OCSP_BASICRESP; - -typedef struct ocsp_crl_id_st OCSP_CRLID; -typedef struct ocsp_service_locator_st OCSP_SERVICELOC; - -# define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" -# define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" - -# define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) - -# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) - -# define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ - (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST, \ - bp,(char **)(x),cb,NULL) - -# define PEM_read_bio_OCSP_RESPONSE(bp,x,cb) (OCSP_RESPONSE *)PEM_ASN1_read_bio(\ - (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE, \ - bp,(char **)(x),cb,NULL) - -# define PEM_write_bio_OCSP_REQUEST(bp,o) \ - PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ - bp,(char *)(o), NULL,NULL,0,NULL,NULL) - -# define PEM_write_bio_OCSP_RESPONSE(bp,o) \ - PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ - bp,(char *)(o), NULL,NULL,0,NULL,NULL) - -# define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) - -# define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) - -# define ASN1_BIT_STRING_digest(data,type,md,len) \ - ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) - -# define OCSP_CERTSTATUS_dup(cs)\ - (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ - (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) - -OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); - -OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); -OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, - int maxline); -int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx); -int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); -OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline); -void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); -void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); -int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, - ASN1_VALUE *val); -int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval, - const ASN1_ITEM *it); -BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx); -int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path); -int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); -int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, - const char *name, const char *value); - -OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject, - const X509 *issuer); - -OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, - const X509_NAME *issuerName, - const ASN1_BIT_STRING *issuerKey, - const ASN1_INTEGER *serialNumber); - -OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); - -int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); -int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); -int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); -int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); - -int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); -int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); - -int OCSP_request_sign(OCSP_REQUEST *req, - X509 *signer, - EVP_PKEY *key, - const EVP_MD *dgst, - STACK_OF(X509) *certs, unsigned long flags); - -int OCSP_response_status(OCSP_RESPONSE *resp); -OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); - -const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs); -const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs); -const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs); -int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, - STACK_OF(X509) *extra_certs); - -int OCSP_resp_count(OCSP_BASICRESP *bs); -OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); -const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP* bs); -const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs); -int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, - const ASN1_OCTET_STRING **pid, - const X509_NAME **pname); -int OCSP_resp_get1_id(const OCSP_BASICRESP *bs, - ASN1_OCTET_STRING **pid, - X509_NAME **pname); - -int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); -int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, - ASN1_GENERALIZEDTIME **revtime, - ASN1_GENERALIZEDTIME **thisupd, - ASN1_GENERALIZEDTIME **nextupd); -int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, - int *reason, - ASN1_GENERALIZEDTIME **revtime, - ASN1_GENERALIZEDTIME **thisupd, - ASN1_GENERALIZEDTIME **nextupd); -int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, - ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); - -int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, - X509_STORE *store, unsigned long flags); - -int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, - int *pssl); - -int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); -int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); - -int OCSP_request_onereq_count(OCSP_REQUEST *req); -OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); -OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); -int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, - ASN1_OCTET_STRING **pikeyHash, - ASN1_INTEGER **pserial, OCSP_CERTID *cid); -int OCSP_request_is_signed(OCSP_REQUEST *req); -OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); -OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, - OCSP_CERTID *cid, - int status, int reason, - ASN1_TIME *revtime, - ASN1_TIME *thisupd, - ASN1_TIME *nextupd); -int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); -int OCSP_basic_sign(OCSP_BASICRESP *brsp, - X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, - STACK_OF(X509) *certs, unsigned long flags); -int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, - X509 *signer, EVP_MD_CTX *ctx, - STACK_OF(X509) *certs, unsigned long flags); -int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert); -int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert); -int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert); - -X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim); - -X509_EXTENSION *OCSP_accept_responses_new(char **oids); - -X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); - -X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, const char **urls); - -int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); -int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); -int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); -X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); -X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); -void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, - int *idx); -int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, - unsigned long flags); -int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); - -int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); -int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); -int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos); -int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); -X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); -X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); -void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); -int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, - unsigned long flags); -int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); - -int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); -int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); -int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, - int lastpos); -X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); -X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); -void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, - int *idx); -int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, - int crit, unsigned long flags); -int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); - -int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); -int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); -int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, - int lastpos); -X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); -X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); -void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, - int *idx); -int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, - int crit, unsigned long flags); -int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); -const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x); - -DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) -DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) -DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) -DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) -DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) -DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) -DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) -DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) -DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) -DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) -DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) - -const char *OCSP_response_status_str(long s); -const char *OCSP_cert_status_str(long s); -const char *OCSP_crl_reason_str(long s); - -int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); -int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); - -int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, - X509_STORE *st, unsigned long flags); - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ocsperr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ocsperr.h deleted file mode 100644 index 8dd9e01a..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ocsperr.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/opensslconf.h b/Hin2n/src/main/jniLibs/x86/include/openssl/opensslconf.h deleted file mode 100644 index 52bc2c62..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/opensslconf.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * WARNING: do not edit! - * Generated by Makefile from include/openssl/opensslconf.h.in - * - * 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 - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef OPENSSL_ALGORITHM_DEFINES -# error OPENSSL_ALGORITHM_DEFINES no longer supported -#endif - -/* - * OpenSSL was configured with the following options: - */ - -#ifndef OPENSSL_NO_MD2 -# define OPENSSL_NO_MD2 -#endif -#ifndef OPENSSL_NO_RC5 -# define OPENSSL_NO_RC5 -#endif -#ifndef OPENSSL_THREADS -# define OPENSSL_THREADS -#endif -#ifndef OPENSSL_RAND_SEED_OS -# define OPENSSL_RAND_SEED_OS -#endif -#ifndef OPENSSL_NO_AFALGENG -# define OPENSSL_NO_AFALGENG -#endif -#ifndef OPENSSL_NO_ASAN -# define OPENSSL_NO_ASAN -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG -# define OPENSSL_NO_CRYPTO_MDEBUG -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -#endif -#ifndef OPENSSL_NO_DEVCRYPTOENG -# define OPENSSL_NO_DEVCRYPTOENG -#endif -#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -# define OPENSSL_NO_EC_NISTP_64_GCC_128 -#endif -#ifndef OPENSSL_NO_EGD -# define OPENSSL_NO_EGD -#endif -#ifndef OPENSSL_NO_EXTERNAL_TESTS -# define OPENSSL_NO_EXTERNAL_TESTS -#endif -#ifndef OPENSSL_NO_FUZZ_AFL -# define OPENSSL_NO_FUZZ_AFL -#endif -#ifndef OPENSSL_NO_FUZZ_LIBFUZZER -# define OPENSSL_NO_FUZZ_LIBFUZZER -#endif -#ifndef OPENSSL_NO_HEARTBEATS -# define OPENSSL_NO_HEARTBEATS -#endif -#ifndef OPENSSL_NO_MSAN -# define OPENSSL_NO_MSAN -#endif -#ifndef OPENSSL_NO_SCTP -# define OPENSSL_NO_SCTP -#endif -#ifndef OPENSSL_NO_SSL_TRACE -# define OPENSSL_NO_SSL_TRACE -#endif -#ifndef OPENSSL_NO_SSL3 -# define OPENSSL_NO_SSL3 -#endif -#ifndef OPENSSL_NO_SSL3_METHOD -# define OPENSSL_NO_SSL3_METHOD -#endif -#ifndef OPENSSL_NO_UBSAN -# define OPENSSL_NO_UBSAN -#endif -#ifndef OPENSSL_NO_UNIT_TEST -# define OPENSSL_NO_UNIT_TEST -#endif -#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS -# define OPENSSL_NO_WEAK_SSL_CIPHERS -#endif -#ifndef OPENSSL_NO_STATIC_ENGINE -# define OPENSSL_NO_STATIC_ENGINE -#endif - - -/* - * 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= to suppress the - * declarations of functions deprecated in or before . 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 -# 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? */ -#undef I386_ONLY - -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* - * The following are cipher-specific, but are part of the public API. - */ -#if !defined(OPENSSL_SYS_UEFI) -# define BN_LLONG -/* Only one for the following should be defined */ -# undef SIXTY_FOUR_BIT_LONG -# undef SIXTY_FOUR_BIT -# define THIRTY_TWO_BIT -#endif - -#define RC4_INT unsigned int - -#ifdef __cplusplus -} -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/opensslv.h b/Hin2n/src/main/jniLibs/x86/include/openssl/opensslv.h deleted file mode 100644 index 17d271f5..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/opensslv.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 1999-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_OPENSSLV_H -# define HEADER_OPENSSLV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*- - * Numeric release version identifier: - * MNNFFPPS: major minor fix patch status - * The status nibble has one of the values 0 for development, 1 to e for betas - * 1 to 14, and f for release. The patch level is exactly that. - * For example: - * 0.9.3-dev 0x00903000 - * 0.9.3-beta1 0x00903001 - * 0.9.3-beta2-dev 0x00903002 - * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) - * 0.9.3 0x0090300f - * 0.9.3a 0x0090301f - * 0.9.4 0x0090400f - * 1.2.3z 0x102031af - * - * For continuity reasons (because 0.9.5 is already out, and is coded - * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level - * part is slightly different, by setting the highest bit. This means - * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start - * with 0x0090600S... - * - * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) - * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for - * major minor fix final patch/beta) - */ -# define OPENSSL_VERSION_NUMBER 0x1010107fL -# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1g 21 Apr 2020" - -/*- - * The macros below are to be used for shared library (.so, .dll, ...) - * versioning. That kind of versioning works a bit differently between - * operating systems. The most usual scheme is to set a major and a minor - * number, and have the runtime loader check that the major number is equal - * to what it was at application link time, while the minor number has to - * be greater or equal to what it was at application link time. With this - * scheme, the version number is usually part of the file name, like this: - * - * libcrypto.so.0.9 - * - * Some unixen also make a softlink with the major version number only: - * - * libcrypto.so.0 - * - * On Tru64 and IRIX 6.x it works a little bit differently. There, the - * shared library version is stored in the file, and is actually a series - * of versions, separated by colons. The rightmost version present in the - * library when linking an application is stored in the application to be - * matched at run time. When the application is run, a check is done to - * see if the library version stored in the application matches any of the - * versions in the version string of the library itself. - * This version string can be constructed in any way, depending on what - * kind of matching is desired. However, to implement the same scheme as - * the one used in the other unixen, all compatible versions, from lowest - * to highest, should be part of the string. Consecutive builds would - * give the following versions strings: - * - * 3.0 - * 3.0:3.1 - * 3.0:3.1:3.2 - * 4.0 - * 4.0:4.1 - * - * Notice how version 4 is completely incompatible with version, and - * therefore give the breach you can see. - * - * There may be other schemes as well that I haven't yet discovered. - * - * So, here's the way it works here: first of all, the library version - * number doesn't need at all to match the overall OpenSSL version. - * However, it's nice and more understandable if it actually does. - * The current library version is stored in the macro SHLIB_VERSION_NUMBER, - * which is just a piece of text in the format "M.m.e" (Major, minor, edit). - * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, - * we need to keep a history of version numbers, which is done in the - * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and - * should only keep the versions that are binary compatible with the current. - */ -# define SHLIB_VERSION_HISTORY "" -# define SHLIB_VERSION_NUMBER "1.1" - - -#ifdef __cplusplus -} -#endif -#endif /* HEADER_OPENSSLV_H */ diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ossl_typ.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ossl_typ.h deleted file mode 100644 index e0edfaaf..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ossl_typ.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2001-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_OPENSSL_TYPES_H -# define HEADER_OPENSSL_TYPES_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -# include - -# ifdef NO_ASN1_TYPEDEFS -# define ASN1_INTEGER ASN1_STRING -# define ASN1_ENUMERATED ASN1_STRING -# define ASN1_BIT_STRING ASN1_STRING -# define ASN1_OCTET_STRING ASN1_STRING -# define ASN1_PRINTABLESTRING ASN1_STRING -# define ASN1_T61STRING ASN1_STRING -# define ASN1_IA5STRING ASN1_STRING -# define ASN1_UTCTIME ASN1_STRING -# define ASN1_GENERALIZEDTIME ASN1_STRING -# define ASN1_TIME ASN1_STRING -# define ASN1_GENERALSTRING ASN1_STRING -# define ASN1_UNIVERSALSTRING ASN1_STRING -# define ASN1_BMPSTRING ASN1_STRING -# define ASN1_VISIBLESTRING ASN1_STRING -# define ASN1_UTF8STRING ASN1_STRING -# define ASN1_BOOLEAN int -# define ASN1_NULL int -# else -typedef struct asn1_string_st ASN1_INTEGER; -typedef struct asn1_string_st ASN1_ENUMERATED; -typedef struct asn1_string_st ASN1_BIT_STRING; -typedef struct asn1_string_st ASN1_OCTET_STRING; -typedef struct asn1_string_st ASN1_PRINTABLESTRING; -typedef struct asn1_string_st ASN1_T61STRING; -typedef struct asn1_string_st ASN1_IA5STRING; -typedef struct asn1_string_st ASN1_GENERALSTRING; -typedef struct asn1_string_st ASN1_UNIVERSALSTRING; -typedef struct asn1_string_st ASN1_BMPSTRING; -typedef struct asn1_string_st ASN1_UTCTIME; -typedef struct asn1_string_st ASN1_TIME; -typedef struct asn1_string_st ASN1_GENERALIZEDTIME; -typedef struct asn1_string_st ASN1_VISIBLESTRING; -typedef struct asn1_string_st ASN1_UTF8STRING; -typedef struct asn1_string_st ASN1_STRING; -typedef int ASN1_BOOLEAN; -typedef int ASN1_NULL; -# endif - -typedef struct asn1_object_st ASN1_OBJECT; - -typedef struct ASN1_ITEM_st ASN1_ITEM; -typedef struct asn1_pctx_st ASN1_PCTX; -typedef struct asn1_sctx_st ASN1_SCTX; - -# ifdef _WIN32 -# undef X509_NAME -# undef X509_EXTENSIONS -# undef PKCS7_ISSUER_AND_SERIAL -# undef PKCS7_SIGNER_INFO -# undef OCSP_REQUEST -# undef OCSP_RESPONSE -# endif - -# ifdef BIGNUM -# undef BIGNUM -# endif -struct dane_st; -typedef struct bio_st BIO; -typedef struct bignum_st BIGNUM; -typedef struct bignum_ctx BN_CTX; -typedef struct bn_blinding_st BN_BLINDING; -typedef struct bn_mont_ctx_st BN_MONT_CTX; -typedef struct bn_recp_ctx_st BN_RECP_CTX; -typedef struct bn_gencb_st BN_GENCB; - -typedef struct buf_mem_st BUF_MEM; - -typedef struct evp_cipher_st EVP_CIPHER; -typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; -typedef struct evp_md_st EVP_MD; -typedef struct evp_md_ctx_st EVP_MD_CTX; -typedef struct evp_pkey_st EVP_PKEY; - -typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; - -typedef struct evp_pkey_method_st EVP_PKEY_METHOD; -typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; - -typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; - -typedef struct hmac_ctx_st HMAC_CTX; - -typedef struct dh_st DH; -typedef struct dh_method DH_METHOD; - -typedef struct dsa_st DSA; -typedef struct dsa_method DSA_METHOD; - -typedef struct rsa_st RSA; -typedef struct rsa_meth_st RSA_METHOD; -typedef struct rsa_pss_params_st RSA_PSS_PARAMS; - -typedef struct ec_key_st EC_KEY; -typedef struct ec_key_method_st EC_KEY_METHOD; - -typedef struct rand_meth_st RAND_METHOD; -typedef struct rand_drbg_st RAND_DRBG; - -typedef struct ssl_dane_st SSL_DANE; -typedef struct x509_st X509; -typedef struct X509_algor_st X509_ALGOR; -typedef struct X509_crl_st X509_CRL; -typedef struct x509_crl_method_st X509_CRL_METHOD; -typedef struct x509_revoked_st X509_REVOKED; -typedef struct X509_name_st X509_NAME; -typedef struct X509_pubkey_st X509_PUBKEY; -typedef struct x509_store_st X509_STORE; -typedef struct x509_store_ctx_st X509_STORE_CTX; - -typedef struct x509_object_st X509_OBJECT; -typedef struct x509_lookup_st X509_LOOKUP; -typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; -typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; - -typedef struct x509_sig_info_st X509_SIG_INFO; - -typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; - -typedef struct v3_ext_ctx X509V3_CTX; -typedef struct conf_st CONF; -typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS; - -typedef struct ui_st UI; -typedef struct ui_method_st UI_METHOD; - -typedef struct engine_st ENGINE; -typedef struct ssl_st SSL; -typedef struct ssl_ctx_st SSL_CTX; - -typedef struct comp_ctx_st COMP_CTX; -typedef struct comp_method_st COMP_METHOD; - -typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; -typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; -typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; -typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; - -typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; -typedef struct DIST_POINT_st DIST_POINT; -typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; -typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; - -typedef struct crypto_ex_data_st CRYPTO_EX_DATA; - -typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; -typedef struct ocsp_response_st OCSP_RESPONSE; -typedef struct ocsp_responder_id_st OCSP_RESPID; - -typedef struct sct_st SCT; -typedef struct sct_ctx_st SCT_CTX; -typedef struct ctlog_st CTLOG; -typedef struct ctlog_store_st CTLOG_STORE; -typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX; - -typedef struct ossl_store_info_st OSSL_STORE_INFO; -typedef struct ossl_store_search_st OSSL_STORE_SEARCH; - -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ - defined(INTMAX_MAX) && defined(UINTMAX_MAX) -typedef intmax_t ossl_intmax_t; -typedef uintmax_t ossl_uintmax_t; -#else -/* - * Not long long, because the C-library can only be expected to provide - * strtoll(), strtoull() at the same time as intmax_t and strtoimax(), - * strtoumax(). Since we use these for parsing arguments, we need the - * conversion functions, not just the sizes. - */ -typedef long ossl_intmax_t; -typedef unsigned long ossl_uintmax_t; -#endif - -#ifdef __cplusplus -} -#endif -#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/pem.h b/Hin2n/src/main/jniLibs/x86/include/openssl/pem.h deleted file mode 100644 index 2ef5b5d0..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/pem.h +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright 1995-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_PEM_H -# define HEADER_PEM_H - -# include -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define PEM_BUFSIZE 1024 - -# define PEM_STRING_X509_OLD "X509 CERTIFICATE" -# define PEM_STRING_X509 "CERTIFICATE" -# define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" -# define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" -# define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" -# define PEM_STRING_X509_CRL "X509 CRL" -# define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" -# define PEM_STRING_PUBLIC "PUBLIC KEY" -# define PEM_STRING_RSA "RSA PRIVATE KEY" -# define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" -# define PEM_STRING_DSA "DSA PRIVATE KEY" -# define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" -# define PEM_STRING_PKCS7 "PKCS7" -# define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" -# define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" -# define PEM_STRING_PKCS8INF "PRIVATE KEY" -# define PEM_STRING_DHPARAMS "DH PARAMETERS" -# define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" -# define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" -# define PEM_STRING_DSAPARAMS "DSA PARAMETERS" -# define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" -# define PEM_STRING_ECPARAMETERS "EC PARAMETERS" -# define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" -# define PEM_STRING_PARAMETERS "PARAMETERS" -# define PEM_STRING_CMS "CMS" - -# define PEM_TYPE_ENCRYPTED 10 -# define PEM_TYPE_MIC_ONLY 20 -# define PEM_TYPE_MIC_CLEAR 30 -# define PEM_TYPE_CLEAR 40 - -/* - * These macros make the PEM_read/PEM_write functions easier to maintain and - * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or - * IMPLEMENT_PEM_rw_cb(...) - */ - -# ifdef OPENSSL_NO_STDIO - -# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ -# else - -# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ -type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ -{ \ -return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ -} - -# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x) \ -{ \ -return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, const type *x) \ -{ \ -return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, \ - void *u) \ - { \ - return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, \ - void *u) \ - { \ - return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ - } - -# endif - -# define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ -type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ -{ \ -return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ -} - -# define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x) \ -{ \ -return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, const type *x) \ -{ \ -return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ - { \ - return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ - { \ - return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write(name, type, str, asn1) \ - IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_write_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_read_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb(name, type, str, asn1) - -/* These are the same except they are for the declarations */ - -# if defined(OPENSSL_NO_STDIO) - -# define DECLARE_PEM_read_fp(name, type) /**/ -# define DECLARE_PEM_write_fp(name, type) /**/ -# define DECLARE_PEM_write_fp_const(name, type) /**/ -# define DECLARE_PEM_write_cb_fp(name, type) /**/ -# else - -# define DECLARE_PEM_read_fp(name, type) \ - type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write_fp(name, type) \ - int PEM_write_##name(FILE *fp, type *x); - -# define DECLARE_PEM_write_fp_const(name, type) \ - int PEM_write_##name(FILE *fp, const type *x); - -# define DECLARE_PEM_write_cb_fp(name, type) \ - int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u); - -# endif - -# define DECLARE_PEM_read_bio(name, type) \ - type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write_bio(name, type) \ - int PEM_write_bio_##name(BIO *bp, type *x); - -# define DECLARE_PEM_write_bio_const(name, type) \ - int PEM_write_bio_##name(BIO *bp, const type *x); - -# define DECLARE_PEM_write_cb_bio(name, type) \ - int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write(name, type) \ - DECLARE_PEM_write_bio(name, type) \ - DECLARE_PEM_write_fp(name, type) -# define DECLARE_PEM_write_const(name, type) \ - DECLARE_PEM_write_bio_const(name, type) \ - DECLARE_PEM_write_fp_const(name, type) -# define DECLARE_PEM_write_cb(name, type) \ - DECLARE_PEM_write_cb_bio(name, type) \ - DECLARE_PEM_write_cb_fp(name, type) -# define DECLARE_PEM_read(name, type) \ - DECLARE_PEM_read_bio(name, type) \ - DECLARE_PEM_read_fp(name, type) -# define DECLARE_PEM_rw(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write(name, type) -# define DECLARE_PEM_rw_const(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write_const(name, type) -# define DECLARE_PEM_rw_cb(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write_cb(name, type) -typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); - -int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); -int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, - pem_password_cb *callback, void *u); - -int PEM_read_bio(BIO *bp, char **name, char **header, - unsigned char **data, long *len); -# define PEM_FLAG_SECURE 0x1 -# define PEM_FLAG_EAY_COMPATIBLE 0x2 -# define PEM_FLAG_ONLY_B64 0x4 -int PEM_read_bio_ex(BIO *bp, char **name, char **header, - unsigned char **data, long *len, unsigned int flags); -int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, - const char *name, BIO *bp, pem_password_cb *cb, - void *u); -int PEM_write_bio(BIO *bp, const char *name, const char *hdr, - const unsigned char *data, long len); -int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, - const char *name, BIO *bp, pem_password_cb *cb, - void *u); -void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, - pem_password_cb *cb, void *u); -int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, - const EVP_CIPHER *enc, unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - -STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u); -int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cd, void *u); - -#ifndef OPENSSL_NO_STDIO -int PEM_read(FILE *fp, char **name, char **header, - unsigned char **data, long *len); -int PEM_write(FILE *fp, const char *name, const char *hdr, - const unsigned char *data, long len); -void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, - pem_password_cb *cb, void *u); -int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, - void *x, const EVP_CIPHER *enc, unsigned char *kstr, - int klen, pem_password_cb *callback, void *u); -STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u); -#endif - -int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); -int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); -int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, - unsigned int *siglen, EVP_PKEY *pkey); - -/* The default pem_password_cb that's used internally */ -int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); -void PEM_proc_type(char *buf, int type); -void PEM_dek_info(char *buf, const char *type, int len, char *str); - -# include - -DECLARE_PEM_rw(X509, X509) -DECLARE_PEM_rw(X509_AUX, X509) -DECLARE_PEM_rw(X509_REQ, X509_REQ) -DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) -DECLARE_PEM_rw(X509_CRL, X509_CRL) -DECLARE_PEM_rw(PKCS7, PKCS7) -DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) -DECLARE_PEM_rw(PKCS8, X509_SIG) -DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) -# ifndef OPENSSL_NO_RSA -DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) -DECLARE_PEM_rw_const(RSAPublicKey, RSA) -DECLARE_PEM_rw(RSA_PUBKEY, RSA) -# endif -# ifndef OPENSSL_NO_DSA -DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) -DECLARE_PEM_rw(DSA_PUBKEY, DSA) -DECLARE_PEM_rw_const(DSAparams, DSA) -# endif -# ifndef OPENSSL_NO_EC -DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) -DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) -DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) -# endif -# ifndef OPENSSL_NO_DH -DECLARE_PEM_rw_const(DHparams, DH) -DECLARE_PEM_write_const(DHxparams, DH) -# endif -DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) -DECLARE_PEM_rw(PUBKEY, EVP_PKEY) - -int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, - const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - -int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, - char *, int, pem_password_cb *, void *); -int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, - void *u); - -# ifndef OPENSSL_NO_STDIO -int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); - -EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, - void *u); - -int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, pem_password_cb *cd, - void *u); -# endif -EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); -int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); - -# ifndef OPENSSL_NO_DSA -EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); -EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); -EVP_PKEY *b2i_PrivateKey_bio(BIO *in); -EVP_PKEY *b2i_PublicKey_bio(BIO *in); -int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); -int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); -# ifndef OPENSSL_NO_RC4 -EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); -int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, - pem_password_cb *cb, void *u); -# endif -# endif - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/pem2.h b/Hin2n/src/main/jniLibs/x86/include/openssl/pem2.h deleted file mode 100644 index 038fe790..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/pem2.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 1999-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_PEM2_H -# define HEADER_PEM2_H -# include -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/pemerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/pemerr.h deleted file mode 100644 index 0c45918f..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/pemerr.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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_PEMERR_H -# define HEADER_PEMERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PEM_strings(void); - -/* - * PEM function codes. - */ -# define PEM_F_B2I_DSS 127 -# define PEM_F_B2I_PVK_BIO 128 -# define PEM_F_B2I_RSA 129 -# define PEM_F_CHECK_BITLEN_DSA 130 -# define PEM_F_CHECK_BITLEN_RSA 131 -# define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 -# define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 -# define PEM_F_DO_B2I 132 -# define PEM_F_DO_B2I_BIO 133 -# define PEM_F_DO_BLOB_HEADER 134 -# define PEM_F_DO_I2B 146 -# define PEM_F_DO_PK8PKEY 126 -# define PEM_F_DO_PK8PKEY_FP 125 -# define PEM_F_DO_PVK_BODY 135 -# define PEM_F_DO_PVK_HEADER 136 -# define PEM_F_GET_HEADER_AND_DATA 143 -# define PEM_F_GET_NAME 144 -# define PEM_F_I2B_PVK 137 -# define PEM_F_I2B_PVK_BIO 138 -# define PEM_F_LOAD_IV 101 -# define PEM_F_PEM_ASN1_READ 102 -# define PEM_F_PEM_ASN1_READ_BIO 103 -# define PEM_F_PEM_ASN1_WRITE 104 -# define PEM_F_PEM_ASN1_WRITE_BIO 105 -# define PEM_F_PEM_DEF_CALLBACK 100 -# define PEM_F_PEM_DO_HEADER 106 -# define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 -# define PEM_F_PEM_READ 108 -# define PEM_F_PEM_READ_BIO 109 -# define PEM_F_PEM_READ_BIO_DHPARAMS 141 -# define PEM_F_PEM_READ_BIO_EX 145 -# define PEM_F_PEM_READ_BIO_PARAMETERS 140 -# define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 -# define PEM_F_PEM_READ_DHPARAMS 142 -# define PEM_F_PEM_READ_PRIVATEKEY 124 -# define PEM_F_PEM_SIGNFINAL 112 -# define PEM_F_PEM_WRITE 113 -# define PEM_F_PEM_WRITE_BIO 114 -# define PEM_F_PEM_WRITE_PRIVATEKEY 139 -# define PEM_F_PEM_X509_INFO_READ 115 -# define PEM_F_PEM_X509_INFO_READ_BIO 116 -# define PEM_F_PEM_X509_INFO_WRITE_BIO 117 - -/* - * PEM reason codes. - */ -# define PEM_R_BAD_BASE64_DECODE 100 -# define PEM_R_BAD_DECRYPT 101 -# define PEM_R_BAD_END_LINE 102 -# define PEM_R_BAD_IV_CHARS 103 -# define PEM_R_BAD_MAGIC_NUMBER 116 -# define PEM_R_BAD_PASSWORD_READ 104 -# define PEM_R_BAD_VERSION_NUMBER 117 -# define PEM_R_BIO_WRITE_FAILURE 118 -# define PEM_R_CIPHER_IS_NULL 127 -# define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 -# define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 -# define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 -# define PEM_R_HEADER_TOO_LONG 128 -# define PEM_R_INCONSISTENT_HEADER 121 -# define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 -# define PEM_R_KEYBLOB_TOO_SHORT 123 -# define PEM_R_MISSING_DEK_IV 129 -# define PEM_R_NOT_DEK_INFO 105 -# define PEM_R_NOT_ENCRYPTED 106 -# define PEM_R_NOT_PROC_TYPE 107 -# define PEM_R_NO_START_LINE 108 -# define PEM_R_PROBLEMS_GETTING_PASSWORD 109 -# define PEM_R_PVK_DATA_TOO_SHORT 124 -# define PEM_R_PVK_TOO_SHORT 125 -# define PEM_R_READ_KEY 111 -# define PEM_R_SHORT_HEADER 112 -# define PEM_R_UNEXPECTED_DEK_IV 130 -# define PEM_R_UNSUPPORTED_CIPHER 113 -# define PEM_R_UNSUPPORTED_ENCRYPTION 114 -# define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs12.h b/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs12.h deleted file mode 100644 index 3f43dad6..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs12.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 1999-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_PKCS12_H -# define HEADER_PKCS12_H - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define PKCS12_KEY_ID 1 -# define PKCS12_IV_ID 2 -# define PKCS12_MAC_ID 3 - -/* Default iteration count */ -# ifndef PKCS12_DEFAULT_ITER -# define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER -# endif - -# define PKCS12_MAC_KEY_LENGTH 20 - -# define PKCS12_SALT_LEN 8 - -/* It's not clear if these are actually needed... */ -# define PKCS12_key_gen PKCS12_key_gen_utf8 -# define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8 - -/* MS key usage constants */ - -# define KEY_EX 0x10 -# define KEY_SIG 0x80 - -typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; - -typedef struct PKCS12_st PKCS12; - -typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; - -DEFINE_STACK_OF(PKCS12_SAFEBAG) - -typedef struct pkcs12_bag_st PKCS12_BAGS; - -# define PKCS12_ERROR 0 -# define PKCS12_OK 1 - -/* Compatibility macros */ - -#if OPENSSL_API_COMPAT < 0x10100000L - -# define M_PKCS12_bag_type PKCS12_bag_type -# define M_PKCS12_cert_bag_type PKCS12_cert_bag_type -# define M_PKCS12_crl_bag_type PKCS12_cert_bag_type - -# define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert -# define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl -# define PKCS12_bag_type PKCS12_SAFEBAG_get_nid -# define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid -# define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert -# define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl -# define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf -# define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt - -#endif - -DEPRECATEDIN_1_1_0(ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, int attr_nid)) - -ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid); -int PKCS12_mac_present(const PKCS12 *p12); -void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, - const X509_ALGOR **pmacalg, - const ASN1_OCTET_STRING **psalt, - const ASN1_INTEGER **piter, - const PKCS12 *p12); - -const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, - int attr_nid); -const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); -int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag); -int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag); - -X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag); -X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag); -const STACK_OF(PKCS12_SAFEBAG) * -PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); -const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag); -const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag); - -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, - const char *pass, - int passlen, - unsigned char *salt, - int saltlen, int iter, - PKCS8_PRIV_KEY_INFO *p8inf); - -PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, - int nid1, int nid2); -PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, - int passlen); -PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag, - const char *pass, int passlen); -X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, - const char *pass, int passlen, unsigned char *salt, - int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); -X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen, - PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe); -PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); -STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); -PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, - unsigned char *salt, int saltlen, int iter, - STACK_OF(PKCS12_SAFEBAG) *bags); -STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, - int passlen); - -int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); -STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12); - -int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, - int namelen); -int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, - const unsigned char *name, int namelen); -int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); -ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, - int attr_nid); -char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); -const STACK_OF(X509_ATTRIBUTE) * -PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag); -unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, - const char *pass, int passlen, - const unsigned char *in, int inlen, - unsigned char **data, int *datalen, - int en_de); -void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, - const char *pass, int passlen, - const ASN1_OCTET_STRING *oct, int zbuf); -ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, - const ASN1_ITEM *it, - const char *pass, int passlen, - void *obj, int zbuf); -PKCS12 *PKCS12_init(int mode); -int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md_type, int en_de); -int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, - unsigned char *mac, unsigned int *maclen); -int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); -int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, - unsigned char *salt, int saltlen, int iter, - const EVP_MD *md_type); -int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, - int saltlen, const EVP_MD *md_type); -unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, - unsigned char **uni, int *unilen); -char *OPENSSL_uni2asc(const unsigned char *uni, int unilen); -unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, - unsigned char **uni, int *unilen); -char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen); - -DECLARE_ASN1_FUNCTIONS(PKCS12) -DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) -DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) -DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) - -DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) -DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) - -void PKCS12_PBE_add(void); -int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, - STACK_OF(X509) **ca); -PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, - X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, - int iter, int mac_iter, int keytype); - -PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); -PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, - EVP_PKEY *key, int key_usage, int iter, - int key_nid, const char *pass); -int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, - int safe_nid, int iter, const char *pass); -PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); - -int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); -# ifndef OPENSSL_NO_STDIO -int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); -# endif -PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); -# ifndef OPENSSL_NO_STDIO -PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); -# endif -int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs12err.h b/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs12err.h deleted file mode 100644 index eff5eb26..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs12err.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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_PKCS12ERR_H -# define HEADER_PKCS12ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PKCS12_strings(void); - -/* - * PKCS12 function codes. - */ -# define PKCS12_F_OPENSSL_ASC2UNI 121 -# define PKCS12_F_OPENSSL_UNI2ASC 124 -# define PKCS12_F_OPENSSL_UNI2UTF8 127 -# define PKCS12_F_OPENSSL_UTF82UNI 129 -# define PKCS12_F_PKCS12_CREATE 105 -# define PKCS12_F_PKCS12_GEN_MAC 107 -# define PKCS12_F_PKCS12_INIT 109 -# define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 -# define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 -# define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 -# define PKCS12_F_PKCS12_KEY_GEN_ASC 110 -# define PKCS12_F_PKCS12_KEY_GEN_UNI 111 -# define PKCS12_F_PKCS12_KEY_GEN_UTF8 116 -# define PKCS12_F_PKCS12_NEWPASS 128 -# define PKCS12_F_PKCS12_PACK_P7DATA 114 -# define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 -# define PKCS12_F_PKCS12_PARSE 118 -# define PKCS12_F_PKCS12_PBE_CRYPT 119 -# define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 112 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 113 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 133 -# define PKCS12_F_PKCS12_SETUP_MAC 122 -# define PKCS12_F_PKCS12_SET_MAC 123 -# define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 -# define PKCS12_F_PKCS12_UNPACK_P7DATA 131 -# define PKCS12_F_PKCS12_VERIFY_MAC 126 -# define PKCS12_F_PKCS8_ENCRYPT 125 -# define PKCS12_F_PKCS8_SET0_PBE 132 - -/* - * PKCS12 reason codes. - */ -# define PKCS12_R_CANT_PACK_STRUCTURE 100 -# define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 -# define PKCS12_R_DECODE_ERROR 101 -# define PKCS12_R_ENCODE_ERROR 102 -# define PKCS12_R_ENCRYPT_ERROR 103 -# define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 -# define PKCS12_R_INVALID_NULL_ARGUMENT 104 -# define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 -# define PKCS12_R_IV_GEN_ERROR 106 -# define PKCS12_R_KEY_GEN_ERROR 107 -# define PKCS12_R_MAC_ABSENT 108 -# define PKCS12_R_MAC_GENERATION_ERROR 109 -# define PKCS12_R_MAC_SETUP_ERROR 110 -# define PKCS12_R_MAC_STRING_SET_ERROR 111 -# define PKCS12_R_MAC_VERIFY_FAILURE 113 -# define PKCS12_R_PARSE_ERROR 114 -# define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 -# define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 -# define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 -# define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 -# define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs7.h b/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs7.h deleted file mode 100644 index 9b66e002..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs7.h +++ /dev/null @@ -1,319 +0,0 @@ -/* - * 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_PKCS7_H -# define HEADER_PKCS7_H - -# include -# include -# include - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- -Encryption_ID DES-CBC -Digest_ID MD5 -Digest_Encryption_ID rsaEncryption -Key_Encryption_ID rsaEncryption -*/ - -typedef struct pkcs7_issuer_and_serial_st { - X509_NAME *issuer; - ASN1_INTEGER *serial; -} PKCS7_ISSUER_AND_SERIAL; - -typedef struct pkcs7_signer_info_st { - ASN1_INTEGER *version; /* version 1 */ - PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; - X509_ALGOR *digest_alg; - STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ - X509_ALGOR *digest_enc_alg; - ASN1_OCTET_STRING *enc_digest; - STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ - /* The private key to sign with */ - EVP_PKEY *pkey; -} PKCS7_SIGNER_INFO; - -DEFINE_STACK_OF(PKCS7_SIGNER_INFO) - -typedef struct pkcs7_recip_info_st { - ASN1_INTEGER *version; /* version 0 */ - PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; - X509_ALGOR *key_enc_algor; - ASN1_OCTET_STRING *enc_key; - X509 *cert; /* get the pub-key from this */ -} PKCS7_RECIP_INFO; - -DEFINE_STACK_OF(PKCS7_RECIP_INFO) - -typedef struct pkcs7_signed_st { - ASN1_INTEGER *version; /* version 1 */ - STACK_OF(X509_ALGOR) *md_algs; /* md used */ - STACK_OF(X509) *cert; /* [ 0 ] */ - STACK_OF(X509_CRL) *crl; /* [ 1 ] */ - STACK_OF(PKCS7_SIGNER_INFO) *signer_info; - struct pkcs7_st *contents; -} PKCS7_SIGNED; -/* - * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about - * merging the two - */ - -typedef struct pkcs7_enc_content_st { - ASN1_OBJECT *content_type; - X509_ALGOR *algorithm; - ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ - const EVP_CIPHER *cipher; -} PKCS7_ENC_CONTENT; - -typedef struct pkcs7_enveloped_st { - ASN1_INTEGER *version; /* version 0 */ - STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; - PKCS7_ENC_CONTENT *enc_data; -} PKCS7_ENVELOPE; - -typedef struct pkcs7_signedandenveloped_st { - ASN1_INTEGER *version; /* version 1 */ - STACK_OF(X509_ALGOR) *md_algs; /* md used */ - STACK_OF(X509) *cert; /* [ 0 ] */ - STACK_OF(X509_CRL) *crl; /* [ 1 ] */ - STACK_OF(PKCS7_SIGNER_INFO) *signer_info; - PKCS7_ENC_CONTENT *enc_data; - STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; -} PKCS7_SIGN_ENVELOPE; - -typedef struct pkcs7_digest_st { - ASN1_INTEGER *version; /* version 0 */ - X509_ALGOR *md; /* md used */ - struct pkcs7_st *contents; - ASN1_OCTET_STRING *digest; -} PKCS7_DIGEST; - -typedef struct pkcs7_encrypted_st { - ASN1_INTEGER *version; /* version 0 */ - PKCS7_ENC_CONTENT *enc_data; -} PKCS7_ENCRYPT; - -typedef struct pkcs7_st { - /* - * The following is non NULL if it contains ASN1 encoding of this - * structure - */ - unsigned char *asn1; - long length; -# define PKCS7_S_HEADER 0 -# define PKCS7_S_BODY 1 -# define PKCS7_S_TAIL 2 - int state; /* used during processing */ - int detached; - ASN1_OBJECT *type; - /* content as defined by the type */ - /* - * all encryption/message digests are applied to the 'contents', leaving - * out the 'type' field. - */ - union { - char *ptr; - /* NID_pkcs7_data */ - ASN1_OCTET_STRING *data; - /* NID_pkcs7_signed */ - PKCS7_SIGNED *sign; - /* NID_pkcs7_enveloped */ - PKCS7_ENVELOPE *enveloped; - /* NID_pkcs7_signedAndEnveloped */ - PKCS7_SIGN_ENVELOPE *signed_and_enveloped; - /* NID_pkcs7_digest */ - PKCS7_DIGEST *digest; - /* NID_pkcs7_encrypted */ - PKCS7_ENCRYPT *encrypted; - /* Anything else */ - ASN1_TYPE *other; - } d; -} PKCS7; - -DEFINE_STACK_OF(PKCS7) - -# define PKCS7_OP_SET_DETACHED_SIGNATURE 1 -# define PKCS7_OP_GET_DETACHED_SIGNATURE 2 - -# define PKCS7_get_signed_attributes(si) ((si)->auth_attr) -# define PKCS7_get_attributes(si) ((si)->unauth_attr) - -# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) -# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) -# define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) -# define PKCS7_type_is_signedAndEnveloped(a) \ - (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) -# define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) -# define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) - -# define PKCS7_set_detached(p,v) \ - PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) -# define PKCS7_get_detached(p) \ - PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) - -# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) - -/* S/MIME related flags */ - -# define PKCS7_TEXT 0x1 -# define PKCS7_NOCERTS 0x2 -# define PKCS7_NOSIGS 0x4 -# define PKCS7_NOCHAIN 0x8 -# define PKCS7_NOINTERN 0x10 -# define PKCS7_NOVERIFY 0x20 -# define PKCS7_DETACHED 0x40 -# define PKCS7_BINARY 0x80 -# define PKCS7_NOATTR 0x100 -# define PKCS7_NOSMIMECAP 0x200 -# define PKCS7_NOOLDMIMETYPE 0x400 -# define PKCS7_CRLFEOL 0x800 -# define PKCS7_STREAM 0x1000 -# define PKCS7_NOCRL 0x2000 -# define PKCS7_PARTIAL 0x4000 -# define PKCS7_REUSE_DIGEST 0x8000 -# define PKCS7_NO_DUAL_CONTENT 0x10000 - -/* Flags: for compatibility with older code */ - -# define SMIME_TEXT PKCS7_TEXT -# define SMIME_NOCERTS PKCS7_NOCERTS -# define SMIME_NOSIGS PKCS7_NOSIGS -# define SMIME_NOCHAIN PKCS7_NOCHAIN -# define SMIME_NOINTERN PKCS7_NOINTERN -# define SMIME_NOVERIFY PKCS7_NOVERIFY -# define SMIME_DETACHED PKCS7_DETACHED -# define SMIME_BINARY PKCS7_BINARY -# define SMIME_NOATTR PKCS7_NOATTR - -/* CRLF ASCII canonicalisation */ -# define SMIME_ASCIICRLF 0x80000 - -DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) - -int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, - const EVP_MD *type, unsigned char *md, - unsigned int *len); -# ifndef OPENSSL_NO_STDIO -PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7); -int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7); -# endif -PKCS7 *PKCS7_dup(PKCS7 *p7); -PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7); -int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7); -int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); -int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); - -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) -DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) -DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) -DECLARE_ASN1_FUNCTIONS(PKCS7) - -DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) -DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) - -DECLARE_ASN1_NDEF_FUNCTION(PKCS7) -DECLARE_ASN1_PRINT_FUNCTION(PKCS7) - -long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); - -int PKCS7_set_type(PKCS7 *p7, int type); -int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); -int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); -int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, - const EVP_MD *dgst); -int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); -int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); -int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); -int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); -int PKCS7_content_new(PKCS7 *p7, int nid); -int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, - BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); -int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, - X509 *x509); - -BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); -int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); -BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); - -PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, - EVP_PKEY *pkey, const EVP_MD *dgst); -X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); -int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); -STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); - -PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); -void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, - X509_ALGOR **pdig, X509_ALGOR **psig); -void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); -int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); -int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); -int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); -int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); - -PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); -ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); -int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, - void *data); -int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, - void *value); -ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); -ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); -int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, - STACK_OF(X509_ATTRIBUTE) *sk); -int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, - STACK_OF(X509_ATTRIBUTE) *sk); - -PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, - BIO *data, int flags); - -PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, - X509 *signcert, EVP_PKEY *pkey, - const EVP_MD *md, int flags); - -int PKCS7_final(PKCS7 *p7, BIO *data, int flags); -int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, - BIO *indata, BIO *out, int flags); -STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, - int flags); -PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, - int flags); -int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, - int flags); - -int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, - STACK_OF(X509_ALGOR) *cap); -STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); -int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); - -int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); -int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); -int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, - const unsigned char *md, int mdlen); - -int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); -PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); - -BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs7err.h b/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs7err.h deleted file mode 100644 index 02e0299a..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/pkcs7err.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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_PKCS7ERR_H -# define HEADER_PKCS7ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PKCS7_strings(void); - -/* - * PKCS7 function codes. - */ -# define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 -# define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 -# define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 -# define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 -# define PKCS7_F_PKCS7_ADD_CRL 101 -# define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 -# define PKCS7_F_PKCS7_ADD_SIGNATURE 131 -# define PKCS7_F_PKCS7_ADD_SIGNER 103 -# define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 -# define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 -# define PKCS7_F_PKCS7_CTRL 104 -# define PKCS7_F_PKCS7_DATADECODE 112 -# define PKCS7_F_PKCS7_DATAFINAL 128 -# define PKCS7_F_PKCS7_DATAINIT 105 -# define PKCS7_F_PKCS7_DATAVERIFY 107 -# define PKCS7_F_PKCS7_DECRYPT 114 -# define PKCS7_F_PKCS7_DECRYPT_RINFO 133 -# define PKCS7_F_PKCS7_ENCODE_RINFO 132 -# define PKCS7_F_PKCS7_ENCRYPT 115 -# define PKCS7_F_PKCS7_FINAL 134 -# define PKCS7_F_PKCS7_FIND_DIGEST 127 -# define PKCS7_F_PKCS7_GET0_SIGNERS 124 -# define PKCS7_F_PKCS7_RECIP_INFO_SET 130 -# define PKCS7_F_PKCS7_SET_CIPHER 108 -# define PKCS7_F_PKCS7_SET_CONTENT 109 -# define PKCS7_F_PKCS7_SET_DIGEST 126 -# define PKCS7_F_PKCS7_SET_TYPE 110 -# define PKCS7_F_PKCS7_SIGN 116 -# define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 -# define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 -# define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 -# define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 -# define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 -# define PKCS7_F_PKCS7_VERIFY 117 - -/* - * PKCS7 reason codes. - */ -# define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 -# define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 -# define PKCS7_R_CIPHER_NOT_INITIALIZED 116 -# define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 -# define PKCS7_R_CTRL_ERROR 152 -# define PKCS7_R_DECRYPT_ERROR 119 -# define PKCS7_R_DIGEST_FAILURE 101 -# define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 -# define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 -# define PKCS7_R_ERROR_ADDING_RECIPIENT 120 -# define PKCS7_R_ERROR_SETTING_CIPHER 121 -# define PKCS7_R_INVALID_NULL_POINTER 143 -# define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 -# define PKCS7_R_NO_CONTENT 122 -# define PKCS7_R_NO_DEFAULT_DIGEST 151 -# define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 -# define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 -# define PKCS7_R_NO_SIGNATURES_ON_DATA 123 -# define PKCS7_R_NO_SIGNERS 142 -# define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 -# define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 -# define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 -# define PKCS7_R_PKCS7_DATASIGN 145 -# define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 -# define PKCS7_R_SIGNATURE_FAILURE 105 -# define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 -# define PKCS7_R_SIGNING_CTRL_FAILURE 147 -# define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 -# define PKCS7_R_SMIME_TEXT_ERROR 129 -# define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 -# define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 -# define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 -# define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 -# define PKCS7_R_UNKNOWN_OPERATION 110 -# define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 -# define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 -# define PKCS7_R_WRONG_CONTENT_TYPE 113 -# define PKCS7_R_WRONG_PKCS7_TYPE 114 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/rand.h b/Hin2n/src/main/jniLibs/x86/include/openssl/rand.h deleted file mode 100644 index 38a2a271..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/rand.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1995-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_RAND_H -# define HEADER_RAND_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -struct rand_meth_st { - int (*seed) (const void *buf, int num); - int (*bytes) (unsigned char *buf, int num); - void (*cleanup) (void); - int (*add) (const void *buf, int num, double randomness); - int (*pseudorand) (unsigned char *buf, int num); - int (*status) (void); -}; - -int RAND_set_rand_method(const RAND_METHOD *meth); -const RAND_METHOD *RAND_get_rand_method(void); -# ifndef OPENSSL_NO_ENGINE -int RAND_set_rand_engine(ENGINE *engine); -# endif - -RAND_METHOD *RAND_OpenSSL(void); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define RAND_cleanup() while(0) continue -# endif -int RAND_bytes(unsigned char *buf, int num); -int RAND_priv_bytes(unsigned char *buf, int num); -DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) - -void RAND_seed(const void *buf, int num); -void RAND_keep_random_devices_open(int keep); - -# if defined(__ANDROID__) && defined(__NDK_FPABI__) -__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ -# endif -void RAND_add(const void *buf, int num, double randomness); -int RAND_load_file(const char *file, long max_bytes); -int RAND_write_file(const char *file); -const char *RAND_file_name(char *file, size_t num); -int RAND_status(void); - -# ifndef OPENSSL_NO_EGD -int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); -int RAND_egd(const char *path); -int RAND_egd_bytes(const char *path, int bytes); -# endif - -int RAND_poll(void); - -# if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) -/* application has to include in order to use these */ -DEPRECATEDIN_1_1_0(void RAND_screen(void)) -DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) -# endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/rand_drbg.h b/Hin2n/src/main/jniLibs/x86/include/openssl/rand_drbg.h deleted file mode 100644 index 45b731b7..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/rand_drbg.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2017-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_DRBG_RAND_H -# define HEADER_DRBG_RAND_H - -# include -# include -# include - -/* - * RAND_DRBG flags - * - * Note: if new flags are added, the constant `rand_drbg_used_flags` - * in drbg_lib.c needs to be updated accordingly. - */ - -/* In CTR mode, disable derivation function ctr_df */ -# define RAND_DRBG_FLAG_CTR_NO_DF 0x1 - - -# if OPENSSL_API_COMPAT < 0x10200000L -/* This #define was replaced by an internal constant and should not be used. */ -# define RAND_DRBG_USED_FLAGS (RAND_DRBG_FLAG_CTR_NO_DF) -# endif - -/* - * Default security strength (in the sense of [NIST SP 800-90Ar1]) - * - * NIST SP 800-90Ar1 supports the strength of the DRBG being smaller than that - * of the cipher by collecting less entropy. The current DRBG implementation - * does not take RAND_DRBG_STRENGTH into account and sets the strength of the - * DRBG to that of the cipher. - * - * RAND_DRBG_STRENGTH is currently only used for the legacy RAND - * implementation. - * - * Currently supported ciphers are: NID_aes_128_ctr, NID_aes_192_ctr and - * NID_aes_256_ctr - */ -# define RAND_DRBG_STRENGTH 256 -/* Default drbg type */ -# define RAND_DRBG_TYPE NID_aes_256_ctr -/* Default drbg flags */ -# define RAND_DRBG_FLAGS 0 - - -# ifdef __cplusplus -extern "C" { -# endif - -/* - * Object lifetime functions. - */ -RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent); -RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent); -int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags); -int RAND_DRBG_set_defaults(int type, unsigned int flags); -int RAND_DRBG_instantiate(RAND_DRBG *drbg, - const unsigned char *pers, size_t perslen); -int RAND_DRBG_uninstantiate(RAND_DRBG *drbg); -void RAND_DRBG_free(RAND_DRBG *drbg); - -/* - * Object "use" functions. - */ -int RAND_DRBG_reseed(RAND_DRBG *drbg, - const unsigned char *adin, size_t adinlen, - int prediction_resistance); -int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, - int prediction_resistance, - const unsigned char *adin, size_t adinlen); -int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen); - -int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, unsigned int interval); -int RAND_DRBG_set_reseed_time_interval(RAND_DRBG *drbg, time_t interval); - -int RAND_DRBG_set_reseed_defaults( - unsigned int master_reseed_interval, - unsigned int slave_reseed_interval, - time_t master_reseed_time_interval, - time_t slave_reseed_time_interval - ); - -RAND_DRBG *RAND_DRBG_get0_master(void); -RAND_DRBG *RAND_DRBG_get0_public(void); -RAND_DRBG *RAND_DRBG_get0_private(void); - -/* - * EXDATA - */ -# define RAND_DRBG_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DRBG, l, p, newf, dupf, freef) -int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *arg); -void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx); - -/* - * Callback function typedefs - */ -typedef size_t (*RAND_DRBG_get_entropy_fn)(RAND_DRBG *drbg, - unsigned char **pout, - int entropy, size_t min_len, - size_t max_len, - int prediction_resistance); -typedef void (*RAND_DRBG_cleanup_entropy_fn)(RAND_DRBG *ctx, - unsigned char *out, size_t outlen); -typedef size_t (*RAND_DRBG_get_nonce_fn)(RAND_DRBG *drbg, unsigned char **pout, - int entropy, size_t min_len, - size_t max_len); -typedef void (*RAND_DRBG_cleanup_nonce_fn)(RAND_DRBG *drbg, - unsigned char *out, size_t outlen); - -int RAND_DRBG_set_callbacks(RAND_DRBG *drbg, - RAND_DRBG_get_entropy_fn get_entropy, - RAND_DRBG_cleanup_entropy_fn cleanup_entropy, - RAND_DRBG_get_nonce_fn get_nonce, - RAND_DRBG_cleanup_nonce_fn cleanup_nonce); - - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/randerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/randerr.h deleted file mode 100644 index 79d57905..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/randerr.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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_RANDERR_H -# define HEADER_RANDERR_H - -# include - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_RAND_strings(void); - -/* - * RAND function codes. - */ -# define RAND_F_DATA_COLLECT_METHOD 127 -# define RAND_F_DRBG_BYTES 101 -# define RAND_F_DRBG_GET_ENTROPY 105 -# define RAND_F_DRBG_SETUP 117 -# define RAND_F_GET_ENTROPY 106 -# define RAND_F_RAND_BYTES 100 -# define RAND_F_RAND_DRBG_ENABLE_LOCKING 119 -# define RAND_F_RAND_DRBG_GENERATE 107 -# define RAND_F_RAND_DRBG_GET_ENTROPY 120 -# define RAND_F_RAND_DRBG_GET_NONCE 123 -# define RAND_F_RAND_DRBG_INSTANTIATE 108 -# define RAND_F_RAND_DRBG_NEW 109 -# define RAND_F_RAND_DRBG_RESEED 110 -# define RAND_F_RAND_DRBG_RESTART 102 -# define RAND_F_RAND_DRBG_SET 104 -# define RAND_F_RAND_DRBG_SET_DEFAULTS 121 -# define RAND_F_RAND_DRBG_UNINSTANTIATE 118 -# define RAND_F_RAND_LOAD_FILE 111 -# define RAND_F_RAND_POOL_ACQUIRE_ENTROPY 122 -# define RAND_F_RAND_POOL_ADD 103 -# define RAND_F_RAND_POOL_ADD_BEGIN 113 -# define RAND_F_RAND_POOL_ADD_END 114 -# define RAND_F_RAND_POOL_ATTACH 124 -# define RAND_F_RAND_POOL_BYTES_NEEDED 115 -# define RAND_F_RAND_POOL_GROW 125 -# define RAND_F_RAND_POOL_NEW 116 -# define RAND_F_RAND_PSEUDO_BYTES 126 -# define RAND_F_RAND_WRITE_FILE 112 - -/* - * RAND reason codes. - */ -# define RAND_R_ADDITIONAL_INPUT_TOO_LONG 102 -# define RAND_R_ALREADY_INSTANTIATED 103 -# define RAND_R_ARGUMENT_OUT_OF_RANGE 105 -# define RAND_R_CANNOT_OPEN_FILE 121 -# define RAND_R_DRBG_ALREADY_INITIALIZED 129 -# define RAND_R_DRBG_NOT_INITIALISED 104 -# define RAND_R_ENTROPY_INPUT_TOO_LONG 106 -# define RAND_R_ENTROPY_OUT_OF_RANGE 124 -# define RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED 127 -# define RAND_R_ERROR_INITIALISING_DRBG 107 -# define RAND_R_ERROR_INSTANTIATING_DRBG 108 -# define RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 109 -# define RAND_R_ERROR_RETRIEVING_ENTROPY 110 -# define RAND_R_ERROR_RETRIEVING_NONCE 111 -# define RAND_R_FAILED_TO_CREATE_LOCK 126 -# define RAND_R_FUNC_NOT_IMPLEMENTED 101 -# define RAND_R_FWRITE_ERROR 123 -# define RAND_R_GENERATE_ERROR 112 -# define RAND_R_INTERNAL_ERROR 113 -# define RAND_R_IN_ERROR_STATE 114 -# define RAND_R_NOT_A_REGULAR_FILE 122 -# define RAND_R_NOT_INSTANTIATED 115 -# define RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED 128 -# define RAND_R_PARENT_LOCKING_NOT_ENABLED 130 -# define RAND_R_PARENT_STRENGTH_TOO_WEAK 131 -# define RAND_R_PERSONALISATION_STRING_TOO_LONG 116 -# define RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED 133 -# define RAND_R_PRNG_NOT_SEEDED 100 -# define RAND_R_RANDOM_POOL_OVERFLOW 125 -# define RAND_R_RANDOM_POOL_UNDERFLOW 134 -# define RAND_R_REQUEST_TOO_LARGE_FOR_DRBG 117 -# define RAND_R_RESEED_ERROR 118 -# define RAND_R_SELFTEST_FAILURE 119 -# define RAND_R_TOO_LITTLE_NONCE_REQUESTED 135 -# define RAND_R_TOO_MUCH_NONCE_REQUESTED 136 -# define RAND_R_UNSUPPORTED_DRBG_FLAGS 132 -# define RAND_R_UNSUPPORTED_DRBG_TYPE 120 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/rc2.h b/Hin2n/src/main/jniLibs/x86/include/openssl/rc2.h deleted file mode 100644 index 585f9e4c..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/rc2.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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_RC2_H -# define HEADER_RC2_H - -# include - -# ifndef OPENSSL_NO_RC2 -# ifdef __cplusplus -extern "C" { -# endif - -typedef unsigned int RC2_INT; - -# define RC2_ENCRYPT 1 -# define RC2_DECRYPT 0 - -# define RC2_BLOCK 8 -# define RC2_KEY_LENGTH 16 - -typedef struct rc2_key_st { - RC2_INT data[64]; -} RC2_KEY; - -void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); -void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, - RC2_KEY *key, int enc); -void RC2_encrypt(unsigned long *data, RC2_KEY *key); -void RC2_decrypt(unsigned long *data, RC2_KEY *key); -void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - RC2_KEY *ks, unsigned char *iv, int enc); -void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num, int enc); -void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/rc4.h b/Hin2n/src/main/jniLibs/x86/include/openssl/rc4.h deleted file mode 100644 index 86803b37..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/rc4.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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_RC4_H -# define HEADER_RC4_H - -# include - -# ifndef OPENSSL_NO_RC4 -# include -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct rc4_key_st { - RC4_INT x, y; - RC4_INT data[256]; -} RC4_KEY; - -const char *RC4_options(void); -void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); -void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, - unsigned char *outdata); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/rc5.h b/Hin2n/src/main/jniLibs/x86/include/openssl/rc5.h deleted file mode 100644 index 793f88e4..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/rc5.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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_RC5_H -# define HEADER_RC5_H - -# include - -# ifndef OPENSSL_NO_RC5 -# ifdef __cplusplus -extern "C" { -# endif - -# define RC5_ENCRYPT 1 -# define RC5_DECRYPT 0 - -# define RC5_32_INT unsigned int - -# define RC5_32_BLOCK 8 -# define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ - -/* - * This are the only values supported. Tweak the code if you want more The - * most supported modes will be RC5-32/12/16 RC5-32/16/8 - */ -# define RC5_8_ROUNDS 8 -# define RC5_12_ROUNDS 12 -# define RC5_16_ROUNDS 16 - -typedef struct rc5_key_st { - /* Number of rounds */ - int rounds; - RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; -} RC5_32_KEY; - -void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, - int rounds); -void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, - RC5_32_KEY *key, int enc); -void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *ks, unsigned char *iv, - int enc); -void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ripemd.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ripemd.h deleted file mode 100644 index c42026aa..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ripemd.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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_RIPEMD_H -# define HEADER_RIPEMD_H - -# include - -#ifndef OPENSSL_NO_RMD160 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define RIPEMD160_LONG unsigned int - -# define RIPEMD160_CBLOCK 64 -# define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) -# define RIPEMD160_DIGEST_LENGTH 20 - -typedef struct RIPEMD160state_st { - RIPEMD160_LONG A, B, C, D, E; - RIPEMD160_LONG Nl, Nh; - RIPEMD160_LONG data[RIPEMD160_LBLOCK]; - unsigned int num; -} RIPEMD160_CTX; - -int RIPEMD160_Init(RIPEMD160_CTX *c); -int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); -int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); -unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); -void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); - -# ifdef __cplusplus -} -# endif -# endif - - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/rsa.h b/Hin2n/src/main/jniLibs/x86/include/openssl/rsa.h deleted file mode 100644 index 5e76365c..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/rsa.h +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Copyright 1995-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_RSA_H -# define HEADER_RSA_H - -# include - -# ifndef OPENSSL_NO_RSA -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* The types RSA and RSA_METHOD are defined in ossl_typ.h */ - -# ifndef OPENSSL_RSA_MAX_MODULUS_BITS -# define OPENSSL_RSA_MAX_MODULUS_BITS 16384 -# endif - -# define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 - -# ifndef OPENSSL_RSA_SMALL_MODULUS_BITS -# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 -# endif -# ifndef OPENSSL_RSA_MAX_PUBEXP_BITS - -/* exponent limit enforced for "large" modulus only */ -# define OPENSSL_RSA_MAX_PUBEXP_BITS 64 -# endif - -# define RSA_3 0x3L -# define RSA_F4 0x10001L - -/* based on RFC 8017 appendix A.1.2 */ -# define RSA_ASN1_VERSION_DEFAULT 0 -# define RSA_ASN1_VERSION_MULTI 1 - -# define RSA_DEFAULT_PRIME_NUM 2 - -# define RSA_METHOD_FLAG_NO_CHECK 0x0001/* don't check pub/private - * match */ - -# define RSA_FLAG_CACHE_PUBLIC 0x0002 -# define RSA_FLAG_CACHE_PRIVATE 0x0004 -# define RSA_FLAG_BLINDING 0x0008 -# define RSA_FLAG_THREAD_SAFE 0x0010 -/* - * This flag means the private key operations will be handled by rsa_mod_exp - * and that they do not depend on the private key components being present: - * for example a key stored in external hardware. Without this flag - * bn_mod_exp gets called when private key components are absent. - */ -# define RSA_FLAG_EXT_PKEY 0x0020 - -/* - * new with 0.9.6j and 0.9.7b; the built-in - * RSA implementation now uses blinding by - * default (ignoring RSA_FLAG_BLINDING), - * but other engines might not need it - */ -# define RSA_FLAG_NO_BLINDING 0x0080 -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define RSA_FLAG_NO_CONSTTIME 0x0000 -# endif -# if OPENSSL_API_COMPAT < 0x00908000L -/* deprecated name for the flag*/ -/* - * new with 0.9.7h; the built-in RSA - * implementation now uses constant time - * modular exponentiation for secret exponents - * by default. This flag causes the - * faster variable sliding window method to - * be used for all exponents. - */ -# define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME -# endif - -# define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ - RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_RSA_PADDING, pad, NULL) - -# define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \ - RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad) - -# define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ - RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ - EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) -/* Salt length matches digest */ -# define RSA_PSS_SALTLEN_DIGEST -1 -/* Verify only: auto detect salt length */ -# define RSA_PSS_SALTLEN_AUTO -2 -/* Set salt length to maximum possible */ -# define RSA_PSS_SALTLEN_MAX -3 -/* Old compatible max salt length for sign only */ -# define RSA_PSS_SALTLEN_MAX_SIGN -2 - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \ - RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ - EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, 0, plen) - -# define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) - -# define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp) - -# define EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, primes) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES, primes, NULL) - -# define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)(l)) - -# define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)(l)) - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, \ - EVP_PKEY_OP_KEYGEN, EVP_PKEY_CTRL_MD, \ - 0, (void *)(md)) - -# define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) - -# define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) - -# define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) - -# define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) - -# define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) - -# define EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES (EVP_PKEY_ALG_CTRL + 13) - -# define RSA_PKCS1_PADDING 1 -# define RSA_SSLV23_PADDING 2 -# define RSA_NO_PADDING 3 -# define RSA_PKCS1_OAEP_PADDING 4 -# define RSA_X931_PADDING 5 -/* EVP_PKEY_ only */ -# define RSA_PKCS1_PSS_PADDING 6 - -# define RSA_PKCS1_PADDING_SIZE 11 - -# define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) -# define RSA_get_app_data(s) RSA_get_ex_data(s,0) - -RSA *RSA_new(void); -RSA *RSA_new_method(ENGINE *engine); -int RSA_bits(const RSA *rsa); -int RSA_size(const RSA *rsa); -int RSA_security_bits(const RSA *rsa); - -int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); -int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); -int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); -int RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[], - BIGNUM *coeffs[], int pnum); -void RSA_get0_key(const RSA *r, - const BIGNUM **n, const BIGNUM **e, const BIGNUM **d); -void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); -int RSA_get_multi_prime_extra_count(const RSA *r); -int RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]); -void RSA_get0_crt_params(const RSA *r, - const BIGNUM **dmp1, const BIGNUM **dmq1, - const BIGNUM **iqmp); -int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[], - const BIGNUM *coeffs[]); -const BIGNUM *RSA_get0_n(const RSA *d); -const BIGNUM *RSA_get0_e(const RSA *d); -const BIGNUM *RSA_get0_d(const RSA *d); -const BIGNUM *RSA_get0_p(const RSA *d); -const BIGNUM *RSA_get0_q(const RSA *d); -const BIGNUM *RSA_get0_dmp1(const RSA *r); -const BIGNUM *RSA_get0_dmq1(const RSA *r); -const BIGNUM *RSA_get0_iqmp(const RSA *r); -const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); -void RSA_clear_flags(RSA *r, int flags); -int RSA_test_flags(const RSA *r, int flags); -void RSA_set_flags(RSA *r, int flags); -int RSA_get_version(RSA *r); -ENGINE *RSA_get0_engine(const RSA *r); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void - (*callback) (int, int, void *), - void *cb_arg)) - -/* New version */ -int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); -/* Multi-prime version */ -int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, - BIGNUM *e, BN_GENCB *cb); - -int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, - BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2, - const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2, - const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb); -int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, - BN_GENCB *cb); - -int RSA_check_key(const RSA *); -int RSA_check_key_ex(const RSA *, BN_GENCB *cb); - /* next 4 return -1 on error */ -int RSA_public_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_private_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_public_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_private_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -void RSA_free(RSA *r); -/* "up" the RSA object's reference count */ -int RSA_up_ref(RSA *r); - -int RSA_flags(const RSA *r); - -void RSA_set_default_method(const RSA_METHOD *meth); -const RSA_METHOD *RSA_get_default_method(void); -const RSA_METHOD *RSA_null_method(void); -const RSA_METHOD *RSA_get_method(const RSA *rsa); -int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); - -/* these are the actual RSA functions */ -const RSA_METHOD *RSA_PKCS1_OpenSSL(void); - -int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); - -DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) -DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) - -struct rsa_pss_params_st { - X509_ALGOR *hashAlgorithm; - X509_ALGOR *maskGenAlgorithm; - ASN1_INTEGER *saltLength; - ASN1_INTEGER *trailerField; - /* Decoded hash algorithm from maskGenAlgorithm */ - X509_ALGOR *maskHash; -}; - -DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) - -typedef struct rsa_oaep_params_st { - X509_ALGOR *hashFunc; - X509_ALGOR *maskGenFunc; - X509_ALGOR *pSourceFunc; - /* Decoded hash algorithm from maskGenFunc */ - X509_ALGOR *maskHash; -} RSA_OAEP_PARAMS; - -DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) - -# ifndef OPENSSL_NO_STDIO -int RSA_print_fp(FILE *fp, const RSA *r, int offset); -# endif - -int RSA_print(BIO *bp, const RSA *r, int offset); - -/* - * The following 2 functions sign and verify a X509_SIG ASN1 object inside - * PKCS#1 padded RSA encryption - */ -int RSA_sign(int type, const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, RSA *rsa); -int RSA_verify(int type, const unsigned char *m, unsigned int m_length, - const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); - -/* - * The following 2 function sign and verify a ASN1_OCTET_STRING object inside - * PKCS#1 padded RSA encryption - */ -int RSA_sign_ASN1_OCTET_STRING(int type, - const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - RSA *rsa); -int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, - unsigned int m_length, unsigned char *sigbuf, - unsigned int siglen, RSA *rsa); - -int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); -void RSA_blinding_off(RSA *rsa); -BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); - -int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, - const unsigned char *f, int fl, - int rsa_len); -int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, - const unsigned char *f, int fl, - int rsa_len); -int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, - long seedlen, const EVP_MD *dgst); -int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, - const unsigned char *f, int fl, - const unsigned char *p, int pl); -int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len, - const unsigned char *p, int pl); -int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, - const unsigned char *from, int flen, - const unsigned char *param, int plen, - const EVP_MD *md, const EVP_MD *mgf1md); -int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, - const unsigned char *from, int flen, - int num, const unsigned char *param, - int plen, const EVP_MD *md, - const EVP_MD *mgf1md); -int RSA_padding_add_SSLv23(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_SSLv23(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f, - int fl); -int RSA_padding_check_none(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f, - int fl); -int RSA_padding_check_X931(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_X931_hash_id(int nid); - -int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, - const EVP_MD *Hash, const unsigned char *EM, - int sLen); -int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, - const unsigned char *mHash, const EVP_MD *Hash, - int sLen); - -int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - const unsigned char *EM, int sLen); - -int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, - const unsigned char *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - int sLen); - -#define RSA_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef) -int RSA_set_ex_data(RSA *r, int idx, void *arg); -void *RSA_get_ex_data(const RSA *r, int idx); - -RSA *RSAPublicKey_dup(RSA *rsa); -RSA *RSAPrivateKey_dup(RSA *rsa); - -/* - * If this flag is set the RSA method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define RSA_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define RSA_FLAG_NON_FIPS_ALLOW 0x0400 -/* - * Application has decided PRNG is good enough to generate a key: don't - * check. - */ -# define RSA_FLAG_CHECKED 0x0800 - -RSA_METHOD *RSA_meth_new(const char *name, int flags); -void RSA_meth_free(RSA_METHOD *meth); -RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth); -const char *RSA_meth_get0_name(const RSA_METHOD *meth); -int RSA_meth_set1_name(RSA_METHOD *meth, const char *name); -int RSA_meth_get_flags(const RSA_METHOD *meth); -int RSA_meth_set_flags(RSA_METHOD *meth, int flags); -void *RSA_meth_get0_app_data(const RSA_METHOD *meth); -int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data); -int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_pub_enc(RSA_METHOD *rsa, - int (*pub_enc) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_pub_dec(RSA_METHOD *rsa, - int (*pub_dec) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_priv_enc(RSA_METHOD *rsa, - int (*priv_enc) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_priv_dec(RSA_METHOD *rsa, - int (*priv_dec) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth)) - (BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); -int RSA_meth_set_mod_exp(RSA_METHOD *rsa, - int (*mod_exp) (BIGNUM *r0, const BIGNUM *i, RSA *rsa, - BN_CTX *ctx)); -int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth)) - (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa, - int (*bn_mod_exp) (BIGNUM *r, - const BIGNUM *a, - const BIGNUM *p, - const BIGNUM *m, - BN_CTX *ctx, - BN_MONT_CTX *m_ctx)); -int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa); -int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa)); -int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa); -int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa)); -int (*RSA_meth_get_sign(const RSA_METHOD *meth)) - (int type, - const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - const RSA *rsa); -int RSA_meth_set_sign(RSA_METHOD *rsa, - int (*sign) (int type, const unsigned char *m, - unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - const RSA *rsa)); -int (*RSA_meth_get_verify(const RSA_METHOD *meth)) - (int dtype, const unsigned char *m, - unsigned int m_length, const unsigned char *sigbuf, - unsigned int siglen, const RSA *rsa); -int RSA_meth_set_verify(RSA_METHOD *rsa, - int (*verify) (int dtype, const unsigned char *m, - unsigned int m_length, - const unsigned char *sigbuf, - unsigned int siglen, const RSA *rsa)); -int (*RSA_meth_get_keygen(const RSA_METHOD *meth)) - (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); -int RSA_meth_set_keygen(RSA_METHOD *rsa, - int (*keygen) (RSA *rsa, int bits, BIGNUM *e, - BN_GENCB *cb)); -int (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth)) - (RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb); -int RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth, - int (*keygen) (RSA *rsa, int bits, - int primes, BIGNUM *e, - BN_GENCB *cb)); - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/rsaerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/rsaerr.h deleted file mode 100644 index 59b15e13..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/rsaerr.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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_RSAERR_H -# define HEADER_RSAERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_RSA_strings(void); - -/* - * RSA function codes. - */ -# define RSA_F_CHECK_PADDING_MD 140 -# define RSA_F_ENCODE_PKCS1 146 -# define RSA_F_INT_RSA_VERIFY 145 -# define RSA_F_OLD_RSA_PRIV_DECODE 147 -# define RSA_F_PKEY_PSS_INIT 165 -# define RSA_F_PKEY_RSA_CTRL 143 -# define RSA_F_PKEY_RSA_CTRL_STR 144 -# define RSA_F_PKEY_RSA_SIGN 142 -# define RSA_F_PKEY_RSA_VERIFY 149 -# define RSA_F_PKEY_RSA_VERIFYRECOVER 141 -# define RSA_F_RSA_ALGOR_TO_MD 156 -# define RSA_F_RSA_BUILTIN_KEYGEN 129 -# define RSA_F_RSA_CHECK_KEY 123 -# define RSA_F_RSA_CHECK_KEY_EX 160 -# define RSA_F_RSA_CMS_DECRYPT 159 -# define RSA_F_RSA_CMS_VERIFY 158 -# define RSA_F_RSA_ITEM_VERIFY 148 -# define RSA_F_RSA_METH_DUP 161 -# define RSA_F_RSA_METH_NEW 162 -# define RSA_F_RSA_METH_SET1_NAME 163 -# define RSA_F_RSA_MGF1_TO_MD 157 -# define RSA_F_RSA_MULTIP_INFO_NEW 166 -# define RSA_F_RSA_NEW_METHOD 106 -# define RSA_F_RSA_NULL 124 -# define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 -# define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 -# define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 -# define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 -# define RSA_F_RSA_OSSL_PRIVATE_DECRYPT 101 -# define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 102 -# define RSA_F_RSA_OSSL_PUBLIC_DECRYPT 103 -# define RSA_F_RSA_OSSL_PUBLIC_ENCRYPT 104 -# define RSA_F_RSA_PADDING_ADD_NONE 107 -# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 -# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 154 -# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 -# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 152 -# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 -# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 -# define RSA_F_RSA_PADDING_ADD_SSLV23 110 -# define RSA_F_RSA_PADDING_ADD_X931 127 -# define RSA_F_RSA_PADDING_CHECK_NONE 111 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 153 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 -# define RSA_F_RSA_PADDING_CHECK_SSLV23 114 -# define RSA_F_RSA_PADDING_CHECK_X931 128 -# define RSA_F_RSA_PARAM_DECODE 164 -# define RSA_F_RSA_PRINT 115 -# define RSA_F_RSA_PRINT_FP 116 -# define RSA_F_RSA_PRIV_DECODE 150 -# define RSA_F_RSA_PRIV_ENCODE 138 -# define RSA_F_RSA_PSS_GET_PARAM 151 -# define RSA_F_RSA_PSS_TO_CTX 155 -# define RSA_F_RSA_PUB_DECODE 139 -# define RSA_F_RSA_SETUP_BLINDING 136 -# define RSA_F_RSA_SIGN 117 -# define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 -# define RSA_F_RSA_VERIFY 119 -# define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 -# define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 126 -# define RSA_F_SETUP_TBUF 167 - -/* - * RSA reason codes. - */ -# define RSA_R_ALGORITHM_MISMATCH 100 -# define RSA_R_BAD_E_VALUE 101 -# define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 -# define RSA_R_BAD_PAD_BYTE_COUNT 103 -# define RSA_R_BAD_SIGNATURE 104 -# define RSA_R_BLOCK_TYPE_IS_NOT_01 106 -# define RSA_R_BLOCK_TYPE_IS_NOT_02 107 -# define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 -# define RSA_R_DATA_TOO_LARGE 109 -# define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 -# define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 -# define RSA_R_DATA_TOO_SMALL 111 -# define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 -# define RSA_R_DIGEST_DOES_NOT_MATCH 158 -# define RSA_R_DIGEST_NOT_ALLOWED 145 -# define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 -# define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 -# define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 -# define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 -# define RSA_R_FIRST_OCTET_INVALID 133 -# define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 -# define RSA_R_INVALID_DIGEST 157 -# define RSA_R_INVALID_DIGEST_LENGTH 143 -# define RSA_R_INVALID_HEADER 137 -# define RSA_R_INVALID_LABEL 160 -# define RSA_R_INVALID_MESSAGE_LENGTH 131 -# define RSA_R_INVALID_MGF1_MD 156 -# define RSA_R_INVALID_MULTI_PRIME_KEY 167 -# define RSA_R_INVALID_OAEP_PARAMETERS 161 -# define RSA_R_INVALID_PADDING 138 -# define RSA_R_INVALID_PADDING_MODE 141 -# define RSA_R_INVALID_PSS_PARAMETERS 149 -# define RSA_R_INVALID_PSS_SALTLEN 146 -# define RSA_R_INVALID_SALT_LENGTH 150 -# define RSA_R_INVALID_TRAILER 139 -# define RSA_R_INVALID_X931_DIGEST 142 -# define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 -# define RSA_R_KEY_PRIME_NUM_INVALID 165 -# define RSA_R_KEY_SIZE_TOO_SMALL 120 -# define RSA_R_LAST_OCTET_INVALID 134 -# define RSA_R_MISSING_PRIVATE_KEY 179 -# define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 -# define RSA_R_MODULUS_TOO_LARGE 105 -# define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 -# define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 -# define RSA_R_MP_R_NOT_PRIME 170 -# define RSA_R_NO_PUBLIC_EXPONENT 140 -# define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 -# define RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES 172 -# define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 -# define RSA_R_OAEP_DECODING_ERROR 121 -# define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 -# define RSA_R_PADDING_CHECK_FAILED 114 -# define RSA_R_PKCS_DECODING_ERROR 159 -# define RSA_R_PSS_SALTLEN_TOO_SMALL 164 -# define RSA_R_P_NOT_PRIME 128 -# define RSA_R_Q_NOT_PRIME 129 -# define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 -# define RSA_R_SLEN_CHECK_FAILED 136 -# define RSA_R_SLEN_RECOVERY_FAILED 135 -# define RSA_R_SSLV3_ROLLBACK_ATTACK 115 -# define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 -# define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 -# define RSA_R_UNKNOWN_DIGEST 166 -# define RSA_R_UNKNOWN_MASK_DIGEST 151 -# define RSA_R_UNKNOWN_PADDING_TYPE 118 -# define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162 -# define RSA_R_UNSUPPORTED_LABEL_SOURCE 163 -# define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 -# define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 -# define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 -# define RSA_R_VALUE_MISSING 147 -# define RSA_R_WRONG_SIGNATURE_LENGTH 119 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/safestack.h b/Hin2n/src/main/jniLibs/x86/include/openssl/safestack.h deleted file mode 100644 index 38b55789..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/safestack.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 1999-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_SAFESTACK_H -# define HEADER_SAFESTACK_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define STACK_OF(type) struct stack_st_##type - -# define SKM_DEFINE_STACK_OF(t1, t2, t3) \ - STACK_OF(t1); \ - typedef int (*sk_##t1##_compfunc)(const t3 * const *a, const t3 *const *b); \ - typedef void (*sk_##t1##_freefunc)(t3 *a); \ - typedef t3 * (*sk_##t1##_copyfunc)(const t3 *a); \ - static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk) \ - { \ - return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx) \ - { \ - return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n) \ - { \ - return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_free((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_zero((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i) \ - { \ - return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \ - (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \ - { \ - return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk) \ - { \ - return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc) \ - { \ - OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \ - { \ - return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \ - { \ - return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_sort((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk) \ - { \ - return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \ - sk_##t1##_copyfunc copyfunc, \ - sk_##t1##_freefunc freefunc) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \ - (OPENSSL_sk_copyfunc)copyfunc, \ - (OPENSSL_sk_freefunc)freefunc); \ - } \ - static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare) \ - { \ - return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare); \ - } - -# define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2) -# define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t) -# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \ - SKM_DEFINE_STACK_OF(t1, const t2, t2) -# define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t) - -/*- - * Strings are special: normally an lhash entry will point to a single - * (somewhat) mutable object. In the case of strings: - * - * a) Instead of a single char, there is an array of chars, NUL-terminated. - * b) The string may have be immutable. - * - * So, they need their own declarations. Especially important for - * type-checking tools, such as Deputy. - * - * In practice, however, it appears to be hard to have a const - * string. For now, I'm settling for dealing with the fact it is a - * string at all. - */ -typedef char *OPENSSL_STRING; -typedef const char *OPENSSL_CSTRING; - -/*- - * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but - * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned - * above, instead of a single char each entry is a NUL-terminated array of - * chars. So, we have to implement STRING specially for STACK_OF. This is - * dealt with in the autogenerated macros below. - */ -DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char) -DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char) - -/* - * Similarly, we sometimes use a block of characters, NOT nul-terminated. - * These should also be distinguished from "normal" stacks. - */ -typedef void *OPENSSL_BLOCK; -DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) - -/* - * If called without higher optimization (min. -xO3) the Oracle Developer - * Studio compiler generates code for the defined (static inline) functions - * above. - * This would later lead to the linker complaining about missing symbols when - * this header file is included but the resulting object is not linked against - * the Crypto library (openssl#6912). - */ -# ifdef __SUNPRO_C -# pragma weak OPENSSL_sk_num -# pragma weak OPENSSL_sk_value -# pragma weak OPENSSL_sk_new -# pragma weak OPENSSL_sk_new_null -# pragma weak OPENSSL_sk_new_reserve -# pragma weak OPENSSL_sk_reserve -# pragma weak OPENSSL_sk_free -# pragma weak OPENSSL_sk_zero -# pragma weak OPENSSL_sk_delete -# pragma weak OPENSSL_sk_delete_ptr -# pragma weak OPENSSL_sk_push -# pragma weak OPENSSL_sk_unshift -# pragma weak OPENSSL_sk_pop -# pragma weak OPENSSL_sk_shift -# pragma weak OPENSSL_sk_pop_free -# pragma weak OPENSSL_sk_insert -# pragma weak OPENSSL_sk_set -# pragma weak OPENSSL_sk_find -# pragma weak OPENSSL_sk_find_ex -# pragma weak OPENSSL_sk_sort -# pragma weak OPENSSL_sk_is_sorted -# pragma weak OPENSSL_sk_dup -# pragma weak OPENSSL_sk_deep_copy -# pragma weak OPENSSL_sk_set_cmp_func -# endif /* __SUNPRO_C */ - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/seed.h b/Hin2n/src/main/jniLibs/x86/include/openssl/seed.h deleted file mode 100644 index de10b085..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/seed.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2007-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 - */ - -/* - * Copyright (c) 2007 KISA(Korea Information Security Agency). 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. Neither the name of author nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``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 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. - */ - -#ifndef HEADER_SEED_H -# define HEADER_SEED_H - -# include - -# ifndef OPENSSL_NO_SEED -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* look whether we need 'long' to get 32 bits */ -# ifdef AES_LONG -# ifndef SEED_LONG -# define SEED_LONG 1 -# endif -# endif - -# include - -# define SEED_BLOCK_SIZE 16 -# define SEED_KEY_LENGTH 16 - -typedef struct seed_key_st { -# ifdef SEED_LONG - unsigned long data[32]; -# else - unsigned int data[32]; -# endif -} SEED_KEY_SCHEDULE; - -void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], - SEED_KEY_SCHEDULE *ks); - -void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], - unsigned char d[SEED_BLOCK_SIZE], - const SEED_KEY_SCHEDULE *ks); -void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], - unsigned char d[SEED_BLOCK_SIZE], - const SEED_KEY_SCHEDULE *ks); - -void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, - const SEED_KEY_SCHEDULE *ks, int enc); -void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, - const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int enc); -void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int *num, - int enc); -void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/sha.h b/Hin2n/src/main/jniLibs/x86/include/openssl/sha.h deleted file mode 100644 index 6a1eb0de..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/sha.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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_SHA_H -# define HEADER_SHA_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! SHA_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define SHA_LONG unsigned int - -# define SHA_LBLOCK 16 -# define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a - * contiguous array of 32 bit wide - * big-endian values. */ -# define SHA_LAST_BLOCK (SHA_CBLOCK-8) -# define SHA_DIGEST_LENGTH 20 - -typedef struct SHAstate_st { - SHA_LONG h0, h1, h2, h3, h4; - SHA_LONG Nl, Nh; - SHA_LONG data[SHA_LBLOCK]; - unsigned int num; -} SHA_CTX; - -int SHA1_Init(SHA_CTX *c); -int SHA1_Update(SHA_CTX *c, const void *data, size_t len); -int SHA1_Final(unsigned char *md, SHA_CTX *c); -unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); -void SHA1_Transform(SHA_CTX *c, const unsigned char *data); - -# define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a - * contiguous array of 32 bit wide - * big-endian values. */ - -typedef struct SHA256state_st { - SHA_LONG h[8]; - SHA_LONG Nl, Nh; - SHA_LONG data[SHA_LBLOCK]; - unsigned int num, md_len; -} SHA256_CTX; - -int SHA224_Init(SHA256_CTX *c); -int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA224_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); -int SHA256_Init(SHA256_CTX *c); -int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA256_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); -void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); - -# define SHA224_DIGEST_LENGTH 28 -# define SHA256_DIGEST_LENGTH 32 -# define SHA384_DIGEST_LENGTH 48 -# define SHA512_DIGEST_LENGTH 64 - -/* - * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 - * being exactly 64-bit wide. See Implementation Notes in sha512.c - * for further details. - */ -/* - * SHA-512 treats input data as a - * contiguous array of 64 bit - * wide big-endian values. - */ -# define SHA512_CBLOCK (SHA_LBLOCK*8) -# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -# define SHA_LONG64 unsigned __int64 -# define U64(C) C##UI64 -# elif defined(__arch64__) -# define SHA_LONG64 unsigned long -# define U64(C) C##UL -# else -# define SHA_LONG64 unsigned long long -# define U64(C) C##ULL -# endif - -typedef struct SHA512state_st { - SHA_LONG64 h[8]; - SHA_LONG64 Nl, Nh; - union { - SHA_LONG64 d[SHA_LBLOCK]; - unsigned char p[SHA512_CBLOCK]; - } u; - unsigned int num, md_len; -} SHA512_CTX; - -int SHA384_Init(SHA512_CTX *c); -int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA384_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); -int SHA512_Init(SHA512_CTX *c); -int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA512_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); -void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/srp.h b/Hin2n/src/main/jniLibs/x86/include/openssl/srp.h deleted file mode 100644 index aaf13558..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/srp.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2004, EdelKey Project. 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 - * - * Originally written by Christophe Renou and Peter Sylvester, - * for the EdelKey project. - */ - -#ifndef HEADER_SRP_H -# define HEADER_SRP_H - -#include - -#ifndef OPENSSL_NO_SRP -# include -# include -# include -# include -# include - -# ifdef __cplusplus -extern "C" { -# endif - -typedef struct SRP_gN_cache_st { - char *b64_bn; - BIGNUM *bn; -} SRP_gN_cache; - - -DEFINE_STACK_OF(SRP_gN_cache) - -typedef struct SRP_user_pwd_st { - /* Owned by us. */ - char *id; - BIGNUM *s; - BIGNUM *v; - /* Not owned by us. */ - const BIGNUM *g; - const BIGNUM *N; - /* Owned by us. */ - char *info; -} SRP_user_pwd; - -void SRP_user_pwd_free(SRP_user_pwd *user_pwd); - -DEFINE_STACK_OF(SRP_user_pwd) - -typedef struct SRP_VBASE_st { - STACK_OF(SRP_user_pwd) *users_pwd; - STACK_OF(SRP_gN_cache) *gN_cache; -/* to simulate a user */ - char *seed_key; - const BIGNUM *default_g; - const BIGNUM *default_N; -} SRP_VBASE; - -/* - * Internal structure storing N and g pair - */ -typedef struct SRP_gN_st { - char *id; - const BIGNUM *g; - const BIGNUM *N; -} SRP_gN; - -DEFINE_STACK_OF(SRP_gN) - -SRP_VBASE *SRP_VBASE_new(char *seed_key); -void SRP_VBASE_free(SRP_VBASE *vb); -int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); - -/* This method ignores the configured seed and fails for an unknown user. */ -DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)) -/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ -SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); - -char *SRP_create_verifier(const char *user, const char *pass, char **salt, - char **verifier, const char *N, const char *g); -int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, - BIGNUM **verifier, const BIGNUM *N, - const BIGNUM *g); - -# define SRP_NO_ERROR 0 -# define SRP_ERR_VBASE_INCOMPLETE_FILE 1 -# define SRP_ERR_VBASE_BN_LIB 2 -# define SRP_ERR_OPEN_FILE 3 -# define SRP_ERR_MEMORY 4 - -# define DB_srptype 0 -# define DB_srpverifier 1 -# define DB_srpsalt 2 -# define DB_srpid 3 -# define DB_srpgN 4 -# define DB_srpinfo 5 -# undef DB_NUMBER -# define DB_NUMBER 6 - -# define DB_SRP_INDEX 'I' -# define DB_SRP_VALID 'V' -# define DB_SRP_REVOKED 'R' -# define DB_SRP_MODIF 'v' - -/* see srp.c */ -char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N); -SRP_gN *SRP_get_default_gN(const char *id); - -/* server side .... */ -BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, - const BIGNUM *b, const BIGNUM *N); -BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, - const BIGNUM *v); -int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N); -BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N); - -/* client side .... */ -BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass); -BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g); -BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, - const BIGNUM *x, const BIGNUM *a, const BIGNUM *u); -int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N); - -# define SRP_MINIMAL_N 1024 - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/srtp.h b/Hin2n/src/main/jniLibs/x86/include/openssl/srtp.h deleted file mode 100644 index 0b57c235..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/srtp.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011-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 - */ - -/* - * DTLS code by Eric Rescorla - * - * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. - */ - -#ifndef HEADER_D1_SRTP_H -# define HEADER_D1_SRTP_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define SRTP_AES128_CM_SHA1_80 0x0001 -# define SRTP_AES128_CM_SHA1_32 0x0002 -# define SRTP_AES128_F8_SHA1_80 0x0003 -# define SRTP_AES128_F8_SHA1_32 0x0004 -# define SRTP_NULL_SHA1_80 0x0005 -# define SRTP_NULL_SHA1_32 0x0006 - -/* AEAD SRTP protection profiles from RFC 7714 */ -# define SRTP_AEAD_AES_128_GCM 0x0007 -# define SRTP_AEAD_AES_256_GCM 0x0008 - -# ifndef OPENSSL_NO_SRTP - -__owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); -__owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); - -__owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); -__owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); - -# endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ssl.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ssl.h deleted file mode 100644 index 6724ccf2..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ssl.h +++ /dev/null @@ -1,2438 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved - * Copyright 2005 Nokia. 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_SSL_H -# define HEADER_SSL_H - -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# endif -# include -# include -# include -# include - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* OpenSSL version number for ASN.1 encoding of the session information */ -/*- - * Version 0 - initial version - * Version 1 - added the optional peer certificate - */ -# define SSL_SESSION_ASN1_VERSION 0x0001 - -# define SSL_MAX_SSL_SESSION_ID_LENGTH 32 -# define SSL_MAX_SID_CTX_LENGTH 32 - -# define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) -# define SSL_MAX_KEY_ARG_LENGTH 8 -# define SSL_MAX_MASTER_KEY_LENGTH 48 - -/* The maximum number of encrypt/decrypt pipelines we can support */ -# define SSL_MAX_PIPELINES 32 - -/* text strings for the ciphers */ - -/* These are used to specify which ciphers to use and not to use */ - -# define SSL_TXT_LOW "LOW" -# define SSL_TXT_MEDIUM "MEDIUM" -# define SSL_TXT_HIGH "HIGH" -# define SSL_TXT_FIPS "FIPS" - -# define SSL_TXT_aNULL "aNULL" -# define SSL_TXT_eNULL "eNULL" -# define SSL_TXT_NULL "NULL" - -# define SSL_TXT_kRSA "kRSA" -# define SSL_TXT_kDHr "kDHr"/* this cipher class has been removed */ -# define SSL_TXT_kDHd "kDHd"/* this cipher class has been removed */ -# define SSL_TXT_kDH "kDH"/* this cipher class has been removed */ -# define SSL_TXT_kEDH "kEDH"/* alias for kDHE */ -# define SSL_TXT_kDHE "kDHE" -# define SSL_TXT_kECDHr "kECDHr"/* this cipher class has been removed */ -# define SSL_TXT_kECDHe "kECDHe"/* this cipher class has been removed */ -# define SSL_TXT_kECDH "kECDH"/* this cipher class has been removed */ -# define SSL_TXT_kEECDH "kEECDH"/* alias for kECDHE */ -# define SSL_TXT_kECDHE "kECDHE" -# define SSL_TXT_kPSK "kPSK" -# define SSL_TXT_kRSAPSK "kRSAPSK" -# define SSL_TXT_kECDHEPSK "kECDHEPSK" -# define SSL_TXT_kDHEPSK "kDHEPSK" -# define SSL_TXT_kGOST "kGOST" -# define SSL_TXT_kSRP "kSRP" - -# define SSL_TXT_aRSA "aRSA" -# define SSL_TXT_aDSS "aDSS" -# define SSL_TXT_aDH "aDH"/* this cipher class has been removed */ -# define SSL_TXT_aECDH "aECDH"/* this cipher class has been removed */ -# define SSL_TXT_aECDSA "aECDSA" -# define SSL_TXT_aPSK "aPSK" -# define SSL_TXT_aGOST94 "aGOST94" -# define SSL_TXT_aGOST01 "aGOST01" -# define SSL_TXT_aGOST12 "aGOST12" -# define SSL_TXT_aGOST "aGOST" -# define SSL_TXT_aSRP "aSRP" - -# define SSL_TXT_DSS "DSS" -# define SSL_TXT_DH "DH" -# define SSL_TXT_DHE "DHE"/* same as "kDHE:-ADH" */ -# define SSL_TXT_EDH "EDH"/* alias for DHE */ -# define SSL_TXT_ADH "ADH" -# define SSL_TXT_RSA "RSA" -# define SSL_TXT_ECDH "ECDH" -# define SSL_TXT_EECDH "EECDH"/* alias for ECDHE" */ -# define SSL_TXT_ECDHE "ECDHE"/* same as "kECDHE:-AECDH" */ -# define SSL_TXT_AECDH "AECDH" -# define SSL_TXT_ECDSA "ECDSA" -# define SSL_TXT_PSK "PSK" -# define SSL_TXT_SRP "SRP" - -# define SSL_TXT_DES "DES" -# define SSL_TXT_3DES "3DES" -# define SSL_TXT_RC4 "RC4" -# define SSL_TXT_RC2 "RC2" -# define SSL_TXT_IDEA "IDEA" -# define SSL_TXT_SEED "SEED" -# define SSL_TXT_AES128 "AES128" -# define SSL_TXT_AES256 "AES256" -# define SSL_TXT_AES "AES" -# define SSL_TXT_AES_GCM "AESGCM" -# define SSL_TXT_AES_CCM "AESCCM" -# define SSL_TXT_AES_CCM_8 "AESCCM8" -# define SSL_TXT_CAMELLIA128 "CAMELLIA128" -# define SSL_TXT_CAMELLIA256 "CAMELLIA256" -# define SSL_TXT_CAMELLIA "CAMELLIA" -# define SSL_TXT_CHACHA20 "CHACHA20" -# define SSL_TXT_GOST "GOST89" -# define SSL_TXT_ARIA "ARIA" -# define SSL_TXT_ARIA_GCM "ARIAGCM" -# define SSL_TXT_ARIA128 "ARIA128" -# define SSL_TXT_ARIA256 "ARIA256" - -# define SSL_TXT_MD5 "MD5" -# define SSL_TXT_SHA1 "SHA1" -# define SSL_TXT_SHA "SHA"/* same as "SHA1" */ -# define SSL_TXT_GOST94 "GOST94" -# define SSL_TXT_GOST89MAC "GOST89MAC" -# define SSL_TXT_GOST12 "GOST12" -# define SSL_TXT_GOST89MAC12 "GOST89MAC12" -# define SSL_TXT_SHA256 "SHA256" -# define SSL_TXT_SHA384 "SHA384" - -# define SSL_TXT_SSLV3 "SSLv3" -# define SSL_TXT_TLSV1 "TLSv1" -# define SSL_TXT_TLSV1_1 "TLSv1.1" -# define SSL_TXT_TLSV1_2 "TLSv1.2" - -# define SSL_TXT_ALL "ALL" - -/*- - * COMPLEMENTOF* definitions. These identifiers are used to (de-select) - * ciphers normally not being used. - * Example: "RC4" will activate all ciphers using RC4 including ciphers - * without authentication, which would normally disabled by DEFAULT (due - * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" - * will make sure that it is also disabled in the specific selection. - * COMPLEMENTOF* identifiers are portable between version, as adjustments - * to the default cipher setup will also be included here. - * - * COMPLEMENTOFDEFAULT does not experience the same special treatment that - * DEFAULT gets, as only selection is being done and no sorting as needed - * for DEFAULT. - */ -# define SSL_TXT_CMPALL "COMPLEMENTOFALL" -# define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" - -/* - * The following cipher list is used by default. It also is substituted when - * an application-defined cipher list string starts with 'DEFAULT'. - * This applies to ciphersuites for TLSv1.2 and below. - */ -# define SSL_DEFAULT_CIPHER_LIST "ALL:!COMPLEMENTOFDEFAULT:!eNULL" -/* This is the default set of TLSv1.3 ciphersuites */ -# if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) -# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ - "TLS_CHACHA20_POLY1305_SHA256:" \ - "TLS_AES_128_GCM_SHA256" -# else -# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ - "TLS_AES_128_GCM_SHA256" -#endif -/* - * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always - * starts with a reasonable order, and all we have to do for DEFAULT is - * throwing out anonymous and unencrypted ciphersuites! (The latter are not - * actually enabled by ALL, but "ALL:RSA" would enable some of them.) - */ - -/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ -# define SSL_SENT_SHUTDOWN 1 -# define SSL_RECEIVED_SHUTDOWN 2 - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -# define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 -# define SSL_FILETYPE_PEM X509_FILETYPE_PEM - -/* - * This is needed to stop compilers complaining about the 'struct ssl_st *' - * function parameters used to prototype callbacks in SSL_CTX. - */ -typedef struct ssl_st *ssl_crock_st; -typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; -typedef struct ssl_method_st SSL_METHOD; -typedef struct ssl_cipher_st SSL_CIPHER; -typedef struct ssl_session_st SSL_SESSION; -typedef struct tls_sigalgs_st TLS_SIGALGS; -typedef struct ssl_conf_ctx_st SSL_CONF_CTX; -typedef struct ssl_comp_st SSL_COMP; - -STACK_OF(SSL_CIPHER); -STACK_OF(SSL_COMP); - -/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ -typedef struct srtp_protection_profile_st { - const char *name; - unsigned long id; -} SRTP_PROTECTION_PROFILE; - -DEFINE_STACK_OF(SRTP_PROTECTION_PROFILE) - -typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, - int len, void *arg); -typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, - STACK_OF(SSL_CIPHER) *peer_ciphers, - const SSL_CIPHER **cipher, void *arg); - -/* Extension context codes */ -/* This extension is only allowed in TLS */ -#define SSL_EXT_TLS_ONLY 0x0001 -/* This extension is only allowed in DTLS */ -#define SSL_EXT_DTLS_ONLY 0x0002 -/* Some extensions may be allowed in DTLS but we don't implement them for it */ -#define SSL_EXT_TLS_IMPLEMENTATION_ONLY 0x0004 -/* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */ -#define SSL_EXT_SSL3_ALLOWED 0x0008 -/* Extension is only defined for TLS1.2 and below */ -#define SSL_EXT_TLS1_2_AND_BELOW_ONLY 0x0010 -/* Extension is only defined for TLS1.3 and above */ -#define SSL_EXT_TLS1_3_ONLY 0x0020 -/* Ignore this extension during parsing if we are resuming */ -#define SSL_EXT_IGNORE_ON_RESUMPTION 0x0040 -#define SSL_EXT_CLIENT_HELLO 0x0080 -/* Really means TLS1.2 or below */ -#define SSL_EXT_TLS1_2_SERVER_HELLO 0x0100 -#define SSL_EXT_TLS1_3_SERVER_HELLO 0x0200 -#define SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS 0x0400 -#define SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST 0x0800 -#define SSL_EXT_TLS1_3_CERTIFICATE 0x1000 -#define SSL_EXT_TLS1_3_NEW_SESSION_TICKET 0x2000 -#define SSL_EXT_TLS1_3_CERTIFICATE_REQUEST 0x4000 - -/* Typedefs for handling custom extensions */ - -typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type, - const unsigned char **out, size_t *outlen, - int *al, void *add_arg); - -typedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type, - const unsigned char *out, void *add_arg); - -typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type, - const unsigned char *in, size_t inlen, - int *al, void *parse_arg); - - -typedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char **out, - size_t *outlen, X509 *x, - size_t chainidx, - int *al, void *add_arg); - -typedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char *out, - void *add_arg); - -typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char *in, - size_t inlen, X509 *x, - size_t chainidx, - int *al, void *parse_arg); - -/* Typedef for verification callback */ -typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); - -/* - * Some values are reserved until OpenSSL 1.2.0 because they were previously - * included in SSL_OP_ALL in a 1.1.x release. - * - * Reserved value (until OpenSSL 1.2.0) 0x00000001U - * Reserved value (until OpenSSL 1.2.0) 0x00000002U - */ -/* Allow initial connection to servers that don't support RI */ -# define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004U - -/* Reserved value (until OpenSSL 1.2.0) 0x00000008U */ -# define SSL_OP_TLSEXT_PADDING 0x00000010U -/* Reserved value (until OpenSSL 1.2.0) 0x00000020U */ -# define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040U -/* - * Reserved value (until OpenSSL 1.2.0) 0x00000080U - * Reserved value (until OpenSSL 1.2.0) 0x00000100U - * Reserved value (until OpenSSL 1.2.0) 0x00000200U - */ - -/* In TLSv1.3 allow a non-(ec)dhe based kex_mode */ -# define SSL_OP_ALLOW_NO_DHE_KEX 0x00000400U - -/* - * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in - * OpenSSL 0.9.6d. Usually (depending on the application protocol) the - * workaround is not needed. Unfortunately some broken SSL/TLS - * implementations cannot handle it at all, which is why we include it in - * SSL_OP_ALL. Added in 0.9.6e - */ -# define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800U - -/* DTLS options */ -# define SSL_OP_NO_QUERY_MTU 0x00001000U -/* Turn on Cookie Exchange (on relevant for servers) */ -# define SSL_OP_COOKIE_EXCHANGE 0x00002000U -/* Don't use RFC4507 ticket extension */ -# define SSL_OP_NO_TICKET 0x00004000U -# ifndef OPENSSL_NO_DTLS1_METHOD -/* Use Cisco's "speshul" version of DTLS_BAD_VER - * (only with deprecated DTLSv1_client_method()) */ -# define SSL_OP_CISCO_ANYCONNECT 0x00008000U -# endif - -/* As server, disallow session resumption on renegotiation */ -# define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000U -/* Don't use compression even if supported */ -# define SSL_OP_NO_COMPRESSION 0x00020000U -/* Permit unsafe legacy renegotiation */ -# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000U -/* Disable encrypt-then-mac */ -# define SSL_OP_NO_ENCRYPT_THEN_MAC 0x00080000U - -/* - * Enable TLSv1.3 Compatibility mode. This is on by default. A future version - * of OpenSSL may have this disabled by default. - */ -# define SSL_OP_ENABLE_MIDDLEBOX_COMPAT 0x00100000U - -/* Prioritize Chacha20Poly1305 when client does. - * Modifies SSL_OP_CIPHER_SERVER_PREFERENCE */ -# define SSL_OP_PRIORITIZE_CHACHA 0x00200000U - -/* - * Set on servers to choose the cipher according to the server's preferences - */ -# define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000U -/* - * If set, a server will allow a client to issue a SSLv3.0 version number as - * latest version supported in the premaster secret, even when TLSv1.0 - * (version 3.1) was announced in the client hello. Normally this is - * forbidden to prevent version rollback attacks. - */ -# define SSL_OP_TLS_ROLLBACK_BUG 0x00800000U - -/* - * Switches off automatic TLSv1.3 anti-replay protection for early data. This - * is a server-side option only (no effect on the client). - */ -# define SSL_OP_NO_ANTI_REPLAY 0x01000000U - -# define SSL_OP_NO_SSLv3 0x02000000U -# define SSL_OP_NO_TLSv1 0x04000000U -# define SSL_OP_NO_TLSv1_2 0x08000000U -# define SSL_OP_NO_TLSv1_1 0x10000000U -# define SSL_OP_NO_TLSv1_3 0x20000000U - -# define SSL_OP_NO_DTLSv1 0x04000000U -# define SSL_OP_NO_DTLSv1_2 0x08000000U - -# define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv3|\ - SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2|SSL_OP_NO_TLSv1_3) -# define SSL_OP_NO_DTLS_MASK (SSL_OP_NO_DTLSv1|SSL_OP_NO_DTLSv1_2) - -/* Disallow all renegotiation */ -# define SSL_OP_NO_RENEGOTIATION 0x40000000U - -/* - * Make server add server-hello extension from early version of cryptopro - * draft, when GOST ciphersuite is negotiated. Required for interoperability - * with CryptoPro CSP 3.x - */ -# define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000U - -/* - * SSL_OP_ALL: various bug workarounds that should be rather harmless. - * This used to be 0x000FFFFFL before 0.9.7. - * This used to be 0x80000BFFU before 1.1.1. - */ -# define SSL_OP_ALL (SSL_OP_CRYPTOPRO_TLSEXT_BUG|\ - SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS|\ - SSL_OP_LEGACY_SERVER_CONNECT|\ - SSL_OP_TLSEXT_PADDING|\ - SSL_OP_SAFARI_ECDHE_ECDSA_BUG) - -/* OBSOLETE OPTIONS: retained for compatibility */ - -/* Removed from OpenSSL 1.1.0. Was 0x00000001L */ -/* Related to removed SSLv2. */ -# define SSL_OP_MICROSOFT_SESS_ID_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000002L */ -/* Related to removed SSLv2. */ -# define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x0 -/* Removed from OpenSSL 0.9.8q and 1.0.0c. Was 0x00000008L */ -/* Dead forever, see CVE-2010-4180 */ -# define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x0 -/* Removed from OpenSSL 1.0.1h and 1.0.2. Was 0x00000010L */ -/* Refers to ancient SSLREF and SSLv2. */ -# define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000020 */ -# define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x0 -/* Removed from OpenSSL 0.9.7h and 0.9.8b. Was 0x00000040L */ -# define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000080 */ -/* Ancient SSLeay version. */ -# define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000100L */ -# define SSL_OP_TLS_D5_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000200L */ -# define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00080000L */ -# define SSL_OP_SINGLE_ECDH_USE 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00100000L */ -# define SSL_OP_SINGLE_DH_USE 0x0 -/* Removed from OpenSSL 1.0.1k and 1.0.2. Was 0x00200000L */ -# define SSL_OP_EPHEMERAL_RSA 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x01000000L */ -# define SSL_OP_NO_SSLv2 0x0 -/* Removed from OpenSSL 1.0.1. Was 0x08000000L */ -# define SSL_OP_PKCS1_CHECK_1 0x0 -/* Removed from OpenSSL 1.0.1. Was 0x10000000L */ -# define SSL_OP_PKCS1_CHECK_2 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x20000000L */ -# define SSL_OP_NETSCAPE_CA_DN_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x40000000L */ -# define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x0 - -/* - * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success - * when just a single record has been written): - */ -# define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001U -/* - * Make it possible to retry SSL_write() with changed buffer location (buffer - * contents must stay the same!); this is not the default to avoid the - * misconception that non-blocking SSL_write() behaves like non-blocking - * write(): - */ -# define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002U -/* - * Never bother the application with retries if the transport is blocking: - */ -# define SSL_MODE_AUTO_RETRY 0x00000004U -/* Don't attempt to automatically build certificate chain */ -# define SSL_MODE_NO_AUTO_CHAIN 0x00000008U -/* - * Save RAM by releasing read and write buffers when they're empty. (SSL3 and - * TLS only.) Released buffers are freed. - */ -# define SSL_MODE_RELEASE_BUFFERS 0x00000010U -/* - * Send the current time in the Random fields of the ClientHello and - * ServerHello records for compatibility with hypothetical implementations - * that require it. - */ -# define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020U -# define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040U -/* - * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications - * that reconnect with a downgraded protocol version; see - * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your - * application attempts a normal handshake. Only use this in explicit - * fallback retries, following the guidance in - * draft-ietf-tls-downgrade-scsv-00. - */ -# define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U -/* - * Support Asynchronous operation - */ -# define SSL_MODE_ASYNC 0x00000100U - -/* - * When using DTLS/SCTP, include the terminating zero in the label - * used for computing the endpoint-pair shared secret. Required for - * interoperability with implementations having this bug like these - * older version of OpenSSL: - * - OpenSSL 1.0.0 series - * - OpenSSL 1.0.1 series - * - OpenSSL 1.0.2 series - * - OpenSSL 1.1.0 series - * - OpenSSL 1.1.1 and 1.1.1a - */ -# define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U - -/* Cert related flags */ -/* - * Many implementations ignore some aspects of the TLS standards such as - * enforcing certificate chain algorithms. When this is set we enforce them. - */ -# define SSL_CERT_FLAG_TLS_STRICT 0x00000001U - -/* Suite B modes, takes same values as certificate verify flags */ -# define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 -/* Suite B 192 bit only mode */ -# define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 -/* Suite B 128 bit mode allowing 192 bit algorithms */ -# define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 - -/* Perform all sorts of protocol violations for testing purposes */ -# define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 - -/* Flags for building certificate chains */ -/* Treat any existing certificates as untrusted CAs */ -# define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 -/* Don't include root CA in chain */ -# define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 -/* Just check certificates already there */ -# define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 -/* Ignore verification errors */ -# define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 -/* Clear verification errors from queue */ -# define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 - -/* Flags returned by SSL_check_chain */ -/* Certificate can be used with this session */ -# define CERT_PKEY_VALID 0x1 -/* Certificate can also be used for signing */ -# define CERT_PKEY_SIGN 0x2 -/* EE certificate signing algorithm OK */ -# define CERT_PKEY_EE_SIGNATURE 0x10 -/* CA signature algorithms OK */ -# define CERT_PKEY_CA_SIGNATURE 0x20 -/* EE certificate parameters OK */ -# define CERT_PKEY_EE_PARAM 0x40 -/* CA certificate parameters OK */ -# define CERT_PKEY_CA_PARAM 0x80 -/* Signing explicitly allowed as opposed to SHA1 fallback */ -# define CERT_PKEY_EXPLICIT_SIGN 0x100 -/* Client CA issuer names match (always set for server cert) */ -# define CERT_PKEY_ISSUER_NAME 0x200 -/* Cert type matches client types (always set for server cert) */ -# define CERT_PKEY_CERT_TYPE 0x400 -/* Cert chain suitable to Suite B */ -# define CERT_PKEY_SUITEB 0x800 - -# define SSL_CONF_FLAG_CMDLINE 0x1 -# define SSL_CONF_FLAG_FILE 0x2 -# define SSL_CONF_FLAG_CLIENT 0x4 -# define SSL_CONF_FLAG_SERVER 0x8 -# define SSL_CONF_FLAG_SHOW_ERRORS 0x10 -# define SSL_CONF_FLAG_CERTIFICATE 0x20 -# define SSL_CONF_FLAG_REQUIRE_PRIVATE 0x40 -/* Configuration value types */ -# define SSL_CONF_TYPE_UNKNOWN 0x0 -# define SSL_CONF_TYPE_STRING 0x1 -# define SSL_CONF_TYPE_FILE 0x2 -# define SSL_CONF_TYPE_DIR 0x3 -# define SSL_CONF_TYPE_NONE 0x4 - -/* Maximum length of the application-controlled segment of a a TLSv1.3 cookie */ -# define SSL_COOKIE_LENGTH 4096 - -/* - * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they - * cannot be used to clear bits. - */ - -unsigned long SSL_CTX_get_options(const SSL_CTX *ctx); -unsigned long SSL_get_options(const SSL *s); -unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op); -unsigned long SSL_clear_options(SSL *s, unsigned long op); -unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op); -unsigned long SSL_set_options(SSL *s, unsigned long op); - -# define SSL_CTX_set_mode(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) -# define SSL_CTX_clear_mode(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL) -# define SSL_CTX_get_mode(ctx) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) -# define SSL_clear_mode(ssl,op) \ - SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL) -# define SSL_set_mode(ssl,op) \ - SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) -# define SSL_get_mode(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) -# define SSL_set_mtu(ssl, mtu) \ - SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) -# define DTLS_set_link_mtu(ssl, mtu) \ - SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL) -# define DTLS_get_link_min_mtu(ssl) \ - SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL) - -# define SSL_get_secure_renegotiation_support(ssl) \ - SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) - -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_heartbeat(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT,0,NULL) -# endif - -# define SSL_CTX_set_cert_flags(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL) -# define SSL_set_cert_flags(s,op) \ - SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL) -# define SSL_CTX_clear_cert_flags(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) -# define SSL_clear_cert_flags(s,op) \ - SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) - -void SSL_CTX_set_msg_callback(SSL_CTX *ctx, - void (*cb) (int write_p, int version, - int content_type, const void *buf, - size_t len, SSL *ssl, void *arg)); -void SSL_set_msg_callback(SSL *ssl, - void (*cb) (int write_p, int version, - int content_type, const void *buf, - size_t len, SSL *ssl, void *arg)); -# define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) -# define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) - -# define SSL_get_extms_support(s) \ - SSL_ctrl((s),SSL_CTRL_GET_EXTMS_SUPPORT,0,NULL) - -# ifndef OPENSSL_NO_SRP - -/* see tls_srp.c */ -__owur int SSL_SRP_CTX_init(SSL *s); -__owur int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx); -int SSL_SRP_CTX_free(SSL *ctx); -int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); -__owur int SSL_srp_server_param_with_username(SSL *s, int *ad); -__owur int SRP_Calc_A_param(SSL *s); - -# endif - -/* 100k max cert list */ -# define SSL_MAX_CERT_LIST_DEFAULT 1024*100 - -# define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) - -/* - * This callback type is used inside SSL_CTX, SSL, and in the functions that - * set them. It is used to override the generation of SSL/TLS session IDs in - * a server. Return value should be zero on an error, non-zero to proceed. - * Also, callbacks should themselves check if the id they generate is unique - * otherwise the SSL handshake will fail with an error - callbacks can do - * this using the 'ssl' value they're passed by; - * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in - * is set at the maximum size the session ID can be. In SSLv3/TLSv1 it is 32 - * bytes. The callback can alter this length to be less if desired. It is - * also an error for the callback to set the size to zero. - */ -typedef int (*GEN_SESSION_CB) (SSL *ssl, unsigned char *id, - unsigned int *id_len); - -# define SSL_SESS_CACHE_OFF 0x0000 -# define SSL_SESS_CACHE_CLIENT 0x0001 -# define SSL_SESS_CACHE_SERVER 0x0002 -# define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) -# define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 -/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ -# define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 -# define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 -# define SSL_SESS_CACHE_NO_INTERNAL \ - (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) - -LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); -# define SSL_CTX_sess_number(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) -# define SSL_CTX_sess_connect(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) -# define SSL_CTX_sess_connect_good(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) -# define SSL_CTX_sess_connect_renegotiate(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) -# define SSL_CTX_sess_accept(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) -# define SSL_CTX_sess_accept_renegotiate(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) -# define SSL_CTX_sess_accept_good(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) -# define SSL_CTX_sess_hits(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) -# define SSL_CTX_sess_cb_hits(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) -# define SSL_CTX_sess_misses(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) -# define SSL_CTX_sess_timeouts(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) -# define SSL_CTX_sess_cache_full(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) - -void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, - int (*new_session_cb) (struct ssl_st *ssl, - SSL_SESSION *sess)); -int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, - SSL_SESSION *sess); -void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, - void (*remove_session_cb) (struct ssl_ctx_st - *ctx, - SSL_SESSION *sess)); -void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx, - SSL_SESSION *sess); -void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, - SSL_SESSION *(*get_session_cb) (struct ssl_st - *ssl, - const unsigned char - *data, int len, - int *copy)); -SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, - const unsigned char *data, - int len, int *copy); -void SSL_CTX_set_info_callback(SSL_CTX *ctx, - void (*cb) (const SSL *ssl, int type, int val)); -void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, - int val); -void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, - int (*client_cert_cb) (SSL *ssl, X509 **x509, - EVP_PKEY **pkey)); -int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509, - EVP_PKEY **pkey); -# ifndef OPENSSL_NO_ENGINE -__owur int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); -# endif -void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, - int (*app_gen_cookie_cb) (SSL *ssl, - unsigned char - *cookie, - unsigned int - *cookie_len)); -void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, - int (*app_verify_cookie_cb) (SSL *ssl, - const unsigned - char *cookie, - unsigned int - cookie_len)); - -void SSL_CTX_set_stateless_cookie_generate_cb( - SSL_CTX *ctx, - int (*gen_stateless_cookie_cb) (SSL *ssl, - unsigned char *cookie, - size_t *cookie_len)); -void SSL_CTX_set_stateless_cookie_verify_cb( - SSL_CTX *ctx, - int (*verify_stateless_cookie_cb) (SSL *ssl, - const unsigned char *cookie, - size_t cookie_len)); -# ifndef OPENSSL_NO_NEXTPROTONEG - -typedef int (*SSL_CTX_npn_advertised_cb_func)(SSL *ssl, - const unsigned char **out, - unsigned int *outlen, - void *arg); -void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, - SSL_CTX_npn_advertised_cb_func cb, - void *arg); -# define SSL_CTX_set_npn_advertised_cb SSL_CTX_set_next_protos_advertised_cb - -typedef int (*SSL_CTX_npn_select_cb_func)(SSL *s, - unsigned char **out, - unsigned char *outlen, - const unsigned char *in, - unsigned int inlen, - void *arg); -void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, - SSL_CTX_npn_select_cb_func cb, - void *arg); -# define SSL_CTX_set_npn_select_cb SSL_CTX_set_next_proto_select_cb - -void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, - unsigned *len); -# define SSL_get0_npn_negotiated SSL_get0_next_proto_negotiated -# endif - -__owur int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, - const unsigned char *in, unsigned int inlen, - const unsigned char *client, - unsigned int client_len); - -# define OPENSSL_NPN_UNSUPPORTED 0 -# define OPENSSL_NPN_NEGOTIATED 1 -# define OPENSSL_NPN_NO_OVERLAP 2 - -__owur int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, - unsigned int protos_len); -__owur int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, - unsigned int protos_len); -typedef int (*SSL_CTX_alpn_select_cb_func)(SSL *ssl, - const unsigned char **out, - unsigned char *outlen, - const unsigned char *in, - unsigned int inlen, - void *arg); -void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, - SSL_CTX_alpn_select_cb_func cb, - void *arg); -void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, - unsigned int *len); - -# ifndef OPENSSL_NO_PSK -/* - * the maximum length of the buffer given to callbacks containing the - * resulting identity/psk - */ -# define PSK_MAX_IDENTITY_LEN 128 -# define PSK_MAX_PSK_LEN 256 -typedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl, - const char *hint, - char *identity, - unsigned int max_identity_len, - unsigned char *psk, - unsigned int max_psk_len); -void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb); -void SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb); - -typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl, - const char *identity, - unsigned char *psk, - unsigned int max_psk_len); -void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb); -void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb); - -__owur int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); -__owur int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); -const char *SSL_get_psk_identity_hint(const SSL *s); -const char *SSL_get_psk_identity(const SSL *s); -# endif - -typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl, - const unsigned char *identity, - size_t identity_len, - SSL_SESSION **sess); -typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md, - const unsigned char **id, - size_t *idlen, - SSL_SESSION **sess); - -void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb); -void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, - SSL_psk_find_session_cb_func cb); -void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb); -void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, - SSL_psk_use_session_cb_func cb); - -/* Register callbacks to handle custom TLS Extensions for client or server. */ - -__owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, - unsigned int ext_type); - -__owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, - unsigned int ext_type, - custom_ext_add_cb add_cb, - custom_ext_free_cb free_cb, - void *add_arg, - custom_ext_parse_cb parse_cb, - void *parse_arg); - -__owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, - unsigned int ext_type, - custom_ext_add_cb add_cb, - custom_ext_free_cb free_cb, - void *add_arg, - custom_ext_parse_cb parse_cb, - void *parse_arg); - -__owur int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, - unsigned int context, - SSL_custom_ext_add_cb_ex add_cb, - SSL_custom_ext_free_cb_ex free_cb, - void *add_arg, - SSL_custom_ext_parse_cb_ex parse_cb, - void *parse_arg); - -__owur int SSL_extension_supported(unsigned int ext_type); - -# define SSL_NOTHING 1 -# define SSL_WRITING 2 -# define SSL_READING 3 -# define SSL_X509_LOOKUP 4 -# define SSL_ASYNC_PAUSED 5 -# define SSL_ASYNC_NO_JOBS 6 -# define SSL_CLIENT_HELLO_CB 7 - -/* These will only be used when doing non-blocking IO */ -# define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) -# define SSL_want_read(s) (SSL_want(s) == SSL_READING) -# define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) -# define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) -# define SSL_want_async(s) (SSL_want(s) == SSL_ASYNC_PAUSED) -# define SSL_want_async_job(s) (SSL_want(s) == SSL_ASYNC_NO_JOBS) -# define SSL_want_client_hello_cb(s) (SSL_want(s) == SSL_CLIENT_HELLO_CB) - -# define SSL_MAC_FLAG_READ_MAC_STREAM 1 -# define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 - -/* - * A callback for logging out TLS key material. This callback should log out - * |line| followed by a newline. - */ -typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line); - -/* - * SSL_CTX_set_keylog_callback configures a callback to log key material. This - * is intended for debugging use with tools like Wireshark. The cb function - * should log line followed by a newline. - */ -void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb); - -/* - * SSL_CTX_get_keylog_callback returns the callback configured by - * SSL_CTX_set_keylog_callback. - */ -SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx); - -int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data); -uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); -int SSL_set_max_early_data(SSL *s, uint32_t max_early_data); -uint32_t SSL_get_max_early_data(const SSL *s); -int SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data); -uint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx); -int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data); -uint32_t SSL_get_recv_max_early_data(const SSL *s); - -#ifdef __cplusplus -} -#endif - -# include -# include -# include /* This is mostly sslv3 with a few tweaks */ -# include /* Datagram TLS */ -# include /* Support for the use_srtp extension */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * These need to be after the above set of includes due to a compiler bug - * in VisualStudio 2015 - */ -DEFINE_STACK_OF_CONST(SSL_CIPHER) -DEFINE_STACK_OF(SSL_COMP) - -/* compatibility */ -# define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)(arg))) -# define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) -# define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0, \ - (char *)(a))) -# define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) -# define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) -# define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0, \ - (char *)(arg))) -DEPRECATEDIN_1_1_0(void SSL_set_debug(SSL *s, int debug)) - -/* TLSv1.3 KeyUpdate message types */ -/* -1 used so that this is an invalid value for the on-the-wire protocol */ -#define SSL_KEY_UPDATE_NONE -1 -/* Values as defined for the on-the-wire protocol */ -#define SSL_KEY_UPDATE_NOT_REQUESTED 0 -#define SSL_KEY_UPDATE_REQUESTED 1 - -/* - * The valid handshake states (one for each type message sent and one for each - * type of message received). There are also two "special" states: - * TLS = TLS or DTLS state - * DTLS = DTLS specific state - * CR/SR = Client Read/Server Read - * CW/SW = Client Write/Server Write - * - * The "special" states are: - * TLS_ST_BEFORE = No handshake has been initiated yet - * TLS_ST_OK = A handshake has been successfully completed - */ -typedef enum { - TLS_ST_BEFORE, - TLS_ST_OK, - DTLS_ST_CR_HELLO_VERIFY_REQUEST, - TLS_ST_CR_SRVR_HELLO, - TLS_ST_CR_CERT, - TLS_ST_CR_CERT_STATUS, - TLS_ST_CR_KEY_EXCH, - TLS_ST_CR_CERT_REQ, - TLS_ST_CR_SRVR_DONE, - TLS_ST_CR_SESSION_TICKET, - TLS_ST_CR_CHANGE, - TLS_ST_CR_FINISHED, - TLS_ST_CW_CLNT_HELLO, - TLS_ST_CW_CERT, - TLS_ST_CW_KEY_EXCH, - TLS_ST_CW_CERT_VRFY, - TLS_ST_CW_CHANGE, - TLS_ST_CW_NEXT_PROTO, - TLS_ST_CW_FINISHED, - TLS_ST_SW_HELLO_REQ, - TLS_ST_SR_CLNT_HELLO, - DTLS_ST_SW_HELLO_VERIFY_REQUEST, - TLS_ST_SW_SRVR_HELLO, - TLS_ST_SW_CERT, - TLS_ST_SW_KEY_EXCH, - TLS_ST_SW_CERT_REQ, - TLS_ST_SW_SRVR_DONE, - TLS_ST_SR_CERT, - TLS_ST_SR_KEY_EXCH, - TLS_ST_SR_CERT_VRFY, - TLS_ST_SR_NEXT_PROTO, - TLS_ST_SR_CHANGE, - TLS_ST_SR_FINISHED, - TLS_ST_SW_SESSION_TICKET, - TLS_ST_SW_CERT_STATUS, - TLS_ST_SW_CHANGE, - TLS_ST_SW_FINISHED, - TLS_ST_SW_ENCRYPTED_EXTENSIONS, - TLS_ST_CR_ENCRYPTED_EXTENSIONS, - TLS_ST_CR_CERT_VRFY, - TLS_ST_SW_CERT_VRFY, - TLS_ST_CR_HELLO_REQ, - TLS_ST_SW_KEY_UPDATE, - TLS_ST_CW_KEY_UPDATE, - TLS_ST_SR_KEY_UPDATE, - TLS_ST_CR_KEY_UPDATE, - TLS_ST_EARLY_DATA, - TLS_ST_PENDING_EARLY_DATA_END, - TLS_ST_CW_END_OF_EARLY_DATA, - TLS_ST_SR_END_OF_EARLY_DATA -} OSSL_HANDSHAKE_STATE; - -/* - * Most of the following state values are no longer used and are defined to be - * the closest equivalent value in the current state machine code. Not all - * defines have an equivalent and are set to a dummy value (-1). SSL_ST_CONNECT - * and SSL_ST_ACCEPT are still in use in the definition of SSL_CB_ACCEPT_LOOP, - * SSL_CB_ACCEPT_EXIT, SSL_CB_CONNECT_LOOP and SSL_CB_CONNECT_EXIT. - */ - -# define SSL_ST_CONNECT 0x1000 -# define SSL_ST_ACCEPT 0x2000 - -# define SSL_ST_MASK 0x0FFF - -# define SSL_CB_LOOP 0x01 -# define SSL_CB_EXIT 0x02 -# define SSL_CB_READ 0x04 -# define SSL_CB_WRITE 0x08 -# define SSL_CB_ALERT 0x4000/* used in callback */ -# define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) -# define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) -# define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) -# define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) -# define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) -# define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) -# define SSL_CB_HANDSHAKE_START 0x10 -# define SSL_CB_HANDSHAKE_DONE 0x20 - -/* Is the SSL_connection established? */ -# define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a)) -# define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a)) -int SSL_in_init(const SSL *s); -int SSL_in_before(const SSL *s); -int SSL_is_init_finished(const SSL *s); - -/* - * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you - * should not need these - */ -# define SSL_ST_READ_HEADER 0xF0 -# define SSL_ST_READ_BODY 0xF1 -# define SSL_ST_READ_DONE 0xF2 - -/*- - * Obtain latest Finished message - * -- that we sent (SSL_get_finished) - * -- that we expected from peer (SSL_get_peer_finished). - * Returns length (0 == no Finished so far), copies up to 'count' bytes. - */ -size_t SSL_get_finished(const SSL *s, void *buf, size_t count); -size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); - -/* - * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options are - * 'ored' with SSL_VERIFY_PEER if they are desired - */ -# define SSL_VERIFY_NONE 0x00 -# define SSL_VERIFY_PEER 0x01 -# define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 -# define SSL_VERIFY_CLIENT_ONCE 0x04 -# define SSL_VERIFY_POST_HANDSHAKE 0x08 - -# if OPENSSL_API_COMPAT < 0x10100000L -# define OpenSSL_add_ssl_algorithms() SSL_library_init() -# define SSLeay_add_ssl_algorithms() SSL_library_init() -# endif - -/* More backward compatibility */ -# define SSL_get_cipher(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) -# define SSL_get_cipher_bits(s,np) \ - SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) -# define SSL_get_cipher_version(s) \ - SSL_CIPHER_get_version(SSL_get_current_cipher(s)) -# define SSL_get_cipher_name(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) -# define SSL_get_time(a) SSL_SESSION_get_time(a) -# define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) -# define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) -# define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) - -# define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) -# define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) - -DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) -# define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value - * from SSL_AD_... */ -/* These alert types are for SSLv3 and TLSv1 */ -# define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY -/* fatal */ -# define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE -/* fatal */ -# define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC -# define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED -# define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW -/* fatal */ -# define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE -/* fatal */ -# define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE -/* Not for TLS */ -# define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE -# define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE -# define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE -# define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED -# define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED -# define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN -/* fatal */ -# define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER -/* fatal */ -# define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA -/* fatal */ -# define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED -/* fatal */ -# define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR -# define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR -/* fatal */ -# define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION -/* fatal */ -# define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION -/* fatal */ -# define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY -/* fatal */ -# define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR -# define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED -# define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION -# define SSL_AD_MISSING_EXTENSION TLS13_AD_MISSING_EXTENSION -# define SSL_AD_CERTIFICATE_REQUIRED TLS13_AD_CERTIFICATE_REQUIRED -# define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION -# define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE -# define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME -# define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE -# define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE -/* fatal */ -# define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY -/* fatal */ -# define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK -# define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL -# define SSL_ERROR_NONE 0 -# define SSL_ERROR_SSL 1 -# define SSL_ERROR_WANT_READ 2 -# define SSL_ERROR_WANT_WRITE 3 -# define SSL_ERROR_WANT_X509_LOOKUP 4 -# define SSL_ERROR_SYSCALL 5/* look at error stack/return - * value/errno */ -# define SSL_ERROR_ZERO_RETURN 6 -# define SSL_ERROR_WANT_CONNECT 7 -# define SSL_ERROR_WANT_ACCEPT 8 -# define SSL_ERROR_WANT_ASYNC 9 -# define SSL_ERROR_WANT_ASYNC_JOB 10 -# define SSL_ERROR_WANT_CLIENT_HELLO_CB 11 -# define SSL_CTRL_SET_TMP_DH 3 -# define SSL_CTRL_SET_TMP_ECDH 4 -# define SSL_CTRL_SET_TMP_DH_CB 6 -# define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 -# define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 -# define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 -# define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 -# define SSL_CTRL_GET_FLAGS 13 -# define SSL_CTRL_EXTRA_CHAIN_CERT 14 -# define SSL_CTRL_SET_MSG_CALLBACK 15 -# define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 -/* only applies to datagram connections */ -# define SSL_CTRL_SET_MTU 17 -/* Stats */ -# define SSL_CTRL_SESS_NUMBER 20 -# define SSL_CTRL_SESS_CONNECT 21 -# define SSL_CTRL_SESS_CONNECT_GOOD 22 -# define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 -# define SSL_CTRL_SESS_ACCEPT 24 -# define SSL_CTRL_SESS_ACCEPT_GOOD 25 -# define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 -# define SSL_CTRL_SESS_HIT 27 -# define SSL_CTRL_SESS_CB_HIT 28 -# define SSL_CTRL_SESS_MISSES 29 -# define SSL_CTRL_SESS_TIMEOUTS 30 -# define SSL_CTRL_SESS_CACHE_FULL 31 -# define SSL_CTRL_MODE 33 -# define SSL_CTRL_GET_READ_AHEAD 40 -# define SSL_CTRL_SET_READ_AHEAD 41 -# define SSL_CTRL_SET_SESS_CACHE_SIZE 42 -# define SSL_CTRL_GET_SESS_CACHE_SIZE 43 -# define SSL_CTRL_SET_SESS_CACHE_MODE 44 -# define SSL_CTRL_GET_SESS_CACHE_MODE 45 -# define SSL_CTRL_GET_MAX_CERT_LIST 50 -# define SSL_CTRL_SET_MAX_CERT_LIST 51 -# define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 -/* see tls1.h for macros based on these */ -# define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 -# define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 -# define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 -# define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 -# define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 -# define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 -# define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 */ -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 */ -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 */ -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 -# define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 -# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 -# define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 -# define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 -# define SSL_CTRL_SET_SRP_ARG 78 -# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 -# define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 -# define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT 85 -# define SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING 86 -# define SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS 87 -# endif -# define DTLS_CTRL_GET_TIMEOUT 73 -# define DTLS_CTRL_HANDLE_TIMEOUT 74 -# define SSL_CTRL_GET_RI_SUPPORT 76 -# define SSL_CTRL_CLEAR_MODE 78 -# define SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB 79 -# define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 -# define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 -# define SSL_CTRL_CHAIN 88 -# define SSL_CTRL_CHAIN_CERT 89 -# define SSL_CTRL_GET_GROUPS 90 -# define SSL_CTRL_SET_GROUPS 91 -# define SSL_CTRL_SET_GROUPS_LIST 92 -# define SSL_CTRL_GET_SHARED_GROUP 93 -# define SSL_CTRL_SET_SIGALGS 97 -# define SSL_CTRL_SET_SIGALGS_LIST 98 -# define SSL_CTRL_CERT_FLAGS 99 -# define SSL_CTRL_CLEAR_CERT_FLAGS 100 -# define SSL_CTRL_SET_CLIENT_SIGALGS 101 -# define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 -# define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 -# define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 -# define SSL_CTRL_BUILD_CERT_CHAIN 105 -# define SSL_CTRL_SET_VERIFY_CERT_STORE 106 -# define SSL_CTRL_SET_CHAIN_CERT_STORE 107 -# define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 -# define SSL_CTRL_GET_PEER_TMP_KEY 109 -# define SSL_CTRL_GET_RAW_CIPHERLIST 110 -# define SSL_CTRL_GET_EC_POINT_FORMATS 111 -# define SSL_CTRL_GET_CHAIN_CERTS 115 -# define SSL_CTRL_SELECT_CURRENT_CERT 116 -# define SSL_CTRL_SET_CURRENT_CERT 117 -# define SSL_CTRL_SET_DH_AUTO 118 -# define DTLS_CTRL_SET_LINK_MTU 120 -# define DTLS_CTRL_GET_LINK_MIN_MTU 121 -# define SSL_CTRL_GET_EXTMS_SUPPORT 122 -# define SSL_CTRL_SET_MIN_PROTO_VERSION 123 -# define SSL_CTRL_SET_MAX_PROTO_VERSION 124 -# define SSL_CTRL_SET_SPLIT_SEND_FRAGMENT 125 -# define SSL_CTRL_SET_MAX_PIPELINES 126 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 127 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129 -# define SSL_CTRL_GET_MIN_PROTO_VERSION 130 -# define SSL_CTRL_GET_MAX_PROTO_VERSION 131 -# define SSL_CTRL_GET_SIGNATURE_NID 132 -# define SSL_CTRL_GET_TMP_KEY 133 -# define SSL_CERT_SET_FIRST 1 -# define SSL_CERT_SET_NEXT 2 -# define SSL_CERT_SET_SERVER 3 -# define DTLSv1_get_timeout(ssl, arg) \ - SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)(arg)) -# define DTLSv1_handle_timeout(ssl) \ - SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL) -# define SSL_num_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) -# define SSL_clear_num_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) -# define SSL_total_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) -# define SSL_CTX_set_tmp_dh(ctx,dh) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) -# define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) -# define SSL_CTX_set_dh_auto(ctx, onoff) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_DH_AUTO,onoff,NULL) -# define SSL_set_dh_auto(s, onoff) \ - SSL_ctrl(s,SSL_CTRL_SET_DH_AUTO,onoff,NULL) -# define SSL_set_tmp_dh(ssl,dh) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) -# define SSL_set_tmp_ecdh(ssl,ecdh) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) -# define SSL_CTX_add_extra_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509)) -# define SSL_CTX_get_extra_chain_certs(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509) -# define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509) -# define SSL_CTX_clear_extra_chain_certs(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL) -# define SSL_CTX_set0_chain(ctx,sk) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk)) -# define SSL_CTX_set1_chain(ctx,sk) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)(sk)) -# define SSL_CTX_add0_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) -# define SSL_CTX_add1_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) -# define SSL_CTX_get0_chain_certs(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) -# define SSL_CTX_clear_chain_certs(ctx) \ - SSL_CTX_set0_chain(ctx,NULL) -# define SSL_CTX_build_cert_chain(ctx, flags) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) -# define SSL_CTX_select_current_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) -# define SSL_CTX_set_current_cert(ctx, op) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) -# define SSL_CTX_set0_verify_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) -# define SSL_CTX_set1_verify_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) -# define SSL_CTX_set0_chain_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) -# define SSL_CTX_set1_chain_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) -# define SSL_set0_chain(s,sk) \ - SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk)) -# define SSL_set1_chain(s,sk) \ - SSL_ctrl(s,SSL_CTRL_CHAIN,1,(char *)(sk)) -# define SSL_add0_chain_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) -# define SSL_add1_chain_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) -# define SSL_get0_chain_certs(s,px509) \ - SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERTS,0,px509) -# define SSL_clear_chain_certs(s) \ - SSL_set0_chain(s,NULL) -# define SSL_build_cert_chain(s, flags) \ - SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) -# define SSL_select_current_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) -# define SSL_set_current_cert(s,op) \ - SSL_ctrl(s,SSL_CTRL_SET_CURRENT_CERT, op, NULL) -# define SSL_set0_verify_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) -# define SSL_set1_verify_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) -# define SSL_set0_chain_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) -# define SSL_set1_chain_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) -# define SSL_get1_groups(s, glist) \ - SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist)) -# define SSL_CTX_set1_groups(ctx, glist, glistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) -# define SSL_CTX_set1_groups_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(s)) -# define SSL_set1_groups(s, glist, glistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) -# define SSL_set1_groups_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(str)) -# define SSL_get_shared_group(s, n) \ - SSL_ctrl(s,SSL_CTRL_GET_SHARED_GROUP,n,NULL) -# define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) -# define SSL_CTX_set1_sigalgs_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(s)) -# define SSL_set1_sigalgs(s, slist, slistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) -# define SSL_set1_sigalgs_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(str)) -# define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) -# define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(s)) -# define SSL_set1_client_sigalgs(s, slist, slistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) -# define SSL_set1_client_sigalgs_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(str)) -# define SSL_get0_certificate_types(s, clist) \ - SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)(clist)) -# define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen, \ - (char *)(clist)) -# define SSL_set1_client_certificate_types(s, clist, clistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)(clist)) -# define SSL_get_signature_nid(s, pn) \ - SSL_ctrl(s,SSL_CTRL_GET_SIGNATURE_NID,0,pn) -# define SSL_get_peer_signature_nid(s, pn) \ - SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn) -# define SSL_get_peer_tmp_key(s, pk) \ - SSL_ctrl(s,SSL_CTRL_GET_PEER_TMP_KEY,0,pk) -# define SSL_get_tmp_key(s, pk) \ - SSL_ctrl(s,SSL_CTRL_GET_TMP_KEY,0,pk) -# define SSL_get0_raw_cipherlist(s, plst) \ - SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,plst) -# define SSL_get0_ec_point_formats(s, plst) \ - SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,plst) -# define SSL_CTX_set_min_proto_version(ctx, version) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) -# define SSL_CTX_set_max_proto_version(ctx, version) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) -# define SSL_CTX_get_min_proto_version(ctx) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) -# define SSL_CTX_get_max_proto_version(ctx) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) -# define SSL_set_min_proto_version(s, version) \ - SSL_ctrl(s, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) -# define SSL_set_max_proto_version(s, version) \ - SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) -# define SSL_get_min_proto_version(s) \ - SSL_ctrl(s, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) -# define SSL_get_max_proto_version(s) \ - SSL_ctrl(s, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) - -/* Backwards compatibility, original 1.1.0 names */ -# define SSL_CTRL_GET_SERVER_TMP_KEY \ - SSL_CTRL_GET_PEER_TMP_KEY -# define SSL_get_server_tmp_key(s, pk) \ - SSL_get_peer_tmp_key(s, pk) - -/* - * The following symbol names are old and obsolete. They are kept - * for compatibility reasons only and should not be used anymore. - */ -# define SSL_CTRL_GET_CURVES SSL_CTRL_GET_GROUPS -# define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS -# define SSL_CTRL_SET_CURVES_LIST SSL_CTRL_SET_GROUPS_LIST -# define SSL_CTRL_GET_SHARED_CURVE SSL_CTRL_GET_SHARED_GROUP - -# define SSL_get1_curves SSL_get1_groups -# define SSL_CTX_set1_curves SSL_CTX_set1_groups -# define SSL_CTX_set1_curves_list SSL_CTX_set1_groups_list -# define SSL_set1_curves SSL_set1_groups -# define SSL_set1_curves_list SSL_set1_groups_list -# define SSL_get_shared_curve SSL_get_shared_group - - -# if OPENSSL_API_COMPAT < 0x10100000L -/* Provide some compatibility macros for removed functionality. */ -# define SSL_CTX_need_tmp_RSA(ctx) 0 -# define SSL_CTX_set_tmp_rsa(ctx,rsa) 1 -# define SSL_need_tmp_RSA(ssl) 0 -# define SSL_set_tmp_rsa(ssl,rsa) 1 -# define SSL_CTX_set_ecdh_auto(dummy, onoff) ((onoff) != 0) -# define SSL_set_ecdh_auto(dummy, onoff) ((onoff) != 0) -/* - * We "pretend" to call the callback to avoid warnings about unused static - * functions. - */ -# define SSL_CTX_set_tmp_rsa_callback(ctx, cb) while(0) (cb)(NULL, 0, 0) -# define SSL_set_tmp_rsa_callback(ssl, cb) while(0) (cb)(NULL, 0, 0) -# endif -__owur const BIO_METHOD *BIO_f_ssl(void); -__owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client); -__owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx); -__owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); -__owur int BIO_ssl_copy_session_id(BIO *to, BIO *from); -void BIO_ssl_shutdown(BIO *ssl_bio); - -__owur int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); -__owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); -int SSL_CTX_up_ref(SSL_CTX *ctx); -void SSL_CTX_free(SSL_CTX *); -__owur long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); -__owur long SSL_CTX_get_timeout(const SSL_CTX *ctx); -__owur X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); -void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); -void SSL_CTX_set1_cert_store(SSL_CTX *, X509_STORE *); -__owur int SSL_want(const SSL *s); -__owur int SSL_clear(SSL *s); - -void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); - -__owur const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); -__owur const SSL_CIPHER *SSL_get_pending_cipher(const SSL *s); -__owur int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); -__owur const char *SSL_CIPHER_get_version(const SSL_CIPHER *c); -__owur const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); -__owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); -__owur const char *OPENSSL_cipher_name(const char *rfc_name); -__owur uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c); -__owur uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c); -__owur int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c); -__owur int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c); -__owur const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c); -__owur int SSL_CIPHER_is_aead(const SSL_CIPHER *c); - -__owur int SSL_get_fd(const SSL *s); -__owur int SSL_get_rfd(const SSL *s); -__owur int SSL_get_wfd(const SSL *s); -__owur const char *SSL_get_cipher_list(const SSL *s, int n); -__owur char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size); -__owur int SSL_get_read_ahead(const SSL *s); -__owur int SSL_pending(const SSL *s); -__owur int SSL_has_pending(const SSL *s); -# ifndef OPENSSL_NO_SOCK -__owur int SSL_set_fd(SSL *s, int fd); -__owur int SSL_set_rfd(SSL *s, int fd); -__owur int SSL_set_wfd(SSL *s, int fd); -# endif -void SSL_set0_rbio(SSL *s, BIO *rbio); -void SSL_set0_wbio(SSL *s, BIO *wbio); -void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); -__owur BIO *SSL_get_rbio(const SSL *s); -__owur BIO *SSL_get_wbio(const SSL *s); -__owur int SSL_set_cipher_list(SSL *s, const char *str); -__owur int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); -__owur int SSL_set_ciphersuites(SSL *s, const char *str); -void SSL_set_read_ahead(SSL *s, int yes); -__owur int SSL_get_verify_mode(const SSL *s); -__owur int SSL_get_verify_depth(const SSL *s); -__owur SSL_verify_cb SSL_get_verify_callback(const SSL *s); -void SSL_set_verify(SSL *s, int mode, SSL_verify_cb callback); -void SSL_set_verify_depth(SSL *s, int depth); -void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg); -# ifndef OPENSSL_NO_RSA -__owur int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); -__owur int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, - long len); -# endif -__owur int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); -__owur int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, - long len); -__owur int SSL_use_certificate(SSL *ssl, X509 *x); -__owur int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); -__owur int SSL_use_cert_and_key(SSL *ssl, X509 *x509, EVP_PKEY *privatekey, - STACK_OF(X509) *chain, int override); - - -/* serverinfo file format versions */ -# define SSL_SERVERINFOV1 1 -# define SSL_SERVERINFOV2 2 - -/* Set serverinfo data for the current active cert. */ -__owur int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, - size_t serverinfo_length); -__owur int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version, - const unsigned char *serverinfo, - size_t serverinfo_length); -__owur int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); - -#ifndef OPENSSL_NO_RSA -__owur int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); -#endif - -__owur int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); -__owur int SSL_use_certificate_file(SSL *ssl, const char *file, int type); - -#ifndef OPENSSL_NO_RSA -__owur int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, - int type); -#endif -__owur int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, - int type); -__owur int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, - int type); -/* PEM type */ -__owur int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); -__owur int SSL_use_certificate_chain_file(SSL *ssl, const char *file); -__owur STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); -__owur int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, - const char *file); -int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, - const char *dir); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_load_error_strings() \ - OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ - | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) -# endif - -__owur const char *SSL_state_string(const SSL *s); -__owur const char *SSL_rstate_string(const SSL *s); -__owur const char *SSL_state_string_long(const SSL *s); -__owur const char *SSL_rstate_string_long(const SSL *s); -__owur long SSL_SESSION_get_time(const SSL_SESSION *s); -__owur long SSL_SESSION_set_time(SSL_SESSION *s, long t); -__owur long SSL_SESSION_get_timeout(const SSL_SESSION *s); -__owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); -__owur int SSL_SESSION_get_protocol_version(const SSL_SESSION *s); -__owur int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version); - -__owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s); -__owur int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname); -void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s, - const unsigned char **alpn, - size_t *len); -__owur int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, - const unsigned char *alpn, - size_t len); -__owur const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s); -__owur int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher); -__owur int SSL_SESSION_has_ticket(const SSL_SESSION *s); -__owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s); -void SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick, - size_t *len); -__owur uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s); -__owur int SSL_SESSION_set_max_early_data(SSL_SESSION *s, - uint32_t max_early_data); -__owur int SSL_copy_session_id(SSL *to, const SSL *from); -__owur X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); -__owur int SSL_SESSION_set1_id_context(SSL_SESSION *s, - const unsigned char *sid_ctx, - unsigned int sid_ctx_len); -__owur int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, - unsigned int sid_len); -__owur int SSL_SESSION_is_resumable(const SSL_SESSION *s); - -__owur SSL_SESSION *SSL_SESSION_new(void); -__owur SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src); -const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, - unsigned int *len); -const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s, - unsigned int *len); -__owur unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); -# ifndef OPENSSL_NO_STDIO -int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); -# endif -int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); -int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x); -int SSL_SESSION_up_ref(SSL_SESSION *ses); -void SSL_SESSION_free(SSL_SESSION *ses); -__owur int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); -__owur int SSL_set_session(SSL *to, SSL_SESSION *session); -int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session); -int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session); -__owur int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); -__owur int SSL_set_generate_session_id(SSL *s, GEN_SESSION_CB cb); -__owur int SSL_has_matching_session_id(const SSL *s, - const unsigned char *id, - unsigned int id_len); -SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, - long length); - -# ifdef HEADER_X509_H -__owur X509 *SSL_get_peer_certificate(const SSL *s); -# endif - -__owur STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); - -__owur int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); -__owur int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); -__owur SSL_verify_cb SSL_CTX_get_verify_callback(const SSL_CTX *ctx); -void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb callback); -void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); -void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, - int (*cb) (X509_STORE_CTX *, void *), - void *arg); -void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), - void *arg); -# ifndef OPENSSL_NO_RSA -__owur int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); -__owur int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, - long len); -# endif -__owur int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); -__owur int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, - const unsigned char *d, long len); -__owur int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); -__owur int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, - const unsigned char *d); -__owur int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey, - STACK_OF(X509) *chain, int override); - -void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); -void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); -pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx); -void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx); -void SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb); -void SSL_set_default_passwd_cb_userdata(SSL *s, void *u); -pem_password_cb *SSL_get_default_passwd_cb(SSL *s); -void *SSL_get_default_passwd_cb_userdata(SSL *s); - -__owur int SSL_CTX_check_private_key(const SSL_CTX *ctx); -__owur int SSL_check_private_key(const SSL *ctx); - -__owur int SSL_CTX_set_session_id_context(SSL_CTX *ctx, - const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - -SSL *SSL_new(SSL_CTX *ctx); -int SSL_up_ref(SSL *s); -int SSL_is_dtls(const SSL *s); -__owur int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - -__owur int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose); -__owur int SSL_set_purpose(SSL *ssl, int purpose); -__owur int SSL_CTX_set_trust(SSL_CTX *ctx, int trust); -__owur int SSL_set_trust(SSL *ssl, int trust); - -__owur int SSL_set1_host(SSL *s, const char *hostname); -__owur int SSL_add1_host(SSL *s, const char *hostname); -__owur const char *SSL_get0_peername(SSL *s); -void SSL_set_hostflags(SSL *s, unsigned int flags); - -__owur int SSL_CTX_dane_enable(SSL_CTX *ctx); -__owur int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, - uint8_t mtype, uint8_t ord); -__owur int SSL_dane_enable(SSL *s, const char *basedomain); -__owur int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector, - uint8_t mtype, unsigned const char *data, size_t dlen); -__owur int SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki); -__owur int SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector, - uint8_t *mtype, unsigned const char **data, - size_t *dlen); -/* - * Bridge opacity barrier between libcrypt and libssl, also needed to support - * offline testing in test/danetest.c - */ -SSL_DANE *SSL_get0_dane(SSL *ssl); -/* - * DANE flags - */ -unsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags); -unsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags); -unsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags); -unsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags); - -__owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); -__owur int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); - -__owur X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); -__owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); - -# ifndef OPENSSL_NO_SRP -int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); -int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); -int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); -int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, - char *(*cb) (SSL *, void *)); -int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, - int (*cb) (SSL *, void *)); -int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, - int (*cb) (SSL *, int *, void *)); -int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); - -int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, - BIGNUM *sa, BIGNUM *v, char *info); -int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, - const char *grp); - -__owur BIGNUM *SSL_get_srp_g(SSL *s); -__owur BIGNUM *SSL_get_srp_N(SSL *s); - -__owur char *SSL_get_srp_username(SSL *s); -__owur char *SSL_get_srp_userinfo(SSL *s); -# endif - -/* - * ClientHello callback and helpers. - */ - -# define SSL_CLIENT_HELLO_SUCCESS 1 -# define SSL_CLIENT_HELLO_ERROR 0 -# define SSL_CLIENT_HELLO_RETRY (-1) - -typedef int (*SSL_client_hello_cb_fn) (SSL *s, int *al, void *arg); -void SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn cb, - void *arg); -int SSL_client_hello_isv2(SSL *s); -unsigned int SSL_client_hello_get0_legacy_version(SSL *s); -size_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_compression_methods(SSL *s, - const unsigned char **out); -int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen); -int SSL_client_hello_get0_ext(SSL *s, unsigned int type, - const unsigned char **out, size_t *outlen); - -void SSL_certs_clear(SSL *s); -void SSL_free(SSL *ssl); -# ifdef OSSL_ASYNC_FD -/* - * Windows application developer has to include windows.h to use these. - */ -__owur int SSL_waiting_for_async(SSL *s); -__owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds); -__owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, - size_t *numaddfds, OSSL_ASYNC_FD *delfd, - size_t *numdelfds); -# endif -__owur int SSL_accept(SSL *ssl); -__owur int SSL_stateless(SSL *s); -__owur int SSL_connect(SSL *ssl); -__owur int SSL_read(SSL *ssl, void *buf, int num); -__owur int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); - -# define SSL_READ_EARLY_DATA_ERROR 0 -# define SSL_READ_EARLY_DATA_SUCCESS 1 -# define SSL_READ_EARLY_DATA_FINISH 2 - -__owur int SSL_read_early_data(SSL *s, void *buf, size_t num, - size_t *readbytes); -__owur int SSL_peek(SSL *ssl, void *buf, int num); -__owur int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); -__owur int SSL_write(SSL *ssl, const void *buf, int num); -__owur int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written); -__owur int SSL_write_early_data(SSL *s, const void *buf, size_t num, - size_t *written); -long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); -long SSL_callback_ctrl(SSL *, int, void (*)(void)); -long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); -long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); - -# define SSL_EARLY_DATA_NOT_SENT 0 -# define SSL_EARLY_DATA_REJECTED 1 -# define SSL_EARLY_DATA_ACCEPTED 2 - -__owur int SSL_get_early_data_status(const SSL *s); - -__owur int SSL_get_error(const SSL *s, int ret_code); -__owur const char *SSL_get_version(const SSL *s); - -/* This sets the 'default' SSL version that SSL_new() will create */ -__owur int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); - -# ifndef OPENSSL_NO_SSL3_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_method(void)) /* SSLv3 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_client_method(void)) -# endif - -#define SSLv23_method TLS_method -#define SSLv23_server_method TLS_server_method -#define SSLv23_client_method TLS_client_method - -/* Negotiate highest available SSL/TLS version */ -__owur const SSL_METHOD *TLS_method(void); -__owur const SSL_METHOD *TLS_server_method(void); -__owur const SSL_METHOD *TLS_client_method(void); - -# ifndef OPENSSL_NO_TLS1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_TLS1_1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_TLS1_2_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void)) -# endif - -# ifndef OPENSSL_NO_DTLS1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_DTLS1_2_METHOD -/* DTLSv1.2 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_client_method(void)) -# endif - -__owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ -__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ -__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ - -__owur size_t DTLS_get_data_mtu(const SSL *s); - -__owur STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); -__owur STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx); -__owur STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *s); -__owur STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s); - -__owur int SSL_do_handshake(SSL *s); -int SSL_key_update(SSL *s, int updatetype); -int SSL_get_key_update_type(const SSL *s); -int SSL_renegotiate(SSL *s); -int SSL_renegotiate_abbreviated(SSL *s); -__owur int SSL_renegotiate_pending(const SSL *s); -int SSL_shutdown(SSL *s); -__owur int SSL_verify_client_post_handshake(SSL *s); -void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val); -void SSL_set_post_handshake_auth(SSL *s, int val); - -__owur const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx); -__owur const SSL_METHOD *SSL_get_ssl_method(const SSL *s); -__owur int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); -__owur const char *SSL_alert_type_string_long(int value); -__owur const char *SSL_alert_type_string(int value); -__owur const char *SSL_alert_desc_string_long(int value); -__owur const char *SSL_alert_desc_string(int value); - -void SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); -void SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); -__owur const STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s); -__owur const STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx); -__owur int SSL_add1_to_CA_list(SSL *ssl, const X509 *x); -__owur int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x); -__owur const STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s); - -void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); -void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); -__owur STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); -__owur STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); -__owur int SSL_add_client_CA(SSL *ssl, X509 *x); -__owur int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); - -void SSL_set_connect_state(SSL *s); -void SSL_set_accept_state(SSL *s); - -__owur long SSL_get_default_timeout(const SSL *s); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_library_init() OPENSSL_init_ssl(0, NULL) -# endif - -__owur char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); -__owur STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk); - -__owur SSL *SSL_dup(SSL *ssl); - -__owur X509 *SSL_get_certificate(const SSL *ssl); -/* - * EVP_PKEY - */ -struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); - -__owur X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); -__owur EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); - -void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); -__owur int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); -void SSL_set_quiet_shutdown(SSL *ssl, int mode); -__owur int SSL_get_quiet_shutdown(const SSL *ssl); -void SSL_set_shutdown(SSL *ssl, int mode); -__owur int SSL_get_shutdown(const SSL *ssl); -__owur int SSL_version(const SSL *ssl); -__owur int SSL_client_version(const SSL *s); -__owur int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); -__owur int SSL_CTX_set_default_verify_dir(SSL_CTX *ctx); -__owur int SSL_CTX_set_default_verify_file(SSL_CTX *ctx); -__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, - const char *CApath); -# define SSL_get0_session SSL_get_session/* just peek at pointer */ -__owur SSL_SESSION *SSL_get_session(const SSL *ssl); -__owur SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ -__owur SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); -SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); -void SSL_set_info_callback(SSL *ssl, - void (*cb) (const SSL *ssl, int type, int val)); -void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, - int val); -__owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl); - -void SSL_set_verify_result(SSL *ssl, long v); -__owur long SSL_get_verify_result(const SSL *ssl); -__owur STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s); - -__owur size_t SSL_get_client_random(const SSL *ssl, unsigned char *out, - size_t outlen); -__owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out, - size_t outlen); -__owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess, - unsigned char *out, size_t outlen); -__owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess, - const unsigned char *in, size_t len); -uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *sess); - -#define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) -__owur int SSL_set_ex_data(SSL *ssl, int idx, void *data); -void *SSL_get_ex_data(const SSL *ssl, int idx); -#define SSL_SESSION_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef) -__owur int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); -void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); -#define SSL_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef) -__owur int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); -void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); - -__owur int SSL_get_ex_data_X509_STORE_CTX_idx(void); - -# define SSL_CTX_sess_set_cache_size(ctx,t) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) -# define SSL_CTX_sess_get_cache_size(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) -# define SSL_CTX_set_session_cache_mode(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) -# define SSL_CTX_get_session_cache_mode(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) - -# define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) -# define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) -# define SSL_CTX_get_read_ahead(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) -# define SSL_CTX_set_read_ahead(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) -# define SSL_CTX_get_max_cert_list(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) -# define SSL_CTX_set_max_cert_list(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) -# define SSL_get_max_cert_list(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) -# define SSL_set_max_cert_list(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) - -# define SSL_CTX_set_max_send_fragment(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) -# define SSL_set_max_send_fragment(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) -# define SSL_CTX_set_split_send_fragment(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) -# define SSL_set_split_send_fragment(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) -# define SSL_CTX_set_max_pipelines(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) -# define SSL_set_max_pipelines(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) - -void SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len); -void SSL_set_default_read_buffer_len(SSL *s, size_t len); - -# ifndef OPENSSL_NO_DH -/* NB: the |keylength| is only applicable when is_export is true */ -void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, - DH *(*dh) (SSL *ssl, int is_export, - int keylength)); -void SSL_set_tmp_dh_callback(SSL *ssl, - DH *(*dh) (SSL *ssl, int is_export, - int keylength)); -# endif - -__owur const COMP_METHOD *SSL_get_current_compression(const SSL *s); -__owur const COMP_METHOD *SSL_get_current_expansion(const SSL *s); -__owur const char *SSL_COMP_get_name(const COMP_METHOD *comp); -__owur const char *SSL_COMP_get0_name(const SSL_COMP *comp); -__owur int SSL_COMP_get_id(const SSL_COMP *comp); -STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); -__owur STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) - *meths); -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_COMP_free_compression_methods() while(0) continue -# endif -__owur int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); - -const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); -int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); -int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c); -int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len, - int isv2format, STACK_OF(SSL_CIPHER) **sk, - STACK_OF(SSL_CIPHER) **scsvs); - -/* TLS extensions functions */ -__owur int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); - -__owur int SSL_set_session_ticket_ext_cb(SSL *s, - tls_session_ticket_ext_cb_fn cb, - void *arg); - -/* Pre-shared secret session resumption functions */ -__owur int SSL_set_session_secret_cb(SSL *s, - tls_session_secret_cb_fn session_secret_cb, - void *arg); - -void SSL_CTX_set_not_resumable_session_callback(SSL_CTX *ctx, - int (*cb) (SSL *ssl, - int - is_forward_secure)); - -void SSL_set_not_resumable_session_callback(SSL *ssl, - int (*cb) (SSL *ssl, - int is_forward_secure)); - -void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, - size_t (*cb) (SSL *ssl, int type, - size_t len, void *arg)); -void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg); -void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx); -int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size); - -void SSL_set_record_padding_callback(SSL *ssl, - size_t (*cb) (SSL *ssl, int type, - size_t len, void *arg)); -void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg); -void *SSL_get_record_padding_callback_arg(const SSL *ssl); -int SSL_set_block_padding(SSL *ssl, size_t block_size); - -int SSL_set_num_tickets(SSL *s, size_t num_tickets); -size_t SSL_get_num_tickets(const SSL *s); -int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); -size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_cache_hit(s) SSL_session_reused(s) -# endif - -__owur int SSL_session_reused(const SSL *s); -__owur int SSL_is_server(const SSL *s); - -__owur __owur SSL_CONF_CTX *SSL_CONF_CTX_new(void); -int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); -void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); -unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); -__owur unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, - unsigned int flags); -__owur int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); - -void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); -void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); - -__owur int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); -__owur int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); -__owur int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); - -void SSL_add_ssl_module(void); -int SSL_config(SSL *s, const char *name); -int SSL_CTX_config(SSL_CTX *ctx, const char *name); - -# ifndef OPENSSL_NO_SSL_TRACE -void SSL_trace(int write_p, int version, int content_type, - const void *buf, size_t len, SSL *ssl, void *arg); -# endif - -# ifndef OPENSSL_NO_SOCK -int DTLSv1_listen(SSL *s, BIO_ADDR *client); -# endif - -# ifndef OPENSSL_NO_CT - -/* - * A callback for verifying that the received SCTs are sufficient. - * Expected to return 1 if they are sufficient, otherwise 0. - * May return a negative integer if an error occurs. - * A connection should be aborted if the SCTs are deemed insufficient. - */ -typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx, - const STACK_OF(SCT) *scts, void *arg); - -/* - * Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate - * the received SCTs. - * If the callback returns a non-positive result, the connection is terminated. - * Call this function before beginning a handshake. - * If a NULL |callback| is provided, SCT validation is disabled. - * |arg| is arbitrary userdata that will be passed to the callback whenever it - * is invoked. Ownership of |arg| remains with the caller. - * - * NOTE: A side-effect of setting a CT callback is that an OCSP stapled response - * will be requested. - */ -int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback, - void *arg); -int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx, - ssl_ct_validation_cb callback, - void *arg); -#define SSL_disable_ct(s) \ - ((void) SSL_set_validation_callback((s), NULL, NULL)) -#define SSL_CTX_disable_ct(ctx) \ - ((void) SSL_CTX_set_validation_callback((ctx), NULL, NULL)) - -/* - * The validation type enumerates the available behaviours of the built-in SSL - * CT validation callback selected via SSL_enable_ct() and SSL_CTX_enable_ct(). - * The underlying callback is a static function in libssl. - */ -enum { - SSL_CT_VALIDATION_PERMISSIVE = 0, - SSL_CT_VALIDATION_STRICT -}; - -/* - * Enable CT by setting up a callback that implements one of the built-in - * validation variants. The SSL_CT_VALIDATION_PERMISSIVE variant always - * continues the handshake, the application can make appropriate decisions at - * handshake completion. The SSL_CT_VALIDATION_STRICT variant requires at - * least one valid SCT, or else handshake termination will be requested. The - * handshake may continue anyway if SSL_VERIFY_NONE is in effect. - */ -int SSL_enable_ct(SSL *s, int validation_mode); -int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode); - -/* - * Report whether a non-NULL callback is enabled. - */ -int SSL_ct_is_enabled(const SSL *s); -int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx); - -/* Gets the SCTs received from a connection */ -const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s); - -/* - * Loads the CT log list from the default location. - * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, - * the log information loaded from this file will be appended to the - * CTLOG_STORE. - * Returns 1 on success, 0 otherwise. - */ -int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx); - -/* - * Loads the CT log list from the specified file path. - * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, - * the log information loaded from this file will be appended to the - * CTLOG_STORE. - * Returns 1 on success, 0 otherwise. - */ -int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path); - -/* - * Sets the CT log list used by all SSL connections created from this SSL_CTX. - * Ownership of the CTLOG_STORE is transferred to the SSL_CTX. - */ -void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs); - -/* - * Gets the CT log list used by all SSL connections created from this SSL_CTX. - * This will be NULL unless one of the following functions has been called: - * - SSL_CTX_set_default_ctlog_list_file - * - SSL_CTX_set_ctlog_list_file - * - SSL_CTX_set_ctlog_store - */ -const CTLOG_STORE *SSL_CTX_get0_ctlog_store(const SSL_CTX *ctx); - -# endif /* OPENSSL_NO_CT */ - -/* What the "other" parameter contains in security callback */ -/* Mask for type */ -# define SSL_SECOP_OTHER_TYPE 0xffff0000 -# define SSL_SECOP_OTHER_NONE 0 -# define SSL_SECOP_OTHER_CIPHER (1 << 16) -# define SSL_SECOP_OTHER_CURVE (2 << 16) -# define SSL_SECOP_OTHER_DH (3 << 16) -# define SSL_SECOP_OTHER_PKEY (4 << 16) -# define SSL_SECOP_OTHER_SIGALG (5 << 16) -# define SSL_SECOP_OTHER_CERT (6 << 16) - -/* Indicated operation refers to peer key or certificate */ -# define SSL_SECOP_PEER 0x1000 - -/* Values for "op" parameter in security callback */ - -/* Called to filter ciphers */ -/* Ciphers client supports */ -# define SSL_SECOP_CIPHER_SUPPORTED (1 | SSL_SECOP_OTHER_CIPHER) -/* Cipher shared by client/server */ -# define SSL_SECOP_CIPHER_SHARED (2 | SSL_SECOP_OTHER_CIPHER) -/* Sanity check of cipher server selects */ -# define SSL_SECOP_CIPHER_CHECK (3 | SSL_SECOP_OTHER_CIPHER) -/* Curves supported by client */ -# define SSL_SECOP_CURVE_SUPPORTED (4 | SSL_SECOP_OTHER_CURVE) -/* Curves shared by client/server */ -# define SSL_SECOP_CURVE_SHARED (5 | SSL_SECOP_OTHER_CURVE) -/* Sanity check of curve server selects */ -# define SSL_SECOP_CURVE_CHECK (6 | SSL_SECOP_OTHER_CURVE) -/* Temporary DH key */ -# define SSL_SECOP_TMP_DH (7 | SSL_SECOP_OTHER_PKEY) -/* SSL/TLS version */ -# define SSL_SECOP_VERSION (9 | SSL_SECOP_OTHER_NONE) -/* Session tickets */ -# define SSL_SECOP_TICKET (10 | SSL_SECOP_OTHER_NONE) -/* Supported signature algorithms sent to peer */ -# define SSL_SECOP_SIGALG_SUPPORTED (11 | SSL_SECOP_OTHER_SIGALG) -/* Shared signature algorithm */ -# define SSL_SECOP_SIGALG_SHARED (12 | SSL_SECOP_OTHER_SIGALG) -/* Sanity check signature algorithm allowed */ -# define SSL_SECOP_SIGALG_CHECK (13 | SSL_SECOP_OTHER_SIGALG) -/* Used to get mask of supported public key signature algorithms */ -# define SSL_SECOP_SIGALG_MASK (14 | SSL_SECOP_OTHER_SIGALG) -/* Use to see if compression is allowed */ -# define SSL_SECOP_COMPRESSION (15 | SSL_SECOP_OTHER_NONE) -/* EE key in certificate */ -# define SSL_SECOP_EE_KEY (16 | SSL_SECOP_OTHER_CERT) -/* CA key in certificate */ -# define SSL_SECOP_CA_KEY (17 | SSL_SECOP_OTHER_CERT) -/* CA digest algorithm in certificate */ -# define SSL_SECOP_CA_MD (18 | SSL_SECOP_OTHER_CERT) -/* Peer EE key in certificate */ -# define SSL_SECOP_PEER_EE_KEY (SSL_SECOP_EE_KEY | SSL_SECOP_PEER) -/* Peer CA key in certificate */ -# define SSL_SECOP_PEER_CA_KEY (SSL_SECOP_CA_KEY | SSL_SECOP_PEER) -/* Peer CA digest algorithm in certificate */ -# define SSL_SECOP_PEER_CA_MD (SSL_SECOP_CA_MD | SSL_SECOP_PEER) - -void SSL_set_security_level(SSL *s, int level); -__owur int SSL_get_security_level(const SSL *s); -void SSL_set_security_callback(SSL *s, - int (*cb) (const SSL *s, const SSL_CTX *ctx, - int op, int bits, int nid, - void *other, void *ex)); -int (*SSL_get_security_callback(const SSL *s)) (const SSL *s, - const SSL_CTX *ctx, int op, - int bits, int nid, void *other, - void *ex); -void SSL_set0_security_ex_data(SSL *s, void *ex); -__owur void *SSL_get0_security_ex_data(const SSL *s); - -void SSL_CTX_set_security_level(SSL_CTX *ctx, int level); -__owur int SSL_CTX_get_security_level(const SSL_CTX *ctx); -void SSL_CTX_set_security_callback(SSL_CTX *ctx, - int (*cb) (const SSL *s, const SSL_CTX *ctx, - int op, int bits, int nid, - void *other, void *ex)); -int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (const SSL *s, - const SSL_CTX *ctx, - int op, int bits, - int nid, - void *other, - void *ex); -void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex); -__owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx); - -/* OPENSSL_INIT flag 0x010000 reserved for internal use */ -# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x00100000L -# define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L - -# define OPENSSL_INIT_SSL_DEFAULT \ - (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS) - -int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); - -# ifndef OPENSSL_NO_UNIT_TEST -__owur const struct openssl_ssl_test_functions *SSL_test_functions(void); -# endif - -__owur int SSL_free_buffers(SSL *ssl); -__owur int SSL_alloc_buffers(SSL *ssl); - -/* Status codes passed to the decrypt session ticket callback. Some of these - * are for internal use only and are never passed to the callback. */ -typedef int SSL_TICKET_STATUS; - -/* Support for ticket appdata */ -/* fatal error, malloc failure */ -# define SSL_TICKET_FATAL_ERR_MALLOC 0 -/* fatal error, either from parsing or decrypting the ticket */ -# define SSL_TICKET_FATAL_ERR_OTHER 1 -/* No ticket present */ -# define SSL_TICKET_NONE 2 -/* Empty ticket present */ -# define SSL_TICKET_EMPTY 3 -/* the ticket couldn't be decrypted */ -# define SSL_TICKET_NO_DECRYPT 4 -/* a ticket was successfully decrypted */ -# define SSL_TICKET_SUCCESS 5 -/* same as above but the ticket needs to be renewed */ -# define SSL_TICKET_SUCCESS_RENEW 6 - -/* Return codes for the decrypt session ticket callback */ -typedef int SSL_TICKET_RETURN; - -/* An error occurred */ -#define SSL_TICKET_RETURN_ABORT 0 -/* Do not use the ticket, do not send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_IGNORE 1 -/* Do not use the ticket, send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_IGNORE_RENEW 2 -/* Use the ticket, do not send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_USE 3 -/* Use the ticket, send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_USE_RENEW 4 - -typedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg); -typedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss, - const unsigned char *keyname, - size_t keyname_length, - SSL_TICKET_STATUS status, - void *arg); -int SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx, - SSL_CTX_generate_session_ticket_fn gen_cb, - SSL_CTX_decrypt_session_ticket_fn dec_cb, - void *arg); -int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len); -int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len); - -extern const char SSL_version_str[]; - -typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us); - -void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb); - - -typedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg); -void SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx, - SSL_allow_early_data_cb_fn cb, - void *arg); -void SSL_set_allow_early_data_cb(SSL *s, - SSL_allow_early_data_cb_fn cb, - void *arg); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ssl2.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ssl2.h deleted file mode 100644 index 5321bd27..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ssl2.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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_SSL2_H -# define HEADER_SSL2_H - -#ifdef __cplusplus -extern "C" { -#endif - -# define SSL2_VERSION 0x0002 - -# define SSL2_MT_CLIENT_HELLO 1 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ssl3.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ssl3.h deleted file mode 100644 index 8d01fcc4..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ssl3.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_SSL3_H -# define HEADER_SSL3_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Signalling cipher suite value from RFC 5746 - * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) - */ -# define SSL3_CK_SCSV 0x030000FF - -/* - * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 - * (TLS_FALLBACK_SCSV) - */ -# define SSL3_CK_FALLBACK_SCSV 0x03005600 - -# define SSL3_CK_RSA_NULL_MD5 0x03000001 -# define SSL3_CK_RSA_NULL_SHA 0x03000002 -# define SSL3_CK_RSA_RC4_40_MD5 0x03000003 -# define SSL3_CK_RSA_RC4_128_MD5 0x03000004 -# define SSL3_CK_RSA_RC4_128_SHA 0x03000005 -# define SSL3_CK_RSA_RC2_40_MD5 0x03000006 -# define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 -# define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 -# define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 -# define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A - -# define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B -# define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C -# define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D -# define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E -# define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F -# define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 - -# define SSL3_CK_DHE_DSS_DES_40_CBC_SHA 0x03000011 -# define SSL3_CK_EDH_DSS_DES_40_CBC_SHA SSL3_CK_DHE_DSS_DES_40_CBC_SHA -# define SSL3_CK_DHE_DSS_DES_64_CBC_SHA 0x03000012 -# define SSL3_CK_EDH_DSS_DES_64_CBC_SHA SSL3_CK_DHE_DSS_DES_64_CBC_SHA -# define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA 0x03000013 -# define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA SSL3_CK_DHE_DSS_DES_192_CBC3_SHA -# define SSL3_CK_DHE_RSA_DES_40_CBC_SHA 0x03000014 -# define SSL3_CK_EDH_RSA_DES_40_CBC_SHA SSL3_CK_DHE_RSA_DES_40_CBC_SHA -# define SSL3_CK_DHE_RSA_DES_64_CBC_SHA 0x03000015 -# define SSL3_CK_EDH_RSA_DES_64_CBC_SHA SSL3_CK_DHE_RSA_DES_64_CBC_SHA -# define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA 0x03000016 -# define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA SSL3_CK_DHE_RSA_DES_192_CBC3_SHA - -# define SSL3_CK_ADH_RC4_40_MD5 0x03000017 -# define SSL3_CK_ADH_RC4_128_MD5 0x03000018 -# define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 -# define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A -# define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B - -/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ -# define SSL3_RFC_RSA_NULL_MD5 "TLS_RSA_WITH_NULL_MD5" -# define SSL3_RFC_RSA_NULL_SHA "TLS_RSA_WITH_NULL_SHA" -# define SSL3_RFC_RSA_DES_192_CBC3_SHA "TLS_RSA_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_DHE_DSS_DES_192_CBC3_SHA "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_DHE_RSA_DES_192_CBC3_SHA "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_ADH_DES_192_CBC_SHA "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_RSA_IDEA_128_SHA "TLS_RSA_WITH_IDEA_CBC_SHA" -# define SSL3_RFC_RSA_RC4_128_MD5 "TLS_RSA_WITH_RC4_128_MD5" -# define SSL3_RFC_RSA_RC4_128_SHA "TLS_RSA_WITH_RC4_128_SHA" -# define SSL3_RFC_ADH_RC4_128_MD5 "TLS_DH_anon_WITH_RC4_128_MD5" - -# define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" -# define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" -# define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" -# define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" -# define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" -# define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" -# define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" -# define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" -# define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" -# define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" - -# define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" -# define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" -# define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" -# define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" -# define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" -# define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" - -# define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" -# define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" -# define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" -# define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" -# define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" -# define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" - -/* - * This next block of six "EDH" labels is for backward compatibility with - * older versions of OpenSSL. New code should use the six "DHE" labels above - * instead: - */ -# define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" -# define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" -# define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" -# define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" -# define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" -# define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" - -# define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" -# define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" -# define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" -# define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" -# define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" - -# define SSL3_SSL_SESSION_ID_LENGTH 32 -# define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 - -# define SSL3_MASTER_SECRET_SIZE 48 -# define SSL3_RANDOM_SIZE 32 -# define SSL3_SESSION_ID_SIZE 32 -# define SSL3_RT_HEADER_LENGTH 5 - -# define SSL3_HM_HEADER_LENGTH 4 - -# ifndef SSL3_ALIGN_PAYLOAD - /* - * Some will argue that this increases memory footprint, but it's not - * actually true. Point is that malloc has to return at least 64-bit aligned - * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. - * Suggested pre-gaping simply moves these wasted bytes from the end of - * allocated region to its front, but makes data payload aligned, which - * improves performance:-) - */ -# define SSL3_ALIGN_PAYLOAD 8 -# else -# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0 -# error "insane SSL3_ALIGN_PAYLOAD" -# undef SSL3_ALIGN_PAYLOAD -# endif -# endif - -/* - * This is the maximum MAC (digest) size used by the SSL library. Currently - * maximum of 20 is used by SHA1, but we reserve for future extension for - * 512-bit hashes. - */ - -# define SSL3_RT_MAX_MD_SIZE 64 - -/* - * Maximum block size used in all ciphersuites. Currently 16 for AES. - */ - -# define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 - -# define SSL3_RT_MAX_EXTRA (16384) - -/* Maximum plaintext length: defined by SSL/TLS standards */ -# define SSL3_RT_MAX_PLAIN_LENGTH 16384 -/* Maximum compression overhead: defined by SSL/TLS standards */ -# define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 - -/* - * The standards give a maximum encryption overhead of 1024 bytes. In - * practice the value is lower than this. The overhead is the maximum number - * of padding bytes (256) plus the mac size. - */ -# define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) -# define SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD 256 - -/* - * OpenSSL currently only uses a padding length of at most one block so the - * send overhead is smaller. - */ - -# define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ - (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) - -/* If compression isn't used don't include the compression overhead */ - -# ifdef OPENSSL_NO_COMP -# define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH -# else -# define SSL3_RT_MAX_COMPRESSED_LENGTH \ - (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) -# endif -# define SSL3_RT_MAX_ENCRYPTED_LENGTH \ - (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) -# define SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH \ - (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD) -# define SSL3_RT_MAX_PACKET_SIZE \ - (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) - -# define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" -# define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" - -# define SSL3_VERSION 0x0300 -# define SSL3_VERSION_MAJOR 0x03 -# define SSL3_VERSION_MINOR 0x00 - -# define SSL3_RT_CHANGE_CIPHER_SPEC 20 -# define SSL3_RT_ALERT 21 -# define SSL3_RT_HANDSHAKE 22 -# define SSL3_RT_APPLICATION_DATA 23 -# define DTLS1_RT_HEARTBEAT 24 - -/* Pseudo content types to indicate additional parameters */ -# define TLS1_RT_CRYPTO 0x1000 -# define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) -# define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) -# define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) -# define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) - -# define TLS1_RT_CRYPTO_READ 0x0000 -# define TLS1_RT_CRYPTO_WRITE 0x0100 -# define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) -# define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) -# define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) -# define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) - -/* Pseudo content types for SSL/TLS header info */ -# define SSL3_RT_HEADER 0x100 -# define SSL3_RT_INNER_CONTENT_TYPE 0x101 - -# define SSL3_AL_WARNING 1 -# define SSL3_AL_FATAL 2 - -# define SSL3_AD_CLOSE_NOTIFY 0 -# define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */ -# define SSL3_AD_BAD_RECORD_MAC 20/* fatal */ -# define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */ -# define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */ -# define SSL3_AD_NO_CERTIFICATE 41 -# define SSL3_AD_BAD_CERTIFICATE 42 -# define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 -# define SSL3_AD_CERTIFICATE_REVOKED 44 -# define SSL3_AD_CERTIFICATE_EXPIRED 45 -# define SSL3_AD_CERTIFICATE_UNKNOWN 46 -# define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */ - -# define TLS1_HB_REQUEST 1 -# define TLS1_HB_RESPONSE 2 - - -# define SSL3_CT_RSA_SIGN 1 -# define SSL3_CT_DSS_SIGN 2 -# define SSL3_CT_RSA_FIXED_DH 3 -# define SSL3_CT_DSS_FIXED_DH 4 -# define SSL3_CT_RSA_EPHEMERAL_DH 5 -# define SSL3_CT_DSS_EPHEMERAL_DH 6 -# define SSL3_CT_FORTEZZA_DMS 20 -/* - * SSL3_CT_NUMBER is used to size arrays and it must be large enough to - * contain all of the cert types defined for *either* SSLv3 and TLSv1. - */ -# define SSL3_CT_NUMBER 10 - -# if defined(TLS_CT_NUMBER) -# if TLS_CT_NUMBER != SSL3_CT_NUMBER -# error "SSL/TLS CT_NUMBER values do not match" -# endif -# endif - -/* No longer used as of OpenSSL 1.1.1 */ -# define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 - -/* Removed from OpenSSL 1.1.0 */ -# define TLS1_FLAGS_TLS_PADDING_BUG 0x0 - -# define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 - -/* Set if we encrypt then mac instead of usual mac then encrypt */ -# define TLS1_FLAGS_ENCRYPT_THEN_MAC_READ 0x0100 -# define TLS1_FLAGS_ENCRYPT_THEN_MAC TLS1_FLAGS_ENCRYPT_THEN_MAC_READ - -/* Set if extended master secret extension received from peer */ -# define TLS1_FLAGS_RECEIVED_EXTMS 0x0200 - -# define TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE 0x0400 - -# define TLS1_FLAGS_STATELESS 0x0800 - -# define SSL3_MT_HELLO_REQUEST 0 -# define SSL3_MT_CLIENT_HELLO 1 -# define SSL3_MT_SERVER_HELLO 2 -# define SSL3_MT_NEWSESSION_TICKET 4 -# define SSL3_MT_END_OF_EARLY_DATA 5 -# define SSL3_MT_ENCRYPTED_EXTENSIONS 8 -# define SSL3_MT_CERTIFICATE 11 -# define SSL3_MT_SERVER_KEY_EXCHANGE 12 -# define SSL3_MT_CERTIFICATE_REQUEST 13 -# define SSL3_MT_SERVER_DONE 14 -# define SSL3_MT_CERTIFICATE_VERIFY 15 -# define SSL3_MT_CLIENT_KEY_EXCHANGE 16 -# define SSL3_MT_FINISHED 20 -# define SSL3_MT_CERTIFICATE_URL 21 -# define SSL3_MT_CERTIFICATE_STATUS 22 -# define SSL3_MT_SUPPLEMENTAL_DATA 23 -# define SSL3_MT_KEY_UPDATE 24 -# ifndef OPENSSL_NO_NEXTPROTONEG -# define SSL3_MT_NEXT_PROTO 67 -# endif -# define SSL3_MT_MESSAGE_HASH 254 -# define DTLS1_MT_HELLO_VERIFY_REQUEST 3 - -/* Dummy message type for handling CCS like a normal handshake message */ -# define SSL3_MT_CHANGE_CIPHER_SPEC 0x0101 - -# define SSL3_MT_CCS 1 - -/* These are used when changing over to a new cipher */ -# define SSL3_CC_READ 0x001 -# define SSL3_CC_WRITE 0x002 -# define SSL3_CC_CLIENT 0x010 -# define SSL3_CC_SERVER 0x020 -# define SSL3_CC_EARLY 0x040 -# define SSL3_CC_HANDSHAKE 0x080 -# define SSL3_CC_APPLICATION 0x100 -# define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) -# define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) -# define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) -# define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/sslerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/sslerr.h deleted file mode 100644 index 82983d3c..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/sslerr.h +++ /dev/null @@ -1,773 +0,0 @@ -/* - * 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_SSLERR_H -# define HEADER_SSLERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_SSL_strings(void); - -/* - * SSL function codes. - */ -# define SSL_F_ADD_CLIENT_KEY_SHARE_EXT 438 -# define SSL_F_ADD_KEY_SHARE 512 -# define SSL_F_BYTES_TO_CIPHER_LIST 519 -# define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 -# define SSL_F_CIPHERSUITE_CB 622 -# define SSL_F_CONSTRUCT_CA_NAMES 552 -# define SSL_F_CONSTRUCT_KEY_EXCHANGE_TBS 553 -# define SSL_F_CONSTRUCT_STATEFUL_TICKET 636 -# define SSL_F_CONSTRUCT_STATELESS_TICKET 637 -# define SSL_F_CREATE_SYNTHETIC_MESSAGE_HASH 539 -# define SSL_F_CREATE_TICKET_PREQUEL 638 -# define SSL_F_CT_MOVE_SCTS 345 -# define SSL_F_CT_STRICT 349 -# define SSL_F_CUSTOM_EXT_ADD 554 -# define SSL_F_CUSTOM_EXT_PARSE 555 -# define SSL_F_D2I_SSL_SESSION 103 -# define SSL_F_DANE_CTX_ENABLE 347 -# define SSL_F_DANE_MTYPE_SET 393 -# define SSL_F_DANE_TLSA_ADD 394 -# define SSL_F_DERIVE_SECRET_KEY_AND_IV 514 -# define SSL_F_DO_DTLS1_WRITE 245 -# define SSL_F_DO_SSL3_WRITE 104 -# define SSL_F_DTLS1_BUFFER_RECORD 247 -# define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 318 -# define SSL_F_DTLS1_HEARTBEAT 305 -# define SSL_F_DTLS1_HM_FRAGMENT_NEW 623 -# define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 -# define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 -# define SSL_F_DTLS1_PROCESS_RECORD 257 -# define SSL_F_DTLS1_READ_BYTES 258 -# define SSL_F_DTLS1_READ_FAILED 339 -# define SSL_F_DTLS1_RETRANSMIT_MESSAGE 390 -# define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 -# define SSL_F_DTLS1_WRITE_BYTES 545 -# define SSL_F_DTLSV1_LISTEN 350 -# define SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC 371 -# define SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST 385 -# define SSL_F_DTLS_GET_REASSEMBLED_MESSAGE 370 -# define SSL_F_DTLS_PROCESS_HELLO_VERIFY 386 -# define SSL_F_DTLS_RECORD_LAYER_NEW 635 -# define SSL_F_DTLS_WAIT_FOR_DRY 592 -# define SSL_F_EARLY_DATA_COUNT_OK 532 -# define SSL_F_FINAL_EARLY_DATA 556 -# define SSL_F_FINAL_EC_PT_FORMATS 485 -# define SSL_F_FINAL_EMS 486 -# define SSL_F_FINAL_KEY_SHARE 503 -# define SSL_F_FINAL_MAXFRAGMENTLEN 557 -# define SSL_F_FINAL_RENEGOTIATE 483 -# define SSL_F_FINAL_SERVER_NAME 558 -# define SSL_F_FINAL_SIG_ALGS 497 -# define SSL_F_GET_CERT_VERIFY_TBS_DATA 588 -# define SSL_F_NSS_KEYLOG_INT 500 -# define SSL_F_OPENSSL_INIT_SSL 342 -# define SSL_F_OSSL_STATEM_CLIENT13_READ_TRANSITION 436 -# define SSL_F_OSSL_STATEM_CLIENT13_WRITE_TRANSITION 598 -# define SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE 430 -# define SSL_F_OSSL_STATEM_CLIENT_POST_PROCESS_MESSAGE 593 -# define SSL_F_OSSL_STATEM_CLIENT_PROCESS_MESSAGE 594 -# define SSL_F_OSSL_STATEM_CLIENT_READ_TRANSITION 417 -# define SSL_F_OSSL_STATEM_CLIENT_WRITE_TRANSITION 599 -# define SSL_F_OSSL_STATEM_SERVER13_READ_TRANSITION 437 -# define SSL_F_OSSL_STATEM_SERVER13_WRITE_TRANSITION 600 -# define SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE 431 -# define SSL_F_OSSL_STATEM_SERVER_POST_PROCESS_MESSAGE 601 -# define SSL_F_OSSL_STATEM_SERVER_POST_WORK 602 -# define SSL_F_OSSL_STATEM_SERVER_PRE_WORK 640 -# define SSL_F_OSSL_STATEM_SERVER_PROCESS_MESSAGE 603 -# define SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION 418 -# define SSL_F_OSSL_STATEM_SERVER_WRITE_TRANSITION 604 -# define SSL_F_PARSE_CA_NAMES 541 -# define SSL_F_PITEM_NEW 624 -# define SSL_F_PQUEUE_NEW 625 -# define SSL_F_PROCESS_KEY_SHARE_EXT 439 -# define SSL_F_READ_STATE_MACHINE 352 -# define SSL_F_SET_CLIENT_CIPHERSUITE 540 -# define SSL_F_SRP_GENERATE_CLIENT_MASTER_SECRET 595 -# define SSL_F_SRP_GENERATE_SERVER_MASTER_SECRET 589 -# define SSL_F_SRP_VERIFY_SERVER_PARAM 596 -# define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 -# define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 -# define SSL_F_SSL3_CTRL 213 -# define SSL_F_SSL3_CTX_CTRL 133 -# define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 -# define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 -# define SSL_F_SSL3_ENC 608 -# define SSL_F_SSL3_FINAL_FINISH_MAC 285 -# define SSL_F_SSL3_FINISH_MAC 587 -# define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 -# define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 -# define SSL_F_SSL3_GET_RECORD 143 -# define SSL_F_SSL3_INIT_FINISHED_MAC 397 -# define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 -# define SSL_F_SSL3_READ_BYTES 148 -# define SSL_F_SSL3_READ_N 149 -# define SSL_F_SSL3_SETUP_KEY_BLOCK 157 -# define SSL_F_SSL3_SETUP_READ_BUFFER 156 -# define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 -# define SSL_F_SSL3_WRITE_BYTES 158 -# define SSL_F_SSL3_WRITE_PENDING 159 -# define SSL_F_SSL_ADD_CERT_CHAIN 316 -# define SSL_F_SSL_ADD_CERT_TO_BUF 319 -# define SSL_F_SSL_ADD_CERT_TO_WPACKET 493 -# define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 -# define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 -# define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 -# define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 -# define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 -# define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 -# define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 -# define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 -# define SSL_F_SSL_BAD_METHOD 160 -# define SSL_F_SSL_BUILD_CERT_CHAIN 332 -# define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 -# define SSL_F_SSL_CACHE_CIPHERLIST 520 -# define SSL_F_SSL_CERT_ADD0_CHAIN_CERT 346 -# define SSL_F_SSL_CERT_DUP 221 -# define SSL_F_SSL_CERT_NEW 162 -# define SSL_F_SSL_CERT_SET0_CHAIN 340 -# define SSL_F_SSL_CHECK_PRIVATE_KEY 163 -# define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 -# define SSL_F_SSL_CHECK_SRP_EXT_CLIENTHELLO 606 -# define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 -# define SSL_F_SSL_CHOOSE_CLIENT_VERSION 607 -# define SSL_F_SSL_CIPHER_DESCRIPTION 626 -# define SSL_F_SSL_CIPHER_LIST_TO_BYTES 425 -# define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 -# define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 -# define SSL_F_SSL_CLEAR 164 -# define SSL_F_SSL_CLIENT_HELLO_GET1_EXTENSIONS_PRESENT 627 -# define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 -# define SSL_F_SSL_CONF_CMD 334 -# define SSL_F_SSL_CREATE_CIPHER_LIST 166 -# define SSL_F_SSL_CTRL 232 -# define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 -# define SSL_F_SSL_CTX_ENABLE_CT 398 -# define SSL_F_SSL_CTX_MAKE_PROFILES 309 -# define SSL_F_SSL_CTX_NEW 169 -# define SSL_F_SSL_CTX_SET_ALPN_PROTOS 343 -# define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 -# define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 -# define SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK 396 -# define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 -# define SSL_F_SSL_CTX_SET_SSL_VERSION 170 -# define SSL_F_SSL_CTX_SET_TLSEXT_MAX_FRAGMENT_LENGTH 551 -# define SSL_F_SSL_CTX_USE_CERTIFICATE 171 -# define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 -# define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 -# define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 -# define SSL_F_SSL_CTX_USE_SERVERINFO 336 -# define SSL_F_SSL_CTX_USE_SERVERINFO_EX 543 -# define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 -# define SSL_F_SSL_DANE_DUP 403 -# define SSL_F_SSL_DANE_ENABLE 395 -# define SSL_F_SSL_DERIVE 590 -# define SSL_F_SSL_DO_CONFIG 391 -# define SSL_F_SSL_DO_HANDSHAKE 180 -# define SSL_F_SSL_DUP_CA_LIST 408 -# define SSL_F_SSL_ENABLE_CT 402 -# define SSL_F_SSL_GENERATE_PKEY_GROUP 559 -# define SSL_F_SSL_GENERATE_SESSION_ID 547 -# define SSL_F_SSL_GET_NEW_SESSION 181 -# define SSL_F_SSL_GET_PREV_SESSION 217 -# define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 -# define SSL_F_SSL_GET_SIGN_PKEY 183 -# define SSL_F_SSL_HANDSHAKE_HASH 560 -# define SSL_F_SSL_INIT_WBIO_BUFFER 184 -# define SSL_F_SSL_KEY_UPDATE 515 -# define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 -# define SSL_F_SSL_LOG_MASTER_SECRET 498 -# define SSL_F_SSL_LOG_RSA_CLIENT_KEY_EXCHANGE 499 -# define SSL_F_SSL_MODULE_INIT 392 -# define SSL_F_SSL_NEW 186 -# define SSL_F_SSL_NEXT_PROTO_VALIDATE 565 -# define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 -# define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 -# define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 -# define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 -# define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 -# define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 -# define SSL_F_SSL_PEEK 270 -# define SSL_F_SSL_PEEK_EX 432 -# define SSL_F_SSL_PEEK_INTERNAL 522 -# define SSL_F_SSL_READ 223 -# define SSL_F_SSL_READ_EARLY_DATA 529 -# define SSL_F_SSL_READ_EX 434 -# define SSL_F_SSL_READ_INTERNAL 523 -# define SSL_F_SSL_RENEGOTIATE 516 -# define SSL_F_SSL_RENEGOTIATE_ABBREVIATED 546 -# define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 -# define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 -# define SSL_F_SSL_SESSION_DUP 348 -# define SSL_F_SSL_SESSION_NEW 189 -# define SSL_F_SSL_SESSION_PRINT_FP 190 -# define SSL_F_SSL_SESSION_SET1_ID 423 -# define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 -# define SSL_F_SSL_SET_ALPN_PROTOS 344 -# define SSL_F_SSL_SET_CERT 191 -# define SSL_F_SSL_SET_CERT_AND_KEY 621 -# define SSL_F_SSL_SET_CIPHER_LIST 271 -# define SSL_F_SSL_SET_CT_VALIDATION_CALLBACK 399 -# define SSL_F_SSL_SET_FD 192 -# define SSL_F_SSL_SET_PKEY 193 -# define SSL_F_SSL_SET_RFD 194 -# define SSL_F_SSL_SET_SESSION 195 -# define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 -# define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 -# define SSL_F_SSL_SET_TLSEXT_MAX_FRAGMENT_LENGTH 550 -# define SSL_F_SSL_SET_WFD 196 -# define SSL_F_SSL_SHUTDOWN 224 -# define SSL_F_SSL_SRP_CTX_INIT 313 -# define SSL_F_SSL_START_ASYNC_JOB 389 -# define SSL_F_SSL_UNDEFINED_FUNCTION 197 -# define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 -# define SSL_F_SSL_USE_CERTIFICATE 198 -# define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 -# define SSL_F_SSL_USE_CERTIFICATE_FILE 200 -# define SSL_F_SSL_USE_PRIVATEKEY 201 -# define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 -# define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 -# define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 -# define SSL_F_SSL_USE_RSAPRIVATEKEY 204 -# define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 -# define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 -# define SSL_F_SSL_VALIDATE_CT 400 -# define SSL_F_SSL_VERIFY_CERT_CHAIN 207 -# define SSL_F_SSL_VERIFY_CLIENT_POST_HANDSHAKE 616 -# define SSL_F_SSL_WRITE 208 -# define SSL_F_SSL_WRITE_EARLY_DATA 526 -# define SSL_F_SSL_WRITE_EARLY_FINISH 527 -# define SSL_F_SSL_WRITE_EX 433 -# define SSL_F_SSL_WRITE_INTERNAL 524 -# define SSL_F_STATE_MACHINE 353 -# define SSL_F_TLS12_CHECK_PEER_SIGALG 333 -# define SSL_F_TLS12_COPY_SIGALGS 533 -# define SSL_F_TLS13_CHANGE_CIPHER_STATE 440 -# define SSL_F_TLS13_ENC 609 -# define SSL_F_TLS13_FINAL_FINISH_MAC 605 -# define SSL_F_TLS13_GENERATE_SECRET 591 -# define SSL_F_TLS13_HKDF_EXPAND 561 -# define SSL_F_TLS13_RESTORE_HANDSHAKE_DIGEST_FOR_PHA 617 -# define SSL_F_TLS13_SAVE_HANDSHAKE_DIGEST_FOR_PHA 618 -# define SSL_F_TLS13_SETUP_KEY_BLOCK 441 -# define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 -# define SSL_F_TLS1_CHECK_DUPLICATE_EXTENSIONS 341 -# define SSL_F_TLS1_ENC 401 -# define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 -# define SSL_F_TLS1_GET_CURVELIST 338 -# define SSL_F_TLS1_PRF 284 -# define SSL_F_TLS1_SAVE_U16 628 -# define SSL_F_TLS1_SETUP_KEY_BLOCK 211 -# define SSL_F_TLS1_SET_GROUPS 629 -# define SSL_F_TLS1_SET_RAW_SIGALGS 630 -# define SSL_F_TLS1_SET_SERVER_SIGALGS 335 -# define SSL_F_TLS1_SET_SHARED_SIGALGS 631 -# define SSL_F_TLS1_SET_SIGALGS 632 -# define SSL_F_TLS_CHOOSE_SIGALG 513 -# define SSL_F_TLS_CLIENT_KEY_EXCHANGE_POST_WORK 354 -# define SSL_F_TLS_COLLECT_EXTENSIONS 435 -# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES 542 -# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST 372 -# define SSL_F_TLS_CONSTRUCT_CERT_STATUS 429 -# define SSL_F_TLS_CONSTRUCT_CERT_STATUS_BODY 494 -# define SSL_F_TLS_CONSTRUCT_CERT_VERIFY 496 -# define SSL_F_TLS_CONSTRUCT_CHANGE_CIPHER_SPEC 427 -# define SSL_F_TLS_CONSTRUCT_CKE_DHE 404 -# define SSL_F_TLS_CONSTRUCT_CKE_ECDHE 405 -# define SSL_F_TLS_CONSTRUCT_CKE_GOST 406 -# define SSL_F_TLS_CONSTRUCT_CKE_PSK_PREAMBLE 407 -# define SSL_F_TLS_CONSTRUCT_CKE_RSA 409 -# define SSL_F_TLS_CONSTRUCT_CKE_SRP 410 -# define SSL_F_TLS_CONSTRUCT_CLIENT_CERTIFICATE 484 -# define SSL_F_TLS_CONSTRUCT_CLIENT_HELLO 487 -# define SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE 488 -# define SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY 489 -# define SSL_F_TLS_CONSTRUCT_CTOS_ALPN 466 -# define SSL_F_TLS_CONSTRUCT_CTOS_CERTIFICATE 355 -# define SSL_F_TLS_CONSTRUCT_CTOS_COOKIE 535 -# define SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA 530 -# define SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS 467 -# define SSL_F_TLS_CONSTRUCT_CTOS_EMS 468 -# define SSL_F_TLS_CONSTRUCT_CTOS_ETM 469 -# define SSL_F_TLS_CONSTRUCT_CTOS_HELLO 356 -# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_EXCHANGE 357 -# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE 470 -# define SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN 549 -# define SSL_F_TLS_CONSTRUCT_CTOS_NPN 471 -# define SSL_F_TLS_CONSTRUCT_CTOS_PADDING 472 -# define SSL_F_TLS_CONSTRUCT_CTOS_POST_HANDSHAKE_AUTH 619 -# define SSL_F_TLS_CONSTRUCT_CTOS_PSK 501 -# define SSL_F_TLS_CONSTRUCT_CTOS_PSK_KEX_MODES 509 -# define SSL_F_TLS_CONSTRUCT_CTOS_RENEGOTIATE 473 -# define SSL_F_TLS_CONSTRUCT_CTOS_SCT 474 -# define SSL_F_TLS_CONSTRUCT_CTOS_SERVER_NAME 475 -# define SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET 476 -# define SSL_F_TLS_CONSTRUCT_CTOS_SIG_ALGS 477 -# define SSL_F_TLS_CONSTRUCT_CTOS_SRP 478 -# define SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST 479 -# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS 480 -# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS 481 -# define SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP 482 -# define SSL_F_TLS_CONSTRUCT_CTOS_VERIFY 358 -# define SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS 443 -# define SSL_F_TLS_CONSTRUCT_END_OF_EARLY_DATA 536 -# define SSL_F_TLS_CONSTRUCT_EXTENSIONS 447 -# define SSL_F_TLS_CONSTRUCT_FINISHED 359 -# define SSL_F_TLS_CONSTRUCT_HELLO_REQUEST 373 -# define SSL_F_TLS_CONSTRUCT_HELLO_RETRY_REQUEST 510 -# define SSL_F_TLS_CONSTRUCT_KEY_UPDATE 517 -# define SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET 428 -# define SSL_F_TLS_CONSTRUCT_NEXT_PROTO 426 -# define SSL_F_TLS_CONSTRUCT_SERVER_CERTIFICATE 490 -# define SSL_F_TLS_CONSTRUCT_SERVER_HELLO 491 -# define SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE 492 -# define SSL_F_TLS_CONSTRUCT_STOC_ALPN 451 -# define SSL_F_TLS_CONSTRUCT_STOC_CERTIFICATE 374 -# define SSL_F_TLS_CONSTRUCT_STOC_COOKIE 613 -# define SSL_F_TLS_CONSTRUCT_STOC_CRYPTOPRO_BUG 452 -# define SSL_F_TLS_CONSTRUCT_STOC_DONE 375 -# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA 531 -# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA_INFO 525 -# define SSL_F_TLS_CONSTRUCT_STOC_EC_PT_FORMATS 453 -# define SSL_F_TLS_CONSTRUCT_STOC_EMS 454 -# define SSL_F_TLS_CONSTRUCT_STOC_ETM 455 -# define SSL_F_TLS_CONSTRUCT_STOC_HELLO 376 -# define SSL_F_TLS_CONSTRUCT_STOC_KEY_EXCHANGE 377 -# define SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE 456 -# define SSL_F_TLS_CONSTRUCT_STOC_MAXFRAGMENTLEN 548 -# define SSL_F_TLS_CONSTRUCT_STOC_NEXT_PROTO_NEG 457 -# define SSL_F_TLS_CONSTRUCT_STOC_PSK 504 -# define SSL_F_TLS_CONSTRUCT_STOC_RENEGOTIATE 458 -# define SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME 459 -# define SSL_F_TLS_CONSTRUCT_STOC_SESSION_TICKET 460 -# define SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST 461 -# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_GROUPS 544 -# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_VERSIONS 611 -# define SSL_F_TLS_CONSTRUCT_STOC_USE_SRTP 462 -# define SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO 521 -# define SSL_F_TLS_FINISH_HANDSHAKE 597 -# define SSL_F_TLS_GET_MESSAGE_BODY 351 -# define SSL_F_TLS_GET_MESSAGE_HEADER 387 -# define SSL_F_TLS_HANDLE_ALPN 562 -# define SSL_F_TLS_HANDLE_STATUS_REQUEST 563 -# define SSL_F_TLS_PARSE_CERTIFICATE_AUTHORITIES 566 -# define SSL_F_TLS_PARSE_CLIENTHELLO_TLSEXT 449 -# define SSL_F_TLS_PARSE_CTOS_ALPN 567 -# define SSL_F_TLS_PARSE_CTOS_COOKIE 614 -# define SSL_F_TLS_PARSE_CTOS_EARLY_DATA 568 -# define SSL_F_TLS_PARSE_CTOS_EC_PT_FORMATS 569 -# define SSL_F_TLS_PARSE_CTOS_EMS 570 -# define SSL_F_TLS_PARSE_CTOS_KEY_SHARE 463 -# define SSL_F_TLS_PARSE_CTOS_MAXFRAGMENTLEN 571 -# define SSL_F_TLS_PARSE_CTOS_POST_HANDSHAKE_AUTH 620 -# define SSL_F_TLS_PARSE_CTOS_PSK 505 -# define SSL_F_TLS_PARSE_CTOS_PSK_KEX_MODES 572 -# define SSL_F_TLS_PARSE_CTOS_RENEGOTIATE 464 -# define SSL_F_TLS_PARSE_CTOS_SERVER_NAME 573 -# define SSL_F_TLS_PARSE_CTOS_SESSION_TICKET 574 -# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS 575 -# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS_CERT 615 -# define SSL_F_TLS_PARSE_CTOS_SRP 576 -# define SSL_F_TLS_PARSE_CTOS_STATUS_REQUEST 577 -# define SSL_F_TLS_PARSE_CTOS_SUPPORTED_GROUPS 578 -# define SSL_F_TLS_PARSE_CTOS_USE_SRTP 465 -# define SSL_F_TLS_PARSE_STOC_ALPN 579 -# define SSL_F_TLS_PARSE_STOC_COOKIE 534 -# define SSL_F_TLS_PARSE_STOC_EARLY_DATA 538 -# define SSL_F_TLS_PARSE_STOC_EARLY_DATA_INFO 528 -# define SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS 580 -# define SSL_F_TLS_PARSE_STOC_KEY_SHARE 445 -# define SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN 581 -# define SSL_F_TLS_PARSE_STOC_NPN 582 -# define SSL_F_TLS_PARSE_STOC_PSK 502 -# define SSL_F_TLS_PARSE_STOC_RENEGOTIATE 448 -# define SSL_F_TLS_PARSE_STOC_SCT 564 -# define SSL_F_TLS_PARSE_STOC_SERVER_NAME 583 -# define SSL_F_TLS_PARSE_STOC_SESSION_TICKET 584 -# define SSL_F_TLS_PARSE_STOC_STATUS_REQUEST 585 -# define SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS 612 -# define SSL_F_TLS_PARSE_STOC_USE_SRTP 446 -# define SSL_F_TLS_POST_PROCESS_CLIENT_HELLO 378 -# define SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE 384 -# define SSL_F_TLS_PREPARE_CLIENT_CERTIFICATE 360 -# define SSL_F_TLS_PROCESS_AS_HELLO_RETRY_REQUEST 610 -# define SSL_F_TLS_PROCESS_CERTIFICATE_REQUEST 361 -# define SSL_F_TLS_PROCESS_CERT_STATUS 362 -# define SSL_F_TLS_PROCESS_CERT_STATUS_BODY 495 -# define SSL_F_TLS_PROCESS_CERT_VERIFY 379 -# define SSL_F_TLS_PROCESS_CHANGE_CIPHER_SPEC 363 -# define SSL_F_TLS_PROCESS_CKE_DHE 411 -# define SSL_F_TLS_PROCESS_CKE_ECDHE 412 -# define SSL_F_TLS_PROCESS_CKE_GOST 413 -# define SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE 414 -# define SSL_F_TLS_PROCESS_CKE_RSA 415 -# define SSL_F_TLS_PROCESS_CKE_SRP 416 -# define SSL_F_TLS_PROCESS_CLIENT_CERTIFICATE 380 -# define SSL_F_TLS_PROCESS_CLIENT_HELLO 381 -# define SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE 382 -# define SSL_F_TLS_PROCESS_ENCRYPTED_EXTENSIONS 444 -# define SSL_F_TLS_PROCESS_END_OF_EARLY_DATA 537 -# define SSL_F_TLS_PROCESS_FINISHED 364 -# define SSL_F_TLS_PROCESS_HELLO_REQ 507 -# define SSL_F_TLS_PROCESS_HELLO_RETRY_REQUEST 511 -# define SSL_F_TLS_PROCESS_INITIAL_SERVER_FLIGHT 442 -# define SSL_F_TLS_PROCESS_KEY_EXCHANGE 365 -# define SSL_F_TLS_PROCESS_KEY_UPDATE 518 -# define SSL_F_TLS_PROCESS_NEW_SESSION_TICKET 366 -# define SSL_F_TLS_PROCESS_NEXT_PROTO 383 -# define SSL_F_TLS_PROCESS_SERVER_CERTIFICATE 367 -# define SSL_F_TLS_PROCESS_SERVER_DONE 368 -# define SSL_F_TLS_PROCESS_SERVER_HELLO 369 -# define SSL_F_TLS_PROCESS_SKE_DHE 419 -# define SSL_F_TLS_PROCESS_SKE_ECDHE 420 -# define SSL_F_TLS_PROCESS_SKE_PSK_PREAMBLE 421 -# define SSL_F_TLS_PROCESS_SKE_SRP 422 -# define SSL_F_TLS_PSK_DO_BINDER 506 -# define SSL_F_TLS_SCAN_CLIENTHELLO_TLSEXT 450 -# define SSL_F_TLS_SETUP_HANDSHAKE 508 -# define SSL_F_USE_CERTIFICATE_CHAIN_FILE 220 -# define SSL_F_WPACKET_INTERN_INIT_LEN 633 -# define SSL_F_WPACKET_START_SUB_PACKET_LEN__ 634 -# define SSL_F_WRITE_STATE_MACHINE 586 - -/* - * SSL reason codes. - */ -# define SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY 291 -# define SSL_R_APP_DATA_IN_HANDSHAKE 100 -# define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 -# define SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE 143 -# define SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE 158 -# define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 -# define SSL_R_BAD_CIPHER 186 -# define SSL_R_BAD_DATA 390 -# define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 -# define SSL_R_BAD_DECOMPRESSION 107 -# define SSL_R_BAD_DH_VALUE 102 -# define SSL_R_BAD_DIGEST_LENGTH 111 -# define SSL_R_BAD_EARLY_DATA 233 -# define SSL_R_BAD_ECC_CERT 304 -# define SSL_R_BAD_ECPOINT 306 -# define SSL_R_BAD_EXTENSION 110 -# define SSL_R_BAD_HANDSHAKE_LENGTH 332 -# define SSL_R_BAD_HANDSHAKE_STATE 236 -# define SSL_R_BAD_HELLO_REQUEST 105 -# define SSL_R_BAD_HRR_VERSION 263 -# define SSL_R_BAD_KEY_SHARE 108 -# define SSL_R_BAD_KEY_UPDATE 122 -# define SSL_R_BAD_LEGACY_VERSION 292 -# define SSL_R_BAD_LENGTH 271 -# define SSL_R_BAD_PACKET 240 -# define SSL_R_BAD_PACKET_LENGTH 115 -# define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 -# define SSL_R_BAD_PSK 219 -# define SSL_R_BAD_PSK_IDENTITY 114 -# define SSL_R_BAD_RECORD_TYPE 443 -# define SSL_R_BAD_RSA_ENCRYPT 119 -# define SSL_R_BAD_SIGNATURE 123 -# define SSL_R_BAD_SRP_A_LENGTH 347 -# define SSL_R_BAD_SRP_PARAMETERS 371 -# define SSL_R_BAD_SRTP_MKI_VALUE 352 -# define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 -# define SSL_R_BAD_SSL_FILETYPE 124 -# define SSL_R_BAD_VALUE 384 -# define SSL_R_BAD_WRITE_RETRY 127 -# define SSL_R_BINDER_DOES_NOT_VERIFY 253 -# define SSL_R_BIO_NOT_SET 128 -# define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 -# define SSL_R_BN_LIB 130 -# define SSL_R_CALLBACK_FAILED 234 -# define SSL_R_CANNOT_CHANGE_CIPHER 109 -# define SSL_R_CA_DN_LENGTH_MISMATCH 131 -# define SSL_R_CA_KEY_TOO_SMALL 397 -# define SSL_R_CA_MD_TOO_WEAK 398 -# define SSL_R_CCS_RECEIVED_EARLY 133 -# define SSL_R_CERTIFICATE_VERIFY_FAILED 134 -# define SSL_R_CERT_CB_ERROR 377 -# define SSL_R_CERT_LENGTH_MISMATCH 135 -# define SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED 218 -# define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 -# define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 -# define SSL_R_CLIENTHELLO_TLSEXT 226 -# define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 -# define SSL_R_COMPRESSION_DISABLED 343 -# define SSL_R_COMPRESSION_FAILURE 141 -# define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 -# define SSL_R_COMPRESSION_LIBRARY_ERROR 142 -# define SSL_R_CONNECTION_TYPE_NOT_SET 144 -# define SSL_R_CONTEXT_NOT_DANE_ENABLED 167 -# define SSL_R_COOKIE_GEN_CALLBACK_FAILURE 400 -# define SSL_R_COOKIE_MISMATCH 308 -# define SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED 206 -# define SSL_R_DANE_ALREADY_ENABLED 172 -# define SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL 173 -# define SSL_R_DANE_NOT_ENABLED 175 -# define SSL_R_DANE_TLSA_BAD_CERTIFICATE 180 -# define SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE 184 -# define SSL_R_DANE_TLSA_BAD_DATA_LENGTH 189 -# define SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH 192 -# define SSL_R_DANE_TLSA_BAD_MATCHING_TYPE 200 -# define SSL_R_DANE_TLSA_BAD_PUBLIC_KEY 201 -# define SSL_R_DANE_TLSA_BAD_SELECTOR 202 -# define SSL_R_DANE_TLSA_NULL_DATA 203 -# define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 -# define SSL_R_DATA_LENGTH_TOO_LONG 146 -# define SSL_R_DECRYPTION_FAILED 147 -# define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 -# define SSL_R_DH_KEY_TOO_SMALL 394 -# define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 -# define SSL_R_DIGEST_CHECK_FAILED 149 -# define SSL_R_DTLS_MESSAGE_TOO_BIG 334 -# define SSL_R_DUPLICATE_COMPRESSION_ID 309 -# define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 -# define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 -# define SSL_R_EE_KEY_TOO_SMALL 399 -# define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 -# define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 -# define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 -# define SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN 204 -# define SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE 194 -# define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 -# define SSL_R_EXTENSION_NOT_RECEIVED 279 -# define SSL_R_EXTRA_DATA_IN_MESSAGE 153 -# define SSL_R_EXT_LENGTH_MISMATCH 163 -# define SSL_R_FAILED_TO_INIT_ASYNC 405 -# define SSL_R_FRAGMENTED_CLIENT_HELLO 401 -# define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 -# define SSL_R_HTTPS_PROXY_REQUEST 155 -# define SSL_R_HTTP_REQUEST 156 -# define SSL_R_ILLEGAL_POINT_COMPRESSION 162 -# define SSL_R_ILLEGAL_SUITEB_DIGEST 380 -# define SSL_R_INAPPROPRIATE_FALLBACK 373 -# define SSL_R_INCONSISTENT_COMPRESSION 340 -# define SSL_R_INCONSISTENT_EARLY_DATA_ALPN 222 -# define SSL_R_INCONSISTENT_EARLY_DATA_SNI 231 -# define SSL_R_INCONSISTENT_EXTMS 104 -# define SSL_R_INSUFFICIENT_SECURITY 241 -# define SSL_R_INVALID_ALERT 205 -# define SSL_R_INVALID_CCS_MESSAGE 260 -# define SSL_R_INVALID_CERTIFICATE_OR_ALG 238 -# define SSL_R_INVALID_COMMAND 280 -# define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 -# define SSL_R_INVALID_CONFIG 283 -# define SSL_R_INVALID_CONFIGURATION_NAME 113 -# define SSL_R_INVALID_CONTEXT 282 -# define SSL_R_INVALID_CT_VALIDATION_TYPE 212 -# define SSL_R_INVALID_KEY_UPDATE_TYPE 120 -# define SSL_R_INVALID_MAX_EARLY_DATA 174 -# define SSL_R_INVALID_NULL_CMD_NAME 385 -# define SSL_R_INVALID_SEQUENCE_NUMBER 402 -# define SSL_R_INVALID_SERVERINFO_DATA 388 -# define SSL_R_INVALID_SESSION_ID 999 -# define SSL_R_INVALID_SRP_USERNAME 357 -# define SSL_R_INVALID_STATUS_RESPONSE 328 -# define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 -# define SSL_R_LENGTH_MISMATCH 159 -# define SSL_R_LENGTH_TOO_LONG 404 -# define SSL_R_LENGTH_TOO_SHORT 160 -# define SSL_R_LIBRARY_BUG 274 -# define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 -# define SSL_R_MISSING_DSA_SIGNING_CERT 165 -# define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 -# define SSL_R_MISSING_FATAL 256 -# define SSL_R_MISSING_PARAMETERS 290 -# define SSL_R_MISSING_RSA_CERTIFICATE 168 -# define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 -# define SSL_R_MISSING_RSA_SIGNING_CERT 170 -# define SSL_R_MISSING_SIGALGS_EXTENSION 112 -# define SSL_R_MISSING_SIGNING_CERT 221 -# define SSL_R_MISSING_SRP_PARAM 358 -# define SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION 209 -# define SSL_R_MISSING_TMP_DH_KEY 171 -# define SSL_R_MISSING_TMP_ECDH_KEY 311 -# define SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA 293 -# define SSL_R_NOT_ON_RECORD_BOUNDARY 182 -# define SSL_R_NOT_REPLACING_CERTIFICATE 289 -# define SSL_R_NOT_SERVER 284 -# define SSL_R_NO_APPLICATION_PROTOCOL 235 -# define SSL_R_NO_CERTIFICATES_RETURNED 176 -# define SSL_R_NO_CERTIFICATE_ASSIGNED 177 -# define SSL_R_NO_CERTIFICATE_SET 179 -# define SSL_R_NO_CHANGE_FOLLOWING_HRR 214 -# define SSL_R_NO_CIPHERS_AVAILABLE 181 -# define SSL_R_NO_CIPHERS_SPECIFIED 183 -# define SSL_R_NO_CIPHER_MATCH 185 -# define SSL_R_NO_CLIENT_CERT_METHOD 331 -# define SSL_R_NO_COMPRESSION_SPECIFIED 187 -# define SSL_R_NO_COOKIE_CALLBACK_SET 287 -# define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 -# define SSL_R_NO_METHOD_SPECIFIED 188 -# define SSL_R_NO_PEM_EXTENSIONS 389 -# define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 -# define SSL_R_NO_PROTOCOLS_AVAILABLE 191 -# define SSL_R_NO_RENEGOTIATION 339 -# define SSL_R_NO_REQUIRED_DIGEST 324 -# define SSL_R_NO_SHARED_CIPHER 193 -# define SSL_R_NO_SHARED_GROUPS 410 -# define SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS 376 -# define SSL_R_NO_SRTP_PROFILES 359 -# define SSL_R_NO_SUITABLE_KEY_SHARE 101 -# define SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM 118 -# define SSL_R_NO_VALID_SCTS 216 -# define SSL_R_NO_VERIFY_COOKIE_CALLBACK 403 -# define SSL_R_NULL_SSL_CTX 195 -# define SSL_R_NULL_SSL_METHOD_PASSED 196 -# define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 -# define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 -# define SSL_R_OVERFLOW_ERROR 237 -# define SSL_R_PACKET_LENGTH_TOO_LONG 198 -# define SSL_R_PARSE_TLSEXT 227 -# define SSL_R_PATH_TOO_LONG 270 -# define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 -# define SSL_R_PEM_NAME_BAD_PREFIX 391 -# define SSL_R_PEM_NAME_TOO_SHORT 392 -# define SSL_R_PIPELINE_FAILURE 406 -# define SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR 278 -# define SSL_R_PRIVATE_KEY_MISMATCH 288 -# define SSL_R_PROTOCOL_IS_SHUTDOWN 207 -# define SSL_R_PSK_IDENTITY_NOT_FOUND 223 -# define SSL_R_PSK_NO_CLIENT_CB 224 -# define SSL_R_PSK_NO_SERVER_CB 225 -# define SSL_R_READ_BIO_NOT_SET 211 -# define SSL_R_READ_TIMEOUT_EXPIRED 312 -# define SSL_R_RECORD_LENGTH_MISMATCH 213 -# define SSL_R_RECORD_TOO_SMALL 298 -# define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 -# define SSL_R_RENEGOTIATION_ENCODING_ERR 336 -# define SSL_R_RENEGOTIATION_MISMATCH 337 -# define SSL_R_REQUEST_PENDING 285 -# define SSL_R_REQUEST_SENT 286 -# define SSL_R_REQUIRED_CIPHER_MISSING 215 -# define SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING 342 -# define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 -# define SSL_R_SCT_VERIFICATION_FAILED 208 -# define SSL_R_SERVERHELLO_TLSEXT 275 -# define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 -# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 -# define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 -# define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 -# define SSL_R_SRP_A_CALC 361 -# define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 -# define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 -# define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 -# define SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH 232 -# define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 -# define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 -# define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 -# define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 -# define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 -# define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 -# define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 -# define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 -# define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 -# define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 -# define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 -# define SSL_R_SSL_COMMAND_SECTION_EMPTY 117 -# define SSL_R_SSL_COMMAND_SECTION_NOT_FOUND 125 -# define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 -# define SSL_R_SSL_HANDSHAKE_FAILURE 229 -# define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 -# define SSL_R_SSL_NEGATIVE_LENGTH 372 -# define SSL_R_SSL_SECTION_EMPTY 126 -# define SSL_R_SSL_SECTION_NOT_FOUND 136 -# define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 -# define SSL_R_SSL_SESSION_ID_CONFLICT 302 -# define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 -# define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 -# define SSL_R_SSL_SESSION_ID_TOO_LONG 408 -# define SSL_R_SSL_SESSION_VERSION_MISMATCH 210 -# define SSL_R_STILL_IN_INIT 121 -# define SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED 1116 -# define SSL_R_TLSV13_ALERT_MISSING_EXTENSION 1109 -# define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 -# define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 -# define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 -# define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 -# define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 -# define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 -# define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 -# define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 -# define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 -# define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 -# define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 -# define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 -# define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 -# define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 -# define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 -# define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 -# define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 -# define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 -# define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 -# define SSL_R_TLS_HEARTBEAT_PENDING 366 -# define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 -# define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 -# define SSL_R_TOO_MANY_KEY_UPDATES 132 -# define SSL_R_TOO_MANY_WARN_ALERTS 409 -# define SSL_R_TOO_MUCH_EARLY_DATA 164 -# define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 -# define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 -# define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 -# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 -# define SSL_R_UNEXPECTED_CCS_MESSAGE 262 -# define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178 -# define SSL_R_UNEXPECTED_MESSAGE 244 -# define SSL_R_UNEXPECTED_RECORD 245 -# define SSL_R_UNINITIALIZED 276 -# define SSL_R_UNKNOWN_ALERT_TYPE 246 -# define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 -# define SSL_R_UNKNOWN_CIPHER_RETURNED 248 -# define SSL_R_UNKNOWN_CIPHER_TYPE 249 -# define SSL_R_UNKNOWN_CMD_NAME 386 -# define SSL_R_UNKNOWN_COMMAND 139 -# define SSL_R_UNKNOWN_DIGEST 368 -# define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 -# define SSL_R_UNKNOWN_PKEY_TYPE 251 -# define SSL_R_UNKNOWN_PROTOCOL 252 -# define SSL_R_UNKNOWN_SSL_VERSION 254 -# define SSL_R_UNKNOWN_STATE 255 -# define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 -# define SSL_R_UNSOLICITED_EXTENSION 217 -# define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 -# define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 -# define SSL_R_UNSUPPORTED_PROTOCOL 258 -# define SSL_R_UNSUPPORTED_SSL_VERSION 259 -# define SSL_R_UNSUPPORTED_STATUS_TYPE 329 -# define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 -# define SSL_R_VERSION_TOO_HIGH 166 -# define SSL_R_VERSION_TOO_LOW 396 -# define SSL_R_WRONG_CERTIFICATE_TYPE 383 -# define SSL_R_WRONG_CIPHER_RETURNED 261 -# define SSL_R_WRONG_CURVE 378 -# define SSL_R_WRONG_SIGNATURE_LENGTH 264 -# define SSL_R_WRONG_SIGNATURE_SIZE 265 -# define SSL_R_WRONG_SIGNATURE_TYPE 370 -# define SSL_R_WRONG_SSL_VERSION 266 -# define SSL_R_WRONG_VERSION_NUMBER 267 -# define SSL_R_X509_LIB 268 -# define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/stack.h b/Hin2n/src/main/jniLibs/x86/include/openssl/stack.h deleted file mode 100644 index cfc07505..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/stack.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 1995-2017 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_STACK_H -# define HEADER_STACK_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */ - -typedef int (*OPENSSL_sk_compfunc)(const void *, const void *); -typedef void (*OPENSSL_sk_freefunc)(void *); -typedef void *(*OPENSSL_sk_copyfunc)(const void *); - -int OPENSSL_sk_num(const OPENSSL_STACK *); -void *OPENSSL_sk_value(const OPENSSL_STACK *, int); - -void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data); - -OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp); -OPENSSL_STACK *OPENSSL_sk_new_null(void); -OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n); -int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n); -void OPENSSL_sk_free(OPENSSL_STACK *); -void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *)); -OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, - OPENSSL_sk_copyfunc c, - OPENSSL_sk_freefunc f); -int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where); -void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc); -void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p); -int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data); -void *OPENSSL_sk_shift(OPENSSL_STACK *st); -void *OPENSSL_sk_pop(OPENSSL_STACK *st); -void OPENSSL_sk_zero(OPENSSL_STACK *st); -OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, - OPENSSL_sk_compfunc cmp); -OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st); -void OPENSSL_sk_sort(OPENSSL_STACK *st); -int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define _STACK OPENSSL_STACK -# define sk_num OPENSSL_sk_num -# define sk_value OPENSSL_sk_value -# define sk_set OPENSSL_sk_set -# define sk_new OPENSSL_sk_new -# define sk_new_null OPENSSL_sk_new_null -# define sk_free OPENSSL_sk_free -# define sk_pop_free OPENSSL_sk_pop_free -# define sk_deep_copy OPENSSL_sk_deep_copy -# define sk_insert OPENSSL_sk_insert -# define sk_delete OPENSSL_sk_delete -# define sk_delete_ptr OPENSSL_sk_delete_ptr -# define sk_find OPENSSL_sk_find -# define sk_find_ex OPENSSL_sk_find_ex -# define sk_push OPENSSL_sk_push -# define sk_unshift OPENSSL_sk_unshift -# define sk_shift OPENSSL_sk_shift -# define sk_pop OPENSSL_sk_pop -# define sk_zero OPENSSL_sk_zero -# define sk_set_cmp_func OPENSSL_sk_set_cmp_func -# define sk_dup OPENSSL_sk_dup -# define sk_sort OPENSSL_sk_sort -# define sk_is_sorted OPENSSL_sk_is_sorted -# endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/store.h b/Hin2n/src/main/jniLibs/x86/include/openssl/store.h deleted file mode 100644 index a40a7339..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/store.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2016-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_OSSL_STORE_H -# define HEADER_OSSL_STORE_H - -# include -# include -# include -# include - -# ifdef __cplusplus -extern "C" { -# endif - -/*- - * The main OSSL_STORE functions. - * ------------------------------ - * - * These allow applications to open a channel to a resource with supported - * data (keys, certs, crls, ...), read the data a piece at a time and decide - * what to do with it, and finally close. - */ - -typedef struct ossl_store_ctx_st OSSL_STORE_CTX; - -/* - * Typedef for the OSSL_STORE_INFO post processing callback. This can be used - * to massage the given OSSL_STORE_INFO, or to drop it entirely (by returning - * NULL). - */ -typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *, - void *); - -/* - * Open a channel given a URI. The given UI method will be used any time the - * loader needs extra input, for example when a password or pin is needed, and - * will be passed the same user data every time it's needed in this context. - * - * Returns a context reference which represents the channel to communicate - * through. - */ -OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method, - void *ui_data, - OSSL_STORE_post_process_info_fn post_process, - void *post_process_data); - -/* - * Control / fine tune the OSSL_STORE channel. |cmd| determines what is to be - * done, and depends on the underlying loader (use OSSL_STORE_get0_scheme to - * determine which loader is used), except for common commands (see below). - * Each command takes different arguments. - */ -int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */); -int OSSL_STORE_vctrl(OSSL_STORE_CTX *ctx, int cmd, va_list args); - -/* - * Common ctrl commands that different loaders may choose to support. - */ -/* int on = 0 or 1; STORE_ctrl(ctx, STORE_C_USE_SECMEM, &on); */ -# define OSSL_STORE_C_USE_SECMEM 1 -/* Where custom commands start */ -# define OSSL_STORE_C_CUSTOM_START 100 - -/* - * Read one data item (a key, a cert, a CRL) that is supported by the OSSL_STORE - * functionality, given a context. - * Returns a OSSL_STORE_INFO pointer, from which OpenSSL typed data can be - * extracted with OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), ... - * NULL is returned on error, which may include that the data found at the URI - * can't be figured out for certain or is ambiguous. - */ -OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx); - -/* - * Check if end of data (end of file) is reached - * Returns 1 on end, 0 otherwise. - */ -int OSSL_STORE_eof(OSSL_STORE_CTX *ctx); - -/* - * Check if an error occurred - * Returns 1 if it did, 0 otherwise. - */ -int OSSL_STORE_error(OSSL_STORE_CTX *ctx); - -/* - * Close the channel - * Returns 1 on success, 0 on error. - */ -int OSSL_STORE_close(OSSL_STORE_CTX *ctx); - - -/*- - * Extracting OpenSSL types from and creating new OSSL_STORE_INFOs - * --------------------------------------------------------------- - */ - -/* - * Types of data that can be ossl_stored in a OSSL_STORE_INFO. - * OSSL_STORE_INFO_NAME is typically found when getting a listing of - * available "files" / "tokens" / what have you. - */ -# define OSSL_STORE_INFO_NAME 1 /* char * */ -# define OSSL_STORE_INFO_PARAMS 2 /* EVP_PKEY * */ -# define OSSL_STORE_INFO_PKEY 3 /* EVP_PKEY * */ -# define OSSL_STORE_INFO_CERT 4 /* X509 * */ -# define OSSL_STORE_INFO_CRL 5 /* X509_CRL * */ - -/* - * Functions to generate OSSL_STORE_INFOs, one function for each type we - * support having in them, as well as a generic constructor. - * - * In all cases, ownership of the object is transferred to the OSSL_STORE_INFO - * and will therefore be freed when the OSSL_STORE_INFO is freed. - */ -OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name); -int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(EVP_PKEY *params); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl); - -/* - * Functions to try to extract data from a OSSL_STORE_INFO. - */ -int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *info); -const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *info); -char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *info); -const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO *info); -char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *info); -X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *info); -X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *info); -X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *info); -X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *info); - -const char *OSSL_STORE_INFO_type_string(int type); - -/* - * Free the OSSL_STORE_INFO - */ -void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info); - - -/*- - * Functions to construct a search URI from a base URI and search criteria - * ----------------------------------------------------------------------- - */ - -/* OSSL_STORE search types */ -# define OSSL_STORE_SEARCH_BY_NAME 1 /* subject in certs, issuer in CRLs */ -# define OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 2 -# define OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 3 -# define OSSL_STORE_SEARCH_BY_ALIAS 4 - -/* To check what search types the scheme handler supports */ -int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type); - -/* Search term constructors */ -/* - * The input is considered to be owned by the caller, and must therefore - * remain present throughout the lifetime of the returned OSSL_STORE_SEARCH - */ -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name, - const ASN1_INTEGER - *serial); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest, - const unsigned char - *bytes, size_t len); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias); - -/* Search term destructor */ -void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search); - -/* Search term accessors */ -int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion); -X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion); -const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH - *criterion); -const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH - *criterion, size_t *length); -const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion); -const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH *criterion); - -/* - * Add search criterion and expected return type (which can be unspecified) - * to the loading channel. This MUST happen before the first OSSL_STORE_load(). - */ -int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type); -int OSSL_STORE_find(OSSL_STORE_CTX *ctx, OSSL_STORE_SEARCH *search); - - -/*- - * Function to register a loader for the given URI scheme. - * ------------------------------------------------------- - * - * The loader receives all the main components of an URI except for the - * scheme. - */ - -typedef struct ossl_store_loader_st OSSL_STORE_LOADER; -OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme); -const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader); -const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader); -/* struct ossl_store_loader_ctx_st is defined differently by each loader */ -typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX; -typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(const OSSL_STORE_LOADER - *loader, - const char *uri, - const UI_METHOD *ui_method, - void *ui_data); -int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader, - OSSL_STORE_open_fn open_function); -typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd, - va_list args); -int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader, - OSSL_STORE_ctrl_fn ctrl_function); -typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected); -int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader, - OSSL_STORE_expect_fn expect_function); -typedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx, - OSSL_STORE_SEARCH *criteria); -int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader, - OSSL_STORE_find_fn find_function); -typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx, - const UI_METHOD *ui_method, - void *ui_data); -int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *loader, - OSSL_STORE_load_fn load_function); -typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *loader, - OSSL_STORE_eof_fn eof_function); -typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader, - OSSL_STORE_error_fn error_function); -typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader, - OSSL_STORE_close_fn close_function); -void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader); - -int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader); -OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme); - -/*- - * Functions to list STORE loaders - * ------------------------------- - */ -int OSSL_STORE_do_all_loaders(void (*do_function) (const OSSL_STORE_LOADER - *loader, void *do_arg), - void *do_arg); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/storeerr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/storeerr.h deleted file mode 100644 index 190eab07..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/storeerr.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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_OSSL_STOREERR_H -# define HEADER_OSSL_STOREERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_OSSL_STORE_strings(void); - -/* - * OSSL_STORE function codes. - */ -# define OSSL_STORE_F_FILE_CTRL 129 -# define OSSL_STORE_F_FILE_FIND 138 -# define OSSL_STORE_F_FILE_GET_PASS 118 -# define OSSL_STORE_F_FILE_LOAD 119 -# define OSSL_STORE_F_FILE_LOAD_TRY_DECODE 124 -# define OSSL_STORE_F_FILE_NAME_TO_URI 126 -# define OSSL_STORE_F_FILE_OPEN 120 -# define OSSL_STORE_F_OSSL_STORE_ATTACH_PEM_BIO 127 -# define OSSL_STORE_F_OSSL_STORE_EXPECT 130 -# define OSSL_STORE_F_OSSL_STORE_FILE_ATTACH_PEM_BIO_INT 128 -# define OSSL_STORE_F_OSSL_STORE_FIND 131 -# define OSSL_STORE_F_OSSL_STORE_GET0_LOADER_INT 100 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CERT 101 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CRL 102 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME 103 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME_DESCRIPTION 135 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PARAMS 104 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PKEY 105 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CERT 106 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CRL 107 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_EMBEDDED 123 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_NAME 109 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PARAMS 110 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PKEY 111 -# define OSSL_STORE_F_OSSL_STORE_INFO_SET0_NAME_DESCRIPTION 134 -# define OSSL_STORE_F_OSSL_STORE_INIT_ONCE 112 -# define OSSL_STORE_F_OSSL_STORE_LOADER_NEW 113 -# define OSSL_STORE_F_OSSL_STORE_OPEN 114 -# define OSSL_STORE_F_OSSL_STORE_OPEN_INT 115 -# define OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT 117 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ALIAS 132 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 133 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 136 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_NAME 137 -# define OSSL_STORE_F_OSSL_STORE_UNREGISTER_LOADER_INT 116 -# define OSSL_STORE_F_TRY_DECODE_PARAMS 121 -# define OSSL_STORE_F_TRY_DECODE_PKCS12 122 -# define OSSL_STORE_F_TRY_DECODE_PKCS8ENCRYPTED 125 - -/* - * OSSL_STORE reason codes. - */ -# define OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE 107 -# define OSSL_STORE_R_BAD_PASSWORD_READ 115 -# define OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC 113 -# define OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST 121 -# define OSSL_STORE_R_INVALID_SCHEME 106 -# define OSSL_STORE_R_IS_NOT_A 112 -# define OSSL_STORE_R_LOADER_INCOMPLETE 116 -# define OSSL_STORE_R_LOADING_STARTED 117 -# define OSSL_STORE_R_NOT_A_CERTIFICATE 100 -# define OSSL_STORE_R_NOT_A_CRL 101 -# define OSSL_STORE_R_NOT_A_KEY 102 -# define OSSL_STORE_R_NOT_A_NAME 103 -# define OSSL_STORE_R_NOT_PARAMETERS 104 -# define OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR 114 -# define OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE 108 -# define OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 119 -# define OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED 109 -# define OSSL_STORE_R_UNREGISTERED_SCHEME 105 -# define OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE 110 -# define OSSL_STORE_R_UNSUPPORTED_OPERATION 118 -# define OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE 120 -# define OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED 111 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/symhacks.h b/Hin2n/src/main/jniLibs/x86/include/openssl/symhacks.h deleted file mode 100644 index 156ea6e4..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/symhacks.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 1999-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_SYMHACKS_H -# define HEADER_SYMHACKS_H - -# include - -/* Case insensitive linking causes problems.... */ -# if defined(OPENSSL_SYS_VMS) -# undef ERR_load_CRYPTO_strings -# define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings -# undef OCSP_crlID_new -# define OCSP_crlID_new OCSP_crlID2_new - -# undef d2i_ECPARAMETERS -# define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS -# undef i2d_ECPARAMETERS -# define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS -# undef d2i_ECPKPARAMETERS -# define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS -# undef i2d_ECPKPARAMETERS -# define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS - -/* This one clashes with CMS_data_create */ -# undef cms_Data_create -# define cms_Data_create priv_cms_Data_create - -# endif - -#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/tls1.h b/Hin2n/src/main/jniLibs/x86/include/openssl/tls1.h deleted file mode 100644 index 76d9fda4..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/tls1.h +++ /dev/null @@ -1,1237 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved - * Copyright 2005 Nokia. 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_TLS1_H -# define HEADER_TLS1_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Default security level if not overridden at config time */ -# ifndef OPENSSL_TLS_SECURITY_LEVEL -# define OPENSSL_TLS_SECURITY_LEVEL 1 -# endif - -# define TLS1_VERSION 0x0301 -# define TLS1_1_VERSION 0x0302 -# define TLS1_2_VERSION 0x0303 -# define TLS1_3_VERSION 0x0304 -# define TLS_MAX_VERSION TLS1_3_VERSION - -/* Special value for method supporting multiple versions */ -# define TLS_ANY_VERSION 0x10000 - -# define TLS1_VERSION_MAJOR 0x03 -# define TLS1_VERSION_MINOR 0x01 - -# define TLS1_1_VERSION_MAJOR 0x03 -# define TLS1_1_VERSION_MINOR 0x02 - -# define TLS1_2_VERSION_MAJOR 0x03 -# define TLS1_2_VERSION_MINOR 0x03 - -# define TLS1_get_version(s) \ - ((SSL_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_version(s) : 0) - -# define TLS1_get_client_version(s) \ - ((SSL_client_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_client_version(s) : 0) - -# define TLS1_AD_DECRYPTION_FAILED 21 -# define TLS1_AD_RECORD_OVERFLOW 22 -# define TLS1_AD_UNKNOWN_CA 48/* fatal */ -# define TLS1_AD_ACCESS_DENIED 49/* fatal */ -# define TLS1_AD_DECODE_ERROR 50/* fatal */ -# define TLS1_AD_DECRYPT_ERROR 51 -# define TLS1_AD_EXPORT_RESTRICTION 60/* fatal */ -# define TLS1_AD_PROTOCOL_VERSION 70/* fatal */ -# define TLS1_AD_INSUFFICIENT_SECURITY 71/* fatal */ -# define TLS1_AD_INTERNAL_ERROR 80/* fatal */ -# define TLS1_AD_INAPPROPRIATE_FALLBACK 86/* fatal */ -# define TLS1_AD_USER_CANCELLED 90 -# define TLS1_AD_NO_RENEGOTIATION 100 -/* TLSv1.3 alerts */ -# define TLS13_AD_MISSING_EXTENSION 109 /* fatal */ -# define TLS13_AD_CERTIFICATE_REQUIRED 116 /* fatal */ -/* codes 110-114 are from RFC3546 */ -# define TLS1_AD_UNSUPPORTED_EXTENSION 110 -# define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 -# define TLS1_AD_UNRECOGNIZED_NAME 112 -# define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 -# define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 -# define TLS1_AD_UNKNOWN_PSK_IDENTITY 115/* fatal */ -# define TLS1_AD_NO_APPLICATION_PROTOCOL 120 /* fatal */ - -/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ -# define TLSEXT_TYPE_server_name 0 -# define TLSEXT_TYPE_max_fragment_length 1 -# define TLSEXT_TYPE_client_certificate_url 2 -# define TLSEXT_TYPE_trusted_ca_keys 3 -# define TLSEXT_TYPE_truncated_hmac 4 -# define TLSEXT_TYPE_status_request 5 -/* ExtensionType values from RFC4681 */ -# define TLSEXT_TYPE_user_mapping 6 -/* ExtensionType values from RFC5878 */ -# define TLSEXT_TYPE_client_authz 7 -# define TLSEXT_TYPE_server_authz 8 -/* ExtensionType values from RFC6091 */ -# define TLSEXT_TYPE_cert_type 9 - -/* ExtensionType values from RFC4492 */ -/* - * Prior to TLSv1.3 the supported_groups extension was known as - * elliptic_curves - */ -# define TLSEXT_TYPE_supported_groups 10 -# define TLSEXT_TYPE_elliptic_curves TLSEXT_TYPE_supported_groups -# define TLSEXT_TYPE_ec_point_formats 11 - - -/* ExtensionType value from RFC5054 */ -# define TLSEXT_TYPE_srp 12 - -/* ExtensionType values from RFC5246 */ -# define TLSEXT_TYPE_signature_algorithms 13 - -/* ExtensionType value from RFC5764 */ -# define TLSEXT_TYPE_use_srtp 14 - -/* ExtensionType value from RFC5620 */ -# define TLSEXT_TYPE_heartbeat 15 - -/* ExtensionType value from RFC7301 */ -# define TLSEXT_TYPE_application_layer_protocol_negotiation 16 - -/* - * Extension type for Certificate Transparency - * https://tools.ietf.org/html/rfc6962#section-3.3.1 - */ -# define TLSEXT_TYPE_signed_certificate_timestamp 18 - -/* - * ExtensionType value for TLS padding extension. - * http://tools.ietf.org/html/draft-agl-tls-padding - */ -# define TLSEXT_TYPE_padding 21 - -/* ExtensionType value from RFC7366 */ -# define TLSEXT_TYPE_encrypt_then_mac 22 - -/* ExtensionType value from RFC7627 */ -# define TLSEXT_TYPE_extended_master_secret 23 - -/* ExtensionType value from RFC4507 */ -# define TLSEXT_TYPE_session_ticket 35 - -/* As defined for TLS1.3 */ -# define TLSEXT_TYPE_psk 41 -# define TLSEXT_TYPE_early_data 42 -# define TLSEXT_TYPE_supported_versions 43 -# define TLSEXT_TYPE_cookie 44 -# define TLSEXT_TYPE_psk_kex_modes 45 -# define TLSEXT_TYPE_certificate_authorities 47 -# define TLSEXT_TYPE_post_handshake_auth 49 -# define TLSEXT_TYPE_signature_algorithms_cert 50 -# define TLSEXT_TYPE_key_share 51 - -/* Temporary extension type */ -# define TLSEXT_TYPE_renegotiate 0xff01 - -# ifndef OPENSSL_NO_NEXTPROTONEG -/* This is not an IANA defined extension number */ -# define TLSEXT_TYPE_next_proto_neg 13172 -# endif - -/* NameType value from RFC3546 */ -# define TLSEXT_NAMETYPE_host_name 0 -/* status request value from RFC3546 */ -# define TLSEXT_STATUSTYPE_ocsp 1 - -/* ECPointFormat values from RFC4492 */ -# define TLSEXT_ECPOINTFORMAT_first 0 -# define TLSEXT_ECPOINTFORMAT_uncompressed 0 -# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 -# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 -# define TLSEXT_ECPOINTFORMAT_last 2 - -/* Signature and hash algorithms from RFC5246 */ -# define TLSEXT_signature_anonymous 0 -# define TLSEXT_signature_rsa 1 -# define TLSEXT_signature_dsa 2 -# define TLSEXT_signature_ecdsa 3 -# define TLSEXT_signature_gostr34102001 237 -# define TLSEXT_signature_gostr34102012_256 238 -# define TLSEXT_signature_gostr34102012_512 239 - -/* Total number of different signature algorithms */ -# define TLSEXT_signature_num 7 - -# define TLSEXT_hash_none 0 -# define TLSEXT_hash_md5 1 -# define TLSEXT_hash_sha1 2 -# define TLSEXT_hash_sha224 3 -# define TLSEXT_hash_sha256 4 -# define TLSEXT_hash_sha384 5 -# define TLSEXT_hash_sha512 6 -# define TLSEXT_hash_gostr3411 237 -# define TLSEXT_hash_gostr34112012_256 238 -# define TLSEXT_hash_gostr34112012_512 239 - -/* Total number of different digest algorithms */ - -# define TLSEXT_hash_num 10 - -/* Flag set for unrecognised algorithms */ -# define TLSEXT_nid_unknown 0x1000000 - -/* ECC curves */ - -# define TLSEXT_curve_P_256 23 -# define TLSEXT_curve_P_384 24 - -/* OpenSSL value to disable maximum fragment length extension */ -# define TLSEXT_max_fragment_length_DISABLED 0 -/* Allowed values for max fragment length extension */ -# define TLSEXT_max_fragment_length_512 1 -# define TLSEXT_max_fragment_length_1024 2 -# define TLSEXT_max_fragment_length_2048 3 -# define TLSEXT_max_fragment_length_4096 4 - -int SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode); -int SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode); - -# define TLSEXT_MAXLEN_host_name 255 - -__owur const char *SSL_get_servername(const SSL *s, const int type); -__owur int SSL_get_servername_type(const SSL *s); -/* - * SSL_export_keying_material exports a value derived from the master secret, - * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and - * optional context. (Since a zero length context is allowed, the |use_context| - * flag controls whether a context is included.) It returns 1 on success and - * 0 or -1 otherwise. - */ -__owur int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, - const char *label, size_t llen, - const unsigned char *context, - size_t contextlen, int use_context); - -/* - * SSL_export_keying_material_early exports a value derived from the - * early exporter master secret, as specified in - * https://tools.ietf.org/html/draft-ietf-tls-tls13-23. It writes - * |olen| bytes to |out| given a label and optional context. It - * returns 1 on success and 0 otherwise. - */ -__owur int SSL_export_keying_material_early(SSL *s, unsigned char *out, - size_t olen, const char *label, - size_t llen, - const unsigned char *context, - size_t contextlen); - -int SSL_get_peer_signature_type_nid(const SSL *s, int *pnid); -int SSL_get_signature_type_nid(const SSL *s, int *pnid); - -int SSL_get_sigalgs(SSL *s, int idx, - int *psign, int *phash, int *psignandhash, - unsigned char *rsig, unsigned char *rhash); - -int SSL_get_shared_sigalgs(SSL *s, int idx, - int *psign, int *phash, int *psignandhash, - unsigned char *rsig, unsigned char *rhash); - -__owur int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain); - -# define SSL_set_tlsext_host_name(s,name) \ - SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,\ - (void *)name) - -# define SSL_set_tlsext_debug_callback(ssl, cb) \ - SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,\ - (void (*)(void))cb) - -# define SSL_set_tlsext_debug_arg(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0,arg) - -# define SSL_get_tlsext_status_type(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) - -# define SSL_set_tlsext_status_type(ssl, type) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) - -# define SSL_get_tlsext_status_exts(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0,arg) - -# define SSL_set_tlsext_status_exts(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0,arg) - -# define SSL_get_tlsext_status_ids(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0,arg) - -# define SSL_set_tlsext_status_ids(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0,arg) - -# define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0,arg) - -# define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen,arg) - -# define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ - SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,\ - (void (*)(void))cb) - -# define SSL_TLSEXT_ERR_OK 0 -# define SSL_TLSEXT_ERR_ALERT_WARNING 1 -# define SSL_TLSEXT_ERR_ALERT_FATAL 2 -# define SSL_TLSEXT_ERR_NOACK 3 - -# define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0,arg) - -# define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_TLSEXT_TICKET_KEYS,keylen,keys) -# define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_TICKET_KEYS,keylen,keys) - -# define SSL_CTX_get_tlsext_status_cb(ssl, cb) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB,0,(void *)cb) -# define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ - SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,\ - (void (*)(void))cb) - -# define SSL_CTX_get_tlsext_status_arg(ssl, arg) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) -# define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) - -# define SSL_CTX_set_tlsext_status_type(ssl, type) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) - -# define SSL_CTX_get_tlsext_status_type(ssl) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) - -# define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ - SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,\ - (void (*)(void))cb) - -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_DTLSEXT_HB_ENABLED 0x01 -# define SSL_DTLSEXT_HB_DONT_SEND_REQUESTS 0x02 -# define SSL_DTLSEXT_HB_DONT_RECV_REQUESTS 0x04 -# define SSL_get_dtlsext_heartbeat_pending(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING,0,NULL) -# define SSL_set_dtlsext_heartbeat_no_requests(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL) - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT \ - SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT -# define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING \ - SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING -# define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS \ - SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS -# define SSL_TLSEXT_HB_ENABLED \ - SSL_DTLSEXT_HB_ENABLED -# define SSL_TLSEXT_HB_DONT_SEND_REQUESTS \ - SSL_DTLSEXT_HB_DONT_SEND_REQUESTS -# define SSL_TLSEXT_HB_DONT_RECV_REQUESTS \ - SSL_DTLSEXT_HB_DONT_RECV_REQUESTS -# define SSL_get_tlsext_heartbeat_pending(ssl) \ - SSL_get_dtlsext_heartbeat_pending(ssl) -# define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \ - SSL_set_dtlsext_heartbeat_no_requests(ssl,arg) -# endif -# endif - -/* PSK ciphersuites from 4279 */ -# define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A -# define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B -# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C -# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D -# define TLS1_CK_DHE_PSK_WITH_RC4_128_SHA 0x0300008E -# define TLS1_CK_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008F -# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA 0x03000090 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA 0x03000091 -# define TLS1_CK_RSA_PSK_WITH_RC4_128_SHA 0x03000092 -# define TLS1_CK_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x03000093 -# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA 0x03000094 -# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA 0x03000095 - -/* PSK ciphersuites from 5487 */ -# define TLS1_CK_PSK_WITH_AES_128_GCM_SHA256 0x030000A8 -# define TLS1_CK_PSK_WITH_AES_256_GCM_SHA384 0x030000A9 -# define TLS1_CK_DHE_PSK_WITH_AES_128_GCM_SHA256 0x030000AA -# define TLS1_CK_DHE_PSK_WITH_AES_256_GCM_SHA384 0x030000AB -# define TLS1_CK_RSA_PSK_WITH_AES_128_GCM_SHA256 0x030000AC -# define TLS1_CK_RSA_PSK_WITH_AES_256_GCM_SHA384 0x030000AD -# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA256 0x030000AE -# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA384 0x030000AF -# define TLS1_CK_PSK_WITH_NULL_SHA256 0x030000B0 -# define TLS1_CK_PSK_WITH_NULL_SHA384 0x030000B1 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA256 0x030000B2 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA384 0x030000B3 -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA256 0x030000B4 -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA384 0x030000B5 -# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA256 0x030000B6 -# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA384 0x030000B7 -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA256 0x030000B8 -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA384 0x030000B9 - -/* NULL PSK ciphersuites from RFC4785 */ -# define TLS1_CK_PSK_WITH_NULL_SHA 0x0300002C -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA 0x0300002D -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA 0x0300002E - -/* AES ciphersuites from RFC3268 */ -# define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F -# define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 -# define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 -# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 -# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 -# define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 -# define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 -# define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 -# define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 -# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 -# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 -# define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A - -/* TLS v1.2 ciphersuites */ -# define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B -# define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C -# define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D -# define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E -# define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F -# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 -# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 - -/* TLS v1.2 ciphersuites */ -# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 -# define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 -# define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 -# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A -# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B -# define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C -# define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 -# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 - -/* SEED ciphersuites from RFC4162 */ -# define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 -# define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 -# define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 -# define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 -# define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A -# define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B - -/* TLS v1.2 GCM ciphersuites from RFC5288 */ -# define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C -# define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D -# define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E -# define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F -# define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 -# define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 -# define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 -# define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 -# define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 -# define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 -# define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 -# define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 - -/* CCM ciphersuites from RFC6655 */ -# define TLS1_CK_RSA_WITH_AES_128_CCM 0x0300C09C -# define TLS1_CK_RSA_WITH_AES_256_CCM 0x0300C09D -# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM 0x0300C09E -# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM 0x0300C09F -# define TLS1_CK_RSA_WITH_AES_128_CCM_8 0x0300C0A0 -# define TLS1_CK_RSA_WITH_AES_256_CCM_8 0x0300C0A1 -# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM_8 0x0300C0A2 -# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM_8 0x0300C0A3 -# define TLS1_CK_PSK_WITH_AES_128_CCM 0x0300C0A4 -# define TLS1_CK_PSK_WITH_AES_256_CCM 0x0300C0A5 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM 0x0300C0A6 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM 0x0300C0A7 -# define TLS1_CK_PSK_WITH_AES_128_CCM_8 0x0300C0A8 -# define TLS1_CK_PSK_WITH_AES_256_CCM_8 0x0300C0A9 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM_8 0x0300C0AA -# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM_8 0x0300C0AB - -/* CCM ciphersuites from RFC7251 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM 0x0300C0AC -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM 0x0300C0AD -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM_8 0x0300C0AE -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM_8 0x0300C0AF - -/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BA -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BB -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BC -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BD -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BE -# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256 0x030000BF - -# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C0 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C1 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C2 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C3 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4 -# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5 - -/* ECC ciphersuites from RFC4492 */ -# define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 -# define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 -# define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 - -# define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 -# define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 -# define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A - -# define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B -# define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C -# define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D -# define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E -# define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F - -# define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 -# define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 -# define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 - -# define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 -# define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 -# define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 -# define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 -# define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 - -/* SRP ciphersuites from RFC 5054 */ -# define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A -# define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B -# define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C -# define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D -# define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E -# define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F -# define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 -# define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 -# define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 - -/* ECDH HMAC based ciphersuites from RFC5289 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 -# define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 -# define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A - -/* ECDH GCM based ciphersuites from RFC5289 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 -# define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 -# define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 - -/* ECDHE PSK ciphersuites from RFC5489 */ -# define TLS1_CK_ECDHE_PSK_WITH_RC4_128_SHA 0x0300C033 -# define TLS1_CK_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300C034 -# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035 -# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036 - -# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0x0300C037 -# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0x0300C038 - -/* NULL PSK ciphersuites from RFC4785 */ -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA 0x0300C039 -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA256 0x0300C03A -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA384 0x0300C03B - -/* Camellia-CBC ciphersuites from RFC6367 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C072 -# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C073 -# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C074 -# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C075 -# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C076 -# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C077 -# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C078 -# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C079 - -# define TLS1_CK_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C094 -# define TLS1_CK_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C095 -# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C096 -# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C097 -# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C098 -# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C099 -# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C09A -# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C09B - -/* draft-ietf-tls-chacha20-poly1305-03 */ -# define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCA8 -# define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0x0300CCA9 -# define TLS1_CK_DHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCAA -# define TLS1_CK_PSK_WITH_CHACHA20_POLY1305 0x0300CCAB -# define TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAC -# define TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAD -# define TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305 0x0300CCAE - -/* TLS v1.3 ciphersuites */ -# define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301 -# define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302 -# define TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x03001303 -# define TLS1_3_CK_AES_128_CCM_SHA256 0x03001304 -# define TLS1_3_CK_AES_128_CCM_8_SHA256 0x03001305 - -/* Aria ciphersuites from RFC6209 */ -# define TLS1_CK_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C050 -# define TLS1_CK_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C051 -# define TLS1_CK_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C052 -# define TLS1_CK_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C053 -# define TLS1_CK_DH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C054 -# define TLS1_CK_DH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C055 -# define TLS1_CK_DHE_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C056 -# define TLS1_CK_DHE_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C057 -# define TLS1_CK_DH_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C058 -# define TLS1_CK_DH_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C059 -# define TLS1_CK_DH_anon_WITH_ARIA_128_GCM_SHA256 0x0300C05A -# define TLS1_CK_DH_anon_WITH_ARIA_256_GCM_SHA384 0x0300C05B -# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05C -# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05D -# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05E -# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05F -# define TLS1_CK_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C060 -# define TLS1_CK_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C061 -# define TLS1_CK_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C062 -# define TLS1_CK_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C063 -# define TLS1_CK_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06A -# define TLS1_CK_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06B -# define TLS1_CK_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06C -# define TLS1_CK_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06D -# define TLS1_CK_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06E -# define TLS1_CK_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06F - -/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ -# define TLS1_RFC_RSA_WITH_AES_128_SHA "TLS_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ADH_WITH_AES_128_SHA "TLS_DH_anon_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_RSA_WITH_AES_256_SHA "TLS_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ADH_WITH_AES_256_SHA "TLS_DH_anon_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_RSA_WITH_NULL_SHA256 "TLS_RSA_WITH_NULL_SHA256" -# define TLS1_RFC_RSA_WITH_AES_128_SHA256 "TLS_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_AES_256_SHA256 "TLS_RSA_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA256 "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA256 "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA256 "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA256 "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_AES_128_SHA256 "TLS_DH_anon_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_AES_256_SHA256 "TLS_DH_anon_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_AES_128_GCM_SHA256 "TLS_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_RSA_WITH_AES_256_GCM_SHA384 "TLS_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_GCM_SHA256 "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_GCM_SHA384 "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_ADH_WITH_AES_128_GCM_SHA256 "TLS_DH_anon_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ADH_WITH_AES_256_GCM_SHA384 "TLS_DH_anon_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_RSA_WITH_AES_128_CCM "TLS_RSA_WITH_AES_128_CCM" -# define TLS1_RFC_RSA_WITH_AES_256_CCM "TLS_RSA_WITH_AES_256_CCM" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM "TLS_DHE_RSA_WITH_AES_128_CCM" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM "TLS_DHE_RSA_WITH_AES_256_CCM" -# define TLS1_RFC_RSA_WITH_AES_128_CCM_8 "TLS_RSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_RSA_WITH_AES_256_CCM_8 "TLS_RSA_WITH_AES_256_CCM_8" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM_8 "TLS_DHE_RSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM_8 "TLS_DHE_RSA_WITH_AES_256_CCM_8" -# define TLS1_RFC_PSK_WITH_AES_128_CCM "TLS_PSK_WITH_AES_128_CCM" -# define TLS1_RFC_PSK_WITH_AES_256_CCM "TLS_PSK_WITH_AES_256_CCM" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM "TLS_DHE_PSK_WITH_AES_128_CCM" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM "TLS_DHE_PSK_WITH_AES_256_CCM" -# define TLS1_RFC_PSK_WITH_AES_128_CCM_8 "TLS_PSK_WITH_AES_128_CCM_8" -# define TLS1_RFC_PSK_WITH_AES_256_CCM_8 "TLS_PSK_WITH_AES_256_CCM_8" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM_8 "TLS_PSK_DHE_WITH_AES_128_CCM_8" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM_8 "TLS_PSK_DHE_WITH_AES_256_CCM_8" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM "TLS_ECDHE_ECDSA_WITH_AES_128_CCM" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM "TLS_ECDHE_ECDSA_WITH_AES_256_CCM" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8" -# define TLS1_3_RFC_AES_128_GCM_SHA256 "TLS_AES_128_GCM_SHA256" -# define TLS1_3_RFC_AES_256_GCM_SHA384 "TLS_AES_256_GCM_SHA384" -# define TLS1_3_RFC_CHACHA20_POLY1305_SHA256 "TLS_CHACHA20_POLY1305_SHA256" -# define TLS1_3_RFC_AES_128_CCM_SHA256 "TLS_AES_128_CCM_SHA256" -# define TLS1_3_RFC_AES_128_CCM_8_SHA256 "TLS_AES_128_CCM_8_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_NULL_SHA "TLS_ECDHE_ECDSA_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_NULL_SHA "TLS_ECDHE_RSA_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_NULL_SHA "TLS_ECDH_anon_WITH_NULL_SHA" -# define TLS1_RFC_ECDH_anon_WITH_DES_192_CBC3_SHA "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_AES_128_CBC_SHA "TLS_ECDH_anon_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_AES_256_CBC_SHA "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_NULL_SHA "TLS_PSK_WITH_NULL_SHA" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA "TLS_DHE_PSK_WITH_NULL_SHA" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA "TLS_RSA_PSK_WITH_NULL_SHA" -# define TLS1_RFC_PSK_WITH_3DES_EDE_CBC_SHA "TLS_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA "TLS_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA "TLS_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA "TLS_DHE_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA "TLS_DHE_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_3DES_EDE_CBC_SHA "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA "TLS_RSA_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA "TLS_RSA_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_128_GCM_SHA256 "TLS_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_PSK_WITH_AES_256_GCM_SHA384 "TLS_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_GCM_SHA256 "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_GCM_SHA384 "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_GCM_SHA256 "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_GCM_SHA384 "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA256 "TLS_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA384 "TLS_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_PSK_WITH_NULL_SHA256 "TLS_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_PSK_WITH_NULL_SHA384 "TLS_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA256 "TLS_DHE_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA384 "TLS_DHE_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA256 "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA384 "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA256 "TLS_RSA_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA384 "TLS_RSA_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA "TLS_ECDHE_PSK_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA256 "TLS_ECDHE_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA384 "TLS_ECDHE_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_SRP_SHA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CHACHA20_POLY1305 "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_PSK_WITH_CHACHA20_POLY1305 "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_CHACHA20_POLY1305 "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_CHACHA20_POLY1305 "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_CHACHA20_POLY1305 "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_RSA_WITH_SEED_SHA "TLS_RSA_WITH_SEED_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_SEED_SHA "TLS_DHE_DSS_WITH_SEED_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_SEED_SHA "TLS_DHE_RSA_WITH_SEED_CBC_SHA" -# define TLS1_RFC_ADH_WITH_SEED_SHA "TLS_DH_anon_WITH_SEED_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_RC4_128_SHA "TLS_ECDHE_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDH_anon_WITH_RC4_128_SHA "TLS_ECDH_anon_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_RC4_128_SHA "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_RC4_128_SHA "TLS_ECDHE_RSA_WITH_RC4_128_SHA" -# define TLS1_RFC_PSK_WITH_RC4_128_SHA "TLS_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_RSA_PSK_WITH_RC4_128_SHA "TLS_RSA_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_DHE_PSK_WITH_RC4_128_SHA "TLS_DHE_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_anon_WITH_ARIA_128_GCM_SHA256 "TLS_DH_anon_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_anon_WITH_ARIA_256_GCM_SHA384 "TLS_DH_anon_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_PSK_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384" - - -/* - * XXX Backward compatibility alert: Older versions of OpenSSL gave some DHE - * ciphers names with "EDH" instead of "DHE". Going forward, we should be - * using DHE everywhere, though we may indefinitely maintain aliases for - * users or configurations that used "EDH" - */ -# define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" - -# define TLS1_TXT_PSK_WITH_NULL_SHA "PSK-NULL-SHA" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA "DHE-PSK-NULL-SHA" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA "RSA-PSK-NULL-SHA" - -/* AES ciphersuites from RFC3268 */ -# define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" -# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" -# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" -# define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" - -# define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" -# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" -# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" -# define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" - -/* ECC ciphersuites from RFC4492 */ -# define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" - -# define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" - -# define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" - -# define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" - -# define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" -# define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" -# define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" -# define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" - -/* PSK ciphersuites from RFC 4279 */ -# define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" -# define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" -# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" - -# define TLS1_TXT_DHE_PSK_WITH_RC4_128_SHA "DHE-PSK-RC4-SHA" -# define TLS1_TXT_DHE_PSK_WITH_3DES_EDE_CBC_SHA "DHE-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA "DHE-PSK-AES128-CBC-SHA" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA "DHE-PSK-AES256-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_RC4_128_SHA "RSA-PSK-RC4-SHA" -# define TLS1_TXT_RSA_PSK_WITH_3DES_EDE_CBC_SHA "RSA-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA "RSA-PSK-AES128-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA "RSA-PSK-AES256-CBC-SHA" - -/* PSK ciphersuites from RFC 5487 */ -# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_GCM_SHA256 "DHE-PSK-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_GCM_SHA384 "DHE-PSK-AES256-GCM-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_AES_128_GCM_SHA256 "RSA-PSK-AES128-GCM-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_GCM_SHA384 "RSA-PSK-AES256-GCM-SHA384" - -# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA256 "PSK-AES128-CBC-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA384 "PSK-AES256-CBC-SHA384" -# define TLS1_TXT_PSK_WITH_NULL_SHA256 "PSK-NULL-SHA256" -# define TLS1_TXT_PSK_WITH_NULL_SHA384 "PSK-NULL-SHA384" - -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA256 "DHE-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA384 "DHE-PSK-AES256-CBC-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA256 "DHE-PSK-NULL-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA384 "DHE-PSK-NULL-SHA384" - -# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA256 "RSA-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA384 "RSA-PSK-AES256-CBC-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA256 "RSA-PSK-NULL-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA384 "RSA-PSK-NULL-SHA384" - -/* SRP ciphersuite from RFC 5054 */ -# define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" -# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" - -# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" -# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" - -/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ -# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256 "CAMELLIA128-SHA256" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DH-DSS-CAMELLIA128-SHA256" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DH-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DHE-DSS-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DHE-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256 "ADH-CAMELLIA128-SHA256" - -# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256 "CAMELLIA256-SHA256" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DH-DSS-CAMELLIA256-SHA256" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DH-RSA-CAMELLIA256-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DHE-DSS-CAMELLIA256-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DHE-RSA-CAMELLIA256-SHA256" -# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256 "ADH-CAMELLIA256-SHA256" - -# define TLS1_TXT_PSK_WITH_CAMELLIA_128_CBC_SHA256 "PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_PSK_WITH_CAMELLIA_256_CBC_SHA384 "PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "DHE-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "DHE-PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "RSA-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "RSA-PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-PSK-CAMELLIA256-SHA384" - -/* SEED ciphersuites from RFC4162 */ -# define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" -# define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" -# define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" -# define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" -# define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" -# define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" - -/* TLS v1.2 ciphersuites */ -# define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" -# define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" -# define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" -# define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" -# define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" - -/* TLS v1.2 GCM ciphersuites from RFC5288 */ -# define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" -# define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" -# define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" -# define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" -# define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" - -/* CCM ciphersuites from RFC6655 */ -# define TLS1_TXT_RSA_WITH_AES_128_CCM "AES128-CCM" -# define TLS1_TXT_RSA_WITH_AES_256_CCM "AES256-CCM" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM "DHE-RSA-AES128-CCM" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM "DHE-RSA-AES256-CCM" - -# define TLS1_TXT_RSA_WITH_AES_128_CCM_8 "AES128-CCM8" -# define TLS1_TXT_RSA_WITH_AES_256_CCM_8 "AES256-CCM8" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM_8 "DHE-RSA-AES128-CCM8" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM_8 "DHE-RSA-AES256-CCM8" - -# define TLS1_TXT_PSK_WITH_AES_128_CCM "PSK-AES128-CCM" -# define TLS1_TXT_PSK_WITH_AES_256_CCM "PSK-AES256-CCM" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM "DHE-PSK-AES128-CCM" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM "DHE-PSK-AES256-CCM" - -# define TLS1_TXT_PSK_WITH_AES_128_CCM_8 "PSK-AES128-CCM8" -# define TLS1_TXT_PSK_WITH_AES_256_CCM_8 "PSK-AES256-CCM8" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM_8 "DHE-PSK-AES128-CCM8" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM_8 "DHE-PSK-AES256-CCM8" - -/* CCM ciphersuites from RFC7251 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM "ECDHE-ECDSA-AES128-CCM" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM "ECDHE-ECDSA-AES256-CCM" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM_8 "ECDHE-ECDSA-AES128-CCM8" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8 "ECDHE-ECDSA-AES256-CCM8" - -/* ECDH HMAC based ciphersuites from RFC5289 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" - -/* ECDH GCM based ciphersuites from RFC5289 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" - -/* TLS v1.2 PSK GCM ciphersuites from RFC5487 */ -# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" - -/* ECDHE PSK ciphersuites from RFC 5489 */ -# define TLS1_TXT_ECDHE_PSK_WITH_RC4_128_SHA "ECDHE-PSK-RC4-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "ECDHE-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA "ECDHE-PSK-AES256-CBC-SHA" - -# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "ECDHE-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "ECDHE-PSK-AES256-CBC-SHA384" - -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA "ECDHE-PSK-NULL-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA256 "ECDHE-PSK-NULL-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA384 "ECDHE-PSK-NULL-SHA384" - -/* Camellia-CBC ciphersuites from RFC6367 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-ECDSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-ECDSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-ECDSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-ECDSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-RSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-RSA-CAMELLIA256-SHA384" - -/* draft-ietf-tls-chacha20-poly1305-03 */ -# define TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305 "ECDHE-RSA-CHACHA20-POLY1305" -# define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305" -# define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" -# define TLS1_TXT_PSK_WITH_CHACHA20_POLY1305 "PSK-CHACHA20-POLY1305" -# define TLS1_TXT_ECDHE_PSK_WITH_CHACHA20_POLY1305 "ECDHE-PSK-CHACHA20-POLY1305" -# define TLS1_TXT_DHE_PSK_WITH_CHACHA20_POLY1305 "DHE-PSK-CHACHA20-POLY1305" -# define TLS1_TXT_RSA_PSK_WITH_CHACHA20_POLY1305 "RSA-PSK-CHACHA20-POLY1305" - -/* Aria ciphersuites from RFC6209 */ -# define TLS1_TXT_RSA_WITH_ARIA_128_GCM_SHA256 "ARIA128-GCM-SHA256" -# define TLS1_TXT_RSA_WITH_ARIA_256_GCM_SHA384 "ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "DHE-RSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "DHE-RSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_RSA_WITH_ARIA_128_GCM_SHA256 "DH-RSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_RSA_WITH_ARIA_256_GCM_SHA384 "DH-RSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "DHE-DSS-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "DHE-DSS-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_DSS_WITH_ARIA_128_GCM_SHA256 "DH-DSS-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_DSS_WITH_ARIA_256_GCM_SHA384 "DH-DSS-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_anon_WITH_ARIA_128_GCM_SHA256 "ADH-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_anon_WITH_ARIA_256_GCM_SHA384 "ADH-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ECDSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ECDSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ECDSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ECDSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ARIA256-GCM-SHA384" -# define TLS1_TXT_PSK_WITH_ARIA_128_GCM_SHA256 "PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_ARIA_256_GCM_SHA384 "PSK-ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "DHE-PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "DHE-PSK-ARIA256-GCM-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "RSA-PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "RSA-PSK-ARIA256-GCM-SHA384" - -# define TLS_CT_RSA_SIGN 1 -# define TLS_CT_DSS_SIGN 2 -# define TLS_CT_RSA_FIXED_DH 3 -# define TLS_CT_DSS_FIXED_DH 4 -# define TLS_CT_ECDSA_SIGN 64 -# define TLS_CT_RSA_FIXED_ECDH 65 -# define TLS_CT_ECDSA_FIXED_ECDH 66 -# define TLS_CT_GOST01_SIGN 22 -# define TLS_CT_GOST12_SIGN 238 -# define TLS_CT_GOST12_512_SIGN 239 - -/* - * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see - * comment there) - */ -# define TLS_CT_NUMBER 10 - -# if defined(SSL3_CT_NUMBER) -# if TLS_CT_NUMBER != SSL3_CT_NUMBER -# error "SSL/TLS CT_NUMBER values do not match" -# endif -# endif - -# define TLS1_FINISH_MAC_LENGTH 12 - -# define TLS_MD_MAX_CONST_SIZE 22 -# define TLS_MD_CLIENT_FINISH_CONST "client finished" -# define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 -# define TLS_MD_SERVER_FINISH_CONST "server finished" -# define TLS_MD_SERVER_FINISH_CONST_SIZE 15 -# define TLS_MD_KEY_EXPANSION_CONST "key expansion" -# define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 -# define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" -# define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 -# define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" -# define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 -# define TLS_MD_IV_BLOCK_CONST "IV block" -# define TLS_MD_IV_BLOCK_CONST_SIZE 8 -# define TLS_MD_MASTER_SECRET_CONST "master secret" -# define TLS_MD_MASTER_SECRET_CONST_SIZE 13 -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "extended master secret" -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE 22 - -# ifdef CHARSET_EBCDIC -# undef TLS_MD_CLIENT_FINISH_CONST -/* - * client finished - */ -# define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" - -# undef TLS_MD_SERVER_FINISH_CONST -/* - * server finished - */ -# define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" - -# undef TLS_MD_SERVER_WRITE_KEY_CONST -/* - * server write key - */ -# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_KEY_EXPANSION_CONST -/* - * key expansion - */ -# define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" - -# undef TLS_MD_CLIENT_WRITE_KEY_CONST -/* - * client write key - */ -# define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_SERVER_WRITE_KEY_CONST -/* - * server write key - */ -# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_IV_BLOCK_CONST -/* - * IV block - */ -# define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" - -# undef TLS_MD_MASTER_SECRET_CONST -/* - * master secret - */ -# define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" -# undef TLS_MD_EXTENDED_MASTER_SECRET_CONST -/* - * extended master secret - */ -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" -# endif - -/* TLS Session Ticket extension struct */ -struct tls_session_ticket_ext_st { - unsigned short length; - void *data; -}; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ts.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ts.h deleted file mode 100644 index 3b58aa52..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ts.h +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Copyright 2006-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_TS_H -# define HEADER_TS_H - -# include - -# ifndef OPENSSL_NO_TS -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# include -# include - -typedef struct TS_msg_imprint_st TS_MSG_IMPRINT; -typedef struct TS_req_st TS_REQ; -typedef struct TS_accuracy_st TS_ACCURACY; -typedef struct TS_tst_info_st TS_TST_INFO; - -/* Possible values for status. */ -# define TS_STATUS_GRANTED 0 -# define TS_STATUS_GRANTED_WITH_MODS 1 -# define TS_STATUS_REJECTION 2 -# define TS_STATUS_WAITING 3 -# define TS_STATUS_REVOCATION_WARNING 4 -# define TS_STATUS_REVOCATION_NOTIFICATION 5 - -/* Possible values for failure_info. */ -# define TS_INFO_BAD_ALG 0 -# define TS_INFO_BAD_REQUEST 2 -# define TS_INFO_BAD_DATA_FORMAT 5 -# define TS_INFO_TIME_NOT_AVAILABLE 14 -# define TS_INFO_UNACCEPTED_POLICY 15 -# define TS_INFO_UNACCEPTED_EXTENSION 16 -# define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 -# define TS_INFO_SYSTEM_FAILURE 25 - - -typedef struct TS_status_info_st TS_STATUS_INFO; -typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL; -typedef struct ESS_cert_id ESS_CERT_ID; -typedef struct ESS_signing_cert ESS_SIGNING_CERT; - -DEFINE_STACK_OF(ESS_CERT_ID) - -typedef struct ESS_cert_id_v2_st ESS_CERT_ID_V2; -typedef struct ESS_signing_cert_v2_st ESS_SIGNING_CERT_V2; - -DEFINE_STACK_OF(ESS_CERT_ID_V2) - -typedef struct TS_resp_st TS_RESP; - -TS_REQ *TS_REQ_new(void); -void TS_REQ_free(TS_REQ *a); -int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); -TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); - -TS_REQ *TS_REQ_dup(TS_REQ *a); - -#ifndef OPENSSL_NO_STDIO -TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); -int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); -#endif -TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); -int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); - -TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); -void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); -int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, - const unsigned char **pp, long length); - -TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); - -#ifndef OPENSSL_NO_STDIO -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); -int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); -#endif -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a); -int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a); - -TS_RESP *TS_RESP_new(void); -void TS_RESP_free(TS_RESP *a); -int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); -TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); -TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); -TS_RESP *TS_RESP_dup(TS_RESP *a); - -#ifndef OPENSSL_NO_STDIO -TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); -int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); -#endif -TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a); -int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a); - -TS_STATUS_INFO *TS_STATUS_INFO_new(void); -void TS_STATUS_INFO_free(TS_STATUS_INFO *a); -int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); -TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, - const unsigned char **pp, long length); -TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); - -TS_TST_INFO *TS_TST_INFO_new(void); -void TS_TST_INFO_free(TS_TST_INFO *a); -int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); -TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, - long length); -TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); - -#ifndef OPENSSL_NO_STDIO -TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); -int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); -#endif -TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a); -int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a); - -TS_ACCURACY *TS_ACCURACY_new(void); -void TS_ACCURACY_free(TS_ACCURACY *a); -int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); -TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, - long length); -TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); - -ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); -void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); -int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp); -ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, - const unsigned char **pp, - long length); -ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); - -ESS_CERT_ID *ESS_CERT_ID_new(void); -void ESS_CERT_ID_free(ESS_CERT_ID *a); -int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); -ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, - long length); -ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); - -ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); -void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); -int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp); -ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, - const unsigned char **pp, long length); -ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); - -ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new(void); -void ESS_CERT_ID_V2_free(ESS_CERT_ID_V2 *a); -int i2d_ESS_CERT_ID_V2(const ESS_CERT_ID_V2 *a, unsigned char **pp); -ESS_CERT_ID_V2 *d2i_ESS_CERT_ID_V2(ESS_CERT_ID_V2 **a, - const unsigned char **pp, long length); -ESS_CERT_ID_V2 *ESS_CERT_ID_V2_dup(ESS_CERT_ID_V2 *a); - -ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new(void); -void ESS_SIGNING_CERT_V2_free(ESS_SIGNING_CERT_V2 *a); -int i2d_ESS_SIGNING_CERT_V2(const ESS_SIGNING_CERT_V2 *a, unsigned char **pp); -ESS_SIGNING_CERT_V2 *d2i_ESS_SIGNING_CERT_V2(ESS_SIGNING_CERT_V2 **a, - const unsigned char **pp, - long length); -ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_dup(ESS_SIGNING_CERT_V2 *a); - -int TS_REQ_set_version(TS_REQ *a, long version); -long TS_REQ_get_version(const TS_REQ *a); - -int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i); -const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a); - -const STACK_OF(ASN1_UTF8STRING) * -TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a); - -const ASN1_BIT_STRING * -TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a); - -int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); -TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); - -int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); -X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); - -int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); -ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); - -int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy); -ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); - -int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); -const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); - -int TS_REQ_set_cert_req(TS_REQ *a, int cert_req); -int TS_REQ_get_cert_req(const TS_REQ *a); - -STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); -void TS_REQ_ext_free(TS_REQ *a); -int TS_REQ_get_ext_count(TS_REQ *a); -int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); -int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos); -int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); -X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); -X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); -int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); -void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); - -/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ - -int TS_REQ_print_bio(BIO *bio, TS_REQ *a); - -/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ - -int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); -TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); - -/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ -void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); -PKCS7 *TS_RESP_get_token(TS_RESP *a); -TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); - -int TS_TST_INFO_set_version(TS_TST_INFO *a, long version); -long TS_TST_INFO_get_version(const TS_TST_INFO *a); - -int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); -ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); - -int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); -TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); - -int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); -const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); - -int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); -const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); - -int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); -TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); - -int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); -const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); - -int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); -const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); - -int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); -const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); - -int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); -int TS_TST_INFO_get_ordering(const TS_TST_INFO *a); - -int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); -const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); - -int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); -GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); - -STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); -void TS_TST_INFO_ext_free(TS_TST_INFO *a); -int TS_TST_INFO_get_ext_count(TS_TST_INFO *a); -int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); -int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, - int lastpos); -int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); -X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); -X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); -int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); -void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); - -/* - * Declarations related to response generation, defined in ts/ts_resp_sign.c. - */ - -/* Optional flags for response generation. */ - -/* Don't include the TSA name in response. */ -# define TS_TSA_NAME 0x01 - -/* Set ordering to true in response. */ -# define TS_ORDERING 0x02 - -/* - * Include the signer certificate and the other specified certificates in - * the ESS signing certificate attribute beside the PKCS7 signed data. - * Only the signer certificates is included by default. - */ -# define TS_ESS_CERT_ID_CHAIN 0x04 - -/* Forward declaration. */ -struct TS_resp_ctx; - -/* This must return a unique number less than 160 bits long. */ -typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *); - -/* - * This must return the seconds and microseconds since Jan 1, 1970 in the sec - * and usec variables allocated by the caller. Return non-zero for success - * and zero for failure. - */ -typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec, - long *usec); - -/* - * This must process the given extension. It can modify the TS_TST_INFO - * object of the context. Return values: !0 (processed), 0 (error, it must - * set the status info/failure info of the response). - */ -typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *, - void *); - -typedef struct TS_resp_ctx TS_RESP_CTX; - -DEFINE_STACK_OF_CONST(EVP_MD) - -/* Creates a response context that can be used for generating responses. */ -TS_RESP_CTX *TS_RESP_CTX_new(void); -void TS_RESP_CTX_free(TS_RESP_CTX *ctx); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); - -int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx, - const EVP_MD *signer_digest); -int TS_RESP_CTX_set_ess_cert_id_digest(TS_RESP_CTX *ctx, const EVP_MD *md); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy); - -/* No additional certs are included in the response by default. */ -int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); - -/* - * Adds a new acceptable policy, only the default policy is accepted by - * default. - */ -int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy); - -/* - * Adds a new acceptable message digest. Note that no message digests are - * accepted by default. The md argument is shared with the caller. - */ -int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); - -/* Accuracy is not included by default. */ -int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, - int secs, int millis, int micros); - -/* - * Clock precision digits, i.e. the number of decimal digits: '0' means sec, - * '3' msec, '6' usec, and so on. Default is 0. - */ -int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, - unsigned clock_precision_digits); -/* At most we accept usec precision. */ -# define TS_MAX_CLOCK_PRECISION_DIGITS 6 - -/* Maximum status message length */ -# define TS_MAX_STATUS_LENGTH (1024 * 1024) - -/* No flags are set by default. */ -void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); - -/* Default callback always returns a constant. */ -void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); - -/* Default callback uses the gettimeofday() and gmtime() system calls. */ -void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); - -/* - * Default callback rejects all extensions. The extension callback is called - * when the TS_TST_INFO object is already set up and not signed yet. - */ -/* FIXME: extension handling is not tested yet. */ -void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, - TS_extension_cb cb, void *data); - -/* The following methods can be used in the callbacks. */ -int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, - int status, const char *text); - -/* Sets the status info only if it is still TS_STATUS_GRANTED. */ -int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, - int status, const char *text); - -int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); - -/* The get methods below can be used in the extension callback. */ -TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); - -TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); - -/* - * Creates the signed TS_TST_INFO and puts it in TS_RESP. - * In case of errors it sets the status info properly. - * Returns NULL only in case of memory allocation/fatal error. - */ -TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); - -/* - * Declarations related to response verification, - * they are defined in ts/ts_resp_verify.c. - */ - -int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, - X509_STORE *store, X509 **signer_out); - -/* Context structure for the generic verify method. */ - -/* Verify the signer's certificate and the signature of the response. */ -# define TS_VFY_SIGNATURE (1u << 0) -/* Verify the version number of the response. */ -# define TS_VFY_VERSION (1u << 1) -/* Verify if the policy supplied by the user matches the policy of the TSA. */ -# define TS_VFY_POLICY (1u << 2) -/* - * Verify the message imprint provided by the user. This flag should not be - * specified with TS_VFY_DATA. - */ -# define TS_VFY_IMPRINT (1u << 3) -/* - * Verify the message imprint computed by the verify method from the user - * provided data and the MD algorithm of the response. This flag should not - * be specified with TS_VFY_IMPRINT. - */ -# define TS_VFY_DATA (1u << 4) -/* Verify the nonce value. */ -# define TS_VFY_NONCE (1u << 5) -/* Verify if the TSA name field matches the signer certificate. */ -# define TS_VFY_SIGNER (1u << 6) -/* Verify if the TSA name field equals to the user provided name. */ -# define TS_VFY_TSA_NAME (1u << 7) - -/* You can use the following convenience constants. */ -# define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ - | TS_VFY_VERSION \ - | TS_VFY_POLICY \ - | TS_VFY_IMPRINT \ - | TS_VFY_NONCE \ - | TS_VFY_SIGNER \ - | TS_VFY_TSA_NAME) -# define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ - | TS_VFY_VERSION \ - | TS_VFY_POLICY \ - | TS_VFY_DATA \ - | TS_VFY_NONCE \ - | TS_VFY_SIGNER \ - | TS_VFY_TSA_NAME) - -typedef struct TS_verify_ctx TS_VERIFY_CTX; - -int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); -int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); - -/* - * Declarations related to response verification context, - */ -TS_VERIFY_CTX *TS_VERIFY_CTX_new(void); -void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); -void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); -void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); -int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f); -int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f); -BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b); -unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, - unsigned char *hexstr, long len); -X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s); -STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs); - -/*- - * If ctx is NULL, it allocates and returns a new object, otherwise - * it returns ctx. It initialises all the members as follows: - * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) - * certs = NULL - * store = NULL - * policy = policy from the request or NULL if absent (in this case - * TS_VFY_POLICY is cleared from flags as well) - * md_alg = MD algorithm from request - * imprint, imprint_len = imprint from request - * data = NULL - * nonce, nonce_len = nonce from the request or NULL if absent (in this case - * TS_VFY_NONCE is cleared from flags as well) - * tsa_name = NULL - * Important: after calling this method TS_VFY_SIGNATURE should be added! - */ -TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); - -/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ - -int TS_RESP_print_bio(BIO *bio, TS_RESP *a); -int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); -int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); - -/* Common utility functions defined in ts/ts_lib.c */ - -int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); -int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); -int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); -int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); -int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); - -/* - * Function declarations for handling configuration options, defined in - * ts/ts_conf.c - */ - -X509 *TS_CONF_load_cert(const char *file); -STACK_OF(X509) *TS_CONF_load_certs(const char *file); -EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); -const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); -int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, - TS_RESP_CTX *ctx); -#ifndef OPENSSL_NO_ENGINE -int TS_CONF_set_crypto_device(CONF *conf, const char *section, - const char *device); -int TS_CONF_set_default_engine(const char *name); -#endif -int TS_CONF_set_signer_cert(CONF *conf, const char *section, - const char *cert, TS_RESP_CTX *ctx); -int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, - TS_RESP_CTX *ctx); -int TS_CONF_set_signer_key(CONF *conf, const char *section, - const char *key, const char *pass, - TS_RESP_CTX *ctx); -int TS_CONF_set_signer_digest(CONF *conf, const char *section, - const char *md, TS_RESP_CTX *ctx); -int TS_CONF_set_def_policy(CONF *conf, const char *section, - const char *policy, TS_RESP_CTX *ctx); -int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, - TS_RESP_CTX *ctx); -int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, - TS_RESP_CTX *ctx); -int TS_CONF_set_ess_cert_id_digest(CONF *conf, const char *section, - TS_RESP_CTX *ctx); - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/tserr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/tserr.h deleted file mode 100644 index 07f23339..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/tserr.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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_TSERR_H -# define HEADER_TSERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# include - -# ifndef OPENSSL_NO_TS - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_TS_strings(void); - -/* - * TS function codes. - */ -# define TS_F_DEF_SERIAL_CB 110 -# define TS_F_DEF_TIME_CB 111 -# define TS_F_ESS_ADD_SIGNING_CERT 112 -# define TS_F_ESS_ADD_SIGNING_CERT_V2 147 -# define TS_F_ESS_CERT_ID_NEW_INIT 113 -# define TS_F_ESS_CERT_ID_V2_NEW_INIT 156 -# define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 -# define TS_F_ESS_SIGNING_CERT_V2_NEW_INIT 157 -# define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 -# define TS_F_PKCS7_TO_TS_TST_INFO 148 -# define TS_F_TS_ACCURACY_SET_MICROS 115 -# define TS_F_TS_ACCURACY_SET_MILLIS 116 -# define TS_F_TS_ACCURACY_SET_SECONDS 117 -# define TS_F_TS_CHECK_IMPRINTS 100 -# define TS_F_TS_CHECK_NONCES 101 -# define TS_F_TS_CHECK_POLICY 102 -# define TS_F_TS_CHECK_SIGNING_CERTS 103 -# define TS_F_TS_CHECK_STATUS_INFO 104 -# define TS_F_TS_COMPUTE_IMPRINT 145 -# define TS_F_TS_CONF_INVALID 151 -# define TS_F_TS_CONF_LOAD_CERT 153 -# define TS_F_TS_CONF_LOAD_CERTS 154 -# define TS_F_TS_CONF_LOAD_KEY 155 -# define TS_F_TS_CONF_LOOKUP_FAIL 152 -# define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 -# define TS_F_TS_GET_STATUS_TEXT 105 -# define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 -# define TS_F_TS_REQ_SET_MSG_IMPRINT 119 -# define TS_F_TS_REQ_SET_NONCE 120 -# define TS_F_TS_REQ_SET_POLICY_ID 121 -# define TS_F_TS_RESP_CREATE_RESPONSE 122 -# define TS_F_TS_RESP_CREATE_TST_INFO 123 -# define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 -# define TS_F_TS_RESP_CTX_ADD_MD 125 -# define TS_F_TS_RESP_CTX_ADD_POLICY 126 -# define TS_F_TS_RESP_CTX_NEW 127 -# define TS_F_TS_RESP_CTX_SET_ACCURACY 128 -# define TS_F_TS_RESP_CTX_SET_CERTS 129 -# define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 -# define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 -# define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 -# define TS_F_TS_RESP_GET_POLICY 133 -# define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 -# define TS_F_TS_RESP_SET_STATUS_INFO 135 -# define TS_F_TS_RESP_SET_TST_INFO 150 -# define TS_F_TS_RESP_SIGN 136 -# define TS_F_TS_RESP_VERIFY_SIGNATURE 106 -# define TS_F_TS_TST_INFO_SET_ACCURACY 137 -# define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 -# define TS_F_TS_TST_INFO_SET_NONCE 139 -# define TS_F_TS_TST_INFO_SET_POLICY_ID 140 -# define TS_F_TS_TST_INFO_SET_SERIAL 141 -# define TS_F_TS_TST_INFO_SET_TIME 142 -# define TS_F_TS_TST_INFO_SET_TSA 143 -# define TS_F_TS_VERIFY 108 -# define TS_F_TS_VERIFY_CERT 109 -# define TS_F_TS_VERIFY_CTX_NEW 144 - -/* - * TS reason codes. - */ -# define TS_R_BAD_PKCS7_TYPE 132 -# define TS_R_BAD_TYPE 133 -# define TS_R_CANNOT_LOAD_CERT 137 -# define TS_R_CANNOT_LOAD_KEY 138 -# define TS_R_CERTIFICATE_VERIFY_ERROR 100 -# define TS_R_COULD_NOT_SET_ENGINE 127 -# define TS_R_COULD_NOT_SET_TIME 115 -# define TS_R_DETACHED_CONTENT 134 -# define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 -# define TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR 139 -# define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 -# define TS_R_INVALID_NULL_POINTER 102 -# define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 -# define TS_R_MESSAGE_IMPRINT_MISMATCH 103 -# define TS_R_NONCE_MISMATCH 104 -# define TS_R_NONCE_NOT_RETURNED 105 -# define TS_R_NO_CONTENT 106 -# define TS_R_NO_TIME_STAMP_TOKEN 107 -# define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 -# define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 -# define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 -# define TS_R_POLICY_MISMATCH 108 -# define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 -# define TS_R_RESPONSE_SETUP_ERROR 121 -# define TS_R_SIGNATURE_FAILURE 109 -# define TS_R_THERE_MUST_BE_ONE_SIGNER 110 -# define TS_R_TIME_SYSCALL_ERROR 122 -# define TS_R_TOKEN_NOT_PRESENT 130 -# define TS_R_TOKEN_PRESENT 131 -# define TS_R_TSA_NAME_MISMATCH 111 -# define TS_R_TSA_UNTRUSTED 112 -# define TS_R_TST_INFO_SETUP_ERROR 123 -# define TS_R_TS_DATASIGN 124 -# define TS_R_UNACCEPTABLE_POLICY 125 -# define TS_R_UNSUPPORTED_MD_ALGORITHM 126 -# define TS_R_UNSUPPORTED_VERSION 113 -# define TS_R_VAR_BAD_VALUE 135 -# define TS_R_VAR_LOOKUP_FAILURE 136 -# define TS_R_WRONG_CONTENT_TYPE 114 - -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/txt_db.h b/Hin2n/src/main/jniLibs/x86/include/openssl/txt_db.h deleted file mode 100644 index ec981a43..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/txt_db.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 1995-2017 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_TXT_DB_H -# define HEADER_TXT_DB_H - -# include -# include -# include -# include - -# define DB_ERROR_OK 0 -# define DB_ERROR_MALLOC 1 -# define DB_ERROR_INDEX_CLASH 2 -# define DB_ERROR_INDEX_OUT_OF_RANGE 3 -# define DB_ERROR_NO_INDEX 4 -# define DB_ERROR_INSERT_INDEX_CLASH 5 -# define DB_ERROR_WRONG_NUM_FIELDS 6 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef OPENSSL_STRING *OPENSSL_PSTRING; -DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) - -typedef struct txt_db_st { - int num_fields; - STACK_OF(OPENSSL_PSTRING) *data; - LHASH_OF(OPENSSL_STRING) **index; - int (**qual) (OPENSSL_STRING *); - long error; - long arg1; - long arg2; - OPENSSL_STRING *arg_row; -} TXT_DB; - -TXT_DB *TXT_DB_read(BIO *in, int num); -long TXT_DB_write(BIO *out, TXT_DB *db); -int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), - OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); -void TXT_DB_free(TXT_DB *db); -OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, - OPENSSL_STRING *value); -int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/ui.h b/Hin2n/src/main/jniLibs/x86/include/openssl/ui.h deleted file mode 100644 index 7c721ec8..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/ui.h +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright 2001-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_UI_H -# define HEADER_UI_H - -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# include -# include -# include - -/* For compatibility reasons, the macro OPENSSL_NO_UI is currently retained */ -# if OPENSSL_API_COMPAT < 0x10200000L -# ifdef OPENSSL_NO_UI_CONSOLE -# define OPENSSL_NO_UI -# endif -# endif - -# ifdef __cplusplus -extern "C" { -# endif - -/* - * All the following functions return -1 or NULL on error and in some cases - * (UI_process()) -2 if interrupted or in some other way cancelled. When - * everything is fine, they return 0, a positive value or a non-NULL pointer, - * all depending on their purpose. - */ - -/* Creators and destructor. */ -UI *UI_new(void); -UI *UI_new_method(const UI_METHOD *method); -void UI_free(UI *ui); - -/*- - The following functions are used to add strings to be printed and prompt - strings to prompt for data. The names are UI_{add,dup}__string - and UI_{add,dup}_input_boolean. - - UI_{add,dup}__string have the following meanings: - add add a text or prompt string. The pointers given to these - functions are used verbatim, no copying is done. - dup make a copy of the text or prompt string, then add the copy - to the collection of strings in the user interface. - - The function is a name for the functionality that the given - string shall be used for. It can be one of: - input use the string as data prompt. - verify use the string as verification prompt. This - is used to verify a previous input. - info use the string for informational output. - error use the string for error output. - Honestly, there's currently no difference between info and error for the - moment. - - UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", - and are typically used when one wants to prompt for a yes/no response. - - All of the functions in this group take a UI and a prompt string. - The string input and verify addition functions also take a flag argument, - a buffer for the result to end up with, a minimum input size and a maximum - input size (the result buffer MUST be large enough to be able to contain - the maximum number of characters). Additionally, the verify addition - functions takes another buffer to compare the result against. - The boolean input functions take an action description string (which should - be safe to ignore if the expected user action is obvious, for example with - a dialog box with an OK button and a Cancel button), a string of acceptable - characters to mean OK and to mean Cancel. The two last strings are checked - to make sure they don't have common characters. Additionally, the same - flag argument as for the string input is taken, as well as a result buffer. - The result buffer is required to be at least one byte long. Depending on - the answer, the first character from the OK or the Cancel character strings - will be stored in the first byte of the result buffer. No NUL will be - added, so the result is *not* a string. - - On success, the all return an index of the added information. That index - is useful when retrieving results with UI_get0_result(). */ -int UI_add_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); -int UI_dup_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); -int UI_add_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, - const char *test_buf); -int UI_dup_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, - const char *test_buf); -int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); -int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); -int UI_add_info_string(UI *ui, const char *text); -int UI_dup_info_string(UI *ui, const char *text); -int UI_add_error_string(UI *ui, const char *text); -int UI_dup_error_string(UI *ui, const char *text); - -/* These are the possible flags. They can be or'ed together. */ -/* Use to have echoing of input */ -# define UI_INPUT_FLAG_ECHO 0x01 -/* - * Use a default password. Where that password is found is completely up to - * the application, it might for example be in the user data set with - * UI_add_user_data(). It is not recommended to have more than one input in - * each UI being marked with this flag, or the application might get - * confused. - */ -# define UI_INPUT_FLAG_DEFAULT_PWD 0x02 - -/*- - * The user of these routines may want to define flags of their own. The core - * UI won't look at those, but will pass them on to the method routines. They - * must use higher bits so they don't get confused with the UI bits above. - * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good - * example of use is this: - * - * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) - * -*/ -# define UI_INPUT_FLAG_USER_BASE 16 - -/*- - * The following function helps construct a prompt. object_desc is a - * textual short description of the object, for example "pass phrase", - * and object_name is the name of the object (might be a card name or - * a file name. - * The returned string shall always be allocated on the heap with - * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). - * - * If the ui_method doesn't contain a pointer to a user-defined prompt - * constructor, a default string is built, looking like this: - * - * "Enter {object_desc} for {object_name}:" - * - * So, if object_desc has the value "pass phrase" and object_name has - * the value "foo.key", the resulting string is: - * - * "Enter pass phrase for foo.key:" -*/ -char *UI_construct_prompt(UI *ui_method, - const char *object_desc, const char *object_name); - -/* - * The following function is used to store a pointer to user-specific data. - * Any previous such pointer will be returned and replaced. - * - * For callback purposes, this function makes a lot more sense than using - * ex_data, since the latter requires that different parts of OpenSSL or - * applications share the same ex_data index. - * - * Note that the UI_OpenSSL() method completely ignores the user data. Other - * methods may not, however. - */ -void *UI_add_user_data(UI *ui, void *user_data); -/* - * Alternatively, this function is used to duplicate the user data. - * This uses the duplicator method function. The destroy function will - * be used to free the user data in this case. - */ -int UI_dup_user_data(UI *ui, void *user_data); -/* We need a user data retrieving function as well. */ -void *UI_get0_user_data(UI *ui); - -/* Return the result associated with a prompt given with the index i. */ -const char *UI_get0_result(UI *ui, int i); -int UI_get_result_length(UI *ui, int i); - -/* When all strings have been added, process the whole thing. */ -int UI_process(UI *ui); - -/* - * Give a user interface parameterised control commands. This can be used to - * send down an integer, a data pointer or a function pointer, as well as be - * used to get information from a UI. - */ -int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void)); - -/* The commands */ -/* - * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the - * OpenSSL error stack before printing any info or added error messages and - * before any prompting. - */ -# define UI_CTRL_PRINT_ERRORS 1 -/* - * Check if a UI_process() is possible to do again with the same instance of - * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 - * if not. - */ -# define UI_CTRL_IS_REDOABLE 2 - -/* Some methods may use extra data */ -# define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) -# define UI_get_app_data(s) UI_get_ex_data(s,0) - -# define UI_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef) -int UI_set_ex_data(UI *r, int idx, void *arg); -void *UI_get_ex_data(UI *r, int idx); - -/* Use specific methods instead of the built-in one */ -void UI_set_default_method(const UI_METHOD *meth); -const UI_METHOD *UI_get_default_method(void); -const UI_METHOD *UI_get_method(UI *ui); -const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); - -# ifndef OPENSSL_NO_UI_CONSOLE - -/* The method with all the built-in thingies */ -UI_METHOD *UI_OpenSSL(void); - -# endif - -/* - * NULL method. Literally does nothing, but may serve as a placeholder - * to avoid internal default. - */ -const UI_METHOD *UI_null(void); - -/* ---------- For method writers ---------- */ -/*- - A method contains a number of functions that implement the low level - of the User Interface. The functions are: - - an opener This function starts a session, maybe by opening - a channel to a tty, or by opening a window. - a writer This function is called to write a given string, - maybe to the tty, maybe as a field label in a - window. - a flusher This function is called to flush everything that - has been output so far. It can be used to actually - display a dialog box after it has been built. - a reader This function is called to read a given prompt, - maybe from the tty, maybe from a field in a - window. Note that it's called with all string - structures, not only the prompt ones, so it must - check such things itself. - a closer This function closes the session, maybe by closing - the channel to the tty, or closing the window. - - All these functions are expected to return: - - 0 on error. - 1 on success. - -1 on out-of-band events, for example if some prompting has - been canceled (by pressing Ctrl-C, for example). This is - only checked when returned by the flusher or the reader. - - The way this is used, the opener is first called, then the writer for all - strings, then the flusher, then the reader for all strings and finally the - closer. Note that if you want to prompt from a terminal or other command - line interface, the best is to have the reader also write the prompts - instead of having the writer do it. If you want to prompt from a dialog - box, the writer can be used to build up the contents of the box, and the - flusher to actually display the box and run the event loop until all data - has been given, after which the reader only grabs the given data and puts - them back into the UI strings. - - All method functions take a UI as argument. Additionally, the writer and - the reader take a UI_STRING. -*/ - -/* - * The UI_STRING type is the data structure that contains all the needed info - * about a string or a prompt, including test data for a verification prompt. - */ -typedef struct ui_string_st UI_STRING; -DEFINE_STACK_OF(UI_STRING) - -/* - * The different types of strings that are currently supported. This is only - * needed by method authors. - */ -enum UI_string_types { - UIT_NONE = 0, - UIT_PROMPT, /* Prompt for a string */ - UIT_VERIFY, /* Prompt for a string and verify */ - UIT_BOOLEAN, /* Prompt for a yes/no response */ - UIT_INFO, /* Send info to the user */ - UIT_ERROR /* Send an error message to the user */ -}; - -/* Create and manipulate methods */ -UI_METHOD *UI_create_method(const char *name); -void UI_destroy_method(UI_METHOD *ui_method); -int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui)); -int UI_method_set_writer(UI_METHOD *method, - int (*writer) (UI *ui, UI_STRING *uis)); -int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui)); -int UI_method_set_reader(UI_METHOD *method, - int (*reader) (UI *ui, UI_STRING *uis)); -int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui)); -int UI_method_set_data_duplicator(UI_METHOD *method, - void *(*duplicator) (UI *ui, void *ui_data), - void (*destructor)(UI *ui, void *ui_data)); -int UI_method_set_prompt_constructor(UI_METHOD *method, - char *(*prompt_constructor) (UI *ui, - const char - *object_desc, - const char - *object_name)); -int UI_method_set_ex_data(UI_METHOD *method, int idx, void *data); -int (*UI_method_get_opener(const UI_METHOD *method)) (UI *); -int (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *); -int (*UI_method_get_flusher(const UI_METHOD *method)) (UI *); -int (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *); -int (*UI_method_get_closer(const UI_METHOD *method)) (UI *); -char *(*UI_method_get_prompt_constructor(const UI_METHOD *method)) - (UI *, const char *, const char *); -void *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *); -void (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *); -const void *UI_method_get_ex_data(const UI_METHOD *method, int idx); - -/* - * The following functions are helpers for method writers to access relevant - * data from a UI_STRING. - */ - -/* Return type of the UI_STRING */ -enum UI_string_types UI_get_string_type(UI_STRING *uis); -/* Return input flags of the UI_STRING */ -int UI_get_input_flags(UI_STRING *uis); -/* Return the actual string to output (the prompt, info or error) */ -const char *UI_get0_output_string(UI_STRING *uis); -/* - * Return the optional action string to output (the boolean prompt - * instruction) - */ -const char *UI_get0_action_string(UI_STRING *uis); -/* Return the result of a prompt */ -const char *UI_get0_result_string(UI_STRING *uis); -int UI_get_result_string_length(UI_STRING *uis); -/* - * Return the string to test the result against. Only useful with verifies. - */ -const char *UI_get0_test_string(UI_STRING *uis); -/* Return the required minimum size of the result */ -int UI_get_result_minsize(UI_STRING *uis); -/* Return the required maximum size of the result */ -int UI_get_result_maxsize(UI_STRING *uis); -/* Set the result of a UI_STRING. */ -int UI_set_result(UI *ui, UI_STRING *uis, const char *result); -int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len); - -/* A couple of popular utility functions */ -int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, - int verify); -int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, - int verify); -UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/uierr.h b/Hin2n/src/main/jniLibs/x86/include/openssl/uierr.h deleted file mode 100644 index bd68864d..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/uierr.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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_UIERR_H -# define HEADER_UIERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_UI_strings(void); - -/* - * UI function codes. - */ -# define UI_F_CLOSE_CONSOLE 115 -# define UI_F_ECHO_CONSOLE 116 -# define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 -# define UI_F_GENERAL_ALLOCATE_PROMPT 109 -# define UI_F_NOECHO_CONSOLE 117 -# define UI_F_OPEN_CONSOLE 114 -# define UI_F_UI_CONSTRUCT_PROMPT 121 -# define UI_F_UI_CREATE_METHOD 112 -# define UI_F_UI_CTRL 111 -# define UI_F_UI_DUP_ERROR_STRING 101 -# define UI_F_UI_DUP_INFO_STRING 102 -# define UI_F_UI_DUP_INPUT_BOOLEAN 110 -# define UI_F_UI_DUP_INPUT_STRING 103 -# define UI_F_UI_DUP_USER_DATA 118 -# define UI_F_UI_DUP_VERIFY_STRING 106 -# define UI_F_UI_GET0_RESULT 107 -# define UI_F_UI_GET_RESULT_LENGTH 119 -# define UI_F_UI_NEW_METHOD 104 -# define UI_F_UI_PROCESS 113 -# define UI_F_UI_SET_RESULT 105 -# define UI_F_UI_SET_RESULT_EX 120 - -/* - * UI reason codes. - */ -# define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 -# define UI_R_INDEX_TOO_LARGE 102 -# define UI_R_INDEX_TOO_SMALL 103 -# define UI_R_NO_RESULT_BUFFER 105 -# define UI_R_PROCESSING_ERROR 107 -# define UI_R_RESULT_TOO_LARGE 100 -# define UI_R_RESULT_TOO_SMALL 101 -# define UI_R_SYSASSIGN_ERROR 109 -# define UI_R_SYSDASSGN_ERROR 110 -# define UI_R_SYSQIOW_ERROR 111 -# define UI_R_UNKNOWN_CONTROL_COMMAND 106 -# define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 -# define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/whrlpool.h b/Hin2n/src/main/jniLibs/x86/include/openssl/whrlpool.h deleted file mode 100644 index 20ea3503..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/whrlpool.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-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_WHRLPOOL_H -# define HEADER_WHRLPOOL_H - -#include - -# ifndef OPENSSL_NO_WHIRLPOOL -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define WHIRLPOOL_DIGEST_LENGTH (512/8) -# define WHIRLPOOL_BBLOCK 512 -# define WHIRLPOOL_COUNTER (256/8) - -typedef struct { - union { - unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; - /* double q is here to ensure 64-bit alignment */ - double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; - } H; - unsigned char data[WHIRLPOOL_BBLOCK / 8]; - unsigned int bitoff; - size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; -} WHIRLPOOL_CTX; - -int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); -int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); -void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); -int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); -unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/x509.h b/Hin2n/src/main/jniLibs/x86/include/openssl/x509.h deleted file mode 100644 index 39ca0ba5..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/x509.h +++ /dev/null @@ -1,1047 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_X509_H -# define HEADER_X509_H - -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# endif - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Flags for X509_get_signature_info() */ -/* Signature info is valid */ -# define X509_SIG_INFO_VALID 0x1 -/* Signature is suitable for TLS use */ -# define X509_SIG_INFO_TLS 0x2 - -# define X509_FILETYPE_PEM 1 -# define X509_FILETYPE_ASN1 2 -# define X509_FILETYPE_DEFAULT 3 - -# define X509v3_KU_DIGITAL_SIGNATURE 0x0080 -# define X509v3_KU_NON_REPUDIATION 0x0040 -# define X509v3_KU_KEY_ENCIPHERMENT 0x0020 -# define X509v3_KU_DATA_ENCIPHERMENT 0x0010 -# define X509v3_KU_KEY_AGREEMENT 0x0008 -# define X509v3_KU_KEY_CERT_SIGN 0x0004 -# define X509v3_KU_CRL_SIGN 0x0002 -# define X509v3_KU_ENCIPHER_ONLY 0x0001 -# define X509v3_KU_DECIPHER_ONLY 0x8000 -# define X509v3_KU_UNDEF 0xffff - -struct X509_algor_st { - ASN1_OBJECT *algorithm; - ASN1_TYPE *parameter; -} /* X509_ALGOR */ ; - -typedef STACK_OF(X509_ALGOR) X509_ALGORS; - -typedef struct X509_val_st { - ASN1_TIME *notBefore; - ASN1_TIME *notAfter; -} X509_VAL; - -typedef struct X509_sig_st X509_SIG; - -typedef struct X509_name_entry_st X509_NAME_ENTRY; - -DEFINE_STACK_OF(X509_NAME_ENTRY) - -DEFINE_STACK_OF(X509_NAME) - -# define X509_EX_V_NETSCAPE_HACK 0x8000 -# define X509_EX_V_INIT 0x0001 -typedef struct X509_extension_st X509_EXTENSION; - -typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; - -DEFINE_STACK_OF(X509_EXTENSION) - -typedef struct x509_attributes_st X509_ATTRIBUTE; - -DEFINE_STACK_OF(X509_ATTRIBUTE) - -typedef struct X509_req_info_st X509_REQ_INFO; - -typedef struct X509_req_st X509_REQ; - -typedef struct x509_cert_aux_st X509_CERT_AUX; - -typedef struct x509_cinf_st X509_CINF; - -DEFINE_STACK_OF(X509) - -/* This is used for a table of trust checking functions */ - -typedef struct x509_trust_st { - int trust; - int flags; - int (*check_trust) (struct x509_trust_st *, X509 *, int); - char *name; - int arg1; - void *arg2; -} X509_TRUST; - -DEFINE_STACK_OF(X509_TRUST) - -/* standard trust ids */ - -# define X509_TRUST_DEFAULT 0 /* Only valid in purpose settings */ - -# define X509_TRUST_COMPAT 1 -# define X509_TRUST_SSL_CLIENT 2 -# define X509_TRUST_SSL_SERVER 3 -# define X509_TRUST_EMAIL 4 -# define X509_TRUST_OBJECT_SIGN 5 -# define X509_TRUST_OCSP_SIGN 6 -# define X509_TRUST_OCSP_REQUEST 7 -# define X509_TRUST_TSA 8 - -/* Keep these up to date! */ -# define X509_TRUST_MIN 1 -# define X509_TRUST_MAX 8 - -/* trust_flags values */ -# define X509_TRUST_DYNAMIC (1U << 0) -# define X509_TRUST_DYNAMIC_NAME (1U << 1) -/* No compat trust if self-signed, preempts "DO_SS" */ -# define X509_TRUST_NO_SS_COMPAT (1U << 2) -/* Compat trust if no explicit accepted trust EKUs */ -# define X509_TRUST_DO_SS_COMPAT (1U << 3) -/* Accept "anyEKU" as a wildcard trust OID */ -# define X509_TRUST_OK_ANY_EKU (1U << 4) - -/* check_trust return codes */ - -# define X509_TRUST_TRUSTED 1 -# define X509_TRUST_REJECTED 2 -# define X509_TRUST_UNTRUSTED 3 - -/* Flags for X509_print_ex() */ - -# define X509_FLAG_COMPAT 0 -# define X509_FLAG_NO_HEADER 1L -# define X509_FLAG_NO_VERSION (1L << 1) -# define X509_FLAG_NO_SERIAL (1L << 2) -# define X509_FLAG_NO_SIGNAME (1L << 3) -# define X509_FLAG_NO_ISSUER (1L << 4) -# define X509_FLAG_NO_VALIDITY (1L << 5) -# define X509_FLAG_NO_SUBJECT (1L << 6) -# define X509_FLAG_NO_PUBKEY (1L << 7) -# define X509_FLAG_NO_EXTENSIONS (1L << 8) -# define X509_FLAG_NO_SIGDUMP (1L << 9) -# define X509_FLAG_NO_AUX (1L << 10) -# define X509_FLAG_NO_ATTRIBUTES (1L << 11) -# define X509_FLAG_NO_IDS (1L << 12) - -/* Flags specific to X509_NAME_print_ex() */ - -/* The field separator information */ - -# define XN_FLAG_SEP_MASK (0xf << 16) - -# define XN_FLAG_COMPAT 0/* Traditional; use old X509_NAME_print */ -# define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */ -# define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */ -# define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */ -# define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */ - -# define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */ - -/* How the field name is shown */ - -# define XN_FLAG_FN_MASK (0x3 << 21) - -# define XN_FLAG_FN_SN 0/* Object short name */ -# define XN_FLAG_FN_LN (1 << 21)/* Object long name */ -# define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */ -# define XN_FLAG_FN_NONE (3 << 21)/* No field names */ - -# define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */ - -/* - * This determines if we dump fields we don't recognise: RFC2253 requires - * this. - */ - -# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) - -# define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20 - * characters */ - -/* Complete set of RFC2253 flags */ - -# define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ - XN_FLAG_SEP_COMMA_PLUS | \ - XN_FLAG_DN_REV | \ - XN_FLAG_FN_SN | \ - XN_FLAG_DUMP_UNKNOWN_FIELDS) - -/* readable oneline form */ - -# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ - ASN1_STRFLGS_ESC_QUOTE | \ - XN_FLAG_SEP_CPLUS_SPC | \ - XN_FLAG_SPC_EQ | \ - XN_FLAG_FN_SN) - -/* readable multiline form */ - -# define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ - ASN1_STRFLGS_ESC_MSB | \ - XN_FLAG_SEP_MULTILINE | \ - XN_FLAG_SPC_EQ | \ - XN_FLAG_FN_LN | \ - XN_FLAG_FN_ALIGN) - -DEFINE_STACK_OF(X509_REVOKED) - -typedef struct X509_crl_info_st X509_CRL_INFO; - -DEFINE_STACK_OF(X509_CRL) - -typedef struct private_key_st { - int version; - /* The PKCS#8 data types */ - X509_ALGOR *enc_algor; - ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ - /* When decrypted, the following will not be NULL */ - EVP_PKEY *dec_pkey; - /* used to encrypt and decrypt */ - int key_length; - char *key_data; - int key_free; /* true if we should auto free key_data */ - /* expanded version of 'enc_algor' */ - EVP_CIPHER_INFO cipher; -} X509_PKEY; - -typedef struct X509_info_st { - X509 *x509; - X509_CRL *crl; - X509_PKEY *x_pkey; - EVP_CIPHER_INFO enc_cipher; - int enc_len; - char *enc_data; -} X509_INFO; - -DEFINE_STACK_OF(X509_INFO) - -/* - * The next 2 structures and their 8 routines are used to manipulate Netscape's - * spki structures - useful if you are writing a CA web page - */ -typedef struct Netscape_spkac_st { - X509_PUBKEY *pubkey; - ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ -} NETSCAPE_SPKAC; - -typedef struct Netscape_spki_st { - NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ - X509_ALGOR sig_algor; - ASN1_BIT_STRING *signature; -} NETSCAPE_SPKI; - -/* Netscape certificate sequence structure */ -typedef struct Netscape_certificate_sequence { - ASN1_OBJECT *type; - STACK_OF(X509) *certs; -} NETSCAPE_CERT_SEQUENCE; - -/*- Unused (and iv length is wrong) -typedef struct CBCParameter_st - { - unsigned char iv[8]; - } CBC_PARAM; -*/ - -/* Password based encryption structure */ - -typedef struct PBEPARAM_st { - ASN1_OCTET_STRING *salt; - ASN1_INTEGER *iter; -} PBEPARAM; - -/* Password based encryption V2 structures */ - -typedef struct PBE2PARAM_st { - X509_ALGOR *keyfunc; - X509_ALGOR *encryption; -} PBE2PARAM; - -typedef struct PBKDF2PARAM_st { -/* Usually OCTET STRING but could be anything */ - ASN1_TYPE *salt; - ASN1_INTEGER *iter; - ASN1_INTEGER *keylength; - X509_ALGOR *prf; -} PBKDF2PARAM; - -#ifndef OPENSSL_NO_SCRYPT -typedef struct SCRYPT_PARAMS_st { - ASN1_OCTET_STRING *salt; - ASN1_INTEGER *costParameter; - ASN1_INTEGER *blockSize; - ASN1_INTEGER *parallelizationParameter; - ASN1_INTEGER *keyLength; -} SCRYPT_PARAMS; -#endif - -#ifdef __cplusplus -} -#endif - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define X509_EXT_PACK_UNKNOWN 1 -# define X509_EXT_PACK_STRING 2 - -# define X509_extract_key(x) X509_get_pubkey(x)/*****/ -# define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) -# define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) - -void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); -X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl), - int (*crl_free) (X509_CRL *crl), - int (*crl_lookup) (X509_CRL *crl, - X509_REVOKED **ret, - ASN1_INTEGER *ser, - X509_NAME *issuer), - int (*crl_verify) (X509_CRL *crl, - EVP_PKEY *pk)); -void X509_CRL_METHOD_free(X509_CRL_METHOD *m); - -void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); -void *X509_CRL_get_meth_data(X509_CRL *crl); - -const char *X509_verify_cert_error_string(long n); - -int X509_verify(X509 *a, EVP_PKEY *r); - -int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); -int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); -int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); - -NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); -char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); -EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); -int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); - -int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); - -int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); -int X509_signature_print(BIO *bp, const X509_ALGOR *alg, - const ASN1_STRING *sig); - -int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); -# ifndef OPENSSL_NO_OCSP -int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert); -# endif -int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); -int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); -# ifndef OPENSSL_NO_OCSP -int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl); -# endif -int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); - -int X509_pubkey_digest(const X509 *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_digest(const X509 *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); - -# ifndef OPENSSL_NO_STDIO -X509 *d2i_X509_fp(FILE *fp, X509 **x509); -int i2d_X509_fp(FILE *fp, X509 *x509); -X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); -int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl); -X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); -int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req); -# ifndef OPENSSL_NO_RSA -RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); -int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa); -RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); -int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa); -RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); -int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa); -# endif -# ifndef OPENSSL_NO_DSA -DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); -int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); -DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); -int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); -# endif -# ifndef OPENSSL_NO_EC -EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); -int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); -EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); -int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); -# endif -X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); -int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8); -PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, - PKCS8_PRIV_KEY_INFO **p8inf); -int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf); -int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); -int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); -int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); -# endif - -X509 *d2i_X509_bio(BIO *bp, X509 **x509); -int i2d_X509_bio(BIO *bp, X509 *x509); -X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); -int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl); -X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); -int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req); -# ifndef OPENSSL_NO_RSA -RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); -int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa); -RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); -int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa); -RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); -int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa); -# endif -# ifndef OPENSSL_NO_DSA -DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); -int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); -DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); -int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); -# endif -# ifndef OPENSSL_NO_EC -EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); -int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); -EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); -int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); -# endif -X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); -int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8); -PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, - PKCS8_PRIV_KEY_INFO **p8inf); -int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf); -int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); -int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); -int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); - -X509 *X509_dup(X509 *x509); -X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); -X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); -X509_CRL *X509_CRL_dup(X509_CRL *crl); -X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev); -X509_REQ *X509_REQ_dup(X509_REQ *req); -X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); -int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, - void *pval); -void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, - const void **ppval, const X509_ALGOR *algor); -void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); -int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); - -X509_NAME *X509_NAME_dup(X509_NAME *xn); -X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); - -int X509_cmp_time(const ASN1_TIME *s, time_t *t); -int X509_cmp_current_time(const ASN1_TIME *s); -ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t); -ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, - int offset_day, long offset_sec, time_t *t); -ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); - -const char *X509_get_default_cert_area(void); -const char *X509_get_default_cert_dir(void); -const char *X509_get_default_cert_file(void); -const char *X509_get_default_cert_dir_env(void); -const char *X509_get_default_cert_file_env(void); -const char *X509_get_default_private_dir(void); - -X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); -X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); - -DECLARE_ASN1_FUNCTIONS(X509_ALGOR) -DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) -DECLARE_ASN1_FUNCTIONS(X509_VAL) - -DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) - -int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); -EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key); -EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key); -int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain); -long X509_get_pathlen(X509 *x); -int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp); -EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length); -# ifndef OPENSSL_NO_RSA -int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); -RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length); -# endif -# ifndef OPENSSL_NO_DSA -int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp); -DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length); -# endif -# ifndef OPENSSL_NO_EC -int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); -EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length); -# endif - -DECLARE_ASN1_FUNCTIONS(X509_SIG) -void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, - const ASN1_OCTET_STRING **pdigest); -void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, - ASN1_OCTET_STRING **pdigest); - -DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) -DECLARE_ASN1_FUNCTIONS(X509_REQ) - -DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) -X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); - -DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) -DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) - -DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) - -DECLARE_ASN1_FUNCTIONS(X509_NAME) - -int X509_NAME_set(X509_NAME **xn, X509_NAME *name); - -DECLARE_ASN1_FUNCTIONS(X509_CINF) - -DECLARE_ASN1_FUNCTIONS(X509) -DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) - -#define X509_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef) -int X509_set_ex_data(X509 *r, int idx, void *arg); -void *X509_get_ex_data(X509 *r, int idx); -int i2d_X509_AUX(X509 *a, unsigned char **pp); -X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length); - -int i2d_re_X509_tbs(X509 *x, unsigned char **pp); - -int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid, - int *secbits, uint32_t *flags); -void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid, - int secbits, uint32_t flags); - -int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits, - uint32_t *flags); - -void X509_get0_signature(const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg, const X509 *x); -int X509_get_signature_nid(const X509 *x); - -int X509_trusted(const X509 *x); -int X509_alias_set1(X509 *x, const unsigned char *name, int len); -int X509_keyid_set1(X509 *x, const unsigned char *id, int len); -unsigned char *X509_alias_get0(X509 *x, int *len); -unsigned char *X509_keyid_get0(X509 *x, int *len); -int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *, - int); -int X509_TRUST_set(int *t, int trust); -int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); -int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj); -void X509_trust_clear(X509 *x); -void X509_reject_clear(X509 *x); - -STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x); -STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x); - -DECLARE_ASN1_FUNCTIONS(X509_REVOKED) -DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) -DECLARE_ASN1_FUNCTIONS(X509_CRL) - -int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); -int X509_CRL_get0_by_serial(X509_CRL *crl, - X509_REVOKED **ret, ASN1_INTEGER *serial); -int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); - -X509_PKEY *X509_PKEY_new(void); -void X509_PKEY_free(X509_PKEY *a); - -DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) -DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) -DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) - -X509_INFO *X509_INFO_new(void); -void X509_INFO_free(X509_INFO *a); -char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size); - -int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, - ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); - -int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, - unsigned char *md, unsigned int *len); - -int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, - char *data, EVP_PKEY *pkey, const EVP_MD *type); - -int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, - unsigned char *md, unsigned int *len); - -int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, - ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey); - -int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data, - EVP_PKEY *pkey, const EVP_MD *type); -int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, - void *asn, EVP_MD_CTX *ctx); - -long X509_get_version(const X509 *x); -int X509_set_version(X509 *x, long version); -int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); -ASN1_INTEGER *X509_get_serialNumber(X509 *x); -const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); -int X509_set_issuer_name(X509 *x, X509_NAME *name); -X509_NAME *X509_get_issuer_name(const X509 *a); -int X509_set_subject_name(X509 *x, X509_NAME *name); -X509_NAME *X509_get_subject_name(const X509 *a); -const ASN1_TIME * X509_get0_notBefore(const X509 *x); -ASN1_TIME *X509_getm_notBefore(const X509 *x); -int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); -const ASN1_TIME *X509_get0_notAfter(const X509 *x); -ASN1_TIME *X509_getm_notAfter(const X509 *x); -int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); -int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); -int X509_up_ref(X509 *x); -int X509_get_signature_type(const X509 *x); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_get_notBefore X509_getm_notBefore -# define X509_get_notAfter X509_getm_notAfter -# define X509_set_notBefore X509_set1_notBefore -# define X509_set_notAfter X509_set1_notAfter -#endif - - -/* - * This one is only used so that a binary form can output, as in - * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf) - */ -X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); -const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); -void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid, - const ASN1_BIT_STRING **psuid); -const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); - -EVP_PKEY *X509_get0_pubkey(const X509 *x); -EVP_PKEY *X509_get_pubkey(X509 *x); -ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); -int X509_certificate_type(const X509 *x, const EVP_PKEY *pubkey); - -long X509_REQ_get_version(const X509_REQ *req); -int X509_REQ_set_version(X509_REQ *x, long version); -X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req); -int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); -void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg); -int X509_REQ_get_signature_nid(const X509_REQ *req); -int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); -int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); -EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); -EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req); -X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req); -int X509_REQ_extension_nid(int nid); -int *X509_REQ_get_extension_nids(void); -void X509_REQ_set_extension_nids(int *nids); -STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); -int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, - int nid); -int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); -int X509_REQ_get_attr_count(const X509_REQ *req); -int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); -int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); -X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); -int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); -int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len); -int X509_REQ_add1_attr_by_NID(X509_REQ *req, - int nid, int type, - const unsigned char *bytes, int len); -int X509_REQ_add1_attr_by_txt(X509_REQ *req, - const char *attrname, int type, - const unsigned char *bytes, int len); - -int X509_CRL_set_version(X509_CRL *x, long version); -int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); -int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); -int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); -int X509_CRL_sort(X509_CRL *crl); -int X509_CRL_up_ref(X509_CRL *crl); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate -# define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate -#endif - -long X509_CRL_get_version(const X509_CRL *crl); -const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); -const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); -DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl)) -DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl)) -X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); -const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); -STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); -void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg); -int X509_CRL_get_signature_nid(const X509_CRL *crl); -int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); - -const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); -int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); -const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); -int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); -const STACK_OF(X509_EXTENSION) * -X509_REVOKED_get0_extensions(const X509_REVOKED *r); - -X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, - EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); - -int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey); - -int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); -int X509_chain_check_suiteb(int *perror_depth, - X509 *x, STACK_OF(X509) *chain, - unsigned long flags); -int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); -STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); - -int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); -unsigned long X509_issuer_and_serial_hash(X509 *a); - -int X509_issuer_name_cmp(const X509 *a, const X509 *b); -unsigned long X509_issuer_name_hash(X509 *a); - -int X509_subject_name_cmp(const X509 *a, const X509 *b); -unsigned long X509_subject_name_hash(X509 *x); - -# ifndef OPENSSL_NO_MD5 -unsigned long X509_issuer_name_hash_old(X509 *a); -unsigned long X509_subject_name_hash_old(X509 *x); -# endif - -int X509_cmp(const X509 *a, const X509 *b); -int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); -unsigned long X509_NAME_hash(X509_NAME *x); -unsigned long X509_NAME_hash_old(X509_NAME *x); - -int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); -int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); -int X509_aux_print(BIO *out, X509 *x, int indent); -# ifndef OPENSSL_NO_STDIO -int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, - unsigned long cflag); -int X509_print_fp(FILE *bp, X509 *x); -int X509_CRL_print_fp(FILE *bp, X509_CRL *x); -int X509_REQ_print_fp(FILE *bp, X509_REQ *req); -int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, - unsigned long flags); -# endif - -int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase); -int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, - unsigned long flags); -int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, - unsigned long cflag); -int X509_print(BIO *bp, X509 *x); -int X509_ocspid_print(BIO *bp, X509 *x); -int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag); -int X509_CRL_print(BIO *bp, X509_CRL *x); -int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, - unsigned long cflag); -int X509_REQ_print(BIO *bp, X509_REQ *req); - -int X509_NAME_entry_count(const X509_NAME *name); -int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len); -int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, - char *buf, int len); - -/* - * NOTE: you should be passing -1, not 0 as lastpos. The functions that use - * lastpos, search after that position on. - */ -int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos); -int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, - int lastpos); -X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); -X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); -int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, - int loc, int set); -int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len, int loc, - int set); -int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, - const unsigned char *bytes, int len, int loc, - int set); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, - const char *field, int type, - const unsigned char *bytes, - int len); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, - int type, - const unsigned char *bytes, - int len); -int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, - const unsigned char *bytes, int len, int loc, - int set); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, - int len); -int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj); -int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, - const unsigned char *bytes, int len); -ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); -ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); -int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); - -int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, - size_t *pderlen); - -int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); -int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, - int nid, int lastpos); -int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, - const ASN1_OBJECT *obj, int lastpos); -int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, - int crit, int lastpos); -X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); -X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); -STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, - X509_EXTENSION *ex, int loc); - -int X509_get_ext_count(const X509 *x); -int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); -int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos); -int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); -X509_EXTENSION *X509_get_ext(const X509 *x, int loc); -X509_EXTENSION *X509_delete_ext(X509 *x, int loc); -int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); -void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); -int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, - unsigned long flags); - -int X509_CRL_get_ext_count(const X509_CRL *x); -int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos); -int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, - int lastpos); -int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos); -X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); -X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); -int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); -void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx); -int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, - unsigned long flags); - -int X509_REVOKED_get_ext_count(const X509_REVOKED *x); -int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos); -int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj, - int lastpos); -int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, - int lastpos); -X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); -X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); -int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); -void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, - int *idx); -int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, - unsigned long flags); - -X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, - int nid, int crit, - ASN1_OCTET_STRING *data); -X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, - const ASN1_OBJECT *obj, int crit, - ASN1_OCTET_STRING *data); -int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); -int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); -int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); -ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); -ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); -int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); - -int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); -int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, - int lastpos); -int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, - const ASN1_OBJECT *obj, int lastpos); -X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); -X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, - X509_ATTRIBUTE *attr); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) - **x, const ASN1_OBJECT *obj, - int type, - const unsigned char *bytes, - int len); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) - **x, int nid, int type, - const unsigned char *bytes, - int len); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) - **x, const char *attrname, - int type, - const unsigned char *bytes, - int len); -void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, - const ASN1_OBJECT *obj, int lastpos, int type); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, - int atrtype, const void *data, - int len); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, - const ASN1_OBJECT *obj, - int atrtype, const void *data, - int len); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, - const char *atrname, int type, - const unsigned char *bytes, - int len); -int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); -int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, - const void *data, int len); -void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype, - void *data); -int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); -ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); -ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); - -int EVP_PKEY_get_attr_count(const EVP_PKEY *key); -int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); -int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); -X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); -int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); -int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len); -int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, - int nid, int type, - const unsigned char *bytes, int len); -int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, - const char *attrname, int type, - const unsigned char *bytes, int len); - -int X509_verify_cert(X509_STORE_CTX *ctx); - -/* lookup a cert from a X509 STACK */ -X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name, - ASN1_INTEGER *serial); -X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name); - -DECLARE_ASN1_FUNCTIONS(PBEPARAM) -DECLARE_ASN1_FUNCTIONS(PBE2PARAM) -DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) -#ifndef OPENSSL_NO_SCRYPT -DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS) -#endif - -int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, - const unsigned char *salt, int saltlen); - -X509_ALGOR *PKCS5_pbe_set(int alg, int iter, - const unsigned char *salt, int saltlen); -X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, - unsigned char *salt, int saltlen); -X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, - unsigned char *salt, int saltlen, - unsigned char *aiv, int prf_nid); - -#ifndef OPENSSL_NO_SCRYPT -X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, - const unsigned char *salt, int saltlen, - unsigned char *aiv, uint64_t N, uint64_t r, - uint64_t p); -#endif - -X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, - int prf_nid, int keylen); - -/* PKCS#8 utilities */ - -DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) - -EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); -PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); - -int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, - int version, int ptype, void *pval, - unsigned char *penc, int penclen); -int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, - const unsigned char **pk, int *ppklen, - const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); - -const STACK_OF(X509_ATTRIBUTE) * -PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); -int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, - const unsigned char *bytes, int len); - -int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, - int ptype, void *pval, - unsigned char *penc, int penclen); -int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, - const unsigned char **pk, int *ppklen, - X509_ALGOR **pa, X509_PUBKEY *pub); - -int X509_check_trust(X509 *x, int id, int flags); -int X509_TRUST_get_count(void); -X509_TRUST *X509_TRUST_get0(int idx); -int X509_TRUST_get_by_id(int id); -int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), - const char *name, int arg1, void *arg2); -void X509_TRUST_cleanup(void); -int X509_TRUST_get_flags(const X509_TRUST *xp); -char *X509_TRUST_get0_name(const X509_TRUST *xp); -int X509_TRUST_get_trust(const X509_TRUST *xp); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/x509_vfy.h b/Hin2n/src/main/jniLibs/x86/include/openssl/x509_vfy.h deleted file mode 100644 index adb8bce7..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/x509_vfy.h +++ /dev/null @@ -1,628 +0,0 @@ -/* - * 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_X509_VFY_H -# define HEADER_X509_VFY_H - -/* - * Protect against recursion, x509.h and x509_vfy.h each include the other. - */ -# ifndef HEADER_X509_H -# include -# endif - -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- -SSL_CTX -> X509_STORE - -> X509_LOOKUP - ->X509_LOOKUP_METHOD - -> X509_LOOKUP - ->X509_LOOKUP_METHOD - -SSL -> X509_STORE_CTX - ->X509_STORE - -The X509_STORE holds the tables etc for verification stuff. -A X509_STORE_CTX is used while validating a single certificate. -The X509_STORE has X509_LOOKUPs for looking up certs. -The X509_STORE then calls a function to actually verify the -certificate chain. -*/ - -typedef enum { - X509_LU_NONE = 0, - X509_LU_X509, X509_LU_CRL -} X509_LOOKUP_TYPE; - -#if OPENSSL_API_COMPAT < 0x10100000L -#define X509_LU_RETRY -1 -#define X509_LU_FAIL 0 -#endif - -DEFINE_STACK_OF(X509_LOOKUP) -DEFINE_STACK_OF(X509_OBJECT) -DEFINE_STACK_OF(X509_VERIFY_PARAM) - -int X509_STORE_set_depth(X509_STORE *store, int depth); - -typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *); -typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); -typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer, - X509_STORE_CTX *ctx, X509 *x); -typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx, - X509 *x, X509 *issuer); -typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx); -typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx, - X509_CRL **crl, X509 *x); -typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl); -typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx, - X509_CRL *crl, X509 *x); -typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx); -typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx, - X509_NAME *nm); -typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx, - X509_NAME *nm); -typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx); - - -void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); - -# define X509_STORE_CTX_set_app_data(ctx,data) \ - X509_STORE_CTX_set_ex_data(ctx,0,data) -# define X509_STORE_CTX_get_app_data(ctx) \ - X509_STORE_CTX_get_ex_data(ctx,0) - -# define X509_L_FILE_LOAD 1 -# define X509_L_ADD_DIR 2 - -# define X509_LOOKUP_load_file(x,name,type) \ - X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) - -# define X509_LOOKUP_add_dir(x,name,type) \ - X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) - -# define X509_V_OK 0 -# define X509_V_ERR_UNSPECIFIED 1 -# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 -# define X509_V_ERR_UNABLE_TO_GET_CRL 3 -# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 -# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 -# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 -# define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 -# define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 -# define X509_V_ERR_CERT_NOT_YET_VALID 9 -# define X509_V_ERR_CERT_HAS_EXPIRED 10 -# define X509_V_ERR_CRL_NOT_YET_VALID 11 -# define X509_V_ERR_CRL_HAS_EXPIRED 12 -# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 -# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 -# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 -# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 -# define X509_V_ERR_OUT_OF_MEM 17 -# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 -# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 -# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 -# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 -# define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 -# define X509_V_ERR_CERT_REVOKED 23 -# define X509_V_ERR_INVALID_CA 24 -# define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 -# define X509_V_ERR_INVALID_PURPOSE 26 -# define X509_V_ERR_CERT_UNTRUSTED 27 -# define X509_V_ERR_CERT_REJECTED 28 -/* These are 'informational' when looking for issuer cert */ -# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 -# define X509_V_ERR_AKID_SKID_MISMATCH 30 -# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 -# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 -# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 -# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 -# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 -# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 -# define X509_V_ERR_INVALID_NON_CA 37 -# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 -# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 -# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 -# define X509_V_ERR_INVALID_EXTENSION 41 -# define X509_V_ERR_INVALID_POLICY_EXTENSION 42 -# define X509_V_ERR_NO_EXPLICIT_POLICY 43 -# define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 -# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 -# define X509_V_ERR_UNNESTED_RESOURCE 46 -# define X509_V_ERR_PERMITTED_VIOLATION 47 -# define X509_V_ERR_EXCLUDED_VIOLATION 48 -# define X509_V_ERR_SUBTREE_MINMAX 49 -/* The application is not happy */ -# define X509_V_ERR_APPLICATION_VERIFICATION 50 -# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 -# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 -# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 -# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 -/* Another issuer check debug option */ -# define X509_V_ERR_PATH_LOOP 55 -/* Suite B mode algorithm violation */ -# define X509_V_ERR_SUITE_B_INVALID_VERSION 56 -# define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 -# define X509_V_ERR_SUITE_B_INVALID_CURVE 58 -# define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 -# define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 -# define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 -/* Host, email and IP check errors */ -# define X509_V_ERR_HOSTNAME_MISMATCH 62 -# define X509_V_ERR_EMAIL_MISMATCH 63 -# define X509_V_ERR_IP_ADDRESS_MISMATCH 64 -/* DANE TLSA errors */ -# define X509_V_ERR_DANE_NO_MATCH 65 -/* security level errors */ -# define X509_V_ERR_EE_KEY_TOO_SMALL 66 -# define X509_V_ERR_CA_KEY_TOO_SMALL 67 -# define X509_V_ERR_CA_MD_TOO_WEAK 68 -/* Caller error */ -# define X509_V_ERR_INVALID_CALL 69 -/* Issuer lookup error */ -# define X509_V_ERR_STORE_LOOKUP 70 -/* Certificate transparency */ -# define X509_V_ERR_NO_VALID_SCTS 71 - -# define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72 -/* OCSP status errors */ -# define X509_V_ERR_OCSP_VERIFY_NEEDED 73 /* Need OCSP verification */ -# define X509_V_ERR_OCSP_VERIFY_FAILED 74 /* Couldn't verify cert through OCSP */ -# define X509_V_ERR_OCSP_CERT_UNKNOWN 75 /* Certificate wasn't recognized by the OCSP responder */ - -/* Certificate verify flags */ - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_V_FLAG_CB_ISSUER_CHECK 0x0 /* Deprecated */ -# endif -/* Use check time instead of current time */ -# define X509_V_FLAG_USE_CHECK_TIME 0x2 -/* Lookup CRLs */ -# define X509_V_FLAG_CRL_CHECK 0x4 -/* Lookup CRLs for whole chain */ -# define X509_V_FLAG_CRL_CHECK_ALL 0x8 -/* Ignore unhandled critical extensions */ -# define X509_V_FLAG_IGNORE_CRITICAL 0x10 -/* Disable workarounds for broken certificates */ -# define X509_V_FLAG_X509_STRICT 0x20 -/* Enable proxy certificate validation */ -# define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 -/* Enable policy checking */ -# define X509_V_FLAG_POLICY_CHECK 0x80 -/* Policy variable require-explicit-policy */ -# define X509_V_FLAG_EXPLICIT_POLICY 0x100 -/* Policy variable inhibit-any-policy */ -# define X509_V_FLAG_INHIBIT_ANY 0x200 -/* Policy variable inhibit-policy-mapping */ -# define X509_V_FLAG_INHIBIT_MAP 0x400 -/* Notify callback that policy is OK */ -# define X509_V_FLAG_NOTIFY_POLICY 0x800 -/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ -# define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 -/* Delta CRL support */ -# define X509_V_FLAG_USE_DELTAS 0x2000 -/* Check self-signed CA signature */ -# define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 -/* Use trusted store first */ -# define X509_V_FLAG_TRUSTED_FIRST 0x8000 -/* Suite B 128 bit only mode: not normally used */ -# define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 -/* Suite B 192 bit only mode */ -# define X509_V_FLAG_SUITEB_192_LOS 0x20000 -/* Suite B 128 bit mode allowing 192 bit algorithms */ -# define X509_V_FLAG_SUITEB_128_LOS 0x30000 -/* Allow partial chains if at least one certificate is in trusted store */ -# define X509_V_FLAG_PARTIAL_CHAIN 0x80000 -/* - * If the initial chain is not trusted, do not attempt to build an alternative - * chain. Alternate chain checking was introduced in 1.1.0. Setting this flag - * will force the behaviour to match that of previous versions. - */ -# define X509_V_FLAG_NO_ALT_CHAINS 0x100000 -/* Do not check certificate/CRL validity against current time */ -# define X509_V_FLAG_NO_CHECK_TIME 0x200000 - -# define X509_VP_FLAG_DEFAULT 0x1 -# define X509_VP_FLAG_OVERWRITE 0x2 -# define X509_VP_FLAG_RESET_FLAGS 0x4 -# define X509_VP_FLAG_LOCKED 0x8 -# define X509_VP_FLAG_ONCE 0x10 - -/* Internal use: mask of policy related options */ -# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ - | X509_V_FLAG_EXPLICIT_POLICY \ - | X509_V_FLAG_INHIBIT_ANY \ - | X509_V_FLAG_INHIBIT_MAP) - -int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, - X509_NAME *name); -X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, - X509_LOOKUP_TYPE type, - X509_NAME *name); -X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, - X509_OBJECT *x); -int X509_OBJECT_up_ref_count(X509_OBJECT *a); -X509_OBJECT *X509_OBJECT_new(void); -void X509_OBJECT_free(X509_OBJECT *a); -X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); -X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a); -int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj); -X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a); -int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj); -X509_STORE *X509_STORE_new(void); -void X509_STORE_free(X509_STORE *v); -int X509_STORE_lock(X509_STORE *ctx); -int X509_STORE_unlock(X509_STORE *ctx); -int X509_STORE_up_ref(X509_STORE *v); -STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v); - -STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); -STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); -int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); -int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); -int X509_STORE_set_trust(X509_STORE *ctx, int trust); -int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); -X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx); - -void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify); -#define X509_STORE_set_verify_func(ctx, func) \ - X509_STORE_set_verify((ctx),(func)) -void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, - X509_STORE_CTX_verify_fn verify); -X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx); -void X509_STORE_set_verify_cb(X509_STORE *ctx, - X509_STORE_CTX_verify_cb verify_cb); -# define X509_STORE_set_verify_cb_func(ctx,func) \ - X509_STORE_set_verify_cb((ctx),(func)) -X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx); -void X509_STORE_set_get_issuer(X509_STORE *ctx, - X509_STORE_CTX_get_issuer_fn get_issuer); -X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE *ctx); -void X509_STORE_set_check_issued(X509_STORE *ctx, - X509_STORE_CTX_check_issued_fn check_issued); -X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *ctx); -void X509_STORE_set_check_revocation(X509_STORE *ctx, - X509_STORE_CTX_check_revocation_fn check_revocation); -X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE *ctx); -void X509_STORE_set_get_crl(X509_STORE *ctx, - X509_STORE_CTX_get_crl_fn get_crl); -X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE *ctx); -void X509_STORE_set_check_crl(X509_STORE *ctx, - X509_STORE_CTX_check_crl_fn check_crl); -X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE *ctx); -void X509_STORE_set_cert_crl(X509_STORE *ctx, - X509_STORE_CTX_cert_crl_fn cert_crl); -X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE *ctx); -void X509_STORE_set_check_policy(X509_STORE *ctx, - X509_STORE_CTX_check_policy_fn check_policy); -X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE *ctx); -void X509_STORE_set_lookup_certs(X509_STORE *ctx, - X509_STORE_CTX_lookup_certs_fn lookup_certs); -X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE *ctx); -void X509_STORE_set_lookup_crls(X509_STORE *ctx, - X509_STORE_CTX_lookup_crls_fn lookup_crls); -#define X509_STORE_set_lookup_crls_cb(ctx, func) \ - X509_STORE_set_lookup_crls((ctx), (func)) -X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE *ctx); -void X509_STORE_set_cleanup(X509_STORE *ctx, - X509_STORE_CTX_cleanup_fn cleanup); -X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE *ctx); - -#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, l, p, newf, dupf, freef) -int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data); -void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx); - -X509_STORE_CTX *X509_STORE_CTX_new(void); - -int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); - -void X509_STORE_CTX_free(X509_STORE_CTX *ctx); -int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, - X509 *x509, STACK_OF(X509) *chain); -void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); -void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); - -X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); -X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx); -STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); -void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, - X509_STORE_CTX_verify_cb verify); -X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx); -X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx); -X509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx); -X509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx); -X509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx); -X509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx); -X509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define X509_STORE_CTX_get_chain X509_STORE_CTX_get0_chain -# define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted -# define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack -# define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject -# define X509_STORE_get1_certs X509_STORE_CTX_get1_certs -# define X509_STORE_get1_crls X509_STORE_CTX_get1_crls -/* the following macro is misspelled; use X509_STORE_get1_certs instead */ -# define X509_STORE_get1_cert X509_STORE_CTX_get1_certs -/* the following macro is misspelled; use X509_STORE_get1_crls instead */ -# define X509_STORE_get1_crl X509_STORE_CTX_get1_crls -#endif - -X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); -X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); -X509_LOOKUP_METHOD *X509_LOOKUP_file(void); - -typedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc, - long argl, char **ret); -typedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - X509_NAME *name, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - X509_NAME *name, - ASN1_INTEGER *serial, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - const unsigned char* bytes, - int len, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - const char *str, - int len, - X509_OBJECT *ret); - -X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name); -void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method, - int (*new_item) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method, - void (*free_fn) (X509_LOOKUP *ctx)); -void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method, - int (*init) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method, - int (*shutdown) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method, - X509_LOOKUP_ctrl_fn ctrl_fn); -X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_subject_fn fn); -X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_issuer_serial(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_issuer_serial_fn fn); -X509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_fingerprint_fn fn); -X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_alias_fn fn); -X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias( - const X509_LOOKUP_METHOD *method); - - -int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); -int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); - -int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, - X509_NAME *name, X509_OBJECT *ret); -X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, - X509_LOOKUP_TYPE type, - X509_NAME *name); - -int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, - long argl, char **ret); - -int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); -int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); -int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); - -X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); -void X509_LOOKUP_free(X509_LOOKUP *ctx); -int X509_LOOKUP_init(X509_LOOKUP *ctx); -int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - X509_NAME *name, X509_OBJECT *ret); -int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - X509_NAME *name, ASN1_INTEGER *serial, - X509_OBJECT *ret); -int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const unsigned char *bytes, int len, - X509_OBJECT *ret); -int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const char *str, int len, X509_OBJECT *ret); -int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data); -void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx); -X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx); -int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); - -int X509_STORE_load_locations(X509_STORE *ctx, - const char *file, const char *dir); -int X509_STORE_set_default_paths(X509_STORE *ctx); - -#define X509_STORE_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE_CTX, l, p, newf, dupf, freef) -int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data); -void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx); -int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s); -int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth); -X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x); -X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); -X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); -STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx); -STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x); -void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk); -void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk); -int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); -int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); -int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, - int purpose, int trust); -void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); -void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, - time_t t); - -X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); -int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); -int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx); - -X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); -int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); - -/* - * Bridge opacity barrier between libcrypt and libssl, also needed to support - * offline testing in test/danetest.c - */ -void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane); -#define DANE_FLAG_NO_DANE_EE_NAMECHECKS (1L << 0) - -/* X509_VERIFY_PARAM functions */ - -X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); -void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, - const X509_VERIFY_PARAM *from); -int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, - const X509_VERIFY_PARAM *from); -int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); -int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, - unsigned long flags); -int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, - unsigned long flags); -unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); -int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); -void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); -void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level); -time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param); -void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); -int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, - ASN1_OBJECT *policy); -int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, - STACK_OF(ASN1_OBJECT) *policies); - -int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, - uint32_t flags); -uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param); - -int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, - const char *name, size_t namelen); -int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, - const char *name, size_t namelen); -void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, - unsigned int flags); -unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param); -char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *); -void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *, X509_VERIFY_PARAM *); -int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, - const char *email, size_t emaillen); -int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, - const unsigned char *ip, size_t iplen); -int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, - const char *ipasc); - -int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param); -const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); - -int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_get_count(void); -const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); -const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); -void X509_VERIFY_PARAM_table_cleanup(void); - -/* Non positive return values are errors */ -#define X509_PCY_TREE_FAILURE -2 /* Failure to satisfy explicit policy */ -#define X509_PCY_TREE_INVALID -1 /* Inconsistent or invalid extensions */ -#define X509_PCY_TREE_INTERNAL 0 /* Internal error, most likely malloc */ - -/* - * Positive return values form a bit mask, all but the first are internal to - * the library and don't appear in results from X509_policy_check(). - */ -#define X509_PCY_TREE_VALID 1 /* The policy tree is valid */ -#define X509_PCY_TREE_EMPTY 2 /* The policy tree is empty */ -#define X509_PCY_TREE_EXPLICIT 4 /* Explicit policy required */ - -int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, - STACK_OF(X509) *certs, - STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags); - -void X509_policy_tree_free(X509_POLICY_TREE *tree); - -int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); -X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, - int i); - -STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const - X509_POLICY_TREE - *tree); - -STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const - X509_POLICY_TREE - *tree); - -int X509_policy_level_node_count(X509_POLICY_LEVEL *level); - -X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, - int i); - -const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); - -STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const - X509_POLICY_NODE - *node); -const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE - *node); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/x509err.h b/Hin2n/src/main/jniLibs/x86/include/openssl/x509err.h deleted file mode 100644 index 02738531..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/x509err.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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_X509ERR_H -# define HEADER_X509ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_X509_strings(void); - -/* - * X509 function codes. - */ -# define X509_F_ADD_CERT_DIR 100 -# define X509_F_BUILD_CHAIN 106 -# define X509_F_BY_FILE_CTRL 101 -# define X509_F_CHECK_NAME_CONSTRAINTS 149 -# define X509_F_CHECK_POLICY 145 -# define X509_F_DANE_I2D 107 -# define X509_F_DIR_CTRL 102 -# define X509_F_GET_CERT_BY_SUBJECT 103 -# define X509_F_I2D_X509_AUX 151 -# define X509_F_LOOKUP_CERTS_SK 152 -# define X509_F_NETSCAPE_SPKI_B64_DECODE 129 -# define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 -# define X509_F_NEW_DIR 153 -# define X509_F_X509AT_ADD1_ATTR 135 -# define X509_F_X509V3_ADD_EXT 104 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 -# define X509_F_X509_ATTRIBUTE_GET0_DATA 139 -# define X509_F_X509_ATTRIBUTE_SET1_DATA 138 -# define X509_F_X509_CHECK_PRIVATE_KEY 128 -# define X509_F_X509_CRL_DIFF 105 -# define X509_F_X509_CRL_METHOD_NEW 154 -# define X509_F_X509_CRL_PRINT_FP 147 -# define X509_F_X509_EXTENSION_CREATE_BY_NID 108 -# define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 -# define X509_F_X509_GET_PUBKEY_PARAMETERS 110 -# define X509_F_X509_LOAD_CERT_CRL_FILE 132 -# define X509_F_X509_LOAD_CERT_FILE 111 -# define X509_F_X509_LOAD_CRL_FILE 112 -# define X509_F_X509_LOOKUP_METH_NEW 160 -# define X509_F_X509_LOOKUP_NEW 155 -# define X509_F_X509_NAME_ADD_ENTRY 113 -# define X509_F_X509_NAME_CANON 156 -# define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 -# define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 -# define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 -# define X509_F_X509_NAME_ONELINE 116 -# define X509_F_X509_NAME_PRINT 117 -# define X509_F_X509_OBJECT_NEW 150 -# define X509_F_X509_PRINT_EX_FP 118 -# define X509_F_X509_PUBKEY_DECODE 148 -# define X509_F_X509_PUBKEY_GET0 119 -# define X509_F_X509_PUBKEY_SET 120 -# define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 -# define X509_F_X509_REQ_PRINT_EX 121 -# define X509_F_X509_REQ_PRINT_FP 122 -# define X509_F_X509_REQ_TO_X509 123 -# define X509_F_X509_STORE_ADD_CERT 124 -# define X509_F_X509_STORE_ADD_CRL 125 -# define X509_F_X509_STORE_ADD_LOOKUP 157 -# define X509_F_X509_STORE_CTX_GET1_ISSUER 146 -# define X509_F_X509_STORE_CTX_INIT 143 -# define X509_F_X509_STORE_CTX_NEW 142 -# define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 -# define X509_F_X509_STORE_NEW 158 -# define X509_F_X509_TO_X509_REQ 126 -# define X509_F_X509_TRUST_ADD 133 -# define X509_F_X509_TRUST_SET 141 -# define X509_F_X509_VERIFY_CERT 127 -# define X509_F_X509_VERIFY_PARAM_NEW 159 - -/* - * X509 reason codes. - */ -# define X509_R_AKID_MISMATCH 110 -# define X509_R_BAD_SELECTOR 133 -# define X509_R_BAD_X509_FILETYPE 100 -# define X509_R_BASE64_DECODE_ERROR 118 -# define X509_R_CANT_CHECK_DH_KEY 114 -# define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 -# define X509_R_CRL_ALREADY_DELTA 127 -# define X509_R_CRL_VERIFY_FAILURE 131 -# define X509_R_IDP_MISMATCH 128 -# define X509_R_INVALID_ATTRIBUTES 138 -# define X509_R_INVALID_DIRECTORY 113 -# define X509_R_INVALID_FIELD_NAME 119 -# define X509_R_INVALID_TRUST 123 -# define X509_R_ISSUER_MISMATCH 129 -# define X509_R_KEY_TYPE_MISMATCH 115 -# define X509_R_KEY_VALUES_MISMATCH 116 -# define X509_R_LOADING_CERT_DIR 103 -# define X509_R_LOADING_DEFAULTS 104 -# define X509_R_METHOD_NOT_SUPPORTED 124 -# define X509_R_NAME_TOO_LONG 134 -# define X509_R_NEWER_CRL_NOT_NEWER 132 -# define X509_R_NO_CERTIFICATE_FOUND 135 -# define X509_R_NO_CERTIFICATE_OR_CRL_FOUND 136 -# define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 -# define X509_R_NO_CRL_FOUND 137 -# define X509_R_NO_CRL_NUMBER 130 -# define X509_R_PUBLIC_KEY_DECODE_ERROR 125 -# define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 -# define X509_R_SHOULD_RETRY 106 -# define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 -# define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 -# define X509_R_UNKNOWN_KEY_TYPE 117 -# define X509_R_UNKNOWN_NID 109 -# define X509_R_UNKNOWN_PURPOSE_ID 121 -# define X509_R_UNKNOWN_TRUST_ID 120 -# define X509_R_UNSUPPORTED_ALGORITHM 111 -# define X509_R_WRONG_LOOKUP_TYPE 112 -# define X509_R_WRONG_TYPE 122 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/x509v3.h b/Hin2n/src/main/jniLibs/x86/include/openssl/x509v3.h deleted file mode 100644 index 6c6eca38..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/x509v3.h +++ /dev/null @@ -1,937 +0,0 @@ -/* - * Copyright 1999-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_X509V3_H -# define HEADER_X509V3_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward reference */ -struct v3_ext_method; -struct v3_ext_ctx; - -/* Useful typedefs */ - -typedef void *(*X509V3_EXT_NEW)(void); -typedef void (*X509V3_EXT_FREE) (void *); -typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); -typedef int (*X509V3_EXT_I2D) (void *, unsigned char **); -typedef STACK_OF(CONF_VALUE) * - (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, - STACK_OF(CONF_VALUE) *extlist); -typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, - STACK_OF(CONF_VALUE) *values); -typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, - void *ext); -typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, const char *str); -typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, - BIO *out, int indent); -typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, const char *str); - -/* V3 extension structure */ - -struct v3_ext_method { - int ext_nid; - int ext_flags; -/* If this is set the following four fields are ignored */ - ASN1_ITEM_EXP *it; -/* Old style ASN1 calls */ - X509V3_EXT_NEW ext_new; - X509V3_EXT_FREE ext_free; - X509V3_EXT_D2I d2i; - X509V3_EXT_I2D i2d; -/* The following pair is used for string extensions */ - X509V3_EXT_I2S i2s; - X509V3_EXT_S2I s2i; -/* The following pair is used for multi-valued extensions */ - X509V3_EXT_I2V i2v; - X509V3_EXT_V2I v2i; -/* The following are used for raw extensions */ - X509V3_EXT_I2R i2r; - X509V3_EXT_R2I r2i; - void *usr_data; /* Any extension specific data */ -}; - -typedef struct X509V3_CONF_METHOD_st { - char *(*get_string) (void *db, const char *section, const char *value); - STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section); - void (*free_string) (void *db, char *string); - void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); -} X509V3_CONF_METHOD; - -/* Context specific info */ -struct v3_ext_ctx { -# define CTX_TEST 0x1 -# define X509V3_CTX_REPLACE 0x2 - int flags; - X509 *issuer_cert; - X509 *subject_cert; - X509_REQ *subject_req; - X509_CRL *crl; - X509V3_CONF_METHOD *db_meth; - void *db; -/* Maybe more here */ -}; - -typedef struct v3_ext_method X509V3_EXT_METHOD; - -DEFINE_STACK_OF(X509V3_EXT_METHOD) - -/* ext_flags values */ -# define X509V3_EXT_DYNAMIC 0x1 -# define X509V3_EXT_CTX_DEP 0x2 -# define X509V3_EXT_MULTILINE 0x4 - -typedef BIT_STRING_BITNAME ENUMERATED_NAMES; - -typedef struct BASIC_CONSTRAINTS_st { - int ca; - ASN1_INTEGER *pathlen; -} BASIC_CONSTRAINTS; - -typedef struct PKEY_USAGE_PERIOD_st { - ASN1_GENERALIZEDTIME *notBefore; - ASN1_GENERALIZEDTIME *notAfter; -} PKEY_USAGE_PERIOD; - -typedef struct otherName_st { - ASN1_OBJECT *type_id; - ASN1_TYPE *value; -} OTHERNAME; - -typedef struct EDIPartyName_st { - ASN1_STRING *nameAssigner; - ASN1_STRING *partyName; -} EDIPARTYNAME; - -typedef struct GENERAL_NAME_st { -# define GEN_OTHERNAME 0 -# define GEN_EMAIL 1 -# define GEN_DNS 2 -# define GEN_X400 3 -# define GEN_DIRNAME 4 -# define GEN_EDIPARTY 5 -# define GEN_URI 6 -# define GEN_IPADD 7 -# define GEN_RID 8 - int type; - union { - char *ptr; - OTHERNAME *otherName; /* otherName */ - ASN1_IA5STRING *rfc822Name; - ASN1_IA5STRING *dNSName; - ASN1_TYPE *x400Address; - X509_NAME *directoryName; - EDIPARTYNAME *ediPartyName; - ASN1_IA5STRING *uniformResourceIdentifier; - ASN1_OCTET_STRING *iPAddress; - ASN1_OBJECT *registeredID; - /* Old names */ - ASN1_OCTET_STRING *ip; /* iPAddress */ - X509_NAME *dirn; /* dirn */ - ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, - * uniformResourceIdentifier */ - ASN1_OBJECT *rid; /* registeredID */ - ASN1_TYPE *other; /* x400Address */ - } d; -} GENERAL_NAME; - -typedef struct ACCESS_DESCRIPTION_st { - ASN1_OBJECT *method; - GENERAL_NAME *location; -} ACCESS_DESCRIPTION; - -typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; - -typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; - -typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; - -DEFINE_STACK_OF(GENERAL_NAME) -typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; -DEFINE_STACK_OF(GENERAL_NAMES) - -DEFINE_STACK_OF(ACCESS_DESCRIPTION) - -typedef struct DIST_POINT_NAME_st { - int type; - union { - GENERAL_NAMES *fullname; - STACK_OF(X509_NAME_ENTRY) *relativename; - } name; -/* If relativename then this contains the full distribution point name */ - X509_NAME *dpname; -} DIST_POINT_NAME; -/* All existing reasons */ -# define CRLDP_ALL_REASONS 0x807f - -# define CRL_REASON_NONE -1 -# define CRL_REASON_UNSPECIFIED 0 -# define CRL_REASON_KEY_COMPROMISE 1 -# define CRL_REASON_CA_COMPROMISE 2 -# define CRL_REASON_AFFILIATION_CHANGED 3 -# define CRL_REASON_SUPERSEDED 4 -# define CRL_REASON_CESSATION_OF_OPERATION 5 -# define CRL_REASON_CERTIFICATE_HOLD 6 -# define CRL_REASON_REMOVE_FROM_CRL 8 -# define CRL_REASON_PRIVILEGE_WITHDRAWN 9 -# define CRL_REASON_AA_COMPROMISE 10 - -struct DIST_POINT_st { - DIST_POINT_NAME *distpoint; - ASN1_BIT_STRING *reasons; - GENERAL_NAMES *CRLissuer; - int dp_reasons; -}; - -typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; - -DEFINE_STACK_OF(DIST_POINT) - -struct AUTHORITY_KEYID_st { - ASN1_OCTET_STRING *keyid; - GENERAL_NAMES *issuer; - ASN1_INTEGER *serial; -}; - -/* Strong extranet structures */ - -typedef struct SXNET_ID_st { - ASN1_INTEGER *zone; - ASN1_OCTET_STRING *user; -} SXNETID; - -DEFINE_STACK_OF(SXNETID) - -typedef struct SXNET_st { - ASN1_INTEGER *version; - STACK_OF(SXNETID) *ids; -} SXNET; - -typedef struct NOTICEREF_st { - ASN1_STRING *organization; - STACK_OF(ASN1_INTEGER) *noticenos; -} NOTICEREF; - -typedef struct USERNOTICE_st { - NOTICEREF *noticeref; - ASN1_STRING *exptext; -} USERNOTICE; - -typedef struct POLICYQUALINFO_st { - ASN1_OBJECT *pqualid; - union { - ASN1_IA5STRING *cpsuri; - USERNOTICE *usernotice; - ASN1_TYPE *other; - } d; -} POLICYQUALINFO; - -DEFINE_STACK_OF(POLICYQUALINFO) - -typedef struct POLICYINFO_st { - ASN1_OBJECT *policyid; - STACK_OF(POLICYQUALINFO) *qualifiers; -} POLICYINFO; - -typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; - -DEFINE_STACK_OF(POLICYINFO) - -typedef struct POLICY_MAPPING_st { - ASN1_OBJECT *issuerDomainPolicy; - ASN1_OBJECT *subjectDomainPolicy; -} POLICY_MAPPING; - -DEFINE_STACK_OF(POLICY_MAPPING) - -typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; - -typedef struct GENERAL_SUBTREE_st { - GENERAL_NAME *base; - ASN1_INTEGER *minimum; - ASN1_INTEGER *maximum; -} GENERAL_SUBTREE; - -DEFINE_STACK_OF(GENERAL_SUBTREE) - -struct NAME_CONSTRAINTS_st { - STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; - STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; -}; - -typedef struct POLICY_CONSTRAINTS_st { - ASN1_INTEGER *requireExplicitPolicy; - ASN1_INTEGER *inhibitPolicyMapping; -} POLICY_CONSTRAINTS; - -/* Proxy certificate structures, see RFC 3820 */ -typedef struct PROXY_POLICY_st { - ASN1_OBJECT *policyLanguage; - ASN1_OCTET_STRING *policy; -} PROXY_POLICY; - -typedef struct PROXY_CERT_INFO_EXTENSION_st { - ASN1_INTEGER *pcPathLengthConstraint; - PROXY_POLICY *proxyPolicy; -} PROXY_CERT_INFO_EXTENSION; - -DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) -DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) - -struct ISSUING_DIST_POINT_st { - DIST_POINT_NAME *distpoint; - int onlyuser; - int onlyCA; - ASN1_BIT_STRING *onlysomereasons; - int indirectCRL; - int onlyattr; -}; - -/* Values in idp_flags field */ -/* IDP present */ -# define IDP_PRESENT 0x1 -/* IDP values inconsistent */ -# define IDP_INVALID 0x2 -/* onlyuser true */ -# define IDP_ONLYUSER 0x4 -/* onlyCA true */ -# define IDP_ONLYCA 0x8 -/* onlyattr true */ -# define IDP_ONLYATTR 0x10 -/* indirectCRL true */ -# define IDP_INDIRECT 0x20 -/* onlysomereasons present */ -# define IDP_REASONS 0x40 - -# define X509V3_conf_err(val) ERR_add_error_data(6, \ - "section:", (val)->section, \ - ",name:", (val)->name, ",value:", (val)->value) - -# define X509V3_set_ctx_test(ctx) \ - X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) -# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; - -# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ - 0,0,0,0, \ - 0,0, \ - (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ - (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ - NULL, NULL, \ - table} - -# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ - 0,0,0,0, \ - (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ - (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ - 0,0,0,0, \ - NULL} - -# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - -/* X509_PURPOSE stuff */ - -# define EXFLAG_BCONS 0x1 -# define EXFLAG_KUSAGE 0x2 -# define EXFLAG_XKUSAGE 0x4 -# define EXFLAG_NSCERT 0x8 - -# define EXFLAG_CA 0x10 -/* Really self issued not necessarily self signed */ -# define EXFLAG_SI 0x20 -# define EXFLAG_V1 0x40 -# define EXFLAG_INVALID 0x80 -/* EXFLAG_SET is set to indicate that some values have been precomputed */ -# define EXFLAG_SET 0x100 -# define EXFLAG_CRITICAL 0x200 -# define EXFLAG_PROXY 0x400 - -# define EXFLAG_INVALID_POLICY 0x800 -# define EXFLAG_FRESHEST 0x1000 -/* Self signed */ -# define EXFLAG_SS 0x2000 - -# define KU_DIGITAL_SIGNATURE 0x0080 -# define KU_NON_REPUDIATION 0x0040 -# define KU_KEY_ENCIPHERMENT 0x0020 -# define KU_DATA_ENCIPHERMENT 0x0010 -# define KU_KEY_AGREEMENT 0x0008 -# define KU_KEY_CERT_SIGN 0x0004 -# define KU_CRL_SIGN 0x0002 -# define KU_ENCIPHER_ONLY 0x0001 -# define KU_DECIPHER_ONLY 0x8000 - -# define NS_SSL_CLIENT 0x80 -# define NS_SSL_SERVER 0x40 -# define NS_SMIME 0x20 -# define NS_OBJSIGN 0x10 -# define NS_SSL_CA 0x04 -# define NS_SMIME_CA 0x02 -# define NS_OBJSIGN_CA 0x01 -# define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) - -# define XKU_SSL_SERVER 0x1 -# define XKU_SSL_CLIENT 0x2 -# define XKU_SMIME 0x4 -# define XKU_CODE_SIGN 0x8 -# define XKU_SGC 0x10 -# define XKU_OCSP_SIGN 0x20 -# define XKU_TIMESTAMP 0x40 -# define XKU_DVCS 0x80 -# define XKU_ANYEKU 0x100 - -# define X509_PURPOSE_DYNAMIC 0x1 -# define X509_PURPOSE_DYNAMIC_NAME 0x2 - -typedef struct x509_purpose_st { - int purpose; - int trust; /* Default trust ID */ - int flags; - int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); - char *name; - char *sname; - void *usr_data; -} X509_PURPOSE; - -# define X509_PURPOSE_SSL_CLIENT 1 -# define X509_PURPOSE_SSL_SERVER 2 -# define X509_PURPOSE_NS_SSL_SERVER 3 -# define X509_PURPOSE_SMIME_SIGN 4 -# define X509_PURPOSE_SMIME_ENCRYPT 5 -# define X509_PURPOSE_CRL_SIGN 6 -# define X509_PURPOSE_ANY 7 -# define X509_PURPOSE_OCSP_HELPER 8 -# define X509_PURPOSE_TIMESTAMP_SIGN 9 - -# define X509_PURPOSE_MIN 1 -# define X509_PURPOSE_MAX 9 - -/* Flags for X509V3_EXT_print() */ - -# define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) -/* Return error for unknown extensions */ -# define X509V3_EXT_DEFAULT 0 -/* Print error for unknown extensions */ -# define X509V3_EXT_ERROR_UNKNOWN (1L << 16) -/* ASN1 parse unknown extensions */ -# define X509V3_EXT_PARSE_UNKNOWN (2L << 16) -/* BIO_dump unknown extensions */ -# define X509V3_EXT_DUMP_UNKNOWN (3L << 16) - -/* Flags for X509V3_add1_i2d */ - -# define X509V3_ADD_OP_MASK 0xfL -# define X509V3_ADD_DEFAULT 0L -# define X509V3_ADD_APPEND 1L -# define X509V3_ADD_REPLACE 2L -# define X509V3_ADD_REPLACE_EXISTING 3L -# define X509V3_ADD_KEEP_EXISTING 4L -# define X509V3_ADD_DELETE 5L -# define X509V3_ADD_SILENT 0x10 - -DEFINE_STACK_OF(X509_PURPOSE) - -DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) - -DECLARE_ASN1_FUNCTIONS(SXNET) -DECLARE_ASN1_FUNCTIONS(SXNETID) - -int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); -int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, - int userlen); -int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, - int userlen); - -ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); -ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); -ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); - -DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) - -DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) - -DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) -GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); -int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); - -ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, - STACK_OF(CONF_VALUE) *nval); -STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, - ASN1_BIT_STRING *bits, - STACK_OF(CONF_VALUE) *extlist); -char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); -ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, const char *str); - -STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, - GENERAL_NAME *gen, - STACK_OF(CONF_VALUE) *ret); -int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); - -DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) - -STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, - GENERAL_NAMES *gen, - STACK_OF(CONF_VALUE) *extlist); -GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); - -DECLARE_ASN1_FUNCTIONS(OTHERNAME) -DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) -int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); -void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); -void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); -int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, - ASN1_OBJECT *oid, ASN1_TYPE *value); -int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, - ASN1_OBJECT **poid, ASN1_TYPE **pvalue); - -char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, - const ASN1_OCTET_STRING *ia5); -ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, const char *str); - -DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) -int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); - -DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) - -DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) -DECLARE_ASN1_FUNCTIONS(POLICYINFO) -DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) -DECLARE_ASN1_FUNCTIONS(USERNOTICE) -DECLARE_ASN1_FUNCTIONS(NOTICEREF) - -DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) -DECLARE_ASN1_FUNCTIONS(DIST_POINT) -DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) -DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) - -int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); - -int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); -int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); - -DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) -DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) - -DECLARE_ASN1_ITEM(POLICY_MAPPING) -DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) -DECLARE_ASN1_ITEM(POLICY_MAPPINGS) - -DECLARE_ASN1_ITEM(GENERAL_SUBTREE) -DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) - -DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) -DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) - -DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) -DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) - -GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, - const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, int gen_type, - const char *value, int is_nc); - -# ifdef HEADER_CONF_H -GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, CONF_VALUE *cnf); -GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, - const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, CONF_VALUE *cnf, - int is_nc); -void X509V3_conf_free(CONF_VALUE *val); - -X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, - const char *value); -X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, - const char *value); -int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, - STACK_OF(X509_EXTENSION) **sk); -int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509 *cert); -int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509_REQ *req); -int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509_CRL *crl); - -X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, - X509V3_CTX *ctx, int ext_nid, - const char *value); -X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *name, const char *value); -int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509 *cert); -int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509_REQ *req); -int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509_CRL *crl); - -int X509V3_add_value_bool_nf(const char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); -int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); -void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); -void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); -# endif - -char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); -STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); -void X509V3_string_free(X509V3_CTX *ctx, char *str); -void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); -void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, - X509_REQ *req, X509_CRL *crl, int flags); - -int X509V3_add_value(const char *name, const char *value, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_uchar(const char *name, const unsigned char *value, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_bool(const char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, - STACK_OF(CONF_VALUE) **extlist); -char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); -ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); -char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); -char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, - const ASN1_ENUMERATED *aint); -int X509V3_EXT_add(X509V3_EXT_METHOD *ext); -int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); -int X509V3_EXT_add_alias(int nid_to, int nid_from); -void X509V3_EXT_cleanup(void); - -const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); -const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); -int X509V3_add_standard_extensions(void); -STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); -void *X509V3_EXT_d2i(X509_EXTENSION *ext); -void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, - int *idx); - -X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); -int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, - int crit, unsigned long flags); - -#if OPENSSL_API_COMPAT < 0x10100000L -/* The new declarations are in crypto.h, but the old ones were here. */ -# define hex_to_string OPENSSL_buf2hexstr -# define string_to_hex OPENSSL_hexstr2buf -#endif - -void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, - int ml); -int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, - int indent); -#ifndef OPENSSL_NO_STDIO -int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); -#endif -int X509V3_extensions_print(BIO *out, const char *title, - const STACK_OF(X509_EXTENSION) *exts, - unsigned long flag, int indent); - -int X509_check_ca(X509 *x); -int X509_check_purpose(X509 *x, int id, int ca); -int X509_supported_extension(X509_EXTENSION *ex); -int X509_PURPOSE_set(int *p, int purpose); -int X509_check_issued(X509 *issuer, X509 *subject); -int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); -void X509_set_proxy_flag(X509 *x); -void X509_set_proxy_pathlen(X509 *x, long l); -long X509_get_proxy_pathlen(X509 *x); - -uint32_t X509_get_extension_flags(X509 *x); -uint32_t X509_get_key_usage(X509 *x); -uint32_t X509_get_extended_key_usage(X509 *x); -const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); -const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); -const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); -const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); - -int X509_PURPOSE_get_count(void); -X509_PURPOSE *X509_PURPOSE_get0(int idx); -int X509_PURPOSE_get_by_sname(const char *sname); -int X509_PURPOSE_get_by_id(int id); -int X509_PURPOSE_add(int id, int trust, int flags, - int (*ck) (const X509_PURPOSE *, const X509 *, int), - const char *name, const char *sname, void *arg); -char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); -char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); -int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); -void X509_PURPOSE_cleanup(void); -int X509_PURPOSE_get_id(const X509_PURPOSE *); - -STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); -STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); -void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); -STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); -/* Flags for X509_check_* functions */ - -/* - * Always check subject name for host match even if subject alt names present - */ -# define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 -/* Disable wildcard matching for dnsName fields and common name. */ -# define X509_CHECK_FLAG_NO_WILDCARDS 0x2 -/* Wildcards must not match a partial label. */ -# define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 -/* Allow (non-partial) wildcards to match multiple labels. */ -# define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 -/* Constraint verifier subdomain patterns to match a single labels. */ -# define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 -/* Never check the subject CN */ -# define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 -/* - * Match reference identifiers starting with "." to any sub-domain. - * This is a non-public flag, turned on implicitly when the subject - * reference identity is a DNS name. - */ -# define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 - -int X509_check_host(X509 *x, const char *chk, size_t chklen, - unsigned int flags, char **peername); -int X509_check_email(X509 *x, const char *chk, size_t chklen, - unsigned int flags); -int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags); -int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); - -ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); -ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); -int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, - unsigned long chtype); - -void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); -DEFINE_STACK_OF(X509_POLICY_NODE) - -#ifndef OPENSSL_NO_RFC3779 -typedef struct ASRange_st { - ASN1_INTEGER *min, *max; -} ASRange; - -# define ASIdOrRange_id 0 -# define ASIdOrRange_range 1 - -typedef struct ASIdOrRange_st { - int type; - union { - ASN1_INTEGER *id; - ASRange *range; - } u; -} ASIdOrRange; - -typedef STACK_OF(ASIdOrRange) ASIdOrRanges; -DEFINE_STACK_OF(ASIdOrRange) - -# define ASIdentifierChoice_inherit 0 -# define ASIdentifierChoice_asIdsOrRanges 1 - -typedef struct ASIdentifierChoice_st { - int type; - union { - ASN1_NULL *inherit; - ASIdOrRanges *asIdsOrRanges; - } u; -} ASIdentifierChoice; - -typedef struct ASIdentifiers_st { - ASIdentifierChoice *asnum, *rdi; -} ASIdentifiers; - -DECLARE_ASN1_FUNCTIONS(ASRange) -DECLARE_ASN1_FUNCTIONS(ASIdOrRange) -DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) -DECLARE_ASN1_FUNCTIONS(ASIdentifiers) - -typedef struct IPAddressRange_st { - ASN1_BIT_STRING *min, *max; -} IPAddressRange; - -# define IPAddressOrRange_addressPrefix 0 -# define IPAddressOrRange_addressRange 1 - -typedef struct IPAddressOrRange_st { - int type; - union { - ASN1_BIT_STRING *addressPrefix; - IPAddressRange *addressRange; - } u; -} IPAddressOrRange; - -typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; -DEFINE_STACK_OF(IPAddressOrRange) - -# define IPAddressChoice_inherit 0 -# define IPAddressChoice_addressesOrRanges 1 - -typedef struct IPAddressChoice_st { - int type; - union { - ASN1_NULL *inherit; - IPAddressOrRanges *addressesOrRanges; - } u; -} IPAddressChoice; - -typedef struct IPAddressFamily_st { - ASN1_OCTET_STRING *addressFamily; - IPAddressChoice *ipAddressChoice; -} IPAddressFamily; - -typedef STACK_OF(IPAddressFamily) IPAddrBlocks; -DEFINE_STACK_OF(IPAddressFamily) - -DECLARE_ASN1_FUNCTIONS(IPAddressRange) -DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) -DECLARE_ASN1_FUNCTIONS(IPAddressChoice) -DECLARE_ASN1_FUNCTIONS(IPAddressFamily) - -/* - * API tag for elements of the ASIdentifer SEQUENCE. - */ -# define V3_ASID_ASNUM 0 -# define V3_ASID_RDI 1 - -/* - * AFI values, assigned by IANA. It'd be nice to make the AFI - * handling code totally generic, but there are too many little things - * that would need to be defined for other address families for it to - * be worth the trouble. - */ -# define IANA_AFI_IPV4 1 -# define IANA_AFI_IPV6 2 - -/* - * Utilities to construct and extract values from RFC3779 extensions, - * since some of the encodings (particularly for IP address prefixes - * and ranges) are a bit tedious to work with directly. - */ -int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); -int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, - ASN1_INTEGER *min, ASN1_INTEGER *max); -int X509v3_addr_add_inherit(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi); -int X509v3_addr_add_prefix(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi, - unsigned char *a, const int prefixlen); -int X509v3_addr_add_range(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi, - unsigned char *min, unsigned char *max); -unsigned X509v3_addr_get_afi(const IPAddressFamily *f); -int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, - unsigned char *min, unsigned char *max, - const int length); - -/* - * Canonical forms. - */ -int X509v3_asid_is_canonical(ASIdentifiers *asid); -int X509v3_addr_is_canonical(IPAddrBlocks *addr); -int X509v3_asid_canonize(ASIdentifiers *asid); -int X509v3_addr_canonize(IPAddrBlocks *addr); - -/* - * Tests for inheritance and containment. - */ -int X509v3_asid_inherits(ASIdentifiers *asid); -int X509v3_addr_inherits(IPAddrBlocks *addr); -int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); -int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); - -/* - * Check whether RFC 3779 extensions nest properly in chains. - */ -int X509v3_asid_validate_path(X509_STORE_CTX *); -int X509v3_addr_validate_path(X509_STORE_CTX *); -int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, - ASIdentifiers *ext, - int allow_inheritance); -int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, - IPAddrBlocks *ext, int allow_inheritance); - -#endif /* OPENSSL_NO_RFC3779 */ - -DEFINE_STACK_OF(ASN1_STRING) - -/* - * Admission Syntax - */ -typedef struct NamingAuthority_st NAMING_AUTHORITY; -typedef struct ProfessionInfo_st PROFESSION_INFO; -typedef struct Admissions_st ADMISSIONS; -typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; -DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) -DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) -DECLARE_ASN1_FUNCTIONS(ADMISSIONS) -DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) -DEFINE_STACK_OF(ADMISSIONS) -DEFINE_STACK_OF(PROFESSION_INFO) -typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; - -const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( - const NAMING_AUTHORITY *n); -const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( - const NAMING_AUTHORITY *n); -const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( - const NAMING_AUTHORITY *n); -void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, - ASN1_OBJECT* namingAuthorityId); -void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, - ASN1_IA5STRING* namingAuthorityUrl); -void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, - ASN1_STRING* namingAuthorityText); - -const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( - const ADMISSION_SYNTAX *as); -void ADMISSION_SYNTAX_set0_admissionAuthority( - ADMISSION_SYNTAX *as, GENERAL_NAME *aa); -const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( - const ADMISSION_SYNTAX *as); -void ADMISSION_SYNTAX_set0_contentsOfAdmissions( - ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); -const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); -void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); -const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); -void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); -const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); -void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); -const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_addProfessionInfo( - PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); -const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_namingAuthority( - PROFESSION_INFO *pi, NAMING_AUTHORITY *na); -const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_professionItems( - PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); -const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_professionOIDs( - PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); -const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_registrationNumber( - PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86/include/openssl/x509v3err.h b/Hin2n/src/main/jniLibs/x86/include/openssl/x509v3err.h deleted file mode 100644 index 5f25442f..00000000 --- a/Hin2n/src/main/jniLibs/x86/include/openssl/x509v3err.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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_X509V3ERR_H -# define HEADER_X509V3ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_X509V3_strings(void); - -/* - * X509V3 function codes. - */ -# define X509V3_F_A2I_GENERAL_NAME 164 -# define X509V3_F_ADDR_VALIDATE_PATH_INTERNAL 166 -# define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 -# define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 -# define X509V3_F_BIGNUM_TO_STRING 167 -# define X509V3_F_COPY_EMAIL 122 -# define X509V3_F_COPY_ISSUER 123 -# define X509V3_F_DO_DIRNAME 144 -# define X509V3_F_DO_EXT_I2D 135 -# define X509V3_F_DO_EXT_NCONF 151 -# define X509V3_F_GNAMES_FROM_SECTNAME 156 -# define X509V3_F_I2S_ASN1_ENUMERATED 121 -# define X509V3_F_I2S_ASN1_IA5STRING 149 -# define X509V3_F_I2S_ASN1_INTEGER 120 -# define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 -# define X509V3_F_LEVEL_ADD_NODE 168 -# define X509V3_F_NOTICE_SECTION 132 -# define X509V3_F_NREF_NOS 133 -# define X509V3_F_POLICY_CACHE_CREATE 169 -# define X509V3_F_POLICY_CACHE_NEW 170 -# define X509V3_F_POLICY_DATA_NEW 171 -# define X509V3_F_POLICY_SECTION 131 -# define X509V3_F_PROCESS_PCI_VALUE 150 -# define X509V3_F_R2I_CERTPOL 130 -# define X509V3_F_R2I_PCI 155 -# define X509V3_F_S2I_ASN1_IA5STRING 100 -# define X509V3_F_S2I_ASN1_INTEGER 108 -# define X509V3_F_S2I_ASN1_OCTET_STRING 112 -# define X509V3_F_S2I_SKEY_ID 115 -# define X509V3_F_SET_DIST_POINT_NAME 158 -# define X509V3_F_SXNET_ADD_ID_ASC 125 -# define X509V3_F_SXNET_ADD_ID_INTEGER 126 -# define X509V3_F_SXNET_ADD_ID_ULONG 127 -# define X509V3_F_SXNET_GET_ID_ASC 128 -# define X509V3_F_SXNET_GET_ID_ULONG 129 -# define X509V3_F_TREE_INIT 172 -# define X509V3_F_V2I_ASIDENTIFIERS 163 -# define X509V3_F_V2I_ASN1_BIT_STRING 101 -# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 -# define X509V3_F_V2I_AUTHORITY_KEYID 119 -# define X509V3_F_V2I_BASIC_CONSTRAINTS 102 -# define X509V3_F_V2I_CRLD 134 -# define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 -# define X509V3_F_V2I_GENERAL_NAMES 118 -# define X509V3_F_V2I_GENERAL_NAME_EX 117 -# define X509V3_F_V2I_IDP 157 -# define X509V3_F_V2I_IPADDRBLOCKS 159 -# define X509V3_F_V2I_ISSUER_ALT 153 -# define X509V3_F_V2I_NAME_CONSTRAINTS 147 -# define X509V3_F_V2I_POLICY_CONSTRAINTS 146 -# define X509V3_F_V2I_POLICY_MAPPINGS 145 -# define X509V3_F_V2I_SUBJECT_ALT 154 -# define X509V3_F_V2I_TLS_FEATURE 165 -# define X509V3_F_V3_GENERIC_EXTENSION 116 -# define X509V3_F_X509V3_ADD1_I2D 140 -# define X509V3_F_X509V3_ADD_VALUE 105 -# define X509V3_F_X509V3_EXT_ADD 104 -# define X509V3_F_X509V3_EXT_ADD_ALIAS 106 -# define X509V3_F_X509V3_EXT_I2D 136 -# define X509V3_F_X509V3_EXT_NCONF 152 -# define X509V3_F_X509V3_GET_SECTION 142 -# define X509V3_F_X509V3_GET_STRING 143 -# define X509V3_F_X509V3_GET_VALUE_BOOL 110 -# define X509V3_F_X509V3_PARSE_LIST 109 -# define X509V3_F_X509_PURPOSE_ADD 137 -# define X509V3_F_X509_PURPOSE_SET 141 - -/* - * X509V3 reason codes. - */ -# define X509V3_R_BAD_IP_ADDRESS 118 -# define X509V3_R_BAD_OBJECT 119 -# define X509V3_R_BN_DEC2BN_ERROR 100 -# define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 -# define X509V3_R_DIRNAME_ERROR 149 -# define X509V3_R_DISTPOINT_ALREADY_SET 160 -# define X509V3_R_DUPLICATE_ZONE_ID 133 -# define X509V3_R_ERROR_CONVERTING_ZONE 131 -# define X509V3_R_ERROR_CREATING_EXTENSION 144 -# define X509V3_R_ERROR_IN_EXTENSION 128 -# define X509V3_R_EXPECTED_A_SECTION_NAME 137 -# define X509V3_R_EXTENSION_EXISTS 145 -# define X509V3_R_EXTENSION_NAME_ERROR 115 -# define X509V3_R_EXTENSION_NOT_FOUND 102 -# define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 -# define X509V3_R_EXTENSION_VALUE_ERROR 116 -# define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 -# define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 -# define X509V3_R_INVALID_ASNUMBER 162 -# define X509V3_R_INVALID_ASRANGE 163 -# define X509V3_R_INVALID_BOOLEAN_STRING 104 -# define X509V3_R_INVALID_EXTENSION_STRING 105 -# define X509V3_R_INVALID_INHERITANCE 165 -# define X509V3_R_INVALID_IPADDRESS 166 -# define X509V3_R_INVALID_MULTIPLE_RDNS 161 -# define X509V3_R_INVALID_NAME 106 -# define X509V3_R_INVALID_NULL_ARGUMENT 107 -# define X509V3_R_INVALID_NULL_NAME 108 -# define X509V3_R_INVALID_NULL_VALUE 109 -# define X509V3_R_INVALID_NUMBER 140 -# define X509V3_R_INVALID_NUMBERS 141 -# define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 -# define X509V3_R_INVALID_OPTION 138 -# define X509V3_R_INVALID_POLICY_IDENTIFIER 134 -# define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 -# define X509V3_R_INVALID_PURPOSE 146 -# define X509V3_R_INVALID_SAFI 164 -# define X509V3_R_INVALID_SECTION 135 -# define X509V3_R_INVALID_SYNTAX 143 -# define X509V3_R_ISSUER_DECODE_ERROR 126 -# define X509V3_R_MISSING_VALUE 124 -# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 -# define X509V3_R_NO_CONFIG_DATABASE 136 -# define X509V3_R_NO_ISSUER_CERTIFICATE 121 -# define X509V3_R_NO_ISSUER_DETAILS 127 -# define X509V3_R_NO_POLICY_IDENTIFIER 139 -# define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 -# define X509V3_R_NO_PUBLIC_KEY 114 -# define X509V3_R_NO_SUBJECT_DETAILS 125 -# define X509V3_R_OPERATION_NOT_DEFINED 148 -# define X509V3_R_OTHERNAME_ERROR 147 -# define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 -# define X509V3_R_POLICY_PATH_LENGTH 156 -# define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 -# define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 -# define X509V3_R_SECTION_NOT_FOUND 150 -# define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 -# define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 -# define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 -# define X509V3_R_UNKNOWN_EXTENSION 129 -# define X509V3_R_UNKNOWN_EXTENSION_NAME 130 -# define X509V3_R_UNKNOWN_OPTION 120 -# define X509V3_R_UNSUPPORTED_OPTION 117 -# define X509V3_R_UNSUPPORTED_TYPE 167 -# define X509V3_R_USER_TOO_LONG 132 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86/libcrypto.so b/Hin2n/src/main/jniLibs/x86/libcrypto.so deleted file mode 100644 index 587d4126..00000000 Binary files a/Hin2n/src/main/jniLibs/x86/libcrypto.so and /dev/null differ diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/aes.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/aes.h deleted file mode 100644 index 245c552a..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/aes.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_AES_H -# define HEADER_AES_H - -# include - -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define AES_ENCRYPT 1 -# define AES_DECRYPT 0 - -/* - * Because array size can't be a const in C, the following two are macros. - * Both sizes are in bytes. - */ -# define AES_MAXNR 14 -# define AES_BLOCK_SIZE 16 - -/* This should be a hidden type, but EVP requires that the size be known */ -struct aes_key_st { -# ifdef AES_LONG - unsigned long rd_key[4 * (AES_MAXNR + 1)]; -# else - unsigned int rd_key[4 * (AES_MAXNR + 1)]; -# endif - int rounds; -}; -typedef struct aes_key_st AES_KEY; - -const char *AES_options(void); - -int AES_set_encrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); -int AES_set_decrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); - -void AES_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); -void AES_decrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); - -void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key, const int enc); -void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, const int enc); -void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, int *num); -/* NB: the IV is _two_ blocks long */ -void AES_ige_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - unsigned char *ivec, const int enc); -/* NB: the IV is _four_ blocks long */ -void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const AES_KEY *key, - const AES_KEY *key2, const unsigned char *ivec, - const int enc); - -int AES_wrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); -int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); - - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1.h deleted file mode 100644 index 9522eec1..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1.h +++ /dev/null @@ -1,886 +0,0 @@ -/* - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_ASN1_H -# define HEADER_ASN1_H - -# include -# include -# include -# include -# include -# include -# include - -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -# define V_ASN1_UNIVERSAL 0x00 -# define V_ASN1_APPLICATION 0x40 -# define V_ASN1_CONTEXT_SPECIFIC 0x80 -# define V_ASN1_PRIVATE 0xc0 - -# define V_ASN1_CONSTRUCTED 0x20 -# define V_ASN1_PRIMITIVE_TAG 0x1f -# define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG - -# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */ -# define V_ASN1_OTHER -3/* used in ASN1_TYPE */ -# define V_ASN1_ANY -4/* used in ASN1 template code */ - -# define V_ASN1_UNDEF -1 -/* ASN.1 tag values */ -# define V_ASN1_EOC 0 -# define V_ASN1_BOOLEAN 1 /**/ -# define V_ASN1_INTEGER 2 -# define V_ASN1_BIT_STRING 3 -# define V_ASN1_OCTET_STRING 4 -# define V_ASN1_NULL 5 -# define V_ASN1_OBJECT 6 -# define V_ASN1_OBJECT_DESCRIPTOR 7 -# define V_ASN1_EXTERNAL 8 -# define V_ASN1_REAL 9 -# define V_ASN1_ENUMERATED 10 -# define V_ASN1_UTF8STRING 12 -# define V_ASN1_SEQUENCE 16 -# define V_ASN1_SET 17 -# define V_ASN1_NUMERICSTRING 18 /**/ -# define V_ASN1_PRINTABLESTRING 19 -# define V_ASN1_T61STRING 20 -# define V_ASN1_TELETEXSTRING 20/* alias */ -# define V_ASN1_VIDEOTEXSTRING 21 /**/ -# define V_ASN1_IA5STRING 22 -# define V_ASN1_UTCTIME 23 -# define V_ASN1_GENERALIZEDTIME 24 /**/ -# define V_ASN1_GRAPHICSTRING 25 /**/ -# define V_ASN1_ISO64STRING 26 /**/ -# define V_ASN1_VISIBLESTRING 26/* alias */ -# define V_ASN1_GENERALSTRING 27 /**/ -# define V_ASN1_UNIVERSALSTRING 28 /**/ -# define V_ASN1_BMPSTRING 30 - -/* - * NB the constants below are used internally by ASN1_INTEGER - * and ASN1_ENUMERATED to indicate the sign. They are *not* on - * the wire tag values. - */ - -# define V_ASN1_NEG 0x100 -# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) -# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) - -/* For use with d2i_ASN1_type_bytes() */ -# define B_ASN1_NUMERICSTRING 0x0001 -# define B_ASN1_PRINTABLESTRING 0x0002 -# define B_ASN1_T61STRING 0x0004 -# define B_ASN1_TELETEXSTRING 0x0004 -# define B_ASN1_VIDEOTEXSTRING 0x0008 -# define B_ASN1_IA5STRING 0x0010 -# define B_ASN1_GRAPHICSTRING 0x0020 -# define B_ASN1_ISO64STRING 0x0040 -# define B_ASN1_VISIBLESTRING 0x0040 -# define B_ASN1_GENERALSTRING 0x0080 -# define B_ASN1_UNIVERSALSTRING 0x0100 -# define B_ASN1_OCTET_STRING 0x0200 -# define B_ASN1_BIT_STRING 0x0400 -# define B_ASN1_BMPSTRING 0x0800 -# define B_ASN1_UNKNOWN 0x1000 -# define B_ASN1_UTF8STRING 0x2000 -# define B_ASN1_UTCTIME 0x4000 -# define B_ASN1_GENERALIZEDTIME 0x8000 -# define B_ASN1_SEQUENCE 0x10000 -/* For use with ASN1_mbstring_copy() */ -# define MBSTRING_FLAG 0x1000 -# define MBSTRING_UTF8 (MBSTRING_FLAG) -# define MBSTRING_ASC (MBSTRING_FLAG|1) -# define MBSTRING_BMP (MBSTRING_FLAG|2) -# define MBSTRING_UNIV (MBSTRING_FLAG|4) -# define SMIME_OLDMIME 0x400 -# define SMIME_CRLFEOL 0x800 -# define SMIME_STREAM 0x1000 - struct X509_algor_st; -DEFINE_STACK_OF(X509_ALGOR) - -# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */ -/* - * This indicates that the ASN1_STRING is not a real value but just a place - * holder for the location where indefinite length constructed data should be - * inserted in the memory buffer - */ -# define ASN1_STRING_FLAG_NDEF 0x010 - -/* - * This flag is used by the CMS code to indicate that a string is not - * complete and is a place holder for content when it had all been accessed. - * The flag will be reset when content has been written to it. - */ - -# define ASN1_STRING_FLAG_CONT 0x020 -/* - * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING - * type. - */ -# define ASN1_STRING_FLAG_MSTRING 0x040 -/* String is embedded and only content should be freed */ -# define ASN1_STRING_FLAG_EMBED 0x080 -/* String should be parsed in RFC 5280's time format */ -# define ASN1_STRING_FLAG_X509_TIME 0x100 -/* This is the base type that holds just about everything :-) */ -struct asn1_string_st { - int length; - int type; - unsigned char *data; - /* - * The value of the following field depends on the type being held. It - * is mostly being used for BIT_STRING so if the input data has a - * non-zero 'unused bits' value, it will be handled correctly - */ - long flags; -}; - -/* - * ASN1_ENCODING structure: this is used to save the received encoding of an - * ASN1 type. This is useful to get round problems with invalid encodings - * which can break signatures. - */ - -typedef struct ASN1_ENCODING_st { - unsigned char *enc; /* DER encoding */ - long len; /* Length of encoding */ - int modified; /* set to 1 if 'enc' is invalid */ -} ASN1_ENCODING; - -/* Used with ASN1 LONG type: if a long is set to this it is omitted */ -# define ASN1_LONG_UNDEF 0x7fffffffL - -# define STABLE_FLAGS_MALLOC 0x01 -/* - * A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted - * as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting - * STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias - * STABLE_FLAGS_CLEAR to reflect this. - */ -# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC -# define STABLE_NO_MASK 0x02 -# define DIRSTRING_TYPE \ - (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) -# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) - -typedef struct asn1_string_table_st { - int nid; - long minsize; - long maxsize; - unsigned long mask; - unsigned long flags; -} ASN1_STRING_TABLE; - -DEFINE_STACK_OF(ASN1_STRING_TABLE) - -/* size limits: this stuff is taken straight from RFC2459 */ - -# define ub_name 32768 -# define ub_common_name 64 -# define ub_locality_name 128 -# define ub_state_name 128 -# define ub_organization_name 64 -# define ub_organization_unit_name 64 -# define ub_title 64 -# define ub_email_address 128 - -/* - * Declarations for template structures: for full definitions see asn1t.h - */ -typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; -typedef struct ASN1_TLC_st ASN1_TLC; -/* This is just an opaque pointer */ -typedef struct ASN1_VALUE_st ASN1_VALUE; - -/* Declare ASN1 functions: the implement macro in in asn1t.h */ - -# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) - -# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) - -# define DECLARE_ASN1_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) - -# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) - -# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ - type *d2i_##name(type **a, const unsigned char **in, long len); \ - int i2d_##name(type *a, unsigned char **out); \ - DECLARE_ASN1_ITEM(itname) - -# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ - type *d2i_##name(type **a, const unsigned char **in, long len); \ - int i2d_##name(const type *a, unsigned char **out); \ - DECLARE_ASN1_ITEM(name) - -# define DECLARE_ASN1_NDEF_FUNCTION(name) \ - int i2d_##name##_NDEF(name *a, unsigned char **out); - -# define DECLARE_ASN1_FUNCTIONS_const(name) \ - DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ - DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) - -# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ - type *name##_new(void); \ - void name##_free(type *a); - -# define DECLARE_ASN1_PRINT_FUNCTION(stname) \ - DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) - -# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ - int fname##_print_ctx(BIO *out, stname *x, int indent, \ - const ASN1_PCTX *pctx); - -# define D2I_OF(type) type *(*)(type **,const unsigned char **,long) -# define I2D_OF(type) int (*)(type *,unsigned char **) -# define I2D_OF_const(type) int (*)(const type *,unsigned char **) - -# define CHECKED_D2I_OF(type, d2i) \ - ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) -# define CHECKED_I2D_OF(type, i2d) \ - ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) -# define CHECKED_NEW_OF(type, xnew) \ - ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) -# define CHECKED_PTR_OF(type, p) \ - ((void*) (1 ? p : (type*)0)) -# define CHECKED_PPTR_OF(type, p) \ - ((void**) (1 ? p : (type**)0)) - -# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) -# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) -# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) - -TYPEDEF_D2I2D_OF(void); - -/*- - * The following macros and typedefs allow an ASN1_ITEM - * to be embedded in a structure and referenced. Since - * the ASN1_ITEM pointers need to be globally accessible - * (possibly from shared libraries) they may exist in - * different forms. On platforms that support it the - * ASN1_ITEM structure itself will be globally exported. - * Other platforms will export a function that returns - * an ASN1_ITEM pointer. - * - * To handle both cases transparently the macros below - * should be used instead of hard coding an ASN1_ITEM - * pointer in a structure. - * - * The structure will look like this: - * - * typedef struct SOMETHING_st { - * ... - * ASN1_ITEM_EXP *iptr; - * ... - * } SOMETHING; - * - * It would be initialised as e.g.: - * - * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; - * - * and the actual pointer extracted with: - * - * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); - * - * Finally an ASN1_ITEM pointer can be extracted from an - * appropriate reference with: ASN1_ITEM_rptr(X509). This - * would be used when a function takes an ASN1_ITEM * argument. - * - */ - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM ASN1_ITEM_EXP; - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -# define ASN1_ITEM_ptr(iptr) (iptr) - -/* Macro to include ASN1_ITEM pointer from base type */ -# define ASN1_ITEM_ref(iptr) (&(iptr##_it)) - -# define ASN1_ITEM_rptr(ref) (&(ref##_it)) - -# define DECLARE_ASN1_ITEM(name) \ - OPENSSL_EXTERN const ASN1_ITEM name##_it; - -# else - -/* - * Platforms that can't easily handle shared global variables are declared as - * functions returning ASN1_ITEM pointers. - */ - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM *ASN1_ITEM_EXP (void); - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -# define ASN1_ITEM_ptr(iptr) (iptr()) - -/* Macro to include ASN1_ITEM pointer from base type */ -# define ASN1_ITEM_ref(iptr) (iptr##_it) - -# define ASN1_ITEM_rptr(ref) (ref##_it()) - -# define DECLARE_ASN1_ITEM(name) \ - const ASN1_ITEM * name##_it(void); - -# endif - -/* Parameters used by ASN1_STRING_print_ex() */ - -/* - * These determine which characters to escape: RFC2253 special characters, - * control characters and MSB set characters - */ - -# define ASN1_STRFLGS_ESC_2253 1 -# define ASN1_STRFLGS_ESC_CTRL 2 -# define ASN1_STRFLGS_ESC_MSB 4 - -/* - * This flag determines how we do escaping: normally RC2253 backslash only, - * set this to use backslash and quote. - */ - -# define ASN1_STRFLGS_ESC_QUOTE 8 - -/* These three flags are internal use only. */ - -/* Character is a valid PrintableString character */ -# define CHARTYPE_PRINTABLESTRING 0x10 -/* Character needs escaping if it is the first character */ -# define CHARTYPE_FIRST_ESC_2253 0x20 -/* Character needs escaping if it is the last character */ -# define CHARTYPE_LAST_ESC_2253 0x40 - -/* - * NB the internal flags are safely reused below by flags handled at the top - * level. - */ - -/* - * If this is set we convert all character strings to UTF8 first - */ - -# define ASN1_STRFLGS_UTF8_CONVERT 0x10 - -/* - * If this is set we don't attempt to interpret content: just assume all - * strings are 1 byte per character. This will produce some pretty odd - * looking output! - */ - -# define ASN1_STRFLGS_IGNORE_TYPE 0x20 - -/* If this is set we include the string type in the output */ -# define ASN1_STRFLGS_SHOW_TYPE 0x40 - -/* - * This determines which strings to display and which to 'dump' (hex dump of - * content octets or DER encoding). We can only dump non character strings or - * everything. If we don't dump 'unknown' they are interpreted as character - * strings with 1 octet per character and are subject to the usual escaping - * options. - */ - -# define ASN1_STRFLGS_DUMP_ALL 0x80 -# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 - -/* - * These determine what 'dumping' does, we can dump the content octets or the - * DER encoding: both use the RFC2253 #XXXXX notation. - */ - -# define ASN1_STRFLGS_DUMP_DER 0x200 - -/* - * This flag specifies that RC2254 escaping shall be performed. - */ -#define ASN1_STRFLGS_ESC_2254 0x400 - -/* - * All the string flags consistent with RFC2253, escaping control characters - * isn't essential in RFC2253 but it is advisable anyway. - */ - -# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ - ASN1_STRFLGS_ESC_CTRL | \ - ASN1_STRFLGS_ESC_MSB | \ - ASN1_STRFLGS_UTF8_CONVERT | \ - ASN1_STRFLGS_DUMP_UNKNOWN | \ - ASN1_STRFLGS_DUMP_DER) - -DEFINE_STACK_OF(ASN1_INTEGER) - -DEFINE_STACK_OF(ASN1_GENERALSTRING) - -DEFINE_STACK_OF(ASN1_UTF8STRING) - -typedef struct asn1_type_st { - int type; - union { - char *ptr; - ASN1_BOOLEAN boolean; - ASN1_STRING *asn1_string; - ASN1_OBJECT *object; - ASN1_INTEGER *integer; - ASN1_ENUMERATED *enumerated; - ASN1_BIT_STRING *bit_string; - ASN1_OCTET_STRING *octet_string; - ASN1_PRINTABLESTRING *printablestring; - ASN1_T61STRING *t61string; - ASN1_IA5STRING *ia5string; - ASN1_GENERALSTRING *generalstring; - ASN1_BMPSTRING *bmpstring; - ASN1_UNIVERSALSTRING *universalstring; - ASN1_UTCTIME *utctime; - ASN1_GENERALIZEDTIME *generalizedtime; - ASN1_VISIBLESTRING *visiblestring; - ASN1_UTF8STRING *utf8string; - /* - * set and sequence are left complete and still contain the set or - * sequence bytes - */ - ASN1_STRING *set; - ASN1_STRING *sequence; - ASN1_VALUE *asn1_value; - } value; -} ASN1_TYPE; - -DEFINE_STACK_OF(ASN1_TYPE) - -typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; - -DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) -DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) - -/* This is used to contain a list of bit names */ -typedef struct BIT_STRING_BITNAME_st { - int bitnum; - const char *lname; - const char *sname; -} BIT_STRING_BITNAME; - -# define B_ASN1_TIME \ - B_ASN1_UTCTIME | \ - B_ASN1_GENERALIZEDTIME - -# define B_ASN1_PRINTABLE \ - B_ASN1_NUMERICSTRING| \ - B_ASN1_PRINTABLESTRING| \ - B_ASN1_T61STRING| \ - B_ASN1_IA5STRING| \ - B_ASN1_BIT_STRING| \ - B_ASN1_UNIVERSALSTRING|\ - B_ASN1_BMPSTRING|\ - B_ASN1_UTF8STRING|\ - B_ASN1_SEQUENCE|\ - B_ASN1_UNKNOWN - -# define B_ASN1_DIRECTORYSTRING \ - B_ASN1_PRINTABLESTRING| \ - B_ASN1_TELETEXSTRING|\ - B_ASN1_BMPSTRING|\ - B_ASN1_UNIVERSALSTRING|\ - B_ASN1_UTF8STRING - -# define B_ASN1_DISPLAYTEXT \ - B_ASN1_IA5STRING| \ - B_ASN1_VISIBLESTRING| \ - B_ASN1_BMPSTRING|\ - B_ASN1_UTF8STRING - -DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) - -int ASN1_TYPE_get(const ASN1_TYPE *a); -void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); -int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); -int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); - -ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t); -void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t); - -ASN1_OBJECT *ASN1_OBJECT_new(void); -void ASN1_OBJECT_free(ASN1_OBJECT *a); -int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp); -ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, - long length); - -DECLARE_ASN1_ITEM(ASN1_OBJECT) - -DEFINE_STACK_OF(ASN1_OBJECT) - -ASN1_STRING *ASN1_STRING_new(void); -void ASN1_STRING_free(ASN1_STRING *a); -void ASN1_STRING_clear_free(ASN1_STRING *a); -int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); -ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a); -ASN1_STRING *ASN1_STRING_type_new(int type); -int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); - /* - * Since this is used to store all sorts of things, via macros, for now, - * make its data void * - */ -int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); -void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); -int ASN1_STRING_length(const ASN1_STRING *x); -void ASN1_STRING_length_set(ASN1_STRING *x, int n); -int ASN1_STRING_type(const ASN1_STRING *x); -DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) -const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); - -DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) -int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); -int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); -int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); -int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, - const unsigned char *flags, int flags_len); - -int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, - BIT_STRING_BITNAME *tbl, int indent); -int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); -int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, - BIT_STRING_BITNAME *tbl); - -DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) -ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, - long length); -ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x); -int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); - -DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) - -int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); -ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); -ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, - int offset_day, long offset_sec); -int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); -int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); - -int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); -ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, - time_t t); -ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, - time_t t, int offset_day, - long offset_sec); -int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); - -int ASN1_TIME_diff(int *pday, int *psec, - const ASN1_TIME *from, const ASN1_TIME *to); - -DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) -ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); -int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, - const ASN1_OCTET_STRING *b); -int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, - int len); - -DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_NULL) -DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) - -int UTF8_getc(const unsigned char *str, int len, unsigned long *val); -int UTF8_putc(unsigned char *str, int len, unsigned long value); - -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) - -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) -DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) -DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) -DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) -DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) -DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) -DECLARE_ASN1_FUNCTIONS(ASN1_TIME) - -DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) - -ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); -ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, - int offset_day, long offset_sec); -int ASN1_TIME_check(const ASN1_TIME *t); -ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, - ASN1_GENERALIZEDTIME **out); -int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); -int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str); -int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm); -int ASN1_TIME_normalize(ASN1_TIME *s); -int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t); -int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b); - -int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); -int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); -int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a); -int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); -int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a); -int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); -int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type); -int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a); - -int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); -ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, - const char *sn, const char *ln); - -int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); -int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); -int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); -int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); - -int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); -long ASN1_INTEGER_get(const ASN1_INTEGER *a); -ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); -BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); - -int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); -int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); - - -int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); -long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); -ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); -BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn); - -/* General */ -/* given a string, return the correct type, max is the maximum length */ -int ASN1_PRINTABLE_type(const unsigned char *s, int max); - -unsigned long ASN1_tag2bit(int tag); - -/* SPECIALS */ -int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, - int *pclass, long omax); -int ASN1_check_infinite_end(unsigned char **p, long len); -int ASN1_const_check_infinite_end(const unsigned char **p, long len); -void ASN1_put_object(unsigned char **pp, int constructed, int length, - int tag, int xclass); -int ASN1_put_eoc(unsigned char **pp); -int ASN1_object_size(int constructed, int length, int tag); - -/* Used to implement other functions */ -void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); - -# define ASN1_dup_of(type,i2d,d2i,x) \ - ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ - CHECKED_D2I_OF(type, d2i), \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_dup_of_const(type,i2d,d2i,x) \ - ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ - CHECKED_D2I_OF(type, d2i), \ - CHECKED_PTR_OF(const type, x))) - -void *ASN1_item_dup(const ASN1_ITEM *it, void *x); - -/* ASN1 alloc/free macros for when a type is only used internally */ - -# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) -# define M_ASN1_free_of(x, type) \ - ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) - -# ifndef OPENSSL_NO_STDIO -void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x); - -# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ - ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ - CHECKED_D2I_OF(type, d2i), \ - in, \ - CHECKED_PPTR_OF(type, x))) - -void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); -int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x); - -# define ASN1_i2d_fp_of(type,i2d,out,x) \ - (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ - out, \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_i2d_fp_of_const(type,i2d,out,x) \ - (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ - out, \ - CHECKED_PTR_OF(const type, x))) - -int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); -int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); -# endif - -int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in); - -void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x); - -# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ - ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ - CHECKED_D2I_OF(type, d2i), \ - in, \ - CHECKED_PPTR_OF(type, x))) - -void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); -int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x); - -# define ASN1_i2d_bio_of(type,i2d,out,x) \ - (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ - out, \ - CHECKED_PTR_OF(type, x))) - -# define ASN1_i2d_bio_of_const(type,i2d,out,x) \ - (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ - out, \ - CHECKED_PTR_OF(const type, x))) - -int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); -int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); -int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); -int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); -int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); -int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); -int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off); -int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, - unsigned char *buf, int off); -int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); -int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, - int dump); -const char *ASN1_tag2str(int tag); - -/* Used to load and write Netscape format cert */ - -int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); - -int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); -int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len); -int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, - unsigned char *data, int len); -int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, - unsigned char *data, int max_len); - -void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it); - -ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, - ASN1_OCTET_STRING **oct); - -void ASN1_STRING_set_default_mask(unsigned long mask); -int ASN1_STRING_set_default_mask_asc(const char *p); -unsigned long ASN1_STRING_get_default_mask(void); -int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask); -int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, - int inform, unsigned long mask, - long minsize, long maxsize); - -ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, - const unsigned char *in, int inlen, - int inform, int nid); -ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); -int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); -void ASN1_STRING_TABLE_cleanup(void); - -/* ASN1 template functions */ - -/* Old API compatible functions */ -ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); -void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); -ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, - long len, const ASN1_ITEM *it); -int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); -int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, - const ASN1_ITEM *it); - -void ASN1_add_oid_module(void); -void ASN1_add_stable_module(void); - -ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf); -ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf); -int ASN1_str2mask(const char *str, unsigned long *pmask); - -/* ASN1 Print flags */ - -/* Indicate missing OPTIONAL fields */ -# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 -/* Mark start and end of SEQUENCE */ -# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 -/* Mark start and end of SEQUENCE/SET OF */ -# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 -/* Show the ASN1 type of primitives */ -# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 -/* Don't show ASN1 type of ANY */ -# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 -/* Don't show ASN1 type of MSTRINGs */ -# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 -/* Don't show field names in SEQUENCE */ -# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 -/* Show structure names of each SEQUENCE field */ -# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 -/* Don't show structure name even at top level */ -# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 - -int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, - const ASN1_ITEM *it, const ASN1_PCTX *pctx); -ASN1_PCTX *ASN1_PCTX_new(void); -void ASN1_PCTX_free(ASN1_PCTX *p); -unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); -unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); -void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); - -ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx)); -void ASN1_SCTX_free(ASN1_SCTX *p); -const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p); -const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p); -unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); -void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); -void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); - -const BIO_METHOD *BIO_f_asn1(void); - -BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); - -int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, - const ASN1_ITEM *it); -int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, - const char *hdr, const ASN1_ITEM *it); -int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, - int ctype_nid, int econt_nid, - STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); -ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); -int SMIME_crlf_copy(BIO *in, BIO *out, int flags); -int SMIME_text(BIO *in, BIO *out); - -const ASN1_ITEM *ASN1_ITEM_lookup(const char *name); -const ASN1_ITEM *ASN1_ITEM_get(size_t i); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1_mac.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1_mac.h deleted file mode 100644 index 7ac1782a..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1_mac.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2015-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 - */ - -#error "This file is obsolete; please update your software." diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1err.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1err.h deleted file mode 100644 index faed5a55..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1err.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - * 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_ASN1ERR_H -# define HEADER_ASN1ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# 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_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_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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1t.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1t.h deleted file mode 100644 index a450ba0d..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asn1t.h +++ /dev/null @@ -1,945 +0,0 @@ -/* - * Copyright 2000-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_ASN1T_H -# define HEADER_ASN1T_H - -# include -# include -# include - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -/* ASN1 template defines, structures and functions */ - -#ifdef __cplusplus -extern "C" { -#endif - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) - -/* Macros for start and end of ASN1_ITEM definition */ - -# define ASN1_ITEM_start(itname) \ - const ASN1_ITEM itname##_it = { - -# define static_ASN1_ITEM_start(itname) \ - static const ASN1_ITEM itname##_it = { - -# define ASN1_ITEM_end(itname) \ - }; - -# else - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)())) - -/* Macros for start and end of ASN1_ITEM definition */ - -# define ASN1_ITEM_start(itname) \ - const ASN1_ITEM * itname##_it(void) \ - { \ - static const ASN1_ITEM local_it = { - -# define static_ASN1_ITEM_start(itname) \ - static ASN1_ITEM_start(itname) - -# define ASN1_ITEM_end(itname) \ - }; \ - return &local_it; \ - } - -# endif - -/* Macros to aid ASN1 template writing */ - -# define ASN1_ITEM_TEMPLATE(tname) \ - static const ASN1_TEMPLATE tname##_item_tt - -# define ASN1_ITEM_TEMPLATE_END(tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_PRIMITIVE,\ - -1,\ - &tname##_item_tt,\ - 0,\ - NULL,\ - 0,\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_ITEM_TEMPLATE_END(tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_PRIMITIVE,\ - -1,\ - &tname##_item_tt,\ - 0,\ - NULL,\ - 0,\ - #tname \ - ASN1_ITEM_end(tname) - -/* This is a ASN1 type which just embeds a template */ - -/*- - * This pair helps declare a SEQUENCE. We can do: - * - * ASN1_SEQUENCE(stname) = { - * ... SEQUENCE components ... - * } ASN1_SEQUENCE_END(stname) - * - * This will produce an ASN1_ITEM called stname_it - * for a structure called stname. - * - * If you want the same structure but a different - * name then use: - * - * ASN1_SEQUENCE(itname) = { - * ... SEQUENCE components ... - * } ASN1_SEQUENCE_END_name(stname, itname) - * - * This will create an item called itname_it using - * a structure called stname. - */ - -# define ASN1_SEQUENCE(tname) \ - static const ASN1_TEMPLATE tname##_seq_tt[] - -# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) - -# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) - -# define ASN1_SEQUENCE_END_name(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #tname \ - ASN1_ITEM_end(tname) - -# define static_ASN1_SEQUENCE_END_name(stname, tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_NDEF_SEQUENCE(tname) \ - ASN1_SEQUENCE(tname) - -# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ - ASN1_SEQUENCE_cb(tname, cb) - -# define ASN1_SEQUENCE_cb(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_BROKEN_SEQUENCE(tname) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_SEQUENCE_ref(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_SEQUENCE_enc(tname, enc, cb) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ - ASN1_SEQUENCE(tname) - -# define ASN1_NDEF_SEQUENCE_END(tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(tname),\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_NDEF_SEQUENCE_END(tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(tname),\ - #tname \ - ASN1_ITEM_end(tname) - -# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) -# define static_ASN1_BROKEN_SEQUENCE_END(stname) \ - static_ASN1_SEQUENCE_END_ref(stname, stname) - -# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) - -# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) -# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) - -# define ASN1_SEQUENCE_END_ref(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #tname \ - ASN1_ITEM_end(tname) -# define static_ASN1_SEQUENCE_END_ref(stname, tname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_NDEF_SEQUENCE,\ - V_ASN1_SEQUENCE,\ - tname##_seq_tt,\ - sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -/*- - * This pair helps declare a CHOICE type. We can do: - * - * ASN1_CHOICE(chname) = { - * ... CHOICE options ... - * ASN1_CHOICE_END(chname) - * - * This will produce an ASN1_ITEM called chname_it - * for a structure called chname. The structure - * definition must look like this: - * typedef struct { - * int type; - * union { - * ASN1_SOMETHING *opt1; - * ASN1_SOMEOTHER *opt2; - * } value; - * } chname; - * - * the name of the selector must be 'type'. - * to use an alternative selector name use the - * ASN1_CHOICE_END_selector() version. - */ - -# define ASN1_CHOICE(tname) \ - static const ASN1_TEMPLATE tname##_ch_tt[] - -# define ASN1_CHOICE_cb(tname, cb) \ - static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ - ASN1_CHOICE(tname) - -# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) - -# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) - -# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) - -# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) - -# define ASN1_CHOICE_END_selector(stname, tname, selname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ - ;\ - static_ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - NULL,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -# define ASN1_CHOICE_END_cb(stname, tname, selname) \ - ;\ - ASN1_ITEM_start(tname) \ - ASN1_ITYPE_CHOICE,\ - offsetof(stname,selname) ,\ - tname##_ch_tt,\ - sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ - &tname##_aux,\ - sizeof(stname),\ - #stname \ - ASN1_ITEM_end(tname) - -/* This helps with the template wrapper form of ASN1_ITEM */ - -# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ - (flags), (tag), 0,\ - #name, ASN1_ITEM_ref(type) } - -/* These help with SEQUENCE or CHOICE components */ - -/* used to declare other types */ - -# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ - (flags), (tag), offsetof(stname, field),\ - #field, ASN1_ITEM_ref(type) } - -/* implicit and explicit helper macros */ - -# define ASN1_IMP_EX(stname, field, type, tag, ex) \ - ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type) - -# define ASN1_EXP_EX(stname, field, type, tag, ex) \ - ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type) - -/* Any defined by macros: the field used is in the table itself */ - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -# else -# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } -# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } -# endif -/* Plain simple type */ -# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) -/* Embedded simple type */ -# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type) - -/* OPTIONAL simple type */ -# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) -# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type) - -/* IMPLICIT tagged simple type */ -# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) -# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) - -/* IMPLICIT tagged OPTIONAL simple type */ -# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) -# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) - -/* Same as above but EXPLICIT */ - -# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) -# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) -# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) -# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) - -/* SEQUENCE OF type */ -# define ASN1_SEQUENCE_OF(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) - -/* OPTIONAL SEQUENCE OF */ -# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) - -/* Same as above but for SET OF */ - -# define ASN1_SET_OF(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) - -# define ASN1_SET_OF_OPT(stname, field, type) \ - ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) - -/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ - -# define ASN1_IMP_SET_OF(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) - -# define ASN1_EXP_SET_OF(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) - -# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) - -# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ - ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) - -# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) - -# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) - -/* EXPLICIT using indefinite length constructed form */ -# define ASN1_NDEF_EXP(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) - -/* EXPLICIT OPTIONAL using indefinite length constructed form */ -# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ - ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) - -/* Macros for the ASN1_ADB structure */ - -# define ASN1_ADB(name) \ - static const ASN1_ADB_TABLE name##_adbtbl[] - -# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION - -# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ - ;\ - static const ASN1_ADB name##_adb = {\ - flags,\ - offsetof(name, field),\ - adb_cb,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - } - -# else - -# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ - ;\ - static const ASN1_ITEM *name##_adb(void) \ - { \ - static const ASN1_ADB internal_adb = \ - {\ - flags,\ - offsetof(name, field),\ - adb_cb,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - }; \ - return (const ASN1_ITEM *) &internal_adb; \ - } \ - void dummy_function(void) - -# endif - -# define ADB_ENTRY(val, template) {val, template} - -# define ASN1_ADB_TEMPLATE(name) \ - static const ASN1_TEMPLATE name##_tt - -/* - * This is the ASN1 template structure that defines a wrapper round the - * actual type. It determines the actual position of the field in the value - * structure, various flags such as OPTIONAL and the field name. - */ - -struct ASN1_TEMPLATE_st { - unsigned long flags; /* Various flags */ - long tag; /* tag, not used if no tagging */ - unsigned long offset; /* Offset of this field in structure */ - const char *field_name; /* Field name */ - ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ -}; - -/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ - -# define ASN1_TEMPLATE_item(t) (t->item_ptr) -# define ASN1_TEMPLATE_adb(t) (t->item_ptr) - -typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; -typedef struct ASN1_ADB_st ASN1_ADB; - -struct ASN1_ADB_st { - unsigned long flags; /* Various flags */ - unsigned long offset; /* Offset of selector field */ - int (*adb_cb)(long *psel); /* Application callback */ - const ASN1_ADB_TABLE *tbl; /* Table of possible types */ - long tblcount; /* Number of entries in tbl */ - const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ - const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ -}; - -struct ASN1_ADB_TABLE_st { - long value; /* NID for an object or value for an int */ - const ASN1_TEMPLATE tt; /* item for this value */ -}; - -/* template flags */ - -/* Field is optional */ -# define ASN1_TFLG_OPTIONAL (0x1) - -/* Field is a SET OF */ -# define ASN1_TFLG_SET_OF (0x1 << 1) - -/* Field is a SEQUENCE OF */ -# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) - -/* - * Special case: this refers to a SET OF that will be sorted into DER order - * when encoded *and* the corresponding STACK will be modified to match the - * new order. - */ -# define ASN1_TFLG_SET_ORDER (0x3 << 1) - -/* Mask for SET OF or SEQUENCE OF */ -# define ASN1_TFLG_SK_MASK (0x3 << 1) - -/* - * These flags mean the tag should be taken from the tag field. If EXPLICIT - * then the underlying type is used for the inner tag. - */ - -/* IMPLICIT tagging */ -# define ASN1_TFLG_IMPTAG (0x1 << 3) - -/* EXPLICIT tagging, inner tag from underlying type */ -# define ASN1_TFLG_EXPTAG (0x2 << 3) - -# define ASN1_TFLG_TAG_MASK (0x3 << 3) - -/* context specific IMPLICIT */ -# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT) - -/* context specific EXPLICIT */ -# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT) - -/* - * If tagging is in force these determine the type of tag to use. Otherwise - * the tag is determined by the underlying type. These values reflect the - * actual octet format. - */ - -/* Universal tag */ -# define ASN1_TFLG_UNIVERSAL (0x0<<6) -/* Application tag */ -# define ASN1_TFLG_APPLICATION (0x1<<6) -/* Context specific tag */ -# define ASN1_TFLG_CONTEXT (0x2<<6) -/* Private tag */ -# define ASN1_TFLG_PRIVATE (0x3<<6) - -# define ASN1_TFLG_TAG_CLASS (0x3<<6) - -/* - * These are for ANY DEFINED BY type. In this case the 'item' field points to - * an ASN1_ADB structure which contains a table of values to decode the - * relevant type - */ - -# define ASN1_TFLG_ADB_MASK (0x3<<8) - -# define ASN1_TFLG_ADB_OID (0x1<<8) - -# define ASN1_TFLG_ADB_INT (0x1<<9) - -/* - * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes - * indefinite length constructed encoding to be used if required. - */ - -# define ASN1_TFLG_NDEF (0x1<<11) - -/* Field is embedded and not a pointer */ -# define ASN1_TFLG_EMBED (0x1 << 12) - -/* This is the actual ASN1 item itself */ - -struct ASN1_ITEM_st { - char itype; /* The item type, primitive, SEQUENCE, CHOICE - * or extern */ - long utype; /* underlying type */ - const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains - * the contents */ - long tcount; /* Number of templates if SEQUENCE or CHOICE */ - const void *funcs; /* functions that handle this type */ - long size; /* Structure size (usually) */ - const char *sname; /* Structure name */ -}; - -/*- - * These are values for the itype field and - * determine how the type is interpreted. - * - * For PRIMITIVE types the underlying type - * determines the behaviour if items is NULL. - * - * Otherwise templates must contain a single - * template and the type is treated in the - * same way as the type specified in the template. - * - * For SEQUENCE types the templates field points - * to the members, the size field is the - * structure size. - * - * For CHOICE types the templates field points - * to each possible member (typically a union) - * and the 'size' field is the offset of the - * selector. - * - * The 'funcs' field is used for application - * specific functions. - * - * The EXTERN type uses a new style d2i/i2d. - * The new style should be used where possible - * because it avoids things like the d2i IMPLICIT - * hack. - * - * MSTRING is a multiple string type, it is used - * for a CHOICE of character strings where the - * actual strings all occupy an ASN1_STRING - * structure. In this case the 'utype' field - * has a special meaning, it is used as a mask - * of acceptable types using the B_ASN1 constants. - * - * NDEF_SEQUENCE is the same as SEQUENCE except - * that it will use indefinite length constructed - * encoding if requested. - * - */ - -# define ASN1_ITYPE_PRIMITIVE 0x0 - -# define ASN1_ITYPE_SEQUENCE 0x1 - -# define ASN1_ITYPE_CHOICE 0x2 - -# define ASN1_ITYPE_EXTERN 0x4 - -# define ASN1_ITYPE_MSTRING 0x5 - -# define ASN1_ITYPE_NDEF_SEQUENCE 0x6 - -/* - * Cache for ASN1 tag and length, so we don't keep re-reading it for things - * like CHOICE - */ - -struct ASN1_TLC_st { - char valid; /* Values below are valid */ - int ret; /* return value */ - long plen; /* length */ - int ptag; /* class value */ - int pclass; /* class value */ - int hdrlen; /* header length */ -}; - -/* Typedefs for ASN1 function pointers */ -typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, - const ASN1_ITEM *it, int tag, int aclass, char opt, - ASN1_TLC *ctx); - -typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, - const ASN1_ITEM *it, int tag, int aclass); -typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); -typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); - -typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, - int indent, const char *fname, - const ASN1_PCTX *pctx); - -typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, - int *putype, const ASN1_ITEM *it); -typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, - int len, int utype, char *free_cont, - const ASN1_ITEM *it); -typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, - const ASN1_ITEM *it, int indent, - const ASN1_PCTX *pctx); - -typedef struct ASN1_EXTERN_FUNCS_st { - void *app_data; - ASN1_ex_new_func *asn1_ex_new; - ASN1_ex_free_func *asn1_ex_free; - ASN1_ex_free_func *asn1_ex_clear; - ASN1_ex_d2i *asn1_ex_d2i; - ASN1_ex_i2d *asn1_ex_i2d; - ASN1_ex_print_func *asn1_ex_print; -} ASN1_EXTERN_FUNCS; - -typedef struct ASN1_PRIMITIVE_FUNCS_st { - void *app_data; - unsigned long flags; - ASN1_ex_new_func *prim_new; - ASN1_ex_free_func *prim_free; - ASN1_ex_free_func *prim_clear; - ASN1_primitive_c2i *prim_c2i; - ASN1_primitive_i2c *prim_i2c; - ASN1_primitive_print *prim_print; -} ASN1_PRIMITIVE_FUNCS; - -/* - * This is the ASN1_AUX structure: it handles various miscellaneous - * requirements. For example the use of reference counts and an informational - * callback. The "informational callback" is called at various points during - * the ASN1 encoding and decoding. It can be used to provide minor - * customisation of the structures used. This is most useful where the - * supplied routines *almost* do the right thing but need some extra help at - * a few points. If the callback returns zero then it is assumed a fatal - * error has occurred and the main operation should be abandoned. If major - * changes in the default behaviour are required then an external type is - * more appropriate. - */ - -typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, - void *exarg); - -typedef struct ASN1_AUX_st { - void *app_data; - int flags; - int ref_offset; /* Offset of reference value */ - int ref_lock; /* Lock type to use */ - ASN1_aux_cb *asn1_cb; - int enc_offset; /* Offset of ASN1_ENCODING structure */ -} ASN1_AUX; - -/* For print related callbacks exarg points to this structure */ -typedef struct ASN1_PRINT_ARG_st { - BIO *out; - int indent; - const ASN1_PCTX *pctx; -} ASN1_PRINT_ARG; - -/* For streaming related callbacks exarg points to this structure */ -typedef struct ASN1_STREAM_ARG_st { - /* BIO to stream through */ - BIO *out; - /* BIO with filters appended */ - BIO *ndef_bio; - /* Streaming I/O boundary */ - unsigned char **boundary; -} ASN1_STREAM_ARG; - -/* Flags in ASN1_AUX */ - -/* Use a reference count */ -# define ASN1_AFLG_REFCOUNT 1 -/* Save the encoding of structure (useful for signatures) */ -# define ASN1_AFLG_ENCODING 2 -/* The Sequence length is invalid */ -# define ASN1_AFLG_BROKEN 4 - -/* operation values for asn1_cb */ - -# define ASN1_OP_NEW_PRE 0 -# define ASN1_OP_NEW_POST 1 -# define ASN1_OP_FREE_PRE 2 -# define ASN1_OP_FREE_POST 3 -# define ASN1_OP_D2I_PRE 4 -# define ASN1_OP_D2I_POST 5 -# define ASN1_OP_I2D_PRE 6 -# define ASN1_OP_I2D_POST 7 -# define ASN1_OP_PRINT_PRE 8 -# define ASN1_OP_PRINT_POST 9 -# define ASN1_OP_STREAM_PRE 10 -# define ASN1_OP_STREAM_POST 11 -# define ASN1_OP_DETACHED_PRE 12 -# define ASN1_OP_DETACHED_POST 13 - -/* Macro to implement a primitive type */ -# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) -# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ - ASN1_ITEM_start(itname) \ - ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ - ASN1_ITEM_end(itname) - -/* Macro to implement a multi string type */ -# define IMPLEMENT_ASN1_MSTRING(itname, mask) \ - ASN1_ITEM_start(itname) \ - ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ - ASN1_ITEM_end(itname) - -# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ - ASN1_ITEM_start(sname) \ - ASN1_ITYPE_EXTERN, \ - tag, \ - NULL, \ - 0, \ - &fptrs, \ - 0, \ - #sname \ - ASN1_ITEM_end(sname) - -/* Macro to implement standard functions in terms of ASN1_ITEM structures */ - -# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) - -# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ - IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) - -# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ - pre stname *fname##_new(void) \ - { \ - return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ - } \ - pre void fname##_free(stname *a) \ - { \ - ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ - } - -# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ - stname *fname##_new(void) \ - { \ - return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ - } \ - void fname##_free(stname *a) \ - { \ - ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ - } - -# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) - -# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ - } \ - int i2d_##fname(stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ - } - -# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ - int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ - { \ - return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ - } - -# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \ - static stname *d2i_##stname(stname **a, \ - const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \ - ASN1_ITEM_rptr(stname)); \ - } \ - static int i2d_##stname(stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, \ - ASN1_ITEM_rptr(stname)); \ - } - -/* - * This includes evil casts to remove const: they will go away when full ASN1 - * constification is done. - */ -# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ - { \ - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ - } \ - int i2d_##fname(const stname *a, unsigned char **out) \ - { \ - return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ - } - -# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ - stname * stname##_dup(stname *x) \ - { \ - return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ - } - -# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ - IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) - -# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ - int fname##_print_ctx(BIO *out, stname *x, int indent, \ - const ASN1_PCTX *pctx) \ - { \ - return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ - ASN1_ITEM_rptr(itname), pctx); \ - } - -# define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ - IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) - -# define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ - IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) - -/* external definitions for primitive types */ - -DECLARE_ASN1_ITEM(ASN1_BOOLEAN) -DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) -DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) -DECLARE_ASN1_ITEM(ASN1_SEQUENCE) -DECLARE_ASN1_ITEM(CBIGNUM) -DECLARE_ASN1_ITEM(BIGNUM) -DECLARE_ASN1_ITEM(INT32) -DECLARE_ASN1_ITEM(ZINT32) -DECLARE_ASN1_ITEM(UINT32) -DECLARE_ASN1_ITEM(ZUINT32) -DECLARE_ASN1_ITEM(INT64) -DECLARE_ASN1_ITEM(ZINT64) -DECLARE_ASN1_ITEM(UINT64) -DECLARE_ASN1_ITEM(ZUINT64) - -# if OPENSSL_API_COMPAT < 0x10200000L -/* - * LONG and ZLONG are strongly discouraged for use as stored data, as the - * underlying C type (long) differs in size depending on the architecture. - * They are designed with 32-bit longs in mind. - */ -DECLARE_ASN1_ITEM(LONG) -DECLARE_ASN1_ITEM(ZLONG) -# endif - -DEFINE_STACK_OF(ASN1_VALUE) - -/* Functions used internally by the ASN1 code */ - -int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); -void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); - -int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, - const ASN1_ITEM *it, int tag, int aclass, char opt, - ASN1_TLC *ctx); - -int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, - const ASN1_ITEM *it, int tag, int aclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/async.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/async.h deleted file mode 100644 index 7052b890..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/async.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 - -#ifndef HEADER_ASYNC_H -# define HEADER_ASYNC_H - -#if defined(_WIN32) -# if defined(BASETYPES) || defined(_WINDEF_H) -/* application has to include 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 - - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asyncerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/asyncerr.h deleted file mode 100644 index 91afbbb2..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/asyncerr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/bio.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/bio.h deleted file mode 100644 index ae559a51..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/bio.h +++ /dev/null @@ -1,801 +0,0 @@ -/* - * 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_BIO_H -# define HEADER_BIO_H - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# endif -# include - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* There are the classes of BIOs */ -# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ -# define BIO_TYPE_FILTER 0x0200 -# define BIO_TYPE_SOURCE_SINK 0x0400 - -/* These are the 'types' of BIOs */ -# define BIO_TYPE_NONE 0 -# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK) -# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK) - -# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK) -# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER) -# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER) -# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER) -# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER) -# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER) -# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) - -# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */ -# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER) -# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */ -# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER) -# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER) -# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER) -# ifndef OPENSSL_NO_SCTP -# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) -# endif - -#define BIO_TYPE_START 128 - -/* - * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. - * BIO_set_fp(in,stdin,BIO_NOCLOSE); - */ -# define BIO_NOCLOSE 0x00 -# define BIO_CLOSE 0x01 - -/* - * These are used in the following macros and are passed to BIO_ctrl() - */ -# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ -# define BIO_CTRL_EOF 2/* opt - are we at the eof */ -# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ -# define BIO_CTRL_SET 4/* man - set the 'IO' type */ -# define BIO_CTRL_GET 5/* man - get the 'IO' type */ -# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ -# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ -# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ -# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ -# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ -# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ -# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ -# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ -# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ -# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ - -# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ -# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ - -/* dgram BIO stuff */ -# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ -# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected - * socket to be passed in */ -# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ -# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ -# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ -# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ - -# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ -# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ - -/* #ifdef IP_MTU_DISCOVER */ -# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ -/* #endif */ - -# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ -# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 -# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ -# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. - * want to use this if asking - * the kernel fails */ - -# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was - * exceed in the previous write - * operation */ - -# define BIO_CTRL_DGRAM_GET_PEER 46 -# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ - -# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout - * to adjust socket timeouts */ -# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 - -# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 - -/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ -# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 -# ifndef OPENSSL_NO_SCTP -/* SCTP stuff */ -# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 -# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 -# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 -# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 -# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 -# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 -# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 -# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 -# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 -# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 -# endif - -# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71 - -/* modifiers */ -# define BIO_FP_READ 0x02 -# define BIO_FP_WRITE 0x04 -# define BIO_FP_APPEND 0x08 -# define BIO_FP_TEXT 0x10 - -# define BIO_FLAGS_READ 0x01 -# define BIO_FLAGS_WRITE 0x02 -# define BIO_FLAGS_IO_SPECIAL 0x04 -# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) -# define BIO_FLAGS_SHOULD_RETRY 0x08 -# ifndef BIO_FLAGS_UPLINK -/* - * "UPLINK" flag denotes file descriptors provided by application. It - * defaults to 0, as most platforms don't require UPLINK interface. - */ -# define BIO_FLAGS_UPLINK 0 -# endif - -# define BIO_FLAGS_BASE64_NO_NL 0x100 - -/* - * This is used with memory BIOs: - * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; - * BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. - */ -# define BIO_FLAGS_MEM_RDONLY 0x200 -# define BIO_FLAGS_NONCLEAR_RST 0x400 -# define BIO_FLAGS_IN_EOF 0x800 - -typedef union bio_addr_st BIO_ADDR; -typedef struct bio_addrinfo_st BIO_ADDRINFO; - -int BIO_get_new_index(void); -void BIO_set_flags(BIO *b, int flags); -int BIO_test_flags(const BIO *b, int flags); -void BIO_clear_flags(BIO *b, int flags); - -# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) -# define BIO_set_retry_special(b) \ - BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_set_retry_read(b) \ - BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_set_retry_write(b) \ - BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) - -/* These are normally used internally in BIOs */ -# define BIO_clear_retry_flags(b) \ - BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) -# define BIO_get_retry_flags(b) \ - BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) - -/* These should be used by the application to tell why we should retry */ -# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) -# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) -# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) -# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) -# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) - -/* - * The next three are used in conjunction with the BIO_should_io_special() - * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int - * *reason); will walk the BIO stack and return the 'reason' for the special - * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return - * the code. - */ -/* - * Returned from the SSL bio when the certificate retrieval code had an error - */ -# define BIO_RR_SSL_X509_LOOKUP 0x01 -/* Returned from the connect BIO when a connect would have blocked */ -# define BIO_RR_CONNECT 0x02 -/* Returned from the accept BIO when an accept would have blocked */ -# define BIO_RR_ACCEPT 0x03 - -/* These are passed by the BIO callback */ -# define BIO_CB_FREE 0x01 -# define BIO_CB_READ 0x02 -# define BIO_CB_WRITE 0x03 -# define BIO_CB_PUTS 0x04 -# define BIO_CB_GETS 0x05 -# define BIO_CB_CTRL 0x06 - -/* - * The callback is called before and after the underling operation, The - * BIO_CB_RETURN flag indicates if it is after the call - */ -# define BIO_CB_RETURN 0x80 -# define BIO_CB_return(a) ((a)|BIO_CB_RETURN) -# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) -# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) - -typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, - long argl, long ret); -typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, - size_t len, int argi, - long argl, int ret, size_t *processed); -BIO_callback_fn BIO_get_callback(const BIO *b); -void BIO_set_callback(BIO *b, BIO_callback_fn callback); - -BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); -void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); - -char *BIO_get_callback_arg(const BIO *b); -void BIO_set_callback_arg(BIO *b, char *arg); - -typedef struct bio_method_st BIO_METHOD; - -const char *BIO_method_name(const BIO *b); -int BIO_method_type(const BIO *b); - -typedef int BIO_info_cb(BIO *, int, int); -typedef BIO_info_cb bio_info_cb; /* backward compatibility */ - -DEFINE_STACK_OF(BIO) - -/* Prefix and suffix callback in ASN1 BIO */ -typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, - void *parg); - -# ifndef OPENSSL_NO_SCTP -/* SCTP parameter structs */ -struct bio_dgram_sctp_sndinfo { - uint16_t snd_sid; - uint16_t snd_flags; - uint32_t snd_ppid; - uint32_t snd_context; -}; - -struct bio_dgram_sctp_rcvinfo { - uint16_t rcv_sid; - uint16_t rcv_ssn; - uint16_t rcv_flags; - uint32_t rcv_ppid; - uint32_t rcv_tsn; - uint32_t rcv_cumtsn; - uint32_t rcv_context; -}; - -struct bio_dgram_sctp_prinfo { - uint16_t pr_policy; - uint32_t pr_value; -}; -# endif - -/* - * #define BIO_CONN_get_param_hostname BIO_ctrl - */ - -# define BIO_C_SET_CONNECT 100 -# define BIO_C_DO_STATE_MACHINE 101 -# define BIO_C_SET_NBIO 102 -/* # define BIO_C_SET_PROXY_PARAM 103 */ -# define BIO_C_SET_FD 104 -# define BIO_C_GET_FD 105 -# define BIO_C_SET_FILE_PTR 106 -# define BIO_C_GET_FILE_PTR 107 -# define BIO_C_SET_FILENAME 108 -# define BIO_C_SET_SSL 109 -# define BIO_C_GET_SSL 110 -# define BIO_C_SET_MD 111 -# define BIO_C_GET_MD 112 -# define BIO_C_GET_CIPHER_STATUS 113 -# define BIO_C_SET_BUF_MEM 114 -# define BIO_C_GET_BUF_MEM_PTR 115 -# define BIO_C_GET_BUFF_NUM_LINES 116 -# define BIO_C_SET_BUFF_SIZE 117 -# define BIO_C_SET_ACCEPT 118 -# define BIO_C_SSL_MODE 119 -# define BIO_C_GET_MD_CTX 120 -/* # define BIO_C_GET_PROXY_PARAM 121 */ -# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ -# define BIO_C_GET_CONNECT 123 -# define BIO_C_GET_ACCEPT 124 -# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 -# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 -# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 -# define BIO_C_FILE_SEEK 128 -# define BIO_C_GET_CIPHER_CTX 129 -# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input - * value */ -# define BIO_C_SET_BIND_MODE 131 -# define BIO_C_GET_BIND_MODE 132 -# define BIO_C_FILE_TELL 133 -# define BIO_C_GET_SOCKS 134 -# define BIO_C_SET_SOCKS 135 - -# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ -# define BIO_C_GET_WRITE_BUF_SIZE 137 -# define BIO_C_MAKE_BIO_PAIR 138 -# define BIO_C_DESTROY_BIO_PAIR 139 -# define BIO_C_GET_WRITE_GUARANTEE 140 -# define BIO_C_GET_READ_REQUEST 141 -# define BIO_C_SHUTDOWN_WR 142 -# define BIO_C_NREAD0 143 -# define BIO_C_NREAD 144 -# define BIO_C_NWRITE0 145 -# define BIO_C_NWRITE 146 -# define BIO_C_RESET_READ_REQUEST 147 -# define BIO_C_SET_MD_CTX 148 - -# define BIO_C_SET_PREFIX 149 -# define BIO_C_GET_PREFIX 150 -# define BIO_C_SET_SUFFIX 151 -# define BIO_C_GET_SUFFIX 152 - -# define BIO_C_SET_EX_ARG 153 -# define BIO_C_GET_EX_ARG 154 - -# define BIO_C_SET_CONNECT_MODE 155 - -# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) -# define BIO_get_app_data(s) BIO_get_ex_data(s,0) - -# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) - -# ifndef OPENSSL_NO_SOCK -/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ -/* Note: the underlying operating system may not support some of them */ -# define BIO_FAMILY_IPV4 4 -# define BIO_FAMILY_IPV6 6 -# define BIO_FAMILY_IPANY 256 - -/* BIO_s_connect() */ -# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \ - (char *)(name)) -# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \ - (char *)(port)) -# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \ - (char *)(addr)) -# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f) -# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)) -# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)) -# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)) -# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) -# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL) - -/* BIO_s_accept() */ -# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \ - (char *)(name)) -# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \ - (char *)(port)) -# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)) -# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1)) -# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2)) -# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3)) -/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ -# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL) -# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \ - (char *)(bio)) -# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f) -# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL) - -/* Aliases kept for backward compatibility */ -# define BIO_BIND_NORMAL 0 -# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR -# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR -# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) -# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) - -/* BIO_s_accept() and BIO_s_connect() */ -# define BIO_do_connect(b) BIO_do_handshake(b) -# define BIO_do_accept(b) BIO_do_handshake(b) -# endif /* OPENSSL_NO_SOCK */ - -# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) - -/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ -# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) -# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c)) - -/* BIO_s_file() */ -# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp)) -# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp)) - -/* BIO_s_fd() and BIO_s_file() */ -# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) -# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) - -/* - * name is cast to lose const, but might be better to route through a - * function so we can do it safely - */ -# ifdef CONST_STRICT -/* - * If you are wondering why this isn't defined, its because CONST_STRICT is - * purely a compile-time kludge to allow const to be checked. - */ -int BIO_read_filename(BIO *b, const char *name); -# else -# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_READ,(char *)(name)) -# endif -# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_WRITE,name) -# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_APPEND,name) -# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) - -/* - * WARNING WARNING, this ups the reference count on the read bio of the SSL - * structure. This is because the ssl read BIO is now pointed to by the - * next_bio field in the bio. So when you free the BIO, make sure you are - * doing a BIO_free_all() to catch the underlying BIO. - */ -# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl)) -# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp)) -# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) -# define BIO_set_ssl_renegotiate_bytes(b,num) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) -# define BIO_get_num_renegotiates(b) \ - BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL) -# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) - -/* defined in evp.h */ -/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ - -# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp)) -# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm)) -# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \ - (char *)(pp)) -# define BIO_set_mem_eof_return(b,v) \ - BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) - -/* For the BIO_f_buffer() type */ -# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) -# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) -# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) -# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) -# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) - -/* Don't use the next one unless you know what you are doing :-) */ -# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) - -# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) -# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) -# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) -# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) -# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) -# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) -/* ...pending macros have inappropriate return type */ -size_t BIO_ctrl_pending(BIO *b); -size_t BIO_ctrl_wpending(BIO *b); -# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) -# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ - cbp) -# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) - -/* For the BIO_f_buffer() type */ -# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) -# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) - -/* For BIO_s_bio() */ -# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) -# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) -# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) -# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) -# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) -/* macros with inappropriate type -- but ...pending macros use int too: */ -# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) -# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) -size_t BIO_ctrl_get_write_guarantee(BIO *b); -size_t BIO_ctrl_get_read_request(BIO *b); -int BIO_ctrl_reset_read_request(BIO *b); - -/* ctrl macros for dgram */ -# define BIO_ctrl_dgram_connect(b,peer) \ - (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer)) -# define BIO_ctrl_set_connected(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer)) -# define BIO_dgram_recv_timedout(b) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) -# define BIO_dgram_send_timedout(b) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) -# define BIO_dgram_get_peer(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer)) -# define BIO_dgram_set_peer(b,peer) \ - (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer)) -# define BIO_dgram_get_mtu_overhead(b) \ - (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) - -#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef) -int BIO_set_ex_data(BIO *bio, int idx, void *data); -void *BIO_get_ex_data(BIO *bio, int idx); -uint64_t BIO_number_read(BIO *bio); -uint64_t BIO_number_written(BIO *bio); - -/* For BIO_f_asn1() */ -int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, - asn1_ps_func *prefix_free); -int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, - asn1_ps_func **pprefix_free); -int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, - asn1_ps_func *suffix_free); -int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, - asn1_ps_func **psuffix_free); - -const BIO_METHOD *BIO_s_file(void); -BIO *BIO_new_file(const char *filename, const char *mode); -# ifndef OPENSSL_NO_STDIO -BIO *BIO_new_fp(FILE *stream, int close_flag); -# endif -BIO *BIO_new(const BIO_METHOD *type); -int BIO_free(BIO *a); -void BIO_set_data(BIO *a, void *ptr); -void *BIO_get_data(BIO *a); -void BIO_set_init(BIO *a, int init); -int BIO_get_init(BIO *a); -void BIO_set_shutdown(BIO *a, int shut); -int BIO_get_shutdown(BIO *a); -void BIO_vfree(BIO *a); -int BIO_up_ref(BIO *a); -int BIO_read(BIO *b, void *data, int dlen); -int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); -int BIO_gets(BIO *bp, char *buf, int size); -int BIO_write(BIO *b, const void *data, int dlen); -int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); -int BIO_puts(BIO *bp, const char *buf); -int BIO_indent(BIO *b, int indent, int max); -long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); -long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); -void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); -long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); -BIO *BIO_push(BIO *b, BIO *append); -BIO *BIO_pop(BIO *b); -void BIO_free_all(BIO *a); -BIO *BIO_find_type(BIO *b, int bio_type); -BIO *BIO_next(BIO *b); -void BIO_set_next(BIO *b, BIO *next); -BIO *BIO_get_retry_BIO(BIO *bio, int *reason); -int BIO_get_retry_reason(BIO *bio); -void BIO_set_retry_reason(BIO *bio, int reason); -BIO *BIO_dup_chain(BIO *in); - -int BIO_nread0(BIO *bio, char **buf); -int BIO_nread(BIO *bio, char **buf, int num); -int BIO_nwrite0(BIO *bio, char **buf); -int BIO_nwrite(BIO *bio, char **buf, int num); - -long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, - long argl, long ret); - -const BIO_METHOD *BIO_s_mem(void); -const BIO_METHOD *BIO_s_secmem(void); -BIO *BIO_new_mem_buf(const void *buf, int len); -# ifndef OPENSSL_NO_SOCK -const BIO_METHOD *BIO_s_socket(void); -const BIO_METHOD *BIO_s_connect(void); -const BIO_METHOD *BIO_s_accept(void); -# endif -const BIO_METHOD *BIO_s_fd(void); -const BIO_METHOD *BIO_s_log(void); -const BIO_METHOD *BIO_s_bio(void); -const BIO_METHOD *BIO_s_null(void); -const BIO_METHOD *BIO_f_null(void); -const BIO_METHOD *BIO_f_buffer(void); -const BIO_METHOD *BIO_f_linebuffer(void); -const BIO_METHOD *BIO_f_nbio_test(void); -# ifndef OPENSSL_NO_DGRAM -const BIO_METHOD *BIO_s_datagram(void); -int BIO_dgram_non_fatal_error(int error); -BIO *BIO_new_dgram(int fd, int close_flag); -# ifndef OPENSSL_NO_SCTP -const BIO_METHOD *BIO_s_datagram_sctp(void); -BIO *BIO_new_dgram_sctp(int fd, int close_flag); -int BIO_dgram_is_sctp(BIO *bio); -int BIO_dgram_sctp_notification_cb(BIO *b, - void (*handle_notifications) (BIO *bio, - void *context, - void *buf), - void *context); -int BIO_dgram_sctp_wait_for_dry(BIO *b); -int BIO_dgram_sctp_msg_waiting(BIO *b); -# endif -# endif - -# ifndef OPENSSL_NO_SOCK -int BIO_sock_should_retry(int i); -int BIO_sock_non_fatal_error(int error); -# endif - -int BIO_fd_should_retry(int i); -int BIO_fd_non_fatal_error(int error); -int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), - void *u, const char *s, int len); -int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), - void *u, const char *s, int len, int indent); -int BIO_dump(BIO *b, const char *bytes, int len); -int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); -# ifndef OPENSSL_NO_STDIO -int BIO_dump_fp(FILE *fp, const char *s, int len); -int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); -# endif -int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data, - int datalen); - -# ifndef OPENSSL_NO_SOCK -BIO_ADDR *BIO_ADDR_new(void); -int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, - const void *where, size_t wherelen, unsigned short port); -void BIO_ADDR_free(BIO_ADDR *); -void BIO_ADDR_clear(BIO_ADDR *ap); -int BIO_ADDR_family(const BIO_ADDR *ap); -int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); -unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); -char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); -char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); -char *BIO_ADDR_path_string(const BIO_ADDR *ap); - -const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); -int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); -const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); -void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); - -enum BIO_hostserv_priorities { - BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV -}; -int BIO_parse_hostserv(const char *hostserv, char **host, char **service, - enum BIO_hostserv_priorities hostserv_prio); -enum BIO_lookup_type { - BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER -}; -int BIO_lookup(const char *host, const char *service, - enum BIO_lookup_type lookup_type, - int family, int socktype, BIO_ADDRINFO **res); -int BIO_lookup_ex(const char *host, const char *service, - int lookup_type, int family, int socktype, int protocol, - BIO_ADDRINFO **res); -int BIO_sock_error(int sock); -int BIO_socket_ioctl(int fd, long type, void *arg); -int BIO_socket_nbio(int fd, int mode); -int BIO_sock_init(void); -# if OPENSSL_API_COMPAT < 0x10100000L -# define BIO_sock_cleanup() while(0) continue -# endif -int BIO_set_tcp_ndelay(int sock, int turn_on); - -DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name)) -DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr)) -DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip)) -DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode)) -DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port)) - -union BIO_sock_info_u { - BIO_ADDR *addr; -}; -enum BIO_sock_info_type { - BIO_SOCK_INFO_ADDRESS -}; -int BIO_sock_info(int sock, - enum BIO_sock_info_type type, union BIO_sock_info_u *info); - -# define BIO_SOCK_REUSEADDR 0x01 -# define BIO_SOCK_V6_ONLY 0x02 -# define BIO_SOCK_KEEPALIVE 0x04 -# define BIO_SOCK_NONBLOCK 0x08 -# define BIO_SOCK_NODELAY 0x10 - -int BIO_socket(int domain, int socktype, int protocol, int options); -int BIO_connect(int sock, const BIO_ADDR *addr, int options); -int BIO_bind(int sock, const BIO_ADDR *addr, int options); -int BIO_listen(int sock, const BIO_ADDR *addr, int options); -int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); -int BIO_closesocket(int sock); - -BIO *BIO_new_socket(int sock, int close_flag); -BIO *BIO_new_connect(const char *host_port); -BIO *BIO_new_accept(const char *host_port); -# endif /* OPENSSL_NO_SOCK*/ - -BIO *BIO_new_fd(int fd, int close_flag); - -int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, - BIO **bio2, size_t writebuf2); -/* - * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. - * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default - * value. - */ - -void BIO_copy_next_retry(BIO *b); - -/* - * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); - */ - -# define ossl_bio__attr__(x) -# if defined(__GNUC__) && defined(__STDC_VERSION__) \ - && !defined(__APPLE__) - /* - * Because we support the 'z' modifier, which made its appearance in C99, - * we can't use __attribute__ with pre C99 dialects. - */ -# if __STDC_VERSION__ >= 199901L -# undef ossl_bio__attr__ -# define ossl_bio__attr__ __attribute__ -# if __GNUC__*10 + __GNUC_MINOR__ >= 44 -# define ossl_bio__printf__ __gnu_printf__ -# else -# define ossl_bio__printf__ __printf__ -# endif -# endif -# endif -int BIO_printf(BIO *bio, const char *format, ...) -ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); -int BIO_vprintf(BIO *bio, const char *format, va_list args) -ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); -int BIO_snprintf(char *buf, size_t n, const char *format, ...) -ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); -int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) -ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); -# undef ossl_bio__attr__ -# undef ossl_bio__printf__ - - -BIO_METHOD *BIO_meth_new(int type, const char *name); -void BIO_meth_free(BIO_METHOD *biom); -int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int); -int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, - size_t *); -int BIO_meth_set_write(BIO_METHOD *biom, - int (*write) (BIO *, const char *, int)); -int BIO_meth_set_write_ex(BIO_METHOD *biom, - int (*bwrite) (BIO *, const char *, size_t, size_t *)); -int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int); -int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *); -int BIO_meth_set_read(BIO_METHOD *biom, - int (*read) (BIO *, char *, int)); -int BIO_meth_set_read_ex(BIO_METHOD *biom, - int (*bread) (BIO *, char *, size_t, size_t *)); -int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *); -int BIO_meth_set_puts(BIO_METHOD *biom, - int (*puts) (BIO *, const char *)); -int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int); -int BIO_meth_set_gets(BIO_METHOD *biom, - int (*gets) (BIO *, char *, int)); -long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *); -int BIO_meth_set_ctrl(BIO_METHOD *biom, - long (*ctrl) (BIO *, int, long, void *)); -int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *); -int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); -int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *); -int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); -long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) - (BIO *, int, BIO_info_cb *); -int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, - long (*callback_ctrl) (BIO *, int, - BIO_info_cb *)); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/bioerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/bioerr.h deleted file mode 100644 index 46e2c96e..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/bioerr.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/blowfish.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/blowfish.h deleted file mode 100644 index cd3e460e..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/blowfish.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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_BLOWFISH_H -# define HEADER_BLOWFISH_H - -# include - -# ifndef OPENSSL_NO_BF -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define BF_ENCRYPT 1 -# define BF_DECRYPT 0 - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! BF_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define BF_LONG unsigned int - -# define BF_ROUNDS 16 -# define BF_BLOCK 8 - -typedef struct bf_key_st { - BF_LONG P[BF_ROUNDS + 2]; - BF_LONG S[4 * 256]; -} BF_KEY; - -void BF_set_key(BF_KEY *key, int len, const unsigned char *data); - -void BF_encrypt(BF_LONG *data, const BF_KEY *key); -void BF_decrypt(BF_LONG *data, const BF_KEY *key); - -void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, - const BF_KEY *key, int enc); -void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - const BF_KEY *schedule, unsigned char *ivec, int enc); -void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const BF_KEY *schedule, - unsigned char *ivec, int *num); -const char *BF_options(void); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/bn.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/bn.h deleted file mode 100644 index 8af05d00..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/bn.h +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_BN_H -# define HEADER_BN_H - -# include -# ifndef OPENSSL_NO_STDIO -# include -# endif -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * 64-bit processor with LP64 ABI - */ -# ifdef SIXTY_FOUR_BIT_LONG -# define BN_ULONG unsigned long -# define BN_BYTES 8 -# endif - -/* - * 64-bit processor other than LP64 ABI - */ -# ifdef SIXTY_FOUR_BIT -# define BN_ULONG unsigned long long -# define BN_BYTES 8 -# endif - -# ifdef THIRTY_TWO_BIT -# define BN_ULONG unsigned int -# define BN_BYTES 4 -# endif - -# define BN_BITS2 (BN_BYTES * 8) -# define BN_BITS (BN_BITS2 * 2) -# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1)) - -# define BN_FLG_MALLOCED 0x01 -# define BN_FLG_STATIC_DATA 0x02 - -/* - * avoid leaking exponent information through timing, - * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, - * BN_div() will call BN_div_no_branch, - * BN_mod_inverse() will call BN_mod_inverse_no_branch. - */ -# define BN_FLG_CONSTTIME 0x04 -# define BN_FLG_SECURE 0x08 - -# if OPENSSL_API_COMPAT < 0x00908000L -/* deprecated name for the flag */ -# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME -# define BN_FLG_FREE 0x8000 /* used for debugging */ -# endif - -void BN_set_flags(BIGNUM *b, int n); -int BN_get_flags(const BIGNUM *b, int n); - -/* Values for |top| in BN_rand() */ -#define BN_RAND_TOP_ANY -1 -#define BN_RAND_TOP_ONE 0 -#define BN_RAND_TOP_TWO 1 - -/* Values for |bottom| in BN_rand() */ -#define BN_RAND_BOTTOM_ANY 0 -#define BN_RAND_BOTTOM_ODD 1 - -/* - * get a clone of a BIGNUM with changed flags, for *temporary* use only (the - * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The - * value |dest| should be a newly allocated BIGNUM obtained via BN_new() that - * has not been otherwise initialised or used. - */ -void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); - -/* Wrapper function to make using BN_GENCB easier */ -int BN_GENCB_call(BN_GENCB *cb, int a, int b); - -BN_GENCB *BN_GENCB_new(void); -void BN_GENCB_free(BN_GENCB *cb); - -/* Populate a BN_GENCB structure with an "old"-style callback */ -void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *), - void *cb_arg); - -/* Populate a BN_GENCB structure with a "new"-style callback */ -void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), - void *cb_arg); - -void *BN_GENCB_get_arg(BN_GENCB *cb); - -# define BN_prime_checks 0 /* default: select number of iterations based - * on the size of the number */ - -/* - * BN_prime_checks_for_size() returns the number of Miller-Rabin iterations - * that will be done for checking that a random number is probably prime. The - * error rate for accepting a composite number as prime depends on the size of - * the prime |b|. The error rates used are for calculating an RSA key with 2 primes, - * and so the level is what you would expect for a key of double the size of the - * prime. - * - * This table is generated using the algorithm of FIPS PUB 186-4 - * Digital Signature Standard (DSS), section F.1, page 117. - * (https://dx.doi.org/10.6028/NIST.FIPS.186-4) - * - * The following magma script was used to generate the output: - * securitybits:=125; - * k:=1024; - * for t:=1 to 65 do - * for M:=3 to Floor(2*Sqrt(k-1)-1) do - * S:=0; - * // Sum over m - * for m:=3 to M do - * s:=0; - * // Sum over j - * for j:=2 to m do - * s+:=(RealField(32)!2)^-(j+(k-1)/j); - * end for; - * S+:=2^(m-(m-1)*t)*s; - * end for; - * A:=2^(k-2-M*t); - * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S; - * pkt:=2.00743*Log(2)*k*2^-k*(A+B); - * seclevel:=Floor(-Log(2,pkt)); - * if seclevel ge securitybits then - * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M; - * break; - * end if; - * end for; - * if seclevel ge securitybits then break; end if; - * end for; - * - * It can be run online at: - * http://magma.maths.usyd.edu.au/calc - * - * And will output: - * k: 1024, security: 129 bits (t: 6, M: 23) - * - * k is the number of bits of the prime, securitybits is the level we want to - * reach. - * - * prime length | RSA key size | # MR tests | security level - * -------------+--------------|------------+--------------- - * (b) >= 6394 | >= 12788 | 3 | 256 bit - * (b) >= 3747 | >= 7494 | 3 | 192 bit - * (b) >= 1345 | >= 2690 | 4 | 128 bit - * (b) >= 1080 | >= 2160 | 5 | 128 bit - * (b) >= 852 | >= 1704 | 5 | 112 bit - * (b) >= 476 | >= 952 | 5 | 80 bit - * (b) >= 400 | >= 800 | 6 | 80 bit - * (b) >= 347 | >= 694 | 7 | 80 bit - * (b) >= 308 | >= 616 | 8 | 80 bit - * (b) >= 55 | >= 110 | 27 | 64 bit - * (b) >= 6 | >= 12 | 34 | 64 bit - */ - -# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \ - (b) >= 1345 ? 4 : \ - (b) >= 476 ? 5 : \ - (b) >= 400 ? 6 : \ - (b) >= 347 ? 7 : \ - (b) >= 308 ? 8 : \ - (b) >= 55 ? 27 : \ - /* b >= 6 */ 34) - -# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) - -int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); -int BN_is_zero(const BIGNUM *a); -int BN_is_one(const BIGNUM *a); -int BN_is_word(const BIGNUM *a, const BN_ULONG w); -int BN_is_odd(const BIGNUM *a); - -# define BN_one(a) (BN_set_word((a),1)) - -void BN_zero_ex(BIGNUM *a); - -# if OPENSSL_API_COMPAT >= 0x00908000L -# define BN_zero(a) BN_zero_ex(a) -# else -# define BN_zero(a) (BN_set_word((a),0)) -# endif - -const BIGNUM *BN_value_one(void); -char *BN_options(void); -BN_CTX *BN_CTX_new(void); -BN_CTX *BN_CTX_secure_new(void); -void BN_CTX_free(BN_CTX *c); -void BN_CTX_start(BN_CTX *ctx); -BIGNUM *BN_CTX_get(BN_CTX *ctx); -void BN_CTX_end(BN_CTX *ctx); -int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); -int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); -int BN_num_bits(const BIGNUM *a); -int BN_num_bits_word(BN_ULONG l); -int BN_security_bits(int L, int N); -BIGNUM *BN_new(void); -BIGNUM *BN_secure_new(void); -void BN_clear_free(BIGNUM *a); -BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); -void BN_swap(BIGNUM *a, BIGNUM *b); -BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2bin(const BIGNUM *a, unsigned char *to); -int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); -BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); -BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); -int BN_bn2mpi(const BIGNUM *a, unsigned char *to); -int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); -int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); -/** BN_set_negative sets sign of a BIGNUM - * \param b pointer to the BIGNUM object - * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise - */ -void BN_set_negative(BIGNUM *b, int n); -/** BN_is_negative returns 1 if the BIGNUM is negative - * \param b pointer to the BIGNUM object - * \return 1 if a < 0 and 0 otherwise - */ -int BN_is_negative(const BIGNUM *b); - -int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, - BN_CTX *ctx); -# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) -int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); -int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); -int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); -int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); -int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, - BN_CTX *ctx); -int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); - -BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); -BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); -int BN_mul_word(BIGNUM *a, BN_ULONG w); -int BN_add_word(BIGNUM *a, BN_ULONG w); -int BN_sub_word(BIGNUM *a, BN_ULONG w); -int BN_set_word(BIGNUM *a, BN_ULONG w); -BN_ULONG BN_get_word(const BIGNUM *a); - -int BN_cmp(const BIGNUM *a, const BIGNUM *b); -void BN_free(BIGNUM *a); -int BN_is_bit_set(const BIGNUM *a, int n); -int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); -int BN_lshift1(BIGNUM *r, const BIGNUM *a); -int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - -int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); -int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, - BN_MONT_CTX *in_mont); -int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, - const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, - BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); - -int BN_mask_bits(BIGNUM *a, int n); -# ifndef OPENSSL_NO_STDIO -int BN_print_fp(FILE *fp, const BIGNUM *a); -# endif -int BN_print(BIO *bio, const BIGNUM *a); -int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); -int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); -int BN_rshift1(BIGNUM *r, const BIGNUM *a); -void BN_clear(BIGNUM *a); -BIGNUM *BN_dup(const BIGNUM *a); -int BN_ucmp(const BIGNUM *a, const BIGNUM *b); -int BN_set_bit(BIGNUM *a, int n); -int BN_clear_bit(BIGNUM *a, int n); -char *BN_bn2hex(const BIGNUM *a); -char *BN_bn2dec(const BIGNUM *a); -int BN_hex2bn(BIGNUM **a, const char *str); -int BN_dec2bn(BIGNUM **a, const char *str); -int BN_asc2bn(BIGNUM **a, const char *str); -int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); -int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns - * -2 for - * error */ -BIGNUM *BN_mod_inverse(BIGNUM *ret, - const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); -BIGNUM *BN_mod_sqrt(BIGNUM *ret, - const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); - -void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); - -/* Deprecated versions */ -DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, - const BIGNUM *add, - const BIGNUM *rem, - void (*callback) (int, int, - void *), - void *cb_arg)) -DEPRECATEDIN_0_9_8(int - BN_is_prime(const BIGNUM *p, int nchecks, - void (*callback) (int, int, void *), - BN_CTX *ctx, void *cb_arg)) -DEPRECATEDIN_0_9_8(int - BN_is_prime_fasttest(const BIGNUM *p, int nchecks, - void (*callback) (int, int, void *), - BN_CTX *ctx, void *cb_arg, - int do_trial_division)) - -/* Newer versions */ -int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, - const BIGNUM *rem, BN_GENCB *cb); -int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); -int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, - int do_trial_division, BN_GENCB *cb); - -int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); - -int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, - const BIGNUM *Xp, const BIGNUM *Xp1, - const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, - BN_GENCB *cb); -int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, - BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, - BN_CTX *ctx, BN_GENCB *cb); - -BN_MONT_CTX *BN_MONT_CTX_new(void); -int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - BN_MONT_CTX *mont, BN_CTX *ctx); -int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -void BN_MONT_CTX_free(BN_MONT_CTX *mont); -int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); -BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); -BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, - const BIGNUM *mod, BN_CTX *ctx); - -/* BN_BLINDING flags */ -# define BN_BLINDING_NO_UPDATE 0x00000001 -# define BN_BLINDING_NO_RECREATE 0x00000002 - -BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); -void BN_BLINDING_free(BN_BLINDING *b); -int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); -int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); -int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, - BN_CTX *); - -int BN_BLINDING_is_current_thread(BN_BLINDING *b); -void BN_BLINDING_set_current_thread(BN_BLINDING *b); -int BN_BLINDING_lock(BN_BLINDING *b); -int BN_BLINDING_unlock(BN_BLINDING *b); - -unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); -void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); -BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, - const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, - int (*bn_mod_exp) (BIGNUM *r, - const BIGNUM *a, - const BIGNUM *p, - const BIGNUM *m, - BN_CTX *ctx, - BN_MONT_CTX *m_ctx), - BN_MONT_CTX *m_ctx); - -DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont)) -DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3 - * mont */ - -BN_RECP_CTX *BN_RECP_CTX_new(void); -void BN_RECP_CTX_free(BN_RECP_CTX *recp); -int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); -int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, - BN_RECP_CTX *recp, BN_CTX *ctx); -int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx); -int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, - BN_RECP_CTX *recp, BN_CTX *ctx); - -# ifndef OPENSSL_NO_EC2M - -/* - * Functions for arithmetic over binary polynomials represented by BIGNUMs. - * The BIGNUM::neg property of BIGNUMs representing binary polynomials is - * ignored. Note that input arguments are not const so that their bit arrays - * can be expanded to the appropriate size if needed. - */ - -/* - * r = a + b - */ -int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); -# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) -/* - * r=a mod p - */ -int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); -/* r = (a * b) mod p */ -int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = (a * a) mod p */ -int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -/* r = (1 / b) mod p */ -int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); -/* r = (a / b) mod p */ -int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = (a ^ b) mod p */ -int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *p, BN_CTX *ctx); -/* r = sqrt(a) mod p */ -int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - BN_CTX *ctx); -/* r^2 + r = a mod p */ -int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - BN_CTX *ctx); -# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) -/*- - * Some functions allow for representation of the irreducible polynomials - * as an unsigned int[], say p. The irreducible f(t) is then of the form: - * t^p[0] + t^p[1] + ... + t^p[k] - * where m = p[0] > p[1] > ... > p[k] = 0. - */ -/* r = a mod p */ -int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); -/* r = (a * b) mod p */ -int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = (a * a) mod p */ -int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], - BN_CTX *ctx); -/* r = (1 / b) mod p */ -int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], - BN_CTX *ctx); -/* r = (a / b) mod p */ -int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = (a ^ b) mod p */ -int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const int p[], BN_CTX *ctx); -/* r = sqrt(a) mod p */ -int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, - const int p[], BN_CTX *ctx); -/* r^2 + r = a mod p */ -int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, - const int p[], BN_CTX *ctx); -int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); -int BN_GF2m_arr2poly(const int p[], BIGNUM *a); - -# endif - -/* - * faster mod functions for the 'NIST primes' 0 <= a < p^2 - */ -int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); -int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - -const BIGNUM *BN_get0_nist_prime_192(void); -const BIGNUM *BN_get0_nist_prime_224(void); -const BIGNUM *BN_get0_nist_prime_256(void); -const BIGNUM *BN_get0_nist_prime_384(void); -const BIGNUM *BN_get0_nist_prime_521(void); - -int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a, - const BIGNUM *field, BN_CTX *ctx); - -int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, - const BIGNUM *priv, const unsigned char *message, - size_t message_len, BN_CTX *ctx); - -/* Primes from RFC 2409 */ -BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn); -BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn); - -/* Primes from RFC 3526 */ -BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn); -BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768 -# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024 -# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536 -# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048 -# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072 -# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096 -# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144 -# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192 -# endif - -int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/bnerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/bnerr.h deleted file mode 100644 index 9f3c7cfa..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/bnerr.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/buffer.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/buffer.h deleted file mode 100644 index d2765766..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/buffer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 1995-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_BUFFER_H -# define HEADER_BUFFER_H - -# include -# ifndef HEADER_CRYPTO_H -# include -# endif -# include - - -#ifdef __cplusplus -extern "C" { -#endif - -# include -# include - -/* - * 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 { - size_t length; /* current number of bytes */ - char *data; - 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_ex(unsigned long flags); -void BUF_MEM_free(BUF_MEM *a); -size_t BUF_MEM_grow(BUF_MEM *str, size_t len); -size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); -void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/buffererr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/buffererr.h deleted file mode 100644 index 04f6ff7a..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/buffererr.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/camellia.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/camellia.h deleted file mode 100644 index 151f3c13..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/camellia.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2006-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_CAMELLIA_H -# define HEADER_CAMELLIA_H - -# include - -# ifndef OPENSSL_NO_CAMELLIA -# include -#ifdef __cplusplus -extern "C" { -#endif - -# define CAMELLIA_ENCRYPT 1 -# define CAMELLIA_DECRYPT 0 - -/* - * Because array size can't be a const in C, the following two are macros. - * Both sizes are in bytes. - */ - -/* This should be a hidden type, but EVP requires that the size be known */ - -# define CAMELLIA_BLOCK_SIZE 16 -# define CAMELLIA_TABLE_BYTE_LEN 272 -# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) - -typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match - * with WORD */ - -struct camellia_key_st { - union { - double d; /* ensures 64-bit align */ - KEY_TABLE_TYPE rd_key; - } u; - int grand_rounds; -}; -typedef struct camellia_key_st CAMELLIA_KEY; - -int Camellia_set_key(const unsigned char *userKey, const int bits, - CAMELLIA_KEY *key); - -void Camellia_encrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key); -void Camellia_decrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key); - -void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, - const CAMELLIA_KEY *key, const int enc); -void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, const int enc); -void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num, const int enc); -void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char *ivec, int *num); -void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const CAMELLIA_KEY *key, - unsigned char ivec[CAMELLIA_BLOCK_SIZE], - unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], - unsigned int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cast.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/cast.h deleted file mode 100644 index 2cc89ae0..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cast.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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_CAST_H -# define HEADER_CAST_H - -# include - -# ifndef OPENSSL_NO_CAST -# ifdef __cplusplus -extern "C" { -# endif - -# define CAST_ENCRYPT 1 -# define CAST_DECRYPT 0 - -# define CAST_LONG unsigned int - -# define CAST_BLOCK 8 -# define CAST_KEY_LENGTH 16 - -typedef struct cast_key_st { - CAST_LONG data[32]; - int short_key; /* Use reduced rounds for short key */ -} CAST_KEY; - -void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); -void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, - const CAST_KEY *key, int enc); -void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); -void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); -void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *ks, unsigned char *iv, - int enc); -void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, const CAST_KEY *schedule, - unsigned char *ivec, int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cmac.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/cmac.h deleted file mode 100644 index 3535a9ab..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cmac.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2010-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_CMAC_H -# define HEADER_CMAC_H - -# ifndef OPENSSL_NO_CMAC - -#ifdef __cplusplus -extern "C" { -#endif - -# include - -/* Opaque */ -typedef struct CMAC_CTX_st CMAC_CTX; - -CMAC_CTX *CMAC_CTX_new(void); -void CMAC_CTX_cleanup(CMAC_CTX *ctx); -void CMAC_CTX_free(CMAC_CTX *ctx); -EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); -int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); - -int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, - const EVP_CIPHER *cipher, ENGINE *impl); -int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); -int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); -int CMAC_resume(CMAC_CTX *ctx); - -#ifdef __cplusplus -} -#endif - -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cms.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/cms.h deleted file mode 100644 index c7627968..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cms.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 2008-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_CMS_H -# define HEADER_CMS_H - -# include - -# ifndef OPENSSL_NO_CMS -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -typedef struct CMS_ContentInfo_st CMS_ContentInfo; -typedef struct CMS_SignerInfo_st CMS_SignerInfo; -typedef struct CMS_CertificateChoices CMS_CertificateChoices; -typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; -typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; -typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; -typedef struct CMS_Receipt_st CMS_Receipt; -typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; -typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; - -DEFINE_STACK_OF(CMS_SignerInfo) -DEFINE_STACK_OF(CMS_RecipientEncryptedKey) -DEFINE_STACK_OF(CMS_RecipientInfo) -DEFINE_STACK_OF(CMS_RevocationInfoChoice) -DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) -DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) -DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) - -# define CMS_SIGNERINFO_ISSUER_SERIAL 0 -# define CMS_SIGNERINFO_KEYIDENTIFIER 1 - -# define CMS_RECIPINFO_NONE -1 -# define CMS_RECIPINFO_TRANS 0 -# define CMS_RECIPINFO_AGREE 1 -# define CMS_RECIPINFO_KEK 2 -# define CMS_RECIPINFO_PASS 3 -# define CMS_RECIPINFO_OTHER 4 - -/* S/MIME related flags */ - -# define CMS_TEXT 0x1 -# define CMS_NOCERTS 0x2 -# define CMS_NO_CONTENT_VERIFY 0x4 -# define CMS_NO_ATTR_VERIFY 0x8 -# define CMS_NOSIGS \ - (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY) -# define CMS_NOINTERN 0x10 -# define CMS_NO_SIGNER_CERT_VERIFY 0x20 -# define CMS_NOVERIFY 0x20 -# define CMS_DETACHED 0x40 -# define CMS_BINARY 0x80 -# define CMS_NOATTR 0x100 -# define CMS_NOSMIMECAP 0x200 -# define CMS_NOOLDMIMETYPE 0x400 -# define CMS_CRLFEOL 0x800 -# define CMS_STREAM 0x1000 -# define CMS_NOCRL 0x2000 -# define CMS_PARTIAL 0x4000 -# define CMS_REUSE_DIGEST 0x8000 -# define CMS_USE_KEYID 0x10000 -# define CMS_DEBUG_DECRYPT 0x20000 -# define CMS_KEY_PARAM 0x40000 -# define CMS_ASCIICRLF 0x80000 - -const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms); - -BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); -int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); - -ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); -int CMS_is_detached(CMS_ContentInfo *cms); -int CMS_set_detached(CMS_ContentInfo *cms, int detached); - -# ifdef HEADER_PEM_H -DECLARE_PEM_rw_const(CMS, CMS_ContentInfo) -# endif -int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms); -CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms); -int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms); - -BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); -int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); -int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, - int flags); -CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont); -int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags); - -int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, - unsigned int flags); - -CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, BIO *data, - unsigned int flags); - -CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, - X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, unsigned int flags); - -int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags); -CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags); - -int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, - unsigned int flags); -CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, - unsigned int flags); - -int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, - const unsigned char *key, size_t keylen, - BIO *dcont, BIO *out, unsigned int flags); - -CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, - const unsigned char *key, - size_t keylen, unsigned int flags); - -int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, - const unsigned char *key, size_t keylen); - -int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, - X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags); - -int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, - STACK_OF(X509) *certs, - X509_STORE *store, unsigned int flags); - -STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); - -CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, - const EVP_CIPHER *cipher, unsigned int flags); - -int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, - BIO *dcont, BIO *out, unsigned int flags); - -int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert); -int CMS_decrypt_set1_key(CMS_ContentInfo *cms, - unsigned char *key, size_t keylen, - const unsigned char *id, size_t idlen); -int CMS_decrypt_set1_password(CMS_ContentInfo *cms, - unsigned char *pass, ossl_ssize_t passlen); - -STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); -int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); -EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri); -CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); -CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, - X509 *recip, unsigned int flags); -int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); -int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); -int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, - EVP_PKEY **pk, X509 **recip, - X509_ALGOR **palg); -int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, - ASN1_INTEGER **sno); - -CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, - unsigned char *key, size_t keylen, - unsigned char *id, size_t idlen, - ASN1_GENERALIZEDTIME *date, - ASN1_OBJECT *otherTypeId, - ASN1_TYPE *otherType); - -int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, - X509_ALGOR **palg, - ASN1_OCTET_STRING **pid, - ASN1_GENERALIZEDTIME **pdate, - ASN1_OBJECT **potherid, - ASN1_TYPE **pothertype); - -int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, - unsigned char *key, size_t keylen); - -int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, - const unsigned char *id, size_t idlen); - -int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, - unsigned char *pass, - ossl_ssize_t passlen); - -CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, - int iter, int wrap_nid, - int pbe_nid, - unsigned char *pass, - ossl_ssize_t passlen, - const EVP_CIPHER *kekciph); - -int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); -int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); - -int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, - unsigned int flags); -CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); - -int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); -const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); - -CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms); -int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); -int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); -STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); - -CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms); -int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); -int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); -STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); - -int CMS_SignedData_init(CMS_ContentInfo *cms); -CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, - X509 *signer, EVP_PKEY *pk, const EVP_MD *md, - unsigned int flags); -EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si); -EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si); -STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); - -void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); -int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, ASN1_INTEGER **sno); -int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); -int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs, - unsigned int flags); -void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, - X509 **signer, X509_ALGOR **pdig, - X509_ALGOR **psig); -ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); -int CMS_SignerInfo_sign(CMS_SignerInfo *si); -int CMS_SignerInfo_verify(CMS_SignerInfo *si); -int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain); - -int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs); -int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, - int algnid, int keysize); -int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap); - -int CMS_signed_get_attr_count(const CMS_SignerInfo *si); -int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, - int lastpos); -int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc); -X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc); -int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); -int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int type, - const void *bytes, int len); -int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, - int nid, int type, - const void *bytes, int len); -int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, - const char *attrname, int type, - const void *bytes, int len); -void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, - int lastpos, int type); - -int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si); -int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, - int lastpos); -int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int lastpos); -X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc); -X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc); -int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); -int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, - const ASN1_OBJECT *obj, int type, - const void *bytes, int len); -int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, - int nid, int type, - const void *bytes, int len); -int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, - const char *attrname, int type, - const void *bytes, int len); -void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, - int lastpos, int type); - -int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); -CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, - int allorfirst, - STACK_OF(GENERAL_NAMES) - *receiptList, STACK_OF(GENERAL_NAMES) - *receiptsTo); -int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); -void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, - ASN1_STRING **pcid, - int *pallorfirst, - STACK_OF(GENERAL_NAMES) **plist, - STACK_OF(GENERAL_NAMES) **prto); -int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, - X509_ALGOR **palg, - ASN1_OCTET_STRING **pukm); -STACK_OF(CMS_RecipientEncryptedKey) -*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri); - -int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, - X509_ALGOR **pubalg, - ASN1_BIT_STRING **pubkey, - ASN1_OCTET_STRING **keyid, - X509_NAME **issuer, - ASN1_INTEGER **sno); - -int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert); - -int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, - ASN1_OCTET_STRING **keyid, - ASN1_GENERALIZEDTIME **tm, - CMS_OtherKeyAttribute **other, - X509_NAME **issuer, ASN1_INTEGER **sno); -int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, - X509 *cert); -int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); -EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri); -int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, - CMS_RecipientInfo *ri, - CMS_RecipientEncryptedKey *rek); - -int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, - ASN1_OCTET_STRING *ukm, int keylen); - -/* Backward compatibility for spelling errors. */ -# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM -# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \ - CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cmserr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/cmserr.h deleted file mode 100644 index 7dbc13dc..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cmserr.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/comp.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/comp.h deleted file mode 100644 index d814d3cf..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/comp.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 -# define HEADER_COMP_H - -# include - -# ifndef OPENSSL_NO_COMP -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - - - -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); - -int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); -int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); - -COMP_METHOD *COMP_zlib(void); - -#if OPENSSL_API_COMPAT < 0x10100000L -#define COMP_zlib_cleanup() while(0) continue -#endif - -# ifdef HEADER_BIO_H -# ifdef ZLIB -const BIO_METHOD *BIO_f_zlib(void); -# endif -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/comperr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/comperr.h deleted file mode 100644 index 90231e9a..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/comperr.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/conf.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/conf.h deleted file mode 100644 index 7336cd2f..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/conf.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 1995-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_CONF_H -# define HEADER_CONF_H - -# include -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - char *section; - char *name; - char *value; -} CONF_VALUE; - -DEFINE_STACK_OF(CONF_VALUE) -DEFINE_LHASH_OF(CONF_VALUE); - -struct conf_st; -struct conf_method_st; -typedef struct conf_method_st CONF_METHOD; - -struct conf_method_st { - const char *name; - CONF *(*create) (CONF_METHOD *meth); - int (*init) (CONF *conf); - int (*destroy) (CONF *conf); - int (*destroy_data) (CONF *conf); - int (*load_bio) (CONF *conf, BIO *bp, long *eline); - int (*dump) (const CONF *conf, BIO *bp); - int (*is_number) (const CONF *conf, char c); - int (*to_int) (const CONF *conf, char c); - int (*load) (CONF *conf, const char *name, long *eline); -}; - -/* Module definitions */ - -typedef struct conf_imodule_st CONF_IMODULE; -typedef struct conf_module_st CONF_MODULE; - -DEFINE_STACK_OF(CONF_MODULE) -DEFINE_STACK_OF(CONF_IMODULE) - -/* DSO module function typedefs */ -typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); -typedef void conf_finish_func (CONF_IMODULE *md); - -# define CONF_MFLAGS_IGNORE_ERRORS 0x1 -# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 -# define CONF_MFLAGS_SILENT 0x4 -# define CONF_MFLAGS_NO_DSO 0x8 -# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 -# define CONF_MFLAGS_DEFAULT_SECTION 0x20 - -int CONF_set_default_method(CONF_METHOD *meth); -void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); -LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, - long *eline); -# ifndef OPENSSL_NO_STDIO -LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, - long *eline); -# endif -LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, - long *eline); -STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, - const char *section); -char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, - const char *name); -void CONF_free(LHASH_OF(CONF_VALUE) *conf); -#ifndef OPENSSL_NO_STDIO -int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); -#endif -int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); - -DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name)) - -#if OPENSSL_API_COMPAT < 0x10100000L -# define OPENSSL_no_config() \ - OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) -#endif - -/* - * New conf code. The semantics are different from the functions above. If - * that wasn't the case, the above functions would have been replaced - */ - -struct conf_st { - CONF_METHOD *meth; - void *meth_data; - LHASH_OF(CONF_VALUE) *data; -}; - -CONF *NCONF_new(CONF_METHOD *meth); -CONF_METHOD *NCONF_default(void); -CONF_METHOD *NCONF_WIN32(void); -void NCONF_free(CONF *conf); -void NCONF_free_data(CONF *conf); - -int NCONF_load(CONF *conf, const char *file, long *eline); -# ifndef OPENSSL_NO_STDIO -int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); -# endif -int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); -STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, - const char *section); -char *NCONF_get_string(const CONF *conf, const char *group, const char *name); -int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, - long *result); -#ifndef OPENSSL_NO_STDIO -int NCONF_dump_fp(const CONF *conf, FILE *out); -#endif -int NCONF_dump_bio(const CONF *conf, BIO *out); - -#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) - -/* Module functions */ - -int CONF_modules_load(const CONF *cnf, const char *appname, - unsigned long flags); -int CONF_modules_load_file(const char *filename, const char *appname, - unsigned long flags); -void CONF_modules_unload(int all); -void CONF_modules_finish(void); -#if OPENSSL_API_COMPAT < 0x10100000L -# define CONF_modules_free() while(0) continue -#endif -int CONF_module_add(const char *name, conf_init_func *ifunc, - conf_finish_func *ffunc); - -const char *CONF_imodule_get_name(const CONF_IMODULE *md); -const char *CONF_imodule_get_value(const CONF_IMODULE *md); -void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); -void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); -CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); -unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); -void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); -void *CONF_module_get_usr_data(CONF_MODULE *pmod); -void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); - -char *CONF_get1_default_config_file(void); - -int CONF_parse_list(const char *list, int sep, int nospc, - int (*list_cb) (const char *elem, int len, void *usr), - void *arg); - -void OPENSSL_load_builtin_modules(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/conf_api.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/conf_api.h deleted file mode 100644 index a0275ad7..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/conf_api.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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_CONF_API_H -# define HEADER_CONF_API_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Up until OpenSSL 0.9.5a, this was new_section */ -CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); -/* Up until OpenSSL 0.9.5a, this was get_section */ -CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); -/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ -STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, - const char *section); - -int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); -char *_CONF_get_string(const CONF *conf, const char *section, - const char *name); -long _CONF_get_number(const CONF *conf, const char *section, - const char *name); - -int _CONF_new_data(CONF *conf); -void _CONF_free_data(CONF *conf); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/conferr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/conferr.h deleted file mode 100644 index 32b92291..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/conferr.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/crypto.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/crypto.h deleted file mode 100644 index 7d0b5262..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/crypto.h +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_CRYPTO_H -# define HEADER_CRYPTO_H - -# include -# include - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# endif - -# include -# include -# include -# include -# include - -# ifdef CHARSET_EBCDIC -# include -# endif - -/* - * Resolve problems on some operating systems with symbol names that clash - * one way or another - */ -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSLeay OpenSSL_version_num -# define SSLeay_version OpenSSL_version -# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER -# define SSLEAY_VERSION OPENSSL_VERSION -# define SSLEAY_CFLAGS OPENSSL_CFLAGS -# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON -# define SSLEAY_PLATFORM OPENSSL_PLATFORM -# define SSLEAY_DIR OPENSSL_DIR - -/* - * Old type for allocating dynamic locks. No longer used. Use the new thread - * API instead. - */ -typedef struct { - int dummy; -} CRYPTO_dynlock; - -# endif /* OPENSSL_API_COMPAT */ - -typedef void CRYPTO_RWLOCK; - -CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void); -int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock); -int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock); -int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock); -void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock); - -int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock); - -/* - * The following can be used to detect memory leaks in the library. If - * used, it turns on malloc checking - */ -# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */ -# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */ -# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */ -# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */ - -struct crypto_ex_data_st { - STACK_OF(void) *sk; -}; -DEFINE_STACK_OF(void) - -/* - * Per class, we have a STACK of function pointers. - */ -# define CRYPTO_EX_INDEX_SSL 0 -# define CRYPTO_EX_INDEX_SSL_CTX 1 -# define CRYPTO_EX_INDEX_SSL_SESSION 2 -# define CRYPTO_EX_INDEX_X509 3 -# define CRYPTO_EX_INDEX_X509_STORE 4 -# define CRYPTO_EX_INDEX_X509_STORE_CTX 5 -# define CRYPTO_EX_INDEX_DH 6 -# define CRYPTO_EX_INDEX_DSA 7 -# define CRYPTO_EX_INDEX_EC_KEY 8 -# define CRYPTO_EX_INDEX_RSA 9 -# define CRYPTO_EX_INDEX_ENGINE 10 -# define CRYPTO_EX_INDEX_UI 11 -# define CRYPTO_EX_INDEX_BIO 12 -# define CRYPTO_EX_INDEX_APP 13 -# define CRYPTO_EX_INDEX_UI_METHOD 14 -# define CRYPTO_EX_INDEX_DRBG 15 -# define CRYPTO_EX_INDEX__COUNT 16 - -/* No longer needed, so this is a no-op */ -#define OPENSSL_malloc_init() while(0) continue - -int CRYPTO_mem_ctrl(int mode); - -# define OPENSSL_malloc(num) \ - CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_zalloc(num) \ - CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_realloc(addr, num) \ - CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_clear_realloc(addr, old_num, num) \ - CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_clear_free(addr, num) \ - CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_free(addr) \ - CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_memdup(str, s) \ - CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_strdup(str) \ - CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_strndup(str, n) \ - CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_malloc(num) \ - CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_zalloc(num) \ - CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_free(addr) \ - CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_clear_free(addr, num) \ - CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_secure_actual_size(ptr) \ - CRYPTO_secure_actual_size(ptr) - -size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz); -size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz); -size_t OPENSSL_strnlen(const char *str, size_t maxlen); -char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len); -unsigned char *OPENSSL_hexstr2buf(const char *str, long *len); -int OPENSSL_hexchar2int(unsigned char c); - -# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type)) - -unsigned long OpenSSL_version_num(void); -const char *OpenSSL_version(int type); -# define OPENSSL_VERSION 0 -# define OPENSSL_CFLAGS 1 -# define OPENSSL_BUILT_ON 2 -# define OPENSSL_PLATFORM 3 -# define OPENSSL_DIR 4 -# define OPENSSL_ENGINES_DIR 5 - -int OPENSSL_issetugid(void); - -typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); -typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); -typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, - void *from_d, int idx, long argl, void *argp); -__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, - CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); -/* No longer use an index. */ -int CRYPTO_free_ex_index(int class_index, int idx); - -/* - * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a - * given class (invokes whatever per-class callbacks are applicable) - */ -int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); -int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, - const CRYPTO_EX_DATA *from); - -void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); - -/* - * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular - * index (relative to the class type involved) - */ -int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); -void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); - -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * This function cleans up all "ex_data" state. It mustn't be called under - * potential race-conditions. - */ -# define CRYPTO_cleanup_all_ex_data() while(0) continue - -/* - * The old locking functions have been removed completely without compatibility - * macros. This is because the old functions either could not properly report - * errors, or the returned error values were not clearly documented. - * Replacing the locking functions with no-ops would cause race condition - * issues in the affected applications. It is far better for them to fail at - * compile time. - * On the other hand, the locking callbacks are no longer used. Consequently, - * the callback management functions can be safely replaced with no-op macros. - */ -# define CRYPTO_num_locks() (1) -# define CRYPTO_set_locking_callback(func) -# define CRYPTO_get_locking_callback() (NULL) -# define CRYPTO_set_add_lock_callback(func) -# define CRYPTO_get_add_lock_callback() (NULL) - -/* - * These defines where used in combination with the old locking callbacks, - * they are not called anymore, but old code that's not called might still - * use them. - */ -# define CRYPTO_LOCK 1 -# define CRYPTO_UNLOCK 2 -# define CRYPTO_READ 4 -# define CRYPTO_WRITE 8 - -/* This structure is no longer used */ -typedef struct crypto_threadid_st { - int dummy; -} CRYPTO_THREADID; -/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ -# define CRYPTO_THREADID_set_numeric(id, val) -# define CRYPTO_THREADID_set_pointer(id, ptr) -# define CRYPTO_THREADID_set_callback(threadid_func) (0) -# define CRYPTO_THREADID_get_callback() (NULL) -# define CRYPTO_THREADID_current(id) -# define CRYPTO_THREADID_cmp(a, b) (-1) -# define CRYPTO_THREADID_cpy(dest, src) -# define CRYPTO_THREADID_hash(id) (0UL) - -# if OPENSSL_API_COMPAT < 0x10000000L -# define CRYPTO_set_id_callback(func) -# define CRYPTO_get_id_callback() (NULL) -# define CRYPTO_thread_id() (0UL) -# endif /* OPENSSL_API_COMPAT < 0x10000000L */ - -# define CRYPTO_set_dynlock_create_callback(dyn_create_function) -# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function) -# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function) -# define CRYPTO_get_dynlock_create_callback() (NULL) -# define CRYPTO_get_dynlock_lock_callback() (NULL) -# define CRYPTO_get_dynlock_destroy_callback() (NULL) -# endif /* OPENSSL_API_COMPAT < 0x10100000L */ - -int CRYPTO_set_mem_functions( - void *(*m) (size_t, const char *, int), - void *(*r) (void *, size_t, const char *, int), - void (*f) (void *, const char *, int)); -int CRYPTO_set_mem_debug(int flag); -void CRYPTO_get_mem_functions( - void *(**m) (size_t, const char *, int), - void *(**r) (void *, size_t, const char *, int), - void (**f) (void *, const char *, int)); - -void *CRYPTO_malloc(size_t num, const char *file, int line); -void *CRYPTO_zalloc(size_t num, const char *file, int line); -void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); -char *CRYPTO_strdup(const char *str, const char *file, int line); -char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); -void CRYPTO_free(void *ptr, const char *file, int line); -void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line); -void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); -void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num, - const char *file, int line); - -int CRYPTO_secure_malloc_init(size_t sz, int minsize); -int CRYPTO_secure_malloc_done(void); -void *CRYPTO_secure_malloc(size_t num, const char *file, int line); -void *CRYPTO_secure_zalloc(size_t num, const char *file, int line); -void CRYPTO_secure_free(void *ptr, const char *file, int line); -void CRYPTO_secure_clear_free(void *ptr, size_t num, - const char *file, int line); -int CRYPTO_secure_allocated(const void *ptr); -int CRYPTO_secure_malloc_initialized(void); -size_t CRYPTO_secure_actual_size(void *ptr); -size_t CRYPTO_secure_used(void); - -void OPENSSL_cleanse(void *ptr, size_t len); - -# ifndef OPENSSL_NO_CRYPTO_MDEBUG -# define OPENSSL_mem_debug_push(info) \ - CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE) -# define OPENSSL_mem_debug_pop() \ - CRYPTO_mem_debug_pop() -int CRYPTO_mem_debug_push(const char *info, const char *file, int line); -int CRYPTO_mem_debug_pop(void); -void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount); - -/*- - * Debugging functions (enabled by CRYPTO_set_mem_debug(1)) - * The flag argument has the following significance: - * 0: called before the actual memory allocation has taken place - * 1: called after the actual memory allocation has taken place - */ -void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag, - const char *file, int line); -void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag, - const char *file, int line); -void CRYPTO_mem_debug_free(void *addr, int flag, - const char *file, int line); - -int CRYPTO_mem_leaks_cb(int (*cb) (const char *str, size_t len, void *u), - void *u); -# ifndef OPENSSL_NO_STDIO -int CRYPTO_mem_leaks_fp(FILE *); -# endif -int CRYPTO_mem_leaks(BIO *bio); -# endif - -/* die if we have to */ -ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line); -# if OPENSSL_API_COMPAT < 0x10100000L -# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l)) -# endif -# define OPENSSL_assert(e) \ - (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1)) - -int OPENSSL_isservice(void); - -int FIPS_mode(void); -int FIPS_mode_set(int r); - -void OPENSSL_init(void); -# ifdef OPENSSL_SYS_UNIX -void OPENSSL_fork_prepare(void); -void OPENSSL_fork_parent(void); -void OPENSSL_fork_child(void); -# endif - -struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); -int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); -int OPENSSL_gmtime_diff(int *pday, int *psec, - const struct tm *from, const struct tm *to); - -/* - * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. - * It takes an amount of time dependent on |len|, but independent of the - * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements - * into a defined order as the return value when a != b is undefined, other - * than to be non-zero. - */ -int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len); - -/* Standard initialisation options */ -# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L -# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L -# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L -# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L -# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L -# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L -# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L -# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L -# define OPENSSL_INIT_ASYNC 0x00000100L -# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L -# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L -# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L -# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L -# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L -# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L -# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L -/* OPENSSL_INIT_ZLIB 0x00010000L */ -# define OPENSSL_INIT_ATFORK 0x00020000L -/* OPENSSL_INIT_BASE_ONLY 0x00040000L */ -# define OPENSSL_INIT_NO_ATEXIT 0x00080000L -/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */ -/* Max OPENSSL_INIT flag value is 0x80000000 */ - -/* openssl and dasync not counted as builtin */ -# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \ - (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \ - | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \ - OPENSSL_INIT_ENGINE_PADLOCK) - - -/* Library initialisation functions */ -void OPENSSL_cleanup(void); -int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); -int OPENSSL_atexit(void (*handler)(void)); -void OPENSSL_thread_stop(void); - -/* Low-level control of initialization */ -OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void); -# ifndef OPENSSL_NO_STDIO -int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, - const char *config_filename); -void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, - unsigned long flags); -int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, - const char *config_appname); -# endif -void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings); - -# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) -# if defined(_WIN32) -# if defined(BASETYPES) || defined(_WINDEF_H) -/* application has to include in order to use this */ -typedef DWORD CRYPTO_THREAD_LOCAL; -typedef DWORD CRYPTO_THREAD_ID; - -typedef LONG CRYPTO_ONCE; -# define CRYPTO_ONCE_STATIC_INIT 0 -# endif -# else -# include -typedef pthread_once_t CRYPTO_ONCE; -typedef pthread_key_t CRYPTO_THREAD_LOCAL; -typedef pthread_t CRYPTO_THREAD_ID; - -# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT -# endif -# endif - -# if !defined(CRYPTO_ONCE_STATIC_INIT) -typedef unsigned int CRYPTO_ONCE; -typedef unsigned int CRYPTO_THREAD_LOCAL; -typedef unsigned int CRYPTO_THREAD_ID; -# define CRYPTO_ONCE_STATIC_INIT 0 -# endif - -int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)); - -int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)); -void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key); -int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val); -int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key); - -CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void); -int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cryptoerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/cryptoerr.h deleted file mode 100644 index 3db5a4ee..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cryptoerr.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ct.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ct.h deleted file mode 100644 index ebdba34d..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ct.h +++ /dev/null @@ -1,474 +0,0 @@ -/* - * 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 - -# ifndef OPENSSL_NO_CT -# include -# include -# include -# include -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cterr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/cterr.h deleted file mode 100644 index feb7bc56..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/cterr.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/des.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/des.h deleted file mode 100644 index be4abbdf..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/des.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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_DES_H -# define HEADER_DES_H - -# include - -# ifndef OPENSSL_NO_DES -# ifdef __cplusplus -extern "C" { -# endif -# include - -typedef unsigned int DES_LONG; - -# ifdef OPENSSL_BUILD_SHLIBCRYPTO -# undef OPENSSL_EXTERN -# define OPENSSL_EXTERN OPENSSL_EXPORT -# endif - -typedef unsigned char DES_cblock[8]; -typedef /* const */ unsigned char const_DES_cblock[8]; -/* - * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and - * const_DES_cblock * are incompatible pointer types. - */ - -typedef struct DES_ks { - union { - DES_cblock cblock; - /* - * make sure things are correct size on machines with 8 byte longs - */ - DES_LONG deslong[2]; - } ks[16]; -} DES_key_schedule; - -# define DES_KEY_SZ (sizeof(DES_cblock)) -# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) - -# define DES_ENCRYPT 1 -# define DES_DECRYPT 0 - -# define DES_CBC_MODE 0 -# define DES_PCBC_MODE 1 - -# 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)) - -OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */ -# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) - -const char *DES_options(void); -void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, int enc); -DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, - long length, DES_key_schedule *schedule, - const_DES_cblock *ivec); -/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ -void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, const_DES_cblock *inw, - const_DES_cblock *outw, int enc); -void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, - DES_key_schedule *ks, int enc); - -/* - * This is the DES encryption function that gets called by just about every - * other DES routine in the library. You should not use this function except - * to implement 'modes' of DES. I say this because the functions that call - * this routine do the conversion from 'char *' to long, and this needs to be - * done to make sure 'non-aligned' memory access do not occur. The - * characters are loaded 'little endian'. Data is a pointer to 2 unsigned - * long's and ks is the DES_key_schedule to use. enc, is non zero specifies - * encryption, zero if decryption. - */ -void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); - -/* - * This functions is the same as DES_encrypt1() except that the DES initial - * permutation (IP) and final permutation (FP) have been left out. As for - * DES_encrypt1(), you should not use this function. It is used by the - * routines in the library that implement triple DES. IP() DES_encrypt2() - * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() - * DES_encrypt1() DES_encrypt1() except faster :-). - */ -void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); - -void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3); -void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, - long length, - DES_key_schedule *ks1, DES_key_schedule *ks2, - DES_key_schedule *ks3, DES_cblock *ivec, int enc); -void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num, int enc); -void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, - int numbits, long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int enc); -void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *ks1, - DES_key_schedule *ks2, DES_key_schedule *ks3, - DES_cblock *ivec, int *num); -char *DES_fcrypt(const char *buf, const char *salt, char *ret); -char *DES_crypt(const char *buf, const char *salt); -void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, - long length, DES_key_schedule *schedule, - DES_cblock *ivec); -void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int enc); -DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], - long length, int out_count, DES_cblock *seed); -int DES_random_key(DES_cblock *ret); -void DES_set_odd_parity(DES_cblock *key); -int DES_check_key_parity(const_DES_cblock *key); -int DES_is_weak_key(const_DES_cblock *key); -/* - * DES_set_key (= set_key = DES_key_sched = key_sched) calls - * DES_set_key_checked if global variable DES_check_key is set, - * DES_set_key_unchecked otherwise. - */ -int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); -int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); -int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); -void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); -void DES_string_to_key(const char *str, DES_cblock *key); -void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); -void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int *num, int enc); -void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, DES_key_schedule *schedule, - DES_cblock *ivec, int *num); - -# define DES_fixup_key_parity DES_set_odd_parity - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dh.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/dh.h deleted file mode 100644 index 3527540c..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dh.h +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright 1995-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_DH_H -# define HEADER_DH_H - -# include - -# ifndef OPENSSL_NO_DH -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include - -# ifdef __cplusplus -extern "C" { -# endif - -# ifndef OPENSSL_DH_MAX_MODULUS_BITS -# define OPENSSL_DH_MAX_MODULUS_BITS 10000 -# endif - -# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 - -# define DH_FLAG_CACHE_MONT_P 0x01 - -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define DH_FLAG_NO_EXP_CONSTTIME 0x00 -# endif - -/* - * If this flag is set the DH method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define DH_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define DH_FLAG_NON_FIPS_ALLOW 0x0400 - -/* Already defined in ossl_typ.h */ -/* typedef struct dh_st DH; */ -/* typedef struct dh_method DH_METHOD; */ - -DECLARE_ASN1_ITEM(DHparams) - -# define DH_GENERATOR_2 2 -/* #define DH_GENERATOR_3 3 */ -# define DH_GENERATOR_5 5 - -/* DH_check error codes */ -# define DH_CHECK_P_NOT_PRIME 0x01 -# define DH_CHECK_P_NOT_SAFE_PRIME 0x02 -# define DH_UNABLE_TO_CHECK_GENERATOR 0x04 -# define DH_NOT_SUITABLE_GENERATOR 0x08 -# define DH_CHECK_Q_NOT_PRIME 0x10 -# define DH_CHECK_INVALID_Q_VALUE 0x20 -# define DH_CHECK_INVALID_J_VALUE 0x40 - -/* DH_check_pub_key error codes */ -# define DH_CHECK_PUBKEY_TOO_SMALL 0x01 -# define DH_CHECK_PUBKEY_TOO_LARGE 0x02 -# define DH_CHECK_PUBKEY_INVALID 0x04 - -/* - * primes p where (p-1)/2 is prime too are called "safe"; we define this for - * backward compatibility: - */ -# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME - -# define d2i_DHparams_fp(fp,x) \ - (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ - (char *(*)())d2i_DHparams, \ - (fp), \ - (unsigned char **)(x)) -# define i2d_DHparams_fp(fp,x) \ - ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x)) -# define d2i_DHparams_bio(bp,x) \ - ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) -# define i2d_DHparams_bio(bp,x) \ - ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) - -# define d2i_DHxparams_fp(fp,x) \ - (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ - (char *(*)())d2i_DHxparams, \ - (fp), \ - (unsigned char **)(x)) -# define i2d_DHxparams_fp(fp,x) \ - ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x)) -# define d2i_DHxparams_bio(bp,x) \ - ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) -# define i2d_DHxparams_bio(bp,x) \ - ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x) - -DH *DHparams_dup(DH *); - -const DH_METHOD *DH_OpenSSL(void); - -void DH_set_default_method(const DH_METHOD *meth); -const DH_METHOD *DH_get_default_method(void); -int DH_set_method(DH *dh, const DH_METHOD *meth); -DH *DH_new_method(ENGINE *engine); - -DH *DH_new(void); -void DH_free(DH *dh); -int DH_up_ref(DH *dh); -int DH_bits(const DH *dh); -int DH_size(const DH *dh); -int DH_security_bits(const DH *dh); -#define DH_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef) -int DH_set_ex_data(DH *d, int idx, void *arg); -void *DH_get_ex_data(DH *d, int idx); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator, - void (*callback) (int, int, - void *), - void *cb_arg)) - -/* New version */ -int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, - BN_GENCB *cb); - -int DH_check_params_ex(const DH *dh); -int DH_check_ex(const DH *dh); -int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key); -int DH_check_params(const DH *dh, int *ret); -int DH_check(const DH *dh, int *codes); -int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes); -int DH_generate_key(DH *dh); -int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); -int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh); -DH *d2i_DHparams(DH **a, const unsigned char **pp, long length); -int i2d_DHparams(const DH *a, unsigned char **pp); -DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length); -int i2d_DHxparams(const DH *a, unsigned char **pp); -# ifndef OPENSSL_NO_STDIO -int DHparams_print_fp(FILE *fp, const DH *x); -# endif -int DHparams_print(BIO *bp, const DH *x); - -/* RFC 5114 parameters */ -DH *DH_get_1024_160(void); -DH *DH_get_2048_224(void); -DH *DH_get_2048_256(void); - -/* Named parameters, currently RFC7919 */ -DH *DH_new_by_nid(int nid); -int DH_get_nid(const DH *dh); - -# ifndef OPENSSL_NO_CMS -/* RFC2631 KDF */ -int DH_KDF_X9_42(unsigned char *out, size_t outlen, - const unsigned char *Z, size_t Zlen, - ASN1_OBJECT *key_oid, - const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); -# endif - -void DH_get0_pqg(const DH *dh, - const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); -void DH_get0_key(const DH *dh, - const BIGNUM **pub_key, const BIGNUM **priv_key); -int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); -const BIGNUM *DH_get0_p(const DH *dh); -const BIGNUM *DH_get0_q(const DH *dh); -const BIGNUM *DH_get0_g(const DH *dh); -const BIGNUM *DH_get0_priv_key(const DH *dh); -const BIGNUM *DH_get0_pub_key(const DH *dh); -void DH_clear_flags(DH *dh, int flags); -int DH_test_flags(const DH *dh, int flags); -void DH_set_flags(DH *dh, int flags); -ENGINE *DH_get0_engine(DH *d); -long DH_get_length(const DH *dh); -int DH_set_length(DH *dh, long length); - -DH_METHOD *DH_meth_new(const char *name, int flags); -void DH_meth_free(DH_METHOD *dhm); -DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); -const char *DH_meth_get0_name(const DH_METHOD *dhm); -int DH_meth_set1_name(DH_METHOD *dhm, const char *name); -int DH_meth_get_flags(const DH_METHOD *dhm); -int DH_meth_set_flags(DH_METHOD *dhm, int flags); -void *DH_meth_get0_app_data(const DH_METHOD *dhm); -int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); -int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); -int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); -int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) - (unsigned char *key, const BIGNUM *pub_key, DH *dh); -int DH_meth_set_compute_key(DH_METHOD *dhm, - int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); -int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) - (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - BN_CTX *, BN_MONT_CTX *); -int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, - int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); -int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); -int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); -int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); -int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); -int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) - (DH *, int, int, BN_GENCB *); -int DH_meth_set_generate_params(DH_METHOD *dhm, - int (*generate_params) (DH *, int, int, BN_GENCB *)); - - -# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL) - -# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) - -# define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) - -# define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) - -# define EVP_PKEY_CTX_set_dh_nid(ctx, nid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, \ - EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_DH_NID, nid, NULL) - -# define EVP_PKEY_CTX_set_dh_pad(ctx, pad) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_PAD, pad, NULL) - -# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL) - -# define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL) - -# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)(oid)) - -# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)(poid)) - -# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)(plen)) - -# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)(p)) - -# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)(p)) - -# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) -# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) -# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) -# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) -# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) -# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) -# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15) -# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16) - -/* KDF types */ -# define EVP_PKEY_DH_KDF_NONE 1 -# ifndef OPENSSL_NO_CMS -# define EVP_PKEY_DH_KDF_X9_42 2 -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dherr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/dherr.h deleted file mode 100644 index 916b3bed..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dherr.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dsa.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/dsa.h deleted file mode 100644 index 6d8a18a4..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dsa.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 1995-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_DSA_H -# define HEADER_DSA_H - -# include - -# ifndef OPENSSL_NO_DSA -# ifdef __cplusplus -extern "C" { -# endif -# include -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include - -# ifndef OPENSSL_DSA_MAX_MODULUS_BITS -# define OPENSSL_DSA_MAX_MODULUS_BITS 10000 -# endif - -# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 - -# define DSA_FLAG_CACHE_MONT_P 0x01 -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define DSA_FLAG_NO_EXP_CONSTTIME 0x00 -# endif - -/* - * If this flag is set the DSA method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define DSA_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define DSA_FLAG_NON_FIPS_ALLOW 0x0400 -# define DSA_FLAG_FIPS_CHECKED 0x0800 - -/* Already defined in ossl_typ.h */ -/* typedef struct dsa_st DSA; */ -/* typedef struct dsa_method DSA_METHOD; */ - -typedef struct DSA_SIG_st DSA_SIG; - -# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ - (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) -# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ - (unsigned char *)(x)) -# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) -# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) - -DSA *DSAparams_dup(DSA *x); -DSA_SIG *DSA_SIG_new(void); -void DSA_SIG_free(DSA_SIG *a); -int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); -DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); -void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); -int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); - -DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); -int DSA_do_verify(const unsigned char *dgst, int dgst_len, - DSA_SIG *sig, DSA *dsa); - -const DSA_METHOD *DSA_OpenSSL(void); - -void DSA_set_default_method(const DSA_METHOD *); -const DSA_METHOD *DSA_get_default_method(void); -int DSA_set_method(DSA *dsa, const DSA_METHOD *); -const DSA_METHOD *DSA_get_method(DSA *d); - -DSA *DSA_new(void); -DSA *DSA_new_method(ENGINE *engine); -void DSA_free(DSA *r); -/* "up" the DSA object's reference count */ -int DSA_up_ref(DSA *r); -int DSA_size(const DSA *); -int DSA_bits(const DSA *d); -int DSA_security_bits(const DSA *d); - /* next 4 return -1 on error */ -DEPRECATEDIN_1_2_0(int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)) -int DSA_sign(int type, const unsigned char *dgst, int dlen, - unsigned char *sig, unsigned int *siglen, DSA *dsa); -int DSA_verify(int type, const unsigned char *dgst, int dgst_len, - const unsigned char *sigbuf, int siglen, DSA *dsa); -#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef) -int DSA_set_ex_data(DSA *d, int idx, void *arg); -void *DSA_get_ex_data(DSA *d, int idx); - -DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); -DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); -DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits, - unsigned char *seed, - int seed_len, - int *counter_ret, - unsigned long *h_ret, void - (*callback) (int, int, - void *), - void *cb_arg)) - -/* New version */ -int DSA_generate_parameters_ex(DSA *dsa, int bits, - const unsigned char *seed, int seed_len, - int *counter_ret, unsigned long *h_ret, - BN_GENCB *cb); - -int DSA_generate_key(DSA *a); -int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); -int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); -int i2d_DSAparams(const DSA *a, unsigned char **pp); - -int DSAparams_print(BIO *bp, const DSA *x); -int DSA_print(BIO *bp, const DSA *x, int off); -# ifndef OPENSSL_NO_STDIO -int DSAparams_print_fp(FILE *fp, const DSA *x); -int DSA_print_fp(FILE *bp, const DSA *x, int off); -# endif - -# define DSS_prime_checks 64 -/* - * Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only - * have one value here we set the number of checks to 64 which is the 128 bit - * security level that is the highest level and valid for creating a 3072 bit - * DSA key. - */ -# define DSA_is_prime(n, callback, cb_arg) \ - BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) - -# ifndef OPENSSL_NO_DH -/* - * Convert DSA structure (key or just parameters) into DH structure (be - * careful to avoid small subgroup attacks when using this!) - */ -DH *DSA_dup_DH(const DSA *r); -# endif - -# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) -# define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits, NULL) -# define EVP_PKEY_CTX_set_dsa_paramgen_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ - EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) - -void DSA_get0_pqg(const DSA *d, - const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); -void DSA_get0_key(const DSA *d, - const BIGNUM **pub_key, const BIGNUM **priv_key); -int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); -const BIGNUM *DSA_get0_p(const DSA *d); -const BIGNUM *DSA_get0_q(const DSA *d); -const BIGNUM *DSA_get0_g(const DSA *d); -const BIGNUM *DSA_get0_pub_key(const DSA *d); -const BIGNUM *DSA_get0_priv_key(const DSA *d); -void DSA_clear_flags(DSA *d, int flags); -int DSA_test_flags(const DSA *d, int flags); -void DSA_set_flags(DSA *d, int flags); -ENGINE *DSA_get0_engine(DSA *d); - -DSA_METHOD *DSA_meth_new(const char *name, int flags); -void DSA_meth_free(DSA_METHOD *dsam); -DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam); -const char *DSA_meth_get0_name(const DSA_METHOD *dsam); -int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name); -int DSA_meth_get_flags(const DSA_METHOD *dsam); -int DSA_meth_set_flags(DSA_METHOD *dsam, int flags); -void *DSA_meth_get0_app_data(const DSA_METHOD *dsam); -int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data); -DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam)) - (const unsigned char *, int, DSA *); -int DSA_meth_set_sign(DSA_METHOD *dsam, - DSA_SIG *(*sign) (const unsigned char *, int, DSA *)); -int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam)) - (DSA *, BN_CTX *, BIGNUM **, BIGNUM **); -int DSA_meth_set_sign_setup(DSA_METHOD *dsam, - int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)); -int (*DSA_meth_get_verify(const DSA_METHOD *dsam)) - (const unsigned char *, int, DSA_SIG *, DSA *); -int DSA_meth_set_verify(DSA_METHOD *dsam, - int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *)); -int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam)) - (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); -int DSA_meth_set_mod_exp(DSA_METHOD *dsam, - int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, - BN_MONT_CTX *)); -int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam)) - (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, - BN_CTX *, BN_MONT_CTX *); -int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, - int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, - const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); -int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *); -int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *)); -int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *); -int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *)); -int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam)) - (DSA *, int, const unsigned char *, int, int *, unsigned long *, - BN_GENCB *); -int DSA_meth_set_paramgen(DSA_METHOD *dsam, - int (*paramgen) (DSA *, int, const unsigned char *, int, int *, - unsigned long *, BN_GENCB *)); -int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *); -int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *)); - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dsaerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/dsaerr.h deleted file mode 100644 index 495a1ac8..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dsaerr.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dtls1.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/dtls1.h deleted file mode 100644 index d55ca9c3..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/dtls1.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2005-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_DTLS1_H -# define HEADER_DTLS1_H - -#ifdef __cplusplus -extern "C" { -#endif - -# define DTLS1_VERSION 0xFEFF -# define DTLS1_2_VERSION 0xFEFD -# define DTLS_MIN_VERSION DTLS1_VERSION -# define DTLS_MAX_VERSION DTLS1_2_VERSION -# define DTLS1_VERSION_MAJOR 0xFE - -# define DTLS1_BAD_VER 0x0100 - -/* Special value for method supporting multiple versions */ -# define DTLS_ANY_VERSION 0x1FFFF - -/* lengths of messages */ -/* - * Actually the max cookie length in DTLS is 255. But we can't change this now - * due to compatibility concerns. - */ -# define DTLS1_COOKIE_LENGTH 256 - -# define DTLS1_RT_HEADER_LENGTH 13 - -# define DTLS1_HM_HEADER_LENGTH 12 - -# define DTLS1_HM_BAD_FRAGMENT -2 -# define DTLS1_HM_FRAGMENT_RETRY -3 - -# define DTLS1_CCS_HEADER_LENGTH 1 - -# define DTLS1_AL_HEADER_LENGTH 2 - -/* Timeout multipliers */ -# define DTLS1_TMO_READ_COUNT 2 -# define DTLS1_TMO_WRITE_COUNT 2 - -# define DTLS1_TMO_ALERT_COUNT 12 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/e_os2.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/e_os2.h deleted file mode 100644 index 97a776cd..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/e_os2.h +++ /dev/null @@ -1,300 +0,0 @@ -/* - * 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_E_OS2_H -# define HEADER_E_OS2_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/****************************************************************************** - * Detect operating systems. This probably needs completing. - * The result is that at least one OPENSSL_SYS_os macro should be defined. - * However, if none is defined, Unix is assumed. - **/ - -# define OPENSSL_SYS_UNIX - -/* --------------------- Microsoft operating systems ---------------------- */ - -/* - * Note that MSDOS actually denotes 32-bit environments running on top of - * MS-DOS, such as DJGPP one. - */ -# if defined(OPENSSL_SYS_MSDOS) -# undef OPENSSL_SYS_UNIX -# endif - -/* - * For 32 bit environment, there seems to be the CygWin environment and then - * all the others that try to do the same thing Microsoft does... - */ -/* - * UEFI lives here because it might be built with a Microsoft toolchain and - * we need to avoid the false positive match on Windows. - */ -# if defined(OPENSSL_SYS_UEFI) -# undef OPENSSL_SYS_UNIX -# elif defined(OPENSSL_SYS_UWIN) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WIN32_UWIN -# else -# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN) -# define OPENSSL_SYS_WIN32_CYGWIN -# else -# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32) -# undef OPENSSL_SYS_UNIX -# if !defined(OPENSSL_SYS_WIN32) -# define OPENSSL_SYS_WIN32 -# endif -# endif -# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64) -# undef OPENSSL_SYS_UNIX -# if !defined(OPENSSL_SYS_WIN64) -# define OPENSSL_SYS_WIN64 -# endif -# endif -# if defined(OPENSSL_SYS_WINNT) -# undef OPENSSL_SYS_UNIX -# endif -# if defined(OPENSSL_SYS_WINCE) -# undef OPENSSL_SYS_UNIX -# endif -# endif -# endif - -/* Anything that tries to look like Microsoft is "Windows" */ -# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) -# undef OPENSSL_SYS_UNIX -# define OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_SYS_MSDOS -# define OPENSSL_SYS_MSDOS -# endif -# endif - -/* - * DLL settings. This part is a bit tough, because it's up to the - * application implementor how he or she will link the application, so it - * requires some macro to be used. - */ -# ifdef OPENSSL_SYS_WINDOWS -# ifndef OPENSSL_OPT_WINDLL -# if defined(_WINDLL) /* This is used when building OpenSSL to - * indicate that DLL linkage should be used */ -# define OPENSSL_OPT_WINDLL -# endif -# endif -# endif - -/* ------------------------------- OpenVMS -------------------------------- */ -# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS) -# if !defined(OPENSSL_SYS_VMS) -# undef OPENSSL_SYS_UNIX -# endif -# define OPENSSL_SYS_VMS -# if defined(__DECC) -# define OPENSSL_SYS_VMS_DECC -# elif defined(__DECCXX) -# define OPENSSL_SYS_VMS_DECC -# define OPENSSL_SYS_VMS_DECCXX -# else -# define OPENSSL_SYS_VMS_NODECC -# endif -# endif - -/* -------------------------------- Unix ---------------------------------- */ -# ifdef OPENSSL_SYS_UNIX -# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX) -# define OPENSSL_SYS_LINUX -# endif -# if defined(_AIX) && !defined(OPENSSL_SYS_AIX) -# define OPENSSL_SYS_AIX -# endif -# endif - -/* -------------------------------- VOS ----------------------------------- */ -# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS) -# define OPENSSL_SYS_VOS -# ifdef __HPPA__ -# define OPENSSL_SYS_VOS_HPPA -# endif -# ifdef __IA32__ -# define OPENSSL_SYS_VOS_IA32 -# endif -# endif - -/** - * That's it for OS-specific stuff - *****************************************************************************/ - -/* Specials for I/O an exit */ -# ifdef OPENSSL_SYS_MSDOS -# define OPENSSL_UNISTD_IO -# define OPENSSL_DECLARE_EXIT extern void exit(int); -# else -# define OPENSSL_UNISTD_IO OPENSSL_UNISTD -# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ -# endif - -/*- - * OPENSSL_EXTERN is normally used to declare a symbol with possible extra - * attributes to handle its presence in a shared library. - * OPENSSL_EXPORT is used to define a symbol with extra possible attributes - * to make it visible in a shared library. - * Care needs to be taken when a header file is used both to declare and - * define symbols. Basically, for any library that exports some global - * variables, the following code must be present in the header file that - * declares them, before OPENSSL_EXTERN is used: - * - * #ifdef SOME_BUILD_FLAG_MACRO - * # undef OPENSSL_EXTERN - * # define OPENSSL_EXTERN OPENSSL_EXPORT - * #endif - * - * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN - * have some generally sensible values. - */ - -# if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) -# define OPENSSL_EXPORT extern __declspec(dllexport) -# define OPENSSL_EXTERN extern __declspec(dllimport) -# else -# define OPENSSL_EXPORT extern -# define OPENSSL_EXTERN extern -# endif - -/*- - * Macros to allow global variables to be reached through function calls when - * required (if a shared library version requires it, for example. - * The way it's done allows definitions like this: - * - * // in foobar.c - * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) - * // in foobar.h - * OPENSSL_DECLARE_GLOBAL(int,foobar); - * #define foobar OPENSSL_GLOBAL_REF(foobar) - */ -# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ - type *_shadow_##name(void) \ - { static type _hide_##name=value; return &_hide_##name; } -# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) -# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) -# else -# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) type _shadow_##name=value; -# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name -# define OPENSSL_GLOBAL_REF(name) _shadow_##name -# endif - -# ifdef _WIN32 -# ifdef _WIN64 -# define ossl_ssize_t __int64 -# define OSSL_SSIZE_MAX _I64_MAX -# else -# define ossl_ssize_t int -# define OSSL_SSIZE_MAX INT_MAX -# endif -# endif - -# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t) -# define ossl_ssize_t INTN -# define OSSL_SSIZE_MAX MAX_INTN -# endif - -# ifndef ossl_ssize_t -# define ossl_ssize_t ssize_t -# if defined(SSIZE_MAX) -# define OSSL_SSIZE_MAX SSIZE_MAX -# elif defined(_POSIX_SSIZE_MAX) -# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX -# else -# define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1)) -# endif -# endif - -# ifdef DEBUG_UNUSED -# define __owur __attribute__((__warn_unused_result__)) -# else -# define __owur -# endif - -/* Standard integer types */ -# if defined(OPENSSL_SYS_UEFI) -typedef INT8 int8_t; -typedef UINT8 uint8_t; -typedef INT16 int16_t; -typedef UINT16 uint16_t; -typedef INT32 int32_t; -typedef UINT32 uint32_t; -typedef INT64 int64_t; -typedef UINT64 uint64_t; -# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ - defined(__osf__) || defined(__sgi) || defined(__hpux) || \ - defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__) -# include -# elif defined(_MSC_VER) && _MSC_VER<=1500 -/* - * minimally required typdefs for systems not supporting inttypes.h or - * stdint.h: currently just older VC++ - */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -# else -# include -# endif - -/* ossl_inline: portable inline definition usable in public headers */ -# if !defined(inline) && !defined(__cplusplus) -# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L - /* just use inline */ -# define ossl_inline inline -# elif defined(__GNUC__) && __GNUC__>=2 -# define ossl_inline __inline__ -# elif defined(_MSC_VER) - /* - * Visual Studio: inline is available in C++ only, however - * __inline is available for C, see - * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx - */ -# define ossl_inline __inline -# else -# define ossl_inline -# endif -# else -# define ossl_inline inline -# endif - -# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -# define ossl_noreturn _Noreturn -# elif defined(__GNUC__) && __GNUC__ >= 2 -# define ossl_noreturn __attribute__((noreturn)) -# else -# define ossl_noreturn -# endif - -/* ossl_unused: portable unused attribute for use in public headers */ -# if defined(__GNUC__) -# define ossl_unused __attribute__((unused)) -# else -# define ossl_unused -# endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ebcdic.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ebcdic.h deleted file mode 100644 index aa012855..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ebcdic.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 1999-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_EBCDIC_H -# define HEADER_EBCDIC_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Avoid name clashes with other applications */ -# define os_toascii _openssl_os_toascii -# define os_toebcdic _openssl_os_toebcdic -# define ebcdic2ascii _openssl_ebcdic2ascii -# define ascii2ebcdic _openssl_ascii2ebcdic - -extern const unsigned char os_toascii[256]; -extern const unsigned char os_toebcdic[256]; -void *ebcdic2ascii(void *dest, const void *srce, size_t count); -void *ascii2ebcdic(void *dest, const void *srce, size_t count); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ec.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ec.h deleted file mode 100644 index 5af9ebdc..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ec.h +++ /dev/null @@ -1,1479 +0,0 @@ -/* - * Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_EC_H -# define HEADER_EC_H - -# include - -# ifndef OPENSSL_NO_EC -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# ifdef __cplusplus -extern "C" { -# endif - -# ifndef OPENSSL_ECC_MAX_FIELD_BITS -# define OPENSSL_ECC_MAX_FIELD_BITS 661 -# endif - -/** Enum for the point conversion form as defined in X9.62 (ECDSA) - * for the encoding of a elliptic curve point (x,y) */ -typedef enum { - /** the point is encoded as z||x, where the octet z specifies - * which solution of the quadratic equation y is */ - POINT_CONVERSION_COMPRESSED = 2, - /** the point is encoded as z||x||y, where z is the octet 0x04 */ - POINT_CONVERSION_UNCOMPRESSED = 4, - /** the point is encoded as z||x||y, where the octet z specifies - * which solution of the quadratic equation y is */ - POINT_CONVERSION_HYBRID = 6 -} point_conversion_form_t; - -typedef struct ec_method_st EC_METHOD; -typedef struct ec_group_st EC_GROUP; -typedef struct ec_point_st EC_POINT; -typedef struct ecpk_parameters_st ECPKPARAMETERS; -typedef struct ec_parameters_st ECPARAMETERS; - -/********************************************************************/ -/* EC_METHODs for curves over GF(p) */ -/********************************************************************/ - -/** Returns the basic GFp ec methods which provides the basis for the - * optimized methods. - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_simple_method(void); - -/** Returns GFp methods using montgomery multiplication. - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_mont_method(void); - -/** Returns GFp methods using optimized methods for NIST recommended curves - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nist_method(void); - -# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -/** Returns 64-bit optimized methods for nistp224 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp224_method(void); - -/** Returns 64-bit optimized methods for nistp256 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp256_method(void); - -/** Returns 64-bit optimized methods for nistp521 - * \return EC_METHOD object - */ -const EC_METHOD *EC_GFp_nistp521_method(void); -# endif - -# ifndef OPENSSL_NO_EC2M -/********************************************************************/ -/* EC_METHOD for curves over GF(2^m) */ -/********************************************************************/ - -/** Returns the basic GF2m ec method - * \return EC_METHOD object - */ -const EC_METHOD *EC_GF2m_simple_method(void); - -# endif - -/********************************************************************/ -/* EC_GROUP functions */ -/********************************************************************/ - -/** Creates a new EC_GROUP object - * \param meth EC_METHOD to use - * \return newly created EC_GROUP object or NULL in case of an error. - */ -EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); - -/** Frees a EC_GROUP object - * \param group EC_GROUP object to be freed. - */ -void EC_GROUP_free(EC_GROUP *group); - -/** Clears and frees a EC_GROUP object - * \param group EC_GROUP object to be cleared and freed. - */ -void EC_GROUP_clear_free(EC_GROUP *group); - -/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. - * \param dst destination EC_GROUP object - * \param src source EC_GROUP object - * \return 1 on success and 0 if an error occurred. - */ -int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); - -/** Creates a new EC_GROUP object and copies the copies the content - * form src to the newly created EC_KEY object - * \param src source EC_GROUP object - * \return newly created EC_GROUP object or NULL in case of an error. - */ -EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); - -/** Returns the EC_METHOD of the EC_GROUP object. - * \param group EC_GROUP object - * \return EC_METHOD used in this EC_GROUP object. - */ -const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); - -/** Returns the field type of the EC_METHOD. - * \param meth EC_METHOD object - * \return NID of the underlying field type OID. - */ -int EC_METHOD_get_field_type(const EC_METHOD *meth); - -/** Sets the generator and its order/cofactor of a EC_GROUP object. - * \param group EC_GROUP object - * \param generator EC_POINT object with the generator. - * \param order the order of the group generated by the generator. - * \param cofactor the index of the sub-group generated by the generator - * in the group of all points on the elliptic curve. - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, - const BIGNUM *order, const BIGNUM *cofactor); - -/** Returns the generator of a EC_GROUP object. - * \param group EC_GROUP object - * \return the currently used generator (possibly NULL). - */ -const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); - -/** Returns the montgomery data for order(Generator) - * \param group EC_GROUP object - * \return the currently used montgomery data (possibly NULL). -*/ -BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); - -/** Gets the order of a EC_GROUP - * \param group EC_GROUP object - * \param order BIGNUM to which the order is copied - * \param ctx unused - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); - -/** Gets the order of an EC_GROUP - * \param group EC_GROUP object - * \return the group order - */ -const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); - -/** Gets the number of bits of the order of an EC_GROUP - * \param group EC_GROUP object - * \return number of bits of group order. - */ -int EC_GROUP_order_bits(const EC_GROUP *group); - -/** Gets the cofactor of a EC_GROUP - * \param group EC_GROUP object - * \param cofactor BIGNUM to which the cofactor is copied - * \param ctx unused - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, - BN_CTX *ctx); - -/** Gets the cofactor of an EC_GROUP - * \param group EC_GROUP object - * \return the group cofactor - */ -const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group); - -/** Sets the name of a EC_GROUP object - * \param group EC_GROUP object - * \param nid NID of the curve name OID - */ -void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); - -/** Returns the curve name of a EC_GROUP object - * \param group EC_GROUP object - * \return NID of the curve name OID or 0 if not set. - */ -int EC_GROUP_get_curve_name(const EC_GROUP *group); - -void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); -int EC_GROUP_get_asn1_flag(const EC_GROUP *group); - -void EC_GROUP_set_point_conversion_form(EC_GROUP *group, - point_conversion_form_t form); -point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); - -unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); -size_t EC_GROUP_get_seed_len(const EC_GROUP *); -size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); - -/** Sets the parameters of a ec curve defined by y^2 = x^3 + a*x + b (for GFp) - * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); - -/** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp) - * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, - BN_CTX *ctx); - -/** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, - const BIGNUM *a, const BIGNUM *b, - BN_CTX *ctx)) - -/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, - BIGNUM *a, BIGNUM *b, - BN_CTX *ctx)) - -# ifndef OPENSSL_NO_EC2M -/** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM with parameter a of the equation - * \param b BIGNUM with parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, - const BIGNUM *a, const BIGNUM *b, - BN_CTX *ctx)) - -/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve - * \param group EC_GROUP object - * \param p BIGNUM with the prime number (GFp) or the polynomial - * defining the underlying field (GF2m) - * \param a BIGNUM for parameter a of the equation - * \param b BIGNUM for parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, - BIGNUM *a, BIGNUM *b, - BN_CTX *ctx)) -# endif -/** Returns the number of bits needed to represent a field element - * \param group EC_GROUP object - * \return number of bits needed to represent a field element - */ -int EC_GROUP_get_degree(const EC_GROUP *group); - -/** Checks whether the parameter in the EC_GROUP define a valid ec group - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 if group is a valid ec group and 0 otherwise - */ -int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); - -/** Checks whether the discriminant of the elliptic curve is zero or not - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 if the discriminant is not zero and 0 otherwise - */ -int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); - -/** Compares two EC_GROUP objects - * \param a first EC_GROUP object - * \param b second EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 0 if the groups are equal, 1 if not, or -1 on error - */ -int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); - -/* - * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after - * choosing an appropriate EC_METHOD - */ - -/** Creates a new EC_GROUP object with the specified parameters defined - * over GFp (defined by the equation y^2 = x^3 + a*x + b) - * \param p BIGNUM with the prime number - * \param a BIGNUM with the parameter a of the equation - * \param b BIGNUM with the parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return newly created EC_GROUP object with the specified parameters - */ -EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); -# ifndef OPENSSL_NO_EC2M -/** Creates a new EC_GROUP object with the specified parameters defined - * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) - * \param p BIGNUM with the polynomial defining the underlying field - * \param a BIGNUM with the parameter a of the equation - * \param b BIGNUM with the parameter b of the equation - * \param ctx BN_CTX object (optional) - * \return newly created EC_GROUP object with the specified parameters - */ -EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, BN_CTX *ctx); -# endif - -/** Creates a EC_GROUP object with a curve specified by a NID - * \param nid NID of the OID of the curve name - * \return newly created EC_GROUP object with specified curve or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_by_curve_name(int nid); - -/** Creates a new EC_GROUP object from an ECPARAMETERS object - * \param params pointer to the ECPARAMETERS object - * \return newly created EC_GROUP object with specified curve or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params); - -/** Creates an ECPARAMETERS object for the given EC_GROUP object. - * \param group pointer to the EC_GROUP object - * \param params pointer to an existing ECPARAMETERS object or NULL - * \return pointer to the new ECPARAMETERS object or NULL - * if an error occurred. - */ -ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, - ECPARAMETERS *params); - -/** Creates a new EC_GROUP object from an ECPKPARAMETERS object - * \param params pointer to an existing ECPKPARAMETERS object, or NULL - * \return newly created EC_GROUP object with specified curve, or NULL - * if an error occurred - */ -EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params); - -/** Creates an ECPKPARAMETERS object for the given EC_GROUP object. - * \param group pointer to the EC_GROUP object - * \param params pointer to an existing ECPKPARAMETERS object or NULL - * \return pointer to the new ECPKPARAMETERS object or NULL - * if an error occurred. - */ -ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, - ECPKPARAMETERS *params); - -/********************************************************************/ -/* handling of internal curves */ -/********************************************************************/ - -typedef struct { - int nid; - const char *comment; -} EC_builtin_curve; - -/* - * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all - * available curves or zero if a error occurred. In case r is not zero, - * nitems EC_builtin_curve structures are filled with the data of the first - * nitems internal groups - */ -size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); - -const char *EC_curve_nid2nist(int nid); -int EC_curve_nist2nid(const char *name); - -/********************************************************************/ -/* EC_POINT functions */ -/********************************************************************/ - -/** Creates a new EC_POINT object for the specified EC_GROUP - * \param group EC_GROUP the underlying EC_GROUP object - * \return newly created EC_POINT object or NULL if an error occurred - */ -EC_POINT *EC_POINT_new(const EC_GROUP *group); - -/** Frees a EC_POINT object - * \param point EC_POINT object to be freed - */ -void EC_POINT_free(EC_POINT *point); - -/** Clears and frees a EC_POINT object - * \param point EC_POINT object to be cleared and freed - */ -void EC_POINT_clear_free(EC_POINT *point); - -/** Copies EC_POINT object - * \param dst destination EC_POINT object - * \param src source EC_POINT object - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); - -/** Creates a new EC_POINT object and copies the content of the supplied - * EC_POINT - * \param src source EC_POINT object - * \param group underlying the EC_GROUP object - * \return newly created EC_POINT object or NULL if an error occurred - */ -EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); - -/** Returns the EC_METHOD used in EC_POINT object - * \param point EC_POINT object - * \return the EC_METHOD used - */ -const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); - -/** Sets a point to infinity (neutral element) - * \param group underlying EC_GROUP object - * \param point EC_POINT to set to infinity - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); - -/** Sets the jacobian projective coordinates of a EC_POINT over GFp - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param z BIGNUM with the z-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, const BIGNUM *x, - const BIGNUM *y, const BIGNUM *z, - BN_CTX *ctx); - -/** Gets the jacobian projective coordinates of a EC_POINT over GFp - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param z BIGNUM for the z-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, - const EC_POINT *p, BIGNUM *x, - BIGNUM *y, BIGNUM *z, - BN_CTX *ctx); - -/** Sets the affine coordinates of an EC_POINT - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, - const BIGNUM *x, const BIGNUM *y, - BN_CTX *ctx); - -/** Gets the affine coordinates of an EC_POINT. - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p, - BIGNUM *x, BIGNUM *y, BN_CTX *ctx); - -/** Sets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_set_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - const BIGNUM *y, - BN_CTX *ctx)) - -/** Gets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_get_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, - const EC_POINT *p, - BIGNUM *x, - BIGNUM *y, - BN_CTX *ctx)) - -/** Sets the x9.62 compressed coordinates of a EC_POINT - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p, - const BIGNUM *x, int y_bit, - BN_CTX *ctx); - -/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of - * EC_POINT_set_compressed_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - int y_bit, - BN_CTX *ctx)) -# ifndef OPENSSL_NO_EC2M -/** Sets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_set_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with the x-coordinate - * \param y BIGNUM with the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - const BIGNUM *y, - BN_CTX *ctx)) - -/** Gets the affine coordinates of an EC_POINT. A synonym of - * EC_POINT_get_affine_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM for the x-coordinate - * \param y BIGNUM for the y-coordinate - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, - const EC_POINT *p, - BIGNUM *x, - BIGNUM *y, - BN_CTX *ctx)) - -/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of - * EC_POINT_set_compressed_coordinates - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param x BIGNUM with x-coordinate - * \param y_bit integer with the y-Bit (either 0 or 1) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, - EC_POINT *p, - const BIGNUM *x, - int y_bit, - BN_CTX *ctx)) -# endif -/** Encodes a EC_POINT object to a octet string - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param form point conversion form - * \param buf memory buffer for the result. If NULL the function returns - * required buffer size. - * \param len length of the memory buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, - point_conversion_form_t form, - unsigned char *buf, size_t len, BN_CTX *ctx); - -/** Decodes a EC_POINT from a octet string - * \param group underlying EC_GROUP object - * \param p EC_POINT object - * \param buf memory buffer with the encoded ec point - * \param len length of the encoded ec point - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, - const unsigned char *buf, size_t len, BN_CTX *ctx); - -/** Encodes an EC_POINT object to an allocated octet string - * \param group underlying EC_GROUP object - * \param point EC_POINT object - * \param form point conversion form - * \param pbuf returns pointer to allocated buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point, - point_conversion_form_t form, - unsigned char **pbuf, BN_CTX *ctx); - -/* other interfaces to point2oct/oct2point: */ -BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, - point_conversion_form_t form, BIGNUM *, BN_CTX *); -EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, - EC_POINT *, BN_CTX *); -char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, - point_conversion_form_t form, BN_CTX *); -EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, - EC_POINT *, BN_CTX *); - -/********************************************************************/ -/* functions for doing EC_POINT arithmetic */ -/********************************************************************/ - -/** Computes the sum of two EC_POINT - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result (r = a + b) - * \param a EC_POINT object with the first summand - * \param b EC_POINT object with the second summand - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, - const EC_POINT *b, BN_CTX *ctx); - -/** Computes the double of a EC_POINT - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result (r = 2 * a) - * \param a EC_POINT object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, - BN_CTX *ctx); - -/** Computes the inverse of a EC_POINT - * \param group underlying EC_GROUP object - * \param a EC_POINT object to be inverted (it's used for the result as well) - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); - -/** Checks whether the point is the neutral element of the group - * \param group the underlying EC_GROUP object - * \param p EC_POINT object - * \return 1 if the point is the neutral element and 0 otherwise - */ -int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); - -/** Checks whether the point is on the curve - * \param group underlying EC_GROUP object - * \param point EC_POINT object to check - * \param ctx BN_CTX object (optional) - * \return 1 if the point is on the curve, 0 if not, or -1 on error - */ -int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, - BN_CTX *ctx); - -/** Compares two EC_POINTs - * \param group underlying EC_GROUP object - * \param a first EC_POINT object - * \param b second EC_POINT object - * \param ctx BN_CTX object (optional) - * \return 1 if the points are not equal, 0 if they are, or -1 on error - */ -int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, - BN_CTX *ctx); - -int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); -int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, - EC_POINT *points[], BN_CTX *ctx); - -/** Computes r = generator * n + sum_{i=0}^{num-1} p[i] * m[i] - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result - * \param n BIGNUM with the multiplier for the group generator (optional) - * \param num number further summands - * \param p array of size num of EC_POINT objects - * \param m array of size num of BIGNUM objects - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, - size_t num, const EC_POINT *p[], const BIGNUM *m[], - BN_CTX *ctx); - -/** Computes r = generator * n + q * m - * \param group underlying EC_GROUP object - * \param r EC_POINT object for the result - * \param n BIGNUM with the multiplier for the group generator (optional) - * \param q EC_POINT object with the first factor of the second summand - * \param m BIGNUM with the second factor of the second summand - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, - const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); - -/** Stores multiples of generator for faster point multiplication - * \param group EC_GROUP object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ -int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); - -/** Reports whether a precomputation has been done - * \param group EC_GROUP object - * \return 1 if a pre-computation has been done and 0 otherwise - */ -int EC_GROUP_have_precompute_mult(const EC_GROUP *group); - -/********************************************************************/ -/* ASN1 stuff */ -/********************************************************************/ - -DECLARE_ASN1_ITEM(ECPKPARAMETERS) -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPKPARAMETERS) -DECLARE_ASN1_ITEM(ECPARAMETERS) -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) - -/* - * EC_GROUP_get_basis_type() returns the NID of the basis type used to - * represent the field elements - */ -int EC_GROUP_get_basis_type(const EC_GROUP *); -# ifndef OPENSSL_NO_EC2M -int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); -int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, - unsigned int *k2, unsigned int *k3); -# endif - -# define OPENSSL_EC_EXPLICIT_CURVE 0x000 -# define OPENSSL_EC_NAMED_CURVE 0x001 - -EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); -int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); - -# define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) -# define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) -# define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ - (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) -# define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ - (unsigned char *)(x)) - -int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); -# ifndef OPENSSL_NO_STDIO -int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); -# endif - -/********************************************************************/ -/* EC_KEY functions */ -/********************************************************************/ - -/* some values for the encoding_flag */ -# define EC_PKEY_NO_PARAMETERS 0x001 -# define EC_PKEY_NO_PUBKEY 0x002 - -/* some values for the flags field */ -# define EC_FLAG_NON_FIPS_ALLOW 0x1 -# define EC_FLAG_FIPS_CHECKED 0x2 -# define EC_FLAG_COFACTOR_ECDH 0x1000 - -/** Creates a new EC_KEY object. - * \return EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_new(void); - -int EC_KEY_get_flags(const EC_KEY *key); - -void EC_KEY_set_flags(EC_KEY *key, int flags); - -void EC_KEY_clear_flags(EC_KEY *key, int flags); - -/** Creates a new EC_KEY object using a named curve as underlying - * EC_GROUP object. - * \param nid NID of the named curve. - * \return EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_new_by_curve_name(int nid); - -/** Frees a EC_KEY object. - * \param key EC_KEY object to be freed. - */ -void EC_KEY_free(EC_KEY *key); - -/** Copies a EC_KEY object. - * \param dst destination EC_KEY object - * \param src src EC_KEY object - * \return dst or NULL if an error occurred. - */ -EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); - -/** Creates a new EC_KEY object and copies the content from src to it. - * \param src the source EC_KEY object - * \return newly created EC_KEY object or NULL if an error occurred. - */ -EC_KEY *EC_KEY_dup(const EC_KEY *src); - -/** Increases the internal reference count of a EC_KEY object. - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_up_ref(EC_KEY *key); - -/** Returns the ENGINE object of a EC_KEY object - * \param eckey EC_KEY object - * \return the ENGINE object (possibly NULL). - */ -ENGINE *EC_KEY_get0_engine(const EC_KEY *eckey); - -/** Returns the EC_GROUP object of a EC_KEY object - * \param key EC_KEY object - * \return the EC_GROUP object (possibly NULL). - */ -const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); - -/** Sets the EC_GROUP of a EC_KEY object. - * \param key EC_KEY object - * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY - * object will use an own copy of the EC_GROUP). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); - -/** Returns the private key of a EC_KEY object. - * \param key EC_KEY object - * \return a BIGNUM with the private key (possibly NULL). - */ -const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); - -/** Sets the private key of a EC_KEY object. - * \param key EC_KEY object - * \param prv BIGNUM with the private key (note: the EC_KEY object - * will use an own copy of the BIGNUM). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); - -/** Returns the public key of a EC_KEY object. - * \param key the EC_KEY object - * \return a EC_POINT object with the public key (possibly NULL) - */ -const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); - -/** Sets the public key of a EC_KEY object. - * \param key EC_KEY object - * \param pub EC_POINT object with the public key (note: the EC_KEY object - * will use an own copy of the EC_POINT object). - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); - -unsigned EC_KEY_get_enc_flags(const EC_KEY *key); -void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); -point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); -void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); - -#define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef) -int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg); -void *EC_KEY_get_ex_data(const EC_KEY *key, int idx); - -/* wrapper functions for the underlying EC_GROUP object */ -void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); - -/** Creates a table of pre-computed multiples of the generator to - * accelerate further EC_KEY operations. - * \param key EC_KEY object - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); - -/** Creates a new ec private (and optional a new public) key. - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred. - */ -int EC_KEY_generate_key(EC_KEY *key); - -/** Verifies that a private and/or public key is valid. - * \param key the EC_KEY object - * \return 1 on success and 0 otherwise. - */ -int EC_KEY_check_key(const EC_KEY *key); - -/** Indicates if an EC_KEY can be used for signing. - * \param eckey the EC_KEY object - * \return 1 if can can sign and 0 otherwise. - */ -int EC_KEY_can_sign(const EC_KEY *eckey); - -/** Sets a public key from affine coordinates performing - * necessary NIST PKV tests. - * \param key the EC_KEY object - * \param x public key x coordinate - * \param y public key y coordinate - * \return 1 on success and 0 otherwise. - */ -int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, - BIGNUM *y); - -/** Encodes an EC_KEY public key to an allocated octet string - * \param key key to encode - * \param form point conversion form - * \param pbuf returns pointer to allocated buffer - * \param ctx BN_CTX object (optional) - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form, - unsigned char **pbuf, BN_CTX *ctx); - -/** Decodes a EC_KEY public key from a octet string - * \param key key to decode - * \param buf memory buffer with the encoded ec point - * \param len length of the encoded ec point - * \param ctx BN_CTX object (optional) - * \return 1 on success and 0 if an error occurred - */ - -int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, - BN_CTX *ctx); - -/** Decodes an EC_KEY private key from an octet string - * \param key key to decode - * \param buf memory buffer with the encoded private key - * \param len length of the encoded key - * \return 1 on success and 0 if an error occurred - */ - -int EC_KEY_oct2priv(EC_KEY *key, const unsigned char *buf, size_t len); - -/** Encodes a EC_KEY private key to an octet string - * \param key key to encode - * \param buf memory buffer for the result. If NULL the function returns - * required buffer size. - * \param len length of the memory buffer - * \return the length of the encoded octet string or 0 if an error occurred - */ - -size_t EC_KEY_priv2oct(const EC_KEY *key, unsigned char *buf, size_t len); - -/** Encodes an EC_KEY private key to an allocated octet string - * \param eckey key to encode - * \param pbuf returns pointer to allocated buffer - * \return the length of the encoded octet string or 0 if an error occurred - */ -size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf); - -/********************************************************************/ -/* de- and encoding functions for SEC1 ECPrivateKey */ -/********************************************************************/ - -/** Decodes a private key from a memory buffer. - * \param key a pointer to a EC_KEY object which should be used (or NULL) - * \param in pointer to memory with the DER encoded private key - * \param len length of the DER encoded private key - * \return the decoded private key or NULL if an error occurred. - */ -EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes a private key object and stores the result in a buffer. - * \param key the EC_KEY object to encode - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred. - */ -int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); - -/********************************************************************/ -/* de- and encoding functions for EC parameters */ -/********************************************************************/ - -/** Decodes ec parameter from a memory buffer. - * \param key a pointer to a EC_KEY object which should be used (or NULL) - * \param in pointer to memory with the DER encoded ec parameters - * \param len length of the DER encoded ec parameters - * \return a EC_KEY object with the decoded parameters or NULL if an error - * occurred. - */ -EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes ec parameter and stores the result in a buffer. - * \param key the EC_KEY object with ec parameters to encode - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred. - */ -int i2d_ECParameters(EC_KEY *key, unsigned char **out); - -/********************************************************************/ -/* de- and encoding functions for EC public key */ -/* (octet string, not DER -- hence 'o2i' and 'i2o') */ -/********************************************************************/ - -/** Decodes a ec public key from a octet string. - * \param key a pointer to a EC_KEY object which should be used - * \param in memory buffer with the encoded public key - * \param len length of the encoded public key - * \return EC_KEY object with decoded public key or NULL if an error - * occurred. - */ -EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); - -/** Encodes a ec public key in an octet string. - * \param key the EC_KEY object with the public key - * \param out the buffer for the result (if NULL the function returns number - * of bytes needed). - * \return 1 on success and 0 if an error occurred - */ -int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out); - -/** Prints out the ec parameters on human readable form. - * \param bp BIO object to which the information is printed - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred - */ -int ECParameters_print(BIO *bp, const EC_KEY *key); - -/** Prints out the contents of a EC_KEY object - * \param bp BIO object to which the information is printed - * \param key EC_KEY object - * \param off line offset - * \return 1 on success and 0 if an error occurred - */ -int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); - -# ifndef OPENSSL_NO_STDIO -/** Prints out the ec parameters on human readable form. - * \param fp file descriptor to which the information is printed - * \param key EC_KEY object - * \return 1 on success and 0 if an error occurred - */ -int ECParameters_print_fp(FILE *fp, const EC_KEY *key); - -/** Prints out the contents of a EC_KEY object - * \param fp file descriptor to which the information is printed - * \param key EC_KEY object - * \param off line offset - * \return 1 on success and 0 if an error occurred - */ -int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); - -# endif - -const EC_KEY_METHOD *EC_KEY_OpenSSL(void); -const EC_KEY_METHOD *EC_KEY_get_default_method(void); -void EC_KEY_set_default_method(const EC_KEY_METHOD *meth); -const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key); -int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth); -EC_KEY *EC_KEY_new_method(ENGINE *engine); - -/** The old name for ecdh_KDF_X9_63 - * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, - * it is actually specified in ANSI X9.63. - * This identifier is retained for backwards compatibility - */ -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); - -int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, - const EC_KEY *ecdh, - void *(*KDF) (const void *in, size_t inlen, - void *out, size_t *outlen)); - -typedef struct ECDSA_SIG_st 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 a negative value - * on error - */ -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); - -/** Accessor for r and s fields of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - * \param pr pointer to BIGNUM pointer for r (may be NULL) - * \param ps pointer to BIGNUM pointer for s (may be NULL) - */ -void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); - -/** Accessor for r field of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - */ -const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); - -/** Accessor for s field of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - */ -const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); - -/** Setter for r and s fields of ECDSA_SIG - * \param sig pointer to ECDSA_SIG structure - * \param r pointer to BIGNUM for r (may be NULL) - * \param s pointer to BIGNUM for s (may be NULL) - */ -int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); - -/** 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 (optional), - * 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); - -/** 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 (optional), - * 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); - -/** 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); - -/********************************************************************/ -/* EC_KEY_METHOD constructors, destructors, writers and accessors */ -/********************************************************************/ - -EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth); -void EC_KEY_METHOD_free(EC_KEY_METHOD *meth); -void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, - int (*init)(EC_KEY *key), - void (*finish)(EC_KEY *key), - int (*copy)(EC_KEY *dest, const EC_KEY *src), - int (*set_group)(EC_KEY *key, const EC_GROUP *grp), - int (*set_private)(EC_KEY *key, - const BIGNUM *priv_key), - int (*set_public)(EC_KEY *key, - const EC_POINT *pub_key)); - -void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, - int (*keygen)(EC_KEY *key)); - -void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, - int (*ckey)(unsigned char **psec, - size_t *pseclen, - const EC_POINT *pub_key, - const EC_KEY *ecdh)); - -void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, - int (*sign)(int type, const unsigned char *dgst, - int dlen, unsigned char *sig, - unsigned int *siglen, - const BIGNUM *kinv, const BIGNUM *r, - EC_KEY *eckey), - int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, - BIGNUM **kinvp, BIGNUM **rp), - ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, - int dgst_len, - const BIGNUM *in_kinv, - const BIGNUM *in_r, - EC_KEY *eckey)); - -void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, - int (*verify)(int type, const unsigned - char *dgst, int dgst_len, - const unsigned char *sigbuf, - int sig_len, EC_KEY *eckey), - int (*verify_sig)(const unsigned char *dgst, - int dgst_len, - const ECDSA_SIG *sig, - EC_KEY *eckey)); - -void EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth, - int (**pinit)(EC_KEY *key), - void (**pfinish)(EC_KEY *key), - int (**pcopy)(EC_KEY *dest, const EC_KEY *src), - int (**pset_group)(EC_KEY *key, - const EC_GROUP *grp), - int (**pset_private)(EC_KEY *key, - const BIGNUM *priv_key), - int (**pset_public)(EC_KEY *key, - const EC_POINT *pub_key)); - -void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, - int (**pkeygen)(EC_KEY *key)); - -void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, - int (**pck)(unsigned char **psec, - size_t *pseclen, - const EC_POINT *pub_key, - const EC_KEY *ecdh)); - -void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, - int (**psign)(int type, const unsigned char *dgst, - int dlen, unsigned char *sig, - unsigned int *siglen, - const BIGNUM *kinv, const BIGNUM *r, - EC_KEY *eckey), - int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, - BIGNUM **kinvp, BIGNUM **rp), - ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, - int dgst_len, - const BIGNUM *in_kinv, - const BIGNUM *in_r, - EC_KEY *eckey)); - -void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, - int (**pverify)(int type, const unsigned - char *dgst, int dgst_len, - const unsigned char *sigbuf, - int sig_len, EC_KEY *eckey), - int (**pverify_sig)(const unsigned char *dgst, - int dgst_len, - const ECDSA_SIG *sig, - EC_KEY *eckey)); - -# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) - -# ifndef __cplusplus -# if defined(__SUNPRO_C) -# if __SUNPRO_C >= 0x520 -# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) -# endif -# endif -# endif - -# define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) - -# define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_EC_PARAM_ENC, flag, NULL) - -# define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_ECDH_COFACTOR, flag, NULL) - -# define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_ECDH_COFACTOR, -2, NULL) - -# define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_TYPE, kdf, NULL) - -# define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_TYPE, -2, NULL) - -# define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_OUTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, 0, \ - (void *)(plen)) - -# define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_EC_KDF_UKM, plen, (void *)(p)) - -# define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ - EVP_PKEY_OP_DERIVE, \ - EVP_PKEY_CTRL_GET_EC_KDF_UKM, 0, (void *)(p)) - -/* SM2 will skip the operation check so no need to pass operation here */ -# define EVP_PKEY_CTX_set1_id(ctx, id, id_len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_SET1_ID, (int)id_len, (void*)(id)) - -# define EVP_PKEY_CTX_get1_id(ctx, id) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_GET1_ID, 0, (void*)(id)) - -# define EVP_PKEY_CTX_get1_id_len(ctx, id_len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ - EVP_PKEY_CTRL_GET1_ID_LEN, 0, (void*)(id_len)) - -# define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) -# define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) -# define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) -# define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) -# define EVP_PKEY_CTRL_SET1_ID (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET1_ID (EVP_PKEY_ALG_CTRL + 12) -# define EVP_PKEY_CTRL_GET1_ID_LEN (EVP_PKEY_ALG_CTRL + 13) -/* KDF types */ -# define EVP_PKEY_ECDH_KDF_NONE 1 -# define EVP_PKEY_ECDH_KDF_X9_63 2 -/** The old name for EVP_PKEY_ECDH_KDF_X9_63 - * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, - * it is actually specified in ANSI X9.63. - * This identifier is retained for backwards compatibility - */ -# define EVP_PKEY_ECDH_KDF_X9_62 EVP_PKEY_ECDH_KDF_X9_63 - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ecdh.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ecdh.h deleted file mode 100644 index 681f3d5e..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ecdh.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ecdsa.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ecdsa.h deleted file mode 100644 index 681f3d5e..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ecdsa.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ecerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ecerr.h deleted file mode 100644 index f7b91834..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ecerr.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * 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_ECERR_H -# define HEADER_ECERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# include - -# 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_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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/engine.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/engine.h deleted file mode 100644 index 0780f0fb..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/engine.h +++ /dev/null @@ -1,751 +0,0 @@ -/* - * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_ENGINE_H -# define HEADER_ENGINE_H - -# include - -# ifndef OPENSSL_NO_ENGINE -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# include -# include -# include -# include -# include -# endif -# include -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* - * These flags are used to control combinations of algorithm (methods) by - * bitwise "OR"ing. - */ -# define ENGINE_METHOD_RSA (unsigned int)0x0001 -# define ENGINE_METHOD_DSA (unsigned int)0x0002 -# define ENGINE_METHOD_DH (unsigned int)0x0004 -# define ENGINE_METHOD_RAND (unsigned int)0x0008 -# define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 -# define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 -# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 -# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 -# define ENGINE_METHOD_EC (unsigned int)0x0800 -/* Obvious all-or-nothing cases. */ -# define ENGINE_METHOD_ALL (unsigned int)0xFFFF -# define ENGINE_METHOD_NONE (unsigned int)0x0000 - -/* - * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used - * internally to control registration of ENGINE implementations, and can be - * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to - * initialise registered ENGINEs if they are not already initialised. - */ -# define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 - -/* ENGINE flags that can be set by ENGINE_set_flags(). */ -/* Not used */ -/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ - -/* - * This flag is for ENGINEs that wish to handle the various 'CMD'-related - * control commands on their own. Without this flag, ENGINE_ctrl() handles - * these control commands on behalf of the ENGINE using their "cmd_defns" - * data. - */ -# define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 - -/* - * This flag is for ENGINEs who return new duplicate structures when found - * via "ENGINE_by_id()". When an ENGINE must store state (eg. if - * ENGINE_ctrl() commands are called in sequence as part of some stateful - * process like key-generation setup and execution), it can set this flag - - * then each attempt to obtain the ENGINE will result in it being copied into - * a new structure. Normally, ENGINEs don't declare this flag so - * ENGINE_by_id() just increments the existing ENGINE's structural reference - * count. - */ -# define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 - -/* - * This flag if for an ENGINE that does not want its methods registered as - * part of ENGINE_register_all_complete() for example if the methods are not - * usable as default methods. - */ - -# define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 - -/* - * ENGINEs can support their own command types, and these flags are used in - * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input - * each command expects. Currently only numeric and string input is - * supported. If a control command supports none of the _NUMERIC, _STRING, or - * _NO_INPUT options, then it is regarded as an "internal" control command - - * and not for use in config setting situations. As such, they're not - * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() - * access. Changes to this list of 'command types' should be reflected - * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). - */ - -/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ -# define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 -/* - * accepts string input (cast from 'void*' to 'const char *', 4th parameter - * to ENGINE_ctrl) - */ -# define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 -/* - * Indicates that the control command takes *no* input. Ie. the control - * command is unparameterised. - */ -# define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 -/* - * Indicates that the control command is internal. This control command won't - * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() - * function. - */ -# define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 - -/* - * NB: These 3 control commands are deprecated and should not be used. - * ENGINEs relying on these commands should compile conditional support for - * compatibility (eg. if these symbols are defined) but should also migrate - * the same functionality to their own ENGINE-specific control functions that - * can be "discovered" by calling applications. The fact these control - * commands wouldn't be "executable" (ie. usable by text-based config) - * doesn't change the fact that application code can find and use them - * without requiring per-ENGINE hacking. - */ - -/* - * These flags are used to tell the ctrl function what should be done. All - * command numbers are shared between all engines, even if some don't make - * sense to some engines. In such a case, they do nothing but return the - * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. - */ -# define ENGINE_CTRL_SET_LOGSTREAM 1 -# define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 -# define ENGINE_CTRL_HUP 3/* Close and reinitialise - * any handles/connections - * etc. */ -# define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */ -# define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used - * when calling the password - * callback and the user - * interface */ -# define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration, - * given a string that - * represents a file name - * or so */ -# define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given - * section in the already - * loaded configuration */ - -/* - * These control commands allow an application to deal with an arbitrary - * engine in a dynamic way. Warn: Negative return values indicate errors FOR - * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other - * commands, including ENGINE-specific command types, return zero for an - * error. An ENGINE can choose to implement these ctrl functions, and can - * internally manage things however it chooses - it does so by setting the - * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise - * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the - * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's - * ctrl() handler need only implement its own commands - the above "meta" - * commands will be taken care of. - */ - -/* - * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", - * then all the remaining control commands will return failure, so it is - * worth checking this first if the caller is trying to "discover" the - * engine's capabilities and doesn't want errors generated unnecessarily. - */ -# define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 -/* - * Returns a positive command number for the first command supported by the - * engine. Returns zero if no ctrl commands are supported. - */ -# define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 -/* - * The 'long' argument specifies a command implemented by the engine, and the - * return value is the next command supported, or zero if there are no more. - */ -# define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 -/* - * The 'void*' argument is a command name (cast from 'const char *'), and the - * return value is the command that corresponds to it. - */ -# define ENGINE_CTRL_GET_CMD_FROM_NAME 13 -/* - * The next two allow a command to be converted into its corresponding string - * form. In each case, the 'long' argument supplies the command. In the - * NAME_LEN case, the return value is the length of the command name (not - * counting a trailing EOL). In the NAME case, the 'void*' argument must be a - * string buffer large enough, and it will be populated with the name of the - * command (WITH a trailing EOL). - */ -# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 -# define ENGINE_CTRL_GET_NAME_FROM_CMD 15 -/* The next two are similar but give a "short description" of a command. */ -# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 -# define ENGINE_CTRL_GET_DESC_FROM_CMD 17 -/* - * With this command, the return value is the OR'd combination of - * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given - * engine-specific ctrl command expects. - */ -# define ENGINE_CTRL_GET_CMD_FLAGS 18 - -/* - * ENGINE implementations should start the numbering of their own control - * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). - */ -# define ENGINE_CMD_BASE 200 - -/* - * NB: These 2 nCipher "chil" control commands are deprecated, and their - * functionality is now available through ENGINE-specific control commands - * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 - * commands should be migrated to the more general command handling before - * these are removed. - */ - -/* Flags specific to the nCipher "chil" engine */ -# define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 - /* - * Depending on the value of the (long)i argument, this sets or - * unsets the SimpleForkCheck flag in the CHIL API to enable or - * disable checking and workarounds for applications that fork(). - */ -# define ENGINE_CTRL_CHIL_NO_LOCKING 101 - /* - * This prevents the initialisation function from providing mutex - * callbacks to the nCipher library. - */ - -/* - * If an ENGINE supports its own specific control commands and wishes the - * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on - * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN - * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() - * handler that supports the stated commands (ie. the "cmd_num" entries as - * described by the array). NB: The array must be ordered in increasing order - * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element - * has cmd_num set to zero and/or cmd_name set to NULL. - */ -typedef struct ENGINE_CMD_DEFN_st { - unsigned int cmd_num; /* The command number */ - const char *cmd_name; /* The command name itself */ - const char *cmd_desc; /* A short description of the command */ - unsigned int cmd_flags; /* The input the command expects */ -} ENGINE_CMD_DEFN; - -/* Generic function pointer */ -typedef int (*ENGINE_GEN_FUNC_PTR) (void); -/* Generic function pointer taking no arguments */ -typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *); -/* Specific control function pointer */ -typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *, - void (*f) (void)); -/* Generic load_key function pointer */ -typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, - UI_METHOD *ui_method, - void *callback_data); -typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl, - STACK_OF(X509_NAME) *ca_dn, - X509 **pcert, EVP_PKEY **pkey, - STACK_OF(X509) **pother, - UI_METHOD *ui_method, - void *callback_data); -/*- - * These callback types are for an ENGINE's handler for cipher and digest logic. - * These handlers have these prototypes; - * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); - * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); - * Looking at how to implement these handlers in the case of cipher support, if - * the framework wants the EVP_CIPHER for 'nid', it will call; - * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) - * If the framework wants a list of supported 'nid's, it will call; - * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) - */ -/* - * Returns to a pointer to the array of supported cipher 'nid's. If the - * second parameter is non-NULL it is set to the size of the returned array. - */ -typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **, - const int **, int); -typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **, - int); -typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **, - const int **, int); -typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **, - const int **, int); -/* - * STRUCTURE functions ... all of these functions deal with pointers to - * ENGINE structures where the pointers have a "structural reference". This - * means that their reference is to allowed access to the structure but it - * does not imply that the structure is functional. To simply increment or - * decrement the structural reference count, use ENGINE_by_id and - * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next - * as it will automatically decrement the structural reference count of the - * "current" ENGINE and increment the structural reference count of the - * ENGINE it returns (unless it is NULL). - */ - -/* Get the first/last "ENGINE" type available. */ -ENGINE *ENGINE_get_first(void); -ENGINE *ENGINE_get_last(void); -/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ -ENGINE *ENGINE_get_next(ENGINE *e); -ENGINE *ENGINE_get_prev(ENGINE *e); -/* Add another "ENGINE" type into the array. */ -int ENGINE_add(ENGINE *e); -/* Remove an existing "ENGINE" type from the array. */ -int ENGINE_remove(ENGINE *e); -/* Retrieve an engine from the list by its unique "id" value. */ -ENGINE *ENGINE_by_id(const char *id); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define ENGINE_load_openssl() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL) -# define ENGINE_load_dynamic() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL) -# ifndef OPENSSL_NO_STATIC_ENGINE -# define ENGINE_load_padlock() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL) -# define ENGINE_load_capi() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL) -# define ENGINE_load_afalg() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL) -# endif -# define ENGINE_load_cryptodev() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) -# define ENGINE_load_rdrand() \ - OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL) -#endif -void ENGINE_load_builtin_engines(void); - -/* - * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation - * "registry" handling. - */ -unsigned int ENGINE_get_table_flags(void); -void ENGINE_set_table_flags(unsigned int flags); - -/*- Manage registration of ENGINEs per "table". For each type, there are 3 - * functions; - * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) - * ENGINE_unregister_***(e) - unregister the implementation from 'e' - * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list - * Cleanup is automatically registered from each table when required. - */ - -int ENGINE_register_RSA(ENGINE *e); -void ENGINE_unregister_RSA(ENGINE *e); -void ENGINE_register_all_RSA(void); - -int ENGINE_register_DSA(ENGINE *e); -void ENGINE_unregister_DSA(ENGINE *e); -void ENGINE_register_all_DSA(void); - -int ENGINE_register_EC(ENGINE *e); -void ENGINE_unregister_EC(ENGINE *e); -void ENGINE_register_all_EC(void); - -int ENGINE_register_DH(ENGINE *e); -void ENGINE_unregister_DH(ENGINE *e); -void ENGINE_register_all_DH(void); - -int ENGINE_register_RAND(ENGINE *e); -void ENGINE_unregister_RAND(ENGINE *e); -void ENGINE_register_all_RAND(void); - -int ENGINE_register_ciphers(ENGINE *e); -void ENGINE_unregister_ciphers(ENGINE *e); -void ENGINE_register_all_ciphers(void); - -int ENGINE_register_digests(ENGINE *e); -void ENGINE_unregister_digests(ENGINE *e); -void ENGINE_register_all_digests(void); - -int ENGINE_register_pkey_meths(ENGINE *e); -void ENGINE_unregister_pkey_meths(ENGINE *e); -void ENGINE_register_all_pkey_meths(void); - -int ENGINE_register_pkey_asn1_meths(ENGINE *e); -void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); -void ENGINE_register_all_pkey_asn1_meths(void); - -/* - * These functions register all support from the above categories. Note, use - * of these functions can result in static linkage of code your application - * may not need. If you only need a subset of functionality, consider using - * more selective initialisation. - */ -int ENGINE_register_complete(ENGINE *e); -int ENGINE_register_all_complete(void); - -/* - * Send parameterised control commands to the engine. The possibilities to - * send down an integer, a pointer to data or a function pointer are - * provided. Any of the parameters may or may not be NULL, depending on the - * command number. In actuality, this function only requires a structural - * (rather than functional) reference to an engine, but many control commands - * may require the engine be functional. The caller should be aware of trying - * commands that require an operational ENGINE, and only use functional - * references in such situations. - */ -int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)); - -/* - * This function tests if an ENGINE-specific command is usable as a - * "setting". Eg. in an application's config file that gets processed through - * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to - * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). - */ -int ENGINE_cmd_is_executable(ENGINE *e, int cmd); - -/* - * This function works like ENGINE_ctrl() with the exception of taking a - * command name instead of a command number, and can handle optional - * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation - * on how to use the cmd_name and cmd_optional. - */ -int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, - long i, void *p, void (*f) (void), int cmd_optional); - -/* - * This function passes a command-name and argument to an ENGINE. The - * cmd_name is converted to a command number and the control command is - * called using 'arg' as an argument (unless the ENGINE doesn't support such - * a command, in which case no control command is called). The command is - * checked for input flags, and if necessary the argument will be converted - * to a numeric value. If cmd_optional is non-zero, then if the ENGINE - * doesn't support the given cmd_name the return value will be success - * anyway. This function is intended for applications to use so that users - * (or config files) can supply engine-specific config data to the ENGINE at - * run-time to control behaviour of specific engines. As such, it shouldn't - * be used for calling ENGINE_ctrl() functions that return data, deal with - * binary data, or that are otherwise supposed to be used directly through - * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() - * operation in this function will be lost - the return value is interpreted - * as failure if the return value is zero, success otherwise, and this - * function returns a boolean value as a result. In other words, vendors of - * 'ENGINE'-enabled devices should write ENGINE implementations with - * parameterisations that work in this scheme, so that compliant ENGINE-based - * applications can work consistently with the same configuration for the - * same ENGINE-enabled devices, across applications. - */ -int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, - int cmd_optional); - -/* - * These functions are useful for manufacturing new ENGINE structures. They - * don't address reference counting at all - one uses them to populate an - * ENGINE structure with personalised implementations of things prior to - * using it directly or adding it to the builtin ENGINE list in OpenSSL. - * These are also here so that the ENGINE structure doesn't have to be - * exposed and break binary compatibility! - */ -ENGINE *ENGINE_new(void); -int ENGINE_free(ENGINE *e); -int ENGINE_up_ref(ENGINE *e); -int ENGINE_set_id(ENGINE *e, const char *id); -int ENGINE_set_name(ENGINE *e, const char *name); -int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); -int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); -int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth); -int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); -int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); -int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); -int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); -int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); -int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); -int ENGINE_set_load_privkey_function(ENGINE *e, - ENGINE_LOAD_KEY_PTR loadpriv_f); -int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); -int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, - ENGINE_SSL_CLIENT_CERT_PTR - loadssl_f); -int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); -int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); -int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); -int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); -int ENGINE_set_flags(ENGINE *e, int flags); -int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); -/* These functions allow control over any per-structure ENGINE data. */ -#define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef) -int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); -void *ENGINE_get_ex_data(const ENGINE *e, int idx); - -#if OPENSSL_API_COMPAT < 0x10100000L -/* - * This function previously cleaned up anything that needs it. Auto-deinit will - * now take care of it so it is no longer required to call this function. - */ -# define ENGINE_cleanup() while(0) continue -#endif - -/* - * These return values from within the ENGINE structure. These can be useful - * with functional references as well as structural references - it depends - * which you obtained. Using the result for functional purposes if you only - * obtained a structural reference may be problematic! - */ -const char *ENGINE_get_id(const ENGINE *e); -const char *ENGINE_get_name(const ENGINE *e); -const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); -const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); -const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); -const DH_METHOD *ENGINE_get_DH(const ENGINE *e); -const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); -ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); -ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); -ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); -ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); -ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE - *e); -ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); -ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); -ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); -ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); -const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); -const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); -const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); -const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); -const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, - const char *str, - int len); -const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, - const char *str, - int len); -const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); -int ENGINE_get_flags(const ENGINE *e); - -/* - * FUNCTIONAL functions. These functions deal with ENGINE structures that - * have (or will) be initialised for use. Broadly speaking, the structural - * functions are useful for iterating the list of available engine types, - * creating new engine types, and other "list" operations. These functions - * actually deal with ENGINEs that are to be used. As such these functions - * can fail (if applicable) when particular engines are unavailable - eg. if - * a hardware accelerator is not attached or not functioning correctly. Each - * ENGINE has 2 reference counts; structural and functional. Every time a - * functional reference is obtained or released, a corresponding structural - * reference is automatically obtained or released too. - */ - -/* - * Initialise a engine type for use (or up its reference count if it's - * already in use). This will fail if the engine is not currently operational - * and cannot initialise. - */ -int ENGINE_init(ENGINE *e); -/* - * Free a functional reference to a engine type. This does not require a - * corresponding call to ENGINE_free as it also releases a structural - * reference. - */ -int ENGINE_finish(ENGINE *e); - -/* - * The following functions handle keys that are stored in some secondary - * location, handled by the engine. The storage may be on a card or - * whatever. - */ -EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); -EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, - UI_METHOD *ui_method, void *callback_data); -int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, - STACK_OF(X509_NAME) *ca_dn, X509 **pcert, - EVP_PKEY **ppkey, STACK_OF(X509) **pother, - UI_METHOD *ui_method, void *callback_data); - -/* - * This returns a pointer for the current ENGINE structure that is (by - * default) performing any RSA operations. The value returned is an - * incremented reference, so it should be free'd (ENGINE_finish) before it is - * discarded. - */ -ENGINE *ENGINE_get_default_RSA(void); -/* Same for the other "methods" */ -ENGINE *ENGINE_get_default_DSA(void); -ENGINE *ENGINE_get_default_EC(void); -ENGINE *ENGINE_get_default_DH(void); -ENGINE *ENGINE_get_default_RAND(void); -/* - * These functions can be used to get a functional reference to perform - * ciphering or digesting corresponding to "nid". - */ -ENGINE *ENGINE_get_cipher_engine(int nid); -ENGINE *ENGINE_get_digest_engine(int nid); -ENGINE *ENGINE_get_pkey_meth_engine(int nid); -ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); - -/* - * This sets a new default ENGINE structure for performing RSA operations. If - * the result is non-zero (success) then the ENGINE structure will have had - * its reference count up'd so the caller should still free their own - * reference 'e'. - */ -int ENGINE_set_default_RSA(ENGINE *e); -int ENGINE_set_default_string(ENGINE *e, const char *def_list); -/* Same for the other "methods" */ -int ENGINE_set_default_DSA(ENGINE *e); -int ENGINE_set_default_EC(ENGINE *e); -int ENGINE_set_default_DH(ENGINE *e); -int ENGINE_set_default_RAND(ENGINE *e); -int ENGINE_set_default_ciphers(ENGINE *e); -int ENGINE_set_default_digests(ENGINE *e); -int ENGINE_set_default_pkey_meths(ENGINE *e); -int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); - -/* - * The combination "set" - the flags are bitwise "OR"d from the - * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" - * function, this function can result in unnecessary static linkage. If your - * application requires only specific functionality, consider using more - * selective functions. - */ -int ENGINE_set_default(ENGINE *e, unsigned int flags); - -void ENGINE_add_conf_module(void); - -/* Deprecated functions ... */ -/* int ENGINE_clear_defaults(void); */ - -/**************************/ -/* DYNAMIC ENGINE SUPPORT */ -/**************************/ - -/* Binary/behaviour compatibility levels */ -# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000 -/* - * Binary versions older than this are too old for us (whether we're a loader - * or a loadee) - */ -# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000 - -/* - * When compiling an ENGINE entirely as an external shared library, loadable - * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' - * structure type provides the calling application's (or library's) error - * functionality and memory management function pointers to the loaded - * library. These should be used/set in the loaded library code so that the - * loading application's 'state' will be used/changed in all operations. The - * 'static_state' pointer allows the loaded library to know if it shares the - * same static data as the calling application (or library), and thus whether - * these callbacks need to be set or not. - */ -typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int); -typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int); -typedef void (*dyn_MEM_free_fn) (void *, const char *, int); -typedef struct st_dynamic_MEM_fns { - dyn_MEM_malloc_fn malloc_fn; - dyn_MEM_realloc_fn realloc_fn; - dyn_MEM_free_fn free_fn; -} dynamic_MEM_fns; -/* - * FIXME: Perhaps the memory and locking code (crypto.h) should declare and - * use these types so we (and any other dependent code) can simplify a bit?? - */ -/* The top-level structure */ -typedef struct st_dynamic_fns { - void *static_state; - dynamic_MEM_fns mem_fns; -} dynamic_fns; - -/* - * The version checking function should be of this prototype. NB: The - * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading - * code. If this function returns zero, it indicates a (potential) version - * incompatibility and the loaded library doesn't believe it can proceed. - * Otherwise, the returned value is the (latest) version supported by the - * loading library. The loader may still decide that the loaded code's - * version is unsatisfactory and could veto the load. The function is - * expected to be implemented with the symbol name "v_check", and a default - * implementation can be fully instantiated with - * IMPLEMENT_DYNAMIC_CHECK_FN(). - */ -typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version); -# define IMPLEMENT_DYNAMIC_CHECK_FN() \ - OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ - OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ - if (v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ - return 0; } - -/* - * This function is passed the ENGINE structure to initialise with its own - * function and command settings. It should not adjust the structural or - * functional reference counts. If this function returns zero, (a) the load - * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto - * the structure, and (c) the shared library will be unloaded. So - * implementations should do their own internal cleanup in failure - * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, - * represents the ENGINE id that the loader is looking for. If this is NULL, - * the shared library can choose to return failure or to initialise a - * 'default' ENGINE. If non-NULL, the shared library must initialise only an - * ENGINE matching the passed 'id'. The function is expected to be - * implemented with the symbol name "bind_engine". A standard implementation - * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter - * 'fn' is a callback function that populates the ENGINE structure and - * returns an int value (zero for failure). 'fn' should have prototype; - * [static] int fn(ENGINE *e, const char *id); - */ -typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, - const dynamic_fns *fns); -# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ - OPENSSL_EXPORT \ - int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ - OPENSSL_EXPORT \ - int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ - if (ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ - CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \ - fns->mem_fns.realloc_fn, \ - fns->mem_fns.free_fn); \ - skip_cbs: \ - if (!fn(e, id)) return 0; \ - return 1; } - -/* - * If the loading application (or library) and the loaded ENGINE library - * share the same static data (eg. they're both dynamically linked to the - * same libcrypto.so) we need a way to avoid trying to set system callbacks - - * this would fail, and for the same reason that it's unnecessary to try. If - * the loaded ENGINE has (or gets from through the loader) its own copy of - * the libcrypto static data, we will need to set the callbacks. The easiest - * way to detect this is to have a function that returns a pointer to some - * static data and let the loading application and loaded ENGINE compare - * their respective values. - */ -void *ENGINE_get_static_state(void); - -# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void)) -# endif - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/engineerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/engineerr.h deleted file mode 100644 index 05e84bd2..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/engineerr.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/err.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/err.h deleted file mode 100644 index b49f8812..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/err.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * 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_ERR_H -# define HEADER_ERR_H - -# include - -# ifndef OPENSSL_NO_STDIO -# include -# include -# endif - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# ifndef OPENSSL_NO_ERR -# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) -# else -# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) -# endif - -# include - -# define ERR_TXT_MALLOCED 0x01 -# define ERR_TXT_STRING 0x02 - -# define ERR_FLAG_MARK 0x01 -# define ERR_FLAG_CLEAR 0x02 - -# define ERR_NUM_ERRORS 16 -typedef struct err_state_st { - int err_flags[ERR_NUM_ERRORS]; - unsigned long err_buffer[ERR_NUM_ERRORS]; - char *err_data[ERR_NUM_ERRORS]; - int err_data_flags[ERR_NUM_ERRORS]; - const char *err_file[ERR_NUM_ERRORS]; - int err_line[ERR_NUM_ERRORS]; - int top, bottom; -} ERR_STATE; - -/* library */ -# define ERR_LIB_NONE 1 -# define ERR_LIB_SYS 2 -# define ERR_LIB_BN 3 -# define ERR_LIB_RSA 4 -# define ERR_LIB_DH 5 -# define ERR_LIB_EVP 6 -# define ERR_LIB_BUF 7 -# define ERR_LIB_OBJ 8 -# define ERR_LIB_PEM 9 -# define ERR_LIB_DSA 10 -# define ERR_LIB_X509 11 -/* #define ERR_LIB_METH 12 */ -# define ERR_LIB_ASN1 13 -# define ERR_LIB_CONF 14 -# define ERR_LIB_CRYPTO 15 -# define ERR_LIB_EC 16 -# define ERR_LIB_SSL 20 -/* #define ERR_LIB_SSL23 21 */ -/* #define ERR_LIB_SSL2 22 */ -/* #define ERR_LIB_SSL3 23 */ -/* #define ERR_LIB_RSAREF 30 */ -/* #define ERR_LIB_PROXY 31 */ -# define ERR_LIB_BIO 32 -# define ERR_LIB_PKCS7 33 -# define ERR_LIB_X509V3 34 -# define ERR_LIB_PKCS12 35 -# define ERR_LIB_RAND 36 -# define ERR_LIB_DSO 37 -# define ERR_LIB_ENGINE 38 -# define ERR_LIB_OCSP 39 -# define ERR_LIB_UI 40 -# define ERR_LIB_COMP 41 -# define ERR_LIB_ECDSA 42 -# define ERR_LIB_ECDH 43 -# define ERR_LIB_OSSL_STORE 44 -# define ERR_LIB_FIPS 45 -# define ERR_LIB_CMS 46 -# define ERR_LIB_TS 47 -# define ERR_LIB_HMAC 48 -/* # define ERR_LIB_JPAKE 49 */ -# define ERR_LIB_CT 50 -# define ERR_LIB_ASYNC 51 -# define ERR_LIB_KDF 52 -# define ERR_LIB_SM2 53 - -# define ERR_LIB_USER 128 - -# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE) - -# define ERR_PACK(l,f,r) ( \ - (((unsigned int)(l) & 0x0FF) << 24L) | \ - (((unsigned int)(f) & 0xFFF) << 12L) | \ - (((unsigned int)(r) & 0xFFF) ) ) -# define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL) -# define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL) -# define ERR_GET_REASON(l) (int)( (l) & 0xFFFL) -# define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL) - -/* OS functions */ -# define SYS_F_FOPEN 1 -# define SYS_F_CONNECT 2 -# define SYS_F_GETSERVBYNAME 3 -# define SYS_F_SOCKET 4 -# define SYS_F_IOCTLSOCKET 5 -# define SYS_F_BIND 6 -# define SYS_F_LISTEN 7 -# define SYS_F_ACCEPT 8 -# define SYS_F_WSASTARTUP 9/* Winsock stuff */ -# define SYS_F_OPENDIR 10 -# define SYS_F_FREAD 11 -# define SYS_F_GETADDRINFO 12 -# define SYS_F_GETNAMEINFO 13 -# define SYS_F_SETSOCKOPT 14 -# define SYS_F_GETSOCKOPT 15 -# define SYS_F_GETSOCKNAME 16 -# define SYS_F_GETHOSTBYNAME 17 -# define SYS_F_FFLUSH 18 -# define SYS_F_OPEN 19 -# define SYS_F_CLOSE 20 -# define SYS_F_IOCTL 21 -# define SYS_F_STAT 22 -# define SYS_F_FCNTL 23 -# define SYS_F_FSTAT 24 - -/* reasons */ -# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ -# define ERR_R_BN_LIB ERR_LIB_BN/* 3 */ -# define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */ -# define ERR_R_DH_LIB ERR_LIB_DH/* 5 */ -# define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */ -# define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */ -# define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */ -# define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */ -# define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */ -# define ERR_R_X509_LIB ERR_LIB_X509/* 11 */ -# define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */ -# define ERR_R_EC_LIB ERR_LIB_EC/* 16 */ -# define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */ -# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */ -# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */ -# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */ -# define ERR_R_UI_LIB ERR_LIB_UI/* 40 */ -# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */ -# define ERR_R_OSSL_STORE_LIB ERR_LIB_OSSL_STORE/* 44 */ - -# define ERR_R_NESTED_ASN1_ERROR 58 -# define ERR_R_MISSING_ASN1_EOS 63 - -/* fatal error */ -# define ERR_R_FATAL 64 -# define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) -# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) -# define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) -# define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) -# define ERR_R_DISABLED (5|ERR_R_FATAL) -# define ERR_R_INIT_FAIL (6|ERR_R_FATAL) -# define ERR_R_PASSED_INVALID_ARGUMENT (7) -# define ERR_R_OPERATION_FAIL (8|ERR_R_FATAL) - -/* - * 99 is the maximum possible ERR_R_... code, higher values are reserved for - * the individual libraries - */ - -typedef struct ERR_string_data_st { - unsigned long error; - const char *string; -} ERR_STRING_DATA; - -DEFINE_LHASH_OF(ERR_STRING_DATA); - -void ERR_put_error(int lib, int func, int reason, const char *file, int line); -void ERR_set_error_data(char *data, int flags); - -unsigned long ERR_get_error(void); -unsigned long ERR_get_error_line(const char **file, int *line); -unsigned long ERR_get_error_line_data(const char **file, int *line, - const char **data, int *flags); -unsigned long ERR_peek_error(void); -unsigned long ERR_peek_error_line(const char **file, int *line); -unsigned long ERR_peek_error_line_data(const char **file, int *line, - const char **data, int *flags); -unsigned long ERR_peek_last_error(void); -unsigned long ERR_peek_last_error_line(const char **file, int *line); -unsigned long ERR_peek_last_error_line_data(const char **file, int *line, - const char **data, int *flags); -void ERR_clear_error(void); -char *ERR_error_string(unsigned long e, char *buf); -void ERR_error_string_n(unsigned long e, char *buf, size_t len); -const char *ERR_lib_error_string(unsigned long e); -const char *ERR_func_error_string(unsigned long e); -const char *ERR_reason_error_string(unsigned long e); -void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), - void *u); -# ifndef OPENSSL_NO_STDIO -void ERR_print_errors_fp(FILE *fp); -# endif -void ERR_print_errors(BIO *bp); -void ERR_add_error_data(int num, ...); -void ERR_add_error_vdata(int num, va_list args); -int ERR_load_strings(int lib, ERR_STRING_DATA *str); -int ERR_load_strings_const(const ERR_STRING_DATA *str); -int ERR_unload_strings(int lib, ERR_STRING_DATA *str); -int ERR_load_ERR_strings(void); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define ERR_load_crypto_strings() \ - OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) -# define ERR_free_strings() while(0) continue -#endif - -DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *)) -DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid)) -ERR_STATE *ERR_get_state(void); - -int ERR_get_next_error_library(void); - -int ERR_set_mark(void); -int ERR_pop_to_mark(void); -int ERR_clear_last_mark(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/evp.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/evp.h deleted file mode 100644 index a411f3f2..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/evp.h +++ /dev/null @@ -1,1666 +0,0 @@ -/* - * 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_ENVELOPE_H -# define HEADER_ENVELOPE_H - -# include -# include -# include -# include -# include - -# define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ -# define EVP_MAX_KEY_LENGTH 64 -# define EVP_MAX_IV_LENGTH 16 -# define EVP_MAX_BLOCK_LENGTH 32 - -# define PKCS5_SALT_LEN 8 -/* Default PKCS#5 iteration count */ -# define PKCS5_DEFAULT_ITER 2048 - -# include - -# define EVP_PK_RSA 0x0001 -# define EVP_PK_DSA 0x0002 -# define EVP_PK_DH 0x0004 -# define EVP_PK_EC 0x0008 -# define EVP_PKT_SIGN 0x0010 -# define EVP_PKT_ENC 0x0020 -# define EVP_PKT_EXCH 0x0040 -# define EVP_PKS_RSA 0x0100 -# define EVP_PKS_DSA 0x0200 -# define EVP_PKS_EC 0x0400 - -# define EVP_PKEY_NONE NID_undef -# define EVP_PKEY_RSA NID_rsaEncryption -# define EVP_PKEY_RSA2 NID_rsa -# define EVP_PKEY_RSA_PSS NID_rsassaPss -# define EVP_PKEY_DSA NID_dsa -# define EVP_PKEY_DSA1 NID_dsa_2 -# define EVP_PKEY_DSA2 NID_dsaWithSHA -# define EVP_PKEY_DSA3 NID_dsaWithSHA1 -# define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 -# define EVP_PKEY_DH NID_dhKeyAgreement -# define EVP_PKEY_DHX NID_dhpublicnumber -# define EVP_PKEY_EC NID_X9_62_id_ecPublicKey -# define EVP_PKEY_SM2 NID_sm2 -# define EVP_PKEY_HMAC NID_hmac -# define EVP_PKEY_CMAC NID_cmac -# define EVP_PKEY_SCRYPT NID_id_scrypt -# define EVP_PKEY_TLS1_PRF NID_tls1_prf -# define EVP_PKEY_HKDF NID_hkdf -# define EVP_PKEY_POLY1305 NID_poly1305 -# define EVP_PKEY_SIPHASH NID_siphash -# define EVP_PKEY_X25519 NID_X25519 -# define EVP_PKEY_ED25519 NID_ED25519 -# define EVP_PKEY_X448 NID_X448 -# define EVP_PKEY_ED448 NID_ED448 - -#ifdef __cplusplus -extern "C" { -#endif - -# define EVP_PKEY_MO_SIGN 0x0001 -# define EVP_PKEY_MO_VERIFY 0x0002 -# define EVP_PKEY_MO_ENCRYPT 0x0004 -# define EVP_PKEY_MO_DECRYPT 0x0008 - -# ifndef EVP_MD -EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); -EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); -void EVP_MD_meth_free(EVP_MD *md); - -int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); -int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); -int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); -int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); -int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); -int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, - const void *data, - size_t count)); -int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, - unsigned char *md)); -int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, - const EVP_MD_CTX *from)); -int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); -int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, - int p1, void *p2)); - -int EVP_MD_meth_get_input_blocksize(const EVP_MD *md); -int EVP_MD_meth_get_result_size(const EVP_MD *md); -int EVP_MD_meth_get_app_datasize(const EVP_MD *md); -unsigned long EVP_MD_meth_get_flags(const EVP_MD *md); -int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); -int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, - const void *data, - size_t count); -int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, - unsigned char *md); -int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, - const EVP_MD_CTX *from); -int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); -int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, - int p1, void *p2); - -/* digest can only handle a single block */ -# define EVP_MD_FLAG_ONESHOT 0x0001 - -/* digest is extensible-output function, XOF */ -# define EVP_MD_FLAG_XOF 0x0002 - -/* DigestAlgorithmIdentifier flags... */ - -# define EVP_MD_FLAG_DIGALGID_MASK 0x0018 - -/* NULL or absent parameter accepted. Use NULL */ - -# define EVP_MD_FLAG_DIGALGID_NULL 0x0000 - -/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ - -# define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 - -/* Custom handling via ctrl */ - -# define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 - -/* Note if suitable for use in FIPS mode */ -# define EVP_MD_FLAG_FIPS 0x0400 - -/* Digest ctrls */ - -# define EVP_MD_CTRL_DIGALGID 0x1 -# define EVP_MD_CTRL_MICALG 0x2 -# define EVP_MD_CTRL_XOF_LEN 0x3 - -/* Minimum Algorithm specific ctrl value */ - -# define EVP_MD_CTRL_ALG_CTRL 0x1000 - -# endif /* !EVP_MD */ - -/* values for EVP_MD_CTX flags */ - -# define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be - * called once only */ -# define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been - * cleaned */ -# define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data - * in EVP_MD_CTX_reset */ -/* - * FIPS and pad options are ignored in 1.0.0, definitions are here so we - * don't accidentally reuse the values for other purposes. - */ - -# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS - * digest in FIPS mode */ - -/* - * The following PAD options are also currently ignored in 1.0.0, digest - * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() - * instead. - */ -# define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ -# define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ -# define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ -# define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ - -# define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ -/* - * Some functions such as EVP_DigestSign only finalise copies of internal - * contexts so additional data can be included after the finalisation call. - * This is inefficient if this functionality is not required: it is disabled - * if the following flag is set. - */ -# define EVP_MD_CTX_FLAG_FINALISE 0x0200 -/* NOTE: 0x0400 is reserved for internal usage */ - -EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); -EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); -void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); - -int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); -int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); -int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); -int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, - int (*init) (EVP_CIPHER_CTX *ctx, - const unsigned char *key, - const unsigned char *iv, - int enc)); -int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, - int (*do_cipher) (EVP_CIPHER_CTX *ctx, - unsigned char *out, - const unsigned char *in, - size_t inl)); -int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, - int (*cleanup) (EVP_CIPHER_CTX *)); -int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, - int (*set_asn1_parameters) (EVP_CIPHER_CTX *, - ASN1_TYPE *)); -int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, - int (*get_asn1_parameters) (EVP_CIPHER_CTX *, - ASN1_TYPE *)); -int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, - int (*ctrl) (EVP_CIPHER_CTX *, int type, - int arg, void *ptr)); - -int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, - const unsigned char *key, - const unsigned char *iv, - int enc); -int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, - unsigned char *out, - const unsigned char *in, - size_t inl); -int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); -int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - ASN1_TYPE *); -int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - ASN1_TYPE *); -int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, - int type, int arg, - void *ptr); - -/* Values for cipher flags */ - -/* Modes for ciphers */ - -# define EVP_CIPH_STREAM_CIPHER 0x0 -# define EVP_CIPH_ECB_MODE 0x1 -# define EVP_CIPH_CBC_MODE 0x2 -# define EVP_CIPH_CFB_MODE 0x3 -# define EVP_CIPH_OFB_MODE 0x4 -# define EVP_CIPH_CTR_MODE 0x5 -# define EVP_CIPH_GCM_MODE 0x6 -# define EVP_CIPH_CCM_MODE 0x7 -# define EVP_CIPH_XTS_MODE 0x10001 -# define EVP_CIPH_WRAP_MODE 0x10002 -# define EVP_CIPH_OCB_MODE 0x10003 -# define EVP_CIPH_MODE 0xF0007 -/* Set if variable length cipher */ -# define EVP_CIPH_VARIABLE_LENGTH 0x8 -/* Set if the iv handling should be done by the cipher itself */ -# define EVP_CIPH_CUSTOM_IV 0x10 -/* Set if the cipher's init() function should be called if key is NULL */ -# define EVP_CIPH_ALWAYS_CALL_INIT 0x20 -/* Call ctrl() to init cipher parameters */ -# define EVP_CIPH_CTRL_INIT 0x40 -/* Don't use standard key length function */ -# define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 -/* Don't use standard block padding */ -# define EVP_CIPH_NO_PADDING 0x100 -/* cipher handles random key generation */ -# define EVP_CIPH_RAND_KEY 0x200 -/* cipher has its own additional copying logic */ -# define EVP_CIPH_CUSTOM_COPY 0x400 -/* Don't use standard iv length function */ -# define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 -/* Allow use default ASN1 get/set iv */ -# define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 -/* Buffer length in bits not bytes: CFB1 mode only */ -# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 -/* Note if suitable for use in FIPS mode */ -# define EVP_CIPH_FLAG_FIPS 0x4000 -/* Allow non FIPS cipher in FIPS mode */ -# define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 -/* - * Cipher handles any and all padding logic as well as finalisation. - */ -# define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 -# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 -# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 -/* Cipher can handle pipeline operations */ -# define EVP_CIPH_FLAG_PIPELINE 0X800000 - -/* - * Cipher context flag to indicate we can handle wrap mode: if allowed in - * older applications it could overflow buffers. - */ - -# define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 - -/* ctrl() values */ - -# define EVP_CTRL_INIT 0x0 -# define EVP_CTRL_SET_KEY_LENGTH 0x1 -# define EVP_CTRL_GET_RC2_KEY_BITS 0x2 -# define EVP_CTRL_SET_RC2_KEY_BITS 0x3 -# define EVP_CTRL_GET_RC5_ROUNDS 0x4 -# define EVP_CTRL_SET_RC5_ROUNDS 0x5 -# define EVP_CTRL_RAND_KEY 0x6 -# define EVP_CTRL_PBE_PRF_NID 0x7 -# define EVP_CTRL_COPY 0x8 -# define EVP_CTRL_AEAD_SET_IVLEN 0x9 -# define EVP_CTRL_AEAD_GET_TAG 0x10 -# define EVP_CTRL_AEAD_SET_TAG 0x11 -# define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 -# define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN -# define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED -# define EVP_CTRL_GCM_IV_GEN 0x13 -# define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN -# define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED -# define EVP_CTRL_CCM_SET_L 0x14 -# define EVP_CTRL_CCM_SET_MSGLEN 0x15 -/* - * AEAD cipher deduces payload length and returns number of bytes required to - * store MAC and eventual padding. Subsequent call to EVP_Cipher even - * appends/verifies MAC. - */ -# define EVP_CTRL_AEAD_TLS1_AAD 0x16 -/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ -# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 -/* Set the GCM invocation field, decrypt only */ -# define EVP_CTRL_GCM_SET_IV_INV 0x18 - -# define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 -# define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a -# define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b -# define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c - -# define EVP_CTRL_SSL3_MASTER_SECRET 0x1d - -/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ -# define EVP_CTRL_SET_SBOX 0x1e -/* - * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a - * pre-allocated buffer with specified size - */ -# define EVP_CTRL_SBOX_USED 0x1f -/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, - * 0 switches meshing off - */ -# define EVP_CTRL_KEY_MESH 0x20 -/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ -# define EVP_CTRL_BLOCK_PADDING_MODE 0x21 - -/* Set the output buffers to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 -/* Set the input buffers to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 -/* Set the input buffer lengths to use for a pipelined operation */ -# define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 - -# define EVP_CTRL_GET_IVLEN 0x25 - -/* Padding modes */ -#define EVP_PADDING_PKCS7 1 -#define EVP_PADDING_ISO7816_4 2 -#define EVP_PADDING_ANSI923 3 -#define EVP_PADDING_ISO10126 4 -#define EVP_PADDING_ZERO 5 - -/* RFC 5246 defines additional data to be 13 bytes in length */ -# define EVP_AEAD_TLS1_AAD_LEN 13 - -typedef struct { - unsigned char *out; - const unsigned char *inp; - size_t len; - unsigned int interleave; -} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; - -/* GCM TLS constants */ -/* Length of fixed part of IV derived from PRF */ -# define EVP_GCM_TLS_FIXED_IV_LEN 4 -/* Length of explicit part of IV part of TLS records */ -# define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 -/* Length of tag for TLS */ -# define EVP_GCM_TLS_TAG_LEN 16 - -/* CCM TLS constants */ -/* Length of fixed part of IV derived from PRF */ -# define EVP_CCM_TLS_FIXED_IV_LEN 4 -/* Length of explicit part of IV part of TLS records */ -# define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 -/* Total length of CCM IV length for TLS */ -# define EVP_CCM_TLS_IV_LEN 12 -/* Length of tag for TLS */ -# define EVP_CCM_TLS_TAG_LEN 16 -/* Length of CCM8 tag for TLS */ -# define EVP_CCM8_TLS_TAG_LEN 8 - -/* Length of tag for TLS */ -# define EVP_CHACHAPOLY_TLS_TAG_LEN 16 - -typedef struct evp_cipher_info_st { - const EVP_CIPHER *cipher; - unsigned char iv[EVP_MAX_IV_LENGTH]; -} EVP_CIPHER_INFO; - - -/* Password based encryption function */ -typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, - int passlen, ASN1_TYPE *param, - const EVP_CIPHER *cipher, const EVP_MD *md, - int en_de); - -# ifndef OPENSSL_NO_RSA -# define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ - (char *)(rsa)) -# endif - -# ifndef OPENSSL_NO_DSA -# define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ - (char *)(dsa)) -# endif - -# ifndef OPENSSL_NO_DH -# define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ - (char *)(dh)) -# endif - -# ifndef OPENSSL_NO_EC -# define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ - (char *)(eckey)) -# endif -# ifndef OPENSSL_NO_SIPHASH -# define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),EVP_PKEY_SIPHASH,\ - (char *)(shkey)) -# endif - -# ifndef OPENSSL_NO_POLY1305 -# define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),EVP_PKEY_POLY1305,\ - (char *)(polykey)) -# endif - -/* Add some extra combinations */ -# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) -# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) -# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) -# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) - -int EVP_MD_type(const EVP_MD *md); -# define EVP_MD_nid(e) EVP_MD_type(e) -# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) -int EVP_MD_pkey_type(const EVP_MD *md); -int EVP_MD_size(const EVP_MD *md); -int EVP_MD_block_size(const EVP_MD *md); -unsigned long EVP_MD_flags(const EVP_MD *md); - -const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); -int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, - const void *data, size_t count); -void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, - int (*update) (EVP_MD_CTX *ctx, - const void *data, size_t count)); -# define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) -# define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) -# define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) -EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); -void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); -void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); - -int EVP_CIPHER_nid(const EVP_CIPHER *cipher); -# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) -int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); -int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); -int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); -int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); -unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); -# define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) - -const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); -const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); -const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); -unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); -unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); -int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx); -void EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); -int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); -void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); -void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); -void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); -void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); -# define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) -# if OPENSSL_API_COMPAT < 0x10100000L -# define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) -# endif -# define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c)) - -# define EVP_ENCODE_LENGTH(l) ((((l)+2)/3*4)+((l)/48+1)*2+80) -# define EVP_DECODE_LENGTH(l) (((l)+3)/4*3+80) - -# define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) -# define EVP_SignInit(a,b) EVP_DigestInit(a,b) -# define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) -# define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) -# define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) -# define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) -# define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) -# define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) - -# ifdef CONST_STRICT -void BIO_set_md(BIO *, const EVP_MD *md); -# else -# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)(md)) -# endif -# define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)(mdp)) -# define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0, \ - (char *)(mdcp)) -# define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0, \ - (char *)(mdcp)) -# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) -# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0, \ - (char *)(c_pp)) - -/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c, - unsigned char *out, - const unsigned char *in, unsigned int inl); - -# define EVP_add_cipher_alias(n,alias) \ - OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) -# define EVP_add_digest_alias(n,alias) \ - OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) -# define EVP_delete_cipher_alias(alias) \ - OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); -# define EVP_delete_digest_alias(alias) \ - OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); - -int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); -EVP_MD_CTX *EVP_MD_CTX_new(void); -int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); -void EVP_MD_CTX_free(EVP_MD_CTX *ctx); -# define EVP_MD_CTX_create() EVP_MD_CTX_new() -# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) -# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) -__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); -void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); -void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); -int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); -__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, - ENGINE *impl); -__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, - size_t cnt); -__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); -__owur int EVP_Digest(const void *data, size_t count, - unsigned char *md, unsigned int *size, - const EVP_MD *type, ENGINE *impl); - -__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); -__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); -__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, - unsigned int *s); -__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, - size_t len); - -int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); -int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, - const char *prompt, int verify); -void EVP_set_pw_prompt(const char *prompt); -char *EVP_get_pw_prompt(void); - -__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, - const unsigned char *salt, - const unsigned char *data, int datal, int count, - unsigned char *key, unsigned char *iv); - -void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); -void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); -int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); - -__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv); -/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv); -/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); -/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl); - -__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv); -/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv); -/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); -/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - -__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, - const unsigned char *key, const unsigned char *iv, - int enc); -/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, - const EVP_CIPHER *cipher, ENGINE *impl, - const unsigned char *key, - const unsigned char *iv, int enc); -__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, - int *outl, const unsigned char *in, int inl); -__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); -__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, - int *outl); - -__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, - EVP_PKEY *pkey); - -__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen, const unsigned char *tbs, - size_t tbslen); - -__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, - unsigned int siglen, EVP_PKEY *pkey); - -__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, - size_t siglen, const unsigned char *tbs, - size_t tbslen); - -/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, - EVP_PKEY *pkey); -__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, - size_t *siglen); - -__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const EVP_MD *type, ENGINE *e, - EVP_PKEY *pkey); -__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, - size_t siglen); - -# ifndef OPENSSL_NO_RSA -__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - const unsigned char *ek, int ekl, - const unsigned char *iv, EVP_PKEY *priv); -__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); - -__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, - unsigned char **ek, int *ekl, unsigned char *iv, - EVP_PKEY **pubk, int npubk); -__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); -# endif - -EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); -void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); -int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx); -int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); -void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); -int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, - const unsigned char *in, int inl); -void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); -int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); - -void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); -int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, - const unsigned char *in, int inl); -int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned - char *out, int *outl); -int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) -# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) -# endif -EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); -int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); -void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); -int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); -int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); -int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); -int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); - -const BIO_METHOD *BIO_f_md(void); -const BIO_METHOD *BIO_f_base64(void); -const BIO_METHOD *BIO_f_cipher(void); -const BIO_METHOD *BIO_f_reliable(void); -__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, - const unsigned char *i, int enc); - -const EVP_MD *EVP_md_null(void); -# ifndef OPENSSL_NO_MD2 -const EVP_MD *EVP_md2(void); -# endif -# ifndef OPENSSL_NO_MD4 -const EVP_MD *EVP_md4(void); -# endif -# ifndef OPENSSL_NO_MD5 -const EVP_MD *EVP_md5(void); -const EVP_MD *EVP_md5_sha1(void); -# endif -# ifndef OPENSSL_NO_BLAKE2 -const EVP_MD *EVP_blake2b512(void); -const EVP_MD *EVP_blake2s256(void); -# endif -const EVP_MD *EVP_sha1(void); -const EVP_MD *EVP_sha224(void); -const EVP_MD *EVP_sha256(void); -const EVP_MD *EVP_sha384(void); -const EVP_MD *EVP_sha512(void); -const EVP_MD *EVP_sha512_224(void); -const EVP_MD *EVP_sha512_256(void); -const EVP_MD *EVP_sha3_224(void); -const EVP_MD *EVP_sha3_256(void); -const EVP_MD *EVP_sha3_384(void); -const EVP_MD *EVP_sha3_512(void); -const EVP_MD *EVP_shake128(void); -const EVP_MD *EVP_shake256(void); -# ifndef OPENSSL_NO_MDC2 -const EVP_MD *EVP_mdc2(void); -# endif -# ifndef OPENSSL_NO_RMD160 -const EVP_MD *EVP_ripemd160(void); -# endif -# ifndef OPENSSL_NO_WHIRLPOOL -const EVP_MD *EVP_whirlpool(void); -# endif -# ifndef OPENSSL_NO_SM3 -const EVP_MD *EVP_sm3(void); -# endif -const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ -# ifndef OPENSSL_NO_DES -const EVP_CIPHER *EVP_des_ecb(void); -const EVP_CIPHER *EVP_des_ede(void); -const EVP_CIPHER *EVP_des_ede3(void); -const EVP_CIPHER *EVP_des_ede_ecb(void); -const EVP_CIPHER *EVP_des_ede3_ecb(void); -const EVP_CIPHER *EVP_des_cfb64(void); -# define EVP_des_cfb EVP_des_cfb64 -const EVP_CIPHER *EVP_des_cfb1(void); -const EVP_CIPHER *EVP_des_cfb8(void); -const EVP_CIPHER *EVP_des_ede_cfb64(void); -# define EVP_des_ede_cfb EVP_des_ede_cfb64 -const EVP_CIPHER *EVP_des_ede3_cfb64(void); -# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 -const EVP_CIPHER *EVP_des_ede3_cfb1(void); -const EVP_CIPHER *EVP_des_ede3_cfb8(void); -const EVP_CIPHER *EVP_des_ofb(void); -const EVP_CIPHER *EVP_des_ede_ofb(void); -const EVP_CIPHER *EVP_des_ede3_ofb(void); -const EVP_CIPHER *EVP_des_cbc(void); -const EVP_CIPHER *EVP_des_ede_cbc(void); -const EVP_CIPHER *EVP_des_ede3_cbc(void); -const EVP_CIPHER *EVP_desx_cbc(void); -const EVP_CIPHER *EVP_des_ede3_wrap(void); -/* - * This should now be supported through the dev_crypto ENGINE. But also, why - * are rc4 and md5 declarations made here inside a "NO_DES" precompiler - * branch? - */ -# endif -# ifndef OPENSSL_NO_RC4 -const EVP_CIPHER *EVP_rc4(void); -const EVP_CIPHER *EVP_rc4_40(void); -# ifndef OPENSSL_NO_MD5 -const EVP_CIPHER *EVP_rc4_hmac_md5(void); -# endif -# endif -# ifndef OPENSSL_NO_IDEA -const EVP_CIPHER *EVP_idea_ecb(void); -const EVP_CIPHER *EVP_idea_cfb64(void); -# define EVP_idea_cfb EVP_idea_cfb64 -const EVP_CIPHER *EVP_idea_ofb(void); -const EVP_CIPHER *EVP_idea_cbc(void); -# endif -# ifndef OPENSSL_NO_RC2 -const EVP_CIPHER *EVP_rc2_ecb(void); -const EVP_CIPHER *EVP_rc2_cbc(void); -const EVP_CIPHER *EVP_rc2_40_cbc(void); -const EVP_CIPHER *EVP_rc2_64_cbc(void); -const EVP_CIPHER *EVP_rc2_cfb64(void); -# define EVP_rc2_cfb EVP_rc2_cfb64 -const EVP_CIPHER *EVP_rc2_ofb(void); -# endif -# ifndef OPENSSL_NO_BF -const EVP_CIPHER *EVP_bf_ecb(void); -const EVP_CIPHER *EVP_bf_cbc(void); -const EVP_CIPHER *EVP_bf_cfb64(void); -# define EVP_bf_cfb EVP_bf_cfb64 -const EVP_CIPHER *EVP_bf_ofb(void); -# endif -# ifndef OPENSSL_NO_CAST -const EVP_CIPHER *EVP_cast5_ecb(void); -const EVP_CIPHER *EVP_cast5_cbc(void); -const EVP_CIPHER *EVP_cast5_cfb64(void); -# define EVP_cast5_cfb EVP_cast5_cfb64 -const EVP_CIPHER *EVP_cast5_ofb(void); -# endif -# ifndef OPENSSL_NO_RC5 -const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); -const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); -const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); -# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 -const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); -# endif -const EVP_CIPHER *EVP_aes_128_ecb(void); -const EVP_CIPHER *EVP_aes_128_cbc(void); -const EVP_CIPHER *EVP_aes_128_cfb1(void); -const EVP_CIPHER *EVP_aes_128_cfb8(void); -const EVP_CIPHER *EVP_aes_128_cfb128(void); -# define EVP_aes_128_cfb EVP_aes_128_cfb128 -const EVP_CIPHER *EVP_aes_128_ofb(void); -const EVP_CIPHER *EVP_aes_128_ctr(void); -const EVP_CIPHER *EVP_aes_128_ccm(void); -const EVP_CIPHER *EVP_aes_128_gcm(void); -const EVP_CIPHER *EVP_aes_128_xts(void); -const EVP_CIPHER *EVP_aes_128_wrap(void); -const EVP_CIPHER *EVP_aes_128_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_128_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_192_ecb(void); -const EVP_CIPHER *EVP_aes_192_cbc(void); -const EVP_CIPHER *EVP_aes_192_cfb1(void); -const EVP_CIPHER *EVP_aes_192_cfb8(void); -const EVP_CIPHER *EVP_aes_192_cfb128(void); -# define EVP_aes_192_cfb EVP_aes_192_cfb128 -const EVP_CIPHER *EVP_aes_192_ofb(void); -const EVP_CIPHER *EVP_aes_192_ctr(void); -const EVP_CIPHER *EVP_aes_192_ccm(void); -const EVP_CIPHER *EVP_aes_192_gcm(void); -const EVP_CIPHER *EVP_aes_192_wrap(void); -const EVP_CIPHER *EVP_aes_192_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_192_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_256_ecb(void); -const EVP_CIPHER *EVP_aes_256_cbc(void); -const EVP_CIPHER *EVP_aes_256_cfb1(void); -const EVP_CIPHER *EVP_aes_256_cfb8(void); -const EVP_CIPHER *EVP_aes_256_cfb128(void); -# define EVP_aes_256_cfb EVP_aes_256_cfb128 -const EVP_CIPHER *EVP_aes_256_ofb(void); -const EVP_CIPHER *EVP_aes_256_ctr(void); -const EVP_CIPHER *EVP_aes_256_ccm(void); -const EVP_CIPHER *EVP_aes_256_gcm(void); -const EVP_CIPHER *EVP_aes_256_xts(void); -const EVP_CIPHER *EVP_aes_256_wrap(void); -const EVP_CIPHER *EVP_aes_256_wrap_pad(void); -# ifndef OPENSSL_NO_OCB -const EVP_CIPHER *EVP_aes_256_ocb(void); -# endif -const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); -const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); -const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); -const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); -# ifndef OPENSSL_NO_ARIA -const EVP_CIPHER *EVP_aria_128_ecb(void); -const EVP_CIPHER *EVP_aria_128_cbc(void); -const EVP_CIPHER *EVP_aria_128_cfb1(void); -const EVP_CIPHER *EVP_aria_128_cfb8(void); -const EVP_CIPHER *EVP_aria_128_cfb128(void); -# define EVP_aria_128_cfb EVP_aria_128_cfb128 -const EVP_CIPHER *EVP_aria_128_ctr(void); -const EVP_CIPHER *EVP_aria_128_ofb(void); -const EVP_CIPHER *EVP_aria_128_gcm(void); -const EVP_CIPHER *EVP_aria_128_ccm(void); -const EVP_CIPHER *EVP_aria_192_ecb(void); -const EVP_CIPHER *EVP_aria_192_cbc(void); -const EVP_CIPHER *EVP_aria_192_cfb1(void); -const EVP_CIPHER *EVP_aria_192_cfb8(void); -const EVP_CIPHER *EVP_aria_192_cfb128(void); -# define EVP_aria_192_cfb EVP_aria_192_cfb128 -const EVP_CIPHER *EVP_aria_192_ctr(void); -const EVP_CIPHER *EVP_aria_192_ofb(void); -const EVP_CIPHER *EVP_aria_192_gcm(void); -const EVP_CIPHER *EVP_aria_192_ccm(void); -const EVP_CIPHER *EVP_aria_256_ecb(void); -const EVP_CIPHER *EVP_aria_256_cbc(void); -const EVP_CIPHER *EVP_aria_256_cfb1(void); -const EVP_CIPHER *EVP_aria_256_cfb8(void); -const EVP_CIPHER *EVP_aria_256_cfb128(void); -# define EVP_aria_256_cfb EVP_aria_256_cfb128 -const EVP_CIPHER *EVP_aria_256_ctr(void); -const EVP_CIPHER *EVP_aria_256_ofb(void); -const EVP_CIPHER *EVP_aria_256_gcm(void); -const EVP_CIPHER *EVP_aria_256_ccm(void); -# endif -# ifndef OPENSSL_NO_CAMELLIA -const EVP_CIPHER *EVP_camellia_128_ecb(void); -const EVP_CIPHER *EVP_camellia_128_cbc(void); -const EVP_CIPHER *EVP_camellia_128_cfb1(void); -const EVP_CIPHER *EVP_camellia_128_cfb8(void); -const EVP_CIPHER *EVP_camellia_128_cfb128(void); -# define EVP_camellia_128_cfb EVP_camellia_128_cfb128 -const EVP_CIPHER *EVP_camellia_128_ofb(void); -const EVP_CIPHER *EVP_camellia_128_ctr(void); -const EVP_CIPHER *EVP_camellia_192_ecb(void); -const EVP_CIPHER *EVP_camellia_192_cbc(void); -const EVP_CIPHER *EVP_camellia_192_cfb1(void); -const EVP_CIPHER *EVP_camellia_192_cfb8(void); -const EVP_CIPHER *EVP_camellia_192_cfb128(void); -# define EVP_camellia_192_cfb EVP_camellia_192_cfb128 -const EVP_CIPHER *EVP_camellia_192_ofb(void); -const EVP_CIPHER *EVP_camellia_192_ctr(void); -const EVP_CIPHER *EVP_camellia_256_ecb(void); -const EVP_CIPHER *EVP_camellia_256_cbc(void); -const EVP_CIPHER *EVP_camellia_256_cfb1(void); -const EVP_CIPHER *EVP_camellia_256_cfb8(void); -const EVP_CIPHER *EVP_camellia_256_cfb128(void); -# define EVP_camellia_256_cfb EVP_camellia_256_cfb128 -const EVP_CIPHER *EVP_camellia_256_ofb(void); -const EVP_CIPHER *EVP_camellia_256_ctr(void); -# endif -# ifndef OPENSSL_NO_CHACHA -const EVP_CIPHER *EVP_chacha20(void); -# ifndef OPENSSL_NO_POLY1305 -const EVP_CIPHER *EVP_chacha20_poly1305(void); -# endif -# endif - -# ifndef OPENSSL_NO_SEED -const EVP_CIPHER *EVP_seed_ecb(void); -const EVP_CIPHER *EVP_seed_cbc(void); -const EVP_CIPHER *EVP_seed_cfb128(void); -# define EVP_seed_cfb EVP_seed_cfb128 -const EVP_CIPHER *EVP_seed_ofb(void); -# endif - -# ifndef OPENSSL_NO_SM4 -const EVP_CIPHER *EVP_sm4_ecb(void); -const EVP_CIPHER *EVP_sm4_cbc(void); -const EVP_CIPHER *EVP_sm4_cfb128(void); -# define EVP_sm4_cfb EVP_sm4_cfb128 -const EVP_CIPHER *EVP_sm4_ofb(void); -const EVP_CIPHER *EVP_sm4_ctr(void); -# endif - -# if OPENSSL_API_COMPAT < 0x10100000L -# define OPENSSL_add_all_algorithms_conf() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ - | OPENSSL_INIT_ADD_ALL_DIGESTS \ - | OPENSSL_INIT_LOAD_CONFIG, NULL) -# define OPENSSL_add_all_algorithms_noconf() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ - | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) - -# ifdef OPENSSL_LOAD_CONF -# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() -# else -# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() -# endif - -# define OpenSSL_add_all_ciphers() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) -# define OpenSSL_add_all_digests() \ - OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) - -# define EVP_cleanup() while(0) continue -# endif - -int EVP_add_cipher(const EVP_CIPHER *cipher); -int EVP_add_digest(const EVP_MD *digest); - -const EVP_CIPHER *EVP_get_cipherbyname(const char *name); -const EVP_MD *EVP_get_digestbyname(const char *name); - -void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, - const char *from, const char *to, void *x), - void *arg); -void EVP_CIPHER_do_all_sorted(void (*fn) - (const EVP_CIPHER *ciph, const char *from, - const char *to, void *x), void *arg); - -void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, - const char *from, const char *to, void *x), - void *arg); -void EVP_MD_do_all_sorted(void (*fn) - (const EVP_MD *ciph, const char *from, - const char *to, void *x), void *arg); - -int EVP_PKEY_decrypt_old(unsigned char *dec_key, - const unsigned char *enc_key, int enc_key_len, - EVP_PKEY *private_key); -int EVP_PKEY_encrypt_old(unsigned char *enc_key, - const unsigned char *key, int key_len, - EVP_PKEY *pub_key); -int EVP_PKEY_type(int type); -int EVP_PKEY_id(const EVP_PKEY *pkey); -int EVP_PKEY_base_id(const EVP_PKEY *pkey); -int EVP_PKEY_bits(const EVP_PKEY *pkey); -int EVP_PKEY_security_bits(const EVP_PKEY *pkey); -int EVP_PKEY_size(const EVP_PKEY *pkey); -int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); -int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); -int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); -# ifndef OPENSSL_NO_ENGINE -int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); -ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); -# endif -int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); -void *EVP_PKEY_get0(const EVP_PKEY *pkey); -const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); -# ifndef OPENSSL_NO_POLY1305 -const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); -# endif -# ifndef OPENSSL_NO_SIPHASH -const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); -# endif - -# ifndef OPENSSL_NO_RSA -struct rsa_st; -int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); -struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); -struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_DSA -struct dsa_st; -int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); -struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); -struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_DH -struct dh_st; -int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); -struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); -struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); -# endif -# ifndef OPENSSL_NO_EC -struct ec_key_st; -int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); -struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); -struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); -# endif - -EVP_PKEY *EVP_PKEY_new(void); -int EVP_PKEY_up_ref(EVP_PKEY *pkey); -void EVP_PKEY_free(EVP_PKEY *pkey); - -EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, - long length); -int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); - -EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, - long length); -EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, - long length); -int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); - -int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); -int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); -int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); -int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); - -int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); - -int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); -int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); -int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx); - -int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); - -int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, - const unsigned char *pt, size_t ptlen); -size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); - -int EVP_CIPHER_type(const EVP_CIPHER *ctx); - -/* calls methods */ -int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -/* These are used by EVP_CIPHER methods */ -int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); - -/* PKCS5 password based encryption */ -int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md, int en_de); -int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, - const unsigned char *salt, int saltlen, int iter, - int keylen, unsigned char *out); -int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, - const unsigned char *salt, int saltlen, int iter, - const EVP_MD *digest, int keylen, unsigned char *out); -int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md, int en_de); - -#ifndef OPENSSL_NO_SCRYPT -int EVP_PBE_scrypt(const char *pass, size_t passlen, - const unsigned char *salt, size_t saltlen, - uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, - unsigned char *key, size_t keylen); - -int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, - int passlen, ASN1_TYPE *param, - const EVP_CIPHER *c, const EVP_MD *md, int en_de); -#endif - -void PKCS5_PBE_add(void); - -int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, - ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); - -/* PBE type */ - -/* Can appear as the outermost AlgorithmIdentifier */ -# define EVP_PBE_TYPE_OUTER 0x0 -/* Is an PRF type OID */ -# define EVP_PBE_TYPE_PRF 0x1 -/* Is a PKCS#5 v2.0 KDF */ -# define EVP_PBE_TYPE_KDF 0x2 - -int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, - int md_nid, EVP_PBE_KEYGEN *keygen); -int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, - EVP_PBE_KEYGEN *keygen); -int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, - EVP_PBE_KEYGEN **pkeygen); -void EVP_PBE_cleanup(void); -int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); - -# define ASN1_PKEY_ALIAS 0x1 -# define ASN1_PKEY_DYNAMIC 0x2 -# define ASN1_PKEY_SIGPARAM_NULL 0x4 - -# define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 -# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 -# define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 -# define ASN1_PKEY_CTRL_CMS_SIGN 0x5 -# define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 -# define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 - -# define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 -# define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa - -int EVP_PKEY_asn1_get_count(void); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, - const char *str, int len); -int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); -int EVP_PKEY_asn1_add_alias(int to, int from); -int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, - int *ppkey_flags, const char **pinfo, - const char **ppem_str, - const EVP_PKEY_ASN1_METHOD *ameth); - -const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); -EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, - const char *pem_str, - const char *info); -void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, - const EVP_PKEY_ASN1_METHOD *src); -void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); -void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, - int (*pub_decode) (EVP_PKEY *pk, - X509_PUBKEY *pub), - int (*pub_encode) (X509_PUBKEY *pub, - const EVP_PKEY *pk), - int (*pub_cmp) (const EVP_PKEY *a, - const EVP_PKEY *b), - int (*pub_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, ASN1_PCTX *pctx), - int (*pkey_size) (const EVP_PKEY *pk), - int (*pkey_bits) (const EVP_PKEY *pk)); -void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, - int (*priv_decode) (EVP_PKEY *pk, - const PKCS8_PRIV_KEY_INFO - *p8inf), - int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, - const EVP_PKEY *pk), - int (*priv_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, - ASN1_PCTX *pctx)); -void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, - int (*param_decode) (EVP_PKEY *pkey, - const unsigned char **pder, - int derlen), - int (*param_encode) (const EVP_PKEY *pkey, - unsigned char **pder), - int (*param_missing) (const EVP_PKEY *pk), - int (*param_copy) (EVP_PKEY *to, - const EVP_PKEY *from), - int (*param_cmp) (const EVP_PKEY *a, - const EVP_PKEY *b), - int (*param_print) (BIO *out, - const EVP_PKEY *pkey, - int indent, - ASN1_PCTX *pctx)); - -void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, - void (*pkey_free) (EVP_PKEY *pkey)); -void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_ctrl) (EVP_PKEY *pkey, int op, - long arg1, void *arg2)); -void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, - int (*item_verify) (EVP_MD_CTX *ctx, - const ASN1_ITEM *it, - void *asn, - X509_ALGOR *a, - ASN1_BIT_STRING *sig, - EVP_PKEY *pkey), - int (*item_sign) (EVP_MD_CTX *ctx, - const ASN1_ITEM *it, - void *asn, - X509_ALGOR *alg1, - X509_ALGOR *alg2, - ASN1_BIT_STRING *sig)); - -void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, - int (*siginf_set) (X509_SIG_INFO *siginf, - const X509_ALGOR *alg, - const ASN1_STRING *sig)); - -void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_pub_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_param_check) (const EVP_PKEY *pk)); - -void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*set_priv_key) (EVP_PKEY *pk, - const unsigned char - *priv, - size_t len)); -void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*set_pub_key) (EVP_PKEY *pk, - const unsigned char *pub, - size_t len)); -void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*get_priv_key) (const EVP_PKEY *pk, - unsigned char *priv, - size_t *len)); -void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, - int (*get_pub_key) (const EVP_PKEY *pk, - unsigned char *pub, - size_t *len)); - -void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, - int (*pkey_security_bits) (const EVP_PKEY - *pk)); - -# define EVP_PKEY_OP_UNDEFINED 0 -# define EVP_PKEY_OP_PARAMGEN (1<<1) -# define EVP_PKEY_OP_KEYGEN (1<<2) -# define EVP_PKEY_OP_SIGN (1<<3) -# define EVP_PKEY_OP_VERIFY (1<<4) -# define EVP_PKEY_OP_VERIFYRECOVER (1<<5) -# define EVP_PKEY_OP_SIGNCTX (1<<6) -# define EVP_PKEY_OP_VERIFYCTX (1<<7) -# define EVP_PKEY_OP_ENCRYPT (1<<8) -# define EVP_PKEY_OP_DECRYPT (1<<9) -# define EVP_PKEY_OP_DERIVE (1<<10) - -# define EVP_PKEY_OP_TYPE_SIG \ - (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ - | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) - -# define EVP_PKEY_OP_TYPE_CRYPT \ - (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) - -# define EVP_PKEY_OP_TYPE_NOGEN \ - (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE) - -# define EVP_PKEY_OP_TYPE_GEN \ - (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) - -# define EVP_PKEY_CTX_set_signature_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ - EVP_PKEY_CTRL_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ - EVP_PKEY_CTRL_GET_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \ - EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)(key)) - -# define EVP_PKEY_CTRL_MD 1 -# define EVP_PKEY_CTRL_PEER_KEY 2 - -# define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 -# define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 - -# define EVP_PKEY_CTRL_PKCS7_SIGN 5 - -# define EVP_PKEY_CTRL_SET_MAC_KEY 6 - -# define EVP_PKEY_CTRL_DIGESTINIT 7 - -/* Used by GOST key encryption in TLS */ -# define EVP_PKEY_CTRL_SET_IV 8 - -# define EVP_PKEY_CTRL_CMS_ENCRYPT 9 -# define EVP_PKEY_CTRL_CMS_DECRYPT 10 -# define EVP_PKEY_CTRL_CMS_SIGN 11 - -# define EVP_PKEY_CTRL_CIPHER 12 - -# define EVP_PKEY_CTRL_GET_MD 13 - -# define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 - -# define EVP_PKEY_ALG_CTRL 0x1000 - -# define EVP_PKEY_FLAG_AUTOARGLEN 2 -/* - * Method handles all operations: don't assume any digest related defaults. - */ -# define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 - -const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); -EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); -void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, - const EVP_PKEY_METHOD *meth); -void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); -void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); -int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); -int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); -size_t EVP_PKEY_meth_get_count(void); -const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); - -EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); -EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); -EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); -void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, - int cmd, int p1, void *p2); -int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, - const char *value); -int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, - int cmd, uint64_t value); - -int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); -int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); - -int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); - -int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); -void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); - -EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, - const unsigned char *key, int keylen); -EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, - const unsigned char *priv, - size_t len); -EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, - const unsigned char *pub, - size_t len); -int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, - size_t *len); -int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, - size_t *len); - -EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, - size_t len, const EVP_CIPHER *cipher); - -void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); -void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); -EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); - -EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); - -void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); -void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, size_t tbslen); -int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, - const unsigned char *sig, size_t siglen, - const unsigned char *tbs, size_t tbslen); -int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, - unsigned char *rout, size_t *routlen, - const unsigned char *sig, size_t siglen); -int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); -int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); - -int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); -int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); - -typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); -int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); -int EVP_PKEY_check(EVP_PKEY_CTX *ctx); -int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); -int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); - -void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); -EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); - -int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); - -void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, - int (*init) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, - int (*copy) (EVP_PKEY_CTX *dst, - EVP_PKEY_CTX *src)); - -void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, - void (*cleanup) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, - int (*paramgen_init) (EVP_PKEY_CTX *ctx), - int (*paramgen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, - int (*keygen_init) (EVP_PKEY_CTX *ctx), - int (*keygen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, - int (*sign_init) (EVP_PKEY_CTX *ctx), - int (*sign) (EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, - int (*verify_init) (EVP_PKEY_CTX *ctx), - int (*verify) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, - int (*verify_recover_init) (EVP_PKEY_CTX - *ctx), - int (*verify_recover) (EVP_PKEY_CTX - *ctx, - unsigned char - *sig, - size_t *siglen, - const unsigned - char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, - int (*signctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (*signctx) (EVP_PKEY_CTX *ctx, - unsigned char *sig, - size_t *siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, - int (*verifyctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (*verifyctx) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - int siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, - int (*encrypt_init) (EVP_PKEY_CTX *ctx), - int (*encryptfn) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, - int (*decrypt_init) (EVP_PKEY_CTX *ctx), - int (*decrypt) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, - int (*derive_init) (EVP_PKEY_CTX *ctx), - int (*derive) (EVP_PKEY_CTX *ctx, - unsigned char *key, - size_t *keylen)); - -void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, - int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, - void *p2), - int (*ctrl_str) (EVP_PKEY_CTX *ctx, - const char *type, - const char *value)); - -void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth, - int (*digestsign) (EVP_MD_CTX *ctx, - unsigned char *sig, - size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth, - int (*digestverify) (EVP_MD_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, - int (*check) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, - int (*digest_custom) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, - int (**pinit) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, - int (**pcopy) (EVP_PKEY_CTX *dst, - EVP_PKEY_CTX *src)); - -void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, - void (**pcleanup) (EVP_PKEY_CTX *ctx)); - -void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, - int (**pparamgen_init) (EVP_PKEY_CTX *ctx), - int (**pparamgen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, - int (**pkeygen_init) (EVP_PKEY_CTX *ctx), - int (**pkeygen) (EVP_PKEY_CTX *ctx, - EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, - int (**psign_init) (EVP_PKEY_CTX *ctx), - int (**psign) (EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, - int (**pverify_init) (EVP_PKEY_CTX *ctx), - int (**pverify) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, - int (**pverify_recover_init) (EVP_PKEY_CTX - *ctx), - int (**pverify_recover) (EVP_PKEY_CTX - *ctx, - unsigned char - *sig, - size_t *siglen, - const unsigned - char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, - int (**psignctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (**psignctx) (EVP_PKEY_CTX *ctx, - unsigned char *sig, - size_t *siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, - int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx), - int (**pverifyctx) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, - int siglen, - EVP_MD_CTX *mctx)); - -void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, - int (**pencrypt_init) (EVP_PKEY_CTX *ctx), - int (**pencryptfn) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, - int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), - int (**pdecrypt) (EVP_PKEY_CTX *ctx, - unsigned char *out, - size_t *outlen, - const unsigned char *in, - size_t inlen)); - -void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, - int (**pderive_init) (EVP_PKEY_CTX *ctx), - int (**pderive) (EVP_PKEY_CTX *ctx, - unsigned char *key, - size_t *keylen)); - -void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, - int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, - void *p2), - int (**pctrl_str) (EVP_PKEY_CTX *ctx, - const char *type, - const char *value)); - -void EVP_PKEY_meth_get_digestsign(EVP_PKEY_METHOD *pmeth, - int (**digestsign) (EVP_MD_CTX *ctx, - unsigned char *sig, - size_t *siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_digestverify(EVP_PKEY_METHOD *pmeth, - int (**digestverify) (EVP_MD_CTX *ctx, - const unsigned char *sig, - size_t siglen, - const unsigned char *tbs, - size_t tbslen)); - -void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, - int (**pcheck) (EVP_PKEY *pkey)); - -void EVP_PKEY_meth_get_digest_custom(EVP_PKEY_METHOD *pmeth, - int (**pdigest_custom) (EVP_PKEY_CTX *ctx, - EVP_MD_CTX *mctx)); -void EVP_add_alg_module(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/evperr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/evperr.h deleted file mode 100644 index d2b26ea5..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/evperr.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/hmac.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/hmac.h deleted file mode 100644 index 458efc1d..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/hmac.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 1995-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_HMAC_H -# define HEADER_HMAC_H - -# include - -# include - -# if OPENSSL_API_COMPAT < 0x10200000L -# define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */ -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -size_t HMAC_size(const HMAC_CTX *e); -HMAC_CTX *HMAC_CTX_new(void); -int HMAC_CTX_reset(HMAC_CTX *ctx); -void HMAC_CTX_free(HMAC_CTX *ctx); - -DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md)) - -/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, - const EVP_MD *md, ENGINE *impl); -/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, - size_t len); -/*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, - unsigned int *len); -unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, - const unsigned char *d, size_t n, unsigned char *md, - unsigned int *md_len); -__owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); - -void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); -const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/idea.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/idea.h deleted file mode 100644 index 4334f3ea..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/idea.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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_IDEA_H -# define HEADER_IDEA_H - -# include - -# ifndef OPENSSL_NO_IDEA -# ifdef __cplusplus -extern "C" { -# endif - -typedef unsigned int IDEA_INT; - -# define IDEA_ENCRYPT 1 -# define IDEA_DECRYPT 0 - -# define IDEA_BLOCK 8 -# define IDEA_KEY_LENGTH 16 - -typedef struct idea_key_st { - IDEA_INT data[9][6]; -} IDEA_KEY_SCHEDULE; - -const char *IDEA_options(void); -void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, - 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_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int enc); -void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int *num, int enc); -void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, - int *num); -void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/kdf.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/kdf.h deleted file mode 100644 index 5abd4c37..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/kdf.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 -#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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/kdferr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/kdferr.h deleted file mode 100644 index 3f51bd02..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/kdferr.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/lhash.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/lhash.h deleted file mode 100644 index 2e42d727..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/lhash.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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 - */ - -/* - * Header for dynamic hash table routines Author - Eric Young - */ - -#ifndef HEADER_LHASH_H -# define HEADER_LHASH_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct lhash_node_st OPENSSL_LH_NODE; -typedef int (*OPENSSL_LH_COMPFUNC) (const void *, const void *); -typedef unsigned long (*OPENSSL_LH_HASHFUNC) (const void *); -typedef void (*OPENSSL_LH_DOALL_FUNC) (void *); -typedef void (*OPENSSL_LH_DOALL_FUNCARG) (void *, void *); -typedef struct lhash_st OPENSSL_LHASH; - -/* - * Macros for declaring and implementing type-safe wrappers for LHASH - * callbacks. This way, callbacks can be provided to LHASH structures without - * function pointer casting and the macro-defined callbacks provide - * per-variable casting before deferring to the underlying type-specific - * callbacks. NB: It is possible to place a "static" in front of both the - * DECLARE and IMPLEMENT macros if the functions are strictly internal. - */ - -/* First: "hash" functions */ -# define DECLARE_LHASH_HASH_FN(name, o_type) \ - unsigned long name##_LHASH_HASH(const void *); -# define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ - unsigned long name##_LHASH_HASH(const void *arg) { \ - const o_type *a = arg; \ - return name##_hash(a); } -# define LHASH_HASH_FN(name) name##_LHASH_HASH - -/* Second: "compare" functions */ -# define DECLARE_LHASH_COMP_FN(name, o_type) \ - int name##_LHASH_COMP(const void *, const void *); -# define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ - int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ - const o_type *a = arg1; \ - const o_type *b = arg2; \ - return name##_cmp(a,b); } -# define LHASH_COMP_FN(name) name##_LHASH_COMP - -/* Fourth: "doall_arg" functions */ -# define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ - void name##_LHASH_DOALL_ARG(void *, void *); -# define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ - void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ - o_type *a = arg1; \ - a_type *b = arg2; \ - name##_doall_arg(a, b); } -# define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG - - -# define LH_LOAD_MULT 256 - -int OPENSSL_LH_error(OPENSSL_LHASH *lh); -OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c); -void OPENSSL_LH_free(OPENSSL_LHASH *lh); -void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data); -void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data); -void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data); -void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func); -void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg); -unsigned long OPENSSL_LH_strhash(const char *c); -unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh); -unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh); -void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load); - -# ifndef OPENSSL_NO_STDIO -void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp); -void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp); -void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp); -# endif -void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out); -void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out); -void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define _LHASH OPENSSL_LHASH -# define LHASH_NODE OPENSSL_LH_NODE -# define lh_error OPENSSL_LH_error -# define lh_new OPENSSL_LH_new -# define lh_free OPENSSL_LH_free -# define lh_insert OPENSSL_LH_insert -# define lh_delete OPENSSL_LH_delete -# define lh_retrieve OPENSSL_LH_retrieve -# define lh_doall OPENSSL_LH_doall -# define lh_doall_arg OPENSSL_LH_doall_arg -# define lh_strhash OPENSSL_LH_strhash -# define lh_num_items OPENSSL_LH_num_items -# ifndef OPENSSL_NO_STDIO -# define lh_stats OPENSSL_LH_stats -# define lh_node_stats OPENSSL_LH_node_stats -# define lh_node_usage_stats OPENSSL_LH_node_usage_stats -# endif -# define lh_stats_bio OPENSSL_LH_stats_bio -# define lh_node_stats_bio OPENSSL_LH_node_stats_bio -# define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio -# endif - -/* Type checking... */ - -# define LHASH_OF(type) struct lhash_st_##type - -# define DEFINE_LHASH_OF(type) \ - LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \ - static ossl_unused ossl_inline LHASH_OF(type) *lh_##type##_new(unsigned long (*hfn)(const type *), \ - int (*cfn)(const type *, const type *)) \ - { \ - return (LHASH_OF(type) *) \ - OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \ - } \ - static ossl_unused ossl_inline void lh_##type##_free(LHASH_OF(type) *lh) \ - { \ - OPENSSL_LH_free((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_insert(LHASH_OF(type) *lh, type *d) \ - { \ - return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *d) \ - { \ - return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline type *lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d) \ - { \ - return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \ - } \ - static ossl_unused ossl_inline int lh_##type##_error(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline unsigned long lh_##type##_num_items(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline void lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline void lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline void lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ - { \ - OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \ - } \ - static ossl_unused ossl_inline unsigned long lh_##type##_get_down_load(LHASH_OF(type) *lh) \ - { \ - return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \ - } \ - static ossl_unused ossl_inline void lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl) \ - { \ - OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \ - } \ - static ossl_unused ossl_inline void lh_##type##_doall(LHASH_OF(type) *lh, \ - void (*doall)(type *)) \ - { \ - OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \ - } \ - LHASH_OF(type) - -#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \ - int_implement_lhash_doall(type, argtype, const type) - -#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \ - int_implement_lhash_doall(type, argtype, type) - -#define int_implement_lhash_doall(type, argtype, cbargtype) \ - static ossl_unused ossl_inline void \ - lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \ - void (*fn)(cbargtype *, argtype *), \ - argtype *arg) \ - { \ - OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \ - } \ - LHASH_OF(type) - -DEFINE_LHASH_OF(OPENSSL_STRING); -# ifdef _MSC_VER -/* - * push and pop this warning: - * warning C4090: 'function': different 'const' qualifiers - */ -# pragma warning (push) -# pragma warning (disable: 4090) -# endif - -DEFINE_LHASH_OF(OPENSSL_CSTRING); - -# ifdef _MSC_VER -# pragma warning (pop) -# endif - -/* - * If called without higher optimization (min. -xO3) the Oracle Developer - * Studio compiler generates code for the defined (static inline) functions - * above. - * This would later lead to the linker complaining about missing symbols when - * this header file is included but the resulting object is not linked against - * the Crypto library (openssl#6912). - */ -# ifdef __SUNPRO_C -# pragma weak OPENSSL_LH_new -# pragma weak OPENSSL_LH_free -# pragma weak OPENSSL_LH_insert -# pragma weak OPENSSL_LH_delete -# pragma weak OPENSSL_LH_retrieve -# pragma weak OPENSSL_LH_error -# pragma weak OPENSSL_LH_num_items -# pragma weak OPENSSL_LH_node_stats_bio -# pragma weak OPENSSL_LH_node_usage_stats_bio -# pragma weak OPENSSL_LH_stats_bio -# pragma weak OPENSSL_LH_get_down_load -# pragma weak OPENSSL_LH_set_down_load -# pragma weak OPENSSL_LH_doall -# pragma weak OPENSSL_LH_doall_arg -# endif /* __SUNPRO_C */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/md2.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/md2.h deleted file mode 100644 index 7faf8e3d..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/md2.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 - -# ifndef OPENSSL_NO_MD2 -# include -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/md4.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/md4.h deleted file mode 100644 index 940e29db..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/md4.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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_MD4_H -# define HEADER_MD4_H - -# include - -# ifndef OPENSSL_NO_MD4 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! MD4_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define MD4_LONG unsigned int - -# define MD4_CBLOCK 64 -# define MD4_LBLOCK (MD4_CBLOCK/4) -# define MD4_DIGEST_LENGTH 16 - -typedef struct MD4state_st { - MD4_LONG A, B, C, D; - MD4_LONG Nl, Nh; - MD4_LONG data[MD4_LBLOCK]; - unsigned int num; -} MD4_CTX; - -int MD4_Init(MD4_CTX *c); -int MD4_Update(MD4_CTX *c, const void *data, size_t len); -int MD4_Final(unsigned char *md, MD4_CTX *c); -unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); -void MD4_Transform(MD4_CTX *c, const unsigned char *b); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/md5.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/md5.h deleted file mode 100644 index 2deb7721..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/md5.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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_MD5_H -# define HEADER_MD5_H - -# include - -# ifndef OPENSSL_NO_MD5 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! MD5_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define MD5_LONG unsigned int - -# define MD5_CBLOCK 64 -# define MD5_LBLOCK (MD5_CBLOCK/4) -# define MD5_DIGEST_LENGTH 16 - -typedef struct MD5state_st { - MD5_LONG A, B, C, D; - MD5_LONG Nl, Nh; - MD5_LONG data[MD5_LBLOCK]; - unsigned int num; -} MD5_CTX; - -int MD5_Init(MD5_CTX *c); -int MD5_Update(MD5_CTX *c, const void *data, size_t len); -int MD5_Final(unsigned char *md, MD5_CTX *c); -unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); -void MD5_Transform(MD5_CTX *c, const unsigned char *b); -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/mdc2.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/mdc2.h deleted file mode 100644 index aabd2bfa..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/mdc2.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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_MDC2_H -# define HEADER_MDC2_H - -# include - -#ifndef OPENSSL_NO_MDC2 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define MDC2_BLOCK 8 -# define MDC2_DIGEST_LENGTH 16 - -typedef struct mdc2_ctx_st { - unsigned int num; - unsigned char data[MDC2_BLOCK]; - DES_cblock h, hh; - int pad_type; /* either 1 or 2, default 1 */ -} MDC2_CTX; - -int MDC2_Init(MDC2_CTX *c); -int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); -int MDC2_Final(unsigned char *md, MDC2_CTX *c); -unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/modes.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/modes.h deleted file mode 100644 index d544f98d..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/modes.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright 2008-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_MODES_H -# define HEADER_MODES_H - -# include - -# ifdef __cplusplus -extern "C" { -# endif -typedef void (*block128_f) (const unsigned char in[16], - unsigned char out[16], const void *key); - -typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int enc); - -typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16]); - -typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - const unsigned char ivec[16], - unsigned char cmac[16]); - -void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); -void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], block128_f block); - -void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], - unsigned char ecount_buf[16], unsigned int *num, - block128_f block); - -void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], - unsigned char ecount_buf[16], - unsigned int *num, ctr128_f ctr); - -void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - block128_f block); - -void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); -void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, - size_t length, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); -void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, - size_t bits, const void *key, - unsigned char ivec[16], int *num, - int enc, block128_f block); - -size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, unsigned char ivec[16], - block128_f block); -size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); -size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, unsigned char ivec[16], - block128_f block); -size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); - -size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, - unsigned char ivec[16], - block128_f block); -size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); -size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, - unsigned char *out, size_t len, - const void *key, - unsigned char ivec[16], - block128_f block); -size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, - size_t len, const void *key, - unsigned char ivec[16], cbc128_f cbc); - -typedef struct gcm128_context GCM128_CONTEXT; - -GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); -void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); -void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, - size_t len); -int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, - size_t len); -int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); -int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len); -int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); -int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, - const unsigned char *in, unsigned char *out, - size_t len, ctr128_f stream); -int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, - size_t len); -void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); -void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); - -typedef struct ccm128_context CCM128_CONTEXT; - -void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, - unsigned int M, unsigned int L, void *key, - block128_f block); -int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, - size_t nlen, size_t mlen); -void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, - size_t alen); -int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len); -int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len); -int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len, - ccm128_f stream); -int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, - unsigned char *out, size_t len, - ccm128_f stream); -size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); - -typedef struct xts128_context XTS128_CONTEXT; - -int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, - const unsigned char iv[16], - const unsigned char *inp, unsigned char *out, - size_t len, int enc); - -size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, size_t inlen, - block128_f block); - -size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, size_t inlen, - block128_f block); -size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, - unsigned char *out, const unsigned char *in, - size_t inlen, block128_f block); -size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, - unsigned char *out, const unsigned char *in, - size_t inlen, block128_f block); - -# ifndef OPENSSL_NO_OCB -typedef struct ocb128_context OCB128_CONTEXT; - -typedef void (*ocb128_f) (const unsigned char *in, unsigned char *out, - size_t blocks, const void *key, - size_t start_block_num, - unsigned char offset_i[16], - const unsigned char L_[][16], - unsigned char checksum[16]); - -OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, - block128_f encrypt, block128_f decrypt, - ocb128_f stream); -int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, - block128_f encrypt, block128_f decrypt, - ocb128_f stream); -int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, - void *keyenc, void *keydec); -int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, - size_t len, size_t taglen); -int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, - size_t len); -int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in, - unsigned char *out, size_t len); -int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in, - unsigned char *out, size_t len); -int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag, - size_t len); -int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len); -void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx); -# endif /* OPENSSL_NO_OCB */ - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/obj_mac.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/obj_mac.h deleted file mode 100644 index 483fc050..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/obj_mac.h +++ /dev/null @@ -1,5198 +0,0 @@ -/* - * WARNING: do not edit! - * Generated by crypto/objects/objects.pl - * - * Copyright 2000-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 - */ - -#define SN_undef "UNDEF" -#define LN_undef "undefined" -#define NID_undef 0 -#define OBJ_undef 0L - -#define SN_itu_t "ITU-T" -#define LN_itu_t "itu-t" -#define NID_itu_t 645 -#define OBJ_itu_t 0L - -#define NID_ccitt 404 -#define OBJ_ccitt OBJ_itu_t - -#define SN_iso "ISO" -#define LN_iso "iso" -#define NID_iso 181 -#define OBJ_iso 1L - -#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" -#define LN_joint_iso_itu_t "joint-iso-itu-t" -#define NID_joint_iso_itu_t 646 -#define OBJ_joint_iso_itu_t 2L - -#define NID_joint_iso_ccitt 393 -#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t - -#define SN_member_body "member-body" -#define LN_member_body "ISO Member Body" -#define NID_member_body 182 -#define OBJ_member_body OBJ_iso,2L - -#define SN_identified_organization "identified-organization" -#define NID_identified_organization 676 -#define OBJ_identified_organization OBJ_iso,3L - -#define SN_hmac_md5 "HMAC-MD5" -#define LN_hmac_md5 "hmac-md5" -#define NID_hmac_md5 780 -#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L - -#define SN_hmac_sha1 "HMAC-SHA1" -#define LN_hmac_sha1 "hmac-sha1" -#define NID_hmac_sha1 781 -#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L - -#define SN_x509ExtAdmission "x509ExtAdmission" -#define LN_x509ExtAdmission "Professional Information or basis for Admission" -#define NID_x509ExtAdmission 1093 -#define OBJ_x509ExtAdmission OBJ_identified_organization,36L,8L,3L,3L - -#define SN_certicom_arc "certicom-arc" -#define NID_certicom_arc 677 -#define OBJ_certicom_arc OBJ_identified_organization,132L - -#define SN_ieee "ieee" -#define NID_ieee 1170 -#define OBJ_ieee OBJ_identified_organization,111L - -#define SN_ieee_siswg "ieee-siswg" -#define LN_ieee_siswg "IEEE Security in Storage Working Group" -#define NID_ieee_siswg 1171 -#define OBJ_ieee_siswg OBJ_ieee,2L,1619L - -#define SN_international_organizations "international-organizations" -#define LN_international_organizations "International Organizations" -#define NID_international_organizations 647 -#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L - -#define SN_wap "wap" -#define NID_wap 678 -#define OBJ_wap OBJ_international_organizations,43L - -#define SN_wap_wsg "wap-wsg" -#define NID_wap_wsg 679 -#define OBJ_wap_wsg OBJ_wap,1L - -#define SN_selected_attribute_types "selected-attribute-types" -#define LN_selected_attribute_types "Selected Attribute Types" -#define NID_selected_attribute_types 394 -#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L - -#define SN_clearance "clearance" -#define NID_clearance 395 -#define OBJ_clearance OBJ_selected_attribute_types,55L - -#define SN_ISO_US "ISO-US" -#define LN_ISO_US "ISO US Member Body" -#define NID_ISO_US 183 -#define OBJ_ISO_US OBJ_member_body,840L - -#define SN_X9_57 "X9-57" -#define LN_X9_57 "X9.57" -#define NID_X9_57 184 -#define OBJ_X9_57 OBJ_ISO_US,10040L - -#define SN_X9cm "X9cm" -#define LN_X9cm "X9.57 CM ?" -#define NID_X9cm 185 -#define OBJ_X9cm OBJ_X9_57,4L - -#define SN_ISO_CN "ISO-CN" -#define LN_ISO_CN "ISO CN Member Body" -#define NID_ISO_CN 1140 -#define OBJ_ISO_CN OBJ_member_body,156L - -#define SN_oscca "oscca" -#define NID_oscca 1141 -#define OBJ_oscca OBJ_ISO_CN,10197L - -#define SN_sm_scheme "sm-scheme" -#define NID_sm_scheme 1142 -#define OBJ_sm_scheme OBJ_oscca,1L - -#define SN_dsa "DSA" -#define LN_dsa "dsaEncryption" -#define NID_dsa 116 -#define OBJ_dsa OBJ_X9cm,1L - -#define SN_dsaWithSHA1 "DSA-SHA1" -#define LN_dsaWithSHA1 "dsaWithSHA1" -#define NID_dsaWithSHA1 113 -#define OBJ_dsaWithSHA1 OBJ_X9cm,3L - -#define SN_ansi_X9_62 "ansi-X9-62" -#define LN_ansi_X9_62 "ANSI X9.62" -#define NID_ansi_X9_62 405 -#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L - -#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L - -#define SN_X9_62_prime_field "prime-field" -#define NID_X9_62_prime_field 406 -#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L - -#define SN_X9_62_characteristic_two_field "characteristic-two-field" -#define NID_X9_62_characteristic_two_field 407 -#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L - -#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" -#define NID_X9_62_id_characteristic_two_basis 680 -#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L - -#define SN_X9_62_onBasis "onBasis" -#define NID_X9_62_onBasis 681 -#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L - -#define SN_X9_62_tpBasis "tpBasis" -#define NID_X9_62_tpBasis 682 -#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L - -#define SN_X9_62_ppBasis "ppBasis" -#define NID_X9_62_ppBasis 683 -#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L - -#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L - -#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" -#define NID_X9_62_id_ecPublicKey 408 -#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L - -#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L - -#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L - -#define SN_X9_62_c2pnb163v1 "c2pnb163v1" -#define NID_X9_62_c2pnb163v1 684 -#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L - -#define SN_X9_62_c2pnb163v2 "c2pnb163v2" -#define NID_X9_62_c2pnb163v2 685 -#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L - -#define SN_X9_62_c2pnb163v3 "c2pnb163v3" -#define NID_X9_62_c2pnb163v3 686 -#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L - -#define SN_X9_62_c2pnb176v1 "c2pnb176v1" -#define NID_X9_62_c2pnb176v1 687 -#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L - -#define SN_X9_62_c2tnb191v1 "c2tnb191v1" -#define NID_X9_62_c2tnb191v1 688 -#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L - -#define SN_X9_62_c2tnb191v2 "c2tnb191v2" -#define NID_X9_62_c2tnb191v2 689 -#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L - -#define SN_X9_62_c2tnb191v3 "c2tnb191v3" -#define NID_X9_62_c2tnb191v3 690 -#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L - -#define SN_X9_62_c2onb191v4 "c2onb191v4" -#define NID_X9_62_c2onb191v4 691 -#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L - -#define SN_X9_62_c2onb191v5 "c2onb191v5" -#define NID_X9_62_c2onb191v5 692 -#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L - -#define SN_X9_62_c2pnb208w1 "c2pnb208w1" -#define NID_X9_62_c2pnb208w1 693 -#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L - -#define SN_X9_62_c2tnb239v1 "c2tnb239v1" -#define NID_X9_62_c2tnb239v1 694 -#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L - -#define SN_X9_62_c2tnb239v2 "c2tnb239v2" -#define NID_X9_62_c2tnb239v2 695 -#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L - -#define SN_X9_62_c2tnb239v3 "c2tnb239v3" -#define NID_X9_62_c2tnb239v3 696 -#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L - -#define SN_X9_62_c2onb239v4 "c2onb239v4" -#define NID_X9_62_c2onb239v4 697 -#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L - -#define SN_X9_62_c2onb239v5 "c2onb239v5" -#define NID_X9_62_c2onb239v5 698 -#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L - -#define SN_X9_62_c2pnb272w1 "c2pnb272w1" -#define NID_X9_62_c2pnb272w1 699 -#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L - -#define SN_X9_62_c2pnb304w1 "c2pnb304w1" -#define NID_X9_62_c2pnb304w1 700 -#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L - -#define SN_X9_62_c2tnb359v1 "c2tnb359v1" -#define NID_X9_62_c2tnb359v1 701 -#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L - -#define SN_X9_62_c2pnb368w1 "c2pnb368w1" -#define NID_X9_62_c2pnb368w1 702 -#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L - -#define SN_X9_62_c2tnb431r1 "c2tnb431r1" -#define NID_X9_62_c2tnb431r1 703 -#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L - -#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L - -#define SN_X9_62_prime192v1 "prime192v1" -#define NID_X9_62_prime192v1 409 -#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L - -#define SN_X9_62_prime192v2 "prime192v2" -#define NID_X9_62_prime192v2 410 -#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L - -#define SN_X9_62_prime192v3 "prime192v3" -#define NID_X9_62_prime192v3 411 -#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L - -#define SN_X9_62_prime239v1 "prime239v1" -#define NID_X9_62_prime239v1 412 -#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L - -#define SN_X9_62_prime239v2 "prime239v2" -#define NID_X9_62_prime239v2 413 -#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L - -#define SN_X9_62_prime239v3 "prime239v3" -#define NID_X9_62_prime239v3 414 -#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L - -#define SN_X9_62_prime256v1 "prime256v1" -#define NID_X9_62_prime256v1 415 -#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L - -#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L - -#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" -#define NID_ecdsa_with_SHA1 416 -#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L - -#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" -#define NID_ecdsa_with_Recommended 791 -#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L - -#define SN_ecdsa_with_Specified "ecdsa-with-Specified" -#define NID_ecdsa_with_Specified 792 -#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L - -#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" -#define NID_ecdsa_with_SHA224 793 -#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L - -#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" -#define NID_ecdsa_with_SHA256 794 -#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L - -#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" -#define NID_ecdsa_with_SHA384 795 -#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L - -#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" -#define NID_ecdsa_with_SHA512 796 -#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L - -#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L - -#define SN_secp112r1 "secp112r1" -#define NID_secp112r1 704 -#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L - -#define SN_secp112r2 "secp112r2" -#define NID_secp112r2 705 -#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L - -#define SN_secp128r1 "secp128r1" -#define NID_secp128r1 706 -#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L - -#define SN_secp128r2 "secp128r2" -#define NID_secp128r2 707 -#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L - -#define SN_secp160k1 "secp160k1" -#define NID_secp160k1 708 -#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L - -#define SN_secp160r1 "secp160r1" -#define NID_secp160r1 709 -#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L - -#define SN_secp160r2 "secp160r2" -#define NID_secp160r2 710 -#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L - -#define SN_secp192k1 "secp192k1" -#define NID_secp192k1 711 -#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L - -#define SN_secp224k1 "secp224k1" -#define NID_secp224k1 712 -#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L - -#define SN_secp224r1 "secp224r1" -#define NID_secp224r1 713 -#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L - -#define SN_secp256k1 "secp256k1" -#define NID_secp256k1 714 -#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L - -#define SN_secp384r1 "secp384r1" -#define NID_secp384r1 715 -#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L - -#define SN_secp521r1 "secp521r1" -#define NID_secp521r1 716 -#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L - -#define SN_sect113r1 "sect113r1" -#define NID_sect113r1 717 -#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L - -#define SN_sect113r2 "sect113r2" -#define NID_sect113r2 718 -#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L - -#define SN_sect131r1 "sect131r1" -#define NID_sect131r1 719 -#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L - -#define SN_sect131r2 "sect131r2" -#define NID_sect131r2 720 -#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L - -#define SN_sect163k1 "sect163k1" -#define NID_sect163k1 721 -#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L - -#define SN_sect163r1 "sect163r1" -#define NID_sect163r1 722 -#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L - -#define SN_sect163r2 "sect163r2" -#define NID_sect163r2 723 -#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L - -#define SN_sect193r1 "sect193r1" -#define NID_sect193r1 724 -#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L - -#define SN_sect193r2 "sect193r2" -#define NID_sect193r2 725 -#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L - -#define SN_sect233k1 "sect233k1" -#define NID_sect233k1 726 -#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L - -#define SN_sect233r1 "sect233r1" -#define NID_sect233r1 727 -#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L - -#define SN_sect239k1 "sect239k1" -#define NID_sect239k1 728 -#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L - -#define SN_sect283k1 "sect283k1" -#define NID_sect283k1 729 -#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L - -#define SN_sect283r1 "sect283r1" -#define NID_sect283r1 730 -#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L - -#define SN_sect409k1 "sect409k1" -#define NID_sect409k1 731 -#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L - -#define SN_sect409r1 "sect409r1" -#define NID_sect409r1 732 -#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L - -#define SN_sect571k1 "sect571k1" -#define NID_sect571k1 733 -#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L - -#define SN_sect571r1 "sect571r1" -#define NID_sect571r1 734 -#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L - -#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L - -#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" -#define NID_wap_wsg_idm_ecid_wtls1 735 -#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L - -#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" -#define NID_wap_wsg_idm_ecid_wtls3 736 -#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L - -#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" -#define NID_wap_wsg_idm_ecid_wtls4 737 -#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L - -#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" -#define NID_wap_wsg_idm_ecid_wtls5 738 -#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L - -#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" -#define NID_wap_wsg_idm_ecid_wtls6 739 -#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L - -#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" -#define NID_wap_wsg_idm_ecid_wtls7 740 -#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L - -#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" -#define NID_wap_wsg_idm_ecid_wtls8 741 -#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L - -#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" -#define NID_wap_wsg_idm_ecid_wtls9 742 -#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L - -#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" -#define NID_wap_wsg_idm_ecid_wtls10 743 -#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L - -#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" -#define NID_wap_wsg_idm_ecid_wtls11 744 -#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L - -#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" -#define NID_wap_wsg_idm_ecid_wtls12 745 -#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L - -#define SN_cast5_cbc "CAST5-CBC" -#define LN_cast5_cbc "cast5-cbc" -#define NID_cast5_cbc 108 -#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L - -#define SN_cast5_ecb "CAST5-ECB" -#define LN_cast5_ecb "cast5-ecb" -#define NID_cast5_ecb 109 - -#define SN_cast5_cfb64 "CAST5-CFB" -#define LN_cast5_cfb64 "cast5-cfb" -#define NID_cast5_cfb64 110 - -#define SN_cast5_ofb64 "CAST5-OFB" -#define LN_cast5_ofb64 "cast5-ofb" -#define NID_cast5_ofb64 111 - -#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" -#define NID_pbeWithMD5AndCast5_CBC 112 -#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L - -#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" -#define LN_id_PasswordBasedMAC "password based MAC" -#define NID_id_PasswordBasedMAC 782 -#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L - -#define SN_id_DHBasedMac "id-DHBasedMac" -#define LN_id_DHBasedMac "Diffie-Hellman based MAC" -#define NID_id_DHBasedMac 783 -#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L - -#define SN_rsadsi "rsadsi" -#define LN_rsadsi "RSA Data Security, Inc." -#define NID_rsadsi 1 -#define OBJ_rsadsi OBJ_ISO_US,113549L - -#define SN_pkcs "pkcs" -#define LN_pkcs "RSA Data Security, Inc. PKCS" -#define NID_pkcs 2 -#define OBJ_pkcs OBJ_rsadsi,1L - -#define SN_pkcs1 "pkcs1" -#define NID_pkcs1 186 -#define OBJ_pkcs1 OBJ_pkcs,1L - -#define LN_rsaEncryption "rsaEncryption" -#define NID_rsaEncryption 6 -#define OBJ_rsaEncryption OBJ_pkcs1,1L - -#define SN_md2WithRSAEncryption "RSA-MD2" -#define LN_md2WithRSAEncryption "md2WithRSAEncryption" -#define NID_md2WithRSAEncryption 7 -#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L - -#define SN_md4WithRSAEncryption "RSA-MD4" -#define LN_md4WithRSAEncryption "md4WithRSAEncryption" -#define NID_md4WithRSAEncryption 396 -#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L - -#define SN_md5WithRSAEncryption "RSA-MD5" -#define LN_md5WithRSAEncryption "md5WithRSAEncryption" -#define NID_md5WithRSAEncryption 8 -#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L - -#define SN_sha1WithRSAEncryption "RSA-SHA1" -#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" -#define NID_sha1WithRSAEncryption 65 -#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L - -#define SN_rsaesOaep "RSAES-OAEP" -#define LN_rsaesOaep "rsaesOaep" -#define NID_rsaesOaep 919 -#define OBJ_rsaesOaep OBJ_pkcs1,7L - -#define SN_mgf1 "MGF1" -#define LN_mgf1 "mgf1" -#define NID_mgf1 911 -#define OBJ_mgf1 OBJ_pkcs1,8L - -#define SN_pSpecified "PSPECIFIED" -#define LN_pSpecified "pSpecified" -#define NID_pSpecified 935 -#define OBJ_pSpecified OBJ_pkcs1,9L - -#define SN_rsassaPss "RSASSA-PSS" -#define LN_rsassaPss "rsassaPss" -#define NID_rsassaPss 912 -#define OBJ_rsassaPss OBJ_pkcs1,10L - -#define SN_sha256WithRSAEncryption "RSA-SHA256" -#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" -#define NID_sha256WithRSAEncryption 668 -#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L - -#define SN_sha384WithRSAEncryption "RSA-SHA384" -#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" -#define NID_sha384WithRSAEncryption 669 -#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L - -#define SN_sha512WithRSAEncryption "RSA-SHA512" -#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" -#define NID_sha512WithRSAEncryption 670 -#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L - -#define SN_sha224WithRSAEncryption "RSA-SHA224" -#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" -#define NID_sha224WithRSAEncryption 671 -#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L - -#define SN_sha512_224WithRSAEncryption "RSA-SHA512/224" -#define LN_sha512_224WithRSAEncryption "sha512-224WithRSAEncryption" -#define NID_sha512_224WithRSAEncryption 1145 -#define OBJ_sha512_224WithRSAEncryption OBJ_pkcs1,15L - -#define SN_sha512_256WithRSAEncryption "RSA-SHA512/256" -#define LN_sha512_256WithRSAEncryption "sha512-256WithRSAEncryption" -#define NID_sha512_256WithRSAEncryption 1146 -#define OBJ_sha512_256WithRSAEncryption OBJ_pkcs1,16L - -#define SN_pkcs3 "pkcs3" -#define NID_pkcs3 27 -#define OBJ_pkcs3 OBJ_pkcs,3L - -#define LN_dhKeyAgreement "dhKeyAgreement" -#define NID_dhKeyAgreement 28 -#define OBJ_dhKeyAgreement OBJ_pkcs3,1L - -#define SN_pkcs5 "pkcs5" -#define NID_pkcs5 187 -#define OBJ_pkcs5 OBJ_pkcs,5L - -#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" -#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" -#define NID_pbeWithMD2AndDES_CBC 9 -#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L - -#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" -#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" -#define NID_pbeWithMD5AndDES_CBC 10 -#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L - -#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" -#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" -#define NID_pbeWithMD2AndRC2_CBC 168 -#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L - -#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" -#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" -#define NID_pbeWithMD5AndRC2_CBC 169 -#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L - -#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" -#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" -#define NID_pbeWithSHA1AndDES_CBC 170 -#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L - -#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" -#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" -#define NID_pbeWithSHA1AndRC2_CBC 68 -#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L - -#define LN_id_pbkdf2 "PBKDF2" -#define NID_id_pbkdf2 69 -#define OBJ_id_pbkdf2 OBJ_pkcs5,12L - -#define LN_pbes2 "PBES2" -#define NID_pbes2 161 -#define OBJ_pbes2 OBJ_pkcs5,13L - -#define LN_pbmac1 "PBMAC1" -#define NID_pbmac1 162 -#define OBJ_pbmac1 OBJ_pkcs5,14L - -#define SN_pkcs7 "pkcs7" -#define NID_pkcs7 20 -#define OBJ_pkcs7 OBJ_pkcs,7L - -#define LN_pkcs7_data "pkcs7-data" -#define NID_pkcs7_data 21 -#define OBJ_pkcs7_data OBJ_pkcs7,1L - -#define LN_pkcs7_signed "pkcs7-signedData" -#define NID_pkcs7_signed 22 -#define OBJ_pkcs7_signed OBJ_pkcs7,2L - -#define LN_pkcs7_enveloped "pkcs7-envelopedData" -#define NID_pkcs7_enveloped 23 -#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L - -#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" -#define NID_pkcs7_signedAndEnveloped 24 -#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L - -#define LN_pkcs7_digest "pkcs7-digestData" -#define NID_pkcs7_digest 25 -#define OBJ_pkcs7_digest OBJ_pkcs7,5L - -#define LN_pkcs7_encrypted "pkcs7-encryptedData" -#define NID_pkcs7_encrypted 26 -#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L - -#define SN_pkcs9 "pkcs9" -#define NID_pkcs9 47 -#define OBJ_pkcs9 OBJ_pkcs,9L - -#define LN_pkcs9_emailAddress "emailAddress" -#define NID_pkcs9_emailAddress 48 -#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L - -#define LN_pkcs9_unstructuredName "unstructuredName" -#define NID_pkcs9_unstructuredName 49 -#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L - -#define LN_pkcs9_contentType "contentType" -#define NID_pkcs9_contentType 50 -#define OBJ_pkcs9_contentType OBJ_pkcs9,3L - -#define LN_pkcs9_messageDigest "messageDigest" -#define NID_pkcs9_messageDigest 51 -#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L - -#define LN_pkcs9_signingTime "signingTime" -#define NID_pkcs9_signingTime 52 -#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L - -#define LN_pkcs9_countersignature "countersignature" -#define NID_pkcs9_countersignature 53 -#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L - -#define LN_pkcs9_challengePassword "challengePassword" -#define NID_pkcs9_challengePassword 54 -#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L - -#define LN_pkcs9_unstructuredAddress "unstructuredAddress" -#define NID_pkcs9_unstructuredAddress 55 -#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L - -#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" -#define NID_pkcs9_extCertAttributes 56 -#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L - -#define SN_ext_req "extReq" -#define LN_ext_req "Extension Request" -#define NID_ext_req 172 -#define OBJ_ext_req OBJ_pkcs9,14L - -#define SN_SMIMECapabilities "SMIME-CAPS" -#define LN_SMIMECapabilities "S/MIME Capabilities" -#define NID_SMIMECapabilities 167 -#define OBJ_SMIMECapabilities OBJ_pkcs9,15L - -#define SN_SMIME "SMIME" -#define LN_SMIME "S/MIME" -#define NID_SMIME 188 -#define OBJ_SMIME OBJ_pkcs9,16L - -#define SN_id_smime_mod "id-smime-mod" -#define NID_id_smime_mod 189 -#define OBJ_id_smime_mod OBJ_SMIME,0L - -#define SN_id_smime_ct "id-smime-ct" -#define NID_id_smime_ct 190 -#define OBJ_id_smime_ct OBJ_SMIME,1L - -#define SN_id_smime_aa "id-smime-aa" -#define NID_id_smime_aa 191 -#define OBJ_id_smime_aa OBJ_SMIME,2L - -#define SN_id_smime_alg "id-smime-alg" -#define NID_id_smime_alg 192 -#define OBJ_id_smime_alg OBJ_SMIME,3L - -#define SN_id_smime_cd "id-smime-cd" -#define NID_id_smime_cd 193 -#define OBJ_id_smime_cd OBJ_SMIME,4L - -#define SN_id_smime_spq "id-smime-spq" -#define NID_id_smime_spq 194 -#define OBJ_id_smime_spq OBJ_SMIME,5L - -#define SN_id_smime_cti "id-smime-cti" -#define NID_id_smime_cti 195 -#define OBJ_id_smime_cti OBJ_SMIME,6L - -#define SN_id_smime_mod_cms "id-smime-mod-cms" -#define NID_id_smime_mod_cms 196 -#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L - -#define SN_id_smime_mod_ess "id-smime-mod-ess" -#define NID_id_smime_mod_ess 197 -#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L - -#define SN_id_smime_mod_oid "id-smime-mod-oid" -#define NID_id_smime_mod_oid 198 -#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L - -#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" -#define NID_id_smime_mod_msg_v3 199 -#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L - -#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" -#define NID_id_smime_mod_ets_eSignature_88 200 -#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L - -#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" -#define NID_id_smime_mod_ets_eSignature_97 201 -#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L - -#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" -#define NID_id_smime_mod_ets_eSigPolicy_88 202 -#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L - -#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" -#define NID_id_smime_mod_ets_eSigPolicy_97 203 -#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L - -#define SN_id_smime_ct_receipt "id-smime-ct-receipt" -#define NID_id_smime_ct_receipt 204 -#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L - -#define SN_id_smime_ct_authData "id-smime-ct-authData" -#define NID_id_smime_ct_authData 205 -#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L - -#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" -#define NID_id_smime_ct_publishCert 206 -#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L - -#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" -#define NID_id_smime_ct_TSTInfo 207 -#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L - -#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" -#define NID_id_smime_ct_TDTInfo 208 -#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L - -#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" -#define NID_id_smime_ct_contentInfo 209 -#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L - -#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" -#define NID_id_smime_ct_DVCSRequestData 210 -#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L - -#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" -#define NID_id_smime_ct_DVCSResponseData 211 -#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L - -#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" -#define NID_id_smime_ct_compressedData 786 -#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L - -#define SN_id_smime_ct_contentCollection "id-smime-ct-contentCollection" -#define NID_id_smime_ct_contentCollection 1058 -#define OBJ_id_smime_ct_contentCollection OBJ_id_smime_ct,19L - -#define SN_id_smime_ct_authEnvelopedData "id-smime-ct-authEnvelopedData" -#define NID_id_smime_ct_authEnvelopedData 1059 -#define OBJ_id_smime_ct_authEnvelopedData OBJ_id_smime_ct,23L - -#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" -#define NID_id_ct_asciiTextWithCRLF 787 -#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L - -#define SN_id_ct_xml "id-ct-xml" -#define NID_id_ct_xml 1060 -#define OBJ_id_ct_xml OBJ_id_smime_ct,28L - -#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" -#define NID_id_smime_aa_receiptRequest 212 -#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L - -#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" -#define NID_id_smime_aa_securityLabel 213 -#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L - -#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" -#define NID_id_smime_aa_mlExpandHistory 214 -#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L - -#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" -#define NID_id_smime_aa_contentHint 215 -#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L - -#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" -#define NID_id_smime_aa_msgSigDigest 216 -#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L - -#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" -#define NID_id_smime_aa_encapContentType 217 -#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L - -#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" -#define NID_id_smime_aa_contentIdentifier 218 -#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L - -#define SN_id_smime_aa_macValue "id-smime-aa-macValue" -#define NID_id_smime_aa_macValue 219 -#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L - -#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" -#define NID_id_smime_aa_equivalentLabels 220 -#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L - -#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" -#define NID_id_smime_aa_contentReference 221 -#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L - -#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" -#define NID_id_smime_aa_encrypKeyPref 222 -#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L - -#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" -#define NID_id_smime_aa_signingCertificate 223 -#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L - -#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" -#define NID_id_smime_aa_smimeEncryptCerts 224 -#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L - -#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" -#define NID_id_smime_aa_timeStampToken 225 -#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L - -#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" -#define NID_id_smime_aa_ets_sigPolicyId 226 -#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L - -#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" -#define NID_id_smime_aa_ets_commitmentType 227 -#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L - -#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" -#define NID_id_smime_aa_ets_signerLocation 228 -#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L - -#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" -#define NID_id_smime_aa_ets_signerAttr 229 -#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L - -#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" -#define NID_id_smime_aa_ets_otherSigCert 230 -#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L - -#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" -#define NID_id_smime_aa_ets_contentTimestamp 231 -#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L - -#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" -#define NID_id_smime_aa_ets_CertificateRefs 232 -#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L - -#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" -#define NID_id_smime_aa_ets_RevocationRefs 233 -#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L - -#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" -#define NID_id_smime_aa_ets_certValues 234 -#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L - -#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" -#define NID_id_smime_aa_ets_revocationValues 235 -#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L - -#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" -#define NID_id_smime_aa_ets_escTimeStamp 236 -#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L - -#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" -#define NID_id_smime_aa_ets_certCRLTimestamp 237 -#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L - -#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" -#define NID_id_smime_aa_ets_archiveTimeStamp 238 -#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L - -#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" -#define NID_id_smime_aa_signatureType 239 -#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L - -#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" -#define NID_id_smime_aa_dvcs_dvc 240 -#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L - -#define SN_id_smime_aa_signingCertificateV2 "id-smime-aa-signingCertificateV2" -#define NID_id_smime_aa_signingCertificateV2 1086 -#define OBJ_id_smime_aa_signingCertificateV2 OBJ_id_smime_aa,47L - -#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" -#define NID_id_smime_alg_ESDHwith3DES 241 -#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L - -#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" -#define NID_id_smime_alg_ESDHwithRC2 242 -#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L - -#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" -#define NID_id_smime_alg_3DESwrap 243 -#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L - -#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" -#define NID_id_smime_alg_RC2wrap 244 -#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L - -#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" -#define NID_id_smime_alg_ESDH 245 -#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L - -#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" -#define NID_id_smime_alg_CMS3DESwrap 246 -#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L - -#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" -#define NID_id_smime_alg_CMSRC2wrap 247 -#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L - -#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" -#define NID_id_alg_PWRI_KEK 893 -#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L - -#define SN_id_smime_cd_ldap "id-smime-cd-ldap" -#define NID_id_smime_cd_ldap 248 -#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L - -#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" -#define NID_id_smime_spq_ets_sqt_uri 249 -#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L - -#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" -#define NID_id_smime_spq_ets_sqt_unotice 250 -#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L - -#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" -#define NID_id_smime_cti_ets_proofOfOrigin 251 -#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L - -#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" -#define NID_id_smime_cti_ets_proofOfReceipt 252 -#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L - -#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" -#define NID_id_smime_cti_ets_proofOfDelivery 253 -#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L - -#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" -#define NID_id_smime_cti_ets_proofOfSender 254 -#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L - -#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" -#define NID_id_smime_cti_ets_proofOfApproval 255 -#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L - -#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" -#define NID_id_smime_cti_ets_proofOfCreation 256 -#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L - -#define LN_friendlyName "friendlyName" -#define NID_friendlyName 156 -#define OBJ_friendlyName OBJ_pkcs9,20L - -#define LN_localKeyID "localKeyID" -#define NID_localKeyID 157 -#define OBJ_localKeyID OBJ_pkcs9,21L - -#define SN_ms_csp_name "CSPName" -#define LN_ms_csp_name "Microsoft CSP Name" -#define NID_ms_csp_name 417 -#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L - -#define SN_LocalKeySet "LocalKeySet" -#define LN_LocalKeySet "Microsoft Local Key set" -#define NID_LocalKeySet 856 -#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L - -#define OBJ_certTypes OBJ_pkcs9,22L - -#define LN_x509Certificate "x509Certificate" -#define NID_x509Certificate 158 -#define OBJ_x509Certificate OBJ_certTypes,1L - -#define LN_sdsiCertificate "sdsiCertificate" -#define NID_sdsiCertificate 159 -#define OBJ_sdsiCertificate OBJ_certTypes,2L - -#define OBJ_crlTypes OBJ_pkcs9,23L - -#define LN_x509Crl "x509Crl" -#define NID_x509Crl 160 -#define OBJ_x509Crl OBJ_crlTypes,1L - -#define OBJ_pkcs12 OBJ_pkcs,12L - -#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L - -#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" -#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" -#define NID_pbe_WithSHA1And128BitRC4 144 -#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L - -#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" -#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" -#define NID_pbe_WithSHA1And40BitRC4 145 -#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L - -#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" -#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 -#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L - -#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" -#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 -#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L - -#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" -#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" -#define NID_pbe_WithSHA1And128BitRC2_CBC 148 -#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L - -#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" -#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" -#define NID_pbe_WithSHA1And40BitRC2_CBC 149 -#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L - -#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L - -#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L - -#define LN_keyBag "keyBag" -#define NID_keyBag 150 -#define OBJ_keyBag OBJ_pkcs12_BagIds,1L - -#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" -#define NID_pkcs8ShroudedKeyBag 151 -#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L - -#define LN_certBag "certBag" -#define NID_certBag 152 -#define OBJ_certBag OBJ_pkcs12_BagIds,3L - -#define LN_crlBag "crlBag" -#define NID_crlBag 153 -#define OBJ_crlBag OBJ_pkcs12_BagIds,4L - -#define LN_secretBag "secretBag" -#define NID_secretBag 154 -#define OBJ_secretBag OBJ_pkcs12_BagIds,5L - -#define LN_safeContentsBag "safeContentsBag" -#define NID_safeContentsBag 155 -#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L - -#define SN_md2 "MD2" -#define LN_md2 "md2" -#define NID_md2 3 -#define OBJ_md2 OBJ_rsadsi,2L,2L - -#define SN_md4 "MD4" -#define LN_md4 "md4" -#define NID_md4 257 -#define OBJ_md4 OBJ_rsadsi,2L,4L - -#define SN_md5 "MD5" -#define LN_md5 "md5" -#define NID_md5 4 -#define OBJ_md5 OBJ_rsadsi,2L,5L - -#define SN_md5_sha1 "MD5-SHA1" -#define LN_md5_sha1 "md5-sha1" -#define NID_md5_sha1 114 - -#define LN_hmacWithMD5 "hmacWithMD5" -#define NID_hmacWithMD5 797 -#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L - -#define LN_hmacWithSHA1 "hmacWithSHA1" -#define NID_hmacWithSHA1 163 -#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L - -#define SN_sm2 "SM2" -#define LN_sm2 "sm2" -#define NID_sm2 1172 -#define OBJ_sm2 OBJ_sm_scheme,301L - -#define SN_sm3 "SM3" -#define LN_sm3 "sm3" -#define NID_sm3 1143 -#define OBJ_sm3 OBJ_sm_scheme,401L - -#define SN_sm3WithRSAEncryption "RSA-SM3" -#define LN_sm3WithRSAEncryption "sm3WithRSAEncryption" -#define NID_sm3WithRSAEncryption 1144 -#define OBJ_sm3WithRSAEncryption OBJ_sm_scheme,504L - -#define LN_hmacWithSHA224 "hmacWithSHA224" -#define NID_hmacWithSHA224 798 -#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L - -#define LN_hmacWithSHA256 "hmacWithSHA256" -#define NID_hmacWithSHA256 799 -#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L - -#define LN_hmacWithSHA384 "hmacWithSHA384" -#define NID_hmacWithSHA384 800 -#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L - -#define LN_hmacWithSHA512 "hmacWithSHA512" -#define NID_hmacWithSHA512 801 -#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L - -#define LN_hmacWithSHA512_224 "hmacWithSHA512-224" -#define NID_hmacWithSHA512_224 1193 -#define OBJ_hmacWithSHA512_224 OBJ_rsadsi,2L,12L - -#define LN_hmacWithSHA512_256 "hmacWithSHA512-256" -#define NID_hmacWithSHA512_256 1194 -#define OBJ_hmacWithSHA512_256 OBJ_rsadsi,2L,13L - -#define SN_rc2_cbc "RC2-CBC" -#define LN_rc2_cbc "rc2-cbc" -#define NID_rc2_cbc 37 -#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L - -#define SN_rc2_ecb "RC2-ECB" -#define LN_rc2_ecb "rc2-ecb" -#define NID_rc2_ecb 38 - -#define SN_rc2_cfb64 "RC2-CFB" -#define LN_rc2_cfb64 "rc2-cfb" -#define NID_rc2_cfb64 39 - -#define SN_rc2_ofb64 "RC2-OFB" -#define LN_rc2_ofb64 "rc2-ofb" -#define NID_rc2_ofb64 40 - -#define SN_rc2_40_cbc "RC2-40-CBC" -#define LN_rc2_40_cbc "rc2-40-cbc" -#define NID_rc2_40_cbc 98 - -#define SN_rc2_64_cbc "RC2-64-CBC" -#define LN_rc2_64_cbc "rc2-64-cbc" -#define NID_rc2_64_cbc 166 - -#define SN_rc4 "RC4" -#define LN_rc4 "rc4" -#define NID_rc4 5 -#define OBJ_rc4 OBJ_rsadsi,3L,4L - -#define SN_rc4_40 "RC4-40" -#define LN_rc4_40 "rc4-40" -#define NID_rc4_40 97 - -#define SN_des_ede3_cbc "DES-EDE3-CBC" -#define LN_des_ede3_cbc "des-ede3-cbc" -#define NID_des_ede3_cbc 44 -#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L - -#define SN_rc5_cbc "RC5-CBC" -#define LN_rc5_cbc "rc5-cbc" -#define NID_rc5_cbc 120 -#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L - -#define SN_rc5_ecb "RC5-ECB" -#define LN_rc5_ecb "rc5-ecb" -#define NID_rc5_ecb 121 - -#define SN_rc5_cfb64 "RC5-CFB" -#define LN_rc5_cfb64 "rc5-cfb" -#define NID_rc5_cfb64 122 - -#define SN_rc5_ofb64 "RC5-OFB" -#define LN_rc5_ofb64 "rc5-ofb" -#define NID_rc5_ofb64 123 - -#define SN_ms_ext_req "msExtReq" -#define LN_ms_ext_req "Microsoft Extension Request" -#define NID_ms_ext_req 171 -#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L - -#define SN_ms_code_ind "msCodeInd" -#define LN_ms_code_ind "Microsoft Individual Code Signing" -#define NID_ms_code_ind 134 -#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L - -#define SN_ms_code_com "msCodeCom" -#define LN_ms_code_com "Microsoft Commercial Code Signing" -#define NID_ms_code_com 135 -#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L - -#define SN_ms_ctl_sign "msCTLSign" -#define LN_ms_ctl_sign "Microsoft Trust List Signing" -#define NID_ms_ctl_sign 136 -#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L - -#define SN_ms_sgc "msSGC" -#define LN_ms_sgc "Microsoft Server Gated Crypto" -#define NID_ms_sgc 137 -#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L - -#define SN_ms_efs "msEFS" -#define LN_ms_efs "Microsoft Encrypted File System" -#define NID_ms_efs 138 -#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L - -#define SN_ms_smartcard_login "msSmartcardLogin" -#define LN_ms_smartcard_login "Microsoft Smartcard Login" -#define NID_ms_smartcard_login 648 -#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L - -#define SN_ms_upn "msUPN" -#define LN_ms_upn "Microsoft User Principal Name" -#define NID_ms_upn 649 -#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L - -#define SN_idea_cbc "IDEA-CBC" -#define LN_idea_cbc "idea-cbc" -#define NID_idea_cbc 34 -#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L - -#define SN_idea_ecb "IDEA-ECB" -#define LN_idea_ecb "idea-ecb" -#define NID_idea_ecb 36 - -#define SN_idea_cfb64 "IDEA-CFB" -#define LN_idea_cfb64 "idea-cfb" -#define NID_idea_cfb64 35 - -#define SN_idea_ofb64 "IDEA-OFB" -#define LN_idea_ofb64 "idea-ofb" -#define NID_idea_ofb64 46 - -#define SN_bf_cbc "BF-CBC" -#define LN_bf_cbc "bf-cbc" -#define NID_bf_cbc 91 -#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L - -#define SN_bf_ecb "BF-ECB" -#define LN_bf_ecb "bf-ecb" -#define NID_bf_ecb 92 - -#define SN_bf_cfb64 "BF-CFB" -#define LN_bf_cfb64 "bf-cfb" -#define NID_bf_cfb64 93 - -#define SN_bf_ofb64 "BF-OFB" -#define LN_bf_ofb64 "bf-ofb" -#define NID_bf_ofb64 94 - -#define SN_id_pkix "PKIX" -#define NID_id_pkix 127 -#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L - -#define SN_id_pkix_mod "id-pkix-mod" -#define NID_id_pkix_mod 258 -#define OBJ_id_pkix_mod OBJ_id_pkix,0L - -#define SN_id_pe "id-pe" -#define NID_id_pe 175 -#define OBJ_id_pe OBJ_id_pkix,1L - -#define SN_id_qt "id-qt" -#define NID_id_qt 259 -#define OBJ_id_qt OBJ_id_pkix,2L - -#define SN_id_kp "id-kp" -#define NID_id_kp 128 -#define OBJ_id_kp OBJ_id_pkix,3L - -#define SN_id_it "id-it" -#define NID_id_it 260 -#define OBJ_id_it OBJ_id_pkix,4L - -#define SN_id_pkip "id-pkip" -#define NID_id_pkip 261 -#define OBJ_id_pkip OBJ_id_pkix,5L - -#define SN_id_alg "id-alg" -#define NID_id_alg 262 -#define OBJ_id_alg OBJ_id_pkix,6L - -#define SN_id_cmc "id-cmc" -#define NID_id_cmc 263 -#define OBJ_id_cmc OBJ_id_pkix,7L - -#define SN_id_on "id-on" -#define NID_id_on 264 -#define OBJ_id_on OBJ_id_pkix,8L - -#define SN_id_pda "id-pda" -#define NID_id_pda 265 -#define OBJ_id_pda OBJ_id_pkix,9L - -#define SN_id_aca "id-aca" -#define NID_id_aca 266 -#define OBJ_id_aca OBJ_id_pkix,10L - -#define SN_id_qcs "id-qcs" -#define NID_id_qcs 267 -#define OBJ_id_qcs OBJ_id_pkix,11L - -#define SN_id_cct "id-cct" -#define NID_id_cct 268 -#define OBJ_id_cct OBJ_id_pkix,12L - -#define SN_id_ppl "id-ppl" -#define NID_id_ppl 662 -#define OBJ_id_ppl OBJ_id_pkix,21L - -#define SN_id_ad "id-ad" -#define NID_id_ad 176 -#define OBJ_id_ad OBJ_id_pkix,48L - -#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" -#define NID_id_pkix1_explicit_88 269 -#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L - -#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" -#define NID_id_pkix1_implicit_88 270 -#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L - -#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" -#define NID_id_pkix1_explicit_93 271 -#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L - -#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" -#define NID_id_pkix1_implicit_93 272 -#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L - -#define SN_id_mod_crmf "id-mod-crmf" -#define NID_id_mod_crmf 273 -#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L - -#define SN_id_mod_cmc "id-mod-cmc" -#define NID_id_mod_cmc 274 -#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L - -#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" -#define NID_id_mod_kea_profile_88 275 -#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L - -#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" -#define NID_id_mod_kea_profile_93 276 -#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L - -#define SN_id_mod_cmp "id-mod-cmp" -#define NID_id_mod_cmp 277 -#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L - -#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" -#define NID_id_mod_qualified_cert_88 278 -#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L - -#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" -#define NID_id_mod_qualified_cert_93 279 -#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L - -#define SN_id_mod_attribute_cert "id-mod-attribute-cert" -#define NID_id_mod_attribute_cert 280 -#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L - -#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" -#define NID_id_mod_timestamp_protocol 281 -#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L - -#define SN_id_mod_ocsp "id-mod-ocsp" -#define NID_id_mod_ocsp 282 -#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L - -#define SN_id_mod_dvcs "id-mod-dvcs" -#define NID_id_mod_dvcs 283 -#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L - -#define SN_id_mod_cmp2000 "id-mod-cmp2000" -#define NID_id_mod_cmp2000 284 -#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L - -#define SN_info_access "authorityInfoAccess" -#define LN_info_access "Authority Information Access" -#define NID_info_access 177 -#define OBJ_info_access OBJ_id_pe,1L - -#define SN_biometricInfo "biometricInfo" -#define LN_biometricInfo "Biometric Info" -#define NID_biometricInfo 285 -#define OBJ_biometricInfo OBJ_id_pe,2L - -#define SN_qcStatements "qcStatements" -#define NID_qcStatements 286 -#define OBJ_qcStatements OBJ_id_pe,3L - -#define SN_ac_auditEntity "ac-auditEntity" -#define NID_ac_auditEntity 287 -#define OBJ_ac_auditEntity OBJ_id_pe,4L - -#define SN_ac_targeting "ac-targeting" -#define NID_ac_targeting 288 -#define OBJ_ac_targeting OBJ_id_pe,5L - -#define SN_aaControls "aaControls" -#define NID_aaControls 289 -#define OBJ_aaControls OBJ_id_pe,6L - -#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" -#define NID_sbgp_ipAddrBlock 290 -#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L - -#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" -#define NID_sbgp_autonomousSysNum 291 -#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L - -#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" -#define NID_sbgp_routerIdentifier 292 -#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L - -#define SN_ac_proxying "ac-proxying" -#define NID_ac_proxying 397 -#define OBJ_ac_proxying OBJ_id_pe,10L - -#define SN_sinfo_access "subjectInfoAccess" -#define LN_sinfo_access "Subject Information Access" -#define NID_sinfo_access 398 -#define OBJ_sinfo_access OBJ_id_pe,11L - -#define SN_proxyCertInfo "proxyCertInfo" -#define LN_proxyCertInfo "Proxy Certificate Information" -#define NID_proxyCertInfo 663 -#define OBJ_proxyCertInfo OBJ_id_pe,14L - -#define SN_tlsfeature "tlsfeature" -#define LN_tlsfeature "TLS Feature" -#define NID_tlsfeature 1020 -#define OBJ_tlsfeature OBJ_id_pe,24L - -#define SN_id_qt_cps "id-qt-cps" -#define LN_id_qt_cps "Policy Qualifier CPS" -#define NID_id_qt_cps 164 -#define OBJ_id_qt_cps OBJ_id_qt,1L - -#define SN_id_qt_unotice "id-qt-unotice" -#define LN_id_qt_unotice "Policy Qualifier User Notice" -#define NID_id_qt_unotice 165 -#define OBJ_id_qt_unotice OBJ_id_qt,2L - -#define SN_textNotice "textNotice" -#define NID_textNotice 293 -#define OBJ_textNotice OBJ_id_qt,3L - -#define SN_server_auth "serverAuth" -#define LN_server_auth "TLS Web Server Authentication" -#define NID_server_auth 129 -#define OBJ_server_auth OBJ_id_kp,1L - -#define SN_client_auth "clientAuth" -#define LN_client_auth "TLS Web Client Authentication" -#define NID_client_auth 130 -#define OBJ_client_auth OBJ_id_kp,2L - -#define SN_code_sign "codeSigning" -#define LN_code_sign "Code Signing" -#define NID_code_sign 131 -#define OBJ_code_sign OBJ_id_kp,3L - -#define SN_email_protect "emailProtection" -#define LN_email_protect "E-mail Protection" -#define NID_email_protect 132 -#define OBJ_email_protect OBJ_id_kp,4L - -#define SN_ipsecEndSystem "ipsecEndSystem" -#define LN_ipsecEndSystem "IPSec End System" -#define NID_ipsecEndSystem 294 -#define OBJ_ipsecEndSystem OBJ_id_kp,5L - -#define SN_ipsecTunnel "ipsecTunnel" -#define LN_ipsecTunnel "IPSec Tunnel" -#define NID_ipsecTunnel 295 -#define OBJ_ipsecTunnel OBJ_id_kp,6L - -#define SN_ipsecUser "ipsecUser" -#define LN_ipsecUser "IPSec User" -#define NID_ipsecUser 296 -#define OBJ_ipsecUser OBJ_id_kp,7L - -#define SN_time_stamp "timeStamping" -#define LN_time_stamp "Time Stamping" -#define NID_time_stamp 133 -#define OBJ_time_stamp OBJ_id_kp,8L - -#define SN_OCSP_sign "OCSPSigning" -#define LN_OCSP_sign "OCSP Signing" -#define NID_OCSP_sign 180 -#define OBJ_OCSP_sign OBJ_id_kp,9L - -#define SN_dvcs "DVCS" -#define LN_dvcs "dvcs" -#define NID_dvcs 297 -#define OBJ_dvcs OBJ_id_kp,10L - -#define SN_ipsec_IKE "ipsecIKE" -#define LN_ipsec_IKE "ipsec Internet Key Exchange" -#define NID_ipsec_IKE 1022 -#define OBJ_ipsec_IKE OBJ_id_kp,17L - -#define SN_capwapAC "capwapAC" -#define LN_capwapAC "Ctrl/provision WAP Access" -#define NID_capwapAC 1023 -#define OBJ_capwapAC OBJ_id_kp,18L - -#define SN_capwapWTP "capwapWTP" -#define LN_capwapWTP "Ctrl/Provision WAP Termination" -#define NID_capwapWTP 1024 -#define OBJ_capwapWTP OBJ_id_kp,19L - -#define SN_sshClient "secureShellClient" -#define LN_sshClient "SSH Client" -#define NID_sshClient 1025 -#define OBJ_sshClient OBJ_id_kp,21L - -#define SN_sshServer "secureShellServer" -#define LN_sshServer "SSH Server" -#define NID_sshServer 1026 -#define OBJ_sshServer OBJ_id_kp,22L - -#define SN_sendRouter "sendRouter" -#define LN_sendRouter "Send Router" -#define NID_sendRouter 1027 -#define OBJ_sendRouter OBJ_id_kp,23L - -#define SN_sendProxiedRouter "sendProxiedRouter" -#define LN_sendProxiedRouter "Send Proxied Router" -#define NID_sendProxiedRouter 1028 -#define OBJ_sendProxiedRouter OBJ_id_kp,24L - -#define SN_sendOwner "sendOwner" -#define LN_sendOwner "Send Owner" -#define NID_sendOwner 1029 -#define OBJ_sendOwner OBJ_id_kp,25L - -#define SN_sendProxiedOwner "sendProxiedOwner" -#define LN_sendProxiedOwner "Send Proxied Owner" -#define NID_sendProxiedOwner 1030 -#define OBJ_sendProxiedOwner OBJ_id_kp,26L - -#define SN_cmcCA "cmcCA" -#define LN_cmcCA "CMC Certificate Authority" -#define NID_cmcCA 1131 -#define OBJ_cmcCA OBJ_id_kp,27L - -#define SN_cmcRA "cmcRA" -#define LN_cmcRA "CMC Registration Authority" -#define NID_cmcRA 1132 -#define OBJ_cmcRA OBJ_id_kp,28L - -#define SN_id_it_caProtEncCert "id-it-caProtEncCert" -#define NID_id_it_caProtEncCert 298 -#define OBJ_id_it_caProtEncCert OBJ_id_it,1L - -#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" -#define NID_id_it_signKeyPairTypes 299 -#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L - -#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" -#define NID_id_it_encKeyPairTypes 300 -#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L - -#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" -#define NID_id_it_preferredSymmAlg 301 -#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L - -#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" -#define NID_id_it_caKeyUpdateInfo 302 -#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L - -#define SN_id_it_currentCRL "id-it-currentCRL" -#define NID_id_it_currentCRL 303 -#define OBJ_id_it_currentCRL OBJ_id_it,6L - -#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" -#define NID_id_it_unsupportedOIDs 304 -#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L - -#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" -#define NID_id_it_subscriptionRequest 305 -#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L - -#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" -#define NID_id_it_subscriptionResponse 306 -#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L - -#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" -#define NID_id_it_keyPairParamReq 307 -#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L - -#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" -#define NID_id_it_keyPairParamRep 308 -#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L - -#define SN_id_it_revPassphrase "id-it-revPassphrase" -#define NID_id_it_revPassphrase 309 -#define OBJ_id_it_revPassphrase OBJ_id_it,12L - -#define SN_id_it_implicitConfirm "id-it-implicitConfirm" -#define NID_id_it_implicitConfirm 310 -#define OBJ_id_it_implicitConfirm OBJ_id_it,13L - -#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" -#define NID_id_it_confirmWaitTime 311 -#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L - -#define SN_id_it_origPKIMessage "id-it-origPKIMessage" -#define NID_id_it_origPKIMessage 312 -#define OBJ_id_it_origPKIMessage OBJ_id_it,15L - -#define SN_id_it_suppLangTags "id-it-suppLangTags" -#define NID_id_it_suppLangTags 784 -#define OBJ_id_it_suppLangTags OBJ_id_it,16L - -#define SN_id_regCtrl "id-regCtrl" -#define NID_id_regCtrl 313 -#define OBJ_id_regCtrl OBJ_id_pkip,1L - -#define SN_id_regInfo "id-regInfo" -#define NID_id_regInfo 314 -#define OBJ_id_regInfo OBJ_id_pkip,2L - -#define SN_id_regCtrl_regToken "id-regCtrl-regToken" -#define NID_id_regCtrl_regToken 315 -#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L - -#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" -#define NID_id_regCtrl_authenticator 316 -#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L - -#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" -#define NID_id_regCtrl_pkiPublicationInfo 317 -#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L - -#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" -#define NID_id_regCtrl_pkiArchiveOptions 318 -#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L - -#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" -#define NID_id_regCtrl_oldCertID 319 -#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L - -#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" -#define NID_id_regCtrl_protocolEncrKey 320 -#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L - -#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" -#define NID_id_regInfo_utf8Pairs 321 -#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L - -#define SN_id_regInfo_certReq "id-regInfo-certReq" -#define NID_id_regInfo_certReq 322 -#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L - -#define SN_id_alg_des40 "id-alg-des40" -#define NID_id_alg_des40 323 -#define OBJ_id_alg_des40 OBJ_id_alg,1L - -#define SN_id_alg_noSignature "id-alg-noSignature" -#define NID_id_alg_noSignature 324 -#define OBJ_id_alg_noSignature OBJ_id_alg,2L - -#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" -#define NID_id_alg_dh_sig_hmac_sha1 325 -#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L - -#define SN_id_alg_dh_pop "id-alg-dh-pop" -#define NID_id_alg_dh_pop 326 -#define OBJ_id_alg_dh_pop OBJ_id_alg,4L - -#define SN_id_cmc_statusInfo "id-cmc-statusInfo" -#define NID_id_cmc_statusInfo 327 -#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L - -#define SN_id_cmc_identification "id-cmc-identification" -#define NID_id_cmc_identification 328 -#define OBJ_id_cmc_identification OBJ_id_cmc,2L - -#define SN_id_cmc_identityProof "id-cmc-identityProof" -#define NID_id_cmc_identityProof 329 -#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L - -#define SN_id_cmc_dataReturn "id-cmc-dataReturn" -#define NID_id_cmc_dataReturn 330 -#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L - -#define SN_id_cmc_transactionId "id-cmc-transactionId" -#define NID_id_cmc_transactionId 331 -#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L - -#define SN_id_cmc_senderNonce "id-cmc-senderNonce" -#define NID_id_cmc_senderNonce 332 -#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L - -#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" -#define NID_id_cmc_recipientNonce 333 -#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L - -#define SN_id_cmc_addExtensions "id-cmc-addExtensions" -#define NID_id_cmc_addExtensions 334 -#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L - -#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" -#define NID_id_cmc_encryptedPOP 335 -#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L - -#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" -#define NID_id_cmc_decryptedPOP 336 -#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L - -#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" -#define NID_id_cmc_lraPOPWitness 337 -#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L - -#define SN_id_cmc_getCert "id-cmc-getCert" -#define NID_id_cmc_getCert 338 -#define OBJ_id_cmc_getCert OBJ_id_cmc,15L - -#define SN_id_cmc_getCRL "id-cmc-getCRL" -#define NID_id_cmc_getCRL 339 -#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L - -#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" -#define NID_id_cmc_revokeRequest 340 -#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L - -#define SN_id_cmc_regInfo "id-cmc-regInfo" -#define NID_id_cmc_regInfo 341 -#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L - -#define SN_id_cmc_responseInfo "id-cmc-responseInfo" -#define NID_id_cmc_responseInfo 342 -#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L - -#define SN_id_cmc_queryPending "id-cmc-queryPending" -#define NID_id_cmc_queryPending 343 -#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L - -#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" -#define NID_id_cmc_popLinkRandom 344 -#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L - -#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" -#define NID_id_cmc_popLinkWitness 345 -#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L - -#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" -#define NID_id_cmc_confirmCertAcceptance 346 -#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L - -#define SN_id_on_personalData "id-on-personalData" -#define NID_id_on_personalData 347 -#define OBJ_id_on_personalData OBJ_id_on,1L - -#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" -#define LN_id_on_permanentIdentifier "Permanent Identifier" -#define NID_id_on_permanentIdentifier 858 -#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L - -#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" -#define NID_id_pda_dateOfBirth 348 -#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L - -#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" -#define NID_id_pda_placeOfBirth 349 -#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L - -#define SN_id_pda_gender "id-pda-gender" -#define NID_id_pda_gender 351 -#define OBJ_id_pda_gender OBJ_id_pda,3L - -#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" -#define NID_id_pda_countryOfCitizenship 352 -#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L - -#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" -#define NID_id_pda_countryOfResidence 353 -#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L - -#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" -#define NID_id_aca_authenticationInfo 354 -#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L - -#define SN_id_aca_accessIdentity "id-aca-accessIdentity" -#define NID_id_aca_accessIdentity 355 -#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L - -#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" -#define NID_id_aca_chargingIdentity 356 -#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L - -#define SN_id_aca_group "id-aca-group" -#define NID_id_aca_group 357 -#define OBJ_id_aca_group OBJ_id_aca,4L - -#define SN_id_aca_role "id-aca-role" -#define NID_id_aca_role 358 -#define OBJ_id_aca_role OBJ_id_aca,5L - -#define SN_id_aca_encAttrs "id-aca-encAttrs" -#define NID_id_aca_encAttrs 399 -#define OBJ_id_aca_encAttrs OBJ_id_aca,6L - -#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" -#define NID_id_qcs_pkixQCSyntax_v1 359 -#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L - -#define SN_id_cct_crs "id-cct-crs" -#define NID_id_cct_crs 360 -#define OBJ_id_cct_crs OBJ_id_cct,1L - -#define SN_id_cct_PKIData "id-cct-PKIData" -#define NID_id_cct_PKIData 361 -#define OBJ_id_cct_PKIData OBJ_id_cct,2L - -#define SN_id_cct_PKIResponse "id-cct-PKIResponse" -#define NID_id_cct_PKIResponse 362 -#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L - -#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" -#define LN_id_ppl_anyLanguage "Any language" -#define NID_id_ppl_anyLanguage 664 -#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L - -#define SN_id_ppl_inheritAll "id-ppl-inheritAll" -#define LN_id_ppl_inheritAll "Inherit all" -#define NID_id_ppl_inheritAll 665 -#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L - -#define SN_Independent "id-ppl-independent" -#define LN_Independent "Independent" -#define NID_Independent 667 -#define OBJ_Independent OBJ_id_ppl,2L - -#define SN_ad_OCSP "OCSP" -#define LN_ad_OCSP "OCSP" -#define NID_ad_OCSP 178 -#define OBJ_ad_OCSP OBJ_id_ad,1L - -#define SN_ad_ca_issuers "caIssuers" -#define LN_ad_ca_issuers "CA Issuers" -#define NID_ad_ca_issuers 179 -#define OBJ_ad_ca_issuers OBJ_id_ad,2L - -#define SN_ad_timeStamping "ad_timestamping" -#define LN_ad_timeStamping "AD Time Stamping" -#define NID_ad_timeStamping 363 -#define OBJ_ad_timeStamping OBJ_id_ad,3L - -#define SN_ad_dvcs "AD_DVCS" -#define LN_ad_dvcs "ad dvcs" -#define NID_ad_dvcs 364 -#define OBJ_ad_dvcs OBJ_id_ad,4L - -#define SN_caRepository "caRepository" -#define LN_caRepository "CA Repository" -#define NID_caRepository 785 -#define OBJ_caRepository OBJ_id_ad,5L - -#define OBJ_id_pkix_OCSP OBJ_ad_OCSP - -#define SN_id_pkix_OCSP_basic "basicOCSPResponse" -#define LN_id_pkix_OCSP_basic "Basic OCSP Response" -#define NID_id_pkix_OCSP_basic 365 -#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L - -#define SN_id_pkix_OCSP_Nonce "Nonce" -#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" -#define NID_id_pkix_OCSP_Nonce 366 -#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L - -#define SN_id_pkix_OCSP_CrlID "CrlID" -#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" -#define NID_id_pkix_OCSP_CrlID 367 -#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L - -#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" -#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" -#define NID_id_pkix_OCSP_acceptableResponses 368 -#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L - -#define SN_id_pkix_OCSP_noCheck "noCheck" -#define LN_id_pkix_OCSP_noCheck "OCSP No Check" -#define NID_id_pkix_OCSP_noCheck 369 -#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L - -#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" -#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" -#define NID_id_pkix_OCSP_archiveCutoff 370 -#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L - -#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" -#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" -#define NID_id_pkix_OCSP_serviceLocator 371 -#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L - -#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" -#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" -#define NID_id_pkix_OCSP_extendedStatus 372 -#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L - -#define SN_id_pkix_OCSP_valid "valid" -#define NID_id_pkix_OCSP_valid 373 -#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L - -#define SN_id_pkix_OCSP_path "path" -#define NID_id_pkix_OCSP_path 374 -#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L - -#define SN_id_pkix_OCSP_trustRoot "trustRoot" -#define LN_id_pkix_OCSP_trustRoot "Trust Root" -#define NID_id_pkix_OCSP_trustRoot 375 -#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L - -#define SN_algorithm "algorithm" -#define LN_algorithm "algorithm" -#define NID_algorithm 376 -#define OBJ_algorithm 1L,3L,14L,3L,2L - -#define SN_md5WithRSA "RSA-NP-MD5" -#define LN_md5WithRSA "md5WithRSA" -#define NID_md5WithRSA 104 -#define OBJ_md5WithRSA OBJ_algorithm,3L - -#define SN_des_ecb "DES-ECB" -#define LN_des_ecb "des-ecb" -#define NID_des_ecb 29 -#define OBJ_des_ecb OBJ_algorithm,6L - -#define SN_des_cbc "DES-CBC" -#define LN_des_cbc "des-cbc" -#define NID_des_cbc 31 -#define OBJ_des_cbc OBJ_algorithm,7L - -#define SN_des_ofb64 "DES-OFB" -#define LN_des_ofb64 "des-ofb" -#define NID_des_ofb64 45 -#define OBJ_des_ofb64 OBJ_algorithm,8L - -#define SN_des_cfb64 "DES-CFB" -#define LN_des_cfb64 "des-cfb" -#define NID_des_cfb64 30 -#define OBJ_des_cfb64 OBJ_algorithm,9L - -#define SN_rsaSignature "rsaSignature" -#define NID_rsaSignature 377 -#define OBJ_rsaSignature OBJ_algorithm,11L - -#define SN_dsa_2 "DSA-old" -#define LN_dsa_2 "dsaEncryption-old" -#define NID_dsa_2 67 -#define OBJ_dsa_2 OBJ_algorithm,12L - -#define SN_dsaWithSHA "DSA-SHA" -#define LN_dsaWithSHA "dsaWithSHA" -#define NID_dsaWithSHA 66 -#define OBJ_dsaWithSHA OBJ_algorithm,13L - -#define SN_shaWithRSAEncryption "RSA-SHA" -#define LN_shaWithRSAEncryption "shaWithRSAEncryption" -#define NID_shaWithRSAEncryption 42 -#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L - -#define SN_des_ede_ecb "DES-EDE" -#define LN_des_ede_ecb "des-ede" -#define NID_des_ede_ecb 32 -#define OBJ_des_ede_ecb OBJ_algorithm,17L - -#define SN_des_ede3_ecb "DES-EDE3" -#define LN_des_ede3_ecb "des-ede3" -#define NID_des_ede3_ecb 33 - -#define SN_des_ede_cbc "DES-EDE-CBC" -#define LN_des_ede_cbc "des-ede-cbc" -#define NID_des_ede_cbc 43 - -#define SN_des_ede_cfb64 "DES-EDE-CFB" -#define LN_des_ede_cfb64 "des-ede-cfb" -#define NID_des_ede_cfb64 60 - -#define SN_des_ede3_cfb64 "DES-EDE3-CFB" -#define LN_des_ede3_cfb64 "des-ede3-cfb" -#define NID_des_ede3_cfb64 61 - -#define SN_des_ede_ofb64 "DES-EDE-OFB" -#define LN_des_ede_ofb64 "des-ede-ofb" -#define NID_des_ede_ofb64 62 - -#define SN_des_ede3_ofb64 "DES-EDE3-OFB" -#define LN_des_ede3_ofb64 "des-ede3-ofb" -#define NID_des_ede3_ofb64 63 - -#define SN_desx_cbc "DESX-CBC" -#define LN_desx_cbc "desx-cbc" -#define NID_desx_cbc 80 - -#define SN_sha "SHA" -#define LN_sha "sha" -#define NID_sha 41 -#define OBJ_sha OBJ_algorithm,18L - -#define SN_sha1 "SHA1" -#define LN_sha1 "sha1" -#define NID_sha1 64 -#define OBJ_sha1 OBJ_algorithm,26L - -#define SN_dsaWithSHA1_2 "DSA-SHA1-old" -#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" -#define NID_dsaWithSHA1_2 70 -#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L - -#define SN_sha1WithRSA "RSA-SHA1-2" -#define LN_sha1WithRSA "sha1WithRSA" -#define NID_sha1WithRSA 115 -#define OBJ_sha1WithRSA OBJ_algorithm,29L - -#define SN_ripemd160 "RIPEMD160" -#define LN_ripemd160 "ripemd160" -#define NID_ripemd160 117 -#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L - -#define SN_ripemd160WithRSA "RSA-RIPEMD160" -#define LN_ripemd160WithRSA "ripemd160WithRSA" -#define NID_ripemd160WithRSA 119 -#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L - -#define SN_blake2b512 "BLAKE2b512" -#define LN_blake2b512 "blake2b512" -#define NID_blake2b512 1056 -#define OBJ_blake2b512 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L,16L - -#define SN_blake2s256 "BLAKE2s256" -#define LN_blake2s256 "blake2s256" -#define NID_blake2s256 1057 -#define OBJ_blake2s256 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L,8L - -#define SN_sxnet "SXNetID" -#define LN_sxnet "Strong Extranet ID" -#define NID_sxnet 143 -#define OBJ_sxnet 1L,3L,101L,1L,4L,1L - -#define SN_X500 "X500" -#define LN_X500 "directory services (X.500)" -#define NID_X500 11 -#define OBJ_X500 2L,5L - -#define SN_X509 "X509" -#define NID_X509 12 -#define OBJ_X509 OBJ_X500,4L - -#define SN_commonName "CN" -#define LN_commonName "commonName" -#define NID_commonName 13 -#define OBJ_commonName OBJ_X509,3L - -#define SN_surname "SN" -#define LN_surname "surname" -#define NID_surname 100 -#define OBJ_surname OBJ_X509,4L - -#define LN_serialNumber "serialNumber" -#define NID_serialNumber 105 -#define OBJ_serialNumber OBJ_X509,5L - -#define SN_countryName "C" -#define LN_countryName "countryName" -#define NID_countryName 14 -#define OBJ_countryName OBJ_X509,6L - -#define SN_localityName "L" -#define LN_localityName "localityName" -#define NID_localityName 15 -#define OBJ_localityName OBJ_X509,7L - -#define SN_stateOrProvinceName "ST" -#define LN_stateOrProvinceName "stateOrProvinceName" -#define NID_stateOrProvinceName 16 -#define OBJ_stateOrProvinceName OBJ_X509,8L - -#define SN_streetAddress "street" -#define LN_streetAddress "streetAddress" -#define NID_streetAddress 660 -#define OBJ_streetAddress OBJ_X509,9L - -#define SN_organizationName "O" -#define LN_organizationName "organizationName" -#define NID_organizationName 17 -#define OBJ_organizationName OBJ_X509,10L - -#define SN_organizationalUnitName "OU" -#define LN_organizationalUnitName "organizationalUnitName" -#define NID_organizationalUnitName 18 -#define OBJ_organizationalUnitName OBJ_X509,11L - -#define SN_title "title" -#define LN_title "title" -#define NID_title 106 -#define OBJ_title OBJ_X509,12L - -#define LN_description "description" -#define NID_description 107 -#define OBJ_description OBJ_X509,13L - -#define LN_searchGuide "searchGuide" -#define NID_searchGuide 859 -#define OBJ_searchGuide OBJ_X509,14L - -#define LN_businessCategory "businessCategory" -#define NID_businessCategory 860 -#define OBJ_businessCategory OBJ_X509,15L - -#define LN_postalAddress "postalAddress" -#define NID_postalAddress 861 -#define OBJ_postalAddress OBJ_X509,16L - -#define LN_postalCode "postalCode" -#define NID_postalCode 661 -#define OBJ_postalCode OBJ_X509,17L - -#define LN_postOfficeBox "postOfficeBox" -#define NID_postOfficeBox 862 -#define OBJ_postOfficeBox OBJ_X509,18L - -#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" -#define NID_physicalDeliveryOfficeName 863 -#define OBJ_physicalDeliveryOfficeName OBJ_X509,19L - -#define LN_telephoneNumber "telephoneNumber" -#define NID_telephoneNumber 864 -#define OBJ_telephoneNumber OBJ_X509,20L - -#define LN_telexNumber "telexNumber" -#define NID_telexNumber 865 -#define OBJ_telexNumber OBJ_X509,21L - -#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" -#define NID_teletexTerminalIdentifier 866 -#define OBJ_teletexTerminalIdentifier OBJ_X509,22L - -#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" -#define NID_facsimileTelephoneNumber 867 -#define OBJ_facsimileTelephoneNumber OBJ_X509,23L - -#define LN_x121Address "x121Address" -#define NID_x121Address 868 -#define OBJ_x121Address OBJ_X509,24L - -#define LN_internationaliSDNNumber "internationaliSDNNumber" -#define NID_internationaliSDNNumber 869 -#define OBJ_internationaliSDNNumber OBJ_X509,25L - -#define LN_registeredAddress "registeredAddress" -#define NID_registeredAddress 870 -#define OBJ_registeredAddress OBJ_X509,26L - -#define LN_destinationIndicator "destinationIndicator" -#define NID_destinationIndicator 871 -#define OBJ_destinationIndicator OBJ_X509,27L - -#define LN_preferredDeliveryMethod "preferredDeliveryMethod" -#define NID_preferredDeliveryMethod 872 -#define OBJ_preferredDeliveryMethod OBJ_X509,28L - -#define LN_presentationAddress "presentationAddress" -#define NID_presentationAddress 873 -#define OBJ_presentationAddress OBJ_X509,29L - -#define LN_supportedApplicationContext "supportedApplicationContext" -#define NID_supportedApplicationContext 874 -#define OBJ_supportedApplicationContext OBJ_X509,30L - -#define SN_member "member" -#define NID_member 875 -#define OBJ_member OBJ_X509,31L - -#define SN_owner "owner" -#define NID_owner 876 -#define OBJ_owner OBJ_X509,32L - -#define LN_roleOccupant "roleOccupant" -#define NID_roleOccupant 877 -#define OBJ_roleOccupant OBJ_X509,33L - -#define SN_seeAlso "seeAlso" -#define NID_seeAlso 878 -#define OBJ_seeAlso OBJ_X509,34L - -#define LN_userPassword "userPassword" -#define NID_userPassword 879 -#define OBJ_userPassword OBJ_X509,35L - -#define LN_userCertificate "userCertificate" -#define NID_userCertificate 880 -#define OBJ_userCertificate OBJ_X509,36L - -#define LN_cACertificate "cACertificate" -#define NID_cACertificate 881 -#define OBJ_cACertificate OBJ_X509,37L - -#define LN_authorityRevocationList "authorityRevocationList" -#define NID_authorityRevocationList 882 -#define OBJ_authorityRevocationList OBJ_X509,38L - -#define LN_certificateRevocationList "certificateRevocationList" -#define NID_certificateRevocationList 883 -#define OBJ_certificateRevocationList OBJ_X509,39L - -#define LN_crossCertificatePair "crossCertificatePair" -#define NID_crossCertificatePair 884 -#define OBJ_crossCertificatePair OBJ_X509,40L - -#define SN_name "name" -#define LN_name "name" -#define NID_name 173 -#define OBJ_name OBJ_X509,41L - -#define SN_givenName "GN" -#define LN_givenName "givenName" -#define NID_givenName 99 -#define OBJ_givenName OBJ_X509,42L - -#define SN_initials "initials" -#define LN_initials "initials" -#define NID_initials 101 -#define OBJ_initials OBJ_X509,43L - -#define LN_generationQualifier "generationQualifier" -#define NID_generationQualifier 509 -#define OBJ_generationQualifier OBJ_X509,44L - -#define LN_x500UniqueIdentifier "x500UniqueIdentifier" -#define NID_x500UniqueIdentifier 503 -#define OBJ_x500UniqueIdentifier OBJ_X509,45L - -#define SN_dnQualifier "dnQualifier" -#define LN_dnQualifier "dnQualifier" -#define NID_dnQualifier 174 -#define OBJ_dnQualifier OBJ_X509,46L - -#define LN_enhancedSearchGuide "enhancedSearchGuide" -#define NID_enhancedSearchGuide 885 -#define OBJ_enhancedSearchGuide OBJ_X509,47L - -#define LN_protocolInformation "protocolInformation" -#define NID_protocolInformation 886 -#define OBJ_protocolInformation OBJ_X509,48L - -#define LN_distinguishedName "distinguishedName" -#define NID_distinguishedName 887 -#define OBJ_distinguishedName OBJ_X509,49L - -#define LN_uniqueMember "uniqueMember" -#define NID_uniqueMember 888 -#define OBJ_uniqueMember OBJ_X509,50L - -#define LN_houseIdentifier "houseIdentifier" -#define NID_houseIdentifier 889 -#define OBJ_houseIdentifier OBJ_X509,51L - -#define LN_supportedAlgorithms "supportedAlgorithms" -#define NID_supportedAlgorithms 890 -#define OBJ_supportedAlgorithms OBJ_X509,52L - -#define LN_deltaRevocationList "deltaRevocationList" -#define NID_deltaRevocationList 891 -#define OBJ_deltaRevocationList OBJ_X509,53L - -#define SN_dmdName "dmdName" -#define NID_dmdName 892 -#define OBJ_dmdName OBJ_X509,54L - -#define LN_pseudonym "pseudonym" -#define NID_pseudonym 510 -#define OBJ_pseudonym OBJ_X509,65L - -#define SN_role "role" -#define LN_role "role" -#define NID_role 400 -#define OBJ_role OBJ_X509,72L - -#define LN_organizationIdentifier "organizationIdentifier" -#define NID_organizationIdentifier 1089 -#define OBJ_organizationIdentifier OBJ_X509,97L - -#define SN_countryCode3c "c3" -#define LN_countryCode3c "countryCode3c" -#define NID_countryCode3c 1090 -#define OBJ_countryCode3c OBJ_X509,98L - -#define SN_countryCode3n "n3" -#define LN_countryCode3n "countryCode3n" -#define NID_countryCode3n 1091 -#define OBJ_countryCode3n OBJ_X509,99L - -#define LN_dnsName "dnsName" -#define NID_dnsName 1092 -#define OBJ_dnsName OBJ_X509,100L - -#define SN_X500algorithms "X500algorithms" -#define LN_X500algorithms "directory services - algorithms" -#define NID_X500algorithms 378 -#define OBJ_X500algorithms OBJ_X500,8L - -#define SN_rsa "RSA" -#define LN_rsa "rsa" -#define NID_rsa 19 -#define OBJ_rsa OBJ_X500algorithms,1L,1L - -#define SN_mdc2WithRSA "RSA-MDC2" -#define LN_mdc2WithRSA "mdc2WithRSA" -#define NID_mdc2WithRSA 96 -#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L - -#define SN_mdc2 "MDC2" -#define LN_mdc2 "mdc2" -#define NID_mdc2 95 -#define OBJ_mdc2 OBJ_X500algorithms,3L,101L - -#define SN_id_ce "id-ce" -#define NID_id_ce 81 -#define OBJ_id_ce OBJ_X500,29L - -#define SN_subject_directory_attributes "subjectDirectoryAttributes" -#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" -#define NID_subject_directory_attributes 769 -#define OBJ_subject_directory_attributes OBJ_id_ce,9L - -#define SN_subject_key_identifier "subjectKeyIdentifier" -#define LN_subject_key_identifier "X509v3 Subject Key Identifier" -#define NID_subject_key_identifier 82 -#define OBJ_subject_key_identifier OBJ_id_ce,14L - -#define SN_key_usage "keyUsage" -#define LN_key_usage "X509v3 Key Usage" -#define NID_key_usage 83 -#define OBJ_key_usage OBJ_id_ce,15L - -#define SN_private_key_usage_period "privateKeyUsagePeriod" -#define LN_private_key_usage_period "X509v3 Private Key Usage Period" -#define NID_private_key_usage_period 84 -#define OBJ_private_key_usage_period OBJ_id_ce,16L - -#define SN_subject_alt_name "subjectAltName" -#define LN_subject_alt_name "X509v3 Subject Alternative Name" -#define NID_subject_alt_name 85 -#define OBJ_subject_alt_name OBJ_id_ce,17L - -#define SN_issuer_alt_name "issuerAltName" -#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" -#define NID_issuer_alt_name 86 -#define OBJ_issuer_alt_name OBJ_id_ce,18L - -#define SN_basic_constraints "basicConstraints" -#define LN_basic_constraints "X509v3 Basic Constraints" -#define NID_basic_constraints 87 -#define OBJ_basic_constraints OBJ_id_ce,19L - -#define SN_crl_number "crlNumber" -#define LN_crl_number "X509v3 CRL Number" -#define NID_crl_number 88 -#define OBJ_crl_number OBJ_id_ce,20L - -#define SN_crl_reason "CRLReason" -#define LN_crl_reason "X509v3 CRL Reason Code" -#define NID_crl_reason 141 -#define OBJ_crl_reason OBJ_id_ce,21L - -#define SN_invalidity_date "invalidityDate" -#define LN_invalidity_date "Invalidity Date" -#define NID_invalidity_date 142 -#define OBJ_invalidity_date OBJ_id_ce,24L - -#define SN_delta_crl "deltaCRL" -#define LN_delta_crl "X509v3 Delta CRL Indicator" -#define NID_delta_crl 140 -#define OBJ_delta_crl OBJ_id_ce,27L - -#define SN_issuing_distribution_point "issuingDistributionPoint" -#define LN_issuing_distribution_point "X509v3 Issuing Distribution Point" -#define NID_issuing_distribution_point 770 -#define OBJ_issuing_distribution_point OBJ_id_ce,28L - -#define SN_certificate_issuer "certificateIssuer" -#define LN_certificate_issuer "X509v3 Certificate Issuer" -#define NID_certificate_issuer 771 -#define OBJ_certificate_issuer OBJ_id_ce,29L - -#define SN_name_constraints "nameConstraints" -#define LN_name_constraints "X509v3 Name Constraints" -#define NID_name_constraints 666 -#define OBJ_name_constraints OBJ_id_ce,30L - -#define SN_crl_distribution_points "crlDistributionPoints" -#define LN_crl_distribution_points "X509v3 CRL Distribution Points" -#define NID_crl_distribution_points 103 -#define OBJ_crl_distribution_points OBJ_id_ce,31L - -#define SN_certificate_policies "certificatePolicies" -#define LN_certificate_policies "X509v3 Certificate Policies" -#define NID_certificate_policies 89 -#define OBJ_certificate_policies OBJ_id_ce,32L - -#define SN_any_policy "anyPolicy" -#define LN_any_policy "X509v3 Any Policy" -#define NID_any_policy 746 -#define OBJ_any_policy OBJ_certificate_policies,0L - -#define SN_policy_mappings "policyMappings" -#define LN_policy_mappings "X509v3 Policy Mappings" -#define NID_policy_mappings 747 -#define OBJ_policy_mappings OBJ_id_ce,33L - -#define SN_authority_key_identifier "authorityKeyIdentifier" -#define LN_authority_key_identifier "X509v3 Authority Key Identifier" -#define NID_authority_key_identifier 90 -#define OBJ_authority_key_identifier OBJ_id_ce,35L - -#define SN_policy_constraints "policyConstraints" -#define LN_policy_constraints "X509v3 Policy Constraints" -#define NID_policy_constraints 401 -#define OBJ_policy_constraints OBJ_id_ce,36L - -#define SN_ext_key_usage "extendedKeyUsage" -#define LN_ext_key_usage "X509v3 Extended Key Usage" -#define NID_ext_key_usage 126 -#define OBJ_ext_key_usage OBJ_id_ce,37L - -#define SN_freshest_crl "freshestCRL" -#define LN_freshest_crl "X509v3 Freshest CRL" -#define NID_freshest_crl 857 -#define OBJ_freshest_crl OBJ_id_ce,46L - -#define SN_inhibit_any_policy "inhibitAnyPolicy" -#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" -#define NID_inhibit_any_policy 748 -#define OBJ_inhibit_any_policy OBJ_id_ce,54L - -#define SN_target_information "targetInformation" -#define LN_target_information "X509v3 AC Targeting" -#define NID_target_information 402 -#define OBJ_target_information OBJ_id_ce,55L - -#define SN_no_rev_avail "noRevAvail" -#define LN_no_rev_avail "X509v3 No Revocation Available" -#define NID_no_rev_avail 403 -#define OBJ_no_rev_avail OBJ_id_ce,56L - -#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" -#define LN_anyExtendedKeyUsage "Any Extended Key Usage" -#define NID_anyExtendedKeyUsage 910 -#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L - -#define SN_netscape "Netscape" -#define LN_netscape "Netscape Communications Corp." -#define NID_netscape 57 -#define OBJ_netscape 2L,16L,840L,1L,113730L - -#define SN_netscape_cert_extension "nsCertExt" -#define LN_netscape_cert_extension "Netscape Certificate Extension" -#define NID_netscape_cert_extension 58 -#define OBJ_netscape_cert_extension OBJ_netscape,1L - -#define SN_netscape_data_type "nsDataType" -#define LN_netscape_data_type "Netscape Data Type" -#define NID_netscape_data_type 59 -#define OBJ_netscape_data_type OBJ_netscape,2L - -#define SN_netscape_cert_type "nsCertType" -#define LN_netscape_cert_type "Netscape Cert Type" -#define NID_netscape_cert_type 71 -#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L - -#define SN_netscape_base_url "nsBaseUrl" -#define LN_netscape_base_url "Netscape Base Url" -#define NID_netscape_base_url 72 -#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L - -#define SN_netscape_revocation_url "nsRevocationUrl" -#define LN_netscape_revocation_url "Netscape Revocation Url" -#define NID_netscape_revocation_url 73 -#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L - -#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" -#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" -#define NID_netscape_ca_revocation_url 74 -#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L - -#define SN_netscape_renewal_url "nsRenewalUrl" -#define LN_netscape_renewal_url "Netscape Renewal Url" -#define NID_netscape_renewal_url 75 -#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L - -#define SN_netscape_ca_policy_url "nsCaPolicyUrl" -#define LN_netscape_ca_policy_url "Netscape CA Policy Url" -#define NID_netscape_ca_policy_url 76 -#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L - -#define SN_netscape_ssl_server_name "nsSslServerName" -#define LN_netscape_ssl_server_name "Netscape SSL Server Name" -#define NID_netscape_ssl_server_name 77 -#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L - -#define SN_netscape_comment "nsComment" -#define LN_netscape_comment "Netscape Comment" -#define NID_netscape_comment 78 -#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L - -#define SN_netscape_cert_sequence "nsCertSequence" -#define LN_netscape_cert_sequence "Netscape Certificate Sequence" -#define NID_netscape_cert_sequence 79 -#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L - -#define SN_ns_sgc "nsSGC" -#define LN_ns_sgc "Netscape Server Gated Crypto" -#define NID_ns_sgc 139 -#define OBJ_ns_sgc OBJ_netscape,4L,1L - -#define SN_org "ORG" -#define LN_org "org" -#define NID_org 379 -#define OBJ_org OBJ_iso,3L - -#define SN_dod "DOD" -#define LN_dod "dod" -#define NID_dod 380 -#define OBJ_dod OBJ_org,6L - -#define SN_iana "IANA" -#define LN_iana "iana" -#define NID_iana 381 -#define OBJ_iana OBJ_dod,1L - -#define OBJ_internet OBJ_iana - -#define SN_Directory "directory" -#define LN_Directory "Directory" -#define NID_Directory 382 -#define OBJ_Directory OBJ_internet,1L - -#define SN_Management "mgmt" -#define LN_Management "Management" -#define NID_Management 383 -#define OBJ_Management OBJ_internet,2L - -#define SN_Experimental "experimental" -#define LN_Experimental "Experimental" -#define NID_Experimental 384 -#define OBJ_Experimental OBJ_internet,3L - -#define SN_Private "private" -#define LN_Private "Private" -#define NID_Private 385 -#define OBJ_Private OBJ_internet,4L - -#define SN_Security "security" -#define LN_Security "Security" -#define NID_Security 386 -#define OBJ_Security OBJ_internet,5L - -#define SN_SNMPv2 "snmpv2" -#define LN_SNMPv2 "SNMPv2" -#define NID_SNMPv2 387 -#define OBJ_SNMPv2 OBJ_internet,6L - -#define LN_Mail "Mail" -#define NID_Mail 388 -#define OBJ_Mail OBJ_internet,7L - -#define SN_Enterprises "enterprises" -#define LN_Enterprises "Enterprises" -#define NID_Enterprises 389 -#define OBJ_Enterprises OBJ_Private,1L - -#define SN_dcObject "dcobject" -#define LN_dcObject "dcObject" -#define NID_dcObject 390 -#define OBJ_dcObject OBJ_Enterprises,1466L,344L - -#define SN_mime_mhs "mime-mhs" -#define LN_mime_mhs "MIME MHS" -#define NID_mime_mhs 504 -#define OBJ_mime_mhs OBJ_Mail,1L - -#define SN_mime_mhs_headings "mime-mhs-headings" -#define LN_mime_mhs_headings "mime-mhs-headings" -#define NID_mime_mhs_headings 505 -#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L - -#define SN_mime_mhs_bodies "mime-mhs-bodies" -#define LN_mime_mhs_bodies "mime-mhs-bodies" -#define NID_mime_mhs_bodies 506 -#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L - -#define SN_id_hex_partial_message "id-hex-partial-message" -#define LN_id_hex_partial_message "id-hex-partial-message" -#define NID_id_hex_partial_message 507 -#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L - -#define SN_id_hex_multipart_message "id-hex-multipart-message" -#define LN_id_hex_multipart_message "id-hex-multipart-message" -#define NID_id_hex_multipart_message 508 -#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L - -#define SN_zlib_compression "ZLIB" -#define LN_zlib_compression "zlib compression" -#define NID_zlib_compression 125 -#define OBJ_zlib_compression OBJ_id_smime_alg,8L - -#define OBJ_csor 2L,16L,840L,1L,101L,3L - -#define OBJ_nistAlgorithms OBJ_csor,4L - -#define OBJ_aes OBJ_nistAlgorithms,1L - -#define SN_aes_128_ecb "AES-128-ECB" -#define LN_aes_128_ecb "aes-128-ecb" -#define NID_aes_128_ecb 418 -#define OBJ_aes_128_ecb OBJ_aes,1L - -#define SN_aes_128_cbc "AES-128-CBC" -#define LN_aes_128_cbc "aes-128-cbc" -#define NID_aes_128_cbc 419 -#define OBJ_aes_128_cbc OBJ_aes,2L - -#define SN_aes_128_ofb128 "AES-128-OFB" -#define LN_aes_128_ofb128 "aes-128-ofb" -#define NID_aes_128_ofb128 420 -#define OBJ_aes_128_ofb128 OBJ_aes,3L - -#define SN_aes_128_cfb128 "AES-128-CFB" -#define LN_aes_128_cfb128 "aes-128-cfb" -#define NID_aes_128_cfb128 421 -#define OBJ_aes_128_cfb128 OBJ_aes,4L - -#define SN_id_aes128_wrap "id-aes128-wrap" -#define NID_id_aes128_wrap 788 -#define OBJ_id_aes128_wrap OBJ_aes,5L - -#define SN_aes_128_gcm "id-aes128-GCM" -#define LN_aes_128_gcm "aes-128-gcm" -#define NID_aes_128_gcm 895 -#define OBJ_aes_128_gcm OBJ_aes,6L - -#define SN_aes_128_ccm "id-aes128-CCM" -#define LN_aes_128_ccm "aes-128-ccm" -#define NID_aes_128_ccm 896 -#define OBJ_aes_128_ccm OBJ_aes,7L - -#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" -#define NID_id_aes128_wrap_pad 897 -#define OBJ_id_aes128_wrap_pad OBJ_aes,8L - -#define SN_aes_192_ecb "AES-192-ECB" -#define LN_aes_192_ecb "aes-192-ecb" -#define NID_aes_192_ecb 422 -#define OBJ_aes_192_ecb OBJ_aes,21L - -#define SN_aes_192_cbc "AES-192-CBC" -#define LN_aes_192_cbc "aes-192-cbc" -#define NID_aes_192_cbc 423 -#define OBJ_aes_192_cbc OBJ_aes,22L - -#define SN_aes_192_ofb128 "AES-192-OFB" -#define LN_aes_192_ofb128 "aes-192-ofb" -#define NID_aes_192_ofb128 424 -#define OBJ_aes_192_ofb128 OBJ_aes,23L - -#define SN_aes_192_cfb128 "AES-192-CFB" -#define LN_aes_192_cfb128 "aes-192-cfb" -#define NID_aes_192_cfb128 425 -#define OBJ_aes_192_cfb128 OBJ_aes,24L - -#define SN_id_aes192_wrap "id-aes192-wrap" -#define NID_id_aes192_wrap 789 -#define OBJ_id_aes192_wrap OBJ_aes,25L - -#define SN_aes_192_gcm "id-aes192-GCM" -#define LN_aes_192_gcm "aes-192-gcm" -#define NID_aes_192_gcm 898 -#define OBJ_aes_192_gcm OBJ_aes,26L - -#define SN_aes_192_ccm "id-aes192-CCM" -#define LN_aes_192_ccm "aes-192-ccm" -#define NID_aes_192_ccm 899 -#define OBJ_aes_192_ccm OBJ_aes,27L - -#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" -#define NID_id_aes192_wrap_pad 900 -#define OBJ_id_aes192_wrap_pad OBJ_aes,28L - -#define SN_aes_256_ecb "AES-256-ECB" -#define LN_aes_256_ecb "aes-256-ecb" -#define NID_aes_256_ecb 426 -#define OBJ_aes_256_ecb OBJ_aes,41L - -#define SN_aes_256_cbc "AES-256-CBC" -#define LN_aes_256_cbc "aes-256-cbc" -#define NID_aes_256_cbc 427 -#define OBJ_aes_256_cbc OBJ_aes,42L - -#define SN_aes_256_ofb128 "AES-256-OFB" -#define LN_aes_256_ofb128 "aes-256-ofb" -#define NID_aes_256_ofb128 428 -#define OBJ_aes_256_ofb128 OBJ_aes,43L - -#define SN_aes_256_cfb128 "AES-256-CFB" -#define LN_aes_256_cfb128 "aes-256-cfb" -#define NID_aes_256_cfb128 429 -#define OBJ_aes_256_cfb128 OBJ_aes,44L - -#define SN_id_aes256_wrap "id-aes256-wrap" -#define NID_id_aes256_wrap 790 -#define OBJ_id_aes256_wrap OBJ_aes,45L - -#define SN_aes_256_gcm "id-aes256-GCM" -#define LN_aes_256_gcm "aes-256-gcm" -#define NID_aes_256_gcm 901 -#define OBJ_aes_256_gcm OBJ_aes,46L - -#define SN_aes_256_ccm "id-aes256-CCM" -#define LN_aes_256_ccm "aes-256-ccm" -#define NID_aes_256_ccm 902 -#define OBJ_aes_256_ccm OBJ_aes,47L - -#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" -#define NID_id_aes256_wrap_pad 903 -#define OBJ_id_aes256_wrap_pad OBJ_aes,48L - -#define SN_aes_128_xts "AES-128-XTS" -#define LN_aes_128_xts "aes-128-xts" -#define NID_aes_128_xts 913 -#define OBJ_aes_128_xts OBJ_ieee_siswg,0L,1L,1L - -#define SN_aes_256_xts "AES-256-XTS" -#define LN_aes_256_xts "aes-256-xts" -#define NID_aes_256_xts 914 -#define OBJ_aes_256_xts OBJ_ieee_siswg,0L,1L,2L - -#define SN_aes_128_cfb1 "AES-128-CFB1" -#define LN_aes_128_cfb1 "aes-128-cfb1" -#define NID_aes_128_cfb1 650 - -#define SN_aes_192_cfb1 "AES-192-CFB1" -#define LN_aes_192_cfb1 "aes-192-cfb1" -#define NID_aes_192_cfb1 651 - -#define SN_aes_256_cfb1 "AES-256-CFB1" -#define LN_aes_256_cfb1 "aes-256-cfb1" -#define NID_aes_256_cfb1 652 - -#define SN_aes_128_cfb8 "AES-128-CFB8" -#define LN_aes_128_cfb8 "aes-128-cfb8" -#define NID_aes_128_cfb8 653 - -#define SN_aes_192_cfb8 "AES-192-CFB8" -#define LN_aes_192_cfb8 "aes-192-cfb8" -#define NID_aes_192_cfb8 654 - -#define SN_aes_256_cfb8 "AES-256-CFB8" -#define LN_aes_256_cfb8 "aes-256-cfb8" -#define NID_aes_256_cfb8 655 - -#define SN_aes_128_ctr "AES-128-CTR" -#define LN_aes_128_ctr "aes-128-ctr" -#define NID_aes_128_ctr 904 - -#define SN_aes_192_ctr "AES-192-CTR" -#define LN_aes_192_ctr "aes-192-ctr" -#define NID_aes_192_ctr 905 - -#define SN_aes_256_ctr "AES-256-CTR" -#define LN_aes_256_ctr "aes-256-ctr" -#define NID_aes_256_ctr 906 - -#define SN_aes_128_ocb "AES-128-OCB" -#define LN_aes_128_ocb "aes-128-ocb" -#define NID_aes_128_ocb 958 - -#define SN_aes_192_ocb "AES-192-OCB" -#define LN_aes_192_ocb "aes-192-ocb" -#define NID_aes_192_ocb 959 - -#define SN_aes_256_ocb "AES-256-OCB" -#define LN_aes_256_ocb "aes-256-ocb" -#define NID_aes_256_ocb 960 - -#define SN_des_cfb1 "DES-CFB1" -#define LN_des_cfb1 "des-cfb1" -#define NID_des_cfb1 656 - -#define SN_des_cfb8 "DES-CFB8" -#define LN_des_cfb8 "des-cfb8" -#define NID_des_cfb8 657 - -#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" -#define LN_des_ede3_cfb1 "des-ede3-cfb1" -#define NID_des_ede3_cfb1 658 - -#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" -#define LN_des_ede3_cfb8 "des-ede3-cfb8" -#define NID_des_ede3_cfb8 659 - -#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L - -#define SN_sha256 "SHA256" -#define LN_sha256 "sha256" -#define NID_sha256 672 -#define OBJ_sha256 OBJ_nist_hashalgs,1L - -#define SN_sha384 "SHA384" -#define LN_sha384 "sha384" -#define NID_sha384 673 -#define OBJ_sha384 OBJ_nist_hashalgs,2L - -#define SN_sha512 "SHA512" -#define LN_sha512 "sha512" -#define NID_sha512 674 -#define OBJ_sha512 OBJ_nist_hashalgs,3L - -#define SN_sha224 "SHA224" -#define LN_sha224 "sha224" -#define NID_sha224 675 -#define OBJ_sha224 OBJ_nist_hashalgs,4L - -#define SN_sha512_224 "SHA512-224" -#define LN_sha512_224 "sha512-224" -#define NID_sha512_224 1094 -#define OBJ_sha512_224 OBJ_nist_hashalgs,5L - -#define SN_sha512_256 "SHA512-256" -#define LN_sha512_256 "sha512-256" -#define NID_sha512_256 1095 -#define OBJ_sha512_256 OBJ_nist_hashalgs,6L - -#define SN_sha3_224 "SHA3-224" -#define LN_sha3_224 "sha3-224" -#define NID_sha3_224 1096 -#define OBJ_sha3_224 OBJ_nist_hashalgs,7L - -#define SN_sha3_256 "SHA3-256" -#define LN_sha3_256 "sha3-256" -#define NID_sha3_256 1097 -#define OBJ_sha3_256 OBJ_nist_hashalgs,8L - -#define SN_sha3_384 "SHA3-384" -#define LN_sha3_384 "sha3-384" -#define NID_sha3_384 1098 -#define OBJ_sha3_384 OBJ_nist_hashalgs,9L - -#define SN_sha3_512 "SHA3-512" -#define LN_sha3_512 "sha3-512" -#define NID_sha3_512 1099 -#define OBJ_sha3_512 OBJ_nist_hashalgs,10L - -#define SN_shake128 "SHAKE128" -#define LN_shake128 "shake128" -#define NID_shake128 1100 -#define OBJ_shake128 OBJ_nist_hashalgs,11L - -#define SN_shake256 "SHAKE256" -#define LN_shake256 "shake256" -#define NID_shake256 1101 -#define OBJ_shake256 OBJ_nist_hashalgs,12L - -#define SN_hmac_sha3_224 "id-hmacWithSHA3-224" -#define LN_hmac_sha3_224 "hmac-sha3-224" -#define NID_hmac_sha3_224 1102 -#define OBJ_hmac_sha3_224 OBJ_nist_hashalgs,13L - -#define SN_hmac_sha3_256 "id-hmacWithSHA3-256" -#define LN_hmac_sha3_256 "hmac-sha3-256" -#define NID_hmac_sha3_256 1103 -#define OBJ_hmac_sha3_256 OBJ_nist_hashalgs,14L - -#define SN_hmac_sha3_384 "id-hmacWithSHA3-384" -#define LN_hmac_sha3_384 "hmac-sha3-384" -#define NID_hmac_sha3_384 1104 -#define OBJ_hmac_sha3_384 OBJ_nist_hashalgs,15L - -#define SN_hmac_sha3_512 "id-hmacWithSHA3-512" -#define LN_hmac_sha3_512 "hmac-sha3-512" -#define NID_hmac_sha3_512 1105 -#define OBJ_hmac_sha3_512 OBJ_nist_hashalgs,16L - -#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L - -#define SN_dsa_with_SHA224 "dsa_with_SHA224" -#define NID_dsa_with_SHA224 802 -#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L - -#define SN_dsa_with_SHA256 "dsa_with_SHA256" -#define NID_dsa_with_SHA256 803 -#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L - -#define OBJ_sigAlgs OBJ_nistAlgorithms,3L - -#define SN_dsa_with_SHA384 "id-dsa-with-sha384" -#define LN_dsa_with_SHA384 "dsa_with_SHA384" -#define NID_dsa_with_SHA384 1106 -#define OBJ_dsa_with_SHA384 OBJ_sigAlgs,3L - -#define SN_dsa_with_SHA512 "id-dsa-with-sha512" -#define LN_dsa_with_SHA512 "dsa_with_SHA512" -#define NID_dsa_with_SHA512 1107 -#define OBJ_dsa_with_SHA512 OBJ_sigAlgs,4L - -#define SN_dsa_with_SHA3_224 "id-dsa-with-sha3-224" -#define LN_dsa_with_SHA3_224 "dsa_with_SHA3-224" -#define NID_dsa_with_SHA3_224 1108 -#define OBJ_dsa_with_SHA3_224 OBJ_sigAlgs,5L - -#define SN_dsa_with_SHA3_256 "id-dsa-with-sha3-256" -#define LN_dsa_with_SHA3_256 "dsa_with_SHA3-256" -#define NID_dsa_with_SHA3_256 1109 -#define OBJ_dsa_with_SHA3_256 OBJ_sigAlgs,6L - -#define SN_dsa_with_SHA3_384 "id-dsa-with-sha3-384" -#define LN_dsa_with_SHA3_384 "dsa_with_SHA3-384" -#define NID_dsa_with_SHA3_384 1110 -#define OBJ_dsa_with_SHA3_384 OBJ_sigAlgs,7L - -#define SN_dsa_with_SHA3_512 "id-dsa-with-sha3-512" -#define LN_dsa_with_SHA3_512 "dsa_with_SHA3-512" -#define NID_dsa_with_SHA3_512 1111 -#define OBJ_dsa_with_SHA3_512 OBJ_sigAlgs,8L - -#define SN_ecdsa_with_SHA3_224 "id-ecdsa-with-sha3-224" -#define LN_ecdsa_with_SHA3_224 "ecdsa_with_SHA3-224" -#define NID_ecdsa_with_SHA3_224 1112 -#define OBJ_ecdsa_with_SHA3_224 OBJ_sigAlgs,9L - -#define SN_ecdsa_with_SHA3_256 "id-ecdsa-with-sha3-256" -#define LN_ecdsa_with_SHA3_256 "ecdsa_with_SHA3-256" -#define NID_ecdsa_with_SHA3_256 1113 -#define OBJ_ecdsa_with_SHA3_256 OBJ_sigAlgs,10L - -#define SN_ecdsa_with_SHA3_384 "id-ecdsa-with-sha3-384" -#define LN_ecdsa_with_SHA3_384 "ecdsa_with_SHA3-384" -#define NID_ecdsa_with_SHA3_384 1114 -#define OBJ_ecdsa_with_SHA3_384 OBJ_sigAlgs,11L - -#define SN_ecdsa_with_SHA3_512 "id-ecdsa-with-sha3-512" -#define LN_ecdsa_with_SHA3_512 "ecdsa_with_SHA3-512" -#define NID_ecdsa_with_SHA3_512 1115 -#define OBJ_ecdsa_with_SHA3_512 OBJ_sigAlgs,12L - -#define SN_RSA_SHA3_224 "id-rsassa-pkcs1-v1_5-with-sha3-224" -#define LN_RSA_SHA3_224 "RSA-SHA3-224" -#define NID_RSA_SHA3_224 1116 -#define OBJ_RSA_SHA3_224 OBJ_sigAlgs,13L - -#define SN_RSA_SHA3_256 "id-rsassa-pkcs1-v1_5-with-sha3-256" -#define LN_RSA_SHA3_256 "RSA-SHA3-256" -#define NID_RSA_SHA3_256 1117 -#define OBJ_RSA_SHA3_256 OBJ_sigAlgs,14L - -#define SN_RSA_SHA3_384 "id-rsassa-pkcs1-v1_5-with-sha3-384" -#define LN_RSA_SHA3_384 "RSA-SHA3-384" -#define NID_RSA_SHA3_384 1118 -#define OBJ_RSA_SHA3_384 OBJ_sigAlgs,15L - -#define SN_RSA_SHA3_512 "id-rsassa-pkcs1-v1_5-with-sha3-512" -#define LN_RSA_SHA3_512 "RSA-SHA3-512" -#define NID_RSA_SHA3_512 1119 -#define OBJ_RSA_SHA3_512 OBJ_sigAlgs,16L - -#define SN_hold_instruction_code "holdInstructionCode" -#define LN_hold_instruction_code "Hold Instruction Code" -#define NID_hold_instruction_code 430 -#define OBJ_hold_instruction_code OBJ_id_ce,23L - -#define OBJ_holdInstruction OBJ_X9_57,2L - -#define SN_hold_instruction_none "holdInstructionNone" -#define LN_hold_instruction_none "Hold Instruction None" -#define NID_hold_instruction_none 431 -#define OBJ_hold_instruction_none OBJ_holdInstruction,1L - -#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" -#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" -#define NID_hold_instruction_call_issuer 432 -#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L - -#define SN_hold_instruction_reject "holdInstructionReject" -#define LN_hold_instruction_reject "Hold Instruction Reject" -#define NID_hold_instruction_reject 433 -#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L - -#define SN_data "data" -#define NID_data 434 -#define OBJ_data OBJ_itu_t,9L - -#define SN_pss "pss" -#define NID_pss 435 -#define OBJ_pss OBJ_data,2342L - -#define SN_ucl "ucl" -#define NID_ucl 436 -#define OBJ_ucl OBJ_pss,19200300L - -#define SN_pilot "pilot" -#define NID_pilot 437 -#define OBJ_pilot OBJ_ucl,100L - -#define LN_pilotAttributeType "pilotAttributeType" -#define NID_pilotAttributeType 438 -#define OBJ_pilotAttributeType OBJ_pilot,1L - -#define LN_pilotAttributeSyntax "pilotAttributeSyntax" -#define NID_pilotAttributeSyntax 439 -#define OBJ_pilotAttributeSyntax OBJ_pilot,3L - -#define LN_pilotObjectClass "pilotObjectClass" -#define NID_pilotObjectClass 440 -#define OBJ_pilotObjectClass OBJ_pilot,4L - -#define LN_pilotGroups "pilotGroups" -#define NID_pilotGroups 441 -#define OBJ_pilotGroups OBJ_pilot,10L - -#define LN_iA5StringSyntax "iA5StringSyntax" -#define NID_iA5StringSyntax 442 -#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L - -#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" -#define NID_caseIgnoreIA5StringSyntax 443 -#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L - -#define LN_pilotObject "pilotObject" -#define NID_pilotObject 444 -#define OBJ_pilotObject OBJ_pilotObjectClass,3L - -#define LN_pilotPerson "pilotPerson" -#define NID_pilotPerson 445 -#define OBJ_pilotPerson OBJ_pilotObjectClass,4L - -#define SN_account "account" -#define NID_account 446 -#define OBJ_account OBJ_pilotObjectClass,5L - -#define SN_document "document" -#define NID_document 447 -#define OBJ_document OBJ_pilotObjectClass,6L - -#define SN_room "room" -#define NID_room 448 -#define OBJ_room OBJ_pilotObjectClass,7L - -#define LN_documentSeries "documentSeries" -#define NID_documentSeries 449 -#define OBJ_documentSeries OBJ_pilotObjectClass,9L - -#define SN_Domain "domain" -#define LN_Domain "Domain" -#define NID_Domain 392 -#define OBJ_Domain OBJ_pilotObjectClass,13L - -#define LN_rFC822localPart "rFC822localPart" -#define NID_rFC822localPart 450 -#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L - -#define LN_dNSDomain "dNSDomain" -#define NID_dNSDomain 451 -#define OBJ_dNSDomain OBJ_pilotObjectClass,15L - -#define LN_domainRelatedObject "domainRelatedObject" -#define NID_domainRelatedObject 452 -#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L - -#define LN_friendlyCountry "friendlyCountry" -#define NID_friendlyCountry 453 -#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L - -#define LN_simpleSecurityObject "simpleSecurityObject" -#define NID_simpleSecurityObject 454 -#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L - -#define LN_pilotOrganization "pilotOrganization" -#define NID_pilotOrganization 455 -#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L - -#define LN_pilotDSA "pilotDSA" -#define NID_pilotDSA 456 -#define OBJ_pilotDSA OBJ_pilotObjectClass,21L - -#define LN_qualityLabelledData "qualityLabelledData" -#define NID_qualityLabelledData 457 -#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L - -#define SN_userId "UID" -#define LN_userId "userId" -#define NID_userId 458 -#define OBJ_userId OBJ_pilotAttributeType,1L - -#define LN_textEncodedORAddress "textEncodedORAddress" -#define NID_textEncodedORAddress 459 -#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L - -#define SN_rfc822Mailbox "mail" -#define LN_rfc822Mailbox "rfc822Mailbox" -#define NID_rfc822Mailbox 460 -#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L - -#define SN_info "info" -#define NID_info 461 -#define OBJ_info OBJ_pilotAttributeType,4L - -#define LN_favouriteDrink "favouriteDrink" -#define NID_favouriteDrink 462 -#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L - -#define LN_roomNumber "roomNumber" -#define NID_roomNumber 463 -#define OBJ_roomNumber OBJ_pilotAttributeType,6L - -#define SN_photo "photo" -#define NID_photo 464 -#define OBJ_photo OBJ_pilotAttributeType,7L - -#define LN_userClass "userClass" -#define NID_userClass 465 -#define OBJ_userClass OBJ_pilotAttributeType,8L - -#define SN_host "host" -#define NID_host 466 -#define OBJ_host OBJ_pilotAttributeType,9L - -#define SN_manager "manager" -#define NID_manager 467 -#define OBJ_manager OBJ_pilotAttributeType,10L - -#define LN_documentIdentifier "documentIdentifier" -#define NID_documentIdentifier 468 -#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L - -#define LN_documentTitle "documentTitle" -#define NID_documentTitle 469 -#define OBJ_documentTitle OBJ_pilotAttributeType,12L - -#define LN_documentVersion "documentVersion" -#define NID_documentVersion 470 -#define OBJ_documentVersion OBJ_pilotAttributeType,13L - -#define LN_documentAuthor "documentAuthor" -#define NID_documentAuthor 471 -#define OBJ_documentAuthor OBJ_pilotAttributeType,14L - -#define LN_documentLocation "documentLocation" -#define NID_documentLocation 472 -#define OBJ_documentLocation OBJ_pilotAttributeType,15L - -#define LN_homeTelephoneNumber "homeTelephoneNumber" -#define NID_homeTelephoneNumber 473 -#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L - -#define SN_secretary "secretary" -#define NID_secretary 474 -#define OBJ_secretary OBJ_pilotAttributeType,21L - -#define LN_otherMailbox "otherMailbox" -#define NID_otherMailbox 475 -#define OBJ_otherMailbox OBJ_pilotAttributeType,22L - -#define LN_lastModifiedTime "lastModifiedTime" -#define NID_lastModifiedTime 476 -#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L - -#define LN_lastModifiedBy "lastModifiedBy" -#define NID_lastModifiedBy 477 -#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L - -#define SN_domainComponent "DC" -#define LN_domainComponent "domainComponent" -#define NID_domainComponent 391 -#define OBJ_domainComponent OBJ_pilotAttributeType,25L - -#define LN_aRecord "aRecord" -#define NID_aRecord 478 -#define OBJ_aRecord OBJ_pilotAttributeType,26L - -#define LN_pilotAttributeType27 "pilotAttributeType27" -#define NID_pilotAttributeType27 479 -#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L - -#define LN_mXRecord "mXRecord" -#define NID_mXRecord 480 -#define OBJ_mXRecord OBJ_pilotAttributeType,28L - -#define LN_nSRecord "nSRecord" -#define NID_nSRecord 481 -#define OBJ_nSRecord OBJ_pilotAttributeType,29L - -#define LN_sOARecord "sOARecord" -#define NID_sOARecord 482 -#define OBJ_sOARecord OBJ_pilotAttributeType,30L - -#define LN_cNAMERecord "cNAMERecord" -#define NID_cNAMERecord 483 -#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L - -#define LN_associatedDomain "associatedDomain" -#define NID_associatedDomain 484 -#define OBJ_associatedDomain OBJ_pilotAttributeType,37L - -#define LN_associatedName "associatedName" -#define NID_associatedName 485 -#define OBJ_associatedName OBJ_pilotAttributeType,38L - -#define LN_homePostalAddress "homePostalAddress" -#define NID_homePostalAddress 486 -#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L - -#define LN_personalTitle "personalTitle" -#define NID_personalTitle 487 -#define OBJ_personalTitle OBJ_pilotAttributeType,40L - -#define LN_mobileTelephoneNumber "mobileTelephoneNumber" -#define NID_mobileTelephoneNumber 488 -#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L - -#define LN_pagerTelephoneNumber "pagerTelephoneNumber" -#define NID_pagerTelephoneNumber 489 -#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L - -#define LN_friendlyCountryName "friendlyCountryName" -#define NID_friendlyCountryName 490 -#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L - -#define SN_uniqueIdentifier "uid" -#define LN_uniqueIdentifier "uniqueIdentifier" -#define NID_uniqueIdentifier 102 -#define OBJ_uniqueIdentifier OBJ_pilotAttributeType,44L - -#define LN_organizationalStatus "organizationalStatus" -#define NID_organizationalStatus 491 -#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L - -#define LN_janetMailbox "janetMailbox" -#define NID_janetMailbox 492 -#define OBJ_janetMailbox OBJ_pilotAttributeType,46L - -#define LN_mailPreferenceOption "mailPreferenceOption" -#define NID_mailPreferenceOption 493 -#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L - -#define LN_buildingName "buildingName" -#define NID_buildingName 494 -#define OBJ_buildingName OBJ_pilotAttributeType,48L - -#define LN_dSAQuality "dSAQuality" -#define NID_dSAQuality 495 -#define OBJ_dSAQuality OBJ_pilotAttributeType,49L - -#define LN_singleLevelQuality "singleLevelQuality" -#define NID_singleLevelQuality 496 -#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L - -#define LN_subtreeMinimumQuality "subtreeMinimumQuality" -#define NID_subtreeMinimumQuality 497 -#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L - -#define LN_subtreeMaximumQuality "subtreeMaximumQuality" -#define NID_subtreeMaximumQuality 498 -#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L - -#define LN_personalSignature "personalSignature" -#define NID_personalSignature 499 -#define OBJ_personalSignature OBJ_pilotAttributeType,53L - -#define LN_dITRedirect "dITRedirect" -#define NID_dITRedirect 500 -#define OBJ_dITRedirect OBJ_pilotAttributeType,54L - -#define SN_audio "audio" -#define NID_audio 501 -#define OBJ_audio OBJ_pilotAttributeType,55L - -#define LN_documentPublisher "documentPublisher" -#define NID_documentPublisher 502 -#define OBJ_documentPublisher OBJ_pilotAttributeType,56L - -#define SN_id_set "id-set" -#define LN_id_set "Secure Electronic Transactions" -#define NID_id_set 512 -#define OBJ_id_set OBJ_international_organizations,42L - -#define SN_set_ctype "set-ctype" -#define LN_set_ctype "content types" -#define NID_set_ctype 513 -#define OBJ_set_ctype OBJ_id_set,0L - -#define SN_set_msgExt "set-msgExt" -#define LN_set_msgExt "message extensions" -#define NID_set_msgExt 514 -#define OBJ_set_msgExt OBJ_id_set,1L - -#define SN_set_attr "set-attr" -#define NID_set_attr 515 -#define OBJ_set_attr OBJ_id_set,3L - -#define SN_set_policy "set-policy" -#define NID_set_policy 516 -#define OBJ_set_policy OBJ_id_set,5L - -#define SN_set_certExt "set-certExt" -#define LN_set_certExt "certificate extensions" -#define NID_set_certExt 517 -#define OBJ_set_certExt OBJ_id_set,7L - -#define SN_set_brand "set-brand" -#define NID_set_brand 518 -#define OBJ_set_brand OBJ_id_set,8L - -#define SN_setct_PANData "setct-PANData" -#define NID_setct_PANData 519 -#define OBJ_setct_PANData OBJ_set_ctype,0L - -#define SN_setct_PANToken "setct-PANToken" -#define NID_setct_PANToken 520 -#define OBJ_setct_PANToken OBJ_set_ctype,1L - -#define SN_setct_PANOnly "setct-PANOnly" -#define NID_setct_PANOnly 521 -#define OBJ_setct_PANOnly OBJ_set_ctype,2L - -#define SN_setct_OIData "setct-OIData" -#define NID_setct_OIData 522 -#define OBJ_setct_OIData OBJ_set_ctype,3L - -#define SN_setct_PI "setct-PI" -#define NID_setct_PI 523 -#define OBJ_setct_PI OBJ_set_ctype,4L - -#define SN_setct_PIData "setct-PIData" -#define NID_setct_PIData 524 -#define OBJ_setct_PIData OBJ_set_ctype,5L - -#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" -#define NID_setct_PIDataUnsigned 525 -#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L - -#define SN_setct_HODInput "setct-HODInput" -#define NID_setct_HODInput 526 -#define OBJ_setct_HODInput OBJ_set_ctype,7L - -#define SN_setct_AuthResBaggage "setct-AuthResBaggage" -#define NID_setct_AuthResBaggage 527 -#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L - -#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" -#define NID_setct_AuthRevReqBaggage 528 -#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L - -#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" -#define NID_setct_AuthRevResBaggage 529 -#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L - -#define SN_setct_CapTokenSeq "setct-CapTokenSeq" -#define NID_setct_CapTokenSeq 530 -#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L - -#define SN_setct_PInitResData "setct-PInitResData" -#define NID_setct_PInitResData 531 -#define OBJ_setct_PInitResData OBJ_set_ctype,12L - -#define SN_setct_PI_TBS "setct-PI-TBS" -#define NID_setct_PI_TBS 532 -#define OBJ_setct_PI_TBS OBJ_set_ctype,13L - -#define SN_setct_PResData "setct-PResData" -#define NID_setct_PResData 533 -#define OBJ_setct_PResData OBJ_set_ctype,14L - -#define SN_setct_AuthReqTBS "setct-AuthReqTBS" -#define NID_setct_AuthReqTBS 534 -#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L - -#define SN_setct_AuthResTBS "setct-AuthResTBS" -#define NID_setct_AuthResTBS 535 -#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L - -#define SN_setct_AuthResTBSX "setct-AuthResTBSX" -#define NID_setct_AuthResTBSX 536 -#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L - -#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" -#define NID_setct_AuthTokenTBS 537 -#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L - -#define SN_setct_CapTokenData "setct-CapTokenData" -#define NID_setct_CapTokenData 538 -#define OBJ_setct_CapTokenData OBJ_set_ctype,20L - -#define SN_setct_CapTokenTBS "setct-CapTokenTBS" -#define NID_setct_CapTokenTBS 539 -#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L - -#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" -#define NID_setct_AcqCardCodeMsg 540 -#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L - -#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" -#define NID_setct_AuthRevReqTBS 541 -#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L - -#define SN_setct_AuthRevResData "setct-AuthRevResData" -#define NID_setct_AuthRevResData 542 -#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L - -#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" -#define NID_setct_AuthRevResTBS 543 -#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L - -#define SN_setct_CapReqTBS "setct-CapReqTBS" -#define NID_setct_CapReqTBS 544 -#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L - -#define SN_setct_CapReqTBSX "setct-CapReqTBSX" -#define NID_setct_CapReqTBSX 545 -#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L - -#define SN_setct_CapResData "setct-CapResData" -#define NID_setct_CapResData 546 -#define OBJ_setct_CapResData OBJ_set_ctype,28L - -#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" -#define NID_setct_CapRevReqTBS 547 -#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L - -#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" -#define NID_setct_CapRevReqTBSX 548 -#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L - -#define SN_setct_CapRevResData "setct-CapRevResData" -#define NID_setct_CapRevResData 549 -#define OBJ_setct_CapRevResData OBJ_set_ctype,31L - -#define SN_setct_CredReqTBS "setct-CredReqTBS" -#define NID_setct_CredReqTBS 550 -#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L - -#define SN_setct_CredReqTBSX "setct-CredReqTBSX" -#define NID_setct_CredReqTBSX 551 -#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L - -#define SN_setct_CredResData "setct-CredResData" -#define NID_setct_CredResData 552 -#define OBJ_setct_CredResData OBJ_set_ctype,34L - -#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" -#define NID_setct_CredRevReqTBS 553 -#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L - -#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" -#define NID_setct_CredRevReqTBSX 554 -#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L - -#define SN_setct_CredRevResData "setct-CredRevResData" -#define NID_setct_CredRevResData 555 -#define OBJ_setct_CredRevResData OBJ_set_ctype,37L - -#define SN_setct_PCertReqData "setct-PCertReqData" -#define NID_setct_PCertReqData 556 -#define OBJ_setct_PCertReqData OBJ_set_ctype,38L - -#define SN_setct_PCertResTBS "setct-PCertResTBS" -#define NID_setct_PCertResTBS 557 -#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L - -#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" -#define NID_setct_BatchAdminReqData 558 -#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L - -#define SN_setct_BatchAdminResData "setct-BatchAdminResData" -#define NID_setct_BatchAdminResData 559 -#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L - -#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" -#define NID_setct_CardCInitResTBS 560 -#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L - -#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" -#define NID_setct_MeAqCInitResTBS 561 -#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L - -#define SN_setct_RegFormResTBS "setct-RegFormResTBS" -#define NID_setct_RegFormResTBS 562 -#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L - -#define SN_setct_CertReqData "setct-CertReqData" -#define NID_setct_CertReqData 563 -#define OBJ_setct_CertReqData OBJ_set_ctype,45L - -#define SN_setct_CertReqTBS "setct-CertReqTBS" -#define NID_setct_CertReqTBS 564 -#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L - -#define SN_setct_CertResData "setct-CertResData" -#define NID_setct_CertResData 565 -#define OBJ_setct_CertResData OBJ_set_ctype,47L - -#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" -#define NID_setct_CertInqReqTBS 566 -#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L - -#define SN_setct_ErrorTBS "setct-ErrorTBS" -#define NID_setct_ErrorTBS 567 -#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L - -#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" -#define NID_setct_PIDualSignedTBE 568 -#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L - -#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" -#define NID_setct_PIUnsignedTBE 569 -#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L - -#define SN_setct_AuthReqTBE "setct-AuthReqTBE" -#define NID_setct_AuthReqTBE 570 -#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L - -#define SN_setct_AuthResTBE "setct-AuthResTBE" -#define NID_setct_AuthResTBE 571 -#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L - -#define SN_setct_AuthResTBEX "setct-AuthResTBEX" -#define NID_setct_AuthResTBEX 572 -#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L - -#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" -#define NID_setct_AuthTokenTBE 573 -#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L - -#define SN_setct_CapTokenTBE "setct-CapTokenTBE" -#define NID_setct_CapTokenTBE 574 -#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L - -#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" -#define NID_setct_CapTokenTBEX 575 -#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L - -#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" -#define NID_setct_AcqCardCodeMsgTBE 576 -#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L - -#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" -#define NID_setct_AuthRevReqTBE 577 -#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L - -#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" -#define NID_setct_AuthRevResTBE 578 -#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L - -#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" -#define NID_setct_AuthRevResTBEB 579 -#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L - -#define SN_setct_CapReqTBE "setct-CapReqTBE" -#define NID_setct_CapReqTBE 580 -#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L - -#define SN_setct_CapReqTBEX "setct-CapReqTBEX" -#define NID_setct_CapReqTBEX 581 -#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L - -#define SN_setct_CapResTBE "setct-CapResTBE" -#define NID_setct_CapResTBE 582 -#define OBJ_setct_CapResTBE OBJ_set_ctype,64L - -#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" -#define NID_setct_CapRevReqTBE 583 -#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L - -#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" -#define NID_setct_CapRevReqTBEX 584 -#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L - -#define SN_setct_CapRevResTBE "setct-CapRevResTBE" -#define NID_setct_CapRevResTBE 585 -#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L - -#define SN_setct_CredReqTBE "setct-CredReqTBE" -#define NID_setct_CredReqTBE 586 -#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L - -#define SN_setct_CredReqTBEX "setct-CredReqTBEX" -#define NID_setct_CredReqTBEX 587 -#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L - -#define SN_setct_CredResTBE "setct-CredResTBE" -#define NID_setct_CredResTBE 588 -#define OBJ_setct_CredResTBE OBJ_set_ctype,70L - -#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" -#define NID_setct_CredRevReqTBE 589 -#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L - -#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" -#define NID_setct_CredRevReqTBEX 590 -#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L - -#define SN_setct_CredRevResTBE "setct-CredRevResTBE" -#define NID_setct_CredRevResTBE 591 -#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L - -#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" -#define NID_setct_BatchAdminReqTBE 592 -#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L - -#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" -#define NID_setct_BatchAdminResTBE 593 -#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L - -#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" -#define NID_setct_RegFormReqTBE 594 -#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L - -#define SN_setct_CertReqTBE "setct-CertReqTBE" -#define NID_setct_CertReqTBE 595 -#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L - -#define SN_setct_CertReqTBEX "setct-CertReqTBEX" -#define NID_setct_CertReqTBEX 596 -#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L - -#define SN_setct_CertResTBE "setct-CertResTBE" -#define NID_setct_CertResTBE 597 -#define OBJ_setct_CertResTBE OBJ_set_ctype,79L - -#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" -#define NID_setct_CRLNotificationTBS 598 -#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L - -#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" -#define NID_setct_CRLNotificationResTBS 599 -#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L - -#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" -#define NID_setct_BCIDistributionTBS 600 -#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L - -#define SN_setext_genCrypt "setext-genCrypt" -#define LN_setext_genCrypt "generic cryptogram" -#define NID_setext_genCrypt 601 -#define OBJ_setext_genCrypt OBJ_set_msgExt,1L - -#define SN_setext_miAuth "setext-miAuth" -#define LN_setext_miAuth "merchant initiated auth" -#define NID_setext_miAuth 602 -#define OBJ_setext_miAuth OBJ_set_msgExt,3L - -#define SN_setext_pinSecure "setext-pinSecure" -#define NID_setext_pinSecure 603 -#define OBJ_setext_pinSecure OBJ_set_msgExt,4L - -#define SN_setext_pinAny "setext-pinAny" -#define NID_setext_pinAny 604 -#define OBJ_setext_pinAny OBJ_set_msgExt,5L - -#define SN_setext_track2 "setext-track2" -#define NID_setext_track2 605 -#define OBJ_setext_track2 OBJ_set_msgExt,7L - -#define SN_setext_cv "setext-cv" -#define LN_setext_cv "additional verification" -#define NID_setext_cv 606 -#define OBJ_setext_cv OBJ_set_msgExt,8L - -#define SN_set_policy_root "set-policy-root" -#define NID_set_policy_root 607 -#define OBJ_set_policy_root OBJ_set_policy,0L - -#define SN_setCext_hashedRoot "setCext-hashedRoot" -#define NID_setCext_hashedRoot 608 -#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L - -#define SN_setCext_certType "setCext-certType" -#define NID_setCext_certType 609 -#define OBJ_setCext_certType OBJ_set_certExt,1L - -#define SN_setCext_merchData "setCext-merchData" -#define NID_setCext_merchData 610 -#define OBJ_setCext_merchData OBJ_set_certExt,2L - -#define SN_setCext_cCertRequired "setCext-cCertRequired" -#define NID_setCext_cCertRequired 611 -#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L - -#define SN_setCext_tunneling "setCext-tunneling" -#define NID_setCext_tunneling 612 -#define OBJ_setCext_tunneling OBJ_set_certExt,4L - -#define SN_setCext_setExt "setCext-setExt" -#define NID_setCext_setExt 613 -#define OBJ_setCext_setExt OBJ_set_certExt,5L - -#define SN_setCext_setQualf "setCext-setQualf" -#define NID_setCext_setQualf 614 -#define OBJ_setCext_setQualf OBJ_set_certExt,6L - -#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" -#define NID_setCext_PGWYcapabilities 615 -#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L - -#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" -#define NID_setCext_TokenIdentifier 616 -#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L - -#define SN_setCext_Track2Data "setCext-Track2Data" -#define NID_setCext_Track2Data 617 -#define OBJ_setCext_Track2Data OBJ_set_certExt,9L - -#define SN_setCext_TokenType "setCext-TokenType" -#define NID_setCext_TokenType 618 -#define OBJ_setCext_TokenType OBJ_set_certExt,10L - -#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" -#define NID_setCext_IssuerCapabilities 619 -#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L - -#define SN_setAttr_Cert "setAttr-Cert" -#define NID_setAttr_Cert 620 -#define OBJ_setAttr_Cert OBJ_set_attr,0L - -#define SN_setAttr_PGWYcap "setAttr-PGWYcap" -#define LN_setAttr_PGWYcap "payment gateway capabilities" -#define NID_setAttr_PGWYcap 621 -#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L - -#define SN_setAttr_TokenType "setAttr-TokenType" -#define NID_setAttr_TokenType 622 -#define OBJ_setAttr_TokenType OBJ_set_attr,2L - -#define SN_setAttr_IssCap "setAttr-IssCap" -#define LN_setAttr_IssCap "issuer capabilities" -#define NID_setAttr_IssCap 623 -#define OBJ_setAttr_IssCap OBJ_set_attr,3L - -#define SN_set_rootKeyThumb "set-rootKeyThumb" -#define NID_set_rootKeyThumb 624 -#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L - -#define SN_set_addPolicy "set-addPolicy" -#define NID_set_addPolicy 625 -#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L - -#define SN_setAttr_Token_EMV "setAttr-Token-EMV" -#define NID_setAttr_Token_EMV 626 -#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L - -#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" -#define NID_setAttr_Token_B0Prime 627 -#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L - -#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" -#define NID_setAttr_IssCap_CVM 628 -#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L - -#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" -#define NID_setAttr_IssCap_T2 629 -#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L - -#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" -#define NID_setAttr_IssCap_Sig 630 -#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L - -#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" -#define LN_setAttr_GenCryptgrm "generate cryptogram" -#define NID_setAttr_GenCryptgrm 631 -#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L - -#define SN_setAttr_T2Enc "setAttr-T2Enc" -#define LN_setAttr_T2Enc "encrypted track 2" -#define NID_setAttr_T2Enc 632 -#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L - -#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" -#define LN_setAttr_T2cleartxt "cleartext track 2" -#define NID_setAttr_T2cleartxt 633 -#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L - -#define SN_setAttr_TokICCsig "setAttr-TokICCsig" -#define LN_setAttr_TokICCsig "ICC or token signature" -#define NID_setAttr_TokICCsig 634 -#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L - -#define SN_setAttr_SecDevSig "setAttr-SecDevSig" -#define LN_setAttr_SecDevSig "secure device signature" -#define NID_setAttr_SecDevSig 635 -#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L - -#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" -#define NID_set_brand_IATA_ATA 636 -#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L - -#define SN_set_brand_Diners "set-brand-Diners" -#define NID_set_brand_Diners 637 -#define OBJ_set_brand_Diners OBJ_set_brand,30L - -#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" -#define NID_set_brand_AmericanExpress 638 -#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L - -#define SN_set_brand_JCB "set-brand-JCB" -#define NID_set_brand_JCB 639 -#define OBJ_set_brand_JCB OBJ_set_brand,35L - -#define SN_set_brand_Visa "set-brand-Visa" -#define NID_set_brand_Visa 640 -#define OBJ_set_brand_Visa OBJ_set_brand,4L - -#define SN_set_brand_MasterCard "set-brand-MasterCard" -#define NID_set_brand_MasterCard 641 -#define OBJ_set_brand_MasterCard OBJ_set_brand,5L - -#define SN_set_brand_Novus "set-brand-Novus" -#define NID_set_brand_Novus 642 -#define OBJ_set_brand_Novus OBJ_set_brand,6011L - -#define SN_des_cdmf "DES-CDMF" -#define LN_des_cdmf "des-cdmf" -#define NID_des_cdmf 643 -#define OBJ_des_cdmf OBJ_rsadsi,3L,10L - -#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" -#define NID_rsaOAEPEncryptionSET 644 -#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L - -#define SN_ipsec3 "Oakley-EC2N-3" -#define LN_ipsec3 "ipsec3" -#define NID_ipsec3 749 - -#define SN_ipsec4 "Oakley-EC2N-4" -#define LN_ipsec4 "ipsec4" -#define NID_ipsec4 750 - -#define SN_whirlpool "whirlpool" -#define NID_whirlpool 804 -#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L - -#define SN_cryptopro "cryptopro" -#define NID_cryptopro 805 -#define OBJ_cryptopro OBJ_member_body,643L,2L,2L - -#define SN_cryptocom "cryptocom" -#define NID_cryptocom 806 -#define OBJ_cryptocom OBJ_member_body,643L,2L,9L - -#define SN_id_tc26 "id-tc26" -#define NID_id_tc26 974 -#define OBJ_id_tc26 OBJ_member_body,643L,7L,1L - -#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" -#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" -#define NID_id_GostR3411_94_with_GostR3410_2001 807 -#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L - -#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" -#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" -#define NID_id_GostR3411_94_with_GostR3410_94 808 -#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L - -#define SN_id_GostR3411_94 "md_gost94" -#define LN_id_GostR3411_94 "GOST R 34.11-94" -#define NID_id_GostR3411_94 809 -#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L - -#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" -#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" -#define NID_id_HMACGostR3411_94 810 -#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L - -#define SN_id_GostR3410_2001 "gost2001" -#define LN_id_GostR3410_2001 "GOST R 34.10-2001" -#define NID_id_GostR3410_2001 811 -#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L - -#define SN_id_GostR3410_94 "gost94" -#define LN_id_GostR3410_94 "GOST R 34.10-94" -#define NID_id_GostR3410_94 812 -#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L - -#define SN_id_Gost28147_89 "gost89" -#define LN_id_Gost28147_89 "GOST 28147-89" -#define NID_id_Gost28147_89 813 -#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L - -#define SN_gost89_cnt "gost89-cnt" -#define NID_gost89_cnt 814 - -#define SN_gost89_cnt_12 "gost89-cnt-12" -#define NID_gost89_cnt_12 975 - -#define SN_gost89_cbc "gost89-cbc" -#define NID_gost89_cbc 1009 - -#define SN_gost89_ecb "gost89-ecb" -#define NID_gost89_ecb 1010 - -#define SN_gost89_ctr "gost89-ctr" -#define NID_gost89_ctr 1011 - -#define SN_id_Gost28147_89_MAC "gost-mac" -#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" -#define NID_id_Gost28147_89_MAC 815 -#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L - -#define SN_gost_mac_12 "gost-mac-12" -#define NID_gost_mac_12 976 - -#define SN_id_GostR3411_94_prf "prf-gostr3411-94" -#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" -#define NID_id_GostR3411_94_prf 816 -#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L - -#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" -#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" -#define NID_id_GostR3410_2001DH 817 -#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L - -#define SN_id_GostR3410_94DH "id-GostR3410-94DH" -#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" -#define NID_id_GostR3410_94DH 818 -#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L - -#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" -#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 -#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L - -#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" -#define NID_id_Gost28147_89_None_KeyMeshing 820 -#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L - -#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" -#define NID_id_GostR3411_94_TestParamSet 821 -#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L - -#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" -#define NID_id_GostR3411_94_CryptoProParamSet 822 -#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L - -#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" -#define NID_id_Gost28147_89_TestParamSet 823 -#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L - -#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 -#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L - -#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 -#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L - -#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 -#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L - -#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 -#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L - -#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 -#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L - -#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 -#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L - -#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" -#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 -#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L - -#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" -#define NID_id_GostR3410_94_TestParamSet 831 -#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L - -#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 -#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L - -#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 -#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L - -#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 -#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L - -#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 -#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L - -#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 -#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L - -#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 -#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L - -#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" -#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 -#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L - -#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" -#define NID_id_GostR3410_2001_TestParamSet 839 -#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L - -#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 -#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L - -#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 -#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L - -#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 -#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L - -#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 -#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L - -#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" -#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 -#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L - -#define SN_id_GostR3410_94_a "id-GostR3410-94-a" -#define NID_id_GostR3410_94_a 845 -#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L - -#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" -#define NID_id_GostR3410_94_aBis 846 -#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L - -#define SN_id_GostR3410_94_b "id-GostR3410-94-b" -#define NID_id_GostR3410_94_b 847 -#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L - -#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" -#define NID_id_GostR3410_94_bBis 848 -#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L - -#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" -#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" -#define NID_id_Gost28147_89_cc 849 -#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L - -#define SN_id_GostR3410_94_cc "gost94cc" -#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" -#define NID_id_GostR3410_94_cc 850 -#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L - -#define SN_id_GostR3410_2001_cc "gost2001cc" -#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" -#define NID_id_GostR3410_2001_cc 851 -#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L - -#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" -#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" -#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 -#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L - -#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" -#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" -#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 -#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L - -#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" -#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" -#define NID_id_GostR3410_2001_ParamSet_cc 854 -#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L - -#define SN_id_tc26_algorithms "id-tc26-algorithms" -#define NID_id_tc26_algorithms 977 -#define OBJ_id_tc26_algorithms OBJ_id_tc26,1L - -#define SN_id_tc26_sign "id-tc26-sign" -#define NID_id_tc26_sign 978 -#define OBJ_id_tc26_sign OBJ_id_tc26_algorithms,1L - -#define SN_id_GostR3410_2012_256 "gost2012_256" -#define LN_id_GostR3410_2012_256 "GOST R 34.10-2012 with 256 bit modulus" -#define NID_id_GostR3410_2012_256 979 -#define OBJ_id_GostR3410_2012_256 OBJ_id_tc26_sign,1L - -#define SN_id_GostR3410_2012_512 "gost2012_512" -#define LN_id_GostR3410_2012_512 "GOST R 34.10-2012 with 512 bit modulus" -#define NID_id_GostR3410_2012_512 980 -#define OBJ_id_GostR3410_2012_512 OBJ_id_tc26_sign,2L - -#define SN_id_tc26_digest "id-tc26-digest" -#define NID_id_tc26_digest 981 -#define OBJ_id_tc26_digest OBJ_id_tc26_algorithms,2L - -#define SN_id_GostR3411_2012_256 "md_gost12_256" -#define LN_id_GostR3411_2012_256 "GOST R 34.11-2012 with 256 bit hash" -#define NID_id_GostR3411_2012_256 982 -#define OBJ_id_GostR3411_2012_256 OBJ_id_tc26_digest,2L - -#define SN_id_GostR3411_2012_512 "md_gost12_512" -#define LN_id_GostR3411_2012_512 "GOST R 34.11-2012 with 512 bit hash" -#define NID_id_GostR3411_2012_512 983 -#define OBJ_id_GostR3411_2012_512 OBJ_id_tc26_digest,3L - -#define SN_id_tc26_signwithdigest "id-tc26-signwithdigest" -#define NID_id_tc26_signwithdigest 984 -#define OBJ_id_tc26_signwithdigest OBJ_id_tc26_algorithms,3L - -#define SN_id_tc26_signwithdigest_gost3410_2012_256 "id-tc26-signwithdigest-gost3410-2012-256" -#define LN_id_tc26_signwithdigest_gost3410_2012_256 "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" -#define NID_id_tc26_signwithdigest_gost3410_2012_256 985 -#define OBJ_id_tc26_signwithdigest_gost3410_2012_256 OBJ_id_tc26_signwithdigest,2L - -#define SN_id_tc26_signwithdigest_gost3410_2012_512 "id-tc26-signwithdigest-gost3410-2012-512" -#define LN_id_tc26_signwithdigest_gost3410_2012_512 "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" -#define NID_id_tc26_signwithdigest_gost3410_2012_512 986 -#define OBJ_id_tc26_signwithdigest_gost3410_2012_512 OBJ_id_tc26_signwithdigest,3L - -#define SN_id_tc26_mac "id-tc26-mac" -#define NID_id_tc26_mac 987 -#define OBJ_id_tc26_mac OBJ_id_tc26_algorithms,4L - -#define SN_id_tc26_hmac_gost_3411_2012_256 "id-tc26-hmac-gost-3411-2012-256" -#define LN_id_tc26_hmac_gost_3411_2012_256 "HMAC GOST 34.11-2012 256 bit" -#define NID_id_tc26_hmac_gost_3411_2012_256 988 -#define OBJ_id_tc26_hmac_gost_3411_2012_256 OBJ_id_tc26_mac,1L - -#define SN_id_tc26_hmac_gost_3411_2012_512 "id-tc26-hmac-gost-3411-2012-512" -#define LN_id_tc26_hmac_gost_3411_2012_512 "HMAC GOST 34.11-2012 512 bit" -#define NID_id_tc26_hmac_gost_3411_2012_512 989 -#define OBJ_id_tc26_hmac_gost_3411_2012_512 OBJ_id_tc26_mac,2L - -#define SN_id_tc26_cipher "id-tc26-cipher" -#define NID_id_tc26_cipher 990 -#define OBJ_id_tc26_cipher OBJ_id_tc26_algorithms,5L - -#define SN_id_tc26_cipher_gostr3412_2015_magma "id-tc26-cipher-gostr3412-2015-magma" -#define NID_id_tc26_cipher_gostr3412_2015_magma 1173 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma OBJ_id_tc26_cipher,1L - -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm "id-tc26-cipher-gostr3412-2015-magma-ctracpkm" -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm 1174 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_magma,1L - -#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-magma-ctracpkm-omac" -#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac 1175 -#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_magma,2L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik "id-tc26-cipher-gostr3412-2015-kuznyechik" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik 1176 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik OBJ_id_tc26_cipher,2L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm 1177 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,1L - -#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm-omac" -#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac 1178 -#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,2L - -#define SN_id_tc26_agreement "id-tc26-agreement" -#define NID_id_tc26_agreement 991 -#define OBJ_id_tc26_agreement OBJ_id_tc26_algorithms,6L - -#define SN_id_tc26_agreement_gost_3410_2012_256 "id-tc26-agreement-gost-3410-2012-256" -#define NID_id_tc26_agreement_gost_3410_2012_256 992 -#define OBJ_id_tc26_agreement_gost_3410_2012_256 OBJ_id_tc26_agreement,1L - -#define SN_id_tc26_agreement_gost_3410_2012_512 "id-tc26-agreement-gost-3410-2012-512" -#define NID_id_tc26_agreement_gost_3410_2012_512 993 -#define OBJ_id_tc26_agreement_gost_3410_2012_512 OBJ_id_tc26_agreement,2L - -#define SN_id_tc26_wrap "id-tc26-wrap" -#define NID_id_tc26_wrap 1179 -#define OBJ_id_tc26_wrap OBJ_id_tc26_algorithms,7L - -#define SN_id_tc26_wrap_gostr3412_2015_magma "id-tc26-wrap-gostr3412-2015-magma" -#define NID_id_tc26_wrap_gostr3412_2015_magma 1180 -#define OBJ_id_tc26_wrap_gostr3412_2015_magma OBJ_id_tc26_wrap,1L - -#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 "id-tc26-wrap-gostr3412-2015-magma-kexp15" -#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 1181 -#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_magma,1L - -#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik "id-tc26-wrap-gostr3412-2015-kuznyechik" -#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik 1182 -#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik OBJ_id_tc26_wrap,2L - -#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 "id-tc26-wrap-gostr3412-2015-kuznyechik-kexp15" -#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 1183 -#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik,1L - -#define SN_id_tc26_constants "id-tc26-constants" -#define NID_id_tc26_constants 994 -#define OBJ_id_tc26_constants OBJ_id_tc26,2L - -#define SN_id_tc26_sign_constants "id-tc26-sign-constants" -#define NID_id_tc26_sign_constants 995 -#define OBJ_id_tc26_sign_constants OBJ_id_tc26_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_constants "id-tc26-gost-3410-2012-256-constants" -#define NID_id_tc26_gost_3410_2012_256_constants 1147 -#define OBJ_id_tc26_gost_3410_2012_256_constants OBJ_id_tc26_sign_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_paramSetA "id-tc26-gost-3410-2012-256-paramSetA" -#define LN_id_tc26_gost_3410_2012_256_paramSetA "GOST R 34.10-2012 (256 bit) ParamSet A" -#define NID_id_tc26_gost_3410_2012_256_paramSetA 1148 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetA OBJ_id_tc26_gost_3410_2012_256_constants,1L - -#define SN_id_tc26_gost_3410_2012_256_paramSetB "id-tc26-gost-3410-2012-256-paramSetB" -#define LN_id_tc26_gost_3410_2012_256_paramSetB "GOST R 34.10-2012 (256 bit) ParamSet B" -#define NID_id_tc26_gost_3410_2012_256_paramSetB 1184 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetB OBJ_id_tc26_gost_3410_2012_256_constants,2L - -#define SN_id_tc26_gost_3410_2012_256_paramSetC "id-tc26-gost-3410-2012-256-paramSetC" -#define LN_id_tc26_gost_3410_2012_256_paramSetC "GOST R 34.10-2012 (256 bit) ParamSet C" -#define NID_id_tc26_gost_3410_2012_256_paramSetC 1185 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetC OBJ_id_tc26_gost_3410_2012_256_constants,3L - -#define SN_id_tc26_gost_3410_2012_256_paramSetD "id-tc26-gost-3410-2012-256-paramSetD" -#define LN_id_tc26_gost_3410_2012_256_paramSetD "GOST R 34.10-2012 (256 bit) ParamSet D" -#define NID_id_tc26_gost_3410_2012_256_paramSetD 1186 -#define OBJ_id_tc26_gost_3410_2012_256_paramSetD OBJ_id_tc26_gost_3410_2012_256_constants,4L - -#define SN_id_tc26_gost_3410_2012_512_constants "id-tc26-gost-3410-2012-512-constants" -#define NID_id_tc26_gost_3410_2012_512_constants 996 -#define OBJ_id_tc26_gost_3410_2012_512_constants OBJ_id_tc26_sign_constants,2L - -#define SN_id_tc26_gost_3410_2012_512_paramSetTest "id-tc26-gost-3410-2012-512-paramSetTest" -#define LN_id_tc26_gost_3410_2012_512_paramSetTest "GOST R 34.10-2012 (512 bit) testing parameter set" -#define NID_id_tc26_gost_3410_2012_512_paramSetTest 997 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetTest OBJ_id_tc26_gost_3410_2012_512_constants,0L - -#define SN_id_tc26_gost_3410_2012_512_paramSetA "id-tc26-gost-3410-2012-512-paramSetA" -#define LN_id_tc26_gost_3410_2012_512_paramSetA "GOST R 34.10-2012 (512 bit) ParamSet A" -#define NID_id_tc26_gost_3410_2012_512_paramSetA 998 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetA OBJ_id_tc26_gost_3410_2012_512_constants,1L - -#define SN_id_tc26_gost_3410_2012_512_paramSetB "id-tc26-gost-3410-2012-512-paramSetB" -#define LN_id_tc26_gost_3410_2012_512_paramSetB "GOST R 34.10-2012 (512 bit) ParamSet B" -#define NID_id_tc26_gost_3410_2012_512_paramSetB 999 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetB OBJ_id_tc26_gost_3410_2012_512_constants,2L - -#define SN_id_tc26_gost_3410_2012_512_paramSetC "id-tc26-gost-3410-2012-512-paramSetC" -#define LN_id_tc26_gost_3410_2012_512_paramSetC "GOST R 34.10-2012 (512 bit) ParamSet C" -#define NID_id_tc26_gost_3410_2012_512_paramSetC 1149 -#define OBJ_id_tc26_gost_3410_2012_512_paramSetC OBJ_id_tc26_gost_3410_2012_512_constants,3L - -#define SN_id_tc26_digest_constants "id-tc26-digest-constants" -#define NID_id_tc26_digest_constants 1000 -#define OBJ_id_tc26_digest_constants OBJ_id_tc26_constants,2L - -#define SN_id_tc26_cipher_constants "id-tc26-cipher-constants" -#define NID_id_tc26_cipher_constants 1001 -#define OBJ_id_tc26_cipher_constants OBJ_id_tc26_constants,5L - -#define SN_id_tc26_gost_28147_constants "id-tc26-gost-28147-constants" -#define NID_id_tc26_gost_28147_constants 1002 -#define OBJ_id_tc26_gost_28147_constants OBJ_id_tc26_cipher_constants,1L - -#define SN_id_tc26_gost_28147_param_Z "id-tc26-gost-28147-param-Z" -#define LN_id_tc26_gost_28147_param_Z "GOST 28147-89 TC26 parameter set" -#define NID_id_tc26_gost_28147_param_Z 1003 -#define OBJ_id_tc26_gost_28147_param_Z OBJ_id_tc26_gost_28147_constants,1L - -#define SN_INN "INN" -#define LN_INN "INN" -#define NID_INN 1004 -#define OBJ_INN OBJ_member_body,643L,3L,131L,1L,1L - -#define SN_OGRN "OGRN" -#define LN_OGRN "OGRN" -#define NID_OGRN 1005 -#define OBJ_OGRN OBJ_member_body,643L,100L,1L - -#define SN_SNILS "SNILS" -#define LN_SNILS "SNILS" -#define NID_SNILS 1006 -#define OBJ_SNILS OBJ_member_body,643L,100L,3L - -#define SN_subjectSignTool "subjectSignTool" -#define LN_subjectSignTool "Signing Tool of Subject" -#define NID_subjectSignTool 1007 -#define OBJ_subjectSignTool OBJ_member_body,643L,100L,111L - -#define SN_issuerSignTool "issuerSignTool" -#define LN_issuerSignTool "Signing Tool of Issuer" -#define NID_issuerSignTool 1008 -#define OBJ_issuerSignTool OBJ_member_body,643L,100L,112L - -#define SN_grasshopper_ecb "grasshopper-ecb" -#define NID_grasshopper_ecb 1012 - -#define SN_grasshopper_ctr "grasshopper-ctr" -#define NID_grasshopper_ctr 1013 - -#define SN_grasshopper_ofb "grasshopper-ofb" -#define NID_grasshopper_ofb 1014 - -#define SN_grasshopper_cbc "grasshopper-cbc" -#define NID_grasshopper_cbc 1015 - -#define SN_grasshopper_cfb "grasshopper-cfb" -#define NID_grasshopper_cfb 1016 - -#define SN_grasshopper_mac "grasshopper-mac" -#define NID_grasshopper_mac 1017 - -#define SN_magma_ecb "magma-ecb" -#define NID_magma_ecb 1187 - -#define SN_magma_ctr "magma-ctr" -#define NID_magma_ctr 1188 - -#define SN_magma_ofb "magma-ofb" -#define NID_magma_ofb 1189 - -#define SN_magma_cbc "magma-cbc" -#define NID_magma_cbc 1190 - -#define SN_magma_cfb "magma-cfb" -#define NID_magma_cfb 1191 - -#define SN_magma_mac "magma-mac" -#define NID_magma_mac 1192 - -#define SN_camellia_128_cbc "CAMELLIA-128-CBC" -#define LN_camellia_128_cbc "camellia-128-cbc" -#define NID_camellia_128_cbc 751 -#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L - -#define SN_camellia_192_cbc "CAMELLIA-192-CBC" -#define LN_camellia_192_cbc "camellia-192-cbc" -#define NID_camellia_192_cbc 752 -#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L - -#define SN_camellia_256_cbc "CAMELLIA-256-CBC" -#define LN_camellia_256_cbc "camellia-256-cbc" -#define NID_camellia_256_cbc 753 -#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L - -#define SN_id_camellia128_wrap "id-camellia128-wrap" -#define NID_id_camellia128_wrap 907 -#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L - -#define SN_id_camellia192_wrap "id-camellia192-wrap" -#define NID_id_camellia192_wrap 908 -#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L - -#define SN_id_camellia256_wrap "id-camellia256-wrap" -#define NID_id_camellia256_wrap 909 -#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L - -#define OBJ_ntt_ds 0L,3L,4401L,5L - -#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L - -#define SN_camellia_128_ecb "CAMELLIA-128-ECB" -#define LN_camellia_128_ecb "camellia-128-ecb" -#define NID_camellia_128_ecb 754 -#define OBJ_camellia_128_ecb OBJ_camellia,1L - -#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" -#define LN_camellia_128_ofb128 "camellia-128-ofb" -#define NID_camellia_128_ofb128 766 -#define OBJ_camellia_128_ofb128 OBJ_camellia,3L - -#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" -#define LN_camellia_128_cfb128 "camellia-128-cfb" -#define NID_camellia_128_cfb128 757 -#define OBJ_camellia_128_cfb128 OBJ_camellia,4L - -#define SN_camellia_128_gcm "CAMELLIA-128-GCM" -#define LN_camellia_128_gcm "camellia-128-gcm" -#define NID_camellia_128_gcm 961 -#define OBJ_camellia_128_gcm OBJ_camellia,6L - -#define SN_camellia_128_ccm "CAMELLIA-128-CCM" -#define LN_camellia_128_ccm "camellia-128-ccm" -#define NID_camellia_128_ccm 962 -#define OBJ_camellia_128_ccm OBJ_camellia,7L - -#define SN_camellia_128_ctr "CAMELLIA-128-CTR" -#define LN_camellia_128_ctr "camellia-128-ctr" -#define NID_camellia_128_ctr 963 -#define OBJ_camellia_128_ctr OBJ_camellia,9L - -#define SN_camellia_128_cmac "CAMELLIA-128-CMAC" -#define LN_camellia_128_cmac "camellia-128-cmac" -#define NID_camellia_128_cmac 964 -#define OBJ_camellia_128_cmac OBJ_camellia,10L - -#define SN_camellia_192_ecb "CAMELLIA-192-ECB" -#define LN_camellia_192_ecb "camellia-192-ecb" -#define NID_camellia_192_ecb 755 -#define OBJ_camellia_192_ecb OBJ_camellia,21L - -#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" -#define LN_camellia_192_ofb128 "camellia-192-ofb" -#define NID_camellia_192_ofb128 767 -#define OBJ_camellia_192_ofb128 OBJ_camellia,23L - -#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" -#define LN_camellia_192_cfb128 "camellia-192-cfb" -#define NID_camellia_192_cfb128 758 -#define OBJ_camellia_192_cfb128 OBJ_camellia,24L - -#define SN_camellia_192_gcm "CAMELLIA-192-GCM" -#define LN_camellia_192_gcm "camellia-192-gcm" -#define NID_camellia_192_gcm 965 -#define OBJ_camellia_192_gcm OBJ_camellia,26L - -#define SN_camellia_192_ccm "CAMELLIA-192-CCM" -#define LN_camellia_192_ccm "camellia-192-ccm" -#define NID_camellia_192_ccm 966 -#define OBJ_camellia_192_ccm OBJ_camellia,27L - -#define SN_camellia_192_ctr "CAMELLIA-192-CTR" -#define LN_camellia_192_ctr "camellia-192-ctr" -#define NID_camellia_192_ctr 967 -#define OBJ_camellia_192_ctr OBJ_camellia,29L - -#define SN_camellia_192_cmac "CAMELLIA-192-CMAC" -#define LN_camellia_192_cmac "camellia-192-cmac" -#define NID_camellia_192_cmac 968 -#define OBJ_camellia_192_cmac OBJ_camellia,30L - -#define SN_camellia_256_ecb "CAMELLIA-256-ECB" -#define LN_camellia_256_ecb "camellia-256-ecb" -#define NID_camellia_256_ecb 756 -#define OBJ_camellia_256_ecb OBJ_camellia,41L - -#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" -#define LN_camellia_256_ofb128 "camellia-256-ofb" -#define NID_camellia_256_ofb128 768 -#define OBJ_camellia_256_ofb128 OBJ_camellia,43L - -#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" -#define LN_camellia_256_cfb128 "camellia-256-cfb" -#define NID_camellia_256_cfb128 759 -#define OBJ_camellia_256_cfb128 OBJ_camellia,44L - -#define SN_camellia_256_gcm "CAMELLIA-256-GCM" -#define LN_camellia_256_gcm "camellia-256-gcm" -#define NID_camellia_256_gcm 969 -#define OBJ_camellia_256_gcm OBJ_camellia,46L - -#define SN_camellia_256_ccm "CAMELLIA-256-CCM" -#define LN_camellia_256_ccm "camellia-256-ccm" -#define NID_camellia_256_ccm 970 -#define OBJ_camellia_256_ccm OBJ_camellia,47L - -#define SN_camellia_256_ctr "CAMELLIA-256-CTR" -#define LN_camellia_256_ctr "camellia-256-ctr" -#define NID_camellia_256_ctr 971 -#define OBJ_camellia_256_ctr OBJ_camellia,49L - -#define SN_camellia_256_cmac "CAMELLIA-256-CMAC" -#define LN_camellia_256_cmac "camellia-256-cmac" -#define NID_camellia_256_cmac 972 -#define OBJ_camellia_256_cmac OBJ_camellia,50L - -#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" -#define LN_camellia_128_cfb1 "camellia-128-cfb1" -#define NID_camellia_128_cfb1 760 - -#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" -#define LN_camellia_192_cfb1 "camellia-192-cfb1" -#define NID_camellia_192_cfb1 761 - -#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" -#define LN_camellia_256_cfb1 "camellia-256-cfb1" -#define NID_camellia_256_cfb1 762 - -#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" -#define LN_camellia_128_cfb8 "camellia-128-cfb8" -#define NID_camellia_128_cfb8 763 - -#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" -#define LN_camellia_192_cfb8 "camellia-192-cfb8" -#define NID_camellia_192_cfb8 764 - -#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" -#define LN_camellia_256_cfb8 "camellia-256-cfb8" -#define NID_camellia_256_cfb8 765 - -#define OBJ_aria 1L,2L,410L,200046L,1L,1L - -#define SN_aria_128_ecb "ARIA-128-ECB" -#define LN_aria_128_ecb "aria-128-ecb" -#define NID_aria_128_ecb 1065 -#define OBJ_aria_128_ecb OBJ_aria,1L - -#define SN_aria_128_cbc "ARIA-128-CBC" -#define LN_aria_128_cbc "aria-128-cbc" -#define NID_aria_128_cbc 1066 -#define OBJ_aria_128_cbc OBJ_aria,2L - -#define SN_aria_128_cfb128 "ARIA-128-CFB" -#define LN_aria_128_cfb128 "aria-128-cfb" -#define NID_aria_128_cfb128 1067 -#define OBJ_aria_128_cfb128 OBJ_aria,3L - -#define SN_aria_128_ofb128 "ARIA-128-OFB" -#define LN_aria_128_ofb128 "aria-128-ofb" -#define NID_aria_128_ofb128 1068 -#define OBJ_aria_128_ofb128 OBJ_aria,4L - -#define SN_aria_128_ctr "ARIA-128-CTR" -#define LN_aria_128_ctr "aria-128-ctr" -#define NID_aria_128_ctr 1069 -#define OBJ_aria_128_ctr OBJ_aria,5L - -#define SN_aria_192_ecb "ARIA-192-ECB" -#define LN_aria_192_ecb "aria-192-ecb" -#define NID_aria_192_ecb 1070 -#define OBJ_aria_192_ecb OBJ_aria,6L - -#define SN_aria_192_cbc "ARIA-192-CBC" -#define LN_aria_192_cbc "aria-192-cbc" -#define NID_aria_192_cbc 1071 -#define OBJ_aria_192_cbc OBJ_aria,7L - -#define SN_aria_192_cfb128 "ARIA-192-CFB" -#define LN_aria_192_cfb128 "aria-192-cfb" -#define NID_aria_192_cfb128 1072 -#define OBJ_aria_192_cfb128 OBJ_aria,8L - -#define SN_aria_192_ofb128 "ARIA-192-OFB" -#define LN_aria_192_ofb128 "aria-192-ofb" -#define NID_aria_192_ofb128 1073 -#define OBJ_aria_192_ofb128 OBJ_aria,9L - -#define SN_aria_192_ctr "ARIA-192-CTR" -#define LN_aria_192_ctr "aria-192-ctr" -#define NID_aria_192_ctr 1074 -#define OBJ_aria_192_ctr OBJ_aria,10L - -#define SN_aria_256_ecb "ARIA-256-ECB" -#define LN_aria_256_ecb "aria-256-ecb" -#define NID_aria_256_ecb 1075 -#define OBJ_aria_256_ecb OBJ_aria,11L - -#define SN_aria_256_cbc "ARIA-256-CBC" -#define LN_aria_256_cbc "aria-256-cbc" -#define NID_aria_256_cbc 1076 -#define OBJ_aria_256_cbc OBJ_aria,12L - -#define SN_aria_256_cfb128 "ARIA-256-CFB" -#define LN_aria_256_cfb128 "aria-256-cfb" -#define NID_aria_256_cfb128 1077 -#define OBJ_aria_256_cfb128 OBJ_aria,13L - -#define SN_aria_256_ofb128 "ARIA-256-OFB" -#define LN_aria_256_ofb128 "aria-256-ofb" -#define NID_aria_256_ofb128 1078 -#define OBJ_aria_256_ofb128 OBJ_aria,14L - -#define SN_aria_256_ctr "ARIA-256-CTR" -#define LN_aria_256_ctr "aria-256-ctr" -#define NID_aria_256_ctr 1079 -#define OBJ_aria_256_ctr OBJ_aria,15L - -#define SN_aria_128_cfb1 "ARIA-128-CFB1" -#define LN_aria_128_cfb1 "aria-128-cfb1" -#define NID_aria_128_cfb1 1080 - -#define SN_aria_192_cfb1 "ARIA-192-CFB1" -#define LN_aria_192_cfb1 "aria-192-cfb1" -#define NID_aria_192_cfb1 1081 - -#define SN_aria_256_cfb1 "ARIA-256-CFB1" -#define LN_aria_256_cfb1 "aria-256-cfb1" -#define NID_aria_256_cfb1 1082 - -#define SN_aria_128_cfb8 "ARIA-128-CFB8" -#define LN_aria_128_cfb8 "aria-128-cfb8" -#define NID_aria_128_cfb8 1083 - -#define SN_aria_192_cfb8 "ARIA-192-CFB8" -#define LN_aria_192_cfb8 "aria-192-cfb8" -#define NID_aria_192_cfb8 1084 - -#define SN_aria_256_cfb8 "ARIA-256-CFB8" -#define LN_aria_256_cfb8 "aria-256-cfb8" -#define NID_aria_256_cfb8 1085 - -#define SN_aria_128_ccm "ARIA-128-CCM" -#define LN_aria_128_ccm "aria-128-ccm" -#define NID_aria_128_ccm 1120 -#define OBJ_aria_128_ccm OBJ_aria,37L - -#define SN_aria_192_ccm "ARIA-192-CCM" -#define LN_aria_192_ccm "aria-192-ccm" -#define NID_aria_192_ccm 1121 -#define OBJ_aria_192_ccm OBJ_aria,38L - -#define SN_aria_256_ccm "ARIA-256-CCM" -#define LN_aria_256_ccm "aria-256-ccm" -#define NID_aria_256_ccm 1122 -#define OBJ_aria_256_ccm OBJ_aria,39L - -#define SN_aria_128_gcm "ARIA-128-GCM" -#define LN_aria_128_gcm "aria-128-gcm" -#define NID_aria_128_gcm 1123 -#define OBJ_aria_128_gcm OBJ_aria,34L - -#define SN_aria_192_gcm "ARIA-192-GCM" -#define LN_aria_192_gcm "aria-192-gcm" -#define NID_aria_192_gcm 1124 -#define OBJ_aria_192_gcm OBJ_aria,35L - -#define SN_aria_256_gcm "ARIA-256-GCM" -#define LN_aria_256_gcm "aria-256-gcm" -#define NID_aria_256_gcm 1125 -#define OBJ_aria_256_gcm OBJ_aria,36L - -#define SN_kisa "KISA" -#define LN_kisa "kisa" -#define NID_kisa 773 -#define OBJ_kisa OBJ_member_body,410L,200004L - -#define SN_seed_ecb "SEED-ECB" -#define LN_seed_ecb "seed-ecb" -#define NID_seed_ecb 776 -#define OBJ_seed_ecb OBJ_kisa,1L,3L - -#define SN_seed_cbc "SEED-CBC" -#define LN_seed_cbc "seed-cbc" -#define NID_seed_cbc 777 -#define OBJ_seed_cbc OBJ_kisa,1L,4L - -#define SN_seed_cfb128 "SEED-CFB" -#define LN_seed_cfb128 "seed-cfb" -#define NID_seed_cfb128 779 -#define OBJ_seed_cfb128 OBJ_kisa,1L,5L - -#define SN_seed_ofb128 "SEED-OFB" -#define LN_seed_ofb128 "seed-ofb" -#define NID_seed_ofb128 778 -#define OBJ_seed_ofb128 OBJ_kisa,1L,6L - -#define SN_sm4_ecb "SM4-ECB" -#define LN_sm4_ecb "sm4-ecb" -#define NID_sm4_ecb 1133 -#define OBJ_sm4_ecb OBJ_sm_scheme,104L,1L - -#define SN_sm4_cbc "SM4-CBC" -#define LN_sm4_cbc "sm4-cbc" -#define NID_sm4_cbc 1134 -#define OBJ_sm4_cbc OBJ_sm_scheme,104L,2L - -#define SN_sm4_ofb128 "SM4-OFB" -#define LN_sm4_ofb128 "sm4-ofb" -#define NID_sm4_ofb128 1135 -#define OBJ_sm4_ofb128 OBJ_sm_scheme,104L,3L - -#define SN_sm4_cfb128 "SM4-CFB" -#define LN_sm4_cfb128 "sm4-cfb" -#define NID_sm4_cfb128 1137 -#define OBJ_sm4_cfb128 OBJ_sm_scheme,104L,4L - -#define SN_sm4_cfb1 "SM4-CFB1" -#define LN_sm4_cfb1 "sm4-cfb1" -#define NID_sm4_cfb1 1136 -#define OBJ_sm4_cfb1 OBJ_sm_scheme,104L,5L - -#define SN_sm4_cfb8 "SM4-CFB8" -#define LN_sm4_cfb8 "sm4-cfb8" -#define NID_sm4_cfb8 1138 -#define OBJ_sm4_cfb8 OBJ_sm_scheme,104L,6L - -#define SN_sm4_ctr "SM4-CTR" -#define LN_sm4_ctr "sm4-ctr" -#define NID_sm4_ctr 1139 -#define OBJ_sm4_ctr OBJ_sm_scheme,104L,7L - -#define SN_hmac "HMAC" -#define LN_hmac "hmac" -#define NID_hmac 855 - -#define SN_cmac "CMAC" -#define LN_cmac "cmac" -#define NID_cmac 894 - -#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" -#define LN_rc4_hmac_md5 "rc4-hmac-md5" -#define NID_rc4_hmac_md5 915 - -#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" -#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" -#define NID_aes_128_cbc_hmac_sha1 916 - -#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" -#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" -#define NID_aes_192_cbc_hmac_sha1 917 - -#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" -#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" -#define NID_aes_256_cbc_hmac_sha1 918 - -#define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" -#define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" -#define NID_aes_128_cbc_hmac_sha256 948 - -#define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" -#define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" -#define NID_aes_192_cbc_hmac_sha256 949 - -#define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" -#define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" -#define NID_aes_256_cbc_hmac_sha256 950 - -#define SN_chacha20_poly1305 "ChaCha20-Poly1305" -#define LN_chacha20_poly1305 "chacha20-poly1305" -#define NID_chacha20_poly1305 1018 - -#define SN_chacha20 "ChaCha20" -#define LN_chacha20 "chacha20" -#define NID_chacha20 1019 - -#define SN_dhpublicnumber "dhpublicnumber" -#define LN_dhpublicnumber "X9.42 DH" -#define NID_dhpublicnumber 920 -#define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L - -#define SN_brainpoolP160r1 "brainpoolP160r1" -#define NID_brainpoolP160r1 921 -#define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L - -#define SN_brainpoolP160t1 "brainpoolP160t1" -#define NID_brainpoolP160t1 922 -#define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L - -#define SN_brainpoolP192r1 "brainpoolP192r1" -#define NID_brainpoolP192r1 923 -#define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L - -#define SN_brainpoolP192t1 "brainpoolP192t1" -#define NID_brainpoolP192t1 924 -#define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L - -#define SN_brainpoolP224r1 "brainpoolP224r1" -#define NID_brainpoolP224r1 925 -#define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L - -#define SN_brainpoolP224t1 "brainpoolP224t1" -#define NID_brainpoolP224t1 926 -#define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L - -#define SN_brainpoolP256r1 "brainpoolP256r1" -#define NID_brainpoolP256r1 927 -#define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L - -#define SN_brainpoolP256t1 "brainpoolP256t1" -#define NID_brainpoolP256t1 928 -#define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L - -#define SN_brainpoolP320r1 "brainpoolP320r1" -#define NID_brainpoolP320r1 929 -#define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L - -#define SN_brainpoolP320t1 "brainpoolP320t1" -#define NID_brainpoolP320t1 930 -#define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L - -#define SN_brainpoolP384r1 "brainpoolP384r1" -#define NID_brainpoolP384r1 931 -#define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L - -#define SN_brainpoolP384t1 "brainpoolP384t1" -#define NID_brainpoolP384t1 932 -#define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L - -#define SN_brainpoolP512r1 "brainpoolP512r1" -#define NID_brainpoolP512r1 933 -#define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L - -#define SN_brainpoolP512t1 "brainpoolP512t1" -#define NID_brainpoolP512t1 934 -#define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L - -#define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L - -#define OBJ_secg_scheme OBJ_certicom_arc,1L - -#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" -#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 -#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L - -#define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" -#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 -#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L - -#define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" -#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 -#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L - -#define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" -#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 -#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L - -#define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" -#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 -#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L - -#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 -#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L - -#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 -#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L - -#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 -#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L - -#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 -#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L - -#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" -#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 -#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L - -#define SN_dh_std_kdf "dh-std-kdf" -#define NID_dh_std_kdf 946 - -#define SN_dh_cofactor_kdf "dh-cofactor-kdf" -#define NID_dh_cofactor_kdf 947 - -#define SN_ct_precert_scts "ct_precert_scts" -#define LN_ct_precert_scts "CT Precertificate SCTs" -#define NID_ct_precert_scts 951 -#define OBJ_ct_precert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,2L - -#define SN_ct_precert_poison "ct_precert_poison" -#define LN_ct_precert_poison "CT Precertificate Poison" -#define NID_ct_precert_poison 952 -#define OBJ_ct_precert_poison 1L,3L,6L,1L,4L,1L,11129L,2L,4L,3L - -#define SN_ct_precert_signer "ct_precert_signer" -#define LN_ct_precert_signer "CT Precertificate Signer" -#define NID_ct_precert_signer 953 -#define OBJ_ct_precert_signer 1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L - -#define SN_ct_cert_scts "ct_cert_scts" -#define LN_ct_cert_scts "CT Certificate SCTs" -#define NID_ct_cert_scts 954 -#define OBJ_ct_cert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L - -#define SN_jurisdictionLocalityName "jurisdictionL" -#define LN_jurisdictionLocalityName "jurisdictionLocalityName" -#define NID_jurisdictionLocalityName 955 -#define OBJ_jurisdictionLocalityName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,1L - -#define SN_jurisdictionStateOrProvinceName "jurisdictionST" -#define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" -#define NID_jurisdictionStateOrProvinceName 956 -#define OBJ_jurisdictionStateOrProvinceName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,2L - -#define SN_jurisdictionCountryName "jurisdictionC" -#define LN_jurisdictionCountryName "jurisdictionCountryName" -#define NID_jurisdictionCountryName 957 -#define OBJ_jurisdictionCountryName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,3L - -#define SN_id_scrypt "id-scrypt" -#define LN_id_scrypt "scrypt" -#define NID_id_scrypt 973 -#define OBJ_id_scrypt 1L,3L,6L,1L,4L,1L,11591L,4L,11L - -#define SN_tls1_prf "TLS1-PRF" -#define LN_tls1_prf "tls1-prf" -#define NID_tls1_prf 1021 - -#define SN_hkdf "HKDF" -#define LN_hkdf "hkdf" -#define NID_hkdf 1036 - -#define SN_id_pkinit "id-pkinit" -#define NID_id_pkinit 1031 -#define OBJ_id_pkinit 1L,3L,6L,1L,5L,2L,3L - -#define SN_pkInitClientAuth "pkInitClientAuth" -#define LN_pkInitClientAuth "PKINIT Client Auth" -#define NID_pkInitClientAuth 1032 -#define OBJ_pkInitClientAuth OBJ_id_pkinit,4L - -#define SN_pkInitKDC "pkInitKDC" -#define LN_pkInitKDC "Signing KDC Response" -#define NID_pkInitKDC 1033 -#define OBJ_pkInitKDC OBJ_id_pkinit,5L - -#define SN_X25519 "X25519" -#define NID_X25519 1034 -#define OBJ_X25519 1L,3L,101L,110L - -#define SN_X448 "X448" -#define NID_X448 1035 -#define OBJ_X448 1L,3L,101L,111L - -#define SN_ED25519 "ED25519" -#define NID_ED25519 1087 -#define OBJ_ED25519 1L,3L,101L,112L - -#define SN_ED448 "ED448" -#define NID_ED448 1088 -#define OBJ_ED448 1L,3L,101L,113L - -#define SN_kx_rsa "KxRSA" -#define LN_kx_rsa "kx-rsa" -#define NID_kx_rsa 1037 - -#define SN_kx_ecdhe "KxECDHE" -#define LN_kx_ecdhe "kx-ecdhe" -#define NID_kx_ecdhe 1038 - -#define SN_kx_dhe "KxDHE" -#define LN_kx_dhe "kx-dhe" -#define NID_kx_dhe 1039 - -#define SN_kx_ecdhe_psk "KxECDHE-PSK" -#define LN_kx_ecdhe_psk "kx-ecdhe-psk" -#define NID_kx_ecdhe_psk 1040 - -#define SN_kx_dhe_psk "KxDHE-PSK" -#define LN_kx_dhe_psk "kx-dhe-psk" -#define NID_kx_dhe_psk 1041 - -#define SN_kx_rsa_psk "KxRSA_PSK" -#define LN_kx_rsa_psk "kx-rsa-psk" -#define NID_kx_rsa_psk 1042 - -#define SN_kx_psk "KxPSK" -#define LN_kx_psk "kx-psk" -#define NID_kx_psk 1043 - -#define SN_kx_srp "KxSRP" -#define LN_kx_srp "kx-srp" -#define NID_kx_srp 1044 - -#define SN_kx_gost "KxGOST" -#define LN_kx_gost "kx-gost" -#define NID_kx_gost 1045 - -#define SN_kx_any "KxANY" -#define LN_kx_any "kx-any" -#define NID_kx_any 1063 - -#define SN_auth_rsa "AuthRSA" -#define LN_auth_rsa "auth-rsa" -#define NID_auth_rsa 1046 - -#define SN_auth_ecdsa "AuthECDSA" -#define LN_auth_ecdsa "auth-ecdsa" -#define NID_auth_ecdsa 1047 - -#define SN_auth_psk "AuthPSK" -#define LN_auth_psk "auth-psk" -#define NID_auth_psk 1048 - -#define SN_auth_dss "AuthDSS" -#define LN_auth_dss "auth-dss" -#define NID_auth_dss 1049 - -#define SN_auth_gost01 "AuthGOST01" -#define LN_auth_gost01 "auth-gost01" -#define NID_auth_gost01 1050 - -#define SN_auth_gost12 "AuthGOST12" -#define LN_auth_gost12 "auth-gost12" -#define NID_auth_gost12 1051 - -#define SN_auth_srp "AuthSRP" -#define LN_auth_srp "auth-srp" -#define NID_auth_srp 1052 - -#define SN_auth_null "AuthNULL" -#define LN_auth_null "auth-null" -#define NID_auth_null 1053 - -#define SN_auth_any "AuthANY" -#define LN_auth_any "auth-any" -#define NID_auth_any 1064 - -#define SN_poly1305 "Poly1305" -#define LN_poly1305 "poly1305" -#define NID_poly1305 1061 - -#define SN_siphash "SipHash" -#define LN_siphash "siphash" -#define NID_siphash 1062 - -#define SN_ffdhe2048 "ffdhe2048" -#define NID_ffdhe2048 1126 - -#define SN_ffdhe3072 "ffdhe3072" -#define NID_ffdhe3072 1127 - -#define SN_ffdhe4096 "ffdhe4096" -#define NID_ffdhe4096 1128 - -#define SN_ffdhe6144 "ffdhe6144" -#define NID_ffdhe6144 1129 - -#define SN_ffdhe8192 "ffdhe8192" -#define NID_ffdhe8192 1130 - -#define SN_ISO_UA "ISO-UA" -#define NID_ISO_UA 1150 -#define OBJ_ISO_UA OBJ_member_body,804L - -#define SN_ua_pki "ua-pki" -#define NID_ua_pki 1151 -#define OBJ_ua_pki OBJ_ISO_UA,2L,1L,1L,1L - -#define SN_dstu28147 "dstu28147" -#define LN_dstu28147 "DSTU Gost 28147-2009" -#define NID_dstu28147 1152 -#define OBJ_dstu28147 OBJ_ua_pki,1L,1L,1L - -#define SN_dstu28147_ofb "dstu28147-ofb" -#define LN_dstu28147_ofb "DSTU Gost 28147-2009 OFB mode" -#define NID_dstu28147_ofb 1153 -#define OBJ_dstu28147_ofb OBJ_dstu28147,2L - -#define SN_dstu28147_cfb "dstu28147-cfb" -#define LN_dstu28147_cfb "DSTU Gost 28147-2009 CFB mode" -#define NID_dstu28147_cfb 1154 -#define OBJ_dstu28147_cfb OBJ_dstu28147,3L - -#define SN_dstu28147_wrap "dstu28147-wrap" -#define LN_dstu28147_wrap "DSTU Gost 28147-2009 key wrap" -#define NID_dstu28147_wrap 1155 -#define OBJ_dstu28147_wrap OBJ_dstu28147,5L - -#define SN_hmacWithDstu34311 "hmacWithDstu34311" -#define LN_hmacWithDstu34311 "HMAC DSTU Gost 34311-95" -#define NID_hmacWithDstu34311 1156 -#define OBJ_hmacWithDstu34311 OBJ_ua_pki,1L,1L,2L - -#define SN_dstu34311 "dstu34311" -#define LN_dstu34311 "DSTU Gost 34311-95" -#define NID_dstu34311 1157 -#define OBJ_dstu34311 OBJ_ua_pki,1L,2L,1L - -#define SN_dstu4145le "dstu4145le" -#define LN_dstu4145le "DSTU 4145-2002 little endian" -#define NID_dstu4145le 1158 -#define OBJ_dstu4145le OBJ_ua_pki,1L,3L,1L,1L - -#define SN_dstu4145be "dstu4145be" -#define LN_dstu4145be "DSTU 4145-2002 big endian" -#define NID_dstu4145be 1159 -#define OBJ_dstu4145be OBJ_dstu4145le,1L,1L - -#define SN_uacurve0 "uacurve0" -#define LN_uacurve0 "DSTU curve 0" -#define NID_uacurve0 1160 -#define OBJ_uacurve0 OBJ_dstu4145le,2L,0L - -#define SN_uacurve1 "uacurve1" -#define LN_uacurve1 "DSTU curve 1" -#define NID_uacurve1 1161 -#define OBJ_uacurve1 OBJ_dstu4145le,2L,1L - -#define SN_uacurve2 "uacurve2" -#define LN_uacurve2 "DSTU curve 2" -#define NID_uacurve2 1162 -#define OBJ_uacurve2 OBJ_dstu4145le,2L,2L - -#define SN_uacurve3 "uacurve3" -#define LN_uacurve3 "DSTU curve 3" -#define NID_uacurve3 1163 -#define OBJ_uacurve3 OBJ_dstu4145le,2L,3L - -#define SN_uacurve4 "uacurve4" -#define LN_uacurve4 "DSTU curve 4" -#define NID_uacurve4 1164 -#define OBJ_uacurve4 OBJ_dstu4145le,2L,4L - -#define SN_uacurve5 "uacurve5" -#define LN_uacurve5 "DSTU curve 5" -#define NID_uacurve5 1165 -#define OBJ_uacurve5 OBJ_dstu4145le,2L,5L - -#define SN_uacurve6 "uacurve6" -#define LN_uacurve6 "DSTU curve 6" -#define NID_uacurve6 1166 -#define OBJ_uacurve6 OBJ_dstu4145le,2L,6L - -#define SN_uacurve7 "uacurve7" -#define LN_uacurve7 "DSTU curve 7" -#define NID_uacurve7 1167 -#define OBJ_uacurve7 OBJ_dstu4145le,2L,7L - -#define SN_uacurve8 "uacurve8" -#define LN_uacurve8 "DSTU curve 8" -#define NID_uacurve8 1168 -#define OBJ_uacurve8 OBJ_dstu4145le,2L,8L - -#define SN_uacurve9 "uacurve9" -#define LN_uacurve9 "DSTU curve 9" -#define NID_uacurve9 1169 -#define OBJ_uacurve9 OBJ_dstu4145le,2L,9L diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/objects.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/objects.h deleted file mode 100644 index 5e8b5762..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/objects.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 1995-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_OBJECTS_H -# define HEADER_OBJECTS_H - -# include -# include -# include -# include - -# define OBJ_NAME_TYPE_UNDEF 0x00 -# define OBJ_NAME_TYPE_MD_METH 0x01 -# define OBJ_NAME_TYPE_CIPHER_METH 0x02 -# define OBJ_NAME_TYPE_PKEY_METH 0x03 -# define OBJ_NAME_TYPE_COMP_METH 0x04 -# define OBJ_NAME_TYPE_NUM 0x05 - -# define OBJ_NAME_ALIAS 0x8000 - -# define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 -# define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct obj_name_st { - int type; - int alias; - const char *name; - const char *data; -} OBJ_NAME; - -# define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) - -int OBJ_NAME_init(void); -int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), - int (*cmp_func) (const char *, const char *), - void (*free_func) (const char *, int, const char *)); -const char *OBJ_NAME_get(const char *name, int type); -int OBJ_NAME_add(const char *name, int type, const char *data); -int OBJ_NAME_remove(const char *name, int type); -void OBJ_NAME_cleanup(int type); /* -1 for everything */ -void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), - void *arg); -void OBJ_NAME_do_all_sorted(int type, - void (*fn) (const OBJ_NAME *, void *arg), - void *arg); - -ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o); -ASN1_OBJECT *OBJ_nid2obj(int n); -const char *OBJ_nid2ln(int n); -const char *OBJ_nid2sn(int n); -int OBJ_obj2nid(const ASN1_OBJECT *o); -ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); -int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); -int OBJ_txt2nid(const char *s); -int OBJ_ln2nid(const char *s); -int OBJ_sn2nid(const char *s); -int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); -const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, - int (*cmp) (const void *, const void *)); -const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, - int size, - int (*cmp) (const void *, const void *), - int flags); - -# define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ - static int nm##_cmp(type1 const *, type2 const *); \ - scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) - -# define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ - _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) -# define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ - type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) - -/*- - * Unsolved problem: if a type is actually a pointer type, like - * nid_triple is, then its impossible to get a const where you need - * it. Consider: - * - * typedef int nid_triple[3]; - * const void *a_; - * const nid_triple const *a = a_; - * - * The assignment discards a const because what you really want is: - * - * const int const * const *a = a_; - * - * But if you do that, you lose the fact that a is an array of 3 ints, - * which breaks comparison functions. - * - * Thus we end up having to cast, sadly, or unpack the - * declarations. Or, as I finally did in this case, declare nid_triple - * to be a struct, which it should have been in the first place. - * - * Ben, August 2008. - * - * Also, strictly speaking not all types need be const, but handling - * the non-constness means a lot of complication, and in practice - * comparison routines do always not touch their arguments. - */ - -# define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ - { \ - type1 const *a = a_; \ - type2 const *b = b_; \ - return nm##_cmp(a,b); \ - } \ - static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ - { \ - return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ - nm##_cmp_BSEARCH_CMP_FN); \ - } \ - extern void dummy_prototype(void) - -# define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ - static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ - { \ - type1 const *a = a_; \ - type2 const *b = b_; \ - return nm##_cmp(a,b); \ - } \ - type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ - { \ - return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ - nm##_cmp_BSEARCH_CMP_FN); \ - } \ - extern void dummy_prototype(void) - -# define OBJ_bsearch(type1,key,type2,base,num,cmp) \ - ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ - num,sizeof(type2), \ - ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ - (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ - cmp##_BSEARCH_CMP_FN))) - -# define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ - ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ - num,sizeof(type2), \ - ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ - (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ - cmp##_BSEARCH_CMP_FN)),flags) - -int OBJ_new_nid(int num); -int OBJ_add_object(const ASN1_OBJECT *obj); -int OBJ_create(const char *oid, const char *sn, const char *ln); -#if OPENSSL_API_COMPAT < 0x10100000L -# define OBJ_cleanup() while(0) continue -#endif -int OBJ_create_objects(BIO *in); - -size_t OBJ_length(const ASN1_OBJECT *obj); -const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); - -int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); -int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); -int OBJ_add_sigid(int signid, int dig_id, int pkey_id); -void OBJ_sigid_free(void); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/objectserr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/objectserr.h deleted file mode 100644 index 02e166f1..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/objectserr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ocsp.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ocsp.h deleted file mode 100644 index 4d759a49..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ocsp.h +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright 2000-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_OCSP_H -# define HEADER_OCSP_H - -#include - -/* - * These definitions are outside the OPENSSL_NO_OCSP guard because although for - * historical reasons they have OCSP_* names, they can actually be used - * independently of OCSP. E.g. see RFC5280 - */ -/*- - * CRLReason ::= ENUMERATED { - * unspecified (0), - * keyCompromise (1), - * cACompromise (2), - * affiliationChanged (3), - * superseded (4), - * cessationOfOperation (5), - * certificateHold (6), - * removeFromCRL (8) } - */ -# define OCSP_REVOKED_STATUS_NOSTATUS -1 -# define OCSP_REVOKED_STATUS_UNSPECIFIED 0 -# define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 -# define OCSP_REVOKED_STATUS_CACOMPROMISE 2 -# define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 -# define OCSP_REVOKED_STATUS_SUPERSEDED 4 -# define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 -# define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 -# define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 - - -# ifndef OPENSSL_NO_OCSP - -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Various flags and values */ - -# define OCSP_DEFAULT_NONCE_LENGTH 16 - -# define OCSP_NOCERTS 0x1 -# define OCSP_NOINTERN 0x2 -# define OCSP_NOSIGS 0x4 -# define OCSP_NOCHAIN 0x8 -# define OCSP_NOVERIFY 0x10 -# define OCSP_NOEXPLICIT 0x20 -# define OCSP_NOCASIGN 0x40 -# define OCSP_NODELEGATED 0x80 -# define OCSP_NOCHECKS 0x100 -# define OCSP_TRUSTOTHER 0x200 -# define OCSP_RESPID_KEY 0x400 -# define OCSP_NOTIME 0x800 - -typedef struct ocsp_cert_id_st OCSP_CERTID; - -DEFINE_STACK_OF(OCSP_CERTID) - -typedef struct ocsp_one_request_st OCSP_ONEREQ; - -DEFINE_STACK_OF(OCSP_ONEREQ) - -typedef struct ocsp_req_info_st OCSP_REQINFO; -typedef struct ocsp_signature_st OCSP_SIGNATURE; -typedef struct ocsp_request_st OCSP_REQUEST; - -# define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 -# define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 -# define OCSP_RESPONSE_STATUS_INTERNALERROR 2 -# define OCSP_RESPONSE_STATUS_TRYLATER 3 -# define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 -# define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 - -typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES; - -# define V_OCSP_RESPID_NAME 0 -# define V_OCSP_RESPID_KEY 1 - -DEFINE_STACK_OF(OCSP_RESPID) - -typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO; - -# define V_OCSP_CERTSTATUS_GOOD 0 -# define V_OCSP_CERTSTATUS_REVOKED 1 -# define V_OCSP_CERTSTATUS_UNKNOWN 2 - -typedef struct ocsp_cert_status_st OCSP_CERTSTATUS; -typedef struct ocsp_single_response_st OCSP_SINGLERESP; - -DEFINE_STACK_OF(OCSP_SINGLERESP) - -typedef struct ocsp_response_data_st OCSP_RESPDATA; - -typedef struct ocsp_basic_response_st OCSP_BASICRESP; - -typedef struct ocsp_crl_id_st OCSP_CRLID; -typedef struct ocsp_service_locator_st OCSP_SERVICELOC; - -# define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" -# define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" - -# define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) - -# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) - -# define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ - (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST, \ - bp,(char **)(x),cb,NULL) - -# define PEM_read_bio_OCSP_RESPONSE(bp,x,cb) (OCSP_RESPONSE *)PEM_ASN1_read_bio(\ - (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE, \ - bp,(char **)(x),cb,NULL) - -# define PEM_write_bio_OCSP_REQUEST(bp,o) \ - PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ - bp,(char *)(o), NULL,NULL,0,NULL,NULL) - -# define PEM_write_bio_OCSP_RESPONSE(bp,o) \ - PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ - bp,(char *)(o), NULL,NULL,0,NULL,NULL) - -# define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) - -# define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) - -# define ASN1_BIT_STRING_digest(data,type,md,len) \ - ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) - -# define OCSP_CERTSTATUS_dup(cs)\ - (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ - (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) - -OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); - -OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); -OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, - int maxline); -int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx); -int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); -OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline); -void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); -void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); -int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, - ASN1_VALUE *val); -int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval, - const ASN1_ITEM *it); -BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx); -int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path); -int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); -int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, - const char *name, const char *value); - -OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject, - const X509 *issuer); - -OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, - const X509_NAME *issuerName, - const ASN1_BIT_STRING *issuerKey, - const ASN1_INTEGER *serialNumber); - -OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); - -int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); -int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); -int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); -int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); - -int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); -int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); - -int OCSP_request_sign(OCSP_REQUEST *req, - X509 *signer, - EVP_PKEY *key, - const EVP_MD *dgst, - STACK_OF(X509) *certs, unsigned long flags); - -int OCSP_response_status(OCSP_RESPONSE *resp); -OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); - -const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs); -const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs); -const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs); -int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, - STACK_OF(X509) *extra_certs); - -int OCSP_resp_count(OCSP_BASICRESP *bs); -OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); -const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP* bs); -const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs); -int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, - const ASN1_OCTET_STRING **pid, - const X509_NAME **pname); -int OCSP_resp_get1_id(const OCSP_BASICRESP *bs, - ASN1_OCTET_STRING **pid, - X509_NAME **pname); - -int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); -int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, - ASN1_GENERALIZEDTIME **revtime, - ASN1_GENERALIZEDTIME **thisupd, - ASN1_GENERALIZEDTIME **nextupd); -int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, - int *reason, - ASN1_GENERALIZEDTIME **revtime, - ASN1_GENERALIZEDTIME **thisupd, - ASN1_GENERALIZEDTIME **nextupd); -int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, - ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); - -int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, - X509_STORE *store, unsigned long flags); - -int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, - int *pssl); - -int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); -int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); - -int OCSP_request_onereq_count(OCSP_REQUEST *req); -OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); -OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); -int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, - ASN1_OCTET_STRING **pikeyHash, - ASN1_INTEGER **pserial, OCSP_CERTID *cid); -int OCSP_request_is_signed(OCSP_REQUEST *req); -OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); -OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, - OCSP_CERTID *cid, - int status, int reason, - ASN1_TIME *revtime, - ASN1_TIME *thisupd, - ASN1_TIME *nextupd); -int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); -int OCSP_basic_sign(OCSP_BASICRESP *brsp, - X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, - STACK_OF(X509) *certs, unsigned long flags); -int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, - X509 *signer, EVP_MD_CTX *ctx, - STACK_OF(X509) *certs, unsigned long flags); -int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert); -int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert); -int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert); - -X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim); - -X509_EXTENSION *OCSP_accept_responses_new(char **oids); - -X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); - -X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, const char **urls); - -int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); -int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); -int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); -X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); -X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); -void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, - int *idx); -int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, - unsigned long flags); -int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); - -int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); -int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); -int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos); -int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); -X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); -X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); -void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); -int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, - unsigned long flags); -int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); - -int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); -int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); -int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, - int lastpos); -X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); -X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); -void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, - int *idx); -int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, - int crit, unsigned long flags); -int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); - -int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); -int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); -int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, - int lastpos); -int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, - int lastpos); -X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); -X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); -void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, - int *idx); -int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, - int crit, unsigned long flags); -int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); -const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x); - -DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) -DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) -DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) -DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) -DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) -DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) -DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) -DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) -DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) -DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) -DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) -DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) - -const char *OCSP_response_status_str(long s); -const char *OCSP_cert_status_str(long s); -const char *OCSP_crl_reason_str(long s); - -int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); -int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); - -int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, - X509_STORE *st, unsigned long flags); - - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ocsperr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ocsperr.h deleted file mode 100644 index 8dd9e01a..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ocsperr.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 -# endif - -# include - -# 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 diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/opensslconf.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/opensslconf.h deleted file mode 100644 index 942b46db..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/opensslconf.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * WARNING: do not edit! - * Generated by Makefile from include/openssl/opensslconf.h.in - * - * 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 - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef OPENSSL_ALGORITHM_DEFINES -# error OPENSSL_ALGORITHM_DEFINES no longer supported -#endif - -/* - * OpenSSL was configured with the following options: - */ - -#ifndef OPENSSL_NO_MD2 -# define OPENSSL_NO_MD2 -#endif -#ifndef OPENSSL_NO_RC5 -# define OPENSSL_NO_RC5 -#endif -#ifndef OPENSSL_THREADS -# define OPENSSL_THREADS -#endif -#ifndef OPENSSL_RAND_SEED_OS -# define OPENSSL_RAND_SEED_OS -#endif -#ifndef OPENSSL_NO_AFALGENG -# define OPENSSL_NO_AFALGENG -#endif -#ifndef OPENSSL_NO_ASAN -# define OPENSSL_NO_ASAN -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG -# define OPENSSL_NO_CRYPTO_MDEBUG -#endif -#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE -#endif -#ifndef OPENSSL_NO_DEVCRYPTOENG -# define OPENSSL_NO_DEVCRYPTOENG -#endif -#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 -# define OPENSSL_NO_EC_NISTP_64_GCC_128 -#endif -#ifndef OPENSSL_NO_EGD -# define OPENSSL_NO_EGD -#endif -#ifndef OPENSSL_NO_EXTERNAL_TESTS -# define OPENSSL_NO_EXTERNAL_TESTS -#endif -#ifndef OPENSSL_NO_FUZZ_AFL -# define OPENSSL_NO_FUZZ_AFL -#endif -#ifndef OPENSSL_NO_FUZZ_LIBFUZZER -# define OPENSSL_NO_FUZZ_LIBFUZZER -#endif -#ifndef OPENSSL_NO_HEARTBEATS -# define OPENSSL_NO_HEARTBEATS -#endif -#ifndef OPENSSL_NO_MSAN -# define OPENSSL_NO_MSAN -#endif -#ifndef OPENSSL_NO_SCTP -# define OPENSSL_NO_SCTP -#endif -#ifndef OPENSSL_NO_SSL_TRACE -# define OPENSSL_NO_SSL_TRACE -#endif -#ifndef OPENSSL_NO_SSL3 -# define OPENSSL_NO_SSL3 -#endif -#ifndef OPENSSL_NO_SSL3_METHOD -# define OPENSSL_NO_SSL3_METHOD -#endif -#ifndef OPENSSL_NO_UBSAN -# define OPENSSL_NO_UBSAN -#endif -#ifndef OPENSSL_NO_UNIT_TEST -# define OPENSSL_NO_UNIT_TEST -#endif -#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS -# define OPENSSL_NO_WEAK_SSL_CIPHERS -#endif -#ifndef OPENSSL_NO_STATIC_ENGINE -# define OPENSSL_NO_STATIC_ENGINE -#endif - - -/* - * 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= to suppress the - * declarations of functions deprecated in or before . 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 -# 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? */ -#undef I386_ONLY - -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD - -#undef OPENSSL_EXPORT_VAR_AS_FUNCTION - -/* - * The following are cipher-specific, but are part of the public API. - */ -#if !defined(OPENSSL_SYS_UEFI) -# undef BN_LLONG -/* Only one for the following should be defined */ -# define SIXTY_FOUR_BIT_LONG -# undef SIXTY_FOUR_BIT -# undef THIRTY_TWO_BIT -#endif - -#define RC4_INT unsigned int - -#ifdef __cplusplus -} -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/opensslv.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/opensslv.h deleted file mode 100644 index 17d271f5..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/opensslv.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 1999-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_OPENSSLV_H -# define HEADER_OPENSSLV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*- - * Numeric release version identifier: - * MNNFFPPS: major minor fix patch status - * The status nibble has one of the values 0 for development, 1 to e for betas - * 1 to 14, and f for release. The patch level is exactly that. - * For example: - * 0.9.3-dev 0x00903000 - * 0.9.3-beta1 0x00903001 - * 0.9.3-beta2-dev 0x00903002 - * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) - * 0.9.3 0x0090300f - * 0.9.3a 0x0090301f - * 0.9.4 0x0090400f - * 1.2.3z 0x102031af - * - * For continuity reasons (because 0.9.5 is already out, and is coded - * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level - * part is slightly different, by setting the highest bit. This means - * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start - * with 0x0090600S... - * - * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) - * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for - * major minor fix final patch/beta) - */ -# define OPENSSL_VERSION_NUMBER 0x1010107fL -# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1g 21 Apr 2020" - -/*- - * The macros below are to be used for shared library (.so, .dll, ...) - * versioning. That kind of versioning works a bit differently between - * operating systems. The most usual scheme is to set a major and a minor - * number, and have the runtime loader check that the major number is equal - * to what it was at application link time, while the minor number has to - * be greater or equal to what it was at application link time. With this - * scheme, the version number is usually part of the file name, like this: - * - * libcrypto.so.0.9 - * - * Some unixen also make a softlink with the major version number only: - * - * libcrypto.so.0 - * - * On Tru64 and IRIX 6.x it works a little bit differently. There, the - * shared library version is stored in the file, and is actually a series - * of versions, separated by colons. The rightmost version present in the - * library when linking an application is stored in the application to be - * matched at run time. When the application is run, a check is done to - * see if the library version stored in the application matches any of the - * versions in the version string of the library itself. - * This version string can be constructed in any way, depending on what - * kind of matching is desired. However, to implement the same scheme as - * the one used in the other unixen, all compatible versions, from lowest - * to highest, should be part of the string. Consecutive builds would - * give the following versions strings: - * - * 3.0 - * 3.0:3.1 - * 3.0:3.1:3.2 - * 4.0 - * 4.0:4.1 - * - * Notice how version 4 is completely incompatible with version, and - * therefore give the breach you can see. - * - * There may be other schemes as well that I haven't yet discovered. - * - * So, here's the way it works here: first of all, the library version - * number doesn't need at all to match the overall OpenSSL version. - * However, it's nice and more understandable if it actually does. - * The current library version is stored in the macro SHLIB_VERSION_NUMBER, - * which is just a piece of text in the format "M.m.e" (Major, minor, edit). - * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, - * we need to keep a history of version numbers, which is done in the - * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and - * should only keep the versions that are binary compatible with the current. - */ -# define SHLIB_VERSION_HISTORY "" -# define SHLIB_VERSION_NUMBER "1.1" - - -#ifdef __cplusplus -} -#endif -#endif /* HEADER_OPENSSLV_H */ diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ossl_typ.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ossl_typ.h deleted file mode 100644 index e0edfaaf..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ossl_typ.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2001-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_OPENSSL_TYPES_H -# define HEADER_OPENSSL_TYPES_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -# include - -# ifdef NO_ASN1_TYPEDEFS -# define ASN1_INTEGER ASN1_STRING -# define ASN1_ENUMERATED ASN1_STRING -# define ASN1_BIT_STRING ASN1_STRING -# define ASN1_OCTET_STRING ASN1_STRING -# define ASN1_PRINTABLESTRING ASN1_STRING -# define ASN1_T61STRING ASN1_STRING -# define ASN1_IA5STRING ASN1_STRING -# define ASN1_UTCTIME ASN1_STRING -# define ASN1_GENERALIZEDTIME ASN1_STRING -# define ASN1_TIME ASN1_STRING -# define ASN1_GENERALSTRING ASN1_STRING -# define ASN1_UNIVERSALSTRING ASN1_STRING -# define ASN1_BMPSTRING ASN1_STRING -# define ASN1_VISIBLESTRING ASN1_STRING -# define ASN1_UTF8STRING ASN1_STRING -# define ASN1_BOOLEAN int -# define ASN1_NULL int -# else -typedef struct asn1_string_st ASN1_INTEGER; -typedef struct asn1_string_st ASN1_ENUMERATED; -typedef struct asn1_string_st ASN1_BIT_STRING; -typedef struct asn1_string_st ASN1_OCTET_STRING; -typedef struct asn1_string_st ASN1_PRINTABLESTRING; -typedef struct asn1_string_st ASN1_T61STRING; -typedef struct asn1_string_st ASN1_IA5STRING; -typedef struct asn1_string_st ASN1_GENERALSTRING; -typedef struct asn1_string_st ASN1_UNIVERSALSTRING; -typedef struct asn1_string_st ASN1_BMPSTRING; -typedef struct asn1_string_st ASN1_UTCTIME; -typedef struct asn1_string_st ASN1_TIME; -typedef struct asn1_string_st ASN1_GENERALIZEDTIME; -typedef struct asn1_string_st ASN1_VISIBLESTRING; -typedef struct asn1_string_st ASN1_UTF8STRING; -typedef struct asn1_string_st ASN1_STRING; -typedef int ASN1_BOOLEAN; -typedef int ASN1_NULL; -# endif - -typedef struct asn1_object_st ASN1_OBJECT; - -typedef struct ASN1_ITEM_st ASN1_ITEM; -typedef struct asn1_pctx_st ASN1_PCTX; -typedef struct asn1_sctx_st ASN1_SCTX; - -# ifdef _WIN32 -# undef X509_NAME -# undef X509_EXTENSIONS -# undef PKCS7_ISSUER_AND_SERIAL -# undef PKCS7_SIGNER_INFO -# undef OCSP_REQUEST -# undef OCSP_RESPONSE -# endif - -# ifdef BIGNUM -# undef BIGNUM -# endif -struct dane_st; -typedef struct bio_st BIO; -typedef struct bignum_st BIGNUM; -typedef struct bignum_ctx BN_CTX; -typedef struct bn_blinding_st BN_BLINDING; -typedef struct bn_mont_ctx_st BN_MONT_CTX; -typedef struct bn_recp_ctx_st BN_RECP_CTX; -typedef struct bn_gencb_st BN_GENCB; - -typedef struct buf_mem_st BUF_MEM; - -typedef struct evp_cipher_st EVP_CIPHER; -typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; -typedef struct evp_md_st EVP_MD; -typedef struct evp_md_ctx_st EVP_MD_CTX; -typedef struct evp_pkey_st EVP_PKEY; - -typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; - -typedef struct evp_pkey_method_st EVP_PKEY_METHOD; -typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; - -typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; - -typedef struct hmac_ctx_st HMAC_CTX; - -typedef struct dh_st DH; -typedef struct dh_method DH_METHOD; - -typedef struct dsa_st DSA; -typedef struct dsa_method DSA_METHOD; - -typedef struct rsa_st RSA; -typedef struct rsa_meth_st RSA_METHOD; -typedef struct rsa_pss_params_st RSA_PSS_PARAMS; - -typedef struct ec_key_st EC_KEY; -typedef struct ec_key_method_st EC_KEY_METHOD; - -typedef struct rand_meth_st RAND_METHOD; -typedef struct rand_drbg_st RAND_DRBG; - -typedef struct ssl_dane_st SSL_DANE; -typedef struct x509_st X509; -typedef struct X509_algor_st X509_ALGOR; -typedef struct X509_crl_st X509_CRL; -typedef struct x509_crl_method_st X509_CRL_METHOD; -typedef struct x509_revoked_st X509_REVOKED; -typedef struct X509_name_st X509_NAME; -typedef struct X509_pubkey_st X509_PUBKEY; -typedef struct x509_store_st X509_STORE; -typedef struct x509_store_ctx_st X509_STORE_CTX; - -typedef struct x509_object_st X509_OBJECT; -typedef struct x509_lookup_st X509_LOOKUP; -typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; -typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; - -typedef struct x509_sig_info_st X509_SIG_INFO; - -typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; - -typedef struct v3_ext_ctx X509V3_CTX; -typedef struct conf_st CONF; -typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS; - -typedef struct ui_st UI; -typedef struct ui_method_st UI_METHOD; - -typedef struct engine_st ENGINE; -typedef struct ssl_st SSL; -typedef struct ssl_ctx_st SSL_CTX; - -typedef struct comp_ctx_st COMP_CTX; -typedef struct comp_method_st COMP_METHOD; - -typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; -typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; -typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; -typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; - -typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; -typedef struct DIST_POINT_st DIST_POINT; -typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; -typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; - -typedef struct crypto_ex_data_st CRYPTO_EX_DATA; - -typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; -typedef struct ocsp_response_st OCSP_RESPONSE; -typedef struct ocsp_responder_id_st OCSP_RESPID; - -typedef struct sct_st SCT; -typedef struct sct_ctx_st SCT_CTX; -typedef struct ctlog_st CTLOG; -typedef struct ctlog_store_st CTLOG_STORE; -typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX; - -typedef struct ossl_store_info_st OSSL_STORE_INFO; -typedef struct ossl_store_search_st OSSL_STORE_SEARCH; - -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ - defined(INTMAX_MAX) && defined(UINTMAX_MAX) -typedef intmax_t ossl_intmax_t; -typedef uintmax_t ossl_uintmax_t; -#else -/* - * Not long long, because the C-library can only be expected to provide - * strtoll(), strtoull() at the same time as intmax_t and strtoimax(), - * strtoumax(). Since we use these for parsing arguments, we need the - * conversion functions, not just the sizes. - */ -typedef long ossl_intmax_t; -typedef unsigned long ossl_uintmax_t; -#endif - -#ifdef __cplusplus -} -#endif -#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pem.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/pem.h deleted file mode 100644 index 2ef5b5d0..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pem.h +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright 1995-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_PEM_H -# define HEADER_PEM_H - -# include -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define PEM_BUFSIZE 1024 - -# define PEM_STRING_X509_OLD "X509 CERTIFICATE" -# define PEM_STRING_X509 "CERTIFICATE" -# define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" -# define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" -# define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" -# define PEM_STRING_X509_CRL "X509 CRL" -# define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" -# define PEM_STRING_PUBLIC "PUBLIC KEY" -# define PEM_STRING_RSA "RSA PRIVATE KEY" -# define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" -# define PEM_STRING_DSA "DSA PRIVATE KEY" -# define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" -# define PEM_STRING_PKCS7 "PKCS7" -# define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" -# define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" -# define PEM_STRING_PKCS8INF "PRIVATE KEY" -# define PEM_STRING_DHPARAMS "DH PARAMETERS" -# define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" -# define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" -# define PEM_STRING_DSAPARAMS "DSA PARAMETERS" -# define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" -# define PEM_STRING_ECPARAMETERS "EC PARAMETERS" -# define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" -# define PEM_STRING_PARAMETERS "PARAMETERS" -# define PEM_STRING_CMS "CMS" - -# define PEM_TYPE_ENCRYPTED 10 -# define PEM_TYPE_MIC_ONLY 20 -# define PEM_TYPE_MIC_CLEAR 30 -# define PEM_TYPE_CLEAR 40 - -/* - * These macros make the PEM_read/PEM_write functions easier to maintain and - * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or - * IMPLEMENT_PEM_rw_cb(...) - */ - -# ifdef OPENSSL_NO_STDIO - -# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ -# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ -# else - -# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ -type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ -{ \ -return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ -} - -# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x) \ -{ \ -return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, const type *x) \ -{ \ -return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, \ - void *u) \ - { \ - return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ -int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, \ - void *u) \ - { \ - return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ - } - -# endif - -# define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ -type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ -{ \ -return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ -} - -# define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x) \ -{ \ -return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, const type *x) \ -{ \ -return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ -} - -# define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ - { \ - return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ -int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ - { \ - return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ - } - -# define IMPLEMENT_PEM_write(name, type, str, asn1) \ - IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_write_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ - IMPLEMENT_PEM_read_fp(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write_const(name, type, str, asn1) - -# define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ - IMPLEMENT_PEM_read(name, type, str, asn1) \ - IMPLEMENT_PEM_write_cb(name, type, str, asn1) - -/* These are the same except they are for the declarations */ - -# if defined(OPENSSL_NO_STDIO) - -# define DECLARE_PEM_read_fp(name, type) /**/ -# define DECLARE_PEM_write_fp(name, type) /**/ -# define DECLARE_PEM_write_fp_const(name, type) /**/ -# define DECLARE_PEM_write_cb_fp(name, type) /**/ -# else - -# define DECLARE_PEM_read_fp(name, type) \ - type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write_fp(name, type) \ - int PEM_write_##name(FILE *fp, type *x); - -# define DECLARE_PEM_write_fp_const(name, type) \ - int PEM_write_##name(FILE *fp, const type *x); - -# define DECLARE_PEM_write_cb_fp(name, type) \ - int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u); - -# endif - -# define DECLARE_PEM_read_bio(name, type) \ - type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write_bio(name, type) \ - int PEM_write_bio_##name(BIO *bp, type *x); - -# define DECLARE_PEM_write_bio_const(name, type) \ - int PEM_write_bio_##name(BIO *bp, const type *x); - -# define DECLARE_PEM_write_cb_bio(name, type) \ - int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ - unsigned char *kstr, int klen, pem_password_cb *cb, void *u); - -# define DECLARE_PEM_write(name, type) \ - DECLARE_PEM_write_bio(name, type) \ - DECLARE_PEM_write_fp(name, type) -# define DECLARE_PEM_write_const(name, type) \ - DECLARE_PEM_write_bio_const(name, type) \ - DECLARE_PEM_write_fp_const(name, type) -# define DECLARE_PEM_write_cb(name, type) \ - DECLARE_PEM_write_cb_bio(name, type) \ - DECLARE_PEM_write_cb_fp(name, type) -# define DECLARE_PEM_read(name, type) \ - DECLARE_PEM_read_bio(name, type) \ - DECLARE_PEM_read_fp(name, type) -# define DECLARE_PEM_rw(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write(name, type) -# define DECLARE_PEM_rw_const(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write_const(name, type) -# define DECLARE_PEM_rw_cb(name, type) \ - DECLARE_PEM_read(name, type) \ - DECLARE_PEM_write_cb(name, type) -typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); - -int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); -int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, - pem_password_cb *callback, void *u); - -int PEM_read_bio(BIO *bp, char **name, char **header, - unsigned char **data, long *len); -# define PEM_FLAG_SECURE 0x1 -# define PEM_FLAG_EAY_COMPATIBLE 0x2 -# define PEM_FLAG_ONLY_B64 0x4 -int PEM_read_bio_ex(BIO *bp, char **name, char **header, - unsigned char **data, long *len, unsigned int flags); -int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, - const char *name, BIO *bp, pem_password_cb *cb, - void *u); -int PEM_write_bio(BIO *bp, const char *name, const char *hdr, - const unsigned char *data, long len); -int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, - const char *name, BIO *bp, pem_password_cb *cb, - void *u); -void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, - pem_password_cb *cb, void *u); -int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, - const EVP_CIPHER *enc, unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - -STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u); -int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cd, void *u); - -#ifndef OPENSSL_NO_STDIO -int PEM_read(FILE *fp, char **name, char **header, - unsigned char **data, long *len); -int PEM_write(FILE *fp, const char *name, const char *hdr, - const unsigned char *data, long len); -void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, - pem_password_cb *cb, void *u); -int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, - void *x, const EVP_CIPHER *enc, unsigned char *kstr, - int klen, pem_password_cb *callback, void *u); -STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u); -#endif - -int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); -int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); -int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, - unsigned int *siglen, EVP_PKEY *pkey); - -/* The default pem_password_cb that's used internally */ -int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); -void PEM_proc_type(char *buf, int type); -void PEM_dek_info(char *buf, const char *type, int len, char *str); - -# include - -DECLARE_PEM_rw(X509, X509) -DECLARE_PEM_rw(X509_AUX, X509) -DECLARE_PEM_rw(X509_REQ, X509_REQ) -DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) -DECLARE_PEM_rw(X509_CRL, X509_CRL) -DECLARE_PEM_rw(PKCS7, PKCS7) -DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) -DECLARE_PEM_rw(PKCS8, X509_SIG) -DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) -# ifndef OPENSSL_NO_RSA -DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) -DECLARE_PEM_rw_const(RSAPublicKey, RSA) -DECLARE_PEM_rw(RSA_PUBKEY, RSA) -# endif -# ifndef OPENSSL_NO_DSA -DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) -DECLARE_PEM_rw(DSA_PUBKEY, DSA) -DECLARE_PEM_rw_const(DSAparams, DSA) -# endif -# ifndef OPENSSL_NO_EC -DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) -DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) -DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) -# endif -# ifndef OPENSSL_NO_DH -DECLARE_PEM_rw_const(DHparams, DH) -DECLARE_PEM_write_const(DHxparams, DH) -# endif -DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) -DECLARE_PEM_rw(PUBKEY, EVP_PKEY) - -int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, - const EVP_CIPHER *enc, - unsigned char *kstr, int klen, - pem_password_cb *cb, void *u); - -int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, - char *, int, pem_password_cb *, void *); -int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, - void *u); - -# ifndef OPENSSL_NO_STDIO -int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); -int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, - char *kstr, int klen, - pem_password_cb *cb, void *u); - -EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, - void *u); - -int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, - char *kstr, int klen, pem_password_cb *cd, - void *u); -# endif -EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); -int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); - -# ifndef OPENSSL_NO_DSA -EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); -EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); -EVP_PKEY *b2i_PrivateKey_bio(BIO *in); -EVP_PKEY *b2i_PublicKey_bio(BIO *in); -int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); -int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); -# ifndef OPENSSL_NO_RC4 -EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); -int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, - pem_password_cb *cb, void *u); -# endif -# endif - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pem2.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/pem2.h deleted file mode 100644 index 038fe790..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pem2.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 1999-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_PEM2_H -# define HEADER_PEM2_H -# include -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pemerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/pemerr.h deleted file mode 100644 index 0c45918f..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pemerr.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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_PEMERR_H -# define HEADER_PEMERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PEM_strings(void); - -/* - * PEM function codes. - */ -# define PEM_F_B2I_DSS 127 -# define PEM_F_B2I_PVK_BIO 128 -# define PEM_F_B2I_RSA 129 -# define PEM_F_CHECK_BITLEN_DSA 130 -# define PEM_F_CHECK_BITLEN_RSA 131 -# define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 -# define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 -# define PEM_F_DO_B2I 132 -# define PEM_F_DO_B2I_BIO 133 -# define PEM_F_DO_BLOB_HEADER 134 -# define PEM_F_DO_I2B 146 -# define PEM_F_DO_PK8PKEY 126 -# define PEM_F_DO_PK8PKEY_FP 125 -# define PEM_F_DO_PVK_BODY 135 -# define PEM_F_DO_PVK_HEADER 136 -# define PEM_F_GET_HEADER_AND_DATA 143 -# define PEM_F_GET_NAME 144 -# define PEM_F_I2B_PVK 137 -# define PEM_F_I2B_PVK_BIO 138 -# define PEM_F_LOAD_IV 101 -# define PEM_F_PEM_ASN1_READ 102 -# define PEM_F_PEM_ASN1_READ_BIO 103 -# define PEM_F_PEM_ASN1_WRITE 104 -# define PEM_F_PEM_ASN1_WRITE_BIO 105 -# define PEM_F_PEM_DEF_CALLBACK 100 -# define PEM_F_PEM_DO_HEADER 106 -# define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 -# define PEM_F_PEM_READ 108 -# define PEM_F_PEM_READ_BIO 109 -# define PEM_F_PEM_READ_BIO_DHPARAMS 141 -# define PEM_F_PEM_READ_BIO_EX 145 -# define PEM_F_PEM_READ_BIO_PARAMETERS 140 -# define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 -# define PEM_F_PEM_READ_DHPARAMS 142 -# define PEM_F_PEM_READ_PRIVATEKEY 124 -# define PEM_F_PEM_SIGNFINAL 112 -# define PEM_F_PEM_WRITE 113 -# define PEM_F_PEM_WRITE_BIO 114 -# define PEM_F_PEM_WRITE_PRIVATEKEY 139 -# define PEM_F_PEM_X509_INFO_READ 115 -# define PEM_F_PEM_X509_INFO_READ_BIO 116 -# define PEM_F_PEM_X509_INFO_WRITE_BIO 117 - -/* - * PEM reason codes. - */ -# define PEM_R_BAD_BASE64_DECODE 100 -# define PEM_R_BAD_DECRYPT 101 -# define PEM_R_BAD_END_LINE 102 -# define PEM_R_BAD_IV_CHARS 103 -# define PEM_R_BAD_MAGIC_NUMBER 116 -# define PEM_R_BAD_PASSWORD_READ 104 -# define PEM_R_BAD_VERSION_NUMBER 117 -# define PEM_R_BIO_WRITE_FAILURE 118 -# define PEM_R_CIPHER_IS_NULL 127 -# define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 -# define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 -# define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 -# define PEM_R_HEADER_TOO_LONG 128 -# define PEM_R_INCONSISTENT_HEADER 121 -# define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 -# define PEM_R_KEYBLOB_TOO_SHORT 123 -# define PEM_R_MISSING_DEK_IV 129 -# define PEM_R_NOT_DEK_INFO 105 -# define PEM_R_NOT_ENCRYPTED 106 -# define PEM_R_NOT_PROC_TYPE 107 -# define PEM_R_NO_START_LINE 108 -# define PEM_R_PROBLEMS_GETTING_PASSWORD 109 -# define PEM_R_PVK_DATA_TOO_SHORT 124 -# define PEM_R_PVK_TOO_SHORT 125 -# define PEM_R_READ_KEY 111 -# define PEM_R_SHORT_HEADER 112 -# define PEM_R_UNEXPECTED_DEK_IV 130 -# define PEM_R_UNSUPPORTED_CIPHER 113 -# define PEM_R_UNSUPPORTED_ENCRYPTION 114 -# define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs12.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs12.h deleted file mode 100644 index 3f43dad6..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs12.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 1999-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_PKCS12_H -# define HEADER_PKCS12_H - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define PKCS12_KEY_ID 1 -# define PKCS12_IV_ID 2 -# define PKCS12_MAC_ID 3 - -/* Default iteration count */ -# ifndef PKCS12_DEFAULT_ITER -# define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER -# endif - -# define PKCS12_MAC_KEY_LENGTH 20 - -# define PKCS12_SALT_LEN 8 - -/* It's not clear if these are actually needed... */ -# define PKCS12_key_gen PKCS12_key_gen_utf8 -# define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8 - -/* MS key usage constants */ - -# define KEY_EX 0x10 -# define KEY_SIG 0x80 - -typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; - -typedef struct PKCS12_st PKCS12; - -typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; - -DEFINE_STACK_OF(PKCS12_SAFEBAG) - -typedef struct pkcs12_bag_st PKCS12_BAGS; - -# define PKCS12_ERROR 0 -# define PKCS12_OK 1 - -/* Compatibility macros */ - -#if OPENSSL_API_COMPAT < 0x10100000L - -# define M_PKCS12_bag_type PKCS12_bag_type -# define M_PKCS12_cert_bag_type PKCS12_cert_bag_type -# define M_PKCS12_crl_bag_type PKCS12_cert_bag_type - -# define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert -# define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl -# define PKCS12_bag_type PKCS12_SAFEBAG_get_nid -# define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid -# define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert -# define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl -# define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf -# define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt - -#endif - -DEPRECATEDIN_1_1_0(ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, int attr_nid)) - -ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid); -int PKCS12_mac_present(const PKCS12 *p12); -void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, - const X509_ALGOR **pmacalg, - const ASN1_OCTET_STRING **psalt, - const ASN1_INTEGER **piter, - const PKCS12 *p12); - -const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, - int attr_nid); -const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); -int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag); -int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag); - -X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag); -X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag); -const STACK_OF(PKCS12_SAFEBAG) * -PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); -const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag); -const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag); - -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, - const char *pass, - int passlen, - unsigned char *salt, - int saltlen, int iter, - PKCS8_PRIV_KEY_INFO *p8inf); - -PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, - int nid1, int nid2); -PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, - int passlen); -PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag, - const char *pass, int passlen); -X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, - const char *pass, int passlen, unsigned char *salt, - int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); -X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen, - PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe); -PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); -STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); -PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, - unsigned char *salt, int saltlen, int iter, - STACK_OF(PKCS12_SAFEBAG) *bags); -STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, - int passlen); - -int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); -STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12); - -int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, - int namelen); -int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, - int namelen); -int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, - const unsigned char *name, int namelen); -int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); -ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, - int attr_nid); -char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); -const STACK_OF(X509_ATTRIBUTE) * -PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag); -unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, - const char *pass, int passlen, - const unsigned char *in, int inlen, - unsigned char **data, int *datalen, - int en_de); -void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, - const char *pass, int passlen, - const ASN1_OCTET_STRING *oct, int zbuf); -ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, - const ASN1_ITEM *it, - const char *pass, int passlen, - void *obj, int zbuf); -PKCS12 *PKCS12_init(int mode); -int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, - int saltlen, int id, int iter, int n, - unsigned char *out, const EVP_MD *md_type); -int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, - ASN1_TYPE *param, const EVP_CIPHER *cipher, - const EVP_MD *md_type, int en_de); -int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, - unsigned char *mac, unsigned int *maclen); -int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); -int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, - unsigned char *salt, int saltlen, int iter, - const EVP_MD *md_type); -int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, - int saltlen, const EVP_MD *md_type); -unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, - unsigned char **uni, int *unilen); -char *OPENSSL_uni2asc(const unsigned char *uni, int unilen); -unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, - unsigned char **uni, int *unilen); -char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen); - -DECLARE_ASN1_FUNCTIONS(PKCS12) -DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) -DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) -DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) - -DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) -DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) - -void PKCS12_PBE_add(void); -int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, - STACK_OF(X509) **ca); -PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, - X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, - int iter, int mac_iter, int keytype); - -PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); -PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, - EVP_PKEY *key, int key_usage, int iter, - int key_nid, const char *pass); -int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, - int safe_nid, int iter, const char *pass); -PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); - -int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); -# ifndef OPENSSL_NO_STDIO -int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); -# endif -PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); -# ifndef OPENSSL_NO_STDIO -PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); -# endif -int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs12err.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs12err.h deleted file mode 100644 index eff5eb26..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs12err.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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_PKCS12ERR_H -# define HEADER_PKCS12ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PKCS12_strings(void); - -/* - * PKCS12 function codes. - */ -# define PKCS12_F_OPENSSL_ASC2UNI 121 -# define PKCS12_F_OPENSSL_UNI2ASC 124 -# define PKCS12_F_OPENSSL_UNI2UTF8 127 -# define PKCS12_F_OPENSSL_UTF82UNI 129 -# define PKCS12_F_PKCS12_CREATE 105 -# define PKCS12_F_PKCS12_GEN_MAC 107 -# define PKCS12_F_PKCS12_INIT 109 -# define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 -# define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 -# define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 -# define PKCS12_F_PKCS12_KEY_GEN_ASC 110 -# define PKCS12_F_PKCS12_KEY_GEN_UNI 111 -# define PKCS12_F_PKCS12_KEY_GEN_UTF8 116 -# define PKCS12_F_PKCS12_NEWPASS 128 -# define PKCS12_F_PKCS12_PACK_P7DATA 114 -# define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 -# define PKCS12_F_PKCS12_PARSE 118 -# define PKCS12_F_PKCS12_PBE_CRYPT 119 -# define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 112 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 113 -# define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 133 -# define PKCS12_F_PKCS12_SETUP_MAC 122 -# define PKCS12_F_PKCS12_SET_MAC 123 -# define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 -# define PKCS12_F_PKCS12_UNPACK_P7DATA 131 -# define PKCS12_F_PKCS12_VERIFY_MAC 126 -# define PKCS12_F_PKCS8_ENCRYPT 125 -# define PKCS12_F_PKCS8_SET0_PBE 132 - -/* - * PKCS12 reason codes. - */ -# define PKCS12_R_CANT_PACK_STRUCTURE 100 -# define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 -# define PKCS12_R_DECODE_ERROR 101 -# define PKCS12_R_ENCODE_ERROR 102 -# define PKCS12_R_ENCRYPT_ERROR 103 -# define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 -# define PKCS12_R_INVALID_NULL_ARGUMENT 104 -# define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 -# define PKCS12_R_IV_GEN_ERROR 106 -# define PKCS12_R_KEY_GEN_ERROR 107 -# define PKCS12_R_MAC_ABSENT 108 -# define PKCS12_R_MAC_GENERATION_ERROR 109 -# define PKCS12_R_MAC_SETUP_ERROR 110 -# define PKCS12_R_MAC_STRING_SET_ERROR 111 -# define PKCS12_R_MAC_VERIFY_FAILURE 113 -# define PKCS12_R_PARSE_ERROR 114 -# define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 -# define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 -# define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 -# define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 -# define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs7.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs7.h deleted file mode 100644 index 9b66e002..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs7.h +++ /dev/null @@ -1,319 +0,0 @@ -/* - * 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_PKCS7_H -# define HEADER_PKCS7_H - -# include -# include -# include - -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- -Encryption_ID DES-CBC -Digest_ID MD5 -Digest_Encryption_ID rsaEncryption -Key_Encryption_ID rsaEncryption -*/ - -typedef struct pkcs7_issuer_and_serial_st { - X509_NAME *issuer; - ASN1_INTEGER *serial; -} PKCS7_ISSUER_AND_SERIAL; - -typedef struct pkcs7_signer_info_st { - ASN1_INTEGER *version; /* version 1 */ - PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; - X509_ALGOR *digest_alg; - STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ - X509_ALGOR *digest_enc_alg; - ASN1_OCTET_STRING *enc_digest; - STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ - /* The private key to sign with */ - EVP_PKEY *pkey; -} PKCS7_SIGNER_INFO; - -DEFINE_STACK_OF(PKCS7_SIGNER_INFO) - -typedef struct pkcs7_recip_info_st { - ASN1_INTEGER *version; /* version 0 */ - PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; - X509_ALGOR *key_enc_algor; - ASN1_OCTET_STRING *enc_key; - X509 *cert; /* get the pub-key from this */ -} PKCS7_RECIP_INFO; - -DEFINE_STACK_OF(PKCS7_RECIP_INFO) - -typedef struct pkcs7_signed_st { - ASN1_INTEGER *version; /* version 1 */ - STACK_OF(X509_ALGOR) *md_algs; /* md used */ - STACK_OF(X509) *cert; /* [ 0 ] */ - STACK_OF(X509_CRL) *crl; /* [ 1 ] */ - STACK_OF(PKCS7_SIGNER_INFO) *signer_info; - struct pkcs7_st *contents; -} PKCS7_SIGNED; -/* - * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about - * merging the two - */ - -typedef struct pkcs7_enc_content_st { - ASN1_OBJECT *content_type; - X509_ALGOR *algorithm; - ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ - const EVP_CIPHER *cipher; -} PKCS7_ENC_CONTENT; - -typedef struct pkcs7_enveloped_st { - ASN1_INTEGER *version; /* version 0 */ - STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; - PKCS7_ENC_CONTENT *enc_data; -} PKCS7_ENVELOPE; - -typedef struct pkcs7_signedandenveloped_st { - ASN1_INTEGER *version; /* version 1 */ - STACK_OF(X509_ALGOR) *md_algs; /* md used */ - STACK_OF(X509) *cert; /* [ 0 ] */ - STACK_OF(X509_CRL) *crl; /* [ 1 ] */ - STACK_OF(PKCS7_SIGNER_INFO) *signer_info; - PKCS7_ENC_CONTENT *enc_data; - STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; -} PKCS7_SIGN_ENVELOPE; - -typedef struct pkcs7_digest_st { - ASN1_INTEGER *version; /* version 0 */ - X509_ALGOR *md; /* md used */ - struct pkcs7_st *contents; - ASN1_OCTET_STRING *digest; -} PKCS7_DIGEST; - -typedef struct pkcs7_encrypted_st { - ASN1_INTEGER *version; /* version 0 */ - PKCS7_ENC_CONTENT *enc_data; -} PKCS7_ENCRYPT; - -typedef struct pkcs7_st { - /* - * The following is non NULL if it contains ASN1 encoding of this - * structure - */ - unsigned char *asn1; - long length; -# define PKCS7_S_HEADER 0 -# define PKCS7_S_BODY 1 -# define PKCS7_S_TAIL 2 - int state; /* used during processing */ - int detached; - ASN1_OBJECT *type; - /* content as defined by the type */ - /* - * all encryption/message digests are applied to the 'contents', leaving - * out the 'type' field. - */ - union { - char *ptr; - /* NID_pkcs7_data */ - ASN1_OCTET_STRING *data; - /* NID_pkcs7_signed */ - PKCS7_SIGNED *sign; - /* NID_pkcs7_enveloped */ - PKCS7_ENVELOPE *enveloped; - /* NID_pkcs7_signedAndEnveloped */ - PKCS7_SIGN_ENVELOPE *signed_and_enveloped; - /* NID_pkcs7_digest */ - PKCS7_DIGEST *digest; - /* NID_pkcs7_encrypted */ - PKCS7_ENCRYPT *encrypted; - /* Anything else */ - ASN1_TYPE *other; - } d; -} PKCS7; - -DEFINE_STACK_OF(PKCS7) - -# define PKCS7_OP_SET_DETACHED_SIGNATURE 1 -# define PKCS7_OP_GET_DETACHED_SIGNATURE 2 - -# define PKCS7_get_signed_attributes(si) ((si)->auth_attr) -# define PKCS7_get_attributes(si) ((si)->unauth_attr) - -# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) -# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) -# define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) -# define PKCS7_type_is_signedAndEnveloped(a) \ - (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) -# define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) -# define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) - -# define PKCS7_set_detached(p,v) \ - PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) -# define PKCS7_get_detached(p) \ - PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) - -# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) - -/* S/MIME related flags */ - -# define PKCS7_TEXT 0x1 -# define PKCS7_NOCERTS 0x2 -# define PKCS7_NOSIGS 0x4 -# define PKCS7_NOCHAIN 0x8 -# define PKCS7_NOINTERN 0x10 -# define PKCS7_NOVERIFY 0x20 -# define PKCS7_DETACHED 0x40 -# define PKCS7_BINARY 0x80 -# define PKCS7_NOATTR 0x100 -# define PKCS7_NOSMIMECAP 0x200 -# define PKCS7_NOOLDMIMETYPE 0x400 -# define PKCS7_CRLFEOL 0x800 -# define PKCS7_STREAM 0x1000 -# define PKCS7_NOCRL 0x2000 -# define PKCS7_PARTIAL 0x4000 -# define PKCS7_REUSE_DIGEST 0x8000 -# define PKCS7_NO_DUAL_CONTENT 0x10000 - -/* Flags: for compatibility with older code */ - -# define SMIME_TEXT PKCS7_TEXT -# define SMIME_NOCERTS PKCS7_NOCERTS -# define SMIME_NOSIGS PKCS7_NOSIGS -# define SMIME_NOCHAIN PKCS7_NOCHAIN -# define SMIME_NOINTERN PKCS7_NOINTERN -# define SMIME_NOVERIFY PKCS7_NOVERIFY -# define SMIME_DETACHED PKCS7_DETACHED -# define SMIME_BINARY PKCS7_BINARY -# define SMIME_NOATTR PKCS7_NOATTR - -/* CRLF ASCII canonicalisation */ -# define SMIME_ASCIICRLF 0x80000 - -DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) - -int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, - const EVP_MD *type, unsigned char *md, - unsigned int *len); -# ifndef OPENSSL_NO_STDIO -PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7); -int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7); -# endif -PKCS7 *PKCS7_dup(PKCS7 *p7); -PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7); -int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7); -int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); -int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); - -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) -DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) -DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) -DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) -DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) -DECLARE_ASN1_FUNCTIONS(PKCS7) - -DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) -DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) - -DECLARE_ASN1_NDEF_FUNCTION(PKCS7) -DECLARE_ASN1_PRINT_FUNCTION(PKCS7) - -long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); - -int PKCS7_set_type(PKCS7 *p7, int type); -int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); -int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); -int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, - const EVP_MD *dgst); -int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); -int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); -int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); -int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); -int PKCS7_content_new(PKCS7 *p7, int nid); -int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, - BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); -int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, - X509 *x509); - -BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); -int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); -BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); - -PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, - EVP_PKEY *pkey, const EVP_MD *dgst); -X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); -int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); -STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); - -PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); -void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, - X509_ALGOR **pdig, X509_ALGOR **psig); -void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); -int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); -int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); -int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); -int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); - -PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); -ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); -int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, - void *data); -int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, - void *value); -ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); -ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); -int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, - STACK_OF(X509_ATTRIBUTE) *sk); -int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, - STACK_OF(X509_ATTRIBUTE) *sk); - -PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, - BIO *data, int flags); - -PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, - X509 *signcert, EVP_PKEY *pkey, - const EVP_MD *md, int flags); - -int PKCS7_final(PKCS7 *p7, BIO *data, int flags); -int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, - BIO *indata, BIO *out, int flags); -STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, - int flags); -PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, - int flags); -int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, - int flags); - -int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, - STACK_OF(X509_ALGOR) *cap); -STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); -int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); - -int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); -int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); -int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, - const unsigned char *md, int mdlen); - -int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); -PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); - -BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs7err.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs7err.h deleted file mode 100644 index 02e0299a..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/pkcs7err.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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_PKCS7ERR_H -# define HEADER_PKCS7ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_PKCS7_strings(void); - -/* - * PKCS7 function codes. - */ -# define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 -# define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 -# define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 -# define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 -# define PKCS7_F_PKCS7_ADD_CRL 101 -# define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 -# define PKCS7_F_PKCS7_ADD_SIGNATURE 131 -# define PKCS7_F_PKCS7_ADD_SIGNER 103 -# define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 -# define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 -# define PKCS7_F_PKCS7_CTRL 104 -# define PKCS7_F_PKCS7_DATADECODE 112 -# define PKCS7_F_PKCS7_DATAFINAL 128 -# define PKCS7_F_PKCS7_DATAINIT 105 -# define PKCS7_F_PKCS7_DATAVERIFY 107 -# define PKCS7_F_PKCS7_DECRYPT 114 -# define PKCS7_F_PKCS7_DECRYPT_RINFO 133 -# define PKCS7_F_PKCS7_ENCODE_RINFO 132 -# define PKCS7_F_PKCS7_ENCRYPT 115 -# define PKCS7_F_PKCS7_FINAL 134 -# define PKCS7_F_PKCS7_FIND_DIGEST 127 -# define PKCS7_F_PKCS7_GET0_SIGNERS 124 -# define PKCS7_F_PKCS7_RECIP_INFO_SET 130 -# define PKCS7_F_PKCS7_SET_CIPHER 108 -# define PKCS7_F_PKCS7_SET_CONTENT 109 -# define PKCS7_F_PKCS7_SET_DIGEST 126 -# define PKCS7_F_PKCS7_SET_TYPE 110 -# define PKCS7_F_PKCS7_SIGN 116 -# define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 -# define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 -# define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 -# define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 -# define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 -# define PKCS7_F_PKCS7_VERIFY 117 - -/* - * PKCS7 reason codes. - */ -# define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 -# define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 -# define PKCS7_R_CIPHER_NOT_INITIALIZED 116 -# define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 -# define PKCS7_R_CTRL_ERROR 152 -# define PKCS7_R_DECRYPT_ERROR 119 -# define PKCS7_R_DIGEST_FAILURE 101 -# define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 -# define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 -# define PKCS7_R_ERROR_ADDING_RECIPIENT 120 -# define PKCS7_R_ERROR_SETTING_CIPHER 121 -# define PKCS7_R_INVALID_NULL_POINTER 143 -# define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 -# define PKCS7_R_NO_CONTENT 122 -# define PKCS7_R_NO_DEFAULT_DIGEST 151 -# define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 -# define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 -# define PKCS7_R_NO_SIGNATURES_ON_DATA 123 -# define PKCS7_R_NO_SIGNERS 142 -# define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 -# define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 -# define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 -# define PKCS7_R_PKCS7_DATASIGN 145 -# define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 -# define PKCS7_R_SIGNATURE_FAILURE 105 -# define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 -# define PKCS7_R_SIGNING_CTRL_FAILURE 147 -# define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 -# define PKCS7_R_SMIME_TEXT_ERROR 129 -# define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 -# define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 -# define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 -# define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 -# define PKCS7_R_UNKNOWN_OPERATION 110 -# define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 -# define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 -# define PKCS7_R_WRONG_CONTENT_TYPE 113 -# define PKCS7_R_WRONG_PKCS7_TYPE 114 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rand.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/rand.h deleted file mode 100644 index 38a2a271..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rand.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1995-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_RAND_H -# define HEADER_RAND_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -struct rand_meth_st { - int (*seed) (const void *buf, int num); - int (*bytes) (unsigned char *buf, int num); - void (*cleanup) (void); - int (*add) (const void *buf, int num, double randomness); - int (*pseudorand) (unsigned char *buf, int num); - int (*status) (void); -}; - -int RAND_set_rand_method(const RAND_METHOD *meth); -const RAND_METHOD *RAND_get_rand_method(void); -# ifndef OPENSSL_NO_ENGINE -int RAND_set_rand_engine(ENGINE *engine); -# endif - -RAND_METHOD *RAND_OpenSSL(void); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define RAND_cleanup() while(0) continue -# endif -int RAND_bytes(unsigned char *buf, int num); -int RAND_priv_bytes(unsigned char *buf, int num); -DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) - -void RAND_seed(const void *buf, int num); -void RAND_keep_random_devices_open(int keep); - -# if defined(__ANDROID__) && defined(__NDK_FPABI__) -__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ -# endif -void RAND_add(const void *buf, int num, double randomness); -int RAND_load_file(const char *file, long max_bytes); -int RAND_write_file(const char *file); -const char *RAND_file_name(char *file, size_t num); -int RAND_status(void); - -# ifndef OPENSSL_NO_EGD -int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); -int RAND_egd(const char *path); -int RAND_egd_bytes(const char *path, int bytes); -# endif - -int RAND_poll(void); - -# if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) -/* application has to include in order to use these */ -DEPRECATEDIN_1_1_0(void RAND_screen(void)) -DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) -# endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rand_drbg.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/rand_drbg.h deleted file mode 100644 index 45b731b7..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rand_drbg.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2017-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_DRBG_RAND_H -# define HEADER_DRBG_RAND_H - -# include -# include -# include - -/* - * RAND_DRBG flags - * - * Note: if new flags are added, the constant `rand_drbg_used_flags` - * in drbg_lib.c needs to be updated accordingly. - */ - -/* In CTR mode, disable derivation function ctr_df */ -# define RAND_DRBG_FLAG_CTR_NO_DF 0x1 - - -# if OPENSSL_API_COMPAT < 0x10200000L -/* This #define was replaced by an internal constant and should not be used. */ -# define RAND_DRBG_USED_FLAGS (RAND_DRBG_FLAG_CTR_NO_DF) -# endif - -/* - * Default security strength (in the sense of [NIST SP 800-90Ar1]) - * - * NIST SP 800-90Ar1 supports the strength of the DRBG being smaller than that - * of the cipher by collecting less entropy. The current DRBG implementation - * does not take RAND_DRBG_STRENGTH into account and sets the strength of the - * DRBG to that of the cipher. - * - * RAND_DRBG_STRENGTH is currently only used for the legacy RAND - * implementation. - * - * Currently supported ciphers are: NID_aes_128_ctr, NID_aes_192_ctr and - * NID_aes_256_ctr - */ -# define RAND_DRBG_STRENGTH 256 -/* Default drbg type */ -# define RAND_DRBG_TYPE NID_aes_256_ctr -/* Default drbg flags */ -# define RAND_DRBG_FLAGS 0 - - -# ifdef __cplusplus -extern "C" { -# endif - -/* - * Object lifetime functions. - */ -RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent); -RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent); -int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags); -int RAND_DRBG_set_defaults(int type, unsigned int flags); -int RAND_DRBG_instantiate(RAND_DRBG *drbg, - const unsigned char *pers, size_t perslen); -int RAND_DRBG_uninstantiate(RAND_DRBG *drbg); -void RAND_DRBG_free(RAND_DRBG *drbg); - -/* - * Object "use" functions. - */ -int RAND_DRBG_reseed(RAND_DRBG *drbg, - const unsigned char *adin, size_t adinlen, - int prediction_resistance); -int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, - int prediction_resistance, - const unsigned char *adin, size_t adinlen); -int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen); - -int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, unsigned int interval); -int RAND_DRBG_set_reseed_time_interval(RAND_DRBG *drbg, time_t interval); - -int RAND_DRBG_set_reseed_defaults( - unsigned int master_reseed_interval, - unsigned int slave_reseed_interval, - time_t master_reseed_time_interval, - time_t slave_reseed_time_interval - ); - -RAND_DRBG *RAND_DRBG_get0_master(void); -RAND_DRBG *RAND_DRBG_get0_public(void); -RAND_DRBG *RAND_DRBG_get0_private(void); - -/* - * EXDATA - */ -# define RAND_DRBG_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DRBG, l, p, newf, dupf, freef) -int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *arg); -void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx); - -/* - * Callback function typedefs - */ -typedef size_t (*RAND_DRBG_get_entropy_fn)(RAND_DRBG *drbg, - unsigned char **pout, - int entropy, size_t min_len, - size_t max_len, - int prediction_resistance); -typedef void (*RAND_DRBG_cleanup_entropy_fn)(RAND_DRBG *ctx, - unsigned char *out, size_t outlen); -typedef size_t (*RAND_DRBG_get_nonce_fn)(RAND_DRBG *drbg, unsigned char **pout, - int entropy, size_t min_len, - size_t max_len); -typedef void (*RAND_DRBG_cleanup_nonce_fn)(RAND_DRBG *drbg, - unsigned char *out, size_t outlen); - -int RAND_DRBG_set_callbacks(RAND_DRBG *drbg, - RAND_DRBG_get_entropy_fn get_entropy, - RAND_DRBG_cleanup_entropy_fn cleanup_entropy, - RAND_DRBG_get_nonce_fn get_nonce, - RAND_DRBG_cleanup_nonce_fn cleanup_nonce); - - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/randerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/randerr.h deleted file mode 100644 index 79d57905..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/randerr.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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_RANDERR_H -# define HEADER_RANDERR_H - -# include - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_RAND_strings(void); - -/* - * RAND function codes. - */ -# define RAND_F_DATA_COLLECT_METHOD 127 -# define RAND_F_DRBG_BYTES 101 -# define RAND_F_DRBG_GET_ENTROPY 105 -# define RAND_F_DRBG_SETUP 117 -# define RAND_F_GET_ENTROPY 106 -# define RAND_F_RAND_BYTES 100 -# define RAND_F_RAND_DRBG_ENABLE_LOCKING 119 -# define RAND_F_RAND_DRBG_GENERATE 107 -# define RAND_F_RAND_DRBG_GET_ENTROPY 120 -# define RAND_F_RAND_DRBG_GET_NONCE 123 -# define RAND_F_RAND_DRBG_INSTANTIATE 108 -# define RAND_F_RAND_DRBG_NEW 109 -# define RAND_F_RAND_DRBG_RESEED 110 -# define RAND_F_RAND_DRBG_RESTART 102 -# define RAND_F_RAND_DRBG_SET 104 -# define RAND_F_RAND_DRBG_SET_DEFAULTS 121 -# define RAND_F_RAND_DRBG_UNINSTANTIATE 118 -# define RAND_F_RAND_LOAD_FILE 111 -# define RAND_F_RAND_POOL_ACQUIRE_ENTROPY 122 -# define RAND_F_RAND_POOL_ADD 103 -# define RAND_F_RAND_POOL_ADD_BEGIN 113 -# define RAND_F_RAND_POOL_ADD_END 114 -# define RAND_F_RAND_POOL_ATTACH 124 -# define RAND_F_RAND_POOL_BYTES_NEEDED 115 -# define RAND_F_RAND_POOL_GROW 125 -# define RAND_F_RAND_POOL_NEW 116 -# define RAND_F_RAND_PSEUDO_BYTES 126 -# define RAND_F_RAND_WRITE_FILE 112 - -/* - * RAND reason codes. - */ -# define RAND_R_ADDITIONAL_INPUT_TOO_LONG 102 -# define RAND_R_ALREADY_INSTANTIATED 103 -# define RAND_R_ARGUMENT_OUT_OF_RANGE 105 -# define RAND_R_CANNOT_OPEN_FILE 121 -# define RAND_R_DRBG_ALREADY_INITIALIZED 129 -# define RAND_R_DRBG_NOT_INITIALISED 104 -# define RAND_R_ENTROPY_INPUT_TOO_LONG 106 -# define RAND_R_ENTROPY_OUT_OF_RANGE 124 -# define RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED 127 -# define RAND_R_ERROR_INITIALISING_DRBG 107 -# define RAND_R_ERROR_INSTANTIATING_DRBG 108 -# define RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 109 -# define RAND_R_ERROR_RETRIEVING_ENTROPY 110 -# define RAND_R_ERROR_RETRIEVING_NONCE 111 -# define RAND_R_FAILED_TO_CREATE_LOCK 126 -# define RAND_R_FUNC_NOT_IMPLEMENTED 101 -# define RAND_R_FWRITE_ERROR 123 -# define RAND_R_GENERATE_ERROR 112 -# define RAND_R_INTERNAL_ERROR 113 -# define RAND_R_IN_ERROR_STATE 114 -# define RAND_R_NOT_A_REGULAR_FILE 122 -# define RAND_R_NOT_INSTANTIATED 115 -# define RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED 128 -# define RAND_R_PARENT_LOCKING_NOT_ENABLED 130 -# define RAND_R_PARENT_STRENGTH_TOO_WEAK 131 -# define RAND_R_PERSONALISATION_STRING_TOO_LONG 116 -# define RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED 133 -# define RAND_R_PRNG_NOT_SEEDED 100 -# define RAND_R_RANDOM_POOL_OVERFLOW 125 -# define RAND_R_RANDOM_POOL_UNDERFLOW 134 -# define RAND_R_REQUEST_TOO_LARGE_FOR_DRBG 117 -# define RAND_R_RESEED_ERROR 118 -# define RAND_R_SELFTEST_FAILURE 119 -# define RAND_R_TOO_LITTLE_NONCE_REQUESTED 135 -# define RAND_R_TOO_MUCH_NONCE_REQUESTED 136 -# define RAND_R_UNSUPPORTED_DRBG_FLAGS 132 -# define RAND_R_UNSUPPORTED_DRBG_TYPE 120 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rc2.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/rc2.h deleted file mode 100644 index 585f9e4c..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rc2.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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_RC2_H -# define HEADER_RC2_H - -# include - -# ifndef OPENSSL_NO_RC2 -# ifdef __cplusplus -extern "C" { -# endif - -typedef unsigned int RC2_INT; - -# define RC2_ENCRYPT 1 -# define RC2_DECRYPT 0 - -# define RC2_BLOCK 8 -# define RC2_KEY_LENGTH 16 - -typedef struct rc2_key_st { - RC2_INT data[64]; -} RC2_KEY; - -void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); -void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, - RC2_KEY *key, int enc); -void RC2_encrypt(unsigned long *data, RC2_KEY *key); -void RC2_decrypt(unsigned long *data, RC2_KEY *key); -void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, - RC2_KEY *ks, unsigned char *iv, int enc); -void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num, int enc); -void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC2_KEY *schedule, unsigned char *ivec, - int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rc4.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/rc4.h deleted file mode 100644 index 86803b37..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rc4.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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_RC4_H -# define HEADER_RC4_H - -# include - -# ifndef OPENSSL_NO_RC4 -# include -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct rc4_key_st { - RC4_INT x, y; - RC4_INT data[256]; -} RC4_KEY; - -const char *RC4_options(void); -void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); -void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, - unsigned char *outdata); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rc5.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/rc5.h deleted file mode 100644 index 793f88e4..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rc5.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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_RC5_H -# define HEADER_RC5_H - -# include - -# ifndef OPENSSL_NO_RC5 -# ifdef __cplusplus -extern "C" { -# endif - -# define RC5_ENCRYPT 1 -# define RC5_DECRYPT 0 - -# define RC5_32_INT unsigned int - -# define RC5_32_BLOCK 8 -# define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ - -/* - * This are the only values supported. Tweak the code if you want more The - * most supported modes will be RC5-32/12/16 RC5-32/16/8 - */ -# define RC5_8_ROUNDS 8 -# define RC5_12_ROUNDS 12 -# define RC5_16_ROUNDS 16 - -typedef struct rc5_key_st { - /* Number of rounds */ - int rounds; - RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; -} RC5_32_KEY; - -void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, - int rounds); -void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, - RC5_32_KEY *key, int enc); -void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); -void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *ks, unsigned char *iv, - int enc); -void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num, int enc); -void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, - long length, RC5_32_KEY *schedule, - unsigned char *ivec, int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ripemd.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ripemd.h deleted file mode 100644 index c42026aa..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ripemd.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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_RIPEMD_H -# define HEADER_RIPEMD_H - -# include - -#ifndef OPENSSL_NO_RMD160 -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define RIPEMD160_LONG unsigned int - -# define RIPEMD160_CBLOCK 64 -# define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) -# define RIPEMD160_DIGEST_LENGTH 20 - -typedef struct RIPEMD160state_st { - RIPEMD160_LONG A, B, C, D, E; - RIPEMD160_LONG Nl, Nh; - RIPEMD160_LONG data[RIPEMD160_LBLOCK]; - unsigned int num; -} RIPEMD160_CTX; - -int RIPEMD160_Init(RIPEMD160_CTX *c); -int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); -int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); -unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); -void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); - -# ifdef __cplusplus -} -# endif -# endif - - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rsa.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/rsa.h deleted file mode 100644 index 5e76365c..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rsa.h +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Copyright 1995-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_RSA_H -# define HEADER_RSA_H - -# include - -# ifndef OPENSSL_NO_RSA -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# ifdef __cplusplus -extern "C" { -# endif - -/* The types RSA and RSA_METHOD are defined in ossl_typ.h */ - -# ifndef OPENSSL_RSA_MAX_MODULUS_BITS -# define OPENSSL_RSA_MAX_MODULUS_BITS 16384 -# endif - -# define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 - -# ifndef OPENSSL_RSA_SMALL_MODULUS_BITS -# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 -# endif -# ifndef OPENSSL_RSA_MAX_PUBEXP_BITS - -/* exponent limit enforced for "large" modulus only */ -# define OPENSSL_RSA_MAX_PUBEXP_BITS 64 -# endif - -# define RSA_3 0x3L -# define RSA_F4 0x10001L - -/* based on RFC 8017 appendix A.1.2 */ -# define RSA_ASN1_VERSION_DEFAULT 0 -# define RSA_ASN1_VERSION_MULTI 1 - -# define RSA_DEFAULT_PRIME_NUM 2 - -# define RSA_METHOD_FLAG_NO_CHECK 0x0001/* don't check pub/private - * match */ - -# define RSA_FLAG_CACHE_PUBLIC 0x0002 -# define RSA_FLAG_CACHE_PRIVATE 0x0004 -# define RSA_FLAG_BLINDING 0x0008 -# define RSA_FLAG_THREAD_SAFE 0x0010 -/* - * This flag means the private key operations will be handled by rsa_mod_exp - * and that they do not depend on the private key components being present: - * for example a key stored in external hardware. Without this flag - * bn_mod_exp gets called when private key components are absent. - */ -# define RSA_FLAG_EXT_PKEY 0x0020 - -/* - * new with 0.9.6j and 0.9.7b; the built-in - * RSA implementation now uses blinding by - * default (ignoring RSA_FLAG_BLINDING), - * but other engines might not need it - */ -# define RSA_FLAG_NO_BLINDING 0x0080 -# if OPENSSL_API_COMPAT < 0x10100000L -/* - * Does nothing. Previously this switched off constant time behaviour. - */ -# define RSA_FLAG_NO_CONSTTIME 0x0000 -# endif -# if OPENSSL_API_COMPAT < 0x00908000L -/* deprecated name for the flag*/ -/* - * new with 0.9.7h; the built-in RSA - * implementation now uses constant time - * modular exponentiation for secret exponents - * by default. This flag causes the - * faster variable sliding window method to - * be used for all exponents. - */ -# define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME -# endif - -# define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ - RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_RSA_PADDING, pad, NULL) - -# define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \ - RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad) - -# define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ - RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ - EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) -/* Salt length matches digest */ -# define RSA_PSS_SALTLEN_DIGEST -1 -/* Verify only: auto detect salt length */ -# define RSA_PSS_SALTLEN_AUTO -2 -/* Set salt length to maximum possible */ -# define RSA_PSS_SALTLEN_MAX -3 -/* Old compatible max salt length for sign only */ -# define RSA_PSS_SALTLEN_MAX_SIGN -2 - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, len) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) - -# define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \ - RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ - EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, 0, plen) - -# define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) - -# define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp) - -# define EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, primes) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES, primes, NULL) - -# define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ - EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)(md)) - -# define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \ - RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)(pmd)) - -# define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)(l)) - -# define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ - EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)(l)) - -# define EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md) \ - EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, \ - EVP_PKEY_OP_KEYGEN, EVP_PKEY_CTRL_MD, \ - 0, (void *)(md)) - -# define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) -# define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) - -# define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) -# define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) -# define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) - -# define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) -# define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) -# define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) - -# define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) -# define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) - -# define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) -# define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) - -# define EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES (EVP_PKEY_ALG_CTRL + 13) - -# define RSA_PKCS1_PADDING 1 -# define RSA_SSLV23_PADDING 2 -# define RSA_NO_PADDING 3 -# define RSA_PKCS1_OAEP_PADDING 4 -# define RSA_X931_PADDING 5 -/* EVP_PKEY_ only */ -# define RSA_PKCS1_PSS_PADDING 6 - -# define RSA_PKCS1_PADDING_SIZE 11 - -# define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) -# define RSA_get_app_data(s) RSA_get_ex_data(s,0) - -RSA *RSA_new(void); -RSA *RSA_new_method(ENGINE *engine); -int RSA_bits(const RSA *rsa); -int RSA_size(const RSA *rsa); -int RSA_security_bits(const RSA *rsa); - -int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); -int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); -int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); -int RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[], - BIGNUM *coeffs[], int pnum); -void RSA_get0_key(const RSA *r, - const BIGNUM **n, const BIGNUM **e, const BIGNUM **d); -void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); -int RSA_get_multi_prime_extra_count(const RSA *r); -int RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]); -void RSA_get0_crt_params(const RSA *r, - const BIGNUM **dmp1, const BIGNUM **dmq1, - const BIGNUM **iqmp); -int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[], - const BIGNUM *coeffs[]); -const BIGNUM *RSA_get0_n(const RSA *d); -const BIGNUM *RSA_get0_e(const RSA *d); -const BIGNUM *RSA_get0_d(const RSA *d); -const BIGNUM *RSA_get0_p(const RSA *d); -const BIGNUM *RSA_get0_q(const RSA *d); -const BIGNUM *RSA_get0_dmp1(const RSA *r); -const BIGNUM *RSA_get0_dmq1(const RSA *r); -const BIGNUM *RSA_get0_iqmp(const RSA *r); -const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); -void RSA_clear_flags(RSA *r, int flags); -int RSA_test_flags(const RSA *r, int flags); -void RSA_set_flags(RSA *r, int flags); -int RSA_get_version(RSA *r); -ENGINE *RSA_get0_engine(const RSA *r); - -/* Deprecated version */ -DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void - (*callback) (int, int, void *), - void *cb_arg)) - -/* New version */ -int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); -/* Multi-prime version */ -int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, - BIGNUM *e, BN_GENCB *cb); - -int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, - BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2, - const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2, - const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb); -int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, - BN_GENCB *cb); - -int RSA_check_key(const RSA *); -int RSA_check_key_ex(const RSA *, BN_GENCB *cb); - /* next 4 return -1 on error */ -int RSA_public_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_private_encrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_public_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_private_decrypt(int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -void RSA_free(RSA *r); -/* "up" the RSA object's reference count */ -int RSA_up_ref(RSA *r); - -int RSA_flags(const RSA *r); - -void RSA_set_default_method(const RSA_METHOD *meth); -const RSA_METHOD *RSA_get_default_method(void); -const RSA_METHOD *RSA_null_method(void); -const RSA_METHOD *RSA_get_method(const RSA *rsa); -int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); - -/* these are the actual RSA functions */ -const RSA_METHOD *RSA_PKCS1_OpenSSL(void); - -int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); - -DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) -DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) - -struct rsa_pss_params_st { - X509_ALGOR *hashAlgorithm; - X509_ALGOR *maskGenAlgorithm; - ASN1_INTEGER *saltLength; - ASN1_INTEGER *trailerField; - /* Decoded hash algorithm from maskGenAlgorithm */ - X509_ALGOR *maskHash; -}; - -DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) - -typedef struct rsa_oaep_params_st { - X509_ALGOR *hashFunc; - X509_ALGOR *maskGenFunc; - X509_ALGOR *pSourceFunc; - /* Decoded hash algorithm from maskGenFunc */ - X509_ALGOR *maskHash; -} RSA_OAEP_PARAMS; - -DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) - -# ifndef OPENSSL_NO_STDIO -int RSA_print_fp(FILE *fp, const RSA *r, int offset); -# endif - -int RSA_print(BIO *bp, const RSA *r, int offset); - -/* - * The following 2 functions sign and verify a X509_SIG ASN1 object inside - * PKCS#1 padded RSA encryption - */ -int RSA_sign(int type, const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, RSA *rsa); -int RSA_verify(int type, const unsigned char *m, unsigned int m_length, - const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); - -/* - * The following 2 function sign and verify a ASN1_OCTET_STRING object inside - * PKCS#1 padded RSA encryption - */ -int RSA_sign_ASN1_OCTET_STRING(int type, - const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - RSA *rsa); -int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, - unsigned int m_length, unsigned char *sigbuf, - unsigned int siglen, RSA *rsa); - -int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); -void RSA_blinding_off(RSA *rsa); -BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); - -int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, - const unsigned char *f, int fl, - int rsa_len); -int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, - const unsigned char *f, int fl, - int rsa_len); -int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, - long seedlen, const EVP_MD *dgst); -int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, - const unsigned char *f, int fl, - const unsigned char *p, int pl); -int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len, - const unsigned char *p, int pl); -int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, - const unsigned char *from, int flen, - const unsigned char *param, int plen, - const EVP_MD *md, const EVP_MD *mgf1md); -int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, - const unsigned char *from, int flen, - int num, const unsigned char *param, - int plen, const EVP_MD *md, - const EVP_MD *mgf1md); -int RSA_padding_add_SSLv23(unsigned char *to, int tlen, - const unsigned char *f, int fl); -int RSA_padding_check_SSLv23(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f, - int fl); -int RSA_padding_check_none(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f, - int fl); -int RSA_padding_check_X931(unsigned char *to, int tlen, - const unsigned char *f, int fl, int rsa_len); -int RSA_X931_hash_id(int nid); - -int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, - const EVP_MD *Hash, const unsigned char *EM, - int sLen); -int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, - const unsigned char *mHash, const EVP_MD *Hash, - int sLen); - -int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - const unsigned char *EM, int sLen); - -int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, - const unsigned char *mHash, - const EVP_MD *Hash, const EVP_MD *mgf1Hash, - int sLen); - -#define RSA_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef) -int RSA_set_ex_data(RSA *r, int idx, void *arg); -void *RSA_get_ex_data(const RSA *r, int idx); - -RSA *RSAPublicKey_dup(RSA *rsa); -RSA *RSAPrivateKey_dup(RSA *rsa); - -/* - * If this flag is set the RSA method is FIPS compliant and can be used in - * FIPS mode. This is set in the validated module method. If an application - * sets this flag in its own methods it is its responsibility to ensure the - * result is compliant. - */ - -# define RSA_FLAG_FIPS_METHOD 0x0400 - -/* - * If this flag is set the operations normally disabled in FIPS mode are - * permitted it is then the applications responsibility to ensure that the - * usage is compliant. - */ - -# define RSA_FLAG_NON_FIPS_ALLOW 0x0400 -/* - * Application has decided PRNG is good enough to generate a key: don't - * check. - */ -# define RSA_FLAG_CHECKED 0x0800 - -RSA_METHOD *RSA_meth_new(const char *name, int flags); -void RSA_meth_free(RSA_METHOD *meth); -RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth); -const char *RSA_meth_get0_name(const RSA_METHOD *meth); -int RSA_meth_set1_name(RSA_METHOD *meth, const char *name); -int RSA_meth_get_flags(const RSA_METHOD *meth); -int RSA_meth_set_flags(RSA_METHOD *meth, int flags); -void *RSA_meth_get0_app_data(const RSA_METHOD *meth); -int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data); -int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_pub_enc(RSA_METHOD *rsa, - int (*pub_enc) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_pub_dec(RSA_METHOD *rsa, - int (*pub_dec) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_priv_enc(RSA_METHOD *rsa, - int (*priv_enc) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth)) - (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_meth_set_priv_dec(RSA_METHOD *rsa, - int (*priv_dec) (int flen, const unsigned char *from, - unsigned char *to, RSA *rsa, - int padding)); -int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth)) - (BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); -int RSA_meth_set_mod_exp(RSA_METHOD *rsa, - int (*mod_exp) (BIGNUM *r0, const BIGNUM *i, RSA *rsa, - BN_CTX *ctx)); -int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth)) - (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa, - int (*bn_mod_exp) (BIGNUM *r, - const BIGNUM *a, - const BIGNUM *p, - const BIGNUM *m, - BN_CTX *ctx, - BN_MONT_CTX *m_ctx)); -int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa); -int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa)); -int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa); -int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa)); -int (*RSA_meth_get_sign(const RSA_METHOD *meth)) - (int type, - const unsigned char *m, unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - const RSA *rsa); -int RSA_meth_set_sign(RSA_METHOD *rsa, - int (*sign) (int type, const unsigned char *m, - unsigned int m_length, - unsigned char *sigret, unsigned int *siglen, - const RSA *rsa)); -int (*RSA_meth_get_verify(const RSA_METHOD *meth)) - (int dtype, const unsigned char *m, - unsigned int m_length, const unsigned char *sigbuf, - unsigned int siglen, const RSA *rsa); -int RSA_meth_set_verify(RSA_METHOD *rsa, - int (*verify) (int dtype, const unsigned char *m, - unsigned int m_length, - const unsigned char *sigbuf, - unsigned int siglen, const RSA *rsa)); -int (*RSA_meth_get_keygen(const RSA_METHOD *meth)) - (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); -int RSA_meth_set_keygen(RSA_METHOD *rsa, - int (*keygen) (RSA *rsa, int bits, BIGNUM *e, - BN_GENCB *cb)); -int (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth)) - (RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb); -int RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth, - int (*keygen) (RSA *rsa, int bits, - int primes, BIGNUM *e, - BN_GENCB *cb)); - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rsaerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/rsaerr.h deleted file mode 100644 index 59b15e13..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/rsaerr.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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_RSAERR_H -# define HEADER_RSAERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_RSA_strings(void); - -/* - * RSA function codes. - */ -# define RSA_F_CHECK_PADDING_MD 140 -# define RSA_F_ENCODE_PKCS1 146 -# define RSA_F_INT_RSA_VERIFY 145 -# define RSA_F_OLD_RSA_PRIV_DECODE 147 -# define RSA_F_PKEY_PSS_INIT 165 -# define RSA_F_PKEY_RSA_CTRL 143 -# define RSA_F_PKEY_RSA_CTRL_STR 144 -# define RSA_F_PKEY_RSA_SIGN 142 -# define RSA_F_PKEY_RSA_VERIFY 149 -# define RSA_F_PKEY_RSA_VERIFYRECOVER 141 -# define RSA_F_RSA_ALGOR_TO_MD 156 -# define RSA_F_RSA_BUILTIN_KEYGEN 129 -# define RSA_F_RSA_CHECK_KEY 123 -# define RSA_F_RSA_CHECK_KEY_EX 160 -# define RSA_F_RSA_CMS_DECRYPT 159 -# define RSA_F_RSA_CMS_VERIFY 158 -# define RSA_F_RSA_ITEM_VERIFY 148 -# define RSA_F_RSA_METH_DUP 161 -# define RSA_F_RSA_METH_NEW 162 -# define RSA_F_RSA_METH_SET1_NAME 163 -# define RSA_F_RSA_MGF1_TO_MD 157 -# define RSA_F_RSA_MULTIP_INFO_NEW 166 -# define RSA_F_RSA_NEW_METHOD 106 -# define RSA_F_RSA_NULL 124 -# define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 -# define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 -# define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 -# define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 -# define RSA_F_RSA_OSSL_PRIVATE_DECRYPT 101 -# define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 102 -# define RSA_F_RSA_OSSL_PUBLIC_DECRYPT 103 -# define RSA_F_RSA_OSSL_PUBLIC_ENCRYPT 104 -# define RSA_F_RSA_PADDING_ADD_NONE 107 -# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 -# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 154 -# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 -# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 152 -# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 -# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 -# define RSA_F_RSA_PADDING_ADD_SSLV23 110 -# define RSA_F_RSA_PADDING_ADD_X931 127 -# define RSA_F_RSA_PADDING_CHECK_NONE 111 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 153 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 -# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 -# define RSA_F_RSA_PADDING_CHECK_SSLV23 114 -# define RSA_F_RSA_PADDING_CHECK_X931 128 -# define RSA_F_RSA_PARAM_DECODE 164 -# define RSA_F_RSA_PRINT 115 -# define RSA_F_RSA_PRINT_FP 116 -# define RSA_F_RSA_PRIV_DECODE 150 -# define RSA_F_RSA_PRIV_ENCODE 138 -# define RSA_F_RSA_PSS_GET_PARAM 151 -# define RSA_F_RSA_PSS_TO_CTX 155 -# define RSA_F_RSA_PUB_DECODE 139 -# define RSA_F_RSA_SETUP_BLINDING 136 -# define RSA_F_RSA_SIGN 117 -# define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 -# define RSA_F_RSA_VERIFY 119 -# define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 -# define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 126 -# define RSA_F_SETUP_TBUF 167 - -/* - * RSA reason codes. - */ -# define RSA_R_ALGORITHM_MISMATCH 100 -# define RSA_R_BAD_E_VALUE 101 -# define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 -# define RSA_R_BAD_PAD_BYTE_COUNT 103 -# define RSA_R_BAD_SIGNATURE 104 -# define RSA_R_BLOCK_TYPE_IS_NOT_01 106 -# define RSA_R_BLOCK_TYPE_IS_NOT_02 107 -# define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 -# define RSA_R_DATA_TOO_LARGE 109 -# define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 -# define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 -# define RSA_R_DATA_TOO_SMALL 111 -# define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 -# define RSA_R_DIGEST_DOES_NOT_MATCH 158 -# define RSA_R_DIGEST_NOT_ALLOWED 145 -# define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 -# define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 -# define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 -# define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 -# define RSA_R_FIRST_OCTET_INVALID 133 -# define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 -# define RSA_R_INVALID_DIGEST 157 -# define RSA_R_INVALID_DIGEST_LENGTH 143 -# define RSA_R_INVALID_HEADER 137 -# define RSA_R_INVALID_LABEL 160 -# define RSA_R_INVALID_MESSAGE_LENGTH 131 -# define RSA_R_INVALID_MGF1_MD 156 -# define RSA_R_INVALID_MULTI_PRIME_KEY 167 -# define RSA_R_INVALID_OAEP_PARAMETERS 161 -# define RSA_R_INVALID_PADDING 138 -# define RSA_R_INVALID_PADDING_MODE 141 -# define RSA_R_INVALID_PSS_PARAMETERS 149 -# define RSA_R_INVALID_PSS_SALTLEN 146 -# define RSA_R_INVALID_SALT_LENGTH 150 -# define RSA_R_INVALID_TRAILER 139 -# define RSA_R_INVALID_X931_DIGEST 142 -# define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 -# define RSA_R_KEY_PRIME_NUM_INVALID 165 -# define RSA_R_KEY_SIZE_TOO_SMALL 120 -# define RSA_R_LAST_OCTET_INVALID 134 -# define RSA_R_MISSING_PRIVATE_KEY 179 -# define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 -# define RSA_R_MODULUS_TOO_LARGE 105 -# define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 -# define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 -# define RSA_R_MP_R_NOT_PRIME 170 -# define RSA_R_NO_PUBLIC_EXPONENT 140 -# define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 -# define RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES 172 -# define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 -# define RSA_R_OAEP_DECODING_ERROR 121 -# define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 -# define RSA_R_PADDING_CHECK_FAILED 114 -# define RSA_R_PKCS_DECODING_ERROR 159 -# define RSA_R_PSS_SALTLEN_TOO_SMALL 164 -# define RSA_R_P_NOT_PRIME 128 -# define RSA_R_Q_NOT_PRIME 129 -# define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 -# define RSA_R_SLEN_CHECK_FAILED 136 -# define RSA_R_SLEN_RECOVERY_FAILED 135 -# define RSA_R_SSLV3_ROLLBACK_ATTACK 115 -# define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 -# define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 -# define RSA_R_UNKNOWN_DIGEST 166 -# define RSA_R_UNKNOWN_MASK_DIGEST 151 -# define RSA_R_UNKNOWN_PADDING_TYPE 118 -# define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162 -# define RSA_R_UNSUPPORTED_LABEL_SOURCE 163 -# define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 -# define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 -# define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 -# define RSA_R_VALUE_MISSING 147 -# define RSA_R_WRONG_SIGNATURE_LENGTH 119 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/safestack.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/safestack.h deleted file mode 100644 index 38b55789..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/safestack.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 1999-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_SAFESTACK_H -# define HEADER_SAFESTACK_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define STACK_OF(type) struct stack_st_##type - -# define SKM_DEFINE_STACK_OF(t1, t2, t3) \ - STACK_OF(t1); \ - typedef int (*sk_##t1##_compfunc)(const t3 * const *a, const t3 *const *b); \ - typedef void (*sk_##t1##_freefunc)(t3 *a); \ - typedef t3 * (*sk_##t1##_copyfunc)(const t3 *a); \ - static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk) \ - { \ - return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx) \ - { \ - return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n) \ - { \ - return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_free((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_zero((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i) \ - { \ - return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \ - (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \ - { \ - return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk) \ - { \ - return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc) \ - { \ - OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \ - { \ - return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \ - } \ - static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \ - { \ - return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \ - { \ - return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \ - } \ - static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \ - { \ - OPENSSL_sk_sort((OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk) \ - { \ - return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \ - } \ - static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \ - sk_##t1##_copyfunc copyfunc, \ - sk_##t1##_freefunc freefunc) \ - { \ - return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \ - (OPENSSL_sk_copyfunc)copyfunc, \ - (OPENSSL_sk_freefunc)freefunc); \ - } \ - static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare) \ - { \ - return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare); \ - } - -# define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2) -# define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t) -# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \ - SKM_DEFINE_STACK_OF(t1, const t2, t2) -# define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t) - -/*- - * Strings are special: normally an lhash entry will point to a single - * (somewhat) mutable object. In the case of strings: - * - * a) Instead of a single char, there is an array of chars, NUL-terminated. - * b) The string may have be immutable. - * - * So, they need their own declarations. Especially important for - * type-checking tools, such as Deputy. - * - * In practice, however, it appears to be hard to have a const - * string. For now, I'm settling for dealing with the fact it is a - * string at all. - */ -typedef char *OPENSSL_STRING; -typedef const char *OPENSSL_CSTRING; - -/*- - * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but - * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned - * above, instead of a single char each entry is a NUL-terminated array of - * chars. So, we have to implement STRING specially for STACK_OF. This is - * dealt with in the autogenerated macros below. - */ -DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char) -DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char) - -/* - * Similarly, we sometimes use a block of characters, NOT nul-terminated. - * These should also be distinguished from "normal" stacks. - */ -typedef void *OPENSSL_BLOCK; -DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) - -/* - * If called without higher optimization (min. -xO3) the Oracle Developer - * Studio compiler generates code for the defined (static inline) functions - * above. - * This would later lead to the linker complaining about missing symbols when - * this header file is included but the resulting object is not linked against - * the Crypto library (openssl#6912). - */ -# ifdef __SUNPRO_C -# pragma weak OPENSSL_sk_num -# pragma weak OPENSSL_sk_value -# pragma weak OPENSSL_sk_new -# pragma weak OPENSSL_sk_new_null -# pragma weak OPENSSL_sk_new_reserve -# pragma weak OPENSSL_sk_reserve -# pragma weak OPENSSL_sk_free -# pragma weak OPENSSL_sk_zero -# pragma weak OPENSSL_sk_delete -# pragma weak OPENSSL_sk_delete_ptr -# pragma weak OPENSSL_sk_push -# pragma weak OPENSSL_sk_unshift -# pragma weak OPENSSL_sk_pop -# pragma weak OPENSSL_sk_shift -# pragma weak OPENSSL_sk_pop_free -# pragma weak OPENSSL_sk_insert -# pragma weak OPENSSL_sk_set -# pragma weak OPENSSL_sk_find -# pragma weak OPENSSL_sk_find_ex -# pragma weak OPENSSL_sk_sort -# pragma weak OPENSSL_sk_is_sorted -# pragma weak OPENSSL_sk_dup -# pragma weak OPENSSL_sk_deep_copy -# pragma weak OPENSSL_sk_set_cmp_func -# endif /* __SUNPRO_C */ - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/seed.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/seed.h deleted file mode 100644 index de10b085..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/seed.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2007-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 - */ - -/* - * Copyright (c) 2007 KISA(Korea Information Security Agency). 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. Neither the name of author nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``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 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. - */ - -#ifndef HEADER_SEED_H -# define HEADER_SEED_H - -# include - -# ifndef OPENSSL_NO_SEED -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* look whether we need 'long' to get 32 bits */ -# ifdef AES_LONG -# ifndef SEED_LONG -# define SEED_LONG 1 -# endif -# endif - -# include - -# define SEED_BLOCK_SIZE 16 -# define SEED_KEY_LENGTH 16 - -typedef struct seed_key_st { -# ifdef SEED_LONG - unsigned long data[32]; -# else - unsigned int data[32]; -# endif -} SEED_KEY_SCHEDULE; - -void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], - SEED_KEY_SCHEDULE *ks); - -void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], - unsigned char d[SEED_BLOCK_SIZE], - const SEED_KEY_SCHEDULE *ks); -void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], - unsigned char d[SEED_BLOCK_SIZE], - const SEED_KEY_SCHEDULE *ks); - -void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, - const SEED_KEY_SCHEDULE *ks, int enc); -void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, - const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int enc); -void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int *num, - int enc); -void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, - size_t len, const SEED_KEY_SCHEDULE *ks, - unsigned char ivec[SEED_BLOCK_SIZE], int *num); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/sha.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/sha.h deleted file mode 100644 index 6a1eb0de..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/sha.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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_SHA_H -# define HEADER_SHA_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! SHA_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ -# define SHA_LONG unsigned int - -# define SHA_LBLOCK 16 -# define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a - * contiguous array of 32 bit wide - * big-endian values. */ -# define SHA_LAST_BLOCK (SHA_CBLOCK-8) -# define SHA_DIGEST_LENGTH 20 - -typedef struct SHAstate_st { - SHA_LONG h0, h1, h2, h3, h4; - SHA_LONG Nl, Nh; - SHA_LONG data[SHA_LBLOCK]; - unsigned int num; -} SHA_CTX; - -int SHA1_Init(SHA_CTX *c); -int SHA1_Update(SHA_CTX *c, const void *data, size_t len); -int SHA1_Final(unsigned char *md, SHA_CTX *c); -unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); -void SHA1_Transform(SHA_CTX *c, const unsigned char *data); - -# define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a - * contiguous array of 32 bit wide - * big-endian values. */ - -typedef struct SHA256state_st { - SHA_LONG h[8]; - SHA_LONG Nl, Nh; - SHA_LONG data[SHA_LBLOCK]; - unsigned int num, md_len; -} SHA256_CTX; - -int SHA224_Init(SHA256_CTX *c); -int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA224_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); -int SHA256_Init(SHA256_CTX *c); -int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA256_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); -void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); - -# define SHA224_DIGEST_LENGTH 28 -# define SHA256_DIGEST_LENGTH 32 -# define SHA384_DIGEST_LENGTH 48 -# define SHA512_DIGEST_LENGTH 64 - -/* - * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 - * being exactly 64-bit wide. See Implementation Notes in sha512.c - * for further details. - */ -/* - * SHA-512 treats input data as a - * contiguous array of 64 bit - * wide big-endian values. - */ -# define SHA512_CBLOCK (SHA_LBLOCK*8) -# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -# define SHA_LONG64 unsigned __int64 -# define U64(C) C##UI64 -# elif defined(__arch64__) -# define SHA_LONG64 unsigned long -# define U64(C) C##UL -# else -# define SHA_LONG64 unsigned long long -# define U64(C) C##ULL -# endif - -typedef struct SHA512state_st { - SHA_LONG64 h[8]; - SHA_LONG64 Nl, Nh; - union { - SHA_LONG64 d[SHA_LBLOCK]; - unsigned char p[SHA512_CBLOCK]; - } u; - unsigned int num, md_len; -} SHA512_CTX; - -int SHA384_Init(SHA512_CTX *c); -int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA384_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); -int SHA512_Init(SHA512_CTX *c); -int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA512_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); -void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/srp.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/srp.h deleted file mode 100644 index aaf13558..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/srp.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2004, EdelKey Project. 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 - * - * Originally written by Christophe Renou and Peter Sylvester, - * for the EdelKey project. - */ - -#ifndef HEADER_SRP_H -# define HEADER_SRP_H - -#include - -#ifndef OPENSSL_NO_SRP -# include -# include -# include -# include -# include - -# ifdef __cplusplus -extern "C" { -# endif - -typedef struct SRP_gN_cache_st { - char *b64_bn; - BIGNUM *bn; -} SRP_gN_cache; - - -DEFINE_STACK_OF(SRP_gN_cache) - -typedef struct SRP_user_pwd_st { - /* Owned by us. */ - char *id; - BIGNUM *s; - BIGNUM *v; - /* Not owned by us. */ - const BIGNUM *g; - const BIGNUM *N; - /* Owned by us. */ - char *info; -} SRP_user_pwd; - -void SRP_user_pwd_free(SRP_user_pwd *user_pwd); - -DEFINE_STACK_OF(SRP_user_pwd) - -typedef struct SRP_VBASE_st { - STACK_OF(SRP_user_pwd) *users_pwd; - STACK_OF(SRP_gN_cache) *gN_cache; -/* to simulate a user */ - char *seed_key; - const BIGNUM *default_g; - const BIGNUM *default_N; -} SRP_VBASE; - -/* - * Internal structure storing N and g pair - */ -typedef struct SRP_gN_st { - char *id; - const BIGNUM *g; - const BIGNUM *N; -} SRP_gN; - -DEFINE_STACK_OF(SRP_gN) - -SRP_VBASE *SRP_VBASE_new(char *seed_key); -void SRP_VBASE_free(SRP_VBASE *vb); -int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); - -/* This method ignores the configured seed and fails for an unknown user. */ -DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)) -/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ -SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); - -char *SRP_create_verifier(const char *user, const char *pass, char **salt, - char **verifier, const char *N, const char *g); -int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, - BIGNUM **verifier, const BIGNUM *N, - const BIGNUM *g); - -# define SRP_NO_ERROR 0 -# define SRP_ERR_VBASE_INCOMPLETE_FILE 1 -# define SRP_ERR_VBASE_BN_LIB 2 -# define SRP_ERR_OPEN_FILE 3 -# define SRP_ERR_MEMORY 4 - -# define DB_srptype 0 -# define DB_srpverifier 1 -# define DB_srpsalt 2 -# define DB_srpid 3 -# define DB_srpgN 4 -# define DB_srpinfo 5 -# undef DB_NUMBER -# define DB_NUMBER 6 - -# define DB_SRP_INDEX 'I' -# define DB_SRP_VALID 'V' -# define DB_SRP_REVOKED 'R' -# define DB_SRP_MODIF 'v' - -/* see srp.c */ -char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N); -SRP_gN *SRP_get_default_gN(const char *id); - -/* server side .... */ -BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, - const BIGNUM *b, const BIGNUM *N); -BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, - const BIGNUM *v); -int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N); -BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N); - -/* client side .... */ -BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass); -BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g); -BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, - const BIGNUM *x, const BIGNUM *a, const BIGNUM *u); -int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N); - -# define SRP_MINIMAL_N 1024 - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/srtp.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/srtp.h deleted file mode 100644 index 0b57c235..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/srtp.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011-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 - */ - -/* - * DTLS code by Eric Rescorla - * - * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. - */ - -#ifndef HEADER_D1_SRTP_H -# define HEADER_D1_SRTP_H - -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define SRTP_AES128_CM_SHA1_80 0x0001 -# define SRTP_AES128_CM_SHA1_32 0x0002 -# define SRTP_AES128_F8_SHA1_80 0x0003 -# define SRTP_AES128_F8_SHA1_32 0x0004 -# define SRTP_NULL_SHA1_80 0x0005 -# define SRTP_NULL_SHA1_32 0x0006 - -/* AEAD SRTP protection profiles from RFC 7714 */ -# define SRTP_AEAD_AES_128_GCM 0x0007 -# define SRTP_AEAD_AES_256_GCM 0x0008 - -# ifndef OPENSSL_NO_SRTP - -__owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); -__owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); - -__owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); -__owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); - -# endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ssl.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ssl.h deleted file mode 100644 index 6724ccf2..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ssl.h +++ /dev/null @@ -1,2438 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved - * Copyright 2005 Nokia. 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_SSL_H -# define HEADER_SSL_H - -# include -# include -# include -# include -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# endif -# include -# include -# include -# include - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* OpenSSL version number for ASN.1 encoding of the session information */ -/*- - * Version 0 - initial version - * Version 1 - added the optional peer certificate - */ -# define SSL_SESSION_ASN1_VERSION 0x0001 - -# define SSL_MAX_SSL_SESSION_ID_LENGTH 32 -# define SSL_MAX_SID_CTX_LENGTH 32 - -# define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) -# define SSL_MAX_KEY_ARG_LENGTH 8 -# define SSL_MAX_MASTER_KEY_LENGTH 48 - -/* The maximum number of encrypt/decrypt pipelines we can support */ -# define SSL_MAX_PIPELINES 32 - -/* text strings for the ciphers */ - -/* These are used to specify which ciphers to use and not to use */ - -# define SSL_TXT_LOW "LOW" -# define SSL_TXT_MEDIUM "MEDIUM" -# define SSL_TXT_HIGH "HIGH" -# define SSL_TXT_FIPS "FIPS" - -# define SSL_TXT_aNULL "aNULL" -# define SSL_TXT_eNULL "eNULL" -# define SSL_TXT_NULL "NULL" - -# define SSL_TXT_kRSA "kRSA" -# define SSL_TXT_kDHr "kDHr"/* this cipher class has been removed */ -# define SSL_TXT_kDHd "kDHd"/* this cipher class has been removed */ -# define SSL_TXT_kDH "kDH"/* this cipher class has been removed */ -# define SSL_TXT_kEDH "kEDH"/* alias for kDHE */ -# define SSL_TXT_kDHE "kDHE" -# define SSL_TXT_kECDHr "kECDHr"/* this cipher class has been removed */ -# define SSL_TXT_kECDHe "kECDHe"/* this cipher class has been removed */ -# define SSL_TXT_kECDH "kECDH"/* this cipher class has been removed */ -# define SSL_TXT_kEECDH "kEECDH"/* alias for kECDHE */ -# define SSL_TXT_kECDHE "kECDHE" -# define SSL_TXT_kPSK "kPSK" -# define SSL_TXT_kRSAPSK "kRSAPSK" -# define SSL_TXT_kECDHEPSK "kECDHEPSK" -# define SSL_TXT_kDHEPSK "kDHEPSK" -# define SSL_TXT_kGOST "kGOST" -# define SSL_TXT_kSRP "kSRP" - -# define SSL_TXT_aRSA "aRSA" -# define SSL_TXT_aDSS "aDSS" -# define SSL_TXT_aDH "aDH"/* this cipher class has been removed */ -# define SSL_TXT_aECDH "aECDH"/* this cipher class has been removed */ -# define SSL_TXT_aECDSA "aECDSA" -# define SSL_TXT_aPSK "aPSK" -# define SSL_TXT_aGOST94 "aGOST94" -# define SSL_TXT_aGOST01 "aGOST01" -# define SSL_TXT_aGOST12 "aGOST12" -# define SSL_TXT_aGOST "aGOST" -# define SSL_TXT_aSRP "aSRP" - -# define SSL_TXT_DSS "DSS" -# define SSL_TXT_DH "DH" -# define SSL_TXT_DHE "DHE"/* same as "kDHE:-ADH" */ -# define SSL_TXT_EDH "EDH"/* alias for DHE */ -# define SSL_TXT_ADH "ADH" -# define SSL_TXT_RSA "RSA" -# define SSL_TXT_ECDH "ECDH" -# define SSL_TXT_EECDH "EECDH"/* alias for ECDHE" */ -# define SSL_TXT_ECDHE "ECDHE"/* same as "kECDHE:-AECDH" */ -# define SSL_TXT_AECDH "AECDH" -# define SSL_TXT_ECDSA "ECDSA" -# define SSL_TXT_PSK "PSK" -# define SSL_TXT_SRP "SRP" - -# define SSL_TXT_DES "DES" -# define SSL_TXT_3DES "3DES" -# define SSL_TXT_RC4 "RC4" -# define SSL_TXT_RC2 "RC2" -# define SSL_TXT_IDEA "IDEA" -# define SSL_TXT_SEED "SEED" -# define SSL_TXT_AES128 "AES128" -# define SSL_TXT_AES256 "AES256" -# define SSL_TXT_AES "AES" -# define SSL_TXT_AES_GCM "AESGCM" -# define SSL_TXT_AES_CCM "AESCCM" -# define SSL_TXT_AES_CCM_8 "AESCCM8" -# define SSL_TXT_CAMELLIA128 "CAMELLIA128" -# define SSL_TXT_CAMELLIA256 "CAMELLIA256" -# define SSL_TXT_CAMELLIA "CAMELLIA" -# define SSL_TXT_CHACHA20 "CHACHA20" -# define SSL_TXT_GOST "GOST89" -# define SSL_TXT_ARIA "ARIA" -# define SSL_TXT_ARIA_GCM "ARIAGCM" -# define SSL_TXT_ARIA128 "ARIA128" -# define SSL_TXT_ARIA256 "ARIA256" - -# define SSL_TXT_MD5 "MD5" -# define SSL_TXT_SHA1 "SHA1" -# define SSL_TXT_SHA "SHA"/* same as "SHA1" */ -# define SSL_TXT_GOST94 "GOST94" -# define SSL_TXT_GOST89MAC "GOST89MAC" -# define SSL_TXT_GOST12 "GOST12" -# define SSL_TXT_GOST89MAC12 "GOST89MAC12" -# define SSL_TXT_SHA256 "SHA256" -# define SSL_TXT_SHA384 "SHA384" - -# define SSL_TXT_SSLV3 "SSLv3" -# define SSL_TXT_TLSV1 "TLSv1" -# define SSL_TXT_TLSV1_1 "TLSv1.1" -# define SSL_TXT_TLSV1_2 "TLSv1.2" - -# define SSL_TXT_ALL "ALL" - -/*- - * COMPLEMENTOF* definitions. These identifiers are used to (de-select) - * ciphers normally not being used. - * Example: "RC4" will activate all ciphers using RC4 including ciphers - * without authentication, which would normally disabled by DEFAULT (due - * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" - * will make sure that it is also disabled in the specific selection. - * COMPLEMENTOF* identifiers are portable between version, as adjustments - * to the default cipher setup will also be included here. - * - * COMPLEMENTOFDEFAULT does not experience the same special treatment that - * DEFAULT gets, as only selection is being done and no sorting as needed - * for DEFAULT. - */ -# define SSL_TXT_CMPALL "COMPLEMENTOFALL" -# define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" - -/* - * The following cipher list is used by default. It also is substituted when - * an application-defined cipher list string starts with 'DEFAULT'. - * This applies to ciphersuites for TLSv1.2 and below. - */ -# define SSL_DEFAULT_CIPHER_LIST "ALL:!COMPLEMENTOFDEFAULT:!eNULL" -/* This is the default set of TLSv1.3 ciphersuites */ -# if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) -# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ - "TLS_CHACHA20_POLY1305_SHA256:" \ - "TLS_AES_128_GCM_SHA256" -# else -# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ - "TLS_AES_128_GCM_SHA256" -#endif -/* - * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always - * starts with a reasonable order, and all we have to do for DEFAULT is - * throwing out anonymous and unencrypted ciphersuites! (The latter are not - * actually enabled by ALL, but "ALL:RSA" would enable some of them.) - */ - -/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ -# define SSL_SENT_SHUTDOWN 1 -# define SSL_RECEIVED_SHUTDOWN 2 - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -# define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 -# define SSL_FILETYPE_PEM X509_FILETYPE_PEM - -/* - * This is needed to stop compilers complaining about the 'struct ssl_st *' - * function parameters used to prototype callbacks in SSL_CTX. - */ -typedef struct ssl_st *ssl_crock_st; -typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; -typedef struct ssl_method_st SSL_METHOD; -typedef struct ssl_cipher_st SSL_CIPHER; -typedef struct ssl_session_st SSL_SESSION; -typedef struct tls_sigalgs_st TLS_SIGALGS; -typedef struct ssl_conf_ctx_st SSL_CONF_CTX; -typedef struct ssl_comp_st SSL_COMP; - -STACK_OF(SSL_CIPHER); -STACK_OF(SSL_COMP); - -/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ -typedef struct srtp_protection_profile_st { - const char *name; - unsigned long id; -} SRTP_PROTECTION_PROFILE; - -DEFINE_STACK_OF(SRTP_PROTECTION_PROFILE) - -typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, - int len, void *arg); -typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, - STACK_OF(SSL_CIPHER) *peer_ciphers, - const SSL_CIPHER **cipher, void *arg); - -/* Extension context codes */ -/* This extension is only allowed in TLS */ -#define SSL_EXT_TLS_ONLY 0x0001 -/* This extension is only allowed in DTLS */ -#define SSL_EXT_DTLS_ONLY 0x0002 -/* Some extensions may be allowed in DTLS but we don't implement them for it */ -#define SSL_EXT_TLS_IMPLEMENTATION_ONLY 0x0004 -/* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */ -#define SSL_EXT_SSL3_ALLOWED 0x0008 -/* Extension is only defined for TLS1.2 and below */ -#define SSL_EXT_TLS1_2_AND_BELOW_ONLY 0x0010 -/* Extension is only defined for TLS1.3 and above */ -#define SSL_EXT_TLS1_3_ONLY 0x0020 -/* Ignore this extension during parsing if we are resuming */ -#define SSL_EXT_IGNORE_ON_RESUMPTION 0x0040 -#define SSL_EXT_CLIENT_HELLO 0x0080 -/* Really means TLS1.2 or below */ -#define SSL_EXT_TLS1_2_SERVER_HELLO 0x0100 -#define SSL_EXT_TLS1_3_SERVER_HELLO 0x0200 -#define SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS 0x0400 -#define SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST 0x0800 -#define SSL_EXT_TLS1_3_CERTIFICATE 0x1000 -#define SSL_EXT_TLS1_3_NEW_SESSION_TICKET 0x2000 -#define SSL_EXT_TLS1_3_CERTIFICATE_REQUEST 0x4000 - -/* Typedefs for handling custom extensions */ - -typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type, - const unsigned char **out, size_t *outlen, - int *al, void *add_arg); - -typedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type, - const unsigned char *out, void *add_arg); - -typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type, - const unsigned char *in, size_t inlen, - int *al, void *parse_arg); - - -typedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char **out, - size_t *outlen, X509 *x, - size_t chainidx, - int *al, void *add_arg); - -typedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char *out, - void *add_arg); - -typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type, - unsigned int context, - const unsigned char *in, - size_t inlen, X509 *x, - size_t chainidx, - int *al, void *parse_arg); - -/* Typedef for verification callback */ -typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); - -/* - * Some values are reserved until OpenSSL 1.2.0 because they were previously - * included in SSL_OP_ALL in a 1.1.x release. - * - * Reserved value (until OpenSSL 1.2.0) 0x00000001U - * Reserved value (until OpenSSL 1.2.0) 0x00000002U - */ -/* Allow initial connection to servers that don't support RI */ -# define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004U - -/* Reserved value (until OpenSSL 1.2.0) 0x00000008U */ -# define SSL_OP_TLSEXT_PADDING 0x00000010U -/* Reserved value (until OpenSSL 1.2.0) 0x00000020U */ -# define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040U -/* - * Reserved value (until OpenSSL 1.2.0) 0x00000080U - * Reserved value (until OpenSSL 1.2.0) 0x00000100U - * Reserved value (until OpenSSL 1.2.0) 0x00000200U - */ - -/* In TLSv1.3 allow a non-(ec)dhe based kex_mode */ -# define SSL_OP_ALLOW_NO_DHE_KEX 0x00000400U - -/* - * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in - * OpenSSL 0.9.6d. Usually (depending on the application protocol) the - * workaround is not needed. Unfortunately some broken SSL/TLS - * implementations cannot handle it at all, which is why we include it in - * SSL_OP_ALL. Added in 0.9.6e - */ -# define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800U - -/* DTLS options */ -# define SSL_OP_NO_QUERY_MTU 0x00001000U -/* Turn on Cookie Exchange (on relevant for servers) */ -# define SSL_OP_COOKIE_EXCHANGE 0x00002000U -/* Don't use RFC4507 ticket extension */ -# define SSL_OP_NO_TICKET 0x00004000U -# ifndef OPENSSL_NO_DTLS1_METHOD -/* Use Cisco's "speshul" version of DTLS_BAD_VER - * (only with deprecated DTLSv1_client_method()) */ -# define SSL_OP_CISCO_ANYCONNECT 0x00008000U -# endif - -/* As server, disallow session resumption on renegotiation */ -# define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000U -/* Don't use compression even if supported */ -# define SSL_OP_NO_COMPRESSION 0x00020000U -/* Permit unsafe legacy renegotiation */ -# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000U -/* Disable encrypt-then-mac */ -# define SSL_OP_NO_ENCRYPT_THEN_MAC 0x00080000U - -/* - * Enable TLSv1.3 Compatibility mode. This is on by default. A future version - * of OpenSSL may have this disabled by default. - */ -# define SSL_OP_ENABLE_MIDDLEBOX_COMPAT 0x00100000U - -/* Prioritize Chacha20Poly1305 when client does. - * Modifies SSL_OP_CIPHER_SERVER_PREFERENCE */ -# define SSL_OP_PRIORITIZE_CHACHA 0x00200000U - -/* - * Set on servers to choose the cipher according to the server's preferences - */ -# define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000U -/* - * If set, a server will allow a client to issue a SSLv3.0 version number as - * latest version supported in the premaster secret, even when TLSv1.0 - * (version 3.1) was announced in the client hello. Normally this is - * forbidden to prevent version rollback attacks. - */ -# define SSL_OP_TLS_ROLLBACK_BUG 0x00800000U - -/* - * Switches off automatic TLSv1.3 anti-replay protection for early data. This - * is a server-side option only (no effect on the client). - */ -# define SSL_OP_NO_ANTI_REPLAY 0x01000000U - -# define SSL_OP_NO_SSLv3 0x02000000U -# define SSL_OP_NO_TLSv1 0x04000000U -# define SSL_OP_NO_TLSv1_2 0x08000000U -# define SSL_OP_NO_TLSv1_1 0x10000000U -# define SSL_OP_NO_TLSv1_3 0x20000000U - -# define SSL_OP_NO_DTLSv1 0x04000000U -# define SSL_OP_NO_DTLSv1_2 0x08000000U - -# define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv3|\ - SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2|SSL_OP_NO_TLSv1_3) -# define SSL_OP_NO_DTLS_MASK (SSL_OP_NO_DTLSv1|SSL_OP_NO_DTLSv1_2) - -/* Disallow all renegotiation */ -# define SSL_OP_NO_RENEGOTIATION 0x40000000U - -/* - * Make server add server-hello extension from early version of cryptopro - * draft, when GOST ciphersuite is negotiated. Required for interoperability - * with CryptoPro CSP 3.x - */ -# define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000U - -/* - * SSL_OP_ALL: various bug workarounds that should be rather harmless. - * This used to be 0x000FFFFFL before 0.9.7. - * This used to be 0x80000BFFU before 1.1.1. - */ -# define SSL_OP_ALL (SSL_OP_CRYPTOPRO_TLSEXT_BUG|\ - SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS|\ - SSL_OP_LEGACY_SERVER_CONNECT|\ - SSL_OP_TLSEXT_PADDING|\ - SSL_OP_SAFARI_ECDHE_ECDSA_BUG) - -/* OBSOLETE OPTIONS: retained for compatibility */ - -/* Removed from OpenSSL 1.1.0. Was 0x00000001L */ -/* Related to removed SSLv2. */ -# define SSL_OP_MICROSOFT_SESS_ID_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000002L */ -/* Related to removed SSLv2. */ -# define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x0 -/* Removed from OpenSSL 0.9.8q and 1.0.0c. Was 0x00000008L */ -/* Dead forever, see CVE-2010-4180 */ -# define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x0 -/* Removed from OpenSSL 1.0.1h and 1.0.2. Was 0x00000010L */ -/* Refers to ancient SSLREF and SSLv2. */ -# define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000020 */ -# define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x0 -/* Removed from OpenSSL 0.9.7h and 0.9.8b. Was 0x00000040L */ -# define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000080 */ -/* Ancient SSLeay version. */ -# define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000100L */ -# define SSL_OP_TLS_D5_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00000200L */ -# define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00080000L */ -# define SSL_OP_SINGLE_ECDH_USE 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x00100000L */ -# define SSL_OP_SINGLE_DH_USE 0x0 -/* Removed from OpenSSL 1.0.1k and 1.0.2. Was 0x00200000L */ -# define SSL_OP_EPHEMERAL_RSA 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x01000000L */ -# define SSL_OP_NO_SSLv2 0x0 -/* Removed from OpenSSL 1.0.1. Was 0x08000000L */ -# define SSL_OP_PKCS1_CHECK_1 0x0 -/* Removed from OpenSSL 1.0.1. Was 0x10000000L */ -# define SSL_OP_PKCS1_CHECK_2 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x20000000L */ -# define SSL_OP_NETSCAPE_CA_DN_BUG 0x0 -/* Removed from OpenSSL 1.1.0. Was 0x40000000L */ -# define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x0 - -/* - * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success - * when just a single record has been written): - */ -# define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001U -/* - * Make it possible to retry SSL_write() with changed buffer location (buffer - * contents must stay the same!); this is not the default to avoid the - * misconception that non-blocking SSL_write() behaves like non-blocking - * write(): - */ -# define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002U -/* - * Never bother the application with retries if the transport is blocking: - */ -# define SSL_MODE_AUTO_RETRY 0x00000004U -/* Don't attempt to automatically build certificate chain */ -# define SSL_MODE_NO_AUTO_CHAIN 0x00000008U -/* - * Save RAM by releasing read and write buffers when they're empty. (SSL3 and - * TLS only.) Released buffers are freed. - */ -# define SSL_MODE_RELEASE_BUFFERS 0x00000010U -/* - * Send the current time in the Random fields of the ClientHello and - * ServerHello records for compatibility with hypothetical implementations - * that require it. - */ -# define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020U -# define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040U -/* - * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications - * that reconnect with a downgraded protocol version; see - * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your - * application attempts a normal handshake. Only use this in explicit - * fallback retries, following the guidance in - * draft-ietf-tls-downgrade-scsv-00. - */ -# define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U -/* - * Support Asynchronous operation - */ -# define SSL_MODE_ASYNC 0x00000100U - -/* - * When using DTLS/SCTP, include the terminating zero in the label - * used for computing the endpoint-pair shared secret. Required for - * interoperability with implementations having this bug like these - * older version of OpenSSL: - * - OpenSSL 1.0.0 series - * - OpenSSL 1.0.1 series - * - OpenSSL 1.0.2 series - * - OpenSSL 1.1.0 series - * - OpenSSL 1.1.1 and 1.1.1a - */ -# define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U - -/* Cert related flags */ -/* - * Many implementations ignore some aspects of the TLS standards such as - * enforcing certificate chain algorithms. When this is set we enforce them. - */ -# define SSL_CERT_FLAG_TLS_STRICT 0x00000001U - -/* Suite B modes, takes same values as certificate verify flags */ -# define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 -/* Suite B 192 bit only mode */ -# define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 -/* Suite B 128 bit mode allowing 192 bit algorithms */ -# define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 - -/* Perform all sorts of protocol violations for testing purposes */ -# define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 - -/* Flags for building certificate chains */ -/* Treat any existing certificates as untrusted CAs */ -# define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 -/* Don't include root CA in chain */ -# define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 -/* Just check certificates already there */ -# define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 -/* Ignore verification errors */ -# define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 -/* Clear verification errors from queue */ -# define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 - -/* Flags returned by SSL_check_chain */ -/* Certificate can be used with this session */ -# define CERT_PKEY_VALID 0x1 -/* Certificate can also be used for signing */ -# define CERT_PKEY_SIGN 0x2 -/* EE certificate signing algorithm OK */ -# define CERT_PKEY_EE_SIGNATURE 0x10 -/* CA signature algorithms OK */ -# define CERT_PKEY_CA_SIGNATURE 0x20 -/* EE certificate parameters OK */ -# define CERT_PKEY_EE_PARAM 0x40 -/* CA certificate parameters OK */ -# define CERT_PKEY_CA_PARAM 0x80 -/* Signing explicitly allowed as opposed to SHA1 fallback */ -# define CERT_PKEY_EXPLICIT_SIGN 0x100 -/* Client CA issuer names match (always set for server cert) */ -# define CERT_PKEY_ISSUER_NAME 0x200 -/* Cert type matches client types (always set for server cert) */ -# define CERT_PKEY_CERT_TYPE 0x400 -/* Cert chain suitable to Suite B */ -# define CERT_PKEY_SUITEB 0x800 - -# define SSL_CONF_FLAG_CMDLINE 0x1 -# define SSL_CONF_FLAG_FILE 0x2 -# define SSL_CONF_FLAG_CLIENT 0x4 -# define SSL_CONF_FLAG_SERVER 0x8 -# define SSL_CONF_FLAG_SHOW_ERRORS 0x10 -# define SSL_CONF_FLAG_CERTIFICATE 0x20 -# define SSL_CONF_FLAG_REQUIRE_PRIVATE 0x40 -/* Configuration value types */ -# define SSL_CONF_TYPE_UNKNOWN 0x0 -# define SSL_CONF_TYPE_STRING 0x1 -# define SSL_CONF_TYPE_FILE 0x2 -# define SSL_CONF_TYPE_DIR 0x3 -# define SSL_CONF_TYPE_NONE 0x4 - -/* Maximum length of the application-controlled segment of a a TLSv1.3 cookie */ -# define SSL_COOKIE_LENGTH 4096 - -/* - * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they - * cannot be used to clear bits. - */ - -unsigned long SSL_CTX_get_options(const SSL_CTX *ctx); -unsigned long SSL_get_options(const SSL *s); -unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op); -unsigned long SSL_clear_options(SSL *s, unsigned long op); -unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op); -unsigned long SSL_set_options(SSL *s, unsigned long op); - -# define SSL_CTX_set_mode(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) -# define SSL_CTX_clear_mode(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL) -# define SSL_CTX_get_mode(ctx) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) -# define SSL_clear_mode(ssl,op) \ - SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL) -# define SSL_set_mode(ssl,op) \ - SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) -# define SSL_get_mode(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) -# define SSL_set_mtu(ssl, mtu) \ - SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) -# define DTLS_set_link_mtu(ssl, mtu) \ - SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL) -# define DTLS_get_link_min_mtu(ssl) \ - SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL) - -# define SSL_get_secure_renegotiation_support(ssl) \ - SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) - -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_heartbeat(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT,0,NULL) -# endif - -# define SSL_CTX_set_cert_flags(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL) -# define SSL_set_cert_flags(s,op) \ - SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL) -# define SSL_CTX_clear_cert_flags(ctx,op) \ - SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) -# define SSL_clear_cert_flags(s,op) \ - SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) - -void SSL_CTX_set_msg_callback(SSL_CTX *ctx, - void (*cb) (int write_p, int version, - int content_type, const void *buf, - size_t len, SSL *ssl, void *arg)); -void SSL_set_msg_callback(SSL *ssl, - void (*cb) (int write_p, int version, - int content_type, const void *buf, - size_t len, SSL *ssl, void *arg)); -# define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) -# define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) - -# define SSL_get_extms_support(s) \ - SSL_ctrl((s),SSL_CTRL_GET_EXTMS_SUPPORT,0,NULL) - -# ifndef OPENSSL_NO_SRP - -/* see tls_srp.c */ -__owur int SSL_SRP_CTX_init(SSL *s); -__owur int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx); -int SSL_SRP_CTX_free(SSL *ctx); -int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); -__owur int SSL_srp_server_param_with_username(SSL *s, int *ad); -__owur int SRP_Calc_A_param(SSL *s); - -# endif - -/* 100k max cert list */ -# define SSL_MAX_CERT_LIST_DEFAULT 1024*100 - -# define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) - -/* - * This callback type is used inside SSL_CTX, SSL, and in the functions that - * set them. It is used to override the generation of SSL/TLS session IDs in - * a server. Return value should be zero on an error, non-zero to proceed. - * Also, callbacks should themselves check if the id they generate is unique - * otherwise the SSL handshake will fail with an error - callbacks can do - * this using the 'ssl' value they're passed by; - * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in - * is set at the maximum size the session ID can be. In SSLv3/TLSv1 it is 32 - * bytes. The callback can alter this length to be less if desired. It is - * also an error for the callback to set the size to zero. - */ -typedef int (*GEN_SESSION_CB) (SSL *ssl, unsigned char *id, - unsigned int *id_len); - -# define SSL_SESS_CACHE_OFF 0x0000 -# define SSL_SESS_CACHE_CLIENT 0x0001 -# define SSL_SESS_CACHE_SERVER 0x0002 -# define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) -# define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 -/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ -# define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 -# define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 -# define SSL_SESS_CACHE_NO_INTERNAL \ - (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) - -LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); -# define SSL_CTX_sess_number(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) -# define SSL_CTX_sess_connect(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) -# define SSL_CTX_sess_connect_good(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) -# define SSL_CTX_sess_connect_renegotiate(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) -# define SSL_CTX_sess_accept(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) -# define SSL_CTX_sess_accept_renegotiate(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) -# define SSL_CTX_sess_accept_good(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) -# define SSL_CTX_sess_hits(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) -# define SSL_CTX_sess_cb_hits(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) -# define SSL_CTX_sess_misses(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) -# define SSL_CTX_sess_timeouts(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) -# define SSL_CTX_sess_cache_full(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) - -void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, - int (*new_session_cb) (struct ssl_st *ssl, - SSL_SESSION *sess)); -int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, - SSL_SESSION *sess); -void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, - void (*remove_session_cb) (struct ssl_ctx_st - *ctx, - SSL_SESSION *sess)); -void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx, - SSL_SESSION *sess); -void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, - SSL_SESSION *(*get_session_cb) (struct ssl_st - *ssl, - const unsigned char - *data, int len, - int *copy)); -SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, - const unsigned char *data, - int len, int *copy); -void SSL_CTX_set_info_callback(SSL_CTX *ctx, - void (*cb) (const SSL *ssl, int type, int val)); -void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, - int val); -void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, - int (*client_cert_cb) (SSL *ssl, X509 **x509, - EVP_PKEY **pkey)); -int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509, - EVP_PKEY **pkey); -# ifndef OPENSSL_NO_ENGINE -__owur int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); -# endif -void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, - int (*app_gen_cookie_cb) (SSL *ssl, - unsigned char - *cookie, - unsigned int - *cookie_len)); -void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, - int (*app_verify_cookie_cb) (SSL *ssl, - const unsigned - char *cookie, - unsigned int - cookie_len)); - -void SSL_CTX_set_stateless_cookie_generate_cb( - SSL_CTX *ctx, - int (*gen_stateless_cookie_cb) (SSL *ssl, - unsigned char *cookie, - size_t *cookie_len)); -void SSL_CTX_set_stateless_cookie_verify_cb( - SSL_CTX *ctx, - int (*verify_stateless_cookie_cb) (SSL *ssl, - const unsigned char *cookie, - size_t cookie_len)); -# ifndef OPENSSL_NO_NEXTPROTONEG - -typedef int (*SSL_CTX_npn_advertised_cb_func)(SSL *ssl, - const unsigned char **out, - unsigned int *outlen, - void *arg); -void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, - SSL_CTX_npn_advertised_cb_func cb, - void *arg); -# define SSL_CTX_set_npn_advertised_cb SSL_CTX_set_next_protos_advertised_cb - -typedef int (*SSL_CTX_npn_select_cb_func)(SSL *s, - unsigned char **out, - unsigned char *outlen, - const unsigned char *in, - unsigned int inlen, - void *arg); -void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, - SSL_CTX_npn_select_cb_func cb, - void *arg); -# define SSL_CTX_set_npn_select_cb SSL_CTX_set_next_proto_select_cb - -void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, - unsigned *len); -# define SSL_get0_npn_negotiated SSL_get0_next_proto_negotiated -# endif - -__owur int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, - const unsigned char *in, unsigned int inlen, - const unsigned char *client, - unsigned int client_len); - -# define OPENSSL_NPN_UNSUPPORTED 0 -# define OPENSSL_NPN_NEGOTIATED 1 -# define OPENSSL_NPN_NO_OVERLAP 2 - -__owur int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, - unsigned int protos_len); -__owur int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, - unsigned int protos_len); -typedef int (*SSL_CTX_alpn_select_cb_func)(SSL *ssl, - const unsigned char **out, - unsigned char *outlen, - const unsigned char *in, - unsigned int inlen, - void *arg); -void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, - SSL_CTX_alpn_select_cb_func cb, - void *arg); -void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, - unsigned int *len); - -# ifndef OPENSSL_NO_PSK -/* - * the maximum length of the buffer given to callbacks containing the - * resulting identity/psk - */ -# define PSK_MAX_IDENTITY_LEN 128 -# define PSK_MAX_PSK_LEN 256 -typedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl, - const char *hint, - char *identity, - unsigned int max_identity_len, - unsigned char *psk, - unsigned int max_psk_len); -void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb); -void SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb); - -typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl, - const char *identity, - unsigned char *psk, - unsigned int max_psk_len); -void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb); -void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb); - -__owur int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); -__owur int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); -const char *SSL_get_psk_identity_hint(const SSL *s); -const char *SSL_get_psk_identity(const SSL *s); -# endif - -typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl, - const unsigned char *identity, - size_t identity_len, - SSL_SESSION **sess); -typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md, - const unsigned char **id, - size_t *idlen, - SSL_SESSION **sess); - -void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb); -void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, - SSL_psk_find_session_cb_func cb); -void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb); -void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, - SSL_psk_use_session_cb_func cb); - -/* Register callbacks to handle custom TLS Extensions for client or server. */ - -__owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, - unsigned int ext_type); - -__owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, - unsigned int ext_type, - custom_ext_add_cb add_cb, - custom_ext_free_cb free_cb, - void *add_arg, - custom_ext_parse_cb parse_cb, - void *parse_arg); - -__owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, - unsigned int ext_type, - custom_ext_add_cb add_cb, - custom_ext_free_cb free_cb, - void *add_arg, - custom_ext_parse_cb parse_cb, - void *parse_arg); - -__owur int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, - unsigned int context, - SSL_custom_ext_add_cb_ex add_cb, - SSL_custom_ext_free_cb_ex free_cb, - void *add_arg, - SSL_custom_ext_parse_cb_ex parse_cb, - void *parse_arg); - -__owur int SSL_extension_supported(unsigned int ext_type); - -# define SSL_NOTHING 1 -# define SSL_WRITING 2 -# define SSL_READING 3 -# define SSL_X509_LOOKUP 4 -# define SSL_ASYNC_PAUSED 5 -# define SSL_ASYNC_NO_JOBS 6 -# define SSL_CLIENT_HELLO_CB 7 - -/* These will only be used when doing non-blocking IO */ -# define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) -# define SSL_want_read(s) (SSL_want(s) == SSL_READING) -# define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) -# define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) -# define SSL_want_async(s) (SSL_want(s) == SSL_ASYNC_PAUSED) -# define SSL_want_async_job(s) (SSL_want(s) == SSL_ASYNC_NO_JOBS) -# define SSL_want_client_hello_cb(s) (SSL_want(s) == SSL_CLIENT_HELLO_CB) - -# define SSL_MAC_FLAG_READ_MAC_STREAM 1 -# define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 - -/* - * A callback for logging out TLS key material. This callback should log out - * |line| followed by a newline. - */ -typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line); - -/* - * SSL_CTX_set_keylog_callback configures a callback to log key material. This - * is intended for debugging use with tools like Wireshark. The cb function - * should log line followed by a newline. - */ -void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb); - -/* - * SSL_CTX_get_keylog_callback returns the callback configured by - * SSL_CTX_set_keylog_callback. - */ -SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx); - -int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data); -uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); -int SSL_set_max_early_data(SSL *s, uint32_t max_early_data); -uint32_t SSL_get_max_early_data(const SSL *s); -int SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data); -uint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx); -int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data); -uint32_t SSL_get_recv_max_early_data(const SSL *s); - -#ifdef __cplusplus -} -#endif - -# include -# include -# include /* This is mostly sslv3 with a few tweaks */ -# include /* Datagram TLS */ -# include /* Support for the use_srtp extension */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * These need to be after the above set of includes due to a compiler bug - * in VisualStudio 2015 - */ -DEFINE_STACK_OF_CONST(SSL_CIPHER) -DEFINE_STACK_OF(SSL_COMP) - -/* compatibility */ -# define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)(arg))) -# define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) -# define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0, \ - (char *)(a))) -# define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) -# define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) -# define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0, \ - (char *)(arg))) -DEPRECATEDIN_1_1_0(void SSL_set_debug(SSL *s, int debug)) - -/* TLSv1.3 KeyUpdate message types */ -/* -1 used so that this is an invalid value for the on-the-wire protocol */ -#define SSL_KEY_UPDATE_NONE -1 -/* Values as defined for the on-the-wire protocol */ -#define SSL_KEY_UPDATE_NOT_REQUESTED 0 -#define SSL_KEY_UPDATE_REQUESTED 1 - -/* - * The valid handshake states (one for each type message sent and one for each - * type of message received). There are also two "special" states: - * TLS = TLS or DTLS state - * DTLS = DTLS specific state - * CR/SR = Client Read/Server Read - * CW/SW = Client Write/Server Write - * - * The "special" states are: - * TLS_ST_BEFORE = No handshake has been initiated yet - * TLS_ST_OK = A handshake has been successfully completed - */ -typedef enum { - TLS_ST_BEFORE, - TLS_ST_OK, - DTLS_ST_CR_HELLO_VERIFY_REQUEST, - TLS_ST_CR_SRVR_HELLO, - TLS_ST_CR_CERT, - TLS_ST_CR_CERT_STATUS, - TLS_ST_CR_KEY_EXCH, - TLS_ST_CR_CERT_REQ, - TLS_ST_CR_SRVR_DONE, - TLS_ST_CR_SESSION_TICKET, - TLS_ST_CR_CHANGE, - TLS_ST_CR_FINISHED, - TLS_ST_CW_CLNT_HELLO, - TLS_ST_CW_CERT, - TLS_ST_CW_KEY_EXCH, - TLS_ST_CW_CERT_VRFY, - TLS_ST_CW_CHANGE, - TLS_ST_CW_NEXT_PROTO, - TLS_ST_CW_FINISHED, - TLS_ST_SW_HELLO_REQ, - TLS_ST_SR_CLNT_HELLO, - DTLS_ST_SW_HELLO_VERIFY_REQUEST, - TLS_ST_SW_SRVR_HELLO, - TLS_ST_SW_CERT, - TLS_ST_SW_KEY_EXCH, - TLS_ST_SW_CERT_REQ, - TLS_ST_SW_SRVR_DONE, - TLS_ST_SR_CERT, - TLS_ST_SR_KEY_EXCH, - TLS_ST_SR_CERT_VRFY, - TLS_ST_SR_NEXT_PROTO, - TLS_ST_SR_CHANGE, - TLS_ST_SR_FINISHED, - TLS_ST_SW_SESSION_TICKET, - TLS_ST_SW_CERT_STATUS, - TLS_ST_SW_CHANGE, - TLS_ST_SW_FINISHED, - TLS_ST_SW_ENCRYPTED_EXTENSIONS, - TLS_ST_CR_ENCRYPTED_EXTENSIONS, - TLS_ST_CR_CERT_VRFY, - TLS_ST_SW_CERT_VRFY, - TLS_ST_CR_HELLO_REQ, - TLS_ST_SW_KEY_UPDATE, - TLS_ST_CW_KEY_UPDATE, - TLS_ST_SR_KEY_UPDATE, - TLS_ST_CR_KEY_UPDATE, - TLS_ST_EARLY_DATA, - TLS_ST_PENDING_EARLY_DATA_END, - TLS_ST_CW_END_OF_EARLY_DATA, - TLS_ST_SR_END_OF_EARLY_DATA -} OSSL_HANDSHAKE_STATE; - -/* - * Most of the following state values are no longer used and are defined to be - * the closest equivalent value in the current state machine code. Not all - * defines have an equivalent and are set to a dummy value (-1). SSL_ST_CONNECT - * and SSL_ST_ACCEPT are still in use in the definition of SSL_CB_ACCEPT_LOOP, - * SSL_CB_ACCEPT_EXIT, SSL_CB_CONNECT_LOOP and SSL_CB_CONNECT_EXIT. - */ - -# define SSL_ST_CONNECT 0x1000 -# define SSL_ST_ACCEPT 0x2000 - -# define SSL_ST_MASK 0x0FFF - -# define SSL_CB_LOOP 0x01 -# define SSL_CB_EXIT 0x02 -# define SSL_CB_READ 0x04 -# define SSL_CB_WRITE 0x08 -# define SSL_CB_ALERT 0x4000/* used in callback */ -# define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) -# define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) -# define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) -# define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) -# define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) -# define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) -# define SSL_CB_HANDSHAKE_START 0x10 -# define SSL_CB_HANDSHAKE_DONE 0x20 - -/* Is the SSL_connection established? */ -# define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a)) -# define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a)) -int SSL_in_init(const SSL *s); -int SSL_in_before(const SSL *s); -int SSL_is_init_finished(const SSL *s); - -/* - * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you - * should not need these - */ -# define SSL_ST_READ_HEADER 0xF0 -# define SSL_ST_READ_BODY 0xF1 -# define SSL_ST_READ_DONE 0xF2 - -/*- - * Obtain latest Finished message - * -- that we sent (SSL_get_finished) - * -- that we expected from peer (SSL_get_peer_finished). - * Returns length (0 == no Finished so far), copies up to 'count' bytes. - */ -size_t SSL_get_finished(const SSL *s, void *buf, size_t count); -size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); - -/* - * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options are - * 'ored' with SSL_VERIFY_PEER if they are desired - */ -# define SSL_VERIFY_NONE 0x00 -# define SSL_VERIFY_PEER 0x01 -# define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 -# define SSL_VERIFY_CLIENT_ONCE 0x04 -# define SSL_VERIFY_POST_HANDSHAKE 0x08 - -# if OPENSSL_API_COMPAT < 0x10100000L -# define OpenSSL_add_ssl_algorithms() SSL_library_init() -# define SSLeay_add_ssl_algorithms() SSL_library_init() -# endif - -/* More backward compatibility */ -# define SSL_get_cipher(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) -# define SSL_get_cipher_bits(s,np) \ - SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) -# define SSL_get_cipher_version(s) \ - SSL_CIPHER_get_version(SSL_get_current_cipher(s)) -# define SSL_get_cipher_name(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) -# define SSL_get_time(a) SSL_SESSION_get_time(a) -# define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) -# define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) -# define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) - -# define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) -# define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) - -DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) -# define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value - * from SSL_AD_... */ -/* These alert types are for SSLv3 and TLSv1 */ -# define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY -/* fatal */ -# define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE -/* fatal */ -# define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC -# define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED -# define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW -/* fatal */ -# define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE -/* fatal */ -# define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE -/* Not for TLS */ -# define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE -# define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE -# define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE -# define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED -# define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED -# define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN -/* fatal */ -# define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER -/* fatal */ -# define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA -/* fatal */ -# define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED -/* fatal */ -# define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR -# define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR -/* fatal */ -# define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION -/* fatal */ -# define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION -/* fatal */ -# define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY -/* fatal */ -# define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR -# define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED -# define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION -# define SSL_AD_MISSING_EXTENSION TLS13_AD_MISSING_EXTENSION -# define SSL_AD_CERTIFICATE_REQUIRED TLS13_AD_CERTIFICATE_REQUIRED -# define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION -# define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE -# define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME -# define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE -# define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE -/* fatal */ -# define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY -/* fatal */ -# define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK -# define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL -# define SSL_ERROR_NONE 0 -# define SSL_ERROR_SSL 1 -# define SSL_ERROR_WANT_READ 2 -# define SSL_ERROR_WANT_WRITE 3 -# define SSL_ERROR_WANT_X509_LOOKUP 4 -# define SSL_ERROR_SYSCALL 5/* look at error stack/return - * value/errno */ -# define SSL_ERROR_ZERO_RETURN 6 -# define SSL_ERROR_WANT_CONNECT 7 -# define SSL_ERROR_WANT_ACCEPT 8 -# define SSL_ERROR_WANT_ASYNC 9 -# define SSL_ERROR_WANT_ASYNC_JOB 10 -# define SSL_ERROR_WANT_CLIENT_HELLO_CB 11 -# define SSL_CTRL_SET_TMP_DH 3 -# define SSL_CTRL_SET_TMP_ECDH 4 -# define SSL_CTRL_SET_TMP_DH_CB 6 -# define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 -# define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 -# define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 -# define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 -# define SSL_CTRL_GET_FLAGS 13 -# define SSL_CTRL_EXTRA_CHAIN_CERT 14 -# define SSL_CTRL_SET_MSG_CALLBACK 15 -# define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 -/* only applies to datagram connections */ -# define SSL_CTRL_SET_MTU 17 -/* Stats */ -# define SSL_CTRL_SESS_NUMBER 20 -# define SSL_CTRL_SESS_CONNECT 21 -# define SSL_CTRL_SESS_CONNECT_GOOD 22 -# define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 -# define SSL_CTRL_SESS_ACCEPT 24 -# define SSL_CTRL_SESS_ACCEPT_GOOD 25 -# define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 -# define SSL_CTRL_SESS_HIT 27 -# define SSL_CTRL_SESS_CB_HIT 28 -# define SSL_CTRL_SESS_MISSES 29 -# define SSL_CTRL_SESS_TIMEOUTS 30 -# define SSL_CTRL_SESS_CACHE_FULL 31 -# define SSL_CTRL_MODE 33 -# define SSL_CTRL_GET_READ_AHEAD 40 -# define SSL_CTRL_SET_READ_AHEAD 41 -# define SSL_CTRL_SET_SESS_CACHE_SIZE 42 -# define SSL_CTRL_GET_SESS_CACHE_SIZE 43 -# define SSL_CTRL_SET_SESS_CACHE_MODE 44 -# define SSL_CTRL_GET_SESS_CACHE_MODE 45 -# define SSL_CTRL_GET_MAX_CERT_LIST 50 -# define SSL_CTRL_SET_MAX_CERT_LIST 51 -# define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 -/* see tls1.h for macros based on these */ -# define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 -# define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 -# define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 -# define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 -# define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 -# define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 -# define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 */ -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 */ -/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 */ -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 -# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 -# define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 -# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 -# define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 -# define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 -# define SSL_CTRL_SET_SRP_ARG 78 -# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 -# define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 -# define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT 85 -# define SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING 86 -# define SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS 87 -# endif -# define DTLS_CTRL_GET_TIMEOUT 73 -# define DTLS_CTRL_HANDLE_TIMEOUT 74 -# define SSL_CTRL_GET_RI_SUPPORT 76 -# define SSL_CTRL_CLEAR_MODE 78 -# define SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB 79 -# define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 -# define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 -# define SSL_CTRL_CHAIN 88 -# define SSL_CTRL_CHAIN_CERT 89 -# define SSL_CTRL_GET_GROUPS 90 -# define SSL_CTRL_SET_GROUPS 91 -# define SSL_CTRL_SET_GROUPS_LIST 92 -# define SSL_CTRL_GET_SHARED_GROUP 93 -# define SSL_CTRL_SET_SIGALGS 97 -# define SSL_CTRL_SET_SIGALGS_LIST 98 -# define SSL_CTRL_CERT_FLAGS 99 -# define SSL_CTRL_CLEAR_CERT_FLAGS 100 -# define SSL_CTRL_SET_CLIENT_SIGALGS 101 -# define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 -# define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 -# define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 -# define SSL_CTRL_BUILD_CERT_CHAIN 105 -# define SSL_CTRL_SET_VERIFY_CERT_STORE 106 -# define SSL_CTRL_SET_CHAIN_CERT_STORE 107 -# define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 -# define SSL_CTRL_GET_PEER_TMP_KEY 109 -# define SSL_CTRL_GET_RAW_CIPHERLIST 110 -# define SSL_CTRL_GET_EC_POINT_FORMATS 111 -# define SSL_CTRL_GET_CHAIN_CERTS 115 -# define SSL_CTRL_SELECT_CURRENT_CERT 116 -# define SSL_CTRL_SET_CURRENT_CERT 117 -# define SSL_CTRL_SET_DH_AUTO 118 -# define DTLS_CTRL_SET_LINK_MTU 120 -# define DTLS_CTRL_GET_LINK_MIN_MTU 121 -# define SSL_CTRL_GET_EXTMS_SUPPORT 122 -# define SSL_CTRL_SET_MIN_PROTO_VERSION 123 -# define SSL_CTRL_SET_MAX_PROTO_VERSION 124 -# define SSL_CTRL_SET_SPLIT_SEND_FRAGMENT 125 -# define SSL_CTRL_SET_MAX_PIPELINES 126 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 127 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128 -# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129 -# define SSL_CTRL_GET_MIN_PROTO_VERSION 130 -# define SSL_CTRL_GET_MAX_PROTO_VERSION 131 -# define SSL_CTRL_GET_SIGNATURE_NID 132 -# define SSL_CTRL_GET_TMP_KEY 133 -# define SSL_CERT_SET_FIRST 1 -# define SSL_CERT_SET_NEXT 2 -# define SSL_CERT_SET_SERVER 3 -# define DTLSv1_get_timeout(ssl, arg) \ - SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)(arg)) -# define DTLSv1_handle_timeout(ssl) \ - SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL) -# define SSL_num_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) -# define SSL_clear_num_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) -# define SSL_total_renegotiations(ssl) \ - SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) -# define SSL_CTX_set_tmp_dh(ctx,dh) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) -# define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) -# define SSL_CTX_set_dh_auto(ctx, onoff) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_DH_AUTO,onoff,NULL) -# define SSL_set_dh_auto(s, onoff) \ - SSL_ctrl(s,SSL_CTRL_SET_DH_AUTO,onoff,NULL) -# define SSL_set_tmp_dh(ssl,dh) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) -# define SSL_set_tmp_ecdh(ssl,ecdh) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) -# define SSL_CTX_add_extra_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509)) -# define SSL_CTX_get_extra_chain_certs(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509) -# define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509) -# define SSL_CTX_clear_extra_chain_certs(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL) -# define SSL_CTX_set0_chain(ctx,sk) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk)) -# define SSL_CTX_set1_chain(ctx,sk) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)(sk)) -# define SSL_CTX_add0_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) -# define SSL_CTX_add1_chain_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) -# define SSL_CTX_get0_chain_certs(ctx,px509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) -# define SSL_CTX_clear_chain_certs(ctx) \ - SSL_CTX_set0_chain(ctx,NULL) -# define SSL_CTX_build_cert_chain(ctx, flags) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) -# define SSL_CTX_select_current_cert(ctx,x509) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) -# define SSL_CTX_set_current_cert(ctx, op) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) -# define SSL_CTX_set0_verify_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) -# define SSL_CTX_set1_verify_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) -# define SSL_CTX_set0_chain_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) -# define SSL_CTX_set1_chain_cert_store(ctx,st) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) -# define SSL_set0_chain(s,sk) \ - SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk)) -# define SSL_set1_chain(s,sk) \ - SSL_ctrl(s,SSL_CTRL_CHAIN,1,(char *)(sk)) -# define SSL_add0_chain_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) -# define SSL_add1_chain_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) -# define SSL_get0_chain_certs(s,px509) \ - SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERTS,0,px509) -# define SSL_clear_chain_certs(s) \ - SSL_set0_chain(s,NULL) -# define SSL_build_cert_chain(s, flags) \ - SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) -# define SSL_select_current_cert(s,x509) \ - SSL_ctrl(s,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) -# define SSL_set_current_cert(s,op) \ - SSL_ctrl(s,SSL_CTRL_SET_CURRENT_CERT, op, NULL) -# define SSL_set0_verify_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) -# define SSL_set1_verify_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) -# define SSL_set0_chain_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) -# define SSL_set1_chain_cert_store(s,st) \ - SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) -# define SSL_get1_groups(s, glist) \ - SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist)) -# define SSL_CTX_set1_groups(ctx, glist, glistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) -# define SSL_CTX_set1_groups_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(s)) -# define SSL_set1_groups(s, glist, glistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) -# define SSL_set1_groups_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(str)) -# define SSL_get_shared_group(s, n) \ - SSL_ctrl(s,SSL_CTRL_GET_SHARED_GROUP,n,NULL) -# define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) -# define SSL_CTX_set1_sigalgs_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(s)) -# define SSL_set1_sigalgs(s, slist, slistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) -# define SSL_set1_sigalgs_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(str)) -# define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) -# define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(s)) -# define SSL_set1_client_sigalgs(s, slist, slistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) -# define SSL_set1_client_sigalgs_list(s, str) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(str)) -# define SSL_get0_certificate_types(s, clist) \ - SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)(clist)) -# define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen, \ - (char *)(clist)) -# define SSL_set1_client_certificate_types(s, clist, clistlen) \ - SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)(clist)) -# define SSL_get_signature_nid(s, pn) \ - SSL_ctrl(s,SSL_CTRL_GET_SIGNATURE_NID,0,pn) -# define SSL_get_peer_signature_nid(s, pn) \ - SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn) -# define SSL_get_peer_tmp_key(s, pk) \ - SSL_ctrl(s,SSL_CTRL_GET_PEER_TMP_KEY,0,pk) -# define SSL_get_tmp_key(s, pk) \ - SSL_ctrl(s,SSL_CTRL_GET_TMP_KEY,0,pk) -# define SSL_get0_raw_cipherlist(s, plst) \ - SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,plst) -# define SSL_get0_ec_point_formats(s, plst) \ - SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,plst) -# define SSL_CTX_set_min_proto_version(ctx, version) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) -# define SSL_CTX_set_max_proto_version(ctx, version) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) -# define SSL_CTX_get_min_proto_version(ctx) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) -# define SSL_CTX_get_max_proto_version(ctx) \ - SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) -# define SSL_set_min_proto_version(s, version) \ - SSL_ctrl(s, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) -# define SSL_set_max_proto_version(s, version) \ - SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) -# define SSL_get_min_proto_version(s) \ - SSL_ctrl(s, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) -# define SSL_get_max_proto_version(s) \ - SSL_ctrl(s, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) - -/* Backwards compatibility, original 1.1.0 names */ -# define SSL_CTRL_GET_SERVER_TMP_KEY \ - SSL_CTRL_GET_PEER_TMP_KEY -# define SSL_get_server_tmp_key(s, pk) \ - SSL_get_peer_tmp_key(s, pk) - -/* - * The following symbol names are old and obsolete. They are kept - * for compatibility reasons only and should not be used anymore. - */ -# define SSL_CTRL_GET_CURVES SSL_CTRL_GET_GROUPS -# define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS -# define SSL_CTRL_SET_CURVES_LIST SSL_CTRL_SET_GROUPS_LIST -# define SSL_CTRL_GET_SHARED_CURVE SSL_CTRL_GET_SHARED_GROUP - -# define SSL_get1_curves SSL_get1_groups -# define SSL_CTX_set1_curves SSL_CTX_set1_groups -# define SSL_CTX_set1_curves_list SSL_CTX_set1_groups_list -# define SSL_set1_curves SSL_set1_groups -# define SSL_set1_curves_list SSL_set1_groups_list -# define SSL_get_shared_curve SSL_get_shared_group - - -# if OPENSSL_API_COMPAT < 0x10100000L -/* Provide some compatibility macros for removed functionality. */ -# define SSL_CTX_need_tmp_RSA(ctx) 0 -# define SSL_CTX_set_tmp_rsa(ctx,rsa) 1 -# define SSL_need_tmp_RSA(ssl) 0 -# define SSL_set_tmp_rsa(ssl,rsa) 1 -# define SSL_CTX_set_ecdh_auto(dummy, onoff) ((onoff) != 0) -# define SSL_set_ecdh_auto(dummy, onoff) ((onoff) != 0) -/* - * We "pretend" to call the callback to avoid warnings about unused static - * functions. - */ -# define SSL_CTX_set_tmp_rsa_callback(ctx, cb) while(0) (cb)(NULL, 0, 0) -# define SSL_set_tmp_rsa_callback(ssl, cb) while(0) (cb)(NULL, 0, 0) -# endif -__owur const BIO_METHOD *BIO_f_ssl(void); -__owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client); -__owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx); -__owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); -__owur int BIO_ssl_copy_session_id(BIO *to, BIO *from); -void BIO_ssl_shutdown(BIO *ssl_bio); - -__owur int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); -__owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); -int SSL_CTX_up_ref(SSL_CTX *ctx); -void SSL_CTX_free(SSL_CTX *); -__owur long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); -__owur long SSL_CTX_get_timeout(const SSL_CTX *ctx); -__owur X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); -void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); -void SSL_CTX_set1_cert_store(SSL_CTX *, X509_STORE *); -__owur int SSL_want(const SSL *s); -__owur int SSL_clear(SSL *s); - -void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); - -__owur const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); -__owur const SSL_CIPHER *SSL_get_pending_cipher(const SSL *s); -__owur int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); -__owur const char *SSL_CIPHER_get_version(const SSL_CIPHER *c); -__owur const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); -__owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); -__owur const char *OPENSSL_cipher_name(const char *rfc_name); -__owur uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c); -__owur uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c); -__owur int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c); -__owur int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c); -__owur const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c); -__owur int SSL_CIPHER_is_aead(const SSL_CIPHER *c); - -__owur int SSL_get_fd(const SSL *s); -__owur int SSL_get_rfd(const SSL *s); -__owur int SSL_get_wfd(const SSL *s); -__owur const char *SSL_get_cipher_list(const SSL *s, int n); -__owur char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size); -__owur int SSL_get_read_ahead(const SSL *s); -__owur int SSL_pending(const SSL *s); -__owur int SSL_has_pending(const SSL *s); -# ifndef OPENSSL_NO_SOCK -__owur int SSL_set_fd(SSL *s, int fd); -__owur int SSL_set_rfd(SSL *s, int fd); -__owur int SSL_set_wfd(SSL *s, int fd); -# endif -void SSL_set0_rbio(SSL *s, BIO *rbio); -void SSL_set0_wbio(SSL *s, BIO *wbio); -void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); -__owur BIO *SSL_get_rbio(const SSL *s); -__owur BIO *SSL_get_wbio(const SSL *s); -__owur int SSL_set_cipher_list(SSL *s, const char *str); -__owur int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); -__owur int SSL_set_ciphersuites(SSL *s, const char *str); -void SSL_set_read_ahead(SSL *s, int yes); -__owur int SSL_get_verify_mode(const SSL *s); -__owur int SSL_get_verify_depth(const SSL *s); -__owur SSL_verify_cb SSL_get_verify_callback(const SSL *s); -void SSL_set_verify(SSL *s, int mode, SSL_verify_cb callback); -void SSL_set_verify_depth(SSL *s, int depth); -void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg); -# ifndef OPENSSL_NO_RSA -__owur int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); -__owur int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, - long len); -# endif -__owur int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); -__owur int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, - long len); -__owur int SSL_use_certificate(SSL *ssl, X509 *x); -__owur int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); -__owur int SSL_use_cert_and_key(SSL *ssl, X509 *x509, EVP_PKEY *privatekey, - STACK_OF(X509) *chain, int override); - - -/* serverinfo file format versions */ -# define SSL_SERVERINFOV1 1 -# define SSL_SERVERINFOV2 2 - -/* Set serverinfo data for the current active cert. */ -__owur int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, - size_t serverinfo_length); -__owur int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version, - const unsigned char *serverinfo, - size_t serverinfo_length); -__owur int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); - -#ifndef OPENSSL_NO_RSA -__owur int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); -#endif - -__owur int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); -__owur int SSL_use_certificate_file(SSL *ssl, const char *file, int type); - -#ifndef OPENSSL_NO_RSA -__owur int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, - int type); -#endif -__owur int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, - int type); -__owur int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, - int type); -/* PEM type */ -__owur int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); -__owur int SSL_use_certificate_chain_file(SSL *ssl, const char *file); -__owur STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); -__owur int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, - const char *file); -int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, - const char *dir); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_load_error_strings() \ - OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ - | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) -# endif - -__owur const char *SSL_state_string(const SSL *s); -__owur const char *SSL_rstate_string(const SSL *s); -__owur const char *SSL_state_string_long(const SSL *s); -__owur const char *SSL_rstate_string_long(const SSL *s); -__owur long SSL_SESSION_get_time(const SSL_SESSION *s); -__owur long SSL_SESSION_set_time(SSL_SESSION *s, long t); -__owur long SSL_SESSION_get_timeout(const SSL_SESSION *s); -__owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); -__owur int SSL_SESSION_get_protocol_version(const SSL_SESSION *s); -__owur int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version); - -__owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s); -__owur int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname); -void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s, - const unsigned char **alpn, - size_t *len); -__owur int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, - const unsigned char *alpn, - size_t len); -__owur const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s); -__owur int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher); -__owur int SSL_SESSION_has_ticket(const SSL_SESSION *s); -__owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s); -void SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick, - size_t *len); -__owur uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s); -__owur int SSL_SESSION_set_max_early_data(SSL_SESSION *s, - uint32_t max_early_data); -__owur int SSL_copy_session_id(SSL *to, const SSL *from); -__owur X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); -__owur int SSL_SESSION_set1_id_context(SSL_SESSION *s, - const unsigned char *sid_ctx, - unsigned int sid_ctx_len); -__owur int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, - unsigned int sid_len); -__owur int SSL_SESSION_is_resumable(const SSL_SESSION *s); - -__owur SSL_SESSION *SSL_SESSION_new(void); -__owur SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src); -const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, - unsigned int *len); -const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s, - unsigned int *len); -__owur unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); -# ifndef OPENSSL_NO_STDIO -int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); -# endif -int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); -int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x); -int SSL_SESSION_up_ref(SSL_SESSION *ses); -void SSL_SESSION_free(SSL_SESSION *ses); -__owur int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); -__owur int SSL_set_session(SSL *to, SSL_SESSION *session); -int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session); -int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session); -__owur int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); -__owur int SSL_set_generate_session_id(SSL *s, GEN_SESSION_CB cb); -__owur int SSL_has_matching_session_id(const SSL *s, - const unsigned char *id, - unsigned int id_len); -SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, - long length); - -# ifdef HEADER_X509_H -__owur X509 *SSL_get_peer_certificate(const SSL *s); -# endif - -__owur STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); - -__owur int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); -__owur int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); -__owur SSL_verify_cb SSL_CTX_get_verify_callback(const SSL_CTX *ctx); -void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb callback); -void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); -void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, - int (*cb) (X509_STORE_CTX *, void *), - void *arg); -void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), - void *arg); -# ifndef OPENSSL_NO_RSA -__owur int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); -__owur int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, - long len); -# endif -__owur int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); -__owur int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, - const unsigned char *d, long len); -__owur int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); -__owur int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, - const unsigned char *d); -__owur int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey, - STACK_OF(X509) *chain, int override); - -void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); -void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); -pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx); -void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx); -void SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb); -void SSL_set_default_passwd_cb_userdata(SSL *s, void *u); -pem_password_cb *SSL_get_default_passwd_cb(SSL *s); -void *SSL_get_default_passwd_cb_userdata(SSL *s); - -__owur int SSL_CTX_check_private_key(const SSL_CTX *ctx); -__owur int SSL_check_private_key(const SSL *ctx); - -__owur int SSL_CTX_set_session_id_context(SSL_CTX *ctx, - const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - -SSL *SSL_new(SSL_CTX *ctx); -int SSL_up_ref(SSL *s); -int SSL_is_dtls(const SSL *s); -__owur int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, - unsigned int sid_ctx_len); - -__owur int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose); -__owur int SSL_set_purpose(SSL *ssl, int purpose); -__owur int SSL_CTX_set_trust(SSL_CTX *ctx, int trust); -__owur int SSL_set_trust(SSL *ssl, int trust); - -__owur int SSL_set1_host(SSL *s, const char *hostname); -__owur int SSL_add1_host(SSL *s, const char *hostname); -__owur const char *SSL_get0_peername(SSL *s); -void SSL_set_hostflags(SSL *s, unsigned int flags); - -__owur int SSL_CTX_dane_enable(SSL_CTX *ctx); -__owur int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, - uint8_t mtype, uint8_t ord); -__owur int SSL_dane_enable(SSL *s, const char *basedomain); -__owur int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector, - uint8_t mtype, unsigned const char *data, size_t dlen); -__owur int SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki); -__owur int SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector, - uint8_t *mtype, unsigned const char **data, - size_t *dlen); -/* - * Bridge opacity barrier between libcrypt and libssl, also needed to support - * offline testing in test/danetest.c - */ -SSL_DANE *SSL_get0_dane(SSL *ssl); -/* - * DANE flags - */ -unsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags); -unsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags); -unsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags); -unsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags); - -__owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); -__owur int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); - -__owur X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); -__owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); - -# ifndef OPENSSL_NO_SRP -int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); -int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); -int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); -int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, - char *(*cb) (SSL *, void *)); -int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, - int (*cb) (SSL *, void *)); -int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, - int (*cb) (SSL *, int *, void *)); -int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); - -int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, - BIGNUM *sa, BIGNUM *v, char *info); -int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, - const char *grp); - -__owur BIGNUM *SSL_get_srp_g(SSL *s); -__owur BIGNUM *SSL_get_srp_N(SSL *s); - -__owur char *SSL_get_srp_username(SSL *s); -__owur char *SSL_get_srp_userinfo(SSL *s); -# endif - -/* - * ClientHello callback and helpers. - */ - -# define SSL_CLIENT_HELLO_SUCCESS 1 -# define SSL_CLIENT_HELLO_ERROR 0 -# define SSL_CLIENT_HELLO_RETRY (-1) - -typedef int (*SSL_client_hello_cb_fn) (SSL *s, int *al, void *arg); -void SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn cb, - void *arg); -int SSL_client_hello_isv2(SSL *s); -unsigned int SSL_client_hello_get0_legacy_version(SSL *s); -size_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out); -size_t SSL_client_hello_get0_compression_methods(SSL *s, - const unsigned char **out); -int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen); -int SSL_client_hello_get0_ext(SSL *s, unsigned int type, - const unsigned char **out, size_t *outlen); - -void SSL_certs_clear(SSL *s); -void SSL_free(SSL *ssl); -# ifdef OSSL_ASYNC_FD -/* - * Windows application developer has to include windows.h to use these. - */ -__owur int SSL_waiting_for_async(SSL *s); -__owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds); -__owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, - size_t *numaddfds, OSSL_ASYNC_FD *delfd, - size_t *numdelfds); -# endif -__owur int SSL_accept(SSL *ssl); -__owur int SSL_stateless(SSL *s); -__owur int SSL_connect(SSL *ssl); -__owur int SSL_read(SSL *ssl, void *buf, int num); -__owur int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); - -# define SSL_READ_EARLY_DATA_ERROR 0 -# define SSL_READ_EARLY_DATA_SUCCESS 1 -# define SSL_READ_EARLY_DATA_FINISH 2 - -__owur int SSL_read_early_data(SSL *s, void *buf, size_t num, - size_t *readbytes); -__owur int SSL_peek(SSL *ssl, void *buf, int num); -__owur int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); -__owur int SSL_write(SSL *ssl, const void *buf, int num); -__owur int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written); -__owur int SSL_write_early_data(SSL *s, const void *buf, size_t num, - size_t *written); -long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); -long SSL_callback_ctrl(SSL *, int, void (*)(void)); -long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); -long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); - -# define SSL_EARLY_DATA_NOT_SENT 0 -# define SSL_EARLY_DATA_REJECTED 1 -# define SSL_EARLY_DATA_ACCEPTED 2 - -__owur int SSL_get_early_data_status(const SSL *s); - -__owur int SSL_get_error(const SSL *s, int ret_code); -__owur const char *SSL_get_version(const SSL *s); - -/* This sets the 'default' SSL version that SSL_new() will create */ -__owur int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); - -# ifndef OPENSSL_NO_SSL3_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_method(void)) /* SSLv3 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_client_method(void)) -# endif - -#define SSLv23_method TLS_method -#define SSLv23_server_method TLS_server_method -#define SSLv23_client_method TLS_client_method - -/* Negotiate highest available SSL/TLS version */ -__owur const SSL_METHOD *TLS_method(void); -__owur const SSL_METHOD *TLS_server_method(void); -__owur const SSL_METHOD *TLS_client_method(void); - -# ifndef OPENSSL_NO_TLS1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_TLS1_1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_TLS1_2_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void)) -# endif - -# ifndef OPENSSL_NO_DTLS1_METHOD -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void)) -# endif - -# ifndef OPENSSL_NO_DTLS1_2_METHOD -/* DTLSv1.2 */ -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_server_method(void)) -DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_client_method(void)) -# endif - -__owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ -__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ -__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ - -__owur size_t DTLS_get_data_mtu(const SSL *s); - -__owur STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); -__owur STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx); -__owur STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *s); -__owur STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s); - -__owur int SSL_do_handshake(SSL *s); -int SSL_key_update(SSL *s, int updatetype); -int SSL_get_key_update_type(const SSL *s); -int SSL_renegotiate(SSL *s); -int SSL_renegotiate_abbreviated(SSL *s); -__owur int SSL_renegotiate_pending(const SSL *s); -int SSL_shutdown(SSL *s); -__owur int SSL_verify_client_post_handshake(SSL *s); -void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val); -void SSL_set_post_handshake_auth(SSL *s, int val); - -__owur const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx); -__owur const SSL_METHOD *SSL_get_ssl_method(const SSL *s); -__owur int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); -__owur const char *SSL_alert_type_string_long(int value); -__owur const char *SSL_alert_type_string(int value); -__owur const char *SSL_alert_desc_string_long(int value); -__owur const char *SSL_alert_desc_string(int value); - -void SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); -void SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); -__owur const STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s); -__owur const STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx); -__owur int SSL_add1_to_CA_list(SSL *ssl, const X509 *x); -__owur int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x); -__owur const STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s); - -void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); -void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); -__owur STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); -__owur STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); -__owur int SSL_add_client_CA(SSL *ssl, X509 *x); -__owur int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); - -void SSL_set_connect_state(SSL *s); -void SSL_set_accept_state(SSL *s); - -__owur long SSL_get_default_timeout(const SSL *s); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_library_init() OPENSSL_init_ssl(0, NULL) -# endif - -__owur char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); -__owur STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk); - -__owur SSL *SSL_dup(SSL *ssl); - -__owur X509 *SSL_get_certificate(const SSL *ssl); -/* - * EVP_PKEY - */ -struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); - -__owur X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); -__owur EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); - -void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); -__owur int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); -void SSL_set_quiet_shutdown(SSL *ssl, int mode); -__owur int SSL_get_quiet_shutdown(const SSL *ssl); -void SSL_set_shutdown(SSL *ssl, int mode); -__owur int SSL_get_shutdown(const SSL *ssl); -__owur int SSL_version(const SSL *ssl); -__owur int SSL_client_version(const SSL *s); -__owur int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); -__owur int SSL_CTX_set_default_verify_dir(SSL_CTX *ctx); -__owur int SSL_CTX_set_default_verify_file(SSL_CTX *ctx); -__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, - const char *CApath); -# define SSL_get0_session SSL_get_session/* just peek at pointer */ -__owur SSL_SESSION *SSL_get_session(const SSL *ssl); -__owur SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ -__owur SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); -SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); -void SSL_set_info_callback(SSL *ssl, - void (*cb) (const SSL *ssl, int type, int val)); -void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, - int val); -__owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl); - -void SSL_set_verify_result(SSL *ssl, long v); -__owur long SSL_get_verify_result(const SSL *ssl); -__owur STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s); - -__owur size_t SSL_get_client_random(const SSL *ssl, unsigned char *out, - size_t outlen); -__owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out, - size_t outlen); -__owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess, - unsigned char *out, size_t outlen); -__owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess, - const unsigned char *in, size_t len); -uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *sess); - -#define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) -__owur int SSL_set_ex_data(SSL *ssl, int idx, void *data); -void *SSL_get_ex_data(const SSL *ssl, int idx); -#define SSL_SESSION_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef) -__owur int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); -void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); -#define SSL_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef) -__owur int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); -void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); - -__owur int SSL_get_ex_data_X509_STORE_CTX_idx(void); - -# define SSL_CTX_sess_set_cache_size(ctx,t) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) -# define SSL_CTX_sess_get_cache_size(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) -# define SSL_CTX_set_session_cache_mode(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) -# define SSL_CTX_get_session_cache_mode(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) - -# define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) -# define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) -# define SSL_CTX_get_read_ahead(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) -# define SSL_CTX_set_read_ahead(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) -# define SSL_CTX_get_max_cert_list(ctx) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) -# define SSL_CTX_set_max_cert_list(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) -# define SSL_get_max_cert_list(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) -# define SSL_set_max_cert_list(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) - -# define SSL_CTX_set_max_send_fragment(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) -# define SSL_set_max_send_fragment(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) -# define SSL_CTX_set_split_send_fragment(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) -# define SSL_set_split_send_fragment(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) -# define SSL_CTX_set_max_pipelines(ctx,m) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) -# define SSL_set_max_pipelines(ssl,m) \ - SSL_ctrl(ssl,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) - -void SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len); -void SSL_set_default_read_buffer_len(SSL *s, size_t len); - -# ifndef OPENSSL_NO_DH -/* NB: the |keylength| is only applicable when is_export is true */ -void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, - DH *(*dh) (SSL *ssl, int is_export, - int keylength)); -void SSL_set_tmp_dh_callback(SSL *ssl, - DH *(*dh) (SSL *ssl, int is_export, - int keylength)); -# endif - -__owur const COMP_METHOD *SSL_get_current_compression(const SSL *s); -__owur const COMP_METHOD *SSL_get_current_expansion(const SSL *s); -__owur const char *SSL_COMP_get_name(const COMP_METHOD *comp); -__owur const char *SSL_COMP_get0_name(const SSL_COMP *comp); -__owur int SSL_COMP_get_id(const SSL_COMP *comp); -STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); -__owur STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) - *meths); -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_COMP_free_compression_methods() while(0) continue -# endif -__owur int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); - -const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); -int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); -int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c); -int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len, - int isv2format, STACK_OF(SSL_CIPHER) **sk, - STACK_OF(SSL_CIPHER) **scsvs); - -/* TLS extensions functions */ -__owur int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); - -__owur int SSL_set_session_ticket_ext_cb(SSL *s, - tls_session_ticket_ext_cb_fn cb, - void *arg); - -/* Pre-shared secret session resumption functions */ -__owur int SSL_set_session_secret_cb(SSL *s, - tls_session_secret_cb_fn session_secret_cb, - void *arg); - -void SSL_CTX_set_not_resumable_session_callback(SSL_CTX *ctx, - int (*cb) (SSL *ssl, - int - is_forward_secure)); - -void SSL_set_not_resumable_session_callback(SSL *ssl, - int (*cb) (SSL *ssl, - int is_forward_secure)); - -void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, - size_t (*cb) (SSL *ssl, int type, - size_t len, void *arg)); -void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg); -void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx); -int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size); - -void SSL_set_record_padding_callback(SSL *ssl, - size_t (*cb) (SSL *ssl, int type, - size_t len, void *arg)); -void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg); -void *SSL_get_record_padding_callback_arg(const SSL *ssl); -int SSL_set_block_padding(SSL *ssl, size_t block_size); - -int SSL_set_num_tickets(SSL *s, size_t num_tickets); -size_t SSL_get_num_tickets(const SSL *s); -int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); -size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_cache_hit(s) SSL_session_reused(s) -# endif - -__owur int SSL_session_reused(const SSL *s); -__owur int SSL_is_server(const SSL *s); - -__owur __owur SSL_CONF_CTX *SSL_CONF_CTX_new(void); -int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); -void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); -unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); -__owur unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, - unsigned int flags); -__owur int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); - -void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); -void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); - -__owur int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); -__owur int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); -__owur int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); - -void SSL_add_ssl_module(void); -int SSL_config(SSL *s, const char *name); -int SSL_CTX_config(SSL_CTX *ctx, const char *name); - -# ifndef OPENSSL_NO_SSL_TRACE -void SSL_trace(int write_p, int version, int content_type, - const void *buf, size_t len, SSL *ssl, void *arg); -# endif - -# ifndef OPENSSL_NO_SOCK -int DTLSv1_listen(SSL *s, BIO_ADDR *client); -# endif - -# ifndef OPENSSL_NO_CT - -/* - * A callback for verifying that the received SCTs are sufficient. - * Expected to return 1 if they are sufficient, otherwise 0. - * May return a negative integer if an error occurs. - * A connection should be aborted if the SCTs are deemed insufficient. - */ -typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx, - const STACK_OF(SCT) *scts, void *arg); - -/* - * Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate - * the received SCTs. - * If the callback returns a non-positive result, the connection is terminated. - * Call this function before beginning a handshake. - * If a NULL |callback| is provided, SCT validation is disabled. - * |arg| is arbitrary userdata that will be passed to the callback whenever it - * is invoked. Ownership of |arg| remains with the caller. - * - * NOTE: A side-effect of setting a CT callback is that an OCSP stapled response - * will be requested. - */ -int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback, - void *arg); -int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx, - ssl_ct_validation_cb callback, - void *arg); -#define SSL_disable_ct(s) \ - ((void) SSL_set_validation_callback((s), NULL, NULL)) -#define SSL_CTX_disable_ct(ctx) \ - ((void) SSL_CTX_set_validation_callback((ctx), NULL, NULL)) - -/* - * The validation type enumerates the available behaviours of the built-in SSL - * CT validation callback selected via SSL_enable_ct() and SSL_CTX_enable_ct(). - * The underlying callback is a static function in libssl. - */ -enum { - SSL_CT_VALIDATION_PERMISSIVE = 0, - SSL_CT_VALIDATION_STRICT -}; - -/* - * Enable CT by setting up a callback that implements one of the built-in - * validation variants. The SSL_CT_VALIDATION_PERMISSIVE variant always - * continues the handshake, the application can make appropriate decisions at - * handshake completion. The SSL_CT_VALIDATION_STRICT variant requires at - * least one valid SCT, or else handshake termination will be requested. The - * handshake may continue anyway if SSL_VERIFY_NONE is in effect. - */ -int SSL_enable_ct(SSL *s, int validation_mode); -int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode); - -/* - * Report whether a non-NULL callback is enabled. - */ -int SSL_ct_is_enabled(const SSL *s); -int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx); - -/* Gets the SCTs received from a connection */ -const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s); - -/* - * Loads the CT log list from the default location. - * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, - * the log information loaded from this file will be appended to the - * CTLOG_STORE. - * Returns 1 on success, 0 otherwise. - */ -int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx); - -/* - * Loads the CT log list from the specified file path. - * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, - * the log information loaded from this file will be appended to the - * CTLOG_STORE. - * Returns 1 on success, 0 otherwise. - */ -int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path); - -/* - * Sets the CT log list used by all SSL connections created from this SSL_CTX. - * Ownership of the CTLOG_STORE is transferred to the SSL_CTX. - */ -void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs); - -/* - * Gets the CT log list used by all SSL connections created from this SSL_CTX. - * This will be NULL unless one of the following functions has been called: - * - SSL_CTX_set_default_ctlog_list_file - * - SSL_CTX_set_ctlog_list_file - * - SSL_CTX_set_ctlog_store - */ -const CTLOG_STORE *SSL_CTX_get0_ctlog_store(const SSL_CTX *ctx); - -# endif /* OPENSSL_NO_CT */ - -/* What the "other" parameter contains in security callback */ -/* Mask for type */ -# define SSL_SECOP_OTHER_TYPE 0xffff0000 -# define SSL_SECOP_OTHER_NONE 0 -# define SSL_SECOP_OTHER_CIPHER (1 << 16) -# define SSL_SECOP_OTHER_CURVE (2 << 16) -# define SSL_SECOP_OTHER_DH (3 << 16) -# define SSL_SECOP_OTHER_PKEY (4 << 16) -# define SSL_SECOP_OTHER_SIGALG (5 << 16) -# define SSL_SECOP_OTHER_CERT (6 << 16) - -/* Indicated operation refers to peer key or certificate */ -# define SSL_SECOP_PEER 0x1000 - -/* Values for "op" parameter in security callback */ - -/* Called to filter ciphers */ -/* Ciphers client supports */ -# define SSL_SECOP_CIPHER_SUPPORTED (1 | SSL_SECOP_OTHER_CIPHER) -/* Cipher shared by client/server */ -# define SSL_SECOP_CIPHER_SHARED (2 | SSL_SECOP_OTHER_CIPHER) -/* Sanity check of cipher server selects */ -# define SSL_SECOP_CIPHER_CHECK (3 | SSL_SECOP_OTHER_CIPHER) -/* Curves supported by client */ -# define SSL_SECOP_CURVE_SUPPORTED (4 | SSL_SECOP_OTHER_CURVE) -/* Curves shared by client/server */ -# define SSL_SECOP_CURVE_SHARED (5 | SSL_SECOP_OTHER_CURVE) -/* Sanity check of curve server selects */ -# define SSL_SECOP_CURVE_CHECK (6 | SSL_SECOP_OTHER_CURVE) -/* Temporary DH key */ -# define SSL_SECOP_TMP_DH (7 | SSL_SECOP_OTHER_PKEY) -/* SSL/TLS version */ -# define SSL_SECOP_VERSION (9 | SSL_SECOP_OTHER_NONE) -/* Session tickets */ -# define SSL_SECOP_TICKET (10 | SSL_SECOP_OTHER_NONE) -/* Supported signature algorithms sent to peer */ -# define SSL_SECOP_SIGALG_SUPPORTED (11 | SSL_SECOP_OTHER_SIGALG) -/* Shared signature algorithm */ -# define SSL_SECOP_SIGALG_SHARED (12 | SSL_SECOP_OTHER_SIGALG) -/* Sanity check signature algorithm allowed */ -# define SSL_SECOP_SIGALG_CHECK (13 | SSL_SECOP_OTHER_SIGALG) -/* Used to get mask of supported public key signature algorithms */ -# define SSL_SECOP_SIGALG_MASK (14 | SSL_SECOP_OTHER_SIGALG) -/* Use to see if compression is allowed */ -# define SSL_SECOP_COMPRESSION (15 | SSL_SECOP_OTHER_NONE) -/* EE key in certificate */ -# define SSL_SECOP_EE_KEY (16 | SSL_SECOP_OTHER_CERT) -/* CA key in certificate */ -# define SSL_SECOP_CA_KEY (17 | SSL_SECOP_OTHER_CERT) -/* CA digest algorithm in certificate */ -# define SSL_SECOP_CA_MD (18 | SSL_SECOP_OTHER_CERT) -/* Peer EE key in certificate */ -# define SSL_SECOP_PEER_EE_KEY (SSL_SECOP_EE_KEY | SSL_SECOP_PEER) -/* Peer CA key in certificate */ -# define SSL_SECOP_PEER_CA_KEY (SSL_SECOP_CA_KEY | SSL_SECOP_PEER) -/* Peer CA digest algorithm in certificate */ -# define SSL_SECOP_PEER_CA_MD (SSL_SECOP_CA_MD | SSL_SECOP_PEER) - -void SSL_set_security_level(SSL *s, int level); -__owur int SSL_get_security_level(const SSL *s); -void SSL_set_security_callback(SSL *s, - int (*cb) (const SSL *s, const SSL_CTX *ctx, - int op, int bits, int nid, - void *other, void *ex)); -int (*SSL_get_security_callback(const SSL *s)) (const SSL *s, - const SSL_CTX *ctx, int op, - int bits, int nid, void *other, - void *ex); -void SSL_set0_security_ex_data(SSL *s, void *ex); -__owur void *SSL_get0_security_ex_data(const SSL *s); - -void SSL_CTX_set_security_level(SSL_CTX *ctx, int level); -__owur int SSL_CTX_get_security_level(const SSL_CTX *ctx); -void SSL_CTX_set_security_callback(SSL_CTX *ctx, - int (*cb) (const SSL *s, const SSL_CTX *ctx, - int op, int bits, int nid, - void *other, void *ex)); -int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (const SSL *s, - const SSL_CTX *ctx, - int op, int bits, - int nid, - void *other, - void *ex); -void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex); -__owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx); - -/* OPENSSL_INIT flag 0x010000 reserved for internal use */ -# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x00100000L -# define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L - -# define OPENSSL_INIT_SSL_DEFAULT \ - (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS) - -int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); - -# ifndef OPENSSL_NO_UNIT_TEST -__owur const struct openssl_ssl_test_functions *SSL_test_functions(void); -# endif - -__owur int SSL_free_buffers(SSL *ssl); -__owur int SSL_alloc_buffers(SSL *ssl); - -/* Status codes passed to the decrypt session ticket callback. Some of these - * are for internal use only and are never passed to the callback. */ -typedef int SSL_TICKET_STATUS; - -/* Support for ticket appdata */ -/* fatal error, malloc failure */ -# define SSL_TICKET_FATAL_ERR_MALLOC 0 -/* fatal error, either from parsing or decrypting the ticket */ -# define SSL_TICKET_FATAL_ERR_OTHER 1 -/* No ticket present */ -# define SSL_TICKET_NONE 2 -/* Empty ticket present */ -# define SSL_TICKET_EMPTY 3 -/* the ticket couldn't be decrypted */ -# define SSL_TICKET_NO_DECRYPT 4 -/* a ticket was successfully decrypted */ -# define SSL_TICKET_SUCCESS 5 -/* same as above but the ticket needs to be renewed */ -# define SSL_TICKET_SUCCESS_RENEW 6 - -/* Return codes for the decrypt session ticket callback */ -typedef int SSL_TICKET_RETURN; - -/* An error occurred */ -#define SSL_TICKET_RETURN_ABORT 0 -/* Do not use the ticket, do not send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_IGNORE 1 -/* Do not use the ticket, send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_IGNORE_RENEW 2 -/* Use the ticket, do not send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_USE 3 -/* Use the ticket, send a renewed ticket to the client */ -#define SSL_TICKET_RETURN_USE_RENEW 4 - -typedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg); -typedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss, - const unsigned char *keyname, - size_t keyname_length, - SSL_TICKET_STATUS status, - void *arg); -int SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx, - SSL_CTX_generate_session_ticket_fn gen_cb, - SSL_CTX_decrypt_session_ticket_fn dec_cb, - void *arg); -int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len); -int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len); - -extern const char SSL_version_str[]; - -typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us); - -void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb); - - -typedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg); -void SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx, - SSL_allow_early_data_cb_fn cb, - void *arg); -void SSL_set_allow_early_data_cb(SSL *s, - SSL_allow_early_data_cb_fn cb, - void *arg); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ssl2.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ssl2.h deleted file mode 100644 index 5321bd27..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ssl2.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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_SSL2_H -# define HEADER_SSL2_H - -#ifdef __cplusplus -extern "C" { -#endif - -# define SSL2_VERSION 0x0002 - -# define SSL2_MT_CLIENT_HELLO 1 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ssl3.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ssl3.h deleted file mode 100644 index 8d01fcc4..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ssl3.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_SSL3_H -# define HEADER_SSL3_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Signalling cipher suite value from RFC 5746 - * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) - */ -# define SSL3_CK_SCSV 0x030000FF - -/* - * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 - * (TLS_FALLBACK_SCSV) - */ -# define SSL3_CK_FALLBACK_SCSV 0x03005600 - -# define SSL3_CK_RSA_NULL_MD5 0x03000001 -# define SSL3_CK_RSA_NULL_SHA 0x03000002 -# define SSL3_CK_RSA_RC4_40_MD5 0x03000003 -# define SSL3_CK_RSA_RC4_128_MD5 0x03000004 -# define SSL3_CK_RSA_RC4_128_SHA 0x03000005 -# define SSL3_CK_RSA_RC2_40_MD5 0x03000006 -# define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 -# define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 -# define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 -# define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A - -# define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B -# define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C -# define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D -# define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E -# define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F -# define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 - -# define SSL3_CK_DHE_DSS_DES_40_CBC_SHA 0x03000011 -# define SSL3_CK_EDH_DSS_DES_40_CBC_SHA SSL3_CK_DHE_DSS_DES_40_CBC_SHA -# define SSL3_CK_DHE_DSS_DES_64_CBC_SHA 0x03000012 -# define SSL3_CK_EDH_DSS_DES_64_CBC_SHA SSL3_CK_DHE_DSS_DES_64_CBC_SHA -# define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA 0x03000013 -# define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA SSL3_CK_DHE_DSS_DES_192_CBC3_SHA -# define SSL3_CK_DHE_RSA_DES_40_CBC_SHA 0x03000014 -# define SSL3_CK_EDH_RSA_DES_40_CBC_SHA SSL3_CK_DHE_RSA_DES_40_CBC_SHA -# define SSL3_CK_DHE_RSA_DES_64_CBC_SHA 0x03000015 -# define SSL3_CK_EDH_RSA_DES_64_CBC_SHA SSL3_CK_DHE_RSA_DES_64_CBC_SHA -# define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA 0x03000016 -# define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA SSL3_CK_DHE_RSA_DES_192_CBC3_SHA - -# define SSL3_CK_ADH_RC4_40_MD5 0x03000017 -# define SSL3_CK_ADH_RC4_128_MD5 0x03000018 -# define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 -# define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A -# define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B - -/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ -# define SSL3_RFC_RSA_NULL_MD5 "TLS_RSA_WITH_NULL_MD5" -# define SSL3_RFC_RSA_NULL_SHA "TLS_RSA_WITH_NULL_SHA" -# define SSL3_RFC_RSA_DES_192_CBC3_SHA "TLS_RSA_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_DHE_DSS_DES_192_CBC3_SHA "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_DHE_RSA_DES_192_CBC3_SHA "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_ADH_DES_192_CBC_SHA "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA" -# define SSL3_RFC_RSA_IDEA_128_SHA "TLS_RSA_WITH_IDEA_CBC_SHA" -# define SSL3_RFC_RSA_RC4_128_MD5 "TLS_RSA_WITH_RC4_128_MD5" -# define SSL3_RFC_RSA_RC4_128_SHA "TLS_RSA_WITH_RC4_128_SHA" -# define SSL3_RFC_ADH_RC4_128_MD5 "TLS_DH_anon_WITH_RC4_128_MD5" - -# define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" -# define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" -# define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" -# define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" -# define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" -# define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" -# define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" -# define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" -# define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" -# define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" - -# define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" -# define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" -# define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" -# define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" -# define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" -# define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" - -# define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" -# define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" -# define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" -# define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" -# define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" -# define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" - -/* - * This next block of six "EDH" labels is for backward compatibility with - * older versions of OpenSSL. New code should use the six "DHE" labels above - * instead: - */ -# define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" -# define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" -# define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" -# define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" -# define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" -# define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" - -# define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" -# define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" -# define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" -# define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" -# define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" - -# define SSL3_SSL_SESSION_ID_LENGTH 32 -# define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 - -# define SSL3_MASTER_SECRET_SIZE 48 -# define SSL3_RANDOM_SIZE 32 -# define SSL3_SESSION_ID_SIZE 32 -# define SSL3_RT_HEADER_LENGTH 5 - -# define SSL3_HM_HEADER_LENGTH 4 - -# ifndef SSL3_ALIGN_PAYLOAD - /* - * Some will argue that this increases memory footprint, but it's not - * actually true. Point is that malloc has to return at least 64-bit aligned - * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. - * Suggested pre-gaping simply moves these wasted bytes from the end of - * allocated region to its front, but makes data payload aligned, which - * improves performance:-) - */ -# define SSL3_ALIGN_PAYLOAD 8 -# else -# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0 -# error "insane SSL3_ALIGN_PAYLOAD" -# undef SSL3_ALIGN_PAYLOAD -# endif -# endif - -/* - * This is the maximum MAC (digest) size used by the SSL library. Currently - * maximum of 20 is used by SHA1, but we reserve for future extension for - * 512-bit hashes. - */ - -# define SSL3_RT_MAX_MD_SIZE 64 - -/* - * Maximum block size used in all ciphersuites. Currently 16 for AES. - */ - -# define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 - -# define SSL3_RT_MAX_EXTRA (16384) - -/* Maximum plaintext length: defined by SSL/TLS standards */ -# define SSL3_RT_MAX_PLAIN_LENGTH 16384 -/* Maximum compression overhead: defined by SSL/TLS standards */ -# define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 - -/* - * The standards give a maximum encryption overhead of 1024 bytes. In - * practice the value is lower than this. The overhead is the maximum number - * of padding bytes (256) plus the mac size. - */ -# define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) -# define SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD 256 - -/* - * OpenSSL currently only uses a padding length of at most one block so the - * send overhead is smaller. - */ - -# define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ - (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) - -/* If compression isn't used don't include the compression overhead */ - -# ifdef OPENSSL_NO_COMP -# define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH -# else -# define SSL3_RT_MAX_COMPRESSED_LENGTH \ - (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) -# endif -# define SSL3_RT_MAX_ENCRYPTED_LENGTH \ - (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) -# define SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH \ - (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD) -# define SSL3_RT_MAX_PACKET_SIZE \ - (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) - -# define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" -# define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" - -# define SSL3_VERSION 0x0300 -# define SSL3_VERSION_MAJOR 0x03 -# define SSL3_VERSION_MINOR 0x00 - -# define SSL3_RT_CHANGE_CIPHER_SPEC 20 -# define SSL3_RT_ALERT 21 -# define SSL3_RT_HANDSHAKE 22 -# define SSL3_RT_APPLICATION_DATA 23 -# define DTLS1_RT_HEARTBEAT 24 - -/* Pseudo content types to indicate additional parameters */ -# define TLS1_RT_CRYPTO 0x1000 -# define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) -# define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) -# define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) -# define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) - -# define TLS1_RT_CRYPTO_READ 0x0000 -# define TLS1_RT_CRYPTO_WRITE 0x0100 -# define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) -# define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) -# define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) -# define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) - -/* Pseudo content types for SSL/TLS header info */ -# define SSL3_RT_HEADER 0x100 -# define SSL3_RT_INNER_CONTENT_TYPE 0x101 - -# define SSL3_AL_WARNING 1 -# define SSL3_AL_FATAL 2 - -# define SSL3_AD_CLOSE_NOTIFY 0 -# define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */ -# define SSL3_AD_BAD_RECORD_MAC 20/* fatal */ -# define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */ -# define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */ -# define SSL3_AD_NO_CERTIFICATE 41 -# define SSL3_AD_BAD_CERTIFICATE 42 -# define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 -# define SSL3_AD_CERTIFICATE_REVOKED 44 -# define SSL3_AD_CERTIFICATE_EXPIRED 45 -# define SSL3_AD_CERTIFICATE_UNKNOWN 46 -# define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */ - -# define TLS1_HB_REQUEST 1 -# define TLS1_HB_RESPONSE 2 - - -# define SSL3_CT_RSA_SIGN 1 -# define SSL3_CT_DSS_SIGN 2 -# define SSL3_CT_RSA_FIXED_DH 3 -# define SSL3_CT_DSS_FIXED_DH 4 -# define SSL3_CT_RSA_EPHEMERAL_DH 5 -# define SSL3_CT_DSS_EPHEMERAL_DH 6 -# define SSL3_CT_FORTEZZA_DMS 20 -/* - * SSL3_CT_NUMBER is used to size arrays and it must be large enough to - * contain all of the cert types defined for *either* SSLv3 and TLSv1. - */ -# define SSL3_CT_NUMBER 10 - -# if defined(TLS_CT_NUMBER) -# if TLS_CT_NUMBER != SSL3_CT_NUMBER -# error "SSL/TLS CT_NUMBER values do not match" -# endif -# endif - -/* No longer used as of OpenSSL 1.1.1 */ -# define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 - -/* Removed from OpenSSL 1.1.0 */ -# define TLS1_FLAGS_TLS_PADDING_BUG 0x0 - -# define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 - -/* Set if we encrypt then mac instead of usual mac then encrypt */ -# define TLS1_FLAGS_ENCRYPT_THEN_MAC_READ 0x0100 -# define TLS1_FLAGS_ENCRYPT_THEN_MAC TLS1_FLAGS_ENCRYPT_THEN_MAC_READ - -/* Set if extended master secret extension received from peer */ -# define TLS1_FLAGS_RECEIVED_EXTMS 0x0200 - -# define TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE 0x0400 - -# define TLS1_FLAGS_STATELESS 0x0800 - -# define SSL3_MT_HELLO_REQUEST 0 -# define SSL3_MT_CLIENT_HELLO 1 -# define SSL3_MT_SERVER_HELLO 2 -# define SSL3_MT_NEWSESSION_TICKET 4 -# define SSL3_MT_END_OF_EARLY_DATA 5 -# define SSL3_MT_ENCRYPTED_EXTENSIONS 8 -# define SSL3_MT_CERTIFICATE 11 -# define SSL3_MT_SERVER_KEY_EXCHANGE 12 -# define SSL3_MT_CERTIFICATE_REQUEST 13 -# define SSL3_MT_SERVER_DONE 14 -# define SSL3_MT_CERTIFICATE_VERIFY 15 -# define SSL3_MT_CLIENT_KEY_EXCHANGE 16 -# define SSL3_MT_FINISHED 20 -# define SSL3_MT_CERTIFICATE_URL 21 -# define SSL3_MT_CERTIFICATE_STATUS 22 -# define SSL3_MT_SUPPLEMENTAL_DATA 23 -# define SSL3_MT_KEY_UPDATE 24 -# ifndef OPENSSL_NO_NEXTPROTONEG -# define SSL3_MT_NEXT_PROTO 67 -# endif -# define SSL3_MT_MESSAGE_HASH 254 -# define DTLS1_MT_HELLO_VERIFY_REQUEST 3 - -/* Dummy message type for handling CCS like a normal handshake message */ -# define SSL3_MT_CHANGE_CIPHER_SPEC 0x0101 - -# define SSL3_MT_CCS 1 - -/* These are used when changing over to a new cipher */ -# define SSL3_CC_READ 0x001 -# define SSL3_CC_WRITE 0x002 -# define SSL3_CC_CLIENT 0x010 -# define SSL3_CC_SERVER 0x020 -# define SSL3_CC_EARLY 0x040 -# define SSL3_CC_HANDSHAKE 0x080 -# define SSL3_CC_APPLICATION 0x100 -# define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) -# define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) -# define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) -# define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/sslerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/sslerr.h deleted file mode 100644 index 82983d3c..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/sslerr.h +++ /dev/null @@ -1,773 +0,0 @@ -/* - * 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_SSLERR_H -# define HEADER_SSLERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_SSL_strings(void); - -/* - * SSL function codes. - */ -# define SSL_F_ADD_CLIENT_KEY_SHARE_EXT 438 -# define SSL_F_ADD_KEY_SHARE 512 -# define SSL_F_BYTES_TO_CIPHER_LIST 519 -# define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 -# define SSL_F_CIPHERSUITE_CB 622 -# define SSL_F_CONSTRUCT_CA_NAMES 552 -# define SSL_F_CONSTRUCT_KEY_EXCHANGE_TBS 553 -# define SSL_F_CONSTRUCT_STATEFUL_TICKET 636 -# define SSL_F_CONSTRUCT_STATELESS_TICKET 637 -# define SSL_F_CREATE_SYNTHETIC_MESSAGE_HASH 539 -# define SSL_F_CREATE_TICKET_PREQUEL 638 -# define SSL_F_CT_MOVE_SCTS 345 -# define SSL_F_CT_STRICT 349 -# define SSL_F_CUSTOM_EXT_ADD 554 -# define SSL_F_CUSTOM_EXT_PARSE 555 -# define SSL_F_D2I_SSL_SESSION 103 -# define SSL_F_DANE_CTX_ENABLE 347 -# define SSL_F_DANE_MTYPE_SET 393 -# define SSL_F_DANE_TLSA_ADD 394 -# define SSL_F_DERIVE_SECRET_KEY_AND_IV 514 -# define SSL_F_DO_DTLS1_WRITE 245 -# define SSL_F_DO_SSL3_WRITE 104 -# define SSL_F_DTLS1_BUFFER_RECORD 247 -# define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 318 -# define SSL_F_DTLS1_HEARTBEAT 305 -# define SSL_F_DTLS1_HM_FRAGMENT_NEW 623 -# define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 -# define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 -# define SSL_F_DTLS1_PROCESS_RECORD 257 -# define SSL_F_DTLS1_READ_BYTES 258 -# define SSL_F_DTLS1_READ_FAILED 339 -# define SSL_F_DTLS1_RETRANSMIT_MESSAGE 390 -# define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 -# define SSL_F_DTLS1_WRITE_BYTES 545 -# define SSL_F_DTLSV1_LISTEN 350 -# define SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC 371 -# define SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST 385 -# define SSL_F_DTLS_GET_REASSEMBLED_MESSAGE 370 -# define SSL_F_DTLS_PROCESS_HELLO_VERIFY 386 -# define SSL_F_DTLS_RECORD_LAYER_NEW 635 -# define SSL_F_DTLS_WAIT_FOR_DRY 592 -# define SSL_F_EARLY_DATA_COUNT_OK 532 -# define SSL_F_FINAL_EARLY_DATA 556 -# define SSL_F_FINAL_EC_PT_FORMATS 485 -# define SSL_F_FINAL_EMS 486 -# define SSL_F_FINAL_KEY_SHARE 503 -# define SSL_F_FINAL_MAXFRAGMENTLEN 557 -# define SSL_F_FINAL_RENEGOTIATE 483 -# define SSL_F_FINAL_SERVER_NAME 558 -# define SSL_F_FINAL_SIG_ALGS 497 -# define SSL_F_GET_CERT_VERIFY_TBS_DATA 588 -# define SSL_F_NSS_KEYLOG_INT 500 -# define SSL_F_OPENSSL_INIT_SSL 342 -# define SSL_F_OSSL_STATEM_CLIENT13_READ_TRANSITION 436 -# define SSL_F_OSSL_STATEM_CLIENT13_WRITE_TRANSITION 598 -# define SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE 430 -# define SSL_F_OSSL_STATEM_CLIENT_POST_PROCESS_MESSAGE 593 -# define SSL_F_OSSL_STATEM_CLIENT_PROCESS_MESSAGE 594 -# define SSL_F_OSSL_STATEM_CLIENT_READ_TRANSITION 417 -# define SSL_F_OSSL_STATEM_CLIENT_WRITE_TRANSITION 599 -# define SSL_F_OSSL_STATEM_SERVER13_READ_TRANSITION 437 -# define SSL_F_OSSL_STATEM_SERVER13_WRITE_TRANSITION 600 -# define SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE 431 -# define SSL_F_OSSL_STATEM_SERVER_POST_PROCESS_MESSAGE 601 -# define SSL_F_OSSL_STATEM_SERVER_POST_WORK 602 -# define SSL_F_OSSL_STATEM_SERVER_PRE_WORK 640 -# define SSL_F_OSSL_STATEM_SERVER_PROCESS_MESSAGE 603 -# define SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION 418 -# define SSL_F_OSSL_STATEM_SERVER_WRITE_TRANSITION 604 -# define SSL_F_PARSE_CA_NAMES 541 -# define SSL_F_PITEM_NEW 624 -# define SSL_F_PQUEUE_NEW 625 -# define SSL_F_PROCESS_KEY_SHARE_EXT 439 -# define SSL_F_READ_STATE_MACHINE 352 -# define SSL_F_SET_CLIENT_CIPHERSUITE 540 -# define SSL_F_SRP_GENERATE_CLIENT_MASTER_SECRET 595 -# define SSL_F_SRP_GENERATE_SERVER_MASTER_SECRET 589 -# define SSL_F_SRP_VERIFY_SERVER_PARAM 596 -# define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 -# define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 -# define SSL_F_SSL3_CTRL 213 -# define SSL_F_SSL3_CTX_CTRL 133 -# define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 -# define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 -# define SSL_F_SSL3_ENC 608 -# define SSL_F_SSL3_FINAL_FINISH_MAC 285 -# define SSL_F_SSL3_FINISH_MAC 587 -# define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 -# define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 -# define SSL_F_SSL3_GET_RECORD 143 -# define SSL_F_SSL3_INIT_FINISHED_MAC 397 -# define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 -# define SSL_F_SSL3_READ_BYTES 148 -# define SSL_F_SSL3_READ_N 149 -# define SSL_F_SSL3_SETUP_KEY_BLOCK 157 -# define SSL_F_SSL3_SETUP_READ_BUFFER 156 -# define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 -# define SSL_F_SSL3_WRITE_BYTES 158 -# define SSL_F_SSL3_WRITE_PENDING 159 -# define SSL_F_SSL_ADD_CERT_CHAIN 316 -# define SSL_F_SSL_ADD_CERT_TO_BUF 319 -# define SSL_F_SSL_ADD_CERT_TO_WPACKET 493 -# define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 -# define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 -# define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 -# define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 -# define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 -# define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 -# define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 -# define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 -# define SSL_F_SSL_BAD_METHOD 160 -# define SSL_F_SSL_BUILD_CERT_CHAIN 332 -# define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 -# define SSL_F_SSL_CACHE_CIPHERLIST 520 -# define SSL_F_SSL_CERT_ADD0_CHAIN_CERT 346 -# define SSL_F_SSL_CERT_DUP 221 -# define SSL_F_SSL_CERT_NEW 162 -# define SSL_F_SSL_CERT_SET0_CHAIN 340 -# define SSL_F_SSL_CHECK_PRIVATE_KEY 163 -# define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 -# define SSL_F_SSL_CHECK_SRP_EXT_CLIENTHELLO 606 -# define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 -# define SSL_F_SSL_CHOOSE_CLIENT_VERSION 607 -# define SSL_F_SSL_CIPHER_DESCRIPTION 626 -# define SSL_F_SSL_CIPHER_LIST_TO_BYTES 425 -# define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 -# define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 -# define SSL_F_SSL_CLEAR 164 -# define SSL_F_SSL_CLIENT_HELLO_GET1_EXTENSIONS_PRESENT 627 -# define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 -# define SSL_F_SSL_CONF_CMD 334 -# define SSL_F_SSL_CREATE_CIPHER_LIST 166 -# define SSL_F_SSL_CTRL 232 -# define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 -# define SSL_F_SSL_CTX_ENABLE_CT 398 -# define SSL_F_SSL_CTX_MAKE_PROFILES 309 -# define SSL_F_SSL_CTX_NEW 169 -# define SSL_F_SSL_CTX_SET_ALPN_PROTOS 343 -# define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 -# define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 -# define SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK 396 -# define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 -# define SSL_F_SSL_CTX_SET_SSL_VERSION 170 -# define SSL_F_SSL_CTX_SET_TLSEXT_MAX_FRAGMENT_LENGTH 551 -# define SSL_F_SSL_CTX_USE_CERTIFICATE 171 -# define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 -# define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 -# define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 -# define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 -# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 -# define SSL_F_SSL_CTX_USE_SERVERINFO 336 -# define SSL_F_SSL_CTX_USE_SERVERINFO_EX 543 -# define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 -# define SSL_F_SSL_DANE_DUP 403 -# define SSL_F_SSL_DANE_ENABLE 395 -# define SSL_F_SSL_DERIVE 590 -# define SSL_F_SSL_DO_CONFIG 391 -# define SSL_F_SSL_DO_HANDSHAKE 180 -# define SSL_F_SSL_DUP_CA_LIST 408 -# define SSL_F_SSL_ENABLE_CT 402 -# define SSL_F_SSL_GENERATE_PKEY_GROUP 559 -# define SSL_F_SSL_GENERATE_SESSION_ID 547 -# define SSL_F_SSL_GET_NEW_SESSION 181 -# define SSL_F_SSL_GET_PREV_SESSION 217 -# define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 -# define SSL_F_SSL_GET_SIGN_PKEY 183 -# define SSL_F_SSL_HANDSHAKE_HASH 560 -# define SSL_F_SSL_INIT_WBIO_BUFFER 184 -# define SSL_F_SSL_KEY_UPDATE 515 -# define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 -# define SSL_F_SSL_LOG_MASTER_SECRET 498 -# define SSL_F_SSL_LOG_RSA_CLIENT_KEY_EXCHANGE 499 -# define SSL_F_SSL_MODULE_INIT 392 -# define SSL_F_SSL_NEW 186 -# define SSL_F_SSL_NEXT_PROTO_VALIDATE 565 -# define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 -# define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 -# define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 -# define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 -# define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 -# define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 -# define SSL_F_SSL_PEEK 270 -# define SSL_F_SSL_PEEK_EX 432 -# define SSL_F_SSL_PEEK_INTERNAL 522 -# define SSL_F_SSL_READ 223 -# define SSL_F_SSL_READ_EARLY_DATA 529 -# define SSL_F_SSL_READ_EX 434 -# define SSL_F_SSL_READ_INTERNAL 523 -# define SSL_F_SSL_RENEGOTIATE 516 -# define SSL_F_SSL_RENEGOTIATE_ABBREVIATED 546 -# define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 -# define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 -# define SSL_F_SSL_SESSION_DUP 348 -# define SSL_F_SSL_SESSION_NEW 189 -# define SSL_F_SSL_SESSION_PRINT_FP 190 -# define SSL_F_SSL_SESSION_SET1_ID 423 -# define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 -# define SSL_F_SSL_SET_ALPN_PROTOS 344 -# define SSL_F_SSL_SET_CERT 191 -# define SSL_F_SSL_SET_CERT_AND_KEY 621 -# define SSL_F_SSL_SET_CIPHER_LIST 271 -# define SSL_F_SSL_SET_CT_VALIDATION_CALLBACK 399 -# define SSL_F_SSL_SET_FD 192 -# define SSL_F_SSL_SET_PKEY 193 -# define SSL_F_SSL_SET_RFD 194 -# define SSL_F_SSL_SET_SESSION 195 -# define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 -# define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 -# define SSL_F_SSL_SET_TLSEXT_MAX_FRAGMENT_LENGTH 550 -# define SSL_F_SSL_SET_WFD 196 -# define SSL_F_SSL_SHUTDOWN 224 -# define SSL_F_SSL_SRP_CTX_INIT 313 -# define SSL_F_SSL_START_ASYNC_JOB 389 -# define SSL_F_SSL_UNDEFINED_FUNCTION 197 -# define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 -# define SSL_F_SSL_USE_CERTIFICATE 198 -# define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 -# define SSL_F_SSL_USE_CERTIFICATE_FILE 200 -# define SSL_F_SSL_USE_PRIVATEKEY 201 -# define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 -# define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 -# define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 -# define SSL_F_SSL_USE_RSAPRIVATEKEY 204 -# define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 -# define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 -# define SSL_F_SSL_VALIDATE_CT 400 -# define SSL_F_SSL_VERIFY_CERT_CHAIN 207 -# define SSL_F_SSL_VERIFY_CLIENT_POST_HANDSHAKE 616 -# define SSL_F_SSL_WRITE 208 -# define SSL_F_SSL_WRITE_EARLY_DATA 526 -# define SSL_F_SSL_WRITE_EARLY_FINISH 527 -# define SSL_F_SSL_WRITE_EX 433 -# define SSL_F_SSL_WRITE_INTERNAL 524 -# define SSL_F_STATE_MACHINE 353 -# define SSL_F_TLS12_CHECK_PEER_SIGALG 333 -# define SSL_F_TLS12_COPY_SIGALGS 533 -# define SSL_F_TLS13_CHANGE_CIPHER_STATE 440 -# define SSL_F_TLS13_ENC 609 -# define SSL_F_TLS13_FINAL_FINISH_MAC 605 -# define SSL_F_TLS13_GENERATE_SECRET 591 -# define SSL_F_TLS13_HKDF_EXPAND 561 -# define SSL_F_TLS13_RESTORE_HANDSHAKE_DIGEST_FOR_PHA 617 -# define SSL_F_TLS13_SAVE_HANDSHAKE_DIGEST_FOR_PHA 618 -# define SSL_F_TLS13_SETUP_KEY_BLOCK 441 -# define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 -# define SSL_F_TLS1_CHECK_DUPLICATE_EXTENSIONS 341 -# define SSL_F_TLS1_ENC 401 -# define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 -# define SSL_F_TLS1_GET_CURVELIST 338 -# define SSL_F_TLS1_PRF 284 -# define SSL_F_TLS1_SAVE_U16 628 -# define SSL_F_TLS1_SETUP_KEY_BLOCK 211 -# define SSL_F_TLS1_SET_GROUPS 629 -# define SSL_F_TLS1_SET_RAW_SIGALGS 630 -# define SSL_F_TLS1_SET_SERVER_SIGALGS 335 -# define SSL_F_TLS1_SET_SHARED_SIGALGS 631 -# define SSL_F_TLS1_SET_SIGALGS 632 -# define SSL_F_TLS_CHOOSE_SIGALG 513 -# define SSL_F_TLS_CLIENT_KEY_EXCHANGE_POST_WORK 354 -# define SSL_F_TLS_COLLECT_EXTENSIONS 435 -# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES 542 -# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST 372 -# define SSL_F_TLS_CONSTRUCT_CERT_STATUS 429 -# define SSL_F_TLS_CONSTRUCT_CERT_STATUS_BODY 494 -# define SSL_F_TLS_CONSTRUCT_CERT_VERIFY 496 -# define SSL_F_TLS_CONSTRUCT_CHANGE_CIPHER_SPEC 427 -# define SSL_F_TLS_CONSTRUCT_CKE_DHE 404 -# define SSL_F_TLS_CONSTRUCT_CKE_ECDHE 405 -# define SSL_F_TLS_CONSTRUCT_CKE_GOST 406 -# define SSL_F_TLS_CONSTRUCT_CKE_PSK_PREAMBLE 407 -# define SSL_F_TLS_CONSTRUCT_CKE_RSA 409 -# define SSL_F_TLS_CONSTRUCT_CKE_SRP 410 -# define SSL_F_TLS_CONSTRUCT_CLIENT_CERTIFICATE 484 -# define SSL_F_TLS_CONSTRUCT_CLIENT_HELLO 487 -# define SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE 488 -# define SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY 489 -# define SSL_F_TLS_CONSTRUCT_CTOS_ALPN 466 -# define SSL_F_TLS_CONSTRUCT_CTOS_CERTIFICATE 355 -# define SSL_F_TLS_CONSTRUCT_CTOS_COOKIE 535 -# define SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA 530 -# define SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS 467 -# define SSL_F_TLS_CONSTRUCT_CTOS_EMS 468 -# define SSL_F_TLS_CONSTRUCT_CTOS_ETM 469 -# define SSL_F_TLS_CONSTRUCT_CTOS_HELLO 356 -# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_EXCHANGE 357 -# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE 470 -# define SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN 549 -# define SSL_F_TLS_CONSTRUCT_CTOS_NPN 471 -# define SSL_F_TLS_CONSTRUCT_CTOS_PADDING 472 -# define SSL_F_TLS_CONSTRUCT_CTOS_POST_HANDSHAKE_AUTH 619 -# define SSL_F_TLS_CONSTRUCT_CTOS_PSK 501 -# define SSL_F_TLS_CONSTRUCT_CTOS_PSK_KEX_MODES 509 -# define SSL_F_TLS_CONSTRUCT_CTOS_RENEGOTIATE 473 -# define SSL_F_TLS_CONSTRUCT_CTOS_SCT 474 -# define SSL_F_TLS_CONSTRUCT_CTOS_SERVER_NAME 475 -# define SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET 476 -# define SSL_F_TLS_CONSTRUCT_CTOS_SIG_ALGS 477 -# define SSL_F_TLS_CONSTRUCT_CTOS_SRP 478 -# define SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST 479 -# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS 480 -# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS 481 -# define SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP 482 -# define SSL_F_TLS_CONSTRUCT_CTOS_VERIFY 358 -# define SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS 443 -# define SSL_F_TLS_CONSTRUCT_END_OF_EARLY_DATA 536 -# define SSL_F_TLS_CONSTRUCT_EXTENSIONS 447 -# define SSL_F_TLS_CONSTRUCT_FINISHED 359 -# define SSL_F_TLS_CONSTRUCT_HELLO_REQUEST 373 -# define SSL_F_TLS_CONSTRUCT_HELLO_RETRY_REQUEST 510 -# define SSL_F_TLS_CONSTRUCT_KEY_UPDATE 517 -# define SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET 428 -# define SSL_F_TLS_CONSTRUCT_NEXT_PROTO 426 -# define SSL_F_TLS_CONSTRUCT_SERVER_CERTIFICATE 490 -# define SSL_F_TLS_CONSTRUCT_SERVER_HELLO 491 -# define SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE 492 -# define SSL_F_TLS_CONSTRUCT_STOC_ALPN 451 -# define SSL_F_TLS_CONSTRUCT_STOC_CERTIFICATE 374 -# define SSL_F_TLS_CONSTRUCT_STOC_COOKIE 613 -# define SSL_F_TLS_CONSTRUCT_STOC_CRYPTOPRO_BUG 452 -# define SSL_F_TLS_CONSTRUCT_STOC_DONE 375 -# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA 531 -# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA_INFO 525 -# define SSL_F_TLS_CONSTRUCT_STOC_EC_PT_FORMATS 453 -# define SSL_F_TLS_CONSTRUCT_STOC_EMS 454 -# define SSL_F_TLS_CONSTRUCT_STOC_ETM 455 -# define SSL_F_TLS_CONSTRUCT_STOC_HELLO 376 -# define SSL_F_TLS_CONSTRUCT_STOC_KEY_EXCHANGE 377 -# define SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE 456 -# define SSL_F_TLS_CONSTRUCT_STOC_MAXFRAGMENTLEN 548 -# define SSL_F_TLS_CONSTRUCT_STOC_NEXT_PROTO_NEG 457 -# define SSL_F_TLS_CONSTRUCT_STOC_PSK 504 -# define SSL_F_TLS_CONSTRUCT_STOC_RENEGOTIATE 458 -# define SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME 459 -# define SSL_F_TLS_CONSTRUCT_STOC_SESSION_TICKET 460 -# define SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST 461 -# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_GROUPS 544 -# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_VERSIONS 611 -# define SSL_F_TLS_CONSTRUCT_STOC_USE_SRTP 462 -# define SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO 521 -# define SSL_F_TLS_FINISH_HANDSHAKE 597 -# define SSL_F_TLS_GET_MESSAGE_BODY 351 -# define SSL_F_TLS_GET_MESSAGE_HEADER 387 -# define SSL_F_TLS_HANDLE_ALPN 562 -# define SSL_F_TLS_HANDLE_STATUS_REQUEST 563 -# define SSL_F_TLS_PARSE_CERTIFICATE_AUTHORITIES 566 -# define SSL_F_TLS_PARSE_CLIENTHELLO_TLSEXT 449 -# define SSL_F_TLS_PARSE_CTOS_ALPN 567 -# define SSL_F_TLS_PARSE_CTOS_COOKIE 614 -# define SSL_F_TLS_PARSE_CTOS_EARLY_DATA 568 -# define SSL_F_TLS_PARSE_CTOS_EC_PT_FORMATS 569 -# define SSL_F_TLS_PARSE_CTOS_EMS 570 -# define SSL_F_TLS_PARSE_CTOS_KEY_SHARE 463 -# define SSL_F_TLS_PARSE_CTOS_MAXFRAGMENTLEN 571 -# define SSL_F_TLS_PARSE_CTOS_POST_HANDSHAKE_AUTH 620 -# define SSL_F_TLS_PARSE_CTOS_PSK 505 -# define SSL_F_TLS_PARSE_CTOS_PSK_KEX_MODES 572 -# define SSL_F_TLS_PARSE_CTOS_RENEGOTIATE 464 -# define SSL_F_TLS_PARSE_CTOS_SERVER_NAME 573 -# define SSL_F_TLS_PARSE_CTOS_SESSION_TICKET 574 -# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS 575 -# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS_CERT 615 -# define SSL_F_TLS_PARSE_CTOS_SRP 576 -# define SSL_F_TLS_PARSE_CTOS_STATUS_REQUEST 577 -# define SSL_F_TLS_PARSE_CTOS_SUPPORTED_GROUPS 578 -# define SSL_F_TLS_PARSE_CTOS_USE_SRTP 465 -# define SSL_F_TLS_PARSE_STOC_ALPN 579 -# define SSL_F_TLS_PARSE_STOC_COOKIE 534 -# define SSL_F_TLS_PARSE_STOC_EARLY_DATA 538 -# define SSL_F_TLS_PARSE_STOC_EARLY_DATA_INFO 528 -# define SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS 580 -# define SSL_F_TLS_PARSE_STOC_KEY_SHARE 445 -# define SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN 581 -# define SSL_F_TLS_PARSE_STOC_NPN 582 -# define SSL_F_TLS_PARSE_STOC_PSK 502 -# define SSL_F_TLS_PARSE_STOC_RENEGOTIATE 448 -# define SSL_F_TLS_PARSE_STOC_SCT 564 -# define SSL_F_TLS_PARSE_STOC_SERVER_NAME 583 -# define SSL_F_TLS_PARSE_STOC_SESSION_TICKET 584 -# define SSL_F_TLS_PARSE_STOC_STATUS_REQUEST 585 -# define SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS 612 -# define SSL_F_TLS_PARSE_STOC_USE_SRTP 446 -# define SSL_F_TLS_POST_PROCESS_CLIENT_HELLO 378 -# define SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE 384 -# define SSL_F_TLS_PREPARE_CLIENT_CERTIFICATE 360 -# define SSL_F_TLS_PROCESS_AS_HELLO_RETRY_REQUEST 610 -# define SSL_F_TLS_PROCESS_CERTIFICATE_REQUEST 361 -# define SSL_F_TLS_PROCESS_CERT_STATUS 362 -# define SSL_F_TLS_PROCESS_CERT_STATUS_BODY 495 -# define SSL_F_TLS_PROCESS_CERT_VERIFY 379 -# define SSL_F_TLS_PROCESS_CHANGE_CIPHER_SPEC 363 -# define SSL_F_TLS_PROCESS_CKE_DHE 411 -# define SSL_F_TLS_PROCESS_CKE_ECDHE 412 -# define SSL_F_TLS_PROCESS_CKE_GOST 413 -# define SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE 414 -# define SSL_F_TLS_PROCESS_CKE_RSA 415 -# define SSL_F_TLS_PROCESS_CKE_SRP 416 -# define SSL_F_TLS_PROCESS_CLIENT_CERTIFICATE 380 -# define SSL_F_TLS_PROCESS_CLIENT_HELLO 381 -# define SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE 382 -# define SSL_F_TLS_PROCESS_ENCRYPTED_EXTENSIONS 444 -# define SSL_F_TLS_PROCESS_END_OF_EARLY_DATA 537 -# define SSL_F_TLS_PROCESS_FINISHED 364 -# define SSL_F_TLS_PROCESS_HELLO_REQ 507 -# define SSL_F_TLS_PROCESS_HELLO_RETRY_REQUEST 511 -# define SSL_F_TLS_PROCESS_INITIAL_SERVER_FLIGHT 442 -# define SSL_F_TLS_PROCESS_KEY_EXCHANGE 365 -# define SSL_F_TLS_PROCESS_KEY_UPDATE 518 -# define SSL_F_TLS_PROCESS_NEW_SESSION_TICKET 366 -# define SSL_F_TLS_PROCESS_NEXT_PROTO 383 -# define SSL_F_TLS_PROCESS_SERVER_CERTIFICATE 367 -# define SSL_F_TLS_PROCESS_SERVER_DONE 368 -# define SSL_F_TLS_PROCESS_SERVER_HELLO 369 -# define SSL_F_TLS_PROCESS_SKE_DHE 419 -# define SSL_F_TLS_PROCESS_SKE_ECDHE 420 -# define SSL_F_TLS_PROCESS_SKE_PSK_PREAMBLE 421 -# define SSL_F_TLS_PROCESS_SKE_SRP 422 -# define SSL_F_TLS_PSK_DO_BINDER 506 -# define SSL_F_TLS_SCAN_CLIENTHELLO_TLSEXT 450 -# define SSL_F_TLS_SETUP_HANDSHAKE 508 -# define SSL_F_USE_CERTIFICATE_CHAIN_FILE 220 -# define SSL_F_WPACKET_INTERN_INIT_LEN 633 -# define SSL_F_WPACKET_START_SUB_PACKET_LEN__ 634 -# define SSL_F_WRITE_STATE_MACHINE 586 - -/* - * SSL reason codes. - */ -# define SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY 291 -# define SSL_R_APP_DATA_IN_HANDSHAKE 100 -# define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 -# define SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE 143 -# define SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE 158 -# define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 -# define SSL_R_BAD_CIPHER 186 -# define SSL_R_BAD_DATA 390 -# define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 -# define SSL_R_BAD_DECOMPRESSION 107 -# define SSL_R_BAD_DH_VALUE 102 -# define SSL_R_BAD_DIGEST_LENGTH 111 -# define SSL_R_BAD_EARLY_DATA 233 -# define SSL_R_BAD_ECC_CERT 304 -# define SSL_R_BAD_ECPOINT 306 -# define SSL_R_BAD_EXTENSION 110 -# define SSL_R_BAD_HANDSHAKE_LENGTH 332 -# define SSL_R_BAD_HANDSHAKE_STATE 236 -# define SSL_R_BAD_HELLO_REQUEST 105 -# define SSL_R_BAD_HRR_VERSION 263 -# define SSL_R_BAD_KEY_SHARE 108 -# define SSL_R_BAD_KEY_UPDATE 122 -# define SSL_R_BAD_LEGACY_VERSION 292 -# define SSL_R_BAD_LENGTH 271 -# define SSL_R_BAD_PACKET 240 -# define SSL_R_BAD_PACKET_LENGTH 115 -# define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 -# define SSL_R_BAD_PSK 219 -# define SSL_R_BAD_PSK_IDENTITY 114 -# define SSL_R_BAD_RECORD_TYPE 443 -# define SSL_R_BAD_RSA_ENCRYPT 119 -# define SSL_R_BAD_SIGNATURE 123 -# define SSL_R_BAD_SRP_A_LENGTH 347 -# define SSL_R_BAD_SRP_PARAMETERS 371 -# define SSL_R_BAD_SRTP_MKI_VALUE 352 -# define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 -# define SSL_R_BAD_SSL_FILETYPE 124 -# define SSL_R_BAD_VALUE 384 -# define SSL_R_BAD_WRITE_RETRY 127 -# define SSL_R_BINDER_DOES_NOT_VERIFY 253 -# define SSL_R_BIO_NOT_SET 128 -# define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 -# define SSL_R_BN_LIB 130 -# define SSL_R_CALLBACK_FAILED 234 -# define SSL_R_CANNOT_CHANGE_CIPHER 109 -# define SSL_R_CA_DN_LENGTH_MISMATCH 131 -# define SSL_R_CA_KEY_TOO_SMALL 397 -# define SSL_R_CA_MD_TOO_WEAK 398 -# define SSL_R_CCS_RECEIVED_EARLY 133 -# define SSL_R_CERTIFICATE_VERIFY_FAILED 134 -# define SSL_R_CERT_CB_ERROR 377 -# define SSL_R_CERT_LENGTH_MISMATCH 135 -# define SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED 218 -# define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 -# define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 -# define SSL_R_CLIENTHELLO_TLSEXT 226 -# define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 -# define SSL_R_COMPRESSION_DISABLED 343 -# define SSL_R_COMPRESSION_FAILURE 141 -# define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 -# define SSL_R_COMPRESSION_LIBRARY_ERROR 142 -# define SSL_R_CONNECTION_TYPE_NOT_SET 144 -# define SSL_R_CONTEXT_NOT_DANE_ENABLED 167 -# define SSL_R_COOKIE_GEN_CALLBACK_FAILURE 400 -# define SSL_R_COOKIE_MISMATCH 308 -# define SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED 206 -# define SSL_R_DANE_ALREADY_ENABLED 172 -# define SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL 173 -# define SSL_R_DANE_NOT_ENABLED 175 -# define SSL_R_DANE_TLSA_BAD_CERTIFICATE 180 -# define SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE 184 -# define SSL_R_DANE_TLSA_BAD_DATA_LENGTH 189 -# define SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH 192 -# define SSL_R_DANE_TLSA_BAD_MATCHING_TYPE 200 -# define SSL_R_DANE_TLSA_BAD_PUBLIC_KEY 201 -# define SSL_R_DANE_TLSA_BAD_SELECTOR 202 -# define SSL_R_DANE_TLSA_NULL_DATA 203 -# define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 -# define SSL_R_DATA_LENGTH_TOO_LONG 146 -# define SSL_R_DECRYPTION_FAILED 147 -# define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 -# define SSL_R_DH_KEY_TOO_SMALL 394 -# define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 -# define SSL_R_DIGEST_CHECK_FAILED 149 -# define SSL_R_DTLS_MESSAGE_TOO_BIG 334 -# define SSL_R_DUPLICATE_COMPRESSION_ID 309 -# define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 -# define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 -# define SSL_R_EE_KEY_TOO_SMALL 399 -# define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 -# define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 -# define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 -# define SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN 204 -# define SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE 194 -# define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 -# define SSL_R_EXTENSION_NOT_RECEIVED 279 -# define SSL_R_EXTRA_DATA_IN_MESSAGE 153 -# define SSL_R_EXT_LENGTH_MISMATCH 163 -# define SSL_R_FAILED_TO_INIT_ASYNC 405 -# define SSL_R_FRAGMENTED_CLIENT_HELLO 401 -# define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 -# define SSL_R_HTTPS_PROXY_REQUEST 155 -# define SSL_R_HTTP_REQUEST 156 -# define SSL_R_ILLEGAL_POINT_COMPRESSION 162 -# define SSL_R_ILLEGAL_SUITEB_DIGEST 380 -# define SSL_R_INAPPROPRIATE_FALLBACK 373 -# define SSL_R_INCONSISTENT_COMPRESSION 340 -# define SSL_R_INCONSISTENT_EARLY_DATA_ALPN 222 -# define SSL_R_INCONSISTENT_EARLY_DATA_SNI 231 -# define SSL_R_INCONSISTENT_EXTMS 104 -# define SSL_R_INSUFFICIENT_SECURITY 241 -# define SSL_R_INVALID_ALERT 205 -# define SSL_R_INVALID_CCS_MESSAGE 260 -# define SSL_R_INVALID_CERTIFICATE_OR_ALG 238 -# define SSL_R_INVALID_COMMAND 280 -# define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 -# define SSL_R_INVALID_CONFIG 283 -# define SSL_R_INVALID_CONFIGURATION_NAME 113 -# define SSL_R_INVALID_CONTEXT 282 -# define SSL_R_INVALID_CT_VALIDATION_TYPE 212 -# define SSL_R_INVALID_KEY_UPDATE_TYPE 120 -# define SSL_R_INVALID_MAX_EARLY_DATA 174 -# define SSL_R_INVALID_NULL_CMD_NAME 385 -# define SSL_R_INVALID_SEQUENCE_NUMBER 402 -# define SSL_R_INVALID_SERVERINFO_DATA 388 -# define SSL_R_INVALID_SESSION_ID 999 -# define SSL_R_INVALID_SRP_USERNAME 357 -# define SSL_R_INVALID_STATUS_RESPONSE 328 -# define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 -# define SSL_R_LENGTH_MISMATCH 159 -# define SSL_R_LENGTH_TOO_LONG 404 -# define SSL_R_LENGTH_TOO_SHORT 160 -# define SSL_R_LIBRARY_BUG 274 -# define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 -# define SSL_R_MISSING_DSA_SIGNING_CERT 165 -# define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 -# define SSL_R_MISSING_FATAL 256 -# define SSL_R_MISSING_PARAMETERS 290 -# define SSL_R_MISSING_RSA_CERTIFICATE 168 -# define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 -# define SSL_R_MISSING_RSA_SIGNING_CERT 170 -# define SSL_R_MISSING_SIGALGS_EXTENSION 112 -# define SSL_R_MISSING_SIGNING_CERT 221 -# define SSL_R_MISSING_SRP_PARAM 358 -# define SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION 209 -# define SSL_R_MISSING_TMP_DH_KEY 171 -# define SSL_R_MISSING_TMP_ECDH_KEY 311 -# define SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA 293 -# define SSL_R_NOT_ON_RECORD_BOUNDARY 182 -# define SSL_R_NOT_REPLACING_CERTIFICATE 289 -# define SSL_R_NOT_SERVER 284 -# define SSL_R_NO_APPLICATION_PROTOCOL 235 -# define SSL_R_NO_CERTIFICATES_RETURNED 176 -# define SSL_R_NO_CERTIFICATE_ASSIGNED 177 -# define SSL_R_NO_CERTIFICATE_SET 179 -# define SSL_R_NO_CHANGE_FOLLOWING_HRR 214 -# define SSL_R_NO_CIPHERS_AVAILABLE 181 -# define SSL_R_NO_CIPHERS_SPECIFIED 183 -# define SSL_R_NO_CIPHER_MATCH 185 -# define SSL_R_NO_CLIENT_CERT_METHOD 331 -# define SSL_R_NO_COMPRESSION_SPECIFIED 187 -# define SSL_R_NO_COOKIE_CALLBACK_SET 287 -# define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 -# define SSL_R_NO_METHOD_SPECIFIED 188 -# define SSL_R_NO_PEM_EXTENSIONS 389 -# define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 -# define SSL_R_NO_PROTOCOLS_AVAILABLE 191 -# define SSL_R_NO_RENEGOTIATION 339 -# define SSL_R_NO_REQUIRED_DIGEST 324 -# define SSL_R_NO_SHARED_CIPHER 193 -# define SSL_R_NO_SHARED_GROUPS 410 -# define SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS 376 -# define SSL_R_NO_SRTP_PROFILES 359 -# define SSL_R_NO_SUITABLE_KEY_SHARE 101 -# define SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM 118 -# define SSL_R_NO_VALID_SCTS 216 -# define SSL_R_NO_VERIFY_COOKIE_CALLBACK 403 -# define SSL_R_NULL_SSL_CTX 195 -# define SSL_R_NULL_SSL_METHOD_PASSED 196 -# define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 -# define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 -# define SSL_R_OVERFLOW_ERROR 237 -# define SSL_R_PACKET_LENGTH_TOO_LONG 198 -# define SSL_R_PARSE_TLSEXT 227 -# define SSL_R_PATH_TOO_LONG 270 -# define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 -# define SSL_R_PEM_NAME_BAD_PREFIX 391 -# define SSL_R_PEM_NAME_TOO_SHORT 392 -# define SSL_R_PIPELINE_FAILURE 406 -# define SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR 278 -# define SSL_R_PRIVATE_KEY_MISMATCH 288 -# define SSL_R_PROTOCOL_IS_SHUTDOWN 207 -# define SSL_R_PSK_IDENTITY_NOT_FOUND 223 -# define SSL_R_PSK_NO_CLIENT_CB 224 -# define SSL_R_PSK_NO_SERVER_CB 225 -# define SSL_R_READ_BIO_NOT_SET 211 -# define SSL_R_READ_TIMEOUT_EXPIRED 312 -# define SSL_R_RECORD_LENGTH_MISMATCH 213 -# define SSL_R_RECORD_TOO_SMALL 298 -# define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 -# define SSL_R_RENEGOTIATION_ENCODING_ERR 336 -# define SSL_R_RENEGOTIATION_MISMATCH 337 -# define SSL_R_REQUEST_PENDING 285 -# define SSL_R_REQUEST_SENT 286 -# define SSL_R_REQUIRED_CIPHER_MISSING 215 -# define SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING 342 -# define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 -# define SSL_R_SCT_VERIFICATION_FAILED 208 -# define SSL_R_SERVERHELLO_TLSEXT 275 -# define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 -# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 -# define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 -# define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 -# define SSL_R_SRP_A_CALC 361 -# define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 -# define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 -# define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 -# define SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH 232 -# define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 -# define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 -# define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 -# define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 -# define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 -# define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 -# define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 -# define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 -# define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 -# define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 -# define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 -# define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 -# define SSL_R_SSL_COMMAND_SECTION_EMPTY 117 -# define SSL_R_SSL_COMMAND_SECTION_NOT_FOUND 125 -# define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 -# define SSL_R_SSL_HANDSHAKE_FAILURE 229 -# define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 -# define SSL_R_SSL_NEGATIVE_LENGTH 372 -# define SSL_R_SSL_SECTION_EMPTY 126 -# define SSL_R_SSL_SECTION_NOT_FOUND 136 -# define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 -# define SSL_R_SSL_SESSION_ID_CONFLICT 302 -# define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 -# define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 -# define SSL_R_SSL_SESSION_ID_TOO_LONG 408 -# define SSL_R_SSL_SESSION_VERSION_MISMATCH 210 -# define SSL_R_STILL_IN_INIT 121 -# define SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED 1116 -# define SSL_R_TLSV13_ALERT_MISSING_EXTENSION 1109 -# define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 -# define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 -# define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 -# define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 -# define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 -# define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 -# define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 -# define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 -# define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 -# define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 -# define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 -# define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 -# define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 -# define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 -# define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 -# define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 -# define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 -# define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 -# define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 -# define SSL_R_TLS_HEARTBEAT_PENDING 366 -# define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 -# define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 -# define SSL_R_TOO_MANY_KEY_UPDATES 132 -# define SSL_R_TOO_MANY_WARN_ALERTS 409 -# define SSL_R_TOO_MUCH_EARLY_DATA 164 -# define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 -# define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 -# define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 -# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 -# define SSL_R_UNEXPECTED_CCS_MESSAGE 262 -# define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178 -# define SSL_R_UNEXPECTED_MESSAGE 244 -# define SSL_R_UNEXPECTED_RECORD 245 -# define SSL_R_UNINITIALIZED 276 -# define SSL_R_UNKNOWN_ALERT_TYPE 246 -# define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 -# define SSL_R_UNKNOWN_CIPHER_RETURNED 248 -# define SSL_R_UNKNOWN_CIPHER_TYPE 249 -# define SSL_R_UNKNOWN_CMD_NAME 386 -# define SSL_R_UNKNOWN_COMMAND 139 -# define SSL_R_UNKNOWN_DIGEST 368 -# define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 -# define SSL_R_UNKNOWN_PKEY_TYPE 251 -# define SSL_R_UNKNOWN_PROTOCOL 252 -# define SSL_R_UNKNOWN_SSL_VERSION 254 -# define SSL_R_UNKNOWN_STATE 255 -# define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 -# define SSL_R_UNSOLICITED_EXTENSION 217 -# define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 -# define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 -# define SSL_R_UNSUPPORTED_PROTOCOL 258 -# define SSL_R_UNSUPPORTED_SSL_VERSION 259 -# define SSL_R_UNSUPPORTED_STATUS_TYPE 329 -# define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 -# define SSL_R_VERSION_TOO_HIGH 166 -# define SSL_R_VERSION_TOO_LOW 396 -# define SSL_R_WRONG_CERTIFICATE_TYPE 383 -# define SSL_R_WRONG_CIPHER_RETURNED 261 -# define SSL_R_WRONG_CURVE 378 -# define SSL_R_WRONG_SIGNATURE_LENGTH 264 -# define SSL_R_WRONG_SIGNATURE_SIZE 265 -# define SSL_R_WRONG_SIGNATURE_TYPE 370 -# define SSL_R_WRONG_SSL_VERSION 266 -# define SSL_R_WRONG_VERSION_NUMBER 267 -# define SSL_R_X509_LIB 268 -# define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/stack.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/stack.h deleted file mode 100644 index cfc07505..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/stack.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 1995-2017 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_STACK_H -# define HEADER_STACK_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */ - -typedef int (*OPENSSL_sk_compfunc)(const void *, const void *); -typedef void (*OPENSSL_sk_freefunc)(void *); -typedef void *(*OPENSSL_sk_copyfunc)(const void *); - -int OPENSSL_sk_num(const OPENSSL_STACK *); -void *OPENSSL_sk_value(const OPENSSL_STACK *, int); - -void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data); - -OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp); -OPENSSL_STACK *OPENSSL_sk_new_null(void); -OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n); -int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n); -void OPENSSL_sk_free(OPENSSL_STACK *); -void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *)); -OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, - OPENSSL_sk_copyfunc c, - OPENSSL_sk_freefunc f); -int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where); -void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc); -void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p); -int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data); -int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data); -void *OPENSSL_sk_shift(OPENSSL_STACK *st); -void *OPENSSL_sk_pop(OPENSSL_STACK *st); -void OPENSSL_sk_zero(OPENSSL_STACK *st); -OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, - OPENSSL_sk_compfunc cmp); -OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st); -void OPENSSL_sk_sort(OPENSSL_STACK *st); -int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define _STACK OPENSSL_STACK -# define sk_num OPENSSL_sk_num -# define sk_value OPENSSL_sk_value -# define sk_set OPENSSL_sk_set -# define sk_new OPENSSL_sk_new -# define sk_new_null OPENSSL_sk_new_null -# define sk_free OPENSSL_sk_free -# define sk_pop_free OPENSSL_sk_pop_free -# define sk_deep_copy OPENSSL_sk_deep_copy -# define sk_insert OPENSSL_sk_insert -# define sk_delete OPENSSL_sk_delete -# define sk_delete_ptr OPENSSL_sk_delete_ptr -# define sk_find OPENSSL_sk_find -# define sk_find_ex OPENSSL_sk_find_ex -# define sk_push OPENSSL_sk_push -# define sk_unshift OPENSSL_sk_unshift -# define sk_shift OPENSSL_sk_shift -# define sk_pop OPENSSL_sk_pop -# define sk_zero OPENSSL_sk_zero -# define sk_set_cmp_func OPENSSL_sk_set_cmp_func -# define sk_dup OPENSSL_sk_dup -# define sk_sort OPENSSL_sk_sort -# define sk_is_sorted OPENSSL_sk_is_sorted -# endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/store.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/store.h deleted file mode 100644 index a40a7339..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/store.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2016-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_OSSL_STORE_H -# define HEADER_OSSL_STORE_H - -# include -# include -# include -# include - -# ifdef __cplusplus -extern "C" { -# endif - -/*- - * The main OSSL_STORE functions. - * ------------------------------ - * - * These allow applications to open a channel to a resource with supported - * data (keys, certs, crls, ...), read the data a piece at a time and decide - * what to do with it, and finally close. - */ - -typedef struct ossl_store_ctx_st OSSL_STORE_CTX; - -/* - * Typedef for the OSSL_STORE_INFO post processing callback. This can be used - * to massage the given OSSL_STORE_INFO, or to drop it entirely (by returning - * NULL). - */ -typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *, - void *); - -/* - * Open a channel given a URI. The given UI method will be used any time the - * loader needs extra input, for example when a password or pin is needed, and - * will be passed the same user data every time it's needed in this context. - * - * Returns a context reference which represents the channel to communicate - * through. - */ -OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method, - void *ui_data, - OSSL_STORE_post_process_info_fn post_process, - void *post_process_data); - -/* - * Control / fine tune the OSSL_STORE channel. |cmd| determines what is to be - * done, and depends on the underlying loader (use OSSL_STORE_get0_scheme to - * determine which loader is used), except for common commands (see below). - * Each command takes different arguments. - */ -int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */); -int OSSL_STORE_vctrl(OSSL_STORE_CTX *ctx, int cmd, va_list args); - -/* - * Common ctrl commands that different loaders may choose to support. - */ -/* int on = 0 or 1; STORE_ctrl(ctx, STORE_C_USE_SECMEM, &on); */ -# define OSSL_STORE_C_USE_SECMEM 1 -/* Where custom commands start */ -# define OSSL_STORE_C_CUSTOM_START 100 - -/* - * Read one data item (a key, a cert, a CRL) that is supported by the OSSL_STORE - * functionality, given a context. - * Returns a OSSL_STORE_INFO pointer, from which OpenSSL typed data can be - * extracted with OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), ... - * NULL is returned on error, which may include that the data found at the URI - * can't be figured out for certain or is ambiguous. - */ -OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx); - -/* - * Check if end of data (end of file) is reached - * Returns 1 on end, 0 otherwise. - */ -int OSSL_STORE_eof(OSSL_STORE_CTX *ctx); - -/* - * Check if an error occurred - * Returns 1 if it did, 0 otherwise. - */ -int OSSL_STORE_error(OSSL_STORE_CTX *ctx); - -/* - * Close the channel - * Returns 1 on success, 0 on error. - */ -int OSSL_STORE_close(OSSL_STORE_CTX *ctx); - - -/*- - * Extracting OpenSSL types from and creating new OSSL_STORE_INFOs - * --------------------------------------------------------------- - */ - -/* - * Types of data that can be ossl_stored in a OSSL_STORE_INFO. - * OSSL_STORE_INFO_NAME is typically found when getting a listing of - * available "files" / "tokens" / what have you. - */ -# define OSSL_STORE_INFO_NAME 1 /* char * */ -# define OSSL_STORE_INFO_PARAMS 2 /* EVP_PKEY * */ -# define OSSL_STORE_INFO_PKEY 3 /* EVP_PKEY * */ -# define OSSL_STORE_INFO_CERT 4 /* X509 * */ -# define OSSL_STORE_INFO_CRL 5 /* X509_CRL * */ - -/* - * Functions to generate OSSL_STORE_INFOs, one function for each type we - * support having in them, as well as a generic constructor. - * - * In all cases, ownership of the object is transferred to the OSSL_STORE_INFO - * and will therefore be freed when the OSSL_STORE_INFO is freed. - */ -OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name); -int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(EVP_PKEY *params); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509); -OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl); - -/* - * Functions to try to extract data from a OSSL_STORE_INFO. - */ -int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *info); -const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *info); -char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *info); -const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO *info); -char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *info); -EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *info); -X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *info); -X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *info); -X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *info); -X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *info); - -const char *OSSL_STORE_INFO_type_string(int type); - -/* - * Free the OSSL_STORE_INFO - */ -void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info); - - -/*- - * Functions to construct a search URI from a base URI and search criteria - * ----------------------------------------------------------------------- - */ - -/* OSSL_STORE search types */ -# define OSSL_STORE_SEARCH_BY_NAME 1 /* subject in certs, issuer in CRLs */ -# define OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 2 -# define OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 3 -# define OSSL_STORE_SEARCH_BY_ALIAS 4 - -/* To check what search types the scheme handler supports */ -int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type); - -/* Search term constructors */ -/* - * The input is considered to be owned by the caller, and must therefore - * remain present throughout the lifetime of the returned OSSL_STORE_SEARCH - */ -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name, - const ASN1_INTEGER - *serial); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest, - const unsigned char - *bytes, size_t len); -OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias); - -/* Search term destructor */ -void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search); - -/* Search term accessors */ -int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion); -X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion); -const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH - *criterion); -const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH - *criterion, size_t *length); -const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion); -const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH *criterion); - -/* - * Add search criterion and expected return type (which can be unspecified) - * to the loading channel. This MUST happen before the first OSSL_STORE_load(). - */ -int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type); -int OSSL_STORE_find(OSSL_STORE_CTX *ctx, OSSL_STORE_SEARCH *search); - - -/*- - * Function to register a loader for the given URI scheme. - * ------------------------------------------------------- - * - * The loader receives all the main components of an URI except for the - * scheme. - */ - -typedef struct ossl_store_loader_st OSSL_STORE_LOADER; -OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme); -const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader); -const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader); -/* struct ossl_store_loader_ctx_st is defined differently by each loader */ -typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX; -typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(const OSSL_STORE_LOADER - *loader, - const char *uri, - const UI_METHOD *ui_method, - void *ui_data); -int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader, - OSSL_STORE_open_fn open_function); -typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd, - va_list args); -int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader, - OSSL_STORE_ctrl_fn ctrl_function); -typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected); -int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader, - OSSL_STORE_expect_fn expect_function); -typedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx, - OSSL_STORE_SEARCH *criteria); -int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader, - OSSL_STORE_find_fn find_function); -typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx, - const UI_METHOD *ui_method, - void *ui_data); -int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *loader, - OSSL_STORE_load_fn load_function); -typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *loader, - OSSL_STORE_eof_fn eof_function); -typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader, - OSSL_STORE_error_fn error_function); -typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx); -int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader, - OSSL_STORE_close_fn close_function); -void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader); - -int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader); -OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme); - -/*- - * Functions to list STORE loaders - * ------------------------------- - */ -int OSSL_STORE_do_all_loaders(void (*do_function) (const OSSL_STORE_LOADER - *loader, void *do_arg), - void *do_arg); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/storeerr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/storeerr.h deleted file mode 100644 index 190eab07..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/storeerr.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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_OSSL_STOREERR_H -# define HEADER_OSSL_STOREERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_OSSL_STORE_strings(void); - -/* - * OSSL_STORE function codes. - */ -# define OSSL_STORE_F_FILE_CTRL 129 -# define OSSL_STORE_F_FILE_FIND 138 -# define OSSL_STORE_F_FILE_GET_PASS 118 -# define OSSL_STORE_F_FILE_LOAD 119 -# define OSSL_STORE_F_FILE_LOAD_TRY_DECODE 124 -# define OSSL_STORE_F_FILE_NAME_TO_URI 126 -# define OSSL_STORE_F_FILE_OPEN 120 -# define OSSL_STORE_F_OSSL_STORE_ATTACH_PEM_BIO 127 -# define OSSL_STORE_F_OSSL_STORE_EXPECT 130 -# define OSSL_STORE_F_OSSL_STORE_FILE_ATTACH_PEM_BIO_INT 128 -# define OSSL_STORE_F_OSSL_STORE_FIND 131 -# define OSSL_STORE_F_OSSL_STORE_GET0_LOADER_INT 100 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CERT 101 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CRL 102 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME 103 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME_DESCRIPTION 135 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PARAMS 104 -# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PKEY 105 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CERT 106 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CRL 107 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_EMBEDDED 123 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_NAME 109 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PARAMS 110 -# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PKEY 111 -# define OSSL_STORE_F_OSSL_STORE_INFO_SET0_NAME_DESCRIPTION 134 -# define OSSL_STORE_F_OSSL_STORE_INIT_ONCE 112 -# define OSSL_STORE_F_OSSL_STORE_LOADER_NEW 113 -# define OSSL_STORE_F_OSSL_STORE_OPEN 114 -# define OSSL_STORE_F_OSSL_STORE_OPEN_INT 115 -# define OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT 117 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ALIAS 132 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 133 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 136 -# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_NAME 137 -# define OSSL_STORE_F_OSSL_STORE_UNREGISTER_LOADER_INT 116 -# define OSSL_STORE_F_TRY_DECODE_PARAMS 121 -# define OSSL_STORE_F_TRY_DECODE_PKCS12 122 -# define OSSL_STORE_F_TRY_DECODE_PKCS8ENCRYPTED 125 - -/* - * OSSL_STORE reason codes. - */ -# define OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE 107 -# define OSSL_STORE_R_BAD_PASSWORD_READ 115 -# define OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC 113 -# define OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST 121 -# define OSSL_STORE_R_INVALID_SCHEME 106 -# define OSSL_STORE_R_IS_NOT_A 112 -# define OSSL_STORE_R_LOADER_INCOMPLETE 116 -# define OSSL_STORE_R_LOADING_STARTED 117 -# define OSSL_STORE_R_NOT_A_CERTIFICATE 100 -# define OSSL_STORE_R_NOT_A_CRL 101 -# define OSSL_STORE_R_NOT_A_KEY 102 -# define OSSL_STORE_R_NOT_A_NAME 103 -# define OSSL_STORE_R_NOT_PARAMETERS 104 -# define OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR 114 -# define OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE 108 -# define OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 119 -# define OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED 109 -# define OSSL_STORE_R_UNREGISTERED_SCHEME 105 -# define OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE 110 -# define OSSL_STORE_R_UNSUPPORTED_OPERATION 118 -# define OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE 120 -# define OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED 111 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/symhacks.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/symhacks.h deleted file mode 100644 index 156ea6e4..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/symhacks.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 1999-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_SYMHACKS_H -# define HEADER_SYMHACKS_H - -# include - -/* Case insensitive linking causes problems.... */ -# if defined(OPENSSL_SYS_VMS) -# undef ERR_load_CRYPTO_strings -# define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings -# undef OCSP_crlID_new -# define OCSP_crlID_new OCSP_crlID2_new - -# undef d2i_ECPARAMETERS -# define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS -# undef i2d_ECPARAMETERS -# define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS -# undef d2i_ECPKPARAMETERS -# define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS -# undef i2d_ECPKPARAMETERS -# define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS - -/* This one clashes with CMS_data_create */ -# undef cms_Data_create -# define cms_Data_create priv_cms_Data_create - -# endif - -#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/tls1.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/tls1.h deleted file mode 100644 index 76d9fda4..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/tls1.h +++ /dev/null @@ -1,1237 +0,0 @@ -/* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved - * Copyright 2005 Nokia. 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_TLS1_H -# define HEADER_TLS1_H - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Default security level if not overridden at config time */ -# ifndef OPENSSL_TLS_SECURITY_LEVEL -# define OPENSSL_TLS_SECURITY_LEVEL 1 -# endif - -# define TLS1_VERSION 0x0301 -# define TLS1_1_VERSION 0x0302 -# define TLS1_2_VERSION 0x0303 -# define TLS1_3_VERSION 0x0304 -# define TLS_MAX_VERSION TLS1_3_VERSION - -/* Special value for method supporting multiple versions */ -# define TLS_ANY_VERSION 0x10000 - -# define TLS1_VERSION_MAJOR 0x03 -# define TLS1_VERSION_MINOR 0x01 - -# define TLS1_1_VERSION_MAJOR 0x03 -# define TLS1_1_VERSION_MINOR 0x02 - -# define TLS1_2_VERSION_MAJOR 0x03 -# define TLS1_2_VERSION_MINOR 0x03 - -# define TLS1_get_version(s) \ - ((SSL_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_version(s) : 0) - -# define TLS1_get_client_version(s) \ - ((SSL_client_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_client_version(s) : 0) - -# define TLS1_AD_DECRYPTION_FAILED 21 -# define TLS1_AD_RECORD_OVERFLOW 22 -# define TLS1_AD_UNKNOWN_CA 48/* fatal */ -# define TLS1_AD_ACCESS_DENIED 49/* fatal */ -# define TLS1_AD_DECODE_ERROR 50/* fatal */ -# define TLS1_AD_DECRYPT_ERROR 51 -# define TLS1_AD_EXPORT_RESTRICTION 60/* fatal */ -# define TLS1_AD_PROTOCOL_VERSION 70/* fatal */ -# define TLS1_AD_INSUFFICIENT_SECURITY 71/* fatal */ -# define TLS1_AD_INTERNAL_ERROR 80/* fatal */ -# define TLS1_AD_INAPPROPRIATE_FALLBACK 86/* fatal */ -# define TLS1_AD_USER_CANCELLED 90 -# define TLS1_AD_NO_RENEGOTIATION 100 -/* TLSv1.3 alerts */ -# define TLS13_AD_MISSING_EXTENSION 109 /* fatal */ -# define TLS13_AD_CERTIFICATE_REQUIRED 116 /* fatal */ -/* codes 110-114 are from RFC3546 */ -# define TLS1_AD_UNSUPPORTED_EXTENSION 110 -# define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 -# define TLS1_AD_UNRECOGNIZED_NAME 112 -# define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 -# define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 -# define TLS1_AD_UNKNOWN_PSK_IDENTITY 115/* fatal */ -# define TLS1_AD_NO_APPLICATION_PROTOCOL 120 /* fatal */ - -/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ -# define TLSEXT_TYPE_server_name 0 -# define TLSEXT_TYPE_max_fragment_length 1 -# define TLSEXT_TYPE_client_certificate_url 2 -# define TLSEXT_TYPE_trusted_ca_keys 3 -# define TLSEXT_TYPE_truncated_hmac 4 -# define TLSEXT_TYPE_status_request 5 -/* ExtensionType values from RFC4681 */ -# define TLSEXT_TYPE_user_mapping 6 -/* ExtensionType values from RFC5878 */ -# define TLSEXT_TYPE_client_authz 7 -# define TLSEXT_TYPE_server_authz 8 -/* ExtensionType values from RFC6091 */ -# define TLSEXT_TYPE_cert_type 9 - -/* ExtensionType values from RFC4492 */ -/* - * Prior to TLSv1.3 the supported_groups extension was known as - * elliptic_curves - */ -# define TLSEXT_TYPE_supported_groups 10 -# define TLSEXT_TYPE_elliptic_curves TLSEXT_TYPE_supported_groups -# define TLSEXT_TYPE_ec_point_formats 11 - - -/* ExtensionType value from RFC5054 */ -# define TLSEXT_TYPE_srp 12 - -/* ExtensionType values from RFC5246 */ -# define TLSEXT_TYPE_signature_algorithms 13 - -/* ExtensionType value from RFC5764 */ -# define TLSEXT_TYPE_use_srtp 14 - -/* ExtensionType value from RFC5620 */ -# define TLSEXT_TYPE_heartbeat 15 - -/* ExtensionType value from RFC7301 */ -# define TLSEXT_TYPE_application_layer_protocol_negotiation 16 - -/* - * Extension type for Certificate Transparency - * https://tools.ietf.org/html/rfc6962#section-3.3.1 - */ -# define TLSEXT_TYPE_signed_certificate_timestamp 18 - -/* - * ExtensionType value for TLS padding extension. - * http://tools.ietf.org/html/draft-agl-tls-padding - */ -# define TLSEXT_TYPE_padding 21 - -/* ExtensionType value from RFC7366 */ -# define TLSEXT_TYPE_encrypt_then_mac 22 - -/* ExtensionType value from RFC7627 */ -# define TLSEXT_TYPE_extended_master_secret 23 - -/* ExtensionType value from RFC4507 */ -# define TLSEXT_TYPE_session_ticket 35 - -/* As defined for TLS1.3 */ -# define TLSEXT_TYPE_psk 41 -# define TLSEXT_TYPE_early_data 42 -# define TLSEXT_TYPE_supported_versions 43 -# define TLSEXT_TYPE_cookie 44 -# define TLSEXT_TYPE_psk_kex_modes 45 -# define TLSEXT_TYPE_certificate_authorities 47 -# define TLSEXT_TYPE_post_handshake_auth 49 -# define TLSEXT_TYPE_signature_algorithms_cert 50 -# define TLSEXT_TYPE_key_share 51 - -/* Temporary extension type */ -# define TLSEXT_TYPE_renegotiate 0xff01 - -# ifndef OPENSSL_NO_NEXTPROTONEG -/* This is not an IANA defined extension number */ -# define TLSEXT_TYPE_next_proto_neg 13172 -# endif - -/* NameType value from RFC3546 */ -# define TLSEXT_NAMETYPE_host_name 0 -/* status request value from RFC3546 */ -# define TLSEXT_STATUSTYPE_ocsp 1 - -/* ECPointFormat values from RFC4492 */ -# define TLSEXT_ECPOINTFORMAT_first 0 -# define TLSEXT_ECPOINTFORMAT_uncompressed 0 -# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 -# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 -# define TLSEXT_ECPOINTFORMAT_last 2 - -/* Signature and hash algorithms from RFC5246 */ -# define TLSEXT_signature_anonymous 0 -# define TLSEXT_signature_rsa 1 -# define TLSEXT_signature_dsa 2 -# define TLSEXT_signature_ecdsa 3 -# define TLSEXT_signature_gostr34102001 237 -# define TLSEXT_signature_gostr34102012_256 238 -# define TLSEXT_signature_gostr34102012_512 239 - -/* Total number of different signature algorithms */ -# define TLSEXT_signature_num 7 - -# define TLSEXT_hash_none 0 -# define TLSEXT_hash_md5 1 -# define TLSEXT_hash_sha1 2 -# define TLSEXT_hash_sha224 3 -# define TLSEXT_hash_sha256 4 -# define TLSEXT_hash_sha384 5 -# define TLSEXT_hash_sha512 6 -# define TLSEXT_hash_gostr3411 237 -# define TLSEXT_hash_gostr34112012_256 238 -# define TLSEXT_hash_gostr34112012_512 239 - -/* Total number of different digest algorithms */ - -# define TLSEXT_hash_num 10 - -/* Flag set for unrecognised algorithms */ -# define TLSEXT_nid_unknown 0x1000000 - -/* ECC curves */ - -# define TLSEXT_curve_P_256 23 -# define TLSEXT_curve_P_384 24 - -/* OpenSSL value to disable maximum fragment length extension */ -# define TLSEXT_max_fragment_length_DISABLED 0 -/* Allowed values for max fragment length extension */ -# define TLSEXT_max_fragment_length_512 1 -# define TLSEXT_max_fragment_length_1024 2 -# define TLSEXT_max_fragment_length_2048 3 -# define TLSEXT_max_fragment_length_4096 4 - -int SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode); -int SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode); - -# define TLSEXT_MAXLEN_host_name 255 - -__owur const char *SSL_get_servername(const SSL *s, const int type); -__owur int SSL_get_servername_type(const SSL *s); -/* - * SSL_export_keying_material exports a value derived from the master secret, - * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and - * optional context. (Since a zero length context is allowed, the |use_context| - * flag controls whether a context is included.) It returns 1 on success and - * 0 or -1 otherwise. - */ -__owur int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, - const char *label, size_t llen, - const unsigned char *context, - size_t contextlen, int use_context); - -/* - * SSL_export_keying_material_early exports a value derived from the - * early exporter master secret, as specified in - * https://tools.ietf.org/html/draft-ietf-tls-tls13-23. It writes - * |olen| bytes to |out| given a label and optional context. It - * returns 1 on success and 0 otherwise. - */ -__owur int SSL_export_keying_material_early(SSL *s, unsigned char *out, - size_t olen, const char *label, - size_t llen, - const unsigned char *context, - size_t contextlen); - -int SSL_get_peer_signature_type_nid(const SSL *s, int *pnid); -int SSL_get_signature_type_nid(const SSL *s, int *pnid); - -int SSL_get_sigalgs(SSL *s, int idx, - int *psign, int *phash, int *psignandhash, - unsigned char *rsig, unsigned char *rhash); - -int SSL_get_shared_sigalgs(SSL *s, int idx, - int *psign, int *phash, int *psignandhash, - unsigned char *rsig, unsigned char *rhash); - -__owur int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain); - -# define SSL_set_tlsext_host_name(s,name) \ - SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,\ - (void *)name) - -# define SSL_set_tlsext_debug_callback(ssl, cb) \ - SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,\ - (void (*)(void))cb) - -# define SSL_set_tlsext_debug_arg(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0,arg) - -# define SSL_get_tlsext_status_type(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) - -# define SSL_set_tlsext_status_type(ssl, type) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) - -# define SSL_get_tlsext_status_exts(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0,arg) - -# define SSL_set_tlsext_status_exts(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0,arg) - -# define SSL_get_tlsext_status_ids(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0,arg) - -# define SSL_set_tlsext_status_ids(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0,arg) - -# define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0,arg) - -# define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ - SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen,arg) - -# define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ - SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,\ - (void (*)(void))cb) - -# define SSL_TLSEXT_ERR_OK 0 -# define SSL_TLSEXT_ERR_ALERT_WARNING 1 -# define SSL_TLSEXT_ERR_ALERT_FATAL 2 -# define SSL_TLSEXT_ERR_NOACK 3 - -# define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0,arg) - -# define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_GET_TLSEXT_TICKET_KEYS,keylen,keys) -# define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ - SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_TICKET_KEYS,keylen,keys) - -# define SSL_CTX_get_tlsext_status_cb(ssl, cb) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB,0,(void *)cb) -# define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ - SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,\ - (void (*)(void))cb) - -# define SSL_CTX_get_tlsext_status_arg(ssl, arg) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) -# define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) - -# define SSL_CTX_set_tlsext_status_type(ssl, type) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) - -# define SSL_CTX_get_tlsext_status_type(ssl) \ - SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) - -# define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ - SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,\ - (void (*)(void))cb) - -# ifndef OPENSSL_NO_HEARTBEATS -# define SSL_DTLSEXT_HB_ENABLED 0x01 -# define SSL_DTLSEXT_HB_DONT_SEND_REQUESTS 0x02 -# define SSL_DTLSEXT_HB_DONT_RECV_REQUESTS 0x04 -# define SSL_get_dtlsext_heartbeat_pending(ssl) \ - SSL_ctrl(ssl,SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING,0,NULL) -# define SSL_set_dtlsext_heartbeat_no_requests(ssl, arg) \ - SSL_ctrl(ssl,SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL) - -# if OPENSSL_API_COMPAT < 0x10100000L -# define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT \ - SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT -# define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING \ - SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING -# define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS \ - SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS -# define SSL_TLSEXT_HB_ENABLED \ - SSL_DTLSEXT_HB_ENABLED -# define SSL_TLSEXT_HB_DONT_SEND_REQUESTS \ - SSL_DTLSEXT_HB_DONT_SEND_REQUESTS -# define SSL_TLSEXT_HB_DONT_RECV_REQUESTS \ - SSL_DTLSEXT_HB_DONT_RECV_REQUESTS -# define SSL_get_tlsext_heartbeat_pending(ssl) \ - SSL_get_dtlsext_heartbeat_pending(ssl) -# define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \ - SSL_set_dtlsext_heartbeat_no_requests(ssl,arg) -# endif -# endif - -/* PSK ciphersuites from 4279 */ -# define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A -# define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B -# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C -# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D -# define TLS1_CK_DHE_PSK_WITH_RC4_128_SHA 0x0300008E -# define TLS1_CK_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008F -# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA 0x03000090 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA 0x03000091 -# define TLS1_CK_RSA_PSK_WITH_RC4_128_SHA 0x03000092 -# define TLS1_CK_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x03000093 -# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA 0x03000094 -# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA 0x03000095 - -/* PSK ciphersuites from 5487 */ -# define TLS1_CK_PSK_WITH_AES_128_GCM_SHA256 0x030000A8 -# define TLS1_CK_PSK_WITH_AES_256_GCM_SHA384 0x030000A9 -# define TLS1_CK_DHE_PSK_WITH_AES_128_GCM_SHA256 0x030000AA -# define TLS1_CK_DHE_PSK_WITH_AES_256_GCM_SHA384 0x030000AB -# define TLS1_CK_RSA_PSK_WITH_AES_128_GCM_SHA256 0x030000AC -# define TLS1_CK_RSA_PSK_WITH_AES_256_GCM_SHA384 0x030000AD -# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA256 0x030000AE -# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA384 0x030000AF -# define TLS1_CK_PSK_WITH_NULL_SHA256 0x030000B0 -# define TLS1_CK_PSK_WITH_NULL_SHA384 0x030000B1 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA256 0x030000B2 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA384 0x030000B3 -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA256 0x030000B4 -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA384 0x030000B5 -# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA256 0x030000B6 -# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA384 0x030000B7 -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA256 0x030000B8 -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA384 0x030000B9 - -/* NULL PSK ciphersuites from RFC4785 */ -# define TLS1_CK_PSK_WITH_NULL_SHA 0x0300002C -# define TLS1_CK_DHE_PSK_WITH_NULL_SHA 0x0300002D -# define TLS1_CK_RSA_PSK_WITH_NULL_SHA 0x0300002E - -/* AES ciphersuites from RFC3268 */ -# define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F -# define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 -# define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 -# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 -# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 -# define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 -# define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 -# define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 -# define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 -# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 -# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 -# define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A - -/* TLS v1.2 ciphersuites */ -# define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B -# define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C -# define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D -# define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E -# define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F -# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 -# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 - -/* TLS v1.2 ciphersuites */ -# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 -# define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 -# define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 -# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A -# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B -# define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C -# define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 -# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 - -/* SEED ciphersuites from RFC4162 */ -# define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 -# define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 -# define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 -# define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 -# define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A -# define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B - -/* TLS v1.2 GCM ciphersuites from RFC5288 */ -# define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C -# define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D -# define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E -# define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F -# define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 -# define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 -# define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 -# define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 -# define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 -# define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 -# define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 -# define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 - -/* CCM ciphersuites from RFC6655 */ -# define TLS1_CK_RSA_WITH_AES_128_CCM 0x0300C09C -# define TLS1_CK_RSA_WITH_AES_256_CCM 0x0300C09D -# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM 0x0300C09E -# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM 0x0300C09F -# define TLS1_CK_RSA_WITH_AES_128_CCM_8 0x0300C0A0 -# define TLS1_CK_RSA_WITH_AES_256_CCM_8 0x0300C0A1 -# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM_8 0x0300C0A2 -# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM_8 0x0300C0A3 -# define TLS1_CK_PSK_WITH_AES_128_CCM 0x0300C0A4 -# define TLS1_CK_PSK_WITH_AES_256_CCM 0x0300C0A5 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM 0x0300C0A6 -# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM 0x0300C0A7 -# define TLS1_CK_PSK_WITH_AES_128_CCM_8 0x0300C0A8 -# define TLS1_CK_PSK_WITH_AES_256_CCM_8 0x0300C0A9 -# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM_8 0x0300C0AA -# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM_8 0x0300C0AB - -/* CCM ciphersuites from RFC7251 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM 0x0300C0AC -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM 0x0300C0AD -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM_8 0x0300C0AE -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM_8 0x0300C0AF - -/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ -# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BA -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BB -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BC -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BD -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BE -# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256 0x030000BF - -# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C0 -# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C1 -# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C2 -# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C3 -# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4 -# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5 - -/* ECC ciphersuites from RFC4492 */ -# define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 -# define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 -# define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 - -# define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 -# define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 -# define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A - -# define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B -# define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C -# define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D -# define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E -# define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F - -# define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 -# define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 -# define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 - -# define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 -# define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 -# define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 -# define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 -# define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 - -/* SRP ciphersuites from RFC 5054 */ -# define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A -# define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B -# define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C -# define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D -# define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E -# define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F -# define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 -# define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 -# define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 - -/* ECDH HMAC based ciphersuites from RFC5289 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 -# define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 -# define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A - -/* ECDH GCM based ciphersuites from RFC5289 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B -# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C -# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D -# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E -# define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F -# define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 -# define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 -# define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 - -/* ECDHE PSK ciphersuites from RFC5489 */ -# define TLS1_CK_ECDHE_PSK_WITH_RC4_128_SHA 0x0300C033 -# define TLS1_CK_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300C034 -# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035 -# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036 - -# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0x0300C037 -# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0x0300C038 - -/* NULL PSK ciphersuites from RFC4785 */ -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA 0x0300C039 -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA256 0x0300C03A -# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA384 0x0300C03B - -/* Camellia-CBC ciphersuites from RFC6367 */ -# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C072 -# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C073 -# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C074 -# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C075 -# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C076 -# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C077 -# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C078 -# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C079 - -# define TLS1_CK_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C094 -# define TLS1_CK_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C095 -# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C096 -# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C097 -# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C098 -# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C099 -# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C09A -# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C09B - -/* draft-ietf-tls-chacha20-poly1305-03 */ -# define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCA8 -# define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0x0300CCA9 -# define TLS1_CK_DHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCAA -# define TLS1_CK_PSK_WITH_CHACHA20_POLY1305 0x0300CCAB -# define TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAC -# define TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAD -# define TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305 0x0300CCAE - -/* TLS v1.3 ciphersuites */ -# define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301 -# define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302 -# define TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x03001303 -# define TLS1_3_CK_AES_128_CCM_SHA256 0x03001304 -# define TLS1_3_CK_AES_128_CCM_8_SHA256 0x03001305 - -/* Aria ciphersuites from RFC6209 */ -# define TLS1_CK_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C050 -# define TLS1_CK_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C051 -# define TLS1_CK_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C052 -# define TLS1_CK_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C053 -# define TLS1_CK_DH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C054 -# define TLS1_CK_DH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C055 -# define TLS1_CK_DHE_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C056 -# define TLS1_CK_DHE_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C057 -# define TLS1_CK_DH_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C058 -# define TLS1_CK_DH_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C059 -# define TLS1_CK_DH_anon_WITH_ARIA_128_GCM_SHA256 0x0300C05A -# define TLS1_CK_DH_anon_WITH_ARIA_256_GCM_SHA384 0x0300C05B -# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05C -# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05D -# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05E -# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05F -# define TLS1_CK_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C060 -# define TLS1_CK_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C061 -# define TLS1_CK_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C062 -# define TLS1_CK_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C063 -# define TLS1_CK_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06A -# define TLS1_CK_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06B -# define TLS1_CK_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06C -# define TLS1_CK_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06D -# define TLS1_CK_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06E -# define TLS1_CK_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06F - -/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ -# define TLS1_RFC_RSA_WITH_AES_128_SHA "TLS_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ADH_WITH_AES_128_SHA "TLS_DH_anon_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_RSA_WITH_AES_256_SHA "TLS_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ADH_WITH_AES_256_SHA "TLS_DH_anon_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_RSA_WITH_NULL_SHA256 "TLS_RSA_WITH_NULL_SHA256" -# define TLS1_RFC_RSA_WITH_AES_128_SHA256 "TLS_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_AES_256_SHA256 "TLS_RSA_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA256 "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA256 "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA256 "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA256 "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_AES_128_SHA256 "TLS_DH_anon_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_AES_256_SHA256 "TLS_DH_anon_WITH_AES_256_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_AES_128_GCM_SHA256 "TLS_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_RSA_WITH_AES_256_GCM_SHA384 "TLS_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_DSS_WITH_AES_128_GCM_SHA256 "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_AES_256_GCM_SHA384 "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_ADH_WITH_AES_128_GCM_SHA256 "TLS_DH_anon_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ADH_WITH_AES_256_GCM_SHA384 "TLS_DH_anon_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_RSA_WITH_AES_128_CCM "TLS_RSA_WITH_AES_128_CCM" -# define TLS1_RFC_RSA_WITH_AES_256_CCM "TLS_RSA_WITH_AES_256_CCM" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM "TLS_DHE_RSA_WITH_AES_128_CCM" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM "TLS_DHE_RSA_WITH_AES_256_CCM" -# define TLS1_RFC_RSA_WITH_AES_128_CCM_8 "TLS_RSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_RSA_WITH_AES_256_CCM_8 "TLS_RSA_WITH_AES_256_CCM_8" -# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM_8 "TLS_DHE_RSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM_8 "TLS_DHE_RSA_WITH_AES_256_CCM_8" -# define TLS1_RFC_PSK_WITH_AES_128_CCM "TLS_PSK_WITH_AES_128_CCM" -# define TLS1_RFC_PSK_WITH_AES_256_CCM "TLS_PSK_WITH_AES_256_CCM" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM "TLS_DHE_PSK_WITH_AES_128_CCM" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM "TLS_DHE_PSK_WITH_AES_256_CCM" -# define TLS1_RFC_PSK_WITH_AES_128_CCM_8 "TLS_PSK_WITH_AES_128_CCM_8" -# define TLS1_RFC_PSK_WITH_AES_256_CCM_8 "TLS_PSK_WITH_AES_256_CCM_8" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM_8 "TLS_PSK_DHE_WITH_AES_128_CCM_8" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM_8 "TLS_PSK_DHE_WITH_AES_256_CCM_8" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM "TLS_ECDHE_ECDSA_WITH_AES_128_CCM" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM "TLS_ECDHE_ECDSA_WITH_AES_256_CCM" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8" -# define TLS1_3_RFC_AES_128_GCM_SHA256 "TLS_AES_128_GCM_SHA256" -# define TLS1_3_RFC_AES_256_GCM_SHA384 "TLS_AES_256_GCM_SHA384" -# define TLS1_3_RFC_CHACHA20_POLY1305_SHA256 "TLS_CHACHA20_POLY1305_SHA256" -# define TLS1_3_RFC_AES_128_CCM_SHA256 "TLS_AES_128_CCM_SHA256" -# define TLS1_3_RFC_AES_128_CCM_8_SHA256 "TLS_AES_128_CCM_8_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_NULL_SHA "TLS_ECDHE_ECDSA_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_NULL_SHA "TLS_ECDHE_RSA_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_NULL_SHA "TLS_ECDH_anon_WITH_NULL_SHA" -# define TLS1_RFC_ECDH_anon_WITH_DES_192_CBC3_SHA "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_AES_128_CBC_SHA "TLS_ECDH_anon_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDH_anon_WITH_AES_256_CBC_SHA "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_NULL_SHA "TLS_PSK_WITH_NULL_SHA" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA "TLS_DHE_PSK_WITH_NULL_SHA" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA "TLS_RSA_PSK_WITH_NULL_SHA" -# define TLS1_RFC_PSK_WITH_3DES_EDE_CBC_SHA "TLS_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA "TLS_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA "TLS_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA "TLS_DHE_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA "TLS_DHE_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_3DES_EDE_CBC_SHA "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA "TLS_RSA_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA "TLS_RSA_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_PSK_WITH_AES_128_GCM_SHA256 "TLS_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_PSK_WITH_AES_256_GCM_SHA384 "TLS_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_GCM_SHA256 "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_GCM_SHA384 "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_GCM_SHA256 "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_GCM_SHA384 "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA256 "TLS_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA384 "TLS_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_PSK_WITH_NULL_SHA256 "TLS_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_PSK_WITH_NULL_SHA384 "TLS_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA256 "TLS_DHE_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA384 "TLS_DHE_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA256 "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA384 "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA256 "TLS_RSA_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA384 "TLS_RSA_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA "TLS_ECDHE_PSK_WITH_NULL_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA256 "TLS_ECDHE_PSK_WITH_NULL_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA384 "TLS_ECDHE_PSK_WITH_NULL_SHA384" -# define TLS1_RFC_SRP_SHA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA" -# define TLS1_RFC_SRP_SHA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA" -# define TLS1_RFC_SRP_SHA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CHACHA20_POLY1305 "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_PSK_WITH_CHACHA20_POLY1305 "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_CHACHA20_POLY1305 "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_CHACHA20_POLY1305 "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_CHACHA20_POLY1305 "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256" -# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA" -# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" -# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" -# define TLS1_RFC_RSA_WITH_SEED_SHA "TLS_RSA_WITH_SEED_CBC_SHA" -# define TLS1_RFC_DHE_DSS_WITH_SEED_SHA "TLS_DHE_DSS_WITH_SEED_CBC_SHA" -# define TLS1_RFC_DHE_RSA_WITH_SEED_SHA "TLS_DHE_RSA_WITH_SEED_CBC_SHA" -# define TLS1_RFC_ADH_WITH_SEED_SHA "TLS_DH_anon_WITH_SEED_CBC_SHA" -# define TLS1_RFC_ECDHE_PSK_WITH_RC4_128_SHA "TLS_ECDHE_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDH_anon_WITH_RC4_128_SHA "TLS_ECDH_anon_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDHE_ECDSA_WITH_RC4_128_SHA "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA" -# define TLS1_RFC_ECDHE_RSA_WITH_RC4_128_SHA "TLS_ECDHE_RSA_WITH_RC4_128_SHA" -# define TLS1_RFC_PSK_WITH_RC4_128_SHA "TLS_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_RSA_PSK_WITH_RC4_128_SHA "TLS_RSA_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_DHE_PSK_WITH_RC4_128_SHA "TLS_DHE_PSK_WITH_RC4_128_SHA" -# define TLS1_RFC_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DH_anon_WITH_ARIA_128_GCM_SHA256 "TLS_DH_anon_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DH_anon_WITH_ARIA_256_GCM_SHA384 "TLS_DH_anon_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_PSK_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384" -# define TLS1_RFC_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256" -# define TLS1_RFC_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384" - - -/* - * XXX Backward compatibility alert: Older versions of OpenSSL gave some DHE - * ciphers names with "EDH" instead of "DHE". Going forward, we should be - * using DHE everywhere, though we may indefinitely maintain aliases for - * users or configurations that used "EDH" - */ -# define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" - -# define TLS1_TXT_PSK_WITH_NULL_SHA "PSK-NULL-SHA" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA "DHE-PSK-NULL-SHA" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA "RSA-PSK-NULL-SHA" - -/* AES ciphersuites from RFC3268 */ -# define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" -# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" -# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" -# define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" - -# define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" -# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" -# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" -# define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" - -/* ECC ciphersuites from RFC4492 */ -# define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" - -# define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" - -# define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" - -# define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" - -# define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" -# define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" -# define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" -# define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" -# define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" - -/* PSK ciphersuites from RFC 4279 */ -# define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" -# define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" -# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" - -# define TLS1_TXT_DHE_PSK_WITH_RC4_128_SHA "DHE-PSK-RC4-SHA" -# define TLS1_TXT_DHE_PSK_WITH_3DES_EDE_CBC_SHA "DHE-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA "DHE-PSK-AES128-CBC-SHA" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA "DHE-PSK-AES256-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_RC4_128_SHA "RSA-PSK-RC4-SHA" -# define TLS1_TXT_RSA_PSK_WITH_3DES_EDE_CBC_SHA "RSA-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA "RSA-PSK-AES128-CBC-SHA" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA "RSA-PSK-AES256-CBC-SHA" - -/* PSK ciphersuites from RFC 5487 */ -# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_GCM_SHA256 "DHE-PSK-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_GCM_SHA384 "DHE-PSK-AES256-GCM-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_AES_128_GCM_SHA256 "RSA-PSK-AES128-GCM-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_GCM_SHA384 "RSA-PSK-AES256-GCM-SHA384" - -# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA256 "PSK-AES128-CBC-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA384 "PSK-AES256-CBC-SHA384" -# define TLS1_TXT_PSK_WITH_NULL_SHA256 "PSK-NULL-SHA256" -# define TLS1_TXT_PSK_WITH_NULL_SHA384 "PSK-NULL-SHA384" - -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA256 "DHE-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA384 "DHE-PSK-AES256-CBC-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA256 "DHE-PSK-NULL-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA384 "DHE-PSK-NULL-SHA384" - -# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA256 "RSA-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA384 "RSA-PSK-AES256-CBC-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA256 "RSA-PSK-NULL-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA384 "RSA-PSK-NULL-SHA384" - -/* SRP ciphersuite from RFC 5054 */ -# define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" -# define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" -# define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" -# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" -# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" - -/* Camellia ciphersuites from RFC4132 */ -# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" -# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" - -# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" -# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" - -/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ -# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256 "CAMELLIA128-SHA256" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DH-DSS-CAMELLIA128-SHA256" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DH-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DHE-DSS-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DHE-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256 "ADH-CAMELLIA128-SHA256" - -# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256 "CAMELLIA256-SHA256" -# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DH-DSS-CAMELLIA256-SHA256" -# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DH-RSA-CAMELLIA256-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DHE-DSS-CAMELLIA256-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DHE-RSA-CAMELLIA256-SHA256" -# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256 "ADH-CAMELLIA256-SHA256" - -# define TLS1_TXT_PSK_WITH_CAMELLIA_128_CBC_SHA256 "PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_PSK_WITH_CAMELLIA_256_CBC_SHA384 "PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "DHE-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "DHE-PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "RSA-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "RSA-PSK-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-PSK-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-PSK-CAMELLIA256-SHA384" - -/* SEED ciphersuites from RFC4162 */ -# define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" -# define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" -# define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" -# define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" -# define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" -# define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" - -/* TLS v1.2 ciphersuites */ -# define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" -# define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" -# define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" -# define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" -# define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" - -/* TLS v1.2 GCM ciphersuites from RFC5288 */ -# define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" -# define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" -# define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" -# define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" -# define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" -# define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" - -/* CCM ciphersuites from RFC6655 */ -# define TLS1_TXT_RSA_WITH_AES_128_CCM "AES128-CCM" -# define TLS1_TXT_RSA_WITH_AES_256_CCM "AES256-CCM" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM "DHE-RSA-AES128-CCM" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM "DHE-RSA-AES256-CCM" - -# define TLS1_TXT_RSA_WITH_AES_128_CCM_8 "AES128-CCM8" -# define TLS1_TXT_RSA_WITH_AES_256_CCM_8 "AES256-CCM8" -# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM_8 "DHE-RSA-AES128-CCM8" -# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM_8 "DHE-RSA-AES256-CCM8" - -# define TLS1_TXT_PSK_WITH_AES_128_CCM "PSK-AES128-CCM" -# define TLS1_TXT_PSK_WITH_AES_256_CCM "PSK-AES256-CCM" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM "DHE-PSK-AES128-CCM" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM "DHE-PSK-AES256-CCM" - -# define TLS1_TXT_PSK_WITH_AES_128_CCM_8 "PSK-AES128-CCM8" -# define TLS1_TXT_PSK_WITH_AES_256_CCM_8 "PSK-AES256-CCM8" -# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM_8 "DHE-PSK-AES128-CCM8" -# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM_8 "DHE-PSK-AES256-CCM8" - -/* CCM ciphersuites from RFC7251 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM "ECDHE-ECDSA-AES128-CCM" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM "ECDHE-ECDSA-AES256-CCM" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM_8 "ECDHE-ECDSA-AES128-CCM8" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8 "ECDHE-ECDSA-AES256-CCM8" - -/* ECDH HMAC based ciphersuites from RFC5289 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" - -/* ECDH GCM based ciphersuites from RFC5289 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" - -/* TLS v1.2 PSK GCM ciphersuites from RFC5487 */ -# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" - -/* ECDHE PSK ciphersuites from RFC 5489 */ -# define TLS1_TXT_ECDHE_PSK_WITH_RC4_128_SHA "ECDHE-PSK-RC4-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "ECDHE-PSK-3DES-EDE-CBC-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA "ECDHE-PSK-AES256-CBC-SHA" - -# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "ECDHE-PSK-AES128-CBC-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "ECDHE-PSK-AES256-CBC-SHA384" - -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA "ECDHE-PSK-NULL-SHA" -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA256 "ECDHE-PSK-NULL-SHA256" -# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA384 "ECDHE-PSK-NULL-SHA384" - -/* Camellia-CBC ciphersuites from RFC6367 */ -# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-ECDSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-ECDSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-ECDSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-ECDSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-RSA-CAMELLIA256-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-RSA-CAMELLIA128-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-RSA-CAMELLIA256-SHA384" - -/* draft-ietf-tls-chacha20-poly1305-03 */ -# define TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305 "ECDHE-RSA-CHACHA20-POLY1305" -# define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305" -# define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" -# define TLS1_TXT_PSK_WITH_CHACHA20_POLY1305 "PSK-CHACHA20-POLY1305" -# define TLS1_TXT_ECDHE_PSK_WITH_CHACHA20_POLY1305 "ECDHE-PSK-CHACHA20-POLY1305" -# define TLS1_TXT_DHE_PSK_WITH_CHACHA20_POLY1305 "DHE-PSK-CHACHA20-POLY1305" -# define TLS1_TXT_RSA_PSK_WITH_CHACHA20_POLY1305 "RSA-PSK-CHACHA20-POLY1305" - -/* Aria ciphersuites from RFC6209 */ -# define TLS1_TXT_RSA_WITH_ARIA_128_GCM_SHA256 "ARIA128-GCM-SHA256" -# define TLS1_TXT_RSA_WITH_ARIA_256_GCM_SHA384 "ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "DHE-RSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "DHE-RSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_RSA_WITH_ARIA_128_GCM_SHA256 "DH-RSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_RSA_WITH_ARIA_256_GCM_SHA384 "DH-RSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "DHE-DSS-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "DHE-DSS-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_DSS_WITH_ARIA_128_GCM_SHA256 "DH-DSS-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_DSS_WITH_ARIA_256_GCM_SHA384 "DH-DSS-ARIA256-GCM-SHA384" -# define TLS1_TXT_DH_anon_WITH_ARIA_128_GCM_SHA256 "ADH-ARIA128-GCM-SHA256" -# define TLS1_TXT_DH_anon_WITH_ARIA_256_GCM_SHA384 "ADH-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ECDSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ECDSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ECDSA-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ECDSA-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ARIA256-GCM-SHA384" -# define TLS1_TXT_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ARIA128-GCM-SHA256" -# define TLS1_TXT_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ARIA256-GCM-SHA384" -# define TLS1_TXT_PSK_WITH_ARIA_128_GCM_SHA256 "PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_PSK_WITH_ARIA_256_GCM_SHA384 "PSK-ARIA256-GCM-SHA384" -# define TLS1_TXT_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "DHE-PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "DHE-PSK-ARIA256-GCM-SHA384" -# define TLS1_TXT_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "RSA-PSK-ARIA128-GCM-SHA256" -# define TLS1_TXT_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "RSA-PSK-ARIA256-GCM-SHA384" - -# define TLS_CT_RSA_SIGN 1 -# define TLS_CT_DSS_SIGN 2 -# define TLS_CT_RSA_FIXED_DH 3 -# define TLS_CT_DSS_FIXED_DH 4 -# define TLS_CT_ECDSA_SIGN 64 -# define TLS_CT_RSA_FIXED_ECDH 65 -# define TLS_CT_ECDSA_FIXED_ECDH 66 -# define TLS_CT_GOST01_SIGN 22 -# define TLS_CT_GOST12_SIGN 238 -# define TLS_CT_GOST12_512_SIGN 239 - -/* - * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see - * comment there) - */ -# define TLS_CT_NUMBER 10 - -# if defined(SSL3_CT_NUMBER) -# if TLS_CT_NUMBER != SSL3_CT_NUMBER -# error "SSL/TLS CT_NUMBER values do not match" -# endif -# endif - -# define TLS1_FINISH_MAC_LENGTH 12 - -# define TLS_MD_MAX_CONST_SIZE 22 -# define TLS_MD_CLIENT_FINISH_CONST "client finished" -# define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 -# define TLS_MD_SERVER_FINISH_CONST "server finished" -# define TLS_MD_SERVER_FINISH_CONST_SIZE 15 -# define TLS_MD_KEY_EXPANSION_CONST "key expansion" -# define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 -# define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" -# define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 -# define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" -# define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 -# define TLS_MD_IV_BLOCK_CONST "IV block" -# define TLS_MD_IV_BLOCK_CONST_SIZE 8 -# define TLS_MD_MASTER_SECRET_CONST "master secret" -# define TLS_MD_MASTER_SECRET_CONST_SIZE 13 -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "extended master secret" -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE 22 - -# ifdef CHARSET_EBCDIC -# undef TLS_MD_CLIENT_FINISH_CONST -/* - * client finished - */ -# define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" - -# undef TLS_MD_SERVER_FINISH_CONST -/* - * server finished - */ -# define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" - -# undef TLS_MD_SERVER_WRITE_KEY_CONST -/* - * server write key - */ -# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_KEY_EXPANSION_CONST -/* - * key expansion - */ -# define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" - -# undef TLS_MD_CLIENT_WRITE_KEY_CONST -/* - * client write key - */ -# define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_SERVER_WRITE_KEY_CONST -/* - * server write key - */ -# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" - -# undef TLS_MD_IV_BLOCK_CONST -/* - * IV block - */ -# define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" - -# undef TLS_MD_MASTER_SECRET_CONST -/* - * master secret - */ -# define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" -# undef TLS_MD_EXTENDED_MASTER_SECRET_CONST -/* - * extended master secret - */ -# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" -# endif - -/* TLS Session Ticket extension struct */ -struct tls_session_ticket_ext_st { - unsigned short length; - void *data; -}; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ts.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ts.h deleted file mode 100644 index 3b58aa52..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ts.h +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Copyright 2006-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_TS_H -# define HEADER_TS_H - -# include - -# ifndef OPENSSL_NO_TS -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# include -# include - -typedef struct TS_msg_imprint_st TS_MSG_IMPRINT; -typedef struct TS_req_st TS_REQ; -typedef struct TS_accuracy_st TS_ACCURACY; -typedef struct TS_tst_info_st TS_TST_INFO; - -/* Possible values for status. */ -# define TS_STATUS_GRANTED 0 -# define TS_STATUS_GRANTED_WITH_MODS 1 -# define TS_STATUS_REJECTION 2 -# define TS_STATUS_WAITING 3 -# define TS_STATUS_REVOCATION_WARNING 4 -# define TS_STATUS_REVOCATION_NOTIFICATION 5 - -/* Possible values for failure_info. */ -# define TS_INFO_BAD_ALG 0 -# define TS_INFO_BAD_REQUEST 2 -# define TS_INFO_BAD_DATA_FORMAT 5 -# define TS_INFO_TIME_NOT_AVAILABLE 14 -# define TS_INFO_UNACCEPTED_POLICY 15 -# define TS_INFO_UNACCEPTED_EXTENSION 16 -# define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 -# define TS_INFO_SYSTEM_FAILURE 25 - - -typedef struct TS_status_info_st TS_STATUS_INFO; -typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL; -typedef struct ESS_cert_id ESS_CERT_ID; -typedef struct ESS_signing_cert ESS_SIGNING_CERT; - -DEFINE_STACK_OF(ESS_CERT_ID) - -typedef struct ESS_cert_id_v2_st ESS_CERT_ID_V2; -typedef struct ESS_signing_cert_v2_st ESS_SIGNING_CERT_V2; - -DEFINE_STACK_OF(ESS_CERT_ID_V2) - -typedef struct TS_resp_st TS_RESP; - -TS_REQ *TS_REQ_new(void); -void TS_REQ_free(TS_REQ *a); -int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); -TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); - -TS_REQ *TS_REQ_dup(TS_REQ *a); - -#ifndef OPENSSL_NO_STDIO -TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); -int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); -#endif -TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); -int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); - -TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); -void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); -int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, - const unsigned char **pp, long length); - -TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); - -#ifndef OPENSSL_NO_STDIO -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); -int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); -#endif -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a); -int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a); - -TS_RESP *TS_RESP_new(void); -void TS_RESP_free(TS_RESP *a); -int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); -TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); -TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); -TS_RESP *TS_RESP_dup(TS_RESP *a); - -#ifndef OPENSSL_NO_STDIO -TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); -int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); -#endif -TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a); -int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a); - -TS_STATUS_INFO *TS_STATUS_INFO_new(void); -void TS_STATUS_INFO_free(TS_STATUS_INFO *a); -int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); -TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, - const unsigned char **pp, long length); -TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); - -TS_TST_INFO *TS_TST_INFO_new(void); -void TS_TST_INFO_free(TS_TST_INFO *a); -int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); -TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, - long length); -TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); - -#ifndef OPENSSL_NO_STDIO -TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); -int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); -#endif -TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a); -int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a); - -TS_ACCURACY *TS_ACCURACY_new(void); -void TS_ACCURACY_free(TS_ACCURACY *a); -int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); -TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, - long length); -TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); - -ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); -void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); -int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp); -ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, - const unsigned char **pp, - long length); -ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); - -ESS_CERT_ID *ESS_CERT_ID_new(void); -void ESS_CERT_ID_free(ESS_CERT_ID *a); -int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); -ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, - long length); -ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); - -ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); -void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); -int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp); -ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, - const unsigned char **pp, long length); -ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); - -ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new(void); -void ESS_CERT_ID_V2_free(ESS_CERT_ID_V2 *a); -int i2d_ESS_CERT_ID_V2(const ESS_CERT_ID_V2 *a, unsigned char **pp); -ESS_CERT_ID_V2 *d2i_ESS_CERT_ID_V2(ESS_CERT_ID_V2 **a, - const unsigned char **pp, long length); -ESS_CERT_ID_V2 *ESS_CERT_ID_V2_dup(ESS_CERT_ID_V2 *a); - -ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new(void); -void ESS_SIGNING_CERT_V2_free(ESS_SIGNING_CERT_V2 *a); -int i2d_ESS_SIGNING_CERT_V2(const ESS_SIGNING_CERT_V2 *a, unsigned char **pp); -ESS_SIGNING_CERT_V2 *d2i_ESS_SIGNING_CERT_V2(ESS_SIGNING_CERT_V2 **a, - const unsigned char **pp, - long length); -ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_dup(ESS_SIGNING_CERT_V2 *a); - -int TS_REQ_set_version(TS_REQ *a, long version); -long TS_REQ_get_version(const TS_REQ *a); - -int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i); -const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a); - -const STACK_OF(ASN1_UTF8STRING) * -TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a); - -const ASN1_BIT_STRING * -TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a); - -int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); -TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); - -int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); -X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); - -int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); -ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); - -int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy); -ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); - -int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); -const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); - -int TS_REQ_set_cert_req(TS_REQ *a, int cert_req); -int TS_REQ_get_cert_req(const TS_REQ *a); - -STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); -void TS_REQ_ext_free(TS_REQ *a); -int TS_REQ_get_ext_count(TS_REQ *a); -int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); -int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos); -int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); -X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); -X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); -int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); -void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); - -/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ - -int TS_REQ_print_bio(BIO *bio, TS_REQ *a); - -/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ - -int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); -TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); - -/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ -void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); -PKCS7 *TS_RESP_get_token(TS_RESP *a); -TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); - -int TS_TST_INFO_set_version(TS_TST_INFO *a, long version); -long TS_TST_INFO_get_version(const TS_TST_INFO *a); - -int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); -ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); - -int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); -TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); - -int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); -const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); - -int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); -const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); - -int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); -TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); - -int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); -const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); - -int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); -const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); - -int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); -const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); - -int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); -int TS_TST_INFO_get_ordering(const TS_TST_INFO *a); - -int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); -const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); - -int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); -GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); - -STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); -void TS_TST_INFO_ext_free(TS_TST_INFO *a); -int TS_TST_INFO_get_ext_count(TS_TST_INFO *a); -int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); -int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, - int lastpos); -int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); -X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); -X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); -int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); -void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); - -/* - * Declarations related to response generation, defined in ts/ts_resp_sign.c. - */ - -/* Optional flags for response generation. */ - -/* Don't include the TSA name in response. */ -# define TS_TSA_NAME 0x01 - -/* Set ordering to true in response. */ -# define TS_ORDERING 0x02 - -/* - * Include the signer certificate and the other specified certificates in - * the ESS signing certificate attribute beside the PKCS7 signed data. - * Only the signer certificates is included by default. - */ -# define TS_ESS_CERT_ID_CHAIN 0x04 - -/* Forward declaration. */ -struct TS_resp_ctx; - -/* This must return a unique number less than 160 bits long. */ -typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *); - -/* - * This must return the seconds and microseconds since Jan 1, 1970 in the sec - * and usec variables allocated by the caller. Return non-zero for success - * and zero for failure. - */ -typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec, - long *usec); - -/* - * This must process the given extension. It can modify the TS_TST_INFO - * object of the context. Return values: !0 (processed), 0 (error, it must - * set the status info/failure info of the response). - */ -typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *, - void *); - -typedef struct TS_resp_ctx TS_RESP_CTX; - -DEFINE_STACK_OF_CONST(EVP_MD) - -/* Creates a response context that can be used for generating responses. */ -TS_RESP_CTX *TS_RESP_CTX_new(void); -void TS_RESP_CTX_free(TS_RESP_CTX *ctx); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); - -int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx, - const EVP_MD *signer_digest); -int TS_RESP_CTX_set_ess_cert_id_digest(TS_RESP_CTX *ctx, const EVP_MD *md); - -/* This parameter must be set. */ -int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy); - -/* No additional certs are included in the response by default. */ -int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); - -/* - * Adds a new acceptable policy, only the default policy is accepted by - * default. - */ -int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy); - -/* - * Adds a new acceptable message digest. Note that no message digests are - * accepted by default. The md argument is shared with the caller. - */ -int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); - -/* Accuracy is not included by default. */ -int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, - int secs, int millis, int micros); - -/* - * Clock precision digits, i.e. the number of decimal digits: '0' means sec, - * '3' msec, '6' usec, and so on. Default is 0. - */ -int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, - unsigned clock_precision_digits); -/* At most we accept usec precision. */ -# define TS_MAX_CLOCK_PRECISION_DIGITS 6 - -/* Maximum status message length */ -# define TS_MAX_STATUS_LENGTH (1024 * 1024) - -/* No flags are set by default. */ -void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); - -/* Default callback always returns a constant. */ -void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); - -/* Default callback uses the gettimeofday() and gmtime() system calls. */ -void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); - -/* - * Default callback rejects all extensions. The extension callback is called - * when the TS_TST_INFO object is already set up and not signed yet. - */ -/* FIXME: extension handling is not tested yet. */ -void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, - TS_extension_cb cb, void *data); - -/* The following methods can be used in the callbacks. */ -int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, - int status, const char *text); - -/* Sets the status info only if it is still TS_STATUS_GRANTED. */ -int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, - int status, const char *text); - -int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); - -/* The get methods below can be used in the extension callback. */ -TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); - -TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); - -/* - * Creates the signed TS_TST_INFO and puts it in TS_RESP. - * In case of errors it sets the status info properly. - * Returns NULL only in case of memory allocation/fatal error. - */ -TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); - -/* - * Declarations related to response verification, - * they are defined in ts/ts_resp_verify.c. - */ - -int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, - X509_STORE *store, X509 **signer_out); - -/* Context structure for the generic verify method. */ - -/* Verify the signer's certificate and the signature of the response. */ -# define TS_VFY_SIGNATURE (1u << 0) -/* Verify the version number of the response. */ -# define TS_VFY_VERSION (1u << 1) -/* Verify if the policy supplied by the user matches the policy of the TSA. */ -# define TS_VFY_POLICY (1u << 2) -/* - * Verify the message imprint provided by the user. This flag should not be - * specified with TS_VFY_DATA. - */ -# define TS_VFY_IMPRINT (1u << 3) -/* - * Verify the message imprint computed by the verify method from the user - * provided data and the MD algorithm of the response. This flag should not - * be specified with TS_VFY_IMPRINT. - */ -# define TS_VFY_DATA (1u << 4) -/* Verify the nonce value. */ -# define TS_VFY_NONCE (1u << 5) -/* Verify if the TSA name field matches the signer certificate. */ -# define TS_VFY_SIGNER (1u << 6) -/* Verify if the TSA name field equals to the user provided name. */ -# define TS_VFY_TSA_NAME (1u << 7) - -/* You can use the following convenience constants. */ -# define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ - | TS_VFY_VERSION \ - | TS_VFY_POLICY \ - | TS_VFY_IMPRINT \ - | TS_VFY_NONCE \ - | TS_VFY_SIGNER \ - | TS_VFY_TSA_NAME) -# define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ - | TS_VFY_VERSION \ - | TS_VFY_POLICY \ - | TS_VFY_DATA \ - | TS_VFY_NONCE \ - | TS_VFY_SIGNER \ - | TS_VFY_TSA_NAME) - -typedef struct TS_verify_ctx TS_VERIFY_CTX; - -int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); -int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); - -/* - * Declarations related to response verification context, - */ -TS_VERIFY_CTX *TS_VERIFY_CTX_new(void); -void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); -void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); -void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); -int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f); -int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f); -BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b); -unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, - unsigned char *hexstr, long len); -X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s); -STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs); - -/*- - * If ctx is NULL, it allocates and returns a new object, otherwise - * it returns ctx. It initialises all the members as follows: - * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) - * certs = NULL - * store = NULL - * policy = policy from the request or NULL if absent (in this case - * TS_VFY_POLICY is cleared from flags as well) - * md_alg = MD algorithm from request - * imprint, imprint_len = imprint from request - * data = NULL - * nonce, nonce_len = nonce from the request or NULL if absent (in this case - * TS_VFY_NONCE is cleared from flags as well) - * tsa_name = NULL - * Important: after calling this method TS_VFY_SIGNATURE should be added! - */ -TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); - -/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ - -int TS_RESP_print_bio(BIO *bio, TS_RESP *a); -int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); -int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); - -/* Common utility functions defined in ts/ts_lib.c */ - -int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); -int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); -int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); -int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); -int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); - -/* - * Function declarations for handling configuration options, defined in - * ts/ts_conf.c - */ - -X509 *TS_CONF_load_cert(const char *file); -STACK_OF(X509) *TS_CONF_load_certs(const char *file); -EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); -const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); -int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, - TS_RESP_CTX *ctx); -#ifndef OPENSSL_NO_ENGINE -int TS_CONF_set_crypto_device(CONF *conf, const char *section, - const char *device); -int TS_CONF_set_default_engine(const char *name); -#endif -int TS_CONF_set_signer_cert(CONF *conf, const char *section, - const char *cert, TS_RESP_CTX *ctx); -int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, - TS_RESP_CTX *ctx); -int TS_CONF_set_signer_key(CONF *conf, const char *section, - const char *key, const char *pass, - TS_RESP_CTX *ctx); -int TS_CONF_set_signer_digest(CONF *conf, const char *section, - const char *md, TS_RESP_CTX *ctx); -int TS_CONF_set_def_policy(CONF *conf, const char *section, - const char *policy, TS_RESP_CTX *ctx); -int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, - TS_RESP_CTX *ctx); -int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); -int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, - TS_RESP_CTX *ctx); -int TS_CONF_set_ess_cert_id_digest(CONF *conf, const char *section, - TS_RESP_CTX *ctx); - -# ifdef __cplusplus -} -# endif -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/tserr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/tserr.h deleted file mode 100644 index 07f23339..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/tserr.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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_TSERR_H -# define HEADER_TSERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# include - -# ifndef OPENSSL_NO_TS - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_TS_strings(void); - -/* - * TS function codes. - */ -# define TS_F_DEF_SERIAL_CB 110 -# define TS_F_DEF_TIME_CB 111 -# define TS_F_ESS_ADD_SIGNING_CERT 112 -# define TS_F_ESS_ADD_SIGNING_CERT_V2 147 -# define TS_F_ESS_CERT_ID_NEW_INIT 113 -# define TS_F_ESS_CERT_ID_V2_NEW_INIT 156 -# define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 -# define TS_F_ESS_SIGNING_CERT_V2_NEW_INIT 157 -# define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 -# define TS_F_PKCS7_TO_TS_TST_INFO 148 -# define TS_F_TS_ACCURACY_SET_MICROS 115 -# define TS_F_TS_ACCURACY_SET_MILLIS 116 -# define TS_F_TS_ACCURACY_SET_SECONDS 117 -# define TS_F_TS_CHECK_IMPRINTS 100 -# define TS_F_TS_CHECK_NONCES 101 -# define TS_F_TS_CHECK_POLICY 102 -# define TS_F_TS_CHECK_SIGNING_CERTS 103 -# define TS_F_TS_CHECK_STATUS_INFO 104 -# define TS_F_TS_COMPUTE_IMPRINT 145 -# define TS_F_TS_CONF_INVALID 151 -# define TS_F_TS_CONF_LOAD_CERT 153 -# define TS_F_TS_CONF_LOAD_CERTS 154 -# define TS_F_TS_CONF_LOAD_KEY 155 -# define TS_F_TS_CONF_LOOKUP_FAIL 152 -# define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 -# define TS_F_TS_GET_STATUS_TEXT 105 -# define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 -# define TS_F_TS_REQ_SET_MSG_IMPRINT 119 -# define TS_F_TS_REQ_SET_NONCE 120 -# define TS_F_TS_REQ_SET_POLICY_ID 121 -# define TS_F_TS_RESP_CREATE_RESPONSE 122 -# define TS_F_TS_RESP_CREATE_TST_INFO 123 -# define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 -# define TS_F_TS_RESP_CTX_ADD_MD 125 -# define TS_F_TS_RESP_CTX_ADD_POLICY 126 -# define TS_F_TS_RESP_CTX_NEW 127 -# define TS_F_TS_RESP_CTX_SET_ACCURACY 128 -# define TS_F_TS_RESP_CTX_SET_CERTS 129 -# define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 -# define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 -# define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 -# define TS_F_TS_RESP_GET_POLICY 133 -# define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 -# define TS_F_TS_RESP_SET_STATUS_INFO 135 -# define TS_F_TS_RESP_SET_TST_INFO 150 -# define TS_F_TS_RESP_SIGN 136 -# define TS_F_TS_RESP_VERIFY_SIGNATURE 106 -# define TS_F_TS_TST_INFO_SET_ACCURACY 137 -# define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 -# define TS_F_TS_TST_INFO_SET_NONCE 139 -# define TS_F_TS_TST_INFO_SET_POLICY_ID 140 -# define TS_F_TS_TST_INFO_SET_SERIAL 141 -# define TS_F_TS_TST_INFO_SET_TIME 142 -# define TS_F_TS_TST_INFO_SET_TSA 143 -# define TS_F_TS_VERIFY 108 -# define TS_F_TS_VERIFY_CERT 109 -# define TS_F_TS_VERIFY_CTX_NEW 144 - -/* - * TS reason codes. - */ -# define TS_R_BAD_PKCS7_TYPE 132 -# define TS_R_BAD_TYPE 133 -# define TS_R_CANNOT_LOAD_CERT 137 -# define TS_R_CANNOT_LOAD_KEY 138 -# define TS_R_CERTIFICATE_VERIFY_ERROR 100 -# define TS_R_COULD_NOT_SET_ENGINE 127 -# define TS_R_COULD_NOT_SET_TIME 115 -# define TS_R_DETACHED_CONTENT 134 -# define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 -# define TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR 139 -# define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 -# define TS_R_INVALID_NULL_POINTER 102 -# define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 -# define TS_R_MESSAGE_IMPRINT_MISMATCH 103 -# define TS_R_NONCE_MISMATCH 104 -# define TS_R_NONCE_NOT_RETURNED 105 -# define TS_R_NO_CONTENT 106 -# define TS_R_NO_TIME_STAMP_TOKEN 107 -# define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 -# define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 -# define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 -# define TS_R_POLICY_MISMATCH 108 -# define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 -# define TS_R_RESPONSE_SETUP_ERROR 121 -# define TS_R_SIGNATURE_FAILURE 109 -# define TS_R_THERE_MUST_BE_ONE_SIGNER 110 -# define TS_R_TIME_SYSCALL_ERROR 122 -# define TS_R_TOKEN_NOT_PRESENT 130 -# define TS_R_TOKEN_PRESENT 131 -# define TS_R_TSA_NAME_MISMATCH 111 -# define TS_R_TSA_UNTRUSTED 112 -# define TS_R_TST_INFO_SETUP_ERROR 123 -# define TS_R_TS_DATASIGN 124 -# define TS_R_UNACCEPTABLE_POLICY 125 -# define TS_R_UNSUPPORTED_MD_ALGORITHM 126 -# define TS_R_UNSUPPORTED_VERSION 113 -# define TS_R_VAR_BAD_VALUE 135 -# define TS_R_VAR_LOOKUP_FAILURE 136 -# define TS_R_WRONG_CONTENT_TYPE 114 - -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/txt_db.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/txt_db.h deleted file mode 100644 index ec981a43..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/txt_db.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 1995-2017 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_TXT_DB_H -# define HEADER_TXT_DB_H - -# include -# include -# include -# include - -# define DB_ERROR_OK 0 -# define DB_ERROR_MALLOC 1 -# define DB_ERROR_INDEX_CLASH 2 -# define DB_ERROR_INDEX_OUT_OF_RANGE 3 -# define DB_ERROR_NO_INDEX 4 -# define DB_ERROR_INSERT_INDEX_CLASH 5 -# define DB_ERROR_WRONG_NUM_FIELDS 6 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef OPENSSL_STRING *OPENSSL_PSTRING; -DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) - -typedef struct txt_db_st { - int num_fields; - STACK_OF(OPENSSL_PSTRING) *data; - LHASH_OF(OPENSSL_STRING) **index; - int (**qual) (OPENSSL_STRING *); - long error; - long arg1; - long arg2; - OPENSSL_STRING *arg_row; -} TXT_DB; - -TXT_DB *TXT_DB_read(BIO *in, int num); -long TXT_DB_write(BIO *out, TXT_DB *db); -int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), - OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); -void TXT_DB_free(TXT_DB *db); -OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, - OPENSSL_STRING *value); -int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ui.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/ui.h deleted file mode 100644 index 7c721ec8..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/ui.h +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright 2001-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_UI_H -# define HEADER_UI_H - -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# endif -# include -# include -# include -# include - -/* For compatibility reasons, the macro OPENSSL_NO_UI is currently retained */ -# if OPENSSL_API_COMPAT < 0x10200000L -# ifdef OPENSSL_NO_UI_CONSOLE -# define OPENSSL_NO_UI -# endif -# endif - -# ifdef __cplusplus -extern "C" { -# endif - -/* - * All the following functions return -1 or NULL on error and in some cases - * (UI_process()) -2 if interrupted or in some other way cancelled. When - * everything is fine, they return 0, a positive value or a non-NULL pointer, - * all depending on their purpose. - */ - -/* Creators and destructor. */ -UI *UI_new(void); -UI *UI_new_method(const UI_METHOD *method); -void UI_free(UI *ui); - -/*- - The following functions are used to add strings to be printed and prompt - strings to prompt for data. The names are UI_{add,dup}__string - and UI_{add,dup}_input_boolean. - - UI_{add,dup}__string have the following meanings: - add add a text or prompt string. The pointers given to these - functions are used verbatim, no copying is done. - dup make a copy of the text or prompt string, then add the copy - to the collection of strings in the user interface. - - The function is a name for the functionality that the given - string shall be used for. It can be one of: - input use the string as data prompt. - verify use the string as verification prompt. This - is used to verify a previous input. - info use the string for informational output. - error use the string for error output. - Honestly, there's currently no difference between info and error for the - moment. - - UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", - and are typically used when one wants to prompt for a yes/no response. - - All of the functions in this group take a UI and a prompt string. - The string input and verify addition functions also take a flag argument, - a buffer for the result to end up with, a minimum input size and a maximum - input size (the result buffer MUST be large enough to be able to contain - the maximum number of characters). Additionally, the verify addition - functions takes another buffer to compare the result against. - The boolean input functions take an action description string (which should - be safe to ignore if the expected user action is obvious, for example with - a dialog box with an OK button and a Cancel button), a string of acceptable - characters to mean OK and to mean Cancel. The two last strings are checked - to make sure they don't have common characters. Additionally, the same - flag argument as for the string input is taken, as well as a result buffer. - The result buffer is required to be at least one byte long. Depending on - the answer, the first character from the OK or the Cancel character strings - will be stored in the first byte of the result buffer. No NUL will be - added, so the result is *not* a string. - - On success, the all return an index of the added information. That index - is useful when retrieving results with UI_get0_result(). */ -int UI_add_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); -int UI_dup_input_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize); -int UI_add_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, - const char *test_buf); -int UI_dup_verify_string(UI *ui, const char *prompt, int flags, - char *result_buf, int minsize, int maxsize, - const char *test_buf); -int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); -int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, - const char *ok_chars, const char *cancel_chars, - int flags, char *result_buf); -int UI_add_info_string(UI *ui, const char *text); -int UI_dup_info_string(UI *ui, const char *text); -int UI_add_error_string(UI *ui, const char *text); -int UI_dup_error_string(UI *ui, const char *text); - -/* These are the possible flags. They can be or'ed together. */ -/* Use to have echoing of input */ -# define UI_INPUT_FLAG_ECHO 0x01 -/* - * Use a default password. Where that password is found is completely up to - * the application, it might for example be in the user data set with - * UI_add_user_data(). It is not recommended to have more than one input in - * each UI being marked with this flag, or the application might get - * confused. - */ -# define UI_INPUT_FLAG_DEFAULT_PWD 0x02 - -/*- - * The user of these routines may want to define flags of their own. The core - * UI won't look at those, but will pass them on to the method routines. They - * must use higher bits so they don't get confused with the UI bits above. - * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good - * example of use is this: - * - * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) - * -*/ -# define UI_INPUT_FLAG_USER_BASE 16 - -/*- - * The following function helps construct a prompt. object_desc is a - * textual short description of the object, for example "pass phrase", - * and object_name is the name of the object (might be a card name or - * a file name. - * The returned string shall always be allocated on the heap with - * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). - * - * If the ui_method doesn't contain a pointer to a user-defined prompt - * constructor, a default string is built, looking like this: - * - * "Enter {object_desc} for {object_name}:" - * - * So, if object_desc has the value "pass phrase" and object_name has - * the value "foo.key", the resulting string is: - * - * "Enter pass phrase for foo.key:" -*/ -char *UI_construct_prompt(UI *ui_method, - const char *object_desc, const char *object_name); - -/* - * The following function is used to store a pointer to user-specific data. - * Any previous such pointer will be returned and replaced. - * - * For callback purposes, this function makes a lot more sense than using - * ex_data, since the latter requires that different parts of OpenSSL or - * applications share the same ex_data index. - * - * Note that the UI_OpenSSL() method completely ignores the user data. Other - * methods may not, however. - */ -void *UI_add_user_data(UI *ui, void *user_data); -/* - * Alternatively, this function is used to duplicate the user data. - * This uses the duplicator method function. The destroy function will - * be used to free the user data in this case. - */ -int UI_dup_user_data(UI *ui, void *user_data); -/* We need a user data retrieving function as well. */ -void *UI_get0_user_data(UI *ui); - -/* Return the result associated with a prompt given with the index i. */ -const char *UI_get0_result(UI *ui, int i); -int UI_get_result_length(UI *ui, int i); - -/* When all strings have been added, process the whole thing. */ -int UI_process(UI *ui); - -/* - * Give a user interface parameterised control commands. This can be used to - * send down an integer, a data pointer or a function pointer, as well as be - * used to get information from a UI. - */ -int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void)); - -/* The commands */ -/* - * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the - * OpenSSL error stack before printing any info or added error messages and - * before any prompting. - */ -# define UI_CTRL_PRINT_ERRORS 1 -/* - * Check if a UI_process() is possible to do again with the same instance of - * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 - * if not. - */ -# define UI_CTRL_IS_REDOABLE 2 - -/* Some methods may use extra data */ -# define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) -# define UI_get_app_data(s) UI_get_ex_data(s,0) - -# define UI_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef) -int UI_set_ex_data(UI *r, int idx, void *arg); -void *UI_get_ex_data(UI *r, int idx); - -/* Use specific methods instead of the built-in one */ -void UI_set_default_method(const UI_METHOD *meth); -const UI_METHOD *UI_get_default_method(void); -const UI_METHOD *UI_get_method(UI *ui); -const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); - -# ifndef OPENSSL_NO_UI_CONSOLE - -/* The method with all the built-in thingies */ -UI_METHOD *UI_OpenSSL(void); - -# endif - -/* - * NULL method. Literally does nothing, but may serve as a placeholder - * to avoid internal default. - */ -const UI_METHOD *UI_null(void); - -/* ---------- For method writers ---------- */ -/*- - A method contains a number of functions that implement the low level - of the User Interface. The functions are: - - an opener This function starts a session, maybe by opening - a channel to a tty, or by opening a window. - a writer This function is called to write a given string, - maybe to the tty, maybe as a field label in a - window. - a flusher This function is called to flush everything that - has been output so far. It can be used to actually - display a dialog box after it has been built. - a reader This function is called to read a given prompt, - maybe from the tty, maybe from a field in a - window. Note that it's called with all string - structures, not only the prompt ones, so it must - check such things itself. - a closer This function closes the session, maybe by closing - the channel to the tty, or closing the window. - - All these functions are expected to return: - - 0 on error. - 1 on success. - -1 on out-of-band events, for example if some prompting has - been canceled (by pressing Ctrl-C, for example). This is - only checked when returned by the flusher or the reader. - - The way this is used, the opener is first called, then the writer for all - strings, then the flusher, then the reader for all strings and finally the - closer. Note that if you want to prompt from a terminal or other command - line interface, the best is to have the reader also write the prompts - instead of having the writer do it. If you want to prompt from a dialog - box, the writer can be used to build up the contents of the box, and the - flusher to actually display the box and run the event loop until all data - has been given, after which the reader only grabs the given data and puts - them back into the UI strings. - - All method functions take a UI as argument. Additionally, the writer and - the reader take a UI_STRING. -*/ - -/* - * The UI_STRING type is the data structure that contains all the needed info - * about a string or a prompt, including test data for a verification prompt. - */ -typedef struct ui_string_st UI_STRING; -DEFINE_STACK_OF(UI_STRING) - -/* - * The different types of strings that are currently supported. This is only - * needed by method authors. - */ -enum UI_string_types { - UIT_NONE = 0, - UIT_PROMPT, /* Prompt for a string */ - UIT_VERIFY, /* Prompt for a string and verify */ - UIT_BOOLEAN, /* Prompt for a yes/no response */ - UIT_INFO, /* Send info to the user */ - UIT_ERROR /* Send an error message to the user */ -}; - -/* Create and manipulate methods */ -UI_METHOD *UI_create_method(const char *name); -void UI_destroy_method(UI_METHOD *ui_method); -int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui)); -int UI_method_set_writer(UI_METHOD *method, - int (*writer) (UI *ui, UI_STRING *uis)); -int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui)); -int UI_method_set_reader(UI_METHOD *method, - int (*reader) (UI *ui, UI_STRING *uis)); -int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui)); -int UI_method_set_data_duplicator(UI_METHOD *method, - void *(*duplicator) (UI *ui, void *ui_data), - void (*destructor)(UI *ui, void *ui_data)); -int UI_method_set_prompt_constructor(UI_METHOD *method, - char *(*prompt_constructor) (UI *ui, - const char - *object_desc, - const char - *object_name)); -int UI_method_set_ex_data(UI_METHOD *method, int idx, void *data); -int (*UI_method_get_opener(const UI_METHOD *method)) (UI *); -int (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *); -int (*UI_method_get_flusher(const UI_METHOD *method)) (UI *); -int (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *); -int (*UI_method_get_closer(const UI_METHOD *method)) (UI *); -char *(*UI_method_get_prompt_constructor(const UI_METHOD *method)) - (UI *, const char *, const char *); -void *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *); -void (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *); -const void *UI_method_get_ex_data(const UI_METHOD *method, int idx); - -/* - * The following functions are helpers for method writers to access relevant - * data from a UI_STRING. - */ - -/* Return type of the UI_STRING */ -enum UI_string_types UI_get_string_type(UI_STRING *uis); -/* Return input flags of the UI_STRING */ -int UI_get_input_flags(UI_STRING *uis); -/* Return the actual string to output (the prompt, info or error) */ -const char *UI_get0_output_string(UI_STRING *uis); -/* - * Return the optional action string to output (the boolean prompt - * instruction) - */ -const char *UI_get0_action_string(UI_STRING *uis); -/* Return the result of a prompt */ -const char *UI_get0_result_string(UI_STRING *uis); -int UI_get_result_string_length(UI_STRING *uis); -/* - * Return the string to test the result against. Only useful with verifies. - */ -const char *UI_get0_test_string(UI_STRING *uis); -/* Return the required minimum size of the result */ -int UI_get_result_minsize(UI_STRING *uis); -/* Return the required maximum size of the result */ -int UI_get_result_maxsize(UI_STRING *uis); -/* Set the result of a UI_STRING. */ -int UI_set_result(UI *ui, UI_STRING *uis, const char *result); -int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len); - -/* A couple of popular utility functions */ -int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, - int verify); -int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, - int verify); -UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag); - - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/uierr.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/uierr.h deleted file mode 100644 index bd68864d..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/uierr.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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_UIERR_H -# define HEADER_UIERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_UI_strings(void); - -/* - * UI function codes. - */ -# define UI_F_CLOSE_CONSOLE 115 -# define UI_F_ECHO_CONSOLE 116 -# define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 -# define UI_F_GENERAL_ALLOCATE_PROMPT 109 -# define UI_F_NOECHO_CONSOLE 117 -# define UI_F_OPEN_CONSOLE 114 -# define UI_F_UI_CONSTRUCT_PROMPT 121 -# define UI_F_UI_CREATE_METHOD 112 -# define UI_F_UI_CTRL 111 -# define UI_F_UI_DUP_ERROR_STRING 101 -# define UI_F_UI_DUP_INFO_STRING 102 -# define UI_F_UI_DUP_INPUT_BOOLEAN 110 -# define UI_F_UI_DUP_INPUT_STRING 103 -# define UI_F_UI_DUP_USER_DATA 118 -# define UI_F_UI_DUP_VERIFY_STRING 106 -# define UI_F_UI_GET0_RESULT 107 -# define UI_F_UI_GET_RESULT_LENGTH 119 -# define UI_F_UI_NEW_METHOD 104 -# define UI_F_UI_PROCESS 113 -# define UI_F_UI_SET_RESULT 105 -# define UI_F_UI_SET_RESULT_EX 120 - -/* - * UI reason codes. - */ -# define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 -# define UI_R_INDEX_TOO_LARGE 102 -# define UI_R_INDEX_TOO_SMALL 103 -# define UI_R_NO_RESULT_BUFFER 105 -# define UI_R_PROCESSING_ERROR 107 -# define UI_R_RESULT_TOO_LARGE 100 -# define UI_R_RESULT_TOO_SMALL 101 -# define UI_R_SYSASSIGN_ERROR 109 -# define UI_R_SYSDASSGN_ERROR 110 -# define UI_R_SYSQIOW_ERROR 111 -# define UI_R_UNKNOWN_CONTROL_COMMAND 106 -# define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 -# define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/whrlpool.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/whrlpool.h deleted file mode 100644 index 20ea3503..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/whrlpool.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2005-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_WHRLPOOL_H -# define HEADER_WHRLPOOL_H - -#include - -# ifndef OPENSSL_NO_WHIRLPOOL -# include -# include -# ifdef __cplusplus -extern "C" { -# endif - -# define WHIRLPOOL_DIGEST_LENGTH (512/8) -# define WHIRLPOOL_BBLOCK 512 -# define WHIRLPOOL_COUNTER (256/8) - -typedef struct { - union { - unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; - /* double q is here to ensure 64-bit alignment */ - double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; - } H; - unsigned char data[WHIRLPOOL_BBLOCK / 8]; - unsigned int bitoff; - size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; -} WHIRLPOOL_CTX; - -int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); -int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); -void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); -int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); -unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); - -# ifdef __cplusplus -} -# endif -# endif - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509.h deleted file mode 100644 index 39ca0ba5..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509.h +++ /dev/null @@ -1,1047 +0,0 @@ -/* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2002, Oracle and/or its affiliates. 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_X509_H -# define HEADER_X509_H - -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# if OPENSSL_API_COMPAT < 0x10100000L -# include -# include -# include -# endif - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Flags for X509_get_signature_info() */ -/* Signature info is valid */ -# define X509_SIG_INFO_VALID 0x1 -/* Signature is suitable for TLS use */ -# define X509_SIG_INFO_TLS 0x2 - -# define X509_FILETYPE_PEM 1 -# define X509_FILETYPE_ASN1 2 -# define X509_FILETYPE_DEFAULT 3 - -# define X509v3_KU_DIGITAL_SIGNATURE 0x0080 -# define X509v3_KU_NON_REPUDIATION 0x0040 -# define X509v3_KU_KEY_ENCIPHERMENT 0x0020 -# define X509v3_KU_DATA_ENCIPHERMENT 0x0010 -# define X509v3_KU_KEY_AGREEMENT 0x0008 -# define X509v3_KU_KEY_CERT_SIGN 0x0004 -# define X509v3_KU_CRL_SIGN 0x0002 -# define X509v3_KU_ENCIPHER_ONLY 0x0001 -# define X509v3_KU_DECIPHER_ONLY 0x8000 -# define X509v3_KU_UNDEF 0xffff - -struct X509_algor_st { - ASN1_OBJECT *algorithm; - ASN1_TYPE *parameter; -} /* X509_ALGOR */ ; - -typedef STACK_OF(X509_ALGOR) X509_ALGORS; - -typedef struct X509_val_st { - ASN1_TIME *notBefore; - ASN1_TIME *notAfter; -} X509_VAL; - -typedef struct X509_sig_st X509_SIG; - -typedef struct X509_name_entry_st X509_NAME_ENTRY; - -DEFINE_STACK_OF(X509_NAME_ENTRY) - -DEFINE_STACK_OF(X509_NAME) - -# define X509_EX_V_NETSCAPE_HACK 0x8000 -# define X509_EX_V_INIT 0x0001 -typedef struct X509_extension_st X509_EXTENSION; - -typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; - -DEFINE_STACK_OF(X509_EXTENSION) - -typedef struct x509_attributes_st X509_ATTRIBUTE; - -DEFINE_STACK_OF(X509_ATTRIBUTE) - -typedef struct X509_req_info_st X509_REQ_INFO; - -typedef struct X509_req_st X509_REQ; - -typedef struct x509_cert_aux_st X509_CERT_AUX; - -typedef struct x509_cinf_st X509_CINF; - -DEFINE_STACK_OF(X509) - -/* This is used for a table of trust checking functions */ - -typedef struct x509_trust_st { - int trust; - int flags; - int (*check_trust) (struct x509_trust_st *, X509 *, int); - char *name; - int arg1; - void *arg2; -} X509_TRUST; - -DEFINE_STACK_OF(X509_TRUST) - -/* standard trust ids */ - -# define X509_TRUST_DEFAULT 0 /* Only valid in purpose settings */ - -# define X509_TRUST_COMPAT 1 -# define X509_TRUST_SSL_CLIENT 2 -# define X509_TRUST_SSL_SERVER 3 -# define X509_TRUST_EMAIL 4 -# define X509_TRUST_OBJECT_SIGN 5 -# define X509_TRUST_OCSP_SIGN 6 -# define X509_TRUST_OCSP_REQUEST 7 -# define X509_TRUST_TSA 8 - -/* Keep these up to date! */ -# define X509_TRUST_MIN 1 -# define X509_TRUST_MAX 8 - -/* trust_flags values */ -# define X509_TRUST_DYNAMIC (1U << 0) -# define X509_TRUST_DYNAMIC_NAME (1U << 1) -/* No compat trust if self-signed, preempts "DO_SS" */ -# define X509_TRUST_NO_SS_COMPAT (1U << 2) -/* Compat trust if no explicit accepted trust EKUs */ -# define X509_TRUST_DO_SS_COMPAT (1U << 3) -/* Accept "anyEKU" as a wildcard trust OID */ -# define X509_TRUST_OK_ANY_EKU (1U << 4) - -/* check_trust return codes */ - -# define X509_TRUST_TRUSTED 1 -# define X509_TRUST_REJECTED 2 -# define X509_TRUST_UNTRUSTED 3 - -/* Flags for X509_print_ex() */ - -# define X509_FLAG_COMPAT 0 -# define X509_FLAG_NO_HEADER 1L -# define X509_FLAG_NO_VERSION (1L << 1) -# define X509_FLAG_NO_SERIAL (1L << 2) -# define X509_FLAG_NO_SIGNAME (1L << 3) -# define X509_FLAG_NO_ISSUER (1L << 4) -# define X509_FLAG_NO_VALIDITY (1L << 5) -# define X509_FLAG_NO_SUBJECT (1L << 6) -# define X509_FLAG_NO_PUBKEY (1L << 7) -# define X509_FLAG_NO_EXTENSIONS (1L << 8) -# define X509_FLAG_NO_SIGDUMP (1L << 9) -# define X509_FLAG_NO_AUX (1L << 10) -# define X509_FLAG_NO_ATTRIBUTES (1L << 11) -# define X509_FLAG_NO_IDS (1L << 12) - -/* Flags specific to X509_NAME_print_ex() */ - -/* The field separator information */ - -# define XN_FLAG_SEP_MASK (0xf << 16) - -# define XN_FLAG_COMPAT 0/* Traditional; use old X509_NAME_print */ -# define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */ -# define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */ -# define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */ -# define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */ - -# define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */ - -/* How the field name is shown */ - -# define XN_FLAG_FN_MASK (0x3 << 21) - -# define XN_FLAG_FN_SN 0/* Object short name */ -# define XN_FLAG_FN_LN (1 << 21)/* Object long name */ -# define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */ -# define XN_FLAG_FN_NONE (3 << 21)/* No field names */ - -# define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */ - -/* - * This determines if we dump fields we don't recognise: RFC2253 requires - * this. - */ - -# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) - -# define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20 - * characters */ - -/* Complete set of RFC2253 flags */ - -# define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ - XN_FLAG_SEP_COMMA_PLUS | \ - XN_FLAG_DN_REV | \ - XN_FLAG_FN_SN | \ - XN_FLAG_DUMP_UNKNOWN_FIELDS) - -/* readable oneline form */ - -# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ - ASN1_STRFLGS_ESC_QUOTE | \ - XN_FLAG_SEP_CPLUS_SPC | \ - XN_FLAG_SPC_EQ | \ - XN_FLAG_FN_SN) - -/* readable multiline form */ - -# define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ - ASN1_STRFLGS_ESC_MSB | \ - XN_FLAG_SEP_MULTILINE | \ - XN_FLAG_SPC_EQ | \ - XN_FLAG_FN_LN | \ - XN_FLAG_FN_ALIGN) - -DEFINE_STACK_OF(X509_REVOKED) - -typedef struct X509_crl_info_st X509_CRL_INFO; - -DEFINE_STACK_OF(X509_CRL) - -typedef struct private_key_st { - int version; - /* The PKCS#8 data types */ - X509_ALGOR *enc_algor; - ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ - /* When decrypted, the following will not be NULL */ - EVP_PKEY *dec_pkey; - /* used to encrypt and decrypt */ - int key_length; - char *key_data; - int key_free; /* true if we should auto free key_data */ - /* expanded version of 'enc_algor' */ - EVP_CIPHER_INFO cipher; -} X509_PKEY; - -typedef struct X509_info_st { - X509 *x509; - X509_CRL *crl; - X509_PKEY *x_pkey; - EVP_CIPHER_INFO enc_cipher; - int enc_len; - char *enc_data; -} X509_INFO; - -DEFINE_STACK_OF(X509_INFO) - -/* - * The next 2 structures and their 8 routines are used to manipulate Netscape's - * spki structures - useful if you are writing a CA web page - */ -typedef struct Netscape_spkac_st { - X509_PUBKEY *pubkey; - ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ -} NETSCAPE_SPKAC; - -typedef struct Netscape_spki_st { - NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ - X509_ALGOR sig_algor; - ASN1_BIT_STRING *signature; -} NETSCAPE_SPKI; - -/* Netscape certificate sequence structure */ -typedef struct Netscape_certificate_sequence { - ASN1_OBJECT *type; - STACK_OF(X509) *certs; -} NETSCAPE_CERT_SEQUENCE; - -/*- Unused (and iv length is wrong) -typedef struct CBCParameter_st - { - unsigned char iv[8]; - } CBC_PARAM; -*/ - -/* Password based encryption structure */ - -typedef struct PBEPARAM_st { - ASN1_OCTET_STRING *salt; - ASN1_INTEGER *iter; -} PBEPARAM; - -/* Password based encryption V2 structures */ - -typedef struct PBE2PARAM_st { - X509_ALGOR *keyfunc; - X509_ALGOR *encryption; -} PBE2PARAM; - -typedef struct PBKDF2PARAM_st { -/* Usually OCTET STRING but could be anything */ - ASN1_TYPE *salt; - ASN1_INTEGER *iter; - ASN1_INTEGER *keylength; - X509_ALGOR *prf; -} PBKDF2PARAM; - -#ifndef OPENSSL_NO_SCRYPT -typedef struct SCRYPT_PARAMS_st { - ASN1_OCTET_STRING *salt; - ASN1_INTEGER *costParameter; - ASN1_INTEGER *blockSize; - ASN1_INTEGER *parallelizationParameter; - ASN1_INTEGER *keyLength; -} SCRYPT_PARAMS; -#endif - -#ifdef __cplusplus -} -#endif - -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -# define X509_EXT_PACK_UNKNOWN 1 -# define X509_EXT_PACK_STRING 2 - -# define X509_extract_key(x) X509_get_pubkey(x)/*****/ -# define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) -# define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) - -void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); -X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl), - int (*crl_free) (X509_CRL *crl), - int (*crl_lookup) (X509_CRL *crl, - X509_REVOKED **ret, - ASN1_INTEGER *ser, - X509_NAME *issuer), - int (*crl_verify) (X509_CRL *crl, - EVP_PKEY *pk)); -void X509_CRL_METHOD_free(X509_CRL_METHOD *m); - -void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); -void *X509_CRL_get_meth_data(X509_CRL *crl); - -const char *X509_verify_cert_error_string(long n); - -int X509_verify(X509 *a, EVP_PKEY *r); - -int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); -int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); -int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); - -NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); -char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); -EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); -int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); - -int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); - -int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); -int X509_signature_print(BIO *bp, const X509_ALGOR *alg, - const ASN1_STRING *sig); - -int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); -# ifndef OPENSSL_NO_OCSP -int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert); -# endif -int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); -int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); -int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); -# ifndef OPENSSL_NO_OCSP -int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl); -# endif -int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); - -int X509_pubkey_digest(const X509 *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_digest(const X509 *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); -int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, - unsigned char *md, unsigned int *len); - -# ifndef OPENSSL_NO_STDIO -X509 *d2i_X509_fp(FILE *fp, X509 **x509); -int i2d_X509_fp(FILE *fp, X509 *x509); -X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); -int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl); -X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); -int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req); -# ifndef OPENSSL_NO_RSA -RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); -int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa); -RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); -int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa); -RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); -int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa); -# endif -# ifndef OPENSSL_NO_DSA -DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); -int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); -DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); -int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); -# endif -# ifndef OPENSSL_NO_EC -EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); -int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); -EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); -int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); -# endif -X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); -int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8); -PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, - PKCS8_PRIV_KEY_INFO **p8inf); -int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf); -int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); -int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); -int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); -# endif - -X509 *d2i_X509_bio(BIO *bp, X509 **x509); -int i2d_X509_bio(BIO *bp, X509 *x509); -X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); -int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl); -X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); -int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req); -# ifndef OPENSSL_NO_RSA -RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); -int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa); -RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); -int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa); -RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); -int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa); -# endif -# ifndef OPENSSL_NO_DSA -DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); -int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); -DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); -int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); -# endif -# ifndef OPENSSL_NO_EC -EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); -int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); -EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); -int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); -# endif -X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); -int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8); -PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, - PKCS8_PRIV_KEY_INFO **p8inf); -int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf); -int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); -int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); -int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); -EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); - -X509 *X509_dup(X509 *x509); -X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); -X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); -X509_CRL *X509_CRL_dup(X509_CRL *crl); -X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev); -X509_REQ *X509_REQ_dup(X509_REQ *req); -X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); -int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, - void *pval); -void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, - const void **ppval, const X509_ALGOR *algor); -void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); -int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); - -X509_NAME *X509_NAME_dup(X509_NAME *xn); -X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); - -int X509_cmp_time(const ASN1_TIME *s, time_t *t); -int X509_cmp_current_time(const ASN1_TIME *s); -ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t); -ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, - int offset_day, long offset_sec, time_t *t); -ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); - -const char *X509_get_default_cert_area(void); -const char *X509_get_default_cert_dir(void); -const char *X509_get_default_cert_file(void); -const char *X509_get_default_cert_dir_env(void); -const char *X509_get_default_cert_file_env(void); -const char *X509_get_default_private_dir(void); - -X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); -X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); - -DECLARE_ASN1_FUNCTIONS(X509_ALGOR) -DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) -DECLARE_ASN1_FUNCTIONS(X509_VAL) - -DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) - -int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); -EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key); -EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key); -int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain); -long X509_get_pathlen(X509 *x); -int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp); -EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length); -# ifndef OPENSSL_NO_RSA -int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); -RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length); -# endif -# ifndef OPENSSL_NO_DSA -int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp); -DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length); -# endif -# ifndef OPENSSL_NO_EC -int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); -EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length); -# endif - -DECLARE_ASN1_FUNCTIONS(X509_SIG) -void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, - const ASN1_OCTET_STRING **pdigest); -void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, - ASN1_OCTET_STRING **pdigest); - -DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) -DECLARE_ASN1_FUNCTIONS(X509_REQ) - -DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) -X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); - -DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) -DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) - -DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) - -DECLARE_ASN1_FUNCTIONS(X509_NAME) - -int X509_NAME_set(X509_NAME **xn, X509_NAME *name); - -DECLARE_ASN1_FUNCTIONS(X509_CINF) - -DECLARE_ASN1_FUNCTIONS(X509) -DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) - -#define X509_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef) -int X509_set_ex_data(X509 *r, int idx, void *arg); -void *X509_get_ex_data(X509 *r, int idx); -int i2d_X509_AUX(X509 *a, unsigned char **pp); -X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length); - -int i2d_re_X509_tbs(X509 *x, unsigned char **pp); - -int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid, - int *secbits, uint32_t *flags); -void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid, - int secbits, uint32_t flags); - -int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits, - uint32_t *flags); - -void X509_get0_signature(const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg, const X509 *x); -int X509_get_signature_nid(const X509 *x); - -int X509_trusted(const X509 *x); -int X509_alias_set1(X509 *x, const unsigned char *name, int len); -int X509_keyid_set1(X509 *x, const unsigned char *id, int len); -unsigned char *X509_alias_get0(X509 *x, int *len); -unsigned char *X509_keyid_get0(X509 *x, int *len); -int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *, - int); -int X509_TRUST_set(int *t, int trust); -int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); -int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj); -void X509_trust_clear(X509 *x); -void X509_reject_clear(X509 *x); - -STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x); -STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x); - -DECLARE_ASN1_FUNCTIONS(X509_REVOKED) -DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) -DECLARE_ASN1_FUNCTIONS(X509_CRL) - -int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); -int X509_CRL_get0_by_serial(X509_CRL *crl, - X509_REVOKED **ret, ASN1_INTEGER *serial); -int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); - -X509_PKEY *X509_PKEY_new(void); -void X509_PKEY_free(X509_PKEY *a); - -DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) -DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) -DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) - -X509_INFO *X509_INFO_new(void); -void X509_INFO_free(X509_INFO *a); -char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size); - -int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, - ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); - -int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, - unsigned char *md, unsigned int *len); - -int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, - char *data, EVP_PKEY *pkey, const EVP_MD *type); - -int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, - unsigned char *md, unsigned int *len); - -int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, - ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey); - -int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data, - EVP_PKEY *pkey, const EVP_MD *type); -int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, - void *asn, EVP_MD_CTX *ctx); - -long X509_get_version(const X509 *x); -int X509_set_version(X509 *x, long version); -int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); -ASN1_INTEGER *X509_get_serialNumber(X509 *x); -const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); -int X509_set_issuer_name(X509 *x, X509_NAME *name); -X509_NAME *X509_get_issuer_name(const X509 *a); -int X509_set_subject_name(X509 *x, X509_NAME *name); -X509_NAME *X509_get_subject_name(const X509 *a); -const ASN1_TIME * X509_get0_notBefore(const X509 *x); -ASN1_TIME *X509_getm_notBefore(const X509 *x); -int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); -const ASN1_TIME *X509_get0_notAfter(const X509 *x); -ASN1_TIME *X509_getm_notAfter(const X509 *x); -int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); -int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); -int X509_up_ref(X509 *x); -int X509_get_signature_type(const X509 *x); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_get_notBefore X509_getm_notBefore -# define X509_get_notAfter X509_getm_notAfter -# define X509_set_notBefore X509_set1_notBefore -# define X509_set_notAfter X509_set1_notAfter -#endif - - -/* - * This one is only used so that a binary form can output, as in - * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf) - */ -X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); -const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); -void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid, - const ASN1_BIT_STRING **psuid); -const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); - -EVP_PKEY *X509_get0_pubkey(const X509 *x); -EVP_PKEY *X509_get_pubkey(X509 *x); -ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); -int X509_certificate_type(const X509 *x, const EVP_PKEY *pubkey); - -long X509_REQ_get_version(const X509_REQ *req); -int X509_REQ_set_version(X509_REQ *x, long version); -X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req); -int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); -void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg); -int X509_REQ_get_signature_nid(const X509_REQ *req); -int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); -int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); -EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); -EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req); -X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req); -int X509_REQ_extension_nid(int nid); -int *X509_REQ_get_extension_nids(void); -void X509_REQ_set_extension_nids(int *nids); -STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); -int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, - int nid); -int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); -int X509_REQ_get_attr_count(const X509_REQ *req); -int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); -int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); -X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); -int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); -int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len); -int X509_REQ_add1_attr_by_NID(X509_REQ *req, - int nid, int type, - const unsigned char *bytes, int len); -int X509_REQ_add1_attr_by_txt(X509_REQ *req, - const char *attrname, int type, - const unsigned char *bytes, int len); - -int X509_CRL_set_version(X509_CRL *x, long version); -int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); -int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); -int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); -int X509_CRL_sort(X509_CRL *crl); -int X509_CRL_up_ref(X509_CRL *crl); - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate -# define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate -#endif - -long X509_CRL_get_version(const X509_CRL *crl); -const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); -const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); -DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl)) -DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl)) -X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); -const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); -STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); -void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, - const X509_ALGOR **palg); -int X509_CRL_get_signature_nid(const X509_CRL *crl); -int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); - -const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); -int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); -const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); -int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); -const STACK_OF(X509_EXTENSION) * -X509_REVOKED_get0_extensions(const X509_REVOKED *r); - -X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, - EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); - -int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey); - -int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); -int X509_chain_check_suiteb(int *perror_depth, - X509 *x, STACK_OF(X509) *chain, - unsigned long flags); -int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); -STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); - -int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); -unsigned long X509_issuer_and_serial_hash(X509 *a); - -int X509_issuer_name_cmp(const X509 *a, const X509 *b); -unsigned long X509_issuer_name_hash(X509 *a); - -int X509_subject_name_cmp(const X509 *a, const X509 *b); -unsigned long X509_subject_name_hash(X509 *x); - -# ifndef OPENSSL_NO_MD5 -unsigned long X509_issuer_name_hash_old(X509 *a); -unsigned long X509_subject_name_hash_old(X509 *x); -# endif - -int X509_cmp(const X509 *a, const X509 *b); -int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); -unsigned long X509_NAME_hash(X509_NAME *x); -unsigned long X509_NAME_hash_old(X509_NAME *x); - -int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); -int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); -int X509_aux_print(BIO *out, X509 *x, int indent); -# ifndef OPENSSL_NO_STDIO -int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, - unsigned long cflag); -int X509_print_fp(FILE *bp, X509 *x); -int X509_CRL_print_fp(FILE *bp, X509_CRL *x); -int X509_REQ_print_fp(FILE *bp, X509_REQ *req); -int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, - unsigned long flags); -# endif - -int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase); -int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, - unsigned long flags); -int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, - unsigned long cflag); -int X509_print(BIO *bp, X509 *x); -int X509_ocspid_print(BIO *bp, X509 *x); -int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag); -int X509_CRL_print(BIO *bp, X509_CRL *x); -int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, - unsigned long cflag); -int X509_REQ_print(BIO *bp, X509_REQ *req); - -int X509_NAME_entry_count(const X509_NAME *name); -int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len); -int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, - char *buf, int len); - -/* - * NOTE: you should be passing -1, not 0 as lastpos. The functions that use - * lastpos, search after that position on. - */ -int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos); -int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, - int lastpos); -X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); -X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); -int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, - int loc, int set); -int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len, int loc, - int set); -int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, - const unsigned char *bytes, int len, int loc, - int set); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, - const char *field, int type, - const unsigned char *bytes, - int len); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, - int type, - const unsigned char *bytes, - int len); -int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, - const unsigned char *bytes, int len, int loc, - int set); -X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, - int len); -int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj); -int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, - const unsigned char *bytes, int len); -ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); -ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); -int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); - -int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, - size_t *pderlen); - -int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); -int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, - int nid, int lastpos); -int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, - const ASN1_OBJECT *obj, int lastpos); -int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, - int crit, int lastpos); -X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); -X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); -STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, - X509_EXTENSION *ex, int loc); - -int X509_get_ext_count(const X509 *x); -int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); -int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos); -int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); -X509_EXTENSION *X509_get_ext(const X509 *x, int loc); -X509_EXTENSION *X509_delete_ext(X509 *x, int loc); -int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); -void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); -int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, - unsigned long flags); - -int X509_CRL_get_ext_count(const X509_CRL *x); -int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos); -int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, - int lastpos); -int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos); -X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); -X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); -int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); -void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx); -int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, - unsigned long flags); - -int X509_REVOKED_get_ext_count(const X509_REVOKED *x); -int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos); -int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj, - int lastpos); -int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, - int lastpos); -X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); -X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); -int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); -void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, - int *idx); -int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, - unsigned long flags); - -X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, - int nid, int crit, - ASN1_OCTET_STRING *data); -X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, - const ASN1_OBJECT *obj, int crit, - ASN1_OCTET_STRING *data); -int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); -int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); -int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); -ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); -ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); -int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); - -int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); -int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, - int lastpos); -int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, - const ASN1_OBJECT *obj, int lastpos); -X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); -X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, - X509_ATTRIBUTE *attr); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) - **x, const ASN1_OBJECT *obj, - int type, - const unsigned char *bytes, - int len); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) - **x, int nid, int type, - const unsigned char *bytes, - int len); -STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) - **x, const char *attrname, - int type, - const unsigned char *bytes, - int len); -void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, - const ASN1_OBJECT *obj, int lastpos, int type); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, - int atrtype, const void *data, - int len); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, - const ASN1_OBJECT *obj, - int atrtype, const void *data, - int len); -X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, - const char *atrname, int type, - const unsigned char *bytes, - int len); -int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); -int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, - const void *data, int len); -void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype, - void *data); -int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); -ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); -ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); - -int EVP_PKEY_get_attr_count(const EVP_PKEY *key); -int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); -int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, - int lastpos); -X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); -X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); -int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); -int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, - const ASN1_OBJECT *obj, int type, - const unsigned char *bytes, int len); -int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, - int nid, int type, - const unsigned char *bytes, int len); -int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, - const char *attrname, int type, - const unsigned char *bytes, int len); - -int X509_verify_cert(X509_STORE_CTX *ctx); - -/* lookup a cert from a X509 STACK */ -X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name, - ASN1_INTEGER *serial); -X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name); - -DECLARE_ASN1_FUNCTIONS(PBEPARAM) -DECLARE_ASN1_FUNCTIONS(PBE2PARAM) -DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) -#ifndef OPENSSL_NO_SCRYPT -DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS) -#endif - -int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, - const unsigned char *salt, int saltlen); - -X509_ALGOR *PKCS5_pbe_set(int alg, int iter, - const unsigned char *salt, int saltlen); -X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, - unsigned char *salt, int saltlen); -X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, - unsigned char *salt, int saltlen, - unsigned char *aiv, int prf_nid); - -#ifndef OPENSSL_NO_SCRYPT -X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, - const unsigned char *salt, int saltlen, - unsigned char *aiv, uint64_t N, uint64_t r, - uint64_t p); -#endif - -X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, - int prf_nid, int keylen); - -/* PKCS#8 utilities */ - -DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) - -EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); -PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); - -int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, - int version, int ptype, void *pval, - unsigned char *penc, int penclen); -int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, - const unsigned char **pk, int *ppklen, - const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); - -const STACK_OF(X509_ATTRIBUTE) * -PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); -int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, - const unsigned char *bytes, int len); - -int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, - int ptype, void *pval, - unsigned char *penc, int penclen); -int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, - const unsigned char **pk, int *ppklen, - X509_ALGOR **pa, X509_PUBKEY *pub); - -int X509_check_trust(X509 *x, int id, int flags); -int X509_TRUST_get_count(void); -X509_TRUST *X509_TRUST_get0(int idx); -int X509_TRUST_get_by_id(int id); -int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), - const char *name, int arg1, void *arg2); -void X509_TRUST_cleanup(void); -int X509_TRUST_get_flags(const X509_TRUST *xp); -char *X509_TRUST_get0_name(const X509_TRUST *xp); -int X509_TRUST_get_trust(const X509_TRUST *xp); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509_vfy.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509_vfy.h deleted file mode 100644 index adb8bce7..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509_vfy.h +++ /dev/null @@ -1,628 +0,0 @@ -/* - * 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_X509_VFY_H -# define HEADER_X509_VFY_H - -/* - * Protect against recursion, x509.h and x509_vfy.h each include the other. - */ -# ifndef HEADER_X509_H -# include -# endif - -# include -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- -SSL_CTX -> X509_STORE - -> X509_LOOKUP - ->X509_LOOKUP_METHOD - -> X509_LOOKUP - ->X509_LOOKUP_METHOD - -SSL -> X509_STORE_CTX - ->X509_STORE - -The X509_STORE holds the tables etc for verification stuff. -A X509_STORE_CTX is used while validating a single certificate. -The X509_STORE has X509_LOOKUPs for looking up certs. -The X509_STORE then calls a function to actually verify the -certificate chain. -*/ - -typedef enum { - X509_LU_NONE = 0, - X509_LU_X509, X509_LU_CRL -} X509_LOOKUP_TYPE; - -#if OPENSSL_API_COMPAT < 0x10100000L -#define X509_LU_RETRY -1 -#define X509_LU_FAIL 0 -#endif - -DEFINE_STACK_OF(X509_LOOKUP) -DEFINE_STACK_OF(X509_OBJECT) -DEFINE_STACK_OF(X509_VERIFY_PARAM) - -int X509_STORE_set_depth(X509_STORE *store, int depth); - -typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *); -typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); -typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer, - X509_STORE_CTX *ctx, X509 *x); -typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx, - X509 *x, X509 *issuer); -typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx); -typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx, - X509_CRL **crl, X509 *x); -typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl); -typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx, - X509_CRL *crl, X509 *x); -typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx); -typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx, - X509_NAME *nm); -typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx, - X509_NAME *nm); -typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx); - - -void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); - -# define X509_STORE_CTX_set_app_data(ctx,data) \ - X509_STORE_CTX_set_ex_data(ctx,0,data) -# define X509_STORE_CTX_get_app_data(ctx) \ - X509_STORE_CTX_get_ex_data(ctx,0) - -# define X509_L_FILE_LOAD 1 -# define X509_L_ADD_DIR 2 - -# define X509_LOOKUP_load_file(x,name,type) \ - X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) - -# define X509_LOOKUP_add_dir(x,name,type) \ - X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) - -# define X509_V_OK 0 -# define X509_V_ERR_UNSPECIFIED 1 -# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 -# define X509_V_ERR_UNABLE_TO_GET_CRL 3 -# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 -# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 -# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 -# define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 -# define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 -# define X509_V_ERR_CERT_NOT_YET_VALID 9 -# define X509_V_ERR_CERT_HAS_EXPIRED 10 -# define X509_V_ERR_CRL_NOT_YET_VALID 11 -# define X509_V_ERR_CRL_HAS_EXPIRED 12 -# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 -# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 -# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 -# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 -# define X509_V_ERR_OUT_OF_MEM 17 -# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 -# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 -# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 -# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 -# define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 -# define X509_V_ERR_CERT_REVOKED 23 -# define X509_V_ERR_INVALID_CA 24 -# define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 -# define X509_V_ERR_INVALID_PURPOSE 26 -# define X509_V_ERR_CERT_UNTRUSTED 27 -# define X509_V_ERR_CERT_REJECTED 28 -/* These are 'informational' when looking for issuer cert */ -# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 -# define X509_V_ERR_AKID_SKID_MISMATCH 30 -# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 -# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 -# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 -# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 -# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 -# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 -# define X509_V_ERR_INVALID_NON_CA 37 -# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 -# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 -# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 -# define X509_V_ERR_INVALID_EXTENSION 41 -# define X509_V_ERR_INVALID_POLICY_EXTENSION 42 -# define X509_V_ERR_NO_EXPLICIT_POLICY 43 -# define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 -# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 -# define X509_V_ERR_UNNESTED_RESOURCE 46 -# define X509_V_ERR_PERMITTED_VIOLATION 47 -# define X509_V_ERR_EXCLUDED_VIOLATION 48 -# define X509_V_ERR_SUBTREE_MINMAX 49 -/* The application is not happy */ -# define X509_V_ERR_APPLICATION_VERIFICATION 50 -# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 -# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 -# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 -# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 -/* Another issuer check debug option */ -# define X509_V_ERR_PATH_LOOP 55 -/* Suite B mode algorithm violation */ -# define X509_V_ERR_SUITE_B_INVALID_VERSION 56 -# define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 -# define X509_V_ERR_SUITE_B_INVALID_CURVE 58 -# define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 -# define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 -# define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 -/* Host, email and IP check errors */ -# define X509_V_ERR_HOSTNAME_MISMATCH 62 -# define X509_V_ERR_EMAIL_MISMATCH 63 -# define X509_V_ERR_IP_ADDRESS_MISMATCH 64 -/* DANE TLSA errors */ -# define X509_V_ERR_DANE_NO_MATCH 65 -/* security level errors */ -# define X509_V_ERR_EE_KEY_TOO_SMALL 66 -# define X509_V_ERR_CA_KEY_TOO_SMALL 67 -# define X509_V_ERR_CA_MD_TOO_WEAK 68 -/* Caller error */ -# define X509_V_ERR_INVALID_CALL 69 -/* Issuer lookup error */ -# define X509_V_ERR_STORE_LOOKUP 70 -/* Certificate transparency */ -# define X509_V_ERR_NO_VALID_SCTS 71 - -# define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72 -/* OCSP status errors */ -# define X509_V_ERR_OCSP_VERIFY_NEEDED 73 /* Need OCSP verification */ -# define X509_V_ERR_OCSP_VERIFY_FAILED 74 /* Couldn't verify cert through OCSP */ -# define X509_V_ERR_OCSP_CERT_UNKNOWN 75 /* Certificate wasn't recognized by the OCSP responder */ - -/* Certificate verify flags */ - -# if OPENSSL_API_COMPAT < 0x10100000L -# define X509_V_FLAG_CB_ISSUER_CHECK 0x0 /* Deprecated */ -# endif -/* Use check time instead of current time */ -# define X509_V_FLAG_USE_CHECK_TIME 0x2 -/* Lookup CRLs */ -# define X509_V_FLAG_CRL_CHECK 0x4 -/* Lookup CRLs for whole chain */ -# define X509_V_FLAG_CRL_CHECK_ALL 0x8 -/* Ignore unhandled critical extensions */ -# define X509_V_FLAG_IGNORE_CRITICAL 0x10 -/* Disable workarounds for broken certificates */ -# define X509_V_FLAG_X509_STRICT 0x20 -/* Enable proxy certificate validation */ -# define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 -/* Enable policy checking */ -# define X509_V_FLAG_POLICY_CHECK 0x80 -/* Policy variable require-explicit-policy */ -# define X509_V_FLAG_EXPLICIT_POLICY 0x100 -/* Policy variable inhibit-any-policy */ -# define X509_V_FLAG_INHIBIT_ANY 0x200 -/* Policy variable inhibit-policy-mapping */ -# define X509_V_FLAG_INHIBIT_MAP 0x400 -/* Notify callback that policy is OK */ -# define X509_V_FLAG_NOTIFY_POLICY 0x800 -/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ -# define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 -/* Delta CRL support */ -# define X509_V_FLAG_USE_DELTAS 0x2000 -/* Check self-signed CA signature */ -# define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 -/* Use trusted store first */ -# define X509_V_FLAG_TRUSTED_FIRST 0x8000 -/* Suite B 128 bit only mode: not normally used */ -# define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 -/* Suite B 192 bit only mode */ -# define X509_V_FLAG_SUITEB_192_LOS 0x20000 -/* Suite B 128 bit mode allowing 192 bit algorithms */ -# define X509_V_FLAG_SUITEB_128_LOS 0x30000 -/* Allow partial chains if at least one certificate is in trusted store */ -# define X509_V_FLAG_PARTIAL_CHAIN 0x80000 -/* - * If the initial chain is not trusted, do not attempt to build an alternative - * chain. Alternate chain checking was introduced in 1.1.0. Setting this flag - * will force the behaviour to match that of previous versions. - */ -# define X509_V_FLAG_NO_ALT_CHAINS 0x100000 -/* Do not check certificate/CRL validity against current time */ -# define X509_V_FLAG_NO_CHECK_TIME 0x200000 - -# define X509_VP_FLAG_DEFAULT 0x1 -# define X509_VP_FLAG_OVERWRITE 0x2 -# define X509_VP_FLAG_RESET_FLAGS 0x4 -# define X509_VP_FLAG_LOCKED 0x8 -# define X509_VP_FLAG_ONCE 0x10 - -/* Internal use: mask of policy related options */ -# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ - | X509_V_FLAG_EXPLICIT_POLICY \ - | X509_V_FLAG_INHIBIT_ANY \ - | X509_V_FLAG_INHIBIT_MAP) - -int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, - X509_NAME *name); -X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, - X509_LOOKUP_TYPE type, - X509_NAME *name); -X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, - X509_OBJECT *x); -int X509_OBJECT_up_ref_count(X509_OBJECT *a); -X509_OBJECT *X509_OBJECT_new(void); -void X509_OBJECT_free(X509_OBJECT *a); -X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); -X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a); -int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj); -X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a); -int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj); -X509_STORE *X509_STORE_new(void); -void X509_STORE_free(X509_STORE *v); -int X509_STORE_lock(X509_STORE *ctx); -int X509_STORE_unlock(X509_STORE *ctx); -int X509_STORE_up_ref(X509_STORE *v); -STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v); - -STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); -STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); -int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); -int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); -int X509_STORE_set_trust(X509_STORE *ctx, int trust); -int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); -X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx); - -void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify); -#define X509_STORE_set_verify_func(ctx, func) \ - X509_STORE_set_verify((ctx),(func)) -void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, - X509_STORE_CTX_verify_fn verify); -X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx); -void X509_STORE_set_verify_cb(X509_STORE *ctx, - X509_STORE_CTX_verify_cb verify_cb); -# define X509_STORE_set_verify_cb_func(ctx,func) \ - X509_STORE_set_verify_cb((ctx),(func)) -X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx); -void X509_STORE_set_get_issuer(X509_STORE *ctx, - X509_STORE_CTX_get_issuer_fn get_issuer); -X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE *ctx); -void X509_STORE_set_check_issued(X509_STORE *ctx, - X509_STORE_CTX_check_issued_fn check_issued); -X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *ctx); -void X509_STORE_set_check_revocation(X509_STORE *ctx, - X509_STORE_CTX_check_revocation_fn check_revocation); -X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE *ctx); -void X509_STORE_set_get_crl(X509_STORE *ctx, - X509_STORE_CTX_get_crl_fn get_crl); -X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE *ctx); -void X509_STORE_set_check_crl(X509_STORE *ctx, - X509_STORE_CTX_check_crl_fn check_crl); -X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE *ctx); -void X509_STORE_set_cert_crl(X509_STORE *ctx, - X509_STORE_CTX_cert_crl_fn cert_crl); -X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE *ctx); -void X509_STORE_set_check_policy(X509_STORE *ctx, - X509_STORE_CTX_check_policy_fn check_policy); -X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE *ctx); -void X509_STORE_set_lookup_certs(X509_STORE *ctx, - X509_STORE_CTX_lookup_certs_fn lookup_certs); -X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE *ctx); -void X509_STORE_set_lookup_crls(X509_STORE *ctx, - X509_STORE_CTX_lookup_crls_fn lookup_crls); -#define X509_STORE_set_lookup_crls_cb(ctx, func) \ - X509_STORE_set_lookup_crls((ctx), (func)) -X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE *ctx); -void X509_STORE_set_cleanup(X509_STORE *ctx, - X509_STORE_CTX_cleanup_fn cleanup); -X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE *ctx); - -#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, l, p, newf, dupf, freef) -int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data); -void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx); - -X509_STORE_CTX *X509_STORE_CTX_new(void); - -int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); - -void X509_STORE_CTX_free(X509_STORE_CTX *ctx); -int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, - X509 *x509, STACK_OF(X509) *chain); -void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); -void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); - -X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); -X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx); -STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); -void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, - X509_STORE_CTX_verify_cb verify); -X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx); -X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx); -X509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx); -X509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx); -X509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx); -X509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx); -X509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx); - -#if OPENSSL_API_COMPAT < 0x10100000L -# define X509_STORE_CTX_get_chain X509_STORE_CTX_get0_chain -# define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted -# define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack -# define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject -# define X509_STORE_get1_certs X509_STORE_CTX_get1_certs -# define X509_STORE_get1_crls X509_STORE_CTX_get1_crls -/* the following macro is misspelled; use X509_STORE_get1_certs instead */ -# define X509_STORE_get1_cert X509_STORE_CTX_get1_certs -/* the following macro is misspelled; use X509_STORE_get1_crls instead */ -# define X509_STORE_get1_crl X509_STORE_CTX_get1_crls -#endif - -X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); -X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); -X509_LOOKUP_METHOD *X509_LOOKUP_file(void); - -typedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc, - long argl, char **ret); -typedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - X509_NAME *name, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - X509_NAME *name, - ASN1_INTEGER *serial, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - const unsigned char* bytes, - int len, - X509_OBJECT *ret); -typedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx, - X509_LOOKUP_TYPE type, - const char *str, - int len, - X509_OBJECT *ret); - -X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name); -void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method, - int (*new_item) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method, - void (*free_fn) (X509_LOOKUP *ctx)); -void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method, - int (*init) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method, - int (*shutdown) (X509_LOOKUP *ctx)); -int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method)) - (X509_LOOKUP *ctx); - -int X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method, - X509_LOOKUP_ctrl_fn ctrl_fn); -X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_subject_fn fn); -X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_issuer_serial(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_issuer_serial_fn fn); -X509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_fingerprint_fn fn); -X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint( - const X509_LOOKUP_METHOD *method); - -int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method, - X509_LOOKUP_get_by_alias_fn fn); -X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias( - const X509_LOOKUP_METHOD *method); - - -int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); -int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); - -int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, - X509_NAME *name, X509_OBJECT *ret); -X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, - X509_LOOKUP_TYPE type, - X509_NAME *name); - -int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, - long argl, char **ret); - -int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); -int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); -int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); - -X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); -void X509_LOOKUP_free(X509_LOOKUP *ctx); -int X509_LOOKUP_init(X509_LOOKUP *ctx); -int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - X509_NAME *name, X509_OBJECT *ret); -int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - X509_NAME *name, ASN1_INTEGER *serial, - X509_OBJECT *ret); -int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const unsigned char *bytes, int len, - X509_OBJECT *ret); -int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const char *str, int len, X509_OBJECT *ret); -int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data); -void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx); -X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx); -int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); - -int X509_STORE_load_locations(X509_STORE *ctx, - const char *file, const char *dir); -int X509_STORE_set_default_paths(X509_STORE *ctx); - -#define X509_STORE_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE_CTX, l, p, newf, dupf, freef) -int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data); -void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx); -int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s); -int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth); -X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x); -X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); -X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); -X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); -STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx); -STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x); -void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk); -void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk); -int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); -int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); -int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, - int purpose, int trust); -void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); -void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, - time_t t); - -X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); -int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); -int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx); - -X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); -void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); -int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); - -/* - * Bridge opacity barrier between libcrypt and libssl, also needed to support - * offline testing in test/danetest.c - */ -void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane); -#define DANE_FLAG_NO_DANE_EE_NAMECHECKS (1L << 0) - -/* X509_VERIFY_PARAM functions */ - -X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); -void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, - const X509_VERIFY_PARAM *from); -int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, - const X509_VERIFY_PARAM *from); -int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); -int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, - unsigned long flags); -int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, - unsigned long flags); -unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); -int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); -void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); -void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level); -time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param); -void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); -int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, - ASN1_OBJECT *policy); -int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, - STACK_OF(ASN1_OBJECT) *policies); - -int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, - uint32_t flags); -uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param); - -int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, - const char *name, size_t namelen); -int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, - const char *name, size_t namelen); -void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, - unsigned int flags); -unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param); -char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *); -void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *, X509_VERIFY_PARAM *); -int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, - const char *email, size_t emaillen); -int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, - const unsigned char *ip, size_t iplen); -int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, - const char *ipasc); - -int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param); -const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); - -int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); -int X509_VERIFY_PARAM_get_count(void); -const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); -const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); -void X509_VERIFY_PARAM_table_cleanup(void); - -/* Non positive return values are errors */ -#define X509_PCY_TREE_FAILURE -2 /* Failure to satisfy explicit policy */ -#define X509_PCY_TREE_INVALID -1 /* Inconsistent or invalid extensions */ -#define X509_PCY_TREE_INTERNAL 0 /* Internal error, most likely malloc */ - -/* - * Positive return values form a bit mask, all but the first are internal to - * the library and don't appear in results from X509_policy_check(). - */ -#define X509_PCY_TREE_VALID 1 /* The policy tree is valid */ -#define X509_PCY_TREE_EMPTY 2 /* The policy tree is empty */ -#define X509_PCY_TREE_EXPLICIT 4 /* Explicit policy required */ - -int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, - STACK_OF(X509) *certs, - STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags); - -void X509_policy_tree_free(X509_POLICY_TREE *tree); - -int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); -X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, - int i); - -STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const - X509_POLICY_TREE - *tree); - -STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const - X509_POLICY_TREE - *tree); - -int X509_policy_level_node_count(X509_POLICY_LEVEL *level); - -X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, - int i); - -const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); - -STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const - X509_POLICY_NODE - *node); -const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE - *node); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509err.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509err.h deleted file mode 100644 index 02738531..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509err.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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_X509ERR_H -# define HEADER_X509ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_X509_strings(void); - -/* - * X509 function codes. - */ -# define X509_F_ADD_CERT_DIR 100 -# define X509_F_BUILD_CHAIN 106 -# define X509_F_BY_FILE_CTRL 101 -# define X509_F_CHECK_NAME_CONSTRAINTS 149 -# define X509_F_CHECK_POLICY 145 -# define X509_F_DANE_I2D 107 -# define X509_F_DIR_CTRL 102 -# define X509_F_GET_CERT_BY_SUBJECT 103 -# define X509_F_I2D_X509_AUX 151 -# define X509_F_LOOKUP_CERTS_SK 152 -# define X509_F_NETSCAPE_SPKI_B64_DECODE 129 -# define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 -# define X509_F_NEW_DIR 153 -# define X509_F_X509AT_ADD1_ATTR 135 -# define X509_F_X509V3_ADD_EXT 104 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 -# define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 -# define X509_F_X509_ATTRIBUTE_GET0_DATA 139 -# define X509_F_X509_ATTRIBUTE_SET1_DATA 138 -# define X509_F_X509_CHECK_PRIVATE_KEY 128 -# define X509_F_X509_CRL_DIFF 105 -# define X509_F_X509_CRL_METHOD_NEW 154 -# define X509_F_X509_CRL_PRINT_FP 147 -# define X509_F_X509_EXTENSION_CREATE_BY_NID 108 -# define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 -# define X509_F_X509_GET_PUBKEY_PARAMETERS 110 -# define X509_F_X509_LOAD_CERT_CRL_FILE 132 -# define X509_F_X509_LOAD_CERT_FILE 111 -# define X509_F_X509_LOAD_CRL_FILE 112 -# define X509_F_X509_LOOKUP_METH_NEW 160 -# define X509_F_X509_LOOKUP_NEW 155 -# define X509_F_X509_NAME_ADD_ENTRY 113 -# define X509_F_X509_NAME_CANON 156 -# define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 -# define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 -# define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 -# define X509_F_X509_NAME_ONELINE 116 -# define X509_F_X509_NAME_PRINT 117 -# define X509_F_X509_OBJECT_NEW 150 -# define X509_F_X509_PRINT_EX_FP 118 -# define X509_F_X509_PUBKEY_DECODE 148 -# define X509_F_X509_PUBKEY_GET0 119 -# define X509_F_X509_PUBKEY_SET 120 -# define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 -# define X509_F_X509_REQ_PRINT_EX 121 -# define X509_F_X509_REQ_PRINT_FP 122 -# define X509_F_X509_REQ_TO_X509 123 -# define X509_F_X509_STORE_ADD_CERT 124 -# define X509_F_X509_STORE_ADD_CRL 125 -# define X509_F_X509_STORE_ADD_LOOKUP 157 -# define X509_F_X509_STORE_CTX_GET1_ISSUER 146 -# define X509_F_X509_STORE_CTX_INIT 143 -# define X509_F_X509_STORE_CTX_NEW 142 -# define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 -# define X509_F_X509_STORE_NEW 158 -# define X509_F_X509_TO_X509_REQ 126 -# define X509_F_X509_TRUST_ADD 133 -# define X509_F_X509_TRUST_SET 141 -# define X509_F_X509_VERIFY_CERT 127 -# define X509_F_X509_VERIFY_PARAM_NEW 159 - -/* - * X509 reason codes. - */ -# define X509_R_AKID_MISMATCH 110 -# define X509_R_BAD_SELECTOR 133 -# define X509_R_BAD_X509_FILETYPE 100 -# define X509_R_BASE64_DECODE_ERROR 118 -# define X509_R_CANT_CHECK_DH_KEY 114 -# define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 -# define X509_R_CRL_ALREADY_DELTA 127 -# define X509_R_CRL_VERIFY_FAILURE 131 -# define X509_R_IDP_MISMATCH 128 -# define X509_R_INVALID_ATTRIBUTES 138 -# define X509_R_INVALID_DIRECTORY 113 -# define X509_R_INVALID_FIELD_NAME 119 -# define X509_R_INVALID_TRUST 123 -# define X509_R_ISSUER_MISMATCH 129 -# define X509_R_KEY_TYPE_MISMATCH 115 -# define X509_R_KEY_VALUES_MISMATCH 116 -# define X509_R_LOADING_CERT_DIR 103 -# define X509_R_LOADING_DEFAULTS 104 -# define X509_R_METHOD_NOT_SUPPORTED 124 -# define X509_R_NAME_TOO_LONG 134 -# define X509_R_NEWER_CRL_NOT_NEWER 132 -# define X509_R_NO_CERTIFICATE_FOUND 135 -# define X509_R_NO_CERTIFICATE_OR_CRL_FOUND 136 -# define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 -# define X509_R_NO_CRL_FOUND 137 -# define X509_R_NO_CRL_NUMBER 130 -# define X509_R_PUBLIC_KEY_DECODE_ERROR 125 -# define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 -# define X509_R_SHOULD_RETRY 106 -# define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 -# define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 -# define X509_R_UNKNOWN_KEY_TYPE 117 -# define X509_R_UNKNOWN_NID 109 -# define X509_R_UNKNOWN_PURPOSE_ID 121 -# define X509_R_UNKNOWN_TRUST_ID 120 -# define X509_R_UNSUPPORTED_ALGORITHM 111 -# define X509_R_WRONG_LOOKUP_TYPE 112 -# define X509_R_WRONG_TYPE 122 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509v3.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509v3.h deleted file mode 100644 index 6c6eca38..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509v3.h +++ /dev/null @@ -1,937 +0,0 @@ -/* - * Copyright 1999-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_X509V3_H -# define HEADER_X509V3_H - -# include -# include -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward reference */ -struct v3_ext_method; -struct v3_ext_ctx; - -/* Useful typedefs */ - -typedef void *(*X509V3_EXT_NEW)(void); -typedef void (*X509V3_EXT_FREE) (void *); -typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); -typedef int (*X509V3_EXT_I2D) (void *, unsigned char **); -typedef STACK_OF(CONF_VALUE) * - (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, - STACK_OF(CONF_VALUE) *extlist); -typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, - STACK_OF(CONF_VALUE) *values); -typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, - void *ext); -typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, const char *str); -typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, - BIO *out, int indent); -typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, - struct v3_ext_ctx *ctx, const char *str); - -/* V3 extension structure */ - -struct v3_ext_method { - int ext_nid; - int ext_flags; -/* If this is set the following four fields are ignored */ - ASN1_ITEM_EXP *it; -/* Old style ASN1 calls */ - X509V3_EXT_NEW ext_new; - X509V3_EXT_FREE ext_free; - X509V3_EXT_D2I d2i; - X509V3_EXT_I2D i2d; -/* The following pair is used for string extensions */ - X509V3_EXT_I2S i2s; - X509V3_EXT_S2I s2i; -/* The following pair is used for multi-valued extensions */ - X509V3_EXT_I2V i2v; - X509V3_EXT_V2I v2i; -/* The following are used for raw extensions */ - X509V3_EXT_I2R i2r; - X509V3_EXT_R2I r2i; - void *usr_data; /* Any extension specific data */ -}; - -typedef struct X509V3_CONF_METHOD_st { - char *(*get_string) (void *db, const char *section, const char *value); - STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section); - void (*free_string) (void *db, char *string); - void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); -} X509V3_CONF_METHOD; - -/* Context specific info */ -struct v3_ext_ctx { -# define CTX_TEST 0x1 -# define X509V3_CTX_REPLACE 0x2 - int flags; - X509 *issuer_cert; - X509 *subject_cert; - X509_REQ *subject_req; - X509_CRL *crl; - X509V3_CONF_METHOD *db_meth; - void *db; -/* Maybe more here */ -}; - -typedef struct v3_ext_method X509V3_EXT_METHOD; - -DEFINE_STACK_OF(X509V3_EXT_METHOD) - -/* ext_flags values */ -# define X509V3_EXT_DYNAMIC 0x1 -# define X509V3_EXT_CTX_DEP 0x2 -# define X509V3_EXT_MULTILINE 0x4 - -typedef BIT_STRING_BITNAME ENUMERATED_NAMES; - -typedef struct BASIC_CONSTRAINTS_st { - int ca; - ASN1_INTEGER *pathlen; -} BASIC_CONSTRAINTS; - -typedef struct PKEY_USAGE_PERIOD_st { - ASN1_GENERALIZEDTIME *notBefore; - ASN1_GENERALIZEDTIME *notAfter; -} PKEY_USAGE_PERIOD; - -typedef struct otherName_st { - ASN1_OBJECT *type_id; - ASN1_TYPE *value; -} OTHERNAME; - -typedef struct EDIPartyName_st { - ASN1_STRING *nameAssigner; - ASN1_STRING *partyName; -} EDIPARTYNAME; - -typedef struct GENERAL_NAME_st { -# define GEN_OTHERNAME 0 -# define GEN_EMAIL 1 -# define GEN_DNS 2 -# define GEN_X400 3 -# define GEN_DIRNAME 4 -# define GEN_EDIPARTY 5 -# define GEN_URI 6 -# define GEN_IPADD 7 -# define GEN_RID 8 - int type; - union { - char *ptr; - OTHERNAME *otherName; /* otherName */ - ASN1_IA5STRING *rfc822Name; - ASN1_IA5STRING *dNSName; - ASN1_TYPE *x400Address; - X509_NAME *directoryName; - EDIPARTYNAME *ediPartyName; - ASN1_IA5STRING *uniformResourceIdentifier; - ASN1_OCTET_STRING *iPAddress; - ASN1_OBJECT *registeredID; - /* Old names */ - ASN1_OCTET_STRING *ip; /* iPAddress */ - X509_NAME *dirn; /* dirn */ - ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, - * uniformResourceIdentifier */ - ASN1_OBJECT *rid; /* registeredID */ - ASN1_TYPE *other; /* x400Address */ - } d; -} GENERAL_NAME; - -typedef struct ACCESS_DESCRIPTION_st { - ASN1_OBJECT *method; - GENERAL_NAME *location; -} ACCESS_DESCRIPTION; - -typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; - -typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; - -typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; - -DEFINE_STACK_OF(GENERAL_NAME) -typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; -DEFINE_STACK_OF(GENERAL_NAMES) - -DEFINE_STACK_OF(ACCESS_DESCRIPTION) - -typedef struct DIST_POINT_NAME_st { - int type; - union { - GENERAL_NAMES *fullname; - STACK_OF(X509_NAME_ENTRY) *relativename; - } name; -/* If relativename then this contains the full distribution point name */ - X509_NAME *dpname; -} DIST_POINT_NAME; -/* All existing reasons */ -# define CRLDP_ALL_REASONS 0x807f - -# define CRL_REASON_NONE -1 -# define CRL_REASON_UNSPECIFIED 0 -# define CRL_REASON_KEY_COMPROMISE 1 -# define CRL_REASON_CA_COMPROMISE 2 -# define CRL_REASON_AFFILIATION_CHANGED 3 -# define CRL_REASON_SUPERSEDED 4 -# define CRL_REASON_CESSATION_OF_OPERATION 5 -# define CRL_REASON_CERTIFICATE_HOLD 6 -# define CRL_REASON_REMOVE_FROM_CRL 8 -# define CRL_REASON_PRIVILEGE_WITHDRAWN 9 -# define CRL_REASON_AA_COMPROMISE 10 - -struct DIST_POINT_st { - DIST_POINT_NAME *distpoint; - ASN1_BIT_STRING *reasons; - GENERAL_NAMES *CRLissuer; - int dp_reasons; -}; - -typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; - -DEFINE_STACK_OF(DIST_POINT) - -struct AUTHORITY_KEYID_st { - ASN1_OCTET_STRING *keyid; - GENERAL_NAMES *issuer; - ASN1_INTEGER *serial; -}; - -/* Strong extranet structures */ - -typedef struct SXNET_ID_st { - ASN1_INTEGER *zone; - ASN1_OCTET_STRING *user; -} SXNETID; - -DEFINE_STACK_OF(SXNETID) - -typedef struct SXNET_st { - ASN1_INTEGER *version; - STACK_OF(SXNETID) *ids; -} SXNET; - -typedef struct NOTICEREF_st { - ASN1_STRING *organization; - STACK_OF(ASN1_INTEGER) *noticenos; -} NOTICEREF; - -typedef struct USERNOTICE_st { - NOTICEREF *noticeref; - ASN1_STRING *exptext; -} USERNOTICE; - -typedef struct POLICYQUALINFO_st { - ASN1_OBJECT *pqualid; - union { - ASN1_IA5STRING *cpsuri; - USERNOTICE *usernotice; - ASN1_TYPE *other; - } d; -} POLICYQUALINFO; - -DEFINE_STACK_OF(POLICYQUALINFO) - -typedef struct POLICYINFO_st { - ASN1_OBJECT *policyid; - STACK_OF(POLICYQUALINFO) *qualifiers; -} POLICYINFO; - -typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; - -DEFINE_STACK_OF(POLICYINFO) - -typedef struct POLICY_MAPPING_st { - ASN1_OBJECT *issuerDomainPolicy; - ASN1_OBJECT *subjectDomainPolicy; -} POLICY_MAPPING; - -DEFINE_STACK_OF(POLICY_MAPPING) - -typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; - -typedef struct GENERAL_SUBTREE_st { - GENERAL_NAME *base; - ASN1_INTEGER *minimum; - ASN1_INTEGER *maximum; -} GENERAL_SUBTREE; - -DEFINE_STACK_OF(GENERAL_SUBTREE) - -struct NAME_CONSTRAINTS_st { - STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; - STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; -}; - -typedef struct POLICY_CONSTRAINTS_st { - ASN1_INTEGER *requireExplicitPolicy; - ASN1_INTEGER *inhibitPolicyMapping; -} POLICY_CONSTRAINTS; - -/* Proxy certificate structures, see RFC 3820 */ -typedef struct PROXY_POLICY_st { - ASN1_OBJECT *policyLanguage; - ASN1_OCTET_STRING *policy; -} PROXY_POLICY; - -typedef struct PROXY_CERT_INFO_EXTENSION_st { - ASN1_INTEGER *pcPathLengthConstraint; - PROXY_POLICY *proxyPolicy; -} PROXY_CERT_INFO_EXTENSION; - -DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) -DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) - -struct ISSUING_DIST_POINT_st { - DIST_POINT_NAME *distpoint; - int onlyuser; - int onlyCA; - ASN1_BIT_STRING *onlysomereasons; - int indirectCRL; - int onlyattr; -}; - -/* Values in idp_flags field */ -/* IDP present */ -# define IDP_PRESENT 0x1 -/* IDP values inconsistent */ -# define IDP_INVALID 0x2 -/* onlyuser true */ -# define IDP_ONLYUSER 0x4 -/* onlyCA true */ -# define IDP_ONLYCA 0x8 -/* onlyattr true */ -# define IDP_ONLYATTR 0x10 -/* indirectCRL true */ -# define IDP_INDIRECT 0x20 -/* onlysomereasons present */ -# define IDP_REASONS 0x40 - -# define X509V3_conf_err(val) ERR_add_error_data(6, \ - "section:", (val)->section, \ - ",name:", (val)->name, ",value:", (val)->value) - -# define X509V3_set_ctx_test(ctx) \ - X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) -# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; - -# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ - 0,0,0,0, \ - 0,0, \ - (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ - (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ - NULL, NULL, \ - table} - -# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ - 0,0,0,0, \ - (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ - (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ - 0,0,0,0, \ - NULL} - -# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - -/* X509_PURPOSE stuff */ - -# define EXFLAG_BCONS 0x1 -# define EXFLAG_KUSAGE 0x2 -# define EXFLAG_XKUSAGE 0x4 -# define EXFLAG_NSCERT 0x8 - -# define EXFLAG_CA 0x10 -/* Really self issued not necessarily self signed */ -# define EXFLAG_SI 0x20 -# define EXFLAG_V1 0x40 -# define EXFLAG_INVALID 0x80 -/* EXFLAG_SET is set to indicate that some values have been precomputed */ -# define EXFLAG_SET 0x100 -# define EXFLAG_CRITICAL 0x200 -# define EXFLAG_PROXY 0x400 - -# define EXFLAG_INVALID_POLICY 0x800 -# define EXFLAG_FRESHEST 0x1000 -/* Self signed */ -# define EXFLAG_SS 0x2000 - -# define KU_DIGITAL_SIGNATURE 0x0080 -# define KU_NON_REPUDIATION 0x0040 -# define KU_KEY_ENCIPHERMENT 0x0020 -# define KU_DATA_ENCIPHERMENT 0x0010 -# define KU_KEY_AGREEMENT 0x0008 -# define KU_KEY_CERT_SIGN 0x0004 -# define KU_CRL_SIGN 0x0002 -# define KU_ENCIPHER_ONLY 0x0001 -# define KU_DECIPHER_ONLY 0x8000 - -# define NS_SSL_CLIENT 0x80 -# define NS_SSL_SERVER 0x40 -# define NS_SMIME 0x20 -# define NS_OBJSIGN 0x10 -# define NS_SSL_CA 0x04 -# define NS_SMIME_CA 0x02 -# define NS_OBJSIGN_CA 0x01 -# define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) - -# define XKU_SSL_SERVER 0x1 -# define XKU_SSL_CLIENT 0x2 -# define XKU_SMIME 0x4 -# define XKU_CODE_SIGN 0x8 -# define XKU_SGC 0x10 -# define XKU_OCSP_SIGN 0x20 -# define XKU_TIMESTAMP 0x40 -# define XKU_DVCS 0x80 -# define XKU_ANYEKU 0x100 - -# define X509_PURPOSE_DYNAMIC 0x1 -# define X509_PURPOSE_DYNAMIC_NAME 0x2 - -typedef struct x509_purpose_st { - int purpose; - int trust; /* Default trust ID */ - int flags; - int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); - char *name; - char *sname; - void *usr_data; -} X509_PURPOSE; - -# define X509_PURPOSE_SSL_CLIENT 1 -# define X509_PURPOSE_SSL_SERVER 2 -# define X509_PURPOSE_NS_SSL_SERVER 3 -# define X509_PURPOSE_SMIME_SIGN 4 -# define X509_PURPOSE_SMIME_ENCRYPT 5 -# define X509_PURPOSE_CRL_SIGN 6 -# define X509_PURPOSE_ANY 7 -# define X509_PURPOSE_OCSP_HELPER 8 -# define X509_PURPOSE_TIMESTAMP_SIGN 9 - -# define X509_PURPOSE_MIN 1 -# define X509_PURPOSE_MAX 9 - -/* Flags for X509V3_EXT_print() */ - -# define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) -/* Return error for unknown extensions */ -# define X509V3_EXT_DEFAULT 0 -/* Print error for unknown extensions */ -# define X509V3_EXT_ERROR_UNKNOWN (1L << 16) -/* ASN1 parse unknown extensions */ -# define X509V3_EXT_PARSE_UNKNOWN (2L << 16) -/* BIO_dump unknown extensions */ -# define X509V3_EXT_DUMP_UNKNOWN (3L << 16) - -/* Flags for X509V3_add1_i2d */ - -# define X509V3_ADD_OP_MASK 0xfL -# define X509V3_ADD_DEFAULT 0L -# define X509V3_ADD_APPEND 1L -# define X509V3_ADD_REPLACE 2L -# define X509V3_ADD_REPLACE_EXISTING 3L -# define X509V3_ADD_KEEP_EXISTING 4L -# define X509V3_ADD_DELETE 5L -# define X509V3_ADD_SILENT 0x10 - -DEFINE_STACK_OF(X509_PURPOSE) - -DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) - -DECLARE_ASN1_FUNCTIONS(SXNET) -DECLARE_ASN1_FUNCTIONS(SXNETID) - -int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); -int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, - int userlen); -int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, - int userlen); - -ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); -ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); -ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); - -DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) - -DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) - -DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) -GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); -int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); - -ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, - STACK_OF(CONF_VALUE) *nval); -STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, - ASN1_BIT_STRING *bits, - STACK_OF(CONF_VALUE) *extlist); -char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); -ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, const char *str); - -STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, - GENERAL_NAME *gen, - STACK_OF(CONF_VALUE) *ret); -int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); - -DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) - -STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, - GENERAL_NAMES *gen, - STACK_OF(CONF_VALUE) *extlist); -GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); - -DECLARE_ASN1_FUNCTIONS(OTHERNAME) -DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) -int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); -void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); -void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); -int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, - ASN1_OBJECT *oid, ASN1_TYPE *value); -int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, - ASN1_OBJECT **poid, ASN1_TYPE **pvalue); - -char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, - const ASN1_OCTET_STRING *ia5); -ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, const char *str); - -DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) -int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); - -DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) - -DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) -DECLARE_ASN1_FUNCTIONS(POLICYINFO) -DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) -DECLARE_ASN1_FUNCTIONS(USERNOTICE) -DECLARE_ASN1_FUNCTIONS(NOTICEREF) - -DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) -DECLARE_ASN1_FUNCTIONS(DIST_POINT) -DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) -DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) - -int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); - -int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); -int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); - -DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) -DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) - -DECLARE_ASN1_ITEM(POLICY_MAPPING) -DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) -DECLARE_ASN1_ITEM(POLICY_MAPPINGS) - -DECLARE_ASN1_ITEM(GENERAL_SUBTREE) -DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) - -DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) -DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) - -DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) -DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) - -GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, - const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, int gen_type, - const char *value, int is_nc); - -# ifdef HEADER_CONF_H -GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, CONF_VALUE *cnf); -GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, - const X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, CONF_VALUE *cnf, - int is_nc); -void X509V3_conf_free(CONF_VALUE *val); - -X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, - const char *value); -X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, - const char *value); -int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, - STACK_OF(X509_EXTENSION) **sk); -int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509 *cert); -int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509_REQ *req); -int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, - X509_CRL *crl); - -X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, - X509V3_CTX *ctx, int ext_nid, - const char *value); -X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *name, const char *value); -int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509 *cert); -int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509_REQ *req); -int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, - const char *section, X509_CRL *crl); - -int X509V3_add_value_bool_nf(const char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); -int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); -void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); -void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); -# endif - -char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); -STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); -void X509V3_string_free(X509V3_CTX *ctx, char *str); -void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); -void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, - X509_REQ *req, X509_CRL *crl, int flags); - -int X509V3_add_value(const char *name, const char *value, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_uchar(const char *name, const unsigned char *value, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_bool(const char *name, int asn1_bool, - STACK_OF(CONF_VALUE) **extlist); -int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, - STACK_OF(CONF_VALUE) **extlist); -char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); -ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); -char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); -char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, - const ASN1_ENUMERATED *aint); -int X509V3_EXT_add(X509V3_EXT_METHOD *ext); -int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); -int X509V3_EXT_add_alias(int nid_to, int nid_from); -void X509V3_EXT_cleanup(void); - -const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); -const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); -int X509V3_add_standard_extensions(void); -STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); -void *X509V3_EXT_d2i(X509_EXTENSION *ext); -void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, - int *idx); - -X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); -int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, - int crit, unsigned long flags); - -#if OPENSSL_API_COMPAT < 0x10100000L -/* The new declarations are in crypto.h, but the old ones were here. */ -# define hex_to_string OPENSSL_buf2hexstr -# define string_to_hex OPENSSL_hexstr2buf -#endif - -void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, - int ml); -int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, - int indent); -#ifndef OPENSSL_NO_STDIO -int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); -#endif -int X509V3_extensions_print(BIO *out, const char *title, - const STACK_OF(X509_EXTENSION) *exts, - unsigned long flag, int indent); - -int X509_check_ca(X509 *x); -int X509_check_purpose(X509 *x, int id, int ca); -int X509_supported_extension(X509_EXTENSION *ex); -int X509_PURPOSE_set(int *p, int purpose); -int X509_check_issued(X509 *issuer, X509 *subject); -int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); -void X509_set_proxy_flag(X509 *x); -void X509_set_proxy_pathlen(X509 *x, long l); -long X509_get_proxy_pathlen(X509 *x); - -uint32_t X509_get_extension_flags(X509 *x); -uint32_t X509_get_key_usage(X509 *x); -uint32_t X509_get_extended_key_usage(X509 *x); -const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); -const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); -const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); -const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); - -int X509_PURPOSE_get_count(void); -X509_PURPOSE *X509_PURPOSE_get0(int idx); -int X509_PURPOSE_get_by_sname(const char *sname); -int X509_PURPOSE_get_by_id(int id); -int X509_PURPOSE_add(int id, int trust, int flags, - int (*ck) (const X509_PURPOSE *, const X509 *, int), - const char *name, const char *sname, void *arg); -char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); -char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); -int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); -void X509_PURPOSE_cleanup(void); -int X509_PURPOSE_get_id(const X509_PURPOSE *); - -STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); -STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); -void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); -STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); -/* Flags for X509_check_* functions */ - -/* - * Always check subject name for host match even if subject alt names present - */ -# define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 -/* Disable wildcard matching for dnsName fields and common name. */ -# define X509_CHECK_FLAG_NO_WILDCARDS 0x2 -/* Wildcards must not match a partial label. */ -# define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 -/* Allow (non-partial) wildcards to match multiple labels. */ -# define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 -/* Constraint verifier subdomain patterns to match a single labels. */ -# define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 -/* Never check the subject CN */ -# define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 -/* - * Match reference identifiers starting with "." to any sub-domain. - * This is a non-public flag, turned on implicitly when the subject - * reference identity is a DNS name. - */ -# define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 - -int X509_check_host(X509 *x, const char *chk, size_t chklen, - unsigned int flags, char **peername); -int X509_check_email(X509 *x, const char *chk, size_t chklen, - unsigned int flags); -int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, - unsigned int flags); -int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); - -ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); -ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); -int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, - unsigned long chtype); - -void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); -DEFINE_STACK_OF(X509_POLICY_NODE) - -#ifndef OPENSSL_NO_RFC3779 -typedef struct ASRange_st { - ASN1_INTEGER *min, *max; -} ASRange; - -# define ASIdOrRange_id 0 -# define ASIdOrRange_range 1 - -typedef struct ASIdOrRange_st { - int type; - union { - ASN1_INTEGER *id; - ASRange *range; - } u; -} ASIdOrRange; - -typedef STACK_OF(ASIdOrRange) ASIdOrRanges; -DEFINE_STACK_OF(ASIdOrRange) - -# define ASIdentifierChoice_inherit 0 -# define ASIdentifierChoice_asIdsOrRanges 1 - -typedef struct ASIdentifierChoice_st { - int type; - union { - ASN1_NULL *inherit; - ASIdOrRanges *asIdsOrRanges; - } u; -} ASIdentifierChoice; - -typedef struct ASIdentifiers_st { - ASIdentifierChoice *asnum, *rdi; -} ASIdentifiers; - -DECLARE_ASN1_FUNCTIONS(ASRange) -DECLARE_ASN1_FUNCTIONS(ASIdOrRange) -DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) -DECLARE_ASN1_FUNCTIONS(ASIdentifiers) - -typedef struct IPAddressRange_st { - ASN1_BIT_STRING *min, *max; -} IPAddressRange; - -# define IPAddressOrRange_addressPrefix 0 -# define IPAddressOrRange_addressRange 1 - -typedef struct IPAddressOrRange_st { - int type; - union { - ASN1_BIT_STRING *addressPrefix; - IPAddressRange *addressRange; - } u; -} IPAddressOrRange; - -typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; -DEFINE_STACK_OF(IPAddressOrRange) - -# define IPAddressChoice_inherit 0 -# define IPAddressChoice_addressesOrRanges 1 - -typedef struct IPAddressChoice_st { - int type; - union { - ASN1_NULL *inherit; - IPAddressOrRanges *addressesOrRanges; - } u; -} IPAddressChoice; - -typedef struct IPAddressFamily_st { - ASN1_OCTET_STRING *addressFamily; - IPAddressChoice *ipAddressChoice; -} IPAddressFamily; - -typedef STACK_OF(IPAddressFamily) IPAddrBlocks; -DEFINE_STACK_OF(IPAddressFamily) - -DECLARE_ASN1_FUNCTIONS(IPAddressRange) -DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) -DECLARE_ASN1_FUNCTIONS(IPAddressChoice) -DECLARE_ASN1_FUNCTIONS(IPAddressFamily) - -/* - * API tag for elements of the ASIdentifer SEQUENCE. - */ -# define V3_ASID_ASNUM 0 -# define V3_ASID_RDI 1 - -/* - * AFI values, assigned by IANA. It'd be nice to make the AFI - * handling code totally generic, but there are too many little things - * that would need to be defined for other address families for it to - * be worth the trouble. - */ -# define IANA_AFI_IPV4 1 -# define IANA_AFI_IPV6 2 - -/* - * Utilities to construct and extract values from RFC3779 extensions, - * since some of the encodings (particularly for IP address prefixes - * and ranges) are a bit tedious to work with directly. - */ -int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); -int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, - ASN1_INTEGER *min, ASN1_INTEGER *max); -int X509v3_addr_add_inherit(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi); -int X509v3_addr_add_prefix(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi, - unsigned char *a, const int prefixlen); -int X509v3_addr_add_range(IPAddrBlocks *addr, - const unsigned afi, const unsigned *safi, - unsigned char *min, unsigned char *max); -unsigned X509v3_addr_get_afi(const IPAddressFamily *f); -int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, - unsigned char *min, unsigned char *max, - const int length); - -/* - * Canonical forms. - */ -int X509v3_asid_is_canonical(ASIdentifiers *asid); -int X509v3_addr_is_canonical(IPAddrBlocks *addr); -int X509v3_asid_canonize(ASIdentifiers *asid); -int X509v3_addr_canonize(IPAddrBlocks *addr); - -/* - * Tests for inheritance and containment. - */ -int X509v3_asid_inherits(ASIdentifiers *asid); -int X509v3_addr_inherits(IPAddrBlocks *addr); -int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); -int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); - -/* - * Check whether RFC 3779 extensions nest properly in chains. - */ -int X509v3_asid_validate_path(X509_STORE_CTX *); -int X509v3_addr_validate_path(X509_STORE_CTX *); -int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, - ASIdentifiers *ext, - int allow_inheritance); -int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, - IPAddrBlocks *ext, int allow_inheritance); - -#endif /* OPENSSL_NO_RFC3779 */ - -DEFINE_STACK_OF(ASN1_STRING) - -/* - * Admission Syntax - */ -typedef struct NamingAuthority_st NAMING_AUTHORITY; -typedef struct ProfessionInfo_st PROFESSION_INFO; -typedef struct Admissions_st ADMISSIONS; -typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; -DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) -DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) -DECLARE_ASN1_FUNCTIONS(ADMISSIONS) -DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) -DEFINE_STACK_OF(ADMISSIONS) -DEFINE_STACK_OF(PROFESSION_INFO) -typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; - -const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( - const NAMING_AUTHORITY *n); -const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( - const NAMING_AUTHORITY *n); -const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( - const NAMING_AUTHORITY *n); -void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, - ASN1_OBJECT* namingAuthorityId); -void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, - ASN1_IA5STRING* namingAuthorityUrl); -void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, - ASN1_STRING* namingAuthorityText); - -const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( - const ADMISSION_SYNTAX *as); -void ADMISSION_SYNTAX_set0_admissionAuthority( - ADMISSION_SYNTAX *as, GENERAL_NAME *aa); -const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( - const ADMISSION_SYNTAX *as); -void ADMISSION_SYNTAX_set0_contentsOfAdmissions( - ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); -const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); -void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); -const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); -void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); -const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); -void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); -const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_addProfessionInfo( - PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); -const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_namingAuthority( - PROFESSION_INFO *pi, NAMING_AUTHORITY *na); -const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_professionItems( - PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); -const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_professionOIDs( - PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); -const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( - const PROFESSION_INFO *pi); -void PROFESSION_INFO_set0_registrationNumber( - PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); - -# ifdef __cplusplus -} -# endif -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509v3err.h b/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509v3err.h deleted file mode 100644 index 5f25442f..00000000 --- a/Hin2n/src/main/jniLibs/x86_64/include/openssl/x509v3err.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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_X509V3ERR_H -# define HEADER_X509V3ERR_H - -# ifndef HEADER_SYMHACKS_H -# include -# endif - -# ifdef __cplusplus -extern "C" -# endif -int ERR_load_X509V3_strings(void); - -/* - * X509V3 function codes. - */ -# define X509V3_F_A2I_GENERAL_NAME 164 -# define X509V3_F_ADDR_VALIDATE_PATH_INTERNAL 166 -# define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 -# define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 -# define X509V3_F_BIGNUM_TO_STRING 167 -# define X509V3_F_COPY_EMAIL 122 -# define X509V3_F_COPY_ISSUER 123 -# define X509V3_F_DO_DIRNAME 144 -# define X509V3_F_DO_EXT_I2D 135 -# define X509V3_F_DO_EXT_NCONF 151 -# define X509V3_F_GNAMES_FROM_SECTNAME 156 -# define X509V3_F_I2S_ASN1_ENUMERATED 121 -# define X509V3_F_I2S_ASN1_IA5STRING 149 -# define X509V3_F_I2S_ASN1_INTEGER 120 -# define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 -# define X509V3_F_LEVEL_ADD_NODE 168 -# define X509V3_F_NOTICE_SECTION 132 -# define X509V3_F_NREF_NOS 133 -# define X509V3_F_POLICY_CACHE_CREATE 169 -# define X509V3_F_POLICY_CACHE_NEW 170 -# define X509V3_F_POLICY_DATA_NEW 171 -# define X509V3_F_POLICY_SECTION 131 -# define X509V3_F_PROCESS_PCI_VALUE 150 -# define X509V3_F_R2I_CERTPOL 130 -# define X509V3_F_R2I_PCI 155 -# define X509V3_F_S2I_ASN1_IA5STRING 100 -# define X509V3_F_S2I_ASN1_INTEGER 108 -# define X509V3_F_S2I_ASN1_OCTET_STRING 112 -# define X509V3_F_S2I_SKEY_ID 115 -# define X509V3_F_SET_DIST_POINT_NAME 158 -# define X509V3_F_SXNET_ADD_ID_ASC 125 -# define X509V3_F_SXNET_ADD_ID_INTEGER 126 -# define X509V3_F_SXNET_ADD_ID_ULONG 127 -# define X509V3_F_SXNET_GET_ID_ASC 128 -# define X509V3_F_SXNET_GET_ID_ULONG 129 -# define X509V3_F_TREE_INIT 172 -# define X509V3_F_V2I_ASIDENTIFIERS 163 -# define X509V3_F_V2I_ASN1_BIT_STRING 101 -# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 -# define X509V3_F_V2I_AUTHORITY_KEYID 119 -# define X509V3_F_V2I_BASIC_CONSTRAINTS 102 -# define X509V3_F_V2I_CRLD 134 -# define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 -# define X509V3_F_V2I_GENERAL_NAMES 118 -# define X509V3_F_V2I_GENERAL_NAME_EX 117 -# define X509V3_F_V2I_IDP 157 -# define X509V3_F_V2I_IPADDRBLOCKS 159 -# define X509V3_F_V2I_ISSUER_ALT 153 -# define X509V3_F_V2I_NAME_CONSTRAINTS 147 -# define X509V3_F_V2I_POLICY_CONSTRAINTS 146 -# define X509V3_F_V2I_POLICY_MAPPINGS 145 -# define X509V3_F_V2I_SUBJECT_ALT 154 -# define X509V3_F_V2I_TLS_FEATURE 165 -# define X509V3_F_V3_GENERIC_EXTENSION 116 -# define X509V3_F_X509V3_ADD1_I2D 140 -# define X509V3_F_X509V3_ADD_VALUE 105 -# define X509V3_F_X509V3_EXT_ADD 104 -# define X509V3_F_X509V3_EXT_ADD_ALIAS 106 -# define X509V3_F_X509V3_EXT_I2D 136 -# define X509V3_F_X509V3_EXT_NCONF 152 -# define X509V3_F_X509V3_GET_SECTION 142 -# define X509V3_F_X509V3_GET_STRING 143 -# define X509V3_F_X509V3_GET_VALUE_BOOL 110 -# define X509V3_F_X509V3_PARSE_LIST 109 -# define X509V3_F_X509_PURPOSE_ADD 137 -# define X509V3_F_X509_PURPOSE_SET 141 - -/* - * X509V3 reason codes. - */ -# define X509V3_R_BAD_IP_ADDRESS 118 -# define X509V3_R_BAD_OBJECT 119 -# define X509V3_R_BN_DEC2BN_ERROR 100 -# define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 -# define X509V3_R_DIRNAME_ERROR 149 -# define X509V3_R_DISTPOINT_ALREADY_SET 160 -# define X509V3_R_DUPLICATE_ZONE_ID 133 -# define X509V3_R_ERROR_CONVERTING_ZONE 131 -# define X509V3_R_ERROR_CREATING_EXTENSION 144 -# define X509V3_R_ERROR_IN_EXTENSION 128 -# define X509V3_R_EXPECTED_A_SECTION_NAME 137 -# define X509V3_R_EXTENSION_EXISTS 145 -# define X509V3_R_EXTENSION_NAME_ERROR 115 -# define X509V3_R_EXTENSION_NOT_FOUND 102 -# define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 -# define X509V3_R_EXTENSION_VALUE_ERROR 116 -# define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 -# define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 -# define X509V3_R_INVALID_ASNUMBER 162 -# define X509V3_R_INVALID_ASRANGE 163 -# define X509V3_R_INVALID_BOOLEAN_STRING 104 -# define X509V3_R_INVALID_EXTENSION_STRING 105 -# define X509V3_R_INVALID_INHERITANCE 165 -# define X509V3_R_INVALID_IPADDRESS 166 -# define X509V3_R_INVALID_MULTIPLE_RDNS 161 -# define X509V3_R_INVALID_NAME 106 -# define X509V3_R_INVALID_NULL_ARGUMENT 107 -# define X509V3_R_INVALID_NULL_NAME 108 -# define X509V3_R_INVALID_NULL_VALUE 109 -# define X509V3_R_INVALID_NUMBER 140 -# define X509V3_R_INVALID_NUMBERS 141 -# define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 -# define X509V3_R_INVALID_OPTION 138 -# define X509V3_R_INVALID_POLICY_IDENTIFIER 134 -# define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 -# define X509V3_R_INVALID_PURPOSE 146 -# define X509V3_R_INVALID_SAFI 164 -# define X509V3_R_INVALID_SECTION 135 -# define X509V3_R_INVALID_SYNTAX 143 -# define X509V3_R_ISSUER_DECODE_ERROR 126 -# define X509V3_R_MISSING_VALUE 124 -# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 -# define X509V3_R_NO_CONFIG_DATABASE 136 -# define X509V3_R_NO_ISSUER_CERTIFICATE 121 -# define X509V3_R_NO_ISSUER_DETAILS 127 -# define X509V3_R_NO_POLICY_IDENTIFIER 139 -# define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 -# define X509V3_R_NO_PUBLIC_KEY 114 -# define X509V3_R_NO_SUBJECT_DETAILS 125 -# define X509V3_R_OPERATION_NOT_DEFINED 148 -# define X509V3_R_OTHERNAME_ERROR 147 -# define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 -# define X509V3_R_POLICY_PATH_LENGTH 156 -# define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 -# define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 -# define X509V3_R_SECTION_NOT_FOUND 150 -# define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 -# define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 -# define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 -# define X509V3_R_UNKNOWN_EXTENSION 129 -# define X509V3_R_UNKNOWN_EXTENSION_NAME 130 -# define X509V3_R_UNKNOWN_OPTION 120 -# define X509V3_R_UNSUPPORTED_OPTION 117 -# define X509V3_R_UNSUPPORTED_TYPE 167 -# define X509V3_R_USER_TOO_LONG 132 - -#endif diff --git a/Hin2n/src/main/jniLibs/x86_64/libcrypto.so b/Hin2n/src/main/jniLibs/x86_64/libcrypto.so deleted file mode 100644 index 314e940e..00000000 Binary files a/Hin2n/src/main/jniLibs/x86_64/libcrypto.so and /dev/null differ diff --git a/Hin2n/src/main/res/drawable/ic_craft_table.png b/Hin2n/src/main/res/drawable/ic_craft_table.png deleted file mode 100644 index 45740510..00000000 Binary files a/Hin2n/src/main/res/drawable/ic_craft_table.png and /dev/null differ diff --git a/Hin2n/src/main/res/values/strings.xml b/Hin2n/src/main/res/values/strings.xml deleted file mode 100644 index 06ebb5b9..00000000 --- a/Hin2n/src/main/res/values/strings.xml +++ /dev/null @@ -1,39 +0,0 @@ - - Hin2n service is running… - - New setting - Update setting - Settings list - - Add succeed! - Save succeed! - Update succeed! - Update this setting, and reconnect to n2n network? - Yes - No - Reconnect n2n network with new setting? - Are you sure to delete this setting? - - Failed to connect to the N2N network - Disconnected with supernode and try to reconnect to N2N network later - - Disconnected with supernode - Reconnect to supernode successfully - - default - default - - - n2n_v1 - n2n_v2 - n2n_v2s - n2n_v3 - - - ERROR - WARNING - NORMAL - INFO - DEBUG - - diff --git a/Hin2n/src/test/java/wang/switchy/hin2n/ExampleUnitTest.java b/Hin2n/src/test/java/wang/switchy/hin2n/ExampleUnitTest.java deleted file mode 100644 index ed22153b..00000000 --- a/Hin2n/src/test/java/wang/switchy/hin2n/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package wang.switchy.hin2n; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/PojavLauncher/build.gradle b/PojavLauncher/build.gradle index 31c08252..d25067c9 100644 --- a/PojavLauncher/build.gradle +++ b/PojavLauncher/build.gradle @@ -3,11 +3,11 @@ plugins { } android { - compileSdk 32 + compileSdk 34 defaultConfig { minSdk 26 - targetSdk 32 + targetSdk 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -32,11 +32,11 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'commons-codec:commons-codec:1.15' - implementation 'com.google.code.gson:gson:2.8.9' - implementation 'androidx.appcompat:appcompat:1.5.0' - implementation 'com.google.android.material:material:1.6.1' + implementation 'commons-codec:commons-codec:1.16.0' + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.11.0' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } \ No newline at end of file diff --git a/ZipTools/build.gradle b/ZipTools/build.gradle index c0f1e648..fb879973 100644 --- a/ZipTools/build.gradle +++ b/ZipTools/build.gradle @@ -3,11 +3,11 @@ plugins { } android { - compileSdk 32 + compileSdk 34 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -27,9 +27,9 @@ android { dependencies { - implementation 'androidx.appcompat:appcompat:1.5.0' - implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.11.0' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } \ No newline at end of file diff --git a/bundles/n2n_meyerd/.gitignore b/bundles/n2n_meyerd/.gitignore deleted file mode 100644 index 53b0be40..00000000 --- a/bundles/n2n_meyerd/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -.svn/ -CMakeCache.txt -CMakeFiles/ -cmake_install.cmake -benchmark -benchmark_hashtable -doc/ -edge -gnutls/ -libn2n.a -libscm.a -Makefile -supernode -test -*.vcxproj -*.vcxproj.filters -*.vcxproj.user -~$ diff --git a/bundles/n2n_meyerd/README b/bundles/n2n_meyerd/README deleted file mode 100644 index e618ed38..00000000 --- a/bundles/n2n_meyerd/README +++ /dev/null @@ -1,13 +0,0 @@ -This is a development branch of the n2n p2p vpn software. - -https://github.com/ntop/n2n - -It contains some modifications of the v2 version of n2n, which is the latest stable version -and should be used for productive environments. -All the current development happens in this repository in the new_protocol branch, which is -intended to be come version v3 of n2n and then merged back into the original svn repository -on ntop.org. - -Uses sglib http://sglib.sourceforge.net. - -For further information please visit the wiki https://github.com/meyerd/n2n/wiki. diff --git a/bundles/n2n_meyerd/n2n_v1/COPYING b/bundles/n2n_meyerd/n2n_v1/COPYING deleted file mode 100644 index b33b35d0..00000000 --- a/bundles/n2n_meyerd/n2n_v1/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - n2n Copyright (C) 2007-08 Luca Deri - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/bundles/n2n_meyerd/n2n_v1/HACKING b/bundles/n2n_meyerd/n2n_v1/HACKING deleted file mode 100644 index b0b9e675..00000000 --- a/bundles/n2n_meyerd/n2n_v1/HACKING +++ /dev/null @@ -1,273 +0,0 @@ -file: HACKING - -Last updated: 2008-04-10 - --------- -(C) 2008 - Richard Andrews - -This program and document is free software; you can redistribute -it and/or modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not see see - --------- - - -This file describes the internals of n2n. Read this before starting to modify -the code. Because coding examples may be present in this document it is licensed -under the GPL rather than FDL. - - -SYMMETRIC NAT -------------- - -Symmetric NAT is a form of firewall NAT in which an UDP packets are only passed -back to an inside host socket when the return packets originate from the outside -socket to which the initiating UDP packets were sent. This means that when an -inside host sends UDP to some outside socket; other hosts cannot piggyback on -this opening in the firewall to send data to the inside host. - -When two inside hosts are both behind symmetric NAT, peer-to-peer packet -exchange is not possible via n2n. These hosts will require the supernode to -relay packets. - - -ARP CACHE ---------- - -n2n makes use of the host operating system's own ARP cache. Each edge node -allocates a random MAC address to itself. This MAC is constant for the life of -the edge process. ARP packets are passed around as broadcast ethernet packets -over n2n and these packets cause the native ARP cache to be updated. - -Edge nodes send gratuitous ARP packets on startup. See GRATUITOUS ARP below. - - -REGISTRATION AND PEER-TO-PEER COMMUNICATION SETUP -------------------------------------------------- - -A and B are edge nodes with public sockets Apub and Bpub; and private network -addresses A and B respectively. S is the supernode. - -A sends {REGISTER,Amac} to S. S registers {Amac->Apub}. -B sends {REGISTER,Bmac} to S. S registers {Bmac->Bpub}. - -Now ping from A to B. - -A sends broadcast "arp who-has B" to S. S relays the packet to all known edge -nodes. B replies "B at Bmac" to supernode which forwards this to A. So now ping -A->B is known to be ping Amac(A)->Bmac(B). Note: gratuitous arp also requires -discussion. - -In response to receiving the arp reply, Apub sends {REGISTER,Amac} to Bpub. If -Bpub receives the request it sends back {REGISTER_ACK,Amac} and also sends its -own {REGISTER,Bmac} request. - -In response to receiving the "arp who-has", Bpub sends {REGISTER,Bmac} to Apub. - -Now the OS has received the arp reply and sends ICMP to Bmac(B) via the tunnel -on A. A looks up Bmac in the peers list and encapsulates the packet to Bpub or -the supernode if the MAC is not found. - -We assume that between two edge nodes, if Bpub receives a packet from Apub then -Apub can receive a packet from Bpub. This is the symmetric NAT case. Note: In -the symmetric NAT case, the public socket for a MAC address will be different -for direct contact when compared to information from the supernode. - -When two edge nodes are both behind symmetric NAT they cannot establish direct -communication. - -If A receives {REGISTER,Bmac} from B, A adds {Bmac->Bpub} to its peers list -knowing that Bmac is now reachable via that public socket. Similarly if B -receives {REGISTER,Amac} from A. - -The supernode never forwards REGISTER messages because the public socket seen by -the supervisor for some edge (eg. A) may be different to the socket seen by -another edge due to the actions of symmetric NAT (alocating a new public socket -for the new outbound UDP "connection"). - - -EDGE REGISTRATION DESIGN AMMENDMENTS (starting from 2008-04-10) ------------------------------------- - - * Send REGISTER on rx of PACKET or REGISTER only when dest_mac == device MAC -(do not send REGISTER on Rx of broadcast packets). - * After sending REGISTER add the new peer to pending_peers list; but - * Don't send REGISTER to a peer in pending_peers list - * Remove old entries from pending_peers at regular intervals - * On rx of REGISTER_ACK, move peer from pending_peers to known_peers for direct -comms and set last_seen=now - * On rx of any packet set last_seen=now in the known_peers entry (if it -exists); but do not add a new entry. - * If the public socket address for a known_peers entry changes, deleted it and -restart registration to the new peer. - * Peer sockets provided by the supernode are ignored unless no other entry -exists. Direct peer-to-peer sockets are always given more priority as the -supernode socket will not be usable for direct contact if the peer is behind -symmetric NAT. - - -The pending_peers list concept is to prevent massive registration traffic when -supernode relay is in force - this would occur if REGISTER was sent for every -incident packet sent via supernode. Periodic REGISTER attempts will still occur; -not for every received packet. In the case where the peer cannot be contacted -(eg. both peers behind symmetric NAT), then there will still be periodic -attempts. Suggest a pending timeout of about 60 sec. - -A peer is only considered operational for peer-to-peer sending when a -REGISTER_ACK is returned. Once operational the peer is kept operational while -any direct packet communications are occurring. REGISTER is not required to -keep the path open through any firewalls; just some activity in one direction. - -After an idle period; the peer should be deleted from the known_peers list. We -should not try to re-register when this time expires. If there is no data to -send then forget the peer. This helps scalability. - -If a peer wants to be remembered it can send gratuitous ARP traffic which will -keep its entry in the known_peers list of any peers which already have the -entry. - - - - -peer = find_by_src_mac( hdr, known_peers ); /* return NULL or entry */ - -if ( peer ) -{ - peer_last_seen = time(NULL); -} -else -{ - if ( ! is_broadcast( hdr ) ) /* ignore broadcasts */ - { - if ( IS_REGISTER_ACK( hdr ) ) - { - /* move from pending to known_peers */ - set_peer_operational( hdr ); - } - else - { - /* add to pending and send REGISTER - ignore if in pending. */ - try_send_register( hdr ) - } - } -} - - -(Notes): - - * In testing it was noted that if a symmetric NAT firewall shuts down the UDP -association but the known_peers registration is still active, then the peer -becomes unreachable until the known_peers registration is deleted. Suggest two -ways to mitigate this problem: - (a) make the known_peers purge timeout a config paramter; - (b) send packets direct and via supernode if the registration is older than - eg. 60 sec. - - -GRATUITOUS ARP --------------- - -In addition to the ARP who-has mechanism noted above, two edge nodes can become -aware of one another by gratuitous ARP. A gratuitous ARP packet is a broadcast -packet sent by a node for no other purpose than to announce its presence and -identify its MAC and IP address. Gratuitous ARP packets are to keep ARP caches -up to date so contacting the host will be faster after an long idle time. - - -MAN PAGES ---------- - -Look at a non-installed man page like this (linux/UNIX): - -nroff -man edge.8 | less - - -PACKET FORMAT -------------- - -Version 1 - - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 0 ! Version=1 ! Message Type ! TTL ! Origin ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! ! - 8 ! Community Name ! -12 ! ! -16 ! ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -20 ! Source MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -24 : Source MAC Address ! Destination MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -28 : Destination MAC Address ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -32 ! Public Peer ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -40 : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -48 : ! Alignment ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! Private Peer : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -56 : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -64 : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - : ! Alignment ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -72 ! Packet Type ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! Seq Number ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -80 ! CRC32 ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - Payload - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Version = 1 -MessageType = 1 -TTL = 1 -Origin = 1 -Community = 16 -src MAC = 6 -dst MAC = 6 -Pub Peer = 19 (20) -Priv Peer = 19 (20) -Pkt Type = 1 (4) -Seq = 4 -CRC = 4 -====================== -Total = 79 (84) - -Sizes in parentheses indicate alignment adjusted sizes on i686. The intel -alignment is also shown in the diagram. Some platforms have different alignment -padding. - -The above packet format describes the header of IP packets carried between edge -nodes. Payload is an encoded ethernet frame appended to the packet header. The -ethernet payload is encrypted and compressed. - -When the payload is created it is first encrypted with twofish, then compressed -using lzo1x_compress. When the payload is decoded it is first decompressed using -lzo1x_decompress_safe then decrypted using twofish. - -------- - -January 2009 - Richard Andrews diff --git a/bundles/n2n_meyerd/n2n_v1/INSTALL b/bundles/n2n_meyerd/n2n_v1/INSTALL deleted file mode 100644 index 45221d43..00000000 --- a/bundles/n2n_meyerd/n2n_v1/INSTALL +++ /dev/null @@ -1,50 +0,0 @@ -INSTALL - -To build the programs: - -$ make - -To install the programs and man pages: - -$ make install - -or - -$ make PREFIX=/usr/local install - - -RPM Package ------------ - -These steps should work with RPM based Linux distributions since rpmbuild was -split from the rpm utility (c RedHat 9). - - -To build an RPM the easy way follow these steps. - -1. Build SRPM - -$ cd n2n -$ scripts/mk_SRPM.sh - -Look for where the src.rpm file was put ( "Wrote:" ). - -2. Build binary RPM from SRPM - -$ rpm -i path/to/n2n-.src.rpm -$ rpmbuild -bb n2n.spec - - -All this can be done as non-root user if you have a ~/.rpmmacros file with this -line in it: - -%_topdir /home/username/rpmtopdir - - -To build an RPM the hard way follow these steps. - -$ cp -a n2ndir n2n-1.3 -$ tar czf n2n-1.3.tar.gz n2n-1.3 -$ mv n2n-1.3.tar.gz /usr/src/redhat/SOURCES -$ cp n2ndir/n2n.spec /usr/src/redhat/SPECS -$ rpmbuild -bb n2n.spec diff --git a/bundles/n2n_meyerd/n2n_v1/README b/bundles/n2n_meyerd/n2n_v1/README deleted file mode 100644 index e021f412..00000000 --- a/bundles/n2n_meyerd/n2n_v1/README +++ /dev/null @@ -1,95 +0,0 @@ - - -Edge node ---------- - -You need to start an egde node on each host you want to connect with the *same* -community. - -0. become root - -1. create tun device -# tunctl -t tun0 - -3. enable the edge process -# ./edge -d n2n0 -c mynetwork -k encryptme -u 99 -g 99 -m 3C:A0:12:34:56:78 -a 1.2.3.4 -l a.b.c.d:xyw - or -# N2N_KEY=encryptme ./edge -d n2n0 -c mynetwork -u 99 -g 99 -m 3C:A0:12:34:56:78 -a 1.2.3.4 -l a.b.c.d:xyw - -Once you have this worked out, you can add the "-f" option to make edge detach -and run as a daemon. - -Note that -u, -g and -f options are not available for Windows. - -Supernode --------- - -You need to start the supernode once - -1. ./supernode -l 1234 -v - - -Dropping Root Privileges and SUID-Root Executables (UNIX) --------------------------------------------------- - -The edge node uses superuser privileges to create a TAP network interface -device. Once this is created root privileges are not required and can constitute -a security hazard if there is some way for an attacker to take control of an -edge process while it is running. Edge will drop to a non-privileged user if you -specify the -u and -g options. These are numeric IDs. Consult -/etc/passwd. - -You may choose to install edge SUID-root to do this: - -1. Become root -2. chown root:root edge -3. chmod +s edge -done - -Any user can now run edge. You may not want this, but it may be convenient and -safe if your host has only one login user. - - -Running As a Daemon (UNIX) -------------------- - -When given "-f" as a command line option, edge will call daemon(3) after -successful setup. This causes the process to fork a child which closes stdin, -stdout and stderr then sets itself as process group leader. When this is done, -the edge command returns immediately and you will only see the edge process in -the process listings, eg. from ps or top. - -If the edge command returns 0 then the daemon started successfully. If it -returns non-zero then edge failed to start up for some reason. When edge starts -running as a daemon, all logging goes to syslog daemon.info facility. - - -IPv6 Support (added r3650) ------------- - -n2n supports the carriage of IPv6 packets within the n2n tunnel. N2n does not -yet use IPv6 for transport between edges and supernodes. - -To make IPv6 carriage work you need to manually add IPv6 addresses to the TAP -interfaces at each end. There is currently no way to specify an IPv6 address on -the edge command line. - -eg. under linux: - -on hostA: -[hostA] # /sbin/ip -6 addr add fc00:abcd:1234::7/48 dev n2n0 - -on hostB: -[hostB] # /sbin/ip -6 addr add fc00:abcd:1234::6/48 dev n2n0 - -You may find it useful to make use of tunctl from the uml-utilities -package. Tunctl allow you to bring up a TAP interface and configure addressing -prior to starting edge. It also allows edge to be restarted without the -interface closing (which would normally affect routing tables). - -Once the IPv6 addresses are configured and edge started, IPv6 neighbor discovery -packets flow (get broadcast) and IPv6 entities self arrange. Test your IPv6 -setup with ping6 - the IPv6 ping command. - - -(C) 2007,2008 - Luca Deri , Richard Andrews diff --git a/bundles/n2n_meyerd/n2n_v1/android/tuntap_android.c b/bundles/n2n_meyerd/n2n_v1/android/tuntap_android.c deleted file mode 100644 index 08aa0fba..00000000 --- a/bundles/n2n_meyerd/n2n_v1/android/tuntap_android.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see -*/ - -#include "../n2n.h" - -#ifdef __ANDROID_NDK__ - -#include -#include -#include - -n2n_edge_status_t* g_status; - -/* ********************************** */ - -/** @brief Open and configure the TAP device for packet read/write. - * - * This routine creates the interface via the tuntap driver then uses ifconfig - * to configure address/mask and MTU. - * - * @param device - [inout] a device info holder object - * @param dev - user-defined name for the new iface, - * if NULL system will assign a name - * @param device_ip - address of iface - * @param device_mask - netmask for device_ip - * @param mtu - MTU for device_ip - * - * @return - negative value on error - * - non-negative file-descriptor on success - */ -int tuntap_open(tuntap_dev *device, - char *dev, /* user-definable interface name, eg. edge0 */ - char *device_ip, - char *device_mask, - const char *device_mac, - int mtu) { - int i, n_matched; - unsigned int mac[6]; - - n_matched = sscanf(device_mac, "%x:%x:%x:%x:%x:%x", mac, mac + 1, mac + 2, mac + 3, mac + 4, - mac + 5); - if (n_matched != 6) { - return -1; - } - memset(device->mac_addr, 0, sizeof(device->mac_addr)); - for (i = 0; i < 6; i++) - device->mac_addr[i] = mac[i]; - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - device->mtu = mtu; - return device->fd; -} - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - int rlen = read(tuntap->fd, buf + UIP_LLH_LEN, len - UIP_LLH_LEN); - if ((rlen <= 0) || (rlen > 2048 - UIP_LLH_LEN)) { - return rlen; - } - uip_buf = buf; - uip_len = rlen; - uip_arp_out(); - if (IPBUF->ethhdr.type == htons(UIP_ETHTYPE_ARP)) { - traceEvent(TRACE_INFO, "ARP request packets are sent instead of packets"); - } - - return uip_len; -} - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - int rlen; - uip_buf = buf; - uip_len = len; - if (IPBUF->ethhdr.type == htons(UIP_ETHTYPE_IP)) { - rlen = write(tuntap->fd, buf + UIP_LLH_LEN, len - UIP_LLH_LEN); - return rlen <= 0 ? rlen : rlen + UIP_LLH_LEN; - } else if (IPBUF->ethhdr.type == htons(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - if (uip_len > 0) { - uip_arp_len = uip_len; - memcpy(uip_arp_buf, uip_buf, uip_arp_len); - traceEvent(TRACE_INFO, "ARP reply packet prepare to send"); - } - return len; - } - - errno = EINVAL; - return -1; -} - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -#endif /* #ifdef __ANDROID_NDK__ */ diff --git a/bundles/n2n_meyerd/n2n_v1/debian/README.Debian b/bundles/n2n_meyerd/n2n_v1/debian/README.Debian deleted file mode 100644 index 700c74ec..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/README.Debian +++ /dev/null @@ -1,7 +0,0 @@ -n2n for Debian --------------- - -This package depends on the kernel having the TUN/TAP driver configured in using -CONFIG_TUN=yes. - - -- Richard Andrews Thu, 10 Jul 2008 22:38:02 +1000 diff --git a/bundles/n2n_meyerd/n2n_v1/debian/changelog b/bundles/n2n_meyerd/n2n_v1/debian/changelog deleted file mode 100644 index 3ce8eb1a..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/changelog +++ /dev/null @@ -1,12 +0,0 @@ -n2n (1.3-1) hardy; urgency=low - - * New upstream release - - -- Richard Andrews Fri, 30 Jan 2009 23:49:56 +1100 - -n2n (1.2-1) unstable; urgency=low - - * Initial release - - -- Richard Andrews Thu, 10 Jul 2008 22:38:02 +1000 - diff --git a/bundles/n2n_meyerd/n2n_v1/debian/compat b/bundles/n2n_meyerd/n2n_v1/debian/compat deleted file mode 100644 index 7ed6ff82..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/bundles/n2n_meyerd/n2n_v1/debian/control b/bundles/n2n_meyerd/n2n_v1/debian/control deleted file mode 100644 index 6c06deda..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/control +++ /dev/null @@ -1,22 +0,0 @@ -Source: n2n -Section: net -Priority: extra -Maintainer: Jean-Baptiste Denis -Build-Depends: cdbs, debhelper (>= 5), libc6-dev (>= 2.0), dpatch, gcc -Standards-Version: 3.7.2 - -Package: n2n -Architecture: any -Suggests: uml-utilities -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: a layer-two peer-to-peer virtual private network (VPN) - n2n is a layer-two peer-to-peer virtual private network (VPN) which allows - users to exploit features typical of P2P applications at network instead of - application level. This means that users can gain native IP visibility (e.g. - two PCs belonging to the same n2n network can ping each other) and be - reachable with the same network IP address regardless of the network where - they currently belong. In a nutshell, as OpenVPN moved SSL from application - (e.g. used to implement the https protocol) to network protocol, n2n moves - P2P from application to network level. - - diff --git a/bundles/n2n_meyerd/n2n_v1/debian/copyright b/bundles/n2n_meyerd/n2n_v1/debian/copyright deleted file mode 100644 index 38346ce9..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/copyright +++ /dev/null @@ -1,23 +0,0 @@ -This package was debianized by Jean-Baptiste Denis on -Thu, 20 Nov 2008 23:53:02 +1000. - -It was downloaded from http://www.ntop.org/n2n/ - -Upstream Author(s): - - Luca Deri - Richard Andrews - -Copyright: - - Copyright (C) 2008 Luca Deri - Copyright (C) 2008 Richard Andrews - -License: - - GPLv3 - -The Debian packaging is (C) 2008, Richard Andrews , -Luca Deri and is licensed under the GPLv3, see -`/usr/share/common-licenses/GPL-3'. - diff --git a/bundles/n2n_meyerd/n2n_v1/debian/n2n.dirs b/bundles/n2n_meyerd/n2n_v1/debian/n2n.dirs deleted file mode 100644 index 8c74f914..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/n2n.dirs +++ /dev/null @@ -1,4 +0,0 @@ -usr/bin -usr/sbin -usr/share/doc/n2n -usr/share/man/man1 diff --git a/bundles/n2n_meyerd/n2n_v1/debian/n2n.docs b/bundles/n2n_meyerd/n2n_v1/debian/n2n.docs deleted file mode 100644 index a74d034d..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/n2n.docs +++ /dev/null @@ -1,3 +0,0 @@ -README -supernode.1 -edge.8 diff --git a/bundles/n2n_meyerd/n2n_v1/debian/n2n.install b/bundles/n2n_meyerd/n2n_v1/debian/n2n.install deleted file mode 100644 index 7ccf7f46..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/n2n.install +++ /dev/null @@ -1,2 +0,0 @@ -edge /usr/bin -supernode /usr/sbin diff --git a/bundles/n2n_meyerd/n2n_v1/debian/n2n.manpages b/bundles/n2n_meyerd/n2n_v1/debian/n2n.manpages deleted file mode 100644 index b8b5aeba..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/n2n.manpages +++ /dev/null @@ -1,2 +0,0 @@ -edge.8 -supernode.1 diff --git a/bundles/n2n_meyerd/n2n_v1/debian/rules b/bundles/n2n_meyerd/n2n_v1/debian/rules deleted file mode 100644 index 914e4c9f..00000000 --- a/bundles/n2n_meyerd/n2n_v1/debian/rules +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/make -f - -#DEB_MAKE_INSTALL_TARGET = install prefix=$(CURDIR)/debian/n2n/usr - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/rules/dpatch.mk -include /usr/share/cdbs/1/class/makefile.mk - -# Add here any variable or target overrides you need. diff --git a/bundles/n2n_meyerd/n2n_v1/edge.8 b/bundles/n2n_meyerd/n2n_v1/edge.8 deleted file mode 100644 index 37d68616..00000000 --- a/bundles/n2n_meyerd/n2n_v1/edge.8 +++ /dev/null @@ -1,116 +0,0 @@ -.TH edge 1 "Jan 3, 2009" "revision 3679" "SUPERUSER COMMANDS" -.SH NAME -edge \- n2n edge node daemon -.SH SYNOPSIS -.B edge -[\-d ] \-a \-c \-k \-l -[\-p ] [\-u ] [\-g ] [-f] [\-m ] [\-t] [\-r] [\-v] -.SH DESCRIPTION -N2N is a peer-to-peer VPN system. Edge is the edge node daemon for n2n which -creates a TAP interface to expose the n2n virtual LAN. On startup n2n creates -the TAP interface and configures it then registers with the supernode so it can -begin to find other nodes in the community. -.PP -.SH OPTIONS -.TP -\-d -sets the TAP device name as seen in ifconfig. -.TP -\-a -sets the n2n virtual LAN IP address being claimed. This is a private IP -address. All IP addresses in an n2n community should belong to the same /24 -network (ie. only the last segment of the IP addresses varies). -.TP -\-b -cause edge to perform hostname resolution for the supernode address each time -the supernode is periodically contacted. -.TP -\-c -sets the n2n community name. All edges within the same community look to be on -the same LAN (layer 2 network segment). All edges communicating must use the -same key and community name. -.TP -\-h -write usage to tty then exit. -.TP -\-k -sets the twofish encryption key from ASCII text (see also N2N_KEY in -ENVIRONMENT). All edges communicating must use the same key and community name. -.TP -\-l : -sets the n2n supernode IP address and port to register to. -.TP -\-p -binds edge to the given UDP port. Useful for keeping the same external socket -across restarts of edge. -.TP -\-u -causes the edge process to drop to the given user ID when privileges are no -longer required. -.TP -\-g -causes the edge process to drop to the given group ID when privileges are no -longer required. -.TP -\-f -causes the edge process to fork and run as a daemon, closing stdin, stdout, -stderr and becoming a process group leader. -.TP -\-m -start the TAP interface with the given MAC address. This is highly recommended -as it means the same address will be used if edge stops and restarts. If this is -not done, the ARP caches of all peers will be wrong and packets will not flow to -this edge until the next ARP refresh. -.TP -\-M -set the MTU of the edge interface in bytes. MTU is the largest packet fragment -size allowed to be moved throught the interface. The default is 1400. -.TP -\-s -set the netmask of edge interface in IPv4 dotted decimal notation. The default -is 255.255.255.0 (ie. /24). -.TP -\-t -use HTTP tunneling instead of the normal UDP mechanism (experimental). -.TP -\-r -enable packet forwarding/routing through the n2n virtual LAN. Without this -option, packets arriving over n2n which are not for the -a IP address are -dropped. -.TP -\-v -use verbose logging. -.SH ENVIRONMENT -.TP -.B N2N_KEY -set the encryption key so it is not visible on the command line -.SH EXAMPLES -.TP -.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:23 \-a 192.168.254.7 \-p 50001 \-l 123.121.120.119:7654 - -Start edge with TAP device n2n0 on community "mynetwork" with community -supernode at 123.121.120.119 UDP port 7654 and bind the locally used UDP port to -50001. Use "encryptme" as the shared encryption key. Assign MAC address -DE:AD:BE:EF:01:23 to the n2n interface and drop to user=99 and group=99 after -the TAP device is successfull configured. -.PP -Add the -f option to make edge run as a daemon. -.PP -Somewhere else setup another edge with similar parameters, eg. - -.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:21 \-a 192.168.254.5 \-p 50001 \-l 123.121.120.119:7654 -.PP -Now you can ping from 192.168.254.5 to 192.168.254.7. -.PP -The MAC address (-m ) and virtual IP address (-a ) must be different on all edges in the same community. - -.SH CONFIGURATION -All configuration for edge is from the command line and environment -variables. If you wish to reconfigure edge you should kill the process and -restart with the desired options. -.SH EXIT STATUS -edge is a daemon and any exit is an error. -.SH AUTHOR -Luca Deri ( deri (at) ntop.org ), Richard Andrews ( andrews (at) ntop.org ), Don Bindner -.SH SEE ALSO -ifconfig(8) supernode(1) tunctl(8) diff --git a/bundles/n2n_meyerd/n2n_v1/edge.c b/bundles/n2n_meyerd/n2n_v1/edge.c deleted file mode 100644 index cbac25e5..00000000 --- a/bundles/n2n_meyerd/n2n_v1/edge.c +++ /dev/null @@ -1,1832 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * Richard Andrews - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - * Code contributions courtesy of: - * Don Bindner - * Sylwester Sosnowski - * Wilfried "Wonka" Klaebe - * - */ - -#include "minilzo.h" -#include "n2n.h" -#include -#include - -#ifdef __ANDROID_NDK__ -#include -#include -#endif /* __ANDROID_NDK__ */ - -/** Time between logging system STATUS messages */ -#define STATUS_UPDATE_INTERVAL (30 * 60) /*secs*/ - -#ifdef __ANDROID_NDK__ -#define ARP_PERIOD_INTERVAL (10) /* sec */ -#endif /* __ANDROID_NDK__ */ - -/* maximum length of command line arguments */ -#define MAX_CMDLINE_BUFFER_LENGTH 4096 -/* maximum length of a line in the configuration file */ -#define MAX_CONFFILE_LINE_LENGTH 1024 - -#define N2N_EDGE_SN_HOST_SIZE 48 - -#ifdef __ANDROID_NDK__ -#define N2N_EDGE_MGMT_PORT 5644 -#endif /* __ANDROID_NDK__ */ - -struct n2n_edge -{ - u_char re_resolve_supernode_ip; - struct peer_addr supernode; - char supernode_ip[N2N_EDGE_SN_HOST_SIZE]; - char * community_name /*= NULL*/; - - /* int sock; */ - /* char is_udp_socket /\*= 1*\/; */ - n2n_sock_info_t sinfo; - - u_int pkt_sent /*= 0*/; - tuntap_dev device; - int allow_routing /*= 0*/; - int drop_ipv6_ndp /*= 0*/; - char * encrypt_key /* = NULL*/; - TWOFISH * enc_tf; - TWOFISH * dec_tf; - - struct peer_info * known_peers /* = NULL*/; - struct peer_info * pending_peers /* = NULL*/; - time_t last_register /* = 0*/; -#ifdef __ANDROID_NDK__ - int sn_wait /* = 0*/; -#endif /* #ifdef __ANDROID_NDK__ */ -}; - -static void supernode2addr(n2n_edge_t * eee, char* addr); - -static void send_packet2net(n2n_edge_t * eee, - char *decrypted_msg, size_t len); - - -/* ************************************** */ - -/* parse the configuration file */ -static int readConfFile(const char * filename, char * const linebuffer) { - struct stat stats; - FILE * fd; - char * buffer = NULL; - - buffer = (char *)malloc(MAX_CONFFILE_LINE_LENGTH); - if (!buffer) { - traceEvent( TRACE_ERROR, "Unable to allocate memory"); - return -1; - } - - if (stat(filename, &stats)) { - if (errno == ENOENT) - traceEvent(TRACE_ERROR, "parameter file %s not found/unable to access\n", filename); - else - traceEvent(TRACE_ERROR, "cannot stat file %s, errno=%d\n",filename, errno); - free(buffer); - return -1; - } - - fd = fopen(filename, "rb"); - if (!fd) { - traceEvent(TRACE_ERROR, "Unable to open parameter file '%s' (%d)...\n",filename,errno); - free(buffer); - return -1; - } - while(fgets(buffer, MAX_CONFFILE_LINE_LENGTH,fd)) { - char * p = NULL; - - /* strip out comments */ - p = strchr(buffer, '#'); - if (p) *p ='\0'; - - /* remove \n */ - p = strchr(buffer, '\n'); - if (p) *p ='\0'; - - /* strip out heading spaces */ - p = buffer; - while(*p == ' ' && *p != '\0') ++p; - if (p != buffer) strncpy(buffer,p,strlen(p)+1); - - /* strip out trailing spaces */ - while(strlen(buffer) && buffer[strlen(buffer)-1]==' ') - buffer[strlen(buffer)-1]= '\0'; - - /* check for nested @file option */ - if (strchr(buffer, '@')) { - traceEvent(TRACE_ERROR, "@file in file nesting is not supported\n"); - free(buffer); - return -1; - } - if ((strlen(linebuffer)+strlen(buffer)+2)< MAX_CMDLINE_BUFFER_LENGTH) { - strncat(linebuffer, " ", 1); - strncat(linebuffer, buffer, strlen(buffer)); - } else { - traceEvent(TRACE_ERROR, "too many argument"); - free(buffer); - return -1; - } - } - - free(buffer); - fclose(fd); - - return 0; -} - -/* Create the argv vector */ -static char ** buildargv(char * const linebuffer) { - const int INITIAL_MAXARGC = 16; /* Number of args + NULL in initial argv */ - int maxargc; - int argc=0; - char ** argv; - char * buffer, * buff; - - buffer = (char *)calloc(1, strlen(linebuffer)+2); - if (!buffer) { - traceEvent( TRACE_ERROR, "Unable to allocate memory"); - return NULL; - } - strncpy(buffer, linebuffer,strlen(linebuffer)); - - maxargc = INITIAL_MAXARGC; - argv = (char **)malloc(maxargc * sizeof(char*)); - if (argv == NULL) { - traceEvent( TRACE_ERROR, "Unable to allocate memory"); - return NULL; - } - buff = buffer; - while(buff) { - char * p = strchr(buff,' '); - if (p) { - *p='\0'; - argv[argc++] = strdup(buff); - while(*++p == ' ' && *p != '\0'); - buff=p; - if (argc >= maxargc) { - maxargc *= 2; - argv = (char **)realloc(argv, maxargc * sizeof(char*)); - if (argv == NULL) { - traceEvent(TRACE_ERROR, "Unable to re-allocate memory"); - free(buffer); - return NULL; - } - } - } else { - argv[argc++] = strdup(buff); - break; - } - } - argv[argc] = NULL; - free(buffer); - return argv; -} - - - -/* ************************************** */ - -static int edge_init(n2n_edge_t * eee) { -#ifdef WIN32 - initWin32(); -#endif - memset(eee, 0, sizeof(n2n_edge_t)); - - eee->re_resolve_supernode_ip = 0; - eee->community_name = NULL; - eee->sinfo.sock = -1; - eee->sinfo.is_udp_socket = 1; - eee->pkt_sent = 0; - eee->allow_routing = 0; - eee->drop_ipv6_ndp = 0; - eee->encrypt_key = NULL; - eee->enc_tf = NULL; - eee->dec_tf = NULL; - eee->known_peers = NULL; - eee->pending_peers = NULL; - eee->last_register = 0; -#ifdef __ANDROID_NDK__ - eee->sn_wait = 0; -#endif /* #ifdef __ANDROID_NDK__ */ - - if(lzo_init() != LZO_E_OK) { - traceEvent(TRACE_ERROR, "LZO compression error"); - return(-1); - } - - return(0); -} - -static int edge_init_twofish( n2n_edge_t * eee, u_int8_t *encrypt_pwd, u_int32_t encrypt_pwd_len ) -{ - eee->enc_tf = TwoFishInit(encrypt_pwd, encrypt_pwd_len); - eee->dec_tf = TwoFishInit(encrypt_pwd, encrypt_pwd_len); - - if ( (eee->enc_tf) && (eee->dec_tf) ) - { - return 0; - } - else - { - return 1; - } -} - -/* ************************************** */ - -static void edge_deinit(n2n_edge_t * eee) { - TwoFishDestroy(eee->enc_tf); - TwoFishDestroy(eee->dec_tf); - if ( eee->sinfo.sock >=0 ) - { - close( eee->sinfo.sock ); - } -} - -static void readFromIPSocket( n2n_edge_t * eee ); - -static void help() { - print_n2n_version(); - - printf("edge " -#ifdef __linux__ - "-d " -#endif - "-a " - "-c " - "-k " - "-s " -#ifndef WIN32 - "[-u -g ]" - "[-f]" -#endif - "[-m ]" - "\n" - "-l " - "[-p ] [-M ] " - "[-t] [-r] [-v] [-b] [-h]\n\n"); - -#ifdef __linux__ - printf("-d | tun device name\n"); -#endif - - printf("-a | n2n IP address\n"); - printf("-c | n2n community name\n"); - printf("-k | Encryption key (ASCII) - also N2N_KEY=\n"); - printf("-s | Edge interface netmask in dotted decimal notation (255.255.255.0)\n"); - printf("-l | Supernode IP:port\n"); - printf("-b | Periodically resolve supernode IP\n"); - printf(" | (when supernodes are running on dynamic IPs)\n"); - printf("-p | Local port used for connecting to supernode\n"); -#ifndef WIN32 - printf("-u | User ID (numeric) to use when privileges are dropped\n"); - printf("-g | Group ID (numeric) to use when privileges are dropped\n"); - printf("-f | Fork and run as a daemon. Use syslog.\n"); -#endif - printf("-m | Choose a MAC address for the TAP interface\n" - " | eg. -m 01:02:03:04:05:06\n"); - printf("-M | Specify n2n MTU (default %d)\n", DEFAULT_MTU); - printf("-t | Use http tunneling (experimental)\n"); - printf("-r | Enable packet forwarding through n2n community\n"); - printf("-v | Verbose\n"); - - printf("\nEnvironment variables:\n"); - printf(" N2N_KEY | Encryption key (ASCII)\n" ); - - exit(0); -} - -/* *********************************************** */ - -static void send_register( n2n_edge_t * eee, - const struct peer_addr *remote_peer, - u_char is_ack) { - struct n2n_packet_header hdr; - char pkt[N2N_PKT_HDR_SIZE]; - size_t len = sizeof(hdr); - ipstr_t ip_buf; - - fill_standard_header_fields( &(eee->sinfo), &hdr, (char*)(eee->device.mac_addr)); - hdr.sent_by_supernode = 0; - hdr.msg_type = (is_ack == 0) ? MSG_TYPE_REGISTER : MSG_TYPE_REGISTER_ACK; - memcpy(hdr.community_name, eee->community_name, COMMUNITY_LEN); - - marshall_n2n_packet_header( (u_int8_t *)pkt, &hdr ); - send_packet( &(eee->sinfo), pkt, &len, remote_peer, N2N_COMPRESSION_ENABLED ); - - traceEvent(TRACE_INFO, "Sent %s message to %s:%hu", - ((hdr.msg_type==MSG_TYPE_REGISTER)?"MSG_TYPE_REGISTER":"MSG_TYPE_REGISTER_ACK"), - intoa(ntohl(remote_peer->addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(remote_peer->port)); -} - -/* *********************************************** */ - -static void send_deregister(n2n_edge_t * eee, - struct peer_addr *remote_peer) { - struct n2n_packet_header hdr; - char pkt[N2N_PKT_HDR_SIZE]; - size_t len = sizeof(hdr); - - fill_standard_header_fields( &(eee->sinfo), &hdr, (char*)(eee->device.mac_addr) ); - hdr.sent_by_supernode = 0; - hdr.msg_type = MSG_TYPE_DEREGISTER; - memcpy(hdr.community_name, eee->community_name, COMMUNITY_LEN); - - marshall_n2n_packet_header( (u_int8_t *)pkt, &hdr ); - send_packet( &(eee->sinfo), pkt, &len, remote_peer, N2N_COMPRESSION_ENABLED); -} - -/* *********************************************** */ - -static void update_peer_address(n2n_edge_t * eee, - const struct n2n_packet_header * hdr, - time_t when); -void trace_registrations( struct peer_info * scan ); -int is_ip6_discovery( const void * buf, size_t bufsize ); -void check_peer( n2n_edge_t * eee, - const struct n2n_packet_header * hdr ); -void try_send_register( n2n_edge_t * eee, - const struct n2n_packet_header * hdr ); -void set_peer_operational( n2n_edge_t * eee, const struct n2n_packet_header * hdr ); - - - -/** Start the registration process. - * - * If the peer is already in pending_peers, ignore the request. - * If not in pending_peers, add it and send a REGISTER. - * - * If hdr is for a direct peer-to-peer packet, try to register back to sender - * even if the MAC is in pending_peers. This is because an incident direct - * packet indicates that peer-to-peer exchange should work so more aggressive - * registration can be permitted (once per incoming packet) as this should only - * last for a small number of packets.. - * - * Called from the main loop when Rx a packet for our device mac. - */ -void try_send_register( n2n_edge_t * eee, - const struct n2n_packet_header * hdr ) -{ - ipstr_t ip_buf; - - /* REVISIT: purge of pending_peers not yet done. */ - struct peer_info * scan = find_peer_by_mac( eee->pending_peers, hdr->src_mac ); - - if ( NULL == scan ) - { - scan = calloc( 1, sizeof( struct peer_info ) ); - - memcpy(scan->mac_addr, hdr->src_mac, 6); - scan->public_ip = hdr->public_ip; - scan->last_seen = time(NULL); /* Don't change this it marks the pending peer for removal. */ - - peer_list_add( &(eee->pending_peers), scan ); - - traceEvent( TRACE_NORMAL, "Pending peers list size=%ld", - peer_list_size( eee->pending_peers ) ); - - traceEvent( TRACE_NORMAL, "Sending REGISTER request to %s:%hu", - intoa(ntohl(scan->public_ip.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(scan->public_ip.port)); - - send_register(eee, - &(scan->public_ip), - 0 /* is not ACK */ ); - - /* pending_peers now owns scan. */ - } - else - { - /* scan already in pending_peers. */ - - if ( 0 == hdr->sent_by_supernode ) - { - /* over-write supernode-based socket with direct socket. */ - scan->public_ip = hdr->public_ip; - - traceEvent( TRACE_NORMAL, "Sending additional REGISTER request to %s:%hu", - intoa(ntohl(scan->public_ip.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(scan->public_ip.port)); - - - send_register(eee, - &(scan->public_ip), - 0 /* is not ACK */ ); - } - } -} - - -/** Update the last_seen time for this peer, or get registered. */ -void check_peer( n2n_edge_t * eee, - const struct n2n_packet_header * hdr ) -{ - struct peer_info * scan = find_peer_by_mac( eee->known_peers, hdr->src_mac ); - - if ( NULL == scan ) - { - /* Not in known_peers - start the REGISTER process. */ - try_send_register( eee, hdr ); - } - else - { - /* Already in known_peers. */ - update_peer_address( eee, hdr, time(NULL) ); - } -} - - -/* Move the peer from the pending_peers list to the known_peers lists. - * - * peer must be a pointer to an element of the pending_peers list. - * - * Called by main loop when Rx a REGISTER_ACK. - */ -void set_peer_operational( n2n_edge_t * eee, const struct n2n_packet_header * hdr ) -{ - struct peer_info * prev = NULL; - struct peer_info * scan; - macstr_t mac_buf; - ipstr_t ip_buf; - - scan=eee->pending_peers; - - while ( NULL != scan ) - { - if ( 0 != memcmp( scan->mac_addr, hdr->dst_mac, 6 ) ) - { - break; /* found. */ - } - - prev = scan; - scan = scan->next; - } - - if ( scan ) - { - - /* Remove scan from pending_peers. */ - if ( prev ) - { - prev->next = scan->next; - } - else - { - eee->pending_peers = scan->next; - } - - /* Add scan to known_peers. */ - scan->next = eee->known_peers; - eee->known_peers = scan; - - scan->public_ip = hdr->public_ip; - - traceEvent(TRACE_INFO, "=== new peer [mac=%s][socket=%s:%hu]", - macaddr_str(scan->mac_addr, mac_buf, sizeof(mac_buf)), - intoa(ntohl(scan->public_ip.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(scan->public_ip.port)); - - traceEvent( TRACE_NORMAL, "Pending peers list size=%ld", - peer_list_size( eee->pending_peers ) ); - - traceEvent( TRACE_NORMAL, "Operational peers list size=%ld", - peer_list_size( eee->known_peers ) ); - - - scan->last_seen = time(NULL); - } - else - { - traceEvent( TRACE_WARNING, "Failed to find sender in pending_peers." ); - } -} - - -void trace_registrations( struct peer_info * scan ) -{ - macstr_t mac_buf; - ipstr_t ip_buf; - - while ( scan ) - { - traceEvent(TRACE_INFO, "=== peer [mac=%s][socket=%s:%hu]", - macaddr_str(scan->mac_addr, mac_buf, sizeof(mac_buf)), - intoa(ntohl(scan->public_ip.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(scan->public_ip.port)); - - scan = scan->next; - } - -} - -u_int8_t broadcast_mac[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - - -/** Keep the known_peers list straight. - * - * Ignore broadcast L2 packets, and packets with invalid public_ip. - * If the dst_mac is in known_peers make sure the entry is correct: - * - if the public_ip socket has changed, erase the entry - * - if the same, update its last_seen = when - */ -static void update_peer_address(n2n_edge_t * eee, - const struct n2n_packet_header * hdr, - time_t when) -{ - ipstr_t ip_buf; - struct peer_info *scan = eee->known_peers; - struct peer_info *prev = NULL; /* use to remove bad registrations. */ - - if ( 0 == hdr->public_ip.addr_type.v4_addr ) - { - /* Not to be registered. */ - return; - } - - if ( 0 == memcmp( hdr->dst_mac, broadcast_mac, 6 ) ) - { - /* Not to be registered. */ - return; - } - - - while(scan != NULL) - { - if(memcmp(hdr->dst_mac, scan->mac_addr, 6) == 0) - { - break; - } - - prev = scan; - scan = scan->next; - } - - if ( NULL == scan ) - { - /* Not in known_peers. */ - return; - } - - if ( 0 != memcmp( &(scan->public_ip), &(hdr->public_ip), sizeof(struct peer_addr))) - { - if ( 0 == hdr->sent_by_supernode ) - { - traceEvent( TRACE_NORMAL, "Peer changed public socket, Was %s:%hu", - intoa(ntohl(hdr->public_ip.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(hdr->public_ip.port)); - - /* The peer has changed public socket. It can no longer be assumed to be reachable. */ - /* Remove the peer. */ - if ( NULL == prev ) - { - /* scan was head of list */ - eee->known_peers = scan->next; - } - else - { - prev->next = scan->next; - } - free(scan); - - try_send_register( eee, hdr ); - } - else - { - /* Don't worry about what the supernode reports, it could be seeing a different socket. */ - } - } - else - { - /* Found and unchanged. */ - scan->last_seen = when; - } -} - - - -#if defined(DUMMY_ID_00001) /* Disabled waiting for config option to enable it */ - -/* *********************************************** */ - -static char gratuitous_arp[] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* Dest mac */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Src mac */ - 0x08, 0x06, /* ARP */ - 0x00, 0x01, /* Ethernet */ - 0x08, 0x00, /* IP */ - 0x06, /* Hw Size */ - 0x04, /* Protocol Size */ - 0x00, 0x01, /* ARP Request */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Src mac */ - 0x00, 0x00, 0x00, 0x00, /* Src IP */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Target mac */ - 0x00, 0x00, 0x00, 0x00 /* Target IP */ -}; - -static int build_gratuitous_arp(char *buffer, u_short buffer_len) { - if(buffer_len < sizeof(gratuitous_arp)) return(-1); - - memcpy(buffer, gratuitous_arp, sizeof(gratuitous_arp)); - memcpy(&buffer[6], device.mac_addr, 6); - memcpy(&buffer[22], device.mac_addr, 6); - memcpy(&buffer[28], &device.ip_addr, 4); - - /* REVISIT: BbMaj7 - use a real netmask here. This is valid only by accident - * for /24 IPv4 networks. */ - buffer[31] = 0xFF; /* Use a faked broadcast address */ - memcpy(&buffer[38], &device.ip_addr, 4); - return(sizeof(gratuitous_arp)); -} - -/** Called from update_registrations to periodically send gratuitous ARP - * broadcasts. */ -static void send_grat_arps(n2n_edge_t * eee,) { - char buffer[48]; - size_t len; - - traceEvent(TRACE_NORMAL, "Sending gratuitous ARP..."); - len = build_gratuitous_arp(buffer, sizeof(buffer)); - send_packet2net(eee, buffer, len); - send_packet2net(eee, buffer, len); /* Two is better than one :-) */ -} -#endif /* #if defined(DUMMY_ID_00001) */ - - - -/* *********************************************** */ - -/** @brief Check to see if we should re-register with our peers and the - * supernode. - * - * This is periodically called by the main loop. The list of registrations is - * not modified. Registration packets may be sent. - */ -static void update_registrations( n2n_edge_t * eee ) { - /* REVISIT: BbMaj7: have shorter timeout to REGISTER to supernode if this has - * not yet succeeded. */ - - if(time(NULL) < (eee->last_register+REGISTER_FREQUENCY)) return; /* Too early */ - - traceEvent(TRACE_NORMAL, "Registering with supernode"); - if(eee->re_resolve_supernode_ip) { - supernode2addr(eee, eee->supernode_ip); - } - - send_register(eee, &(eee->supernode), 0); /* Register with supernode */ - - /* REVISIT: turn-on gratuitous ARP with config option. */ - /* send_grat_arps(sock_fd, is_udp_sock); */ - -#ifdef __ANDROID_NDK__ - if (eee->sn_wait) { - int change = 0; - pthread_mutex_lock(&g_status->mutex); - change = g_status->running_status == EDGE_STAT_SUPERNODE_DISCONNECT ? 0 : 1; - g_status->running_status = EDGE_STAT_SUPERNODE_DISCONNECT; - pthread_mutex_unlock(&g_status->mutex); - if (change) { - g_status->report_edge_status(); - } - } - eee->sn_wait = 1; -#endif /* #ifdef __ANDROID_NDK__ */ - - eee->last_register = time(NULL); -} - -/* ***************************************************** */ - -static int find_peer_destination(n2n_edge_t * eee, - const u_char *mac_address, - struct peer_addr *destination) { - const struct peer_info *scan = eee->known_peers; - macstr_t mac_buf; - ipstr_t ip_buf; - int retval=0; - - traceEvent(TRACE_INFO, "Searching destination peer for MAC %02X:%02X:%02X:%02X:%02X:%02X", - mac_address[0] & 0xFF, mac_address[1] & 0xFF, mac_address[2] & 0xFF, - mac_address[3] & 0xFF, mac_address[4] & 0xFF, mac_address[5] & 0xFF); - - while(scan != NULL) { - traceEvent(TRACE_INFO, "Evaluating peer [MAC=%02X:%02X:%02X:%02X:%02X:%02X][ip=%s:%hu]", - scan->mac_addr[0] & 0xFF, scan->mac_addr[1] & 0xFF, scan->mac_addr[2] & 0xFF, - scan->mac_addr[3] & 0xFF, scan->mac_addr[4] & 0xFF, scan->mac_addr[5] & 0xFF, - intoa(ntohl(scan->public_ip.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(scan->public_ip.port)); - - if((scan->last_seen > 0) && - (memcmp(mac_address, scan->mac_addr, 6) == 0)) - { - memcpy(destination, &scan->public_ip, sizeof(struct sockaddr_in)); - retval=1; - break; - } - scan = scan->next; - } - - if ( 0 == retval ) - { - memcpy(destination, &(eee->supernode), sizeof(struct sockaddr_in)); - } - - traceEvent(TRACE_INFO, "find_peer_address(%s) -> [socket=%s:%hu]", - macaddr_str( (char *)mac_address, mac_buf, sizeof(mac_buf)), - intoa(ntohl(destination->addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(destination->port)); - - return retval; -} - -/* *********************************************** */ - -static const struct option long_options[] = { - { "community", required_argument, NULL, 'c' }, - { "supernode-list", required_argument, NULL, 'l' }, - { "tun-device", required_argument, NULL, 'd' }, - { "euid", required_argument, NULL, 'u' }, - { "egid", required_argument, NULL, 'g' }, - { "help" , no_argument, NULL, 'h' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, 0, NULL, 0 } -}; - -/* ***************************************************** */ - - -/** A layer-2 packet was received at the tunnel and needs to be sent via UDP. */ -static void send_packet2net(n2n_edge_t * eee, - char *decrypted_msg, size_t len) { - ipstr_t ip_buf; - char packet[2048]; - int data_sent_len; - struct n2n_packet_header hdr; - struct peer_addr destination; - macstr_t mac_buf; - macstr_t mac2_buf; - struct ether_header *eh = (struct ether_header*)decrypted_msg; - - /* Discard IP packets that are not originated by this hosts */ - if(!(eee->allow_routing)) { - if(ntohs(eh->ether_type) == 0x0800) { - /* This is an IP packet from the local source address - not forwarded. */ -#define ETH_FRAMESIZE 14 -#define IP4_SRCOFFSET 12 - u_int32_t dst; - memcpy( &dst, &decrypted_msg[ETH_FRAMESIZE + IP4_SRCOFFSET], sizeof(dst) ); - - /* The following comparison works because device.ip_addr is stored in network order */ - if( dst != eee->device.ip_addr) { - /* This is a packet that needs to be routed */ - traceEvent(TRACE_INFO, "Discarding routed packet [%s]", - intoa(ntohl(dst), ip_buf, sizeof(ip_buf))); - return; - } else { - /* This packet is originated by us */ - /* traceEvent(TRACE_INFO, "Sending non-routed packet"); */ - } - } - } - - /* Encrypt "decrypted_msg" into the second half of the n2n packet. */ - len = TwoFishEncryptRaw((u_int8_t *)decrypted_msg, - (u_int8_t *)&packet[N2N_PKT_HDR_SIZE], len, eee->enc_tf); - - /* Add the n2n header to the start of the n2n packet. */ - fill_standard_header_fields( &(eee->sinfo), &hdr, (char*)(eee->device.mac_addr) ); - hdr.msg_type = MSG_TYPE_PACKET; - hdr.sent_by_supernode = 0; - memcpy(hdr.community_name, eee->community_name, COMMUNITY_LEN); - memcpy(hdr.dst_mac, decrypted_msg, 6); - - marshall_n2n_packet_header( (u_int8_t *)packet, &hdr ); - - len += N2N_PKT_HDR_SIZE; - - if(find_peer_destination(eee, eh->ether_dhost, &destination)) - traceEvent(TRACE_INFO, "** Going direct [dst_mac=%s][dest=%s:%hu]", - macaddr_str((char*)eh->ether_dhost, mac_buf, sizeof(mac_buf)), - intoa(ntohl(destination.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(destination.port)); - else - traceEvent(TRACE_INFO, " Going via supernode [src_mac=%s][dst_mac=%s]", - macaddr_str((char*)eh->ether_shost, mac_buf, sizeof(mac_buf)), - macaddr_str((char*)eh->ether_dhost, mac2_buf, sizeof(mac2_buf))); - - data_sent_len = reliable_sendto( &(eee->sinfo), packet, &len, &destination, - N2N_COMPRESSION_ENABLED); - - if(data_sent_len != len) - traceEvent(TRACE_WARNING, "sendto() [sent=%d][attempted_to_send=%d] [%s]\n", - data_sent_len, len, strerror(errno)); - else { - ++(eee->pkt_sent); - traceEvent(TRACE_INFO, "Sent %d byte MSG_TYPE_PACKET ok", data_sent_len); - } -} - -/* ***************************************************** */ - -/** Destination MAC 33:33:0:00:00:00 - 33:33:FF:FF:FF:FF is reserved for IPv6 - * neighbour discovery. - */ -int is_ip6_discovery( const void * buf, size_t bufsize ) -{ - int retval = 0; - - if ( bufsize >= sizeof(struct ether_header) ) - { - struct ether_header *eh = (struct ether_header*)buf; - if ( (0x33 == eh->ether_dhost[0]) && - (0x33 == eh->ether_dhost[1]) ) - { - retval = 1; /* This is an IPv6 neighbour discovery packet. */ - } - } - return retval; -} - - -/* ***************************************************** */ - -/* - * Return: 0 = ok, -1 = invalid packet - * - */ -static int check_received_packet(n2n_edge_t * eee, char *pkt, - u_int pkt_len) { - - if(pkt_len == 42) { - /* ARP */ - if((pkt[12] != 0x08) || (pkt[13] != 0x06)) return(0); /* No ARP */ - if((pkt[20] != 0x00) || (pkt[21] != 0x02)) return(0); /* No ARP Reply */ - if(memcmp(&pkt[28], &(eee->device.ip_addr), 4)) return(0); /* This is not me */ - - if(memcmp(eee->device.mac_addr, &pkt[22], 6) == 0) { - traceEvent(TRACE_WARNING, "Bounced packet received: supernode bug?"); - return(0); - } - - traceEvent(TRACE_ERROR, "Duplicate address found. Your IP is used by MAC %02X:%02X:%02X:%02X:%02X:%02X", - pkt[22+0] & 0xFF, pkt[22+1] & 0xFF, pkt[22+2] & 0xFF, - pkt[22+3] & 0xFF, pkt[22+4] & 0xFF, pkt[22+5] & 0xFF); - exit(0); - } else if(pkt_len > 32 /* IP + Ethernet */) { - /* Check if this packet is for us or if it's routed */ - struct ether_header *eh = (struct ether_header*)pkt; - - const struct in_addr bcast = { 0xffffffff }; - - if(ntohs(eh->ether_type) == 0x0800) { - - /* Note: all elements of the_ip are in network order */ - struct ip the_ip; - memcpy( &the_ip, pkt+sizeof(struct ether_header), sizeof(the_ip) ); - - if((the_ip.ip_dst.s_addr != eee->device.ip_addr) - && ((the_ip.ip_dst.s_addr & eee->device.device_mask) != (eee->device.ip_addr & eee->device.device_mask)) /* Not a broadcast */ - && ((the_ip.ip_dst.s_addr & 0xE0000000) != (0xE0000000 /* 224.0.0.0-239.255.255.255 */)) /* Not a multicast */ - && ((the_ip.ip_dst.s_addr) != (bcast.s_addr)) /* always broadcast (RFC919) */ - && (!(eee->allow_routing)) /* routing is enabled so let it in */ - ) - { - /* Dropping the packet */ - - ipstr_t ip_buf; - ipstr_t ip_buf2; - - /* This is a packet that needs to be routed */ - traceEvent(TRACE_INFO, "Discarding routed packet [rcvd=%s][expected=%s]", - intoa(ntohl(the_ip.ip_dst.s_addr), ip_buf, sizeof(ip_buf)), - intoa(ntohl(eee->device.ip_addr), ip_buf2, sizeof(ip_buf2))); - } else { - /* This packet is for us */ - - /* traceEvent(TRACE_INFO, "Received non-routed packet"); */ - return(0); - } - } else - return(0); - } else { - traceEvent(TRACE_INFO, "Packet too short (%d bytes): discarded", pkt_len); - } - - return(-1); -} - -/* ***************************************************** */ - -/** Read a single packet from the TAP interface, process it and write out the - * corresponding packet to the cooked socket. - * - * REVISIT: fails if more than one packet is waiting to be read. - */ -static void readFromTAPSocket( n2n_edge_t * eee ) -{ - /* tun -> remote */ - u_char decrypted_msg[2048]; - size_t len; - -#ifdef __ANDROID_NDK__ - if (uip_arp_len != 0) { - len = uip_arp_len; - memcpy(decrypted_msg, uip_arp_buf, MIN(uip_arp_len, sizeof(decrypted_msg))); - traceEvent(TRACE_NORMAL, "ARP reply packet to send"); - } - else - { -#endif /* #ifdef __ANDROID_NDK__ */ - len = tuntap_read(&(eee->device), decrypted_msg, sizeof(decrypted_msg)); -#ifdef __ANDROID_NDK__ - } -#endif /* #ifdef __ANDROID_NDK__ */ - - if((len <= 0) || (len > sizeof(decrypted_msg))) - traceEvent(TRACE_WARNING, "read()=%d [%d/%s]\n", - len, errno, strerror(errno)); - else { - traceEvent(TRACE_INFO, "### Rx L2 Msg (%d) tun -> network", len); - - if ( eee->drop_ipv6_ndp && is_ip6_discovery( decrypted_msg, len ) ) { - traceEvent(TRACE_WARNING, "Dropping unsupported IPv6 neighbour discovery packet"); - } else { - send_packet2net(eee, (char*)decrypted_msg, len); - } - } -} - -/* ***************************************************** */ - - -void readFromIPSocket( n2n_edge_t * eee ) -{ - ipstr_t ip_buf; - macstr_t mac_buf; - char packet[2048], decrypted_msg[2048]; - size_t len; - int data_sent_len; - struct peer_addr sender; - - /* remote -> tun */ - u_int8_t discarded_pkt; - struct n2n_packet_header hdr_storage; - - len = receive_data( &(eee->sinfo), packet, sizeof(packet), &sender, - &discarded_pkt, (char*)(eee->device.mac_addr), - N2N_COMPRESSION_ENABLED, &hdr_storage); - - if(len <= 0) return; - - traceEvent(TRACE_INFO, "### Rx N2N Msg network -> tun"); - - if(discarded_pkt) { - traceEvent(TRACE_INFO, "Discarded incoming pkt"); - } else { - if(len <= 0) - traceEvent(TRACE_WARNING, "receive_data()=%d [%s]\n", len, strerror(errno)); - else { - if(len < N2N_PKT_HDR_SIZE) - traceEvent(TRACE_WARNING, "received packet too short [len=%d]\n", len); - else { - struct n2n_packet_header *hdr = &hdr_storage; - - traceEvent(TRACE_INFO, "Received packet from %s:%hu", - intoa(ntohl(sender.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(sender.port)); - - traceEvent(TRACE_INFO, "Received message [msg_type=%s] from %s [dst mac=%s]", - msg_type2str(hdr->msg_type), - hdr->sent_by_supernode ? "supernode" : "peer", - macaddr_str(hdr->dst_mac, mac_buf, sizeof(mac_buf))); - - if(hdr->version != N2N_PKT_VERSION) { - traceEvent(TRACE_WARNING, - "Received packet with unknown protocol version (%d): discarded\n", - hdr->version); - return; - } - - /* FIX - Add IPv6 support */ - if(hdr->public_ip.addr_type.v4_addr == 0) { - hdr->public_ip.addr_type.v4_addr = sender.addr_type.v4_addr; - hdr->public_ip.port = sender.port; - hdr->public_ip.family = AF_INET; - } - - if(strncmp(hdr->community_name, eee->community_name, COMMUNITY_LEN) != 0) { - traceEvent(TRACE_WARNING, "Received packet with invalid community [expected=%s][received=%s]\n", - eee->community_name, hdr->community_name); - } else { - if(hdr->msg_type == MSG_TYPE_PACKET) { - /* assert: the packet received is destined for device.mac_addr or broadcast MAC. */ - - len -= N2N_PKT_HDR_SIZE; - - /* Decrypt message first */ - len = TwoFishDecryptRaw((u_int8_t *)&packet[N2N_PKT_HDR_SIZE], - (u_int8_t *)decrypted_msg, len, eee->dec_tf); - - if(len > 0) { - if(check_received_packet(eee, decrypted_msg, len) == 0) { - - if ( 0 == memcmp(hdr->dst_mac, eee->device.mac_addr, 6) ) - { - check_peer( eee, hdr ); - } - - data_sent_len = tuntap_write(&(eee->device), (u_char*)decrypted_msg, len); - - if(data_sent_len != len) - traceEvent(TRACE_WARNING, "tuntap_write() [sent=%d][attempted_to_send=%d] [%s]\n", - data_sent_len, len, strerror(errno)); - else { - /* Normal situation. */ - traceEvent(TRACE_INFO, "### Tx L2 Msg -> tun"); - } - } else { - traceEvent(TRACE_WARNING, "Bad destination: message discarded"); - } - } - /* else silently ignore empty packet. */ - - } else if(hdr->msg_type == MSG_TYPE_REGISTER) { - traceEvent(TRACE_INFO, "Received registration request from remote peer [ip=%s:%hu]", - intoa(ntohl(hdr->public_ip.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(hdr->public_ip.port)); - if ( 0 == memcmp(hdr->dst_mac, (eee->device.mac_addr), 6) ) - { - check_peer( eee, hdr ); - } - - - send_register(eee, &hdr->public_ip, 1); /* Send ACK back */ - } else if(hdr->msg_type == MSG_TYPE_REGISTER_ACK) { - traceEvent(TRACE_NORMAL, "Received REGISTER_ACK from remote peer [ip=%s:%hu]", - intoa(ntohl(hdr->public_ip.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(hdr->public_ip.port)); - - /* if ( 0 == memcmp(hdr->dst_mac, eee->device.mac_addr, 6) ) */ - { - if ( hdr->sent_by_supernode ) - { - /* Response to supernode registration. Supernode is not in the pending_peers list. */ -#ifdef __ANDROID_NDK__ - eee->sn_wait = 0; - int change = 0; - pthread_mutex_lock(&g_status->mutex); - change = g_status->running_status == EDGE_STAT_CONNECTED ? 0 : 1; - g_status->running_status = EDGE_STAT_CONNECTED; - pthread_mutex_unlock(&g_status->mutex); - if (change) { - g_status->report_edge_status(); - } -#endif /* #ifdef __ANDROID_NDK__ */ - } - else - { - /* Move from pending_peers to known_peers; ignore if not in pending. */ - set_peer_operational( eee, hdr ); - } - } - - } else { - traceEvent(TRACE_WARNING, "Unable to handle packet type %d: ignored\n", hdr->msg_type); - return; - } - } - } - } - } -} - -/* ***************************************************** */ - - -#ifdef WIN32 -static DWORD tunReadThread(LPVOID lpArg ) -{ - n2n_edge_t *eee = (n2n_edge_t*)lpArg; - - while(1) { - readFromTAPSocket(eee); - } - - return((DWORD)NULL); -} - -/* ***************************************************** */ - -static void startTunReadThread(n2n_edge_t *eee) { - HANDLE hThread; - DWORD dwThreadId; - - hThread = CreateThread(NULL, /* no security attributes */ - 0, /* use default stack size */ - (LPTHREAD_START_ROUTINE)tunReadThread, /* thread function */ - (void*)eee, /* argument to thread function */ - 0, /* use default creation flags */ - &dwThreadId); /* returns the thread identifier */ -} -#endif - -/* ***************************************************** */ - -static void supernode2addr(n2n_edge_t * eee, char* addr) { - char tmpAddr[N2N_EDGE_SN_HOST_SIZE]; - memcpy(tmpAddr, addr, N2N_EDGE_SN_HOST_SIZE); - char *supernode_host = strtok(tmpAddr, ":"); - - if(supernode_host) { - char *supernode_port = strtok(NULL, ":"); - const struct addrinfo aihints = {0, PF_INET, 0, 0, 0, NULL, NULL, NULL}; - struct addrinfo * ainfo = NULL; - int nameerr; - ipstr_t ip_buf; - - if ( supernode_port ) - eee->supernode.port = htons(atoi(supernode_port)); - else - traceEvent(TRACE_WARNING, "Bad supernode parameter (-l ): %s", - addr); - - nameerr = getaddrinfo( supernode_host, NULL, &aihints, &ainfo ); - - if( 0 == nameerr ) - { - struct sockaddr_in * saddr; - - /* ainfo s the head of a linked list if non-NULL. */ - if ( ainfo && (PF_INET == ainfo->ai_family) ) - { - /* It is definitely and IPv4 address -> sockaddr_in */ - saddr = (struct sockaddr_in *)ainfo->ai_addr; - - eee->supernode.addr_type.v4_addr = saddr->sin_addr.s_addr; - } - else - { - /* Should only return IPv4 addresses due to aihints. */ - traceEvent(TRACE_WARNING, "Failed to resolve supernode IPv4 address for %s", supernode_host); - } - - freeaddrinfo(ainfo); /* free everything allocated by getaddrinfo(). */ - ainfo = NULL; - } else { - traceEvent(TRACE_WARNING, "Failed to resolve supernode host %s, assuming numeric", supernode_host); - eee->supernode.addr_type.v4_addr = inet_addr(supernode_host); - } - - traceEvent(TRACE_NORMAL, "Using supernode %s:%hu", - intoa(ntohl(eee->supernode.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(eee->supernode.port)); - } else - traceEvent(TRACE_WARNING, "Wrong supernode parameter (-l )"); -} - -/* ***************************************************** */ - -extern int useSyslog; -#ifdef __ANDROID_NDK__ -static int keep_running = 1; -#endif /* #ifdef __ANDROID_NDK__ */ - -#define N2N_NETMASK_STR_SIZE 16 /* dotted decimal 12 numbers + 3 dots */ - -#ifndef __ANDROID_NDK__ -int main(int argc, char* argv[]) { - int opt=0; - u_int16_t local_port = 0 /* any port */; - char *tuntap_dev_name = "edge0"; - char *ip_addr = NULL; - char netmask[N2N_NETMASK_STR_SIZE]="255.255.255.0"; - int mtu = DEFAULT_MTU; - int got_s = 0; - -#ifndef WIN32 - uid_t userid=0; /* root is the only guaranteed ID */ - gid_t groupid=0; /* root is the only guaranteed ID */ - int fork_as_daemon=0; -#endif - - size_t numPurged; - time_t lastStatus=0; - - char * device_mac=NULL; - char * encrypt_key=NULL; - - int i, effectiveargc=0; - char ** effectiveargv=NULL; - char * linebuffer = NULL; - - n2n_edge_t eee; /* single instance for this program */ - - if (-1 == edge_init(&eee) ){ - traceEvent( TRACE_ERROR, "Failed in edge_init" ); - exit(1); - } - - if( getenv( "N2N_KEY" )) { - encrypt_key = strdup( getenv( "N2N_KEY" )); - } - -#ifdef WIN32 - tuntap_dev_name = ""; -#endif - memset(&(eee.supernode), 0, sizeof(eee.supernode)); - eee.supernode.family = AF_INET; - - linebuffer = (char *)malloc(MAX_CMDLINE_BUFFER_LENGTH); - if (!linebuffer) { - traceEvent( TRACE_ERROR, "Unable to allocate memory"); - exit(1); - } - snprintf(linebuffer, MAX_CMDLINE_BUFFER_LENGTH, "%s",argv[0]); - -#ifdef WIN32 - for(i=0; i COMMUNITY_LEN) - eee.community_name[COMMUNITY_LEN] = '\0'; - break; -#ifndef WIN32 - - case 'u': /* uid */ - { - userid = atoi(optarg); - break; - } - case 'g': /* uid */ - { - groupid = atoi(optarg); - break; - } - case 'f' : /* fork as daemon */ - { - fork_as_daemon = 1; - break; - } -#endif - case 'm' : /* device_mac */ - { - device_mac = strdup(optarg); - break; - } - case 'M' : /* device_mac */ - { - mtu = atoi(optarg); - break; - } - case 'k': /* encrypt key */ - encrypt_key = strdup(optarg); - break; - case 'r': /* enable packet routing across n2n endpoints */ - eee.allow_routing = 1; - break; - case 'l': /* supernode-list */ - snprintf(eee.supernode_ip, sizeof(eee.supernode_ip), "%s", optarg); - supernode2addr(&eee, eee.supernode_ip); - break; -#ifdef __linux__ - case 'd': /* tun-device */ - tuntap_dev_name = strdup(optarg); - break; -#endif - case 't': /* Use HTTP tunneling */ - eee.sinfo.is_udp_socket = 0; - break; - case 'b': - eee.re_resolve_supernode_ip = 1; - break; - case 'p': - local_port = atoi(optarg) & 0xffff; - break; - case 's': /* Subnet Mask */ - if (0 != got_s) { - traceEvent(TRACE_WARNING, "Multiple subnet masks supplied."); - } - strncpy(netmask, optarg, N2N_NETMASK_STR_SIZE); - got_s = 1; - break; - case 'h': /* help */ - help(); - break; - case 'v': /* verbose */ - traceLevel = 3; - break; - } - } - - if(!( -#ifdef __linux__ - tuntap_dev_name && -#endif - eee.community_name && - ip_addr && - eee.supernode.addr_type.v4_addr && - encrypt_key)) - help(); - -#ifndef WIN32 - /* If running suid root then we need to setuid before using the force. */ - setuid( 0 ); - /* setgid( 0 ); */ -#endif - - if(tuntap_open(&(eee.device), tuntap_dev_name, ip_addr, netmask, device_mac, mtu) < 0) - return(-1); - -#ifndef WIN32 - if ( (userid != 0) || (groupid != 0 ) ) { - traceEvent(TRACE_NORMAL, "Interface up. Dropping privileges to uid=%d, gid=%d", userid, groupid); - - /* Finished with the need for root privileges. Drop to unprivileged user. */ - setreuid( userid, userid ); - setregid( groupid, groupid ); - } -#endif - - if(local_port > 0) - traceEvent(TRACE_NORMAL, "Binding to local port %hu", local_port); - - if(edge_init_twofish( &eee, (u_int8_t *)(encrypt_key), strlen(encrypt_key) ) < 0) return(-1); - eee.sinfo.sock = open_socket(local_port, eee.sinfo.is_udp_socket, 0); - if(eee.sinfo.sock < 0) return(-1); - - if( !(eee.sinfo.is_udp_socket) ) { - int rc = connect_socket(eee.sinfo.sock, &(eee.supernode)); - - if(rc == -1) { - traceEvent(TRACE_WARNING, "Error while connecting to supernode\n"); - return(-1); - } - } - -#ifndef WIN32 - if ( fork_as_daemon ) - { - useSyslog=1; /* traceEvent output now goes to syslog. */ - daemon( 0, 0 ); - } -#endif -#else /* #ifdef __ANDROID_NDK__ */ -int start_edge_v1(n2n_edge_status_t* status) { - u_int16_t local_port = 0 /* any port */; - char *tuntap_dev_name = "tun0"; - char ip_addr[N2N_NETMASK_STR_SIZE]=""; - char netmask[N2N_NETMASK_STR_SIZE]="255.255.255.0"; - char device_mac[18]=""; - char *encrypt_key=NULL; - int mgmt_sock = -1; - - size_t numPurged; - time_t lastStatus=0; - - n2n_edge_t eee; /* single instance for this program */ - - if (!status) - { - traceEvent( TRACE_ERROR, "Empty cmd struct" ); - return 1; - } - g_status = status; - n2n_edge_cmd_t* cmd = &status->cmd; - - keep_running = 0; - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_CONNECTING; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - - traceLevel = cmd->trace_vlevel; - traceLevel = traceLevel < 0 ? 0 : traceLevel; /* TRACE_ERROR */ - traceLevel = traceLevel > 3 ? 3 : traceLevel; /* TRACE_INFO */ - if (!slog) - { - closeslog(slog); - slog = NULL; - } - slog = initslog(android_log_level(traceLevel), cmd->logpath); - - if (-1 == edge_init(&eee) ) - { - traceEvent( TRACE_ERROR, "Failed in edge_init" ); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - memset(&(eee.supernode), 0, sizeof(eee.supernode)); - eee.supernode.family = AF_INET; - - if (cmd->vpn_fd < 0) { - traceEvent(TRACE_ERROR, "VPN socket is invalid."); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - eee.device.fd = cmd->vpn_fd; - if (cmd->enc_key) - { - encrypt_key = strdup(cmd->enc_key); - traceEvent(TRACE_NORMAL, "encrypt_key = '%s'\n", encrypt_key); - } - if (cmd->ip_addr[0] != '\0') - { - strncpy(ip_addr, cmd->ip_addr, N2N_NETMASK_STR_SIZE); - ip_addr[N2N_NETMASK_STR_SIZE - 1] = '\0'; - } - else - { - traceEvent(TRACE_ERROR, "Ip address is not set."); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - if (cmd->community[0] != '\0') - { - eee.community_name = cmd->community; - } - else - { - traceEvent(TRACE_ERROR, "Community is not set."); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - if (cmd->mac_addr[0] != '\0') - { - strncpy(device_mac, cmd->mac_addr, sizeof(device_mac)); - device_mac[sizeof(device_mac) - 1] = '\0'; - } - else - { - strncpy(device_mac, random_device_mac(), sizeof(device_mac)); - traceEvent(TRACE_NORMAL, "random device mac: %s\n", device_mac); - } - eee.allow_routing = cmd->allow_routing == 0 ? 0 : 1; - if (cmd->supernodes[0][0] != '\0') - { - strncpy(eee.supernode_ip, cmd->supernodes[0], N2N_EDGE_SN_HOST_SIZE); - eee.supernode_ip[N2N_EDGE_SN_HOST_SIZE - 1] = '\0'; - } - else - { - traceEvent(TRACE_ERROR, "Supernode is not set."); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - eee.re_resolve_supernode_ip = cmd->re_resolve_supernode_ip == 0 ? 0 : 1; - if (cmd->ip_netmask[0] != '\0') - { - strncpy(netmask, cmd->ip_netmask, N2N_NETMASK_STR_SIZE); - } - local_port = cmd->local_port; - eee.sinfo.is_udp_socket = cmd->http_tunnel == 0 ? 1 : 0; - - supernode2addr(&eee, eee.supernode_ip); - if (!eee.supernode.addr_type.v4_addr) - { - traceEvent(TRACE_ERROR, "Supernode is not resolved."); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - if(tuntap_open(&(eee.device), tuntap_dev_name, ip_addr, netmask, device_mac, cmd->mtu) < 0) - { - traceEvent(TRACE_ERROR, "Failed in tuntap_open"); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - if(local_port > 0) - { - traceEvent(TRACE_NORMAL, "Binding to local port %hu", local_port); - } - - if(edge_init_twofish( &eee, (u_int8_t *)(encrypt_key), encrypt_key ? strlen(encrypt_key) : 0 ) < 0) - { - traceEvent(TRACE_ERROR, "twofish init failed."); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - free(encrypt_key); - eee.sinfo.sock = open_socket(local_port, eee.sinfo.is_udp_socket, 0); - if(eee.sinfo.sock < 0) - { - traceEvent(TRACE_ERROR, "Failed to bind main socket port %u", (signed int)local_port); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - if(!eee.sinfo.is_udp_socket) - { - int rc = connect_socket(eee.sinfo.sock, &(eee.supernode)); - if(rc == -1) { - traceEvent(TRACE_WARNING, "Error while connecting to supernode\n"); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - } - mgmt_sock = open_socket(N2N_EDGE_MGMT_PORT, 1, 0); - if (mgmt_sock < 0) - { - traceEvent(TRACE_ERROR, "Failed to bind management socket port %u", (signed int)N2N_EDGE_MGMT_PORT); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - - /* set host addr, netmask, mac addr for UIP and init arp*/ - { - int match, i; - int ip[4]; - uip_ipaddr_t ipaddr; - struct uip_eth_addr eaddr; - - match = sscanf(ip_addr, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan ip failed, ip: %s", ip_addr); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_sethostaddr(ipaddr); - match = sscanf(netmask, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan netmask error, ip: %s", netmask); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_setnetmask(ipaddr); - for (i = 0; i < 6; ++i) { - eaddr.addr[i] = eee.device.mac_addr[i]; - } - uip_setethaddr(eaddr); - - uip_arp_init(); - } - - keep_running = 1; - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_CONNECTED; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - traceEvent(TRACE_NORMAL, "edge started"); - -#endif /* #ifdef __ANDROID_NDK__ */ - - update_registrations(&eee); - - traceEvent(TRACE_NORMAL, ""); - traceEvent(TRACE_NORMAL, "Ready"); - -#ifdef WIN32 - startTunReadThread(&eee); -#endif - - /* Main loop - * - * select() is used to wait for input on either the TAP fd or the UDP/TCP - * socket. When input is present the data is read and processed by either - * readFromIPSocket() or readFromTAPSocket() - */ - -#ifdef __ANDROID_NDK__ - time_t lastArpPeriod=0; -#endif - -#ifdef __ANDROID_NDK__ - keep_running = 1; - while(keep_running) { -#else - while (1) { -#endif /* #ifdef __ANDROID_NDK__ */ - - int rc, max_sock = 0; - fd_set socket_mask; - struct timeval wait_time; - time_t nowTime; - - FD_ZERO(&socket_mask); - FD_SET(eee.sinfo.sock, &socket_mask); -#ifndef WIN32 - FD_SET(eee.device.fd, &socket_mask); - max_sock = max( eee.sinfo.sock, eee.device.fd ); -#endif -#ifdef __ANDROID_NDK__ - FD_SET(mgmt_sock, &socket_mask); - max_sock = max(max_sock, mgmt_sock); -#endif /* #ifdef __ANDROID_NDK__ */ - - wait_time.tv_sec = SOCKET_TIMEOUT_INTERVAL_SECS; wait_time.tv_usec = 0; - - rc = select(max_sock+1, &socket_mask, NULL, NULL, &wait_time); - nowTime=time(NULL); - - if(rc > 0) - { - /* Any or all of the FDs could have input; check them all. */ - - if(FD_ISSET(eee.sinfo.sock, &socket_mask)) - { - /* Read a cooked socket from the internet socket. Writes on the TAP - * socket. */ - readFromIPSocket(&eee); - } - -#ifdef __ANDROID_NDK__ - if (uip_arp_len != 0) { - readFromTAPSocket(&eee); - uip_arp_len = 0; - } -#endif /* #ifdef __ANDROID_NDK__ */ - -#ifndef WIN32 - if(FD_ISSET(eee.device.fd, &socket_mask)) - { - /* Read an ethernet frame from the TAP socket. Write on the IP - * socket. */ - readFromTAPSocket(&eee); - } -#endif - -#ifdef __ANDROID_NDK__ - if (FD_ISSET(mgmt_sock, &socket_mask)) - { - keep_running = 0; - } -#endif /* #ifdef __ANDROID_NDK__ */ - - } - - update_registrations(&eee); - - numPurged = purge_expired_registrations( &(eee.known_peers) ); - numPurged += purge_expired_registrations( &(eee.pending_peers) ); - if ( numPurged > 0 ) - { - traceEvent( TRACE_NORMAL, "Peer removed: pending=%ld, operational=%ld", - peer_list_size( eee.pending_peers ), peer_list_size( eee.known_peers ) ); - } - - if ( ( nowTime - lastStatus ) > STATUS_UPDATE_INTERVAL ) - { - lastStatus = nowTime; - - traceEvent( TRACE_NORMAL, "STATUS: pending=%ld, operational=%ld", - peer_list_size( eee.pending_peers ), peer_list_size( eee.known_peers ) ); - } - -#ifdef __ANDROID_NDK__ - if ((nowTime - lastArpPeriod) > ARP_PERIOD_INTERVAL) { - uip_arp_timer(); - lastArpPeriod = nowTime; - } -#endif /* #ifdef __ANDROID_NDK__ */ - } /* while */ - - send_deregister( &eee, &(eee.supernode)); - - closesocket(eee.sinfo.sock); -#ifdef __ANDROID_NDK__ - closesocket(mgmt_sock); -#endif /* #ifdef __ANDROID_NDK__ */ - tuntap_close(&(eee.device)); - -#ifdef __ANDROID_NDK__ - traceEvent(TRACE_NORMAL, "Edge stoped."); - if (!slog) { - closeslog(slog); - slog = NULL; - } -#endif /* #ifdef __ANDROID_NDK__ */ - - edge_deinit( &eee ); - - return(0); -} - -#ifdef __ANDROID_NDK__ -int stop_edge_v1(void) -{ - keep_running = 0; - - // quick stop - int fd = open_socket(0, 1, 0); - if (fd < 0) { - return 1; - } - - struct sockaddr_in peer_addr; - peer_addr.sin_family = PF_INET; - peer_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - peer_addr.sin_port = htons(N2N_EDGE_MGMT_PORT); - sendto(fd, "", 1, 0, (struct sockaddr *)&peer_addr, sizeof(struct sockaddr_in)); - close(fd); - - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_DISCONNECT; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - - return 0; -} -#endif /* #ifdef __ANDROID_NDK__ */ diff --git a/bundles/n2n_meyerd/n2n_v1/lzoconf.h b/bundles/n2n_meyerd/n2n_v1/lzoconf.h deleted file mode 100644 index cc437f1e..00000000 --- a/bundles/n2n_meyerd/n2n_v1/lzoconf.h +++ /dev/null @@ -1,417 +0,0 @@ -/* lzoconf.h -- configuration for the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __LZOCONF_H_INCLUDED -#define __LZOCONF_H_INCLUDED - -#define LZO_VERSION 0x2030 -#define LZO_VERSION_STRING "2.03" -#define LZO_VERSION_DATE "Apr 30 2008" - -/* internal Autoconf configuration file - only used when building LZO */ -#if defined(LZO_HAVE_CONFIG_H) -# include -#endif -#include -#include - - -/*********************************************************************** -// LZO requires a conforming -************************************************************************/ - -#if !defined(CHAR_BIT) || (CHAR_BIT != 8) -# error "invalid CHAR_BIT" -#endif -#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) -# error "check your compiler installation" -#endif -#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) -# error "your limits.h macros are broken" -#endif - -/* get OS and architecture defines */ -#ifndef __LZODEFS_H_INCLUDED -#include "lzodefs.h" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/*********************************************************************** -// some core defines -************************************************************************/ - -#if !defined(LZO_UINT32_C) -# if (UINT_MAX < LZO_0xffffffffL) -# define LZO_UINT32_C(c) c ## UL -# else -# define LZO_UINT32_C(c) ((c) + 0U) -# endif -#endif - -/* memory checkers */ -#if !defined(__LZO_CHECKER) -# if defined(__BOUNDS_CHECKING_ON) -# define __LZO_CHECKER 1 -# elif defined(__CHECKER__) -# define __LZO_CHECKER 1 -# elif defined(__INSURE__) -# define __LZO_CHECKER 1 -# elif defined(__PURIFY__) -# define __LZO_CHECKER 1 -# endif -#endif - - -/*********************************************************************** -// integral and pointer types -************************************************************************/ - -/* lzo_uint should match size_t */ -#if !defined(LZO_UINT_MAX) -# if defined(LZO_ABI_LLP64) /* WIN64 */ -# if defined(LZO_OS_WIN64) - typedef unsigned __int64 lzo_uint; - typedef __int64 lzo_int; -# else - typedef unsigned long long lzo_uint; - typedef long long lzo_int; -# endif -# define LZO_UINT_MAX 0xffffffffffffffffull -# define LZO_INT_MAX 9223372036854775807LL -# define LZO_INT_MIN (-1LL - LZO_INT_MAX) -# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */ - typedef unsigned int lzo_uint; - typedef int lzo_int; -# define LZO_UINT_MAX UINT_MAX -# define LZO_INT_MAX INT_MAX -# define LZO_INT_MIN INT_MIN -# elif (ULONG_MAX >= LZO_0xffffffffL) - typedef unsigned long lzo_uint; - typedef long lzo_int; -# define LZO_UINT_MAX ULONG_MAX -# define LZO_INT_MAX LONG_MAX -# define LZO_INT_MIN LONG_MIN -# else -# error "lzo_uint" -# endif -#endif - -/* Integral types with 32 bits or more. */ -#if !defined(LZO_UINT32_MAX) -# if (UINT_MAX >= LZO_0xffffffffL) - typedef unsigned int lzo_uint32; - typedef int lzo_int32; -# define LZO_UINT32_MAX UINT_MAX -# define LZO_INT32_MAX INT_MAX -# define LZO_INT32_MIN INT_MIN -# elif (ULONG_MAX >= LZO_0xffffffffL) - typedef unsigned long lzo_uint32; - typedef long lzo_int32; -# define LZO_UINT32_MAX ULONG_MAX -# define LZO_INT32_MAX LONG_MAX -# define LZO_INT32_MIN LONG_MIN -# else -# error "lzo_uint32" -# endif -#endif - -/* The larger type of lzo_uint and lzo_uint32. */ -#if (LZO_UINT_MAX >= LZO_UINT32_MAX) -# define lzo_xint lzo_uint -#else -# define lzo_xint lzo_uint32 -#endif - -/* Memory model that allows to access memory at offsets of lzo_uint. */ -#if !defined(__LZO_MMODEL) -# if (LZO_UINT_MAX <= UINT_MAX) -# define __LZO_MMODEL -# elif defined(LZO_HAVE_MM_HUGE_PTR) -# define __LZO_MMODEL_HUGE 1 -# define __LZO_MMODEL __huge -# else -# define __LZO_MMODEL -# endif -#endif - -/* no typedef here because of const-pointer issues */ -#define lzo_bytep unsigned char __LZO_MMODEL * -#define lzo_charp char __LZO_MMODEL * -#define lzo_voidp void __LZO_MMODEL * -#define lzo_shortp short __LZO_MMODEL * -#define lzo_ushortp unsigned short __LZO_MMODEL * -#define lzo_uint32p lzo_uint32 __LZO_MMODEL * -#define lzo_int32p lzo_int32 __LZO_MMODEL * -#define lzo_uintp lzo_uint __LZO_MMODEL * -#define lzo_intp lzo_int __LZO_MMODEL * -#define lzo_xintp lzo_xint __LZO_MMODEL * -#define lzo_voidpp lzo_voidp __LZO_MMODEL * -#define lzo_bytepp lzo_bytep __LZO_MMODEL * -/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */ -#define lzo_byte unsigned char __LZO_MMODEL - -typedef int lzo_bool; - - -/*********************************************************************** -// function types -************************************************************************/ - -/* name mangling */ -#if !defined(__LZO_EXTERN_C) -# ifdef __cplusplus -# define __LZO_EXTERN_C extern "C" -# else -# define __LZO_EXTERN_C extern -# endif -#endif - -/* calling convention */ -#if !defined(__LZO_CDECL) -# define __LZO_CDECL __lzo_cdecl -#endif - -/* DLL export information */ -#if !defined(__LZO_EXPORT1) -# define __LZO_EXPORT1 -#endif -#if !defined(__LZO_EXPORT2) -# define __LZO_EXPORT2 -#endif - -/* __cdecl calling convention for public C and assembly functions */ -#if !defined(LZO_PUBLIC) -# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL -#endif -#if !defined(LZO_EXTERN) -# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype) -#endif -#if !defined(LZO_PRIVATE) -# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL -#endif - -/* function types */ -typedef int -(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem, - const lzo_bytep dict, lzo_uint dict_len ); - -typedef int -(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem, - const lzo_bytep dict, lzo_uint dict_len ); - - -/* Callback interface. Currently only the progress indicator ("nprogress") - * is used, but this may change in a future release. */ - -struct lzo_callback_t; -typedef struct lzo_callback_t lzo_callback_t; -#define lzo_callback_p lzo_callback_t __LZO_MMODEL * - -/* malloc & free function types */ -typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t) - (lzo_callback_p self, lzo_uint items, lzo_uint size); -typedef void (__LZO_CDECL *lzo_free_func_t) - (lzo_callback_p self, lzo_voidp ptr); - -/* a progress indicator callback function */ -typedef void (__LZO_CDECL *lzo_progress_func_t) - (lzo_callback_p, lzo_uint, lzo_uint, int); - -struct lzo_callback_t -{ - /* custom allocators (set to 0 to disable) */ - lzo_alloc_func_t nalloc; /* [not used right now] */ - lzo_free_func_t nfree; /* [not used right now] */ - - /* a progress indicator callback function (set to 0 to disable) */ - lzo_progress_func_t nprogress; - - /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress - * callbacks points back to this struct, so you are free to store - * some extra info in the following variables. */ - lzo_voidp user1; - lzo_xint user2; - lzo_xint user3; -}; - - -/*********************************************************************** -// error codes and prototypes -************************************************************************/ - -/* Error codes for the compression/decompression functions. Negative - * values are errors, positive values will be used for special but - * normal events. - */ -#define LZO_E_OK 0 -#define LZO_E_ERROR (-1) -#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */ -#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ -#define LZO_E_INPUT_OVERRUN (-4) -#define LZO_E_OUTPUT_OVERRUN (-5) -#define LZO_E_LOOKBEHIND_OVERRUN (-6) -#define LZO_E_EOF_NOT_FOUND (-7) -#define LZO_E_INPUT_NOT_CONSUMED (-8) -#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ - - -#ifndef lzo_sizeof_dict_t -# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep)) -#endif - -/* lzo_init() should be the first function you call. - * Check the return code ! - * - * lzo_init() is a macro to allow checking that the library and the - * compiler's view of various types are consistent. - */ -#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ - (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\ - (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ - (int)sizeof(lzo_callback_t)) -LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int); - -/* version functions (useful for shared libraries) */ -LZO_EXTERN(unsigned) lzo_version(void); -LZO_EXTERN(const char *) lzo_version_string(void); -LZO_EXTERN(const char *) lzo_version_date(void); -LZO_EXTERN(const lzo_charp) _lzo_version_string(void); -LZO_EXTERN(const lzo_charp) _lzo_version_date(void); - -/* string functions */ -LZO_EXTERN(int) -lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len); -LZO_EXTERN(lzo_voidp) -lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); -LZO_EXTERN(lzo_voidp) -lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); -LZO_EXTERN(lzo_voidp) -lzo_memset(lzo_voidp _s, int _c, lzo_uint _len); - -/* checksum functions */ -LZO_EXTERN(lzo_uint32) -lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len); -LZO_EXTERN(lzo_uint32) -lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len); -LZO_EXTERN(const lzo_uint32p) -lzo_get_crc32_table(void); - -/* misc. */ -LZO_EXTERN(int) _lzo_config_check(void); -typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u; -typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u; -typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t; - -/* align a char pointer on a boundary that is a multiple of `size' */ -LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size); -#define LZO_PTR_ALIGN_UP(_ptr,_size) \ - ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size))) - - -/*********************************************************************** -// deprecated macros - only for backward compatibility with LZO v1.xx -************************************************************************/ - -#if defined(LZO_CFG_COMPAT) - -#define __LZOCONF_H 1 - -#if defined(LZO_ARCH_I086) -# define __LZO_i386 1 -#elif defined(LZO_ARCH_I386) -# define __LZO_i386 1 -#endif - -#if defined(LZO_OS_DOS16) -# define __LZO_DOS 1 -# define __LZO_DOS16 1 -#elif defined(LZO_OS_DOS32) -# define __LZO_DOS 1 -#elif defined(LZO_OS_WIN16) -# define __LZO_WIN 1 -# define __LZO_WIN16 1 -#elif defined(LZO_OS_WIN32) -# define __LZO_WIN 1 -#endif - -#define __LZO_CMODEL -#define __LZO_DMODEL -#define __LZO_ENTRY __LZO_CDECL -#define LZO_EXTERN_CDECL LZO_EXTERN -#define LZO_ALIGN LZO_PTR_ALIGN_UP - -#define lzo_compress_asm_t lzo_compress_t -#define lzo_decompress_asm_t lzo_decompress_t - -#endif /* LZO_CFG_COMPAT */ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* already included */ - - -/* vim:set ts=4 et: */ diff --git a/bundles/n2n_meyerd/n2n_v1/lzodefs.h b/bundles/n2n_meyerd/n2n_v1/lzodefs.h deleted file mode 100644 index 18056372..00000000 --- a/bundles/n2n_meyerd/n2n_v1/lzodefs.h +++ /dev/null @@ -1,1807 +0,0 @@ -/* lzodefs.h -- architecture, OS and compiler specific defines - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __LZODEFS_H_INCLUDED -#define __LZODEFS_H_INCLUDED 1 - -#if defined(__CYGWIN32__) && !defined(__CYGWIN__) -# define __CYGWIN__ __CYGWIN32__ -#endif -#if defined(__IBMCPP__) && !defined(__IBMC__) -# define __IBMC__ __IBMCPP__ -#endif -#if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) -# define __INTEL_COMPILER __ICL -#endif -#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) -# define _ALL_SOURCE 1 -#endif -#if defined(__mips__) && defined(__R5900__) -# if !defined(__LONG_MAX__) -# define __LONG_MAX__ 9223372036854775807L -# endif -#endif -#if defined(__INTEL_COMPILER) && defined(__linux__) -# pragma warning(disable: 193) -#endif -#if defined(__KEIL__) && defined(__C166__) -# pragma warning disable = 322 -#elif 0 && defined(__C251__) -# pragma warning disable = 322 -#endif -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -# if (_MSC_VER >= 1300) -# pragma warning(disable: 4668) -# endif -#endif -#if 0 && defined(__WATCOMC__) -# if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) -# pragma warning 203 9 -# endif -#endif -#if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) -# pragma option -h -#endif -#if 0 -#define LZO_0xffffL 0xfffful -#define LZO_0xffffffffL 0xfffffffful -#else -#define LZO_0xffffL 65535ul -#define LZO_0xffffffffL 4294967295ul -#endif -#if (LZO_0xffffL == LZO_0xffffffffL) -# error "your preprocessor is broken 1" -#endif -#if (16ul * 16384ul != 262144ul) -# error "your preprocessor is broken 2" -#endif -#if 0 -#if (32767 >= 4294967295ul) -# error "your preprocessor is broken 3" -#endif -#if (65535u >= 4294967295ul) -# error "your preprocessor is broken 4" -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) -# if !defined(MSDOS) -# define MSDOS 1 -# endif -# if !defined(_MSDOS) -# define _MSDOS 1 -# endif -#elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) -# if (__VERSION == 520) && (MB_LEN_MAX == 1) -# if !defined(__AZTEC_C__) -# define __AZTEC_C__ __VERSION -# endif -# if !defined(__DOS__) -# define __DOS__ 1 -# endif -# endif -#endif -#endif -#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) -# define ptrdiff_t long -# define _PTRDIFF_T_DEFINED -#endif -#if (UINT_MAX == LZO_0xffffL) -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -# if defined(__AZTEC_C__) && defined(__DOS__) -# define __LZO_RENAME_A 1 -# elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define __LZO_RENAME_A 1 -# elif (_MSC_VER < 700) -# define __LZO_RENAME_B 1 -# endif -# elif defined(__TSC__) && defined(__OS2__) -# define __LZO_RENAME_A 1 -# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) -# define __LZO_RENAME_A 1 -# elif defined(__PACIFIC__) && defined(DOS) -# if !defined(__far) -# define __far far -# endif -# if !defined(__near) -# define __near near -# endif -# endif -# if defined(__LZO_RENAME_A) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif -# if !defined(__huge) -# define __huge huge -# endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# if !defined(__huge) -# define __huge huge -# endif -# elif defined(__LZO_RENAME_B) -# if !defined(__cdecl) -# define __cdecl _cdecl -# endif -# if !defined(__far) -# define __far _far -# endif -# if !defined(__huge) -# define __huge _huge -# endif -# if !defined(__near) -# define __near _near -# endif -# if !defined(__pascal) -# define __pascal _pascal -# endif -# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# endif -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__AZTEC_C__) && defined(__DOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -#elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# endif -# if (_MSC_VER < 700) -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# define LZO_BROKEN_SIZEOF 1 -# endif -#elif defined(__PACIFIC__) && defined(DOS) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#elif defined(__TURBOC__) && defined(__MSDOS__) -# if (__TURBOC__ < 0x0150) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# endif -# if (__TURBOC__ < 0x0200) -# define LZO_BROKEN_SIZEOF 1 -# endif -# if (__TURBOC__ < 0x0400) && defined(__cplusplus) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# endif -#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_SIZEOF 1 -#endif -#endif -#if defined(__WATCOMC__) && (__WATCOMC__ < 900) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#endif -#if defined(_CRAY) && defined(_CRAY1) -# define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 -#endif -#define LZO_PP_STRINGIZE(x) #x -#define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -#define LZO_PP_CONCAT2(a,b) a ## b -#define LZO_PP_CONCAT3(a,b,c) a ## b ## c -#define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) -#define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) -#define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) -#define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -#if 1 -#define LZO_CPP_STRINGIZE(x) #x -#define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -#define LZO_CPP_CONCAT2(a,b) a ## b -#define LZO_CPP_CONCAT3(a,b,c) a ## b ## c -#define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) -#define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) -#define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) -#define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -#endif -#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) -#if 1 && defined(__cplusplus) -# if !defined(__STDC_CONSTANT_MACROS) -# define __STDC_CONSTANT_MACROS 1 -# endif -# if !defined(__STDC_LIMIT_MACROS) -# define __STDC_LIMIT_MACROS 1 -# endif -#endif -#if defined(__cplusplus) -# define LZO_EXTERN_C extern "C" -#else -# define LZO_EXTERN_C extern -#endif -#if !defined(__LZO_OS_OVERRIDE) -#if defined(LZO_OS_FREESTANDING) -# define LZO_INFO_OS "freestanding" -#elif defined(LZO_OS_EMBEDDED) -# define LZO_INFO_OS "embedded" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_OS_EMBEDDED 1 -# define LZO_INFO_OS "embedded" -#elif defined(__CYGWIN__) && defined(__GNUC__) -# define LZO_OS_CYGWIN 1 -# define LZO_INFO_OS "cygwin" -#elif defined(__EMX__) && defined(__GNUC__) -# define LZO_OS_EMX 1 -# define LZO_INFO_OS "emx" -#elif defined(__BEOS__) -# define LZO_OS_BEOS 1 -# define LZO_INFO_OS "beos" -#elif defined(__Lynx__) -# define LZO_OS_LYNXOS 1 -# define LZO_INFO_OS "lynxos" -#elif defined(__OS400__) -# define LZO_OS_OS400 1 -# define LZO_INFO_OS "os400" -#elif defined(__QNX__) -# define LZO_OS_QNX 1 -# define LZO_INFO_OS "qnx" -#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__BORLANDC__) && defined(__DPMI16__) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -#elif defined(__ZTC__) && defined(DOS386) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__OS2__) || defined(__OS2V2__) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_OS216 1 -# define LZO_INFO_OS "os216" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_OS2 1 -# define LZO_INFO_OS "os2" -# else -# error "check your limits.h header" -# endif -#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) -# define LZO_OS_WIN64 1 -# define LZO_INFO_OS "win64" -#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__MWERKS__) && defined(__INTEL__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_WIN16 1 -# define LZO_INFO_OS "win16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# else -# error "check your limits.h header" -# endif -#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -# else -# error "check your limits.h header" -# endif -#elif defined(__WATCOMC__) -# if defined(__NT__) && (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif defined(__NT__) && (__WATCOMC__ < 1100) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# elif defined(__linux__) || defined(__LINUX__) -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -# else -# error "please specify a target using the -bt compiler option" -# endif -#elif defined(__palmos__) -# define LZO_OS_PALMOS 1 -# define LZO_INFO_OS "palmos" -#elif defined(__TOS__) || defined(__atarist__) -# define LZO_OS_TOS 1 -# define LZO_INFO_OS "tos" -#elif defined(macintosh) && !defined(__ppc__) -# define LZO_OS_MACCLASSIC 1 -# define LZO_INFO_OS "macclassic" -#elif defined(__VMS) -# define LZO_OS_VMS 1 -# define LZO_INFO_OS "vms" -#elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PS2 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "ps2" -#elif (defined(__mips__) && defined(__psp__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PSP 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "psp" -#else -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -#endif -#if (LZO_OS_POSIX) -# if defined(_AIX) || defined(__AIX__) || defined(__aix__) -# define LZO_OS_POSIX_AIX 1 -# define LZO_INFO_OS_POSIX "aix" -# elif defined(__FreeBSD__) -# define LZO_OS_POSIX_FREEBSD 1 -# define LZO_INFO_OS_POSIX "freebsd" -# elif defined(__hpux__) || defined(__hpux) -# define LZO_OS_POSIX_HPUX 1 -# define LZO_INFO_OS_POSIX "hpux" -# elif defined(__INTERIX) -# define LZO_OS_POSIX_INTERIX 1 -# define LZO_INFO_OS_POSIX "interix" -# elif defined(__IRIX__) || defined(__irix__) -# define LZO_OS_POSIX_IRIX 1 -# define LZO_INFO_OS_POSIX "irix" -# elif defined(__linux__) || defined(__linux) || defined(__LINUX__) -# define LZO_OS_POSIX_LINUX 1 -# define LZO_INFO_OS_POSIX "linux" -# elif defined(__APPLE__) || defined(__MACOS__) -# define LZO_OS_POSIX_MACOSX 1 -# define LZO_INFO_OS_POSIX "macosx" -# elif defined(__minix__) || defined(__minix) -# define LZO_OS_POSIX_MINIX 1 -# define LZO_INFO_OS_POSIX "minix" -# elif defined(__NetBSD__) -# define LZO_OS_POSIX_NETBSD 1 -# define LZO_INFO_OS_POSIX "netbsd" -# elif defined(__OpenBSD__) -# define LZO_OS_POSIX_OPENBSD 1 -# define LZO_INFO_OS_POSIX "openbsd" -# elif defined(__osf__) -# define LZO_OS_POSIX_OSF 1 -# define LZO_INFO_OS_POSIX "osf" -# elif defined(__solaris__) || defined(__sun) -# if defined(__SVR4) || defined(__svr4__) -# define LZO_OS_POSIX_SOLARIS 1 -# define LZO_INFO_OS_POSIX "solaris" -# else -# define LZO_OS_POSIX_SUNOS 1 -# define LZO_INFO_OS_POSIX "sunos" -# endif -# elif defined(__ultrix__) || defined(__ultrix) -# define LZO_OS_POSIX_ULTRIX 1 -# define LZO_INFO_OS_POSIX "ultrix" -# elif defined(_UNICOS) -# define LZO_OS_POSIX_UNICOS 1 -# define LZO_INFO_OS_POSIX "unicos" -# else -# define LZO_OS_POSIX_UNKNOWN 1 -# define LZO_INFO_OS_POSIX "unknown" -# endif -#endif -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (UINT_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -# define LZO_CC_CILLY 1 -# define LZO_INFO_CC "Cilly" -# if defined(__CILLY__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) -# define LZO_CC_SDCC 1 -# define LZO_INFO_CC "sdcc" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) -#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) -# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) -# define LZO_INFO_CC "Pathscale C" -# define LZO_INFO_CCVER __PATHSCALE__ -#elif defined(__INTEL_COMPILER) -# define LZO_CC_INTELC 1 -# define LZO_INFO_CC "Intel C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) -# if defined(_WIN32) || defined(_WIN64) -# define LZO_CC_SYNTAX_MSC 1 -# else -# define LZO_CC_SYNTAX_GNUC 1 -# endif -#elif defined(__POCC__) && defined(_WIN32) -# define LZO_CC_PELLESC 1 -# define LZO_INFO_CC "Pelles C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# else -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# endif -# define LZO_INFO_CC "llvm-gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# elif defined(__GNUC_MINOR__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# else -# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -# endif -# define LZO_INFO_CC "gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__ACK__) && defined(_ACK) -# define LZO_CC_ACK 1 -# define LZO_INFO_CC "Amsterdam Compiler Kit C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__AZTEC_C__) -# define LZO_CC_AZTECC 1 -# define LZO_INFO_CC "Aztec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) -#elif defined(__BORLANDC__) -# define LZO_CC_BORLANDC 1 -# define LZO_INFO_CC "Borland C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) -#elif defined(_CRAYC) && defined(_RELEASE) -# define LZO_CC_CRAYC 1 -# define LZO_INFO_CC "Cray C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) -#elif defined(__DMC__) && defined(__SC__) -# define LZO_CC_DMC 1 -# define LZO_INFO_CC "Digital Mars C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) -#elif defined(__DECC) -# define LZO_CC_DECC 1 -# define LZO_INFO_CC "DEC C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -#elif defined(__HIGHC__) -# define LZO_CC_HIGHC 1 -# define LZO_INFO_CC "MetaWare High C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__IAR_SYSTEMS_ICC__) -# define LZO_CC_IARC 1 -# define LZO_INFO_CC "IAR C" -# if defined(__VER__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__IBMC__) -# define LZO_CC_IBMC 1 -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -#elif defined(__KEIL__) && defined(__C166__) -# define LZO_CC_KEILC 1 -# define LZO_INFO_CC "Keil C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) -#elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) -# define LZO_CC_LCCWIN32 1 -# define LZO_INFO_CC "lcc-win32" -# define LZO_INFO_CCVER "unknown" -#elif defined(__LCC__) -# define LZO_CC_LCC 1 -# define LZO_INFO_CC "lcc" -# if defined(__LCC_VERSION__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(_MSC_VER) -# define LZO_CC_MSC 1 -# define LZO_INFO_CC "Microsoft C" -# if defined(_MSC_FULL_VER) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -# endif -#elif defined(__MWERKS__) -# define LZO_CC_MWERKS 1 -# define LZO_INFO_CC "Metrowerks C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) -#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -# define LZO_CC_NDPC 1 -# define LZO_INFO_CC "Microway NDP C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PACIFIC__) -# define LZO_CC_PACIFICC 1 -# define LZO_INFO_CC "Pacific C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) -# define LZO_CC_PGI 1 -# define LZO_INFO_CC "Portland Group PGI C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PUREC__) && defined(__TOS__) -# define LZO_CC_PUREC 1 -# define LZO_INFO_CC "Pure C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) -#elif defined(__SC__) && defined(__ZTC__) -# define LZO_CC_SYMANTECC 1 -# define LZO_INFO_CC "Symantec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) -#elif defined(__SUNPRO_C) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_C)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_C -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__SUNPRO_CC) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_CC)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_CC -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__TINYC__) -# define LZO_CC_TINYC 1 -# define LZO_INFO_CC "Tiny C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) -#elif defined(__TSC__) -# define LZO_CC_TOPSPEEDC 1 -# define LZO_INFO_CC "TopSpeed C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) -#elif defined(__WATCOMC__) -# define LZO_CC_WATCOMC 1 -# define LZO_INFO_CC "Watcom C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) -#elif defined(__TURBOC__) -# define LZO_CC_TURBOC 1 -# define LZO_INFO_CC "Turbo C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) -#elif defined(__ZTC__) -# define LZO_CC_ZORTECHC 1 -# define LZO_INFO_CC "Zortech C" -# if (__ZTC__ == 0x310) -# define LZO_INFO_CCVER "0x310" -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) -# endif -#else -# define LZO_CC_UNKNOWN 1 -# define LZO_INFO_CC "unknown" -# define LZO_INFO_CCVER "unknown" -#endif -#if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) -# error "LZO_CC_MSC: _MSC_FULL_VER is not defined" -#endif -#if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) -# if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) -# if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) -# define LZO_ARCH_CRAY_MPP 1 -# elif defined(_CRAY1) -# define LZO_ARCH_CRAY_PVP 1 -# endif -# endif -#endif -#if !defined(__LZO_ARCH_OVERRIDE) -#if defined(LZO_ARCH_GENERIC) -# define LZO_INFO_ARCH "generic" -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086 1 -# define LZO_ARCH_IA16 1 -# define LZO_INFO_ARCH "i086" -#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) -# define LZO_ARCH_AMD64 1 -# define LZO_INFO_ARCH "amd64" -#elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB)) -# define LZO_ARCH_ARM 1 -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) -# define LZO_ARCH_ARM 1 -# if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -# elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) -# define LZO_INFO_ARCH "arm" -# else -# define LZO_INFO_ARCH "arm" -# endif -#elif defined(__arm__) || defined(_M_ARM) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) -# define LZO_ARCH_AVR 1 -# define LZO_INFO_ARCH "avr" -#elif defined(__bfin__) -# define LZO_ARCH_BLACKFIN 1 -# define LZO_INFO_ARCH "blackfin" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) -# define LZO_ARCH_C166 1 -# define LZO_INFO_ARCH "c166" -#elif defined(__cris__) -# define LZO_ARCH_CRIS 1 -# define LZO_INFO_ARCH "cris" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) -# define LZO_ARCH_EZ80 1 -# define LZO_INFO_ARCH "ez80" -#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_ARCH_H8300 1 -# define LZO_INFO_ARCH "h8300" -#elif defined(__hppa__) || defined(__hppa) -# define LZO_ARCH_HPPA 1 -# define LZO_INFO_ARCH "hppa" -#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_CC_ZORTECHC && defined(__I86__)) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) -# define LZO_ARCH_IA64 1 -# define LZO_INFO_ARCH "ia64" -#elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__m32r__) -# define LZO_ARCH_M32R 1 -# define LZO_INFO_ARCH "m32r" -#elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) -# define LZO_ARCH_M68K 1 -# define LZO_INFO_ARCH "m68k" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) -# define LZO_ARCH_MCS251 1 -# define LZO_INFO_ARCH "mcs251" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) -# define LZO_ARCH_MIPS 1 -# define LZO_INFO_ARCH "mips" -#elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) -# define LZO_ARCH_S390 1 -# define LZO_INFO_ARCH "s390" -#elif defined(__sh__) || defined(_M_SH) -# define LZO_ARCH_SH 1 -# define LZO_INFO_ARCH "sh" -#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) -# define LZO_ARCH_SPARC 1 -# define LZO_INFO_ARCH "sparc" -#elif defined(__SPU__) -# define LZO_ARCH_SPU 1 -# define LZO_INFO_ARCH "spu" -#elif (UINT_MAX == LZO_0xffffL) && defined(__z80) -# define LZO_ARCH_Z80 1 -# define LZO_INFO_ARCH "z80" -#elif (LZO_ARCH_CRAY_PVP) -# if defined(_CRAYSV1) -# define LZO_ARCH_CRAY_SV1 1 -# define LZO_INFO_ARCH "cray_sv1" -# elif (_ADDR64) -# define LZO_ARCH_CRAY_T90 1 -# define LZO_INFO_ARCH "cray_t90" -# elif (_ADDR32) -# define LZO_ARCH_CRAY_YMP 1 -# define LZO_INFO_ARCH "cray_ymp" -# else -# define LZO_ARCH_CRAY_XMP 1 -# define LZO_INFO_ARCH "cray_xmp" -# endif -#else -# define LZO_ARCH_UNKNOWN 1 -# define LZO_INFO_ARCH "unknown" -#endif -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) -# error "FIXME - missing define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) -# error "FIXME - missing WIN32 define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) -# error "FIXME - missing WIN64 define for CPU architecture" -#endif -#if (LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(BLX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#endif -#if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) -# error "this should not happen" -#endif -#if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) -# error "this should not happen" -#endif -#if (LZO_ARCH_I086) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_ARCH_I386) -# if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) -# error "this should not happen" -# endif -# if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if !defined(__LZO_MM_OVERRIDE) -#if (LZO_ARCH_I086) -#if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -#endif -#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) -# define LZO_MM_TINY 1 -#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) -# define LZO_MM_HUGE 1 -#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) -# define LZO_MM_SMALL 1 -#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) -# define LZO_MM_MEDIUM 1 -#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) -# define LZO_MM_COMPACT 1 -#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) -# define LZO_MM_LARGE 1 -#elif (LZO_CC_AZTECC) -# if defined(_LARGE_CODE) && defined(_LARGE_DATA) -# define LZO_MM_LARGE 1 -# elif defined(_LARGE_CODE) -# define LZO_MM_MEDIUM 1 -# elif defined(_LARGE_DATA) -# define LZO_MM_COMPACT 1 -# else -# define LZO_MM_SMALL 1 -# endif -#elif (LZO_CC_ZORTECHC && defined(__VCM__)) -# define LZO_MM_LARGE 1 -#else -# error "unknown memory model" -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -#define LZO_HAVE_MM_HUGE_PTR 1 -#define LZO_HAVE_MM_HUGE_ARRAY 1 -#if (LZO_MM_TINY) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) -# undef LZO_HAVE_MM_HUGE_PTR -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_MSC && defined(_QC)) -# undef LZO_HAVE_MM_HUGE_ARRAY -# if (_MSC_VER < 600) -# undef LZO_HAVE_MM_HUGE_PTR -# endif -#elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) -# if (LZO_OS_DOS16) -# error "this should not happen" -# elif (LZO_CC_ZORTECHC) -# else -# error "this should not happen" -# endif -#endif -#ifdef __cplusplus -extern "C" { -#endif -#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) -# define LZO_MM_AHSHIFT 12 -#elif (LZO_CC_WATCOMC) - extern unsigned char _HShift; -# define LZO_MM_AHSHIFT ((unsigned) _HShift) -#else -# error "FIXME - implement LZO_MM_AHSHIFT" -#endif -#ifdef __cplusplus -} -#endif -#endif -#elif (LZO_ARCH_C166) -#if !defined(__MODEL__) -# error "FIXME - C166 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - C166 __MODEL__" -#endif -#elif (LZO_ARCH_MCS251) -#if !defined(__MODEL__) -# error "FIXME - MCS251 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS251 __MODEL__" -#endif -#elif (LZO_ARCH_MCS51) -#if !defined(__MODEL__) -# error "FIXME - MCS51 __MODEL__" -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS51 __MODEL__" -#endif -#elif (LZO_ARCH_CRAY_PVP) -# define LZO_MM_PVP 1 -#else -# define LZO_MM_FLAT 1 -#endif -#if (LZO_MM_COMPACT) -# define LZO_INFO_MM "compact" -#elif (LZO_MM_FLAT) -# define LZO_INFO_MM "flat" -#elif (LZO_MM_HUGE) -# define LZO_INFO_MM "huge" -#elif (LZO_MM_LARGE) -# define LZO_INFO_MM "large" -#elif (LZO_MM_MEDIUM) -# define LZO_INFO_MM "medium" -#elif (LZO_MM_PVP) -# define LZO_INFO_MM "pvp" -#elif (LZO_MM_SMALL) -# define LZO_INFO_MM "small" -#elif (LZO_MM_TINY) -# define LZO_INFO_MM "tiny" -#else -# error "unknown memory model" -#endif -#endif -#if defined(SIZEOF_SHORT) -# define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -#endif -#if defined(SIZEOF_INT) -# define LZO_SIZEOF_INT (SIZEOF_INT) -#endif -#if defined(SIZEOF_LONG) -# define LZO_SIZEOF_LONG (SIZEOF_LONG) -#endif -#if defined(SIZEOF_LONG_LONG) -# define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -#endif -#if defined(SIZEOF___INT16) -# define LZO_SIZEOF___INT16 (SIZEOF___INT16) -#endif -#if defined(SIZEOF___INT32) -# define LZO_SIZEOF___INT32 (SIZEOF___INT32) -#endif -#if defined(SIZEOF___INT64) -# define LZO_SIZEOF___INT64 (SIZEOF___INT64) -#endif -#if defined(SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -#endif -#if defined(SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -#endif -#if defined(SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -#endif -#define __LZO_LSR(x,b) (((x)+0ul) >> (b)) -#if !defined(LZO_SIZEOF_SHORT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_SHORT 8 -# elif (USHRT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,7) == 1) -# define LZO_SIZEOF_SHORT 1 -# elif (__LZO_LSR(USHRT_MAX,15) == 1) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,31) == 1) -# define LZO_SIZEOF_SHORT 4 -# elif (__LZO_LSR(USHRT_MAX,63) == 1) -# define LZO_SIZEOF_SHORT 8 -# elif (__LZO_LSR(USHRT_MAX,127) == 1) -# define LZO_SIZEOF_SHORT 16 -# else -# error "LZO_SIZEOF_SHORT" -# endif -#endif -#if !defined(LZO_SIZEOF_INT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_INT 8 -# elif (UINT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_INT 2 -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,7) == 1) -# define LZO_SIZEOF_INT 1 -# elif (__LZO_LSR(UINT_MAX,15) == 1) -# define LZO_SIZEOF_INT 2 -# elif (__LZO_LSR(UINT_MAX,31) == 1) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,63) == 1) -# define LZO_SIZEOF_INT 8 -# elif (__LZO_LSR(UINT_MAX,127) == 1) -# define LZO_SIZEOF_INT 16 -# else -# error "LZO_SIZEOF_INT" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG) -# if (ULONG_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,7) == 1) -# define LZO_SIZEOF_LONG 1 -# elif (__LZO_LSR(ULONG_MAX,15) == 1) -# define LZO_SIZEOF_LONG 2 -# elif (__LZO_LSR(ULONG_MAX,31) == 1) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,63) == 1) -# define LZO_SIZEOF_LONG 8 -# elif (__LZO_LSR(ULONG_MAX,127) == 1) -# define LZO_SIZEOF_LONG 16 -# else -# error "LZO_SIZEOF_LONG" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -# if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) -# if (LZO_CC_GNUC >= 0x030300ul) -# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) -# define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG -# elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) -# define LZO_SIZEOF_LONG_LONG 4 -# endif -# endif -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -#if (LZO_ARCH_I086 && LZO_CC_DMC) -#elif (LZO_CC_CILLY) && defined(__GNUC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_SIZEOF_LONG_LONG 8 -#elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_OS_WIN64 || defined(_WIN64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_DMC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) -#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define LZO_SIZEOF_LONG_LONG 8 -#endif -#endif -#endif -#if defined(__cplusplus) && defined(LZO_CC_GNUC) -# if (LZO_CC_GNUC < 0x020800ul) -# undef LZO_SIZEOF_LONG_LONG -# endif -#endif -#if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#endif -#if !defined(LZO_SIZEOF_VOID_P) -#if (LZO_ARCH_I086) -# define __LZO_WORDSIZE 2 -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -# define LZO_SIZEOF_VOID_P 2 -# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -# define LZO_SIZEOF_VOID_P 4 -# else -# error "LZO_MM" -# endif -#elif (LZO_ARCH_AVR || LZO_ARCH_Z80) -# define __LZO_WORDSIZE 1 -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_H8300) -# if defined(__NORMAL_MODE__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 2 -# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 4 -# else -# define __LZO_WORDSIZE 2 -# define LZO_SIZEOF_VOID_P 2 -# endif -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT -# endif -#elif (LZO_ARCH_M16C) -# define __LZO_WORDSIZE 2 -# if defined(__m32c_cpu__) || defined(__m32cm_cpu__) -# define LZO_SIZEOF_VOID_P 4 -# else -# define LZO_SIZEOF_VOID_P 2 -# endif -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 4 -#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_OS_OS400 || defined(__OS400__)) -# define __LZO_WORDSIZE LZO_SIZEOF_LONG -# define LZO_SIZEOF_VOID_P 16 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_ARCH_SPU) -# if 0 -# define __LZO_WORDSIZE 16 -# endif -# define LZO_SIZEOF_VOID_P 4 -#else -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -#endif -#endif -#if !defined(LZO_WORDSIZE) -# if defined(__LZO_WORDSIZE) -# define LZO_WORDSIZE __LZO_WORDSIZE -# else -# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -# endif -#endif -#if !defined(LZO_SIZEOF_SIZE_T) -#if (LZO_ARCH_I086 || LZO_ARCH_M16C) -# define LZO_SIZEOF_SIZE_T 2 -#else -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P -#endif -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -#if (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P -# elif (LZO_MM_COMPACT || LZO_MM_LARGE) -# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) -# define LZO_SIZEOF_PTRDIFF_T 4 -# else -# define LZO_SIZEOF_PTRDIFF_T 2 -# endif -# else -# error "LZO_MM" -# endif -#else -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T -#endif -#endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) -# undef LZO_ABI_BIG_ENDIAN -# undef LZO_ABI_LITTLE_ENDIAN -#elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) -#if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) -# define LZO_ABI_BIG_ENDIAN 1 -#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_M68K || LZO_ARCH_S390) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) -# if (__LITTLE_ENDIAN__ == 1) -# define LZO_ABI_LITTLE_ENDIAN 1 -# else -# define LZO_ABI_BIG_ENDIAN 1 -# endif -#elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#endif -#endif -#if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) -# error "this should not happen" -#endif -#if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "be" -#elif defined(LZO_ABI_LITTLE_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "le" -#elif defined(LZO_ABI_NEUTRAL_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "neutral" -#endif -#if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_I8LP16 1 -# define LZO_INFO_ABI_PM "i8lp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_ILP16 1 -# define LZO_INFO_ABI_PM "ilp16" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_ILP32 1 -# define LZO_INFO_ABI_PM "ilp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) -# define LZO_ABI_LLP64 1 -# define LZO_INFO_ABI_PM "llp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_LP64 1 -# define LZO_INFO_ABI_PM "lp64" -#elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_ILP64 1 -# define LZO_INFO_ABI_PM "ilp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_IP32L64 1 -# define LZO_INFO_ABI_PM "ip32l64" -#endif -#if !defined(__LZO_LIBC_OVERRIDE) -#if defined(LZO_LIBC_NAKED) -# define LZO_INFO_LIBC "naked" -#elif defined(LZO_LIBC_FREESTANDING) -# define LZO_INFO_LIBC "freestanding" -#elif defined(LZO_LIBC_MOSTLY_FREESTANDING) -# define LZO_INFO_LIBC "mfreestanding" -#elif defined(LZO_LIBC_ISOC90) -# define LZO_INFO_LIBC "isoc90" -#elif defined(LZO_LIBC_ISOC99) -# define LZO_INFO_LIBC "isoc99" -#elif defined(__dietlibc__) -# define LZO_LIBC_DIETLIBC 1 -# define LZO_INFO_LIBC "dietlibc" -#elif defined(_NEWLIB_VERSION) -# define LZO_LIBC_NEWLIB 1 -# define LZO_INFO_LIBC "newlib" -#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) -# if defined(__UCLIBC_SUBLEVEL__) -# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) -# else -# define LZO_LIBC_UCLIBC 0x00090bL -# endif -# define LZO_INFO_LIBC "uclibc" -#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) -# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) -# define LZO_INFO_LIBC "glibc" -#elif (LZO_CC_MWERKS) && defined(__MSL__) -# define LZO_LIBC_MSL __MSL__ -# define LZO_INFO_LIBC "msl" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#else -# define LZO_LIBC_DEFAULT 1 -# define LZO_INFO_LIBC "default" -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -#if (LZO_CC_GNUC >= 0x020800ul) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_gnuc_extension__ __extension__ -#else -# define __lzo_gnuc_extension__ -#endif -#endif -#if !defined(__lzo_ua_volatile) -# define __lzo_ua_volatile volatile -#endif -#if !defined(__lzo_alignof) -#if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_alignof(e) __alignof(e) -#endif -#endif -#if defined(__lzo_alignof) -# define __lzo_HAVE_alignof 1 -#endif -#if !defined(__lzo_constructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_constructor __attribute__((__constructor__)) -#endif -#endif -#if defined(__lzo_constructor) -# define __lzo_HAVE_constructor 1 -#endif -#if !defined(__lzo_destructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_destructor __attribute__((__destructor__)) -#endif -#endif -#if defined(__lzo_destructor) -# define __lzo_HAVE_destructor 1 -#endif -#if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) -# error "this should not happen" -#endif -#if !defined(__lzo_inline) -#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -#elif defined(__cplusplus) -# define __lzo_inline inline -#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -# define __lzo_inline __inline -#elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_inline __inline__ -#elif (LZO_CC_DMC) -# define __lzo_inline __inline -#elif (LZO_CC_INTELC) -# define __lzo_inline __inline -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -# define __lzo_inline __inline -#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -# define __lzo_inline __inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define __lzo_inline inline -#endif -#endif -#if defined(__lzo_inline) -# define __lzo_HAVE_inline 1 -#else -# define __lzo_inline -#endif -#if !defined(__lzo_forceinline) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_forceinline __forceinline -#endif -#endif -#if defined(__lzo_forceinline) -# define __lzo_HAVE_forceinline 1 -#else -# define __lzo_forceinline -#endif -#if !defined(__lzo_noinline) -#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -# define __lzo_noinline __attribute__((__noinline__,__used__)) -#elif (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -# if defined(__cplusplus) -# else -# define __lzo_noinline __declspec(noinline) -# endif -#endif -#endif -#if defined(__lzo_noinline) -# define __lzo_HAVE_noinline 1 -#else -# define __lzo_noinline -#endif -#if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) -# error "this should not happen" -#endif -#if !defined(__lzo_noreturn) -#if (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_noreturn __declspec(noreturn) -#endif -#endif -#if defined(__lzo_noreturn) -# define __lzo_HAVE_noreturn 1 -#else -# define __lzo_noreturn -#endif -#if !defined(__lzo_nothrow) -#if (LZO_CC_GNUC >= 0x030300ul) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#endif -#endif -#if defined(__lzo_nothrow) -# define __lzo_HAVE_nothrow 1 -#else -# define __lzo_nothrow -#endif -#if !defined(__lzo_restrict) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_LLVM) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -# define __lzo_restrict __restrict -#endif -#endif -#if defined(__lzo_restrict) -# define __lzo_HAVE_restrict 1 -#else -# define __lzo_restrict -#endif -#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#endif -#endif -#if defined(__lzo_likely) -# define __lzo_HAVE_likely 1 -#else -# define __lzo_likely(e) (e) -#endif -#if defined(__lzo_unlikely) -# define __lzo_HAVE_unlikely 1 -#else -# define __lzo_unlikely(e) (e) -#endif -#if !defined(LZO_UNUSED) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNUSED(var) ((void) var) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_KEILC) -# define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} -# elif (LZO_CC_PACIFICC) -# define LZO_UNUSED(var) ((void) sizeof(var)) -# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED(var) ((void) var) -# else -# define LZO_UNUSED(var) ((void) &var) -# endif -#endif -#if !defined(LZO_UNUSED_FUNC) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED_FUNC(func) ((void) func) -# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_LLVM) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_MSC) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -# define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} -# else -# define LZO_UNUSED_FUNC(func) ((void) func) -# endif -#endif -#if !defined(LZO_UNUSED_LABEL) -# if (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# elif (LZO_CC_INTELC || LZO_CC_WATCOMC) -# define LZO_UNUSED_LABEL(l) if (0) goto l -# else -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# endif -#endif -#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -# if 0 -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -# elif 0 && (LZO_CC_GNUC) -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -# else -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# else -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT) -# if (LZO_CC_AZTECC) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} -# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# else -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} -# endif -#endif -#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit -# define __lzo_cdecl_main __cdecl -# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_qsort __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_qsort _stdcall -# else -# define __lzo_cdecl_qsort __cdecl -# endif -# elif (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -# else -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit __cdecl -# define __lzo_cdecl_main __cdecl -# define __lzo_cdecl_qsort __cdecl -# endif -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_sighandler __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_sighandler _stdcall -# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -# define __lzo_cdecl_sighandler __clrcall -# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -# if defined(_DLL) -# define __lzo_cdecl_sighandler _far _cdecl _loadds -# elif defined(_MT) -# define __lzo_cdecl_sighandler _far _cdecl -# else -# define __lzo_cdecl_sighandler _cdecl -# endif -# else -# define __lzo_cdecl_sighandler __cdecl -# endif -#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -# define __lzo_cdecl cdecl -#endif -#if !defined(__lzo_cdecl) -# define __lzo_cdecl -#endif -#if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit -#endif -#if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main -#endif -#if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort -#endif -#if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler -#endif -#if !defined(__lzo_cdecl_va) -# define __lzo_cdecl_va __lzo_cdecl -#endif -#if !defined(LZO_CFG_NO_WINDOWS_H) -#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) -# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -# else -# define LZO_HAVE_WINDOWS_H 1 -# endif -#endif -#endif -#if (LZO_ARCH_ALPHA) -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_AMD64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# define LZO_OPT_UNALIGNED64 1 -#elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) -#elif (LZO_ARCH_ARM) -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_CRIS) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_I386) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_IA64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_PREFER_POSTINC 1 -#elif (LZO_ARCH_M68K) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(__mc68020__) && !defined(__mcoldfire__) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_MIPS) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_POWERPC) -# define LZO_OPT_PREFER_PREINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_S390) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# if (LZO_SIZEOF_SIZE_T == 8) -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_SH) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -#endif -#if !defined(LZO_CFG_NO_INLINE_ASM) -#if defined(LZO_CC_LLVM) -# define LZO_CFG_NO_INLINE_ASM 1 -#endif -#endif -#if !defined(LZO_CFG_NO_UNALIGNED) -#if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) -# define LZO_CFG_NO_UNALIGNED 1 -#endif -#endif -#if defined(LZO_CFG_NO_UNALIGNED) -# undef LZO_OPT_UNALIGNED16 -# undef LZO_OPT_UNALIGNED32 -# undef LZO_OPT_UNALIGNED64 -#endif -#if defined(LZO_CFG_NO_INLINE_ASM) -#elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -# define LZO_ASM_SYNTAX_MSC 1 -#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#endif -#if (LZO_ASM_SYNTAX_GNUC) -#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -# define __LZO_ASM_CLOBBER "ax" -#elif (LZO_CC_INTELC) -# define __LZO_ASM_CLOBBER "memory" -#else -# define __LZO_ASM_CLOBBER "cc", "memory" -#endif -#endif -#if defined(__LZO_INFOSTR_MM) -#elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) -# define __LZO_INFOSTR_MM "" -#elif defined(LZO_INFO_MM) -# define __LZO_INFOSTR_MM "." LZO_INFO_MM -#else -# define __LZO_INFOSTR_MM "" -#endif -#if defined(__LZO_INFOSTR_PM) -#elif defined(LZO_INFO_ABI_PM) -# define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM -#else -# define __LZO_INFOSTR_PM "" -#endif -#if defined(__LZO_INFOSTR_ENDIAN) -#elif defined(LZO_INFO_ABI_ENDIAN) -# define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN -#else -# define __LZO_INFOSTR_ENDIAN "" -#endif -#if defined(__LZO_INFOSTR_OSNAME) -#elif defined(LZO_INFO_OS_CONSOLE) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE -#elif defined(LZO_INFO_OS_POSIX) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX -#else -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS -#endif -#if defined(__LZO_INFOSTR_LIBC) -#elif defined(LZO_INFO_LIBC) -# define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC -#else -# define __LZO_INFOSTR_LIBC "" -#endif -#if defined(__LZO_INFOSTR_CCVER) -#elif defined(LZO_INFO_CCVER) -# define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER -#else -# define __LZO_INFOSTR_CCVER "" -#endif -#define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER - -#endif /* already included */ - -/* vim:set ts=4 et: */ diff --git a/bundles/n2n_meyerd/n2n_v1/minilzo.c b/bundles/n2n_meyerd/n2n_v1/minilzo.c deleted file mode 100644 index 6a62b31b..00000000 --- a/bundles/n2n_meyerd/n2n_v1/minilzo.c +++ /dev/null @@ -1,4112 +0,0 @@ -/* minilzo.c -- mini subset of the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - -/* - * NOTE: - * the full LZO package can be found at - * http://www.oberhumer.com/opensource/lzo/ - */ - -#define __LZO_IN_MINILZO -#define LZO_BUILD - -#if defined(LZO_CFG_FREESTANDING) -# undef MINILZO_HAVE_CONFIG_H -# define LZO_LIBC_FREESTANDING 1 -# define LZO_OS_FREESTANDING 1 -#endif - -#ifdef MINILZO_HAVE_CONFIG_H -# include -#endif -#include -#include -#if defined(MINILZO_CFG_USE_INTERNAL_LZODEFS) - -#ifndef __LZODEFS_H_INCLUDED -#define __LZODEFS_H_INCLUDED 1 - -#if defined(__CYGWIN32__) && !defined(__CYGWIN__) -# define __CYGWIN__ __CYGWIN32__ -#endif -#if defined(__IBMCPP__) && !defined(__IBMC__) -# define __IBMC__ __IBMCPP__ -#endif -#if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) -# define __INTEL_COMPILER __ICL -#endif -#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) -# define _ALL_SOURCE 1 -#endif -#if defined(__mips__) && defined(__R5900__) -# if !defined(__LONG_MAX__) -# define __LONG_MAX__ 9223372036854775807L -# endif -#endif -#if defined(__INTEL_COMPILER) && defined(__linux__) -# pragma warning(disable: 193) -#endif -#if defined(__KEIL__) && defined(__C166__) -# pragma warning disable = 322 -#elif 0 && defined(__C251__) -# pragma warning disable = 322 -#endif -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -# if (_MSC_VER >= 1300) -# pragma warning(disable: 4668) -# endif -#endif -#if 0 && defined(__WATCOMC__) -# if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) -# pragma warning 203 9 -# endif -#endif -#if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) -# pragma option -h -#endif -#if 0 -#define LZO_0xffffL 0xfffful -#define LZO_0xffffffffL 0xfffffffful -#else -#define LZO_0xffffL 65535ul -#define LZO_0xffffffffL 4294967295ul -#endif -#if (LZO_0xffffL == LZO_0xffffffffL) -# error "your preprocessor is broken 1" -#endif -#if (16ul * 16384ul != 262144ul) -# error "your preprocessor is broken 2" -#endif -#if 0 -#if (32767 >= 4294967295ul) -# error "your preprocessor is broken 3" -#endif -#if (65535u >= 4294967295ul) -# error "your preprocessor is broken 4" -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) -# if !defined(MSDOS) -# define MSDOS 1 -# endif -# if !defined(_MSDOS) -# define _MSDOS 1 -# endif -#elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) -# if (__VERSION == 520) && (MB_LEN_MAX == 1) -# if !defined(__AZTEC_C__) -# define __AZTEC_C__ __VERSION -# endif -# if !defined(__DOS__) -# define __DOS__ 1 -# endif -# endif -#endif -#endif -#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) -# define ptrdiff_t long -# define _PTRDIFF_T_DEFINED -#endif -#if (UINT_MAX == LZO_0xffffL) -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -# if defined(__AZTEC_C__) && defined(__DOS__) -# define __LZO_RENAME_A 1 -# elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define __LZO_RENAME_A 1 -# elif (_MSC_VER < 700) -# define __LZO_RENAME_B 1 -# endif -# elif defined(__TSC__) && defined(__OS2__) -# define __LZO_RENAME_A 1 -# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) -# define __LZO_RENAME_A 1 -# elif defined(__PACIFIC__) && defined(DOS) -# if !defined(__far) -# define __far far -# endif -# if !defined(__near) -# define __near near -# endif -# endif -# if defined(__LZO_RENAME_A) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif -# if !defined(__huge) -# define __huge huge -# endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# if !defined(__huge) -# define __huge huge -# endif -# elif defined(__LZO_RENAME_B) -# if !defined(__cdecl) -# define __cdecl _cdecl -# endif -# if !defined(__far) -# define __far _far -# endif -# if !defined(__huge) -# define __huge _huge -# endif -# if !defined(__near) -# define __near _near -# endif -# if !defined(__pascal) -# define __pascal _pascal -# endif -# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# endif -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__AZTEC_C__) && defined(__DOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -#elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# endif -# if (_MSC_VER < 700) -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# define LZO_BROKEN_SIZEOF 1 -# endif -#elif defined(__PACIFIC__) && defined(DOS) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#elif defined(__TURBOC__) && defined(__MSDOS__) -# if (__TURBOC__ < 0x0150) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# endif -# if (__TURBOC__ < 0x0200) -# define LZO_BROKEN_SIZEOF 1 -# endif -# if (__TURBOC__ < 0x0400) && defined(__cplusplus) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# endif -#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_SIZEOF 1 -#endif -#endif -#if defined(__WATCOMC__) && (__WATCOMC__ < 900) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#endif -#if defined(_CRAY) && defined(_CRAY1) -# define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 -#endif -#define LZO_PP_STRINGIZE(x) #x -#define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -#define LZO_PP_CONCAT2(a,b) a ## b -#define LZO_PP_CONCAT3(a,b,c) a ## b ## c -#define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) -#define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) -#define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) -#define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -#if 1 -#define LZO_CPP_STRINGIZE(x) #x -#define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -#define LZO_CPP_CONCAT2(a,b) a ## b -#define LZO_CPP_CONCAT3(a,b,c) a ## b ## c -#define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) -#define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) -#define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) -#define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -#endif -#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) -#if 1 && defined(__cplusplus) -# if !defined(__STDC_CONSTANT_MACROS) -# define __STDC_CONSTANT_MACROS 1 -# endif -# if !defined(__STDC_LIMIT_MACROS) -# define __STDC_LIMIT_MACROS 1 -# endif -#endif -#if defined(__cplusplus) -# define LZO_EXTERN_C extern "C" -#else -# define LZO_EXTERN_C extern -#endif -#if !defined(__LZO_OS_OVERRIDE) -#if defined(LZO_OS_FREESTANDING) -# define LZO_INFO_OS "freestanding" -#elif defined(LZO_OS_EMBEDDED) -# define LZO_INFO_OS "embedded" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_OS_EMBEDDED 1 -# define LZO_INFO_OS "embedded" -#elif defined(__CYGWIN__) && defined(__GNUC__) -# define LZO_OS_CYGWIN 1 -# define LZO_INFO_OS "cygwin" -#elif defined(__EMX__) && defined(__GNUC__) -# define LZO_OS_EMX 1 -# define LZO_INFO_OS "emx" -#elif defined(__BEOS__) -# define LZO_OS_BEOS 1 -# define LZO_INFO_OS "beos" -#elif defined(__Lynx__) -# define LZO_OS_LYNXOS 1 -# define LZO_INFO_OS "lynxos" -#elif defined(__OS400__) -# define LZO_OS_OS400 1 -# define LZO_INFO_OS "os400" -#elif defined(__QNX__) -# define LZO_OS_QNX 1 -# define LZO_INFO_OS "qnx" -#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__BORLANDC__) && defined(__DPMI16__) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -#elif defined(__ZTC__) && defined(DOS386) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__OS2__) || defined(__OS2V2__) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_OS216 1 -# define LZO_INFO_OS "os216" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_OS2 1 -# define LZO_INFO_OS "os2" -# else -# error "check your limits.h header" -# endif -#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) -# define LZO_OS_WIN64 1 -# define LZO_INFO_OS "win64" -#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__MWERKS__) && defined(__INTEL__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_WIN16 1 -# define LZO_INFO_OS "win16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# else -# error "check your limits.h header" -# endif -#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -# else -# error "check your limits.h header" -# endif -#elif defined(__WATCOMC__) -# if defined(__NT__) && (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif defined(__NT__) && (__WATCOMC__ < 1100) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# elif defined(__linux__) || defined(__LINUX__) -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -# else -# error "please specify a target using the -bt compiler option" -# endif -#elif defined(__palmos__) -# define LZO_OS_PALMOS 1 -# define LZO_INFO_OS "palmos" -#elif defined(__TOS__) || defined(__atarist__) -# define LZO_OS_TOS 1 -# define LZO_INFO_OS "tos" -#elif defined(macintosh) && !defined(__ppc__) -# define LZO_OS_MACCLASSIC 1 -# define LZO_INFO_OS "macclassic" -#elif defined(__VMS) -# define LZO_OS_VMS 1 -# define LZO_INFO_OS "vms" -#elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PS2 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "ps2" -#elif (defined(__mips__) && defined(__psp__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PSP 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "psp" -#else -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -#endif -#if (LZO_OS_POSIX) -# if defined(_AIX) || defined(__AIX__) || defined(__aix__) -# define LZO_OS_POSIX_AIX 1 -# define LZO_INFO_OS_POSIX "aix" -# elif defined(__FreeBSD__) -# define LZO_OS_POSIX_FREEBSD 1 -# define LZO_INFO_OS_POSIX "freebsd" -# elif defined(__hpux__) || defined(__hpux) -# define LZO_OS_POSIX_HPUX 1 -# define LZO_INFO_OS_POSIX "hpux" -# elif defined(__INTERIX) -# define LZO_OS_POSIX_INTERIX 1 -# define LZO_INFO_OS_POSIX "interix" -# elif defined(__IRIX__) || defined(__irix__) -# define LZO_OS_POSIX_IRIX 1 -# define LZO_INFO_OS_POSIX "irix" -# elif defined(__linux__) || defined(__linux) || defined(__LINUX__) -# define LZO_OS_POSIX_LINUX 1 -# define LZO_INFO_OS_POSIX "linux" -# elif defined(__APPLE__) || defined(__MACOS__) -# define LZO_OS_POSIX_MACOSX 1 -# define LZO_INFO_OS_POSIX "macosx" -# elif defined(__minix__) || defined(__minix) -# define LZO_OS_POSIX_MINIX 1 -# define LZO_INFO_OS_POSIX "minix" -# elif defined(__NetBSD__) -# define LZO_OS_POSIX_NETBSD 1 -# define LZO_INFO_OS_POSIX "netbsd" -# elif defined(__OpenBSD__) -# define LZO_OS_POSIX_OPENBSD 1 -# define LZO_INFO_OS_POSIX "openbsd" -# elif defined(__osf__) -# define LZO_OS_POSIX_OSF 1 -# define LZO_INFO_OS_POSIX "osf" -# elif defined(__solaris__) || defined(__sun) -# if defined(__SVR4) || defined(__svr4__) -# define LZO_OS_POSIX_SOLARIS 1 -# define LZO_INFO_OS_POSIX "solaris" -# else -# define LZO_OS_POSIX_SUNOS 1 -# define LZO_INFO_OS_POSIX "sunos" -# endif -# elif defined(__ultrix__) || defined(__ultrix) -# define LZO_OS_POSIX_ULTRIX 1 -# define LZO_INFO_OS_POSIX "ultrix" -# elif defined(_UNICOS) -# define LZO_OS_POSIX_UNICOS 1 -# define LZO_INFO_OS_POSIX "unicos" -# else -# define LZO_OS_POSIX_UNKNOWN 1 -# define LZO_INFO_OS_POSIX "unknown" -# endif -#endif -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (UINT_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -# define LZO_CC_CILLY 1 -# define LZO_INFO_CC "Cilly" -# if defined(__CILLY__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) -# define LZO_CC_SDCC 1 -# define LZO_INFO_CC "sdcc" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) -#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) -# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) -# define LZO_INFO_CC "Pathscale C" -# define LZO_INFO_CCVER __PATHSCALE__ -#elif defined(__INTEL_COMPILER) -# define LZO_CC_INTELC 1 -# define LZO_INFO_CC "Intel C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) -# if defined(_WIN32) || defined(_WIN64) -# define LZO_CC_SYNTAX_MSC 1 -# else -# define LZO_CC_SYNTAX_GNUC 1 -# endif -#elif defined(__POCC__) && defined(_WIN32) -# define LZO_CC_PELLESC 1 -# define LZO_INFO_CC "Pelles C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# else -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# endif -# define LZO_INFO_CC "llvm-gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# elif defined(__GNUC_MINOR__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# else -# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -# endif -# define LZO_INFO_CC "gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__ACK__) && defined(_ACK) -# define LZO_CC_ACK 1 -# define LZO_INFO_CC "Amsterdam Compiler Kit C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__AZTEC_C__) -# define LZO_CC_AZTECC 1 -# define LZO_INFO_CC "Aztec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) -#elif defined(__BORLANDC__) -# define LZO_CC_BORLANDC 1 -# define LZO_INFO_CC "Borland C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) -#elif defined(_CRAYC) && defined(_RELEASE) -# define LZO_CC_CRAYC 1 -# define LZO_INFO_CC "Cray C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) -#elif defined(__DMC__) && defined(__SC__) -# define LZO_CC_DMC 1 -# define LZO_INFO_CC "Digital Mars C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) -#elif defined(__DECC) -# define LZO_CC_DECC 1 -# define LZO_INFO_CC "DEC C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -#elif defined(__HIGHC__) -# define LZO_CC_HIGHC 1 -# define LZO_INFO_CC "MetaWare High C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__IAR_SYSTEMS_ICC__) -# define LZO_CC_IARC 1 -# define LZO_INFO_CC "IAR C" -# if defined(__VER__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__IBMC__) -# define LZO_CC_IBMC 1 -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -#elif defined(__KEIL__) && defined(__C166__) -# define LZO_CC_KEILC 1 -# define LZO_INFO_CC "Keil C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) -#elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) -# define LZO_CC_LCCWIN32 1 -# define LZO_INFO_CC "lcc-win32" -# define LZO_INFO_CCVER "unknown" -#elif defined(__LCC__) -# define LZO_CC_LCC 1 -# define LZO_INFO_CC "lcc" -# if defined(__LCC_VERSION__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(_MSC_VER) -# define LZO_CC_MSC 1 -# define LZO_INFO_CC "Microsoft C" -# if defined(_MSC_FULL_VER) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -# endif -#elif defined(__MWERKS__) -# define LZO_CC_MWERKS 1 -# define LZO_INFO_CC "Metrowerks C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) -#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -# define LZO_CC_NDPC 1 -# define LZO_INFO_CC "Microway NDP C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PACIFIC__) -# define LZO_CC_PACIFICC 1 -# define LZO_INFO_CC "Pacific C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) -# define LZO_CC_PGI 1 -# define LZO_INFO_CC "Portland Group PGI C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PUREC__) && defined(__TOS__) -# define LZO_CC_PUREC 1 -# define LZO_INFO_CC "Pure C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) -#elif defined(__SC__) && defined(__ZTC__) -# define LZO_CC_SYMANTECC 1 -# define LZO_INFO_CC "Symantec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) -#elif defined(__SUNPRO_C) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_C)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_C -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__SUNPRO_CC) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_CC)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_CC -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__TINYC__) -# define LZO_CC_TINYC 1 -# define LZO_INFO_CC "Tiny C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) -#elif defined(__TSC__) -# define LZO_CC_TOPSPEEDC 1 -# define LZO_INFO_CC "TopSpeed C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) -#elif defined(__WATCOMC__) -# define LZO_CC_WATCOMC 1 -# define LZO_INFO_CC "Watcom C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) -#elif defined(__TURBOC__) -# define LZO_CC_TURBOC 1 -# define LZO_INFO_CC "Turbo C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) -#elif defined(__ZTC__) -# define LZO_CC_ZORTECHC 1 -# define LZO_INFO_CC "Zortech C" -# if (__ZTC__ == 0x310) -# define LZO_INFO_CCVER "0x310" -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) -# endif -#else -# define LZO_CC_UNKNOWN 1 -# define LZO_INFO_CC "unknown" -# define LZO_INFO_CCVER "unknown" -#endif -#if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) -# error "LZO_CC_MSC: _MSC_FULL_VER is not defined" -#endif -#if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) -# if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) -# if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) -# define LZO_ARCH_CRAY_MPP 1 -# elif defined(_CRAY1) -# define LZO_ARCH_CRAY_PVP 1 -# endif -# endif -#endif -#if !defined(__LZO_ARCH_OVERRIDE) -#if defined(LZO_ARCH_GENERIC) -# define LZO_INFO_ARCH "generic" -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086 1 -# define LZO_ARCH_IA16 1 -# define LZO_INFO_ARCH "i086" -#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) -# define LZO_ARCH_AMD64 1 -# define LZO_INFO_ARCH "amd64" -#elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB)) -# define LZO_ARCH_ARM 1 -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) -# define LZO_ARCH_ARM 1 -# if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -# elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) -# define LZO_INFO_ARCH "arm" -# else -# define LZO_INFO_ARCH "arm" -# endif -#elif defined(__arm__) || defined(_M_ARM) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) -# define LZO_ARCH_AVR 1 -# define LZO_INFO_ARCH "avr" -#elif defined(__bfin__) -# define LZO_ARCH_BLACKFIN 1 -# define LZO_INFO_ARCH "blackfin" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) -# define LZO_ARCH_C166 1 -# define LZO_INFO_ARCH "c166" -#elif defined(__cris__) -# define LZO_ARCH_CRIS 1 -# define LZO_INFO_ARCH "cris" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) -# define LZO_ARCH_EZ80 1 -# define LZO_INFO_ARCH "ez80" -#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_ARCH_H8300 1 -# define LZO_INFO_ARCH "h8300" -#elif defined(__hppa__) || defined(__hppa) -# define LZO_ARCH_HPPA 1 -# define LZO_INFO_ARCH "hppa" -#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_CC_ZORTECHC && defined(__I86__)) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) -# define LZO_ARCH_IA64 1 -# define LZO_INFO_ARCH "ia64" -#elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__m32r__) -# define LZO_ARCH_M32R 1 -# define LZO_INFO_ARCH "m32r" -#elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) -# define LZO_ARCH_M68K 1 -# define LZO_INFO_ARCH "m68k" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) -# define LZO_ARCH_MCS251 1 -# define LZO_INFO_ARCH "mcs251" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) -# define LZO_ARCH_MIPS 1 -# define LZO_INFO_ARCH "mips" -#elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) -# define LZO_ARCH_S390 1 -# define LZO_INFO_ARCH "s390" -#elif defined(__sh__) || defined(_M_SH) -# define LZO_ARCH_SH 1 -# define LZO_INFO_ARCH "sh" -#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) -# define LZO_ARCH_SPARC 1 -# define LZO_INFO_ARCH "sparc" -#elif defined(__SPU__) -# define LZO_ARCH_SPU 1 -# define LZO_INFO_ARCH "spu" -#elif (UINT_MAX == LZO_0xffffL) && defined(__z80) -# define LZO_ARCH_Z80 1 -# define LZO_INFO_ARCH "z80" -#elif (LZO_ARCH_CRAY_PVP) -# if defined(_CRAYSV1) -# define LZO_ARCH_CRAY_SV1 1 -# define LZO_INFO_ARCH "cray_sv1" -# elif (_ADDR64) -# define LZO_ARCH_CRAY_T90 1 -# define LZO_INFO_ARCH "cray_t90" -# elif (_ADDR32) -# define LZO_ARCH_CRAY_YMP 1 -# define LZO_INFO_ARCH "cray_ymp" -# else -# define LZO_ARCH_CRAY_XMP 1 -# define LZO_INFO_ARCH "cray_xmp" -# endif -#else -# define LZO_ARCH_UNKNOWN 1 -# define LZO_INFO_ARCH "unknown" -#endif -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) -# error "FIXME - missing define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) -# error "FIXME - missing WIN32 define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) -# error "FIXME - missing WIN64 define for CPU architecture" -#endif -#if (LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(BLX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#endif -#if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) -# error "this should not happen" -#endif -#if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) -# error "this should not happen" -#endif -#if (LZO_ARCH_I086) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_ARCH_I386) -# if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) -# error "this should not happen" -# endif -# if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if !defined(__LZO_MM_OVERRIDE) -#if (LZO_ARCH_I086) -#if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -#endif -#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) -# define LZO_MM_TINY 1 -#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) -# define LZO_MM_HUGE 1 -#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) -# define LZO_MM_SMALL 1 -#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) -# define LZO_MM_MEDIUM 1 -#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) -# define LZO_MM_COMPACT 1 -#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) -# define LZO_MM_LARGE 1 -#elif (LZO_CC_AZTECC) -# if defined(_LARGE_CODE) && defined(_LARGE_DATA) -# define LZO_MM_LARGE 1 -# elif defined(_LARGE_CODE) -# define LZO_MM_MEDIUM 1 -# elif defined(_LARGE_DATA) -# define LZO_MM_COMPACT 1 -# else -# define LZO_MM_SMALL 1 -# endif -#elif (LZO_CC_ZORTECHC && defined(__VCM__)) -# define LZO_MM_LARGE 1 -#else -# error "unknown memory model" -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -#define LZO_HAVE_MM_HUGE_PTR 1 -#define LZO_HAVE_MM_HUGE_ARRAY 1 -#if (LZO_MM_TINY) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) -# undef LZO_HAVE_MM_HUGE_PTR -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_MSC && defined(_QC)) -# undef LZO_HAVE_MM_HUGE_ARRAY -# if (_MSC_VER < 600) -# undef LZO_HAVE_MM_HUGE_PTR -# endif -#elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) -# if (LZO_OS_DOS16) -# error "this should not happen" -# elif (LZO_CC_ZORTECHC) -# else -# error "this should not happen" -# endif -#endif -#ifdef __cplusplus -extern "C" { -#endif -#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) -# define LZO_MM_AHSHIFT 12 -#elif (LZO_CC_WATCOMC) - extern unsigned char _HShift; -# define LZO_MM_AHSHIFT ((unsigned) _HShift) -#else -# error "FIXME - implement LZO_MM_AHSHIFT" -#endif -#ifdef __cplusplus -} -#endif -#endif -#elif (LZO_ARCH_C166) -#if !defined(__MODEL__) -# error "FIXME - C166 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - C166 __MODEL__" -#endif -#elif (LZO_ARCH_MCS251) -#if !defined(__MODEL__) -# error "FIXME - MCS251 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS251 __MODEL__" -#endif -#elif (LZO_ARCH_MCS51) -#if !defined(__MODEL__) -# error "FIXME - MCS51 __MODEL__" -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS51 __MODEL__" -#endif -#elif (LZO_ARCH_CRAY_PVP) -# define LZO_MM_PVP 1 -#else -# define LZO_MM_FLAT 1 -#endif -#if (LZO_MM_COMPACT) -# define LZO_INFO_MM "compact" -#elif (LZO_MM_FLAT) -# define LZO_INFO_MM "flat" -#elif (LZO_MM_HUGE) -# define LZO_INFO_MM "huge" -#elif (LZO_MM_LARGE) -# define LZO_INFO_MM "large" -#elif (LZO_MM_MEDIUM) -# define LZO_INFO_MM "medium" -#elif (LZO_MM_PVP) -# define LZO_INFO_MM "pvp" -#elif (LZO_MM_SMALL) -# define LZO_INFO_MM "small" -#elif (LZO_MM_TINY) -# define LZO_INFO_MM "tiny" -#else -# error "unknown memory model" -#endif -#endif -#if defined(SIZEOF_SHORT) -# define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -#endif -#if defined(SIZEOF_INT) -# define LZO_SIZEOF_INT (SIZEOF_INT) -#endif -#if defined(SIZEOF_LONG) -# define LZO_SIZEOF_LONG (SIZEOF_LONG) -#endif -#if defined(SIZEOF_LONG_LONG) -# define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -#endif -#if defined(SIZEOF___INT16) -# define LZO_SIZEOF___INT16 (SIZEOF___INT16) -#endif -#if defined(SIZEOF___INT32) -# define LZO_SIZEOF___INT32 (SIZEOF___INT32) -#endif -#if defined(SIZEOF___INT64) -# define LZO_SIZEOF___INT64 (SIZEOF___INT64) -#endif -#if defined(SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -#endif -#if defined(SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -#endif -#if defined(SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -#endif -#define __LZO_LSR(x,b) (((x)+0ul) >> (b)) -#if !defined(LZO_SIZEOF_SHORT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_SHORT 8 -# elif (USHRT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,7) == 1) -# define LZO_SIZEOF_SHORT 1 -# elif (__LZO_LSR(USHRT_MAX,15) == 1) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,31) == 1) -# define LZO_SIZEOF_SHORT 4 -# elif (__LZO_LSR(USHRT_MAX,63) == 1) -# define LZO_SIZEOF_SHORT 8 -# elif (__LZO_LSR(USHRT_MAX,127) == 1) -# define LZO_SIZEOF_SHORT 16 -# else -# error "LZO_SIZEOF_SHORT" -# endif -#endif -#if !defined(LZO_SIZEOF_INT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_INT 8 -# elif (UINT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_INT 2 -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,7) == 1) -# define LZO_SIZEOF_INT 1 -# elif (__LZO_LSR(UINT_MAX,15) == 1) -# define LZO_SIZEOF_INT 2 -# elif (__LZO_LSR(UINT_MAX,31) == 1) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,63) == 1) -# define LZO_SIZEOF_INT 8 -# elif (__LZO_LSR(UINT_MAX,127) == 1) -# define LZO_SIZEOF_INT 16 -# else -# error "LZO_SIZEOF_INT" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG) -# if (ULONG_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,7) == 1) -# define LZO_SIZEOF_LONG 1 -# elif (__LZO_LSR(ULONG_MAX,15) == 1) -# define LZO_SIZEOF_LONG 2 -# elif (__LZO_LSR(ULONG_MAX,31) == 1) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,63) == 1) -# define LZO_SIZEOF_LONG 8 -# elif (__LZO_LSR(ULONG_MAX,127) == 1) -# define LZO_SIZEOF_LONG 16 -# else -# error "LZO_SIZEOF_LONG" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -# if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) -# if (LZO_CC_GNUC >= 0x030300ul) -# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) -# define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG -# elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) -# define LZO_SIZEOF_LONG_LONG 4 -# endif -# endif -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -#if (LZO_ARCH_I086 && LZO_CC_DMC) -#elif (LZO_CC_CILLY) && defined(__GNUC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_SIZEOF_LONG_LONG 8 -#elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_OS_WIN64 || defined(_WIN64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_DMC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) -#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define LZO_SIZEOF_LONG_LONG 8 -#endif -#endif -#endif -#if defined(__cplusplus) && defined(LZO_CC_GNUC) -# if (LZO_CC_GNUC < 0x020800ul) -# undef LZO_SIZEOF_LONG_LONG -# endif -#endif -#if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#endif -#if !defined(LZO_SIZEOF_VOID_P) -#if (LZO_ARCH_I086) -# define __LZO_WORDSIZE 2 -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -# define LZO_SIZEOF_VOID_P 2 -# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -# define LZO_SIZEOF_VOID_P 4 -# else -# error "LZO_MM" -# endif -#elif (LZO_ARCH_AVR || LZO_ARCH_Z80) -# define __LZO_WORDSIZE 1 -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_H8300) -# if defined(__NORMAL_MODE__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 2 -# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 4 -# else -# define __LZO_WORDSIZE 2 -# define LZO_SIZEOF_VOID_P 2 -# endif -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT -# endif -#elif (LZO_ARCH_M16C) -# define __LZO_WORDSIZE 2 -# if defined(__m32c_cpu__) || defined(__m32cm_cpu__) -# define LZO_SIZEOF_VOID_P 4 -# else -# define LZO_SIZEOF_VOID_P 2 -# endif -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 4 -#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_OS_OS400 || defined(__OS400__)) -# define __LZO_WORDSIZE LZO_SIZEOF_LONG -# define LZO_SIZEOF_VOID_P 16 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_ARCH_SPU) -# if 0 -# define __LZO_WORDSIZE 16 -# endif -# define LZO_SIZEOF_VOID_P 4 -#else -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -#endif -#endif -#if !defined(LZO_WORDSIZE) -# if defined(__LZO_WORDSIZE) -# define LZO_WORDSIZE __LZO_WORDSIZE -# else -# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -# endif -#endif -#if !defined(LZO_SIZEOF_SIZE_T) -#if (LZO_ARCH_I086 || LZO_ARCH_M16C) -# define LZO_SIZEOF_SIZE_T 2 -#else -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P -#endif -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -#if (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P -# elif (LZO_MM_COMPACT || LZO_MM_LARGE) -# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) -# define LZO_SIZEOF_PTRDIFF_T 4 -# else -# define LZO_SIZEOF_PTRDIFF_T 2 -# endif -# else -# error "LZO_MM" -# endif -#else -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T -#endif -#endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) -# undef LZO_ABI_BIG_ENDIAN -# undef LZO_ABI_LITTLE_ENDIAN -#elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) -#if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) -# define LZO_ABI_BIG_ENDIAN 1 -#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_M68K || LZO_ARCH_S390) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) -# if (__LITTLE_ENDIAN__ == 1) -# define LZO_ABI_LITTLE_ENDIAN 1 -# else -# define LZO_ABI_BIG_ENDIAN 1 -# endif -#elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#endif -#endif -#if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) -# error "this should not happen" -#endif -#if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "be" -#elif defined(LZO_ABI_LITTLE_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "le" -#elif defined(LZO_ABI_NEUTRAL_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "neutral" -#endif -#if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_I8LP16 1 -# define LZO_INFO_ABI_PM "i8lp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_ILP16 1 -# define LZO_INFO_ABI_PM "ilp16" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_ILP32 1 -# define LZO_INFO_ABI_PM "ilp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) -# define LZO_ABI_LLP64 1 -# define LZO_INFO_ABI_PM "llp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_LP64 1 -# define LZO_INFO_ABI_PM "lp64" -#elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_ILP64 1 -# define LZO_INFO_ABI_PM "ilp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_IP32L64 1 -# define LZO_INFO_ABI_PM "ip32l64" -#endif -#if !defined(__LZO_LIBC_OVERRIDE) -#if defined(LZO_LIBC_NAKED) -# define LZO_INFO_LIBC "naked" -#elif defined(LZO_LIBC_FREESTANDING) -# define LZO_INFO_LIBC "freestanding" -#elif defined(LZO_LIBC_MOSTLY_FREESTANDING) -# define LZO_INFO_LIBC "mfreestanding" -#elif defined(LZO_LIBC_ISOC90) -# define LZO_INFO_LIBC "isoc90" -#elif defined(LZO_LIBC_ISOC99) -# define LZO_INFO_LIBC "isoc99" -#elif defined(__dietlibc__) -# define LZO_LIBC_DIETLIBC 1 -# define LZO_INFO_LIBC "dietlibc" -#elif defined(_NEWLIB_VERSION) -# define LZO_LIBC_NEWLIB 1 -# define LZO_INFO_LIBC "newlib" -#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) -# if defined(__UCLIBC_SUBLEVEL__) -# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) -# else -# define LZO_LIBC_UCLIBC 0x00090bL -# endif -# define LZO_INFO_LIBC "uclibc" -#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) -# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) -# define LZO_INFO_LIBC "glibc" -#elif (LZO_CC_MWERKS) && defined(__MSL__) -# define LZO_LIBC_MSL __MSL__ -# define LZO_INFO_LIBC "msl" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#else -# define LZO_LIBC_DEFAULT 1 -# define LZO_INFO_LIBC "default" -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -#if (LZO_CC_GNUC >= 0x020800ul) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_gnuc_extension__ __extension__ -#else -# define __lzo_gnuc_extension__ -#endif -#endif -#if !defined(__lzo_ua_volatile) -# define __lzo_ua_volatile volatile -#endif -#if !defined(__lzo_alignof) -#if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_alignof(e) __alignof(e) -#endif -#endif -#if defined(__lzo_alignof) -# define __lzo_HAVE_alignof 1 -#endif -#if !defined(__lzo_constructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_constructor __attribute__((__constructor__)) -#endif -#endif -#if defined(__lzo_constructor) -# define __lzo_HAVE_constructor 1 -#endif -#if !defined(__lzo_destructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_destructor __attribute__((__destructor__)) -#endif -#endif -#if defined(__lzo_destructor) -# define __lzo_HAVE_destructor 1 -#endif -#if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) -# error "this should not happen" -#endif -#if !defined(__lzo_inline) -#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -#elif defined(__cplusplus) -# define __lzo_inline inline -#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -# define __lzo_inline __inline -#elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_inline __inline__ -#elif (LZO_CC_DMC) -# define __lzo_inline __inline -#elif (LZO_CC_INTELC) -# define __lzo_inline __inline -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -# define __lzo_inline __inline -#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -# define __lzo_inline __inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define __lzo_inline inline -#endif -#endif -#if defined(__lzo_inline) -# define __lzo_HAVE_inline 1 -#else -# define __lzo_inline -#endif -#if !defined(__lzo_forceinline) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_forceinline __forceinline -#endif -#endif -#if defined(__lzo_forceinline) -# define __lzo_HAVE_forceinline 1 -#else -# define __lzo_forceinline -#endif -#if !defined(__lzo_noinline) -#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -# define __lzo_noinline __attribute__((__noinline__,__used__)) -#elif (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -# if defined(__cplusplus) -# else -# define __lzo_noinline __declspec(noinline) -# endif -#endif -#endif -#if defined(__lzo_noinline) -# define __lzo_HAVE_noinline 1 -#else -# define __lzo_noinline -#endif -#if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) -# error "this should not happen" -#endif -#if !defined(__lzo_noreturn) -#if (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_noreturn __declspec(noreturn) -#endif -#endif -#if defined(__lzo_noreturn) -# define __lzo_HAVE_noreturn 1 -#else -# define __lzo_noreturn -#endif -#if !defined(__lzo_nothrow) -#if (LZO_CC_GNUC >= 0x030300ul) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#endif -#endif -#if defined(__lzo_nothrow) -# define __lzo_HAVE_nothrow 1 -#else -# define __lzo_nothrow -#endif -#if !defined(__lzo_restrict) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_LLVM) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -# define __lzo_restrict __restrict -#endif -#endif -#if defined(__lzo_restrict) -# define __lzo_HAVE_restrict 1 -#else -# define __lzo_restrict -#endif -#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#endif -#endif -#if defined(__lzo_likely) -# define __lzo_HAVE_likely 1 -#else -# define __lzo_likely(e) (e) -#endif -#if defined(__lzo_unlikely) -# define __lzo_HAVE_unlikely 1 -#else -# define __lzo_unlikely(e) (e) -#endif -#if !defined(LZO_UNUSED) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNUSED(var) ((void) var) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_KEILC) -# define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} -# elif (LZO_CC_PACIFICC) -# define LZO_UNUSED(var) ((void) sizeof(var)) -# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED(var) ((void) var) -# else -# define LZO_UNUSED(var) ((void) &var) -# endif -#endif -#if !defined(LZO_UNUSED_FUNC) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED_FUNC(func) ((void) func) -# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_LLVM) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_MSC) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -# define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} -# else -# define LZO_UNUSED_FUNC(func) ((void) func) -# endif -#endif -#if !defined(LZO_UNUSED_LABEL) -# if (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# elif (LZO_CC_INTELC || LZO_CC_WATCOMC) -# define LZO_UNUSED_LABEL(l) if (0) goto l -# else -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# endif -#endif -#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -# if 0 -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -# elif 0 && (LZO_CC_GNUC) -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -# else -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# else -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT) -# if (LZO_CC_AZTECC) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} -# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# else -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} -# endif -#endif -#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit -# define __lzo_cdecl_main __cdecl -# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_qsort __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_qsort _stdcall -# else -# define __lzo_cdecl_qsort __cdecl -# endif -# elif (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -# else -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit __cdecl -# define __lzo_cdecl_main __cdecl -# define __lzo_cdecl_qsort __cdecl -# endif -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_sighandler __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_sighandler _stdcall -# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -# define __lzo_cdecl_sighandler __clrcall -# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -# if defined(_DLL) -# define __lzo_cdecl_sighandler _far _cdecl _loadds -# elif defined(_MT) -# define __lzo_cdecl_sighandler _far _cdecl -# else -# define __lzo_cdecl_sighandler _cdecl -# endif -# else -# define __lzo_cdecl_sighandler __cdecl -# endif -#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -# define __lzo_cdecl cdecl -#endif -#if !defined(__lzo_cdecl) -# define __lzo_cdecl -#endif -#if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit -#endif -#if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main -#endif -#if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort -#endif -#if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler -#endif -#if !defined(__lzo_cdecl_va) -# define __lzo_cdecl_va __lzo_cdecl -#endif -#if !defined(LZO_CFG_NO_WINDOWS_H) -#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) -# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -# else -# define LZO_HAVE_WINDOWS_H 1 -# endif -#endif -#endif -#if (LZO_ARCH_ALPHA) -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_AMD64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# define LZO_OPT_UNALIGNED64 1 -#elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) -#elif (LZO_ARCH_ARM) -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_CRIS) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_I386) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_IA64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_PREFER_POSTINC 1 -#elif (LZO_ARCH_M68K) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(__mc68020__) && !defined(__mcoldfire__) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_MIPS) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_POWERPC) -# define LZO_OPT_PREFER_PREINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_S390) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# if (LZO_SIZEOF_SIZE_T == 8) -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_SH) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -#endif -#if !defined(LZO_CFG_NO_INLINE_ASM) -#if defined(LZO_CC_LLVM) -# define LZO_CFG_NO_INLINE_ASM 1 -#endif -#endif -#if !defined(LZO_CFG_NO_UNALIGNED) -#if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) -# define LZO_CFG_NO_UNALIGNED 1 -#endif -#endif -#if defined(LZO_CFG_NO_UNALIGNED) -# undef LZO_OPT_UNALIGNED16 -# undef LZO_OPT_UNALIGNED32 -# undef LZO_OPT_UNALIGNED64 -#endif -#if defined(LZO_CFG_NO_INLINE_ASM) -#elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -# define LZO_ASM_SYNTAX_MSC 1 -#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#endif -#if (LZO_ASM_SYNTAX_GNUC) -#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -# define __LZO_ASM_CLOBBER "ax" -#elif (LZO_CC_INTELC) -# define __LZO_ASM_CLOBBER "memory" -#else -# define __LZO_ASM_CLOBBER "cc", "memory" -#endif -#endif -#if defined(__LZO_INFOSTR_MM) -#elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) -# define __LZO_INFOSTR_MM "" -#elif defined(LZO_INFO_MM) -# define __LZO_INFOSTR_MM "." LZO_INFO_MM -#else -# define __LZO_INFOSTR_MM "" -#endif -#if defined(__LZO_INFOSTR_PM) -#elif defined(LZO_INFO_ABI_PM) -# define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM -#else -# define __LZO_INFOSTR_PM "" -#endif -#if defined(__LZO_INFOSTR_ENDIAN) -#elif defined(LZO_INFO_ABI_ENDIAN) -# define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN -#else -# define __LZO_INFOSTR_ENDIAN "" -#endif -#if defined(__LZO_INFOSTR_OSNAME) -#elif defined(LZO_INFO_OS_CONSOLE) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE -#elif defined(LZO_INFO_OS_POSIX) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX -#else -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS -#endif -#if defined(__LZO_INFOSTR_LIBC) -#elif defined(LZO_INFO_LIBC) -# define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC -#else -# define __LZO_INFOSTR_LIBC "" -#endif -#if defined(__LZO_INFOSTR_CCVER) -#elif defined(LZO_INFO_CCVER) -# define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER -#else -# define __LZO_INFOSTR_CCVER "" -#endif -#define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER - -#endif - -#endif - -#undef LZO_HAVE_CONFIG_H -#include "minilzo.h" - -#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2030) -# error "version mismatch in miniLZO source files" -#endif - -#ifdef MINILZO_HAVE_CONFIG_H -# define LZO_HAVE_CONFIG_H -#endif - -#ifndef __LZO_CONF_H -#define __LZO_CONF_H - -#if !defined(__LZO_IN_MINILZO) -#if defined(LZO_CFG_FREESTANDING) -# define LZO_LIBC_FREESTANDING 1 -# define LZO_OS_FREESTANDING 1 -# define ACC_LIBC_FREESTANDING 1 -# define ACC_OS_FREESTANDING 1 -#endif -#if defined(LZO_CFG_NO_UNALIGNED) -# define ACC_CFG_NO_UNALIGNED 1 -#endif -#if defined(LZO_ARCH_GENERIC) -# define ACC_ARCH_GENERIC 1 -#endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) -# define ACC_ABI_NEUTRAL_ENDIAN 1 -#endif -#if defined(LZO_HAVE_CONFIG_H) -# define ACC_CONFIG_NO_HEADER 1 -#endif -#if defined(LZO_CFG_EXTRA_CONFIG_HEADER) -# include LZO_CFG_EXTRA_CONFIG_HEADER -#endif -#if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED) -# error "include this file first" -#endif -#include "lzo/lzoconf.h" -#endif - -#if (LZO_VERSION < 0x02000) || !defined(__LZOCONF_H_INCLUDED) -# error "version mismatch" -#endif - -#if (LZO_CC_BORLANDC && LZO_ARCH_I086) -# pragma option -h -#endif - -#if (LZO_CC_MSC && (_MSC_VER >= 1000)) -# pragma warning(disable: 4127 4701) -#endif -#if (LZO_CC_MSC && (_MSC_VER >= 1300)) -# pragma warning(disable: 4820) -# pragma warning(disable: 4514 4710 4711) -#endif - -#if (LZO_CC_SUNPROC) -# pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED) -# pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP) -#endif - -#if defined(__LZO_MMODEL_HUGE) && (!LZO_HAVE_MM_HUGE_PTR) -# error "this should not happen - check defines for __huge" -#endif - -#if defined(__LZO_IN_MINILZO) || defined(LZO_CFG_FREESTANDING) -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define ACC_WANT_ACC_INCD_H 1 -# define ACC_WANT_ACC_INCE_H 1 -# define ACC_WANT_ACC_INCI_H 1 -#elif 1 -# include -#else -# define ACC_WANT_ACC_INCD_H 1 -#endif - -#if (LZO_ARCH_I086) -# define ACC_MM_AHSHIFT LZO_MM_AHSHIFT -# define ACC_PTR_FP_OFF(x) (((const unsigned __far*)&(x))[0]) -# define ACC_PTR_FP_SEG(x) (((const unsigned __far*)&(x))[1]) -# define ACC_PTR_MK_FP(s,o) ((void __far*)(((unsigned long)(s)<<16)+(unsigned)(o))) -#endif - -#if !defined(lzo_uintptr_t) -# if defined(__LZO_MMODEL_HUGE) -# define lzo_uintptr_t unsigned long -# elif 1 && defined(LZO_OS_OS400) && (LZO_SIZEOF_VOID_P == 16) -# define __LZO_UINTPTR_T_IS_POINTER 1 - typedef char* lzo_uintptr_t; -# define lzo_uintptr_t lzo_uintptr_t -# elif (LZO_SIZEOF_SIZE_T == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t size_t -# elif (LZO_SIZEOF_LONG == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t unsigned long -# elif (LZO_SIZEOF_INT == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t unsigned int -# elif (LZO_SIZEOF_LONG_LONG == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t unsigned long long -# else -# define lzo_uintptr_t size_t -# endif -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - -#if 1 && !defined(LZO_CFG_FREESTANDING) -#if 1 && !defined(HAVE_STRING_H) -#define HAVE_STRING_H 1 -#endif -#if 1 && !defined(HAVE_MEMCMP) -#define HAVE_MEMCMP 1 -#endif -#if 1 && !defined(HAVE_MEMCPY) -#define HAVE_MEMCPY 1 -#endif -#if 1 && !defined(HAVE_MEMMOVE) -#define HAVE_MEMMOVE 1 -#endif -#if 1 && !defined(HAVE_MEMSET) -#define HAVE_MEMSET 1 -#endif -#endif - -#if 1 && defined(HAVE_STRING_H) -#include -#endif - -#if defined(LZO_CFG_FREESTANDING) -# undef HAVE_MEMCMP -# undef HAVE_MEMCPY -# undef HAVE_MEMMOVE -# undef HAVE_MEMSET -#endif - -#if !defined(HAVE_MEMCMP) -# undef memcmp -# define memcmp(a,b,c) lzo_memcmp(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memcmp(a,b,c) memcmp(a,b,c) -#endif -#if !defined(HAVE_MEMCPY) -# undef memcpy -# define memcpy(a,b,c) lzo_memcpy(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memcpy(a,b,c) memcpy(a,b,c) -#endif -#if !defined(HAVE_MEMMOVE) -# undef memmove -# define memmove(a,b,c) lzo_memmove(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memmove(a,b,c) memmove(a,b,c) -#endif -#if !defined(HAVE_MEMSET) -# undef memset -# define memset(a,b,c) lzo_memset(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memset(a,b,c) memset(a,b,c) -#endif - -#undef NDEBUG -#if defined(LZO_CFG_FREESTANDING) -# undef LZO_DEBUG -# define NDEBUG 1 -# undef assert -# define assert(e) ((void)0) -#else -# if !defined(LZO_DEBUG) -# define NDEBUG 1 -# endif -# include -#endif - -#if 0 && defined(__BOUNDS_CHECKING_ON) -# include -#else -# define BOUNDS_CHECKING_OFF_DURING(stmt) stmt -# define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) -#endif - -#if !defined(__lzo_inline) -# define __lzo_inline -#endif -#if !defined(__lzo_forceinline) -# define __lzo_forceinline -#endif -#if !defined(__lzo_noinline) -# define __lzo_noinline -#endif - -#if 1 -# define LZO_BYTE(x) ((unsigned char) (x)) -#else -# define LZO_BYTE(x) ((unsigned char) ((x) & 0xff)) -#endif - -#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b)) -#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b)) -#define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c)) -#define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c)) - -#define lzo_sizeof(type) ((lzo_uint) (sizeof(type))) - -#define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array)))) - -#define LZO_SIZE(bits) (1u << (bits)) -#define LZO_MASK(bits) (LZO_SIZE(bits) - 1) - -#define LZO_LSIZE(bits) (1ul << (bits)) -#define LZO_LMASK(bits) (LZO_LSIZE(bits) - 1) - -#define LZO_USIZE(bits) ((lzo_uint) 1 << (bits)) -#define LZO_UMASK(bits) (LZO_USIZE(bits) - 1) - -#if !defined(DMUL) -#if 0 - -# define DMUL(a,b) ((lzo_xint) ((lzo_uint32)(a) * (lzo_uint32)(b))) -#else -# define DMUL(a,b) ((lzo_xint) ((a) * (b))) -#endif -#endif - -#if 1 && !defined(LZO_CFG_NO_UNALIGNED) -#if 1 && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -# if (LZO_SIZEOF_SHORT == 2) -# define LZO_UNALIGNED_OK_2 -# endif -# if (LZO_SIZEOF_INT == 4) -# define LZO_UNALIGNED_OK_4 -# endif -#endif -#endif - -#if defined(LZO_UNALIGNED_OK_2) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(short) == 2) -#endif -#if defined(LZO_UNALIGNED_OK_4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) -#elif defined(LZO_ALIGNED_OK_4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) -#endif - -#define MEMCPY8_DS(dest,src,len) \ - lzo_memcpy(dest,src,len); dest += len; src += len - -#define BZERO8_PTR(s,l,n) \ - lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) - -#define MEMCPY_DS(dest,src,len) \ - do *dest++ = *src++; while (--len > 0) - -__LZO_EXTERN_C int __lzo_init_done; -__LZO_EXTERN_C const char __lzo_copyright[]; -LZO_EXTERN(const lzo_bytep) lzo_copyright(void); - -#ifndef __LZO_PTR_H -#define __LZO_PTR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(lzo_uintptr_t) -# if defined(__LZO_MMODEL_HUGE) -# define lzo_uintptr_t unsigned long -# else -# define lzo_uintptr_t acc_uintptr_t -# ifdef __ACC_INTPTR_T_IS_POINTER -# define __LZO_UINTPTR_T_IS_POINTER 1 -# endif -# endif -#endif - -#if (LZO_ARCH_I086) -#define PTR(a) ((lzo_bytep) (a)) -#define PTR_ALIGNED_4(a) ((ACC_PTR_FP_OFF(a) & 3) == 0) -#define PTR_ALIGNED2_4(a,b) (((ACC_PTR_FP_OFF(a) | ACC_PTR_FP_OFF(b)) & 3) == 0) -#elif (LZO_MM_PVP) -#define PTR(a) ((lzo_bytep) (a)) -#define PTR_ALIGNED_8(a) ((((lzo_uintptr_t)(a)) >> 61) == 0) -#define PTR_ALIGNED2_8(a,b) ((((lzo_uintptr_t)(a)|(lzo_uintptr_t)(b)) >> 61) == 0) -#else -#define PTR(a) ((lzo_uintptr_t) (a)) -#define PTR_LINEAR(a) PTR(a) -#define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0) -#define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0) -#define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0) -#define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0) -#endif - -#define PTR_LT(a,b) (PTR(a) < PTR(b)) -#define PTR_GE(a,b) (PTR(a) >= PTR(b)) -#define PTR_DIFF(a,b) (PTR(a) - PTR(b)) -#define pd(a,b) ((lzo_uint) ((a)-(b))) - -LZO_EXTERN(lzo_uintptr_t) -__lzo_ptr_linear(const lzo_voidp ptr); - -typedef union -{ - char a_char; - unsigned char a_uchar; - short a_short; - unsigned short a_ushort; - int a_int; - unsigned int a_uint; - long a_long; - unsigned long a_ulong; - lzo_int a_lzo_int; - lzo_uint a_lzo_uint; - lzo_int32 a_lzo_int32; - lzo_uint32 a_lzo_uint32; - ptrdiff_t a_ptrdiff_t; - lzo_uintptr_t a_lzo_uintptr_t; - lzo_voidp a_lzo_voidp; - void * a_void_p; - lzo_bytep a_lzo_bytep; - lzo_bytepp a_lzo_bytepp; - lzo_uintp a_lzo_uintp; - lzo_uint * a_lzo_uint_p; - lzo_uint32p a_lzo_uint32p; - lzo_uint32 * a_lzo_uint32_p; - unsigned char * a_uchar_p; - char * a_char_p; -} -lzo_full_align_t; - -#ifdef __cplusplus -} -#endif - -#endif - -#define LZO_DETERMINISTIC - -#define LZO_DICT_USE_PTR -#if 0 && (LZO_ARCH_I086) -# undef LZO_DICT_USE_PTR -#endif - -#if defined(LZO_DICT_USE_PTR) -# define lzo_dict_t const lzo_bytep -# define lzo_dict_p lzo_dict_t __LZO_MMODEL * -#else -# define lzo_dict_t lzo_uint -# define lzo_dict_p lzo_dict_t __LZO_MMODEL * -#endif - -#endif - -#if !defined(MINILZO_CFG_SKIP_LZO_PTR) - -LZO_PUBLIC(lzo_uintptr_t) -__lzo_ptr_linear(const lzo_voidp ptr) -{ - lzo_uintptr_t p; - -#if (LZO_ARCH_I086) - p = (((lzo_uintptr_t)(ACC_PTR_FP_SEG(ptr))) << (16 - ACC_MM_AHSHIFT)) + (ACC_PTR_FP_OFF(ptr)); -#elif (LZO_MM_PVP) - p = (lzo_uintptr_t) (ptr); - p = (p << 3) | (p >> 61); -#else - p = (lzo_uintptr_t) PTR_LINEAR(ptr); -#endif - - return p; -} - -LZO_PUBLIC(unsigned) -__lzo_align_gap(const lzo_voidp ptr, lzo_uint size) -{ -#if defined(__LZO_UINTPTR_T_IS_POINTER) - size_t n = (size_t) ptr; - n = (((n + size - 1) / size) * size) - n; -#else - lzo_uintptr_t p, n; - p = __lzo_ptr_linear(ptr); - n = (((p + size - 1) / size) * size) - p; -#endif - - assert(size > 0); - assert((long)n >= 0); - assert(n <= size); - return (unsigned)n; -} - -#endif - -/* If you use the LZO library in a product, I would appreciate that you - * keep this copyright string in the executable of your product. - */ - -const char __lzo_copyright[] = -#if !defined(__LZO_IN_MINLZO) - LZO_VERSION_STRING; -#else - "\r\n\n" - "LZO data compression library.\n" - "$Copyright: LZO (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Markus Franz Xaver Johannes Oberhumer\n" - "\n" - "http://www.oberhumer.com $\n\n" - "$Id: LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE " $\n" - "$Built: " __DATE__ " " __TIME__ " $\n" - "$Info: " LZO_INFO_STRING " $\n"; -#endif - -LZO_PUBLIC(const lzo_bytep) -lzo_copyright(void) -{ -#if (LZO_OS_DOS16 && LZO_CC_TURBOC) - return (lzo_voidp) __lzo_copyright; -#else - return (const lzo_bytep) __lzo_copyright; -#endif -} - -LZO_PUBLIC(unsigned) -lzo_version(void) -{ - return LZO_VERSION; -} - -LZO_PUBLIC(const char *) -lzo_version_string(void) -{ - return LZO_VERSION_STRING; -} - -LZO_PUBLIC(const char *) -lzo_version_date(void) -{ - return LZO_VERSION_DATE; -} - -LZO_PUBLIC(const lzo_charp) -_lzo_version_string(void) -{ - return LZO_VERSION_STRING; -} - -LZO_PUBLIC(const lzo_charp) -_lzo_version_date(void) -{ - return LZO_VERSION_DATE; -} - -#define LZO_BASE 65521u -#define LZO_NMAX 5552 - -#define LZO_DO1(buf,i) s1 += buf[i]; s2 += s1 -#define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1); -#define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2); -#define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4); -#define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8); - -LZO_PUBLIC(lzo_uint32) -lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len) -{ - lzo_uint32 s1 = adler & 0xffff; - lzo_uint32 s2 = (adler >> 16) & 0xffff; - unsigned k; - - if (buf == NULL) - return 1; - - while (len > 0) - { - k = len < LZO_NMAX ? (unsigned) len : LZO_NMAX; - len -= k; - if (k >= 16) do - { - LZO_DO16(buf,0); - buf += 16; - k -= 16; - } while (k >= 16); - if (k != 0) do - { - s1 += *buf++; - s2 += s1; - } while (--k > 0); - s1 %= LZO_BASE; - s2 %= LZO_BASE; - } - return (s2 << 16) | s1; -} - -#undef LZO_DO1 -#undef LZO_DO2 -#undef LZO_DO4 -#undef LZO_DO8 -#undef LZO_DO16 - -#if !defined(MINILZO_CFG_SKIP_LZO_STRING) -#undef lzo_memcmp -#undef lzo_memcpy -#undef lzo_memmove -#undef lzo_memset -#if !defined(__LZO_MMODEL_HUGE) -# undef LZO_HAVE_MM_HUGE_PTR -#endif -#define lzo_hsize_t lzo_uint -#define lzo_hvoid_p lzo_voidp -#define lzo_hbyte_p lzo_bytep -#define LZOLIB_PUBLIC(r,f) LZO_PUBLIC(r) f -#define lzo_hmemcmp lzo_memcmp -#define lzo_hmemcpy lzo_memcpy -#define lzo_hmemmove lzo_memmove -#define lzo_hmemset lzo_memset -#define __LZOLIB_HMEMCPY_CH_INCLUDED 1 -#if !defined(LZOLIB_PUBLIC) -# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) -#endif -LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCMP) - const lzo_hbyte_p p1 = (const lzo_hbyte_p) s1; - const lzo_hbyte_p p2 = (const lzo_hbyte_p) s2; - if __lzo_likely(len > 0) do - { - int d = *p1 - *p2; - if (d != 0) - return d; - p1++; p2++; - } while __lzo_likely(--len > 0); - return 0; -#else - return memcmp(s1, s2, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCPY) - lzo_hbyte_p p1 = (lzo_hbyte_p) dest; - const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; - if (!(len > 0) || p1 == p2) - return dest; - do - *p1++ = *p2++; - while __lzo_likely(--len > 0); - return dest; -#else - return memcpy(dest, src, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMMOVE) - lzo_hbyte_p p1 = (lzo_hbyte_p) dest; - const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; - if (!(len > 0) || p1 == p2) - return dest; - if (p1 < p2) - { - do - *p1++ = *p2++; - while __lzo_likely(--len > 0); - } - else - { - p1 += len; - p2 += len; - do - *--p1 = *--p2; - while __lzo_likely(--len > 0); - } - return dest; -#else - return memmove(dest, src, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMSET) - lzo_hbyte_p p = (lzo_hbyte_p) s; - if __lzo_likely(len > 0) do - *p++ = (unsigned char) c; - while __lzo_likely(--len > 0); - return s; -#else - return memset(s, c, len); -#endif -} -#undef LZOLIB_PUBLIC -#endif - -#if !defined(__LZO_IN_MINILZO) - -#define ACC_WANT_ACC_CHK_CH 1 -#undef ACCCHK_ASSERT - - ACCCHK_ASSERT_IS_SIGNED_T(lzo_int) - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint) - - ACCCHK_ASSERT_IS_SIGNED_T(lzo_int32) - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32) - ACCCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0) - ACCCHK_ASSERT(sizeof(lzo_uint32) >= 4) - -#if !defined(__LZO_UINTPTR_T_IS_POINTER) - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t) -#endif - ACCCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_xint) - ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint32)) - ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint)) - ACCCHK_ASSERT(sizeof(lzo_xint) == sizeof(lzo_uint32) || sizeof(lzo_xint) == sizeof(lzo_uint)) - -#endif -#undef ACCCHK_ASSERT - -LZO_PUBLIC(int) -_lzo_config_check(void) -{ - lzo_bool r = 1; - union { unsigned char c[2*sizeof(lzo_xint)]; lzo_xint l[2]; } u; - lzo_uintptr_t p; - -#if !defined(LZO_CFG_NO_CONFIG_CHECK) -#if defined(LZO_ABI_BIG_ENDIAN) - u.l[0] = u.l[1] = 0; u.c[sizeof(lzo_xint) - 1] = 128; - r &= (u.l[0] == 128); -#endif -#if defined(LZO_ABI_LITTLE_ENDIAN) - u.l[0] = u.l[1] = 0; u.c[0] = 128; - r &= (u.l[0] == 128); -#endif -#if defined(LZO_UNALIGNED_OK_2) - p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; - u.l[0] = u.l[1] = 0; - r &= ((* (const lzo_ushortp) (p+1)) == 0); -#endif -#if defined(LZO_UNALIGNED_OK_4) - p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; - u.l[0] = u.l[1] = 0; - r &= ((* (const lzo_uint32p) (p+1)) == 0); -#endif -#endif - - LZO_UNUSED(u); LZO_UNUSED(p); - return r == 1 ? LZO_E_OK : LZO_E_ERROR; -} - -int __lzo_init_done = 0; - -LZO_PUBLIC(int) -__lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5, - int s6, int s7, int s8, int s9) -{ - int r; - -#if defined(__LZO_IN_MINILZO) -#elif (LZO_CC_MSC && ((_MSC_VER) < 700)) -#else -#define ACC_WANT_ACC_CHK_CH 1 -#undef ACCCHK_ASSERT -#define ACCCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr) -#endif -#undef ACCCHK_ASSERT - - __lzo_init_done = 1; - - if (v == 0) - return LZO_E_ERROR; - - r = (s1 == -1 || s1 == (int) sizeof(short)) && - (s2 == -1 || s2 == (int) sizeof(int)) && - (s3 == -1 || s3 == (int) sizeof(long)) && - (s4 == -1 || s4 == (int) sizeof(lzo_uint32)) && - (s5 == -1 || s5 == (int) sizeof(lzo_uint)) && - (s6 == -1 || s6 == (int) lzo_sizeof_dict_t) && - (s7 == -1 || s7 == (int) sizeof(char *)) && - (s8 == -1 || s8 == (int) sizeof(lzo_voidp)) && - (s9 == -1 || s9 == (int) sizeof(lzo_callback_t)); - if (!r) - return LZO_E_ERROR; - - r = _lzo_config_check(); - if (r != LZO_E_OK) - return r; - - return r; -} - -#if !defined(__LZO_IN_MINILZO) - -#if (LZO_OS_WIN16 && LZO_CC_WATCOMC) && defined(__SW_BD) - -#if 0 -BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment, - WORD wHeapSize, LPSTR lpszCmdLine ) -#else -int __far __pascal LibMain ( int a, short b, short c, long d ) -#endif -{ - LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d); - return 1; -} - -#endif - -#endif - -#define do_compress _lzo1x_1_do_compress - -#if !defined(MINILZO_CFG_SKIP_LZO1X_1_COMPRESS) - -#define LZO_NEED_DICT_H -#define D_BITS 14 -#define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5) -#define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f) - -#ifndef __LZO_CONFIG1X_H -#define __LZO_CONFIG1X_H - -#if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z) -# define LZO1X -#endif - -#if !defined(__LZO_IN_MINILZO) -#include "lzo/lzo1x.h" -#endif - -#define LZO_EOF_CODE -#undef LZO_DETERMINISTIC - -#define M1_MAX_OFFSET 0x0400 -#ifndef M2_MAX_OFFSET -#define M2_MAX_OFFSET 0x0800 -#endif -#define M3_MAX_OFFSET 0x4000 -#define M4_MAX_OFFSET 0xbfff - -#define MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET) - -#define M1_MIN_LEN 2 -#define M1_MAX_LEN 2 -#define M2_MIN_LEN 3 -#ifndef M2_MAX_LEN -#define M2_MAX_LEN 8 -#endif -#define M3_MIN_LEN 3 -#define M3_MAX_LEN 33 -#define M4_MIN_LEN 3 -#define M4_MAX_LEN 9 - -#define M1_MARKER 0 -#define M2_MARKER 64 -#define M3_MARKER 32 -#define M4_MARKER 16 - -#ifndef MIN_LOOKAHEAD -#define MIN_LOOKAHEAD (M2_MAX_LEN + 1) -#endif - -#if defined(LZO_NEED_DICT_H) - -#ifndef LZO_HASH -#define LZO_HASH LZO_HASH_LZO_INCREMENTAL_B -#endif -#define DL_MIN_LEN M2_MIN_LEN - -#ifndef __LZO_DICT_H -#define __LZO_DICT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(D_BITS) && defined(DBITS) -# define D_BITS DBITS -#endif -#if !defined(D_BITS) -# error "D_BITS is not defined" -#endif -#if (D_BITS < 16) -# define D_SIZE LZO_SIZE(D_BITS) -# define D_MASK LZO_MASK(D_BITS) -#else -# define D_SIZE LZO_USIZE(D_BITS) -# define D_MASK LZO_UMASK(D_BITS) -#endif -#define D_HIGH ((D_MASK >> 1) + 1) - -#if !defined(DD_BITS) -# define DD_BITS 0 -#endif -#define DD_SIZE LZO_SIZE(DD_BITS) -#define DD_MASK LZO_MASK(DD_BITS) - -#if !defined(DL_BITS) -# define DL_BITS (D_BITS - DD_BITS) -#endif -#if (DL_BITS < 16) -# define DL_SIZE LZO_SIZE(DL_BITS) -# define DL_MASK LZO_MASK(DL_BITS) -#else -# define DL_SIZE LZO_USIZE(DL_BITS) -# define DL_MASK LZO_UMASK(DL_BITS) -#endif - -#if (D_BITS != DL_BITS + DD_BITS) -# error "D_BITS does not match" -#endif -#if (D_BITS < 8 || D_BITS > 18) -# error "invalid D_BITS" -#endif -#if (DL_BITS < 8 || DL_BITS > 20) -# error "invalid DL_BITS" -#endif -#if (DD_BITS < 0 || DD_BITS > 6) -# error "invalid DD_BITS" -#endif - -#if !defined(DL_MIN_LEN) -# define DL_MIN_LEN 3 -#endif -#if !defined(DL_SHIFT) -# define DL_SHIFT ((DL_BITS + (DL_MIN_LEN - 1)) / DL_MIN_LEN) -#endif - -#define LZO_HASH_GZIP 1 -#define LZO_HASH_GZIP_INCREMENTAL 2 -#define LZO_HASH_LZO_INCREMENTAL_A 3 -#define LZO_HASH_LZO_INCREMENTAL_B 4 - -#if !defined(LZO_HASH) -# error "choose a hashing strategy" -#endif - -#undef DM -#undef DX - -#if (DL_MIN_LEN == 3) -# define _DV2_A(p,shift1,shift2) \ - (((( (lzo_xint)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2]) -# define _DV2_B(p,shift1,shift2) \ - (((( (lzo_xint)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0]) -# define _DV3_B(p,shift1,shift2,shift3) \ - ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0]) -#elif (DL_MIN_LEN == 2) -# define _DV2_A(p,shift1,shift2) \ - (( (lzo_xint)(p[0]) << shift1) ^ p[1]) -# define _DV2_B(p,shift1,shift2) \ - (( (lzo_xint)(p[1]) << shift1) ^ p[2]) -#else -# error "invalid DL_MIN_LEN" -#endif -#define _DV_A(p,shift) _DV2_A(p,shift,shift) -#define _DV_B(p,shift) _DV2_B(p,shift,shift) -#define DA2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0]) -#define DS2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0]) -#define DX2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0]) -#define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0]) -#define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0]) -#define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0]) -#define DMS(v,s) ((lzo_uint) (((v) & (D_MASK >> (s))) << (s))) -#define DM(v) DMS(v,0) - -#if (LZO_HASH == LZO_HASH_GZIP) -# define _DINDEX(dv,p) (_DV_A((p),DL_SHIFT)) - -#elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL) -# define __LZO_HASH_INCREMENTAL -# define DVAL_FIRST(dv,p) dv = _DV_A((p),DL_SHIFT) -# define DVAL_NEXT(dv,p) dv = (((dv) << DL_SHIFT) ^ p[2]) -# define _DINDEX(dv,p) (dv) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A) -# define __LZO_HASH_INCREMENTAL -# define DVAL_FIRST(dv,p) dv = _DV_A((p),5) -# define DVAL_NEXT(dv,p) \ - dv ^= (lzo_xint)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2]) -# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B) -# define __LZO_HASH_INCREMENTAL -# define DVAL_FIRST(dv,p) dv = _DV_B((p),5) -# define DVAL_NEXT(dv,p) \ - dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_xint)(p[2]) << (2*5))) -# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#else -# error "choose a hashing strategy" -#endif - -#ifndef DINDEX -#define DINDEX(dv,p) ((lzo_uint)((_DINDEX(dv,p)) & DL_MASK) << DD_BITS) -#endif -#if !defined(DINDEX1) && defined(D_INDEX1) -#define DINDEX1 D_INDEX1 -#endif -#if !defined(DINDEX2) && defined(D_INDEX2) -#define DINDEX2 D_INDEX2 -#endif - -#if !defined(__LZO_HASH_INCREMENTAL) -# define DVAL_FIRST(dv,p) ((void) 0) -# define DVAL_NEXT(dv,p) ((void) 0) -# define DVAL_LOOKAHEAD 0 -#endif - -#if !defined(DVAL_ASSERT) -#if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG) -static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) -{ - lzo_xint df; - DVAL_FIRST(df,(p)); - assert(DINDEX(dv,p) == DINDEX(df,p)); -} -#else -# define DVAL_ASSERT(dv,p) ((void) 0) -#endif -#endif - -#if defined(LZO_DICT_USE_PTR) -# define DENTRY(p,in) (p) -# define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex] -#else -# define DENTRY(p,in) ((lzo_uint) ((p)-(in))) -# define GINDEX(m_pos,m_off,dict,dindex,in) m_off = dict[dindex] -#endif - -#if (DD_BITS == 0) - -# define UPDATE_D(dict,drun,dv,p,in) dict[ DINDEX(dv,p) ] = DENTRY(p,in) -# define UPDATE_I(dict,drun,index,p,in) dict[index] = DENTRY(p,in) -# define UPDATE_P(ptr,drun,p,in) (ptr)[0] = DENTRY(p,in) - -#else - -# define UPDATE_D(dict,drun,dv,p,in) \ - dict[ DINDEX(dv,p) + drun++ ] = DENTRY(p,in); drun &= DD_MASK -# define UPDATE_I(dict,drun,index,p,in) \ - dict[ (index) + drun++ ] = DENTRY(p,in); drun &= DD_MASK -# define UPDATE_P(ptr,drun,p,in) \ - (ptr) [ drun++ ] = DENTRY(p,in); drun &= DD_MASK - -#endif - -#if defined(LZO_DICT_USE_PTR) - -#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ - (m_pos == NULL || (m_off = pd(ip, m_pos)) > max_offset) - -#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ - (BOUNDS_CHECKING_OFF_IN_EXPR(( \ - m_pos = ip - (lzo_uint) PTR_DIFF(ip,m_pos), \ - PTR_LT(m_pos,in) || \ - (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) <= 0 || \ - m_off > max_offset ))) - -#else - -#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ - (m_off == 0 || \ - ((m_off = pd(ip, in) - m_off) > max_offset) || \ - (m_pos = (ip) - (m_off), 0) ) - -#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ - (pd(ip, in) <= m_off || \ - ((m_off = pd(ip, in) - m_off) > max_offset) || \ - (m_pos = (ip) - (m_off), 0) ) - -#endif - -#if defined(LZO_DETERMINISTIC) -# define LZO_CHECK_MPOS LZO_CHECK_MPOS_DET -#else -# define LZO_CHECK_MPOS LZO_CHECK_MPOS_NON_DET -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -#endif - -#endif - -#define DO_COMPRESS lzo1x_1_compress - -static __lzo_noinline lzo_uint -do_compress ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -{ - register const lzo_bytep ip; - lzo_bytep op; - const lzo_bytep const in_end = in + in_len; - const lzo_bytep const ip_end = in + in_len - M2_MAX_LEN - 5; - const lzo_bytep ii; - lzo_dict_p const dict = (lzo_dict_p) wrkmem; - - op = out; - ip = in; - ii = ip; - - ip += 4; - for (;;) - { - register const lzo_bytep m_pos; - lzo_uint m_off; - lzo_uint m_len; - lzo_uint dindex; - - DINDEX1(dindex,ip); - GINDEX(m_pos,m_off,dict,dindex,in); - if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) - goto literal; -#if 1 - if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) - goto try_match; - DINDEX2(dindex,ip); -#endif - GINDEX(m_pos,m_off,dict,dindex,in); - if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) - goto literal; - if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) - goto try_match; - goto literal; - -try_match: -#if 1 && defined(LZO_UNALIGNED_OK_2) - if (* (const lzo_ushortp) m_pos != * (const lzo_ushortp) ip) -#else - if (m_pos[0] != ip[0] || m_pos[1] != ip[1]) -#endif - { - } - else - { - if __lzo_likely(m_pos[2] == ip[2]) - { -#if 0 - if (m_off <= M2_MAX_OFFSET) - goto match; - if (lit <= 3) - goto match; - if (lit == 3) - { - assert(op - 2 > out); op[-2] |= LZO_BYTE(3); - *op++ = *ii++; *op++ = *ii++; *op++ = *ii++; - goto code_match; - } - if (m_pos[3] == ip[3]) -#endif - goto match; - } - else - { -#if 0 -#if 0 - if (m_off <= M1_MAX_OFFSET && lit > 0 && lit <= 3) -#else - if (m_off <= M1_MAX_OFFSET && lit == 3) -#endif - { - register lzo_uint t; - - t = lit; - assert(op - 2 > out); op[-2] |= LZO_BYTE(t); - do *op++ = *ii++; while (--t > 0); - assert(ii == ip); - m_off -= 1; - *op++ = LZO_BYTE(M1_MARKER | ((m_off & 3) << 2)); - *op++ = LZO_BYTE(m_off >> 2); - ip += 2; - goto match_done; - } -#endif - } - } - -literal: - UPDATE_I(dict,0,dindex,ip,in); - ++ip; - if __lzo_unlikely(ip >= ip_end) - break; - continue; - -match: - UPDATE_I(dict,0,dindex,ip,in); - if (pd(ip,ii) > 0) - { - register lzo_uint t = pd(ip,ii); - - if (t <= 3) - { - assert(op - 2 > out); - op[-2] |= LZO_BYTE(t); - } - else if (t <= 18) - *op++ = LZO_BYTE(t - 3); - else - { - register lzo_uint tt = t - 18; - - *op++ = 0; - while (tt > 255) - { - tt -= 255; - *op++ = 0; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } - do *op++ = *ii++; while (--t > 0); - } - - assert(ii == ip); - ip += 3; - if (m_pos[3] != *ip++ || m_pos[4] != *ip++ || m_pos[5] != *ip++ || - m_pos[6] != *ip++ || m_pos[7] != *ip++ || m_pos[8] != *ip++ -#ifdef LZO1Y - || m_pos[ 9] != *ip++ || m_pos[10] != *ip++ || m_pos[11] != *ip++ - || m_pos[12] != *ip++ || m_pos[13] != *ip++ || m_pos[14] != *ip++ -#endif - ) - { - --ip; - m_len = pd(ip, ii); - assert(m_len >= 3); assert(m_len <= M2_MAX_LEN); - - if (m_off <= M2_MAX_OFFSET) - { - m_off -= 1; -#if defined(LZO1X) - *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); - *op++ = LZO_BYTE(m_off >> 3); -#elif defined(LZO1Y) - *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); - *op++ = LZO_BYTE(m_off >> 2); -#endif - } - else if (m_off <= M3_MAX_OFFSET) - { - m_off -= 1; - *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); - goto m3_m4_offset; - } - else -#if defined(LZO1X) - { - m_off -= 0x4000; - assert(m_off > 0); assert(m_off <= 0x7fff); - *op++ = LZO_BYTE(M4_MARKER | - ((m_off & 0x4000) >> 11) | (m_len - 2)); - goto m3_m4_offset; - } -#elif defined(LZO1Y) - goto m4_match; -#endif - } - else - { - { - const lzo_bytep end = in_end; - const lzo_bytep m = m_pos + M2_MAX_LEN + 1; - while (ip < end && *m == *ip) - m++, ip++; - m_len = pd(ip, ii); - } - assert(m_len > M2_MAX_LEN); - - if (m_off <= M3_MAX_OFFSET) - { - m_off -= 1; - if (m_len <= 33) - *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); - else - { - m_len -= 33; - *op++ = M3_MARKER | 0; - goto m3_m4_len; - } - } - else - { -#if defined(LZO1Y) -m4_match: -#endif - m_off -= 0x4000; - assert(m_off > 0); assert(m_off <= 0x7fff); - if (m_len <= M4_MAX_LEN) - *op++ = LZO_BYTE(M4_MARKER | - ((m_off & 0x4000) >> 11) | (m_len - 2)); - else - { - m_len -= M4_MAX_LEN; - *op++ = LZO_BYTE(M4_MARKER | ((m_off & 0x4000) >> 11)); -m3_m4_len: - while (m_len > 255) - { - m_len -= 255; - *op++ = 0; - } - assert(m_len > 0); - *op++ = LZO_BYTE(m_len); - } - } - -m3_m4_offset: - *op++ = LZO_BYTE((m_off & 63) << 2); - *op++ = LZO_BYTE(m_off >> 6); - } - -#if 0 -match_done: -#endif - ii = ip; - if __lzo_unlikely(ip >= ip_end) - break; - } - - *out_len = pd(op, out); - return pd(in_end,ii); -} - -LZO_PUBLIC(int) -DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -{ - lzo_bytep op = out; - lzo_uint t; - - if __lzo_unlikely(in_len <= M2_MAX_LEN + 5) - t = in_len; - else - { - t = do_compress(in,in_len,op,out_len,wrkmem); - op += *out_len; - } - - if (t > 0) - { - const lzo_bytep ii = in + in_len - t; - - if (op == out && t <= 238) - *op++ = LZO_BYTE(17 + t); - else if (t <= 3) - op[-2] |= LZO_BYTE(t); - else if (t <= 18) - *op++ = LZO_BYTE(t - 3); - else - { - lzo_uint tt = t - 18; - - *op++ = 0; - while (tt > 255) - { - tt -= 255; - *op++ = 0; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } - do *op++ = *ii++; while (--t > 0); - } - - *op++ = M4_MARKER | 1; - *op++ = 0; - *op++ = 0; - - *out_len = pd(op, out); - return LZO_E_OK; -} - -#endif - -#undef do_compress -#undef DO_COMPRESS -#undef LZO_HASH - -#undef LZO_TEST_OVERRUN -#undef DO_DECOMPRESS -#define DO_DECOMPRESS lzo1x_decompress - -#if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS) - -#if defined(LZO_TEST_OVERRUN) -# if !defined(LZO_TEST_OVERRUN_INPUT) -# define LZO_TEST_OVERRUN_INPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_OUTPUT) -# define LZO_TEST_OVERRUN_OUTPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND -# endif -#endif - -#undef TEST_IP -#undef TEST_OP -#undef TEST_LB -#undef TEST_LBO -#undef NEED_IP -#undef NEED_OP -#undef HAVE_TEST_IP -#undef HAVE_TEST_OP -#undef HAVE_NEED_IP -#undef HAVE_NEED_OP -#undef HAVE_ANY_IP -#undef HAVE_ANY_OP - -#if defined(LZO_TEST_OVERRUN_INPUT) -# if (LZO_TEST_OVERRUN_INPUT >= 1) -# define TEST_IP (ip < ip_end) -# endif -# if (LZO_TEST_OVERRUN_INPUT >= 2) -# define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_OUTPUT) -# if (LZO_TEST_OVERRUN_OUTPUT >= 1) -# define TEST_OP (op <= op_end) -# endif -# if (LZO_TEST_OVERRUN_OUTPUT >= 2) -# undef TEST_OP -# define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun -# define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun -#else -# define TEST_LB(m_pos) ((void) 0) -# define TEST_LBO(m_pos,o) ((void) 0) -#endif - -#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) -# define TEST_IP (ip < ip_end) -#endif - -#if defined(TEST_IP) -# define HAVE_TEST_IP -#else -# define TEST_IP 1 -#endif -#if defined(TEST_OP) -# define HAVE_TEST_OP -#else -# define TEST_OP 1 -#endif - -#if defined(NEED_IP) -# define HAVE_NEED_IP -#else -# define NEED_IP(x) ((void) 0) -#endif -#if defined(NEED_OP) -# define HAVE_NEED_OP -#else -# define NEED_OP(x) ((void) 0) -#endif - -#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP -#endif -#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP -#endif - -#undef __COPY4 -#define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) - -#undef COPY4 -#if defined(LZO_UNALIGNED_OK_4) -# define COPY4(dst,src) __COPY4(dst,src) -#elif defined(LZO_ALIGNED_OK_4) -# define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) -#endif - -#if defined(DO_DECOMPRESS) -LZO_PUBLIC(int) -DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -#endif -{ - register lzo_bytep op; - register const lzo_bytep ip; - register lzo_uint t; -#if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; -#else - register const lzo_bytep m_pos; -#endif - - const lzo_bytep const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - lzo_bytep const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - lzo_uint last_m_off = 0; -#endif - - LZO_UNUSED(wrkmem); - -#if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif - - *out_len = 0; - - op = out; - ip = in; - - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+1); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - - while (TEST_IP && TEST_OP) - { - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 15 + *ip++; - } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (PTR_ALIGNED2_4(op,ip)) - { -#endif - COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } -#if !defined(LZO_UNALIGNED_OK_4) - } - else -#endif -#endif -#if !defined(LZO_UNALIGNED_OK_4) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } -#endif - -first_literal_run: - - t = *ip++; - if (t >= 16) - goto match; -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(3); - t = 3; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - (1 + M2_MAX_OFFSET); - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - - do { -match: - if (t >= 64) - { -#if defined(COPY_DICT) -#if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; -#elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; -#endif -#else -#if defined(LZO1X) - m_pos = op - 1; - m_pos -= (t >> 2) & 7; - m_pos -= *ip++ << 3; - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; -#elif defined(LZO1Z) - { - lzo_uint off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); - goto copy_match; -#endif - } - else if (t >= 32) - { - t &= 31; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 31 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; -#else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); -#endif -#else -#if defined(LZO1Z) - { - lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif - ip += 2; - } - else if (t >= 16) - { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else - m_pos = op; - m_pos -= (t & 8) << 11; -#endif - t &= 7; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 7 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_pos == op) - goto eof_found; - m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const lzo_bytep)op, m_pos); -#endif -#endif - } - else - { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(2); - t = 2; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - 1; - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - } - -#if defined(COPY_DICT) - - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t,m_off) - -#else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -#else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif - { -copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); - } - -#endif - -match_done: -#if defined(LZO1Z) - t = ip[-1] & 3; -#else - t = ip[-2] & 3; -#endif - if (t == 0) - break; - -match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif - t = *ip++; - } while (TEST_IP && TEST_OP); - } - -#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) - *out_len = pd(op, out); - return LZO_E_EOF_NOT_FOUND; -#endif - -eof_found: - assert(t == 1); - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); - -#if defined(HAVE_NEED_IP) -input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; -#endif - -#if defined(HAVE_NEED_OP) -output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif -} - -#endif - -#define LZO_TEST_OVERRUN -#undef DO_DECOMPRESS -#define DO_DECOMPRESS lzo1x_decompress_safe - -#if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS_SAFE) - -#if defined(LZO_TEST_OVERRUN) -# if !defined(LZO_TEST_OVERRUN_INPUT) -# define LZO_TEST_OVERRUN_INPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_OUTPUT) -# define LZO_TEST_OVERRUN_OUTPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND -# endif -#endif - -#undef TEST_IP -#undef TEST_OP -#undef TEST_LB -#undef TEST_LBO -#undef NEED_IP -#undef NEED_OP -#undef HAVE_TEST_IP -#undef HAVE_TEST_OP -#undef HAVE_NEED_IP -#undef HAVE_NEED_OP -#undef HAVE_ANY_IP -#undef HAVE_ANY_OP - -#if defined(LZO_TEST_OVERRUN_INPUT) -# if (LZO_TEST_OVERRUN_INPUT >= 1) -# define TEST_IP (ip < ip_end) -# endif -# if (LZO_TEST_OVERRUN_INPUT >= 2) -# define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_OUTPUT) -# if (LZO_TEST_OVERRUN_OUTPUT >= 1) -# define TEST_OP (op <= op_end) -# endif -# if (LZO_TEST_OVERRUN_OUTPUT >= 2) -# undef TEST_OP -# define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun -# define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun -#else -# define TEST_LB(m_pos) ((void) 0) -# define TEST_LBO(m_pos,o) ((void) 0) -#endif - -#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) -# define TEST_IP (ip < ip_end) -#endif - -#if defined(TEST_IP) -# define HAVE_TEST_IP -#else -# define TEST_IP 1 -#endif -#if defined(TEST_OP) -# define HAVE_TEST_OP -#else -# define TEST_OP 1 -#endif - -#if defined(NEED_IP) -# define HAVE_NEED_IP -#else -# define NEED_IP(x) ((void) 0) -#endif -#if defined(NEED_OP) -# define HAVE_NEED_OP -#else -# define NEED_OP(x) ((void) 0) -#endif - -#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP -#endif -#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP -#endif - -#undef __COPY4 -#define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) - -#undef COPY4 -#if defined(LZO_UNALIGNED_OK_4) -# define COPY4(dst,src) __COPY4(dst,src) -#elif defined(LZO_ALIGNED_OK_4) -# define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) -#endif - -#if defined(DO_DECOMPRESS) -LZO_PUBLIC(int) -DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -#endif -{ - register lzo_bytep op; - register const lzo_bytep ip; - register lzo_uint t; -#if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; -#else - register const lzo_bytep m_pos; -#endif - - const lzo_bytep const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - lzo_bytep const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - lzo_uint last_m_off = 0; -#endif - - LZO_UNUSED(wrkmem); - -#if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif - - *out_len = 0; - - op = out; - ip = in; - - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+1); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - - while (TEST_IP && TEST_OP) - { - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 15 + *ip++; - } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (PTR_ALIGNED2_4(op,ip)) - { -#endif - COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } -#if !defined(LZO_UNALIGNED_OK_4) - } - else -#endif -#endif -#if !defined(LZO_UNALIGNED_OK_4) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } -#endif - -first_literal_run: - - t = *ip++; - if (t >= 16) - goto match; -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(3); - t = 3; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - (1 + M2_MAX_OFFSET); - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - - do { -match: - if (t >= 64) - { -#if defined(COPY_DICT) -#if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; -#elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; -#endif -#else -#if defined(LZO1X) - m_pos = op - 1; - m_pos -= (t >> 2) & 7; - m_pos -= *ip++ << 3; - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; -#elif defined(LZO1Z) - { - lzo_uint off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); - goto copy_match; -#endif - } - else if (t >= 32) - { - t &= 31; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 31 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; -#else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); -#endif -#else -#if defined(LZO1Z) - { - lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif - ip += 2; - } - else if (t >= 16) - { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else - m_pos = op; - m_pos -= (t & 8) << 11; -#endif - t &= 7; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 7 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_pos == op) - goto eof_found; - m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const lzo_bytep)op, m_pos); -#endif -#endif - } - else - { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(2); - t = 2; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - 1; - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - } - -#if defined(COPY_DICT) - - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t,m_off) - -#else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -#else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif - { -copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); - } - -#endif - -match_done: -#if defined(LZO1Z) - t = ip[-1] & 3; -#else - t = ip[-2] & 3; -#endif - if (t == 0) - break; - -match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif - t = *ip++; - } while (TEST_IP && TEST_OP); - } - -#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) - *out_len = pd(op, out); - return LZO_E_EOF_NOT_FOUND; -#endif - -eof_found: - assert(t == 1); - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); - -#if defined(HAVE_NEED_IP) -input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; -#endif - -#if defined(HAVE_NEED_OP) -output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif -} - -#endif - -/***** End of minilzo.c *****/ - diff --git a/bundles/n2n_meyerd/n2n_v1/minilzo.h b/bundles/n2n_meyerd/n2n_v1/minilzo.h deleted file mode 100644 index 0aff50e4..00000000 --- a/bundles/n2n_meyerd/n2n_v1/minilzo.h +++ /dev/null @@ -1,106 +0,0 @@ -/* minilzo.h -- mini subset of the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - -/* - * NOTE: - * the full LZO package can be found at - * http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __MINILZO_H -#define __MINILZO_H - -#define MINILZO_VERSION 0x2030 - -#ifdef __LZOCONF_H -# error "you cannot use both LZO and miniLZO" -#endif - -#undef LZO_HAVE_CONFIG_H -#include "lzoconf.h" - -#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) -# error "version mismatch in header files" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/*********************************************************************** -// -************************************************************************/ - -/* Memory required for the wrkmem parameter. - * When the required size is 0, you can also pass a NULL pointer. - */ - -#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS -#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t)) -#define LZO1X_MEM_DECOMPRESS (0) - - -/* compression */ -LZO_EXTERN(int) -lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -/* decompression */ -LZO_EXTERN(int) -lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem /* NOT USED */ ); - -/* safe decompression with overrun testing */ -LZO_EXTERN(int) -lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem /* NOT USED */ ); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* already included */ - diff --git a/bundles/n2n_meyerd/n2n_v1/n2n.c b/bundles/n2n_meyerd/n2n_v1/n2n.c deleted file mode 100644 index 2aee17ac..00000000 --- a/bundles/n2n_meyerd/n2n_v1/n2n.c +++ /dev/null @@ -1,966 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * Richard Andrews - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - * Code contributions courtesy of: - * Richard Andrews - * Massimo Torquati - * - */ - -#include "n2n.h" - -#include "minilzo.h" - -#include - -#if defined(DEBUG) -# define PURGE_REGISTRATION_FREQUENCY 60 -# define REGISTRATION_TIMEOUT 120 -#else /* #if defined(DEBUG) */ -# define PURGE_REGISTRATION_FREQUENCY 60 -# define REGISTRATION_TIMEOUT (60*5) -#endif /* #if defined(DEBUG) */ - - -char broadcast_addr[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; -char multicast_addr[6] = { 0x01, 0x00, 0x05, 0x00, 0x00, 0x00 }; /* First 3 bytes are meaningful */ - -/* ************************************** */ - -static void print_header( const char * msg, const struct n2n_packet_header * hdr ) -{ - ipstr_t buf; - ipstr_t buf2; - - traceEvent(TRACE_INFO, "%s hdr: public_ip=(%d)%s:%d, private_ip=(%d)%s:%d", msg, - hdr->public_ip.family, - intoa(ntohl(hdr->public_ip.addr_type.v4_addr), buf, sizeof(buf)), - ntohs(hdr->public_ip.port), - hdr->private_ip.family, - intoa(ntohl(hdr->private_ip.addr_type.v4_addr), buf2, sizeof(buf2)), - ntohs(hdr->private_ip.port) - ); -} - -/* *********************************************** */ - -extern void sockaddr_in2peer_addr(struct sockaddr_in *in, struct peer_addr *out) { - out->family = (u_int8_t)in->sin_family; - out->port = in->sin_port; - out->addr_type.v4_addr = in->sin_addr.s_addr; -} - -/* *********************************************** */ - -extern void peer_addr2sockaddr_in(const struct peer_addr *in, struct sockaddr_in *out) { - out->sin_family = in->family; - out->sin_port = in->port; - out->sin_addr.s_addr = in->addr_type.v4_addr; -} - -/* ************************************** */ - -static -int marshall_peer_addr( u_int8_t * buf, size_t * offset, const struct peer_addr * s ) -{ - /* RA: I'm pretty sure that this is broken. There is no guarantee that the - * peer_addr structure is packed. This will always work between like hosts but - * is almost certainly broken between different host types. */ - memcpy( buf + *offset, s, sizeof(struct peer_addr)); - *offset += sizeof(struct peer_addr); - - return sizeof(struct peer_addr); /* bytes written */ -} - -/* ************************************** */ - -static -int marshall_uint32( u_int8_t * buf, size_t * offset, u_int32_t val ) -{ - buf[*offset + 0] = ((val >> 24) & 0xff); - buf[*offset + 1] = ((val >> 16) & 0xff); - buf[*offset + 2] = ((val >> 8) & 0xff); - buf[*offset + 3] = ((val ) & 0xff); - - *offset += 4; - return 4; -} - -/* ************************************** */ - -int marshall_n2n_packet_header( u_int8_t * buf, const struct n2n_packet_header * hdr ) -{ - size_t offset = 0; - - print_header( "Marshalling ", hdr ); - - *(buf+offset) = hdr->version; - ++offset; - - *(buf+offset) = hdr->msg_type; - ++offset; - - *(buf+offset) = hdr->ttl; - ++offset; - - *(buf+offset) = hdr->sent_by_supernode; - ++offset; - - memcpy( buf+offset, hdr->community_name, COMMUNITY_LEN ); - offset += COMMUNITY_LEN; - - memcpy( buf+offset, hdr->src_mac, 6 ); - offset += 6; - - memcpy( buf+offset, hdr->dst_mac, 6 ); - offset += 6; - - marshall_peer_addr( buf, &offset, &(hdr->public_ip) ); - marshall_peer_addr( buf, &offset, &(hdr->private_ip) ); - - *(buf+offset) = (hdr->pkt_type & 0xff); - ++offset; - - marshall_uint32( buf, &offset, hdr->sequence_id ); - marshall_uint32( buf, &offset, hdr->crc ); - - return offset; -} - -/* ************************************** */ - -static -int unmarshall_peer_addr( struct peer_addr * s, size_t * offset, - const u_int8_t * buf ) -{ - memcpy(s, buf + *offset, sizeof(struct peer_addr)); - *offset += sizeof(struct peer_addr); - return (sizeof(struct peer_addr)); /* bytes written */ -} - -/* ************************************** */ - -static -int unmarshall_uint32( u_int32_t * val, size_t * offset, const u_int8_t * buf ) -{ - *val = ( (buf[*offset + 0] & 0xff) << 24 ); - *val |= ( (buf[*offset + 1] & 0xff) << 16 ); - *val |= ( (buf[*offset + 2] & 0xff) << 8 ); - *val |= ( (buf[*offset + 3] & 0xff) ); - - *offset += 4; - return 4; -} - -/* ************************************** */ - -int unmarshall_n2n_packet_header( struct n2n_packet_header * hdr, const u_int8_t * buf ) -{ - size_t offset=0; - - hdr->version = *(buf + offset); - ++offset; - - hdr->msg_type = *(buf + offset); - ++offset; - - hdr->ttl = *(buf + offset); - ++offset; - - hdr->sent_by_supernode = *(buf + offset); - ++offset; - - memcpy( hdr->community_name, (buf + offset), COMMUNITY_LEN ); - offset += COMMUNITY_LEN; - - memcpy( hdr->src_mac, (buf + offset), 6 ); - offset += 6; - - memcpy( hdr->dst_mac, (buf + offset), 6 ); - offset += 6; - - unmarshall_peer_addr( &(hdr->public_ip), &offset, buf ); - unmarshall_peer_addr( &(hdr->private_ip), &offset, buf ); - - hdr->pkt_type = (*(buf + offset) & 0xff); /* Make sure only 8 bits are copied. */ - ++offset; - - unmarshall_uint32( &(hdr->sequence_id), &offset, buf ); - unmarshall_uint32( &(hdr->crc), &offset, buf ); - - print_header( "Unmarshalled ", hdr ); - - return offset; -} - -/* ************************************** */ - -SOCKET open_socket(u_int16_t local_port, int udp_sock, int server_mode) { - SOCKET sock_fd; - struct sockaddr_in local_address; - int sockopt = 1; - - if((sock_fd = socket(PF_INET, udp_sock ? SOCK_DGRAM : SOCK_STREAM, 0)) < 0) { - traceEvent(TRACE_ERROR, "Unable to create socket [%s][%d]\n", - strerror(errno), sock_fd); - return(-1); - } - -#ifndef WIN32 - /* fcntl(sock_fd, F_SETFL, O_NONBLOCK); */ -#endif - - setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&sockopt, sizeof(sockopt)); - - memset(&local_address, 0, sizeof(local_address)); - local_address.sin_family = AF_INET; - local_address.sin_port = htons(local_port); - local_address.sin_addr.s_addr = INADDR_ANY; - if(bind(sock_fd, (struct sockaddr*) &local_address, sizeof(local_address)) == -1) { - traceEvent(TRACE_ERROR, "Bind error [%s]\n", strerror(errno)); - return(-1); - } - - if((!udp_sock) && server_mode) { - if(listen(sock_fd, 255) == -1) { - traceEvent(TRACE_ERROR, "Listen error [%s]\n", strerror(errno)); - return(-1); - } - } - - return(sock_fd); -} - -/* ************************************** */ - -int connect_socket(int sock_fd, struct peer_addr* _dest) { - char *http_header; - int len, rc; - struct sockaddr_in dest; - - peer_addr2sockaddr_in(_dest, &dest); - - /* FIX: add IPv6 support */ - rc = connect(sock_fd, (struct sockaddr*)&dest, sizeof(struct sockaddr_in)); - - if(rc == -1) { - traceEvent(TRACE_WARNING, "connect() error [%s]\n", strerror(errno)); - return(-1); - } - - /* Send dummy http header */ - http_header = "GET / HTTP/1.0\r\n\r\n"; - len = strlen(http_header); - rc = send(sock_fd, http_header, len, 0); - - return((rc == len) ? 0 : -1); -} - - -/* *********************************************** */ - -void send_packet(n2n_sock_info_t * sinfo, - char *packet, size_t *packet_len, - const struct peer_addr *remote_peer, u_int8_t compress_data) { - int data_sent_len; - - data_sent_len = unreliable_sendto(sinfo, - packet, packet_len, remote_peer, compress_data); - - if(data_sent_len != *packet_len) - traceEvent(TRACE_WARNING, - "sendto() [sent=%d][attempted_to_send=%d] [%s]\n", - data_sent_len, *packet_len, strerror(errno)); -} - -/* *********************************************** */ - -int traceLevel = 2 /* NORMAL */; -int useSyslog = 0, syslog_opened = 0; - -#ifdef __ANDROID_NDK__ -slog_t* slog = NULL; -int android_log_level(int lvl) -{ - switch (lvl) { - case 0: // ERROR - return ANDROID_LOG_ERROR; - case 1: // WARNING - return ANDROID_LOG_WARN; - case 2: // NORMAL - return ANDROID_LOG_INFO; - case 3: // INFO - return ANDROID_LOG_VERBOSE; - default: // NORMAL - return ANDROID_LOG_INFO; - } -} -#endif /* #ifdef __ANDROID_NDK__ */ - -#define N2N_TRACE_DATESIZE 32 -void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...) { - va_list va_ap; - - if(eventTraceLevel <= traceLevel) { - char buf[2048]; - char out_buf[640]; - char theDate[N2N_TRACE_DATESIZE]; - char *extra_msg = ""; - time_t theTime = time(NULL); -#ifdef WIN32 - int i; -#endif - - /* We have two paths - one if we're logging, one if we aren't - * Note that the no-log case is those systems which don't support it (WIN32), - * those without the headers !defined(USE_SYSLOG) - * those where it's parametrically off... - */ - - memset(buf, 0, sizeof(buf)); - strftime(theDate, N2N_TRACE_DATESIZE, "%d/%b/%Y %H:%M:%S", localtime(&theTime)); - - va_start (va_ap, format); - vsnprintf(buf, sizeof(buf)-1, format, va_ap); - va_end(va_ap); - - if(eventTraceLevel == 0 /* TRACE_ERROR */) - extra_msg = "ERROR: "; - else if(eventTraceLevel == 1 /* TRACE_WARNING */) - extra_msg = "WARNING: "; - - while(buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; - -#ifndef WIN32 - if(useSyslog) { - if(!syslog_opened) { - openlog("n2n", LOG_PID, LOG_DAEMON); - syslog_opened = 1; - } - - snprintf(out_buf, sizeof(out_buf), "%s%s", extra_msg, buf); - syslog(LOG_INFO, "%s", out_buf); - } else { -#ifdef __ANDROID_NDK__ - char * p = strrchr(file, '/'); - file = (p ? p + 1 : file); -#endif /* #ifdef __ANDROID_NDK__ */ - snprintf(out_buf, sizeof(out_buf), "%s [%11s:%4d] %s%s", theDate, file, line, extra_msg, buf); -#ifdef __ANDROID_NDK__ - slog = writeslog(slog, android_log_level(eventTraceLevel), "n2n_v1", out_buf); -#else /* #ifdef __ANDROID_NDK__ */ - printf("%s\n", out_buf); - fflush(stdout); -#endif /* #ifdef __ANDROID_NDK__ */ - } -#else - /* this is the WIN32 code */ - for(i=strlen(file)-1; i>0; i--) if(file[i] == '\\') { i++; break; }; - snprintf(out_buf, sizeof(out_buf), "%s [%11s:%4d] %s%s", theDate, &file[i], line, extra_msg, buf); - printf("%s\n", out_buf); - fflush(stdout); -#endif - } - -} - -/* *********************************************** */ - -/* addr should be in network order. Things are so much simpler that way. */ -char* intoa(u_int32_t /* host order */ addr, char* buf, u_short buf_len) { - char *cp, *retStr; - u_int byte; - int n; - - cp = &buf[buf_len]; - *--cp = '\0'; - - n = 4; - do { - byte = addr & 0xff; - *--cp = byte % 10 + '0'; - byte /= 10; - if (byte > 0) { - *--cp = byte % 10 + '0'; - byte /= 10; - if (byte > 0) - *--cp = byte + '0'; - } - *--cp = '.'; - addr >>= 8; - } while (--n > 0); - - /* Convert the string to lowercase */ - retStr = (char*)(cp+1); - - return(retStr); -} - -/* *********************************************** */ - -char* macaddr_str(const char *mac, char *buf, int buf_len) { - snprintf(buf, buf_len, "%02X:%02X:%02X:%02X:%02X:%02X", - mac[0] & 0xFF, mac[1] & 0xFF, mac[2] & 0xFF, - mac[3] & 0xFF, mac[4] & 0xFF, mac[5] & 0xFF); - return(buf); -} - -/* *********************************************** */ - -void fill_standard_header_fields(n2n_sock_info_t * sinfo, - struct n2n_packet_header *hdr, char *src_mac) { - socklen_t len = sizeof(hdr->private_ip); - memset(hdr, 0, N2N_PKT_HDR_SIZE); - hdr->version = N2N_PKT_VERSION; - hdr->crc = 0; // FIX - if(src_mac != NULL) memcpy(hdr->src_mac, src_mac, 6); - getsockname(sinfo->sock, (struct sockaddr*)&hdr->private_ip, &len); - hdr->public_ip.family = AF_INET; -} - -/* *********************************************** */ - -void send_ack(n2n_sock_info_t * sinfo, - u_int16_t last_rcvd_seq_id, - struct n2n_packet_header *header, - struct peer_addr *remote_peer, - char *src_mac) { - - /* marshalling double-checked. */ - struct n2n_packet_header hdr; - u_int8_t pkt[ N2N_PKT_HDR_SIZE ]; - size_t len = sizeof(hdr); - size_t len2; - int compress_data = N2N_COMPRESSION_ENABLED; - - fill_standard_header_fields(sinfo, &hdr, src_mac); - hdr.msg_type = MSG_TYPE_ACK_RESPONSE; - hdr.sequence_id = last_rcvd_seq_id; - memcpy(hdr.community_name, header->community_name, COMMUNITY_LEN); - - len2=marshall_n2n_packet_header( pkt, &hdr ); - assert( len2 == len ); - - send_packet(sinfo, (char*)pkt, &len, remote_peer, compress_data); -} - -/* *********************************************** */ - -u_int8_t is_multi_broadcast(char *dest_mac) { - return(((!memcmp(broadcast_addr, dest_mac, 6)) - || (!memcmp(multicast_addr, dest_mac, 3))) ? 1 : 0); -} - -/* *********************************************** */ - -/* http://www.faqs.org/rfcs/rfc908.html */ - -u_int receive_data(n2n_sock_info_t * sinfo, - char *packet, size_t packet_len, - struct peer_addr *from, u_int8_t *discarded_pkt, - char *tun_mac_addr, u_int8_t decompress_data, - struct n2n_packet_header *hdr) { - socklen_t fromlen = sizeof(struct sockaddr_in); - int len; - char *payload, *pkt_type; - macstr_t src_mac_buf; - macstr_t dst_mac_buf; - ipstr_t ip_buf; - ipstr_t from_ip_buf; - - if(sinfo->is_udp_socket) { - struct sockaddr_in _from; - len = recvfrom(sinfo->sock, packet, packet_len, 0, (struct sockaddr*)&_from, &fromlen); - sockaddr_in2peer_addr(&_from, from); - } else { - len = recv(sinfo->sock, packet, 4, 0); - if(len == 4) { - packet[4] = '\0'; - len = atoi(packet); - len = recv(sinfo->sock, packet, len, 0); - } else { - traceEvent(TRACE_WARNING, "Unable to receive n2n packet length"); - return(-1); - } - } - - unmarshall_n2n_packet_header(hdr, (u_int8_t *)packet); - - payload = &packet[N2N_PKT_HDR_SIZE]; - - if(len < 0) { -#ifdef WIN32 - if(WSAGetLastError() != WSAECONNRESET /* http://support.microsoft.com/kb/263823 */ ) { - traceEvent(TRACE_WARNING, "recvfrom returned %d [err=%d]", len, WSAGetLastError()); - } -#endif - return(0); - } else if(len > MIN_COMPRESSED_PKT_LEN) { -#define N2N_DECOMPRESS_BUFSIZE 2048 - char decompressed[N2N_DECOMPRESS_BUFSIZE]; - int rc; - lzo_uint decompressed_len=N2N_DECOMPRESS_BUFSIZE; - size_t insize = len-N2N_PKT_HDR_SIZE; - - if(decompress_data) { - rc = lzo1x_decompress_safe((u_char*)&packet[N2N_PKT_HDR_SIZE], - insize, - (u_char*)decompressed, &decompressed_len, NULL); - - if(rc == LZO_E_OK) - { - traceEvent(TRACE_INFO, "%u bytes decompressed into %u", insize, decompressed_len); - } - else - { - traceEvent(TRACE_WARNING, "Failed to decompress %u byte packet. LZO error=%d", insize, rc ); - return -1; - } - - if(packet_len > decompressed_len) { - memcpy(&packet[N2N_PKT_HDR_SIZE], decompressed, decompressed_len); - len = decompressed_len+N2N_PKT_HDR_SIZE; - } else { - traceEvent(TRACE_WARNING, "Uncompressed packet is too large [decompressed_len=%d]", - decompressed_len); - return(0); - } - } - - (*discarded_pkt) = 0; - - if(!hdr->sent_by_supernode) { - memcpy( &packet[offsetof(struct n2n_packet_header, public_ip)], from, sizeof(struct sockaddr_in) ); - } - - switch(hdr->pkt_type) { - case packet_unreliable_data: - pkt_type = "unreliable data"; - break; - case packet_reliable_data: - pkt_type = "reliable data"; - break; - case packet_ping: - pkt_type = "ping"; - break; - case packet_pong: - pkt_type = "pong"; - break; - default: - pkt_type = "???"; - } - - traceEvent(TRACE_INFO, "+++ Received %s packet [rcvd_from=%s:%d][msg_type=%s][seq_id=%d]", - pkt_type, - intoa(ntohl(from->addr_type.v4_addr), from_ip_buf, sizeof(from_ip_buf)), - ntohs(from->port), msg_type2str(hdr->msg_type), - hdr->sequence_id); - traceEvent(TRACE_INFO, " [src_mac=%s][dst_mac=%s][original_sender=%s:%d]", - macaddr_str(hdr->src_mac, src_mac_buf, sizeof(src_mac_buf)), - macaddr_str(hdr->dst_mac, dst_mac_buf, sizeof(dst_mac_buf)), - intoa(ntohl(hdr->public_ip.addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(hdr->public_ip.port)); - -#ifdef HANDLE_RETRANSMISSION - if((hdr->pkt_type == packet_reliable_data) - && (hdr->msg_type == MSG_TYPE_PACKET)) { - (*discarded_pkt) = handle_ack(sock_fd, is_udp_socket, hdr, - &payload[6], payload, from, tun_mac_addr); - } else - (*discarded_pkt) = 0; -#endif - } else - traceEvent(TRACE_WARNING, "Receive error [%s] or pkt too short [len=%d]\n", - strerror(errno), len); - - return(len); -} - -/* *********************************************** */ - -#if 0 -static u_int32_t queue_packet(struct send_hash_entry *scan, - char *packet, - u_int16_t packet_len) { - struct packet_list *pkt = (struct packet_list*)malloc(sizeof(struct packet_list)); - - if(pkt == NULL) { - traceEvent(TRACE_ERROR, "Not enough memory!"); - return(0); - } - - if((pkt->packet = (char*)malloc(packet_len)) == NULL) { - traceEvent(TRACE_ERROR, "Not enough memory!"); - return(0); - } - - memcpy(pkt->packet, packet, packet_len); - pkt->packet_len = packet_len; - pkt->seq_id = scan->last_seq_id; - pkt->next = scan->unacked_packet_list; - scan->unacked_packet_list = pkt; - scan->num_unacked_pkts++; - return(pkt->seq_id); -} -#endif - -/* *********************************************** */ - -/* Work-memory needed for compression. Allocate memory in units - * of `lzo_align_t' (instead of `char') to make sure it is properly aligned. - */ - -#define HEAP_ALLOC(var,size) \ - lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ] - -static HEAP_ALLOC(wrkmem,LZO1X_1_MEM_COMPRESS); - -/* ******************************************************* */ - -u_int send_data(n2n_sock_info_t * sinfo, - char *packet, size_t *packet_len, - const struct peer_addr *to, u_int8_t compress_data) { - char compressed[1650]; - int rc; - lzo_uint compressed_len=0; - struct sockaddr_in destsock; - - if(*packet_len < N2N_PKT_HDR_SIZE) { - traceEvent(TRACE_WARNING, "The packet about to be sent is too short [len=%d]\n", *packet_len); - return(-1); - } - - memcpy(compressed, packet, N2N_PKT_HDR_SIZE); - - peer_addr2sockaddr_in(to, &destsock); - - if(compress_data) { - rc = lzo1x_1_compress((u_char*)&packet[N2N_PKT_HDR_SIZE], - *packet_len - N2N_PKT_HDR_SIZE, - (u_char*)&compressed[N2N_PKT_HDR_SIZE], - &compressed_len, wrkmem); - - if ( 0 == compressed_len ) - { - traceEvent(TRACE_WARNING, "failed to compress %u bytes.", (*packet_len - N2N_PKT_HDR_SIZE) ); - return -1; - } - - compressed_len += N2N_PKT_HDR_SIZE; - - traceEvent(TRACE_INFO, "%u bytes compressed into %u", *packet_len, compressed_len); - /* *packet_len = compressed_len; */ - - if(sinfo->is_udp_socket) { - rc = sendto(sinfo->sock, compressed, compressed_len, 0, - (struct sockaddr*)&destsock, sizeof(struct sockaddr_in)); - } else { - char send_len[5]; - - /* 4 bytes packet length */ - snprintf(send_len, sizeof(send_len), "%04d", (int)compressed_len); - if((rc = send(sinfo->sock, send_len, 4, 0)) != 4) - return(-1); - if((rc = send(sinfo->sock, compressed, compressed_len, 0)) != compressed_len) { - traceEvent(TRACE_WARNING, "send error [%d][%s]", - errno, strerror(errno)); - } - } - } else { - compressed_len = *packet_len; - if(sinfo->is_udp_socket) - rc = sendto(sinfo->sock, packet, compressed_len, 0, - (struct sockaddr*)&destsock, sizeof(struct sockaddr_in)); - else { - char send_len[5]; - - /* 4 bytes packet length */ - snprintf(send_len, sizeof(send_len), "%04d", (int)compressed_len); - if((rc = send(sinfo->sock, send_len, 4, 0)) != 4) - return(-1); - rc = send(sinfo->sock, compressed, compressed_len, 0); - } - - if(rc == -1) { - ipstr_t ip_buf; - - traceEvent(TRACE_WARNING, "sendto() failed while attempting to send data to %s:%d", - intoa(ntohl(to->addr_type.v4_addr), ip_buf, sizeof(ip_buf)), - ntohs(to->port)); - } - } - - if ( rc >= 0) { - traceEvent(TRACE_INFO, "### Tx N2N Msg -> network"); - } - - if(rc == compressed_len) - return(*packet_len); /* fake just to avoid warnings */ - else - return(rc); -} - -/* *********************************************** */ - -u_int reliable_sendto(n2n_sock_info_t * sinfo, - char *packet, size_t *packet_len, - const struct peer_addr *to, u_int8_t compress_data) { - /* char *payload = &packet[N2N_PKT_HDR_SIZE]; */ - struct n2n_packet_header hdr_storage; - struct n2n_packet_header *hdr = &hdr_storage; - macstr_t src_mac_buf; - macstr_t dst_mac_buf; - - /* REVISIT: efficiency of unmarshal + re-marshal just to change a couple of bits. */ - unmarshall_n2n_packet_header( hdr, (u_int8_t *)packet ); - - /* hdr->sequence_id = (hdr->msg_type == MSG_TYPE_PACKET) ? mac2sequence((u_char*)payload, packet, *packet_len) : 0; */ - hdr->sequence_id = 0; - hdr->pkt_type = packet_reliable_data; - - traceEvent(TRACE_INFO, "Sent reliable packet [msg_type=%s][seq_id=%d][src_mac=%s][dst_mac=%s]", - msg_type2str(hdr->msg_type), hdr->sequence_id, - macaddr_str(&packet[6], src_mac_buf, sizeof(src_mac_buf)), - macaddr_str(packet, dst_mac_buf, sizeof(dst_mac_buf))); - - marshall_n2n_packet_header( (u_int8_t *)packet, hdr ); - - return(send_data(sinfo, packet, packet_len, to, compress_data)); -} - -/* *********************************************** */ - -/* unreliable_sendto is passed a fully marshalled, packet. Its purpose is to set - * the unreliable flags but leave the rest of the packet untouched. */ -u_int unreliable_sendto(n2n_sock_info_t * sinfo, - char *packet, size_t *packet_len, - const struct peer_addr *to, u_int8_t compress_data) { - struct n2n_packet_header hdr_storage; - struct n2n_packet_header *hdr = &hdr_storage; - macstr_t src_mac_buf; - macstr_t dst_mac_buf; - - /* REVISIT: efficiency of unmarshal + re-marshal just to change a couple of bits. */ - unmarshall_n2n_packet_header( hdr, (u_int8_t *)packet ); - - hdr->sequence_id = 0; /* Unreliable messages have 0 as sequence number */ - hdr->pkt_type = packet_unreliable_data; - - traceEvent(TRACE_INFO, "Sent unreliable packet [msg_type=%s][seq_id=%d][src_mac=%s][dst_mac=%s]", - msg_type2str(hdr->msg_type), hdr->sequence_id, - macaddr_str(hdr->src_mac, src_mac_buf, sizeof(src_mac_buf)), - macaddr_str(hdr->dst_mac, dst_mac_buf, sizeof(dst_mac_buf))); - - marshall_n2n_packet_header( (u_int8_t *)packet, hdr ); - - return(send_data(sinfo, packet, packet_len, to, compress_data)); -} - -/* *********************************************** */ - -char* msg_type2str(u_short msg_type) { - switch(msg_type) { - case MSG_TYPE_REGISTER: return("MSG_TYPE_REGISTER"); - case MSG_TYPE_DEREGISTER: return("MSG_TYPE_DEREGISTER"); - case MSG_TYPE_PACKET: return("MSG_TYPE_PACKET"); - case MSG_TYPE_REGISTER_ACK: return("MSG_TYPE_REGISTER_ACK"); - case MSG_TYPE_ACK_RESPONSE: return("MSG_TYPE_ACK_RESPONSE"); - } - - return("???"); -} - -/* *********************************************** */ - -void hexdump(char *buf, u_int len) { - u_int i; - - for(i=0; i 0) && ((i % 16) == 0)) printf("\n"); - printf("%02X ", buf[i] & 0xFF); - } - - printf("\n"); -} - -/* *********************************************** */ - -void print_n2n_version() { - printf("Welcome to n2n v.%s for %s\n" - "Built on %s\n" - "Copyright 2007-08 - http://www.ntop.org\n\n", - version, osName, buildDate); -} - -const char* random_device_mac(void) -{ - const char key[] = "0123456789abcdef"; - static char mac[18]; - int i; - - srand(gettid()); - for (i = 0; i < sizeof(mac) - 1; ++i) - { - if ((i + 1) % 3 == 0) { - mac[i] = ':'; - continue; - } - mac[i] = key[random() % sizeof(key)]; - } - mac[sizeof(mac) - 1] = '\0'; - return mac; -} - - -/** Find the peer entry in list with mac_addr equal to mac. - * - * Does not modify the list. - * - * @return NULL if not found; otherwise pointer to peer entry. - */ -struct peer_info * find_peer_by_mac( struct peer_info * list, const char * mac ) -{ - while(list != NULL) - { - if( 0 == memcmp(mac, list->mac_addr, 6) ) - { - return list; - } - list = list->next; - } - - return NULL; -} - - -/** Return the number of elements in the list. - * - */ -size_t peer_list_size( const struct peer_info * list ) -{ - size_t retval=0; - - while ( list ) - { - ++retval; - list = list->next; - } - - return retval; -} - -/** Add new to the head of list. If list is NULL; create it. - * - * The item new is added to the head of the list. New is modified during - * insertion. list takes ownership of new. - */ -void peer_list_add( struct peer_info * * list, - struct peer_info * new ) -{ - new->next = *list; - new->last_seen = time(NULL); - *list = new; -} - - -size_t purge_expired_registrations( struct peer_info ** peer_list ) { - static time_t last_purge = 0; - time_t now = time(NULL); - size_t num_reg = 0; - - if((now - last_purge) < PURGE_REGISTRATION_FREQUENCY) return 0; - - traceEvent(TRACE_INFO, "Purging old registrations"); - - num_reg = purge_peer_list( peer_list, now-REGISTRATION_TIMEOUT ); - - last_purge = now; - traceEvent(TRACE_INFO, "Remove %ld registrations", num_reg); - - return num_reg; -} - -/** Purge old items from the peer_list and return the number of items that were removed. */ -size_t purge_peer_list( struct peer_info ** peer_list, - time_t purge_before ) -{ - struct peer_info *scan; - struct peer_info *prev; - size_t retval=0; - - scan = *peer_list; - prev = NULL; - while(scan != NULL) - { - if(scan->last_seen < purge_before) - { - struct peer_info *next = scan->next; - - if(prev == NULL) - { - *peer_list = next; - } - else - { - prev->next = next; - } - - ++retval; - free(scan); - scan = next; - } - else - { - prev = scan; - scan = scan->next; - } - } - - return retval; -} - -static u_int8_t hex2byte( const char * s ) -{ - char tmp[3]; - tmp[0]=s[0]; - tmp[1]=s[1]; - tmp[2]=0; /* NULL term */ - - return((u_int8_t)strtol( s, NULL, 16 )); -} - -extern int str2mac( u_int8_t * outmac /* 6 bytes */, const char * s ) -{ - size_t i; - - /* break it down as one case for the first "HH", the 5 x through loop for - * each ":HH" where HH is a two hex nibbles in ASCII. */ - - *outmac=hex2byte(s); - ++outmac; - s+=2; /* don't skip colon yet - helps generalise loop. */ - - for (i=1; i<6; ++i ) - { - s+=1; - *outmac=hex2byte(s); - ++outmac; - s+=2; - } - - return 0; /* ok */ -} diff --git a/bundles/n2n_meyerd/n2n_v1/n2n.h b/bundles/n2n_meyerd/n2n_v1/n2n.h deleted file mode 100644 index 1e2d96b9..00000000 --- a/bundles/n2n_meyerd/n2n_v1/n2n.h +++ /dev/null @@ -1,308 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * Richard Andrews - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - * Code contributions courtesy of: - * Babak Farrokhi [FreeBSD port] - * -*/ - -#ifndef _N2N_H_ -#define _N2N_H_ - -/* - tunctl -t tun0 - tunctl -t tun1 - ifconfig tun0 1.2.3.4 up - ifconfig tun1 1.2.3.5 up - ./edge -d tun0 -l 2000 -r 127.0.0.1:3000 -c hello - ./edge -d tun1 -l 3000 -r 127.0.0.1:2000 -c hello - - - tunctl -u UID -t tunX -*/ - -#if defined(__APPLE__) && defined(__MACH__) -#define _DARWIN_ -#endif - -#ifdef WIN32 -#include "win32/n2n_win32.h" -#endif - -#include -#include -#include - -#ifndef WIN32 -#include -#endif - -#include -#include -#include - -#ifndef WIN32 -#include -#include -#include -#include -#include - -#ifdef __linux__ -#include -#include -#endif - -#ifdef __FreeBSD__ -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define closesocket(a) close(a) -#endif - -#include -#ifdef WIN32 -#include "win32/getopt.h" -#else -#define _GNU_SOURCE -#include -#endif - -#include - -#ifdef WIN32 -#include "win32/wintap.h" -#endif - -#include "twofish.h" - -#ifndef WIN32 -typedef struct tuntap_dev { - int fd; - u_int8_t mac_addr[6]; - u_int32_t ip_addr, device_mask; - u_int mtu; -} tuntap_dev; - -#define SOCKET int -#endif /* #ifndef WIN32 */ - -#define QUICKLZ 1 -#define N2N_PKT_VERSION 1 - -#define MSG_TYPE_REGISTER 1 /* FIX invece di usare il sender del pacchetto scriverlo nel pacchetto stesso */ -#define MSG_TYPE_DEREGISTER 2 -#define MSG_TYPE_PACKET 3 -#define MSG_TYPE_REGISTER_ACK 4 -#define MSG_TYPE_ACK_RESPONSE 5 - -#define COMMUNITY_LEN 16 -#define MIN_COMPRESSED_PKT_LEN 32 - -/* Set N2N_COMPRESSION_ENABLED to 0 to disable lzo1x compression of ethernet - * frames. Doing this will break compatibility with the standard n2n packet - * format so do it only for experimentation. All edges must be built with the - * same value if they are to understand each other. */ -#define N2N_COMPRESSION_ENABLED 1 - -#define DEFAULT_MTU 1400 - -/* Maximum enum value is 255 due to marshalling into 1 byte */ -enum packet_type { - packet_unreliable_data = 0, /* no ACK needed */ - packet_reliable_data, /* needs ACK */ - packet_ping, - packet_pong -}; - -/* All information is always in network byte-order */ -struct peer_addr { - u_int8_t family; - u_int16_t port; - union { - u_int8_t v6_addr[16]; - u_int32_t v4_addr; - } addr_type; -}; - -struct n2n_packet_header { - u_int8_t version, msg_type, ttl, sent_by_supernode; - char community_name[COMMUNITY_LEN], src_mac[6], dst_mac[6]; - struct peer_addr public_ip, private_ip; - enum packet_type pkt_type; - u_int32_t sequence_id; - u_int32_t crc; // FIX - It needs to be handled for detcting forged packets -}; - -int marshall_n2n_packet_header( u_int8_t * buf, const struct n2n_packet_header * hdr ); -int unmarshall_n2n_packet_header( struct n2n_packet_header * hdr, const u_int8_t * buf ); - -#define N2N_PKT_HDR_SIZE (sizeof(struct n2n_packet_header)) - - -/** Common type used to hold stringified IP addresses. */ -typedef char ipstr_t[32]; - -/** Common type used to hold stringified MAC addresses. */ -typedef char macstr_t[32]; - -struct n2n_sock_info -{ - int sock; - char is_udp_socket /*= 1*/; -}; - -typedef struct n2n_sock_info n2n_sock_info_t; - -struct peer_info { - char community_name[COMMUNITY_LEN], mac_addr[6]; - struct peer_addr public_ip, private_ip; - time_t last_seen; - struct peer_info *next; - /* socket */ - n2n_sock_info_t sinfo; -}; - -struct n2n_edge; /* defined in edge.c */ -typedef struct n2n_edge n2n_edge_t; - - -/* ************************************** */ - -#if defined(DEBUG) -#define SOCKET_TIMEOUT_INTERVAL_SECS 5 -#define REGISTER_FREQUENCY 20 /* sec */ -#else /* #if defined(DEBUG) */ -#define SOCKET_TIMEOUT_INTERVAL_SECS 10 -#define REGISTER_FREQUENCY 60 /* sec */ -#endif /* #if defined(DEBUG) */ - -#ifdef __ANDROID_NDK__ -#include -extern int android_log_level(int lvl); -extern slog_t* slog; -#ifndef N2N_LOG_FILEPATH -#define N2N_LOG_FILEPATH "/storage/sdcard0/wang.switchy.hin2n/n2n_v1.log" -#endif /* #ifndef N2N_LOG_FILEPATH */ -#endif /* #ifdef __ANDROID_NDK__ */ -#define TRACE_ERROR 0, __FILE__, __LINE__ -#define TRACE_WARNING 1, __FILE__, __LINE__ -#define TRACE_NORMAL 2, __FILE__, __LINE__ -#define TRACE_INFO 3, __FILE__, __LINE__ - -/* ************************************** */ - -#define SUPERNODE_IP "127.0.0.1" -#define SUPERNODE_PORT 1234 - -/* ************************************** */ - -#ifndef max -#define max(a, b) ((a < b) ? b : a) -#endif - -#ifndef min -#define min(a, b) ((a > b) ? b : a) -#endif - -/* ************************************** */ - -/* Variables */ -// extern TWOFISH *tf; -extern int traceLevel; -extern char broadcast_addr[6]; -extern char multicast_addr[6]; - -/* Functions */ -extern void sockaddr_in2peer_addr(struct sockaddr_in *in, struct peer_addr *out); -extern void peer_addr2sockaddr_in(const struct peer_addr *in, struct sockaddr_in *out); -// extern int init_n2n(u_int8_t *encrypt_pwd, u_int32_t encrypt_pwd_len ); -// extern void term_n2n(); -extern void send_ack(n2n_sock_info_t * sinfo, - u_int16_t last_rcvd_seq_id, - struct n2n_packet_header *header, - struct peer_addr *remote_peer, - char *src_mac); - -extern void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...); -extern int tuntap_open(tuntap_dev *device, char *dev, char *device_ip, - char *device_mask, const char * device_mac, int mtu); -extern int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len); -extern int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len); -extern void tuntap_close(struct tuntap_dev *tuntap); - -extern SOCKET open_socket(u_int16_t local_port, int udp_sock, int server_mode); -extern int connect_socket(int sock_fd, struct peer_addr* dest); - -extern void send_packet(n2n_sock_info_t * sinfo, - char *packet, size_t *packet_len, - const struct peer_addr *remote_peer, - u_int8_t compress_data); -extern char* intoa(u_int32_t addr, char* buf, u_short buf_len); -extern char* macaddr_str(const char *mac, char *buf, int buf_len); -extern int str2mac( u_int8_t * outmac /* 6 bytes */, const char * s ); -extern void fill_standard_header_fields(n2n_sock_info_t * eee, - struct n2n_packet_header *hdr, - char *src_mac); - -extern u_int receive_data(n2n_sock_info_t * sinfo, - char *packet, size_t packet_len, - struct peer_addr *from, u_int8_t *discarded_pkt, - char *tun_mac_addr, u_int8_t decompress_data, - struct n2n_packet_header *hdr); -extern u_int reliable_sendto(n2n_sock_info_t * sinfo, - char *packet, size_t *packet_len, - const struct peer_addr *from, u_int8_t compress_data); -extern u_int unreliable_sendto(n2n_sock_info_t * sinfo, - char *packet, size_t *packet_len, - const struct peer_addr *from, u_int8_t compress_data); -extern u_int send_data(n2n_sock_info_t * sinfo, - char *packet, size_t *packet_len, - const struct peer_addr *to, u_int8_t compress_data); -extern u_int8_t is_multi_broadcast(char *dest_mac); -extern char* msg_type2str(u_short msg_type); -extern void hexdump(char *buf, u_int len); - -void print_n2n_version(); -const char* random_device_mac(void); - - -/* Operations on peer_info lists. */ -struct peer_info * find_peer_by_mac( struct peer_info * list, - const char * mac ); -void peer_list_add( struct peer_info * * list, - struct peer_info * new ); -size_t peer_list_size( const struct peer_info * list ); -size_t purge_peer_list( struct peer_info ** peer_list, - time_t purge_before ); -size_t purge_expired_registrations( struct peer_info ** peer_list ); - -/* version.c */ -extern char *version, *osName, *buildDate; - -#endif /* _N2N_H_ */ diff --git a/bundles/n2n_meyerd/n2n_v1/n2n.spec b/bundles/n2n_meyerd/n2n_v1/n2n.spec deleted file mode 100644 index 0e7892ae..00000000 --- a/bundles/n2n_meyerd/n2n_v1/n2n.spec +++ /dev/null @@ -1,47 +0,0 @@ -Summary: N2N peer-to-peer virtual private network system. -Name: n2n -Version: 1.3 -Release: 1 -License: GPLv3 -Vendor: ntop.org -Group: None -URL: http://www.ntop.org/n2n -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root - -%description -N2N is a peer-to-peer virtual private network system. N2N uses the universal -TUNTAP interface to create TAP network interfaces to an encrypted virtual -LAN. Members of a community share a common encryption key which allows echange -of data. The supernode is used for peer discovery and initial packet relay -before direct peer-to-peer exchange is established. -Once direct packet exchange is established, the supernode is not required. - -%prep - -%setup -q - -echo -e "\n *** Building ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE} ***\n" - -%build -make - -%install -make PREFIX=${RPM_BUILD_ROOT}/usr install - -%clean -rm -rf $RPM_BUILD_ROOT - - -%files -%defattr(-,root,root,-) - /usr/bin/supernode - /usr/sbin/edge -%doc /usr/share/man/man1/supernode.1.gz -%doc /usr/share/man/man8/edge.8.gz - - -%changelog -* Sat May 3 2008 Richard Andrews - -- Initial build. - diff --git a/bundles/n2n_meyerd/n2n_v1/scripts/mk_SRPM.sh b/bundles/n2n_meyerd/n2n_v1/scripts/mk_SRPM.sh deleted file mode 100644 index 2b1b3743..00000000 --- a/bundles/n2n_meyerd/n2n_v1/scripts/mk_SRPM.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# This script makes a SRPM - a source RPM file which can be built into the -# appropriate distro specific RPM for any platform. -# -# To build the binary package: -# rpm -i n2n-.src.rpm -# rpmbuild -bb n2n.spec -# -# Look for the "Wrote:" line to see where the final RPM is. -# -# To run this script cd to the n2n directory and run it as follows -# scripts/mk_SRPMS.sh -# - -set -e - -set -x - -BASE=`pwd` - -TARFILE=`${BASE}/scripts/mk_tar.sh` - -test -f ${TARFILE} - -echo "Building SRPM" -# -ts means build source RPM from tarfile -rpmbuild -ts ${TARFILE} - -echo "Done" diff --git a/bundles/n2n_meyerd/n2n_v1/scripts/mk_deb.sh b/bundles/n2n_meyerd/n2n_v1/scripts/mk_deb.sh deleted file mode 100644 index 42d86916..00000000 --- a/bundles/n2n_meyerd/n2n_v1/scripts/mk_deb.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# This script makes a SRPM - a source RPM file which can be built into the -# appropriate distro specific RPM for any platform. -# -# To build the binary package: -# rpm -i n2n-.src.rpm -# rpmbuild -bb n2n.spec -# -# Look for the "Wrote:" line to see where the final RPM is. -# -# To run this script cd to the n2n directory and run it as follows -# scripts/mk_SRPMS.sh -# - -set -e - -set -x - -BASE=`pwd` - -TARFILE=`${BASE}/scripts/mk_tar.sh` -TEMPDIR="build_deb" - -test -f ${TARFILE} - -echo "Building .deb" - -if [ -d ${TEMPDIR} ]; then - echo "Removing ${TEMPDIR} directory" - rm -rf ${TEMPDIR} >&2 -fi - -mkdir ${TEMPDIR} - -pushd ${TEMPDIR} - -tar xzf ${TARFILE} #At original location - -cd n2n* - -dpkg-buildpackage -rfakeroot - -popd - -echo "Done" diff --git a/bundles/n2n_meyerd/n2n_v1/scripts/mk_tar.sh b/bundles/n2n_meyerd/n2n_v1/scripts/mk_tar.sh deleted file mode 100644 index 539a5655..00000000 --- a/bundles/n2n_meyerd/n2n_v1/scripts/mk_tar.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -# This script makes a SRPM - a source RPM file which can be built into the -# appropriate distro specific RPM for any platform. -# -# To build the binary package: -# rpm -i n2n-.src.rpm -# rpmbuild -bb n2n.spec -# -# Look for the "Wrote:" line to see where the final RPM is. -# -# To run this script cd to the n2n directory and run it as follows -# scripts/mk_SRPMS.sh -# - -set -e - -function exit_fail() -{ - echo "$1" - exit 1 -} - -PACKAGE="n2n" -PKG_VERSION="1.3" -PKG_AND_VERSION="${PACKAGE}-${PKG_VERSION}" - -TEMPDIR="tmp" - -SOURCE_MANIFEST=" -README -edge.c -lzoconf.h -lzodefs.h -Makefile -minilzo.c -minilzo.h -n2n.c -n2n.h -n2n.spec -supernode.c -tuntap_linux.c -tuntap_freebsd.c -tuntap_osx.c -twofish.c -twofish.h -edge.8 -supernode.1 -debian/changelog -debian/compat -debian/control -debian/copyright -debian/n2n.dirs -debian/n2n.docs -debian/n2n.install -debian/n2n.manpages -debian/README.Debian -debian/rules -" - -BASE=`pwd` - -for F in ${SOURCE_MANIFEST}; do - test -e $F || exit_fail "Cannot find $F. Maybe you're in the wrong directory. Please execute from n2n directory."; >&2 -done - -echo "Found critical files. Proceeding." >&2 - -if [ -d ${TEMPDIR} ]; then - echo "Removing ${TEMPDIR} directory" - rm -rf ${TEMPDIR} >&2 -fi - -mkdir ${TEMPDIR} >&2 - -pushd ${TEMPDIR} >&2 - -echo "Creating staging directory ${PWD}/${PKG_AND_VERSION}" >&2 - -if [ -d ${PKG_AND_VERSION} ] ; then - echo "Removing ${PKG_AND_VERSION} directory" - rm -rf ${PKG_AND_VERSION} >&2 -fi - -mkdir ${PKG_AND_VERSION} - -pushd ${BASE} >&2 - -echo "Copying in files" >&2 -for F in ${SOURCE_MANIFEST}; do - cp --parents -a $F ${TEMPDIR}/${PKG_AND_VERSION}/ -done - -popd >&2 - -TARFILE="${PKG_AND_VERSION}.tar.gz" -echo "Creating ${TARFILE}" >&2 -tar czf ${BASE}/${TARFILE} ${PKG_AND_VERSION} - -popd >&2 - -rm -rf ${TEMPDIR} >&2 - -echo ${BASE}/${TARFILE} diff --git a/bundles/n2n_meyerd/n2n_v1/supernode.1 b/bundles/n2n_meyerd/n2n_v1/supernode.1 deleted file mode 100644 index 863c4984..00000000 --- a/bundles/n2n_meyerd/n2n_v1/supernode.1 +++ /dev/null @@ -1,40 +0,0 @@ -.TH supernode 1 "Jan 3, 2009" "revision 3679" "USER COMMANDS" -.SH NAME -supernode \- n2n supernode daemon -.SH SYNOPSIS -.B supernode \-l [\-v] -.SH DESCRIPTION -N2N is a peer-to-peer VPN system. Supernode is a node introduction registry, -broadcast conduit and packet relay node for the n2n system. On startup supernode -begins listening on the specified UDP port for node registrations, and other -packets to route. The supernode can service any number of communities and routes -packets only between members of the same community. The supernode does not hold -the community encryption key and so cannot snoop or inject packets into the -community. -.PP -Supernode can service a number of n2n communities concurrently. Traffic does not -cross between communities. -.PP -All logging goes to stdout. -.SH OPTIONS -.TP -\-l -listen on the given UDP port -.TP -\-v -use verbose logging -.SH EXAMPLES -.TP -.B supernode -l 7654 -v -Start supernode listening on UDP port 7654 with verbose output. -.PP -.SH RESTART -When suprenode restarts it loses all registration information from associated -edge nodes. It can take up to five minutes for the edge nodes to re-register and -normal traffic flow to resume. -.SH EXIT STATUS -supernode is a daemon and any exit is an error -.SH AUTHOR -Luca Deri ( deri (at) ntop.org ), Richard Andrews ( andrews (at) ntop.org ), Don Bindner -.SH SEE ALSO -ifconfig(8) edge(8) diff --git a/bundles/n2n_meyerd/n2n_v1/supernode.c b/bundles/n2n_meyerd/n2n_v1/supernode.c deleted file mode 100644 index 2f2d6b9a..00000000 --- a/bundles/n2n_meyerd/n2n_v1/supernode.c +++ /dev/null @@ -1,528 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * Richard Andrews - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * -*/ - -#include "n2n.h" - -struct tx_stats -{ - size_t pkts; - size_t errors; -}; - - -/* *********************************************** */ - -static void help() { - print_n2n_version(); - printf("supernode -l [-v] [-h]\n"); - exit(0); -} - -/* *********************************************** */ - -static struct peer_info *known_peers = NULL; -static struct tx_stats supernode_stats = {0,0}; - -/* *********************************************** */ - -/** Turn a REGISTER request around and send a REGISTER_ACK packet back to the - * sender. - * - * This needs to be done for all incoming REGISTER packets to keep firewalls - * open - */ -static void send_register_ack( n2n_sock_info_t * sinfo, - const struct peer_addr *destination_peer, - const struct n2n_packet_header * reqhdr ) -{ - struct n2n_packet_header hdr; - u_int8_t pkt[N2N_PKT_HDR_SIZE]; - size_t len = sizeof(hdr); - - fill_standard_header_fields(sinfo, &hdr, NULL /* zero src MAC */ ); - hdr.sent_by_supernode = 1; - hdr.msg_type = MSG_TYPE_REGISTER_ACK; - memcpy( hdr.community_name, reqhdr->community_name, COMMUNITY_LEN); - memcpy( hdr.dst_mac, reqhdr->src_mac, 6); /* turn it around */ - /* leave IP sockets unfilled. */ - - marshall_n2n_packet_header( pkt, &hdr ); - send_packet(sinfo, (char *)pkt, &len, destination_peer, N2N_COMPRESSION_ENABLED); -} - -static void register_peer(struct n2n_packet_header *hdr, - struct peer_addr *sender, - n2n_sock_info_t * sinfo) { - struct peer_info *scan = known_peers; - ipstr_t buf, buf1; - macstr_t mac_buf; - - send_register_ack( sinfo, sender, hdr ); /* keep firewalls open */ - - while(scan != NULL) { - if((strcmp(scan->community_name, hdr->community_name) == 0) - && (memcmp(&scan->mac_addr, hdr->src_mac, 6) == 0)) { - - scan->last_seen = time(NULL); - if ( ( 0 != memcmp(&scan->public_ip, sender, sizeof(struct peer_addr)) ) || - ( 0 != memcmp(&scan->private_ip, &hdr->private_ip, sizeof(struct peer_addr)) ) ) - { - /* Something is actually different. */ - memcpy(&scan->public_ip, sender, sizeof(struct peer_addr)); - memcpy(&scan->private_ip, &hdr->private_ip, sizeof(struct peer_addr)); - - /* Overwrite existing peer */ - traceEvent(TRACE_NORMAL, "Re-registered node [public_ip=(%d)%s:%hu][private_ip=%s:%hu][mac=%s][community=%s]", - scan->public_ip.family, - intoa(ntohl(scan->public_ip.addr_type.v4_addr), buf, sizeof(buf)), - ntohs(scan->public_ip.port), - intoa(ntohl(scan->private_ip.addr_type.v4_addr), buf1, sizeof(buf1)), - ntohs(scan->private_ip.port), - macaddr_str(scan->mac_addr, mac_buf, sizeof(mac_buf)), - scan->community_name); - } - - return; /* Found the registration entry so stop. */ - } - - scan = scan->next; - } - - /* FIX mettere un limite alla lista dei peer */ - - scan = (struct peer_info*)calloc(1, sizeof(struct peer_info)); - memcpy(scan->community_name, hdr->community_name, COMMUNITY_LEN); - memcpy(&scan->public_ip, sender, sizeof(struct peer_addr)); - memcpy(&scan->private_ip, &hdr->private_ip, sizeof(struct peer_addr)); - memcpy(&scan->mac_addr, hdr->src_mac, 6); - scan->last_seen = time(NULL); // FIX aggiungere un timeout - scan->next = known_peers; - scan->sinfo = *sinfo; - known_peers = scan; - - traceEvent(TRACE_NORMAL, "Registered new node [public_ip=(%d)%s:%d][private_ip=%s:%d][mac=%s][community=%s]", - scan->public_ip.family, - intoa(ntohl(scan->public_ip.addr_type.v4_addr), buf, sizeof(buf)), - ntohs(scan->public_ip.port), - intoa(ntohl(scan->private_ip.addr_type.v4_addr), buf1, sizeof(buf1)), - ntohs(scan->private_ip.port), - macaddr_str(scan->mac_addr, mac_buf, sizeof(mac_buf)), - scan->community_name); -} - -/* *********************************************** */ - -static void deregister_peer(struct n2n_packet_header *hdr, - struct peer_addr *sender) { - struct peer_info *scan = known_peers, *prev = NULL; - ipstr_t buf, buf1; - - while(scan != NULL) { - if((strcmp(scan->community_name, hdr->community_name) == 0) - && (memcmp(&scan->mac_addr, hdr->src_mac, 6) == 0)) { - /* Overwrite existing peer */ - if(prev == NULL) - known_peers = scan->next; - else - prev->next = scan->next; - - traceEvent(TRACE_INFO, "Degistered node [public_ip=%s:%hu][private_ip=%s:%hu]", - intoa(ntohl(scan->public_ip.addr_type.v4_addr), buf, sizeof(buf)), - ntohs(scan->public_ip.port), - intoa(ntohl(scan->private_ip.addr_type.v4_addr), buf1, sizeof(buf1)), - ntohs(scan->private_ip.port)); - - free(scan); - return; - } - - scan = scan->next; - } - - traceEvent(TRACE_WARNING, "Unable to delete specified peer [%s:%hu]", - intoa(ntohl(sender->addr_type.v4_addr), buf, sizeof(buf)), - ntohs(sender->port)); -} - -/* *********************************************** */ - -/* *********************************************** */ - -static const struct option long_options[] = { - { "community", required_argument, NULL, 'c' }, - { "listening-port", required_argument, NULL, 'l' }, - { "help" , no_argument, NULL, 'h' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, 0, NULL, 0 } -}; - -/* *********************************************** */ - - -/** Forward a L2 packet to every edge registered for the community of the - * originator. - * - * @return number of copies of the packet sent - */ -static size_t broadcast_packet(char *packet, u_int packet_len, - struct peer_addr *sender, - n2n_sock_info_t * sinfo, - struct n2n_packet_header *hdr ) -{ - size_t numsent=0; - struct peer_info *scan; - - scan = known_peers; - while(scan != NULL) { - if((strcmp(scan->community_name, hdr->community_name) == 0) - && (memcmp(sender, &scan->public_ip, sizeof(struct peer_addr)) /* No L3 self-send */) ) - { - int data_sent_len; - size_t len = packet_len; - - data_sent_len = send_data( &(scan->sinfo), packet, &len, &scan->public_ip, 0); - - if(data_sent_len != len) - { - ++(supernode_stats.errors); - traceEvent(TRACE_WARNING, "sendto() [sent=%d][attempted_to_send=%d] [%s]\n", - data_sent_len, len, strerror(errno)); - } - else - { - ipstr_t buf; - ipstr_t buf1; - - ++numsent; - ++(supernode_stats.pkts); - traceEvent(TRACE_INFO, "Sent multicast message to remote node [%s:%hu][mac=%s]", - intoa(ntohl(scan->public_ip.addr_type.v4_addr), buf, sizeof(buf)), - ntohs(scan->public_ip.port), - macaddr_str(scan->mac_addr, buf1, sizeof(buf1))); - } - } - - scan = scan->next; - } /* while */ - - - return numsent; -} - - -/** Forward a L2 packet. This may involve a broadcast operation. - * - * Rules are as follows: - * - * 1. If the dest MAC is a multicast address, broadcast to all edges in the - * community. - * - * 2. If the dest MAC is known forward to the destination edge only. - * Else broadcast to all edges in the community. - * - * @return number of copies of the packet sent - */ -static size_t forward_packet(char *packet, u_int packet_len, - struct peer_addr *sender, - n2n_sock_info_t * sinfo, - struct n2n_packet_header *hdr ) -{ - size_t numsent=0; - u_int8_t is_dst_broad_multi_cast; - struct peer_info *scan; - - ipstr_t buf; - ipstr_t buf1; - - hdr->ttl++; /* FIX discard packets with a high TTL */ - is_dst_broad_multi_cast = is_multi_broadcast(hdr->dst_mac); - - /* Put the original packet sender (public) address */ - memcpy(&hdr->public_ip, sender, sizeof(struct peer_addr)); - hdr->sent_by_supernode = 1; - - marshall_n2n_packet_header( (u_int8_t *)packet, hdr ); - - - if ( is_dst_broad_multi_cast ) - { - traceEvent(TRACE_INFO, "Broadcasting. Multicast address [mac=%s]", - macaddr_str(hdr->dst_mac, buf, sizeof(buf))); - - numsent = broadcast_packet( packet, packet_len, sender, sinfo, hdr ); - } - else - { - scan = find_peer_by_mac( known_peers, hdr->dst_mac ); - if ( scan ) - { - int data_sent_len; - size_t len = packet_len; - - data_sent_len = send_data( &(scan->sinfo), packet, &len, &scan->public_ip, 0); - - if(data_sent_len != len) - { - ++(supernode_stats.errors); - traceEvent(TRACE_WARNING, "sendto() [sent=%d][attempted_to_send=%d] [%s]\n", - data_sent_len, len, strerror(errno)); - } - else { - ++(supernode_stats.pkts); - traceEvent(TRACE_INFO, "Sent message to remote node [%s:%hu][mac=%s]", - intoa(ntohl(scan->public_ip.addr_type.v4_addr), buf, sizeof(buf)), - ntohs(scan->public_ip.port), - macaddr_str(scan->mac_addr, buf1, sizeof(buf1))); - } - - numsent = 1; - } - else - { - traceEvent(TRACE_INFO, "Broadcasting because unknown dest [mac=%s]", - macaddr_str(hdr->dst_mac, buf, sizeof(buf))); - numsent = broadcast_packet( packet, packet_len, sender, sinfo, hdr ); - } - } - - return numsent; -} - -static void handle_packet(char *packet, u_int packet_len, - struct peer_addr *sender, - n2n_sock_info_t * sinfo) { - ipstr_t buf; - - traceEvent(TRACE_INFO, "Received message from node [%s:%hu]", - intoa(ntohl(sender->addr_type.v4_addr), buf, sizeof(buf)), - ntohs(sender->port)); - - if(packet_len < N2N_PKT_HDR_SIZE) - traceEvent(TRACE_WARNING, "Received packet too short [len=%d]\n", packet_len); - else { - struct n2n_packet_header hdr_storage; - struct n2n_packet_header *hdr = &hdr_storage; - - unmarshall_n2n_packet_header( hdr, (u_int8_t *)packet ); - - if(hdr->version != N2N_PKT_VERSION) { - traceEvent(TRACE_WARNING, - "Received packet with unknown protocol version (%d): discarded\n", - hdr->version); - return; - } - - if(hdr->msg_type == MSG_TYPE_REGISTER) - { - register_peer(hdr, sender, sinfo); - } - else if(hdr->msg_type == MSG_TYPE_DEREGISTER) { - deregister_peer(hdr, sender); - } else if(hdr->msg_type == MSG_TYPE_PACKET) { - forward_packet( packet, packet_len, sender, sinfo, hdr ); - } else { - traceEvent(TRACE_WARNING, "Unable to handle packet type %d: ignored\n", - hdr->msg_type); - } - } -} - -/* *********************************************** */ - -static -#ifdef WIN32 -DWORD tcpReadThread(LPVOID lpArg) -#else - void* tcpReadThread(void *lpArg) -#endif -{ - n2n_sock_info_t sinfo; - char c[1600]; - int new_line = 0; - - sinfo.sock=(int)lpArg; - sinfo.is_udp_socket=0; /* TCP in this case */ - - traceEvent(TRACE_NORMAL, "Handling sock_fd %d", sinfo.sock); - - while(1) { - int rc; - - if((rc = recv(sinfo.sock, c, 2, 0)) > 0) { - if((c[0] == '\r') && (c[1] == '\n')) { - if(!new_line) - new_line = 1; - else - break; /* Double \r\n\r\n, the http header is over */ - } else - printf("%c%c [%d][%d] ", c[0], c[1], c[0], c[1]); fflush(stdout); - } else { - traceEvent(TRACE_NORMAL, "recv() error [rc=%d][%s]", rc, strerror(errno)); - break; - } - } - - /* Beginning of n2n protocol over TCP */ - c[5] = 0; - - while(1) { - int rc; - - // FIX: add select - if((rc = recv(sinfo.sock, c, 4, 0)) == 4) { - int len = atoi(c); - socklen_t from_len = sizeof(struct sockaddr_in ); - struct sockaddr_in from; - - /* Check packet length */ - if((len <= 0) || (len >= 1600)) break; - rc = recvfrom(sinfo.sock, c, len, 0, (struct sockaddr*)&from, &from_len); - - if((rc <= 0) || (rc != len)) - break; - else { - struct peer_addr _from; - - sockaddr_in2peer_addr(&from, &_from); - handle_packet(c, len, &_from, &sinfo); - } - } else - break; - } - - closesocket(sinfo.sock); -#ifdef WIN32 - return(0); -#else - return(NULL); -#endif -} - - -/* *********************************************** */ - -static void startTcpReadThread(int sock_fd) { -#ifdef WIN32 - HANDLE hThread; - DWORD dwThreadId; - - hThread = CreateThread(NULL, /* no security attributes */ - 0, /* use default stack size */ - (LPTHREAD_START_ROUTINE)tcpReadThread, /* thread function */ - (void*)sock_fd, /* argument to thread function */ - 0, /* use default creation flags */ - &dwThreadId); /* returns the thread identifier */ -#else - int rc; - pthread_t threadId; - - rc = pthread_create(&threadId, NULL, tcpReadThread, (void*)sock_fd); -#endif -} - -/* *********************************************** */ - -int main(int argc, char* argv[]) { - int opt; - u_int16_t local_port = 0; - n2n_sock_info_t udp_sinfo; - n2n_sock_info_t tcp_sinfo; - -#ifdef WIN32 - initWin32(); -#endif - - optarg = NULL; - while((opt = getopt_long(argc, argv, "l:vh", long_options, NULL)) != EOF) { - switch (opt) { - case 'l': /* local-port */ - local_port = atoi(optarg) & 0xffff; - break; - case 'h': /* help */ - help(); - break; - case 'v': /* verbose */ - traceLevel = 3; - break; - } - } - - if(!(local_port)) - help(); - - udp_sinfo.is_udp_socket=1; - udp_sinfo.sock = open_socket(local_port, 1, 0); - if(udp_sinfo.sock < 0) return(-1); - - tcp_sinfo.is_udp_socket=0; - tcp_sinfo.sock = open_socket(local_port, 0, 1); - if(tcp_sinfo.sock < 0) return(-1); - - traceEvent(TRACE_NORMAL, "Supernode ready: listening on port %hu [TCP/UDP]", local_port); - - while(1) { - int rc, max_sock; - fd_set socket_mask; - struct timeval wait_time; - - FD_ZERO(&socket_mask); - max_sock = max(udp_sinfo.sock, tcp_sinfo.sock); - FD_SET(udp_sinfo.sock, &socket_mask); - FD_SET(tcp_sinfo.sock, &socket_mask); - - wait_time.tv_sec = 10; wait_time.tv_usec = 0; - rc = select(max_sock+1, &socket_mask, NULL, NULL, &wait_time); - - if(rc > 0) { - if(FD_ISSET(udp_sinfo.sock, &socket_mask)) { - char packet[2048]; - size_t len; - struct peer_addr sender; - u_int8_t discarded_pkt; - struct n2n_packet_header hdr; - - len = receive_data( &udp_sinfo, packet, sizeof(packet), &sender, &discarded_pkt, NULL, 0, &hdr); - - if(len <= 0) - traceEvent(TRACE_WARNING, "recvfrom()=%d [%s]\n", len, strerror(errno)); - else { - handle_packet(packet, len, &sender, &udp_sinfo); - } - } else if(FD_ISSET(tcp_sinfo.sock, &socket_mask)) { - struct sockaddr from; - int from_len = sizeof(from); - int new_sock = accept(tcp_sinfo.sock, (struct sockaddr*)&from, - (socklen_t*)&from_len); - - if(new_sock < 0) { - traceEvent(TRACE_WARNING, "TCP connection accept() failed [%s]\n", strerror(errno)); - } else { - startTcpReadThread(new_sock); - } - } - } - - purge_expired_registrations( &known_peers ); - } /* while */ - - closesocket(udp_sinfo.sock); - closesocket(tcp_sinfo.sock); - - return(0); -} diff --git a/bundles/n2n_meyerd/n2n_v1/tuntap_freebsd.c b/bundles/n2n_meyerd/n2n_v1/tuntap_freebsd.c deleted file mode 100644 index 95308be4..00000000 --- a/bundles/n2n_meyerd/n2n_v1/tuntap_freebsd.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - */ - -#include "n2n.h" - -#ifdef __FreeBSD__ - -void tun_close(tuntap_dev *device); - -/* ********************************** */ - -#define N2N_FREEBSD_TAPDEVICE_SIZE 32 -int tuntap_open(tuntap_dev *device /* ignored */, - char *dev, - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - int i; - char tap_device[N2N_FREEBSD_TAPDEVICE_SIZE]; - - for (i = 0; i < 255; i++) { - snprintf(tap_device, sizeof(tap_device), "/dev/tap%d", i); - - device->fd = open(tap_device, O_RDWR); - if(device->fd > 0) { - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - break; - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open tap device"); - return(-1); - } else { - char buf[256]; - FILE *fd; - - device->ip_addr = inet_addr(device_ip); - - if ( device_mac ) - { - /* FIXME - This is not tested. Might be wrong syntax for OS X */ - - /* Set the hw address before bringing the if up. */ - snprintf(buf, sizeof(buf), "ifconfig tap%d ether %s", - i, device_mac); - system(buf); - } - - snprintf(buf, sizeof(buf), "ifconfig tap%d %s netmask %s mtu %d up", - i, device_ip, device_mask, mtu); - system(buf); - - traceEvent(TRACE_NORMAL, "Interface tap%d up and running (%s/%s)", - i, device_ip, device_mask); - - /* Read MAC address */ - - snprintf(buf, sizeof(buf), "ifconfig tap%d |grep ether|cut -c 8-24", i); - /* traceEvent(TRACE_INFO, "%s", buf); */ - - fd = popen(buf, "r"); - if(fd < 0) { - tun_close(device); - return(-1); - } else { - int a, b, c, d, e, f; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address"); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface tap%d mac %s", i, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - - /* read_mac(dev, device->mac_addr); */ - return(device->fd); -} - -/* ********************************** */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -#endif diff --git a/bundles/n2n_meyerd/n2n_v1/tuntap_linux.c b/bundles/n2n_meyerd/n2n_v1/tuntap_linux.c deleted file mode 100644 index a1d20fba..00000000 --- a/bundles/n2n_meyerd/n2n_v1/tuntap_linux.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see -*/ - -#include "n2n.h" - -#ifdef __linux__ - -static void read_mac(char *ifname, char *mac_addr) { - int _sock, res; - struct ifreq ifr; - macstr_t mac_addr_buf; - - memset (&ifr,0,sizeof(struct ifreq)); - - /* Dummy socket, just to make ioctls with */ - _sock=socket(PF_INET, SOCK_DGRAM, 0); - strcpy(ifr.ifr_name, ifname); - res = ioctl(_sock,SIOCGIFHWADDR,&ifr); - if (res<0) { - perror ("Get hw addr"); - } else - memcpy(mac_addr, ifr.ifr_ifru.ifru_hwaddr.sa_data, 6); - - traceEvent(TRACE_NORMAL, "Interface %s has MAC %s", - ifname, - macaddr_str(mac_addr, mac_addr_buf, sizeof(mac_addr_buf))); - close(_sock); -} - -/* ********************************** */ - -/** @brief Open and configure the TAP device for packet read/write. - * - * This routine creates the interface via the tuntap driver then uses ifconfig - * to configure address/mask and MTU. - * - * @param device - [inout] a device info holder object - * @param dev - user-defined name for the new iface, - * if NULL system will assign a name - * @param device_ip - address of iface - * @param device_mask - netmask for device_ip - * @param mtu - MTU for device_ip - * - * @return - negative value on error - * - non-negative file-descriptor on success - */ -int tuntap_open(tuntap_dev *device, - char *dev, /* user-definable interface name, eg. edge0 */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - char *tuntap_device = "/dev/net/tun"; -#define N2N_LINUX_SYSTEMCMD_SIZE 128 - char buf[N2N_LINUX_SYSTEMCMD_SIZE]; - struct ifreq ifr; - int rc; - - device->fd = open(tuntap_device, O_RDWR); - if(device->fd < 0) { - printf("ERROR: ioctl() [%s][%d]\n", strerror(errno), errno); - return -1; - } - - memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TAP|IFF_NO_PI; /* Want a TAP device for layer 2 frames. */ - strncpy(ifr.ifr_name, dev, IFNAMSIZ); - rc = ioctl(device->fd, TUNSETIFF, (void *)&ifr); - - if(rc < 0) { - traceEvent(TRACE_ERROR, "ioctl() [%s][%d]\n", strerror(errno), rc); - close(device->fd); - return -1; - } - - if ( device_mac ) - { - /* Set the hw address before bringing the if up. */ - snprintf(buf, sizeof(buf), "/sbin/ifconfig %s hw ether %s", - ifr.ifr_name, device_mac ); - system(buf); - traceEvent(TRACE_INFO, "Setting MAC: %s", buf); - } - - snprintf(buf, sizeof(buf), "/sbin/ifconfig %s %s netmask %s mtu %d up", - ifr.ifr_name, device_ip, device_mask, mtu); - system(buf); - traceEvent(TRACE_INFO, "Bringing up: %s", buf); - - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - read_mac(dev, (char*)device->mac_addr); - return(device->fd); -} - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -#endif /* #ifdef __linux__ */ diff --git a/bundles/n2n_meyerd/n2n_v1/tuntap_osx.c b/bundles/n2n_meyerd/n2n_v1/tuntap_osx.c deleted file mode 100644 index 5a785bde..00000000 --- a/bundles/n2n_meyerd/n2n_v1/tuntap_osx.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - */ - -#include "n2n.h" - -#ifdef _DARWIN_ - -void tuntap_close(tuntap_dev *device); - -/* ********************************** */ - -#define N2N_OSX_TAPDEVICE_SIZE 32 -int tuntap_open(tuntap_dev *device /* ignored */, - char *dev, - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - int i; - char tap_device[N2N_OSX_TAPDEVICE_SIZE]; - - for (i = 0; i < 255; i++) { - snprintf(tap_device, sizeof(tap_device), "/dev/tap%d", i); - - device->fd = open(tap_device, O_RDWR); - if(device->fd > 0) { - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - break; - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open tap device"); - return(-1); - } else { - char buf[256]; - FILE *fd; - - device->ip_addr = inet_addr(device_ip); - - if ( device_mac ) - { - /* FIXME - This is not tested. Might be wrong syntax for OS X */ - - /* Set the hw address before bringing the if up. */ - snprintf(buf, sizeof(buf), "ifconfig tap%d ether %s", - i, device_mac); - system(buf); - } - - snprintf(buf, sizeof(buf), "ifconfig tap%d %s netmask %s mtu %d up", - i, device_ip, device_mask, mtu); - system(buf); - - traceEvent(TRACE_NORMAL, "Interface tap%d up and running (%s/%s)", - i, device_ip, device_mask); - - /* Read MAC address */ - - snprintf(buf, sizeof(buf), "ifconfig tap%d |grep ether|cut -c 8-24", i); - /* traceEvent(TRACE_INFO, "%s", buf); */ - - fd = popen(buf, "r"); - if(fd < 0) { - tuntap_close(device); - return(-1); - } else { - int a, b, c, d, e, f; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address"); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface tap%d [MTU %d] mac %s", i, mtu, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - - /* read_mac(dev, device->mac_addr); */ - return(device->fd); -} - -/* ********************************** */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -#endif diff --git a/bundles/n2n_meyerd/n2n_v1/twofish.c b/bundles/n2n_meyerd/n2n_v1/twofish.c deleted file mode 100644 index 73a1a8e0..00000000 --- a/bundles/n2n_meyerd/n2n_v1/twofish.c +++ /dev/null @@ -1,1031 +0,0 @@ -/* $Id: twofish.c,v 2.0 2002/08/11 22:32:25 fknobbe Exp $ - * - * - * Copyright (C) 1997-2000 The Cryptix Foundation Limited. - * Copyright (C) 2000 Farm9. - * Copyright (C) 2001 Frank Knobbe. - * All rights reserved. - * - * For Cryptix code: - * Use, modification, copying and distribution of this software is subject - * the terms and conditions of the Cryptix General Licence. You should have - * received a copy of the Cryptix General Licence along with this library; - * if not, you can download a copy from http://www.cryptix.org/ . - * - * For Farm9: - * --- jojo@farm9.com, August 2000, converted from Java to C++, added CBC mode and - * ciphertext stealing technique, added AsciiTwofish class for easy encryption - * decryption of text strings - * - * Frank Knobbe : - * --- April 2001, converted from C++ to C, prefixed global variables - * with TwoFish, substituted some defines, changed functions to make use of - * variables supplied in a struct, modified and added routines for modular calls. - * Cleaned up the code so that defines are used instead of fixed 16's and 32's. - * Created two general purpose crypt routines for one block and multiple block - * encryption using Joh's CBC code. - * Added crypt routines that use a header (with a magic and data length). - * (Basically a major rewrite). - * - * Note: Routines labeled _TwoFish are private and should not be used - * (or with extreme caution). - * - */ - -#ifndef __TWOFISH_LIBRARY_SOURCE__ -#define __TWOFISH_LIBRARY_SOURCE__ - -#include -#include -#include -#include -#include -#include "twofish.h" - - -bool TwoFish_srand=TRUE; /* if TRUE, first call of TwoFishInit will seed rand(); */ -/* of TwoFishInit */ - -/* Fixed 8x8 permutation S-boxes */ -static const u_int8_t TwoFish_P[2][256] = - { - { /* p0 */ - 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78, - 0xE4, 0xDD, 0xD1, 0x38, 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, - 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, 0xF2, 0xD0, 0x8B, 0x30, - 0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, - 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE, - 0x16, 0x0C, 0xE3, 0x61, 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, - 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, 0xE1, 0xE6, 0xBD, 0x45, - 0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, - 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF, - 0x33, 0xC9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, - 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, 0xA1, 0x1D, 0xAA, 0xED, - 0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, - 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B, - 0x5F, 0x93, 0x0A, 0xEF, 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, - 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, 0x2A, 0xCE, 0xCB, 0x2F, - 0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, - 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17, - 0x55, 0x1F, 0x8A, 0x7D, 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, - 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6E, 0x50, 0xDE, 0x68, - 0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, - 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42, - 0x4A, 0x5E, 0xC1, 0xE0 - }, - { /* p1 */ - 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B, - 0x45, 0x7D, 0xE8, 0x4B, 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, - 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, 0x5E, 0xBA, 0xAE, 0x5B, - 0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, - 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54, - 0x92, 0x74, 0x36, 0x51, 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, - 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, 0x13, 0x95, 0x9C, 0xC7, - 0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, - 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF, - 0x40, 0xE7, 0x2B, 0xE2, 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, - 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, 0x66, 0x94, 0xA1, 0x1D, - 0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, - 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21, - 0xC4, 0x1A, 0xEB, 0xD9, 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, - 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, 0x4F, 0xF2, 0x65, 0x8E, - 0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, - 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44, - 0xE0, 0x4D, 0x43, 0x69, 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, - 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, 0x22, 0xC9, 0xC0, 0x9B, - 0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, - 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56, - 0x55, 0x09, 0xBE, 0x91 - } - }; - -static bool TwoFish_MDSready=FALSE; -static u_int32_t TwoFish_MDS[4][256]; /* TwoFish_MDS matrix */ - - -#define TwoFish_LFSR1(x) (((x)>>1)^(((x)&0x01)?TwoFish_MDS_GF_FDBK/2:0)) -#define TwoFish_LFSR2(x) (((x)>>2)^(((x)&0x02)?TwoFish_MDS_GF_FDBK/2:0)^(((x)&0x01)?TwoFish_MDS_GF_FDBK/4:0)) - -#define TwoFish_Mx_1(x) ((u_int32_t)(x)) /* force result to dword so << will work */ -#define TwoFish_Mx_X(x) ((u_int32_t)((x)^TwoFish_LFSR2(x))) /* 5B */ -#define TwoFish_Mx_Y(x) ((u_int32_t)((x)^TwoFish_LFSR1(x)^TwoFish_LFSR2(x))) /* EF */ -#define TwoFish_RS_rem(x) { u_int8_t b=(u_int8_t)(x>>24); u_int32_t g2=((b<<1)^((b&0x80)?TwoFish_RS_GF_FDBK:0))&0xFF; u_int32_t g3=((b>>1)&0x7F)^((b&1)?TwoFish_RS_GF_FDBK>>1:0)^g2; x=(x<<8)^(g3<<24)^(g2<<16)^(g3<<8)^b; } - -/*#define TwoFish__b(x,N) (((u_int8_t *)&x)[((N)&3)^TwoFish_ADDR_XOR])*/ /* pick bytes out of a dword */ - -#define TwoFish_b0(x) TwoFish__b(x,0) /* extract LSB of u_int32_t */ -#define TwoFish_b1(x) TwoFish__b(x,1) -#define TwoFish_b2(x) TwoFish__b(x,2) -#define TwoFish_b3(x) TwoFish__b(x,3) /* extract MSB of u_int32_t */ - -u_int8_t TwoFish__b(u_int32_t x,int n) -{ n&=3; - while(n-->0) - x>>=8; - return (u_int8_t)x; -} - - -/* TwoFish Initialization - * - * This routine generates a global data structure for use with TwoFish, - * initializes important values (such as subkeys, sBoxes), generates subkeys - * and precomputes the MDS matrix if not already done. - * - * Input: User supplied password (will be appended by default password of 'SnortHas2FishEncryptionRoutines!') - * - * Output: Pointer to TWOFISH structure. This data structure contains key dependent data. - * This pointer is used with all other crypt functions. - */ - -TWOFISH *TwoFishInit(const u_int8_t *userkey, u_int32_t keysize) -{ TWOFISH *tfdata; - int i,x,m; - u_int8_t tkey[TwoFish_KEY_LENGTH+40]; - - memset( tkey, 0, TwoFish_KEY_LENGTH+40 ); - tfdata=(TWOFISH *)malloc(sizeof(TWOFISH)); /* allocate the TwoFish structure */ - if(tfdata!=NULL) - { - - /* Changes here prevented a dangerous random key segment for keys of length < TwoFish_KEY_LENGTH */ - if(keysize > 0) - { - memcpy( tkey, userkey, keysize ); /* The rest will be zeros */ - } - else - { - memcpy( tkey, TwoFish_DEFAULT_PW, TwoFish_DEFAULT_PW_LEN ); /* if no key defined, use default password */ - } - - /* This loop is awful - surely a loop on memcpy() would be clearer and more efficient */ - for(i=0,x=0,m=keysize;ikey[i]=tkey[x++]; /* fill the whole keyspace with repeating key. */ - if(x==m) - x=0; - } - - if(!TwoFish_MDSready) - _TwoFish_PrecomputeMDSmatrix(); /* "Wake Up, Neo" */ - _TwoFish_MakeSubKeys(tfdata); /* generate subkeys */ - _TwoFish_ResetCBC(tfdata); /* reset the CBC */ - tfdata->output=NULL; /* nothing to output yet */ - tfdata->dontflush=FALSE; /* reset decrypt skip block flag */ - if(TwoFish_srand) - { - TwoFish_srand=FALSE; - /* REVISIT: BbMaj7 : Should choose something with less predictability - * particularly for embedded targets with no real-time clock. */ - srand((unsigned int)time(NULL)); - } - } - return tfdata; /* return the data pointer */ -} - - -void TwoFishDestroy(TWOFISH *tfdata) -{ if(tfdata!=NULL) - free(tfdata); -} - - -/* en/decryption with CBC mode */ -u_int32_t _TwoFish_CryptRawCBC(u_int8_t *in,u_int8_t *out,u_int32_t len,bool decrypt,TWOFISH *tfdata) -{ u_int32_t rl; - - rl=len; /* remember how much data to crypt. */ - while(len>TwoFish_BLOCK_SIZE) /* and now we process block by block. */ - { _TwoFish_BlockCrypt(in,out,TwoFish_BLOCK_SIZE,decrypt,tfdata); /* de/encrypt it. */ - in+=TwoFish_BLOCK_SIZE; /* adjust pointers. */ - out+=TwoFish_BLOCK_SIZE; - len-=TwoFish_BLOCK_SIZE; - } - if(len>0) /* if we have less than a block left... */ - _TwoFish_BlockCrypt(in,out,len,decrypt,tfdata); /* ...then we de/encrypt that too. */ - if(tfdata->qBlockDefined && !tfdata->dontflush) /* in case len was exactly one block... */ - _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); /* ...we need to write the... */ - /* ...remaining bytes of the buffer */ - return rl; -} - -/* en/decryption on one block only */ -u_int32_t _TwoFish_CryptRaw16(u_int8_t *in,u_int8_t *out,u_int32_t len,bool decrypt,TWOFISH *tfdata) -{ /* qBlockPlain already zero'ed through ResetCBC */ - memcpy(tfdata->qBlockPlain,in,len); /* toss the data into it. */ - _TwoFish_BlockCrypt16(tfdata->qBlockPlain,tfdata->qBlockCrypt,decrypt,tfdata); /* encrypt just that block without CBC. */ - memcpy(out,tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE); /* and return what we got */ - return TwoFish_BLOCK_SIZE; -} - -/* en/decryption without reset of CBC and output assignment */ -u_int32_t _TwoFish_CryptRaw(u_int8_t *in,u_int8_t *out,u_int32_t len,bool decrypt,TWOFISH *tfdata) -{ - if(in!=NULL && out!=NULL && len>0 && tfdata!=NULL) /* if we have valid data, then... */ - { if(len>TwoFish_BLOCK_SIZE) /* ...check if we have more than one block. */ - return _TwoFish_CryptRawCBC(in,out,len,decrypt,tfdata); /* if so, use the CBC routines... */ - else - return _TwoFish_CryptRaw16(in,out,len,decrypt,tfdata); /* ...otherwise just do one block. */ - } - return 0; -} - - -/* TwoFish Raw Encryption - * - * Does not use header, but does use CBC (if more than one block has to be encrypted). - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the buffer receiving the ciphertext. - * The length of the plaintext buffer. - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ - -u_int32_t TwoFishEncryptRaw(u_int8_t *in, - u_int8_t *out, - u_int32_t len, - TWOFISH *tfdata) -{ _TwoFish_ResetCBC(tfdata); /* reset CBC flag. */ - tfdata->output=out; /* output straight into output buffer. */ - return _TwoFish_CryptRaw(in,out,len,FALSE,tfdata); /* and go for it. */ -} - -/* TwoFish Raw Decryption - * - * Does not use header, but does use CBC (if more than one block has to be decrypted). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the buffer receiving the plaintext. - * The length of the ciphertext buffer (at least one cipher block). - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ - -u_int32_t TwoFishDecryptRaw(u_int8_t *in, - u_int8_t *out, - u_int32_t len, - TWOFISH *tfdata) -{ _TwoFish_ResetCBC(tfdata); /* reset CBC flag. */ - tfdata->output=out; /* output straight into output buffer. */ - return _TwoFish_CryptRaw(in,out,len,TRUE,tfdata); /* and go for it. */ -} - -/* TwoFish Free - * - * Free's the allocated buffer. - * - * Input: Pointer to the TwoFish structure - * - * Output: (none) - */ - -void TwoFishFree(TWOFISH *tfdata) -{ if(tfdata->output!=NULL) /* if a valid buffer is present... */ - { free(tfdata->output); /* ...then we free it for you... */ - tfdata->output=NULL; /* ...and mark as such. */ - } -} - -/* TwoFish Set Output - * - * If you want to allocate the output buffer yourself, - * then you can set it with this function. - * - * Input: Pointer to your output buffer - * Pointer to the TwoFish structure - * - * Output: (none) - */ - -void TwoFishSetOutput(u_int8_t *outp,TWOFISH *tfdata) -{ tfdata->output=outp; /* (do we really need a function for this?) */ -} - -/* TwoFish Alloc - * - * Allocates enough memory for the output buffer that would be required - * - * Input: Length of the plaintext. - * Boolean flag for BinHex Output. - * Pointer to the TwoFish structure. - * - * Output: Returns a pointer to the memory allocated. - */ - -void *TwoFishAlloc(u_int32_t len,bool binhex,bool decrypt,TWOFISH *tfdata) -{ - /* TwoFishFree(tfdata); */ /* (don't for now) discard whatever was allocated earlier. */ - if(decrypt) /* if decrypting... */ - { if(binhex) /* ...and input is binhex encoded... */ - len/=2; /* ...use half as much for output. */ - len-=TwoFish_BLOCK_SIZE; /* Also, subtract the size of the header. */ - } - else - { len+=TwoFish_BLOCK_SIZE; /* the size is just increased by the header... */ - if(binhex) - len*=2; /* ...and doubled if output is to be binhexed. */ - } - tfdata->output=malloc(len+TwoFish_BLOCK_SIZE);/* grab some memory...plus some extra (it's running over somewhere, crashes without extra padding) */ - - return tfdata->output; /* ...and return to caller. */ -} - -/* bin2hex and hex2bin conversion */ -void _TwoFish_BinHex(u_int8_t *buf,u_int32_t len,bool bintohex) -{ u_int8_t *pi,*po,c; - - if(bintohex) - { for(pi=buf+len-1,po=buf+(2*len)-1;len>0;pi--,po--,len--) /* let's start from the end of the bin block. */ - { c=*pi; /* grab value. */ - c&=15; /* use lower 4 bits. */ - if(c>9) /* convert to ascii. */ - c+=('a'-10); - else - c+='0'; - *po--=c; /* set the lower nibble. */ - c=*pi; /* grab value again. */ - c>>=4; /* right shift 4 bits. */ - c&=15; /* make sure we only have 4 bits. */ - if(c>9) /* convert to ascii. */ - c+=('a'-10); - else - c+='0'; - *po=c; /* set the higher nibble. */ - } /* and keep going. */ - } - else - { for(pi=buf,po=buf;len>0;pi++,po++,len-=2) /* let's start from the beginning of the hex block. */ - { c=tolower(*pi++)-'0'; /* grab higher nibble. */ - if(c>9) /* convert to value. */ - c-=('0'-9); - *po=c<<4; /* left shit 4 bits. */ - c=tolower(*pi)-'0'; /* grab lower nibble. */ - if(c>9) /* convert to value. */ - c-=('0'-9); - *po|=c; /* and add to value. */ - } - } -} - - -/* TwoFish Encryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will include a small 'header' - * containing the magic and some salt. That way the decrypt routine can check if the - * packet got decrypted successfully, and return 0 instead of garbage. - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the pointer to the buffer receiving the ciphertext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the plaintext buffer. - * Can be -1 if the input is a null terminated string, in which case we'll count for you. - * Boolean flag for BinHex Output (if used, output will be twice as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ - -u_int32_t TwoFishEncrypt(u_int8_t *in, - u_int8_t **out, - signed long len, - bool binhex, - TWOFISH *tfdata) -{ u_int32_t ilen,olen; - - -#if 0 -/* This is so broken it doesn't deserve to live. */ - if(len== -1) /* if we got -1 for len, we'll assume IN is a... */ - ilen=strlen(in); /* ...\0 terminated string and figure len out ourselves... */ - else - ilen=len; /* ...otherwise we trust you supply a correct length. */ -#endif - - ilen = len; - - if(in!=NULL && out!=NULL && ilen>0 && tfdata!=NULL) /* if we got usable stuff, we'll do it. */ - { if(*out==NULL) /* if OUT points to a NULL pointer... */ - *out=TwoFishAlloc(ilen,binhex,FALSE,tfdata); /* ...we'll (re-)allocate buffer space. */ - if(*out!=NULL) - { tfdata->output=*out; /* set output buffer. */ - tfdata->header.salt=rand()*65536+rand(); /* toss in some salt. */ - tfdata->header.length[0]= (u_int8_t)(ilen); - tfdata->header.length[1]= (u_int8_t)(ilen>>8); - tfdata->header.length[2]= (u_int8_t)(ilen>>16); - tfdata->header.length[3]= (u_int8_t)(ilen>>24); - memcpy(tfdata->header.magic,TwoFish_MAGIC,TwoFish_MAGIC_LEN); /* set the magic. */ - olen=TwoFish_BLOCK_SIZE; /* set output counter. */ - _TwoFish_ResetCBC(tfdata); /* reset the CBC flag */ - _TwoFish_BlockCrypt((u_int8_t *)&(tfdata->header),*out,olen,FALSE,tfdata); /* encrypt first block (without flush on 16 byte boundary). */ - olen+=_TwoFish_CryptRawCBC(in,*out+TwoFish_BLOCK_SIZE,ilen,FALSE,tfdata); /* and encrypt the rest (we do not reset the CBC flag). */ - if(binhex) /* if binhex... */ - { _TwoFish_BinHex(*out,olen,TRUE); /* ...convert output to binhex... */ - olen*=2; /* ...and size twice as large. */ - } - tfdata->output=*out; - return olen; - } - } - return 0; -} - -/* TwoFish Decryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will check the small 'header' - * containing the magic. If magic does not match we return 0. Otherwise we return the - * amount of bytes decrypted (should be the same as the length in the header). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the pointer to the buffer receiving the plaintext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the ciphertext buffer. - * Can be -1 if the input is a null terminated binhex string, in which case we'll count for you. - * Boolean flag for BinHex Input (if used, plaintext will be half as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ - -u_int32_t TwoFishDecrypt(u_int8_t *in, - u_int8_t **out, - signed long len, - bool binhex, - TWOFISH *tfdata) -{ u_int32_t ilen,elen,olen; - const u_int8_t cmagic[TwoFish_MAGIC_LEN]=TwoFish_MAGIC; - u_int8_t *tbuf; - - - -#if 0 -/* This is so broken it doesn't deserve to live. */ - if(len== -1) /* if we got -1 for len, we'll assume IN is a... */ - ilen=strlen(in); /* ...\0 terminated string and figure len out ourselves... */ - else - ilen=len; /* ...otherwise we trust you supply a correct length. */ -#endif - - ilen = len; - - if(in!=NULL && out!=NULL && ilen>0 && tfdata!=NULL) /* if we got usable stuff, we'll do it. */ - { if(*out==NULL) /* if OUT points to a NULL pointer... */ - *out=TwoFishAlloc(ilen,binhex,TRUE,tfdata); /* ...we'll (re-)allocate buffer space. */ - if(*out!=NULL) - { if(binhex) /* if binhex... */ - { _TwoFish_BinHex(in,ilen,FALSE); /* ...convert input to values... */ - ilen/=2; /* ...and size half as much. */ - } - _TwoFish_ResetCBC(tfdata); /* reset the CBC flag. */ - - tbuf=(u_int8_t *)malloc(ilen+TwoFish_BLOCK_SIZE); /* get memory for data and header. */ - if(tbuf==NULL) - return 0; - tfdata->output=tbuf; /* set output to temp buffer. */ - - olen=_TwoFish_CryptRawCBC(in,tbuf,ilen,TRUE,tfdata)-TwoFish_BLOCK_SIZE; /* decrypt the whole thing. */ - memcpy(&(tfdata->header),tbuf,TwoFish_BLOCK_SIZE); /* copy first block into header. */ - tfdata->output=*out; - for(elen=0;elenheader.magic[elen]!=cmagic[elen]) - break; - if(elen==TwoFish_MAGIC_LEN) /* if magic matches then... */ - { elen=(tfdata->header.length[0]) | - (tfdata->header.length[1])<<8 | - (tfdata->header.length[2])<<16 | - (tfdata->header.length[3])<<24; /* .. we know how much to expect. */ - if(elen>olen) /* adjust if necessary. */ - elen=olen; - memcpy(*out,tbuf+TwoFish_BLOCK_SIZE,elen); /* copy data into intended output. */ - free(tbuf); - return elen; - } - free(tbuf); - } - } - return 0; -} - -void _TwoFish_PrecomputeMDSmatrix(void) /* precompute the TwoFish_MDS matrix */ -{ u_int32_t m1[2]; - u_int32_t mX[2]; - u_int32_t mY[2]; - u_int32_t i, j; - - for (i = 0; i < 256; i++) - { j = TwoFish_P[0][i] & 0xFF; /* compute all the matrix elements */ - m1[0] = j; - mX[0] = TwoFish_Mx_X( j ) & 0xFF; - mY[0] = TwoFish_Mx_Y( j ) & 0xFF; - - j = TwoFish_P[1][i] & 0xFF; - m1[1] = j; - mX[1] = TwoFish_Mx_X( j ) & 0xFF; - mY[1] = TwoFish_Mx_Y( j ) & 0xFF; - - TwoFish_MDS[0][i] = m1[TwoFish_P_00] | /* fill matrix w/ above elements */ - mX[TwoFish_P_00] << 8 | - mY[TwoFish_P_00] << 16 | - mY[TwoFish_P_00] << 24; - TwoFish_MDS[1][i] = mY[TwoFish_P_10] | - mY[TwoFish_P_10] << 8 | - mX[TwoFish_P_10] << 16 | - m1[TwoFish_P_10] << 24; - TwoFish_MDS[2][i] = mX[TwoFish_P_20] | - mY[TwoFish_P_20] << 8 | - m1[TwoFish_P_20] << 16 | - mY[TwoFish_P_20] << 24; - TwoFish_MDS[3][i] = mX[TwoFish_P_30] | - m1[TwoFish_P_30] << 8 | - mY[TwoFish_P_30] << 16 | - mX[TwoFish_P_30] << 24; - } - TwoFish_MDSready=TRUE; -} - - -void _TwoFish_MakeSubKeys(TWOFISH *tfdata) /* Expand a user-supplied key material into a session key. */ -{ u_int32_t k64Cnt = TwoFish_KEY_LENGTH / 8; - u_int32_t k32e[4]; /* even 32-bit entities */ - u_int32_t k32o[4]; /* odd 32-bit entities */ - u_int32_t sBoxKey[4]; - u_int32_t offset,i,j; - u_int32_t A, B, q=0; - u_int32_t k0,k1,k2,k3; - u_int32_t b0,b1,b2,b3; - - /* split user key material into even and odd 32-bit entities and */ - /* compute S-box keys using (12, 8) Reed-Solomon code over GF(256) */ - - - for (offset=0,i=0,j=k64Cnt-1;i<4 && offsetkey[offset++]; - k32e[i]|= tfdata->key[offset++]<<8; - k32e[i]|= tfdata->key[offset++]<<16; - k32e[i]|= tfdata->key[offset++]<<24; - k32o[i] = tfdata->key[offset++]; - k32o[i]|= tfdata->key[offset++]<<8; - k32o[i]|= tfdata->key[offset++]<<16; - k32o[i]|= tfdata->key[offset++]<<24; - sBoxKey[j] = _TwoFish_RS_MDS_Encode( k32e[i], k32o[i] ); /* reverse order */ - } - - /* compute the round decryption subkeys for PHT. these same subkeys */ - /* will be used in encryption but will be applied in reverse order. */ - i=0; - while(i < TwoFish_TOTAL_SUBKEYS) - { A = _TwoFish_F32( k64Cnt, q, k32e ); /* A uses even key entities */ - q += TwoFish_SK_BUMP; - - B = _TwoFish_F32( k64Cnt, q, k32o ); /* B uses odd key entities */ - q += TwoFish_SK_BUMP; - - B = B << 8 | B >> 24; - - A += B; - tfdata->subKeys[i++] = A; /* combine with a PHT */ - - A += B; - tfdata->subKeys[i++] = A << TwoFish_SK_ROTL | A >> (32-TwoFish_SK_ROTL); - } - - /* fully expand the table for speed */ - k0 = sBoxKey[0]; - k1 = sBoxKey[1]; - k2 = sBoxKey[2]; - k3 = sBoxKey[3]; - - for (i = 0; i < 256; i++) - { b0 = b1 = b2 = b3 = i; - switch (k64Cnt & 3) - { case 1: /* 64-bit keys */ - tfdata->sBox[ 2*i ] = TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][b0]) ^ TwoFish_b0(k0)]; - tfdata->sBox[ 2*i+1] = TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][b1]) ^ TwoFish_b1(k0)]; - tfdata->sBox[0x200+2*i ] = TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][b2]) ^ TwoFish_b2(k0)]; - tfdata->sBox[0x200+2*i+1] = TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][b3]) ^ TwoFish_b3(k0)]; - break; - case 0: /* 256-bit keys (same as 4) */ - b0 = (TwoFish_P[TwoFish_P_04][b0]) ^ TwoFish_b0(k3); - b1 = (TwoFish_P[TwoFish_P_14][b1]) ^ TwoFish_b1(k3); - b2 = (TwoFish_P[TwoFish_P_24][b2]) ^ TwoFish_b2(k3); - b3 = (TwoFish_P[TwoFish_P_34][b3]) ^ TwoFish_b3(k3); - case 3: /* 192-bit keys */ - b0 = (TwoFish_P[TwoFish_P_03][b0]) ^ TwoFish_b0(k2); - b1 = (TwoFish_P[TwoFish_P_13][b1]) ^ TwoFish_b1(k2); - b2 = (TwoFish_P[TwoFish_P_23][b2]) ^ TwoFish_b2(k2); - b3 = (TwoFish_P[TwoFish_P_33][b3]) ^ TwoFish_b3(k2); - case 2: /* 128-bit keys */ - tfdata->sBox[ 2*i ]= - TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][(TwoFish_P[TwoFish_P_02][b0]) ^ - TwoFish_b0(k1)]) ^ TwoFish_b0(k0)]; - - tfdata->sBox[ 2*i+1]= - TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][(TwoFish_P[TwoFish_P_12][b1]) ^ - TwoFish_b1(k1)]) ^ TwoFish_b1(k0)]; - - tfdata->sBox[0x200+2*i ]= - TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][(TwoFish_P[TwoFish_P_22][b2]) ^ - TwoFish_b2(k1)]) ^ TwoFish_b2(k0)]; - - tfdata->sBox[0x200+2*i+1]= - TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][(TwoFish_P[TwoFish_P_32][b3]) ^ - TwoFish_b3(k1)]) ^ TwoFish_b3(k0)]; - } - } -} - - -/** - * Encrypt or decrypt exactly one block of plaintext in CBC mode. - * Use "ciphertext stealing" technique described on pg. 196 - * of "Applied Cryptography" to encrypt the final partial - * (i.e. <16 byte) block if necessary. - * - * jojo: the "ciphertext stealing" requires we read ahead and have - * special handling for the last two blocks. Because of this, the - * output from the TwoFish algorithm is handled internally here. - * It would be better to have a higher level handle this as well as - * CBC mode. Unfortunately, I've mixed the two together, which is - * pretty crappy... The Java version separates these out correctly. - * - * fknobbe: I have reduced the CBC mode to work on memory buffer only. - * Higher routines should use an intermediate buffer and handle - * their output seperately (mainly so the data can be flushed - * in one chunk, not seperate 16 byte blocks...) - * - * @param in The plaintext. - * @param out The ciphertext - * @param size how much to encrypt - * @param tfdata: Pointer to the global data structure containing session keys. - * @return none - */ -void _TwoFish_BlockCrypt(u_int8_t *in,u_int8_t *out,u_int32_t size,int decrypt,TWOFISH *tfdata) -{ u_int8_t PnMinusOne[TwoFish_BLOCK_SIZE]; - u_int8_t CnMinusOne[TwoFish_BLOCK_SIZE]; - u_int8_t CBCplusCprime[TwoFish_BLOCK_SIZE]; - u_int8_t Pn[TwoFish_BLOCK_SIZE]; - u_int8_t *p,*pout; - u_int32_t i; - - /* here is where we implement CBC mode and cipher block stealing */ - if(size==TwoFish_BLOCK_SIZE) - { /* if we are encrypting, CBC means we XOR the plain text block with the */ - /* previous cipher text block before encrypting */ - if(!decrypt && tfdata->qBlockDefined) - { for(p=in,i=0;iqBlockCrypt[i]; /* FK: I'm copying the xor'ed input into Pn... */ - } - else - memcpy(Pn,in,TwoFish_BLOCK_SIZE); /* FK: same here. we work of Pn all the time. */ - - /* TwoFish block level encryption or decryption */ - _TwoFish_BlockCrypt16(Pn,out,decrypt,tfdata); - - /* if we are decrypting, CBC means we XOR the result of the decryption */ - /* with the previous cipher text block to get the resulting plain text */ - if(decrypt && tfdata->qBlockDefined) - { for (p=out,i=0;iqBlockPlain[i]; - } - - /* save the input and output blocks, since CBC needs these for XOR */ - /* operations */ - _TwoFish_qBlockPush(Pn,out,tfdata); - } - else - { /* cipher block stealing, we are at Pn, */ - /* but since Cn-1 must now be replaced with CnC' */ - /* we pop it off, and recalculate Cn-1 */ - - if(decrypt) - { /* We are on an odd block, and had to do cipher block stealing, */ - /* so the PnMinusOne has to be derived differently. */ - - /* First we decrypt it into CBC and C' */ - _TwoFish_qBlockPop(CnMinusOne,PnMinusOne,tfdata); - _TwoFish_BlockCrypt16(CnMinusOne,CBCplusCprime,decrypt,tfdata); - - /* we then xor the first few bytes with the "in" bytes (Cn) */ - /* to recover Pn, which we put in out */ - for(p=in,pout=out,i=0;iprevCipher[i]; - - /* So at this point, out has PnMinusOne */ - _TwoFish_qBlockPush(CnMinusOne,PnMinusOne,tfdata); - _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); - _TwoFish_FlushOutput(out,size,tfdata); - } - else - { _TwoFish_qBlockPop(PnMinusOne,CnMinusOne,tfdata); - memset(Pn,0,TwoFish_BLOCK_SIZE); - memcpy(Pn,in,size); - for(i=0;iqBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); - _TwoFish_FlushOutput(CnMinusOne,size,tfdata); /* old Cn-1 becomes new partial Cn */ - } - tfdata->qBlockDefined=FALSE; - } -} - -void _TwoFish_qBlockPush(u_int8_t *p,u_int8_t *c,TWOFISH *tfdata) -{ if(tfdata->qBlockDefined) - _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); - memcpy(tfdata->prevCipher,tfdata->qBlockPlain,TwoFish_BLOCK_SIZE); - memcpy(tfdata->qBlockPlain,p,TwoFish_BLOCK_SIZE); - memcpy(tfdata->qBlockCrypt,c,TwoFish_BLOCK_SIZE); - tfdata->qBlockDefined=TRUE; -} - -void _TwoFish_qBlockPop(u_int8_t *p,u_int8_t *c,TWOFISH *tfdata) -{ memcpy(p,tfdata->qBlockPlain,TwoFish_BLOCK_SIZE ); - memcpy(c,tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE ); - tfdata->qBlockDefined=FALSE; -} - -/* Reset's the CBC flag and zero's PrevCipher (through qBlockPlain) (important) */ -void _TwoFish_ResetCBC(TWOFISH *tfdata) -{ tfdata->qBlockDefined=FALSE; - memset(tfdata->qBlockPlain,0,TwoFish_BLOCK_SIZE); -} - -void _TwoFish_FlushOutput(u_int8_t *b,u_int32_t len,TWOFISH *tfdata) -{ u_int32_t i; - - for(i=0;idontflush;i++) - *tfdata->output++ = *b++; - tfdata->dontflush=FALSE; -} - -void _TwoFish_BlockCrypt16(u_int8_t *in,u_int8_t *out,bool decrypt,TWOFISH *tfdata) -{ u_int32_t x0,x1,x2,x3; - u_int32_t k,t0,t1,R; - - - x0=*in++; - x0|=(*in++ << 8 ); - x0|=(*in++ << 16); - x0|=(*in++ << 24); - x1=*in++; - x1|=(*in++ << 8 ); - x1|=(*in++ << 16); - x1|=(*in++ << 24); - x2=*in++; - x2|=(*in++ << 8 ); - x2|=(*in++ << 16); - x2|=(*in++ << 24); - x3=*in++; - x3|=(*in++ << 8 ); - x3|=(*in++ << 16); - x3|=(*in++ << 24); - - if(decrypt) - { x0 ^= tfdata->subKeys[4]; /* swap input and output whitening keys when decrypting */ - x1 ^= tfdata->subKeys[5]; - x2 ^= tfdata->subKeys[6]; - x3 ^= tfdata->subKeys[7]; - - k = 7+(TwoFish_ROUNDS*2); - for (R = 0; R < TwoFish_ROUNDS; R += 2) - { t0 = _TwoFish_Fe320( tfdata->sBox, x0); - t1 = _TwoFish_Fe323( tfdata->sBox, x1); - x3 ^= t0 + (t1<<1) + tfdata->subKeys[k--]; - x3 = x3 >> 1 | x3 << 31; - x2 = x2 << 1 | x2 >> 31; - x2 ^= t0 + t1 + tfdata->subKeys[k--]; - - t0 = _TwoFish_Fe320( tfdata->sBox, x2); - t1 = _TwoFish_Fe323( tfdata->sBox, x3); - x1 ^= t0 + (t1<<1) + tfdata->subKeys[k--]; - x1 = x1 >> 1 | x1 << 31; - x0 = x0 << 1 | x0 >> 31; - x0 ^= t0 + t1 + tfdata->subKeys[k--]; - } - - x2 ^= tfdata->subKeys[0]; - x3 ^= tfdata->subKeys[1]; - x0 ^= tfdata->subKeys[2]; - x1 ^= tfdata->subKeys[3]; - } - else - { x0 ^= tfdata->subKeys[0]; - x1 ^= tfdata->subKeys[1]; - x2 ^= tfdata->subKeys[2]; - x3 ^= tfdata->subKeys[3]; - - k = 8; - for (R = 0; R < TwoFish_ROUNDS; R += 2) - { t0 = _TwoFish_Fe320( tfdata->sBox, x0); - t1 = _TwoFish_Fe323( tfdata->sBox, x1); - x2 ^= t0 + t1 + tfdata->subKeys[k++]; - x2 = x2 >> 1 | x2 << 31; - x3 = x3 << 1 | x3 >> 31; - x3 ^= t0 + (t1<<1) + tfdata->subKeys[k++]; - - t0 = _TwoFish_Fe320( tfdata->sBox, x2); - t1 = _TwoFish_Fe323( tfdata->sBox, x3); - x0 ^= t0 + t1 + tfdata->subKeys[k++]; - x0 = x0 >> 1 | x0 << 31; - x1 = x1 << 1 | x1 >> 31; - x1 ^= t0 + (t1<<1) + tfdata->subKeys[k++]; - } - - x2 ^= tfdata->subKeys[4]; - x3 ^= tfdata->subKeys[5]; - x0 ^= tfdata->subKeys[6]; - x1 ^= tfdata->subKeys[7]; - } - - *out++ = (u_int8_t)(x2 ); - *out++ = (u_int8_t)(x2 >> 8); - *out++ = (u_int8_t)(x2 >> 16); - *out++ = (u_int8_t)(x2 >> 24); - - *out++ = (u_int8_t)(x3 ); - *out++ = (u_int8_t)(x3 >> 8); - *out++ = (u_int8_t)(x3 >> 16); - *out++ = (u_int8_t)(x3 >> 24); - - *out++ = (u_int8_t)(x0 ); - *out++ = (u_int8_t)(x0 >> 8); - *out++ = (u_int8_t)(x0 >> 16); - *out++ = (u_int8_t)(x0 >> 24); - - *out++ = (u_int8_t)(x1 ); - *out++ = (u_int8_t)(x1 >> 8); - *out++ = (u_int8_t)(x1 >> 16); - *out++ = (u_int8_t)(x1 >> 24); -} - -/** - * Use (12, 8) Reed-Solomon code over GF(256) to produce a key S-box - * 32-bit entity from two key material 32-bit entities. - * - * @param k0 1st 32-bit entity. - * @param k1 2nd 32-bit entity. - * @return Remainder polynomial generated using RS code - */ -u_int32_t _TwoFish_RS_MDS_Encode(u_int32_t k0,u_int32_t k1) -{ u_int32_t i,r; - - for(r=k1,i=0;i<4;i++) /* shift 1 byte at a time */ - TwoFish_RS_rem(r); - r ^= k0; - for(i=0;i<4;i++) - TwoFish_RS_rem(r); - - return r; -} - -u_int32_t _TwoFish_F32(u_int32_t k64Cnt,u_int32_t x,u_int32_t *k32) -{ u_int8_t b0,b1,b2,b3; - u_int32_t k0,k1,k2,k3,result = 0; - - b0=TwoFish_b0(x); - b1=TwoFish_b1(x); - b2=TwoFish_b2(x); - b3=TwoFish_b3(x); - k0=k32[0]; - k1=k32[1]; - k2=k32[2]; - k3=k32[3]; - - switch (k64Cnt & 3) - { case 1: /* 64-bit keys */ - result = - TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][b0] & 0xFF) ^ TwoFish_b0(k0)] ^ - TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][b1] & 0xFF) ^ TwoFish_b1(k0)] ^ - TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][b2] & 0xFF) ^ TwoFish_b2(k0)] ^ - TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][b3] & 0xFF) ^ TwoFish_b3(k0)]; - break; - case 0: /* 256-bit keys (same as 4) */ - b0 = (TwoFish_P[TwoFish_P_04][b0] & 0xFF) ^ TwoFish_b0(k3); - b1 = (TwoFish_P[TwoFish_P_14][b1] & 0xFF) ^ TwoFish_b1(k3); - b2 = (TwoFish_P[TwoFish_P_24][b2] & 0xFF) ^ TwoFish_b2(k3); - b3 = (TwoFish_P[TwoFish_P_34][b3] & 0xFF) ^ TwoFish_b3(k3); - - case 3: /* 192-bit keys */ - b0 = (TwoFish_P[TwoFish_P_03][b0] & 0xFF) ^ TwoFish_b0(k2); - b1 = (TwoFish_P[TwoFish_P_13][b1] & 0xFF) ^ TwoFish_b1(k2); - b2 = (TwoFish_P[TwoFish_P_23][b2] & 0xFF) ^ TwoFish_b2(k2); - b3 = (TwoFish_P[TwoFish_P_33][b3] & 0xFF) ^ TwoFish_b3(k2); - case 2: /* 128-bit keys (optimize for this case) */ - result = - TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][(TwoFish_P[TwoFish_P_02][b0] & 0xFF) ^ TwoFish_b0(k1)] & 0xFF) ^ TwoFish_b0(k0)] ^ - TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][(TwoFish_P[TwoFish_P_12][b1] & 0xFF) ^ TwoFish_b1(k1)] & 0xFF) ^ TwoFish_b1(k0)] ^ - TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][(TwoFish_P[TwoFish_P_22][b2] & 0xFF) ^ TwoFish_b2(k1)] & 0xFF) ^ TwoFish_b2(k0)] ^ - TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][(TwoFish_P[TwoFish_P_32][b3] & 0xFF) ^ TwoFish_b3(k1)] & 0xFF) ^ TwoFish_b3(k0)]; - break; - } - return result; -} - -u_int32_t _TwoFish_Fe320(u_int32_t *lsBox,u_int32_t x) -{ return lsBox[ TwoFish_b0(x)<<1 ]^ - lsBox[ ((TwoFish_b1(x)<<1)|1)]^ - lsBox[0x200+ (TwoFish_b2(x)<<1) ]^ - lsBox[0x200+((TwoFish_b3(x)<<1)|1)]; -} - -u_int32_t _TwoFish_Fe323(u_int32_t *lsBox,u_int32_t x) -{ return lsBox[ (TwoFish_b3(x)<<1) ]^ - lsBox[ ((TwoFish_b0(x)<<1)|1)]^ - lsBox[0x200+ (TwoFish_b1(x)<<1) ]^ - lsBox[0x200+((TwoFish_b2(x)<<1)|1)]; -} - -u_int32_t _TwoFish_Fe32(u_int32_t *lsBox,u_int32_t x,u_int32_t R) -{ return lsBox[ 2*TwoFish__b(x,R ) ]^ - lsBox[ 2*TwoFish__b(x,R+1)+1]^ - lsBox[0x200+2*TwoFish__b(x,R+2) ]^ - lsBox[0x200+2*TwoFish__b(x,R+3)+1]; -} - - -#endif - -/* ******************************************* */ -#if defined TWOFISH_UNIT_TEST -#include - -#define TEST_DATA_SIZE 327 - -int main(int argc, char* argv[]) -{ - int i; - int n; - - char outbuf[4096]; - char * outp = outbuf; - - u_int8_t key[] = { 0xfc, 0x77, 0x1a, 0xda, 0xaa }; - TWOFISH *tfa = TwoFishInit( key, 5 ); - TWOFISH *tfb = TwoFishInit( key, 5 ); - - u_int8_t out[2048], out2[2048]; - u_int8_t in[TEST_DATA_SIZE]; - - for ( i=0; i: - * --- April 2001, converted from C++ to C, prefixed global variables - * with TwoFish, substituted some defines, changed functions to make use of - * variables supplied in a struct, modified and added routines for modular calls. - * Cleaned up the code so that defines are used instead of fixed 16's and 32's. - * Created two general purpose crypt routines for one block and multiple block - * encryption using Joh's CBC code. - * Added crypt routines that use a header (with a magic and data length). - * (Basically a major rewrite). - * - * Note: Routines labeled _TwoFish are private and should not be used - * (or with extreme caution). - * - */ - -#ifndef __TWOFISH_LIBRARY_HEADER__ -#define __TWOFISH_LIBRARY_HEADER__ - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE !FALSE -#endif -#ifndef bool -#define bool int -#endif - -#ifdef WIN32 -#include "win32/n2n_win32.h" -#endif - -/* Constants */ - -#define TwoFish_DEFAULT_PW "SnortHas2FishEncryptionRoutines!" /* default password (not more than 32 chars) */ -#define TwoFish_DEFAULT_PW_LEN 32 -#define TwoFish_MAGIC "TwoFish" /* to indentify a successful decryption */ - -enum -{ TwoFish_KEY_SIZE = 256, /* Valid values: 64, 128, 192, 256 */ - /* User 256, other key sizes have not been tested. */ - /* (But should work. I substitutes as much as */ - /* I could with this define.) */ - TwoFish_ROUNDS = 16, - TwoFish_BLOCK_SIZE = 16, /* bytes in a data-block */ - TwoFish_KEY_LENGTH = TwoFish_KEY_SIZE/8, /* 32= 256-bit key */ - TwoFish_TOTAL_SUBKEYS = 4+4+2*TwoFish_ROUNDS, - TwoFish_MAGIC_LEN = TwoFish_BLOCK_SIZE-8, - TwoFish_SK_BUMP = 0x01010101, - TwoFish_SK_ROTL = 9, - TwoFish_P_00 = 1, - TwoFish_P_01 = 0, - TwoFish_P_02 = 0, - TwoFish_P_03 = TwoFish_P_01 ^ 1, - TwoFish_P_04 = 1, - TwoFish_P_10 = 0, - TwoFish_P_11 = 0, - TwoFish_P_12 = 1, - TwoFish_P_13 = TwoFish_P_11 ^ 1, - TwoFish_P_14 = 0, - TwoFish_P_20 = 1, - TwoFish_P_21 = 1, - TwoFish_P_22 = 0, - TwoFish_P_23 = TwoFish_P_21 ^ 1, - TwoFish_P_24 = 0, - TwoFish_P_30 = 0, - TwoFish_P_31 = 1, - TwoFish_P_32 = 1, - TwoFish_P_33 = TwoFish_P_31 ^ 1, - TwoFish_P_34 = 1, - TwoFish_GF256_FDBK = 0x169, - TwoFish_GF256_FDBK_2 = 0x169 / 2, - TwoFish_GF256_FDBK_4 = 0x169 / 4, - TwoFish_RS_GF_FDBK = 0x14D, /* field generator */ - TwoFish_MDS_GF_FDBK = 0x169 /* primitive polynomial for GF(256) */ -}; - - -/* Global data structure for callers */ - -typedef struct -{ - u_int32_t sBox[4 * 256]; /* Key dependent S-box */ - u_int32_t subKeys[TwoFish_TOTAL_SUBKEYS]; /* Subkeys */ - u_int8_t key[TwoFish_KEY_LENGTH]; /* Encryption Key */ - u_int8_t *output; /* Pointer to output buffer */ - u_int8_t qBlockPlain[TwoFish_BLOCK_SIZE]; /* Used by CBC */ - u_int8_t qBlockCrypt[TwoFish_BLOCK_SIZE]; - u_int8_t prevCipher[TwoFish_BLOCK_SIZE]; - struct /* Header for crypt functions. Has to be at least one block long. */ - { u_int32_t salt; /* Random salt in first block (will salt the rest through CBC) */ - u_int8_t length[4]; /* The amount of data following the header */ - u_int8_t magic[TwoFish_MAGIC_LEN]; /* Magic to identify successful decryption */ - } header; - bool qBlockDefined; - bool dontflush; -} TWOFISH; - -#ifndef __TWOFISH_LIBRARY_SOURCE__ - -extern bool TwoFish_srand; /* if set to TRUE (default), first call of TwoFishInit will seed rand(); */ - /* call of TwoFishInit */ -#endif - - -/**** Public Functions ****/ - -/* TwoFish Initialization - * - * This routine generates a global data structure for use with TwoFish, - * initializes important values (such as subkeys, sBoxes), generates subkeys - * and precomputes the MDS matrix if not already done. - * - * Input: User supplied password (will be appended by default password of 'SnortHas2FishEncryptionRoutines!') - * - * Output: Pointer to TWOFISH structure. This data structure contains key dependent data. - * This pointer is used with all other crypt functions. - */ -TWOFISH *TwoFishInit(const u_int8_t *userkey, u_int32_t keysize ); - - -/* TwoFish Destroy - * - * Nothing else but a free... - * - * Input: Pointer to the TwoFish structure. - * - */ -void TwoFishDestroy(TWOFISH *tfdata); - - -/* TwoFish Alloc - * - * Allocates enough memory for the output buffer as required. - * - * Input: Length of the plaintext. - * Boolean flag for BinHex Output. - * Pointer to the TwoFish structure. - * - * Output: Returns a pointer to the memory allocated. - */ -void *TwoFishAlloc(u_int32_t len,bool binhex,bool decrypt,TWOFISH *tfdata); - - -/* TwoFish Free - * - * Free's the allocated buffer. - * - * Input: Pointer to the TwoFish structure - * - * Output: (none) - */ -void TwoFishFree(TWOFISH *tfdata); - - -/* TwoFish Set Output - * - * If you want to allocate the output buffer yourself, - * then you can set it with this function. - * - * Input: Pointer to your output buffer - * Pointer to the TwoFish structure - * - * Output: (none) - */ -void TwoFishSetOutput(u_int8_t *outp,TWOFISH *tfdata); - - -/* TwoFish Raw Encryption - * - * Does not use header, but does use CBC (if more than one block has to be encrypted). - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the buffer receiving the ciphertext. - * The length of the plaintext buffer. - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ -u_int32_t TwoFishEncryptRaw(u_int8_t *in,u_int8_t *out,u_int32_t len,TWOFISH *tfdata); - -/* TwoFish Raw Decryption - * - * Does not use header, but does use CBC (if more than one block has to be decrypted). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the buffer receiving the plaintext. - * The length of the ciphertext buffer (at least one cipher block). - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ -u_int32_t TwoFishDecryptRaw(u_int8_t *in,u_int8_t *out,u_int32_t len,TWOFISH *tfdata); - - -/* TwoFish Encryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will include a small 'header' - * containing the magic and some salt. That way the decrypt routine can check if the - * packet got decrypted successfully, and return 0 instead of garbage. - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the pointer to the buffer receiving the ciphertext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the plaintext buffer. - * Can be -1 if the input is a null terminated string, in which case we'll count for you. - * Boolean flag for BinHex Output (if used, output will be twice as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ -u_int32_t TwoFishEncrypt(u_int8_t *in,u_int8_t **out,signed long len,bool binhex,TWOFISH *tfdata); - - -/* TwoFish Decryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will check the small 'header' - * containing the magic. If magic does not match we return 0. Otherwise we return the - * amount of bytes decrypted (should be the same as the length in the header). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the pointer to the buffer receiving the plaintext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the ciphertext buffer. - * Can be -1 if the input is a null terminated binhex string, in which case we'll count for you. - * Boolean flag for BinHex Input (if used, plaintext will be half as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ -u_int32_t TwoFishDecrypt(u_int8_t *in,u_int8_t **out,signed long len,bool binhex,TWOFISH *tfdata); - - -/**** Private Functions ****/ - -u_int8_t TwoFish__b(u_int32_t x,int n); -void _TwoFish_BinHex(u_int8_t *buf,u_int32_t len,bool bintohex); -u_int32_t _TwoFish_CryptRawCBC(u_int8_t *in,u_int8_t *out,u_int32_t len,bool decrypt,TWOFISH *tfdata); -u_int32_t _TwoFish_CryptRaw16(u_int8_t *in,u_int8_t *out,u_int32_t len,bool decrypt,TWOFISH *tfdata); -u_int32_t _TwoFish_CryptRaw(u_int8_t *in,u_int8_t *out,u_int32_t len,bool decrypt,TWOFISH *tfdata); -void _TwoFish_PrecomputeMDSmatrix(void); -void _TwoFish_MakeSubKeys(TWOFISH *tfdata); -void _TwoFish_qBlockPush(u_int8_t *p,u_int8_t *c,TWOFISH *tfdata); -void _TwoFish_qBlockPop(u_int8_t *p,u_int8_t *c,TWOFISH *tfdata); -void _TwoFish_ResetCBC(TWOFISH *tfdata); -void _TwoFish_FlushOutput(u_int8_t *b,u_int32_t len,TWOFISH *tfdata); -void _TwoFish_BlockCrypt(u_int8_t *in,u_int8_t *out,u_int32_t size,int decrypt,TWOFISH *tfdata); -void _TwoFish_BlockCrypt16(u_int8_t *in,u_int8_t *out,bool decrypt,TWOFISH *tfdata); -u_int32_t _TwoFish_RS_MDS_Encode(u_int32_t k0,u_int32_t k1); -u_int32_t _TwoFish_F32(u_int32_t k64Cnt,u_int32_t x,u_int32_t *k32); -u_int32_t _TwoFish_Fe320(u_int32_t *lsBox,u_int32_t x); -u_int32_t _TwoFish_Fe323(u_int32_t *lsBox,u_int32_t x); -u_int32_t _TwoFish_Fe32(u_int32_t *lsBox,u_int32_t x,u_int32_t R); - - -#endif diff --git a/bundles/n2n_meyerd/n2n_v1/version.c b/bundles/n2n_meyerd/n2n_v1/version.c deleted file mode 100644 index 42f43c12..00000000 --- a/bundles/n2n_meyerd/n2n_v1/version.c +++ /dev/null @@ -1,3 +0,0 @@ -const char * version = N2N_VERSION; -const char * osName = N2N_OSNAME; -const char * buildDate = __DATE__ " " __TIME__; diff --git a/bundles/n2n_meyerd/n2n_v1/win32/DotNet/n2n.sln b/bundles/n2n_meyerd/n2n_v1/win32/DotNet/n2n.sln deleted file mode 100644 index 024d46a9..00000000 --- a/bundles/n2n_meyerd/n2n_v1/win32/DotNet/n2n.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "edge", "n2n.vcproj", "{4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "supernode", "supernode\supernode.vcproj", "{1F7F0E45-7DE9-4CE2-845F-38D59C2E4F51}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Debug|Win32.ActiveCfg = Debug|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Debug|Win32.Build.0 = Debug|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Release|Win32.ActiveCfg = Release|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Release|Win32.Build.0 = Release|Win32 - {1F7F0E45-7DE9-4CE2-845F-38D59C2E4F51}.Debug|Win32.ActiveCfg = Debug|Win32 - {1F7F0E45-7DE9-4CE2-845F-38D59C2E4F51}.Debug|Win32.Build.0 = Debug|Win32 - {1F7F0E45-7DE9-4CE2-845F-38D59C2E4F51}.Release|Win32.ActiveCfg = Release|Win32 - {1F7F0E45-7DE9-4CE2-845F-38D59C2E4F51}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/bundles/n2n_meyerd/n2n_v1/win32/DotNet/n2n.suo b/bundles/n2n_meyerd/n2n_v1/win32/DotNet/n2n.suo deleted file mode 100644 index aae212bd..00000000 Binary files a/bundles/n2n_meyerd/n2n_v1/win32/DotNet/n2n.suo and /dev/null differ diff --git a/bundles/n2n_meyerd/n2n_v1/win32/DotNet/n2n.vcproj b/bundles/n2n_meyerd/n2n_v1/win32/DotNet/n2n.vcproj deleted file mode 100644 index 25370024..00000000 --- a/bundles/n2n_meyerd/n2n_v1/win32/DotNet/n2n.vcproj +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/n2n_meyerd/n2n_v1/win32/getopt.c b/bundles/n2n_meyerd/n2n_v1/win32/getopt.c deleted file mode 100644 index 6bbb735a..00000000 --- a/bundles/n2n_meyerd/n2n_v1/win32/getopt.c +++ /dev/null @@ -1,1074 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 - Free Software Foundation, Inc. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include -#ifdef WIN32 -#include -#endif - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include -# if _GNU_GETOPT<_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -# include -# include -#endif /* GNU C library. */ - -#ifdef VMS -# include -# if HAVE_STRING_H - 0 -# include -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# ifdef HAVE_LIBINTL_H -# include -# define _(msgid) gettext (msgid) -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -#ifndef DARWIN -char *optarg; -#endif - - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -#ifndef DARWIN -int optind = 1; -#endif - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -#ifndef DARWIN -#ifdef WIN32 -int opterr = 0; -#else -int opterr = 1; -#endif -#endif - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ -#ifndef DARWIN -int optopt = '?'; -#endif - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include -# define my_index strchr -#else - -#ifndef WIN32 -# if HAVE_STRING_H -# include -# else -# include -# endif -#endif - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (); -#endif - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; - -static int original_argc; -static char *const *original_argv; - -/* Make sure the environment variable bash 2.0 puts in the environment - is valid for the getopt call we must make sure that the ARGV passed - to getopt is that one passed to the process. */ -static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) -{ - /* XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ - original_argc = argc; - original_argv = argv; -} -# ifdef text_set_element -text_set_element (__libc_subinit, store_args_and_env); -# endif /* text_set_element */ - -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#ifdef _LIBC - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#ifdef _LIBC - if (posixly_correct == NULL - && argc == original_argc && argv == original_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - int print_errors = opterr; - if (optstring[0] == ':') - print_errors = 0; - - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#ifdef _LIBC -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (print_errors) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (print_errors) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt____ (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ - diff --git a/bundles/n2n_meyerd/n2n_v1/win32/getopt.h b/bundles/n2n_meyerd/n2n_v1/win32/getopt.h deleted file mode 100644 index b0147e9d..00000000 --- a/bundles/n2n_meyerd/n2n_v1/win32/getopt.h +++ /dev/null @@ -1,169 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -# if defined __STDC__ && __STDC__ - const char *name; -# else - char *name; -# endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, `optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `getopt' that there are no more - options. - - If OPTS begins with `--', then non-option arguments are treated as - arguments to the option '\0'. This behavior is specific to the GNU - `getopt'. */ - -#if defined __STDC__ && __STDC__ -# ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/bundles/n2n_meyerd/n2n_v1/win32/getopt1.c b/bundles/n2n_meyerd/n2n_v1/win32/getopt1.c deleted file mode 100644 index 3d264f2d..00000000 --- a/bundles/n2n_meyerd/n2n_v1/win32/getopt1.c +++ /dev/null @@ -1,188 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "getopt.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/bundles/n2n_meyerd/n2n_v1/win32/n2n_win32.h b/bundles/n2n_meyerd/n2n_v1/win32/n2n_win32.h deleted file mode 100644 index 36f8ed36..00000000 --- a/bundles/n2n_meyerd/n2n_v1/win32/n2n_win32.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - - (C) 2007 - Luca Deri - -*/ - -#ifndef _N2N_WIN32_H_ -#define _N2N_WIN32_H_ - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include "wintap.h" - -typedef unsigned int u_int32_t; -typedef unsigned short u_int16_t; -typedef unsigned char u_int8_t; -typedef int int32_t; -typedef short int16_t; -typedef char int8_t; - -#define snprintf _snprintf -#define strdup _strdup - -#define socklen_t int - -#define ETHER_ADDR_LEN 6 -/* - * Structure of a 10Mb/s Ethernet header. - */ -struct ether_header { - u_char ether_dhost[ETHER_ADDR_LEN]; - u_char ether_shost[ETHER_ADDR_LEN]; - u_short ether_type; -}; - -/* ************************************* */ - -struct ip { -#if BYTE_ORDER == LITTLE_ENDIAN - u_char ip_hl:4, /* header length */ - ip_v:4; /* version */ -#else - u_char ip_v:4, /* version */ - ip_hl:4; /* header length */ -#endif - u_char ip_tos; /* type of service */ - short ip_len; /* total length */ - u_short ip_id; /* identification */ - short ip_off; /* fragment offset field */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_char ip_ttl; /* time to live */ - u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src,ip_dst; /* source and dest address */ -}; - - -/* ************************************* */ - -typedef struct tuntap_dev { - HANDLE device_handle; - char *device_name; - char *ifName; - OVERLAPPED overlap_read, overlap_write; - u_int8_t mac_addr[6]; - u_int32_t ip_addr, device_mask; - u_int mtu; -} tuntap_dev; - -#endif \ No newline at end of file diff --git a/bundles/n2n_meyerd/n2n_v1/win32/wintap.c b/bundles/n2n_meyerd/n2n_v1/win32/wintap.c deleted file mode 100644 index 503e4e16..00000000 --- a/bundles/n2n_meyerd/n2n_v1/win32/wintap.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - (C) 2007-08 - Luca Deri -*/ - -#include "../n2n.h" -#include "n2n_win32.h" - -/* 1500 bytes payload + 14 bytes ethernet header + 4 bytes VLAN tag */ -#define MTU 1518 - -void initWin32() { - WSADATA wsaData; - int err; - - err = WSAStartup(MAKEWORD(2, 2), &wsaData ); - if( err != 0 ) { - /* Tell the user that we could not find a usable */ - /* WinSock DLL. */ - printf("FATAL ERROR: unable to initialise Winsock 2.x."); - exit(-1); - } -} - -int open_wintap(struct tuntap_dev *device, - char *device_ip, char *device_mask, - char *device_mac, int mtu) { - HKEY key, key2; - LONG rc; - char regpath[1024], cmd[256]; - char adapterid[1024]; - char adaptername[1024]; - char tapname[1024]; - long len; - int found = 0; - int err, i; - ULONG status = TRUE; - - memset(device, 0, sizeof(struct tuntap_dev)); - device->device_handle = INVALID_HANDLE_VALUE; - device->device_name = NULL; - device->ifName = NULL; - device->ip_addr = inet_addr(device_ip); - - /* Open registry and look for network adapters */ - if((rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &key))) { - printf("Unable to read registry: [rc=%d]\n", rc); - exit(-1); - } - - for (i = 0; ; i++) { - len = sizeof(adapterid); - if(RegEnumKeyEx(key, i, (LPCWSTR)adapterid, &len, 0, 0, 0, NULL)) - break; - - /* Find out more about this adapter */ - - _snprintf(regpath, sizeof(regpath), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, adapterid); - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCSTR)regpath, 0, KEY_READ, &key2)) - continue; - - len = sizeof(adaptername); - err = RegQueryValueEx(key2, "Name", 0, 0, adaptername, &len); - - RegCloseKey(key2); - - if(err) - continue; - - if(device->device_name) { - if(!strcmp(device->device_name, adapterid)) { - found = 1; - break; - } else - continue; - } - - if(device->ifName) { - if(!strcmp(device->ifName, adaptername)) { - found = 1; - break; - } else - continue; - } - - _snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, adapterid); - device->device_handle = CreateFile(tapname, GENERIC_WRITE | GENERIC_READ, - 0, /* Don't let other processes share or open - the resource until the handle's been closed */ - 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0); - if(device->device_handle != INVALID_HANDLE_VALUE) { - found = 1; - break; - } - } - - RegCloseKey(key); - - if(!found) { - printf("No Windows tap device found!\n"); - exit(0); - } - - /* ************************************** */ - - if(!device->device_name) - device->device_name = _strdup(adapterid); - - if(!device->ifName) - device->ifName = _strdup(adaptername); - - /* Try to open the corresponding tap device->device_name */ - - if(device->device_handle == INVALID_HANDLE_VALUE) { - _snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, device->device_name); - device->device_handle = CreateFile(tapname, GENERIC_WRITE | GENERIC_READ, 0, 0, - OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0); - } - - if(device->device_handle == INVALID_HANDLE_VALUE) { - printf("%s (%s) is not a usable Windows tap device\n", device->device_name, device->ifName); - exit(-1); - } - - /* Get MAC address from tap device->device_name */ - - if(!DeviceIoControl(device->device_handle, TAP_IOCTL_GET_MAC, - device->mac_addr, sizeof(device->mac_addr), - device->mac_addr, sizeof(device->mac_addr), &len, 0)) { - printf("Could not get MAC address from Windows tap %s (%s)\n", - device->device_name, device->ifName); - return -1; - } - - device->mtu = mtu; - - printf("Open device [name=%s][ip=%s][ifName=%s][MTU=%d][mac=%02X:%02X:%02X:%02X:%02X:%02X]\n", - device->device_name, device_ip, device->ifName, device->mtu, - device->mac_addr[0] & 0xFF, - device->mac_addr[1] & 0xFF, - device->mac_addr[2] & 0xFF, - device->mac_addr[3] & 0xFF, - device->mac_addr[4] & 0xFF, - device->mac_addr[5] & 0xFF); - - /* ****************** */ - - printf("Setting %s device address...\n", device->ifName); - - _snprintf(cmd, sizeof(cmd), - "netsh interface ip set address \"%s\" static %s %s", - device->ifName, device_ip, device_mask); - - if(system(cmd) == 0) { - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - printf("Device %s set to %s/%s\n", - device->ifName, device_ip, device_mask); - } else - printf("WARNING: Unable to set device %s IP address [%s]\n", - device->ifName, cmd); - - /* ****************** */ - - if(device->mtu != DEFAULT_MTU) - printf("WARNING: MTU set is not supported on Windows\n"); - - /* set driver media status to 'connected' (i.e. set the interface up) */ - if (!DeviceIoControl (device->device_handle, TAP_IOCTL_SET_MEDIA_STATUS, - &status, sizeof (status), - &status, sizeof (status), &len, NULL)) - printf("WARNING: Unable to enable TAP adapter\n"); - - /* - * Initialize overlapped structures - */ - device->overlap_read.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - device->overlap_write.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (!device->overlap_read.hEvent || !device->overlap_write.hEvent) { - return -1; - } - - return(0); -} - -/* ************************************************ */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) -{ - DWORD read_size, last_err; - - ResetEvent(tuntap->overlap_read.hEvent); - if (ReadFile(tuntap->device_handle, buf, len, &read_size, &tuntap->overlap_read)) { - //printf("tun_read(len=%d)\n", read_size); - return read_size; - } - switch (last_err = GetLastError()) { - case ERROR_IO_PENDING: - WaitForSingleObject(tuntap->overlap_read.hEvent, INFINITE); - GetOverlappedResult(tuntap->device_handle, &tuntap->overlap_read, &read_size, FALSE); - return read_size; - break; - default: - printf("GetLastError() returned %d\n", last_err); - break; - } - - return -1; -} -/* ************************************************ */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) -{ - DWORD write_size; - - //printf("tun_write(len=%d)\n", len); - - ResetEvent(tuntap->overlap_write.hEvent); - if (WriteFile(tuntap->device_handle, - buf, - len, - &write_size, - &tuntap->overlap_write)) { - //printf("DONE tun_write(len=%d)\n", write_size); - return write_size; - } - switch (GetLastError()) { - case ERROR_IO_PENDING: - WaitForSingleObject(tuntap->overlap_write.hEvent, INFINITE); - GetOverlappedResult(tuntap->device_handle, &tuntap->overlap_write, - &write_size, FALSE); - return write_size; - break; - default: - break; - } - - return -1; -} - -/* ************************************************ */ - -int tuntap_open(tuntap_dev *device, char *dev, char *device_ip, - char *device_mask, const char * device_mac, int mtu) { - return(open_wintap(device, device_ip, device_mask, device_mac, mtu)); -} - -/* ************************************************ */ - -void tuntap_close(struct tuntap_dev *tuntap) { - CloseHandle(tuntap->device_handle); -} - -/* ************************************************ */ - -#if 0 -int main(int argc, char* argv[]) { - struct tuntap_dev tuntap; - int i; - int mtu = 1400; - - printf("Welcome to n2n\n"); - initWin32(); - open_wintap(&tuntap, "1.2.3.20", "255.255.255.0", mtu); - - for(i=0; i<10; i++) { - u_char buf[MTU]; - int rc; - - rc = tun_read(&tuntap, buf, sizeof(buf)); - buf[0]=2; - buf[1]=3; - buf[2]=4; - - printf("tun_read returned %d\n", rc); - rc = tun_write(&tuntap, buf, rc); - printf("tun_write returned %d\n", rc); - } - // rc = tun_open (device->device_name, IF_MODE_TUN); - WSACleanup (); - return(0); -} - -#endif diff --git a/bundles/n2n_meyerd/n2n_v1/win32/wintap.h b/bundles/n2n_meyerd/n2n_v1/win32/wintap.h deleted file mode 100644 index ba83d12e..00000000 --- a/bundles/n2n_meyerd/n2n_v1/win32/wintap.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - (C) 2007 - Luca Deri -*/ - -#ifndef _WINTAP_H_ -#define _WINTAP_H_ - -#undef UNICODE -#undef _UNICODE -#define _CRT_SECURE_NO_WARNINGS - -#include -#include -#include - - - -//=============================================== -// This file is included both by OpenVPN and -// the TAP-Win32 driver and contains definitions -// common to both. -//=============================================== - -//============= -// TAP IOCTLs -//============= - -#define TAP_CONTROL_CODE(request,method) \ - CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) - -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) - -//================= -// Registry keys -//================= - -#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" -#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" - -//====================== -// Filesystem prefixes -//====================== - -#define USERMODEDEVICEDIR "\\\\.\\Global\\" -#define SYSDEVICEDIR "\\Device\\" -#define USERDEVICEDIR "\\DosDevices\\Global\\" -#define TAPSUFFIX ".tap" - -//========================================================= -// TAP_COMPONENT_ID -- This string defines the TAP driver -// type -- different component IDs can reside in the system -// simultaneously. -//========================================================= - -#define TAP_COMPONENT_ID "tap0801" - -extern void initWin32(); - -#endif \ No newline at end of file diff --git a/bundles/n2n_meyerd/n2n_v2/CMakeLists.txt b/bundles/n2n_meyerd/n2n_v2/CMakeLists.txt deleted file mode 100644 index 75fde2a7..00000000 --- a/bundles/n2n_meyerd/n2n_v2/CMakeLists.txt +++ /dev/null @@ -1,162 +0,0 @@ -project(n2n) -cmake_minimum_required(VERSION 2.6) - -# N2n information -set(N2N_VERSION 2.1.0) -set(N2N_OSNAME ${CMAKE_SYSTEM}) - -# N2n specific params -if(NOT DEFINED N2N_OPTION_AES) -if(NOT WIN32) -set(N2N_OPTION_AES ON) -else(NOT WIN32) -set(N2N_OPTIONS_AES OFF) -endif(NOT WIN32) -endif(NOT DEFINED N2N_OPTION_AES) - -add_definitions(-DN2N_VERSION=\"${N2N_VERSION}\" -DN2N_OSNAME=\"${N2N_OSNAME}\") - -if(N2N_OPTION_AES) -add_definitions(-DN2N_HAVE_AES) -endif(N2N_OPTION_AES) - -# Build information -if(NOT DEFINED BUILD_SHARED_LIBS) -set(BUILD_SHARED_LIBS OFF) -endif(NOT DEFINED BUILD_SHARED_LIBS) - -if(NOT DEFINED CMAKE_BUILD_TYPE) -set(CMAKE_BUILD_TYPE None) -endif(NOT DEFINED CMAKE_BUILD_TYPE) -#set(CMAKE_BUILD_TYPE Debug) -#set(CMAKE_BUILD_TYPE Release) - -#Ultrasparc64 users experiencing SIGBUS should try the following gcc options -#(thanks to Robert Gibbon) -#PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finline-functions -fweb -frename-registers -mapp-regs - -#for macOS, find openssl installed by Homebrew -# cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl .. -if(APPLE) -find_package(openssl REQUIRED) -endif(APPLE) - -# None -if(NOT WIN32) -set(CMAKE_C_FLAGS "-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs -fPIC") -set(CMAKE_CXX_FLAGS "-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs") -# Debug -set(CMAKE_C_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -# Release -set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") -set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") -endif(NOT WIN32) - -#for macOS, add openssl include dir -if(APPLE) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${OPENSSL_INCLUDE_DIR}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${OPENSSL_INCLUDE_DIR}") -endif(APPLE) - -## DEBUG FOR CMAKE -#message(${N2N_VERSION}) -#message(${N2N_OSNAME}) -##message(${CMAKE_BUILD_TYPE}) -#message(${N2N_OPTION_AES}) -## DEBUG FOR CMAKE - -add_library(n2n n2n.c - n2n_keyfile.c - wire.c - minilzo.c - twofish.c - transform_null.c - transform_tf.c - transform_aes.c - tuntap_freebsd.c - tuntap_netbsd.c - tuntap_linux.c - tuntap_osx.c - version.c - ) - -if(NOT WIN32) -add_library(scm unix-scm.c) -target_link_libraries(n2n scm) -endif(NOT WIN32) - -if(WIN32) -add_subdirectory(win32) -add_library(scm win32/win-scm.c) -target_link_libraries(n2n n2n_win32) -endif(WIN32) - -if(N2N_OPTION_AES) -target_link_libraries(n2n crypto) -endif(N2N_OPTION_AES) - -# For Solaris (or OpenSolaris?) -#target_link_libraries(n2n socket nsl) - -add_executable(edge edge.c) -target_link_libraries(edge n2n) - -add_executable(supernode sn.c) -target_link_libraries(supernode n2n) - -add_executable(n2n_test n2n_test.c) -target_link_libraries(n2n_test n2n) - -add_executable(benchmark benchmark.c) -target_link_libraries(benchmark n2n) - -add_executable(benchmark_hashtable benchmark_hashtable.c) -target_link_libraries(benchmark_hashtable n2n) - -install(TARGETS edge supernode - RUNTIME DESTINATION sbin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - ) - -# Documentation -if(DEFINED UNIX) -add_dependencies(n2n doc) -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/doc) -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/edge.8.gz - COMMAND gzip -c ${PROJECT_SOURCE_DIR}/edge.8 > ${PROJECT_BINARY_DIR}/doc/edge.8.gz - DEPENDS ${PROJECT_SOURCE_DIR}/edge.8 - ) - -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - COMMAND gzip -c ${PROJECT_SOURCE_DIR}/supernode.1 > ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - DEPENDS ${PROJECT_SOURCE_DIR}/supernode.1 - ) - -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz - COMMAND gzip -c ${PROJECT_SOURCE_DIR}/n2n_v2.7 > ${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz - DEPENDS ${PROJECT_SOURCE_DIR}/n2n_v2.7 - ) - -add_custom_target(doc DEPENDS ${PROJECT_BINARY_DIR}/doc/edge.8.gz - ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - ${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz - ) - -set_source_files_properties(${PROJECT_BINARY_DIR}/doc/edge.8.gz - ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - ${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz - PROPERTIES GENERATED 1) - -install(FILES ${PROJECT_BINARY_DIR}/doc/edge.8.gz - DESTINATION /usr/share/man8) -install(FILES ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - DESTINATION /usr/share/man1) -install(FILES ${PROJECT_BINARY_DIR}/doc/n2n_v2.7.gz - DESTINATION /usr/share/man7) - -install(PROGRAMS ${PROJECT_SOURCE_DIR}/munin/n2n-supernode - DESTINATION /usr/share/munin/plugins) - -endif(DEFINED UNIX) diff --git a/bundles/n2n_meyerd/n2n_v2/COPYING b/bundles/n2n_meyerd/n2n_v2/COPYING deleted file mode 100644 index b33b35d0..00000000 --- a/bundles/n2n_meyerd/n2n_v2/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - n2n Copyright (C) 2007-08 Luca Deri - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/bundles/n2n_meyerd/n2n_v2/HACKING b/bundles/n2n_meyerd/n2n_v2/HACKING deleted file mode 100644 index 0154552b..00000000 --- a/bundles/n2n_meyerd/n2n_v2/HACKING +++ /dev/null @@ -1,259 +0,0 @@ -file: HACKING - -Last updated: 2010-01-01 09:55 UTC - --------- -(C) 2008-2010 - Richard Andrews - -This program and document is free software; you can redistribute -it and/or modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not see see - --------- - - -This file describes the internals of n2n. Read this before starting to modify -the code. Because coding examples may be present in this document it is licensed -under the GPL rather than FDL. - - -SYMMETRIC NAT -------------- - -Symmetric NAT is a form of firewall NAT in which an UDP packets are only passed -back to an inside host socket when the return packets originate from the outside -socket to which the initiating UDP packets were sent. This means that when an -inside host sends UDP to some outside socket; other hosts cannot piggyback on -this opening in the firewall to send data to the inside host. - -When two inside hosts are both behind symmetric NAT, peer-to-peer packet -exchange is not possible via n2n. These hosts will require the supernode to -relay packets. - - -ARP CACHE ---------- - -n2n makes use of the host operating system's own ARP cache. Each edge node -allocates a random MAC address to itself. This MAC is constant for the life of -the edge process. ARP packets are passed around as broadcast ethernet packets -over n2n and these packets cause the native ARP cache to be updated. - -Edge nodes send gratuitous ARP packets on startup. See GRATUITOUS ARP below. - - -REGISTRATION AND PEER-TO-PEER COMMUNICATION SETUP -------------------------------------------------- - -A and B are edge nodes with public sockets Apub and Bpub; and private network -addresses A and B respectively. S is the supernode. - -A sends {REGISTER,Amac} to S. S registers {Amac->Apub}. -B sends {REGISTER,Bmac} to S. S registers {Bmac->Bpub}. - -Now ping from A to B. - -A sends broadcast "arp who-has B" to S. S relays the packet to all known edge -nodes. B replies "B at Bmac" to supernode which forwards this to A. So now ping -A->B is known to be ping Amac(A)->Bmac(B). Note: gratuitous arp also requires -discussion. - -In response to receiving the arp reply, Apub sends {REGISTER,Amac} to Bpub. If -Bpub receives the request it sends back {REGISTER_ACK,Amac} and also sends its -own {REGISTER,Bmac} request. - -In response to receiving the "arp who-has", Bpub sends {REGISTER,Bmac} to Apub. - -Now the OS has received the arp reply and sends ICMP to Bmac(B) via the tunnel -on A. A looks up Bmac in the peers list and encapsulates the packet to Bpub or -the supernode if the MAC is not found. - -We assume that between two edge nodes, if Bpub receives a packet from Apub then -Apub can receive a packet from Bpub. This is the symmetric NAT case. Note: In -the symmetric NAT case, the public socket for a MAC address will be different -for direct contact when compared to information from the supernode. - -When two edge nodes are both behind symmetric NAT they cannot establish direct -communication. - -If A receives {REGISTER,Bmac} from B, A adds {Bmac->Bpub} to its peers list -knowing that Bmac is now reachable via that public socket. Similarly if B -receives {REGISTER,Amac} from A. - -The supernode never forwards REGISTER messages because the public socket seen by -the supervisor for some edge (eg. A) may be different to the socket seen by -another edge due to the actions of symmetric NAT (alocating a new public socket -for the new outbound UDP "connection"). - - -EDGE REGISTRATION DESIGN AMMENDMENTS (starting from 2008-04-10) ------------------------------------- - - * Send REGISTER on rx of PACKET or REGISTER only when dest_mac == device MAC -(do not send REGISTER on Rx of broadcast packets). - * After sending REGISTER add the new peer to pending_peers list; but - * Don't send REGISTER to a peer in pending_peers list - * Remove old entries from pending_peers at regular intervals - * On rx of REGISTER_ACK, move peer from pending_peers to known_peers for direct -comms and set last_seen=now - * On rx of any packet set last_seen=now in the known_peers entry (if it -exists); but do not add a new entry. - * If the public socket address for a known_peers entry changes, deleted it and -restart registration to the new peer. - * Peer sockets provided by the supernode are ignored unless no other entry -exists. Direct peer-to-peer sockets are always given more priority as the -supernode socket will not be usable for direct contact if the peer is behind -symmetric NAT. - - -The pending_peers list concept is to prevent massive registration traffic when -supernode relay is in force - this would occur if REGISTER was sent for every -incident packet sent via supernode. Periodic REGISTER attempts will still occur; -not for every received packet. In the case where the peer cannot be contacted -(eg. both peers behind symmetric NAT), then there will still be periodic -attempts. Suggest a pending timeout of about 60 sec. - -A peer is only considered operational for peer-to-peer sending when a -REGISTER_ACK is returned. Once operational the peer is kept operational while -any direct packet communications are occurring. REGISTER is not required to -keep the path open through any firewalls; just some activity in one direction. - -After an idle period; the peer should be deleted from the known_peers list. We -should not try to re-register when this time expires. If there is no data to -send then forget the peer. This helps scalability. - -If a peer wants to be remembered it can send gratuitous ARP traffic which will -keep its entry in the known_peers list of any peers which already have the -entry. - - - - -peer = find_by_src_mac( hdr, known_peers ); /* return NULL or entry */ - -if ( peer ) -{ - peer_last_seen = time(NULL); -} -else -{ - if ( ! is_broadcast( hdr ) ) /* ignore broadcasts */ - { - if ( IS_REGISTER_ACK( hdr ) ) - { - /* move from pending to known_peers */ - set_peer_operational( hdr ); - } - else - { - /* add to pending and send REGISTER - ignore if in pending. */ - try_send_register( hdr ) - } - } -} - - -(Notes): - - * In testing it was noted that if a symmetric NAT firewall shuts down the UDP -association but the known_peers registration is still active, then the peer -becomes unreachable until the known_peers registration is deleted. Suggest two -ways to mitigate this problem: - (a) make the known_peers purge timeout a config paramter; - (b) send packets direct and via supernode if the registration is older than - eg. 60 sec. - - -GRATUITOUS ARP --------------- - -In addition to the ARP who-has mechanism noted above, two edge nodes can become -aware of one another by gratuitous ARP. A gratuitous ARP packet is a broadcast -packet sent by a node for no other purpose than to announce its presence and -identify its MAC and IP address. Gratuitous ARP packets are to keep ARP caches -up to date so contacting the host will be faster after an long idle time. - - -MAN PAGES ---------- - -Look at a non-installed man page like this (linux/UNIX): - -nroff -man edge.8 | less - - -common header FORMAT --------------------- - -All message encoding and decoding is contained in wire.c. - - 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! Version=2 ! TTL ! Flags ! PktType ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! Community : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 ! ... Community ... ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -PACKET message FORMAT ---------------------- - -The PACKET message is of main concern as it is the most frequently transferred -as it contains encapsulated ethernet packets. For these, PktFormat is set to -n2n_packet and it goes on as follows: - -If the N2N_FLAGS_SOCKET-Flag is set, the socket of the original sender of the -packet is encoded next. IPv4 or IPv6 is determined by the Socket Flags. - -Socket encoding for IPv4 takes 8 bytes and looks as follows: - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 0 ! Socket Flags (v=IPv4) ! Destination UDP Port ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! Destination IPv4 Address ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -For IPv6 it takes 20 bytes: - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 0 ! Socket Flags (v=IPv6) ! Destination UDP Port ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! Destination IPv6 Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 : ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -After that, if the N2N_FLAGS_LOCAL_SOCKET-Flag is set, yet another socket -(using the same format as above) will follow (used for bypassing the -behind-same-nat problem) - -Finally, the last part of the packet looks like this: - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -40 ! Transform ID ! Payload ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -44 : ... Payload ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -48 : ... Payload ... - -------- - -January 2010 - Richard Andrews diff --git a/bundles/n2n_meyerd/n2n_v2/INSTALL b/bundles/n2n_meyerd/n2n_v2/INSTALL deleted file mode 100644 index 69ca5ac2..00000000 --- a/bundles/n2n_meyerd/n2n_v2/INSTALL +++ /dev/null @@ -1,63 +0,0 @@ -New install procedure, using cmake. - -Customize CMakeLists.txt - -$ cmake ./ -$ make - - - - -!!! DEPRECATED !!! - - -INSTALL - -To build the programs: - -$ make - -To install the programs and man pages: - -$ make install - -or - -$ make PREFIX=/usr/local install - - -RPM Package ------------ - -These steps should work with RPM based Linux distributions since rpmbuild was -split from the rpm utility (c RedHat 9). - - -To build an RPM the easy way follow these steps. - -1. Build SRPM - -$ cd n2n -$ scripts/mk_SRPM.sh - -Look for where the src.rpm file was put ( "Wrote:" ). - -2. Build binary RPM from SRPM - -$ rpm -i path/to/n2n-.src.rpm -$ rpmbuild -bb n2n.spec - - -All this can be done as non-root user if you have a ~/.rpmmacros file with this -line in it: - -%_topdir /home/username/rpmtopdir - - -To build an RPM the hard way follow these steps. - -$ cp -a n2ndir n2n-2.0 -$ tar czf n2n-2.0.tar.gz n2n-2.0 -$ mv n2n-2.0.tar.gz /usr/src/redhat/SOURCES -$ cp n2ndir/n2n.spec /usr/src/redhat/SPECS -$ rpmbuild -bb n2n.spec diff --git a/bundles/n2n_meyerd/n2n_v2/NEW_FEATURES.txt b/bundles/n2n_meyerd/n2n_v2/NEW_FEATURES.txt deleted file mode 100644 index 9efc5875..00000000 --- a/bundles/n2n_meyerd/n2n_v2/NEW_FEATURES.txt +++ /dev/null @@ -1,6 +0,0 @@ - -Between 2.0.x and 2.1.x - -* Better ming Windows build support. -* Added -E flag to allow multicast ethernet traffic. - diff --git a/bundles/n2n_meyerd/n2n_v2/README b/bundles/n2n_meyerd/n2n_v2/README deleted file mode 100644 index f21422b0..00000000 --- a/bundles/n2n_meyerd/n2n_v2/README +++ /dev/null @@ -1,111 +0,0 @@ - - -Edge node ---------- - -You need to start an edge node on each host you want to connect with the *same* -community. - -0. become root - -1. create tun device -# tunctl -t tun0 - -3. enable the edge process -# ./edge -d n2n0 -c mynetwork -k encryptme -u 99 -g 99 -m 3C:A0:12:34:56:78 -a 1.2.3.4 -l a.b.c.d:xyw - or -# N2N_KEY=encryptme ./edge -d n2n0 -c mynetwork -u 99 -g 99 -m 3C:A0:12:34:56:78 -a 1.2.3.4 -l a.b.c.d:xyw - -Once you have this worked out, you can add the "-f" option to make edge detach -and run as a daemon. - -Note that -u, -g and -f options are not available for Windows. - -Supernode --------- - -You need to start the supernode once - -1. ./supernode -l 1234 -v - - -Dropping Root Privileges and SUID-Root Executables (UNIX) --------------------------------------------------- - -The edge node uses superuser privileges to create a TAP network interface -device. Once this is created root privileges are not required and can constitute -a security hazard if there is some way for an attacker to take control of an -edge process while it is running. Edge will drop to a non-privileged user if you -specify the -u and -g options. These are numeric IDs. Consult -/etc/passwd. - -You may choose to install edge SUID-root to do this: - -1. Become root -2. chown root:root edge -3. chmod +s edge -done - -Any user can now run edge. You may not want this, but it may be convenient and -safe if your host has only one login user. - - -Running As a Daemon (UNIX) -------------------- - -Unless given "-f" as a command line option, edge will call daemon(3) after -successful setup. This causes the process to fork a child which closes stdin, -stdout and stderr then sets itself as process group leader. When this is done, -the edge command returns immediately and you will only see the edge process in -the process listings, eg. from ps or top. - -If the edge command returns 0 then the daemon started successfully. If it -returns non-zero then edge failed to start up for some reason. When edge starts -running as a daemon, all logging goes to syslog daemon.info facility. - - -IPv6 Support ------------- - -n2n supports the carriage of IPv6 packets within the n2n tunnel. N2n does not -yet use IPv6 for transport between edges and supernodes. - -To make IPv6 carriage work you need to manually add IPv6 addresses to the TAP -interfaces at each end. There is currently no way to specify an IPv6 address on -the edge command line. - -eg. under linux: - -on hostA: -[hostA] # /sbin/ip -6 addr add fc00:abcd:1234::7/48 dev n2n0 - -on hostB: -[hostB] # /sbin/ip -6 addr add fc00:abcd:1234::6/48 dev n2n0 - -You may find it useful to make use of tunctl from the uml-utilities -package. Tunctl allow you to bring up a TAP interface and configure addressing -prior to starting edge. It also allows edge to be restarted without the -interface closing (which would normally affect routing tables). - -Once the IPv6 addresses are configured and edge started, IPv6 neighbor discovery -packets flow (get broadcast) and IPv6 entities self arrange. Test your IPv6 -setup with ping6 - the IPv6 ping command. - - -Performance Notes ------------------ - -The time taken to perform a ping test for various ciphers is given below: - -Test: ping -f -l 8 -s 800 -c 10000 - -AES (-O0) 11820 -TF (-O0) 25761 - -TF (-O2) 20554 - -AES (-O3) 12532 -TF (-O3) 14046 -NULL (-O3) 10659 - -(C) 2007-2010 - Luca Deri , Richard Andrews diff --git a/bundles/n2n_meyerd/n2n_v2/android/tuntap_android.c b/bundles/n2n_meyerd/n2n_v2/android/tuntap_android.c deleted file mode 100644 index 11e49224..00000000 --- a/bundles/n2n_meyerd/n2n_v2/android/tuntap_android.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see -*/ - -#include "../n2n.h" - -#ifdef __ANDROID_NDK__ -#include -#include -#include - -n2n_edge_status_t* g_status; - -/* ********************************** */ - -/** @brief Open and configure the TAP device for packet read/write. - * - * This routine creates the interface via the tuntap driver then uses ifconfig - * to configure address/mask and MTU. - * - * @param device - [inout] a device info holder object - * @param dev - user-defined name for the new iface, - * if NULL system will assign a name - * @param device_ip - address of iface - * @param device_mask - netmask for device_ip - * @param mtu - MTU for device_ip - * - * @return - negative value on error - * - non-negative file-descriptor on success - */ -int tuntap_open(tuntap_dev *device, - char *dev, /* user-definable interface name, eg. edge0 */ - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - int i, n_matched; - unsigned int mac[6]; - - n_matched = sscanf(device_mac, "%x:%x:%x:%x:%x:%x", mac, mac + 1, mac + 2, mac + 3, mac + 4, mac + 5); - if (n_matched != 6) { - return -1; - } - memset(device->mac_addr, 0, sizeof(device->mac_addr)); - for (i = 0; i < 6; i++) - device->mac_addr[i] = mac[i]; - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - device->mtu = mtu; - strncpy(device->dev_name, dev, MIN(IFNAMSIZ, N2N_IFNAMSIZ)); - return device->fd; -} - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - int rlen = read(tuntap->fd, buf + UIP_LLH_LEN, len - UIP_LLH_LEN); - if ((rlen <= 0) || (rlen > N2N_PKT_BUF_SIZE - UIP_LLH_LEN)) - { - return rlen; - } - uip_buf = buf; - uip_len = rlen; - uip_arp_out(); - if (IPBUF->ethhdr.type == htons(UIP_ETHTYPE_ARP)) - { - traceEvent(TRACE_DEBUG, "ARP request packets are sent instead of packets"); - } - - return uip_len; -} - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - int rlen; - uip_buf = buf; - uip_len = len; - if (IPBUF->ethhdr.type == htons(UIP_ETHTYPE_IP)) { - rlen = write(tuntap->fd, buf + UIP_LLH_LEN, len - UIP_LLH_LEN); - return rlen <= 0 ? rlen : rlen + UIP_LLH_LEN; - } else if (IPBUF->ethhdr.type == htons(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - if (uip_len > 0) { - uip_arp_len = uip_len; - memcpy(uip_arp_buf, uip_buf, uip_arp_len); - traceEvent(TRACE_DEBUG, "ARP reply packet prepare to send"); - } - return len; - } - - errno = EINVAL; - return -1; -} - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -void tuntap_get_address(struct tuntap_dev *tuntap) { -} - -#endif /* #ifdef __ANDROID_NDK__ */ diff --git a/bundles/n2n_meyerd/n2n_v2/benchmark.c b/bundles/n2n_meyerd/n2n_v2/benchmark.c deleted file mode 100644 index 0541095c..00000000 --- a/bundles/n2n_meyerd/n2n_v2/benchmark.c +++ /dev/null @@ -1,108 +0,0 @@ -#include "n2n_wire.h" -#include "n2n_transforms.h" -#include "n2n.h" - -#ifndef WIN32 -#include -#endif -#include -#include -#include - -uint8_t PKT_CONTENT[]={ - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }; - -/* Prototypes */ -static ssize_t do_encode_packet( uint8_t * pktbuf, size_t bufsize, const n2n_community_t c ); - -int main( int argc, char * argv[] ) -{ - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - n2n_trans_op_t transop_null; - - n2n_common_t cmn; - n2n_PACKET_t pkt; - n2n_community_t c; - - struct timeval t1; - struct timeval t2; - - unsigned long int i; - size_t n; - size_t idx; - size_t rem; - ssize_t nw; - unsigned long int tdiff; - - transop_null_init( &transop_null ); - memset(c,0,sizeof(N2N_COMMUNITY_SIZE)); - - n=10000; - memcpy( c, "abc123def456", 12 ); - - gettimeofday( &t1, NULL ); - for(i=0; i %lu nsec each) %u.%06u -> %u.%06u.\n", i, tdiff, (tdiff *1000)/i, (uint32_t)t1.tv_sec, (uint32_t)t1.tv_usec, (uint32_t)t2.tv_sec, (uint32_t)t2.tv_usec ); - - return 0; -} - -static ssize_t do_encode_packet( uint8_t * pktbuf, size_t bufsize, const n2n_community_t c ) -{ - /* n2n_mac_t destMac={0,1,2,3,4,5}; */ - n2n_common_t cmn; - n2n_PACKET_t pkt; - size_t idx; - - - memset( &cmn, 0, sizeof(cmn) ); - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_packet; - cmn.flags=0; /* no options, not from supernode, no socket */ - memcpy( cmn.community, c, N2N_COMMUNITY_SIZE ); - - memset( &pkt, 0, sizeof(pkt) ); - - idx=0; - encode_PACKET( pktbuf, &idx, &cmn, &pkt ); - traceEvent( TRACE_DEBUG, "encoded PACKET header of size=%u", (unsigned int)idx ); - - return idx; -} diff --git a/bundles/n2n_meyerd/n2n_v2/benchmark_hashtable.c b/bundles/n2n_meyerd/n2n_v2/benchmark_hashtable.c deleted file mode 100644 index e1d2e848..00000000 --- a/bundles/n2n_meyerd/n2n_v2/benchmark_hashtable.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "n2n_wire.h" -#include "n2n_transforms.h" -#include "n2n.h" - -#ifndef WIN32 -#include -#endif -#include -#include -#include - -int main(int argc, char** argv) { - peer_info_t* testpeers[PEER_HASH_TAB_SIZE]; - struct sglib_hashed_peer_info_t_iterator it; - peer_info_t *ll; - - sglib_hashed_peer_info_t_init(testpeers); - - for(ll=sglib_hashed_peer_info_t_it_init(&it, testpeers); ll!=NULL; ll=sglib_hashed_peer_info_t_it_next(&it)) { - sglib_hashed_peer_info_t_delete(testpeers, ll); - free(ll); - } - return 0; -} - diff --git a/bundles/n2n_meyerd/n2n_v2/cmake/CMakeToolchainFileMingw32.cmake b/bundles/n2n_meyerd/n2n_v2/cmake/CMakeToolchainFileMingw32.cmake deleted file mode 100644 index 0f1f7b3c..00000000 --- a/bundles/n2n_meyerd/n2n_v2/cmake/CMakeToolchainFileMingw32.cmake +++ /dev/null @@ -1,17 +0,0 @@ -# the name of the target operating system -SET(CMAKE_SYSTEM_NAME Windows) - -# which compilers to use for C and C++ -SET(CMAKE_C_COMPILER i686-mingw32-gcc) -SET(CMAKE_CXX_COMPILER i686-mingw32-g++) - -# here is the target environment located -SET(CMAKE_FIND_ROOT_PATH ${HOME}/win_n2n/mingw32/) - -# adjust the default behaviour of the FIND_XXX() commands: -# search headers and libraries in the target environment, search -# programs in the host environment -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - diff --git a/bundles/n2n_meyerd/n2n_v2/debian/README.Debian b/bundles/n2n_meyerd/n2n_v2/debian/README.Debian deleted file mode 100644 index 700c74ec..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/README.Debian +++ /dev/null @@ -1,7 +0,0 @@ -n2n for Debian --------------- - -This package depends on the kernel having the TUN/TAP driver configured in using -CONFIG_TUN=yes. - - -- Richard Andrews Thu, 10 Jul 2008 22:38:02 +1000 diff --git a/bundles/n2n_meyerd/n2n_v2/debian/changelog b/bundles/n2n_meyerd/n2n_v2/debian/changelog deleted file mode 100644 index bd31a4f2..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/changelog +++ /dev/null @@ -1,27 +0,0 @@ -n2n (2.1.0-1) unstable; urgency=low - - * Split package in two. - * Move manpage for edge to section 8. - * Install manpage for n2n_v2 to section 7. - * Create init.d files for the daemons. - - -- Kim Hansen Sun, 04 Apr 2010 21:40:46 +0200 - -n2n (2.0-1) hardy; urgency=low - - * New upstream release - - -- Richard Andrews Tue, 30 Oct 2009 22:26:04 +1100 - -n2n (1.3-1) hardy; urgency=low - - * New upstream release - - -- Richard Andrews Fri, 30 Jan 2009 23:49:56 +1100 - -n2n (1.2-1) unstable; urgency=low - - * Initial release - - -- Richard Andrews Thu, 10 Jul 2008 22:38:02 +1000 - diff --git a/bundles/n2n_meyerd/n2n_v2/debian/compat b/bundles/n2n_meyerd/n2n_v2/debian/compat deleted file mode 100644 index 7ed6ff82..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/bundles/n2n_meyerd/n2n_v2/debian/control b/bundles/n2n_meyerd/n2n_v2/debian/control deleted file mode 100644 index 1bdb6faa..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/control +++ /dev/null @@ -1,51 +0,0 @@ -Source: n2n -Section: net -Priority: extra -Maintainer: Jean-Baptiste Denis -Build-Depends: cdbs, debhelper (>= 5), libc6-dev (>= 2.0), dpatch, gcc, libssl-dev -Standards-Version: 3.7.2 - -Package: n2n -Architecture: any -Depends: n2n-edge, n2n-supernode -Description: dummy package for transition purposes - A dummy package for transition purposes that depends on n2n-edge and - n2n-supernode - -Package: n2n-edge -Architecture: any -Suggests: uml-utilities -Depends: ${shlibs:Depends}, ${misc:Depends} -Conflicts: n2n (<< 2.1.0-1) -Replaces: n2n (<< 2.1.0-1) -Description: a layer-two peer-to-peer virtual private network (VPN) - n2n is a layer-two peer-to-peer virtual private network (VPN) which allows - users to exploit features typical of P2P applications at network instead of - application level. This means that users can gain native IP visibility (e.g. - two PCs belonging to the same n2n network can ping each other) and be - reachable with the same network IP address regardless of the network where - they currently belong. In a nutshell, as OpenVPN moved SSL from application - (e.g. used to implement the https protocol) to network protocol, n2n moves - P2P from application to network level. - . - Edge is the edge node daemon for n2n which creates a TAP interface to expose - the n2n virtual LAN. - -Package: n2n-supernode -Architecture: any -Suggests: n2n-edge -Depends: ${shlibs:Depends}, ${misc:Depends} -Conflicts: n2n (<< 2.1.0-1) -Replaces: n2n (<< 2.1.0-1) -Description: a layer-two peer-to-peer virtual private network (VPN) - n2n is a layer-two peer-to-peer virtual private network (VPN) which allows - users to exploit features typical of P2P applications at network instead of - application level. This means that users can gain native IP visibility (e.g. - two PCs belonging to the same n2n network can ping each other) and be - reachable with the same network IP address regardless of the network where - they currently belong. In a nutshell, as OpenVPN moved SSL from application - (e.g. used to implement the https protocol) to network protocol, n2n moves - P2P from application to network level. - . - Supernode is a node introduction registry, broadcast conduit and packet relay - node for the n2n system. diff --git a/bundles/n2n_meyerd/n2n_v2/debian/copyright b/bundles/n2n_meyerd/n2n_v2/debian/copyright deleted file mode 100644 index 38346ce9..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/copyright +++ /dev/null @@ -1,23 +0,0 @@ -This package was debianized by Jean-Baptiste Denis on -Thu, 20 Nov 2008 23:53:02 +1000. - -It was downloaded from http://www.ntop.org/n2n/ - -Upstream Author(s): - - Luca Deri - Richard Andrews - -Copyright: - - Copyright (C) 2008 Luca Deri - Copyright (C) 2008 Richard Andrews - -License: - - GPLv3 - -The Debian packaging is (C) 2008, Richard Andrews , -Luca Deri and is licensed under the GPLv3, see -`/usr/share/common-licenses/GPL-3'. - diff --git a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.default b/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.default deleted file mode 100644 index 86bc8288..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.default +++ /dev/null @@ -1,34 +0,0 @@ -# Config file for the n2n edge node daemon. - -# Sets the n2n community name. All edges within the same community appear on -# the same LAN (layer 2 network segment). Community name is 16 bytes in length. -N2N_COMMUNITY="MyCommunityName" - -# Sets the twofish encryption key from ASCII text. All edges communicating must -# use the same key and community name. -N2N_KEY="MySecretCode" - -# Sets the n2n supernode IP address to register to. -#N2N_SN_HOST="localhost" -#N2N_SN_PORT="7654" - -# Hostname supplied to 'getent' to look up configuration. -#HOSTNAME=`uname -n` - -# IP & MAC addresses settings accoring to 'getent' -# ( set via nss which means where -# '/etc/nsswitch.conf' says $HOSTNAME can be found ) -# ( MAC not required ) -#N2N_IP_ADDR=`getent hosts $HOSTNAME | awk '{print $1}'` -#N2N_IP="static:$N2N_IP_ADDR" -#N2N_MAC=`getent ethers $HOSTNAME | awk '{print $1}'` - -# -r Enable packet forwarding -# -b Periodically resolve supernode IP (resolution often fails at boot-time) -# -E Accept muilticast MAC addresses - -DAEMON_OPTS="-r -b -E" - -# Uncomment this to get edge node started. -#N2N_EDGE_CONFIG_DONE="yes" - diff --git a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.docs b/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.docs deleted file mode 100644 index e845566c..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.docs +++ /dev/null @@ -1 +0,0 @@ -README diff --git a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.init b/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.init deleted file mode 100644 index 57c374d7..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.init +++ /dev/null @@ -1,156 +0,0 @@ -#! /bin/bash -### BEGIN INIT INFO -# Provides: n2n-edge -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: n2n-edge -# Description: Start n2n edge node daemon -### END INIT INFO - -# Init script for n2n edge node -# Copyright (C) 2010 Kim Hansen -# Refactor (C) 2017 Dale MM0HGW -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="n2n edge" -NAME=n2n-edge -DAEMON=/usr/sbin/edge -SCRIPTNAME=/etc/init.d/$NAME - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# Check config -if [ -z "$N2N_EDGE_CONFIG_DONE" ] -then - echo "Warning: n2n-edge not configured, edit config file in /etc/default/$NAME." 1>&2 - exit 0 -fi - -# Load default values -if [ -z $HOSTNAME ]; then - HOSTNAME=`uname -n` -fi -if [ -z ${N2N_SN_HOST+x} ]; then - N2N_SN_HOST=localhost; -fi -if [ -z ${N2N_SN_PORT+x} ]; then - N2N_SN_PORT=7654; -fi -DAEMON_ARGS="$DAEMON_ARGS -l $N2N_SN_HOST:$N2N_SN_PORT" -if [ -z ${N2N_IP+x} ]; then - N2N_IP_ADDR=`getent hosts $HOSTNAME | awk '{print $1}'` - N2N_IP="static:$N2N_IP_ADDR" -fi -if [ -z $N2N_IP ]; then - N2N_IP="dhcp:0.0.0.0" -fi -DAEMON_ARGS="$DAEMON_ARGS -a $N2N_IP"; -if [ -z ${N2N_MAC+x} ]; then - N2N_MAC=`getent ethers $HOSTNAME | awk '{print $1}'`; -fi -if ! [ -z $N2N_MAC ]; then - DAEMON_ARGS="$DAEMON_ARGS -m $N2N_MAC"; -fi -DAEMON_ARGS="$DAEMON_ARGS -c $N2N_COMMUNITY" - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - start-stop-daemon --start --quiet --user nobody --exec $DAEMON --test \ - || return 1 - export N2N_KEY - start-stop-daemon --start --quiet --user nobody --exec $DAEMON -- \ - -u $(id -u nobody) -g $(id -g nobody) $DAEMON_ARGS \ - || return 2 -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user nobody --exec $DAEMON -} - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - restart|force-reload) - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 - exit 3 - ;; -esac - -true # Set exit status to 0 (succes) diff --git a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.install b/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.install deleted file mode 100644 index 2d0bd7c9..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.install +++ /dev/null @@ -1 +0,0 @@ -edge /usr/sbin diff --git a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.manpages b/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.manpages deleted file mode 100644 index 2fa385ba..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/n2n-edge.manpages +++ /dev/null @@ -1,2 +0,0 @@ -edge.8 -n2n_v2.7 diff --git a/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.default b/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.default deleted file mode 100644 index bb222602..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.default +++ /dev/null @@ -1,9 +0,0 @@ -# Config file for the n2n supernode daemon. - -#N2N_SN_PORT=7654 - -DAEMON_OPTS="" - -# Uncomment this to get edge node started. -#N2N_SN_CONFIG_DONE="yes" - diff --git a/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.init b/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.init deleted file mode 100644 index 1641caa9..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.init +++ /dev/null @@ -1,126 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: n2n-supernode -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: n2n-supernode -# Description: Start n2n supernode -### END INIT INFO - -# Init script for n2n supernode -# Copyright (C) 2010 Kim Hansen -# Refactor (C) 2017 Dale MM0HGW -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="n2n supernode" -NAME=n2n-supernode -DAEMON=/usr/sbin/supernode -DAEMON_ARGS="" -SCRIPTNAME=/etc/init.d/$NAME - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# Set defaults -if [ -z $N2N_SN_PORT ]; then N2N_SN_PORT=7654; fi -DAEMON_ARGS="$DAEMON_ARGS -l $N2N_SN_PORT" - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - start-stop-daemon --start --quiet --user nobody --exec $DAEMON --test \ - || return 1 - start-stop-daemon --start --quiet --user nobody --chuid nobody --exec $DAEMON -- \ - $DAEMON_ARGS \ - || return 2 -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user nobody --exec $DAEMON -} - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - restart|force-reload) - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 - exit 3 - ;; -esac - -true # Set exit status to 0 (succes) diff --git a/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.install b/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.install deleted file mode 100644 index 28fa2249..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.install +++ /dev/null @@ -1 +0,0 @@ -supernode /usr/sbin diff --git a/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.manpages b/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.manpages deleted file mode 100644 index 6ebfb37b..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/n2n-supernode.manpages +++ /dev/null @@ -1 +0,0 @@ -supernode.1 diff --git a/bundles/n2n_meyerd/n2n_v2/debian/rules b/bundles/n2n_meyerd/n2n_v2/debian/rules deleted file mode 100644 index 0bbc9b8d..00000000 --- a/bundles/n2n_meyerd/n2n_v2/debian/rules +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/makefile.mk - diff --git a/bundles/n2n_meyerd/n2n_v2/edge.8 b/bundles/n2n_meyerd/n2n_v2/edge.8 deleted file mode 100644 index dd0e2a21..00000000 --- a/bundles/n2n_meyerd/n2n_v2/edge.8 +++ /dev/null @@ -1,221 +0,0 @@ -.TH edge 8 "17 Mar 2010" "n2n-2.1" "SUPERUSER COMMANDS" -.SH NAME -edge \- n2n edge node daemon -.SH SYNOPSIS -.B edge -[\-d ] \-a \-c {\-k |\-K } -[\-s ] \-l -[\-p ] [\-u ] [\-g ] [-f] [\-m ] [\-r] [\-v] -.SH DESCRIPTION -N2N is a peer-to-peer VPN system. Edge is the edge node daemon for n2n which -creates a TAP interface to expose the n2n virtual LAN. On startup n2n creates -the TAP interface and configures it then registers with the supernode so it can -begin to find other nodes in the community. -.PP -.SH OPTIONS -.TP -\-d -sets the TAP device name as seen in ifconfig. Only available on Linux. -.TP -\-a {|static:|dhcp:0.0.0.0} -sets the n2n virtual LAN IP address being claimed. This is a private IP -address. All IP addresses in an n2n community typical belong to the same /24 -network (ie. only the last octet of the IP addresses varies). If DHCP is used to -assign interface addresses then specify the address as -.B -a dhcp:0.0.0.0 -.TP -\-b -cause edge to perform hostname resolution for the supernode address each time -the supernode is periodically contacted. This can cause reliability problems -because all packet processing stops while the supernode address is resolved -which might take 15 seconds. -.TP -\-c -sets the n2n community name. All edges within the same community appear on the -same LAN (layer 2 network segment). Community name is 16 bytes in length. A name -smaller than this is padded with 0x00 bytes and a name longer than this is -truncated to take the first 16 bytes. -.TP -\-h -write usage then exit. -.TP -\-i -interval that is needed to keep the holes in the NAT open. This is used as an -interval for registration messages sent to the supernode. It is also used by -other edges to know when they need to reregister. -.TP -\-k -sets the twofish encryption key from ASCII text (see also N2N_KEY in -ENVIRONMENT). All edges communicating must use the same key and community -name. If neither -k nor -K is used to specify a key source then edge uses -cleartext mode (no encryption). The -k and -K options are mutually exclusive. -.TP -\-K -Reads a key-schedule file and populates the internal transform -operations with the data found there. This mechanism allows keys to roll at -pre-determined times for a group of hosts. Accurate time synchronisation is not -required as older keys can be decoded for some time after expiry. If neither -k -nor -K is used to specify a key source then edge uses cleartext mode (no -encryption). The -k and -K options are mutually exclusive. -.TP -\-l : -sets the n2n supernode IP address and port to register to. Up to 2 supernodes -can be specified by two invocations of -l :. eg. -.B edge -l 12.34.56.78:7654 -l 98.76.54.32:7654 -. -.TP -\-L -adds a local ip address which is sent to other nodes on registration. The nodes -will then try to register both with the address seen by the supernode and the -local address. This can be used to circumvent the behind-same-nat problem. The -local_ip value can either be an IP address, or the value "auto" which will try -to guess a valid local ip automatically. The local ip can also be changed via -the management interface. -.TP -\-p -binds edge to the given UDP port. Useful for keeping the same external socket -across restarts of edge. This allows peer edges which know the edge socket to -continue p2p operation without going back to the supernode. -.TP -\-t -binds the edge management system to the given UDP port. Default 5644. Use this -if you need to run multiple instance of edge; or something is bound to that -port. -.TP -\-u -causes the edge process to drop to the given user ID when privileges are no -longer required (UNIX). -.TP -\-g -causes the edge process to drop to the given group ID when privileges are no -longer required (UNIX). -.TP -\-f -disables daemon mode (UNIX) and causes edge to run in the foreground. -.TP -\-m -start the TAP interface with the given MAC address. This is highly recommended -as it means the same address will be used if edge stops and restarts. If this is -not done, the ARP caches of all peers will be wrong and packets will not flow to -this edge until the next ARP refresh. -.TP -\-M -set the MTU of the edge interface in bytes. MTU is the largest packet fragment -size allowed to be moved throught the interface. The default is 1400. -.TP -\-s -set the netmask of edge interface in IPv4 dotted decimal notation. The default -is 255.255.255.0 (ie. /24). -.TP -\-r -enable IP packet forwarding/routing through the n2n virtual LAN. Without this -option, IP packets arriving over n2n are dropped if not for the -a (or -DHCP assigned) IP address of the edge interface. -.TP -\-E -accept packets destined for multicast ethernet MAC addresses. These addresses -are used in multicast ethernet and IPv6 neighbour discovery. If this option is -not present these multicast packets are discarded as most users do not need or -understand them. -.TP -\-v -more verbose logging (may be specified several times for more verbosity). -.SH ENVIRONMENT -.TP -.B N2N_KEY -set the encryption key so it is not visible on the command line -.SH EXAMPLES -.TP -.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:23 \-a 192.168.254.7 \-p 50001 \-l 123.121.120.119:7654 - -Start edge with TAP device n2n0 on community "mynetwork" with community -supernode at 123.121.120.119 UDP port 7654 and bind the locally used UDP port to -50001. Use "encryptme" as the single permanent shared encryption key. Assign MAC -address DE:AD:BE:EF:01:23 to the n2n interface and drop to user=99 and group=99 -after the TAP device is successfull configured. -.PP -Add the -f option to stop edge running as a daemon. -.PP -Somewhere else setup another edge with similar parameters, eg. - -.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:21 \-a 192.168.254.5 \-p 50001 \-l 123.121.120.119:7654 -.PP -Now you can ping from 192.168.254.5 to 192.168.254.7. -.PP -The MAC address (-m ) and virtual IP address (-a ) must be different -on all edges in the same community. - -.SH KEY SCHEDULE FILES -(See -.B n2n_v2(7) -for more details). - -The -K option reads a key schedule file. - -.B edge \-d n2n0 \-c mynetwork \-K /path/to/file \-u 99 \-g 99 \-m DE:AD:BE:EF:01:21 \-a 192.168.254.5 \-p 50001 \-l 123.121.120.119:7654 -.PP - -The key schedule file consists of line, one per key in the schedule. The purpose -of key schedules is to encourage regular changing of the encryption keys used by -a community. The file structure also allows for full binary keys to be specified -as compared to the ASCII keys allowed by the single key injection. Each key line -consists of the following: - -.B - - and are ASCII decimal values of the UNIX times during which the -key is valid. is the index of the transform that applies -to. is some text which is parsed by the transform module to derive the -key for that line. - -Supported values are: -.TP -2 = TwoFish - has the form _. eg. - -.B 1252327945 1252328305 2 602_3d7c7769b34b2a4812f8c0e9d87ce9 - -This specifies security association number 602 and a 16-octet key of numeric -value 0x3d7c7769b34b2a4812f8c0e9d87ce9. is a 32-bit unsigned integer which -is used to identify the encryption key to the receiver. The SA number is sent -unencrypted so the receiver may find the correct key from the key -schedule. is up to 16 octets although shorter keys are allowed. - -.TP -3 = AES-CBC - has the form _. Same rules as TwoFish. - -.SH CLEARTEXT MODE -If neither -.B -k -nor -.B -K -is specified then edge uses cleartext mode. In cleartext mode there is no -transform of the packet data it is simply encrypted. This is useful for -debugging n2n as packet contents can be seen clearly. - -To prevent accidental exposure of data, edge only enters cleartext mode when no -keying parameters are specified. In the case where keying parameters are -specified but no valid keys can be determined, edge exits with an error at -startup. If all keys become invalid while running, edge continues to encode -using the last key that was valid. - -.SH MANAGEMENT INTERFACE -Edge provides a very simple management system on UDP port 5644. Send a newline -to receive a status output. Send 'reload' to cause re-read of the -keyfile. Send 'stop' to cause edge to exit cleanly. - -.SH EXIT STATUS -edge is a daemon and any exit is an error. -.SH AUTHORS -.TP -Richard Andrews -andrews (at) ntop.org - n2n-1 maintainer and main author of n2n-2 -.TP -Luca Deri -deri (at) ntop.org - original author of n2n -.TP -Don Bindner -(--) - significant contributions to n2n-1 -.SH SEE ALSO -ifconfig(8) supernode(1) tunctl(8) n2n_v2(7) diff --git a/bundles/n2n_meyerd/n2n_v2/edge.c b/bundles/n2n_meyerd/n2n_v2/edge.c deleted file mode 100644 index db628754..00000000 --- a/bundles/n2n_meyerd/n2n_v2/edge.c +++ /dev/null @@ -1,3238 +0,0 @@ -/** - * (C) 2007-09 - Luca Deri - * Richard Andrews - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - * Code contributions courtesy of: - * Don Bindner - * Sylwester Sosnowski - * Wilfried "Wonka" Klaebe - * Lukasz Taczuk - * - */ - -#include "n2n.h" -#include "n2n_transforms.h" -#include -#include -#include "minilzo.h" - -#ifndef __ANDROID_NDK__ -#include "scm.h" - -int n2n_main(int, char **); -int n2n_stop(void *); - -struct SCM_def sd = { - .name = "edge", - .desc = "edge - n2n VPN Edge node", - .main = n2n_main, - .stop = n2n_stop, -}; -#endif /* __ANDROID_NDK__ */ - -#ifdef __ANDROID_NDK__ -#include -#include -#endif /* __ANDROID_NDK__ */ - -#if defined(DEBUG) -#define SOCKET_TIMEOUT_INTERVAL_SECS 5 -#define DEFAULT_HOLEPUNCH_INTERVAL 20 /* sec */ -#else /* #if defined(DEBUG) */ -#define SOCKET_TIMEOUT_INTERVAL_SECS 5 -#define DEFAULT_HOLEPUNCH_INTERVAL 25 /* sec */ -#endif /* #if defined(DEBUG) */ - -#define REGISTER_SUPER_INTERVAL_MIN 10 /* sec */ -#define REGISTER_SUPER_INTERVAL_MAX 120 /* sec */ - -#define IFACE_UPDATE_INTERVAL (30) /* sec. How long it usually takes to get an IP lease. */ -#define TRANSOP_TICK_INTERVAL (10) /* sec */ - -#define LOCALIP_UPDATE_INTERVAL (30) /* sec. How long it usually takes to re-resolve local socket. */ - -#define STAT_CALC_INTERVAL (10) /* sec. Calculate the bps values in roughly this interval steps */ - -/** maximum length of command line arguments */ -#define MAX_CMDLINE_BUFFER_LENGTH 4096 - -/** maximum length of a line in the configuration file */ -#define MAX_CONFFILE_LINE_LENGTH 1024 - -#define N2N_PATHNAME_MAXLEN 256 -#define N2N_MAX_TRANSFORMS 16 -#define N2N_EDGE_MGMT_PORT 5644 - -/** Positions in the transop array where various transforms are stored. - * - * Used by transop_enum_to_index(). See also the transform enumerations in - * n2n_transforms.h */ -#define N2N_TRANSOP_NULL_IDX 0 -#define N2N_TRANSOP_TF_IDX 1 -#define N2N_TRANSOP_AESCBC_IDX 2 -/* etc. */ - - - -/* Work-memory needed for compression. Allocate memory in units - * of `lzo_align_t' (instead of `char') to make sure it is properly aligned. - */ - -/* #define HEAP_ALLOC(var,size) \ */ -/* lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ] */ - -/* static HEAP_ALLOC(wrkmem,LZO1X_1_MEM_COMPRESS); */ - -/* ******************************************************* */ - -#define N2N_EDGE_SN_HOST_SIZE 48 -#define N2N_EDGE_LOCAL_IP_SIZE 48 - -typedef char n2n_sn_name_t[N2N_EDGE_SN_HOST_SIZE]; -typedef char n2n_local_ip_t[N2N_EDGE_LOCAL_IP_SIZE]; - -#define N2N_EDGE_NUM_SUPERNODES 2 -#define N2N_EDGE_SUP_ATTEMPTS 3 /* Number of failed attmpts before moving on to next supernode. */ - - -/** Main structure type for edge. */ -struct n2n_edge -{ - int daemon; /**< Non-zero if edge should detach and run in the background. */ - uint8_t re_resolve_supernode_ip; - - n2n_sock_t supernode; - n2n_sock_t local_sock; - - size_t sn_idx; /**< Currently active supernode. */ - size_t sn_num; /**< Number of supernode addresses defined. */ - n2n_sn_name_t sn_ip_array[N2N_EDGE_NUM_SUPERNODES]; - n2n_local_ip_t local_ip_str; /** storing a local ip socket */ - int local_sock_ena; /** > 0 if local_sock is enabled */ - int sn_wait; /**< Whether we are waiting for a supernode response. */ - - n2n_community_t community_name; /**< The community. 16 full octets. */ - char keyschedule[N2N_PATHNAME_MAXLEN]; - int null_transop; /**< Only allowed if no key sources defined. */ - - int udp_sock; - int udp_mgmt_sock; /**< socket for status info. */ - - tuntap_dev device; /**< All about the TUNTAP device */ - int dyn_ip_mode; /**< Interface IP address is dynamically allocated, eg. DHCP. */ - int allow_routing; /**< Accept packet no to interface address. */ - int drop_multicast; /**< Multicast ethernet addresses. */ - - n2n_trans_op_t transop[N2N_MAX_TRANSFORMS]; /* one for each transform at fixed positions */ - size_t tx_transop_idx; /**< The transop to use when encoding. */ - - struct peer_info * known_peers[PEER_HASH_TAB_SIZE]; /**< Edges we are connected to. */ - struct peer_info * pending_peers[PEER_HASH_TAB_SIZE]; /**< Edges we have tried to register with. */ - time_t last_register_req; /**< Check if time to re-register with super*/ - size_t holepunch_interval; /**< Time distance after last_register_req at which to re-register. */ - time_t last_purge; /** last time clients were purged **/ - time_t last_p2p; /**< Last time p2p traffic was received. */ - time_t last_sup; /**< Last time a packet arrived from supernode. */ - size_t sup_attempts; /**< Number of remaining attempts to this supernode. */ - n2n_cookie_t last_cookie; /**< Cookie sent in last REGISTER_SUPER. */ - - time_t start_time; /**< For calculating uptime */ - - /* Statistics */ - size_t tx_p2p; - size_t tx_bit_p2p; - size_t tx_bps_p2p; - size_t rx_p2p; - size_t rx_bit_p2p; - size_t rx_bps_p2p; - size_t tx_sup; - size_t tx_bit_sup; - size_t tx_bps_sup; - size_t rx_sup; - size_t rx_bit_sup; - size_t rx_bps_sup; -}; - -/** Return the IP address of the current supernode in the ring. */ -static const char * supernode_ip( const n2n_edge_t * eee ) -{ - return (eee->sn_ip_array)[eee->sn_idx]; -} - - -static void supernode2addr(n2n_sock_t * sn, const n2n_sn_name_t addr); -static int localip2addr(n2n_sock_t * l_ip, - const n2n_local_ip_t local_ip_strIn, int local_port); -static int set_localip(n2n_edge_t * eee); - -static void send_packet2net(n2n_edge_t * eee, - uint8_t *decrypted_msg, size_t len); - - -/* ************************************** */ - -/* parse the configuration file */ -static int readConfFile(const char * filename, char * const linebuffer) { - struct stat stats; - FILE * fd; - char * buffer = NULL; - - buffer = (char *)malloc(MAX_CONFFILE_LINE_LENGTH); - if (!buffer) { - traceEvent( TRACE_ERROR, "Unable to allocate memory"); - return -1; - } - - if (stat(filename, &stats)) { - if (errno == ENOENT) - traceEvent(TRACE_ERROR, "parameter file %s not found/unable to access\n", filename); - else - traceEvent(TRACE_ERROR, "cannot stat file %s, errno=%d\n",filename, errno); - free(buffer); - return -1; - } - - fd = fopen(filename, "rb"); - if (!fd) { - traceEvent(TRACE_ERROR, "Unable to open parameter file '%s' (%d)...\n",filename,errno); - free(buffer); - return -1; - } - while(fgets(buffer, MAX_CONFFILE_LINE_LENGTH,fd)) { - char * p = NULL; - - /* strip out comments */ - p = strchr(buffer, '#'); - if (p) *p ='\0'; - - /* remove \n */ - p = strchr(buffer, '\n'); - if (p) *p ='\0'; - - /* strip out heading spaces */ - p = buffer; - while(*p == ' ' && *p != '\0') ++p; - if (p != buffer) strncpy(buffer,p,strlen(p)+1); - - /* strip out trailing spaces */ - while(strlen(buffer) && buffer[strlen(buffer)-1]==' ') - buffer[strlen(buffer)-1]= '\0'; - - /* check for nested @file option */ - if (strchr(buffer, '@')) { - traceEvent(TRACE_ERROR, "@file in file nesting is not supported\n"); - free(buffer); - return -1; - } - if ((strlen(linebuffer)+strlen(buffer)+2)< MAX_CMDLINE_BUFFER_LENGTH) { - strncat(linebuffer, " ", 1); - strncat(linebuffer, buffer, strlen(buffer)); - } else { - traceEvent(TRACE_ERROR, "too many argument"); - free(buffer); - return -1; - } - } - - free(buffer); - fclose(fd); - - return 0; -} - -/* Create the argv vector */ -/* FIXME - * - this function does not handle quoted parameters - * Worse still, by this point, we have removed any indications of what the - * original params were - so quote handling performed by the shell is gone.. - */ -static char ** buildargv(int * effectiveargc, char * const linebuffer) { - const int INITIAL_MAXARGC = 16; /* Number of args + NULL in initial argv */ - int maxargc; - int argc=0; - char ** argv; - char * buffer, * buff; - - *effectiveargc = 0; - buffer = (char *)calloc(1, strlen(linebuffer)+2); - if (!buffer) { - traceEvent( TRACE_ERROR, "Unable to allocate memory"); - return NULL; - } - strncpy(buffer, linebuffer,strlen(linebuffer)); - - maxargc = INITIAL_MAXARGC; - argv = (char **)malloc(maxargc * sizeof(char*)); - if (argv == NULL) { - traceEvent( TRACE_ERROR, "Unable to allocate memory"); - return NULL; - } - buff = buffer; - while(buff) { - char * p = strchr(buff,' '); - if (p) { - *p='\0'; - argv[argc++] = strdup(buff); - while(*++p == ' ' && *p != '\0'); - buff=p; - if (argc >= maxargc) { - maxargc *= 2; - argv = (char **)realloc(argv, maxargc * sizeof(char*)); - if (argv == NULL) { - traceEvent(TRACE_ERROR, "Unable to re-allocate memory"); - free(buffer); - return NULL; - } - } - } else { - argv[argc++] = strdup(buff); - break; - } - } - free(buffer); - *effectiveargc = argc; - return argv; -} - - - -/* ************************************** */ - - -/** Initialise an edge to defaults. - * - * This also initialises the NULL transform operation opstruct. - */ -static int edge_init(n2n_edge_t * eee) -{ -#ifdef WIN32 - initWin32(); -#endif - memset(eee, 0, sizeof(n2n_edge_t)); - eee->start_time = time(NULL); - - transop_null_init( &(eee->transop[N2N_TRANSOP_NULL_IDX]) ); - transop_twofish_init( &(eee->transop[N2N_TRANSOP_TF_IDX] ) ); - transop_aes_init( &(eee->transop[N2N_TRANSOP_AESCBC_IDX] ) ); - - eee->tx_transop_idx = N2N_TRANSOP_NULL_IDX; /* No guarantee the others have been setup */ - - eee->daemon = 1; /* By default run in daemon mode. */ - eee->re_resolve_supernode_ip = 0; - /* keyschedule set to NULLs by memset */ - /* community_name set to NULLs by memset */ - eee->null_transop = 0; - eee->udp_sock = -1; - eee->udp_mgmt_sock = -1; - eee->dyn_ip_mode = 0; - eee->allow_routing = 0; - eee->drop_multicast = 1; - eee->local_sock_ena = 0; - sglib_hashed_peer_info_t_init(eee->known_peers); - sglib_hashed_peer_info_t_init(eee->pending_peers); - eee->last_register_req = 0; - eee->holepunch_interval = DEFAULT_HOLEPUNCH_INTERVAL; - eee->last_p2p = 0; - eee->last_sup = 0; - eee->last_purge = 0; - eee->sup_attempts = N2N_EDGE_SUP_ATTEMPTS; - eee->tx_bit_p2p = 0; - eee->tx_bit_sup = 0; - eee->rx_bit_p2p = 0; - eee->rx_bit_sup = 0; - - if(lzo_init() != LZO_E_OK) - { - traceEvent(TRACE_ERROR, "LZO compression error"); - return(-1); - } - - return(0); -} - - - -/* Called in main() after options are parsed. */ -static int edge_init_twofish( n2n_edge_t * eee, uint8_t *encrypt_pwd, uint32_t encrypt_pwd_len ) -{ - return transop_twofish_setup( &(eee->transop[N2N_TRANSOP_TF_IDX]), 0, encrypt_pwd, encrypt_pwd_len ); -} - - -/** Find the transop op-struct for the transform enumeration required. - * - * @return - index into the transop array, or -1 on failure. - */ -static int transop_enum_to_index( n2n_transform_t id ) -{ - switch (id) - { - case N2N_TRANSFORM_ID_TWOFISH: - return N2N_TRANSOP_TF_IDX; - break; - case N2N_TRANSFORM_ID_NULL: - return N2N_TRANSOP_NULL_IDX; - break; - case N2N_TRANSFORM_ID_AESCBC: - return N2N_TRANSOP_AESCBC_IDX; - break; - default: - return -1; - } -} - - -/** Called periodically to roll keys and do any periodic maintenance in the - * tranform operations state machines. */ -static int n2n_tick_transop( n2n_edge_t * eee, time_t now ) -{ - n2n_tostat_t tst; - size_t trop = eee->tx_transop_idx; - - /* Tests are done in order that most preferred transform is last and causes - * tx_transop_idx to be left at most preferred valid transform. */ - tst = (eee->transop[N2N_TRANSOP_NULL_IDX].tick)( &(eee->transop[N2N_TRANSOP_NULL_IDX]), now ); - tst = (eee->transop[N2N_TRANSOP_AESCBC_IDX].tick)( &(eee->transop[N2N_TRANSOP_AESCBC_IDX]), now ); - if ( tst.can_tx ) - { - traceEvent( TRACE_DEBUG, "can_tx AESCBC (idx=%u)", (unsigned int)N2N_TRANSOP_AESCBC_IDX ); - trop = N2N_TRANSOP_AESCBC_IDX; - } - - tst = (eee->transop[N2N_TRANSOP_TF_IDX].tick)( &(eee->transop[N2N_TRANSOP_TF_IDX]), now ); - if ( tst.can_tx ) - { - traceEvent( TRACE_DEBUG, "can_tx TF (idx=%u)", (unsigned int)N2N_TRANSOP_TF_IDX ); - trop = N2N_TRANSOP_TF_IDX; - } - - if ( trop != eee->tx_transop_idx ) - { - eee->tx_transop_idx = trop; - traceEvent( TRACE_NORMAL, "Chose new tx_transop_idx=%u", (unsigned int)(eee->tx_transop_idx) ); - } - - return 0; -} - - - -/** Read in a key-schedule file, parse the lines and pass each line to the - * appropriate trans_op for parsing of key-data and adding key-schedule - * entries. The lookup table of time->trans_op is constructed such that - * encoding can be passed to the correct trans_op. The trans_op internal table - * will then determine the best SA for that trans_op from the key schedule to - * use for encoding. */ -static int edge_init_keyschedule( n2n_edge_t * eee ) -{ - -#define N2N_NUM_CIPHERSPECS 32 - - int retval = -1; - ssize_t numSpecs=0; - n2n_cipherspec_t specs[N2N_NUM_CIPHERSPECS]; - size_t i; - time_t now = time(NULL); - - numSpecs = n2n_read_keyfile( specs, N2N_NUM_CIPHERSPECS, eee->keyschedule ); - - if ( numSpecs > 0 ) - { - traceEvent( TRACE_NORMAL, "keyfile = %s read -> %d specs.\n", optarg, (signed int)numSpecs); - - for ( i=0; i < (size_t)numSpecs; ++i ) - { - int idx; - - idx = transop_enum_to_index( specs[i].t ); - - switch (idx) - { - case N2N_TRANSOP_TF_IDX: - case N2N_TRANSOP_AESCBC_IDX: - { - retval = (eee->transop[idx].addspec)( &(eee->transop[idx]), - &(specs[i]) ); - break; - } - default: - retval = -1; - } - - if (0 != retval) - { - traceEvent( TRACE_ERROR, "keyschedule failed to add spec[%u] to transop[%d].\n", - (unsigned int)i, idx); - - return retval; - } - } - - n2n_tick_transop( eee, now ); - } - else - { - traceEvent( TRACE_ERROR, "Failed to process '%s'", eee->keyschedule ); - } - - return retval; -} - - -/** Deinitialise the edge and deallocate any owned memory. */ -static void edge_deinit(n2n_edge_t * eee) -{ - if ( eee->udp_sock >=0 ) - { - closesocket( eee->udp_sock ); - } - - if ( eee->udp_mgmt_sock >= 0 ) - { - closesocket(eee->udp_mgmt_sock); - } - - clear_hashed_peer_info_t_list( eee->pending_peers ); - clear_hashed_peer_info_t_list( eee->known_peers ); - - (eee->transop[N2N_TRANSOP_TF_IDX].deinit)(&eee->transop[N2N_TRANSOP_TF_IDX]); - (eee->transop[N2N_TRANSOP_NULL_IDX].deinit)(&eee->transop[N2N_TRANSOP_NULL_IDX]); -} - -static void readFromIPSocket( n2n_edge_t * eee ); - -static void readFromMgmtSocket( n2n_edge_t * eee, int * keep_running ); - -static void help() { - print_n2n_version(0 /* no trace */); - - printf("edge " -#if defined(N2N_CAN_NAME_IFACE) - "-d " -#endif /* #if defined(N2N_CAN_NAME_IFACE) */ - "-a [static:|dhcp:] " - "-c " - "[-k | -K ] " - "[-s ] " -#if defined(N2N_HAVE_SETUID) - "[-u -g ]" -#endif /* #ifndef N2N_HAVE_SETUID */ - -#if defined(N2N_HAVE_DAEMON) - "[-f]" -#endif /* #if defined(N2N_HAVE_DAEMON) */ - "[-m ]" - "\n" - "-l " - "[-p ] [-M ] " - "[-r] [-E] [-v] [-t ] [-b] [-h]\n\n"); - -#ifdef __linux__ - printf("-d | tun device name\n"); -#endif - - printf("-a | Set interface address. For DHCP use '-r -a dhcp:0.0.0.0'\n"); - printf("-c | n2n community name the edge belongs to.\n"); - printf("-k | Encryption key (ASCII) - also N2N_KEY=. Not with -K.\n"); - printf("-K | Specify a key schedule file to load. Not with -k.\n"); - printf("-s | Edge interface netmask in dotted decimal notation (255.255.255.0).\n"); - printf("-l | Supernode IP:port\n"); - printf("-L | Add local ip to bypass between same nat problem\n"); - printf("-i | Set the NAT hole-punch interval (default 20seconds)\n"); - printf("-b | Periodically resolve supernode IP\n"); - printf(" : (when supernodes are running on dynamic IPs)\n"); - printf("-p | Fixed local UDP port.\n"); -#ifndef WIN32 - printf("-u | User ID (numeric) to use when privileges are dropped.\n"); - printf("-g | Group ID (numeric) to use when privileges are dropped.\n"); -#endif /* ifndef WIN32 */ -#ifdef N2N_HAVE_DAEMON - printf("-f | Do not fork and run as a daemon; rather run in foreground.\n"); -#endif /* #ifdef N2N_HAVE_DAEMON */ - printf("-m | Fix MAC address for the TAP interface (otherwise it may be random)\n" - " : eg. -m 01:02:03:04:05:06\n"); - printf("-M | Specify n2n MTU of edge interface (default %d).\n", DEFAULT_MTU); - printf("-r | Enable packet forwarding through n2n community.\n"); - printf("-E | Accept multicast MAC addresses (default=drop).\n"); - printf("-v | Make more verbose. Repeat as required.\n"); - printf("-t | Management UDP Port (for multiple edges on a machine).\n"); - - printf("\nEnvironment variables:\n"); - printf(" N2N_KEY | Encryption key (ASCII). Not with -K or -k.\n" ); - - exit(0); -} - - -/** Send a datagram to a socket defined by a n2n_sock_t */ -static ssize_t sendto_sock( int fd, const void * buf, size_t len, const n2n_sock_t * dest ) -{ - n2n_sock_str_t sockbuf; - struct sockaddr_in peer_addr; - ssize_t sent; - - fill_sockaddr( (struct sockaddr *) &peer_addr, - sizeof(peer_addr), - dest ); - - sent = sendto( fd, buf, len, 0/*flags*/, - (struct sockaddr *)&peer_addr, sizeof(struct sockaddr_in) ); - if ( sent < 0 ) - { - char * c = strerror(errno); - traceEvent( TRACE_ERROR, "sendto %s failed (%d) %s", - sock_to_cstr( sockbuf, dest ), errno, c ); - } - else - { - traceEvent( TRACE_DEBUG, "sendto sent=%d to ", (signed int)sent ); - } - - return sent; -} - - -/** Send a REGISTER packet to another edge. */ -static void send_register( n2n_edge_t * eee, - const n2n_sock_t * remote_peer, - const n2n_mac_t dstMac) -{ - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - n2n_common_t cmn = {0}; - n2n_REGISTER_t reg = {{0}}; - n2n_sock_str_t sockbuf; - - cmn.ttl=N2N_DEFAULT_TTL; - cmn.pc = n2n_register; - cmn.flags = 0; - memcpy( cmn.community, eee->community_name, N2N_COMMUNITY_SIZE ); - - /* NOTE: Encoding should probably not be done here but in - * encode_REGISTER (lukas) */ - idx=0; - encode_uint32( reg.cookie, &idx, 123456789 ); - idx=0; - encode_mac( reg.srcMac, &idx, eee->device.mac_addr ); - if(dstMac) { - idx=0; - encode_mac( reg.dstMac, &idx, dstMac ); - } - - idx=0; - encode_REGISTER( pktbuf, &idx, &cmn, ® ); - - traceEvent( TRACE_INFO, "send REGISTER %s", - sock_to_cstr( sockbuf, remote_peer ) ); - - - sendto_sock( eee->udp_sock, pktbuf, idx, remote_peer ); -} - -/** Send a QUERY_PEER packet to the current supernode. */ -static void send_query_peer( n2n_edge_t * eee, - const n2n_mac_t dstMac) -{ - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - n2n_common_t cmn = {0}; - n2n_QUERY_PEER_t query = {{0}}; - - cmn.ttl=N2N_DEFAULT_TTL; - cmn.pc = n2n_query_peer; - cmn.flags = 0; - memcpy( cmn.community, eee->community_name, N2N_COMMUNITY_SIZE ); - - idx=0; - encode_mac( query.srcMac, &idx, eee->device.mac_addr ); - idx=0; - encode_mac( query.targetMac, &idx, dstMac ); - - idx=0; - encode_QUERY_PEER( pktbuf, &idx, &cmn, &query ); - - traceEvent( TRACE_INFO, "send QUERY_PEER to supernode" ); - - sendto_sock( eee->udp_sock, pktbuf, idx, &(eee->supernode) ); -} - -/** Send a REGISTER_SUPER packet to the current supernode. */ -static void send_register_super( n2n_edge_t * eee, - const n2n_sock_t * supernode) -{ - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - n2n_common_t cmn = {0}; - n2n_REGISTER_SUPER_t reg = {0}; - n2n_sock_str_t sockbuf; - - cmn.ttl=N2N_DEFAULT_TTL; - cmn.pc = n2n_register_super; - cmn.flags = 0; - memcpy( cmn.community, eee->community_name, N2N_COMMUNITY_SIZE ); - - for( idx=0; idx < N2N_COOKIE_SIZE; ++idx ) - { - eee->last_cookie[idx] = rand() % 0xff; - } - - reg.aflags = 0; - memcpy( reg.cookie, eee->last_cookie, N2N_COOKIE_SIZE ); - reg.auth.scheme=0; /* No auth yet */ - reg.timeout = eee->holepunch_interval; - - idx=0; - encode_mac( reg.edgeMac, &idx, eee->device.mac_addr ); - - if(eee->local_sock_ena) { - reg.aflags |= N2N_AFLAGS_LOCAL_SOCKET; - reg.local_sock = eee->local_sock; - } - - idx=0; - encode_REGISTER_SUPER( pktbuf, &idx, &cmn, ® ); - - traceEvent( TRACE_INFO, "send REGISTER_SUPER to %s", - sock_to_cstr( sockbuf, supernode ) ); - - - sendto_sock( eee->udp_sock, pktbuf, idx, supernode ); -} - - -/** Send a REGISTER_ACK packet to a peer edge. */ -static void send_register_ack( n2n_edge_t * eee, - const n2n_sock_t * remote_peer, - const n2n_REGISTER_t * reg ) -{ - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - n2n_common_t cmn; - n2n_REGISTER_ACK_t ack; - n2n_sock_str_t sockbuf; - - memset(&cmn, 0, sizeof(cmn) ); - memset(&ack, 0, sizeof(reg) ); - cmn.ttl=N2N_DEFAULT_TTL; - cmn.pc = n2n_register_ack; - cmn.flags = 0; - memcpy( cmn.community, eee->community_name, N2N_COMMUNITY_SIZE ); - - memset( &ack, 0, sizeof(ack) ); - memcpy( ack.cookie, reg->cookie, N2N_COOKIE_SIZE ); - memcpy( ack.srcMac, eee->device.mac_addr, N2N_MAC_SIZE ); - memcpy( ack.dstMac, reg->srcMac, N2N_MAC_SIZE ); - - idx=0; - encode_REGISTER_ACK( pktbuf, &idx, &cmn, &ack ); - - traceEvent( TRACE_INFO, "send REGISTER_ACK %s", - sock_to_cstr( sockbuf, remote_peer ) ); - - - sendto_sock( eee->udp_sock, pktbuf, idx, remote_peer ); -} - - -/** NOT IMPLEMENTED - * - * This would send a DEREGISTER packet to a peer edge or supernode to indicate - * the edge is going away. - */ -static void send_deregister(n2n_edge_t * eee, - n2n_sock_t * remote_peer) -{ - /* Marshall and send message */ -} - - -static int is_empty_ip_address( const n2n_sock_t * sock ); -static void update_peer_address(n2n_edge_t * eee, - uint8_t from_supernode, - const n2n_mac_t mac, - const n2n_sock_t * peer, - time_t when); -void check_peer( n2n_edge_t * eee, - uint8_t from_supernode, - const n2n_mac_t mac, - const n2n_sock_t * peer ); -void establish_connection( n2n_edge_t * eee, - const n2n_mac_t mac ); -void set_peer_operational( n2n_edge_t * eee, - const n2n_mac_t mac, - const n2n_sock_t * peer ); - - - -/** Start the registration process. - * - * If the peer is already in pending_peers, ignore the request. - * If not in pending_peers, add it and query info about it from supernode - * - * If hdr is for a direct peer-to-peer packet, try to register back to sender - * even if the MAC is in pending_peers. This is because an incident direct - * packet indicates that peer-to-peer exchange should work so more aggressive - * registration can be permitted (once per incoming packet) as this should only - * last for a small number of packets.. - * - * Called from the main loop when Rx a packet for our device mac. - */ -void establish_connection( n2n_edge_t * eee, - const n2n_mac_t mac ) -{ - struct peer_info * scan = find_peer_by_mac( eee->pending_peers, mac ); - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - if ( NULL == scan ) - { - time_t now = time(NULL); - scan = calloc( 1, sizeof( struct peer_info ) ); - - memcpy(scan->mac_addr, mac, N2N_MAC_SIZE); - scan->num_sockets = 0; - scan->sock = eee->supernode; - scan->last_seen = now; /* Don't change this it marks the pending peer for removal. */ - - sglib_hashed_peer_info_t_add(eee->pending_peers, scan); - - traceEvent( TRACE_DEBUG, "=== new pending %s -> %s", - macaddr_str( mac_buf, scan->mac_addr ), - sock_to_cstr( sockbuf, &scan->sock ) ); - - traceEvent( TRACE_INFO, "Pending peers list size=%u", - (unsigned int)hashed_peer_list_t_size( eee->pending_peers ) ); - - /* trace Sending REGISTER */ - - send_query_peer(eee, scan->mac_addr); - scan->last_sent_query = now; - - /* pending_peers now owns scan. */ - } - else - { - } -} - - -/** Update the last_seen time for this peer, or get registered. */ -void check_peer( n2n_edge_t * eee, - uint8_t from_supernode, - const n2n_mac_t mac, - const n2n_sock_t * peer) -{ - peer_info_t scan; - memcpy(scan.mac_addr, mac, sizeof(n2n_mac_t)); - - if (sglib_hashed_peer_info_t_find_member(eee->known_peers, &scan) == NULL) - { - /* Not in known_peers - start the REGISTER process. */ - establish_connection( eee, mac ); - } - else - { - /* Already in known_peers. */ - update_peer_address( eee, from_supernode, mac, peer, time(NULL) ); - } -} - - -/* Move the peer from the pending_peers list to the known_peers lists. - * - * peer must be a pointer to an element of the pending_peers list. - * - * Called by main loop when Rx a REGISTER_ACK. - */ -void set_peer_operational( n2n_edge_t * eee, - const n2n_mac_t mac, - const n2n_sock_t * peer ) -{ - peer_info_t tmp; - peer_info_t *scan; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - traceEvent( TRACE_INFO, "set_peer_operational: %s -> %s", - macaddr_str( mac_buf, mac), - sock_to_cstr( sockbuf, peer ) ); - - memcpy(tmp.mac_addr, mac, sizeof(n2n_mac_t)); - - scan = sglib_hashed_peer_info_t_find_member(eee->pending_peers, &tmp); - - if(scan) { - /* Remove scan from pending_peers. */ - sglib_hashed_peer_info_t_delete(eee->pending_peers, scan); - - /* Add scan to known_peers. */ - sglib_hashed_peer_info_t_add(eee->known_peers, scan); - - - scan->sock = *peer; - - traceEvent( TRACE_DEBUG, "=== new peer %s -> %s", - macaddr_str( mac_buf, scan->mac_addr), - sock_to_cstr( sockbuf, &scan->sock ) ); - - traceEvent( TRACE_INFO, "Pending peers list size=%u", - (unsigned int)hashed_peer_list_t_size( eee->pending_peers ) ); - - traceEvent( TRACE_INFO, "Operational peers list size=%u", - (unsigned int)hashed_peer_list_t_size( eee->known_peers ) ); - - - scan->last_seen = time(NULL); - } - else - { - traceEvent( TRACE_DEBUG, "Failed to find sender in pending_peers." ); - } -} - - -n2n_mac_t broadcast_mac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - -static int is_empty_ip_address( const n2n_sock_t * sock ) -{ - const uint8_t * ptr=NULL; - size_t len=0; - size_t i; - - if ( AF_INET6 == sock->family ) - { - ptr = sock->addr.v6; - len = 16; - } - else - { - ptr = sock->addr.v4; - len = 4; - } - - for (i=0; iknown_peers, &tmp); - - if ( scan == NULL ) - { - /* Not in known_peers. */ - return; - } - - if ( 0 != sock_equal( &(scan->sock), peer)) - { - if ( 0 == from_supernode ) - { - traceEvent( TRACE_NORMAL, "Peer changed %s: %s -> %s", - macaddr_str( mac_buf, scan->mac_addr ), - sock_to_cstr(sockbuf1, &(scan->sock)), - sock_to_cstr(sockbuf2, peer) ); - - /* The peer has changed public socket. It can no longer be assumed to be reachable. */ - /* Remove the peer. */ - sglib_hashed_peer_info_t_delete(eee->known_peers, scan); - dealloc_peer(scan); - - establish_connection( eee, mac ); - } - else - { - /* Don't worry about what the supernode reports, it could be seeing - * a different socket. */ - /* anyways, the packet came from supernode. That is potential - * trouble... just in case we will send a register back to the - * origin */ - send_register( eee, &(scan->sock), scan->mac_addr ); - } - } - else - { - /* Found and unchanged. */ - if(!from_supernode) - scan->last_seen = when; - } -} - -#if defined(DUMMY_ID_00001) /* Disabled waiting for config option to enable it */ - - - -static char gratuitous_arp[] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* Dest mac */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Src mac */ - 0x08, 0x06, /* ARP */ - 0x00, 0x01, /* Ethernet */ - 0x08, 0x00, /* IP */ - 0x06, /* Hw Size */ - 0x04, /* Protocol Size */ - 0x00, 0x01, /* ARP Request */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Src mac */ - 0x00, 0x00, 0x00, 0x00, /* Src IP */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Target mac */ - 0x00, 0x00, 0x00, 0x00 /* Target IP */ -}; - - -/** Build a gratuitous ARP packet for a /24 layer 3 (IP) network. */ -static int build_gratuitous_arp(char *buffer, uint16_t buffer_len) { - if(buffer_len < sizeof(gratuitous_arp)) return(-1); - - memcpy(buffer, gratuitous_arp, sizeof(gratuitous_arp)); - memcpy(&buffer[6], device.mac_addr, 6); - memcpy(&buffer[22], device.mac_addr, 6); - memcpy(&buffer[28], &device.ip_addr, 4); - - /* REVISIT: BbMaj7 - use a real netmask here. This is valid only by accident - * for /24 IPv4 networks. */ - buffer[31] = 0xFF; /* Use a faked broadcast address */ - memcpy(&buffer[38], &device.ip_addr, 4); - return(sizeof(gratuitous_arp)); -} - -/** Called from update_supernode_reg to periodically send gratuitous ARP - * broadcasts. */ -static void send_grat_arps(n2n_edge_t * eee,) { - char buffer[48]; - size_t len; - - traceEvent(TRACE_NORMAL, "Sending gratuitous ARP..."); - len = build_gratuitous_arp(buffer, sizeof(buffer)); - send_packet2net(eee, buffer, len); - send_packet2net(eee, buffer, len); /* Two is better than one :-) */ -} -#endif /* #if defined(DUMMY_ID_00001) */ - - - - -/** @brief Check to see if we should re-register with the supernode. - * - * This is frequently called by the main loop. - */ -static void update_supernode_reg( n2n_edge_t * eee, time_t nowTime ) -{ - if ( eee->sn_wait && ( nowTime > (eee->last_register_req + (eee->holepunch_interval/10) ) ) ) - { - /* fall through */ - traceEvent( TRACE_DEBUG, "update_supernode_reg: doing fast retry." ); - } - else if ( nowTime < (eee->last_register_req + eee->holepunch_interval)) - { - return; /* Too early */ - } - - if ( 0 == eee->sup_attempts ) - { - /* Give up on that supernode and try the next one. */ - ++(eee->sn_idx); - - if (eee->sn_idx >= eee->sn_num) - { - /* Got to end of list, go back to the start. Also works for list of one entry. */ - eee->sn_idx=0; - } - - traceEvent(TRACE_WARNING, "Supernode not responding - moving to %u of %u", - (unsigned int)eee->sn_idx, (unsigned int)eee->sn_num ); - -#ifdef __ANDROID_NDK__ - int change = 0; - pthread_mutex_lock(&g_status->mutex); - change = g_status->running_status == EDGE_STAT_SUPERNODE_DISCONNECT ? 0 : 1; - g_status->running_status = EDGE_STAT_SUPERNODE_DISCONNECT; - pthread_mutex_unlock(&g_status->mutex); - if (change) { - g_status->report_edge_status(); - } -#endif /* #ifdef __ANDROID_NDK__ */ - - eee->sup_attempts = N2N_EDGE_SUP_ATTEMPTS; - } - else - { - --(eee->sup_attempts); - } - - if(eee->re_resolve_supernode_ip || (eee->sn_num > 1) ) - { - supernode2addr(&(eee->supernode), eee->sn_ip_array[eee->sn_idx] ); - } - - traceEvent(TRACE_DEBUG, "Registering with supernode (%s) (attempts left %u)", - supernode_ip(eee), (unsigned int)eee->sup_attempts); - - send_register_super( eee, &(eee->supernode) ); - - eee->sn_wait=1; - - /* REVISIT: turn-on gratuitous ARP with config option. */ - /* send_grat_arps(sock_fd, is_udp_sock); */ - - eee->last_register_req = nowTime; -} - - -#define RETRY_INTERVAL 5 - - -/* @return 1 if destination is a peer, 0 if destination is supernode */ -static int find_peer_destination(n2n_edge_t * eee, - n2n_mac_t mac_address, - n2n_sock_t * destination) -{ - peer_info_t tmp; - peer_info_t* scan = NULL; - peer_info_t* tryscan = NULL; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - int retval=0; - int i; - time_t now = time(NULL); - - traceEvent(TRACE_DEBUG, "Searching destination peer for MAC %02X:%02X:%02X:%02X:%02X:%02X", - mac_address[0] & 0xFF, mac_address[1] & 0xFF, mac_address[2] & 0xFF, - mac_address[3] & 0xFF, mac_address[4] & 0xFF, mac_address[5] & 0xFF); - - memcpy(tmp.mac_addr, mac_address, sizeof(n2n_mac_t)); - scan = sglib_hashed_peer_info_t_find_member(eee->known_peers, &tmp); - if(scan) { - if(now-scan->last_seen > scan->timeout) { - /* delete the peer and establish new connection */ - sglib_hashed_peer_info_t_delete(eee->known_peers, scan); - establish_connection( eee, scan->mac_addr ); - dealloc_peer(scan); - } else if(scan->last_seen > 0) { - memcpy(destination, &scan->sock, sizeof(n2n_sock_t)); - retval = 1; - } - } - - if ( 0 == retval ) - { - tryscan = sglib_hashed_peer_info_t_find_member(eee->pending_peers, &tmp); - if(tryscan) { - if(tryscan->num_sockets == 0) { - /* not yet received peer_info from supernode */ - if(now - tryscan->last_sent_query > RETRY_INTERVAL) { - send_query_peer(eee, tryscan->mac_addr); - tryscan->last_sent_query = now; - } - } else if(now - tryscan->last_seen > RETRY_INTERVAL) { - traceEvent(TRACE_INFO, "retrying to register peer (%s) -> [%s]", - macaddr_str( mac_buf, mac_address), - sock_to_cstr( sockbuf, &tryscan->sock)); - for(i=0; inum_sockets; i++) - send_register(eee, &tryscan->sockets[i], tryscan->mac_addr); - tryscan->last_seen = now; - } - } - memcpy(destination, &(eee->supernode), sizeof(struct sockaddr_in)); - } - - traceEvent(TRACE_DEBUG, "find_peer_address (%s) -> [%s]", - macaddr_str( mac_buf, mac_address ), - sock_to_cstr( sockbuf, destination ) ); - - return retval; -} - - - - -/* *********************************************** */ - -static const struct option long_options[] = { - { "community", required_argument, NULL, 'c' }, - { "supernode-list", required_argument, NULL, 'l' }, - { "tun-device", required_argument, NULL, 'd' }, - { "euid", required_argument, NULL, 'u' }, - { "egid", required_argument, NULL, 'g' }, - { "local-ip", required_argument, NULL, 'L' }, - { "holepunch-interval", required_argument, NULL, 'i' }, - { "help" , no_argument, NULL, 'h' }, - { "verbose", no_argument, NULL, 'v' }, -#ifdef WIN32 - { "remove", no_argument, NULL, 'R' }, -#endif - { NULL, 0, NULL, 0 } -}; - -/* ***************************************************** */ - - -/** Send an ecapsulated ethernet PACKET to a destination edge or broadcast MAC - * address. */ -static int send_PACKET( n2n_edge_t * eee, - n2n_mac_t dstMac, - const uint8_t * pktbuf, - size_t pktlen, - n2n_sock_t * destination) -{ - n2n_sock_str_t sockbuf; - - /* hexdump( pktbuf, pktlen ); */ - - - traceEvent( TRACE_INFO, "send_PACKET to %s", sock_to_cstr( sockbuf, destination ) ); - - sendto_sock( eee->udp_sock, pktbuf, pktlen, destination ); - return 0; -} - - -/* Choose the transop for Tx. This should be based on the newest valid - * cipherspec in the key schedule. - * - * Never fall back to NULL tranform unless no key sources were specified. It is - * better to render edge inoperative than to expose user data in the clear. In - * the case where all SAs are expired an arbitrary transform will be chosen for - * Tx. It will fail having no valid SAs but one must be selected. - */ -static size_t edge_choose_tx_transop( const n2n_edge_t * eee ) -{ - if ( eee->null_transop) - { - return N2N_TRANSOP_NULL_IDX; - } - - return eee->tx_transop_idx; -} - - -/** A layer-2 packet was received at the tunnel and needs to be sent via UDP. */ -static void send_packet2net(n2n_edge_t * eee, - uint8_t *tap_pkt, size_t len) -{ - ipstr_t ip_buf; - n2n_mac_t destMac; - - n2n_common_t cmn; - n2n_PACKET_t pkt; - - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx=0; - size_t tx_transop_idx=0; - - ether_hdr_t eh; - - int dest; - int offset; - n2n_sock_t destination; - - /* tap_pkt is not aligned so we have to copy to aligned memory */ - memcpy( &eh, tap_pkt, sizeof(ether_hdr_t) ); - - /* Discard IP packets that are not originated by this hosts */ - if(!(eee->allow_routing)) { - if(ntohs(eh.type) == 0x0800) { - /* This is an IP packet from the local source address - not forwarded. */ - uint32_t *src = (uint32_t*)&tap_pkt[ETH_FRAMEHDRSIZE + IP4_SRCOFFSET]; - - /* Note: all elements of the_ip are in network order */ - if( *src != eee->device.ip_addr) { - /* This is a packet that needs to be routed */ - traceEvent(TRACE_INFO, "Discarding routed packet [%s]", - intoa(ntohl(*src), ip_buf, sizeof(ip_buf))); - return; - } else { - /* This packet is originated by us */ - /* traceEvent(TRACE_INFO, "Sending non-routed packet"); */ - } - } - } - - /* Optionally compress then apply transforms, eg encryption. */ - - /* Once processed, send to destination in PACKET */ - - memcpy( destMac, tap_pkt, N2N_MAC_SIZE ); /* dest MAC is first in ethernet header */ - - memset( &cmn, 0, sizeof(cmn) ); - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_packet; - cmn.flags=0; /* no options, not from supernode, no socket */ - memcpy( cmn.community, eee->community_name, N2N_COMMUNITY_SIZE ); - - dest = find_peer_destination(eee, destMac, &destination); - - memset( &pkt, 0, sizeof(pkt) ); - - tx_transop_idx = edge_choose_tx_transop( eee ); - - pkt.transform = eee->transop[tx_transop_idx].transform_id; - - idx=0; - encode_PACKET( pktbuf, &idx, &cmn, &pkt ); - /* make the ethernet-header part of the PACKET header */ - offset = copy_ETHFRAMEHDR( pktbuf+idx , tap_pkt); - idx += offset; - tap_pkt += offset; - len -= offset; - - traceEvent( TRACE_DEBUG, "encoded PACKET header of size=%u transform %u (idx=%u)", - (unsigned int)idx, (unsigned int)pkt.transform, (unsigned int)tx_transop_idx ); - - idx += eee->transop[tx_transop_idx].fwd( &(eee->transop[tx_transop_idx]), - pktbuf+idx, N2N_PKT_BUF_SIZE-idx, - tap_pkt, len ); - ++(eee->transop[tx_transop_idx].tx_cnt); /* stats */ - - if ( dest ) - { - ++(eee->tx_p2p); - eee->tx_bit_p2p += idx; - } - else - { - ++(eee->tx_sup); - eee->tx_bit_sup += idx; - } - send_PACKET( eee, destMac, pktbuf, idx, &destination); -} - - -/** Destination MAC 33:33:0:00:00:00 - 33:33:FF:FF:FF:FF is reserved for IPv6 - * neighbour discovery. - */ -static int is_ip6_discovery( const void * buf, size_t bufsize ) -{ - int retval = 0; - - if ( bufsize >= sizeof(ether_hdr_t) ) - { - /* copy to aligned memory */ - ether_hdr_t eh; - memcpy( &eh, buf, sizeof(ether_hdr_t) ); - - if ( (0x33 == eh.dhost[0]) && - (0x33 == eh.dhost[1]) ) - { - retval = 1; /* This is an IPv6 multicast packet [RFC2464]. */ - } - } - return retval; -} - -/** Destination 01:00:5E:00:00:00 - 01:00:5E:7F:FF:FF is multicast ethernet. - */ -static int is_ethMulticast( const void * buf, size_t bufsize ) -{ - int retval = 0; - - /* Match 01:00:5E:00:00:00 - 01:00:5E:7F:FF:FF */ - if ( bufsize >= sizeof(ether_hdr_t) ) - { - /* copy to aligned memory */ - ether_hdr_t eh; - memcpy( &eh, buf, sizeof(ether_hdr_t) ); - - if ( (0x01 == eh.dhost[0]) && - (0x00 == eh.dhost[1]) && - (0x5E == eh.dhost[2]) && - (0 == (0x80 & eh.dhost[3])) ) - { - retval = 1; /* This is an ethernet multicast packet [RFC1112]. */ - } - } - return retval; -} - - - -/** Read a single packet from the TAP interface, process it and write out the - * corresponding packet to the cooked socket. - */ -static void readFromTAPSocket( n2n_edge_t * eee ) -{ - /* tun -> remote */ - uint8_t eth_pkt[N2N_PKT_BUF_SIZE]; - macstr_t mac_buf; - ssize_t len; - -#ifdef __ANDROID_NDK__ - if (uip_arp_len != 0) { - len = uip_arp_len; - memcpy(eth_pkt, uip_arp_buf, MIN(uip_arp_len, N2N_PKT_BUF_SIZE)); - traceEvent(TRACE_DEBUG, "ARP reply packet to send"); - } - else - { -#endif /* #ifdef __ANDROID_NDK__ */ - len = tuntap_read( &(eee->device), eth_pkt, N2N_PKT_BUF_SIZE ); -#ifdef __ANDROID_NDK__ - } -#endif /* #ifdef __ANDROID_NDK__ */ - - if( (len <= 0) || (len > N2N_PKT_BUF_SIZE) ) - { - traceEvent(TRACE_WARNING, "read()=%d [%d/%s]", - (signed int)len, errno, strerror(errno)); - } - else - { - const uint8_t * mac = eth_pkt; - traceEvent(TRACE_INFO, "### Rx TAP packet (%4d) for %s", - (signed int)len, macaddr_str(mac_buf, mac) ); - - if ( eee->drop_multicast && - ( is_ip6_discovery( eth_pkt, len ) || - is_ethMulticast( eth_pkt, len) - ) - ) - { - traceEvent(TRACE_DEBUG, "Dropping multicast"); - } - else - { - send_packet2net(eee, eth_pkt, len); - } - } -} - - - -/** A PACKET has arrived containing an encapsulated ethernet datagram - usually - * encrypted. */ -static int handle_PACKET( n2n_edge_t * eee, - const n2n_common_t * cmn, - const n2n_PACKET_t * pkt, - const n2n_sock_t * orig_sender, - uint8_t * payload, - size_t psize ) -{ - ssize_t data_sent_len; - uint8_t from_supernode; - uint8_t * eth_payload=NULL; - int retval = -1; - time_t now; - n2n_ETHFRAMEHDR_t eth; - - now = time(NULL); - - traceEvent( TRACE_DEBUG, "handle_PACKET size %u transform %u", - (unsigned int)psize, (unsigned int)pkt->transform ); - /* hexdump( payload, psize ); */ - - from_supernode= cmn->flags & N2N_FLAGS_FROM_SUPERNODE; - - if ( from_supernode ) - { - ++(eee->rx_sup); - eee->last_sup=now; - eee->rx_bit_sup += psize; - } - else - { - ++(eee->rx_p2p); - eee->last_p2p=now; - eee->rx_bit_p2p += psize; - } - - decode_ETHFRAMEHDR(ð, payload); - /* Update the sender in peer table entry */ - check_peer( eee, from_supernode, eth.srcMac, orig_sender); - - /* Handle transform. */ - { - uint8_t decodebuffer[N2N_PKT_BUF_SIZE]; - uint8_t * decodebuf = decodebuffer; - size_t eth_size; - int rx_transop_idx=0; - int offset; - - /* copy eth header to decodebuf */ - offset = copy_ETHFRAMEHDR(decodebuffer, payload); - decodebuf += offset; - payload += offset; - psize -= offset; - eth_size = offset; - - rx_transop_idx = transop_enum_to_index(pkt->transform); - - if ( rx_transop_idx >=0 ) - { - eth_payload = decodebuf; - eth_size += eee->transop[rx_transop_idx].rev( &(eee->transop[rx_transop_idx]), - eth_payload, N2N_PKT_BUF_SIZE, - payload, psize ); - ++(eee->transop[rx_transop_idx].rx_cnt); /* stats */ - - /* Write ethernet packet to tap device. */ - traceEvent( TRACE_INFO, "sending to TAP %u", (unsigned int)eth_size ); - data_sent_len = tuntap_write(&(eee->device), decodebuffer, eth_size); - - if (data_sent_len == eth_size) - { - retval = 0; - } - } - else - { - traceEvent( TRACE_ERROR, "handle_PACKET dropped unknown transform enum %u", - (unsigned int)pkt->transform ); - } - } - - return retval; -} - - -/** Read a datagram from the management UDP socket and take appropriate - * action. */ -static void readFromMgmtSocket( n2n_edge_t * eee, int * keep_running ) -{ - uint8_t udp_buf[N2N_PKT_BUF_SIZE+1]; /* Complete UDP packet */ - ssize_t recvlen; - struct sockaddr_in sender_sock; - socklen_t i; - size_t msg_len; - time_t now; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - peer_info_t * lpi = NULL; - struct sglib_hashed_peer_info_t_iterator it; - int c; - - now = time(NULL); - i = sizeof(sender_sock); - recvlen = recvfrom(eee->udp_mgmt_sock, udp_buf, N2N_PKT_BUF_SIZE, 0/*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t*)&i); - - if ( recvlen < 0 ) - { - traceEvent(TRACE_ERROR, "mgmt recvfrom failed with %s", strerror(errno) ); - - return; /* failed to receive data from UDP */ - } - - /* avoid parsing any uninitialized junk from the stack */ - udp_buf[recvlen] = 0; - - if ( recvlen >= 4 ) - { - if ( 0 == memcmp( udp_buf, "stop", 4 ) ) - { - traceEvent( TRACE_ERROR, "stop command received." ); - *keep_running = 0; - return; - } - - if ( 0 == memcmp( udp_buf, "help", 4 ) ) - { - msg_len=0; - //++traceLevel; - - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "Help for edge management console:\n" - " stop Gracefully exit edge\n" - " help This help message\n" - " +verb Increase verbosity of logging\n" - " -verb Decrease verbosity of logging\n" - " peers List table of known peers\n" - " reload Re-read the keyschedule\n" - " mangle_peer mac ip [port] mangle peer\n" - " localip [value] Show or set the local IP value\n" - " Display statistics\n\n"); - - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - - return; - } - - } - - if ( recvlen >= 5 ) - { - if ( 0 == memcmp( udp_buf, "+verb", 5 ) ) - { - msg_len=0; - ++traceLevel; - - traceEvent( TRACE_ERROR, "+verb traceLevel=%u", (unsigned int)traceLevel ); - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> +OK traceLevel=%u\n", (unsigned int)traceLevel ); - - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - - return; - } - - if ( 0 == memcmp( udp_buf, "-verb", 5 ) ) - { - msg_len=0; - - if ( traceLevel > 0 ) - { - --traceLevel; - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> -OK traceLevel=%u\n", traceLevel ); - } - else - { - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> -NOK traceLevel=%u\n", traceLevel ); - } - - traceEvent( TRACE_ERROR, "-verb traceLevel=%u", (unsigned int)traceLevel ); - - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - return; - } - - if ( 0 == memcmp( udp_buf, "peers", 5 ) ) - { - msg_len = 0; - - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> known peers (connected edges):\n"); - - traceEvent( TRACE_ERROR, "listing peers on mgmt socket", 0); - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - - c = 0; - for(lpi=sglib_hashed_peer_info_t_it_init(&it,eee->known_peers); lpi!=NULL; lpi=sglib_hashed_peer_info_t_it_next(&it)) { - c++; - msg_len = 0; - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> %i: %s -> %s last: %li(%ld sec ago)\n", c, macaddr_str( mac_buf, lpi->mac_addr ), - sock_to_cstr( sockbuf, &(lpi->sock) ), - lpi->last_seen, (now - lpi->last_seen)); - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - } - - msg_len = 0; - - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> known peers (tried edges):\n"); - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - - c = 0; - for(lpi=sglib_hashed_peer_info_t_it_init(&it,eee->pending_peers); lpi!=NULL; lpi=sglib_hashed_peer_info_t_it_next(&it)) { - c++; - msg_len = 0; - if(lpi->num_sockets == 0) - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> %i: %s -> (no info) last: %li(%ld sec ago)\n", c, - macaddr_str( mac_buf, lpi->mac_addr ), - lpi->last_seen, (now - lpi->last_seen)); - else - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> %i: %s -> %s last: %li(%ld sec ago)\n", c, macaddr_str( mac_buf, lpi->mac_addr ), - sock_to_cstr( sockbuf, lpi->sockets ), - lpi->last_seen, (now - lpi->last_seen)); - if(lpi->num_sockets > 1) - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - " %s\n", - sock_to_cstr( sockbuf, lpi->sockets+1 )); - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - } - - return; - } - } - - if ( recvlen >= 6 ) - { - if ( 0 == memcmp( udp_buf, "reload", 6 ) ) - { - if ( strlen( eee->keyschedule ) > 0 ) - { - if ( edge_init_keyschedule(eee) == 0 ) - { - msg_len=0; - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> OK\n" ); - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - } - return; - } - } - } - - if ( recvlen >= 12 ) - { - if ( 0 == memcmp (udp_buf, "mangle_peer ", 12) ) - { - int j, n_matched; - n2n_mac_t target_mac; - unsigned int mac[6]; - int ip[4]; - int port; - struct peer_info * scan; - - udp_buf[recvlen] = 0; - n_matched = sscanf((const char *) udp_buf, - "mangle_peer %x:%x:%x:%x:%x:%x %d.%d.%d.%d %d", mac, mac+1, - mac+2, mac+3, mac+4, mac+5, ip, ip+1, ip+2, ip+3, &port); - for( j=0; j<6; j++ ) - target_mac[j] = (uint8_t) mac[j]; - scan = find_peer_by_mac( eee->pending_peers, target_mac ); - if (NULL != scan && n_matched >= 10) { - scan->sock.family = AF_INET; - printf("n_matched: %d, port: %d\n", n_matched, port); - if (n_matched >= 11 && port > 0) - scan->sock.port = (uint16_t) port; - for( j=0; j<4; j++) - scan->sock.addr.v4[j] = (uint8_t) ip[j]; - sendto( eee->udp_mgmt_sock, "success\n", 9, 0, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - } else { - sendto( eee->udp_mgmt_sock, "failure\n", 9, 0, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - } - return; - } - } - - char * cmd = strtok( (char *)udp_buf, " \r\n"); - if (cmd) { - if ( 0 == strcmp( cmd, "localip" ) ) - { - char *arg = strtok( NULL, " \r\n"); - if (arg) { - strncpy( eee->local_ip_str, arg, N2N_EDGE_LOCAL_IP_SIZE); - if ( set_localip(eee) != 0) { - sendto( eee->udp_mgmt_sock, "failure\n", 9, 0, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - return; - } - } - - /* show current value - possibly after changing it */ - msg_len=0; - if (!eee->local_sock_ena) { - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> localip off\n" ); - } else { - n2n_sock_str_t local_sockbuf; - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> localip %s (%s)\n", - eee->local_ip_str, - sock_to_cstr( local_sockbuf, &(eee->local_sock) ) ); - } - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); - return; - } - } - - traceEvent(TRACE_DEBUG, "mgmt status rq" ); - - msg_len=0; - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "Statistics for edge\n" ); - - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "uptime %lu\n", - time(NULL) - eee->start_time ); - - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "paths super:(tx),(rx) p2p: (tx),(rx)\n"); - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "packets %u,%u %u,%u\n", - (unsigned int)eee->tx_sup, - (unsigned int)eee->rx_sup, - (unsigned int)eee->tx_p2p, - (unsigned int)eee->rx_p2p ); - - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "byte/s %u,%u %u,%u\n", - (unsigned int)eee->tx_bps_sup, - (unsigned int)eee->rx_bps_sup, - (unsigned int)eee->tx_bps_p2p, - (unsigned int)eee->rx_bps_p2p ); - - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "trans:null |%6u|%6u|\n" - "trans:tf |%6u|%6u|\n" - "trans:aes |%6u|%6u|\n", - (unsigned int)eee->transop[N2N_TRANSOP_NULL_IDX].tx_cnt, - (unsigned int)eee->transop[N2N_TRANSOP_NULL_IDX].rx_cnt, - (unsigned int)eee->transop[N2N_TRANSOP_TF_IDX].tx_cnt, - (unsigned int)eee->transop[N2N_TRANSOP_TF_IDX].rx_cnt, - (unsigned int)eee->transop[N2N_TRANSOP_AESCBC_IDX].tx_cnt, - (unsigned int)eee->transop[N2N_TRANSOP_AESCBC_IDX].rx_cnt ); - - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "peers pend:%u full:%u\n", - (unsigned int)hashed_peer_list_t_size( eee->pending_peers ), - (unsigned int)hashed_peer_list_t_size( eee->known_peers ) ); - - msg_len += snprintf( (char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "last super:%lu(%ld sec ago) p2p:%lu(%ld sec ago)\n", - eee->last_sup, (now - eee->last_sup), eee->last_p2p, (now - eee->last_p2p) ); - - traceEvent(TRACE_DEBUG, "mgmt status sending: %s", udp_buf ); - - - sendto( eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in) ); -} - - -/** Read a datagram from the main UDP socket to the internet. */ -static void readFromIPSocket( n2n_edge_t * eee ) -{ - n2n_common_t cmn; /* common fields in the packet header */ - - n2n_sock_str_t sockbuf1; - n2n_sock_str_t sockbuf2; /* don't clobber sockbuf1 if writing two addresses to trace */ - macstr_t mac_buf1; - macstr_t mac_buf2; - - uint8_t udp_buf[N2N_PKT_BUF_SIZE]; /* Compete UDP packet */ - ssize_t recvlen; - size_t rem; - size_t idx; - size_t msg_type; - struct sockaddr_in sender_sock; - n2n_sock_t sender; - n2n_sock_t * orig_sender=NULL; - time_t now=0; - size_t i; - int j; - - /* for PACKET packages */ - n2n_PACKET_t pkt; - - /* for PEER_INFO packages */ - n2n_PEER_INFO_t pi; - struct peer_info * scan; - - /* for REGISTER packages */ - n2n_REGISTER_t reg; - peer_info_t tmp; - - /* for REGISTER_ACK packages */ - n2n_REGISTER_ACK_t ra; - - /* For REGISTER_SUPER_ACK packages */ - n2n_REGISTER_SUPER_ACK_t rsa; - - - i = sizeof(sender_sock); - recvlen = recvfrom(eee->udp_sock, udp_buf, N2N_PKT_BUF_SIZE, 0/*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t*)&i); - - if ( recvlen < 0 ) - { - traceEvent(TRACE_ERROR, "recvfrom failed with %s", strerror(errno) ); - - return; /* failed to receive data from UDP */ - } - - /* REVISIT: when UDP/IPv6 is supported we will need a flag to indicate which - * IP transport version the packet arrived on. May need to UDP sockets. */ - sender.family = AF_INET; /* udp_sock was opened PF_INET v4 */ - sender.port = ntohs(sender_sock.sin_port); - memcpy( &(sender.addr.v4), &(sender_sock.sin_addr.s_addr), IPV4_SIZE ); - - /* The packet may not have an orig_sender socket spec. So default to last - * hop as sender. */ - orig_sender=&sender; - - traceEvent(TRACE_INFO, "### Rx N2N UDP (%d) from %s", - (signed int)recvlen, sock_to_cstr(sockbuf1, &sender) ); - - /* hexdump( udp_buf, recvlen ); */ - - rem = recvlen; /* Counts down bytes of packet to protect against buffer overruns. */ - idx = 0; /* marches through packet header as parts are decoded. */ - if ( decode_common(&cmn, udp_buf, &rem, &idx) < 0 ) - { - traceEvent( TRACE_ERROR, "Failed to decode common section in N2N_UDP" ); - return; /* failed to decode packet */ - } - - now = time(NULL); - - msg_type = cmn.pc; /* packet code */ - - if( 0 == memcmp(cmn.community, eee->community_name, N2N_COMMUNITY_SIZE) ) - { - switch(msg_type) { - case MSG_TYPE_PACKET: - /* process PACKET */ - decode_PACKET( &pkt, &cmn, udp_buf, &rem, &idx ); - - traceEvent(TRACE_INFO, "Rx PACKET from %s (%s)", - sock_to_cstr(sockbuf1, &sender), - sock_to_cstr(sockbuf2, orig_sender) ); - - handle_PACKET( eee, &cmn, &pkt, orig_sender, udp_buf+idx, - recvlen-idx ); - break; - case MSG_TYPE_PEER_INFO: - decode_PEER_INFO( &pi, &cmn, udp_buf, &rem, &idx ); - - scan = find_peer_by_mac( eee->pending_peers, pi.mac ); - if (scan) { - scan->timeout = pi.timeout; - if (scan->num_sockets > 0) - free(scan->sockets); - if (pi.aflags & N2N_AFLAGS_LOCAL_SOCKET) - scan->num_sockets = 2; - else - scan->num_sockets = 1; - scan->sockets = malloc(scan->num_sockets*sizeof(n2n_sock_t)); - for(j=0; jnum_sockets; j++) - scan->sockets[j] = pi.sockets[j]; - traceEvent(TRACE_INFO, "Rx PEER_INFO on %s", - macaddr_str(mac_buf1, pi.mac) ); - for(j=0; jnum_sockets; j++) - send_register(eee, scan->sockets+j, scan->mac_addr); - } else { - traceEvent(TRACE_INFO, "Rx PEER_INFO unknown peer %s", - macaddr_str(mac_buf1, pi.mac) ); - } - - break; - case MSG_TYPE_REGISTER: - /* Another edge is registering with us */ - decode_REGISTER( ®, &cmn, udp_buf, &rem, &idx ); - - traceEvent(TRACE_INFO, - "Rx REGISTER src=%s dst=%s from peer %s (%s)", - macaddr_str( mac_buf1, reg.srcMac ), - macaddr_str( mac_buf2, reg.dstMac ), - sock_to_cstr(sockbuf1, &sender), - sock_to_cstr(sockbuf2, orig_sender) ); - - if ( 0 == memcmp(reg.dstMac, (eee->device.mac_addr), 6) ) - { - memcpy(tmp.mac_addr, reg.srcMac, sizeof(n2n_mac_t)); - if (sglib_hashed_peer_info_t_find_member( - eee->pending_peers, &tmp) != NULL) - send_register(eee, orig_sender, NULL); - } - - send_register_ack(eee, orig_sender, ®); - break; - case MSG_TYPE_REGISTER_ACK: - /* Peer edge is acknowledging our register request */ - - decode_REGISTER_ACK( &ra, &cmn, udp_buf, &rem, &idx ); - - if ( ra.sock.family ) - { - orig_sender = &(ra.sock); - } - - traceEvent(TRACE_INFO, "Rx REGISTER_ACK src=%s dst=%s from peer %s (%s)", - macaddr_str( mac_buf1, ra.srcMac ), - macaddr_str( mac_buf2, ra.dstMac ), - sock_to_cstr(sockbuf1, &sender), - sock_to_cstr(sockbuf2, orig_sender) ); - - /* Move from pending_peers to known_peers; ignore if not in pending. */ - set_peer_operational( eee, ra.srcMac, &sender ); - break; - case MSG_TYPE_REGISTER_SUPER_ACK: - if ( eee->sn_wait ) - { - decode_REGISTER_SUPER_ACK( &rsa, &cmn, udp_buf, &rem, &idx ); - - if ( rsa.sock.family ) - { - orig_sender = &(rsa.sock); - } - - traceEvent(TRACE_NORMAL, "Rx REGISTER_SUPER_ACK myMAC=%s [%s] (external %s). Attempts %u", - macaddr_str( mac_buf1, rsa.edgeMac ), - sock_to_cstr(sockbuf1, &sender), - sock_to_cstr(sockbuf2, orig_sender), - (unsigned int)eee->sup_attempts ); - - if ( 0 == memcmp( rsa.cookie, eee->last_cookie, N2N_COOKIE_SIZE ) ) - { - if ( rsa.num_sn > 0 ) - { - traceEvent(TRACE_NORMAL, "Rx REGISTER_SUPER_ACK backup supernode at %s", - sock_to_cstr(sockbuf1, &(rsa.sn_bak) ) ); - } - - eee->last_p2p = now; - eee->last_sup = now; - eee->sn_wait=0; - eee->sup_attempts = N2N_EDGE_SUP_ATTEMPTS; /* refresh because we got a response */ - -#ifdef __ANDROID_NDK__ - int change = 0; - pthread_mutex_lock(&g_status->mutex); - change = g_status->running_status == EDGE_STAT_CONNECTED ? 0 : 1; - g_status->running_status = EDGE_STAT_CONNECTED; - pthread_mutex_unlock(&g_status->mutex); - if (change) { - g_status->report_edge_status(); - } -#endif /* #ifdef __ANDROID_NDK__ */ - - /* REVISIT: store sn_back */ - /* don't adjust lifetime according to supernode - this value should be specified - * by the client (because dependent on NAT/firewall) (lukas) - eee->holepunch_interval = rsa.lifetime; - eee->holepunch_interval = MAX( eee->holepunch_interval, REGISTER_SUPER_INTERVAL_MIN ); - eee->holepunch_interval = MIN( eee->holepunch_interval, REGISTER_SUPER_INTERVAL_MAX ); - */ - } - else - { - traceEvent( TRACE_WARNING, "Rx REGISTER_SUPER_ACK with wrong or old cookie." ); - } - } - else - { - traceEvent( TRACE_WARNING, "Rx REGISTER_SUPER_ACK with no outstanding REGISTER_SUPER." ); - } - break; - default: - /* Not a known message type */ - traceEvent(TRACE_WARNING, "Unable to handle packet type %d: ignored", (signed int)msg_type); - break; - } /* end switch(msg_type) */ - } /* if (community match) */ - else - { - traceEvent(TRACE_WARNING, "Received packet with invalid community"); - } - -} - -/* ***************************************************** */ - - -#ifdef WIN32 -static DWORD tunReadThread(LPVOID lpArg ) -{ - n2n_edge_t *eee = (n2n_edge_t*)lpArg; - - while(1) - { - readFromTAPSocket(eee); - } - - return((DWORD)NULL); -} - - -/** Start a second thread in Windows because TUNTAP interfaces do not expose - * file descriptors. */ -static void startTunReadThread(n2n_edge_t *eee) -{ - HANDLE hThread; - DWORD dwThreadId; - - hThread = CreateThread(NULL, /* security attributes */ - 0, /* use default stack size */ - (LPTHREAD_START_ROUTINE)tunReadThread, /* thread function */ - (void*)eee, /* argument to thread function */ - 0, /* thread creation flags */ - &dwThreadId); /* thread id out */ -} -#endif - -/* ***************************************************** */ - -/** Resolve the supernode IP address. - * - * REVISIT: This is a really bad idea. The edge will block completely while the - * hostname resolution is performed. This could take 15 seconds. - */ -static void supernode2addr(n2n_sock_t * sn, const n2n_sn_name_t addrIn) -{ - n2n_sn_name_t addr; - const char *supernode_host; - - memcpy( addr, addrIn, N2N_EDGE_SN_HOST_SIZE ); - - supernode_host = strtok(addr, ":"); - - if(supernode_host) - { - in_addr_t sn_addr; - char *supernode_port = strtok(NULL, ":"); - const struct addrinfo aihints = {0, PF_INET, 0, 0, 0, NULL, NULL, NULL}; - struct addrinfo * ainfo = NULL; - int nameerr; - - if ( supernode_port ) - sn->port = atoi(supernode_port); - else - traceEvent(TRACE_WARNING, "Bad supernode parameter (-l ) %s %s:%s", - addr, supernode_host, supernode_port); - - nameerr = getaddrinfo( supernode_host, NULL, &aihints, &ainfo ); - - if( 0 == nameerr ) - { - struct sockaddr_in * saddr; - - /* ainfo s the head of a linked list if non-NULL. */ - if ( ainfo && (PF_INET == ainfo->ai_family) ) - { - /* It is definitely and IPv4 address -> sockaddr_in */ - saddr = (struct sockaddr_in *)ainfo->ai_addr; - - memcpy( sn->addr.v4, &(saddr->sin_addr.s_addr), IPV4_SIZE ); - sn->family=AF_INET; - } - else - { - /* Should only return IPv4 addresses due to aihints. */ - traceEvent(TRACE_WARNING, "Failed to resolve supernode IPv4 address for %s", supernode_host); - } - - freeaddrinfo(ainfo); /* free everything allocated by getaddrinfo(). */ - ainfo = NULL; - } else { - traceEvent(TRACE_WARNING, "Failed to resolve supernode host %s, assuming numeric", supernode_host); - sn_addr = inet_addr(supernode_host); /* uint32_t */ - memcpy( sn->addr.v4, &(sn_addr), IPV4_SIZE ); - sn->family=AF_INET; - } - - } else - traceEvent(TRACE_WARNING, "Wrong supernode parameter (-l )"); -} - -/** Decode local address string (given on command line) - */ -static int localip2addr(n2n_sock_t * l_ip, - const n2n_local_ip_t local_ip_str, int local_port) -{ - /* TODO: IPv6? */ - unsigned int ip[4]; - int i, n_matches; - - n_matches = sscanf( local_ip_str, "%u.%u.%u.%u", &ip[0], &ip[1], &ip[2], - &ip[3]); - - if( n_matches != 4) { - return 0; - } - - for( i=0; i < 4; i++ ) { - if( ip[i] > 255 ) { - return 0; - } - } - l_ip->family = AF_INET; - l_ip->port = local_port; - for( i = 0; i < 4; i++ ) - l_ip->addr.v4[i] = ip[i]; - return 1; -} - -static int set_localip(n2n_edge_t * eee) { - int local_port; - n2n_sock_str_t local_sockbuf; - struct sockaddr_in sa; - - /* Assume failure, until one of the methods succeeds */ - eee->local_sock_ena = 0; - - if (eee->local_ip_str[0] == 0) { - /* Sanity check - cannot use an empty string to set localip */ - traceEvent( TRACE_ERROR, "localip string is empty" ); - return(-1); - } - - socklen_t sa_len = sizeof(sa); - if ( getsockname(eee->udp_sock, (struct sockaddr *) &sa, &sa_len) == -1 ) { - traceEvent( TRACE_ERROR, "getsockname() failed" ); - return(-1); - } - - local_port = ntohs(sa.sin_port); - memset(&(eee->local_sock), 0, sizeof(eee->local_sock)); - - if ( localip2addr( &(eee->local_sock), - eee->local_ip_str, local_port ) ) { - eee->local_sock_ena = 1; - } else if ( 0 == strcmp( eee->local_ip_str, "auto" ) ) { - /* Automatically use a "sane" value for the localip. - * This is currently using the local ip address that is used to - * talk to the supernode, but that could change if a better method - * if found - */ - - SOCKET fd = socket(AF_INET, SOCK_DGRAM, 0); - if (fd < 0) { - traceEvent(TRACE_WARNING, "socket() failed"); - return(-1); - } - - struct sockaddr_in sa_sn; - - fill_sockaddr( (struct sockaddr *) &sa_sn, - sizeof(sa_sn), - &eee->supernode ); - - if ( connect(fd, (struct sockaddr *) &sa_sn, sizeof(sa_sn) ) <0 ) { - close(fd); - traceEvent(TRACE_WARNING, "connect() failed"); - return(-1); - } - - if ( getsockname(fd, (struct sockaddr *) &sa, &sa_len) <0 ) { - close(fd); - traceEvent(TRACE_WARNING, "getsockname() failed"); - return(-1); - } - - if ( AF_INET != sa.sin_family ) { - /* TODO IPV6 */ - close(fd); - traceEvent(TRACE_WARNING, "wrong socket family"); - return(-1); - } - - eee->local_sock.family = sa.sin_family; - eee->local_sock.port = local_port; - memcpy( eee->local_sock.addr.v4, &(sa.sin_addr.s_addr), IPV4_SIZE ); - eee->local_sock_ena = 1; - close(fd); - } - - if (eee->local_sock_ena) { - traceEvent(TRACE_NORMAL, "Local Socket is %s", - sock_to_cstr( local_sockbuf, &(eee->local_sock) ) ); - return(0); - } - - traceEvent(TRACE_WARNING, "Wrong local_ip parameter (-L ip), disabled"); - return(-1); -} - -/* ***************************************************** */ - - -/** Find the address and IP mode for the tuntap device. - * - * s is one of these forms: - * - * := | A.B.C.D - * - * | static: | dhcp: - * - * If the mode is present (colon required) then fill ip_mode with that value - * otherwise do not change ip_mode. Fill ip_mode with everything after the - * colon if it is present; or s if colon is not present. - * - * ip_add and ip_mode are NULL terminated if modified. - * - * return 0 on success and -1 on error - */ -static int scan_address( char * ip_addr, size_t addr_size, - char * ip_mode, size_t mode_size, - const char * s ) -{ - int retval = -1; - char * p; - - if ( ( NULL == s ) || ( NULL == ip_addr) ) - { - return -1; - } - - memset(ip_addr, 0, addr_size); - - p = strpbrk(s, ":"); - - if ( p ) - { - /* colon is present */ - if ( ip_mode ) - { - size_t end=0; - - memset(ip_mode, 0, mode_size); - end = MIN( p-s, (ssize_t)(mode_size-1) ); /* ensure NULL term */ - strncpy( ip_mode, s, end ); - strncpy( ip_addr, p+1, addr_size-1 ); /* ensure NULL term */ - retval = 0; - } - } - else - { - /* colon is not present */ - strncpy( ip_addr, s, addr_size ); - } - - return retval; -} - -static int run_loop(n2n_edge_t * eee ); -int real_main(int argc, char* argv[]); -static n2n_edge_t eee; /* single instance for this program */ - -#define N2N_NETMASK_STR_SIZE 16 /* dotted decimal 12 numbers + 3 dots */ -#define N2N_MACNAMSIZ 18 /* AA:BB:CC:DD:EE:FF + NULL*/ -#define N2N_IF_MODE_SIZE 16 /* static | dhcp */ - -/** Entry point to program from kernel. */ -int real_main(int argc, char* argv[]) -{ - int opt; - int local_port = 0 /* any port */; - int mgmt_port = N2N_EDGE_MGMT_PORT; /* 5644 by default */ - char tuntap_dev_name[N2N_IFNAMSIZ] = "edge0"; - char ip_mode[N2N_IF_MODE_SIZE]="static"; - char ip_addr[N2N_NETMASK_STR_SIZE] = ""; - char netmask[N2N_NETMASK_STR_SIZE]="255.255.255.0"; - int mtu = DEFAULT_MTU; - int got_s = 0; - -#ifndef WIN32 - uid_t userid=0; /* root is the only guaranteed ID */ - gid_t groupid=0; /* root is the only guaranteed ID */ -#endif - - char device_mac[N2N_MACNAMSIZ]=""; - char * encrypt_key=NULL; - - int i, effectiveargc=0; - char ** effectiveargv=NULL; - char * linebuffer = NULL; - - if (-1 == edge_init(&eee) ) - { - traceEvent( TRACE_ERROR, "Failed in edge_init" ); - exit(1); - } - - if( getenv( "N2N_KEY" )) - { - encrypt_key = strdup( getenv( "N2N_KEY" )); - } - -#ifdef WIN32 - tuntap_dev_name[0] = '\0'; -#endif - memset(&(eee.supernode), 0, sizeof(eee.supernode)); - eee.supernode.family = AF_INET; - - linebuffer = (char *)malloc(MAX_CMDLINE_BUFFER_LENGTH); - if (!linebuffer) - { - traceEvent( TRACE_ERROR, "Unable to allocate memory"); - exit(1); - } - snprintf(linebuffer, MAX_CMDLINE_BUFFER_LENGTH, "%s",argv[0]); - -#ifdef WIN32 - for(i=0; i < (int)strlen(linebuffer); i++) - if(linebuffer[i] == '\\') linebuffer[i] = '/'; -#endif - - for(i = 1; i < argc; ++i) - { - if(argv[i][0] == '@') - { - if (readConfFile(&argv[i][1], linebuffer)<0) exit(1); /* <<<<----- check */ - } - else if ((strlen(linebuffer)+strlen(argv[i])+2) < MAX_CMDLINE_BUFFER_LENGTH) - { - strncat(linebuffer, " ", 1); - strncat(linebuffer, argv[i], strlen(argv[i])); - } - else - { - traceEvent( TRACE_ERROR, "too many argument"); - exit(1); - } - } - /* strip trailing spaces */ - while(strlen(linebuffer) && linebuffer[strlen(linebuffer)-1]==' ') - linebuffer[strlen(linebuffer)-1]= '\0'; - - /* build the new argv from the linebuffer */ - effectiveargv = buildargv(&effectiveargc, linebuffer); - -#ifdef WIN32 - /* unfortunately, any cmdline quoting used originally is gone, so we can - * not use the getopt to process the install - */ - if (!_strnicmp(effectiveargv[1], "--install", 9)) { - char *p = strchr(linebuffer,' ') + 1; /* skip the argv[0] */ - char *scm_args = strchr(p,' ') + 1; /* skip the "--install" */ - - printf("Installing service with args '%s'\n", scm_args); - /* request service installation */ - char *path = SCM_Install(&sd,scm_args); - if (!path) { - printf("Service installation failed\n"); - return 2; - } - printf("Service '%s' installed, binary path '%s'\n", sd.name,path); - printf("You should now start the service using the service manager.\n"); - return 1; - } -#endif - - if (linebuffer) - { - free(linebuffer); - linebuffer = NULL; - } - - /* {int k;for(k=0;k 0 ) - { - fprintf(stderr, "Error: -K and -k options are mutually exclusive.\n"); - exit(1); - } else { - encrypt_key = strdup(optarg); - traceEvent(TRACE_DEBUG, "encrypt_key = '%s'\n", encrypt_key); - } - break; - } - case 'r': /* enable packet routing across n2n endpoints */ - { - eee.allow_routing = 1; - break; - } - - case 'l': /* supernode-list */ - { - if ( eee.sn_num < N2N_EDGE_NUM_SUPERNODES ) - { - strncpy( (eee.sn_ip_array[eee.sn_num]), optarg, N2N_EDGE_SN_HOST_SIZE); - traceEvent(TRACE_DEBUG, "Adding supernode[%u] = %s\n", (unsigned int)eee.sn_num, (eee.sn_ip_array[eee.sn_num]) ); - ++eee.sn_num; - } - else - { - fprintf(stderr, "Too many supernodes!\n" ); - exit(1); - } - break; - } - - case 'i': /* holepunch-interval */ - { - eee.holepunch_interval = atoi(optarg); - eee.holepunch_interval = MAX( eee.holepunch_interval, REGISTER_SUPER_INTERVAL_MIN ); - eee.holepunch_interval = MIN( eee.holepunch_interval, REGISTER_SUPER_INTERVAL_MAX ); - break; - } - case 'L': /* local ip */ - { - eee.local_sock_ena = 1; - strncpy( eee.local_ip_str, optarg, N2N_EDGE_LOCAL_IP_SIZE); - if ( N2N_EDGE_LOCAL_IP_SIZE > 0 ) - eee.local_ip_str[N2N_EDGE_LOCAL_IP_SIZE - 1] = '\0'; - traceEvent(TRACE_DEBUG, "Storing local_ip_str = %s\n", (eee.local_ip_str) ); - break; - } - -#if defined(N2N_CAN_NAME_IFACE) - case 'd': /* TUNTAP name */ - { - strncpy(tuntap_dev_name, optarg, N2N_IFNAMSIZ); - break; - } -#endif - - case 'b': - { - eee.re_resolve_supernode_ip = 1; - break; - } - - case 'p': - { - local_port = atoi(optarg); - break; - } - - case 't': - { - mgmt_port = atoi(optarg); - break; - } - - case 's': /* Subnet Mask */ - { - if (0 != got_s) - { - traceEvent(TRACE_WARNING, "Multiple subnet masks supplied."); - } - strncpy(netmask, optarg, N2N_NETMASK_STR_SIZE); - got_s = 1; - break; - } - - case 'h': /* help */ - { - help(); - break; - } - - case 'v': /* verbose */ - { - ++traceLevel; /* do 2 -v flags to increase verbosity to DEBUG level*/ - break; - } - -#ifdef WIN32 - case 'R': /* Remove */ - { - // request service removal - if (SCM_Remove(&sd)==0) { - printf("Deleted service '%s'\n",sd.name); - } else { - printf("Service removal failed\n"); - } - return 1; - } -#endif - - } /* end switch */ - } - - -#ifdef N2N_HAVE_DAEMON - if ( eee.daemon ) - { - useSyslog=1; /* traceEvent output now goes to syslog. */ - if ( -1 == daemon( 0, 0 ) ) - { - traceEvent( TRACE_ERROR, "Failed to become daemon." ); - exit(-5); - } - } -#endif /* #ifdef N2N_HAVE_DAEMON */ - - print_n2n_version(1 /* trace */); - - - for (i=0; i< N2N_EDGE_NUM_SUPERNODES; ++i ) - { - traceEvent( TRACE_NORMAL, "supernode %u => %s\n", i, (eee.sn_ip_array[i]) ); - } - - supernode2addr( &(eee.supernode), eee.sn_ip_array[eee.sn_idx] ); - - - for ( i=0; i 0) - traceEvent(TRACE_NORMAL, "Binding to local port %d", (signed int)local_port); - - if ( encrypt_key ) { - if(edge_init_twofish( &eee, (uint8_t *)(encrypt_key), strlen(encrypt_key) ) < 0) { - fprintf(stderr, "Error: twofish setup failed.\n" ); - return(-1); - } - } else if ( strlen(eee.keyschedule) > 0 ) { - if (edge_init_keyschedule( &eee ) != 0 ) { - fprintf(stderr, "Error: keyschedule setup failed.\n" ); - return(-1); - } - - } - /* else run in NULL mode */ - - - eee.udp_sock = open_socket(local_port, 1 /*bind ANY*/ ); - if(eee.udp_sock < 0) - { - traceEvent( TRACE_ERROR, "Failed to bind main UDP port %u", (signed int)local_port ); - return(-1); - } - - - if(eee.local_sock_ena) { - if ( set_localip(&eee) != 0) { - traceEvent( TRACE_ERROR, "set localip failed" ); - return(-1); - } - } - - eee.udp_mgmt_sock = open_socket(mgmt_port, 0 /* bind LOOPBACK*/ ); - - if(eee.udp_mgmt_sock < 0) - { - traceEvent( TRACE_ERROR, "Failed to bind management UDP port %u", (unsigned int)N2N_EDGE_MGMT_PORT ); - return(-1); - } - - - traceEvent(TRACE_NORMAL, "edge started"); - - update_supernode_reg(&eee, time(NULL) ); - - return run_loop(&eee); -} - -int keep_running=1; -static int run_loop(n2n_edge_t * eee ) -{ - size_t numPurged; - time_t lastIfaceCheck=0; - time_t lastTransop=0; - time_t lastStatCalc=0; - time_t lastStatCalcDiff; - time_t lastLocalIPReResolve=0; - - -#ifdef WIN32 - startTunReadThread(eee); -#endif - - /* Main loop - * - * select() is used to wait for input on either the TAP fd or the UDP/TCP - * socket. When input is present the data is read and processed by either - * readFromIPSocket() or readFromTAPSocket() - */ - - while(keep_running) - { - int rc, max_sock = 0; - fd_set socket_mask; - struct timeval wait_time; - time_t nowTime; - - FD_ZERO(&socket_mask); - FD_SET(eee->udp_sock, &socket_mask); - FD_SET(eee->udp_mgmt_sock, &socket_mask); - max_sock = max( eee->udp_sock, eee->udp_mgmt_sock ); -#ifndef WIN32 - FD_SET(eee->device.fd, &socket_mask); - max_sock = max( max_sock, eee->device.fd ); -#endif - - wait_time.tv_sec = SOCKET_TIMEOUT_INTERVAL_SECS; wait_time.tv_usec = 0; - - rc = select(max_sock+1, &socket_mask, NULL, NULL, &wait_time); - nowTime=time(NULL); - - /* Make sure ciphers are updated before the packet is treated. */ - if ( ( nowTime - lastTransop ) > TRANSOP_TICK_INTERVAL ) - { - lastTransop = nowTime; - - n2n_tick_transop( eee, nowTime ); - } - - if(rc > 0) - { - /* Any or all of the FDs could have input; check them all. */ - - if(FD_ISSET(eee->udp_sock, &socket_mask)) - { - /* Read a cooked socket from the internet socket. Writes on the TAP - * socket. */ - readFromIPSocket(eee); - } - -#ifdef __ANDROID_NDK__ - if (uip_arp_len != 0) { - readFromTAPSocket(eee); - uip_arp_len = 0; - } -#endif /* #ifdef __ANDROID_NDK__ */ - - if(FD_ISSET(eee->udp_mgmt_sock, &socket_mask)) - { - /* Read a cooked socket from the internet socket. Writes on the TAP - * socket. */ - readFromMgmtSocket(eee, &keep_running); - } - -#ifndef WIN32 - if(FD_ISSET(eee->device.fd, &socket_mask)) - { - /* Read an ethernet frame from the TAP socket. Write on the IP - * socket. */ - readFromTAPSocket(eee); - } -#endif - } - - /* Finished processing select data. */ - - - update_supernode_reg(eee, nowTime); - - numPurged = 0; - if ((nowTime - eee->last_purge) >= PURGE_REGISTRATION_FREQUENCY) { - numPurged += hashed_purge_expired_registrations(eee->known_peers); - numPurged += hashed_purge_expired_registrations(eee->pending_peers); - eee->last_purge = nowTime; - } - if ( numPurged > 0 ) - { - traceEvent( TRACE_NORMAL, "Peer removed: pending=%u, operational=%u", - (unsigned int)hashed_peer_list_t_size( eee->pending_peers ), - (unsigned int)hashed_peer_list_t_size( eee->known_peers ) ); - } - - if ( eee->dyn_ip_mode && - (( nowTime - lastIfaceCheck ) > IFACE_UPDATE_INTERVAL ) ) - { - traceEvent(TRACE_NORMAL, "Re-checking dynamic IP address."); - tuntap_get_address( &(eee->device) ); - lastIfaceCheck = nowTime; - } - - if (eee->local_ip_str[0] != 0 && nowTime - lastLocalIPReResolve > LOCALIP_UPDATE_INTERVAL && strncmp(eee->local_ip_str, "auto", sizeof("auto")) == 0) { - traceEvent(TRACE_NORMAL, "Re-resove local socket."); - set_localip(eee); - lastLocalIPReResolve = nowTime; - } - - lastStatCalcDiff = nowTime - lastStatCalc; - if(lastStatCalcDiff > STAT_CALC_INTERVAL) { - // traceEvent(TRACE_NORMAL, "recalc bps."); - eee->tx_bps_p2p = eee->tx_bit_p2p / (size_t)lastStatCalcDiff; - eee->tx_bit_p2p = 0; - eee->tx_bps_sup = eee->tx_bit_sup / (size_t)lastStatCalcDiff; - eee->tx_bit_sup = 0; - eee->rx_bps_p2p = eee->rx_bit_p2p / (size_t)lastStatCalcDiff; - eee->rx_bit_p2p = 0; - eee->rx_bps_sup = eee->rx_bit_sup / (size_t)lastStatCalcDiff; - eee->rx_bit_sup = 0; - lastStatCalc = nowTime; - -#ifdef __ANDROID_NDK__ - uip_arp_timer(); -#endif /* #ifdef __ANDROID_NDK__ */ - } - - } /* while */ - - send_deregister( eee, &(eee->supernode)); - tuntap_close(&(eee->device)); - edge_deinit( eee ); - -#ifdef __ANDROID_NDK__ - traceEvent(TRACE_NORMAL, "Edge stoped."); - if (!slog) { - closeslog(slog); - slog = NULL; - } -#endif /* #ifdef __ANDROID_NDK__ */ - - return(0); -} - -#ifndef __ANDROID_NDK__ -int n2n_main(int argc, char **argv) { - return real_main(argc,argv); -} - -int n2n_stop(void *param1) { - keep_running=0; - return 0; -} - -int main(int argc, char **argv) -{ - if (SCM_Start(&sd,argc,argv)!=SVC_OK) { - return 1; - } - - return 0; -} -#else /* #ifdef __ANDROID_NDK__ */ -int start_edge_v2s(n2n_edge_status_t* status) -{ - int local_port = 0 /* any port */; - char tuntap_dev_name[N2N_IFNAMSIZ] = "tun0"; - char ip_mode[N2N_IF_MODE_SIZE]="static"; - char ip_addr[N2N_NETMASK_STR_SIZE] = ""; - char netmask[N2N_NETMASK_STR_SIZE]="255.255.255.0"; - char device_mac[N2N_MACNAMSIZ]=""; - char * encrypt_key=NULL; - int i; - - if (!status) { - traceEvent( TRACE_ERROR, "Empty cmd struct" ); - return 1; - } - g_status = status; - n2n_edge_cmd_t* cmd = &status->cmd; - - keep_running = 0; - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_CONNECTING; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - - traceLevel = cmd->trace_vlevel; - traceLevel = traceLevel < 0 ? 0 : traceLevel; /* TRACE_ERROR */ - traceLevel = traceLevel > 4 ? 4 : traceLevel; /* TRACE_DEBUG */ - if (!slog) { - closeslog(slog); - slog = NULL; - } - slog = initslog(android_log_level(traceLevel), cmd->logpath); - - if (-1 == edge_init(&eee) ) - { - traceEvent( TRACE_ERROR, "Failed in edge_init" ); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - memset(&(eee.supernode), 0, sizeof(eee.supernode)); - eee.supernode.family = AF_INET; - - if (cmd->vpn_fd < 0) { - traceEvent(TRACE_ERROR, "VPN socket is invalid."); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - eee.device.fd = cmd->vpn_fd; - if (cmd->enc_key_file) - { - strncpy(eee.keyschedule, cmd->enc_key_file, N2N_PATHNAME_MAXLEN-1); - eee.keyschedule[N2N_PATHNAME_MAXLEN-1]=0; /* strncpy does not add NULL if the source has no NULL. */ - traceEvent(TRACE_DEBUG, "keyfile = '%s'\n", eee.keyschedule); - } - else if (cmd->enc_key) - { - encrypt_key = strdup(cmd->enc_key); - traceEvent(TRACE_DEBUG, "encrypt_key = '%s'\n", encrypt_key); - } - - if (cmd->ip_addr[0] != '\0') - { - scan_address(ip_addr, N2N_NETMASK_STR_SIZE, - ip_mode, N2N_IF_MODE_SIZE, - cmd->ip_addr); - } - else - { - traceEvent(TRACE_ERROR, "Ip address is not set."); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - if (cmd->community[0] != '\0') - { - strncpy((char *)eee.community_name, cmd->community, N2N_COMMUNITY_SIZE); - } - else - { - traceEvent(TRACE_ERROR, "Community is not set."); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - eee.drop_multicast = cmd->drop_multicast == 0 ? 0 : 1; - if (cmd->mac_addr[0] != '\0') - { - strncpy(device_mac, cmd->mac_addr, N2N_MACNAMSIZ); - } - else - { - strncpy(device_mac, random_device_mac(), N2N_MACNAMSIZ); - traceEvent(TRACE_DEBUG, "random device mac: %s\n", device_mac); - } - eee.allow_routing = cmd->allow_routing == 0 ? 0 : 1; - for (i = 0; i < N2N_EDGE_NUM_SUPERNODES && i < EDGE_CMD_SUPERNODES_NUM; ++i) - { - if (cmd->supernodes[i][0] != '\0') - { - strncpy(eee.sn_ip_array[eee.sn_num], cmd->supernodes[i], N2N_EDGE_SN_HOST_SIZE); - traceEvent(TRACE_DEBUG, "Adding supernode[%u] = %s\n", (unsigned int)eee.sn_num, (eee.sn_ip_array[eee.sn_num])); - ++eee.sn_num; - } - } - eee.holepunch_interval = cmd->holepunch_interval; - eee.holepunch_interval = MAX(eee.holepunch_interval, REGISTER_SUPER_INTERVAL_MIN); - eee.holepunch_interval = MIN(eee.holepunch_interval, REGISTER_SUPER_INTERVAL_MAX); - if (cmd->local_ip[0] != '\0') - { - eee.local_sock_ena = 1; - strncpy(eee.local_ip_str, cmd->local_ip, N2N_EDGE_LOCAL_IP_SIZE); - if (N2N_EDGE_LOCAL_IP_SIZE > 0) - { - eee.local_ip_str[N2N_EDGE_LOCAL_IP_SIZE - 1] = '\0'; - } - traceEvent(TRACE_DEBUG, "Storing local_ip_str = %s\n", (eee.local_ip_str)); - } - eee.re_resolve_supernode_ip = cmd->re_resolve_supernode_ip == 0 ? 0 : 1; - if (cmd->ip_netmask[0] != '\0') - { - strncpy(netmask, cmd->ip_netmask, N2N_NETMASK_STR_SIZE); - } - - - print_n2n_version(1 /* trace */); - for (i=0; i< N2N_EDGE_NUM_SUPERNODES; ++i ) - { - traceEvent(TRACE_NORMAL, "supernode %u => %s\n", i, (eee.sn_ip_array[i])); - } - supernode2addr(&(eee.supernode), eee.sn_ip_array[eee.sn_idx]); - if (encrypt_key == NULL && strlen(eee.keyschedule) == 0) - { - traceEvent(TRACE_WARNING, "Encryption is disabled in edge."); - eee.null_transop = 1; - } - if (0 == strcmp("dhcp", ip_mode)) - { - traceEvent(TRACE_NORMAL, "Dynamic IP address assignment enabled."); - eee.dyn_ip_mode = 1; - } - else - { - traceEvent(TRACE_NORMAL, "ip_mode='%s'", ip_mode); - } - if(tuntap_open(&(eee.device), tuntap_dev_name, ip_mode, ip_addr, netmask, device_mac, cmd->mtu) < 0) - { - traceEvent(TRACE_ERROR, "Failed in tuntap_open"); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - if(local_port > 0) - { - traceEvent(TRACE_NORMAL, "Binding to local port %d", (signed int)local_port); - } - if (encrypt_key) - { - if(edge_init_twofish(&eee, (uint8_t *)(encrypt_key), strlen(encrypt_key)) < 0) - { - traceEvent(TRACE_ERROR, "twofish setup failed.\n"); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - free(encrypt_key); - encrypt_key = NULL; - } - else if (strlen(eee.keyschedule) > 0) - { - if (edge_init_keyschedule(&eee) != 0) - { - traceEvent(TRACE_ERROR, "keyschedule setup failed.\n"); - free(encrypt_key); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - } - /* else run in NULL mode */ - eee.udp_sock = open_socket(local_port, 1 /*bind ANY*/ ); - if(eee.udp_sock < 0) - { - traceEvent(TRACE_ERROR, "Failed to bind main UDP port %u", (signed int)local_port); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - if(eee.local_sock_ena) - { - if (set_localip(&eee) != 0) - { - traceEvent(TRACE_ERROR, "set localip failed"); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - } - eee.udp_mgmt_sock = open_socket(N2N_EDGE_MGMT_PORT, 0 /* bind LOOPBACK*/ ); - if(eee.udp_mgmt_sock < 0) - { - traceEvent( TRACE_ERROR, "Failed to bind management UDP port %u", (unsigned int)N2N_EDGE_MGMT_PORT ); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - - /* set host addr, netmask, mac addr for UIP and init arp*/ - { - int match, i; - int ip[4]; - uip_ipaddr_t ipaddr; - struct uip_eth_addr eaddr; - - match = sscanf(ip_addr, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan ip failed, ip: %s", ip_addr); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_sethostaddr(ipaddr); - match = sscanf(netmask, "%d.%d.%d.%d", ip, ip + 1, ip + 2, ip + 3); - if (match != 4) { - traceEvent(TRACE_ERROR, "scan netmask error, ip: %s", netmask); - if (!slog) { - closeslog(slog); - slog = NULL; - } - return 1; - } - uip_ipaddr(ipaddr, ip[0], ip[1], ip[2], ip[3]); - uip_setnetmask(ipaddr); - for (i = 0; i < 6; ++i) { - eaddr.addr[i] = eee.device.mac_addr[i]; - } - uip_setethaddr(eaddr); - - uip_arp_init(); - } - - keep_running = 1; - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_CONNECTED; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - traceEvent(TRACE_NORMAL, "edge started"); - - update_supernode_reg(&eee, time(NULL)); - - return run_loop(&eee); -} - -int stop_edge_v2s(void) -{ - keep_running = 0; - - struct sockaddr_in peer_addr; - peer_addr.sin_family = PF_INET; - peer_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - peer_addr.sin_port = htons(N2N_EDGE_MGMT_PORT); - sendto(eee.udp_mgmt_sock, "stop", 4, 0, (struct sockaddr *)&peer_addr, sizeof(struct sockaddr_in)); - - pthread_mutex_lock(&g_status->mutex); - g_status->running_status = EDGE_STAT_DISCONNECT; - pthread_mutex_unlock(&g_status->mutex); - g_status->report_edge_status(); - - return 0; -} -#endif /* #ifdef __ANDROID_NDK__ */ diff --git a/bundles/n2n_meyerd/n2n_v2/gen_keyfile.py b/bundles/n2n_meyerd/n2n_v2/gen_keyfile.py deleted file mode 100644 index b6dc3e67..00000000 --- a/bundles/n2n_meyerd/n2n_v2/gen_keyfile.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -# (c) 2009 Richard Andrews - -# Program to generate a n2n_edge key schedule file for twofish keys -# Each key line consists of the following element -# -# -# where , are UNIX time_t values of key valid period -# is the transform ID (=2 for twofish) -# is twofish-specific data as follows -# _ - -import os -import sys -import time -import random - -NUM_KEYS=30 -KEY_LIFE=300 -KEY_LEN=16 - -now=time.time() -start_sa=random.randint( 0, 0xffffffff ) - -random.seed(now) # note now is a floating point time value - -def rand_key(): - key=str() - for i in range(0,KEY_LEN): - key += "%02x"%( random.randint( 0, 255) ) - - return key - -for i in range(0,NUM_KEYS): - from_time = now + (KEY_LIFE * (i-1) ) - until_time = now + (KEY_LIFE * (i+1) ) - key = rand_key() - sa_idx = start_sa + i - transform_id = random.randint( 2, 3 ) - - sys.stdout.write("%d %d %d %d_%s\n"%(from_time, until_time, transform_id,sa_idx, key) ) - - diff --git a/bundles/n2n_meyerd/n2n_v2/lzoconf.h b/bundles/n2n_meyerd/n2n_v2/lzoconf.h deleted file mode 100644 index cc437f1e..00000000 --- a/bundles/n2n_meyerd/n2n_v2/lzoconf.h +++ /dev/null @@ -1,417 +0,0 @@ -/* lzoconf.h -- configuration for the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __LZOCONF_H_INCLUDED -#define __LZOCONF_H_INCLUDED - -#define LZO_VERSION 0x2030 -#define LZO_VERSION_STRING "2.03" -#define LZO_VERSION_DATE "Apr 30 2008" - -/* internal Autoconf configuration file - only used when building LZO */ -#if defined(LZO_HAVE_CONFIG_H) -# include -#endif -#include -#include - - -/*********************************************************************** -// LZO requires a conforming -************************************************************************/ - -#if !defined(CHAR_BIT) || (CHAR_BIT != 8) -# error "invalid CHAR_BIT" -#endif -#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) -# error "check your compiler installation" -#endif -#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) -# error "your limits.h macros are broken" -#endif - -/* get OS and architecture defines */ -#ifndef __LZODEFS_H_INCLUDED -#include "lzodefs.h" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/*********************************************************************** -// some core defines -************************************************************************/ - -#if !defined(LZO_UINT32_C) -# if (UINT_MAX < LZO_0xffffffffL) -# define LZO_UINT32_C(c) c ## UL -# else -# define LZO_UINT32_C(c) ((c) + 0U) -# endif -#endif - -/* memory checkers */ -#if !defined(__LZO_CHECKER) -# if defined(__BOUNDS_CHECKING_ON) -# define __LZO_CHECKER 1 -# elif defined(__CHECKER__) -# define __LZO_CHECKER 1 -# elif defined(__INSURE__) -# define __LZO_CHECKER 1 -# elif defined(__PURIFY__) -# define __LZO_CHECKER 1 -# endif -#endif - - -/*********************************************************************** -// integral and pointer types -************************************************************************/ - -/* lzo_uint should match size_t */ -#if !defined(LZO_UINT_MAX) -# if defined(LZO_ABI_LLP64) /* WIN64 */ -# if defined(LZO_OS_WIN64) - typedef unsigned __int64 lzo_uint; - typedef __int64 lzo_int; -# else - typedef unsigned long long lzo_uint; - typedef long long lzo_int; -# endif -# define LZO_UINT_MAX 0xffffffffffffffffull -# define LZO_INT_MAX 9223372036854775807LL -# define LZO_INT_MIN (-1LL - LZO_INT_MAX) -# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */ - typedef unsigned int lzo_uint; - typedef int lzo_int; -# define LZO_UINT_MAX UINT_MAX -# define LZO_INT_MAX INT_MAX -# define LZO_INT_MIN INT_MIN -# elif (ULONG_MAX >= LZO_0xffffffffL) - typedef unsigned long lzo_uint; - typedef long lzo_int; -# define LZO_UINT_MAX ULONG_MAX -# define LZO_INT_MAX LONG_MAX -# define LZO_INT_MIN LONG_MIN -# else -# error "lzo_uint" -# endif -#endif - -/* Integral types with 32 bits or more. */ -#if !defined(LZO_UINT32_MAX) -# if (UINT_MAX >= LZO_0xffffffffL) - typedef unsigned int lzo_uint32; - typedef int lzo_int32; -# define LZO_UINT32_MAX UINT_MAX -# define LZO_INT32_MAX INT_MAX -# define LZO_INT32_MIN INT_MIN -# elif (ULONG_MAX >= LZO_0xffffffffL) - typedef unsigned long lzo_uint32; - typedef long lzo_int32; -# define LZO_UINT32_MAX ULONG_MAX -# define LZO_INT32_MAX LONG_MAX -# define LZO_INT32_MIN LONG_MIN -# else -# error "lzo_uint32" -# endif -#endif - -/* The larger type of lzo_uint and lzo_uint32. */ -#if (LZO_UINT_MAX >= LZO_UINT32_MAX) -# define lzo_xint lzo_uint -#else -# define lzo_xint lzo_uint32 -#endif - -/* Memory model that allows to access memory at offsets of lzo_uint. */ -#if !defined(__LZO_MMODEL) -# if (LZO_UINT_MAX <= UINT_MAX) -# define __LZO_MMODEL -# elif defined(LZO_HAVE_MM_HUGE_PTR) -# define __LZO_MMODEL_HUGE 1 -# define __LZO_MMODEL __huge -# else -# define __LZO_MMODEL -# endif -#endif - -/* no typedef here because of const-pointer issues */ -#define lzo_bytep unsigned char __LZO_MMODEL * -#define lzo_charp char __LZO_MMODEL * -#define lzo_voidp void __LZO_MMODEL * -#define lzo_shortp short __LZO_MMODEL * -#define lzo_ushortp unsigned short __LZO_MMODEL * -#define lzo_uint32p lzo_uint32 __LZO_MMODEL * -#define lzo_int32p lzo_int32 __LZO_MMODEL * -#define lzo_uintp lzo_uint __LZO_MMODEL * -#define lzo_intp lzo_int __LZO_MMODEL * -#define lzo_xintp lzo_xint __LZO_MMODEL * -#define lzo_voidpp lzo_voidp __LZO_MMODEL * -#define lzo_bytepp lzo_bytep __LZO_MMODEL * -/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */ -#define lzo_byte unsigned char __LZO_MMODEL - -typedef int lzo_bool; - - -/*********************************************************************** -// function types -************************************************************************/ - -/* name mangling */ -#if !defined(__LZO_EXTERN_C) -# ifdef __cplusplus -# define __LZO_EXTERN_C extern "C" -# else -# define __LZO_EXTERN_C extern -# endif -#endif - -/* calling convention */ -#if !defined(__LZO_CDECL) -# define __LZO_CDECL __lzo_cdecl -#endif - -/* DLL export information */ -#if !defined(__LZO_EXPORT1) -# define __LZO_EXPORT1 -#endif -#if !defined(__LZO_EXPORT2) -# define __LZO_EXPORT2 -#endif - -/* __cdecl calling convention for public C and assembly functions */ -#if !defined(LZO_PUBLIC) -# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL -#endif -#if !defined(LZO_EXTERN) -# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype) -#endif -#if !defined(LZO_PRIVATE) -# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL -#endif - -/* function types */ -typedef int -(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem, - const lzo_bytep dict, lzo_uint dict_len ); - -typedef int -(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem, - const lzo_bytep dict, lzo_uint dict_len ); - - -/* Callback interface. Currently only the progress indicator ("nprogress") - * is used, but this may change in a future release. */ - -struct lzo_callback_t; -typedef struct lzo_callback_t lzo_callback_t; -#define lzo_callback_p lzo_callback_t __LZO_MMODEL * - -/* malloc & free function types */ -typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t) - (lzo_callback_p self, lzo_uint items, lzo_uint size); -typedef void (__LZO_CDECL *lzo_free_func_t) - (lzo_callback_p self, lzo_voidp ptr); - -/* a progress indicator callback function */ -typedef void (__LZO_CDECL *lzo_progress_func_t) - (lzo_callback_p, lzo_uint, lzo_uint, int); - -struct lzo_callback_t -{ - /* custom allocators (set to 0 to disable) */ - lzo_alloc_func_t nalloc; /* [not used right now] */ - lzo_free_func_t nfree; /* [not used right now] */ - - /* a progress indicator callback function (set to 0 to disable) */ - lzo_progress_func_t nprogress; - - /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress - * callbacks points back to this struct, so you are free to store - * some extra info in the following variables. */ - lzo_voidp user1; - lzo_xint user2; - lzo_xint user3; -}; - - -/*********************************************************************** -// error codes and prototypes -************************************************************************/ - -/* Error codes for the compression/decompression functions. Negative - * values are errors, positive values will be used for special but - * normal events. - */ -#define LZO_E_OK 0 -#define LZO_E_ERROR (-1) -#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */ -#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ -#define LZO_E_INPUT_OVERRUN (-4) -#define LZO_E_OUTPUT_OVERRUN (-5) -#define LZO_E_LOOKBEHIND_OVERRUN (-6) -#define LZO_E_EOF_NOT_FOUND (-7) -#define LZO_E_INPUT_NOT_CONSUMED (-8) -#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ - - -#ifndef lzo_sizeof_dict_t -# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep)) -#endif - -/* lzo_init() should be the first function you call. - * Check the return code ! - * - * lzo_init() is a macro to allow checking that the library and the - * compiler's view of various types are consistent. - */ -#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ - (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\ - (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ - (int)sizeof(lzo_callback_t)) -LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int); - -/* version functions (useful for shared libraries) */ -LZO_EXTERN(unsigned) lzo_version(void); -LZO_EXTERN(const char *) lzo_version_string(void); -LZO_EXTERN(const char *) lzo_version_date(void); -LZO_EXTERN(const lzo_charp) _lzo_version_string(void); -LZO_EXTERN(const lzo_charp) _lzo_version_date(void); - -/* string functions */ -LZO_EXTERN(int) -lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len); -LZO_EXTERN(lzo_voidp) -lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); -LZO_EXTERN(lzo_voidp) -lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); -LZO_EXTERN(lzo_voidp) -lzo_memset(lzo_voidp _s, int _c, lzo_uint _len); - -/* checksum functions */ -LZO_EXTERN(lzo_uint32) -lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len); -LZO_EXTERN(lzo_uint32) -lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len); -LZO_EXTERN(const lzo_uint32p) -lzo_get_crc32_table(void); - -/* misc. */ -LZO_EXTERN(int) _lzo_config_check(void); -typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u; -typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u; -typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t; - -/* align a char pointer on a boundary that is a multiple of `size' */ -LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size); -#define LZO_PTR_ALIGN_UP(_ptr,_size) \ - ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size))) - - -/*********************************************************************** -// deprecated macros - only for backward compatibility with LZO v1.xx -************************************************************************/ - -#if defined(LZO_CFG_COMPAT) - -#define __LZOCONF_H 1 - -#if defined(LZO_ARCH_I086) -# define __LZO_i386 1 -#elif defined(LZO_ARCH_I386) -# define __LZO_i386 1 -#endif - -#if defined(LZO_OS_DOS16) -# define __LZO_DOS 1 -# define __LZO_DOS16 1 -#elif defined(LZO_OS_DOS32) -# define __LZO_DOS 1 -#elif defined(LZO_OS_WIN16) -# define __LZO_WIN 1 -# define __LZO_WIN16 1 -#elif defined(LZO_OS_WIN32) -# define __LZO_WIN 1 -#endif - -#define __LZO_CMODEL -#define __LZO_DMODEL -#define __LZO_ENTRY __LZO_CDECL -#define LZO_EXTERN_CDECL LZO_EXTERN -#define LZO_ALIGN LZO_PTR_ALIGN_UP - -#define lzo_compress_asm_t lzo_compress_t -#define lzo_decompress_asm_t lzo_decompress_t - -#endif /* LZO_CFG_COMPAT */ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* already included */ - - -/* vim:set ts=4 et: */ diff --git a/bundles/n2n_meyerd/n2n_v2/lzodefs.h b/bundles/n2n_meyerd/n2n_v2/lzodefs.h deleted file mode 100644 index 18056372..00000000 --- a/bundles/n2n_meyerd/n2n_v2/lzodefs.h +++ /dev/null @@ -1,1807 +0,0 @@ -/* lzodefs.h -- architecture, OS and compiler specific defines - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __LZODEFS_H_INCLUDED -#define __LZODEFS_H_INCLUDED 1 - -#if defined(__CYGWIN32__) && !defined(__CYGWIN__) -# define __CYGWIN__ __CYGWIN32__ -#endif -#if defined(__IBMCPP__) && !defined(__IBMC__) -# define __IBMC__ __IBMCPP__ -#endif -#if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) -# define __INTEL_COMPILER __ICL -#endif -#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) -# define _ALL_SOURCE 1 -#endif -#if defined(__mips__) && defined(__R5900__) -# if !defined(__LONG_MAX__) -# define __LONG_MAX__ 9223372036854775807L -# endif -#endif -#if defined(__INTEL_COMPILER) && defined(__linux__) -# pragma warning(disable: 193) -#endif -#if defined(__KEIL__) && defined(__C166__) -# pragma warning disable = 322 -#elif 0 && defined(__C251__) -# pragma warning disable = 322 -#endif -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -# if (_MSC_VER >= 1300) -# pragma warning(disable: 4668) -# endif -#endif -#if 0 && defined(__WATCOMC__) -# if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) -# pragma warning 203 9 -# endif -#endif -#if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) -# pragma option -h -#endif -#if 0 -#define LZO_0xffffL 0xfffful -#define LZO_0xffffffffL 0xfffffffful -#else -#define LZO_0xffffL 65535ul -#define LZO_0xffffffffL 4294967295ul -#endif -#if (LZO_0xffffL == LZO_0xffffffffL) -# error "your preprocessor is broken 1" -#endif -#if (16ul * 16384ul != 262144ul) -# error "your preprocessor is broken 2" -#endif -#if 0 -#if (32767 >= 4294967295ul) -# error "your preprocessor is broken 3" -#endif -#if (65535u >= 4294967295ul) -# error "your preprocessor is broken 4" -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) -# if !defined(MSDOS) -# define MSDOS 1 -# endif -# if !defined(_MSDOS) -# define _MSDOS 1 -# endif -#elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) -# if (__VERSION == 520) && (MB_LEN_MAX == 1) -# if !defined(__AZTEC_C__) -# define __AZTEC_C__ __VERSION -# endif -# if !defined(__DOS__) -# define __DOS__ 1 -# endif -# endif -#endif -#endif -#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) -# define ptrdiff_t long -# define _PTRDIFF_T_DEFINED -#endif -#if (UINT_MAX == LZO_0xffffL) -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -# if defined(__AZTEC_C__) && defined(__DOS__) -# define __LZO_RENAME_A 1 -# elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define __LZO_RENAME_A 1 -# elif (_MSC_VER < 700) -# define __LZO_RENAME_B 1 -# endif -# elif defined(__TSC__) && defined(__OS2__) -# define __LZO_RENAME_A 1 -# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) -# define __LZO_RENAME_A 1 -# elif defined(__PACIFIC__) && defined(DOS) -# if !defined(__far) -# define __far far -# endif -# if !defined(__near) -# define __near near -# endif -# endif -# if defined(__LZO_RENAME_A) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif -# if !defined(__huge) -# define __huge huge -# endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# if !defined(__huge) -# define __huge huge -# endif -# elif defined(__LZO_RENAME_B) -# if !defined(__cdecl) -# define __cdecl _cdecl -# endif -# if !defined(__far) -# define __far _far -# endif -# if !defined(__huge) -# define __huge _huge -# endif -# if !defined(__near) -# define __near _near -# endif -# if !defined(__pascal) -# define __pascal _pascal -# endif -# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# endif -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__AZTEC_C__) && defined(__DOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -#elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# endif -# if (_MSC_VER < 700) -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# define LZO_BROKEN_SIZEOF 1 -# endif -#elif defined(__PACIFIC__) && defined(DOS) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#elif defined(__TURBOC__) && defined(__MSDOS__) -# if (__TURBOC__ < 0x0150) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# endif -# if (__TURBOC__ < 0x0200) -# define LZO_BROKEN_SIZEOF 1 -# endif -# if (__TURBOC__ < 0x0400) && defined(__cplusplus) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# endif -#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_SIZEOF 1 -#endif -#endif -#if defined(__WATCOMC__) && (__WATCOMC__ < 900) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#endif -#if defined(_CRAY) && defined(_CRAY1) -# define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 -#endif -#define LZO_PP_STRINGIZE(x) #x -#define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -#define LZO_PP_CONCAT2(a,b) a ## b -#define LZO_PP_CONCAT3(a,b,c) a ## b ## c -#define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) -#define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) -#define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) -#define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -#if 1 -#define LZO_CPP_STRINGIZE(x) #x -#define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -#define LZO_CPP_CONCAT2(a,b) a ## b -#define LZO_CPP_CONCAT3(a,b,c) a ## b ## c -#define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) -#define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) -#define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) -#define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -#endif -#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) -#if 1 && defined(__cplusplus) -# if !defined(__STDC_CONSTANT_MACROS) -# define __STDC_CONSTANT_MACROS 1 -# endif -# if !defined(__STDC_LIMIT_MACROS) -# define __STDC_LIMIT_MACROS 1 -# endif -#endif -#if defined(__cplusplus) -# define LZO_EXTERN_C extern "C" -#else -# define LZO_EXTERN_C extern -#endif -#if !defined(__LZO_OS_OVERRIDE) -#if defined(LZO_OS_FREESTANDING) -# define LZO_INFO_OS "freestanding" -#elif defined(LZO_OS_EMBEDDED) -# define LZO_INFO_OS "embedded" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_OS_EMBEDDED 1 -# define LZO_INFO_OS "embedded" -#elif defined(__CYGWIN__) && defined(__GNUC__) -# define LZO_OS_CYGWIN 1 -# define LZO_INFO_OS "cygwin" -#elif defined(__EMX__) && defined(__GNUC__) -# define LZO_OS_EMX 1 -# define LZO_INFO_OS "emx" -#elif defined(__BEOS__) -# define LZO_OS_BEOS 1 -# define LZO_INFO_OS "beos" -#elif defined(__Lynx__) -# define LZO_OS_LYNXOS 1 -# define LZO_INFO_OS "lynxos" -#elif defined(__OS400__) -# define LZO_OS_OS400 1 -# define LZO_INFO_OS "os400" -#elif defined(__QNX__) -# define LZO_OS_QNX 1 -# define LZO_INFO_OS "qnx" -#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__BORLANDC__) && defined(__DPMI16__) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -#elif defined(__ZTC__) && defined(DOS386) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__OS2__) || defined(__OS2V2__) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_OS216 1 -# define LZO_INFO_OS "os216" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_OS2 1 -# define LZO_INFO_OS "os2" -# else -# error "check your limits.h header" -# endif -#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) -# define LZO_OS_WIN64 1 -# define LZO_INFO_OS "win64" -#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__MWERKS__) && defined(__INTEL__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_WIN16 1 -# define LZO_INFO_OS "win16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# else -# error "check your limits.h header" -# endif -#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -# else -# error "check your limits.h header" -# endif -#elif defined(__WATCOMC__) -# if defined(__NT__) && (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif defined(__NT__) && (__WATCOMC__ < 1100) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# elif defined(__linux__) || defined(__LINUX__) -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -# else -# error "please specify a target using the -bt compiler option" -# endif -#elif defined(__palmos__) -# define LZO_OS_PALMOS 1 -# define LZO_INFO_OS "palmos" -#elif defined(__TOS__) || defined(__atarist__) -# define LZO_OS_TOS 1 -# define LZO_INFO_OS "tos" -#elif defined(macintosh) && !defined(__ppc__) -# define LZO_OS_MACCLASSIC 1 -# define LZO_INFO_OS "macclassic" -#elif defined(__VMS) -# define LZO_OS_VMS 1 -# define LZO_INFO_OS "vms" -#elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PS2 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "ps2" -#elif (defined(__mips__) && defined(__psp__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PSP 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "psp" -#else -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -#endif -#if (LZO_OS_POSIX) -# if defined(_AIX) || defined(__AIX__) || defined(__aix__) -# define LZO_OS_POSIX_AIX 1 -# define LZO_INFO_OS_POSIX "aix" -# elif defined(__FreeBSD__) -# define LZO_OS_POSIX_FREEBSD 1 -# define LZO_INFO_OS_POSIX "freebsd" -# elif defined(__hpux__) || defined(__hpux) -# define LZO_OS_POSIX_HPUX 1 -# define LZO_INFO_OS_POSIX "hpux" -# elif defined(__INTERIX) -# define LZO_OS_POSIX_INTERIX 1 -# define LZO_INFO_OS_POSIX "interix" -# elif defined(__IRIX__) || defined(__irix__) -# define LZO_OS_POSIX_IRIX 1 -# define LZO_INFO_OS_POSIX "irix" -# elif defined(__linux__) || defined(__linux) || defined(__LINUX__) -# define LZO_OS_POSIX_LINUX 1 -# define LZO_INFO_OS_POSIX "linux" -# elif defined(__APPLE__) || defined(__MACOS__) -# define LZO_OS_POSIX_MACOSX 1 -# define LZO_INFO_OS_POSIX "macosx" -# elif defined(__minix__) || defined(__minix) -# define LZO_OS_POSIX_MINIX 1 -# define LZO_INFO_OS_POSIX "minix" -# elif defined(__NetBSD__) -# define LZO_OS_POSIX_NETBSD 1 -# define LZO_INFO_OS_POSIX "netbsd" -# elif defined(__OpenBSD__) -# define LZO_OS_POSIX_OPENBSD 1 -# define LZO_INFO_OS_POSIX "openbsd" -# elif defined(__osf__) -# define LZO_OS_POSIX_OSF 1 -# define LZO_INFO_OS_POSIX "osf" -# elif defined(__solaris__) || defined(__sun) -# if defined(__SVR4) || defined(__svr4__) -# define LZO_OS_POSIX_SOLARIS 1 -# define LZO_INFO_OS_POSIX "solaris" -# else -# define LZO_OS_POSIX_SUNOS 1 -# define LZO_INFO_OS_POSIX "sunos" -# endif -# elif defined(__ultrix__) || defined(__ultrix) -# define LZO_OS_POSIX_ULTRIX 1 -# define LZO_INFO_OS_POSIX "ultrix" -# elif defined(_UNICOS) -# define LZO_OS_POSIX_UNICOS 1 -# define LZO_INFO_OS_POSIX "unicos" -# else -# define LZO_OS_POSIX_UNKNOWN 1 -# define LZO_INFO_OS_POSIX "unknown" -# endif -#endif -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (UINT_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -# define LZO_CC_CILLY 1 -# define LZO_INFO_CC "Cilly" -# if defined(__CILLY__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) -# define LZO_CC_SDCC 1 -# define LZO_INFO_CC "sdcc" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) -#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) -# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) -# define LZO_INFO_CC "Pathscale C" -# define LZO_INFO_CCVER __PATHSCALE__ -#elif defined(__INTEL_COMPILER) -# define LZO_CC_INTELC 1 -# define LZO_INFO_CC "Intel C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) -# if defined(_WIN32) || defined(_WIN64) -# define LZO_CC_SYNTAX_MSC 1 -# else -# define LZO_CC_SYNTAX_GNUC 1 -# endif -#elif defined(__POCC__) && defined(_WIN32) -# define LZO_CC_PELLESC 1 -# define LZO_INFO_CC "Pelles C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# else -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# endif -# define LZO_INFO_CC "llvm-gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# elif defined(__GNUC_MINOR__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# else -# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -# endif -# define LZO_INFO_CC "gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__ACK__) && defined(_ACK) -# define LZO_CC_ACK 1 -# define LZO_INFO_CC "Amsterdam Compiler Kit C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__AZTEC_C__) -# define LZO_CC_AZTECC 1 -# define LZO_INFO_CC "Aztec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) -#elif defined(__BORLANDC__) -# define LZO_CC_BORLANDC 1 -# define LZO_INFO_CC "Borland C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) -#elif defined(_CRAYC) && defined(_RELEASE) -# define LZO_CC_CRAYC 1 -# define LZO_INFO_CC "Cray C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) -#elif defined(__DMC__) && defined(__SC__) -# define LZO_CC_DMC 1 -# define LZO_INFO_CC "Digital Mars C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) -#elif defined(__DECC) -# define LZO_CC_DECC 1 -# define LZO_INFO_CC "DEC C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -#elif defined(__HIGHC__) -# define LZO_CC_HIGHC 1 -# define LZO_INFO_CC "MetaWare High C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__IAR_SYSTEMS_ICC__) -# define LZO_CC_IARC 1 -# define LZO_INFO_CC "IAR C" -# if defined(__VER__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__IBMC__) -# define LZO_CC_IBMC 1 -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -#elif defined(__KEIL__) && defined(__C166__) -# define LZO_CC_KEILC 1 -# define LZO_INFO_CC "Keil C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) -#elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) -# define LZO_CC_LCCWIN32 1 -# define LZO_INFO_CC "lcc-win32" -# define LZO_INFO_CCVER "unknown" -#elif defined(__LCC__) -# define LZO_CC_LCC 1 -# define LZO_INFO_CC "lcc" -# if defined(__LCC_VERSION__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(_MSC_VER) -# define LZO_CC_MSC 1 -# define LZO_INFO_CC "Microsoft C" -# if defined(_MSC_FULL_VER) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -# endif -#elif defined(__MWERKS__) -# define LZO_CC_MWERKS 1 -# define LZO_INFO_CC "Metrowerks C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) -#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -# define LZO_CC_NDPC 1 -# define LZO_INFO_CC "Microway NDP C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PACIFIC__) -# define LZO_CC_PACIFICC 1 -# define LZO_INFO_CC "Pacific C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) -# define LZO_CC_PGI 1 -# define LZO_INFO_CC "Portland Group PGI C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PUREC__) && defined(__TOS__) -# define LZO_CC_PUREC 1 -# define LZO_INFO_CC "Pure C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) -#elif defined(__SC__) && defined(__ZTC__) -# define LZO_CC_SYMANTECC 1 -# define LZO_INFO_CC "Symantec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) -#elif defined(__SUNPRO_C) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_C)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_C -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__SUNPRO_CC) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_CC)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_CC -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__TINYC__) -# define LZO_CC_TINYC 1 -# define LZO_INFO_CC "Tiny C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) -#elif defined(__TSC__) -# define LZO_CC_TOPSPEEDC 1 -# define LZO_INFO_CC "TopSpeed C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) -#elif defined(__WATCOMC__) -# define LZO_CC_WATCOMC 1 -# define LZO_INFO_CC "Watcom C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) -#elif defined(__TURBOC__) -# define LZO_CC_TURBOC 1 -# define LZO_INFO_CC "Turbo C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) -#elif defined(__ZTC__) -# define LZO_CC_ZORTECHC 1 -# define LZO_INFO_CC "Zortech C" -# if (__ZTC__ == 0x310) -# define LZO_INFO_CCVER "0x310" -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) -# endif -#else -# define LZO_CC_UNKNOWN 1 -# define LZO_INFO_CC "unknown" -# define LZO_INFO_CCVER "unknown" -#endif -#if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) -# error "LZO_CC_MSC: _MSC_FULL_VER is not defined" -#endif -#if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) -# if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) -# if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) -# define LZO_ARCH_CRAY_MPP 1 -# elif defined(_CRAY1) -# define LZO_ARCH_CRAY_PVP 1 -# endif -# endif -#endif -#if !defined(__LZO_ARCH_OVERRIDE) -#if defined(LZO_ARCH_GENERIC) -# define LZO_INFO_ARCH "generic" -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086 1 -# define LZO_ARCH_IA16 1 -# define LZO_INFO_ARCH "i086" -#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) -# define LZO_ARCH_AMD64 1 -# define LZO_INFO_ARCH "amd64" -#elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB)) -# define LZO_ARCH_ARM 1 -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) -# define LZO_ARCH_ARM 1 -# if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -# elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) -# define LZO_INFO_ARCH "arm" -# else -# define LZO_INFO_ARCH "arm" -# endif -#elif defined(__arm__) || defined(_M_ARM) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) -# define LZO_ARCH_AVR 1 -# define LZO_INFO_ARCH "avr" -#elif defined(__bfin__) -# define LZO_ARCH_BLACKFIN 1 -# define LZO_INFO_ARCH "blackfin" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) -# define LZO_ARCH_C166 1 -# define LZO_INFO_ARCH "c166" -#elif defined(__cris__) -# define LZO_ARCH_CRIS 1 -# define LZO_INFO_ARCH "cris" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) -# define LZO_ARCH_EZ80 1 -# define LZO_INFO_ARCH "ez80" -#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_ARCH_H8300 1 -# define LZO_INFO_ARCH "h8300" -#elif defined(__hppa__) || defined(__hppa) -# define LZO_ARCH_HPPA 1 -# define LZO_INFO_ARCH "hppa" -#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_CC_ZORTECHC && defined(__I86__)) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) -# define LZO_ARCH_IA64 1 -# define LZO_INFO_ARCH "ia64" -#elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__m32r__) -# define LZO_ARCH_M32R 1 -# define LZO_INFO_ARCH "m32r" -#elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) -# define LZO_ARCH_M68K 1 -# define LZO_INFO_ARCH "m68k" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) -# define LZO_ARCH_MCS251 1 -# define LZO_INFO_ARCH "mcs251" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) -# define LZO_ARCH_MIPS 1 -# define LZO_INFO_ARCH "mips" -#elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) -# define LZO_ARCH_S390 1 -# define LZO_INFO_ARCH "s390" -#elif defined(__sh__) || defined(_M_SH) -# define LZO_ARCH_SH 1 -# define LZO_INFO_ARCH "sh" -#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) -# define LZO_ARCH_SPARC 1 -# define LZO_INFO_ARCH "sparc" -#elif defined(__SPU__) -# define LZO_ARCH_SPU 1 -# define LZO_INFO_ARCH "spu" -#elif (UINT_MAX == LZO_0xffffL) && defined(__z80) -# define LZO_ARCH_Z80 1 -# define LZO_INFO_ARCH "z80" -#elif (LZO_ARCH_CRAY_PVP) -# if defined(_CRAYSV1) -# define LZO_ARCH_CRAY_SV1 1 -# define LZO_INFO_ARCH "cray_sv1" -# elif (_ADDR64) -# define LZO_ARCH_CRAY_T90 1 -# define LZO_INFO_ARCH "cray_t90" -# elif (_ADDR32) -# define LZO_ARCH_CRAY_YMP 1 -# define LZO_INFO_ARCH "cray_ymp" -# else -# define LZO_ARCH_CRAY_XMP 1 -# define LZO_INFO_ARCH "cray_xmp" -# endif -#else -# define LZO_ARCH_UNKNOWN 1 -# define LZO_INFO_ARCH "unknown" -#endif -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) -# error "FIXME - missing define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) -# error "FIXME - missing WIN32 define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) -# error "FIXME - missing WIN64 define for CPU architecture" -#endif -#if (LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(BLX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#endif -#if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) -# error "this should not happen" -#endif -#if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) -# error "this should not happen" -#endif -#if (LZO_ARCH_I086) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_ARCH_I386) -# if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) -# error "this should not happen" -# endif -# if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if !defined(__LZO_MM_OVERRIDE) -#if (LZO_ARCH_I086) -#if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -#endif -#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) -# define LZO_MM_TINY 1 -#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) -# define LZO_MM_HUGE 1 -#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) -# define LZO_MM_SMALL 1 -#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) -# define LZO_MM_MEDIUM 1 -#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) -# define LZO_MM_COMPACT 1 -#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) -# define LZO_MM_LARGE 1 -#elif (LZO_CC_AZTECC) -# if defined(_LARGE_CODE) && defined(_LARGE_DATA) -# define LZO_MM_LARGE 1 -# elif defined(_LARGE_CODE) -# define LZO_MM_MEDIUM 1 -# elif defined(_LARGE_DATA) -# define LZO_MM_COMPACT 1 -# else -# define LZO_MM_SMALL 1 -# endif -#elif (LZO_CC_ZORTECHC && defined(__VCM__)) -# define LZO_MM_LARGE 1 -#else -# error "unknown memory model" -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -#define LZO_HAVE_MM_HUGE_PTR 1 -#define LZO_HAVE_MM_HUGE_ARRAY 1 -#if (LZO_MM_TINY) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) -# undef LZO_HAVE_MM_HUGE_PTR -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_MSC && defined(_QC)) -# undef LZO_HAVE_MM_HUGE_ARRAY -# if (_MSC_VER < 600) -# undef LZO_HAVE_MM_HUGE_PTR -# endif -#elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) -# if (LZO_OS_DOS16) -# error "this should not happen" -# elif (LZO_CC_ZORTECHC) -# else -# error "this should not happen" -# endif -#endif -#ifdef __cplusplus -extern "C" { -#endif -#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) -# define LZO_MM_AHSHIFT 12 -#elif (LZO_CC_WATCOMC) - extern unsigned char _HShift; -# define LZO_MM_AHSHIFT ((unsigned) _HShift) -#else -# error "FIXME - implement LZO_MM_AHSHIFT" -#endif -#ifdef __cplusplus -} -#endif -#endif -#elif (LZO_ARCH_C166) -#if !defined(__MODEL__) -# error "FIXME - C166 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - C166 __MODEL__" -#endif -#elif (LZO_ARCH_MCS251) -#if !defined(__MODEL__) -# error "FIXME - MCS251 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS251 __MODEL__" -#endif -#elif (LZO_ARCH_MCS51) -#if !defined(__MODEL__) -# error "FIXME - MCS51 __MODEL__" -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS51 __MODEL__" -#endif -#elif (LZO_ARCH_CRAY_PVP) -# define LZO_MM_PVP 1 -#else -# define LZO_MM_FLAT 1 -#endif -#if (LZO_MM_COMPACT) -# define LZO_INFO_MM "compact" -#elif (LZO_MM_FLAT) -# define LZO_INFO_MM "flat" -#elif (LZO_MM_HUGE) -# define LZO_INFO_MM "huge" -#elif (LZO_MM_LARGE) -# define LZO_INFO_MM "large" -#elif (LZO_MM_MEDIUM) -# define LZO_INFO_MM "medium" -#elif (LZO_MM_PVP) -# define LZO_INFO_MM "pvp" -#elif (LZO_MM_SMALL) -# define LZO_INFO_MM "small" -#elif (LZO_MM_TINY) -# define LZO_INFO_MM "tiny" -#else -# error "unknown memory model" -#endif -#endif -#if defined(SIZEOF_SHORT) -# define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -#endif -#if defined(SIZEOF_INT) -# define LZO_SIZEOF_INT (SIZEOF_INT) -#endif -#if defined(SIZEOF_LONG) -# define LZO_SIZEOF_LONG (SIZEOF_LONG) -#endif -#if defined(SIZEOF_LONG_LONG) -# define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -#endif -#if defined(SIZEOF___INT16) -# define LZO_SIZEOF___INT16 (SIZEOF___INT16) -#endif -#if defined(SIZEOF___INT32) -# define LZO_SIZEOF___INT32 (SIZEOF___INT32) -#endif -#if defined(SIZEOF___INT64) -# define LZO_SIZEOF___INT64 (SIZEOF___INT64) -#endif -#if defined(SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -#endif -#if defined(SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -#endif -#if defined(SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -#endif -#define __LZO_LSR(x,b) (((x)+0ul) >> (b)) -#if !defined(LZO_SIZEOF_SHORT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_SHORT 8 -# elif (USHRT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,7) == 1) -# define LZO_SIZEOF_SHORT 1 -# elif (__LZO_LSR(USHRT_MAX,15) == 1) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,31) == 1) -# define LZO_SIZEOF_SHORT 4 -# elif (__LZO_LSR(USHRT_MAX,63) == 1) -# define LZO_SIZEOF_SHORT 8 -# elif (__LZO_LSR(USHRT_MAX,127) == 1) -# define LZO_SIZEOF_SHORT 16 -# else -# error "LZO_SIZEOF_SHORT" -# endif -#endif -#if !defined(LZO_SIZEOF_INT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_INT 8 -# elif (UINT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_INT 2 -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,7) == 1) -# define LZO_SIZEOF_INT 1 -# elif (__LZO_LSR(UINT_MAX,15) == 1) -# define LZO_SIZEOF_INT 2 -# elif (__LZO_LSR(UINT_MAX,31) == 1) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,63) == 1) -# define LZO_SIZEOF_INT 8 -# elif (__LZO_LSR(UINT_MAX,127) == 1) -# define LZO_SIZEOF_INT 16 -# else -# error "LZO_SIZEOF_INT" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG) -# if (ULONG_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,7) == 1) -# define LZO_SIZEOF_LONG 1 -# elif (__LZO_LSR(ULONG_MAX,15) == 1) -# define LZO_SIZEOF_LONG 2 -# elif (__LZO_LSR(ULONG_MAX,31) == 1) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,63) == 1) -# define LZO_SIZEOF_LONG 8 -# elif (__LZO_LSR(ULONG_MAX,127) == 1) -# define LZO_SIZEOF_LONG 16 -# else -# error "LZO_SIZEOF_LONG" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -# if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) -# if (LZO_CC_GNUC >= 0x030300ul) -# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) -# define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG -# elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) -# define LZO_SIZEOF_LONG_LONG 4 -# endif -# endif -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -#if (LZO_ARCH_I086 && LZO_CC_DMC) -#elif (LZO_CC_CILLY) && defined(__GNUC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_SIZEOF_LONG_LONG 8 -#elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_OS_WIN64 || defined(_WIN64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_DMC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) -#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define LZO_SIZEOF_LONG_LONG 8 -#endif -#endif -#endif -#if defined(__cplusplus) && defined(LZO_CC_GNUC) -# if (LZO_CC_GNUC < 0x020800ul) -# undef LZO_SIZEOF_LONG_LONG -# endif -#endif -#if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#endif -#if !defined(LZO_SIZEOF_VOID_P) -#if (LZO_ARCH_I086) -# define __LZO_WORDSIZE 2 -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -# define LZO_SIZEOF_VOID_P 2 -# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -# define LZO_SIZEOF_VOID_P 4 -# else -# error "LZO_MM" -# endif -#elif (LZO_ARCH_AVR || LZO_ARCH_Z80) -# define __LZO_WORDSIZE 1 -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_H8300) -# if defined(__NORMAL_MODE__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 2 -# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 4 -# else -# define __LZO_WORDSIZE 2 -# define LZO_SIZEOF_VOID_P 2 -# endif -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT -# endif -#elif (LZO_ARCH_M16C) -# define __LZO_WORDSIZE 2 -# if defined(__m32c_cpu__) || defined(__m32cm_cpu__) -# define LZO_SIZEOF_VOID_P 4 -# else -# define LZO_SIZEOF_VOID_P 2 -# endif -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 4 -#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_OS_OS400 || defined(__OS400__)) -# define __LZO_WORDSIZE LZO_SIZEOF_LONG -# define LZO_SIZEOF_VOID_P 16 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_ARCH_SPU) -# if 0 -# define __LZO_WORDSIZE 16 -# endif -# define LZO_SIZEOF_VOID_P 4 -#else -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -#endif -#endif -#if !defined(LZO_WORDSIZE) -# if defined(__LZO_WORDSIZE) -# define LZO_WORDSIZE __LZO_WORDSIZE -# else -# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -# endif -#endif -#if !defined(LZO_SIZEOF_SIZE_T) -#if (LZO_ARCH_I086 || LZO_ARCH_M16C) -# define LZO_SIZEOF_SIZE_T 2 -#else -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P -#endif -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -#if (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P -# elif (LZO_MM_COMPACT || LZO_MM_LARGE) -# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) -# define LZO_SIZEOF_PTRDIFF_T 4 -# else -# define LZO_SIZEOF_PTRDIFF_T 2 -# endif -# else -# error "LZO_MM" -# endif -#else -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T -#endif -#endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) -# undef LZO_ABI_BIG_ENDIAN -# undef LZO_ABI_LITTLE_ENDIAN -#elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) -#if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) -# define LZO_ABI_BIG_ENDIAN 1 -#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_M68K || LZO_ARCH_S390) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) -# if (__LITTLE_ENDIAN__ == 1) -# define LZO_ABI_LITTLE_ENDIAN 1 -# else -# define LZO_ABI_BIG_ENDIAN 1 -# endif -#elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#endif -#endif -#if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) -# error "this should not happen" -#endif -#if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "be" -#elif defined(LZO_ABI_LITTLE_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "le" -#elif defined(LZO_ABI_NEUTRAL_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "neutral" -#endif -#if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_I8LP16 1 -# define LZO_INFO_ABI_PM "i8lp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_ILP16 1 -# define LZO_INFO_ABI_PM "ilp16" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_ILP32 1 -# define LZO_INFO_ABI_PM "ilp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) -# define LZO_ABI_LLP64 1 -# define LZO_INFO_ABI_PM "llp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_LP64 1 -# define LZO_INFO_ABI_PM "lp64" -#elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_ILP64 1 -# define LZO_INFO_ABI_PM "ilp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_IP32L64 1 -# define LZO_INFO_ABI_PM "ip32l64" -#endif -#if !defined(__LZO_LIBC_OVERRIDE) -#if defined(LZO_LIBC_NAKED) -# define LZO_INFO_LIBC "naked" -#elif defined(LZO_LIBC_FREESTANDING) -# define LZO_INFO_LIBC "freestanding" -#elif defined(LZO_LIBC_MOSTLY_FREESTANDING) -# define LZO_INFO_LIBC "mfreestanding" -#elif defined(LZO_LIBC_ISOC90) -# define LZO_INFO_LIBC "isoc90" -#elif defined(LZO_LIBC_ISOC99) -# define LZO_INFO_LIBC "isoc99" -#elif defined(__dietlibc__) -# define LZO_LIBC_DIETLIBC 1 -# define LZO_INFO_LIBC "dietlibc" -#elif defined(_NEWLIB_VERSION) -# define LZO_LIBC_NEWLIB 1 -# define LZO_INFO_LIBC "newlib" -#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) -# if defined(__UCLIBC_SUBLEVEL__) -# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) -# else -# define LZO_LIBC_UCLIBC 0x00090bL -# endif -# define LZO_INFO_LIBC "uclibc" -#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) -# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) -# define LZO_INFO_LIBC "glibc" -#elif (LZO_CC_MWERKS) && defined(__MSL__) -# define LZO_LIBC_MSL __MSL__ -# define LZO_INFO_LIBC "msl" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#else -# define LZO_LIBC_DEFAULT 1 -# define LZO_INFO_LIBC "default" -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -#if (LZO_CC_GNUC >= 0x020800ul) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_gnuc_extension__ __extension__ -#else -# define __lzo_gnuc_extension__ -#endif -#endif -#if !defined(__lzo_ua_volatile) -# define __lzo_ua_volatile volatile -#endif -#if !defined(__lzo_alignof) -#if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_alignof(e) __alignof(e) -#endif -#endif -#if defined(__lzo_alignof) -# define __lzo_HAVE_alignof 1 -#endif -#if !defined(__lzo_constructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_constructor __attribute__((__constructor__)) -#endif -#endif -#if defined(__lzo_constructor) -# define __lzo_HAVE_constructor 1 -#endif -#if !defined(__lzo_destructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_destructor __attribute__((__destructor__)) -#endif -#endif -#if defined(__lzo_destructor) -# define __lzo_HAVE_destructor 1 -#endif -#if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) -# error "this should not happen" -#endif -#if !defined(__lzo_inline) -#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -#elif defined(__cplusplus) -# define __lzo_inline inline -#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -# define __lzo_inline __inline -#elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_inline __inline__ -#elif (LZO_CC_DMC) -# define __lzo_inline __inline -#elif (LZO_CC_INTELC) -# define __lzo_inline __inline -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -# define __lzo_inline __inline -#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -# define __lzo_inline __inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define __lzo_inline inline -#endif -#endif -#if defined(__lzo_inline) -# define __lzo_HAVE_inline 1 -#else -# define __lzo_inline -#endif -#if !defined(__lzo_forceinline) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_forceinline __forceinline -#endif -#endif -#if defined(__lzo_forceinline) -# define __lzo_HAVE_forceinline 1 -#else -# define __lzo_forceinline -#endif -#if !defined(__lzo_noinline) -#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -# define __lzo_noinline __attribute__((__noinline__,__used__)) -#elif (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -# if defined(__cplusplus) -# else -# define __lzo_noinline __declspec(noinline) -# endif -#endif -#endif -#if defined(__lzo_noinline) -# define __lzo_HAVE_noinline 1 -#else -# define __lzo_noinline -#endif -#if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) -# error "this should not happen" -#endif -#if !defined(__lzo_noreturn) -#if (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_noreturn __declspec(noreturn) -#endif -#endif -#if defined(__lzo_noreturn) -# define __lzo_HAVE_noreturn 1 -#else -# define __lzo_noreturn -#endif -#if !defined(__lzo_nothrow) -#if (LZO_CC_GNUC >= 0x030300ul) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#endif -#endif -#if defined(__lzo_nothrow) -# define __lzo_HAVE_nothrow 1 -#else -# define __lzo_nothrow -#endif -#if !defined(__lzo_restrict) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_LLVM) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -# define __lzo_restrict __restrict -#endif -#endif -#if defined(__lzo_restrict) -# define __lzo_HAVE_restrict 1 -#else -# define __lzo_restrict -#endif -#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#endif -#endif -#if defined(__lzo_likely) -# define __lzo_HAVE_likely 1 -#else -# define __lzo_likely(e) (e) -#endif -#if defined(__lzo_unlikely) -# define __lzo_HAVE_unlikely 1 -#else -# define __lzo_unlikely(e) (e) -#endif -#if !defined(LZO_UNUSED) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNUSED(var) ((void) var) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_KEILC) -# define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} -# elif (LZO_CC_PACIFICC) -# define LZO_UNUSED(var) ((void) sizeof(var)) -# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED(var) ((void) var) -# else -# define LZO_UNUSED(var) ((void) &var) -# endif -#endif -#if !defined(LZO_UNUSED_FUNC) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED_FUNC(func) ((void) func) -# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_LLVM) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_MSC) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -# define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} -# else -# define LZO_UNUSED_FUNC(func) ((void) func) -# endif -#endif -#if !defined(LZO_UNUSED_LABEL) -# if (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# elif (LZO_CC_INTELC || LZO_CC_WATCOMC) -# define LZO_UNUSED_LABEL(l) if (0) goto l -# else -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# endif -#endif -#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -# if 0 -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -# elif 0 && (LZO_CC_GNUC) -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -# else -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# else -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT) -# if (LZO_CC_AZTECC) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} -# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# else -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} -# endif -#endif -#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit -# define __lzo_cdecl_main __cdecl -# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_qsort __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_qsort _stdcall -# else -# define __lzo_cdecl_qsort __cdecl -# endif -# elif (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -# else -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit __cdecl -# define __lzo_cdecl_main __cdecl -# define __lzo_cdecl_qsort __cdecl -# endif -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_sighandler __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_sighandler _stdcall -# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -# define __lzo_cdecl_sighandler __clrcall -# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -# if defined(_DLL) -# define __lzo_cdecl_sighandler _far _cdecl _loadds -# elif defined(_MT) -# define __lzo_cdecl_sighandler _far _cdecl -# else -# define __lzo_cdecl_sighandler _cdecl -# endif -# else -# define __lzo_cdecl_sighandler __cdecl -# endif -#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -# define __lzo_cdecl cdecl -#endif -#if !defined(__lzo_cdecl) -# define __lzo_cdecl -#endif -#if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit -#endif -#if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main -#endif -#if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort -#endif -#if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler -#endif -#if !defined(__lzo_cdecl_va) -# define __lzo_cdecl_va __lzo_cdecl -#endif -#if !defined(LZO_CFG_NO_WINDOWS_H) -#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) -# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -# else -# define LZO_HAVE_WINDOWS_H 1 -# endif -#endif -#endif -#if (LZO_ARCH_ALPHA) -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_AMD64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# define LZO_OPT_UNALIGNED64 1 -#elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) -#elif (LZO_ARCH_ARM) -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_CRIS) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_I386) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_IA64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_PREFER_POSTINC 1 -#elif (LZO_ARCH_M68K) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(__mc68020__) && !defined(__mcoldfire__) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_MIPS) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_POWERPC) -# define LZO_OPT_PREFER_PREINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_S390) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# if (LZO_SIZEOF_SIZE_T == 8) -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_SH) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -#endif -#if !defined(LZO_CFG_NO_INLINE_ASM) -#if defined(LZO_CC_LLVM) -# define LZO_CFG_NO_INLINE_ASM 1 -#endif -#endif -#if !defined(LZO_CFG_NO_UNALIGNED) -#if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) -# define LZO_CFG_NO_UNALIGNED 1 -#endif -#endif -#if defined(LZO_CFG_NO_UNALIGNED) -# undef LZO_OPT_UNALIGNED16 -# undef LZO_OPT_UNALIGNED32 -# undef LZO_OPT_UNALIGNED64 -#endif -#if defined(LZO_CFG_NO_INLINE_ASM) -#elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -# define LZO_ASM_SYNTAX_MSC 1 -#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#endif -#if (LZO_ASM_SYNTAX_GNUC) -#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -# define __LZO_ASM_CLOBBER "ax" -#elif (LZO_CC_INTELC) -# define __LZO_ASM_CLOBBER "memory" -#else -# define __LZO_ASM_CLOBBER "cc", "memory" -#endif -#endif -#if defined(__LZO_INFOSTR_MM) -#elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) -# define __LZO_INFOSTR_MM "" -#elif defined(LZO_INFO_MM) -# define __LZO_INFOSTR_MM "." LZO_INFO_MM -#else -# define __LZO_INFOSTR_MM "" -#endif -#if defined(__LZO_INFOSTR_PM) -#elif defined(LZO_INFO_ABI_PM) -# define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM -#else -# define __LZO_INFOSTR_PM "" -#endif -#if defined(__LZO_INFOSTR_ENDIAN) -#elif defined(LZO_INFO_ABI_ENDIAN) -# define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN -#else -# define __LZO_INFOSTR_ENDIAN "" -#endif -#if defined(__LZO_INFOSTR_OSNAME) -#elif defined(LZO_INFO_OS_CONSOLE) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE -#elif defined(LZO_INFO_OS_POSIX) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX -#else -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS -#endif -#if defined(__LZO_INFOSTR_LIBC) -#elif defined(LZO_INFO_LIBC) -# define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC -#else -# define __LZO_INFOSTR_LIBC "" -#endif -#if defined(__LZO_INFOSTR_CCVER) -#elif defined(LZO_INFO_CCVER) -# define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER -#else -# define __LZO_INFOSTR_CCVER "" -#endif -#define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER - -#endif /* already included */ - -/* vim:set ts=4 et: */ diff --git a/bundles/n2n_meyerd/n2n_v2/minilzo.c b/bundles/n2n_meyerd/n2n_v2/minilzo.c deleted file mode 100644 index 6a62b31b..00000000 --- a/bundles/n2n_meyerd/n2n_v2/minilzo.c +++ /dev/null @@ -1,4112 +0,0 @@ -/* minilzo.c -- mini subset of the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - -/* - * NOTE: - * the full LZO package can be found at - * http://www.oberhumer.com/opensource/lzo/ - */ - -#define __LZO_IN_MINILZO -#define LZO_BUILD - -#if defined(LZO_CFG_FREESTANDING) -# undef MINILZO_HAVE_CONFIG_H -# define LZO_LIBC_FREESTANDING 1 -# define LZO_OS_FREESTANDING 1 -#endif - -#ifdef MINILZO_HAVE_CONFIG_H -# include -#endif -#include -#include -#if defined(MINILZO_CFG_USE_INTERNAL_LZODEFS) - -#ifndef __LZODEFS_H_INCLUDED -#define __LZODEFS_H_INCLUDED 1 - -#if defined(__CYGWIN32__) && !defined(__CYGWIN__) -# define __CYGWIN__ __CYGWIN32__ -#endif -#if defined(__IBMCPP__) && !defined(__IBMC__) -# define __IBMC__ __IBMCPP__ -#endif -#if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) -# define __INTEL_COMPILER __ICL -#endif -#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) -# define _ALL_SOURCE 1 -#endif -#if defined(__mips__) && defined(__R5900__) -# if !defined(__LONG_MAX__) -# define __LONG_MAX__ 9223372036854775807L -# endif -#endif -#if defined(__INTEL_COMPILER) && defined(__linux__) -# pragma warning(disable: 193) -#endif -#if defined(__KEIL__) && defined(__C166__) -# pragma warning disable = 322 -#elif 0 && defined(__C251__) -# pragma warning disable = 322 -#endif -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -# if (_MSC_VER >= 1300) -# pragma warning(disable: 4668) -# endif -#endif -#if 0 && defined(__WATCOMC__) -# if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) -# pragma warning 203 9 -# endif -#endif -#if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) -# pragma option -h -#endif -#if 0 -#define LZO_0xffffL 0xfffful -#define LZO_0xffffffffL 0xfffffffful -#else -#define LZO_0xffffL 65535ul -#define LZO_0xffffffffL 4294967295ul -#endif -#if (LZO_0xffffL == LZO_0xffffffffL) -# error "your preprocessor is broken 1" -#endif -#if (16ul * 16384ul != 262144ul) -# error "your preprocessor is broken 2" -#endif -#if 0 -#if (32767 >= 4294967295ul) -# error "your preprocessor is broken 3" -#endif -#if (65535u >= 4294967295ul) -# error "your preprocessor is broken 4" -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) -# if !defined(MSDOS) -# define MSDOS 1 -# endif -# if !defined(_MSDOS) -# define _MSDOS 1 -# endif -#elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) -# if (__VERSION == 520) && (MB_LEN_MAX == 1) -# if !defined(__AZTEC_C__) -# define __AZTEC_C__ __VERSION -# endif -# if !defined(__DOS__) -# define __DOS__ 1 -# endif -# endif -#endif -#endif -#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) -# define ptrdiff_t long -# define _PTRDIFF_T_DEFINED -#endif -#if (UINT_MAX == LZO_0xffffL) -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -# if defined(__AZTEC_C__) && defined(__DOS__) -# define __LZO_RENAME_A 1 -# elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define __LZO_RENAME_A 1 -# elif (_MSC_VER < 700) -# define __LZO_RENAME_B 1 -# endif -# elif defined(__TSC__) && defined(__OS2__) -# define __LZO_RENAME_A 1 -# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) -# define __LZO_RENAME_A 1 -# elif defined(__PACIFIC__) && defined(DOS) -# if !defined(__far) -# define __far far -# endif -# if !defined(__near) -# define __near near -# endif -# endif -# if defined(__LZO_RENAME_A) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif -# if !defined(__huge) -# define __huge huge -# endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# if !defined(__huge) -# define __huge huge -# endif -# elif defined(__LZO_RENAME_B) -# if !defined(__cdecl) -# define __cdecl _cdecl -# endif -# if !defined(__far) -# define __far _far -# endif -# if !defined(__huge) -# define __huge _huge -# endif -# if !defined(__near) -# define __near _near -# endif -# if !defined(__pascal) -# define __pascal _pascal -# endif -# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# endif -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__AZTEC_C__) && defined(__DOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -#elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# endif -# if (_MSC_VER < 700) -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# define LZO_BROKEN_SIZEOF 1 -# endif -#elif defined(__PACIFIC__) && defined(DOS) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#elif defined(__TURBOC__) && defined(__MSDOS__) -# if (__TURBOC__ < 0x0150) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# endif -# if (__TURBOC__ < 0x0200) -# define LZO_BROKEN_SIZEOF 1 -# endif -# if (__TURBOC__ < 0x0400) && defined(__cplusplus) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# endif -#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_SIZEOF 1 -#endif -#endif -#if defined(__WATCOMC__) && (__WATCOMC__ < 900) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#endif -#if defined(_CRAY) && defined(_CRAY1) -# define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 -#endif -#define LZO_PP_STRINGIZE(x) #x -#define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -#define LZO_PP_CONCAT2(a,b) a ## b -#define LZO_PP_CONCAT3(a,b,c) a ## b ## c -#define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) -#define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) -#define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) -#define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -#if 1 -#define LZO_CPP_STRINGIZE(x) #x -#define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -#define LZO_CPP_CONCAT2(a,b) a ## b -#define LZO_CPP_CONCAT3(a,b,c) a ## b ## c -#define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) -#define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) -#define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) -#define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -#endif -#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) -#if 1 && defined(__cplusplus) -# if !defined(__STDC_CONSTANT_MACROS) -# define __STDC_CONSTANT_MACROS 1 -# endif -# if !defined(__STDC_LIMIT_MACROS) -# define __STDC_LIMIT_MACROS 1 -# endif -#endif -#if defined(__cplusplus) -# define LZO_EXTERN_C extern "C" -#else -# define LZO_EXTERN_C extern -#endif -#if !defined(__LZO_OS_OVERRIDE) -#if defined(LZO_OS_FREESTANDING) -# define LZO_INFO_OS "freestanding" -#elif defined(LZO_OS_EMBEDDED) -# define LZO_INFO_OS "embedded" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_OS_EMBEDDED 1 -# define LZO_INFO_OS "embedded" -#elif defined(__CYGWIN__) && defined(__GNUC__) -# define LZO_OS_CYGWIN 1 -# define LZO_INFO_OS "cygwin" -#elif defined(__EMX__) && defined(__GNUC__) -# define LZO_OS_EMX 1 -# define LZO_INFO_OS "emx" -#elif defined(__BEOS__) -# define LZO_OS_BEOS 1 -# define LZO_INFO_OS "beos" -#elif defined(__Lynx__) -# define LZO_OS_LYNXOS 1 -# define LZO_INFO_OS "lynxos" -#elif defined(__OS400__) -# define LZO_OS_OS400 1 -# define LZO_INFO_OS "os400" -#elif defined(__QNX__) -# define LZO_OS_QNX 1 -# define LZO_INFO_OS "qnx" -#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__BORLANDC__) && defined(__DPMI16__) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -#elif defined(__ZTC__) && defined(DOS386) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__OS2__) || defined(__OS2V2__) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_OS216 1 -# define LZO_INFO_OS "os216" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_OS2 1 -# define LZO_INFO_OS "os2" -# else -# error "check your limits.h header" -# endif -#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) -# define LZO_OS_WIN64 1 -# define LZO_INFO_OS "win64" -#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__MWERKS__) && defined(__INTEL__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_WIN16 1 -# define LZO_INFO_OS "win16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# else -# error "check your limits.h header" -# endif -#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -# else -# error "check your limits.h header" -# endif -#elif defined(__WATCOMC__) -# if defined(__NT__) && (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif defined(__NT__) && (__WATCOMC__ < 1100) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# elif defined(__linux__) || defined(__LINUX__) -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -# else -# error "please specify a target using the -bt compiler option" -# endif -#elif defined(__palmos__) -# define LZO_OS_PALMOS 1 -# define LZO_INFO_OS "palmos" -#elif defined(__TOS__) || defined(__atarist__) -# define LZO_OS_TOS 1 -# define LZO_INFO_OS "tos" -#elif defined(macintosh) && !defined(__ppc__) -# define LZO_OS_MACCLASSIC 1 -# define LZO_INFO_OS "macclassic" -#elif defined(__VMS) -# define LZO_OS_VMS 1 -# define LZO_INFO_OS "vms" -#elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PS2 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "ps2" -#elif (defined(__mips__) && defined(__psp__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PSP 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "psp" -#else -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -#endif -#if (LZO_OS_POSIX) -# if defined(_AIX) || defined(__AIX__) || defined(__aix__) -# define LZO_OS_POSIX_AIX 1 -# define LZO_INFO_OS_POSIX "aix" -# elif defined(__FreeBSD__) -# define LZO_OS_POSIX_FREEBSD 1 -# define LZO_INFO_OS_POSIX "freebsd" -# elif defined(__hpux__) || defined(__hpux) -# define LZO_OS_POSIX_HPUX 1 -# define LZO_INFO_OS_POSIX "hpux" -# elif defined(__INTERIX) -# define LZO_OS_POSIX_INTERIX 1 -# define LZO_INFO_OS_POSIX "interix" -# elif defined(__IRIX__) || defined(__irix__) -# define LZO_OS_POSIX_IRIX 1 -# define LZO_INFO_OS_POSIX "irix" -# elif defined(__linux__) || defined(__linux) || defined(__LINUX__) -# define LZO_OS_POSIX_LINUX 1 -# define LZO_INFO_OS_POSIX "linux" -# elif defined(__APPLE__) || defined(__MACOS__) -# define LZO_OS_POSIX_MACOSX 1 -# define LZO_INFO_OS_POSIX "macosx" -# elif defined(__minix__) || defined(__minix) -# define LZO_OS_POSIX_MINIX 1 -# define LZO_INFO_OS_POSIX "minix" -# elif defined(__NetBSD__) -# define LZO_OS_POSIX_NETBSD 1 -# define LZO_INFO_OS_POSIX "netbsd" -# elif defined(__OpenBSD__) -# define LZO_OS_POSIX_OPENBSD 1 -# define LZO_INFO_OS_POSIX "openbsd" -# elif defined(__osf__) -# define LZO_OS_POSIX_OSF 1 -# define LZO_INFO_OS_POSIX "osf" -# elif defined(__solaris__) || defined(__sun) -# if defined(__SVR4) || defined(__svr4__) -# define LZO_OS_POSIX_SOLARIS 1 -# define LZO_INFO_OS_POSIX "solaris" -# else -# define LZO_OS_POSIX_SUNOS 1 -# define LZO_INFO_OS_POSIX "sunos" -# endif -# elif defined(__ultrix__) || defined(__ultrix) -# define LZO_OS_POSIX_ULTRIX 1 -# define LZO_INFO_OS_POSIX "ultrix" -# elif defined(_UNICOS) -# define LZO_OS_POSIX_UNICOS 1 -# define LZO_INFO_OS_POSIX "unicos" -# else -# define LZO_OS_POSIX_UNKNOWN 1 -# define LZO_INFO_OS_POSIX "unknown" -# endif -#endif -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (UINT_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -# define LZO_CC_CILLY 1 -# define LZO_INFO_CC "Cilly" -# if defined(__CILLY__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) -# define LZO_CC_SDCC 1 -# define LZO_INFO_CC "sdcc" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) -#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) -# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) -# define LZO_INFO_CC "Pathscale C" -# define LZO_INFO_CCVER __PATHSCALE__ -#elif defined(__INTEL_COMPILER) -# define LZO_CC_INTELC 1 -# define LZO_INFO_CC "Intel C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) -# if defined(_WIN32) || defined(_WIN64) -# define LZO_CC_SYNTAX_MSC 1 -# else -# define LZO_CC_SYNTAX_GNUC 1 -# endif -#elif defined(__POCC__) && defined(_WIN32) -# define LZO_CC_PELLESC 1 -# define LZO_INFO_CC "Pelles C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# else -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# endif -# define LZO_INFO_CC "llvm-gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# elif defined(__GNUC_MINOR__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# else -# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -# endif -# define LZO_INFO_CC "gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__ACK__) && defined(_ACK) -# define LZO_CC_ACK 1 -# define LZO_INFO_CC "Amsterdam Compiler Kit C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__AZTEC_C__) -# define LZO_CC_AZTECC 1 -# define LZO_INFO_CC "Aztec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) -#elif defined(__BORLANDC__) -# define LZO_CC_BORLANDC 1 -# define LZO_INFO_CC "Borland C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) -#elif defined(_CRAYC) && defined(_RELEASE) -# define LZO_CC_CRAYC 1 -# define LZO_INFO_CC "Cray C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) -#elif defined(__DMC__) && defined(__SC__) -# define LZO_CC_DMC 1 -# define LZO_INFO_CC "Digital Mars C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) -#elif defined(__DECC) -# define LZO_CC_DECC 1 -# define LZO_INFO_CC "DEC C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -#elif defined(__HIGHC__) -# define LZO_CC_HIGHC 1 -# define LZO_INFO_CC "MetaWare High C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__IAR_SYSTEMS_ICC__) -# define LZO_CC_IARC 1 -# define LZO_INFO_CC "IAR C" -# if defined(__VER__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__IBMC__) -# define LZO_CC_IBMC 1 -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -#elif defined(__KEIL__) && defined(__C166__) -# define LZO_CC_KEILC 1 -# define LZO_INFO_CC "Keil C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) -#elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) -# define LZO_CC_LCCWIN32 1 -# define LZO_INFO_CC "lcc-win32" -# define LZO_INFO_CCVER "unknown" -#elif defined(__LCC__) -# define LZO_CC_LCC 1 -# define LZO_INFO_CC "lcc" -# if defined(__LCC_VERSION__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(_MSC_VER) -# define LZO_CC_MSC 1 -# define LZO_INFO_CC "Microsoft C" -# if defined(_MSC_FULL_VER) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -# endif -#elif defined(__MWERKS__) -# define LZO_CC_MWERKS 1 -# define LZO_INFO_CC "Metrowerks C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) -#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -# define LZO_CC_NDPC 1 -# define LZO_INFO_CC "Microway NDP C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PACIFIC__) -# define LZO_CC_PACIFICC 1 -# define LZO_INFO_CC "Pacific C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) -# define LZO_CC_PGI 1 -# define LZO_INFO_CC "Portland Group PGI C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PUREC__) && defined(__TOS__) -# define LZO_CC_PUREC 1 -# define LZO_INFO_CC "Pure C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) -#elif defined(__SC__) && defined(__ZTC__) -# define LZO_CC_SYMANTECC 1 -# define LZO_INFO_CC "Symantec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) -#elif defined(__SUNPRO_C) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_C)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_C -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__SUNPRO_CC) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_CC)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_CC -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__TINYC__) -# define LZO_CC_TINYC 1 -# define LZO_INFO_CC "Tiny C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) -#elif defined(__TSC__) -# define LZO_CC_TOPSPEEDC 1 -# define LZO_INFO_CC "TopSpeed C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) -#elif defined(__WATCOMC__) -# define LZO_CC_WATCOMC 1 -# define LZO_INFO_CC "Watcom C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) -#elif defined(__TURBOC__) -# define LZO_CC_TURBOC 1 -# define LZO_INFO_CC "Turbo C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) -#elif defined(__ZTC__) -# define LZO_CC_ZORTECHC 1 -# define LZO_INFO_CC "Zortech C" -# if (__ZTC__ == 0x310) -# define LZO_INFO_CCVER "0x310" -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) -# endif -#else -# define LZO_CC_UNKNOWN 1 -# define LZO_INFO_CC "unknown" -# define LZO_INFO_CCVER "unknown" -#endif -#if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) -# error "LZO_CC_MSC: _MSC_FULL_VER is not defined" -#endif -#if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) -# if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) -# if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) -# define LZO_ARCH_CRAY_MPP 1 -# elif defined(_CRAY1) -# define LZO_ARCH_CRAY_PVP 1 -# endif -# endif -#endif -#if !defined(__LZO_ARCH_OVERRIDE) -#if defined(LZO_ARCH_GENERIC) -# define LZO_INFO_ARCH "generic" -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086 1 -# define LZO_ARCH_IA16 1 -# define LZO_INFO_ARCH "i086" -#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) -# define LZO_ARCH_AMD64 1 -# define LZO_INFO_ARCH "amd64" -#elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB)) -# define LZO_ARCH_ARM 1 -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) -# define LZO_ARCH_ARM 1 -# if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -# elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) -# define LZO_INFO_ARCH "arm" -# else -# define LZO_INFO_ARCH "arm" -# endif -#elif defined(__arm__) || defined(_M_ARM) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) -# define LZO_ARCH_AVR 1 -# define LZO_INFO_ARCH "avr" -#elif defined(__bfin__) -# define LZO_ARCH_BLACKFIN 1 -# define LZO_INFO_ARCH "blackfin" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) -# define LZO_ARCH_C166 1 -# define LZO_INFO_ARCH "c166" -#elif defined(__cris__) -# define LZO_ARCH_CRIS 1 -# define LZO_INFO_ARCH "cris" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) -# define LZO_ARCH_EZ80 1 -# define LZO_INFO_ARCH "ez80" -#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_ARCH_H8300 1 -# define LZO_INFO_ARCH "h8300" -#elif defined(__hppa__) || defined(__hppa) -# define LZO_ARCH_HPPA 1 -# define LZO_INFO_ARCH "hppa" -#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_CC_ZORTECHC && defined(__I86__)) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) -# define LZO_ARCH_IA64 1 -# define LZO_INFO_ARCH "ia64" -#elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__m32r__) -# define LZO_ARCH_M32R 1 -# define LZO_INFO_ARCH "m32r" -#elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) -# define LZO_ARCH_M68K 1 -# define LZO_INFO_ARCH "m68k" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) -# define LZO_ARCH_MCS251 1 -# define LZO_INFO_ARCH "mcs251" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) -# define LZO_ARCH_MIPS 1 -# define LZO_INFO_ARCH "mips" -#elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) -# define LZO_ARCH_S390 1 -# define LZO_INFO_ARCH "s390" -#elif defined(__sh__) || defined(_M_SH) -# define LZO_ARCH_SH 1 -# define LZO_INFO_ARCH "sh" -#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) -# define LZO_ARCH_SPARC 1 -# define LZO_INFO_ARCH "sparc" -#elif defined(__SPU__) -# define LZO_ARCH_SPU 1 -# define LZO_INFO_ARCH "spu" -#elif (UINT_MAX == LZO_0xffffL) && defined(__z80) -# define LZO_ARCH_Z80 1 -# define LZO_INFO_ARCH "z80" -#elif (LZO_ARCH_CRAY_PVP) -# if defined(_CRAYSV1) -# define LZO_ARCH_CRAY_SV1 1 -# define LZO_INFO_ARCH "cray_sv1" -# elif (_ADDR64) -# define LZO_ARCH_CRAY_T90 1 -# define LZO_INFO_ARCH "cray_t90" -# elif (_ADDR32) -# define LZO_ARCH_CRAY_YMP 1 -# define LZO_INFO_ARCH "cray_ymp" -# else -# define LZO_ARCH_CRAY_XMP 1 -# define LZO_INFO_ARCH "cray_xmp" -# endif -#else -# define LZO_ARCH_UNKNOWN 1 -# define LZO_INFO_ARCH "unknown" -#endif -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) -# error "FIXME - missing define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) -# error "FIXME - missing WIN32 define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) -# error "FIXME - missing WIN64 define for CPU architecture" -#endif -#if (LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(BLX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#endif -#if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) -# error "this should not happen" -#endif -#if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) -# error "this should not happen" -#endif -#if (LZO_ARCH_I086) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_ARCH_I386) -# if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) -# error "this should not happen" -# endif -# if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if !defined(__LZO_MM_OVERRIDE) -#if (LZO_ARCH_I086) -#if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -#endif -#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) -# define LZO_MM_TINY 1 -#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) -# define LZO_MM_HUGE 1 -#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) -# define LZO_MM_SMALL 1 -#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) -# define LZO_MM_MEDIUM 1 -#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) -# define LZO_MM_COMPACT 1 -#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) -# define LZO_MM_LARGE 1 -#elif (LZO_CC_AZTECC) -# if defined(_LARGE_CODE) && defined(_LARGE_DATA) -# define LZO_MM_LARGE 1 -# elif defined(_LARGE_CODE) -# define LZO_MM_MEDIUM 1 -# elif defined(_LARGE_DATA) -# define LZO_MM_COMPACT 1 -# else -# define LZO_MM_SMALL 1 -# endif -#elif (LZO_CC_ZORTECHC && defined(__VCM__)) -# define LZO_MM_LARGE 1 -#else -# error "unknown memory model" -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -#define LZO_HAVE_MM_HUGE_PTR 1 -#define LZO_HAVE_MM_HUGE_ARRAY 1 -#if (LZO_MM_TINY) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) -# undef LZO_HAVE_MM_HUGE_PTR -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_MSC && defined(_QC)) -# undef LZO_HAVE_MM_HUGE_ARRAY -# if (_MSC_VER < 600) -# undef LZO_HAVE_MM_HUGE_PTR -# endif -#elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) -# if (LZO_OS_DOS16) -# error "this should not happen" -# elif (LZO_CC_ZORTECHC) -# else -# error "this should not happen" -# endif -#endif -#ifdef __cplusplus -extern "C" { -#endif -#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) -# define LZO_MM_AHSHIFT 12 -#elif (LZO_CC_WATCOMC) - extern unsigned char _HShift; -# define LZO_MM_AHSHIFT ((unsigned) _HShift) -#else -# error "FIXME - implement LZO_MM_AHSHIFT" -#endif -#ifdef __cplusplus -} -#endif -#endif -#elif (LZO_ARCH_C166) -#if !defined(__MODEL__) -# error "FIXME - C166 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - C166 __MODEL__" -#endif -#elif (LZO_ARCH_MCS251) -#if !defined(__MODEL__) -# error "FIXME - MCS251 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS251 __MODEL__" -#endif -#elif (LZO_ARCH_MCS51) -#if !defined(__MODEL__) -# error "FIXME - MCS51 __MODEL__" -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS51 __MODEL__" -#endif -#elif (LZO_ARCH_CRAY_PVP) -# define LZO_MM_PVP 1 -#else -# define LZO_MM_FLAT 1 -#endif -#if (LZO_MM_COMPACT) -# define LZO_INFO_MM "compact" -#elif (LZO_MM_FLAT) -# define LZO_INFO_MM "flat" -#elif (LZO_MM_HUGE) -# define LZO_INFO_MM "huge" -#elif (LZO_MM_LARGE) -# define LZO_INFO_MM "large" -#elif (LZO_MM_MEDIUM) -# define LZO_INFO_MM "medium" -#elif (LZO_MM_PVP) -# define LZO_INFO_MM "pvp" -#elif (LZO_MM_SMALL) -# define LZO_INFO_MM "small" -#elif (LZO_MM_TINY) -# define LZO_INFO_MM "tiny" -#else -# error "unknown memory model" -#endif -#endif -#if defined(SIZEOF_SHORT) -# define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -#endif -#if defined(SIZEOF_INT) -# define LZO_SIZEOF_INT (SIZEOF_INT) -#endif -#if defined(SIZEOF_LONG) -# define LZO_SIZEOF_LONG (SIZEOF_LONG) -#endif -#if defined(SIZEOF_LONG_LONG) -# define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -#endif -#if defined(SIZEOF___INT16) -# define LZO_SIZEOF___INT16 (SIZEOF___INT16) -#endif -#if defined(SIZEOF___INT32) -# define LZO_SIZEOF___INT32 (SIZEOF___INT32) -#endif -#if defined(SIZEOF___INT64) -# define LZO_SIZEOF___INT64 (SIZEOF___INT64) -#endif -#if defined(SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -#endif -#if defined(SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -#endif -#if defined(SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -#endif -#define __LZO_LSR(x,b) (((x)+0ul) >> (b)) -#if !defined(LZO_SIZEOF_SHORT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_SHORT 8 -# elif (USHRT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,7) == 1) -# define LZO_SIZEOF_SHORT 1 -# elif (__LZO_LSR(USHRT_MAX,15) == 1) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,31) == 1) -# define LZO_SIZEOF_SHORT 4 -# elif (__LZO_LSR(USHRT_MAX,63) == 1) -# define LZO_SIZEOF_SHORT 8 -# elif (__LZO_LSR(USHRT_MAX,127) == 1) -# define LZO_SIZEOF_SHORT 16 -# else -# error "LZO_SIZEOF_SHORT" -# endif -#endif -#if !defined(LZO_SIZEOF_INT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_INT 8 -# elif (UINT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_INT 2 -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,7) == 1) -# define LZO_SIZEOF_INT 1 -# elif (__LZO_LSR(UINT_MAX,15) == 1) -# define LZO_SIZEOF_INT 2 -# elif (__LZO_LSR(UINT_MAX,31) == 1) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,63) == 1) -# define LZO_SIZEOF_INT 8 -# elif (__LZO_LSR(UINT_MAX,127) == 1) -# define LZO_SIZEOF_INT 16 -# else -# error "LZO_SIZEOF_INT" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG) -# if (ULONG_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,7) == 1) -# define LZO_SIZEOF_LONG 1 -# elif (__LZO_LSR(ULONG_MAX,15) == 1) -# define LZO_SIZEOF_LONG 2 -# elif (__LZO_LSR(ULONG_MAX,31) == 1) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,63) == 1) -# define LZO_SIZEOF_LONG 8 -# elif (__LZO_LSR(ULONG_MAX,127) == 1) -# define LZO_SIZEOF_LONG 16 -# else -# error "LZO_SIZEOF_LONG" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -# if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) -# if (LZO_CC_GNUC >= 0x030300ul) -# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) -# define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG -# elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) -# define LZO_SIZEOF_LONG_LONG 4 -# endif -# endif -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -#if (LZO_ARCH_I086 && LZO_CC_DMC) -#elif (LZO_CC_CILLY) && defined(__GNUC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_SIZEOF_LONG_LONG 8 -#elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_OS_WIN64 || defined(_WIN64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_DMC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) -#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define LZO_SIZEOF_LONG_LONG 8 -#endif -#endif -#endif -#if defined(__cplusplus) && defined(LZO_CC_GNUC) -# if (LZO_CC_GNUC < 0x020800ul) -# undef LZO_SIZEOF_LONG_LONG -# endif -#endif -#if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#endif -#if !defined(LZO_SIZEOF_VOID_P) -#if (LZO_ARCH_I086) -# define __LZO_WORDSIZE 2 -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -# define LZO_SIZEOF_VOID_P 2 -# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -# define LZO_SIZEOF_VOID_P 4 -# else -# error "LZO_MM" -# endif -#elif (LZO_ARCH_AVR || LZO_ARCH_Z80) -# define __LZO_WORDSIZE 1 -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_H8300) -# if defined(__NORMAL_MODE__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 2 -# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 4 -# else -# define __LZO_WORDSIZE 2 -# define LZO_SIZEOF_VOID_P 2 -# endif -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT -# endif -#elif (LZO_ARCH_M16C) -# define __LZO_WORDSIZE 2 -# if defined(__m32c_cpu__) || defined(__m32cm_cpu__) -# define LZO_SIZEOF_VOID_P 4 -# else -# define LZO_SIZEOF_VOID_P 2 -# endif -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 4 -#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_OS_OS400 || defined(__OS400__)) -# define __LZO_WORDSIZE LZO_SIZEOF_LONG -# define LZO_SIZEOF_VOID_P 16 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_ARCH_SPU) -# if 0 -# define __LZO_WORDSIZE 16 -# endif -# define LZO_SIZEOF_VOID_P 4 -#else -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -#endif -#endif -#if !defined(LZO_WORDSIZE) -# if defined(__LZO_WORDSIZE) -# define LZO_WORDSIZE __LZO_WORDSIZE -# else -# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -# endif -#endif -#if !defined(LZO_SIZEOF_SIZE_T) -#if (LZO_ARCH_I086 || LZO_ARCH_M16C) -# define LZO_SIZEOF_SIZE_T 2 -#else -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P -#endif -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -#if (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P -# elif (LZO_MM_COMPACT || LZO_MM_LARGE) -# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) -# define LZO_SIZEOF_PTRDIFF_T 4 -# else -# define LZO_SIZEOF_PTRDIFF_T 2 -# endif -# else -# error "LZO_MM" -# endif -#else -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T -#endif -#endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) -# undef LZO_ABI_BIG_ENDIAN -# undef LZO_ABI_LITTLE_ENDIAN -#elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) -#if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) -# define LZO_ABI_BIG_ENDIAN 1 -#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_M68K || LZO_ARCH_S390) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) -# if (__LITTLE_ENDIAN__ == 1) -# define LZO_ABI_LITTLE_ENDIAN 1 -# else -# define LZO_ABI_BIG_ENDIAN 1 -# endif -#elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#endif -#endif -#if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) -# error "this should not happen" -#endif -#if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "be" -#elif defined(LZO_ABI_LITTLE_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "le" -#elif defined(LZO_ABI_NEUTRAL_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "neutral" -#endif -#if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_I8LP16 1 -# define LZO_INFO_ABI_PM "i8lp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_ILP16 1 -# define LZO_INFO_ABI_PM "ilp16" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_ILP32 1 -# define LZO_INFO_ABI_PM "ilp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) -# define LZO_ABI_LLP64 1 -# define LZO_INFO_ABI_PM "llp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_LP64 1 -# define LZO_INFO_ABI_PM "lp64" -#elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_ILP64 1 -# define LZO_INFO_ABI_PM "ilp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_IP32L64 1 -# define LZO_INFO_ABI_PM "ip32l64" -#endif -#if !defined(__LZO_LIBC_OVERRIDE) -#if defined(LZO_LIBC_NAKED) -# define LZO_INFO_LIBC "naked" -#elif defined(LZO_LIBC_FREESTANDING) -# define LZO_INFO_LIBC "freestanding" -#elif defined(LZO_LIBC_MOSTLY_FREESTANDING) -# define LZO_INFO_LIBC "mfreestanding" -#elif defined(LZO_LIBC_ISOC90) -# define LZO_INFO_LIBC "isoc90" -#elif defined(LZO_LIBC_ISOC99) -# define LZO_INFO_LIBC "isoc99" -#elif defined(__dietlibc__) -# define LZO_LIBC_DIETLIBC 1 -# define LZO_INFO_LIBC "dietlibc" -#elif defined(_NEWLIB_VERSION) -# define LZO_LIBC_NEWLIB 1 -# define LZO_INFO_LIBC "newlib" -#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) -# if defined(__UCLIBC_SUBLEVEL__) -# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) -# else -# define LZO_LIBC_UCLIBC 0x00090bL -# endif -# define LZO_INFO_LIBC "uclibc" -#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) -# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) -# define LZO_INFO_LIBC "glibc" -#elif (LZO_CC_MWERKS) && defined(__MSL__) -# define LZO_LIBC_MSL __MSL__ -# define LZO_INFO_LIBC "msl" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#else -# define LZO_LIBC_DEFAULT 1 -# define LZO_INFO_LIBC "default" -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -#if (LZO_CC_GNUC >= 0x020800ul) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_gnuc_extension__ __extension__ -#else -# define __lzo_gnuc_extension__ -#endif -#endif -#if !defined(__lzo_ua_volatile) -# define __lzo_ua_volatile volatile -#endif -#if !defined(__lzo_alignof) -#if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_alignof(e) __alignof(e) -#endif -#endif -#if defined(__lzo_alignof) -# define __lzo_HAVE_alignof 1 -#endif -#if !defined(__lzo_constructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_constructor __attribute__((__constructor__)) -#endif -#endif -#if defined(__lzo_constructor) -# define __lzo_HAVE_constructor 1 -#endif -#if !defined(__lzo_destructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_destructor __attribute__((__destructor__)) -#endif -#endif -#if defined(__lzo_destructor) -# define __lzo_HAVE_destructor 1 -#endif -#if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) -# error "this should not happen" -#endif -#if !defined(__lzo_inline) -#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -#elif defined(__cplusplus) -# define __lzo_inline inline -#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -# define __lzo_inline __inline -#elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_inline __inline__ -#elif (LZO_CC_DMC) -# define __lzo_inline __inline -#elif (LZO_CC_INTELC) -# define __lzo_inline __inline -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -# define __lzo_inline __inline -#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -# define __lzo_inline __inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define __lzo_inline inline -#endif -#endif -#if defined(__lzo_inline) -# define __lzo_HAVE_inline 1 -#else -# define __lzo_inline -#endif -#if !defined(__lzo_forceinline) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_forceinline __forceinline -#endif -#endif -#if defined(__lzo_forceinline) -# define __lzo_HAVE_forceinline 1 -#else -# define __lzo_forceinline -#endif -#if !defined(__lzo_noinline) -#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -# define __lzo_noinline __attribute__((__noinline__,__used__)) -#elif (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -# if defined(__cplusplus) -# else -# define __lzo_noinline __declspec(noinline) -# endif -#endif -#endif -#if defined(__lzo_noinline) -# define __lzo_HAVE_noinline 1 -#else -# define __lzo_noinline -#endif -#if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) -# error "this should not happen" -#endif -#if !defined(__lzo_noreturn) -#if (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_noreturn __declspec(noreturn) -#endif -#endif -#if defined(__lzo_noreturn) -# define __lzo_HAVE_noreturn 1 -#else -# define __lzo_noreturn -#endif -#if !defined(__lzo_nothrow) -#if (LZO_CC_GNUC >= 0x030300ul) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#endif -#endif -#if defined(__lzo_nothrow) -# define __lzo_HAVE_nothrow 1 -#else -# define __lzo_nothrow -#endif -#if !defined(__lzo_restrict) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_LLVM) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -# define __lzo_restrict __restrict -#endif -#endif -#if defined(__lzo_restrict) -# define __lzo_HAVE_restrict 1 -#else -# define __lzo_restrict -#endif -#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#endif -#endif -#if defined(__lzo_likely) -# define __lzo_HAVE_likely 1 -#else -# define __lzo_likely(e) (e) -#endif -#if defined(__lzo_unlikely) -# define __lzo_HAVE_unlikely 1 -#else -# define __lzo_unlikely(e) (e) -#endif -#if !defined(LZO_UNUSED) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNUSED(var) ((void) var) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_KEILC) -# define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} -# elif (LZO_CC_PACIFICC) -# define LZO_UNUSED(var) ((void) sizeof(var)) -# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED(var) ((void) var) -# else -# define LZO_UNUSED(var) ((void) &var) -# endif -#endif -#if !defined(LZO_UNUSED_FUNC) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED_FUNC(func) ((void) func) -# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_LLVM) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_MSC) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -# define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} -# else -# define LZO_UNUSED_FUNC(func) ((void) func) -# endif -#endif -#if !defined(LZO_UNUSED_LABEL) -# if (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# elif (LZO_CC_INTELC || LZO_CC_WATCOMC) -# define LZO_UNUSED_LABEL(l) if (0) goto l -# else -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# endif -#endif -#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -# if 0 -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -# elif 0 && (LZO_CC_GNUC) -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -# else -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# else -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT) -# if (LZO_CC_AZTECC) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} -# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# else -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} -# endif -#endif -#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit -# define __lzo_cdecl_main __cdecl -# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_qsort __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_qsort _stdcall -# else -# define __lzo_cdecl_qsort __cdecl -# endif -# elif (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -# else -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit __cdecl -# define __lzo_cdecl_main __cdecl -# define __lzo_cdecl_qsort __cdecl -# endif -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_sighandler __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_sighandler _stdcall -# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -# define __lzo_cdecl_sighandler __clrcall -# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -# if defined(_DLL) -# define __lzo_cdecl_sighandler _far _cdecl _loadds -# elif defined(_MT) -# define __lzo_cdecl_sighandler _far _cdecl -# else -# define __lzo_cdecl_sighandler _cdecl -# endif -# else -# define __lzo_cdecl_sighandler __cdecl -# endif -#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -# define __lzo_cdecl cdecl -#endif -#if !defined(__lzo_cdecl) -# define __lzo_cdecl -#endif -#if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit -#endif -#if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main -#endif -#if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort -#endif -#if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler -#endif -#if !defined(__lzo_cdecl_va) -# define __lzo_cdecl_va __lzo_cdecl -#endif -#if !defined(LZO_CFG_NO_WINDOWS_H) -#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) -# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -# else -# define LZO_HAVE_WINDOWS_H 1 -# endif -#endif -#endif -#if (LZO_ARCH_ALPHA) -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_AMD64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# define LZO_OPT_UNALIGNED64 1 -#elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) -#elif (LZO_ARCH_ARM) -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_CRIS) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_I386) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_IA64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_PREFER_POSTINC 1 -#elif (LZO_ARCH_M68K) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(__mc68020__) && !defined(__mcoldfire__) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_MIPS) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_POWERPC) -# define LZO_OPT_PREFER_PREINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_S390) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# if (LZO_SIZEOF_SIZE_T == 8) -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_SH) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -#endif -#if !defined(LZO_CFG_NO_INLINE_ASM) -#if defined(LZO_CC_LLVM) -# define LZO_CFG_NO_INLINE_ASM 1 -#endif -#endif -#if !defined(LZO_CFG_NO_UNALIGNED) -#if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) -# define LZO_CFG_NO_UNALIGNED 1 -#endif -#endif -#if defined(LZO_CFG_NO_UNALIGNED) -# undef LZO_OPT_UNALIGNED16 -# undef LZO_OPT_UNALIGNED32 -# undef LZO_OPT_UNALIGNED64 -#endif -#if defined(LZO_CFG_NO_INLINE_ASM) -#elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -# define LZO_ASM_SYNTAX_MSC 1 -#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#endif -#if (LZO_ASM_SYNTAX_GNUC) -#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -# define __LZO_ASM_CLOBBER "ax" -#elif (LZO_CC_INTELC) -# define __LZO_ASM_CLOBBER "memory" -#else -# define __LZO_ASM_CLOBBER "cc", "memory" -#endif -#endif -#if defined(__LZO_INFOSTR_MM) -#elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) -# define __LZO_INFOSTR_MM "" -#elif defined(LZO_INFO_MM) -# define __LZO_INFOSTR_MM "." LZO_INFO_MM -#else -# define __LZO_INFOSTR_MM "" -#endif -#if defined(__LZO_INFOSTR_PM) -#elif defined(LZO_INFO_ABI_PM) -# define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM -#else -# define __LZO_INFOSTR_PM "" -#endif -#if defined(__LZO_INFOSTR_ENDIAN) -#elif defined(LZO_INFO_ABI_ENDIAN) -# define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN -#else -# define __LZO_INFOSTR_ENDIAN "" -#endif -#if defined(__LZO_INFOSTR_OSNAME) -#elif defined(LZO_INFO_OS_CONSOLE) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE -#elif defined(LZO_INFO_OS_POSIX) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX -#else -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS -#endif -#if defined(__LZO_INFOSTR_LIBC) -#elif defined(LZO_INFO_LIBC) -# define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC -#else -# define __LZO_INFOSTR_LIBC "" -#endif -#if defined(__LZO_INFOSTR_CCVER) -#elif defined(LZO_INFO_CCVER) -# define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER -#else -# define __LZO_INFOSTR_CCVER "" -#endif -#define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER - -#endif - -#endif - -#undef LZO_HAVE_CONFIG_H -#include "minilzo.h" - -#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2030) -# error "version mismatch in miniLZO source files" -#endif - -#ifdef MINILZO_HAVE_CONFIG_H -# define LZO_HAVE_CONFIG_H -#endif - -#ifndef __LZO_CONF_H -#define __LZO_CONF_H - -#if !defined(__LZO_IN_MINILZO) -#if defined(LZO_CFG_FREESTANDING) -# define LZO_LIBC_FREESTANDING 1 -# define LZO_OS_FREESTANDING 1 -# define ACC_LIBC_FREESTANDING 1 -# define ACC_OS_FREESTANDING 1 -#endif -#if defined(LZO_CFG_NO_UNALIGNED) -# define ACC_CFG_NO_UNALIGNED 1 -#endif -#if defined(LZO_ARCH_GENERIC) -# define ACC_ARCH_GENERIC 1 -#endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) -# define ACC_ABI_NEUTRAL_ENDIAN 1 -#endif -#if defined(LZO_HAVE_CONFIG_H) -# define ACC_CONFIG_NO_HEADER 1 -#endif -#if defined(LZO_CFG_EXTRA_CONFIG_HEADER) -# include LZO_CFG_EXTRA_CONFIG_HEADER -#endif -#if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED) -# error "include this file first" -#endif -#include "lzo/lzoconf.h" -#endif - -#if (LZO_VERSION < 0x02000) || !defined(__LZOCONF_H_INCLUDED) -# error "version mismatch" -#endif - -#if (LZO_CC_BORLANDC && LZO_ARCH_I086) -# pragma option -h -#endif - -#if (LZO_CC_MSC && (_MSC_VER >= 1000)) -# pragma warning(disable: 4127 4701) -#endif -#if (LZO_CC_MSC && (_MSC_VER >= 1300)) -# pragma warning(disable: 4820) -# pragma warning(disable: 4514 4710 4711) -#endif - -#if (LZO_CC_SUNPROC) -# pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED) -# pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP) -#endif - -#if defined(__LZO_MMODEL_HUGE) && (!LZO_HAVE_MM_HUGE_PTR) -# error "this should not happen - check defines for __huge" -#endif - -#if defined(__LZO_IN_MINILZO) || defined(LZO_CFG_FREESTANDING) -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define ACC_WANT_ACC_INCD_H 1 -# define ACC_WANT_ACC_INCE_H 1 -# define ACC_WANT_ACC_INCI_H 1 -#elif 1 -# include -#else -# define ACC_WANT_ACC_INCD_H 1 -#endif - -#if (LZO_ARCH_I086) -# define ACC_MM_AHSHIFT LZO_MM_AHSHIFT -# define ACC_PTR_FP_OFF(x) (((const unsigned __far*)&(x))[0]) -# define ACC_PTR_FP_SEG(x) (((const unsigned __far*)&(x))[1]) -# define ACC_PTR_MK_FP(s,o) ((void __far*)(((unsigned long)(s)<<16)+(unsigned)(o))) -#endif - -#if !defined(lzo_uintptr_t) -# if defined(__LZO_MMODEL_HUGE) -# define lzo_uintptr_t unsigned long -# elif 1 && defined(LZO_OS_OS400) && (LZO_SIZEOF_VOID_P == 16) -# define __LZO_UINTPTR_T_IS_POINTER 1 - typedef char* lzo_uintptr_t; -# define lzo_uintptr_t lzo_uintptr_t -# elif (LZO_SIZEOF_SIZE_T == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t size_t -# elif (LZO_SIZEOF_LONG == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t unsigned long -# elif (LZO_SIZEOF_INT == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t unsigned int -# elif (LZO_SIZEOF_LONG_LONG == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t unsigned long long -# else -# define lzo_uintptr_t size_t -# endif -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - -#if 1 && !defined(LZO_CFG_FREESTANDING) -#if 1 && !defined(HAVE_STRING_H) -#define HAVE_STRING_H 1 -#endif -#if 1 && !defined(HAVE_MEMCMP) -#define HAVE_MEMCMP 1 -#endif -#if 1 && !defined(HAVE_MEMCPY) -#define HAVE_MEMCPY 1 -#endif -#if 1 && !defined(HAVE_MEMMOVE) -#define HAVE_MEMMOVE 1 -#endif -#if 1 && !defined(HAVE_MEMSET) -#define HAVE_MEMSET 1 -#endif -#endif - -#if 1 && defined(HAVE_STRING_H) -#include -#endif - -#if defined(LZO_CFG_FREESTANDING) -# undef HAVE_MEMCMP -# undef HAVE_MEMCPY -# undef HAVE_MEMMOVE -# undef HAVE_MEMSET -#endif - -#if !defined(HAVE_MEMCMP) -# undef memcmp -# define memcmp(a,b,c) lzo_memcmp(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memcmp(a,b,c) memcmp(a,b,c) -#endif -#if !defined(HAVE_MEMCPY) -# undef memcpy -# define memcpy(a,b,c) lzo_memcpy(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memcpy(a,b,c) memcpy(a,b,c) -#endif -#if !defined(HAVE_MEMMOVE) -# undef memmove -# define memmove(a,b,c) lzo_memmove(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memmove(a,b,c) memmove(a,b,c) -#endif -#if !defined(HAVE_MEMSET) -# undef memset -# define memset(a,b,c) lzo_memset(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memset(a,b,c) memset(a,b,c) -#endif - -#undef NDEBUG -#if defined(LZO_CFG_FREESTANDING) -# undef LZO_DEBUG -# define NDEBUG 1 -# undef assert -# define assert(e) ((void)0) -#else -# if !defined(LZO_DEBUG) -# define NDEBUG 1 -# endif -# include -#endif - -#if 0 && defined(__BOUNDS_CHECKING_ON) -# include -#else -# define BOUNDS_CHECKING_OFF_DURING(stmt) stmt -# define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) -#endif - -#if !defined(__lzo_inline) -# define __lzo_inline -#endif -#if !defined(__lzo_forceinline) -# define __lzo_forceinline -#endif -#if !defined(__lzo_noinline) -# define __lzo_noinline -#endif - -#if 1 -# define LZO_BYTE(x) ((unsigned char) (x)) -#else -# define LZO_BYTE(x) ((unsigned char) ((x) & 0xff)) -#endif - -#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b)) -#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b)) -#define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c)) -#define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c)) - -#define lzo_sizeof(type) ((lzo_uint) (sizeof(type))) - -#define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array)))) - -#define LZO_SIZE(bits) (1u << (bits)) -#define LZO_MASK(bits) (LZO_SIZE(bits) - 1) - -#define LZO_LSIZE(bits) (1ul << (bits)) -#define LZO_LMASK(bits) (LZO_LSIZE(bits) - 1) - -#define LZO_USIZE(bits) ((lzo_uint) 1 << (bits)) -#define LZO_UMASK(bits) (LZO_USIZE(bits) - 1) - -#if !defined(DMUL) -#if 0 - -# define DMUL(a,b) ((lzo_xint) ((lzo_uint32)(a) * (lzo_uint32)(b))) -#else -# define DMUL(a,b) ((lzo_xint) ((a) * (b))) -#endif -#endif - -#if 1 && !defined(LZO_CFG_NO_UNALIGNED) -#if 1 && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -# if (LZO_SIZEOF_SHORT == 2) -# define LZO_UNALIGNED_OK_2 -# endif -# if (LZO_SIZEOF_INT == 4) -# define LZO_UNALIGNED_OK_4 -# endif -#endif -#endif - -#if defined(LZO_UNALIGNED_OK_2) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(short) == 2) -#endif -#if defined(LZO_UNALIGNED_OK_4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) -#elif defined(LZO_ALIGNED_OK_4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) -#endif - -#define MEMCPY8_DS(dest,src,len) \ - lzo_memcpy(dest,src,len); dest += len; src += len - -#define BZERO8_PTR(s,l,n) \ - lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) - -#define MEMCPY_DS(dest,src,len) \ - do *dest++ = *src++; while (--len > 0) - -__LZO_EXTERN_C int __lzo_init_done; -__LZO_EXTERN_C const char __lzo_copyright[]; -LZO_EXTERN(const lzo_bytep) lzo_copyright(void); - -#ifndef __LZO_PTR_H -#define __LZO_PTR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(lzo_uintptr_t) -# if defined(__LZO_MMODEL_HUGE) -# define lzo_uintptr_t unsigned long -# else -# define lzo_uintptr_t acc_uintptr_t -# ifdef __ACC_INTPTR_T_IS_POINTER -# define __LZO_UINTPTR_T_IS_POINTER 1 -# endif -# endif -#endif - -#if (LZO_ARCH_I086) -#define PTR(a) ((lzo_bytep) (a)) -#define PTR_ALIGNED_4(a) ((ACC_PTR_FP_OFF(a) & 3) == 0) -#define PTR_ALIGNED2_4(a,b) (((ACC_PTR_FP_OFF(a) | ACC_PTR_FP_OFF(b)) & 3) == 0) -#elif (LZO_MM_PVP) -#define PTR(a) ((lzo_bytep) (a)) -#define PTR_ALIGNED_8(a) ((((lzo_uintptr_t)(a)) >> 61) == 0) -#define PTR_ALIGNED2_8(a,b) ((((lzo_uintptr_t)(a)|(lzo_uintptr_t)(b)) >> 61) == 0) -#else -#define PTR(a) ((lzo_uintptr_t) (a)) -#define PTR_LINEAR(a) PTR(a) -#define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0) -#define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0) -#define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0) -#define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0) -#endif - -#define PTR_LT(a,b) (PTR(a) < PTR(b)) -#define PTR_GE(a,b) (PTR(a) >= PTR(b)) -#define PTR_DIFF(a,b) (PTR(a) - PTR(b)) -#define pd(a,b) ((lzo_uint) ((a)-(b))) - -LZO_EXTERN(lzo_uintptr_t) -__lzo_ptr_linear(const lzo_voidp ptr); - -typedef union -{ - char a_char; - unsigned char a_uchar; - short a_short; - unsigned short a_ushort; - int a_int; - unsigned int a_uint; - long a_long; - unsigned long a_ulong; - lzo_int a_lzo_int; - lzo_uint a_lzo_uint; - lzo_int32 a_lzo_int32; - lzo_uint32 a_lzo_uint32; - ptrdiff_t a_ptrdiff_t; - lzo_uintptr_t a_lzo_uintptr_t; - lzo_voidp a_lzo_voidp; - void * a_void_p; - lzo_bytep a_lzo_bytep; - lzo_bytepp a_lzo_bytepp; - lzo_uintp a_lzo_uintp; - lzo_uint * a_lzo_uint_p; - lzo_uint32p a_lzo_uint32p; - lzo_uint32 * a_lzo_uint32_p; - unsigned char * a_uchar_p; - char * a_char_p; -} -lzo_full_align_t; - -#ifdef __cplusplus -} -#endif - -#endif - -#define LZO_DETERMINISTIC - -#define LZO_DICT_USE_PTR -#if 0 && (LZO_ARCH_I086) -# undef LZO_DICT_USE_PTR -#endif - -#if defined(LZO_DICT_USE_PTR) -# define lzo_dict_t const lzo_bytep -# define lzo_dict_p lzo_dict_t __LZO_MMODEL * -#else -# define lzo_dict_t lzo_uint -# define lzo_dict_p lzo_dict_t __LZO_MMODEL * -#endif - -#endif - -#if !defined(MINILZO_CFG_SKIP_LZO_PTR) - -LZO_PUBLIC(lzo_uintptr_t) -__lzo_ptr_linear(const lzo_voidp ptr) -{ - lzo_uintptr_t p; - -#if (LZO_ARCH_I086) - p = (((lzo_uintptr_t)(ACC_PTR_FP_SEG(ptr))) << (16 - ACC_MM_AHSHIFT)) + (ACC_PTR_FP_OFF(ptr)); -#elif (LZO_MM_PVP) - p = (lzo_uintptr_t) (ptr); - p = (p << 3) | (p >> 61); -#else - p = (lzo_uintptr_t) PTR_LINEAR(ptr); -#endif - - return p; -} - -LZO_PUBLIC(unsigned) -__lzo_align_gap(const lzo_voidp ptr, lzo_uint size) -{ -#if defined(__LZO_UINTPTR_T_IS_POINTER) - size_t n = (size_t) ptr; - n = (((n + size - 1) / size) * size) - n; -#else - lzo_uintptr_t p, n; - p = __lzo_ptr_linear(ptr); - n = (((p + size - 1) / size) * size) - p; -#endif - - assert(size > 0); - assert((long)n >= 0); - assert(n <= size); - return (unsigned)n; -} - -#endif - -/* If you use the LZO library in a product, I would appreciate that you - * keep this copyright string in the executable of your product. - */ - -const char __lzo_copyright[] = -#if !defined(__LZO_IN_MINLZO) - LZO_VERSION_STRING; -#else - "\r\n\n" - "LZO data compression library.\n" - "$Copyright: LZO (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Markus Franz Xaver Johannes Oberhumer\n" - "\n" - "http://www.oberhumer.com $\n\n" - "$Id: LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE " $\n" - "$Built: " __DATE__ " " __TIME__ " $\n" - "$Info: " LZO_INFO_STRING " $\n"; -#endif - -LZO_PUBLIC(const lzo_bytep) -lzo_copyright(void) -{ -#if (LZO_OS_DOS16 && LZO_CC_TURBOC) - return (lzo_voidp) __lzo_copyright; -#else - return (const lzo_bytep) __lzo_copyright; -#endif -} - -LZO_PUBLIC(unsigned) -lzo_version(void) -{ - return LZO_VERSION; -} - -LZO_PUBLIC(const char *) -lzo_version_string(void) -{ - return LZO_VERSION_STRING; -} - -LZO_PUBLIC(const char *) -lzo_version_date(void) -{ - return LZO_VERSION_DATE; -} - -LZO_PUBLIC(const lzo_charp) -_lzo_version_string(void) -{ - return LZO_VERSION_STRING; -} - -LZO_PUBLIC(const lzo_charp) -_lzo_version_date(void) -{ - return LZO_VERSION_DATE; -} - -#define LZO_BASE 65521u -#define LZO_NMAX 5552 - -#define LZO_DO1(buf,i) s1 += buf[i]; s2 += s1 -#define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1); -#define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2); -#define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4); -#define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8); - -LZO_PUBLIC(lzo_uint32) -lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len) -{ - lzo_uint32 s1 = adler & 0xffff; - lzo_uint32 s2 = (adler >> 16) & 0xffff; - unsigned k; - - if (buf == NULL) - return 1; - - while (len > 0) - { - k = len < LZO_NMAX ? (unsigned) len : LZO_NMAX; - len -= k; - if (k >= 16) do - { - LZO_DO16(buf,0); - buf += 16; - k -= 16; - } while (k >= 16); - if (k != 0) do - { - s1 += *buf++; - s2 += s1; - } while (--k > 0); - s1 %= LZO_BASE; - s2 %= LZO_BASE; - } - return (s2 << 16) | s1; -} - -#undef LZO_DO1 -#undef LZO_DO2 -#undef LZO_DO4 -#undef LZO_DO8 -#undef LZO_DO16 - -#if !defined(MINILZO_CFG_SKIP_LZO_STRING) -#undef lzo_memcmp -#undef lzo_memcpy -#undef lzo_memmove -#undef lzo_memset -#if !defined(__LZO_MMODEL_HUGE) -# undef LZO_HAVE_MM_HUGE_PTR -#endif -#define lzo_hsize_t lzo_uint -#define lzo_hvoid_p lzo_voidp -#define lzo_hbyte_p lzo_bytep -#define LZOLIB_PUBLIC(r,f) LZO_PUBLIC(r) f -#define lzo_hmemcmp lzo_memcmp -#define lzo_hmemcpy lzo_memcpy -#define lzo_hmemmove lzo_memmove -#define lzo_hmemset lzo_memset -#define __LZOLIB_HMEMCPY_CH_INCLUDED 1 -#if !defined(LZOLIB_PUBLIC) -# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) -#endif -LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCMP) - const lzo_hbyte_p p1 = (const lzo_hbyte_p) s1; - const lzo_hbyte_p p2 = (const lzo_hbyte_p) s2; - if __lzo_likely(len > 0) do - { - int d = *p1 - *p2; - if (d != 0) - return d; - p1++; p2++; - } while __lzo_likely(--len > 0); - return 0; -#else - return memcmp(s1, s2, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCPY) - lzo_hbyte_p p1 = (lzo_hbyte_p) dest; - const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; - if (!(len > 0) || p1 == p2) - return dest; - do - *p1++ = *p2++; - while __lzo_likely(--len > 0); - return dest; -#else - return memcpy(dest, src, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMMOVE) - lzo_hbyte_p p1 = (lzo_hbyte_p) dest; - const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; - if (!(len > 0) || p1 == p2) - return dest; - if (p1 < p2) - { - do - *p1++ = *p2++; - while __lzo_likely(--len > 0); - } - else - { - p1 += len; - p2 += len; - do - *--p1 = *--p2; - while __lzo_likely(--len > 0); - } - return dest; -#else - return memmove(dest, src, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMSET) - lzo_hbyte_p p = (lzo_hbyte_p) s; - if __lzo_likely(len > 0) do - *p++ = (unsigned char) c; - while __lzo_likely(--len > 0); - return s; -#else - return memset(s, c, len); -#endif -} -#undef LZOLIB_PUBLIC -#endif - -#if !defined(__LZO_IN_MINILZO) - -#define ACC_WANT_ACC_CHK_CH 1 -#undef ACCCHK_ASSERT - - ACCCHK_ASSERT_IS_SIGNED_T(lzo_int) - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint) - - ACCCHK_ASSERT_IS_SIGNED_T(lzo_int32) - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32) - ACCCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0) - ACCCHK_ASSERT(sizeof(lzo_uint32) >= 4) - -#if !defined(__LZO_UINTPTR_T_IS_POINTER) - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t) -#endif - ACCCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_xint) - ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint32)) - ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint)) - ACCCHK_ASSERT(sizeof(lzo_xint) == sizeof(lzo_uint32) || sizeof(lzo_xint) == sizeof(lzo_uint)) - -#endif -#undef ACCCHK_ASSERT - -LZO_PUBLIC(int) -_lzo_config_check(void) -{ - lzo_bool r = 1; - union { unsigned char c[2*sizeof(lzo_xint)]; lzo_xint l[2]; } u; - lzo_uintptr_t p; - -#if !defined(LZO_CFG_NO_CONFIG_CHECK) -#if defined(LZO_ABI_BIG_ENDIAN) - u.l[0] = u.l[1] = 0; u.c[sizeof(lzo_xint) - 1] = 128; - r &= (u.l[0] == 128); -#endif -#if defined(LZO_ABI_LITTLE_ENDIAN) - u.l[0] = u.l[1] = 0; u.c[0] = 128; - r &= (u.l[0] == 128); -#endif -#if defined(LZO_UNALIGNED_OK_2) - p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; - u.l[0] = u.l[1] = 0; - r &= ((* (const lzo_ushortp) (p+1)) == 0); -#endif -#if defined(LZO_UNALIGNED_OK_4) - p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; - u.l[0] = u.l[1] = 0; - r &= ((* (const lzo_uint32p) (p+1)) == 0); -#endif -#endif - - LZO_UNUSED(u); LZO_UNUSED(p); - return r == 1 ? LZO_E_OK : LZO_E_ERROR; -} - -int __lzo_init_done = 0; - -LZO_PUBLIC(int) -__lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5, - int s6, int s7, int s8, int s9) -{ - int r; - -#if defined(__LZO_IN_MINILZO) -#elif (LZO_CC_MSC && ((_MSC_VER) < 700)) -#else -#define ACC_WANT_ACC_CHK_CH 1 -#undef ACCCHK_ASSERT -#define ACCCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr) -#endif -#undef ACCCHK_ASSERT - - __lzo_init_done = 1; - - if (v == 0) - return LZO_E_ERROR; - - r = (s1 == -1 || s1 == (int) sizeof(short)) && - (s2 == -1 || s2 == (int) sizeof(int)) && - (s3 == -1 || s3 == (int) sizeof(long)) && - (s4 == -1 || s4 == (int) sizeof(lzo_uint32)) && - (s5 == -1 || s5 == (int) sizeof(lzo_uint)) && - (s6 == -1 || s6 == (int) lzo_sizeof_dict_t) && - (s7 == -1 || s7 == (int) sizeof(char *)) && - (s8 == -1 || s8 == (int) sizeof(lzo_voidp)) && - (s9 == -1 || s9 == (int) sizeof(lzo_callback_t)); - if (!r) - return LZO_E_ERROR; - - r = _lzo_config_check(); - if (r != LZO_E_OK) - return r; - - return r; -} - -#if !defined(__LZO_IN_MINILZO) - -#if (LZO_OS_WIN16 && LZO_CC_WATCOMC) && defined(__SW_BD) - -#if 0 -BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment, - WORD wHeapSize, LPSTR lpszCmdLine ) -#else -int __far __pascal LibMain ( int a, short b, short c, long d ) -#endif -{ - LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d); - return 1; -} - -#endif - -#endif - -#define do_compress _lzo1x_1_do_compress - -#if !defined(MINILZO_CFG_SKIP_LZO1X_1_COMPRESS) - -#define LZO_NEED_DICT_H -#define D_BITS 14 -#define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5) -#define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f) - -#ifndef __LZO_CONFIG1X_H -#define __LZO_CONFIG1X_H - -#if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z) -# define LZO1X -#endif - -#if !defined(__LZO_IN_MINILZO) -#include "lzo/lzo1x.h" -#endif - -#define LZO_EOF_CODE -#undef LZO_DETERMINISTIC - -#define M1_MAX_OFFSET 0x0400 -#ifndef M2_MAX_OFFSET -#define M2_MAX_OFFSET 0x0800 -#endif -#define M3_MAX_OFFSET 0x4000 -#define M4_MAX_OFFSET 0xbfff - -#define MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET) - -#define M1_MIN_LEN 2 -#define M1_MAX_LEN 2 -#define M2_MIN_LEN 3 -#ifndef M2_MAX_LEN -#define M2_MAX_LEN 8 -#endif -#define M3_MIN_LEN 3 -#define M3_MAX_LEN 33 -#define M4_MIN_LEN 3 -#define M4_MAX_LEN 9 - -#define M1_MARKER 0 -#define M2_MARKER 64 -#define M3_MARKER 32 -#define M4_MARKER 16 - -#ifndef MIN_LOOKAHEAD -#define MIN_LOOKAHEAD (M2_MAX_LEN + 1) -#endif - -#if defined(LZO_NEED_DICT_H) - -#ifndef LZO_HASH -#define LZO_HASH LZO_HASH_LZO_INCREMENTAL_B -#endif -#define DL_MIN_LEN M2_MIN_LEN - -#ifndef __LZO_DICT_H -#define __LZO_DICT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(D_BITS) && defined(DBITS) -# define D_BITS DBITS -#endif -#if !defined(D_BITS) -# error "D_BITS is not defined" -#endif -#if (D_BITS < 16) -# define D_SIZE LZO_SIZE(D_BITS) -# define D_MASK LZO_MASK(D_BITS) -#else -# define D_SIZE LZO_USIZE(D_BITS) -# define D_MASK LZO_UMASK(D_BITS) -#endif -#define D_HIGH ((D_MASK >> 1) + 1) - -#if !defined(DD_BITS) -# define DD_BITS 0 -#endif -#define DD_SIZE LZO_SIZE(DD_BITS) -#define DD_MASK LZO_MASK(DD_BITS) - -#if !defined(DL_BITS) -# define DL_BITS (D_BITS - DD_BITS) -#endif -#if (DL_BITS < 16) -# define DL_SIZE LZO_SIZE(DL_BITS) -# define DL_MASK LZO_MASK(DL_BITS) -#else -# define DL_SIZE LZO_USIZE(DL_BITS) -# define DL_MASK LZO_UMASK(DL_BITS) -#endif - -#if (D_BITS != DL_BITS + DD_BITS) -# error "D_BITS does not match" -#endif -#if (D_BITS < 8 || D_BITS > 18) -# error "invalid D_BITS" -#endif -#if (DL_BITS < 8 || DL_BITS > 20) -# error "invalid DL_BITS" -#endif -#if (DD_BITS < 0 || DD_BITS > 6) -# error "invalid DD_BITS" -#endif - -#if !defined(DL_MIN_LEN) -# define DL_MIN_LEN 3 -#endif -#if !defined(DL_SHIFT) -# define DL_SHIFT ((DL_BITS + (DL_MIN_LEN - 1)) / DL_MIN_LEN) -#endif - -#define LZO_HASH_GZIP 1 -#define LZO_HASH_GZIP_INCREMENTAL 2 -#define LZO_HASH_LZO_INCREMENTAL_A 3 -#define LZO_HASH_LZO_INCREMENTAL_B 4 - -#if !defined(LZO_HASH) -# error "choose a hashing strategy" -#endif - -#undef DM -#undef DX - -#if (DL_MIN_LEN == 3) -# define _DV2_A(p,shift1,shift2) \ - (((( (lzo_xint)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2]) -# define _DV2_B(p,shift1,shift2) \ - (((( (lzo_xint)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0]) -# define _DV3_B(p,shift1,shift2,shift3) \ - ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0]) -#elif (DL_MIN_LEN == 2) -# define _DV2_A(p,shift1,shift2) \ - (( (lzo_xint)(p[0]) << shift1) ^ p[1]) -# define _DV2_B(p,shift1,shift2) \ - (( (lzo_xint)(p[1]) << shift1) ^ p[2]) -#else -# error "invalid DL_MIN_LEN" -#endif -#define _DV_A(p,shift) _DV2_A(p,shift,shift) -#define _DV_B(p,shift) _DV2_B(p,shift,shift) -#define DA2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0]) -#define DS2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0]) -#define DX2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0]) -#define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0]) -#define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0]) -#define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0]) -#define DMS(v,s) ((lzo_uint) (((v) & (D_MASK >> (s))) << (s))) -#define DM(v) DMS(v,0) - -#if (LZO_HASH == LZO_HASH_GZIP) -# define _DINDEX(dv,p) (_DV_A((p),DL_SHIFT)) - -#elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL) -# define __LZO_HASH_INCREMENTAL -# define DVAL_FIRST(dv,p) dv = _DV_A((p),DL_SHIFT) -# define DVAL_NEXT(dv,p) dv = (((dv) << DL_SHIFT) ^ p[2]) -# define _DINDEX(dv,p) (dv) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A) -# define __LZO_HASH_INCREMENTAL -# define DVAL_FIRST(dv,p) dv = _DV_A((p),5) -# define DVAL_NEXT(dv,p) \ - dv ^= (lzo_xint)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2]) -# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B) -# define __LZO_HASH_INCREMENTAL -# define DVAL_FIRST(dv,p) dv = _DV_B((p),5) -# define DVAL_NEXT(dv,p) \ - dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_xint)(p[2]) << (2*5))) -# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#else -# error "choose a hashing strategy" -#endif - -#ifndef DINDEX -#define DINDEX(dv,p) ((lzo_uint)((_DINDEX(dv,p)) & DL_MASK) << DD_BITS) -#endif -#if !defined(DINDEX1) && defined(D_INDEX1) -#define DINDEX1 D_INDEX1 -#endif -#if !defined(DINDEX2) && defined(D_INDEX2) -#define DINDEX2 D_INDEX2 -#endif - -#if !defined(__LZO_HASH_INCREMENTAL) -# define DVAL_FIRST(dv,p) ((void) 0) -# define DVAL_NEXT(dv,p) ((void) 0) -# define DVAL_LOOKAHEAD 0 -#endif - -#if !defined(DVAL_ASSERT) -#if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG) -static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) -{ - lzo_xint df; - DVAL_FIRST(df,(p)); - assert(DINDEX(dv,p) == DINDEX(df,p)); -} -#else -# define DVAL_ASSERT(dv,p) ((void) 0) -#endif -#endif - -#if defined(LZO_DICT_USE_PTR) -# define DENTRY(p,in) (p) -# define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex] -#else -# define DENTRY(p,in) ((lzo_uint) ((p)-(in))) -# define GINDEX(m_pos,m_off,dict,dindex,in) m_off = dict[dindex] -#endif - -#if (DD_BITS == 0) - -# define UPDATE_D(dict,drun,dv,p,in) dict[ DINDEX(dv,p) ] = DENTRY(p,in) -# define UPDATE_I(dict,drun,index,p,in) dict[index] = DENTRY(p,in) -# define UPDATE_P(ptr,drun,p,in) (ptr)[0] = DENTRY(p,in) - -#else - -# define UPDATE_D(dict,drun,dv,p,in) \ - dict[ DINDEX(dv,p) + drun++ ] = DENTRY(p,in); drun &= DD_MASK -# define UPDATE_I(dict,drun,index,p,in) \ - dict[ (index) + drun++ ] = DENTRY(p,in); drun &= DD_MASK -# define UPDATE_P(ptr,drun,p,in) \ - (ptr) [ drun++ ] = DENTRY(p,in); drun &= DD_MASK - -#endif - -#if defined(LZO_DICT_USE_PTR) - -#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ - (m_pos == NULL || (m_off = pd(ip, m_pos)) > max_offset) - -#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ - (BOUNDS_CHECKING_OFF_IN_EXPR(( \ - m_pos = ip - (lzo_uint) PTR_DIFF(ip,m_pos), \ - PTR_LT(m_pos,in) || \ - (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) <= 0 || \ - m_off > max_offset ))) - -#else - -#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ - (m_off == 0 || \ - ((m_off = pd(ip, in) - m_off) > max_offset) || \ - (m_pos = (ip) - (m_off), 0) ) - -#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ - (pd(ip, in) <= m_off || \ - ((m_off = pd(ip, in) - m_off) > max_offset) || \ - (m_pos = (ip) - (m_off), 0) ) - -#endif - -#if defined(LZO_DETERMINISTIC) -# define LZO_CHECK_MPOS LZO_CHECK_MPOS_DET -#else -# define LZO_CHECK_MPOS LZO_CHECK_MPOS_NON_DET -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -#endif - -#endif - -#define DO_COMPRESS lzo1x_1_compress - -static __lzo_noinline lzo_uint -do_compress ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -{ - register const lzo_bytep ip; - lzo_bytep op; - const lzo_bytep const in_end = in + in_len; - const lzo_bytep const ip_end = in + in_len - M2_MAX_LEN - 5; - const lzo_bytep ii; - lzo_dict_p const dict = (lzo_dict_p) wrkmem; - - op = out; - ip = in; - ii = ip; - - ip += 4; - for (;;) - { - register const lzo_bytep m_pos; - lzo_uint m_off; - lzo_uint m_len; - lzo_uint dindex; - - DINDEX1(dindex,ip); - GINDEX(m_pos,m_off,dict,dindex,in); - if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) - goto literal; -#if 1 - if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) - goto try_match; - DINDEX2(dindex,ip); -#endif - GINDEX(m_pos,m_off,dict,dindex,in); - if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) - goto literal; - if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) - goto try_match; - goto literal; - -try_match: -#if 1 && defined(LZO_UNALIGNED_OK_2) - if (* (const lzo_ushortp) m_pos != * (const lzo_ushortp) ip) -#else - if (m_pos[0] != ip[0] || m_pos[1] != ip[1]) -#endif - { - } - else - { - if __lzo_likely(m_pos[2] == ip[2]) - { -#if 0 - if (m_off <= M2_MAX_OFFSET) - goto match; - if (lit <= 3) - goto match; - if (lit == 3) - { - assert(op - 2 > out); op[-2] |= LZO_BYTE(3); - *op++ = *ii++; *op++ = *ii++; *op++ = *ii++; - goto code_match; - } - if (m_pos[3] == ip[3]) -#endif - goto match; - } - else - { -#if 0 -#if 0 - if (m_off <= M1_MAX_OFFSET && lit > 0 && lit <= 3) -#else - if (m_off <= M1_MAX_OFFSET && lit == 3) -#endif - { - register lzo_uint t; - - t = lit; - assert(op - 2 > out); op[-2] |= LZO_BYTE(t); - do *op++ = *ii++; while (--t > 0); - assert(ii == ip); - m_off -= 1; - *op++ = LZO_BYTE(M1_MARKER | ((m_off & 3) << 2)); - *op++ = LZO_BYTE(m_off >> 2); - ip += 2; - goto match_done; - } -#endif - } - } - -literal: - UPDATE_I(dict,0,dindex,ip,in); - ++ip; - if __lzo_unlikely(ip >= ip_end) - break; - continue; - -match: - UPDATE_I(dict,0,dindex,ip,in); - if (pd(ip,ii) > 0) - { - register lzo_uint t = pd(ip,ii); - - if (t <= 3) - { - assert(op - 2 > out); - op[-2] |= LZO_BYTE(t); - } - else if (t <= 18) - *op++ = LZO_BYTE(t - 3); - else - { - register lzo_uint tt = t - 18; - - *op++ = 0; - while (tt > 255) - { - tt -= 255; - *op++ = 0; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } - do *op++ = *ii++; while (--t > 0); - } - - assert(ii == ip); - ip += 3; - if (m_pos[3] != *ip++ || m_pos[4] != *ip++ || m_pos[5] != *ip++ || - m_pos[6] != *ip++ || m_pos[7] != *ip++ || m_pos[8] != *ip++ -#ifdef LZO1Y - || m_pos[ 9] != *ip++ || m_pos[10] != *ip++ || m_pos[11] != *ip++ - || m_pos[12] != *ip++ || m_pos[13] != *ip++ || m_pos[14] != *ip++ -#endif - ) - { - --ip; - m_len = pd(ip, ii); - assert(m_len >= 3); assert(m_len <= M2_MAX_LEN); - - if (m_off <= M2_MAX_OFFSET) - { - m_off -= 1; -#if defined(LZO1X) - *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); - *op++ = LZO_BYTE(m_off >> 3); -#elif defined(LZO1Y) - *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); - *op++ = LZO_BYTE(m_off >> 2); -#endif - } - else if (m_off <= M3_MAX_OFFSET) - { - m_off -= 1; - *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); - goto m3_m4_offset; - } - else -#if defined(LZO1X) - { - m_off -= 0x4000; - assert(m_off > 0); assert(m_off <= 0x7fff); - *op++ = LZO_BYTE(M4_MARKER | - ((m_off & 0x4000) >> 11) | (m_len - 2)); - goto m3_m4_offset; - } -#elif defined(LZO1Y) - goto m4_match; -#endif - } - else - { - { - const lzo_bytep end = in_end; - const lzo_bytep m = m_pos + M2_MAX_LEN + 1; - while (ip < end && *m == *ip) - m++, ip++; - m_len = pd(ip, ii); - } - assert(m_len > M2_MAX_LEN); - - if (m_off <= M3_MAX_OFFSET) - { - m_off -= 1; - if (m_len <= 33) - *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); - else - { - m_len -= 33; - *op++ = M3_MARKER | 0; - goto m3_m4_len; - } - } - else - { -#if defined(LZO1Y) -m4_match: -#endif - m_off -= 0x4000; - assert(m_off > 0); assert(m_off <= 0x7fff); - if (m_len <= M4_MAX_LEN) - *op++ = LZO_BYTE(M4_MARKER | - ((m_off & 0x4000) >> 11) | (m_len - 2)); - else - { - m_len -= M4_MAX_LEN; - *op++ = LZO_BYTE(M4_MARKER | ((m_off & 0x4000) >> 11)); -m3_m4_len: - while (m_len > 255) - { - m_len -= 255; - *op++ = 0; - } - assert(m_len > 0); - *op++ = LZO_BYTE(m_len); - } - } - -m3_m4_offset: - *op++ = LZO_BYTE((m_off & 63) << 2); - *op++ = LZO_BYTE(m_off >> 6); - } - -#if 0 -match_done: -#endif - ii = ip; - if __lzo_unlikely(ip >= ip_end) - break; - } - - *out_len = pd(op, out); - return pd(in_end,ii); -} - -LZO_PUBLIC(int) -DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -{ - lzo_bytep op = out; - lzo_uint t; - - if __lzo_unlikely(in_len <= M2_MAX_LEN + 5) - t = in_len; - else - { - t = do_compress(in,in_len,op,out_len,wrkmem); - op += *out_len; - } - - if (t > 0) - { - const lzo_bytep ii = in + in_len - t; - - if (op == out && t <= 238) - *op++ = LZO_BYTE(17 + t); - else if (t <= 3) - op[-2] |= LZO_BYTE(t); - else if (t <= 18) - *op++ = LZO_BYTE(t - 3); - else - { - lzo_uint tt = t - 18; - - *op++ = 0; - while (tt > 255) - { - tt -= 255; - *op++ = 0; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } - do *op++ = *ii++; while (--t > 0); - } - - *op++ = M4_MARKER | 1; - *op++ = 0; - *op++ = 0; - - *out_len = pd(op, out); - return LZO_E_OK; -} - -#endif - -#undef do_compress -#undef DO_COMPRESS -#undef LZO_HASH - -#undef LZO_TEST_OVERRUN -#undef DO_DECOMPRESS -#define DO_DECOMPRESS lzo1x_decompress - -#if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS) - -#if defined(LZO_TEST_OVERRUN) -# if !defined(LZO_TEST_OVERRUN_INPUT) -# define LZO_TEST_OVERRUN_INPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_OUTPUT) -# define LZO_TEST_OVERRUN_OUTPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND -# endif -#endif - -#undef TEST_IP -#undef TEST_OP -#undef TEST_LB -#undef TEST_LBO -#undef NEED_IP -#undef NEED_OP -#undef HAVE_TEST_IP -#undef HAVE_TEST_OP -#undef HAVE_NEED_IP -#undef HAVE_NEED_OP -#undef HAVE_ANY_IP -#undef HAVE_ANY_OP - -#if defined(LZO_TEST_OVERRUN_INPUT) -# if (LZO_TEST_OVERRUN_INPUT >= 1) -# define TEST_IP (ip < ip_end) -# endif -# if (LZO_TEST_OVERRUN_INPUT >= 2) -# define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_OUTPUT) -# if (LZO_TEST_OVERRUN_OUTPUT >= 1) -# define TEST_OP (op <= op_end) -# endif -# if (LZO_TEST_OVERRUN_OUTPUT >= 2) -# undef TEST_OP -# define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun -# define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun -#else -# define TEST_LB(m_pos) ((void) 0) -# define TEST_LBO(m_pos,o) ((void) 0) -#endif - -#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) -# define TEST_IP (ip < ip_end) -#endif - -#if defined(TEST_IP) -# define HAVE_TEST_IP -#else -# define TEST_IP 1 -#endif -#if defined(TEST_OP) -# define HAVE_TEST_OP -#else -# define TEST_OP 1 -#endif - -#if defined(NEED_IP) -# define HAVE_NEED_IP -#else -# define NEED_IP(x) ((void) 0) -#endif -#if defined(NEED_OP) -# define HAVE_NEED_OP -#else -# define NEED_OP(x) ((void) 0) -#endif - -#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP -#endif -#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP -#endif - -#undef __COPY4 -#define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) - -#undef COPY4 -#if defined(LZO_UNALIGNED_OK_4) -# define COPY4(dst,src) __COPY4(dst,src) -#elif defined(LZO_ALIGNED_OK_4) -# define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) -#endif - -#if defined(DO_DECOMPRESS) -LZO_PUBLIC(int) -DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -#endif -{ - register lzo_bytep op; - register const lzo_bytep ip; - register lzo_uint t; -#if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; -#else - register const lzo_bytep m_pos; -#endif - - const lzo_bytep const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - lzo_bytep const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - lzo_uint last_m_off = 0; -#endif - - LZO_UNUSED(wrkmem); - -#if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif - - *out_len = 0; - - op = out; - ip = in; - - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+1); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - - while (TEST_IP && TEST_OP) - { - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 15 + *ip++; - } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (PTR_ALIGNED2_4(op,ip)) - { -#endif - COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } -#if !defined(LZO_UNALIGNED_OK_4) - } - else -#endif -#endif -#if !defined(LZO_UNALIGNED_OK_4) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } -#endif - -first_literal_run: - - t = *ip++; - if (t >= 16) - goto match; -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(3); - t = 3; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - (1 + M2_MAX_OFFSET); - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - - do { -match: - if (t >= 64) - { -#if defined(COPY_DICT) -#if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; -#elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; -#endif -#else -#if defined(LZO1X) - m_pos = op - 1; - m_pos -= (t >> 2) & 7; - m_pos -= *ip++ << 3; - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; -#elif defined(LZO1Z) - { - lzo_uint off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); - goto copy_match; -#endif - } - else if (t >= 32) - { - t &= 31; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 31 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; -#else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); -#endif -#else -#if defined(LZO1Z) - { - lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif - ip += 2; - } - else if (t >= 16) - { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else - m_pos = op; - m_pos -= (t & 8) << 11; -#endif - t &= 7; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 7 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_pos == op) - goto eof_found; - m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const lzo_bytep)op, m_pos); -#endif -#endif - } - else - { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(2); - t = 2; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - 1; - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - } - -#if defined(COPY_DICT) - - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t,m_off) - -#else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -#else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif - { -copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); - } - -#endif - -match_done: -#if defined(LZO1Z) - t = ip[-1] & 3; -#else - t = ip[-2] & 3; -#endif - if (t == 0) - break; - -match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif - t = *ip++; - } while (TEST_IP && TEST_OP); - } - -#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) - *out_len = pd(op, out); - return LZO_E_EOF_NOT_FOUND; -#endif - -eof_found: - assert(t == 1); - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); - -#if defined(HAVE_NEED_IP) -input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; -#endif - -#if defined(HAVE_NEED_OP) -output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif -} - -#endif - -#define LZO_TEST_OVERRUN -#undef DO_DECOMPRESS -#define DO_DECOMPRESS lzo1x_decompress_safe - -#if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS_SAFE) - -#if defined(LZO_TEST_OVERRUN) -# if !defined(LZO_TEST_OVERRUN_INPUT) -# define LZO_TEST_OVERRUN_INPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_OUTPUT) -# define LZO_TEST_OVERRUN_OUTPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND -# endif -#endif - -#undef TEST_IP -#undef TEST_OP -#undef TEST_LB -#undef TEST_LBO -#undef NEED_IP -#undef NEED_OP -#undef HAVE_TEST_IP -#undef HAVE_TEST_OP -#undef HAVE_NEED_IP -#undef HAVE_NEED_OP -#undef HAVE_ANY_IP -#undef HAVE_ANY_OP - -#if defined(LZO_TEST_OVERRUN_INPUT) -# if (LZO_TEST_OVERRUN_INPUT >= 1) -# define TEST_IP (ip < ip_end) -# endif -# if (LZO_TEST_OVERRUN_INPUT >= 2) -# define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_OUTPUT) -# if (LZO_TEST_OVERRUN_OUTPUT >= 1) -# define TEST_OP (op <= op_end) -# endif -# if (LZO_TEST_OVERRUN_OUTPUT >= 2) -# undef TEST_OP -# define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun -# define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun -#else -# define TEST_LB(m_pos) ((void) 0) -# define TEST_LBO(m_pos,o) ((void) 0) -#endif - -#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) -# define TEST_IP (ip < ip_end) -#endif - -#if defined(TEST_IP) -# define HAVE_TEST_IP -#else -# define TEST_IP 1 -#endif -#if defined(TEST_OP) -# define HAVE_TEST_OP -#else -# define TEST_OP 1 -#endif - -#if defined(NEED_IP) -# define HAVE_NEED_IP -#else -# define NEED_IP(x) ((void) 0) -#endif -#if defined(NEED_OP) -# define HAVE_NEED_OP -#else -# define NEED_OP(x) ((void) 0) -#endif - -#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP -#endif -#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP -#endif - -#undef __COPY4 -#define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) - -#undef COPY4 -#if defined(LZO_UNALIGNED_OK_4) -# define COPY4(dst,src) __COPY4(dst,src) -#elif defined(LZO_ALIGNED_OK_4) -# define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) -#endif - -#if defined(DO_DECOMPRESS) -LZO_PUBLIC(int) -DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -#endif -{ - register lzo_bytep op; - register const lzo_bytep ip; - register lzo_uint t; -#if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; -#else - register const lzo_bytep m_pos; -#endif - - const lzo_bytep const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - lzo_bytep const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - lzo_uint last_m_off = 0; -#endif - - LZO_UNUSED(wrkmem); - -#if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif - - *out_len = 0; - - op = out; - ip = in; - - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+1); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - - while (TEST_IP && TEST_OP) - { - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 15 + *ip++; - } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (PTR_ALIGNED2_4(op,ip)) - { -#endif - COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } -#if !defined(LZO_UNALIGNED_OK_4) - } - else -#endif -#endif -#if !defined(LZO_UNALIGNED_OK_4) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } -#endif - -first_literal_run: - - t = *ip++; - if (t >= 16) - goto match; -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(3); - t = 3; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - (1 + M2_MAX_OFFSET); - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - - do { -match: - if (t >= 64) - { -#if defined(COPY_DICT) -#if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; -#elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; -#endif -#else -#if defined(LZO1X) - m_pos = op - 1; - m_pos -= (t >> 2) & 7; - m_pos -= *ip++ << 3; - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; -#elif defined(LZO1Z) - { - lzo_uint off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); - goto copy_match; -#endif - } - else if (t >= 32) - { - t &= 31; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 31 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; -#else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); -#endif -#else -#if defined(LZO1Z) - { - lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif - ip += 2; - } - else if (t >= 16) - { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else - m_pos = op; - m_pos -= (t & 8) << 11; -#endif - t &= 7; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 7 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_pos == op) - goto eof_found; - m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const lzo_bytep)op, m_pos); -#endif -#endif - } - else - { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(2); - t = 2; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - 1; - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - } - -#if defined(COPY_DICT) - - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t,m_off) - -#else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -#else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif - { -copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); - } - -#endif - -match_done: -#if defined(LZO1Z) - t = ip[-1] & 3; -#else - t = ip[-2] & 3; -#endif - if (t == 0) - break; - -match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif - t = *ip++; - } while (TEST_IP && TEST_OP); - } - -#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) - *out_len = pd(op, out); - return LZO_E_EOF_NOT_FOUND; -#endif - -eof_found: - assert(t == 1); - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); - -#if defined(HAVE_NEED_IP) -input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; -#endif - -#if defined(HAVE_NEED_OP) -output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif -} - -#endif - -/***** End of minilzo.c *****/ - diff --git a/bundles/n2n_meyerd/n2n_v2/minilzo.h b/bundles/n2n_meyerd/n2n_v2/minilzo.h deleted file mode 100644 index 0aff50e4..00000000 --- a/bundles/n2n_meyerd/n2n_v2/minilzo.h +++ /dev/null @@ -1,106 +0,0 @@ -/* minilzo.h -- mini subset of the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - -/* - * NOTE: - * the full LZO package can be found at - * http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __MINILZO_H -#define __MINILZO_H - -#define MINILZO_VERSION 0x2030 - -#ifdef __LZOCONF_H -# error "you cannot use both LZO and miniLZO" -#endif - -#undef LZO_HAVE_CONFIG_H -#include "lzoconf.h" - -#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) -# error "version mismatch in header files" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/*********************************************************************** -// -************************************************************************/ - -/* Memory required for the wrkmem parameter. - * When the required size is 0, you can also pass a NULL pointer. - */ - -#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS -#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t)) -#define LZO1X_MEM_DECOMPRESS (0) - - -/* compression */ -LZO_EXTERN(int) -lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -/* decompression */ -LZO_EXTERN(int) -lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem /* NOT USED */ ); - -/* safe decompression with overrun testing */ -LZO_EXTERN(int) -lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem /* NOT USED */ ); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* already included */ - diff --git a/bundles/n2n_meyerd/n2n_v2/munin/n2n-supernode b/bundles/n2n_meyerd/n2n_v2/munin/n2n-supernode deleted file mode 100644 index 0064b38e..00000000 --- a/bundles/n2n_meyerd/n2n_v2/munin/n2n-supernode +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env perl -use warnings; -use strict; - -use Data::Dumper; -$Data::Dumper::Indent = 1; -$Data::Dumper::Sortkeys = 1; -$Data::Dumper::Quotekeys = 0; - -use IO::Socket::INET; -use Munin::Plugin; - -my $fields = { - edges => { - label => 'Current Connected clients', - }, - errors => { - label => 'Error rate', - type => 'DERIVE', - min => 0, - }, - reg_sup => { - label => 'Connect rate', - type => 'DERIVE', - min => 0, - }, - reg_nak => { - label => 'Connect error rate', - type => 'DERIVE', - min => 0, - }, - fwd => { - label => 'Packets forwarded rate', - type => 'DERIVE', - min => 0, - }, - broadcast => { - label => 'Broadcast packet rate', - type => 'DERIVE', - min => 0, - }, -}; - -sub do_config { - print("graph_title n2n supernode status\n"); - print("graph_category network\n"); - print("graph_order edges errors reg_sup reg_nak fwd broadcast\n"); - for my $fieldname (keys(%{$fields})) { - my $field = $fields->{$fieldname}; - for my $key (keys(%{$field})) { - print($fieldname.'.'.$key," ",$field->{$key},"\n"); - } - } - exit 0; -} - -sub do_autoconf { - # quick check to see if this plugin should be enabled - if (`pgrep supernode`) { - print("yes\n"); - exit 0; - } else { - print("no - supernode is not running\n"); - exit 0; - } -} - -sub do_fetch { - my $sock = IO::Socket::INET->new( - PeerAddr => '127.0.0.1', - PeerPort => 5645, - Proto => 'udp', - ); - $sock->send("\n"); - my $buf; - $sock->recv($buf,4096); - undef $sock; - - my $db; - for my $line (split(/\n/,$buf)) { - if ($line =~ m/^(last [a-z]+) +(\d+) sec ago$/) { - $db->{$1} = $2; - next; - } - if ($line =~ m/^([a-z_]+) +(\d+)$/) { - $db->{$1} = $2; - next; - } - } - - for my $field (keys(%{$fields})) { - print($field.".value ",$db->{$field},"\n"); - } - exit 0; -} - -sub main() { - if (!defined($ARGV[0])) { - do_fetch(); - } - if ($ARGV[0] eq 'config') { - do_config(); - } - if ($ARGV[0] eq 'autoconf') { - do_autoconf(); - } - die("bad arg"); -} -main(); - diff --git a/bundles/n2n_meyerd/n2n_v2/n2n.c b/bundles/n2n_meyerd/n2n_v2/n2n.c deleted file mode 100644 index 477bb6a9..00000000 --- a/bundles/n2n_meyerd/n2n_v2/n2n.c +++ /dev/null @@ -1,536 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * Richard Andrews - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - * Code contributions courtesy of: - * Massimo Torquati - * Matt Gilg - * - */ - -#include "n2n.h" - -#include "minilzo.h" - -#include - -/* sglib hash table implementation */ - -SGLIB_DEFINE_LIST_FUNCTIONS(peer_info_t, PEER_INFO_COMPARATOR, next) -SGLIB_DEFINE_HASHED_CONTAINER_FUNCTIONS(peer_info_t, PEER_HASH_TAB_SIZE, peer_info_t_hash_function) - -unsigned int peer_info_t_hash_function(peer_info_t *e) { -#if N2N_MAC_SIZE != 6 - #error not implemented yet! -#else - short i = 0; - uint32_t tmp = 0; - /* Q: why is the hashing implemented like this? - * A: because the MAC addresses basically consist of two parts - * the first three bytes are a organisation unique identifier - * the second three bytes are a interface unique identifier - * therefore if all the (randomly) generated MAC addresses of the - * tun/tap interfaces all have the same organisation unique identifier - * the hashing performance is best if only the interface unique identifier - * is taken into account - */ - for(; i < N2N_MAC_SIZE / 2; i++) { - tmp |= (e->mac_addr[i] ^ e->mac_addr[(N2N_MAC_SIZE/2)+i]) - << (N2N_MAC_SIZE/2-1-i); - } - return tmp; -#endif -}; - - -const uint8_t broadcast_addr[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; -const uint8_t multicast_addr[6] = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0x00 }; /* First 3 bytes are meaningful */ -const uint8_t ipv6_multicast_addr[6] = { 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 }; /* First 2 bytes are meaningful */ - -/* ************************************** */ - -SOCKET open_socket(int local_port, int bind_any) { - SOCKET sock_fd; - struct sockaddr_in local_address; - int sockopt = 1; - - if((sock_fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { - traceEvent(TRACE_ERROR, "Unable to create socket [%s][%d]\n", - strerror(errno), sock_fd); - return(-1); - } - -#ifndef WIN32 - /* fcntl(sock_fd, F_SETFL, O_NONBLOCK); */ -#endif - - setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&sockopt, sizeof(sockopt)); - - memset(&local_address, 0, sizeof(local_address)); - local_address.sin_family = AF_INET; - local_address.sin_port = htons(local_port); - local_address.sin_addr.s_addr = htonl(bind_any?INADDR_ANY:INADDR_LOOPBACK); - if(bind(sock_fd, (struct sockaddr*) &local_address, sizeof(local_address)) == -1) { - traceEvent(TRACE_ERROR, "Bind error [%s]\n", strerror(errno)); - return(-1); - } - - return(sock_fd); -} - - - - - -int traceLevel = 2 /* NORMAL */; -int useSyslog = 0, syslog_opened = 0; - -#ifdef __ANDROID_NDK__ -slog_t* slog = NULL; -int android_log_level(int lvl) -{ - switch (lvl) { - case 0: // ERROR - return ANDROID_LOG_ERROR; - case 1: // WARNING - return ANDROID_LOG_WARN; - case 2: // NORMAL - return ANDROID_LOG_INFO; - case 3: // INFO - return ANDROID_LOG_DEBUG; - case 4: // DEBUG - return ANDROID_LOG_VERBOSE; - default: // NORMAL - return ANDROID_LOG_INFO; - } -} -#endif /* #ifdef __ANDROID_NDK__ */ - -#define N2N_TRACE_DATESIZE 32 -void traceEvent(int eventTraceLevel, char* file, int line, const char * format, ...) { - va_list va_ap; - - if(eventTraceLevel <= traceLevel) { - char buf[2048]; - char out_buf[640]; - char theDate[N2N_TRACE_DATESIZE]; - char *extra_msg = ""; - time_t theTime = time(NULL); -#ifdef WIN32 - int i; -#endif - - /* We have two paths - one if we're logging, one if we aren't - * Note that the no-log case is those systems which don't support it (WIN32), - * those without the headers !defined(USE_SYSLOG) - * those where it's parametrically off... - */ - - memset(buf, 0, sizeof(buf)); - strftime(theDate, N2N_TRACE_DATESIZE, "%d/%b/%Y %H:%M:%S", localtime(&theTime)); - - va_start (va_ap, format); - vsnprintf(buf, sizeof(buf)-1, format, va_ap); - va_end(va_ap); - - if(eventTraceLevel == 0 /* TRACE_ERROR */) - extra_msg = "ERROR: "; - else if(eventTraceLevel == 1 /* TRACE_WARNING */) - extra_msg = "WARNING: "; - - while(buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; - -#ifndef WIN32 - if(useSyslog) { - if(!syslog_opened) { - openlog("n2n", LOG_PID, LOG_DAEMON); - syslog_opened = 1; - } - - snprintf(out_buf, sizeof(out_buf), "%s%s", extra_msg, buf); - syslog(LOG_INFO, "%s", out_buf); - } else { -#ifdef __ANDROID_NDK__ - char * p = strrchr(file, '/'); - file = (p ? p + 1 : file); -#endif /* #ifdef __ANDROID_NDK__ */ - snprintf(out_buf, sizeof(out_buf), "%s [%11s:%4d] %s%s", theDate, file, line, extra_msg, buf); -#ifdef __ANDROID_NDK__ - slog = writeslog(slog, android_log_level(eventTraceLevel), "n2n_v2s", out_buf); -#else /* #ifdef __ANDROID_NDK__ */ - printf("%s\n", out_buf); - fflush(stdout); -#endif /* #ifdef __ANDROID_NDK__ */ - } -#else - /* this is the WIN32 code */ - OutputDebugStringA(buf); - for(i=strlen(file)-1; i>0; i--) if(file[i] == '\\') { i++; break; }; - snprintf(out_buf, sizeof(out_buf), "%s [%11s:%4d] %s%s", theDate, &file[i], line, extra_msg, buf); - printf("%s\n", out_buf); - fflush(stdout); -#endif - } - -} - -/* *********************************************** */ - -/* addr should be in network order. Things are so much simpler that way. */ -char* intoa(uint32_t /* host order */ addr, char* buf, uint16_t buf_len) { - char *cp, *retStr; - uint8_t byteval; - int n; - - cp = &buf[buf_len]; - *--cp = '\0'; - - n = 4; - do { - byteval = addr & 0xff; - *--cp = byteval % 10 + '0'; - byteval /= 10; - if (byteval > 0) { - *--cp = byteval % 10 + '0'; - byteval /= 10; - if (byteval > 0) - *--cp = byteval + '0'; - } - *--cp = '.'; - addr >>= 8; - } while (--n > 0); - - /* Convert the string to lowercase */ - retStr = (char*)(cp+1); - - return(retStr); -} - -/* *********************************************** */ - -char * macaddr_str( macstr_t buf, - const n2n_mac_t mac ) -{ - snprintf(buf, N2N_MACSTR_SIZE, "%02X:%02X:%02X:%02X:%02X:%02X", - mac[0] & 0xFF, mac[1] & 0xFF, mac[2] & 0xFF, - mac[3] & 0xFF, mac[4] & 0xFF, mac[5] & 0xFF); - return(buf); -} - -/* *********************************************** */ - -uint8_t is_multi_broadcast(const uint8_t * dest_mac) { - - int is_broadcast = ( memcmp(broadcast_addr, dest_mac, 6) == 0 ); - int is_multicast = ( memcmp(multicast_addr, dest_mac, 3) == 0 ); - int is_ipv6_multicast = ( memcmp(ipv6_multicast_addr, dest_mac, 2) == 0 ); - - return is_broadcast || is_multicast || is_ipv6_multicast; - -} - -/* http://www.faqs.org/rfcs/rfc908.html */ - - -/* *********************************************** */ - -char* msg_type2str(uint16_t msg_type) { - switch(msg_type) { - case MSG_TYPE_REGISTER: return("MSG_TYPE_REGISTER"); - case MSG_TYPE_DEREGISTER: return("MSG_TYPE_DEREGISTER"); - case MSG_TYPE_PACKET: return("MSG_TYPE_PACKET"); - case MSG_TYPE_REGISTER_ACK: return("MSG_TYPE_REGISTER_ACK"); - case MSG_TYPE_REGISTER_SUPER: return("MSG_TYPE_REGISTER_SUPER"); - case MSG_TYPE_REGISTER_SUPER_ACK: return("MSG_TYPE_REGISTER_SUPER_ACK"); - case MSG_TYPE_REGISTER_SUPER_NAK: return("MSG_TYPE_REGISTER_SUPER_NAK"); - case MSG_TYPE_FEDERATION: return("MSG_TYPE_FEDERATION"); - default: return("???"); - } - - return("???"); -} - -/* *********************************************** */ - -void hexdump(const uint8_t * buf, size_t len) -{ - size_t i; - - if ( 0 == len ) { return; } - - for(i=0; i 0) && ((i % 16) == 0)) { printf("\n"); } - printf("%02X ", buf[i] & 0xFF); - } - - printf("\n"); -} - -/* *********************************************** */ - -void print_n2n_version(int trace) { - const char* bufline = "Welcome to n2n v.%s for %s\n" - "Built on %s\n" - "Copyright 2007-09 - http://www.ntop.org\n" - "Modify version %s\n" - "Modify by %s\n" - "Modify Copyright 2018 - %d - https://github.com/switch-iot/hin2n\n\n"; - time_t t = time(NULL); - if (trace == 1) { - traceEvent(TRACE_NORMAL, bufline, n2n_sw_version, n2n_sw_osName, n2n_sw_buildDate, n2n_mod_version, n2n_mod_author, localtime(&t)->tm_year + 1900); - } else { - printf(bufline, bufline, n2n_sw_version, n2n_sw_osName, n2n_sw_buildDate, n2n_mod_version, n2n_mod_author, localtime(&t)->tm_year + 1900); - } -} - -const char* random_device_mac(void) -{ - const char key[] = "0123456789abcdef"; - static char mac[18]; - int i; - - srand(gettid()); - for (i = 0; i < sizeof(mac) - 1; ++i) - { - if ((i + 1) % 3 == 0) { - mac[i] = ':'; - continue; - } - mac[i] = key[random() % sizeof(key)]; - } - mac[sizeof(mac) - 1] = '\0'; - return mac; -} - - -/** Find the peer entry in list with mac_addr equal to mac. - * - * Does not modify the list. - * - * @return NULL if not found; otherwise pointer to peer entry. - */ -peer_info_t * find_peer_by_mac( peer_info_t ** list, const n2n_mac_t mac ) -{ - peer_info_t tmp; - memcpy(tmp.mac_addr, mac, sizeof(n2n_mac_t)); - - return sglib_hashed_peer_info_t_find_member(list, &tmp); -} - - -/** Return the number of elements in the list. - * - */ -size_t peer_list_size( const struct peer_info * list ) -{ - size_t retval=0; - - while ( list ) - { - ++retval; - list = list->next; - } - - return retval; -} - -size_t hashed_peer_list_t_size(peer_info_t** htab) { - peer_info_t *ll; - struct sglib_hashed_peer_info_t_iterator it; - size_t retval = 0; - - for(ll=sglib_hashed_peer_info_t_it_init(&it,htab); ll!=NULL; ll=sglib_hashed_peer_info_t_it_next(&it)) { - ++retval; - } - - return retval; -} - -/** Add new to the head of list. If list is NULL; create it. - * - * The item new is added to the head of the list. New is modified during - * insertion. list takes ownership of new. - */ -void peer_list_add( struct peer_info * * list, - struct peer_info * new ) -{ - new->next = *list; - new->last_seen = time(NULL); - *list = new; -} - -size_t purge_with_function(struct peer_info ** peer_list, size_t(*purger)(struct peer_info ** peer_list, time_t purge_before)) { - time_t now = time(NULL); - size_t num_reg = 0; - - traceEvent(TRACE_INFO, "Purging old registrations"); - - num_reg = purger( peer_list, now-REGISTRATION_TIMEOUT ); - - traceEvent(TRACE_INFO, "Remove %ld registrations", num_reg); - - return num_reg; -} - -void dealloc_peer( peer_info_t* peer ) -{ - free(peer->sockets); - free(peer); -} - - -/** Purge old items from the peer_list and return the number of items that were removed. */ -size_t purge_peer_list( struct peer_info ** peer_list, - time_t purge_before ) -{ - struct peer_info *scan; - struct peer_info *prev; - size_t retval=0; - - scan = *peer_list; - prev = NULL; - while(scan != NULL) { - if(scan->last_seen < purge_before) { - struct peer_info *next = scan->next; - - if(prev == NULL) { - *peer_list = next; - } else { - prev->next = next; - } - ++retval; - dealloc_peer(scan); - scan = next; - } else { - prev = scan; - scan = scan->next; - } - } - return retval; -} - -size_t purge_hashed_peer_list_t(peer_info_t ** peer_list, time_t purge_before) { - peer_info_t *ll; - struct sglib_hashed_peer_info_t_iterator it; - size_t retval = 0; - - for(ll=sglib_hashed_peer_info_t_it_init(&it,peer_list); ll!=NULL; - ll=sglib_hashed_peer_info_t_it_next(&it)) { - if(ll->last_seen < purge_before) { - ++retval; - sglib_hashed_peer_info_t_delete(peer_list, ll); - dealloc_peer(ll); - } - } - - return retval; -} - -size_t purge_expired_registrations( struct peer_info ** peer_list ) { - return purge_with_function(peer_list, purge_peer_list); -} - -size_t hashed_purge_expired_registrations(peer_info_t ** peer_list) { - return purge_with_function(peer_list, purge_hashed_peer_list_t); -} - -size_t clear_hashed_peer_info_t_list(peer_info_t ** peer_list) { - peer_info_t *ll; - struct sglib_hashed_peer_info_t_iterator it; - size_t retval = 0; - - for(ll=sglib_hashed_peer_info_t_it_init(&it,peer_list); ll!=NULL; ll=sglib_hashed_peer_info_t_it_next(&it)) { - ++retval; - sglib_hashed_peer_info_t_delete(peer_list, ll); - dealloc_peer(ll); - } - - return retval; -} - -static uint8_t hex2byte( const char * s ) -{ - char tmp[3]; - tmp[0]=s[0]; - tmp[1]=s[1]; - tmp[2]=0; /* NULL term */ - - return((uint8_t)strtol( tmp, NULL, 16 )); -} - -extern int str2mac( uint8_t * outmac /* 6 bytes */, const char * s ) -{ - size_t i; - - /* break it down as one case for the first "HH", the 5 x through loop for - * each ":HH" where HH is a two hex nibbles in ASCII. */ - - *outmac=hex2byte(s); - ++outmac; - s+=2; /* don't skip colon yet - helps generalise loop. */ - - for (i=1; i<6; ++i ) - { - s+=1; - *outmac=hex2byte(s); - ++outmac; - s+=2; - } - - return 0; /* ok */ -} - -extern char * sock_to_cstr( n2n_sock_str_t out, - const n2n_sock_t * sock ) -{ - if ( NULL == out ) { return NULL; } - memset(out, 0, N2N_SOCKBUF_SIZE); - - if ( AF_INET6 == sock->family ) - { - /* INET6 not written yet */ - snprintf( out, N2N_SOCKBUF_SIZE, "XXXX:%hu", sock->port ); - return out; - } - else - { - const uint8_t * a = sock->addr.v4; - snprintf( out, N2N_SOCKBUF_SIZE, "%d.%d.%d.%d:%d", (a[0] & 0xff), - (a[1] & 0xff), (a[2] & 0xff), (a[3] & 0xff), sock->port ); - return out; - } -} - -/* @return zero if the two sockets are equivalent. */ -int sock_equal( const n2n_sock_t * a, - const n2n_sock_t * b ) -{ - if ( a->port != b->port ) { return 1; } - if ( a->family != b->family ) { return 1; } - switch (a->family) /* they are the same */ - { - case AF_INET: - if ( 0 != memcmp( a->addr.v4, b->addr.v4, IPV4_SIZE ) ) { return 1;}; - break; - default: - if ( 0 != memcmp( a->addr.v6, b->addr.v6, IPV6_SIZE ) ) { return 1;}; - break; - } - - return 0; -} - diff --git a/bundles/n2n_meyerd/n2n_v2/n2n.h b/bundles/n2n_meyerd/n2n_v2/n2n.h deleted file mode 100644 index 87e3bf0e..00000000 --- a/bundles/n2n_meyerd/n2n_v2/n2n.h +++ /dev/null @@ -1,315 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * Richard Andrews - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - * Code contributions courtesy of: - * Babak Farrokhi [FreeBSD port] - * Lukasz Taczuk - * - */ - -#ifndef _N2N_H_ -#define _N2N_H_ - -/* - tunctl -t tun0 - tunctl -t tun1 - ifconfig tun0 1.2.3.4 up - ifconfig tun1 1.2.3.5 up - ./edge -d tun0 -l 2000 -r 127.0.0.1:3000 -c hello - ./edge -d tun1 -l 3000 -r 127.0.0.1:2000 -c hello - - - tunctl -u UID -t tunX -*/ - -#if defined(__APPLE__) && defined(__MACH__) -#define _DARWIN_ -#endif - - -/* Some capability defaults which can be reset for particular platforms. */ -#define N2N_HAVE_DAEMON 1 -#define N2N_HAVE_SETUID 1 -/* #define N2N_CAN_NAME_IFACE */ - -/* Moved here to define _CRT_SECURE_NO_WARNINGS before all the including takes place */ -#ifdef WIN32 -#include "win32/n2n_win32.h" -#undef N2N_HAVE_DAEMON -#undef N2N_HAVE_SETUID -#endif - -#include -#include -#include - -#ifndef WIN32 -#include -#endif - -#ifndef _MSC_VER -#include -#endif /* #ifndef _MSC_VER */ - -#include -#include -#include - -#ifndef WIN32 -#include -#include -#include -#include -#include - -#ifdef __linux__ -#include -#include -#define N2N_CAN_NAME_IFACE 1 -#endif /* #ifdef __linux__ */ - -#ifdef __FreeBSD__ -#include -#endif /* #ifdef __FreeBSD__ */ - -#include -#include - -#define ETH_ADDR_LEN 6 -struct ether_hdr -{ - uint8_t dhost[ETH_ADDR_LEN]; - uint8_t shost[ETH_ADDR_LEN]; - uint16_t type; /* higher layer protocol encapsulated */ -} __attribute__ ((__packed__)); - -typedef struct ether_hdr ether_hdr_t; - -#ifdef __sun__ -#include /* MIN() and MAX() declared here */ -#undef N2N_HAVE_DAEMON -#endif /* #ifdef __sun__ */ - -#ifdef __ANDROID_NDK__ -#undef N2N_HAVE_DAEMON -#undef N2N_HAVE_SETUID -#undef N2N_CAN_NAME_IFACE -#endif /* #ifdef __ANDROID_NDK__ */ - -#include -#include -#include -#include -#include -#include -#include - -#define closesocket(a) close(a) -#endif /* #ifndef WIN32 */ - -#include - -#include - -#ifdef WIN32 -#include "win32/wintap.h" -#endif /* #ifdef WIN32 */ - -/* include sglib for hash tables */ -#include "sglib.h" - -#include "n2n_wire.h" - -/* N2N_IFNAMSIZ is needed on win32 even if dev_name is not used after declaration */ -#define N2N_IFNAMSIZ 16 /* 15 chars * NULL */ -#ifndef WIN32 -typedef struct tuntap_dev { - int fd; - uint8_t mac_addr[6]; - uint32_t ip_addr, device_mask; - uint16_t mtu; - char dev_name[N2N_IFNAMSIZ]; -} tuntap_dev; - -#define SOCKET int -#endif /* #ifndef WIN32 */ - -#define QUICKLZ 1 - -/* N2N packet header indicators. */ -#define MSG_TYPE_REGISTER 1 -#define MSG_TYPE_DEREGISTER 2 -#define MSG_TYPE_PACKET 3 -#define MSG_TYPE_REGISTER_ACK 4 -#define MSG_TYPE_REGISTER_SUPER 5 -#define MSG_TYPE_REGISTER_SUPER_ACK 6 -#define MSG_TYPE_REGISTER_SUPER_NAK 7 -#define MSG_TYPE_FEDERATION 8 -#define MSG_TYPE_PEER_INFO 9 -#define MSG_TYPE_QUERY_PEER 10 - -/* Set N2N_COMPRESSION_ENABLED to 0 to disable lzo1x compression of ethernet - * frames. Doing this will break compatibility with the standard n2n packet - * format so do it only for experimentation. All edges must be built with the - * same value if they are to understand each other. */ -#define N2N_COMPRESSION_ENABLED 1 - -#define DEFAULT_MTU 1400 - -/* Frequency registration should be attempted to purge and timeout value after - * which to purge*/ -#if defined(DEBUG) -# define PURGE_REGISTRATION_FREQUENCY 60 -# define REGISTRATION_TIMEOUT 120 -#else /* #if defined(DEBUG) */ -# define PURGE_REGISTRATION_FREQUENCY 60 -# define REGISTRATION_TIMEOUT 120 -#endif /* #if defined(DEBUG) */ - -/** Common type used to hold stringified IP addresses. */ -typedef char ipstr_t[32]; - -/** Common type used to hold stringified MAC addresses. */ -#define N2N_MACSTR_SIZE 32 -typedef char macstr_t[N2N_MACSTR_SIZE]; - -struct peer_info { - struct peer_info * next; - n2n_community_t community_name; - n2n_mac_t mac_addr; - n2n_sock_t sock; - int num_sockets; - n2n_sock_t * sockets; - time_t last_seen; - time_t last_sent_query; - size_t timeout; -}; -typedef struct peer_info peer_info_t; - -/* sglib hash table defines */ -#define PEER_HASH_TAB_SIZE 53 // prime number - -/* #define PEER_INFO_COMPARATOR(e1, e2) (\ - for(int i = 0; i < N2N_MAC_SIZE; i++) {\ - int8_t tmp = (e1)->mac_addr[i] - (e2)->mac_addr[i]; \ - if(tmp != 0) \ - return tmp; \ - } \ - return 0; \ -}) -*/ - -#define PEER_INFO_COMPARATOR(e1, e2) (strncmp((const char*)(e1)->mac_addr, (const char*)(e2)->mac_addr, sizeof(n2n_mac_t))) - -unsigned int peer_info_t_hash_function(peer_info_t *e); - -SGLIB_DEFINE_LIST_PROTOTYPES(peer_info_t, PEER_INFO_COMPARATOR, next) -SGLIB_DEFINE_HASHED_CONTAINER_PROTOTYPES(peer_info_t, PEER_HASH_TAB_SIZE, peer_info_t_hash_function) - -struct n2n_edge; /* defined in edge.c */ -typedef struct n2n_edge n2n_edge_t; - - -/* ************************************** */ - -#ifdef __ANDROID_NDK__ -#include -extern int android_log_level(int lvl); -extern slog_t* slog; -#ifndef N2N_LOG_FILEPATH -#define N2N_LOG_FILEPATH "/storage/sdcard0/wang.switchy.hin2n/n2n_v2s.log" -#endif /* #ifndef N2N_LOG_FILEPATH */ -#endif /* #ifdef __ANDROID_NDK__ */ -#define TRACE_ERROR 0, __FILE__, __LINE__ -#define TRACE_WARNING 1, __FILE__, __LINE__ -#define TRACE_NORMAL 2, __FILE__, __LINE__ -#define TRACE_INFO 3, __FILE__, __LINE__ -#define TRACE_DEBUG 4, __FILE__, __LINE__ - -/* ************************************** */ - -#define SUPERNODE_IP "127.0.0.1" -#define SUPERNODE_PORT 1234 - -/* ************************************** */ - -#ifndef max -#define max(a, b) ((a < b) ? b : a) -#endif - -#ifndef min -#define min(a, b) ((a > b) ? b : a) -#endif - -/* ************************************** */ - -/* Variables */ -/* extern TWOFISH *tf; */ -extern int traceLevel; -extern int useSyslog; -extern const uint8_t broadcast_addr[6]; -extern const uint8_t multicast_addr[6]; - -/* Functions */ -extern void traceEvent(int eventTraceLevel, char* file, int line, const char * format, ...); -extern int tuntap_open(tuntap_dev *device, char *dev, const char *address_mode, char *device_ip, - char *device_mask, const char * device_mac, int mtu); -extern int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len); -extern int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len); -extern void tuntap_close(struct tuntap_dev *tuntap); -extern void tuntap_get_address(struct tuntap_dev *tuntap); - -extern SOCKET open_socket(int local_port, int bind_any); - -extern char* intoa(uint32_t addr, char* buf, uint16_t buf_len); -extern char* macaddr_str(macstr_t buf, const n2n_mac_t mac); -extern int str2mac( uint8_t * outmac /* 6 bytes */, const char * s ); -extern char * sock_to_cstr( n2n_sock_str_t out, - const n2n_sock_t * sock ); - -extern int sock_equal( const n2n_sock_t * a, - const n2n_sock_t * b ); - -extern uint8_t is_multi_broadcast(const uint8_t * dest_mac); -extern char* msg_type2str(uint16_t msg_type); -extern void hexdump(const uint8_t * buf, size_t len); - -void print_n2n_version(int trace); -const char* random_device_mac(void); - - -/* Operations on peer_info lists. */ -struct peer_info * find_peer_by_mac( peer_info_t ** list, - const n2n_mac_t mac ); -void peer_list_add( struct peer_info * * list, - struct peer_info * new ); -size_t peer_list_size( const struct peer_info * list ); -void dealloc_peer( peer_info_t* peer ); -size_t hashed_peer_list_t_size(peer_info_t** htab); -size_t purge_with_function(struct peer_info ** peer_list, size_t(*purger)(struct peer_info ** peer_list, time_t purge_before)); -size_t purge_peer_list( struct peer_info ** peer_list, - time_t purge_before ); -size_t purge_hashed_peer_list_t(peer_info_t ** peer_list, time_t purge_before); -size_t clear_peer_list( struct peer_info ** peer_list ); -size_t clear_hashed_peer_info_t_list(peer_info_t ** peer_list); -size_t purge_expired_registrations( struct peer_info ** peer_list ); -size_t hashed_purge_expired_registrations(struct peer_info ** peer_list); - -/* version.c */ -extern char *n2n_sw_version, *n2n_sw_osName, *n2n_sw_buildDate, *n2n_mod_version, *n2n_mod_author; - -#endif /* _N2N_H_ */ diff --git a/bundles/n2n_meyerd/n2n_v2/n2n.spec b/bundles/n2n_meyerd/n2n_v2/n2n.spec deleted file mode 100644 index f5ee7d8a..00000000 --- a/bundles/n2n_meyerd/n2n_v2/n2n.spec +++ /dev/null @@ -1,52 +0,0 @@ -Summary: N2N peer-to-peer virtual private network system. -Name: n2n -Version: 2.1.0 -Release: 1 -License: GPLv3 -Vendor: ntop.org -Group: None -URL: http://www.ntop.org/n2n -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root - -%description -N2N is a peer-to-peer virtual private network system. N2N uses the universal -TUNTAP interface to create TAP network interfaces to an encrypted virtual -LAN. Members of a community share encryption keys which allow exchange of -data. The supernode is used for peer discovery and initial packet relay before -direct peer-to-peer exchange is established. Once direct packet exchange is -established, the supernode is not required. - -N2N-2 introduces additional security features and multiple supernodes. - -%prep - -%setup -q - -echo -e "\n *** Building ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE} ***\n" - -%build -make - -%install -make PREFIX=${RPM_BUILD_ROOT}/usr install - -%clean -rm -rf $RPM_BUILD_ROOT - - -%files -%defattr(-,root,root,-) - /usr/sbin/supernode - /usr/sbin/edge -%doc /usr/share/man/man1/supernode.1.gz -%doc /usr/share/man/man8/edge.8.gz -%doc /usr/share/man/man7/n2n_v2.7.gz - - -%changelog -* Fri Oct 30 2009 Richard Andrews - -- First beta for n2n-2 -* Sat May 3 2008 Richard Andrews - -- Initial build. - diff --git a/bundles/n2n_meyerd/n2n_v2/n2n_keyfile.c b/bundles/n2n_meyerd/n2n_v2/n2n_keyfile.c deleted file mode 100644 index 56de3a19..00000000 --- a/bundles/n2n_meyerd/n2n_v2/n2n_keyfile.c +++ /dev/null @@ -1,203 +0,0 @@ -/* (c) 2009 Richard Andrews */ -/* Contributions from: - * - Jozef Kralik - */ - -#include "n2n.h" -#include "n2n_keyfile.h" -#include -#include -#include -#include - - -#ifdef WIN32 -char *strsep( char **ppsz_string, const char *psz_delimiters ) -{ - char *p; - char *psz_string = *ppsz_string; - if( !psz_string ) - return NULL; - - p = strpbrk( psz_string, psz_delimiters ); - if( !p ) - { - *ppsz_string = NULL; - return psz_string; - } - *p++ = '\0'; - - *ppsz_string = p; - return psz_string; -} -#endif - - -/* Parse hex nibbles in ascii until a non-nibble character is found. Nibble - * characters are 0-9, a-f and A-F. - * - * Return number of bytes parsed into keyBuf or a negative error code. - */ -ssize_t n2n_parse_hex( uint8_t * keyBuf, - size_t keyLen, - const char * textKey, - size_t textLen) -{ - ssize_t retval=0; - uint8_t * pout=keyBuf; - size_t octet=0; - const char * textEnd; - const char * pbeg; - - textEnd = textKey+textLen; - pbeg=textKey; - - while ( ( pbeg + 1 < textEnd ) && ( retval < (ssize_t)keyLen ) ) - { - if ( 1 != sscanf( pbeg, "%02x", (unsigned int*)&octet ) ) - { - retval=-1; - break; - } - - *pout = (octet & 0xff); - ++pout; - ++retval; - pbeg += 2; - } - - return retval; -} - - -static int parseKeyLine( n2n_cipherspec_t * spec, - const char * linein ) -{ - /* parameters are separated by whitespace */ - char line[N2N_KEYFILE_LINESIZE]; - char * lp=line; - const char * token; - strncpy( line, linein, N2N_KEYFILE_LINESIZE ); - - memset( spec, 0, sizeof( n2n_cipherspec_t ) ); - - /* decode valid_from time */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - spec->valid_from = atol(token); - - /* decode valid_until time */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - spec->valid_until = atol(token); - - /* decode the transform number */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - spec->t = atoi(token); - - /* The reset if opaque key data */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - strncpy( (char *)spec->opaque, token, N2N_MAX_KEYSIZE ); - spec->opaque_size=strlen( (char *)spec->opaque); - - return 0; - -error: - return -1; -} - - -#define SEP "/" - - -int validCipherSpec( const n2n_cipherspec_t * k, - time_t now ) -{ - if ( k->valid_until < k->valid_from ) { goto bad; } - if ( k->valid_from > now ) { goto bad; } - if ( k->valid_until < now ) { goto bad; } - - return 0; - -bad: - return -1; -} - -/* Read key control file and return the number of specs stored or a negative - * error code. - * - * As the specs are read in the from and until time values are compared to - * present time. Only those keys which are valid are stored. - */ -int n2n_read_keyfile( n2n_cipherspec_t * specs, /* fill out this array of cipherspecs */ - size_t numspecs, /* number of slots in the array. */ - const char * ctrlfile_path ) /* path to control file */ -{ - /* Each line contains one cipherspec. */ - - int retval=0; - FILE * fp=NULL; - size_t idx=0; - time_t now = time(NULL); - - traceEvent( TRACE_DEBUG, "Reading '%s'\n", ctrlfile_path ); - - fp = fopen( ctrlfile_path, "r" ); - if ( fp ) - { - /* Read the file a line a time with fgets. */ - char line[N2N_KEYFILE_LINESIZE]; - size_t lineNum=0; - - while ( idx < numspecs ) - { - n2n_cipherspec_t * k = &(specs[idx]); - fgets( line, N2N_KEYFILE_LINESIZE, fp ); - ++lineNum; - - if ( strlen(line) > 1 ) - { - if ( 0 == parseKeyLine( k, line ) ) - { - if ( k->valid_until > now ) - { - traceEvent( TRACE_INFO, " --> [%u] from %lu, until %lu, transform=%hu, data=%s\n", - idx, k->valid_from, k->valid_until, k->t, k->opaque ); - - ++retval; - ++idx; - } - else - { - traceEvent( TRACE_INFO, " --X [%u] from %lu, until %lu, transform=%hu, data=%s\n", - idx, k->valid_from, k->valid_until, k->t, k->opaque ); - - } - } - else - { - traceEvent( TRACE_WARNING, "Failed to decode line %u\n", lineNum ); - } - } - - if ( feof(fp) ) - { - break; - } - - line[0]=0; /* this line has been consumed */ - } - - fclose( fp); - fp=NULL; - } - else - { - traceEvent( TRACE_ERROR, "Failed to open '%s'\n", ctrlfile_path ); - retval = -1; - } - - return retval; -} diff --git a/bundles/n2n_meyerd/n2n_v2/n2n_keyfile.h b/bundles/n2n_meyerd/n2n_v2/n2n_keyfile.h deleted file mode 100644 index 6068df1e..00000000 --- a/bundles/n2n_meyerd/n2n_v2/n2n_keyfile.h +++ /dev/null @@ -1,101 +0,0 @@ -/* (c) 2009 Richard Andrews */ - -/** Key files - * - * Edge implements a very simple interface for getting instructions about - * rolling keys. - * - * Key definitions are written as individual files in /.key. The - * format of each key is a single line of hex nibbles as follows: - * - * 0102030405060708090a0b0c0d0e0f - * - * Any external key exchange mechanism can receive the key data write it into - * the keyfiles. - * - * To control which keys are active at what times the key control file is - * used. This is a single file which is periodically reread. It contains key - * definitions in chronological order with one line per key definition as - * follows: - * - * - * - * edge reads the key control file periodically to get updates in policy. edge - * holds a number of keys in memory. Data can be decoded if it was encoded by - * any of the keys still in memory. By having at least 2 keys in memory it - * allows for clock skew and transmission delay when encoder and decoder roll - * keys at slightly different times. The amount of overlap in the valid time - * ranges provides the tolerance to timing skews in the system. - * - * The keys have the same level of secrecy as any other user file. Existing - * UNIX permission systems can be used to provide access controls. - * - */ - -/** How Edge Uses The Key Schedule - * - * Edge provides state space for a number of transform algorithms. Each - * transform uses its state space to store the SA information for its keys as - * found in the key file. When a packet is received the transform ID is in - * plain text. The packets is then sent to that transform for decoding. Each - * transform can store its SA numbers differently (or not at all). The - * transform code then finds the SA number, then finds the cipher (with key) in - * the state space and uses this to decode the packet. - * - * To support this, as edge reads each key line, it passes it to the - * appropriate transform to parse the line and store the SA information in its - * state space. - * - * When encoding a packet, edge has several transforms and potentially valid - * SAs to choose from. To keep track of which one to use for encoding edge does - * its own book-keeping as each key line is passed to the transform code: it - * stores a lookup of valid_from -> transform. When encoding a packet it then - * just calls the transform with the best valid_from in the table. The - * transform's own state space has all the SAs for its keys and the best of - * those is chosen. - */ - -#if !defined( N2N_KEYFILE_H_ ) -#define N2N_KEYFILE_H_ - - -#include "n2n_wire.h" -#include - -#define N2N_MAX_KEYSIZE 256 /* bytes */ -#define N2N_MAX_NUM_CIPHERSPECS 8 -#define N2N_KEYPATH_SIZE 256 -#define N2N_KEYFILE_LINESIZE 256 - -/** This structure stores an encryption cipher spec. */ -struct n2n_cipherspec -{ - n2n_transform_t t; /* N2N_TRANSFORM_ID_xxx for this spec. */ - time_t valid_from; /* Start using the key at this time. */ - time_t valid_until; /* Key is valid if time < valid_until. */ - uint16_t opaque_size; /* Size in bytes of key. */ - uint8_t opaque[N2N_MAX_KEYSIZE];/* Key matter. */ -}; - -typedef struct n2n_cipherspec n2n_cipherspec_t; - - -static const char * const DELIMITERS=" \t\n\r"; - - -/** @return number of cipherspec items filled. */ -int n2n_read_keyfile( n2n_cipherspec_t * specs, /* fill out this array of cipherspecs */ - size_t numspecs, /* number of slots in the array. */ - const char * ctrlfile_path ); /* path to control file */ - -int validCipherSpec( const n2n_cipherspec_t * k, - time_t now ); - -ssize_t n2n_parse_hex( uint8_t * keyBuf, - size_t keyMax, - const char * textKey, - size_t textLen ); - -/*----------------------------------------------------------------------------*/ - -#endif /* #if !defined( N2N_KEYFILE_H_ ) */ diff --git a/bundles/n2n_meyerd/n2n_v2/n2n_test.c b/bundles/n2n_meyerd/n2n_v2/n2n_test.c deleted file mode 100644 index 97ec91b0..00000000 --- a/bundles/n2n_meyerd/n2n_v2/n2n_test.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "n2n.h" -#include "n2n_keyfile.h" -#include -#include -#include - -int main(int arc, const char * argv[] ) -{ - int e; - n2n_cipherspec_t specs[N2N_MAX_NUM_CIPHERSPECS]; - - e = n2n_read_keyfile( specs, N2N_MAX_NUM_CIPHERSPECS, "keyctrl.conf" ); - - if ( e < 0 ) - { - perror( "Failed to read keyfile" ); - } - else - { - fprintf( stderr, "Stored %d keys.\n", e ); - } - - return 0; -} diff --git a/bundles/n2n_meyerd/n2n_v2/n2n_transforms.h b/bundles/n2n_meyerd/n2n_v2/n2n_transforms.h deleted file mode 100644 index effbc50b..00000000 --- a/bundles/n2n_meyerd/n2n_v2/n2n_transforms.h +++ /dev/null @@ -1,78 +0,0 @@ -/* (c) 2009 Richard Andrews */ - -#if !defined(N2N_TRANSFORMS_H_) -#define N2N_TRANSFORMS_H_ - -#include "n2n_keyfile.h" -#include "n2n_wire.h" - - -#define N2N_TRANSFORM_ID_INVAL 0 /* marks uninitialised data */ -#define N2N_TRANSFORM_ID_NULL 1 -#define N2N_TRANSFORM_ID_TWOFISH 2 -#define N2N_TRANSFORM_ID_AESCBC 3 -#define N2N_TRANSFORM_ID_LZO 4 -#define N2N_TRANSFORM_ID_TWOFISH_LZO 5 -#define N2N_TRANSFORM_ID_AESCBC_LZO 6 -#define N2N_TRANSFORM_ID_USER_START 64 -#define N2N_TRANSFORM_ID_MAX 65535 - - -struct n2n_trans_op; -typedef struct n2n_trans_op n2n_trans_op_t; - -struct n2n_tostat -{ - uint8_t can_tx; /* Does this transop have a valid SA for encoding. */ - n2n_cipherspec_t tx_spec; /* If can_tx, the spec used to encode. */ -}; - -typedef struct n2n_tostat n2n_tostat_t; - - -typedef int (*n2n_transdeinit_f)( n2n_trans_op_t * arg ); -typedef int (*n2n_transaddspec_f)( n2n_trans_op_t * arg, - const n2n_cipherspec_t * cspec ); -typedef n2n_tostat_t (*n2n_transtick_f)( n2n_trans_op_t * arg, - time_t now ); - -typedef int (*n2n_transform_f)( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ); - -/** Holds the info associated with a data transform plugin. - * - * When a packet arrives the transform ID is extracted. This defines the code - * to use to decode the packet content. The transform code then decodes the - * packet and consults its internal key lookup. - */ -struct n2n_trans_op -{ - void * priv; /* opaque data. Key schedule goes here. */ - - n2n_transform_t transform_id; /* link header enum to a transform */ - size_t tx_cnt; - size_t rx_cnt; - - n2n_transdeinit_f deinit; /* destructor function */ - n2n_transaddspec_f addspec; /* parse opaque data from a key schedule file. */ - n2n_transtick_f tick; /* periodic maintenance */ - n2n_transform_f fwd; /* encode a payload */ - n2n_transform_f rev; /* decode a payload */ -}; - -/* Setup a single twofish SA for single-key operation. */ -int transop_twofish_setup( n2n_trans_op_t * ttt, - n2n_sa_t sa_num, - uint8_t * encrypt_pwd, - uint32_t encrypt_pwd_len ); - -/* Initialise an empty transop ready to receive cipherspec elements. */ -int transop_twofish_init( n2n_trans_op_t * ttt ); -int transop_aes_init( n2n_trans_op_t * ttt ); -void transop_null_init( n2n_trans_op_t * ttt ); - -#endif /* #if !defined(N2N_TRANSFORMS_H_) */ - diff --git a/bundles/n2n_meyerd/n2n_v2/n2n_v2.7 b/bundles/n2n_meyerd/n2n_v2/n2n_v2.7 deleted file mode 100644 index 092f2d3a..00000000 --- a/bundles/n2n_meyerd/n2n_v2/n2n_v2.7 +++ /dev/null @@ -1,156 +0,0 @@ -.TH "n2n_v2" 7 "Sep 21, 2009" "revision 3909" "Background" -.SH NAME -N2n Version 2 \- version 2 of the n2n decentralised peer-to-peer network overlay -VPN. -.SH DESCRIPTION -N2n is a peer-to-peer network overlay or VPN system that provides layer 2 over -layer 3 encapsulation with data transform capabilities such as encryption and -compression. This guide discusses the differences of version 2 or n2n from -version 1. -.SH PROTOCOLS -N2n-2 uses a different set of messages to communicate with edges and -supernodes. The n2n-2 messages are not compatible with n2n-1. There is no -backward compatibility for n2n-1. -.SH ENCRYPTION -N2n-2 offers a new way of handling encryption compared to n2n-1. N2n-1 provided -facility for a single community password with no expiration. In n2n-2 this -method is preserved but a new mechanism has been added using a key schedule -file. -.TP -Key Schedule -A key schedule file lists a number of keys with the period for which each is -valid along with the encryption type identifier and the actual key value. This -allows the user to define up to 32 keys in advance with a pre-set time at which -they keys will change. The key schedule file can be reloaded while the edge is -running to allow new keys to be loaded and unused keys expunged. -.TP -Timing Requirements When a key rolls over to the next in the schedule, the new -key is used for all transmitted packets; however any packets received using an -older key can still be decoded as the keys from the key schedule are still -known. As a result edges do not need to have accurate time synchronisation. The -accuracy of required synchronisation depends to a large degree on the key -schedule. Rapid key roll-overs requires more accurate time synchronisation. -.P -N2n-2 provides the following encryption ciphers; more can be added as required: -.TP -.B (1) NULL -Data is encapsulated unchanged. Useful for testing and high-performance, low -sensitivity applications. -.TP -.B (2) TF -Twofish AES candidate. -.P -The following additional ciphers are specified but not yet implemented: -.TP -.B (3) AES-CBC -AES in CBC mode with 256-bit key. -.TP -.B (4) LZO -LZO compression of data (no encryption). -.TP -.B (5) TF-LZO -TF cipher with LZO compression of data prior to encryption. -.TP -.B (6) AES-CBC-LZO -AES-CBC ciper with LZO compression of data prior to encryption. - -.SH EXTENSIBILITY -N2n-2 decouples the data transform system from the core of the edge -operation. This allows for easier addition of new data transform -operations. N2n-2 reserves 64 standard transform identifiers (such as TwoFish -encryption) but allocates transform identifiers 64 - 65536 for user-defined -transforms. This allows anyone to add to n2n new private transforms without -breaking compatibility with the standard offering. - -.SH MULTIPLE SUPERNODES -N2n-2 introduces the capability of multiple supernodes to be used by an -edge. N2n-2 offers supernode in several flavours: -.TP -Stand-alone supernode - -This is the same concept as from n2n-1. Supernode is a small efficient C program -which operates in isolation. -.TP -Federated supernodes - -This is a cluster of supernodes which share information. Edges registered to any -of the cooperating supernodes can relay packets through the supernode federation -and switch supernodes if required. Supernodes can send PACKET or REGISTER -messages to other supernodes to try and find the destination edge. - -.P -The n2n-2 edge implementation allows multiple supernodes to be specified on the -command line. Edges monitor the current supernode for responses to -REGISTER_SUPER messages. If 3 responses are missed then the edge starts looking -for a new supernode. It cycles through the list of supernodes specified until it -finds a working one. - -.SH EFFICIENCY -The n2n-2 message formats have been made more efficient. The amount of data -overhead has been reduced by ensuring the messages contain only the data fields -required. Some optional fields do not consume data if they are not present. - -.SH DAEMON OPERATION -The supernode and edge use daemon mode of operation by default. This sense is -inverted from n2n-1 where they ran in the foreground by default. They can be -made to run in the foreground so tools such a DJB's daemontools can work with -them. See the -.B -f -option - -.SH MANAGEMENT CONSOLE -Edge and supernode in n2n-2 provide a UDP-based management console. Both listen -on the localhost address 127.0.0.1. Commands can be sent to the programs by -sending to the UDP socket. Responses are returned to the socket from which -commands were issued. This only works from the computer on which the programs -are running. Statistics can be retrieved and commands issued. The netcat utility -is all that is required; but more sophisticated tools could be built on the -interface. - -.SH SUPERNODE AUTHENTICATION -.B (To be implemented) -Space has been reserved in the supernode registration messages for an -authentication mechanism. - -.SH MESSAGE SUMMARY -The following message types work within n2n-2. -.TP -REGISTER_SUPER -Sent from an edge to its local supernode to register its MAC with the community. -.TP -REGISTER_SUPER_ACK -Sent from a supernode to an edge to confirm registration. This also carries the -definition of the edge socket as seen at the supernode so NAT can be detected -and described. -.TP -REGISTER_SUPER_NAK -Supernode refusing to register an edge. -.TP -PACKET -Encapsulated ethernet packets sent between edges. Supernodes forward or -broadcast these and edges send them direct in peer-to-peer mode. -.TP -REGISTER -A peer-to-peer mode registration request from one edge to another. Supernodes -forward these to facilitate NAT crossing introductions. -.TP -REGISTER_ACK -Complete peer-to-peer mode setup between two edges. These messages need to -travel direct between edges. -.TP -FEDERATION -Federated supernodes exchanging community information. - -.SH OTHER DIFFERENCES -.TP -HTTP Tunneling -This experimental feature (-t option in n2n_v1) of n2n_v1 has been removed -entirely from n2n_v2. -.SH AUTHORS -.TP -Richard Andrews andrews (at) ntop.org - main author of n2n-2 -.TP -Luca Deri -deri (at) ntop.org - code inherited from n2n-1 -.SH SEE ALSO -ifconfig(8) edge(8) supernode(1) diff --git a/bundles/n2n_meyerd/n2n_v2/n2n_wire.h b/bundles/n2n_meyerd/n2n_v2/n2n_wire.h deleted file mode 100644 index 4e9c023c..00000000 --- a/bundles/n2n_meyerd/n2n_v2/n2n_wire.h +++ /dev/null @@ -1,380 +0,0 @@ -/* (c) 2009 Richard Andrews - * - * Contributions by: - * Luca Deri - * Lukasz Taczuk - */ - -#if !defined( N2N_WIRE_H_ ) -#define N2N_WIRE_H_ - -#include - -#if defined(WIN32) -#include "win32/n2n_win32.h" - -#if defined(__MINGW32__) -#include -#endif /* #ifdef __MINGW32__ */ - -#else /* #if defined(WIN32) */ -#include -#include -#include /* AF_INET and AF_INET6 */ -#endif /* #if defined(WIN32) */ - -#define N2N_PKT_VERSION 2 -#define N2N_DEFAULT_TTL 2 /* can be forwarded twice at most */ -#define N2N_COMMUNITY_SIZE 16 -#define N2N_MAC_SIZE 6 -#define N2N_COOKIE_SIZE 4 -#define N2N_PKT_BUF_SIZE 2048 -#define N2N_SOCKBUF_SIZE 64 /* string representation of INET or INET6 sockets */ - -typedef uint8_t n2n_community_t[N2N_COMMUNITY_SIZE]; -typedef uint8_t n2n_mac_t[N2N_MAC_SIZE]; -typedef uint8_t n2n_cookie_t[N2N_COOKIE_SIZE]; - -typedef char n2n_sock_str_t[N2N_SOCKBUF_SIZE]; /* tracing string buffer */ - -enum n2n_pc -{ - n2n_ping=0, /* Not used */ - n2n_register=1, /* Register edge to edge */ - n2n_deregister=2, /* Deregister this edge */ - n2n_packet=3, /* PACKET data content */ - n2n_register_ack=4, /* ACK of a registration from edge to edge */ - n2n_register_super=5, /* Register edge to supernode */ - n2n_register_super_ack=6, /* ACK from supernode to edge */ - n2n_register_super_nak=7, /* NAK from supernode to edge - registration refused */ - n2n_federation=8, /* Not used by edge */ - n2n_peer_info=9, /* Send info on a peer from sn to edge */ - n2n_query_peer=10 /* ask supernode for info on a peer */ -}; - -typedef enum n2n_pc n2n_pc_t; - -/* for the additional_flags present in some non-PACKET types */ -#define N2N_AFLAGS_LOCAL_SOCKET 0x0001 - -/* for the common header section */ -#define N2N_FLAGS_FROM_SUPERNODE 0x0020 - -/* The bits in flag that are the packet type */ -#define N2N_FLAGS_TYPE_MASK 0x001f /* 0 - 31 */ -#define N2N_FLAGS_BITS_MASK 0xffe0 - -#define IPV4_SIZE 4 -#define IPV6_SIZE 16 - -#define ETH_FRAMEHDRSIZE 14 -#define IP4_SRCOFFSET 12 - -#define N2N_AUTH_TOKEN_SIZE 32 /* bytes */ - - -#define N2N_EUNKNOWN -1 -#define N2N_ENOTIMPL -2 -#define N2N_EINVAL -3 -#define N2N_ENOSPACE -4 - - -typedef uint16_t n2n_flags_t; -typedef uint16_t n2n_transform_t; /* Encryption, compression type. */ -typedef uint32_t n2n_sa_t; /* security association number */ - -struct n2n_sock -{ - uint8_t family; /* AF_INET or AF_INET6; or 0 if invalid */ - uint16_t port; /* host order */ - union - { - uint8_t v6[IPV6_SIZE]; /* byte sequence */ - uint8_t v4[IPV4_SIZE]; /* byte sequence */ - } addr; -}; - -typedef struct n2n_sock n2n_sock_t; - -struct n2n_auth -{ - uint16_t scheme; /* What kind of auth */ - uint16_t toksize; /* Size of auth token */ - uint8_t token[N2N_AUTH_TOKEN_SIZE]; /* Auth data interpreted based on scheme */ -}; - -typedef struct n2n_auth n2n_auth_t; - - -struct n2n_common -{ - /* int version; */ - uint8_t ttl; - n2n_pc_t pc; - n2n_flags_t flags; - n2n_community_t community; -}; - -typedef struct n2n_common n2n_common_t; - -struct n2n_REGISTER -{ - n2n_cookie_t cookie; /* Link REGISTER and REGISTER_ACK */ - n2n_mac_t srcMac; /* MAC of registering party */ - n2n_mac_t dstMac; /* MAC of target edge */ - n2n_sock_t sock; /* when relaying by supernode */ -}; - -typedef struct n2n_REGISTER n2n_REGISTER_t; - -struct n2n_REGISTER_ACK -{ - n2n_cookie_t cookie; /* Return cookie from REGISTER */ - n2n_mac_t srcMac; /* MAC of acknowledging party (supernode or edge) */ - n2n_mac_t dstMac; /* Reflected MAC of registering edge from REGISTER */ - n2n_sock_t sock; /* Supernode's view of edge socket (IP Addr, port) */ -}; - -typedef struct n2n_REGISTER_ACK n2n_REGISTER_ACK_t; - -struct n2n_PACKET -{ - n2n_transform_t transform; -}; - -typedef struct n2n_PACKET n2n_PACKET_t; - -struct n2n_ETHFRAMEHDR -{ - n2n_mac_t srcMac; - n2n_mac_t dstMac; - /* uint16_t ethertype; */ /* is there a reason to use this? */ -}; - -typedef struct n2n_ETHFRAMEHDR n2n_ETHFRAMEHDR_t; - - -/* Linked with n2n_register_super in n2n_pc_t. Only from edge to supernode. */ -struct n2n_REGISTER_SUPER -{ - uint16_t aflags; /* additional flags */ - n2n_cookie_t cookie; /* Link REGISTER_SUPER and REGISTER_SUPER_ACK */ - uint16_t timeout; - n2n_mac_t edgeMac; /* MAC to register with edge sending socket */ - n2n_auth_t auth; /* Authentication scheme and tokens */ - n2n_sock_t local_sock; -}; - -typedef struct n2n_REGISTER_SUPER n2n_REGISTER_SUPER_t; - - -/* Linked with n2n_register_super_ack in n2n_pc_t. Only from supernode to edge. */ -struct n2n_REGISTER_SUPER_ACK -{ - n2n_cookie_t cookie; /* Return cookie from REGISTER_SUPER */ - n2n_mac_t edgeMac; /* MAC registered to edge sending socket */ - uint16_t lifetime; /* How long the registration will live */ - n2n_sock_t sock; /* Sending sockets associated with edgeMac */ - - /* The packet format provides additional supernode definitions here. - * uint8_t count, then for each count there is one - * n2n_sock_t. - */ - uint8_t num_sn; /* Number of supernodes that were send - * even if we cannot store them all. If - * non-zero then sn_bak is valid. */ - n2n_sock_t sn_bak; /* Socket of the first backup supernode */ - -}; - -typedef struct n2n_REGISTER_SUPER_ACK n2n_REGISTER_SUPER_ACK_t; - - -/* Linked with n2n_register_super_ack in n2n_pc_t. Only from supernode to edge. */ -struct n2n_REGISTER_SUPER_NAK -{ - n2n_cookie_t cookie; /* Return cookie from REGISTER_SUPER */ -}; - -typedef struct n2n_REGISTER_SUPER_NAK n2n_REGISTER_SUPER_NAK_t; - -struct n2n_PEER_INFO -{ - uint16_t aflags; - uint16_t timeout; - n2n_mac_t mac; - n2n_sock_t sockets[2]; -}; - -typedef struct n2n_PEER_INFO n2n_PEER_INFO_t; - -struct n2n_QUERY_PEER -{ - n2n_mac_t srcMac; - n2n_mac_t targetMac; -}; - -typedef struct n2n_QUERY_PEER n2n_QUERY_PEER_t; - -struct n2n_buf -{ - uint8_t * data; - size_t size; -}; - -typedef struct n2n_buf n2n_buf_t; - -int encode_uint8( uint8_t * base, - size_t * idx, - const uint8_t v ); - -int decode_uint8( uint8_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_uint16( uint8_t * base, - size_t * idx, - const uint16_t v ); - -int decode_uint16( uint16_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_uint32( uint8_t * base, - size_t * idx, - const uint32_t v ); - -int decode_uint32( uint32_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_buf( uint8_t * base, - size_t * idx, - const void * p, - size_t s); - -int decode_buf( uint8_t * out, - size_t bufsize, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_mac( uint8_t * base, - size_t * idx, - const n2n_mac_t m ); - -int decode_mac( uint8_t * out, /* of size N2N_MAC_SIZE. This clearer than passing a n2n_mac_t */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_common( uint8_t * base, - size_t * idx, - const n2n_common_t * common ); - -int decode_common( n2n_common_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_sock( uint8_t * base, - size_t * idx, - const n2n_sock_t * sock ); - -int decode_sock( n2n_sock_t * sock, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_REGISTER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_t * reg ); - -int decode_REGISTER( n2n_REGISTER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_REGISTER_SUPER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_SUPER_t * reg ); - -int decode_REGISTER_SUPER( n2n_REGISTER_SUPER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_REGISTER_ACK( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_ACK_t * reg ); - -int decode_REGISTER_ACK( n2n_REGISTER_ACK_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_REGISTER_SUPER_ACK( uint8_t * base, - size_t * idx, - const n2n_common_t * cmn, - const n2n_REGISTER_SUPER_ACK_t * reg ); - -int decode_REGISTER_SUPER_ACK( n2n_REGISTER_SUPER_ACK_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int fill_sockaddr( struct sockaddr * addr, - size_t addrlen, - const n2n_sock_t * sock ); - -int encode_PACKET( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PACKET_t * pkt ); - -int decode_PACKET( n2n_PACKET_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_PEER_INFO( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PEER_INFO_t * pi ); - -int decode_PEER_INFO( n2n_PEER_INFO_t * pi, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_QUERY_PEER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_QUERY_PEER_t * qp ); - -int decode_QUERY_PEER( n2n_QUERY_PEER_t * qp, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -void decode_ETHFRAMEHDR( n2n_ETHFRAMEHDR_t * eth, - const uint8_t * base ); - -int copy_ETHFRAMEHDR( uint8_t * base, - uint8_t * pkt); - - -#endif /* #if !defined( N2N_WIRE_H_ ) */ diff --git a/bundles/n2n_meyerd/n2n_v2/scm.h b/bundles/n2n_meyerd/n2n_v2/scm.h deleted file mode 100644 index 38cf0491..00000000 --- a/bundles/n2n_meyerd/n2n_v2/scm.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * - * - * - */ - -struct SCM_def { - char *name; - char *desc; - int mode; /* set to SVC_CONSOLE by the *-scm.c code */ - int argc; char **argv; /* original cmdline args */ - int (*init)(int, char **); /* called before main */ - int (*main)(int, char **); /* called to run the service */ - int (*stop)(void *); /* called by scm to tell the service to stop */ -}; - -int SCM_Start(struct SCM_def *, int argc, char **argv); -char *SCM_Install(struct SCM_def *,char *); -int SCM_Remove(struct SCM_def *); - -#define SVC_OK 0 -#define SVC_FAIL -1 -#define SVC_CONSOLE 1 - diff --git a/bundles/n2n_meyerd/n2n_v2/scripts/mk_SRPM.sh b/bundles/n2n_meyerd/n2n_v2/scripts/mk_SRPM.sh deleted file mode 100644 index 2b1b3743..00000000 --- a/bundles/n2n_meyerd/n2n_v2/scripts/mk_SRPM.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# This script makes a SRPM - a source RPM file which can be built into the -# appropriate distro specific RPM for any platform. -# -# To build the binary package: -# rpm -i n2n-.src.rpm -# rpmbuild -bb n2n.spec -# -# Look for the "Wrote:" line to see where the final RPM is. -# -# To run this script cd to the n2n directory and run it as follows -# scripts/mk_SRPMS.sh -# - -set -e - -set -x - -BASE=`pwd` - -TARFILE=`${BASE}/scripts/mk_tar.sh` - -test -f ${TARFILE} - -echo "Building SRPM" -# -ts means build source RPM from tarfile -rpmbuild -ts ${TARFILE} - -echo "Done" diff --git a/bundles/n2n_meyerd/n2n_v2/scripts/mk_deb.sh b/bundles/n2n_meyerd/n2n_v2/scripts/mk_deb.sh deleted file mode 100644 index 42d86916..00000000 --- a/bundles/n2n_meyerd/n2n_v2/scripts/mk_deb.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# This script makes a SRPM - a source RPM file which can be built into the -# appropriate distro specific RPM for any platform. -# -# To build the binary package: -# rpm -i n2n-.src.rpm -# rpmbuild -bb n2n.spec -# -# Look for the "Wrote:" line to see where the final RPM is. -# -# To run this script cd to the n2n directory and run it as follows -# scripts/mk_SRPMS.sh -# - -set -e - -set -x - -BASE=`pwd` - -TARFILE=`${BASE}/scripts/mk_tar.sh` -TEMPDIR="build_deb" - -test -f ${TARFILE} - -echo "Building .deb" - -if [ -d ${TEMPDIR} ]; then - echo "Removing ${TEMPDIR} directory" - rm -rf ${TEMPDIR} >&2 -fi - -mkdir ${TEMPDIR} - -pushd ${TEMPDIR} - -tar xzf ${TARFILE} #At original location - -cd n2n* - -dpkg-buildpackage -rfakeroot - -popd - -echo "Done" diff --git a/bundles/n2n_meyerd/n2n_v2/scripts/mk_tar.sh b/bundles/n2n_meyerd/n2n_v2/scripts/mk_tar.sh deleted file mode 100644 index 0e84331c..00000000 --- a/bundles/n2n_meyerd/n2n_v2/scripts/mk_tar.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -# This script makes a SRPM - a source RPM file which can be built into the -# appropriate distro specific RPM for any platform. -# -# To build the binary package: -# rpm -i n2n-.src.rpm -# rpmbuild -bb n2n.spec -# -# Look for the "Wrote:" line to see where the final RPM is. -# -# To run this script cd to the n2n directory and run it as follows -# scripts/mk_SRPMS.sh -# - -set -e - -function exit_fail() -{ - echo "$1" - exit 1 -} - -PACKAGE="n2n" -PKG_VERSION="2.1.0" -PKG_AND_VERSION="${PACKAGE}-${PKG_VERSION}" - -TEMPDIR="tmp" - -SOURCE_MANIFEST=" -README -edge.c -lzoconf.h -lzodefs.h -Makefile -minilzo.c -minilzo.h -n2n.c -n2n.h -n2n_keyfile.c -n2n_keyfile.h -n2n.spec -n2n_transforms.h -n2n_wire.h -sn.c -transform_aes.c -transform_null.c -transform_tf.c -tuntap_linux.c -tuntap_freebsd.c -tuntap_netbsd.c -tuntap_osx.c -twofish.c -twofish.h -version.c -wire.c -edge.8 -supernode.1 -n2n_v2.7 -debian/changelog -debian/compat -debian/control -debian/copyright -debian/n2n-edge.docs -debian/n2n-edge.install -debian/n2n-supernode.install -debian/n2n-edge.manpages -debian/n2n-supernode.manpages -debian/README.Debian -debian/rules -" - -BASE=`pwd` - -for F in ${SOURCE_MANIFEST}; do - test -e $F || exit_fail "Cannot find $F. Maybe you're in the wrong directory. Please execute from n2n directory."; >&2 -done - -echo "Found critical files. Proceeding." >&2 - -if [ -d ${TEMPDIR} ]; then - echo "Removing ${TEMPDIR} directory" - rm -rf ${TEMPDIR} >&2 -fi - -mkdir ${TEMPDIR} >&2 - -pushd ${TEMPDIR} >&2 - -echo "Creating staging directory ${PWD}/${PKG_AND_VERSION}" >&2 - -if [ -d ${PKG_AND_VERSION} ] ; then - echo "Removing ${PKG_AND_VERSION} directory" - rm -rf ${PKG_AND_VERSION} >&2 -fi - -mkdir ${PKG_AND_VERSION} - -pushd ${BASE} >&2 - -echo "Copying in files" >&2 -for F in ${SOURCE_MANIFEST}; do - cp --parents -a $F ${TEMPDIR}/${PKG_AND_VERSION}/ -done - -popd >&2 - -TARFILE="${PKG_AND_VERSION}.tar.gz" -echo "Creating ${TARFILE}" >&2 -tar czf ${BASE}/${TARFILE} ${PKG_AND_VERSION} - -popd >&2 - -rm -rf ${TEMPDIR} >&2 - -echo ${BASE}/${TARFILE} diff --git a/bundles/n2n_meyerd/n2n_v2/sglib.h b/bundles/n2n_meyerd/n2n_v2/sglib.h deleted file mode 100644 index 76304380..00000000 --- a/bundles/n2n_meyerd/n2n_v2/sglib.h +++ /dev/null @@ -1,1951 +0,0 @@ -/* - - This is SGLIB version 1.0.3 - - (C) by Marian Vittek, Bratislava, http://www.xref-tech.com/sglib, 2003-5 - - License Conditions: You can use a verbatim copy (including this - copyright notice) of sglib freely in any project, commercial or not. - You can also use derivative forms freely under terms of Open Source - Software license or under terms of GNU Public License. If you need - to use a derivative form in a commercial project, or you need sglib - under any other license conditions, contact the author. - - - -*/ - - -#ifndef _SGLIB__h_ -#define _SGLIB__h_ - -/* the assert is used exclusively to write unexpected error messages */ -#include - - -/* ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- */ -/* - LEVEL - 0 INTERFACE - */ -/* ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- */ - - -/* ---------------------------------------------------------------------------- */ -/* ------------------------------ STATIC ARRAYS ------------------------------- */ -/* ---------------------------------------------------------------------------- */ - -/* - - Basic algorithms for sorting arrays. Multiple depending arrays can - be rearranged using user defined 'elem_exchangers' - -*/ - -/* HEAP - SORT (level 0) */ - -#define SGLIB_ARRAY_SINGLE_HEAP_SORT(type, a, max, comparator) {\ - SGLIB_ARRAY_HEAP_SORT(type, a, max, comparator, SGLIB_ARRAY_ELEMENTS_EXCHANGER);\ -} - -#define SGLIB_ARRAY_HEAP_SORT(type, a, max, comparator, elem_exchanger) {\ - int _k_;\ - for(_k_=(max)/2; _k_>=0; _k_--) {\ - SGLIB___ARRAY_HEAP_DOWN(type, a, _k_, max, comparator, elem_exchanger);\ - }\ - for(_k_=(max)-1; _k_>=0; _k_--) {\ - elem_exchanger(type, a, 0, _k_);\ - SGLIB___ARRAY_HEAP_DOWN(type, a, 0, _k_, comparator, elem_exchanger);\ - }\ -} - -#define SGLIB___ARRAY_HEAP_DOWN(type, a, ind, max, comparator, elem_exchanger) {\ - type _t_;\ - int _m_, _l_, _r_, _i_;\ - _i_ = (ind);\ - _m_ = _i_;\ - do {\ - _i_ = _m_; \ - _l_ = 2*_i_+1;\ - _r_ = _l_+1;\ - if (_l_ < (max)){\ - if (comparator(((a)[_m_]), ((a)[_l_])) < 0) _m_ = _l_;\ - if (_r_ < (max)) {\ - if (comparator(((a)[_m_]), ((a)[_r_])) < 0) _m_ = _r_;\ - }\ - }\ - if (_m_ != _i_) {\ - elem_exchanger(type, a, _i_, _m_);\ - }\ - } while (_m_ != _i_);\ -} - - -/* QUICK - SORT (level 0) */ - -#define SGLIB_ARRAY_SINGLE_QUICK_SORT(type, a, max, comparator) {\ - SGLIB_ARRAY_QUICK_SORT(type, a, max, comparator, SGLIB_ARRAY_ELEMENTS_EXCHANGER);\ -} - -#define SGLIB_ARRAY_QUICK_SORT(type, a, max, comparator, elem_exchanger) {\ - int _i_, _j_, _p_, _stacki_, _start_, _end_;\ - /* can sort up to 2^64 elements */\ - int _startStack_[64]; \ - int _endStack_[64];\ - type _tmp_;\ - _startStack_[0] = 0;\ - _endStack_[0] = (max);\ - _stacki_ = 1;\ - while (_stacki_ > 0) {\ - _stacki_ --;\ - _start_ = _startStack_[_stacki_];\ - _end_ = _endStack_[_stacki_];\ - while (_end_ - _start_ > 2) {\ - _p_ = _start_;\ - _i_ = _start_ + 1;\ - _j_ = _end_ - 1;\ - while (_i_<_j_) {\ - for(; _i_<=_j_ && comparator(((a)[_i_]),((a)[_p_]))<=0; _i_++) ;\ - if (_i_ > _j_) {\ - /* all remaining elements lesseq than pivot */\ - elem_exchanger(type, a, _j_, _p_);\ - _i_ = _j_;\ - } else {\ - for(; _i_<=_j_ && comparator(((a)[_j_]),((a)[_p_]))>=0; _j_--) ;\ - if (_i_ > _j_) {\ - /* all remaining elements greater than pivot */\ - elem_exchanger(type, a, _j_, _p_);\ - _i_ = _j_;\ - } else if (_i_ < _j_) {\ - elem_exchanger(type, a, _i_, _j_);\ - if (_i_+2 < _j_) {_i_++; _j_--;}\ - else if (_i_+1 < _j_) _i_++;\ - }\ - }\ - }\ - /* O.K. i==j and pivot is on a[i] == a[j] */\ - /* handle recursive calls without recursion */\ - if (_i_-_start_ > 1 && _end_-_j_ > 1) {\ - /* two recursive calls, use array-stack */\ - if (_i_-_start_ < _end_-_j_-1) {\ - _startStack_[_stacki_] = _j_+1;\ - _endStack_[_stacki_] = _end_;\ - _stacki_ ++;\ - _end_ = _i_;\ - } else {\ - _startStack_[_stacki_] = _start_;\ - _endStack_[_stacki_] = _i_;\ - _stacki_ ++;\ - _start_ = _j_+1;\ - }\ - } else {\ - if (_i_-_start_ > 1) {\ - _end_ = _i_;\ - } else {\ - _start_ = _j_+1;\ - }\ - }\ - }\ - if (_end_ - _start_ == 2) {\ - if (comparator(((a)[_start_]),((a)[_end_-1])) > 0) {\ - elem_exchanger(type, a, _start_, _end_-1);\ - }\ - }\ - }\ -} - -/* BINARY SEARCH (level 0) */ - -#define SGLIB_ARRAY_BINARY_SEARCH(type, a, start_index, end_index, key, comparator, found, result_index) {\ - int _kk_, _cc_, _ii_, _jj_, _ff_;\ - _ii_ = (start_index); \ - _jj_ = (end_index);\ - _ff_ = 0;\ - while (_ii_ <= _jj_ && _ff_==0) {\ - _kk_ = (_jj_+_ii_)/2;\ - _cc_ = comparator(((a)[_kk_]), (key));\ - if (_cc_ == 0) {\ - (result_index) = _kk_; \ - _ff_ = 1;\ - } else if (_cc_ < 0) {\ - _ii_ = _kk_+1;\ - } else {\ - _jj_ = _kk_-1;\ - }\ - }\ - if (_ff_ == 0) {\ - /* not found, but set its resulting place in the array */\ - (result_index) = _jj_+1;\ - }\ - (found) = _ff_;\ -} - -/* -------------------------------- queue (in an array) ------------------ */ -/* queue is a quadruple (a,i,j,dim) such that: */ -/* a is the array storing values */ -/* i is the index of the first used element in the array */ -/* j is the index of the first free element in the array */ -/* dim is the size of the array a */ -/* !!!!!!! This data structure is NOT documented, do not use it !!!!!!!!!! */ - -#define SGLIB_QUEUE_INIT(type, a, i, j) { i = j = 0; } -#define SGLIB_QUEUE_IS_EMPTY(type, a, i, j) ((i)==(j)) -#define SGLIB_QUEUE_IS_FULL(type, a, i, j, dim) ((i)==((j)+1)%(dim)) -#define SGLIB_QUEUE_FIRST_ELEMENT(type, a, i, j) (a[i]) -#define SGLIB_QUEUE_ADD_NEXT(type, a, i, j, dim) {\ - if (SGLIB_QUEUE_IS_FULL(type, a, i, j, dim)) assert(0 && "the queue is full");\ - (j) = ((j)+1) % (dim);\ -} -#define SGLIB_QUEUE_ADD(type, a, elem, i, j, dim) {\ - a[j] = (elem);\ - SGLIB_QUEUE_ADD_NEXT(type, a, i, j, dim);\ -} -#define SGLIB_QUEUE_DELETE_FIRST(type, a, i, j, dim) {\ - if (SGLIB_QUEUE_IS_EMPTY(type, a, i, j)) assert(0 && "the queue is empty");\ - (i) = ((i)+1) % (dim);\ -} -#define SGLIB_QUEUE_DELETE(type, a, i, j, dim) {\ - SGLIB_QUEUE_DELETE_FIRST(type, a, i, j, dim);\ -} - -/* ----------------- priority queue (heap) (in an array) -------------------- */ -/* heap is a triple (a,i,dim) such that: */ -/* a is the array storing values */ -/* i is the index of the first free element in the array */ -/* dim is the size of the array a */ -/* !!!!!!! This data structure is NOT documented, do not use it !!!!!!!!!! */ - -#define SGLIB_HEAP_INIT(type, a, i) { i = 0; } -#define SGLIB_HEAP_IS_EMPTY(type, a, i) ((i)==0) -#define SGLIB_HEAP_IS_FULL(type, a, i, dim) ((i)==(dim)) -#define SGLIB_HEAP_FIRST_ELEMENT(type, a, i) (a[0]) -#define SGLIB_HEAP_ADD_NEXT(type, a, i, dim, comparator, elem_exchanger) {\ - int _i_;\ - if (SGLIB_HEAP_IS_FULL(type, a, i, dim)) assert(0 && "the heap is full");\ - _i_ = (i)++;\ - while (_i_ > 0 && comparator(a[_i_/2], a[_i_]) < 0) {\ - elem_exchanger(type, a, (_i_/2), _i_);\ - _i_ = _i_/2;\ - }\ -} -#define SGLIB_HEAP_ADD(type, a, elem, i, dim, comparator) {\ - if (SGLIB_HEAP_IS_FULL(type, a, i, dim)) assert(0 && "the heap is full");\ - a[i] = (elem);\ - SGLIB_HEAP_ADD_NEXT(type, a, i, dim, comparator, SGLIB_ARRAY_ELEMENTS_EXCHANGER);\ -} -#define SGLIB_HEAP_DELETE_FIRST(type, a, i, dim, comparator, elem_exchanger) {\ - if (SGLIB_HEAP_IS_EMPTY(type, a, i)) assert(0 && "the heap is empty");\ - (i)--;\ - a[0] = a[i];\ - SGLIB___ARRAY_HEAP_DOWN(type, a, 0, i, comparator, elem_exchanger);\ -} -#define SGLIB_HEAP_DELETE(type, a, i, dim, comparator) {\ - SGLIB_HEAP_DELETE_FIRST(type, a, i, dim, comparator, SGLIB_ARRAY_ELEMENTS_EXCHANGER);\ -} - - -/* ----------------- hashed table of pointers (in an array) -------------------- */ - -/* - - This hashed table is storing pointers to objects (not containers). - In this table there is a one-to-one mapping between 'objects' stored - in the table and indexes where they are placed. Each index is - pointing to exactly one 'object' and each 'object' stored in the - table occurs on exactly one index. Once an object is stored in the - table, it can be represented via its index. - - In case of collision while adding an object the index shifted - by SGLIB_HASH_TAB_SHIFT_CONSTANT (constant can be redefined) - - You can NOT delete an element from such hash table. The only - justification (I can see) for this data structure is an exchange - file format, having an index table at the beginning and then - refering objects via indexes. - - !!!!!!! This data structure is NOT documented, do not use it !!!!!!!!!! - -*/ - -#define SGLIB_HASH_TAB_INIT(type, table, dim) {\ - int _i_;\ - for(_i_ = 0; _i_ < (dim); _i_++) (table)[_i_] = NULL;\ -} - -#define SGLIB_HASH_TAB_ADD_IF_NOT_MEMBER(type, table, dim, elem, hash_function, comparator, member){\ - unsigned _pos_;\ - type *_elem_;\ - SGLIB_HASH_TAB_FIND_MEMBER(type, table, dim, elem, _pos_, _elem_);\ - (member) = (table)[_pos_];\ - if (_elem_ == NULL) {\ - if ((table)[_pos_] != NULL) assert(0 && "the hash table is full");\ - (table)[_pos_] = (elem);\ - }\ -} - -#define SGLIB_HASH_TAB_FIND_MEMBER(type, table, dim, elem, hash_function, comparator, resultIndex, resultMember) {\ - unsigned _i_;\ - int _count_;\ - type *_e_;\ - _count = 0;\ - _i_ = hash_function(elem);\ - _i_ %= (dim);\ - while ((_e_=(table)[_i_])!=NULL && comparator(_e_, (elem))!=0 && _count_<(dim)) {\ - _count_ ++;\ - _i_ = (_i_ + SGLIB_HASH_TAB_SHIFT_CONSTANT) % (dim);\ - }\ - (resultIndex) = _i_;\ - if (_count_ < (dim)) (resultMember) = _e_;\ - else (resultMember) = NULL;\ -} - -#define SGLIB_HASH_TAB_IS_MEMBER(type, table, dim, elem, hash_function, resultIndex) {\ - unsigned _i_;\ - int _c_;\ - type *_e_;\ - _count = 0;\ - _i_ = hash_function(elem);\ - _i_ %= (dim);\ - while ((_e_=(table)[_i_])!=NULL && _e_!=(elem) && _c_<(dim)) {\ - _c_ ++;\ - _i_ = (_i_ + SGLIB_HASH_TAB_SHIFT_CONSTANT) % (dim);\ - }\ - if (_e_==(elem)) (resultIndex) = _i_;\ - else (resultIndex) = -1;\ -} - -#define SGLIB_HASH_TAB_MAP_ON_ELEMENTS(type, table, dim, iteratedIndex, iteratedVariable, command) {\ - unsigned iteratedIndex;\ - type *iteratedVariable;\ - for(iteratedIndex=0; iteratedIndex < (dim); iteratedIndex++) {\ - iteratedVariable = (table)[iteratedIndex];\ - if (iteratedVariable != NULL) {command;}\ - }\ -} - - -/* ---------------------------------------------------------------------------- */ -/* ------------------------- DYNAMIC DATA STRUCTURES -------------------------- */ -/* ---------------------------------------------------------------------------- */ - -/* ------------------------------------ lists (level 0) --------------------- */ - -#define SGLIB_LIST_ADD(type, list, elem, next) {\ - (elem)->next = (list);\ - (list) = (elem);\ -} - -#define SGLIB_LIST_CONCAT(type, first, second, next) {\ - if ((first)==NULL) {\ - (first) = (second);\ - } else {\ - type *_p_;\ - for(_p_ = (first); _p_->next!=NULL; _p_=_p_->next) ;\ - _p_->next = (second);\ - }\ -} - -#define SGLIB_LIST_DELETE(type, list, elem, next) {\ - type **_p_;\ - for(_p_ = &(list); *_p_!=NULL && *_p_!=(elem); _p_= &(*_p_)->next) ;\ - assert(*_p_!=NULL && "element is not member of the container, use DELETE_IF_MEMBER instead"!=NULL);\ - *_p_ = (*_p_)->next;\ -} - -#define SGLIB_LIST_ADD_IF_NOT_MEMBER(type, list, elem, comparator, next, member) {\ - type *_p_;\ - for(_p_ = (list); _p_!=NULL && comparator(_p_, (elem)) != 0; _p_= _p_->next) ;\ - (member) = _p_;\ - if (_p_ == NULL) {\ - SGLIB_LIST_ADD(type, list, elem, next);\ - }\ -} - -#define SGLIB_LIST_DELETE_IF_MEMBER(type, list, elem, comparator, next, member) {\ - type **_p_;\ - for(_p_ = &(list); *_p_!=NULL && comparator((*_p_), (elem)) != 0; _p_= &(*_p_)->next) ;\ - (member) = *_p_;\ - if (*_p_ != NULL) {\ - *_p_ = (*_p_)->next;\ - }\ -} - -#define SGLIB_LIST_IS_MEMBER(type, list, elem, next, result) {\ - type *_p_;\ - for(_p_ = (list); _p_!=NULL && _p_ != (elem); _p_= _p_->next) ;\ - (result) = (_p_!=NULL);\ -} - -#define SGLIB_LIST_FIND_MEMBER(type, list, elem, comparator, next, member) {\ - type *_p_;\ - for(_p_ = (list); _p_!=NULL && comparator(_p_, (elem)) != 0; _p_= _p_->next) ;\ - (member) = _p_;\ -} - -#define SGLIB_LIST_MAP_ON_ELEMENTS(type, list, iteratedVariable, next, command) {\ - type *_ne_;\ - type *iteratedVariable;\ - (iteratedVariable) = (list); \ - while ((iteratedVariable)!=NULL) {\ - _ne_ = (iteratedVariable)->next;\ - {command;};\ - (iteratedVariable) = _ne_;\ - }\ -} - -#define SGLIB_LIST_LEN(type, list, next, result) {\ - (result) = 0;\ - SGLIB_LIST_MAP_ON_ELEMENTS(type, list, _ce_, next, (result)++);\ -} - -#define SGLIB_LIST_REVERSE(type, list, next) {\ - type *_list_,*_tmp_,*_res_;\ - _list_ = (list);\ - _res_ = NULL;\ - while (_list_!=NULL) {\ - _tmp_ = _list_->next; _list_->next = _res_;\ - _res_ = _list_; _list_ = _tmp_;\ - }\ - (list) = _res_;\ -} - -#define SGLIB_LIST_SORT(type, list, comparator, next) {\ - /* a non-recursive merge sort on lists */\ - type *_r_;\ - type *_a_, *_b_, *_todo_, *_t_, **_restail_;\ - int _i_, _n_, _contFlag_;\ - _r_ = (list);\ - _contFlag_ = 1;\ - for(_n_ = 1; _contFlag_; _n_ = _n_+_n_) {\ - _todo_ = _r_; _r_ = NULL; _restail_ = &_r_; _contFlag_ =0;\ - while (_todo_!=NULL) {\ - _a_ = _todo_;\ - for(_i_ = 1, _t_ = _a_; _i_ < _n_ && _t_!=NULL; _i_++, _t_ = _t_->next) ;\ - if (_t_ ==NULL) {\ - *_restail_ = _a_;\ - break;\ - }\ - _b_ = _t_->next; _t_->next=NULL;\ - for(_i_ =1, _t_ = _b_; _i_<_n_ && _t_!=NULL; _i_++, _t_ = _t_->next) ;\ - if (_t_ ==NULL) {\ - _todo_ =NULL;\ - } else {\ - _todo_ = _t_->next; _t_->next=NULL;\ - }\ - /* merge */\ - while (_a_!=NULL && _b_!=NULL) {\ - if (comparator(_a_, _b_) < 0) {\ - *_restail_ = _a_; _restail_ = &(_a_->next); _a_ = _a_->next;\ - } else {\ - *_restail_ = _b_; _restail_ = &(_b_->next); _b_ = _b_->next;\ - }\ - }\ - if (_a_!=NULL) *_restail_ = _a_;\ - else *_restail_ = _b_;\ - while (*_restail_!=NULL) _restail_ = &((*_restail_)->next);\ - _contFlag_ =1;\ - }\ - }\ - (list) = _r_;\ -} - -/* --------------------------------- sorted list (level 0) --------------------- */ -/* - All operations suppose that the list is sorted and they preserve - this property. -*/ - - -#define SGLIB_SORTED_LIST_ADD(type, list, elem, comparator, next) {\ - type **_e_;\ - int _cmpres_;\ - SGLIB_SORTED_LIST_FIND_MEMBER_OR_PLACE(type, list, elem, comparator, next, _cmpres_, _e_);\ - (elem)->next = *_e_;\ - *_e_ = (elem);\ -} - -#define SGLIB_SORTED_LIST_ADD_IF_NOT_MEMBER(type, list, elem, comparator, next, member) {\ - type **_e_;\ - int _cmp_res_;\ - SGLIB_SORTED_LIST_FIND_MEMBER_OR_PLACE(type, list, elem, comparator, next, _cmp_res_, _e_);\ - if (_cmp_res_ != 0) {\ - (elem)->next = *_e_;\ - *_e_ = (elem);\ - (member) = NULL;\ - } else {\ - (member) = *_e_;\ - }\ -} - -#define SGLIB_SORTED_LIST_DELETE(type, list, elem, next) {\ - SGLIB_LIST_DELETE(type, list, elem, next);\ -} - -#define SGLIB_SORTED_LIST_DELETE_IF_MEMBER(type, list, elem, comparator, next, member) {\ - type **_e_;\ - int _cmp_res_;\ - SGLIB_SORTED_LIST_FIND_MEMBER_OR_PLACE(type, list, elem, comparator, next, _cmp_res_, _e_);\ - if (_cmp_res_ == 0) {\ - (member) = *_e_;\ - *_e_ = (*_e_)->next;\ - } else {\ - (member) = NULL;\ - }\ -} - -#define SGLIB_SORTED_LIST_FIND_MEMBER(type, list, elem, comparator, next, member) {\ - type *_p_;\ - int _cmpres_ = 1;\ - for(_p_ = (list); _p_!=NULL && (_cmpres_=comparator(_p_, (elem))) < 0; _p_=_p_->next) ;\ - if (_cmpres_ != 0) (member) = NULL;\ - else (member) = _p_;\ -} - -#define SGLIB_SORTED_LIST_IS_MEMBER(type, list, elem, comparator, next, result) {\ - type *_p_;\ - for(_p_ = (list); _p_!=NULL && comparator(_p_, (elem)) < 0; _p_=_p_->next) ;\ - while (_p_ != NULL && _p_ != (elem) && comparator(_p_, (elem)) == 0) _p_=_p_->next;\ - (result) = (_p_ == (elem));\ -} - -#define SGLIB_SORTED_LIST_FIND_MEMBER_OR_PLACE(type, list, elem, comparator, next, comparator_result, member_ptr) {\ - (comparator_result) = -1;\ - for((member_ptr) = &(list); \ - *(member_ptr)!=NULL && ((comparator_result)=comparator((*member_ptr), (elem))) < 0; \ - (member_ptr) = &(*(member_ptr))->next) ;\ -} - -#define SGLIB_SORTED_LIST_LEN(type, list, next, result) {\ - SGLIB_LIST_LEN(type, list, next, result);\ -} - -#define SGLIB_SORTED_LIST_MAP_ON_ELEMENTS(type, list, iteratedVariable, next, command) {\ - SGLIB_LIST_MAP_ON_ELEMENTS(type, list, iteratedVariable, next, command);\ -} - - -/* ------------------------------- double linked list (level 0) ------------------------- */ -/* - Lists with back pointer to previous element. Those lists implements deletion - of an element in a constant time. -*/ - -#define SGLIB___DL_LIST_CREATE_SINGLETON(type, list, elem, previous, next) {\ - (list) = (elem);\ - (list)->next = (list)->previous = NULL;\ -} - -#define SGLIB_DL_LIST_ADD_AFTER(type, place, elem, previous, next) {\ - if ((place) == NULL) {\ - SGLIB___DL_LIST_CREATE_SINGLETON(type, place, elem, previous, next);\ - } else {\ - (elem)->next = (place)->next;\ - (elem)->previous = (place);\ - (place)->next = (elem);\ - if ((elem)->next != NULL) (elem)->next->previous = (elem);\ - }\ -} - -#define SGLIB_DL_LIST_ADD_BEFORE(type, place, elem, previous, next) {\ - if ((place) == NULL) {\ - SGLIB___DL_LIST_CREATE_SINGLETON(type, place, elem, previous, next);\ - } else {\ - (elem)->next = (place);\ - (elem)->previous = (place)->previous;\ - (place)->previous = (elem);\ - if ((elem)->previous != NULL) (elem)->previous->next = (elem);\ - }\ -} - -#define SGLIB_DL_LIST_ADD(type, list, elem, previous, next) {\ - SGLIB_DL_LIST_ADD_BEFORE(type, list, elem, previous, next)\ -} - -#define SGLIB___DL_LIST_GENERIC_ADD_IF_NOT_MEMBER(type, list, elem, comparator, previous, next, member, the_add_operation) {\ - type *_dlp_;\ - for(_dlp_ = (list); _dlp_!=NULL && comparator(_dlp_, (elem)) != 0; _dlp_= _dlp_->previous) ;\ - if (_dlp_ == NULL && (list) != NULL) {\ - for(_dlp_ = (list)->next; _dlp_!=NULL && comparator(_dlp_, (elem)) != 0; _dlp_= _dlp_->next) ;\ - }\ - (member) = _dlp_;\ - if (_dlp_ == NULL) {\ - the_add_operation(type, list, elem, previous, next);\ - }\ -} - -#define SGLIB_DL_LIST_ADD_BEFORE_IF_NOT_MEMBER(type, list, elem, comparator, previous, next, member) {\ - SGLIB___DL_LIST_GENERIC_ADD_IF_NOT_MEMBER(type, list, elem, comparator, previous, next, member, SGLIB_DL_LIST_ADD_BEFORE);\ -} - -#define SGLIB_DL_LIST_ADD_AFTER_IF_NOT_MEMBER(type, list, elem, comparator, previous, next, member) {\ - SGLIB___DL_LIST_GENERIC_ADD_IF_NOT_MEMBER(type, list, elem, comparator, previous, next, member, SGLIB_DL_LIST_ADD_AFTER);\ -} - -#define SGLIB_DL_LIST_ADD_IF_NOT_MEMBER(type, list, elem, comparator, previous, next, member) {\ - SGLIB___DL_LIST_GENERIC_ADD_IF_NOT_MEMBER(type, list, elem, comparator, previous, next, member, SGLIB_DL_LIST_ADD);\ -} - -#define SGLIB_DL_LIST_CONCAT(type, first, second, previous, next) {\ - if ((first)==NULL) {\ - (first) = (second);\ - } else if ((second)!=NULL) {\ - type *_dlp_;\ - for(_dlp_ = (first); _dlp_->next!=NULL; _dlp_=_dlp_->next) ;\ - SGLIB_DL_LIST_ADD_AFTER(type, _dlp_, second, previous, next);\ - }\ -} - -#define SGLIB_DL_LIST_DELETE(type, list, elem, previous, next) {\ - type *_l_;\ - _l_ = (list);\ - if (_l_ == (elem)) {\ - if ((elem)->previous != NULL) _l_ = (elem)->previous;\ - else _l_ = (elem)->next;\ - }\ - if ((elem)->next != NULL) (elem)->next->previous = (elem)->previous;\ - if ((elem)->previous != NULL) (elem)->previous->next = (elem)->next;\ - (list) = _l_;\ -} - -#define SGLIB_DL_LIST_DELETE_IF_MEMBER(type, list, elem, comparator, previous, next, member) {\ - type *_dlp_;\ - for(_dlp_ = (list); _dlp_!=NULL && comparator(_dlp_, (elem)) != 0; _dlp_= _dlp_->previous) ;\ - if (_dlp_ == NULL && (list) != NULL) {\ - for(_dlp_ = (list)->next; _dlp_!=NULL && comparator(_dlp_, (elem)) != 0; _dlp_= _dlp_->next) ;\ - }\ - (member) = _dlp_;\ - if (_dlp_ != NULL) {\ - SGLIB_DL_LIST_DELETE(type, list, _dlp_, previous, next);\ - }\ -} - -#define SGLIB_DL_LIST_IS_MEMBER(type, list, elem, previous, next, result) {\ - type *_dlp_;\ - SGLIB_LIST_IS_MEMBER(type, list, elem, previous, result);\ - if (result == 0 && (list) != NULL) {\ - _dlp_ = (list)->next;\ - SGLIB_LIST_IS_MEMBER(type, _dlp_, elem, next, result);\ - }\ -} - -#define SGLIB_DL_LIST_FIND_MEMBER(type, list, elem, comparator, previous, next, member) {\ - type *_dlp_;\ - SGLIB_LIST_FIND_MEMBER(type, list, elem, comparator, previous, member);\ - if ((member) == NULL && (list) != NULL) {\ - _dlp_ = (list)->next;\ - SGLIB_LIST_FIND_MEMBER(type, _dlp_, elem, comparator, next, member);\ - }\ -} - -#define SGLIB_DL_LIST_MAP_ON_ELEMENTS(type, list, iteratedVariable, previous, next, command) {\ - type *_dl_;\ - type *iteratedVariable;\ - if ((list)!=NULL) {\ - _dl_ = (list)->next;\ - SGLIB_LIST_MAP_ON_ELEMENTS(type, list, iteratedVariable, previous, command);\ - SGLIB_LIST_MAP_ON_ELEMENTS(type, _dl_, iteratedVariable, next, command);\ - }\ -} - -#define SGLIB_DL_LIST_SORT(type, list, comparator, previous, next) {\ - type *_dll_, *_dlp_, *_dlt_;\ - _dll_ = (list);\ - if (_dll_ != NULL) {\ - for(; _dll_->previous!=NULL; _dll_=_dll_->previous) ;\ - SGLIB_LIST_SORT(type, _dll_, comparator, next);\ - SGLIB___DL_LIST_CREATE_FROM_LIST(type, _dll_, previous, next);\ - (list) = _dll_;\ - }\ -} - -#define SGLIB_DL_LIST_GET_FIRST(type, list, previous, next, result) {\ - type *_dll_;\ - _dll_ = (list);\ - if (_dll_ != NULL) {\ - for(; _dll_->previous!=NULL; _dll_=_dll_->previous) ;\ - }\ - (result) = _dll_;\ -} - -#define SGLIB_DL_LIST_GET_LAST(type, list, previous, next, result) {\ - type *_dll_;\ - _dll_ = (list);\ - if (_dll_ != NULL) {\ - for(; _dll_->next!=NULL; _dll_=_dll_->next) ;\ - }\ - (result) = _dll_;\ -} - -#define SGLIB_DL_LIST_LEN(type, list, previous, next, result) {\ - type *_dl_;\ - int _r1_, _r2_;\ - if ((list)==NULL) {\ - (result) = 0;\ - } else {\ - SGLIB_LIST_LEN(type, list, previous, _r1_);\ - _dl_ = (list)->next;\ - SGLIB_LIST_LEN(type, _dl_, next, _r2_);\ - (result) = _r1_ + _r2_;\ - }\ -} - -#define SGLIB_DL_LIST_REVERSE(type, list, previous, next) {\ - type *_list_,*_nlist_,*_dlp_,*_dln_;\ - _list_ = (list);\ - if (_list_!=NULL) {\ - _nlist_ = _list_->next;\ - while (_list_!=NULL) {\ - _dln_ = _list_->next; \ - _dlp_ = _list_->previous; \ - _list_->next = _dlp_;\ - _list_->previous = _dln_;\ - _list_ = _dlp_;\ - }\ - while (_nlist_!=NULL) {\ - _dln_ = _nlist_->next; \ - _dlp_ = _nlist_->previous; \ - _nlist_->next = _dlp_;\ - _nlist_->previous = _dln_;\ - _nlist_ = _dln_;\ - }\ - }\ -} - -#define SGLIB___DL_LIST_CREATE_FROM_LIST(type, list, previous, next) {\ - type *_dlp_, *_dlt_;\ - _dlp_ = NULL;\ - for(_dlt_ = (list); _dlt_!=NULL; _dlt_ = _dlt_->next) {\ - _dlt_->previous = _dlp_;\ - _dlp_ = _dlt_;\ - }\ -} - - -/* ------------------------------- binary tree traversal (level 0) -------------------- */ - - -#define SGLIB___BIN_TREE_MAP_ON_ELEMENTS(type, tree, iteratedVariable, order, left, right, command) {\ - /* this is non-recursive implementation of tree traversal */\ - /* it maintains the path to the current node in the array '_path_' */\ - /* the _path_[0] contains the root of the tree; */\ - /* the _path_[_pathi_] contains the _current_element_ */\ - /* the macro does not use the _current_element_ after execution of command */\ - /* command can destroy it, it can free the element for example */\ - type *_path_[SGLIB_MAX_TREE_DEEP];\ - type *_right_[SGLIB_MAX_TREE_DEEP];\ - char _pass_[SGLIB_MAX_TREE_DEEP];\ - type *_cn_;\ - int _pathi_;\ - type *iteratedVariable;\ - _cn_ = (tree);\ - _pathi_ = 0;\ - while (_cn_!=NULL) {\ - /* push down to leftmost innermost element */\ - while(_cn_!=NULL) {\ - _path_[_pathi_] = _cn_;\ - _right_[_pathi_] = _cn_->right;\ - _pass_[_pathi_] = 0;\ - _cn_ = _cn_->left;\ - if (order == 0) {\ - iteratedVariable = _path_[_pathi_];\ - {command;}\ - }\ - _pathi_ ++;\ - if (_pathi_ >= SGLIB_MAX_TREE_DEEP) assert(0 && "the binary_tree is too deep");\ - }\ - do {\ - _pathi_ --;\ - if ((order==1 && _pass_[_pathi_] == 0)\ - || (order == 2 && (_pass_[_pathi_] == 1 || _right_[_pathi_]==NULL))) {\ - iteratedVariable = _path_[_pathi_];\ - {command;}\ - }\ - _pass_[_pathi_] ++;\ - } while (_pathi_>0 && _right_[_pathi_]==NULL) ;\ - _cn_ = _right_[_pathi_];\ - _right_[_pathi_] = NULL;\ - _pathi_ ++;\ - }\ -} - -#define SGLIB_BIN_TREE_MAP_ON_ELEMENTS(type, tree, _current_element_, left, right, command) {\ - SGLIB___BIN_TREE_MAP_ON_ELEMENTS(type, tree, _current_element_, 1, left, right, command);\ -} - -#define SGLIB_BIN_TREE_MAP_ON_ELEMENTS_PREORDER(type, tree, _current_element_, left, right, command) {\ - SGLIB___BIN_TREE_MAP_ON_ELEMENTS(type, tree, _current_element_, 0, left, right, command);\ -} - -#define SGLIB_BIN_TREE_MAP_ON_ELEMENTS_POSTORDER(type, tree, _current_element_, left, right, command) {\ - SGLIB___BIN_TREE_MAP_ON_ELEMENTS(type, tree, _current_element_, 2, left, right, command);\ -} - -#define SGLIB___BIN_TREE_FIND_MEMBER(type, tree, elem, left, right, comparator, res) {\ - type *_s_;\ - int _c_;\ - _s_ = (tree);\ - while (_s_!=NULL) {\ - _c_ = comparator((elem), _s_);\ - if (_c_ < 0) _s_ = _s_->left;\ - else if (_c_ > 0) _s_ = _s_->right;\ - else break;\ - }\ - (res) = _s_;\ -} - -/* ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- */ -/* - LEVEL - 1 INTERFACE - */ -/* ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- */ - - - -/* ---------------------------------------------------------------------------- */ -/* ------------------------------ STATIC ARRAYS ------------------------------- */ -/* ---------------------------------------------------------------------------- */ - -/* ----------------------------- array sorting (level 1) ---------------------- */ - -#define SGLIB_DEFINE_ARRAY_SORTING_PROTOTYPES(type, comparator) \ - extern void sglib_##type##_array_quick_sort(type *a, int max);\ - extern void sglib_##type##_array_heap_sort(type *a, int max);\ - - -#define SGLIB_DEFINE_ARRAY_SORTING_FUNCTIONS(type, comparator) \ - void sglib_##type##_array_quick_sort(type *a, int max) {\ - SGLIB_ARRAY_SINGLE_QUICK_SORT(type, a, max, comparator);\ - }\ - void sglib_##type##_array_heap_sort(type *a, int max) {\ - SGLIB_ARRAY_SINGLE_HEAP_SORT(type, a, max, comparator);\ - }\ - - -/* ----------------------------- array queue (level 1) ------------------- */ -/* sglib's queue is stored in a fixed sized array */ -/* queue_type MUST be a structure containing fields: */ -/* afield is the array storing elem_type */ -/* ifield is the index of the first element in the queue */ -/* jfield is the index of the first free element after the queue */ -/* dim is the size of the array afield */ -/* !!!!!!! This data structure is NOT documented, do not use it !!!!!!!!!! */ - - -#define SGLIB_DEFINE_QUEUE_PROTOTYPES(queue_type, elem_type, afield, ifield, jfield, dim) \ - extern void sglib_##queue_type##_init(queue_type *q); \ - extern int sglib_##queue_type##_is_empty(queue_type *q); \ - extern int sglib_##queue_type##_is_full(queue_type *q); \ - extern elem_type sglib_##queue_type##_first_element(queue_type *q); \ - extern elem_type *sglib_##queue_type##_first_element_ptr(queue_type *q); \ - extern void sglib_##queue_type##_add_next(queue_type *q); \ - extern void sglib_##queue_type##_add(queue_type *q, elem_type elem); \ - extern void sglib_##queue_type##_delete_first(queue_type *q); \ - extern void sglib_##queue_type##_delete(queue_type *q); - - -#define SGLIB_DEFINE_QUEUE_FUNCTIONS(queue_type, elem_type, afield, ifield, jfield, dim) \ - void sglib_##queue_type##_init(queue_type *q) {\ - SGLIB_QUEUE_INIT(elem_type, q->afield, q->ifield, q->jfield);\ - }\ - int sglib_##queue_type##_is_empty(queue_type *q) {\ - return(SGLIB_QUEUE_IS_EMPTY(elem_type, q->afield, q->ifield, q->jfield));\ - }\ - int sglib_##queue_type##_is_full(queue_type *q) {\ - return(SGLIB_QUEUE_IS_FULL(elem_type, q->afield, q->ifield, q->jfield));\ - }\ - elem_type sglib_##queue_type##_first_element(queue_type *q) {\ - return(SGLIB_QUEUE_FIRST_ELEMENT(elem_type, q->afield, q->ifield, q->jfield));\ - }\ - elem_type *sglib_##queue_type##_first_element_ptr(queue_type *q) {\ - return(& SGLIB_QUEUE_FIRST_ELEMENT(elem_type, q->afield, q->ifield, q->jfield));\ - }\ - void sglib_##queue_type##_add_next(queue_type *q) {\ - SGLIB_QUEUE_ADD_NEXT(elem_type, q->afield, q->ifield, q->jfield, dim);\ - }\ - void sglib_##queue_type##_add(queue_type *q, elem_type elem) {\ - SGLIB_QUEUE_ADD(elem_type, q->afield, elem, q->ifield, q->jfield, dim);\ - }\ - void sglib_##queue_type##_delete_first(queue_type *q) {\ - SGLIB_QUEUE_DELETE_FIRST(elem_type, q->afield, q->ifield, q->jfield, dim);\ - }\ - void sglib_##queue_type##_delete(queue_type *q) {\ - SGLIB_QUEUE_DELETE_FIRST(elem_type, q->afield, q->ifield, q->jfield, dim);\ - } - - -/* ------------------------ array heap (level 1) ------------------------- */ -/* sglib's heap is a priority queue implemented in a fixed sized array */ -/* heap_type MUST be a structure containing fields: */ -/* afield is the array of size dim storing elem_type */ -/* ifield is the index of the first free element after the queue */ -/* !!!!!!! This data structure is NOT documented, do not use it !!!!!!!!!! */ - - -#define SGLIB_DEFINE_HEAP_PROTOTYPES(heap_type, elem_type, afield, ifield, dim, comparator, elem_exchanger) \ - extern void sglib_##heap_type##_init(heap_type *q); \ - extern int sglib_##heap_type##_is_empty(heap_type *q); \ - extern int sglib_##heap_type##_is_full(heap_type *q); \ - extern elem_type sglib_##heap_type##_first_element(heap_type *q); \ - extern elem_type *sglib_##heap_type##_first_element_ptr(heap_type *q); \ - extern void sglib_##heap_type##_add_next(heap_type *q); \ - extern void sglib_##heap_type##_add(heap_type *q, elem_type elem); \ - extern void sglib_##heap_type##_delete_first(heap_type *q); \ - extern void sglib_##heap_type##_delete(heap_type *q) - -#define SGLIB_DEFINE_HEAP_FUNCTIONS(heap_type, elem_type, afield, ifield, dim, comparator, elem_exchanger) \ - void sglib_##heap_type##_init(heap_type *q) {\ - SGLIB_HEAP_INIT(elem_type, q->afield, q->ifield);\ - }\ - int sglib_##heap_type##_is_empty(heap_type *q) {\ - return(SGLIB_HEAP_IS_EMPTY(elem_type, q->afield, q->ifield));\ - }\ - int sglib_##heap_type##_is_full(heap_type *q) {\ - return(SGLIB_HEAP_IS_FULL(elem_type, q->afield, q->ifield));\ - }\ - elem_type sglib_##heap_type##_first_element(heap_type *q) {\ - return(SGLIB_HEAP_FIRST_ELEMENT(elem_type, q->afield, q->ifield));\ - }\ - elem_type *sglib_##heap_type##_first_element_ptr(heap_type *q) {\ - return(& SGLIB_HEAP_FIRST_ELEMENT(elem_type, q->afield, q->ifield));\ - }\ - void sglib_##heap_type##_add_next(heap_type *q) {\ - SGLIB_HEAP_ADD_NEXT(elem_type, q->afield, q->ifield, dim, comparator, elem_exchanger);\ - }\ - void sglib_##heap_type##_add(heap_type *q, elem_type elem) {\ - SGLIB_HEAP_ADD(elem_type, q->afield, elem, q->ifield, dim, comparator, elem_exchanger);\ - }\ - void sglib_##heap_type##_delete_first(heap_type *q) {\ - SGLIB_HEAP_DELETE_FIRST(elem_type, q->afield, q->ifield, dim, comparator, elem_exchanger);\ - }\ - void sglib_##heap_type##_delete(heap_type *q) {\ - SGLIB_HEAP_DELETE_FIRST(elem_type, q->afield, q->ifield, dim, comparator, elem_exchanger);\ - } - - -/* ------------------------ hashed table (level 1) ------------------------- */ -/* - - sglib's hash table is an array storing directly pointers to objects (not containers). - In this table there is a one-to-one mapping between 'objects' stored - in the table and indexes where they are placed. Each index is - pointing to exactly one 'object' and each 'object' stored in the - table occurs on exactly one index. Once an object is stored in the - table, it can be represented via its index. - - type - is the type of elements - dim - is the size of the hash array - hash_function - is a hashing function mapping type* to unsigned - comparator - is a comparator on elements - - !!!!!!! This data structure is NOT documented, do not use it !!!!!!!!!! -*/ - -#define SGLIB_DEFINE_HASHED_TABLE_PROTOTYPES(type, dim, hash_function, comparator) \ - struct sglib_hashed_##type##_iterator {\ - int currentIndex;\ - int (*subcomparator)(type *, type *);\ - type *equalto;\ - };\ - extern void sglib_hashed_##type##_init(type *table[dim]);\ - extern int sglib_hashed_##type##_add_if_not_member(type *table[dim], type *elem, type **member);\ - extern int sglib_hashed_##type##_is_member(type *table[dim], type *elem);\ - extern type * sglib_hashed_##type##_find_member(type *table[dim], type *elem);\ - extern type *sglib_hashed_##type##_it_init(struct sglib_hashed_##type##_iterator *it, type *table[dim]); \ - extern type *sglib_hashed_##type##_it_init_on_equal(struct sglib_hashed_##type##_iterator *it, type *table[dim], int (*subcomparator)(type *, type *), type *equalto); \ - extern type *sglib_hashed_##type##_it_current(struct sglib_hashed_##type##_iterator *it); \ - extern type *sglib_hashed_##type##_it_next(struct sglib_hashed_##type##_iterator *it); - -#define SGLIB_DEFINE_HASHED_TABLE_FUNCTIONS(type, dim, hash_function, comparator) \ - struct sglib_hashed_##type##_iterator {\ - int currentIndex;\ - type **table;\ - int (*subcomparator)(type *, type *);\ - type *equalto;\ - };\ - void sglib_hashed_##type##_init(type *table[dim]) {\ - SGLIB_HASH_TAB_INIT(type, table, dim);\ - }\ - int sglib_hashed_##type##_add_if_not_member(type *table[dim], type *elem, type **member) {\ - SGLIB_HASH_TAB_ADD_IF_NOT_MEMBER(type, table, dim, elem, hash_function, comparator, *member);\ - }\ - int sglib_hashed_##type##_is_member(type *table[dim], type *elem) {\ - int ind;\ - SGLIB_HASH_TAB_IS_MEMBER(type, table, dim, elem, hash_function, ind);\ - return(ind != -1);\ - }\ - type * sglib_hashed_##type##_find_member(type *table[dim], type *elem) {\ - type *mmb;\ - int ind;\ - SGLIB_HASH_TAB_FIND_MEMBER(type, table, dim, elem, hash_function, comparator, ind, mmb);\ - return(mmb);\ - }\ - type *sglib_hashed_##type##_it_init_on_equal(struct sglib_hashed_##type##_iterator *it, type *table[dim], int (*subcomparator)(type *, type *), type *equalto) {\ - int i;\ - it->table = table;\ - it->subcomparator = subcomparator;\ - it->equalto = equalto;\ - for(i=0; i<(dim) && table[i]==NULL; i++) ;\ - it->currentIndex = i;\ - if (i<(dim)) return(table[i]);\ - return(NULL);\ - }\ - type *sglib_hashed_##type##_it_init(struct sglib_hashed_##type##_iterator *it, type *table[dim]) {\ - sglib_hashed_##type##_it_init_on_equal(it, table, NULL, NULL);\ - }\ - type *sglib_hashed_##type##_it_current(struct sglib_hashed_##type##_iterator *it) {\ - return(table[it->currentIndex]);\ - }\ - type *sglib_hashed_##type##_it_next(struct sglib_hashed_##type##_iterator *it) {\ - i=it->currentIndex;\ - if (i<(dim)) {\ - for(i++; i<(dim) && table[i]==NULL; i++) ;\ - }\ - it->currentIndex = i;\ - if (i<(dim)) return(table[i]);\ - return(NULL);\ - } - - -/* ------------------- hashed container (only for level 1) -------------------- */ -/* - hashed container is a table of given fixed size containing another - (dynamic) base container in each cell. Once an object should be - inserted into the hashed container, a hash function is used to - determine the cell where the object belongs and the object is - inserted into the base container stored in this cell. Usually the - base container is simply a list or a sorted list, but it can be a - red-black tree as well. - - parameters: - type - the type of the container stored in each cell. - dim - the size of the hashed array - hash_function - the hashing function hashing 'type *' to unsigned. - -*/ - -#define SGLIB_DEFINE_HASHED_CONTAINER_PROTOTYPES(type, dim, hash_function) \ - struct sglib_hashed_##type##_iterator {\ - struct sglib_##type##_iterator containerIt;\ - type **table;\ - int currentIndex;\ - int (*subcomparator)(type *, type *);\ - type *equalto;\ - };\ - extern void sglib_hashed_##type##_init(type *table[dim]);\ - extern void sglib_hashed_##type##_add(type *table[dim], type *elem);\ - extern int sglib_hashed_##type##_add_if_not_member(type *table[dim], type *elem, type **member);\ - extern void sglib_hashed_##type##_delete(type *table[dim], type *elem);\ - extern int sglib_hashed_##type##_delete_if_member(type *table[dim], type *elem, type **memb);\ - extern int sglib_hashed_##type##_is_member(type *table[dim], type *elem);\ - extern type * sglib_hashed_##type##_find_member(type *table[dim], type *elem);\ - extern type *sglib_hashed_##type##_it_init(struct sglib_hashed_##type##_iterator *it, type *table[dim]); \ - extern type *sglib_hashed_##type##_it_init_on_equal(struct sglib_hashed_##type##_iterator *it, type *table[dim], int (*subcomparator)(type *, type *), type *equalto); \ - extern type *sglib_hashed_##type##_it_current(struct sglib_hashed_##type##_iterator *it); \ - extern type *sglib_hashed_##type##_it_next(struct sglib_hashed_##type##_iterator *it); - -#define SGLIB_DEFINE_HASHED_CONTAINER_FUNCTIONS(type, dim, hash_function) \ - /*extern unsigned hash_function(type *elem);*/\ - void sglib_hashed_##type##_init(type *table[dim]) {\ - unsigned i;\ - for(i=0; i<(dim); i++) table[i] = NULL;\ - }\ - void sglib_hashed_##type##_add(type *table[dim], type *elem) {\ - unsigned i;\ - i = ((unsigned)hash_function(elem)) % (dim);\ - sglib_##type##_add(&(table)[i], elem);\ - }\ - int sglib_hashed_##type##_add_if_not_member(type *table[dim], type *elem, type **member) {\ - unsigned i;\ - i = ((unsigned)hash_function(elem)) % (dim);\ - return(sglib_##type##_add_if_not_member(&(table)[i], elem, member));\ - }\ - void sglib_hashed_##type##_delete(type *table[dim], type *elem) {\ - unsigned i;\ - i = ((unsigned)hash_function(elem)) % (dim);\ - sglib_##type##_delete(&(table)[i], elem);\ - }\ - int sglib_hashed_##type##_delete_if_member(type *table[dim], type *elem, type **memb) {\ - unsigned i;\ - i = ((unsigned)hash_function(elem)) % (dim);\ - return(sglib_##type##_delete_if_member(&(table)[i], elem, memb));\ - }\ - int sglib_hashed_##type##_is_member(type *table[dim], type *elem) {\ - unsigned i;\ - i = ((unsigned)hash_function(elem)) % (dim);\ - return(sglib_##type##_is_member((table)[i], elem));\ - }\ - type * sglib_hashed_##type##_find_member(type *table[dim], type *elem) {\ - unsigned i;\ - i = ((unsigned)hash_function(elem)) % (dim);\ - return(sglib_##type##_find_member((table)[i], elem));\ - }\ - type *sglib_hashed_##type##_it_init_on_equal(struct sglib_hashed_##type##_iterator *it, type *table[dim], int (*subcomparator)(type *, type *), type *equalto) {\ - type *e;\ - it->table = table;\ - it->currentIndex = 0;\ - it->subcomparator = subcomparator;\ - it->equalto = equalto;\ - e = sglib_##type##_it_init_on_equal(&it->containerIt, table[it->currentIndex], it->subcomparator, it->equalto);\ - if (e==NULL) e = sglib_hashed_##type##_it_next(it);\ - return(e);\ - }\ - type *sglib_hashed_##type##_it_init(struct sglib_hashed_##type##_iterator *it, type *table[dim]) {\ - return(sglib_hashed_##type##_it_init_on_equal(it, table, NULL, NULL));\ - }\ - type *sglib_hashed_##type##_it_current(struct sglib_hashed_##type##_iterator *it) {\ - return(sglib_##type##_it_current(&it->containerIt));\ - }\ - type *sglib_hashed_##type##_it_next(struct sglib_hashed_##type##_iterator *it) {\ - type *e;\ - e = sglib_##type##_it_next(&it->containerIt);\ - while (e==NULL && (++(it->currentIndex))<(dim)) {\ - e = sglib_##type##_it_init_on_equal(&it->containerIt, it->table[it->currentIndex], it->subcomparator, it->equalto);\ - }\ - return(e);\ - } - - - -/* ---------------------------------------------------------------------------- */ -/* ------------------------- DYNAMIC DATA STRUCTURES -------------------------- */ -/* ---------------------------------------------------------------------------- */ - - - -/* ------------------------------------ list (level 1) -------------------------------- */ - -#define SGLIB_DEFINE_LIST_PROTOTYPES(type, comparator, next) \ - struct sglib_##type##_iterator {\ - type *currentelem;\ - type *nextelem;\ - int (*subcomparator)(type *, type *);\ - type *equalto;\ - };\ - extern void sglib_##type##_add(type **list, type *elem);\ - extern int sglib_##type##_add_if_not_member(type **list, type *elem, type **member);\ - extern void sglib_##type##_concat(type **first, type *second);\ - extern void sglib_##type##_delete(type **list, type *elem);\ - extern int sglib_##type##_delete_if_member(type **list, type *elem, type **member);\ - extern int sglib_##type##_is_member(type *list, type *elem);\ - extern type *sglib_##type##_find_member(type *list, type *elem);\ - extern void sglib_##type##_sort(type **list);\ - extern int sglib_##type##_len(type *list);\ - extern void sglib_##type##_reverse(type **list);\ - extern type *sglib_##type##_it_init(struct sglib_##type##_iterator *it, type *list); \ - extern type *sglib_##type##_it_init_on_equal(struct sglib_##type##_iterator *it, type *list, int (*subcomparator)(type *, type *), type *equalto); \ - extern type *sglib_##type##_it_current(struct sglib_##type##_iterator *it); \ - extern type *sglib_##type##_it_next(struct sglib_##type##_iterator *it); - - -#define SGLIB_DEFINE_LIST_FUNCTIONS(type, comparator, next) \ - int sglib_##type##_is_member(type *list, type *elem) {\ - int result;\ - SGLIB_LIST_IS_MEMBER(type, list, elem, next, result);\ - return(result);\ - }\ - type *sglib_##type##_find_member(type *list, type *elem) {\ - type *result;\ - SGLIB_LIST_FIND_MEMBER(type, list, elem, comparator, next, result);\ - return(result);\ - }\ - int sglib_##type##_add_if_not_member(type **list, type *elem, type **member) {\ - SGLIB_LIST_ADD_IF_NOT_MEMBER(type, *list, elem, comparator, next, *member);\ - return(*member==NULL);\ - }\ - void sglib_##type##_add(type **list, type *elem) {\ - SGLIB_LIST_ADD(type, *list, elem, next);\ - }\ - void sglib_##type##_concat(type **first, type *second) {\ - SGLIB_LIST_CONCAT(type, *first, second, next);\ - }\ - void sglib_##type##_delete(type **list, type *elem) {\ - SGLIB_LIST_DELETE(type, *list, elem, next);\ - }\ - int sglib_##type##_delete_if_member(type **list, type *elem, type **member) {\ - SGLIB_LIST_DELETE_IF_MEMBER(type, *list, elem, comparator, next, *member);\ - return(*member!=NULL);\ - }\ - void sglib_##type##_sort(type **list) { \ - SGLIB_LIST_SORT(type, *list, comparator, next);\ - }\ - int sglib_##type##_len(type *list) {\ - int res;\ - SGLIB_LIST_LEN(type, list, next, res);\ - return(res);\ - }\ - void sglib_##type##_reverse(type **list) {\ - SGLIB_LIST_REVERSE(type, *list, next);\ - }\ - \ - type *sglib_##type##_it_init_on_equal(struct sglib_##type##_iterator *it, type *list, int (*subcomparator)(type *, type *), type *equalto) {\ - it->subcomparator = subcomparator;\ - it->equalto = equalto;\ - it->nextelem = list;\ - return(sglib_##type##_it_next(it));\ - }\ - type *sglib_##type##_it_init(struct sglib_##type##_iterator *it, type *list) {\ - return(sglib_##type##_it_init_on_equal(it, list, NULL, NULL));\ - }\ - type *sglib_##type##_it_current(struct sglib_##type##_iterator *it) {\ - return(it->currentelem);\ - }\ - type *sglib_##type##_it_next(struct sglib_##type##_iterator *it) {\ - type *ce, *eq;\ - int (*scp)(type *, type *);\ - ce = it->nextelem;\ - it->nextelem = NULL;\ - if (it->subcomparator != NULL) {\ - eq = it->equalto; \ - scp = it->subcomparator;\ - while (ce!=NULL && scp(ce, eq)!=0) ce = ce->next;\ - }\ - it->currentelem = ce;\ - if (ce != NULL) it->nextelem = ce->next;\ - return(ce);\ - } - -/* ----------------------------- sorted list (level 1) ----------------------------------- */ - - -#define SGLIB_DEFINE_SORTED_LIST_PROTOTYPES(type, comparator, next) \ - struct sglib_##type##_iterator {\ - type *currentelem;\ - type *nextelem;\ - int (*subcomparator)(type *, type *);\ - type *equalto;\ - };\ - extern void sglib_##type##_add(type **list, type *elem);\ - extern int sglib_##type##_add_if_not_member(type **list, type *elem, type **member);\ - extern void sglib_##type##_delete(type **list, type *elem);\ - extern int sglib_##type##_delete_if_member(type **list, type *elem, type **member);\ - extern int sglib_##type##_is_member(type *list, type *elem);\ - extern type *sglib_##type##_find_member(type *list, type *elem);\ - extern int sglib_##type##_len(type *list);\ - extern void sglib_##type##_sort(type **list);\ - extern type *sglib_##type##_it_init(struct sglib_##type##_iterator *it, type *list); \ - extern type *sglib_##type##_it_init_on_equal(struct sglib_##type##_iterator *it, type *list, int (*subcomparator)(type *, type *), type *equalto); \ - extern type *sglib_##type##_it_current(struct sglib_##type##_iterator *it); \ - extern type *sglib_##type##_it_next(struct sglib_##type##_iterator *it); - - -#define SGLIB_DEFINE_SORTED_LIST_FUNCTIONS(type, comparator, next) \ - int sglib_##type##_is_member(type *list, type *elem) {\ - int result;\ - SGLIB_SORTED_LIST_IS_MEMBER(type, list, elem, comparator, next, result);\ - return(result);\ - }\ - type *sglib_##type##_find_member(type *list, type *elem) {\ - type *result;\ - SGLIB_SORTED_LIST_FIND_MEMBER(type, list, elem, comparator, next, result);\ - return(result);\ - }\ - int sglib_##type##_add_if_not_member(type **list, type *elem, type **member) {\ - SGLIB_SORTED_LIST_ADD_IF_NOT_MEMBER(type, *list, elem, comparator, next, *member);\ - return(*member==NULL);\ - }\ - void sglib_##type##_add(type **list, type *elem) {\ - SGLIB_SORTED_LIST_ADD(type, *list, elem, comparator, next);\ - }\ - void sglib_##type##_delete(type **list, type *elem) {\ - SGLIB_SORTED_LIST_DELETE(type, *list, elem, next);\ - }\ - int sglib_##type##_delete_if_member(type **list, type *elem, type **member) {\ - SGLIB_SORTED_LIST_DELETE_IF_MEMBER(type, *list, elem, comparator, next, *member);\ - return(*member!=NULL);\ - }\ - int sglib_##type##_len(type *list) {\ - int res;\ - SGLIB_SORTED_LIST_LEN(type, list, next, res);\ - return(res);\ - }\ - void sglib_##type##_sort(type **list) { \ - SGLIB_LIST_SORT(type, *list, comparator, next);\ - }\ - \ - type *sglib_##type##_it_init_on_equal(struct sglib_##type##_iterator *it, type *list, int (*subcomparator)(type *, type *), type *equalto) {\ - it->subcomparator = subcomparator;\ - it->equalto = equalto;\ - it->nextelem = list;\ - return(sglib_##type##_it_next(it));\ - }\ - type *sglib_##type##_it_init(struct sglib_##type##_iterator *it, type *list) {\ - return(sglib_##type##_it_init_on_equal(it, list, NULL, NULL));\ - }\ - type *sglib_##type##_it_current(struct sglib_##type##_iterator *it) {\ - return(it->currentelem);\ - }\ - type *sglib_##type##_it_next(struct sglib_##type##_iterator *it) {\ - type *ce, *eq;\ - int (*scp)(type *, type *);\ - int c;\ - ce = it->nextelem;\ - it->nextelem = NULL;\ - if (it->subcomparator != NULL) {\ - eq = it->equalto; \ - scp = it->subcomparator;\ - while (ce!=NULL && (c=scp(ce, eq)) < 0) ce = ce->next;\ - if (ce != NULL && c > 0) ce = NULL;\ - }\ - it->currentelem = ce;\ - if (ce != NULL) it->nextelem = ce->next;\ - return(ce);\ - } - - -/* ----------------------------- double linked list (level 1) ------------------------------ */ - - -#define SGLIB_DEFINE_DL_LIST_PROTOTYPES(type, comparator, previous, next) \ - struct sglib_##type##_iterator {\ - type *currentelem;\ - type *prevelem;\ - type *nextelem;\ - int (*subcomparator)(type *, type *);\ - type *equalto;\ - };\ - extern void sglib_##type##_add(type **list, type *elem);\ - extern void sglib_##type##_add_before(type **list, type *elem);\ - extern void sglib_##type##_add_after(type **list, type *elem);\ - extern int sglib_##type##_add_if_not_member(type **list, type *elem, type **member);\ - extern int sglib_##type##_add_before_if_not_member(type **list, type *elem, type **member);\ - extern int sglib_##type##_add_after_if_not_member(type **list, type *elem, type **member);\ - extern void sglib_##type##_concat(type **first, type *second);\ - extern void sglib_##type##_delete(type **list, type *elem);\ - extern int sglib_##type##_delete_if_member(type **list, type *elem, type **member);\ - extern int sglib_##type##_is_member(type *list, type *elem);\ - extern type *sglib_##type##_find_member(type *list, type *elem);\ - extern type *sglib_##type##_get_first(type *list);\ - extern type *sglib_##type##_get_last(type *list);\ - extern void sglib_##type##_sort(type **list);\ - extern int sglib_##type##_len(type *list);\ - extern void sglib_##type##_reverse(type **list);\ - extern type *sglib_##type##_it_init(struct sglib_##type##_iterator *it, type *list); \ - extern type *sglib_##type##_it_init_on_equal(struct sglib_##type##_iterator *it, type *list, int (*subcomparator)(type *, type *), type *equalto); \ - extern type *sglib_##type##_it_current(struct sglib_##type##_iterator *it); \ - extern type *sglib_##type##_it_next(struct sglib_##type##_iterator *it); - - -#define SGLIB_DEFINE_DL_LIST_FUNCTIONS(type, comparator, previous, next) \ - void sglib_##type##_add(type **list, type *elem) {\ - SGLIB_DL_LIST_ADD(type, *list, elem, previous, next);\ - }\ - void sglib_##type##_add_after(type **list, type *elem) {\ - SGLIB_DL_LIST_ADD_AFTER(type, *list, elem, previous, next);\ - }\ - void sglib_##type##_add_before(type **list, type *elem) {\ - SGLIB_DL_LIST_ADD_BEFORE(type, *list, elem, previous, next);\ - }\ - int sglib_##type##_add_if_not_member(type **list, type *elem, type **member) {\ - SGLIB_DL_LIST_ADD_IF_NOT_MEMBER(type, *list, elem, comparator, previous, next, *member);\ - return(*member==NULL);\ - }\ - int sglib_##type##_add_after_if_not_member(type **list, type *elem, type **member) {\ - SGLIB_DL_LIST_ADD_AFTER_IF_NOT_MEMBER(type, *list, elem, comparator, previous, next, *member);\ - return(*member==NULL);\ - }\ - int sglib_##type##_add_before_if_not_member(type **list, type *elem, type **member) {\ - SGLIB_DL_LIST_ADD_BEFORE_IF_NOT_MEMBER(type, *list, elem, comparator, previous, next, *member);\ - return(*member==NULL);\ - }\ - void sglib_##type##_concat(type **first, type *second) {\ - SGLIB_DL_LIST_CONCAT(type, *first, second, previous, next);\ - }\ - void sglib_##type##_delete(type **list, type *elem) {\ - SGLIB_DL_LIST_DELETE(type, *list, elem, previous, next);\ - }\ - int sglib_##type##_delete_if_member(type **list, type *elem, type **member) {\ - SGLIB_DL_LIST_DELETE_IF_MEMBER(type, *list, elem, comparator, previous, next, *member);\ - return(*member!=NULL);\ - }\ - int sglib_##type##_is_member(type *list, type *elem) {\ - int result;\ - SGLIB_DL_LIST_IS_MEMBER(type, list, elem, previous, next, result);\ - return(result);\ - }\ - type *sglib_##type##_find_member(type *list, type *elem) {\ - type *result;\ - SGLIB_DL_LIST_FIND_MEMBER(type, list, elem, comparator, previous, next, result);\ - return(result);\ - }\ - type *sglib_##type##_get_first(type *list) {\ - type *result;\ - SGLIB_DL_LIST_GET_FIRST(type, list, previous, next, result);\ - return(result);\ - }\ - type *sglib_##type##_get_last(type *list) {\ - type *result;\ - SGLIB_DL_LIST_GET_LAST(type, list, previous, next, result);\ - return(result);\ - }\ - void sglib_##type##_sort(type **list) {\ - SGLIB_DL_LIST_SORT(type, *list, comparator, previous, next);\ - }\ - int sglib_##type##_len(type *list) {\ - int res;\ - SGLIB_DL_LIST_LEN(type, list, previous, next, res);\ - return(res);\ - }\ - void sglib_##type##_reverse(type **list) {\ - SGLIB_DL_LIST_REVERSE(type, *list, previous, next);\ - }\ - \ - type *sglib_##type##_it_init_on_equal(struct sglib_##type##_iterator *it, type *list, int (*subcomparator)(type *, type *), type *equalto) {\ - it->subcomparator = subcomparator;\ - it->equalto = equalto;\ - it->prevelem = list;\ - it->nextelem = list;\ - if (list != NULL) it->nextelem = list->next;\ - return(sglib_##type##_it_next(it));\ - }\ - type *sglib_##type##_it_init(struct sglib_##type##_iterator *it, type *list) {\ - return(sglib_##type##_it_init_on_equal(it, list, NULL, NULL));\ - }\ - type *sglib_##type##_it_current(struct sglib_##type##_iterator *it) {\ - return(it->currentelem);\ - }\ - type *sglib_##type##_it_next(struct sglib_##type##_iterator *it) {\ - type *ce, *eq;\ - int (*scp)(type *, type *);\ - ce = it->prevelem;\ - it->prevelem = NULL;\ - if (it->subcomparator != NULL) {\ - eq = it->equalto; \ - scp = it->subcomparator;\ - while (ce!=NULL && scp(eq, ce)!=0) ce = ce->previous;\ - }\ - if (ce != NULL) {\ - it->prevelem = ce->previous;\ - } else {\ - ce = it->nextelem;\ - it->nextelem = NULL;\ - if (it->subcomparator != NULL) {\ - eq = it->equalto; \ - scp = it->subcomparator;\ - while (ce!=NULL && scp(ce, eq)!=0) ce = ce->next;\ - }\ - if (ce != NULL) it->nextelem = ce->next;\ - }\ - it->currentelem = ce;\ - return(ce);\ - } - - -/* --------------------------------- red-black trees (level 1) -------------------------------- */ - -/* - -This implementation requires pointers to left and right sons (no -parent pointer is needed) and one bit of additional information -storing the color of the node. The implementation follows discrepancy -fixing rules from: -http://www.cis.ohio-state.edu/~gurari/course/cis680/cis680Ch11.html - -*/ - -#define SGLIB___RBTREE_FIX_INSERTION_DISCREPANCY(type, tree, leftt, rightt, bits, RED, BLACK) {\ - type *t, *tl, *a, *b, *c, *ar, *bl, *br, *cl, *cr;\ - t = *tree;\ - tl = t->leftt;\ - if (t->rightt!=NULL && SGLIB___GET_VALUE(t->rightt->bits)==RED) {\ - if (SGLIB___GET_VALUE(tl->bits)==RED) {\ - if ((tl->leftt!=NULL && SGLIB___GET_VALUE(tl->leftt->bits)==RED) \ - || (tl->rightt!=NULL && SGLIB___GET_VALUE(tl->rightt->bits)==RED)) {\ - SGLIB___SET_VALUE(t->leftt->bits,BLACK);\ - SGLIB___SET_VALUE(t->rightt->bits,BLACK);\ - SGLIB___SET_VALUE(t->bits,RED);\ - }\ - }\ - } else {\ - if (SGLIB___GET_VALUE(tl->bits)==RED) {\ - if (tl->leftt!=NULL && SGLIB___GET_VALUE(tl->leftt->bits)==RED) {\ - a = t; b = tl; c = tl->leftt;\ - br = b->rightt;\ - a->leftt = br;\ - b->leftt = c; b->rightt = a;\ - SGLIB___SET_VALUE(a->bits,RED);\ - SGLIB___SET_VALUE(b->bits,BLACK);\ - *tree = b;\ - } else if (tl->rightt!=NULL && SGLIB___GET_VALUE(tl->rightt->bits)==RED) {\ - a = t; b = tl; ar=a->rightt;\ - bl=b->leftt; c=b->rightt;\ - cl=c->leftt; cr=c->rightt;\ - b->rightt = cl;\ - a->leftt = cr;\ - c->leftt = b;\ - c->rightt = a;\ - SGLIB___SET_VALUE(c->bits,BLACK);\ - SGLIB___SET_VALUE(a->bits,RED);\ - *tree = c;\ - }\ - }\ - }\ -} - -#define SGLIB___RBTREE_FIX_DELETION_DISCREPANCY(type, tree, leftt, rightt, bits, RED, BLACK, res) {\ - type *t, *a, *b, *c, *d, *ar, *bl, *br, *cl, *cr, *dl, *dr;\ - t = a = *tree;\ - assert(t!=NULL);\ - ar = a->rightt;\ - b = t->leftt;\ - if (b==NULL) {\ - assert(SGLIB___GET_VALUE(t->bits)==RED);\ - SGLIB___SET_VALUE(t->bits,BLACK);\ - res = 0;\ - } else {\ - bl = b->leftt;\ - br = b->rightt;\ - if (SGLIB___GET_VALUE(b->bits)==RED) {\ - if (br==NULL) {\ - *tree = b;\ - SGLIB___SET_VALUE(b->bits,BLACK);\ - b->rightt = a;\ - a->leftt = br;\ - res = 0;\ - } else {\ - c = br;\ - assert(c!=NULL && SGLIB___GET_VALUE(c->bits)==BLACK);\ - cl = c->leftt;\ - cr = c->rightt;\ - if ((cl==NULL||SGLIB___GET_VALUE(cl->bits)==BLACK) && (cr==NULL||SGLIB___GET_VALUE(cr->bits)==BLACK)) {\ - *tree = b;\ - b->rightt = a;\ - SGLIB___SET_VALUE(b->bits,BLACK);\ - a->leftt = c;\ - SGLIB___SET_VALUE(c->bits,RED);\ - res = 0;\ - } else if (cl!=NULL && SGLIB___GET_VALUE(cl->bits)==RED) {\ - if (cr!=NULL && SGLIB___GET_VALUE(cr->bits)==RED) {\ - d = cr;\ - dl = d->leftt;\ - dr = d->rightt;\ - *tree = d;\ - SGLIB___SET_VALUE(d->bits,BLACK);\ - d->leftt = b;\ - c->rightt = dl;\ - d->rightt = a;\ - a->leftt = dr;\ - res = 0;\ - } else {\ - *tree = c;\ - c->leftt = b;\ - c->rightt = a;\ - b->leftt = bl;\ - b->rightt = cl;\ - a->leftt = cr;\ - SGLIB___SET_VALUE(cl->bits,BLACK);\ - res = 0;\ - }\ - } else if (cr!=NULL && SGLIB___GET_VALUE(cr->bits)==RED) {\ - assert(cl==NULL || SGLIB___GET_VALUE(cl->bits)==BLACK);\ - d = cr;\ - dl = d->leftt;\ - dr = d->rightt;\ - *tree = d;\ - SGLIB___SET_VALUE(d->bits,BLACK);\ - d->leftt = b;\ - c->rightt = dl;\ - d->rightt = a;\ - a->leftt = dr;\ - res = 0;\ - } else {\ - assert(0);\ - res = 0;\ - }\ - }\ - } else {\ - if ((bl==NULL || SGLIB___GET_VALUE(bl->bits)==BLACK) && (br==NULL || SGLIB___GET_VALUE(br->bits)==BLACK)) {\ - res = (SGLIB___GET_VALUE(a->bits)==BLACK);\ - SGLIB___SET_VALUE(a->bits,BLACK);\ - SGLIB___SET_VALUE(b->bits,RED);\ - } else if (bl!=NULL && SGLIB___GET_VALUE(bl->bits)==RED) {\ - if (br==NULL || SGLIB___GET_VALUE(br->bits)==BLACK) {\ - *tree = b;\ - SGLIB___SET_VALUE(b->bits,SGLIB___GET_VALUE(a->bits));\ - SGLIB___SET_VALUE(a->bits,BLACK);\ - b->rightt = a;\ - a->leftt = br;\ - SGLIB___SET_VALUE(bl->bits,BLACK);\ - res = 0;\ - } else {\ - assert(bl!=NULL);\ - assert(br!=NULL);\ - assert(SGLIB___GET_VALUE(bl->bits)==RED);\ - assert(SGLIB___GET_VALUE(br->bits)==RED);\ - c = br;\ - cl = c->leftt;\ - cr = c->rightt;\ - *tree = c;\ - SGLIB___SET_VALUE(c->bits,SGLIB___GET_VALUE(a->bits));\ - SGLIB___SET_VALUE(a->bits,BLACK);\ - c->leftt = b;\ - c->rightt = a;\ - b->rightt = cl;\ - a->leftt = cr;\ - res = 0;\ - }\ - } else {\ - assert(br!=NULL && SGLIB___GET_VALUE(br->bits)==RED);\ - c = br;\ - cl = c->leftt;\ - cr = c->rightt;\ - *tree = c;\ - SGLIB___SET_VALUE(c->bits,SGLIB___GET_VALUE(a->bits));\ - SGLIB___SET_VALUE(a->bits,BLACK);\ - c->leftt = b;\ - c->rightt = a;\ - b->rightt = cl;\ - a->leftt = cr;\ - res = 0;\ - }\ - }\ - }\ -} - - -#define SGLIB_DEFINE_RBTREE_FUNCTIONS_GENERAL(type, left, right, bits, comparator, RED, BLACK) \ -static void sglib___##type##_fix_left_insertion_discrepancy(type **tree) {\ - SGLIB___RBTREE_FIX_INSERTION_DISCREPANCY(type, tree, left, right, bits, RED, BLACK);\ -}\ -\ -static void sglib___##type##_fix_right_insertion_discrepancy(type **tree) {\ - SGLIB___RBTREE_FIX_INSERTION_DISCREPANCY(type, tree, right, left, bits, RED, BLACK);\ -}\ -\ -static int sglib___##type##_fix_left_deletion_discrepancy(type **tree) {\ - int res;\ - SGLIB___RBTREE_FIX_DELETION_DISCREPANCY(type, tree, right, left, bits, RED, BLACK, res);\ - return(res);\ -}\ -\ -static int sglib___##type##_fix_right_deletion_discrepancy(type **tree) {\ - int res;\ - SGLIB___RBTREE_FIX_DELETION_DISCREPANCY(type, tree, left, right, bits, RED, BLACK, res);\ - return(res);\ -}\ -\ -static void sglib___##type##_add_recursive(type **tree, type *elem) {\ - int cmp;\ - type *t;\ - t = *tree;\ - if (t == NULL) {\ - SGLIB___SET_VALUE(elem->bits,RED);\ - *tree =elem;\ - } else {\ - cmp = comparator(elem, t);\ - if (cmp < 0 || (cmp==0 && elemleft, elem);\ - if (SGLIB___GET_VALUE(t->bits)==BLACK) sglib___##type##_fix_left_insertion_discrepancy(tree);\ - } else {\ - sglib___##type##_add_recursive(&t->right, elem);\ - if (SGLIB___GET_VALUE(t->bits)==BLACK) sglib___##type##_fix_right_insertion_discrepancy(tree);\ - }\ - }\ -}\ -\ -static int sglib___##type##_delete_rightmost_leaf(type **tree, type **theLeaf) {\ - type *t;\ - int res, deepDecreased;\ - t = *tree;\ - res = 0;\ - assert(t!=NULL);\ - if (t->right == NULL) {\ - *theLeaf = t;\ - if (t->left!=NULL) {\ - if (SGLIB___GET_VALUE(t->bits)==BLACK && SGLIB___GET_VALUE(t->left->bits)==BLACK) res = 1;\ - SGLIB___SET_VALUE(t->left->bits,BLACK);\ - *tree = t->left;\ - } else {\ - *tree = NULL;\ - res = (SGLIB___GET_VALUE(t->bits)==BLACK);\ - }\ - } else {\ - deepDecreased = sglib___##type##_delete_rightmost_leaf(&t->right, theLeaf);\ - if (deepDecreased) res = sglib___##type##_fix_right_deletion_discrepancy(tree);\ - }\ - return(res);\ -}\ -\ -int sglib___##type##_delete_recursive(type **tree, type *elem) {\ - type *t, *theLeaf;\ - int cmp, res, deepDecreased;\ - t = *tree;\ - res = 0;\ - if (t==NULL) {\ - assert(0 && "The element to delete not found in the tree, use 'delete_if_member'"!=NULL);\ - } else {\ - cmp = comparator(elem, t);\ - if (cmp < 0 || (cmp==0 && elemleft, elem);\ - if (deepDecreased) {\ - res = sglib___##type##_fix_left_deletion_discrepancy(tree);\ - }\ - } else if (cmp > 0 || (cmp==0 && elem>t)) {\ - deepDecreased = sglib___##type##_delete_recursive(&t->right, elem);\ - if (deepDecreased) {\ - res = sglib___##type##_fix_right_deletion_discrepancy(tree);\ - }\ - } else {\ - assert(elem==t && "Deleting an element which is non member of the tree, use 'delete_if_member'"!=NULL);\ - if (t->left == NULL) {\ - if (t->right == NULL) {\ - /* a leaf, delete, it; */\ - *tree = NULL;\ - res = (SGLIB___GET_VALUE(t->bits)==BLACK);\ - } else {\ - if (SGLIB___GET_VALUE(t->bits)==0 && SGLIB___GET_VALUE(t->right->bits)==0) res = 1;\ - SGLIB___SET_VALUE(t->right->bits,BLACK);\ - *tree = t->right;\ - }\ - } else {\ - /* propagate deletion until righmost leaf of left subtree */\ - deepDecreased = sglib___##type##_delete_rightmost_leaf(&t->left, &theLeaf);\ - theLeaf->left = t->left;\ - theLeaf->right = t->right;\ - SGLIB___SET_VALUE(theLeaf->bits,SGLIB___GET_VALUE(t->bits));\ - *tree = theLeaf;\ - if (deepDecreased) res = sglib___##type##_fix_left_deletion_discrepancy(tree);\ - }\ - }\ - }\ - return(res);\ -}\ -\ -void sglib_##type##_add(type **tree, type *elem) {\ - elem->left = elem->right = NULL;\ - sglib___##type##_add_recursive(tree, elem);\ - SGLIB___SET_VALUE((*tree)->bits,BLACK);\ -}\ -\ -void sglib_##type##_delete(type **tree, type *elem) {\ - sglib___##type##_delete_recursive(tree, elem);\ - if (*tree!=NULL) SGLIB___SET_VALUE((*tree)->bits,BLACK);\ -}\ -\ -type *sglib_##type##_find_member(type *t, type *elem) {\ - type *res;\ - SGLIB___BIN_TREE_FIND_MEMBER(type, t, elem, left, right, comparator, res);\ - return(res);\ -}\ -\ -int sglib_##type##_is_member(type *t, type *elem) {\ - int cmp;\ - while (t!=NULL) {\ - cmp = comparator(elem, t);\ - if (cmp < 0 || (cmp==0 && elemleft;\ - } else if (cmp > 0 || (cmp==0 && elem>t)) {\ - t = t->right;\ - } else {\ - assert(t == elem);\ - return(1);\ - }\ - }\ - return(0);\ -}\ -\ -int sglib_##type##_delete_if_member(type **tree, type *elem, type **memb) {\ - if ((*memb=sglib_##type##_find_member(*tree, elem))!=NULL) {\ - sglib_##type##_delete(tree, *memb);\ - return(1);\ - } else {\ - return(0);\ - }\ -}\ -int sglib_##type##_add_if_not_member(type **tree, type *elem, type **memb) {\ - if ((*memb=sglib_##type##_find_member(*tree, elem))==NULL) {\ - sglib_##type##_add(tree, elem);\ - return(1);\ - } else {\ - return(0);\ - }\ -}\ -int sglib_##type##_len(type *t) {\ - int n;\ - type *e;\ - n = 0;\ - SGLIB_BIN_TREE_MAP_ON_ELEMENTS(type, t, e, left, right, n++);\ - return(n);\ -}\ -\ -void sglib__##type##_it_compute_current_elem(struct sglib_##type##_iterator *it) {\ - int i,j,cmp;\ - type *s, *eqt;\ - int (*subcomparator)(type *, type *);\ - eqt = it->equalto;\ - subcomparator = it->subcomparator;\ - it->currentelem = NULL;\ - while(it->pathi > 0 && it->currentelem==NULL) {\ - i = it->pathi-1;\ - if (i >= 0) {\ - if (it->pass[i] >= 2) {\ - /* goto up */\ - it->pathi --;\ - } else {\ - if (it->pass[i] == 0) {\ - /* goto left */\ - s = it->path[i]->left;\ - } else {\ - /* goto right */\ - s = it->path[i]->right;\ - }\ - if (eqt != NULL) {\ - if (subcomparator == NULL) {\ - SGLIB___BIN_TREE_FIND_MEMBER(type, s, eqt, left, right, comparator, s);\ - } else {\ - SGLIB___BIN_TREE_FIND_MEMBER(type, s, eqt, left, right, subcomparator, s);\ - }\ - }\ - if (s != NULL) {\ - j = i+1;\ - it->path[j] = s;\ - it->pass[j] = 0;\ - it->pathi ++;\ - }\ - it->pass[i] ++;\ - }\ - }\ - if (it->pathi>0 && it->order == it->pass[it->pathi-1]) {\ - it->currentelem = it->path[it->pathi-1];\ - }\ - }\ -}\ -type *sglib__##type##_it_init(struct sglib_##type##_iterator *it, type *tree, int order, int (*subcomparator)(type *, type *), type *equalto) {\ - type *t;\ - assert(it!=NULL);\ - it->order = order;\ - it->equalto = equalto;\ - it->subcomparator = subcomparator;\ - if (equalto == NULL) { \ - t = tree;\ - } else {\ - if (subcomparator == NULL) {\ - SGLIB___BIN_TREE_FIND_MEMBER(type, tree, equalto, left, right, comparator, t);\ - } else {\ - SGLIB___BIN_TREE_FIND_MEMBER(type, tree, equalto, left, right, subcomparator, t);\ - }\ - }\ - if (t == NULL) {\ - it->pathi = 0;\ - it->currentelem = NULL;\ - } else {\ - it->pathi = 1;\ - it->pass[0] = 0;\ - it->path[0] = t;\ - if (order == 0) {\ - it->currentelem = t;\ - } else {\ - sglib__##type##_it_compute_current_elem(it);\ - }\ - }\ - return(it->currentelem);\ -}\ -type *sglib_##type##_it_init(struct sglib_##type##_iterator *it, type *tree) {\ - return(sglib__##type##_it_init(it, tree, 2, NULL, NULL));\ -}\ -type *sglib_##type##_it_init_preorder(struct sglib_##type##_iterator *it, type *tree) {\ - return(sglib__##type##_it_init(it, tree, 0, NULL, NULL));\ -}\ -type *sglib_##type##_it_init_inorder(struct sglib_##type##_iterator *it, type *tree) {\ - return(sglib__##type##_it_init(it, tree, 1, NULL, NULL));\ -}\ -type *sglib_##type##_it_init_postorder(struct sglib_##type##_iterator *it, type *tree) {\ - return(sglib__##type##_it_init(it, tree, 2, NULL, NULL));\ -}\ -type *sglib_##type##_it_init_on_equal(struct sglib_##type##_iterator *it, type *tree, int (*subcomparator)(type *, type *), type *equalto) {\ - return(sglib__##type##_it_init(it, tree, 1, subcomparator, equalto));\ -}\ -type *sglib_##type##_it_current(struct sglib_##type##_iterator *it) {\ - return(it->currentelem);\ -}\ -type *sglib_##type##_it_next(struct sglib_##type##_iterator *it) {\ - sglib__##type##_it_compute_current_elem(it);\ - return(it->currentelem);\ -}\ -\ -static void sglib___##type##_consistency_check_recursive(type *t, int *pathdeep, int cdeep) {\ - if (t==NULL) {\ - if (*pathdeep < 0) *pathdeep = cdeep;\ - else assert(*pathdeep == cdeep);\ - } else {\ - if (t->left!=NULL) assert(comparator(t->left, t) <= 0);\ - if (t->right!=NULL) assert(comparator(t, t->right) <= 0);\ - if (SGLIB___GET_VALUE(t->bits) == RED) {\ - assert(t->left == NULL || SGLIB___GET_VALUE(t->left->bits)==BLACK);\ - assert(t->right == NULL || SGLIB___GET_VALUE(t->right->bits)==BLACK);\ - sglib___##type##_consistency_check_recursive(t->left, pathdeep, cdeep);\ - sglib___##type##_consistency_check_recursive(t->right, pathdeep, cdeep);\ - } else {\ - sglib___##type##_consistency_check_recursive(t->left, pathdeep, cdeep+1);\ - sglib___##type##_consistency_check_recursive(t->right, pathdeep, cdeep+1);\ - }\ - }\ -}\ -\ -void sglib___##type##_consistency_check(type *t) {\ - int pathDeep;\ - assert(t==NULL || SGLIB___GET_VALUE(t->bits) == BLACK);\ - pathDeep = -1;\ - sglib___##type##_consistency_check_recursive(t, &pathDeep, 0);\ -} - - -#define SGLIB_DEFINE_RBTREE_PROTOTYPES(type, left, right, colorbit, comparator) \ - struct sglib_##type##_iterator {\ - type *currentelem;\ - char pass[SGLIB_MAX_TREE_DEEP];\ - type *path[SGLIB_MAX_TREE_DEEP];\ - short int pathi;\ - short int order;\ - type *equalto;\ - int (*subcomparator)(type *, type *);\ - };\ - extern void sglib___##type##_consistency_check(type *t); \ - extern void sglib_##type##_add(type **tree, type *elem); \ - extern int sglib_##type##_add_if_not_member(type **tree, type *elem, type **memb); \ - extern void sglib_##type##_delete(type **tree, type *elem); \ - extern int sglib_##type##_delete_if_member(type **tree, type *elem, type **memb); \ - extern int sglib_##type##_is_member(type *t, type *elem); \ - extern type *sglib_##type##_find_member(type *t, type *elem); \ - extern int sglib_##type##_len(type *t); \ - extern type *sglib_##type##_it_init(struct sglib_##type##_iterator *it, type *tree); \ - extern type *sglib_##type##_it_init_preorder(struct sglib_##type##_iterator *it, type *tree); \ - extern type *sglib_##type##_it_init_inorder(struct sglib_##type##_iterator *it, type *tree); \ - extern type *sglib_##type##_it_init_postorder(struct sglib_##type##_iterator *it, type *tree); \ - extern type *sglib_##type##_it_init_on_equal(struct sglib_##type##_iterator *it, type *tree, int (*subcomparator)(type *, type *), type *equalto); \ - extern type *sglib_##type##_it_current(struct sglib_##type##_iterator *it); \ - extern type *sglib_##type##_it_next(struct sglib_##type##_iterator *it); \ - - -#define SGLIB_DEFINE_RBTREE_FUNCTIONS(type, left, right, colorbit, comparator) \ - SGLIB_DEFINE_RBTREE_FUNCTIONS_GENERAL(type, left, right, colorbit, comparator, 1, 0) - - - -/* ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- */ -/* - SUPPLEMENTARY DEFINITIONS - */ -/* ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- */ - - -#define SGLIB___GET_VALUE(x) (x) -#define SGLIB___SET_VALUE(x, value) {(x) = (value);} -#define SGLIB_ARRAY_ELEMENTS_EXCHANGER(type, a, i, j) {type _sgl_aee_tmp_; _sgl_aee_tmp_=(a)[(i)]; (a)[(i)]=(a)[(j)]; (a)[(j)]= _sgl_aee_tmp_;} - - -#define SGLIB_SAFE_NUMERIC_COMPARATOR(x, y) (((x)>(y)?1:((x)<(y)?-1:0))) -#define SGLIB_SAFE_REVERSE_NUMERIC_COMPARATOR(x, y) (((x)>(y)?-1:((x)<(y)?1:0))) -#define SGLIB_FAST_NUMERIC_COMPARATOR(x, y) ((int)((x) - (y))) -#define SGLIB_FAST_REVERSE_NUMERIC_COMPARATOR(x, y) ((int)((y) - (x))) -#define SGLIB_NUMERIC_COMPARATOR(x, y) SGLIB_SAFE_NUMERIC_COMPARATOR(x, y) -#define SGLIB_REVERSE_NUMERIC_COMPARATOR(x, y) SGLIB_SAFE_REVERSE_NUMERIC_COMPARATOR(x, y) - -#ifndef SGLIB_MAX_TREE_DEEP -#define SGLIB_MAX_TREE_DEEP 128 -#endif - -#ifndef SGLIB_HASH_TAB_SHIFT_CONSTANT -#define SGLIB_HASH_TAB_SHIFT_CONSTANT 16381 /* should be a prime */ -/* #define SGLIB_HASH_TAB_SHIFT_CONSTANT 536870912*/ /* for large tables :) */ -#endif - -#endif /* _SGLIB__h_ */ diff --git a/bundles/n2n_meyerd/n2n_v2/sn.c b/bundles/n2n_meyerd/n2n_v2/sn.c deleted file mode 100644 index 647a4b27..00000000 --- a/bundles/n2n_meyerd/n2n_v2/sn.c +++ /dev/null @@ -1,895 +0,0 @@ -/* Supernode for n2n-2.x */ - -/* (c) 2009 Richard Andrews - * - * Contributions by: - * Lukasz Taczuk - * Struan Bartlett - */ - - -#include "n2n.h" - - -#define N2N_SN_LPORT_DEFAULT 7654 -#define N2N_SN_PKTBUF_SIZE 2048 - -#define N2N_SN_MGMT_PORT 5645 - - -struct sn_stats -{ - size_t errors; /* Number of errors encountered. */ - size_t reg_super; /* Number of REGISTER_SUPER requests received. */ - size_t reg_super_nak; /* Number of REGISTER_SUPER requests declined. */ - size_t fwd; /* Number of messages forwarded. */ - size_t broadcast; /* Number of messages broadcast to a community. */ - time_t last_fwd; /* Time when last message was forwarded. */ - time_t last_reg_super; /* Time when last REGISTER_SUPER was received. */ -}; - -typedef struct sn_stats sn_stats_t; - -struct n2n_sn -{ - time_t start_time; /* Used to measure uptime. */ - sn_stats_t stats; - int daemon; /* If non-zero then daemonise. */ - uint16_t lport; /* Local UDP port to bind to. */ - int sock; /* Main socket for UDP traffic with edges. */ - int mgmt_sock; /* management socket. */ - time_t last_purge; /* last purge time */ - peer_info_t * edges[PEER_HASH_TAB_SIZE]; /* Link list of registered edges. */ -}; - -typedef struct n2n_sn n2n_sn_t; - - -static int try_forward( n2n_sn_t * sss, - const n2n_common_t * cmn, - const n2n_mac_t dstMac, - const uint8_t * pktbuf, - size_t pktsize ); - -static int try_broadcast( n2n_sn_t * sss, - const n2n_common_t * cmn, - const n2n_mac_t srcMac, - const uint8_t * pktbuf, - size_t pktsize ); - - - -/** Initialise the supernode structure */ -static int init_sn( n2n_sn_t * sss ) -{ -#ifdef WIN32 - initWin32(); -#endif - memset( sss, 0, sizeof(n2n_sn_t) ); - - sss->daemon = 1; /* By defult run as a daemon. */ - sss->lport = N2N_SN_LPORT_DEFAULT; - sss->sock = -1; - sss->mgmt_sock = -1; - sss->last_purge = 0; - sglib_hashed_peer_info_t_init(sss->edges); - - return 0; /* OK */ -} - -/** Deinitialise the supernode structure and deallocate any memory owned by - * it. */ -static void deinit_sn( n2n_sn_t * sss ) -{ - if (sss->sock >= 0) - { - closesocket(sss->sock); - } - sss->sock=-1; - - if ( sss->mgmt_sock >= 0 ) - { - closesocket(sss->mgmt_sock); - } - sss->mgmt_sock=-1; - - purge_hashed_peer_list_t(sss->edges, 0xffffffff); -} - - -/** Determine the appropriate lifetime for new registrations. - * - * If the supernode has been put into a pre-shutdown phase then this lifetime - * should not allow registrations to continue beyond the shutdown point. - */ -static uint16_t reg_lifetime( n2n_sn_t * sss ) -{ - return 30; -} - - -/** Update the edge table with the details of the edge which contacted the - * supernode. */ -static int update_edge( n2n_sn_t * sss, - const n2n_REGISTER_SUPER_t * reg, - const n2n_community_t community, - const n2n_sock_t * sender_sock, - time_t now) -{ - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - struct peer_info * scan; - - traceEvent( TRACE_DEBUG, "update_edge for %s [%s]", - macaddr_str( mac_buf, reg->edgeMac ), - sock_to_cstr( sockbuf, sender_sock ) ); - - scan = find_peer_by_mac( sss->edges, reg->edgeMac ); - - if ( NULL == scan ) - { - /* Not known */ - - scan = (struct peer_info*)calloc(1, sizeof(struct peer_info)); /* deallocated in purge_expired_registrations */ - - memcpy(scan->community_name, community, sizeof(n2n_community_t) ); - memcpy(&(scan->mac_addr), reg->edgeMac, sizeof(n2n_mac_t)); - memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); - - scan->timeout = reg->timeout; - if(reg->aflags & N2N_AFLAGS_LOCAL_SOCKET) { - scan->num_sockets = 2; - scan->sockets = malloc(scan->num_sockets*sizeof(n2n_sock_t)); - scan->sockets[1] = reg->local_sock; - } else { - scan->num_sockets = 1; - scan->sockets = malloc(scan->num_sockets*sizeof(n2n_sock_t)); - } - scan->sockets[0] = scan->sock; - - /* insert this guy at the head of the edges list */ - sglib_hashed_peer_info_t_add(sss->edges, scan); - - traceEvent( TRACE_INFO, "update_edge created %s ==> %s", - macaddr_str( mac_buf, reg->edgeMac ), - sock_to_cstr( sockbuf, sender_sock ) ); - } - else - { - /* Known */ - int num_changes = 0; - scan->timeout = reg->timeout; - if (0 != memcmp(community, scan->community_name, sizeof(n2n_community_t))) - { - memcpy(scan->community_name, community, sizeof(n2n_community_t) ); - num_changes++; - } - if (0 != sock_equal(sender_sock, &(scan->sock) )) { - memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); - memcpy(scan->sockets, sender_sock, sizeof(n2n_sock_t)); - num_changes++; - } - if (scan->num_sockets == 1) { - if (reg->aflags & N2N_AFLAGS_LOCAL_SOCKET) { - scan->num_sockets = 2; - free(scan->sockets); - scan->sockets = malloc(scan->num_sockets*sizeof(n2n_sock_t)); - scan->sockets[0] = scan->sock; - scan->sockets[1] = reg->local_sock; - } - } else { - if (reg->aflags & N2N_AFLAGS_LOCAL_SOCKET) { - if (0 != sock_equal(&(reg->local_sock), scan->sockets+1 )) { - memcpy(scan->sockets+1, &(reg->local_sock), sizeof(n2n_sock_t)); - } - } else { - scan->num_sockets = 1; - free(scan->sockets); - scan->sockets = malloc(scan->num_sockets*sizeof(n2n_sock_t)); - scan->sockets[0] = scan->sock; - } - } - if (num_changes) { - traceEvent( TRACE_INFO, "update_edge updated %s ==> %s", - macaddr_str( mac_buf, reg->edgeMac ), - sock_to_cstr( sockbuf, sender_sock ) ); - } else { - traceEvent( TRACE_DEBUG, "update_edge unchanged %s ==> %s", - macaddr_str( mac_buf, reg->edgeMac ), - sock_to_cstr( sockbuf, sender_sock ) ); - } - - } - - scan->last_seen = now; - return 0; -} - - -/** Send a datagram to the destination embodied in a n2n_sock_t. - * - * @return -1 on error otherwise number of bytes sent - */ -static ssize_t sendto_sock(n2n_sn_t * sss, - const n2n_sock_t * sock, - const uint8_t * pktbuf, - size_t pktsize) -{ - n2n_sock_str_t sockbuf; - - if ( AF_INET == sock->family ) - { - struct sockaddr_in udpsock; - - udpsock.sin_family = AF_INET; - udpsock.sin_port = htons( sock->port ); - memcpy( &(udpsock.sin_addr.s_addr), &(sock->addr.v4), IPV4_SIZE ); - - traceEvent( TRACE_DEBUG, "sendto_sock %lu to [%s]", - pktsize, - sock_to_cstr( sockbuf, sock ) ); - - return sendto( sss->sock, pktbuf, pktsize, 0, - (const struct sockaddr *)&udpsock, sizeof(struct sockaddr_in) ); - } - else - { - /* AF_INET6 not implemented */ - errno = EAFNOSUPPORT; - return -1; - } -} - - - -/** Try to forward a message to a unicast MAC. If the MAC is unknown then - * broadcast to all edges in the destination community. - */ -static int try_forward( n2n_sn_t * sss, - const n2n_common_t * cmn, - const n2n_mac_t dstMac, - const uint8_t * pktbuf, - size_t pktsize ) -{ - struct peer_info * scan; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - scan = find_peer_by_mac( sss->edges, dstMac ); - - if ( NULL != scan ) - { - int data_sent_len; - data_sent_len = sendto_sock( sss, &(scan->sock), pktbuf, pktsize ); - - if ( data_sent_len == pktsize ) - { - ++(sss->stats.fwd); - traceEvent(TRACE_DEBUG, "unicast %lu to [%s] %s", - pktsize, - sock_to_cstr( sockbuf, &(scan->sock) ), - macaddr_str(mac_buf, scan->mac_addr)); - } - else - { - ++(sss->stats.errors); - traceEvent(TRACE_ERROR, "unicast %lu to [%s] %s FAILED (%d: %s)", - pktsize, - sock_to_cstr( sockbuf, &(scan->sock) ), - macaddr_str(mac_buf, scan->mac_addr), - errno, strerror(errno) ); - } - } - else - { - traceEvent( TRACE_DEBUG, "try_forward unknown MAC" ); - - /* Not a known MAC so drop. */ - } - - return 0; -} - - -/** Try and broadcast a message to all edges in the community. - * - * This will send the exact same datagram to zero or more edges registered to - * the supernode. - */ -static int try_broadcast( n2n_sn_t * sss, - const n2n_common_t * cmn, - const n2n_mac_t srcMac, - const uint8_t * pktbuf, - size_t pktsize ) -{ - peer_info_t * ll; - struct sglib_hashed_peer_info_t_iterator it; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - traceEvent( TRACE_DEBUG, "try_broadcast" ); - - for(ll=sglib_hashed_peer_info_t_it_init(&it,sss->edges); ll!=NULL; ll=sglib_hashed_peer_info_t_it_next(&it)) { - if( 0 == (memcmp(ll->community_name, cmn->community, sizeof(n2n_community_t)) ) - && (0 != memcmp(srcMac, ll->mac_addr, sizeof(n2n_mac_t)) ) ) - /* REVISIT: exclude if the destination socket is where the packet came from. */ - { - int data_sent_len; - - data_sent_len = sendto_sock(sss, &(ll->sock), pktbuf, pktsize); - - if(data_sent_len != pktsize) - { - ++(sss->stats.errors); - traceEvent(TRACE_WARNING, "multicast %lu to [%s] %s failed %s", - pktsize, - sock_to_cstr( sockbuf, &(ll->sock) ), - macaddr_str(mac_buf, ll->mac_addr), - strerror(errno)); - } - else - { - ++(sss->stats.broadcast); - traceEvent(TRACE_DEBUG, "multicast %lu to [%s] %s", - pktsize, - sock_to_cstr( sockbuf, &(ll->sock) ), - macaddr_str(mac_buf, ll->mac_addr)); - } - } - } /* for */ - - return 0; -} - - -static int process_mgmt( n2n_sn_t * sss, - const struct sockaddr_in * sender_sock, - const uint8_t * mgmt_buf, - size_t mgmt_size, - time_t now) -{ - char resbuf[N2N_SN_PKTBUF_SIZE]; - size_t ressize=0; - ssize_t r; - - traceEvent( TRACE_DEBUG, "process_mgmt" ); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "----------------\n" ); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "uptime %lu\n", (now - sss->start_time) ); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "edges %u\n", - (unsigned int)hashed_peer_list_t_size( sss->edges )); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "errors %u\n", - (unsigned int)sss->stats.errors ); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "reg_sup %u\n", - (unsigned int)sss->stats.reg_super ); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "reg_nak %u\n", - (unsigned int)sss->stats.reg_super_nak ); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "fwd %u\n", - (unsigned int) sss->stats.fwd ); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "broadcast %u\n", - (unsigned int) sss->stats.broadcast ); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "last fwd %lu sec ago\n", - (long unsigned int)(now - sss->stats.last_fwd) ); - - ressize += snprintf( resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "last reg %lu sec ago\n", - (long unsigned int) (now - sss->stats.last_reg_super) ); - - - r = sendto( sss->mgmt_sock, resbuf, ressize, 0/*flags*/, - (struct sockaddr *)sender_sock, sizeof(struct sockaddr_in) ); - - if ( r <= 0 ) - { - ++(sss->stats.errors); - traceEvent( TRACE_ERROR, "process_mgmt : sendto failed. %s", strerror(errno) ); - } - - return 0; -} - - -/** Examine a datagram and determine what to do with it. - * - */ -static int process_udp( n2n_sn_t * sss, - const struct sockaddr_in * sender_sock, - const uint8_t * udp_buf, - size_t udp_size, - time_t now) -{ - n2n_common_t cmn; /* common fields in the packet header */ - n2n_common_t cmn2; /* common fields of newly generated packets */ - size_t rem; - size_t idx; - size_t msg_type; - uint8_t from_supernode; - macstr_t mac_buf; - macstr_t mac_buf2; - n2n_sock_str_t sockbuf; - const uint8_t * rec_buf; /* either udp_buf or encbuf */ - int unicast; /* non-zero if unicast */ - size_t encx=0; - uint8_t encbuf[N2N_SN_PKTBUF_SIZE]; - n2n_ETHFRAMEHDR_t eth; - int i; - - /* for PACKET packages */ - n2n_PACKET_t pkt; - - /* for QUERY_PEER packages */ - n2n_QUERY_PEER_t query; - struct peer_info * scan; - n2n_PEER_INFO_t pi; - - /* for REGISTER packages */ - n2n_REGISTER_t reg; - - /* for REGISTER_SUPER packages */ - n2n_REGISTER_SUPER_t regs; - n2n_REGISTER_SUPER_ACK_t ack; - - traceEvent( TRACE_DEBUG, "process_udp(%lu)", udp_size ); - - /* Use decode_common() to determine the kind of packet then process it: - * - * REGISTER_SUPER adds an edge and generate a return REGISTER_SUPER_ACK - * - * REGISTER, REGISTER_ACK and PACKET messages are forwarded to their - * destination edge. If the destination is not known then PACKETs are - * broadcast. - */ - - rem = udp_size; /* Counts down bytes of packet to protect against buffer overruns. */ - idx = 0; /* marches through packet header as parts are decoded. */ - if ( decode_common(&cmn, udp_buf, &rem, &idx) < 0 ) - { - traceEvent( TRACE_ERROR, "Failed to decode common section" ); - return -1; /* failed to decode packet */ - } - - msg_type = cmn.pc; /* packet code */ - from_supernode= cmn.flags & N2N_FLAGS_FROM_SUPERNODE; - - if ( cmn.ttl < 1 ) - { - traceEvent( TRACE_WARNING, "Expired TTL" ); - return 0; /* Don't process further */ - } - - --(cmn.ttl); /* The value copied into all forwarded packets. */ - - switch(msg_type) { - case MSG_TYPE_PACKET: - /* PACKET from one edge to another edge via supernode. */ - - /* pkt will be modified in place and recoded to an output of potentially - * different size due to addition of the socket.*/ - - - sss->stats.last_fwd=now; - decode_PACKET( &pkt, &cmn, udp_buf, &rem, &idx ); - decode_ETHFRAMEHDR( ð, udp_buf+idx ); - - unicast = (0 == is_multi_broadcast(eth.dstMac) ); - - traceEvent( TRACE_DEBUG, "Rx PACKET (%s) %s -> %s %s", - (unicast?"unicast":"multicast"), - macaddr_str( mac_buf, eth.srcMac ), - macaddr_str( mac_buf2, eth.dstMac ), - (from_supernode?"from sn":"local") ); - - if ( !from_supernode ) - { - memcpy( &cmn2, &cmn, sizeof( n2n_common_t ) ); - - /* We are going to add socket even if it was not there before */ - cmn2.flags |= N2N_FLAGS_FROM_SUPERNODE; - - rec_buf = encbuf; - - /* Re-encode the header. */ - encode_PACKET( encbuf, &encx, &cmn2, &pkt ); - - /* Copy the original payload unchanged */ - encode_buf( encbuf, &encx, (udp_buf + idx), (udp_size - idx ) ); - } - else - { - /* Already from a supernode. Nothing to modify, just pass to - * destination. */ - - traceEvent( TRACE_DEBUG, "Rx PACKET fwd unmodified" ); - - rec_buf = udp_buf; - encx = udp_size; - } - - /* Common section to forward the final product. */ - if ( unicast ) - { - try_forward( sss, &cmn, eth.dstMac, rec_buf, encx ); - } - else - { - try_broadcast( sss, &cmn, eth.srcMac, rec_buf, encx ); - } - break; - case MSG_TYPE_QUERY_PEER: - decode_QUERY_PEER( &query, &cmn, udp_buf, &rem, &idx ); - - traceEvent( TRACE_DEBUG, "Rx QUERY_PEER from %s for %s", - macaddr_str( mac_buf, query.srcMac ), - macaddr_str( mac_buf2, query.targetMac ) ); - - scan = find_peer_by_mac( sss->edges, query.targetMac ); - if (scan && 0 == memcmp(cmn.community, scan->community_name, - sizeof(n2n_community_t))) { - cmn2.ttl = N2N_DEFAULT_TTL; - cmn2.pc = n2n_peer_info; - cmn2.flags = N2N_FLAGS_FROM_SUPERNODE; - memcpy( cmn2.community, cmn.community, sizeof(n2n_community_t) ); - - pi.aflags = 0; - pi.timeout = scan->timeout; - memcpy( pi.mac, query.targetMac, sizeof(n2n_mac_t) ); - for(i=0; inum_sockets; i++) - pi.sockets[i] = scan->sockets[i]; - if(scan->num_sockets > 1) - pi.aflags |= N2N_AFLAGS_LOCAL_SOCKET; - - encode_PEER_INFO( encbuf, &encx, &cmn2, &pi ); - - sendto( sss->sock, encbuf, encx, 0, - (struct sockaddr *)sender_sock, sizeof(struct sockaddr_in) ); - - traceEvent( TRACE_DEBUG, "Tx PEER_INFO to %s", - macaddr_str( mac_buf, query.srcMac ) ); - } else { - traceEvent( TRACE_DEBUG, "Ignoring QUERY_PEER for unknown edge %s", - macaddr_str( mac_buf, query.targetMac ) ); - } - - break; - case MSG_TYPE_REGISTER: - /* Forwarding a REGISTER from one edge to the next */ - - - sss->stats.last_fwd=now; - decode_REGISTER( ®, &cmn, udp_buf, &rem, &idx ); - - unicast = (0 == is_multi_broadcast(reg.dstMac) ); - - if ( unicast ) - { - traceEvent( TRACE_DEBUG, "Rx REGISTER %s -> %s %s", - macaddr_str( mac_buf, reg.srcMac ), - macaddr_str( mac_buf2, reg.dstMac ), - ((cmn.flags & N2N_FLAGS_FROM_SUPERNODE)?"from sn":"local") ); - - if ( 0 != (cmn.flags & N2N_FLAGS_FROM_SUPERNODE) ) - { - memcpy( &cmn2, &cmn, sizeof( n2n_common_t ) ); - - /* We are going to add socket even if it was not there before */ - cmn2.flags |= N2N_FLAGS_FROM_SUPERNODE; - - reg.sock.family = AF_INET; - reg.sock.port = ntohs(sender_sock->sin_port); - memcpy( reg.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE ); - - rec_buf = encbuf; - - /* Re-encode the header. */ - encode_REGISTER( encbuf, &encx, &cmn2, ® ); - - /* Copy the original payload unchanged */ - encode_buf( encbuf, &encx, (udp_buf + idx), (udp_size - idx ) ); - } - else - { - /* Already from a supernode. Nothing to modify, just pass to - * destination. */ - - rec_buf = udp_buf; - encx = udp_size; - } - - try_forward( sss, &cmn, reg.dstMac, rec_buf, encx ); /* unicast only */ - } - else - { - traceEvent( TRACE_ERROR, "Rx REGISTER with multicast destination" ); - } - break; - case MSG_TYPE_REGISTER_ACK: - traceEvent( TRACE_DEBUG, "Rx REGISTER_ACK (NOT IMPLEMENTED) SHould not be via supernode" ); - break; - case MSG_TYPE_REGISTER_SUPER: - /* Edge requesting registration with us. */ - - sss->stats.last_reg_super=now; - ++(sss->stats.reg_super); - decode_REGISTER_SUPER( ®s, &cmn, udp_buf, &rem, &idx ); - - cmn2.ttl = N2N_DEFAULT_TTL; - cmn2.pc = n2n_register_super_ack; - cmn2.flags = N2N_FLAGS_FROM_SUPERNODE; - memcpy( cmn2.community, cmn.community, sizeof(n2n_community_t) ); - - memcpy( &(ack.cookie), &(regs.cookie), sizeof(n2n_cookie_t) ); - memcpy( ack.edgeMac, regs.edgeMac, sizeof(n2n_mac_t) ); - ack.lifetime = reg_lifetime( sss ); - - ack.sock.family = AF_INET; - ack.sock.port = ntohs(sender_sock->sin_port); - memcpy( ack.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE ); - - ack.num_sn=0; /* No backup */ - memset( &(ack.sn_bak), 0, sizeof(n2n_sock_t) ); - - traceEvent( TRACE_DEBUG, "Rx REGISTER_SUPER for %s [%s]", - macaddr_str( mac_buf, regs.edgeMac ), - sock_to_cstr( sockbuf, &(ack.sock) ) ); - - update_edge( sss, ®s, cmn.community, &(ack.sock), now ); - - encode_REGISTER_SUPER_ACK( encbuf, &encx, &cmn2, &ack ); - - sendto( sss->sock, encbuf, encx, 0, - (struct sockaddr *)sender_sock, sizeof(struct sockaddr_in) ); - - traceEvent( TRACE_DEBUG, "Tx REGISTER_SUPER_ACK for %s [%s]", - macaddr_str( mac_buf, regs.edgeMac ), - sock_to_cstr( sockbuf, &(ack.sock) ) ); - break; - default: - /* Not a known message type */ - traceEvent(TRACE_WARNING, "Unable to handle packet type %d: ignored", (signed int)msg_type); - break; - } - - return 0; -} - - -/** Help message to print if the command line arguments are not valid. */ -static void exit_help(int argc, char * const argv[]) -{ - fprintf( stderr, "%s usage\n", argv[0] ); - fprintf( stderr, "-l \tSet UDP main listen port to \n" ); - -#if defined(N2N_HAVE_DAEMON) - fprintf( stderr, "-f \tRun in foreground.\n" ); -#endif /* #if defined(N2N_HAVE_DAEMON) */ -#ifndef WIN32 - fprintf( stderr, "-u \tUser ID (numeric) to use when privileges are dropped.\n"); - fprintf( stderr, "-g \tGroup ID (numeric) to use when privileges are dropped.\n"); -#endif /* ifndef WIN32 */ - fprintf( stderr, "-v \tIncrease verbosity. Can be used multiple times.\n" ); - fprintf( stderr, "-h \tThis help message.\n" ); - fprintf( stderr, "\n" ); - exit(1); -} - -static int run_loop( n2n_sn_t * sss ); - -/* *********************************************** */ - -static const struct option long_options[] = { - { "foreground", no_argument, NULL, 'f' }, - { "local-port", required_argument, NULL, 'l' }, - { "help" , no_argument, NULL, 'h' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, 0, NULL, 0 } -}; - -/** Main program entry point from kernel. */ -int main( int argc, char * const argv[] ) -{ - n2n_sn_t sss; - -#ifndef WIN32 - uid_t userid=0; /* root is the only guaranteed ID */ - gid_t groupid=0; /* root is the only guaranteed ID */ -#endif - - init_sn( &sss ); - - { - int opt; - - while((opt = getopt_long(argc, argv, "fl:u:g:vh", long_options, NULL)) != -1) - { - switch (opt) - { - case 'l': /* local-port */ - sss.lport = atoi(optarg); - break; - case 'f': /* foreground */ - sss.daemon = 0; - break; -#ifndef WIN32 - case 'u': /* unprivileged uid */ - { - userid = atoi(optarg); - break; - } - case 'g': /* unprivileged uid */ - { - groupid = atoi(optarg); - break; - } -#endif - case 'h': /* help */ - exit_help(argc, argv); - break; - case 'v': /* verbose */ - ++traceLevel; - break; - } - } - - } - -#if defined(N2N_HAVE_DAEMON) - if (sss.daemon) - { - useSyslog=1; /* traceEvent output now goes to syslog. */ - if ( -1 == daemon( 0, 0 ) ) - { - traceEvent( TRACE_ERROR, "Failed to become daemon." ); - exit(-5); - } - } -#endif /* #if defined(N2N_HAVE_DAEMON) */ - - traceEvent( TRACE_DEBUG, "traceLevel is %d", traceLevel); - - sss.sock = open_socket(sss.lport, 1 /*bind ANY*/ ); - if ( -1 == sss.sock ) - { - traceEvent( TRACE_ERROR, "Failed to open main socket. %s", strerror(errno) ); - exit(-2); - } - else - { - traceEvent( TRACE_NORMAL, "supernode is listening on UDP %u (main)", sss.lport ); - } - - sss.mgmt_sock = open_socket(N2N_SN_MGMT_PORT, 0 /* bind LOOPBACK */ ); - if ( -1 == sss.mgmt_sock ) - { - traceEvent( TRACE_ERROR, "Failed to open management socket. %s", strerror(errno) ); - exit(-2); - } - else - { - traceEvent( TRACE_NORMAL, "supernode is listening on UDP %u (management)", N2N_SN_MGMT_PORT ); - } - -#ifndef WIN32 - if ( (userid != 0) || (groupid != 0 ) ) { - traceEvent(TRACE_NORMAL, "Interface up. Dropping privileges to uid=%d, gid=%d", - (signed int)userid, (signed int)groupid); - - /* Finished with the need for root privileges. Drop to unprivileged user. */ - setreuid( userid, userid ); - setregid( groupid, groupid ); - } -#endif - traceEvent(TRACE_NORMAL, "supernode started"); - - return run_loop(&sss); -} - - -/** Long lived processing entry point. Split out from main to simply - * daemonisation on some platforms. */ -static int run_loop( n2n_sn_t * sss ) -{ - uint8_t pktbuf[N2N_SN_PKTBUF_SIZE]; - int keep_running=1; - - sss->start_time = time(NULL); - - while(keep_running) - { - int rc; - ssize_t bread; - int max_sock; - fd_set socket_mask; - struct timeval wait_time; - time_t now=0; - - FD_ZERO(&socket_mask); - max_sock = MAX(sss->sock, sss->mgmt_sock); - - FD_SET(sss->sock, &socket_mask); - FD_SET(sss->mgmt_sock, &socket_mask); - - wait_time.tv_sec = 10; wait_time.tv_usec = 0; - rc = select(max_sock+1, &socket_mask, NULL, NULL, &wait_time); - - now = time(NULL); - - if(rc > 0) - { - if (FD_ISSET(sss->sock, &socket_mask)) - { - struct sockaddr_in sender_sock; - socklen_t i; - - i = sizeof(sender_sock); - bread = recvfrom( sss->sock, pktbuf, N2N_SN_PKTBUF_SIZE, 0/*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t*)&i); - - if ( bread < 0 ) /* For UDP bread of zero just means no data (unlike TCP). */ - { - /* The fd is no good now. Maybe we lost our interface. */ - traceEvent( TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno) ); - keep_running=0; - break; - } - - /* We have a datagram to process */ - if ( bread > 0 ) - { - /* And the datagram has data (not just a header) */ - process_udp( sss, &sender_sock, pktbuf, bread, now ); - } - } - - if (FD_ISSET(sss->mgmt_sock, &socket_mask)) - { - struct sockaddr_in sender_sock; - size_t i; - - i = sizeof(sender_sock); - bread = recvfrom( sss->mgmt_sock, pktbuf, N2N_SN_PKTBUF_SIZE, 0/*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t*)&i); - - if ( bread <= 0 ) - { - traceEvent( TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno) ); - keep_running=0; - break; - } - - /* We have a datagram to process */ - process_mgmt( sss, &sender_sock, pktbuf, bread, now ); - } - } - else - { - traceEvent( TRACE_DEBUG, "timeout" ); - } - if ((now - sss->last_purge) >= PURGE_REGISTRATION_FREQUENCY) { - hashed_purge_expired_registrations( sss->edges ); - sss->last_purge = now; - } - - } /* while */ - - deinit_sn( sss ); - - return 0; -} - diff --git a/bundles/n2n_meyerd/n2n_v2/supernode.1 b/bundles/n2n_meyerd/n2n_v2/supernode.1 deleted file mode 100644 index 26b1f70f..00000000 --- a/bundles/n2n_meyerd/n2n_v2/supernode.1 +++ /dev/null @@ -1,43 +0,0 @@ -.TH supernode 1 "Jan 3, 2009" "revision 3679" "USER COMMANDS" -.SH NAME -supernode \- n2n supernode daemon -.SH SYNOPSIS -.B supernode \-l [\-v] -.SH DESCRIPTION -N2N is a peer-to-peer VPN system. Supernode is a node introduction registry, -broadcast conduit and packet relay node for the n2n system. On startup supernode -begins listening on the specified UDP port for node registrations, and other -packets to route. The supernode can service any number of communities and routes -packets only between members of the same community. The supernode does not hold -the community encryption key and so cannot snoop or inject packets into the -community. -.PP -Supernode can service a number of n2n communities concurrently. Traffic does not -cross between communities. -.PP -All logging goes to stdout. -.SH OPTIONS -.TP -\-l -listen on the given UDP port -.TP -\-v -use verbose logging -.TP -\-f -disable daemon mode (UNIX) and run in foreground. -.SH EXAMPLES -.TP -.B supernode -l 7654 -v -Start supernode listening on UDP port 7654 with verbose output. -.PP -.SH RESTART -When suprenode restarts it loses all registration information from associated -edge nodes. It can take up to five minutes for the edge nodes to re-register and -normal traffic flow to resume. -.SH EXIT STATUS -supernode is a daemon and any exit is an error -.SH AUTHOR -Luca Deri ( deri (at) ntop.org ), Richard Andrews ( andrews (at) ntop.org ), Don Bindner -.SH SEE ALSO -ifconfig(8) edge(8) diff --git a/bundles/n2n_meyerd/n2n_v2/transform_aes.c b/bundles/n2n_meyerd/n2n_v2/transform_aes.c deleted file mode 100644 index a8c49690..00000000 --- a/bundles/n2n_meyerd/n2n_v2/transform_aes.c +++ /dev/null @@ -1,597 +0,0 @@ -/* (c) 2009 Richard Andrews */ -/* Contributions from: - * - Jozef Kralik - */ - -#include "n2n.h" -#include "n2n_transforms.h" - -#if defined(N2N_HAVE_AES) - - -#include "openssl/aes.h" -#ifndef _MSC_VER -/* Not included in Visual Studio 2008 */ -#include /* index() */ -#endif - -#define N2N_AES_NUM_SA 32 /* space for SAa */ - -#define N2N_AES_TRANSFORM_VERSION 1 /* version of the transform encoding */ -#define N2N_AES_IVEC_SIZE 32 /* Enough space for biggest AES ivec */ - -typedef unsigned char n2n_aes_ivec_t[N2N_AES_IVEC_SIZE]; - -struct sa_aes -{ - n2n_cipherspec_t spec; /* cipher spec parameters */ - n2n_sa_t sa_id; /* security association index */ - AES_KEY enc_key; /* tx key */ - n2n_aes_ivec_t enc_ivec; /* tx CBC state */ - AES_KEY dec_key; /* tx key */ - n2n_aes_ivec_t dec_ivec; /* tx CBC state */ -}; - -typedef struct sa_aes sa_aes_t; - - -/** Aes transform state data. - * - * With a key-schedule in place this will be populated with a number of - * SAs. Each SA has a lifetime and some opque data. The opaque data for aes - * consists of the SA number and key material. - * - */ -struct transop_aes -{ - ssize_t tx_sa; - size_t num_sa; - sa_aes_t sa[N2N_AES_NUM_SA]; -}; - -typedef struct transop_aes transop_aes_t; - -static int transop_deinit_aes( n2n_trans_op_t * arg ) -{ - transop_aes_t * priv = (transop_aes_t *)arg->priv; - size_t i; - - if ( priv ) - { - /* Memory was previously allocated */ - for (i=0; isa[i]); - - sa->sa_id=0; - } - - priv->num_sa=0; - priv->tx_sa=-1; - - free(priv); - } - - arg->priv=NULL; /* return to fully uninitialised state */ - - return 0; -} - -static size_t aes_choose_tx_sa( transop_aes_t * priv ) -{ - return priv->tx_sa; /* set in tick */ -} - -#define TRANSOP_AES_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_AES_NONCE_SIZE 4 -#define TRANSOP_AES_SA_SIZE 4 - - -#define AES256_KEY_BYTES (256/8) -#define AES192_KEY_BYTES (192/8) -#define AES128_KEY_BYTES (128/8) - -/* Return the best acceptable AES key size (in bytes) given an input keysize. - * - * The value returned will be one of AES128_KEY_BYTES, AES192_KEY_BYTES or - * AES256_KEY_BYTES. - */ -static size_t aes_best_keysize(size_t numBytes) -{ - if (numBytes >= AES256_KEY_BYTES ) - { - return AES256_KEY_BYTES; - } - else if (numBytes >= AES192_KEY_BYTES) - { - return AES192_KEY_BYTES; - } - else - { - return AES128_KEY_BYTES; - } -} - -/** The aes packet format consists of: - * - * - a 8-bit aes encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_encode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - int len2=-1; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - uint32_t * pnonce; - - if ( (in_len + TRANSOP_AES_NONCE_SIZE) <= N2N_PKT_BUF_SIZE ) - { - if ( (in_len + TRANSOP_AES_NONCE_SIZE + TRANSOP_AES_SA_SIZE + TRANSOP_AES_VER_SIZE) <= out_len ) - { - int len=-1; - size_t idx=0; - sa_aes_t * sa; - size_t tx_sa_num = 0; - - /* The transmit sa is periodically updated */ - tx_sa_num = aes_choose_tx_sa( priv ); - - sa = &(priv->sa[tx_sa_num]); /* Proper Tx SA index */ - - traceEvent( TRACE_DEBUG, "encode_aes %lu with SA %lu.", in_len, sa->sa_id ); - - /* Encode the aes format version. */ - encode_uint8( outbuf, &idx, N2N_AES_TRANSFORM_VERSION ); - - /* Encode the security association (SA) number */ - encode_uint32( outbuf, &idx, sa->sa_id ); - - /* Encrypt the assembly contents and write the ciphertext after the SA. */ - len = in_len + TRANSOP_AES_NONCE_SIZE; - - /* The assembly buffer is a source for encrypting data. The nonce is - * written in first followed by the packet payload. The whole - * contents of assembly are encrypted. */ - pnonce = (uint32_t *)assembly; - *pnonce = rand(); - memcpy( assembly + TRANSOP_AES_NONCE_SIZE, inbuf, in_len ); - - /* Need at least one encrypted byte at the end for the padding. */ - len2 = ( (len / AES_BLOCK_SIZE) + 1) * AES_BLOCK_SIZE; /* Round up to next whole AES adding at least one byte. */ - assembly[ len2-1 ]=(len2-len); - traceEvent( TRACE_DEBUG, "padding = %u", assembly[ len2-1 ] ); - - memset( &(sa->enc_ivec), 0, sizeof(N2N_AES_IVEC_SIZE) ); - AES_cbc_encrypt( assembly, /* source */ - outbuf + TRANSOP_AES_VER_SIZE + TRANSOP_AES_SA_SIZE, /* dest */ - len2, /* enc size */ - &(sa->enc_key), sa->enc_ivec, 1 /* encrypt */ ); - - len2 += TRANSOP_AES_VER_SIZE + TRANSOP_AES_SA_SIZE; /* size of data carried in UDP. */ - } - else - { - traceEvent( TRACE_ERROR, "encode_aes outbuf too small." ); - } - } - else - { - traceEvent( TRACE_ERROR, "encode_aes inbuf too big to encrypt." ); - } - - return len2; -} - - -/* Search through the array of SAs to find the one with the required ID. - * - * @return array index where found or -1 if not found - */ -static ssize_t aes_find_sa( const transop_aes_t * priv, const n2n_sa_t req_id ) -{ - size_t i; - - for (i=0; i < priv->num_sa; ++i) - { - const sa_aes_t * sa=NULL; - - sa = &(priv->sa[i]); - if (req_id == sa->sa_id) - { - return i; - } - } - - return -1; -} - - -/** The aes packet format consists of: - * - * - a 8-bit aes encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_decode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - int len=0; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - if ( ( (in_len - (TRANSOP_AES_VER_SIZE + TRANSOP_AES_SA_SIZE)) <= N2N_PKT_BUF_SIZE ) /* Cipher text fits in assembly */ - && (in_len >= (TRANSOP_AES_VER_SIZE + TRANSOP_AES_SA_SIZE + TRANSOP_AES_NONCE_SIZE) ) /* Has at least version, SA and nonce */ - ) - { - n2n_sa_t sa_rx; - ssize_t sa_idx=-1; - size_t rem=in_len; - size_t idx=0; - uint8_t aes_enc_ver=0; - - /* Get the encoding version to make sure it is supported */ - decode_uint8( &aes_enc_ver, inbuf, &rem, &idx ); - - if ( N2N_AES_TRANSFORM_VERSION == aes_enc_ver ) - { - /* Get the SA number and make sure we are decrypting with the right one. */ - decode_uint32( &sa_rx, inbuf, &rem, &idx ); - - sa_idx = aes_find_sa(priv, sa_rx); - if ( sa_idx >= 0 ) - { - sa_aes_t * sa = &(priv->sa[sa_idx]); - - traceEvent( TRACE_DEBUG, "decode_aes %lu with SA %lu.", in_len, sa_rx, sa->sa_id ); - - len = (in_len - (TRANSOP_AES_VER_SIZE + TRANSOP_AES_SA_SIZE)); - - if ( 0 == (len % AES_BLOCK_SIZE ) ) - { - uint8_t padding; - - memset( &(sa->dec_ivec), 0, sizeof(N2N_AES_IVEC_SIZE) ); - AES_cbc_encrypt( (inbuf + TRANSOP_AES_VER_SIZE + TRANSOP_AES_SA_SIZE), - assembly, /* destination */ - len, - &(sa->dec_key), - sa->dec_ivec, 0 /* decrypt */ ); - - /* last byte is how much was padding: max value should be - * AES_BLOCKSIZE-1 */ - padding = assembly[ len-1 ] & 0xff; - - if ( len >= (padding + TRANSOP_AES_NONCE_SIZE)) - { - /* strictly speaking for this to be an ethernet packet - * it is going to need to be even bigger; but this is - * enough to prevent segfaults. */ - traceEvent( TRACE_DEBUG, "padding = %u", padding ); - len -= padding; - - len -= TRANSOP_AES_NONCE_SIZE; /* size of ethernet packet */ - - /* Step over 4-byte random nonce value */ - memcpy( outbuf, - assembly + TRANSOP_AES_NONCE_SIZE, - len ); - } - else - { - traceEvent( TRACE_WARNING, "UDP payload decryption failed." ); - } - } - else - { - traceEvent( TRACE_WARNING, "Encrypted length %d is not a multiple of AES_BLOCK_SIZE (%d)", len, AES_BLOCK_SIZE ); - len = 0; - } - - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_aes SA number %lu not found.", sa_rx ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_aes unsupported aes version %u.", aes_enc_ver ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - traceEvent( TRACE_ERROR, "decode_aes inbuf wrong size (%ul) to decrypt.", in_len ); - } - - return len; -} - -static int transop_addspec_aes( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - int retval = 1; - ssize_t pstat=-1; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t keybuf[N2N_MAX_KEYSIZE]; - - if ( priv->num_sa < N2N_AES_NUM_SA ) - { - const char * op = (const char *)cspec->opaque; - const char * sep = index( op, '_' ); - - if ( sep ) - { - char tmp[256]; - size_t s; - - s = sep - op; - memcpy( tmp, cspec->opaque, s ); - tmp[s]=0; - - s = strlen(sep+1); /* sep is the _ which might be immediately followed by NULL */ - - priv->sa[priv->num_sa].spec = *cspec; - priv->sa[priv->num_sa].sa_id = strtoul(tmp, NULL, 10); - - memset( keybuf, 0, N2N_MAX_KEYSIZE ); - pstat = n2n_parse_hex( keybuf, N2N_MAX_KEYSIZE, sep+1, s ); - if ( pstat > 0 ) - { - /* pstat is number of bytes read into keybuf. */ - sa_aes_t * sa = &(priv->sa[priv->num_sa]); - size_t aes_keysize_bytes; - size_t aes_keysize_bits; - - /* Clear out any old possibly longer key matter. */ - memset( &(sa->enc_key), 0, sizeof(AES_KEY) ); - memset( &(sa->dec_key), 0, sizeof(AES_KEY) ); - - memset( &(sa->enc_ivec), 0, sizeof(N2N_AES_IVEC_SIZE) ); - memset( &(sa->dec_ivec), 0, sizeof(N2N_AES_IVEC_SIZE) ); - - aes_keysize_bytes = aes_best_keysize(pstat); - aes_keysize_bits = 8 * aes_keysize_bytes; - - /* Use N2N_MAX_KEYSIZE because the AES key needs to be of fixed - * size. If fewer bits specified then the rest will be - * zeroes. AES acceptable key sizes are 128, 192 and 256 - * bits. */ - AES_set_encrypt_key( keybuf, aes_keysize_bits, &(sa->enc_key)); - AES_set_decrypt_key( keybuf, aes_keysize_bits, &(sa->dec_key)); - /* Leave ivecs set to all zeroes */ - - traceEvent( TRACE_DEBUG, "transop_addspec_aes sa_id=%u, %u bits data=%s.\n", - priv->sa[priv->num_sa].sa_id, aes_keysize_bits, sep+1); - - ++(priv->num_sa); - retval = 0; - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_aes : bad key data - missing '_'.\n"); - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_aes : full.\n"); - } - - return retval; -} - - -static n2n_tostat_t transop_tick_aes( n2n_trans_op_t * arg, time_t now ) -{ - transop_aes_t * priv = (transop_aes_t *)arg->priv; - size_t i; - int found=0; - n2n_tostat_t r; - - memset( &r, 0, sizeof(r) ); - - traceEvent( TRACE_DEBUG, "transop_aes tick num_sa=%u now=%lu", priv->num_sa, now ); - - for ( i=0; i < priv->num_sa; ++i ) - { - if ( 0 == validCipherSpec( &(priv->sa[i].spec), now ) ) - { - time_t remaining = priv->sa[i].spec.valid_until - now; - - traceEvent( TRACE_INFO, "transop_aes choosing tx_sa=%u (valid for %lu sec)", priv->sa[i].sa_id, remaining ); - priv->tx_sa=i; - found=1; - break; - } - else - { - traceEvent( TRACE_DEBUG, "transop_aes tick rejecting sa=%u %lu -> %lu", - priv->sa[i].sa_id, priv->sa[i].spec.valid_from, priv->sa[i].spec.valid_until ); - } - } - - if ( 0==found) - { - traceEvent( TRACE_INFO, "transop_aes no keys are currently valid. Keeping tx_sa=%u", priv->tx_sa ); - } - else - { - r.can_tx = 1; - r.tx_spec.t = N2N_TRANSFORM_ID_AESCBC; - r.tx_spec = priv->sa[priv->tx_sa].spec; - } - - return r; -} - - -int transop_aes_init( n2n_trans_op_t * ttt ) -{ - int retval = 1; - transop_aes_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_aes( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_aes_t *) malloc( sizeof(transop_aes_t) ); - - if ( NULL != priv ) - { - size_t i; - sa_aes_t * sa=NULL; - - /* install the private structure. */ - ttt->priv = priv; - priv->num_sa=0; - priv->tx_sa=0; /* We will use this sa index for encoding. */ - - ttt->transform_id = N2N_TRANSFORM_ID_AESCBC; - ttt->addspec = transop_addspec_aes; - ttt->tick = transop_tick_aes; /* chooses a new tx_sa */ - ttt->deinit = transop_deinit_aes; - ttt->fwd = transop_encode_aes; - ttt->rev = transop_decode_aes; - - for(i=0; isa[i]); - sa->sa_id=0; - memset( &(sa->spec), 0, sizeof(n2n_cipherspec_t) ); - memset( &(sa->enc_key), 0, sizeof(AES_KEY) ); - memset( &(sa->enc_ivec), 0, sizeof(N2N_AES_IVEC_SIZE) ); - memset( &(sa->dec_key), 0, sizeof(AES_KEY) ); - memset( &(sa->dec_ivec), 0, sizeof(N2N_AES_IVEC_SIZE) ); - } - - retval = 0; - } - else - { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for aes" ); - } - - return retval; -} - -#else /* #if defined(N2N_HAVE_AES) */ - -struct transop_aes -{ - ssize_t tx_sa; -}; - -typedef struct transop_aes transop_aes_t; - - -static int transop_deinit_aes( n2n_trans_op_t * arg ) -{ - transop_aes_t * priv = (transop_aes_t *)arg->priv; - - if ( priv ) - { - free(priv); - } - - arg->priv=NULL; /* return to fully uninitialised state */ - - return 0; -} - -static int transop_encode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - return -1; -} - -static int transop_decode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - return -1; -} - -static int transop_addspec_aes( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - traceEvent( TRACE_DEBUG, "transop_addspec_aes AES not built into edge.\n"); - - return -1; -} - -static n2n_tostat_t transop_tick_aes( n2n_trans_op_t * arg, time_t now ) -{ - n2n_tostat_t r; - - memset( &r, 0, sizeof(r) ); - - return r; -} - -int transop_aes_init( n2n_trans_op_t * ttt ) -{ - int retval = 1; - transop_aes_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_aes( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_aes_t *) malloc( sizeof(transop_aes_t) ); - - if ( NULL != priv ) - { - /* install the private structure. */ - ttt->priv = priv; - priv->tx_sa=0; /* We will use this sa index for encoding. */ - - ttt->transform_id = N2N_TRANSFORM_ID_AESCBC; - ttt->addspec = transop_addspec_aes; - ttt->tick = transop_tick_aes; /* chooses a new tx_sa */ - ttt->deinit = transop_deinit_aes; - ttt->fwd = transop_encode_aes; - ttt->rev = transop_decode_aes; - - retval = 0; - } - else - { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for aes" ); - } - - return retval; -} - -#endif /* #if defined(N2N_HAVE_AES) */ - diff --git a/bundles/n2n_meyerd/n2n_v2/transform_null.c b/bundles/n2n_meyerd/n2n_v2/transform_null.c deleted file mode 100644 index b486989d..00000000 --- a/bundles/n2n_meyerd/n2n_v2/transform_null.c +++ /dev/null @@ -1,84 +0,0 @@ -/* (c) 2009 Richard Andrews */ - -#include "n2n.h" -#include "n2n_transforms.h" - -static int transop_deinit_null( n2n_trans_op_t * arg ) -{ - /* nothing to deallocate, nothing to release. */ - return 0; -} - -static int transop_encode_null( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - int retval = -1; - - traceEvent( TRACE_DEBUG, "encode_null %lu", in_len ); - if ( out_len >= in_len ) - { - memcpy( outbuf, inbuf, in_len ); - retval = in_len; - } - else - { - traceEvent( TRACE_DEBUG, "encode_null %lu too big for packet buffer", in_len ); - } - - return retval; -} - -static int transop_decode_null( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - int retval = -1; - - traceEvent( TRACE_DEBUG, "decode_null %lu", in_len ); - if ( out_len >= in_len ) - { - memcpy( outbuf, inbuf, in_len ); - retval = in_len; - } - else - { - traceEvent( TRACE_DEBUG, "decode_null %lu too big for packet buffer", in_len ); - } - - return retval; -} - -static int transop_addspec_null( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - return 0; -} - -static n2n_tostat_t transop_tick_null( n2n_trans_op_t * arg, time_t now ) -{ - n2n_tostat_t r; - - r.can_tx=1; - r.tx_spec.t = N2N_TRANSFORM_ID_NULL; - r.tx_spec.valid_from = 0; - r.tx_spec.valid_until = (time_t)(-1); - r.tx_spec.opaque_size=0; - - return r; -} - -void transop_null_init( n2n_trans_op_t * ttt ) -{ - memset(ttt, 0, sizeof(n2n_trans_op_t) ); - - ttt->transform_id = N2N_TRANSFORM_ID_NULL; - ttt->deinit = transop_deinit_null; - ttt->addspec = transop_addspec_null; - ttt->tick = transop_tick_null; - ttt->fwd = transop_encode_null; - ttt->rev = transop_decode_null; -} diff --git a/bundles/n2n_meyerd/n2n_v2/transform_tf.c b/bundles/n2n_meyerd/n2n_v2/transform_tf.c deleted file mode 100644 index 93273179..00000000 --- a/bundles/n2n_meyerd/n2n_v2/transform_tf.c +++ /dev/null @@ -1,491 +0,0 @@ -/* (c) 2009 Richard Andrews */ - -#include "n2n.h" -#include "n2n_transforms.h" -#include "twofish.h" -#ifndef _MSC_VER -/* Not included in Visual Studio 2008 */ -#include /* index() */ -#endif - -#define N2N_TWOFISH_NUM_SA 32 /* space for SAa */ - -#define N2N_TWOFISH_TRANSFORM_VERSION 1 /* version of the transform encoding */ - -struct sa_twofish -{ - n2n_cipherspec_t spec; /* cipher spec parameters */ - n2n_sa_t sa_id; /* security association index */ - TWOFISH * enc_tf; /* tx state */ - TWOFISH * dec_tf; /* rx state */ -}; - -typedef struct sa_twofish sa_twofish_t; - - -/** Twofish transform state data. - * - * With a key-schedule in place this will be populated with a number of - * SAs. Each SA has a lifetime and some opque data. The opaque data for twofish - * consists of the SA number and key material. - * - */ -struct transop_tf -{ - ssize_t tx_sa; - size_t num_sa; - sa_twofish_t sa[N2N_TWOFISH_NUM_SA]; -}; - -typedef struct transop_tf transop_tf_t; - -static int transop_deinit_twofish( n2n_trans_op_t * arg ) -{ - transop_tf_t * priv = (transop_tf_t *)arg->priv; - size_t i; - - if ( priv ) - { - /* Memory was previously allocated */ - for (i=0; isa[i]); - - TwoFishDestroy(sa->enc_tf); /* deallocate TWOFISH */ - sa->enc_tf=NULL; - - TwoFishDestroy(sa->dec_tf); /* deallocate TWOFISH */ - sa->dec_tf=NULL; - - sa->sa_id=0; - } - - priv->num_sa=0; - priv->tx_sa=-1; - - free(priv); - } - - arg->priv=NULL; /* return to fully uninitialised state */ - - return 0; -} - -static size_t tf_choose_tx_sa( transop_tf_t * priv ) -{ - return priv->tx_sa; /* set in tick */ -} - -#define TRANSOP_TF_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_TF_NONCE_SIZE 4 -#define TRANSOP_TF_SA_SIZE 4 - -/** The twofish packet format consists of: - * - * - a 8-bit twofish encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_encode_twofish( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - int len=-1; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - uint32_t * pnonce; - - if ( (in_len + TRANSOP_TF_NONCE_SIZE) <= N2N_PKT_BUF_SIZE ) - { - if ( (in_len + TRANSOP_TF_NONCE_SIZE + TRANSOP_TF_SA_SIZE + TRANSOP_TF_VER_SIZE) <= out_len ) - { - size_t idx=0; - sa_twofish_t * sa; - size_t tx_sa_num = 0; - - /* The transmit sa is periodically updated */ - tx_sa_num = tf_choose_tx_sa( priv ); - - sa = &(priv->sa[tx_sa_num]); /* Proper Tx SA index */ - - traceEvent( TRACE_DEBUG, "encode_twofish %lu with SA %lu.", in_len, sa->sa_id ); - - /* Encode the twofish format version. */ - encode_uint8( outbuf, &idx, N2N_TWOFISH_TRANSFORM_VERSION ); - - /* Encode the security association (SA) number */ - encode_uint32( outbuf, &idx, sa->sa_id ); - - /* The assembly buffer is a source for encrypting data. The nonce is - * written in first followed by the packet payload. The whole - * contents of assembly are encrypted. */ - pnonce = (uint32_t *)assembly; - *pnonce = rand(); - memcpy( assembly + TRANSOP_TF_NONCE_SIZE, inbuf, in_len ); - - /* Encrypt the assembly contents and write the ciphertext after the SA. */ - len = TwoFishEncryptRaw( assembly, /* source */ - outbuf + TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE, - in_len + TRANSOP_TF_NONCE_SIZE, /* enc size */ - sa->enc_tf); - if ( len > 0 ) - { - len += TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE; /* size of data carried in UDP. */ - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish encryption failed." ); - } - - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish outbuf too small." ); - } - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish inbuf too big to encrypt." ); - } - - return len; -} - - -/* Search through the array of SAs to find the one with the required ID. - * - * @return array index where found or -1 if not found - */ -static ssize_t twofish_find_sa( const transop_tf_t * priv, const n2n_sa_t req_id ) -{ - size_t i; - - for (i=0; i < priv->num_sa; ++i) - { - const sa_twofish_t * sa=NULL; - - sa = &(priv->sa[i]); - if (req_id == sa->sa_id) - { - return i; - } - } - - return -1; -} - - -/** The twofish packet format consists of: - * - * - a 8-bit twofish encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_decode_twofish( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - int len=0; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - if ( ( (in_len - (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE)) <= N2N_PKT_BUF_SIZE ) /* Cipher text fits in assembly */ - && (in_len >= (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE + TRANSOP_TF_NONCE_SIZE) ) /* Has at least version, SA and nonce */ - ) - { - n2n_sa_t sa_rx; - ssize_t sa_idx=-1; - size_t rem=in_len; - size_t idx=0; - uint8_t tf_enc_ver=0; - - /* Get the encoding version to make sure it is supported */ - decode_uint8( &tf_enc_ver, inbuf, &rem, &idx ); - - if ( N2N_TWOFISH_TRANSFORM_VERSION == tf_enc_ver ) - { - /* Get the SA number and make sure we are decrypting with the right one. */ - decode_uint32( &sa_rx, inbuf, &rem, &idx ); - - sa_idx = twofish_find_sa(priv, sa_rx); - if ( sa_idx >= 0 ) - { - sa_twofish_t * sa = &(priv->sa[sa_idx]); - - traceEvent( TRACE_DEBUG, "decode_twofish %lu with SA %lu.", in_len, sa_rx, sa->sa_id ); - - len = TwoFishDecryptRaw( (void *)(inbuf + TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE), - assembly, /* destination */ - (in_len - (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE)), - sa->dec_tf); - - if ( len > 0 ) - { - /* Step over 4-byte random nonce value */ - len -= TRANSOP_TF_NONCE_SIZE; /* size of ethernet packet */ - - memcpy( outbuf, - assembly + TRANSOP_TF_NONCE_SIZE, - len ); - } - else - { - traceEvent( TRACE_ERROR, "decode_twofish decryption failed." ); - } - - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_twofish SA number %lu not found.", sa_rx ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_twofish unsupported twofish version %u.", tf_enc_ver ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - traceEvent( TRACE_ERROR, "decode_twofish inbuf wrong size (%ul) to decrypt.", in_len ); - } - - return len; -} - -static int transop_addspec_twofish( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - int retval = 1; - ssize_t pstat=-1; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t keybuf[N2N_MAX_KEYSIZE]; - - if ( priv->num_sa < N2N_TWOFISH_NUM_SA ) - { - const char * op = (const char *)cspec->opaque; -#ifdef __ANDROID_NDK__ - const char *sep = strchr(op, '_'); -#else - const char * sep = index( op, '_' ); -#endif // __ANDROID_NDK__ - - if ( sep ) - { - char tmp[256]; - size_t s; - - s = sep - op; - memcpy( tmp, cspec->opaque, s ); - tmp[s]=0; - - s = strlen(sep+1); /* sep is the _ which might be immediately followed by NULL */ - - priv->sa[priv->num_sa].spec = *cspec; - priv->sa[priv->num_sa].sa_id = strtoul(tmp, NULL, 10); - - pstat = n2n_parse_hex( keybuf, N2N_MAX_KEYSIZE, sep+1, s ); - if ( pstat > 0 ) - { - priv->sa[priv->num_sa].enc_tf = TwoFishInit( keybuf, pstat); - priv->sa[priv->num_sa].dec_tf = TwoFishInit( keybuf, pstat); - - traceEvent( TRACE_DEBUG, "transop_addspec_twofish sa_id=%u data=%s.\n", - priv->sa[priv->num_sa].sa_id, sep+1); - - ++(priv->num_sa); - retval = 0; - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_twofish : bad key data - missing '_'.\n"); - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_twofish : full.\n"); - } - - return retval; -} - - -static n2n_tostat_t transop_tick_twofish( n2n_trans_op_t * arg, time_t now ) -{ - transop_tf_t * priv = (transop_tf_t *)arg->priv; - size_t i; - int found=0; - n2n_tostat_t r; - - memset( &r, 0, sizeof(r) ); - - traceEvent( TRACE_DEBUG, "transop_tf tick num_sa=%u", priv->num_sa ); - - for ( i=0; i < priv->num_sa; ++i ) - { - if ( 0 == validCipherSpec( &(priv->sa[i].spec), now ) ) - { - time_t remaining = priv->sa[i].spec.valid_until - now; - - traceEvent( TRACE_INFO, "transop_tf choosing tx_sa=%u (valid for %lu sec)", priv->sa[i].sa_id, remaining ); - priv->tx_sa=i; - found=1; - break; - } - else - { - traceEvent( TRACE_DEBUG, "transop_tf tick rejecting sa=%u %lu -> %lu", - priv->sa[i].sa_id, priv->sa[i].spec.valid_from, priv->sa[i].spec.valid_until ); - } - } - - if ( 0==found) - { - traceEvent( TRACE_INFO, "transop_tf no keys are currently valid. Keeping tx_sa=%u", priv->tx_sa ); - } - else - { - r.can_tx = 1; - r.tx_spec.t = N2N_TRANSFORM_ID_TWOFISH; - r.tx_spec = priv->sa[priv->tx_sa].spec; - } - - return r; -} - - -int transop_twofish_setup( n2n_trans_op_t * ttt, - n2n_sa_t sa_num, - uint8_t * encrypt_pwd, - uint32_t encrypt_pwd_len ) -{ - int retval = 1; - transop_tf_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_twofish( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_tf_t *) malloc( sizeof(transop_tf_t) ); - - if ( NULL != priv ) - { - size_t i; - sa_twofish_t * sa=NULL; - - /* install the private structure. */ - ttt->priv = priv; - - for(i=0; isa[i]); - sa->sa_id=0; - memset( &(sa->spec), 0, sizeof(n2n_cipherspec_t) ); - sa->enc_tf=NULL; - sa->dec_tf=NULL; - } - - priv->num_sa=1; /* There is one SA in the array. */ - priv->tx_sa=0; - sa = &(priv->sa[priv->tx_sa]); - sa->sa_id=sa_num; - sa->spec.valid_until = 0x7fffffff; - - /* This is a preshared key setup. Both Tx and Rx are using the same security association. */ - - sa->enc_tf = TwoFishInit(encrypt_pwd, encrypt_pwd_len); - sa->dec_tf = TwoFishInit(encrypt_pwd, encrypt_pwd_len); - - if ( (sa->enc_tf) && (sa->dec_tf) ) - { - ttt->transform_id = N2N_TRANSFORM_ID_TWOFISH; - ttt->deinit = transop_deinit_twofish; - ttt->addspec = transop_addspec_twofish; - ttt->tick = transop_tick_twofish; /* chooses a new tx_sa */ - ttt->fwd = transop_encode_twofish; - ttt->rev = transop_decode_twofish; - - retval = 0; - } - else - { - traceEvent( TRACE_ERROR, "TwoFishInit failed" ); - } - } - else - { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for twofish" ); - } - - return retval; -} - -int transop_twofish_init( n2n_trans_op_t * ttt ) -{ - int retval = 1; - transop_tf_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_twofish( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_tf_t *) malloc( sizeof(transop_tf_t) ); - - if ( NULL != priv ) - { - size_t i; - sa_twofish_t * sa=NULL; - - /* install the private structure. */ - ttt->priv = priv; - priv->num_sa=0; - priv->tx_sa=0; /* We will use this sa index for encoding. */ - - ttt->transform_id = N2N_TRANSFORM_ID_TWOFISH; - ttt->addspec = transop_addspec_twofish; - ttt->tick = transop_tick_twofish; /* chooses a new tx_sa */ - ttt->deinit = transop_deinit_twofish; - ttt->fwd = transop_encode_twofish; - ttt->rev = transop_decode_twofish; - - for(i=0; isa[i]); - sa->sa_id=0; - memset( &(sa->spec), 0, sizeof(n2n_cipherspec_t) ); - sa->enc_tf=NULL; - sa->dec_tf=NULL; - } - - retval = 0; - } - else - { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for twofish" ); - } - - return retval; -} diff --git a/bundles/n2n_meyerd/n2n_v2/tuntap_freebsd.c b/bundles/n2n_meyerd/n2n_v2/tuntap_freebsd.c deleted file mode 100644 index 7d9096a3..00000000 --- a/bundles/n2n_meyerd/n2n_v2/tuntap_freebsd.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - */ - -#include "n2n.h" - -#ifdef __FreeBSD__ - -void tun_close(tuntap_dev *device); - -/* ********************************** */ - -#define N2N_FREEBSD_TAPDEVICE_SIZE 32 -int tuntap_open(tuntap_dev *device /* ignored */, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - int i; - char tap_device[N2N_FREEBSD_TAPDEVICE_SIZE]; - - for (i = 0; i < 255; i++) { - snprintf(tap_device, sizeof(tap_device), "/dev/tap%d", i); - - device->fd = open(tap_device, O_RDWR); - if(device->fd > 0) { - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - break; - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open tap device"); - return(-1); - } else { - char buf[256]; - FILE *fd; - - device->ip_addr = inet_addr(device_ip); - - if ( device_mac && device_mac[0] != '\0' ) - { - /* FIXME - This is not tested. Might be wrong syntax for OS X */ - - /* Set the hw address before bringing the if up. */ - snprintf(buf, sizeof(buf), "ifconfig tap%d ether %s", - i, device_mac); - system(buf); - } - - snprintf(buf, sizeof(buf), "ifconfig tap%d %s netmask %s mtu %d up", - i, device_ip, device_mask, mtu); - system(buf); - - traceEvent(TRACE_NORMAL, "Interface tap%d up and running (%s/%s)", - i, device_ip, device_mask); - - /* Read MAC address */ - - snprintf(buf, sizeof(buf), "ifconfig tap%d |grep ether|cut -c 8-24", i); - /* traceEvent(TRACE_INFO, "%s", buf); */ - - fd = popen(buf, "r"); - if(fd < 0) { - tun_close(device); - return(-1); - } else { - int a, b, c, d, e, f; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address"); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface tap%d mac %s", i, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - - /* read_mac(dev, device->mac_addr); */ - return(device->fd); -} - -/* ********************************** */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ -} - -#endif /* #ifdef __FreeBSD__ */ diff --git a/bundles/n2n_meyerd/n2n_v2/tuntap_linux.c b/bundles/n2n_meyerd/n2n_v2/tuntap_linux.c deleted file mode 100644 index be3cbb97..00000000 --- a/bundles/n2n_meyerd/n2n_v2/tuntap_linux.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see -*/ - -#include "n2n.h" - -#ifdef __linux__ - -static void read_mac(char *ifname, n2n_mac_t mac_addr) { - int _sock, res; - struct ifreq ifr; - macstr_t mac_addr_buf; - - memset (&ifr,0,sizeof(struct ifreq)); - - /* Dummy socket, just to make ioctls with */ - _sock=socket(PF_INET, SOCK_DGRAM, 0); - strcpy(ifr.ifr_name, ifname); - res = ioctl(_sock,SIOCGIFHWADDR,&ifr); - if (res<0) { - perror ("Get hw addr"); - } else - memcpy(mac_addr, ifr.ifr_ifru.ifru_hwaddr.sa_data, 6); - - traceEvent(TRACE_NORMAL, "Interface %s has MAC %s", - ifname, - macaddr_str(mac_addr_buf, mac_addr )); - close(_sock); -} - -/* ********************************** */ - -/** @brief Open and configure the TAP device for packet read/write. - * - * This routine creates the interface via the tuntap driver then uses ifconfig - * to configure address/mask and MTU. - * - * @param device - [inout] a device info holder object - * @param dev - user-defined name for the new iface, - * if NULL system will assign a name - * @param device_ip - address of iface - * @param device_mask - netmask for device_ip - * @param mtu - MTU for device_ip - * - * @return - negative value on error - * - non-negative file-descriptor on success - */ -int tuntap_open(tuntap_dev *device, - char *dev, /* user-definable interface name, eg. edge0 */ - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - char *tuntap_device = "/dev/net/tun"; -#define N2N_LINUX_SYSTEMCMD_SIZE 128 - char buf[N2N_LINUX_SYSTEMCMD_SIZE]; - struct ifreq ifr; - int rc; - - device->fd = open(tuntap_device, O_RDWR); - if(device->fd < 0) { - printf("ERROR: ioctl() [%s][%d]\n", strerror(errno), errno); - return -1; - } - - memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TAP|IFF_NO_PI; /* Want a TAP device for layer 2 frames. */ - strncpy(ifr.ifr_name, dev, IFNAMSIZ); - rc = ioctl(device->fd, TUNSETIFF, (void *)&ifr); - - if(rc < 0) { - traceEvent(TRACE_ERROR, "ioctl() [%s][%d]\n", strerror(errno), rc); - close(device->fd); - return -1; - } - - /* Store the device name for later reuse */ - strncpy(device->dev_name, ifr.ifr_name, MIN(IFNAMSIZ, N2N_IFNAMSIZ) ); - - if ( device_mac && device_mac[0] != '\0' ) - { - /* Set the hw address before bringing the if up. */ - snprintf(buf, sizeof(buf), "/sbin/ifconfig %s hw ether %s", - ifr.ifr_name, device_mac ); - system(buf); - traceEvent(TRACE_INFO, "Setting MAC: %s", buf); - } - - if ( 0 == strncmp( "dhcp", address_mode, 5 ) ) - { - snprintf(buf, sizeof(buf), "/sbin/ifconfig %s %s mtu %d up", - ifr.ifr_name, device_ip, mtu); - } - else - { - snprintf(buf, sizeof(buf), "/sbin/ifconfig %s %s netmask %s mtu %d up", - ifr.ifr_name, device_ip, device_mask, mtu); - } - - system(buf); - traceEvent(TRACE_INFO, "Bringing up: %s", buf); - - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - read_mac(dev, device->mac_addr); - return(device->fd); -} - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ - FILE * fp=NULL; - char buf[N2N_LINUX_SYSTEMCMD_SIZE]; - - /* Would rather have a more direct way to get the inet address but a netlink - * socket is overkill and probably less portable than ifconfig and sed. */ - - /* If the interface has no address (0.0.0.0) there will be no inet addr - * line and the returned string will be empty. */ - snprintf( buf, sizeof(buf), "/sbin/ifconfig %s | /bin/sed -e '/inet addr:/!d' -e 's/^.*inet addr://' -e 's/ .*$//'", - tuntap->dev_name ); - fp=popen(buf, "r"); - if (fp ) - { - memset(buf,0,N2N_LINUX_SYSTEMCMD_SIZE); /* make sure buf is NULL terminated. */ - fread(buf, 1, 15, fp); - fclose(fp); - fp=NULL; - - traceEvent(TRACE_INFO, "ifconfig address = %s", buf); - - tuntap->ip_addr = inet_addr(buf); - } -} - - -#endif /* #ifdef __linux__ */ diff --git a/bundles/n2n_meyerd/n2n_v2/tuntap_netbsd.c b/bundles/n2n_meyerd/n2n_v2/tuntap_netbsd.c deleted file mode 100644 index 011f7dfb..00000000 --- a/bundles/n2n_meyerd/n2n_v2/tuntap_netbsd.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * (C) 2009 - Alaric Snell-Pym - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - */ - -#include "n2n.h" - -#ifdef __NetBSD__ - -#include -#include -#include - -void tun_close(tuntap_dev *device); - -/* ********************************** */ - -#define N2N_NETBSD_TAPDEVICE_SIZE 32 -int tuntap_open(tuntap_dev *device /* ignored */, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - char tap_device[N2N_NETBSD_TAPDEVICE_SIZE]; - struct ifreq req; - - if (dev) { - snprintf(tap_device, sizeof(tap_device), "/dev/%s", dev); - device->fd = open(tap_device, O_RDWR); - snprintf(tap_device, sizeof(tap_device), "%s", dev); - } - else { - device->fd = open("/dev/tap", O_RDWR); - if(device->fd >= 0) { - if (ioctl(device->fd, TAPGIFNAME, &req) == -1) { - traceEvent(TRACE_ERROR, "Unable to obtain name of tap device (%s)", strerror(errno)); - close(device->fd); - return(-1); - } - else { - snprintf(tap_device, sizeof(tap_device), req.ifr_name); - } - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open tap device (%s)", strerror(errno)); - return(-1); - } else { - char buf[256]; - FILE *fd; - - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - - device->ip_addr = inet_addr(device_ip); - - if ( device_mac && device_mac[0] != '\0' ) - { - /* Set the hw address before bringing the if up. */ - snprintf(buf, sizeof(buf), "ifconfig %s link %s active", - tap_device, device_mac); - system(buf); - } - - snprintf(buf, sizeof(buf), "ifconfig %s %s netmask %s mtu %d up", - tap_device, device_ip, device_mask, mtu); - system(buf); - - traceEvent(TRACE_NORMAL, "Interface %s up and running (%s/%s)", - tap_device, device_ip, device_mask); - - /* Read MAC address */ - - snprintf(buf, sizeof(buf), "ifconfig %s |grep address|cut -c 11-28", tap_device); - /* traceEvent(TRACE_INFO, "%s", buf); */ - - fd = popen(buf, "r"); - if(fd < 0) { - tun_close(device); - return(-1); - } else { - int a, b, c, d, e, f; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read %s interface MAC address", tap_device); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface %s mac %s", tap_device, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - - /* read_mac(dev, device->mac_addr); */ - return(device->fd); -} - -/* ********************************** */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ -} - -#endif /* #ifdef __NetBSD__ */ diff --git a/bundles/n2n_meyerd/n2n_v2/tuntap_osx.c b/bundles/n2n_meyerd/n2n_v2/tuntap_osx.c deleted file mode 100644 index d8c7c2be..00000000 --- a/bundles/n2n_meyerd/n2n_v2/tuntap_osx.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * (C) 2007-09 - Luca Deri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - */ - -#include "n2n.h" - -#ifdef _DARWIN_ - -void tuntap_close(tuntap_dev *device); - -/* ********************************** */ - -#define N2N_OSX_TAPDEVICE_SIZE 32 -int tuntap_open(tuntap_dev *device /* ignored */, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - int i; - char tap_device[N2N_OSX_TAPDEVICE_SIZE]; - - for (i = 0; i < 255; i++) { - snprintf(tap_device, sizeof(tap_device), "/dev/tap%d", i); - - device->fd = open(tap_device, O_RDWR); - if(device->fd > 0) { - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - break; - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open tap device"); - return(-1); - } else { - char buf[256]; - FILE *fd; - - device->ip_addr = inet_addr(device_ip); - - if ( device_mac && device_mac[0] != '\0' ) - { - /* FIXME - This is not tested. Might be wrong syntax for OS X */ - - /* Set the hw address before bringing the if up. */ - snprintf(buf, sizeof(buf), "ifconfig tap%d ether %s", - i, device_mac); - system(buf); - } - - snprintf(buf, sizeof(buf), "ifconfig tap%d %s netmask %s mtu %d up", - i, device_ip, device_mask, mtu); - system(buf); - - traceEvent(TRACE_NORMAL, "Interface tap%d up and running (%s/%s)", - i, device_ip, device_mask); - - /* Read MAC address */ - - snprintf(buf, sizeof(buf), "ifconfig tap%d |grep ether|cut -c 8-24", i); - /* traceEvent(TRACE_INFO, "%s", buf); */ - - fd = popen(buf, "r"); - if(fd < 0) { - tuntap_close(device); - return(-1); - } else { - int a, b, c, d, e, f; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address"); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface tap%d [MTU %d] mac %s", i, mtu, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - - /* read_mac(dev, device->mac_addr); */ - return(device->fd); -} - -/* ********************************** */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ -} - -#endif /* _DARWIN_ */ diff --git a/bundles/n2n_meyerd/n2n_v2/twofish.c b/bundles/n2n_meyerd/n2n_v2/twofish.c deleted file mode 100644 index 57661d74..00000000 --- a/bundles/n2n_meyerd/n2n_v2/twofish.c +++ /dev/null @@ -1,1031 +0,0 @@ -/* $Id: twofish.c,v 2.0 2002/08/11 22:32:25 fknobbe Exp $ - * - * - * Copyright (C) 1997-2000 The Cryptix Foundation Limited. - * Copyright (C) 2000 Farm9. - * Copyright (C) 2001 Frank Knobbe. - * All rights reserved. - * - * For Cryptix code: - * Use, modification, copying and distribution of this software is subject - * the terms and conditions of the Cryptix General Licence. You should have - * received a copy of the Cryptix General Licence along with this library; - * if not, you can download a copy from http://www.cryptix.org/ . - * - * For Farm9: - * --- jojo@farm9.com, August 2000, converted from Java to C++, added CBC mode and - * ciphertext stealing technique, added AsciiTwofish class for easy encryption - * decryption of text strings - * - * Frank Knobbe : - * --- April 2001, converted from C++ to C, prefixed global variables - * with TwoFish, substituted some defines, changed functions to make use of - * variables supplied in a struct, modified and added routines for modular calls. - * Cleaned up the code so that defines are used instead of fixed 16's and 32's. - * Created two general purpose crypt routines for one block and multiple block - * encryption using Joh's CBC code. - * Added crypt routines that use a header (with a magic and data length). - * (Basically a major rewrite). - * - * Note: Routines labeled _TwoFish are private and should not be used - * (or with extreme caution). - * - */ - -#ifndef __TWOFISH_LIBRARY_SOURCE__ -#define __TWOFISH_LIBRARY_SOURCE__ - -#include -#include -#include -#include -#include -#include "twofish.h" - - -bool TwoFish_srand=TRUE; /* if TRUE, first call of TwoFishInit will seed rand(); */ -/* of TwoFishInit */ - -/* Fixed 8x8 permutation S-boxes */ -static const uint8_t TwoFish_P[2][256] = - { - { /* p0 */ - 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78, - 0xE4, 0xDD, 0xD1, 0x38, 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, - 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, 0xF2, 0xD0, 0x8B, 0x30, - 0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, - 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE, - 0x16, 0x0C, 0xE3, 0x61, 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, - 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, 0xE1, 0xE6, 0xBD, 0x45, - 0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, - 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF, - 0x33, 0xC9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, - 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, 0xA1, 0x1D, 0xAA, 0xED, - 0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, - 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B, - 0x5F, 0x93, 0x0A, 0xEF, 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, - 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, 0x2A, 0xCE, 0xCB, 0x2F, - 0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, - 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17, - 0x55, 0x1F, 0x8A, 0x7D, 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, - 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6E, 0x50, 0xDE, 0x68, - 0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, - 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42, - 0x4A, 0x5E, 0xC1, 0xE0 - }, - { /* p1 */ - 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B, - 0x45, 0x7D, 0xE8, 0x4B, 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, - 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, 0x5E, 0xBA, 0xAE, 0x5B, - 0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, - 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54, - 0x92, 0x74, 0x36, 0x51, 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, - 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, 0x13, 0x95, 0x9C, 0xC7, - 0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, - 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF, - 0x40, 0xE7, 0x2B, 0xE2, 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, - 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, 0x66, 0x94, 0xA1, 0x1D, - 0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, - 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21, - 0xC4, 0x1A, 0xEB, 0xD9, 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, - 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, 0x4F, 0xF2, 0x65, 0x8E, - 0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, - 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44, - 0xE0, 0x4D, 0x43, 0x69, 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, - 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, 0x22, 0xC9, 0xC0, 0x9B, - 0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, - 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56, - 0x55, 0x09, 0xBE, 0x91 - } - }; - -static bool TwoFish_MDSready=FALSE; -static uint32_t TwoFish_MDS[4][256]; /* TwoFish_MDS matrix */ - - -#define TwoFish_LFSR1(x) (((x)>>1)^(((x)&0x01)?TwoFish_MDS_GF_FDBK/2:0)) -#define TwoFish_LFSR2(x) (((x)>>2)^(((x)&0x02)?TwoFish_MDS_GF_FDBK/2:0)^(((x)&0x01)?TwoFish_MDS_GF_FDBK/4:0)) - -#define TwoFish_Mx_1(x) ((uint32_t)(x)) /* force result to dword so << will work */ -#define TwoFish_Mx_X(x) ((uint32_t)((x)^TwoFish_LFSR2(x))) /* 5B */ -#define TwoFish_Mx_Y(x) ((uint32_t)((x)^TwoFish_LFSR1(x)^TwoFish_LFSR2(x))) /* EF */ -#define TwoFish_RS_rem(x) { uint8_t b=(uint8_t)(x>>24); uint32_t g2=((b<<1)^((b&0x80)?TwoFish_RS_GF_FDBK:0))&0xFF; uint32_t g3=((b>>1)&0x7F)^((b&1)?TwoFish_RS_GF_FDBK>>1:0)^g2; x=(x<<8)^(g3<<24)^(g2<<16)^(g3<<8)^b; } - -/*#define TwoFish__b(x,N) (((uint8_t *)&x)[((N)&3)^TwoFish_ADDR_XOR])*/ /* pick bytes out of a dword */ - -#define TwoFish_b0(x) TwoFish__b(x,0) /* extract LSB of uint32_t */ -#define TwoFish_b1(x) TwoFish__b(x,1) -#define TwoFish_b2(x) TwoFish__b(x,2) -#define TwoFish_b3(x) TwoFish__b(x,3) /* extract MSB of uint32_t */ - -uint8_t TwoFish__b(uint32_t x,int n) -{ n&=3; - while(n-->0) - x>>=8; - return (uint8_t)x; -} - - -/* TwoFish Initialization - * - * This routine generates a global data structure for use with TwoFish, - * initializes important values (such as subkeys, sBoxes), generates subkeys - * and precomputes the MDS matrix if not already done. - * - * Input: User supplied password (will be appended by default password of 'SnortHas2FishEncryptionRoutines!') - * - * Output: Pointer to TWOFISH structure. This data structure contains key dependent data. - * This pointer is used with all other crypt functions. - */ - -TWOFISH *TwoFishInit(const uint8_t *userkey, uint32_t keysize) -{ TWOFISH *tfdata; - int i,x,m; - uint8_t tkey[TwoFish_KEY_LENGTH+40]; - - memset( tkey, 0, TwoFish_KEY_LENGTH+40 ); - tfdata=(TWOFISH *)malloc(sizeof(TWOFISH)); /* allocate the TwoFish structure */ - if(tfdata!=NULL) - { - - /* Changes here prevented a dangerous random key segment for keys of length < TwoFish_KEY_LENGTH */ - if(keysize > 0) - { - memcpy( tkey, userkey, keysize ); /* The rest will be zeros */ - } - else - { - memcpy( tkey, TwoFish_DEFAULT_PW, TwoFish_DEFAULT_PW_LEN ); /* if no key defined, use default password */ - } - - /* This loop is awful - surely a loop on memcpy() would be clearer and more efficient */ - for(i=0,x=0,m=keysize;ikey[i]=tkey[x++]; /* fill the whole keyspace with repeating key. */ - if(x==m) - x=0; - } - - if(!TwoFish_MDSready) - _TwoFish_PrecomputeMDSmatrix(); /* "Wake Up, Neo" */ - _TwoFish_MakeSubKeys(tfdata); /* generate subkeys */ - _TwoFish_ResetCBC(tfdata); /* reset the CBC */ - tfdata->output=NULL; /* nothing to output yet */ - tfdata->dontflush=FALSE; /* reset decrypt skip block flag */ - if(TwoFish_srand) - { - TwoFish_srand=FALSE; - /* REVISIT: BbMaj7 : Should choose something with less predictability - * particularly for embedded targets with no real-time clock. */ - srand((unsigned int)time(NULL)); - } - } - return tfdata; /* return the data pointer */ -} - - -void TwoFishDestroy(TWOFISH *tfdata) -{ if(tfdata!=NULL) - free(tfdata); -} - - -/* en/decryption with CBC mode */ -uint32_t _TwoFish_CryptRawCBC(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata) -{ uint32_t rl; - - rl=len; /* remember how much data to crypt. */ - while(len>TwoFish_BLOCK_SIZE) /* and now we process block by block. */ - { _TwoFish_BlockCrypt(in,out,TwoFish_BLOCK_SIZE,decrypt,tfdata); /* de/encrypt it. */ - in+=TwoFish_BLOCK_SIZE; /* adjust pointers. */ - out+=TwoFish_BLOCK_SIZE; - len-=TwoFish_BLOCK_SIZE; - } - if(len>0) /* if we have less than a block left... */ - _TwoFish_BlockCrypt(in,out,len,decrypt,tfdata); /* ...then we de/encrypt that too. */ - if(tfdata->qBlockDefined && !tfdata->dontflush) /* in case len was exactly one block... */ - _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); /* ...we need to write the... */ - /* ...remaining bytes of the buffer */ - return rl; -} - -/* en/decryption on one block only */ -uint32_t _TwoFish_CryptRaw16(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata) -{ /* qBlockPlain already zero'ed through ResetCBC */ - memcpy(tfdata->qBlockPlain,in,len); /* toss the data into it. */ - _TwoFish_BlockCrypt16(tfdata->qBlockPlain,tfdata->qBlockCrypt,decrypt,tfdata); /* encrypt just that block without CBC. */ - memcpy(out,tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE); /* and return what we got */ - return TwoFish_BLOCK_SIZE; -} - -/* en/decryption without reset of CBC and output assignment */ -uint32_t _TwoFish_CryptRaw(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata) -{ - if(in!=NULL && out!=NULL && len>0 && tfdata!=NULL) /* if we have valid data, then... */ - { if(len>TwoFish_BLOCK_SIZE) /* ...check if we have more than one block. */ - return _TwoFish_CryptRawCBC(in,out,len,decrypt,tfdata); /* if so, use the CBC routines... */ - else - return _TwoFish_CryptRaw16(in,out,len,decrypt,tfdata); /* ...otherwise just do one block. */ - } - return 0; -} - - -/* TwoFish Raw Encryption - * - * Does not use header, but does use CBC (if more than one block has to be encrypted). - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the buffer receiving the ciphertext. - * The length of the plaintext buffer. - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ - -uint32_t TwoFishEncryptRaw(uint8_t *in, - uint8_t *out, - uint32_t len, - TWOFISH *tfdata) -{ _TwoFish_ResetCBC(tfdata); /* reset CBC flag. */ - tfdata->output=out; /* output straight into output buffer. */ - return _TwoFish_CryptRaw(in,out,len,FALSE,tfdata); /* and go for it. */ -} - -/* TwoFish Raw Decryption - * - * Does not use header, but does use CBC (if more than one block has to be decrypted). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the buffer receiving the plaintext. - * The length of the ciphertext buffer (at least one cipher block). - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ - -uint32_t TwoFishDecryptRaw(uint8_t *in, - uint8_t *out, - uint32_t len, - TWOFISH *tfdata) -{ _TwoFish_ResetCBC(tfdata); /* reset CBC flag. */ - tfdata->output=out; /* output straight into output buffer. */ - return _TwoFish_CryptRaw(in,out,len,TRUE,tfdata); /* and go for it. */ -} - -/* TwoFish Free - * - * Free's the allocated buffer. - * - * Input: Pointer to the TwoFish structure - * - * Output: (none) - */ - -void TwoFishFree(TWOFISH *tfdata) -{ if(tfdata->output!=NULL) /* if a valid buffer is present... */ - { free(tfdata->output); /* ...then we free it for you... */ - tfdata->output=NULL; /* ...and mark as such. */ - } -} - -/* TwoFish Set Output - * - * If you want to allocate the output buffer yourself, - * then you can set it with this function. - * - * Input: Pointer to your output buffer - * Pointer to the TwoFish structure - * - * Output: (none) - */ - -void TwoFishSetOutput(uint8_t *outp,TWOFISH *tfdata) -{ tfdata->output=outp; /* (do we really need a function for this?) */ -} - -/* TwoFish Alloc - * - * Allocates enough memory for the output buffer that would be required - * - * Input: Length of the plaintext. - * Boolean flag for BinHex Output. - * Pointer to the TwoFish structure. - * - * Output: Returns a pointer to the memory allocated. - */ - -void *TwoFishAlloc(uint32_t len,bool binhex,bool decrypt,TWOFISH *tfdata) -{ - /* TwoFishFree(tfdata); */ /* (don't for now) discard whatever was allocated earlier. */ - if(decrypt) /* if decrypting... */ - { if(binhex) /* ...and input is binhex encoded... */ - len/=2; /* ...use half as much for output. */ - len-=TwoFish_BLOCK_SIZE; /* Also, subtract the size of the header. */ - } - else - { len+=TwoFish_BLOCK_SIZE; /* the size is just increased by the header... */ - if(binhex) - len*=2; /* ...and doubled if output is to be binhexed. */ - } - tfdata->output=malloc(len+TwoFish_BLOCK_SIZE);/* grab some memory...plus some extra (it's running over somewhere, crashes without extra padding) */ - - return tfdata->output; /* ...and return to caller. */ -} - -/* bin2hex and hex2bin conversion */ -void _TwoFish_BinHex(uint8_t *buf,uint32_t len,bool bintohex) -{ uint8_t *pi,*po,c; - - if(bintohex) - { for(pi=buf+len-1,po=buf+(2*len)-1;len>0;pi--,po--,len--) /* let's start from the end of the bin block. */ - { c=*pi; /* grab value. */ - c&=15; /* use lower 4 bits. */ - if(c>9) /* convert to ascii. */ - c+=('a'-10); - else - c+='0'; - *po--=c; /* set the lower nibble. */ - c=*pi; /* grab value again. */ - c>>=4; /* right shift 4 bits. */ - c&=15; /* make sure we only have 4 bits. */ - if(c>9) /* convert to ascii. */ - c+=('a'-10); - else - c+='0'; - *po=c; /* set the higher nibble. */ - } /* and keep going. */ - } - else - { for(pi=buf,po=buf;len>0;pi++,po++,len-=2) /* let's start from the beginning of the hex block. */ - { c=tolower(*pi++)-'0'; /* grab higher nibble. */ - if(c>9) /* convert to value. */ - c-=('0'-9); - *po=c<<4; /* left shit 4 bits. */ - c=tolower(*pi)-'0'; /* grab lower nibble. */ - if(c>9) /* convert to value. */ - c-=('0'-9); - *po|=c; /* and add to value. */ - } - } -} - - -/* TwoFish Encryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will include a small 'header' - * containing the magic and some salt. That way the decrypt routine can check if the - * packet got decrypted successfully, and return 0 instead of garbage. - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the pointer to the buffer receiving the ciphertext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the plaintext buffer. - * Can be -1 if the input is a null terminated string, in which case we'll count for you. - * Boolean flag for BinHex Output (if used, output will be twice as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ - -uint32_t TwoFishEncrypt(uint8_t *in, - uint8_t **out, - signed long len, - bool binhex, - TWOFISH *tfdata) -{ uint32_t ilen,olen; - - -#if 0 -/* This is so broken it doesn't deserve to live. */ - if(len== -1) /* if we got -1 for len, we'll assume IN is a... */ - ilen=strlen(in); /* ...\0 terminated string and figure len out ourselves... */ - else - ilen=len; /* ...otherwise we trust you supply a correct length. */ -#endif - - ilen = len; - - if(in!=NULL && out!=NULL && ilen>0 && tfdata!=NULL) /* if we got usable stuff, we'll do it. */ - { if(*out==NULL) /* if OUT points to a NULL pointer... */ - *out=TwoFishAlloc(ilen,binhex,FALSE,tfdata); /* ...we'll (re-)allocate buffer space. */ - if(*out!=NULL) - { tfdata->output=*out; /* set output buffer. */ - tfdata->header.salt=rand()*65536+rand(); /* toss in some salt. */ - tfdata->header.length[0]= (uint8_t)(ilen); - tfdata->header.length[1]= (uint8_t)(ilen>>8); - tfdata->header.length[2]= (uint8_t)(ilen>>16); - tfdata->header.length[3]= (uint8_t)(ilen>>24); - memcpy(tfdata->header.magic,TwoFish_MAGIC,TwoFish_MAGIC_LEN); /* set the magic. */ - olen=TwoFish_BLOCK_SIZE; /* set output counter. */ - _TwoFish_ResetCBC(tfdata); /* reset the CBC flag */ - _TwoFish_BlockCrypt((uint8_t *)&(tfdata->header),*out,olen,FALSE,tfdata); /* encrypt first block (without flush on 16 byte boundary). */ - olen+=_TwoFish_CryptRawCBC(in,*out+TwoFish_BLOCK_SIZE,ilen,FALSE,tfdata); /* and encrypt the rest (we do not reset the CBC flag). */ - if(binhex) /* if binhex... */ - { _TwoFish_BinHex(*out,olen,TRUE); /* ...convert output to binhex... */ - olen*=2; /* ...and size twice as large. */ - } - tfdata->output=*out; - return olen; - } - } - return 0; -} - -/* TwoFish Decryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will check the small 'header' - * containing the magic. If magic does not match we return 0. Otherwise we return the - * amount of bytes decrypted (should be the same as the length in the header). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the pointer to the buffer receiving the plaintext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the ciphertext buffer. - * Can be -1 if the input is a null terminated binhex string, in which case we'll count for you. - * Boolean flag for BinHex Input (if used, plaintext will be half as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ - -uint32_t TwoFishDecrypt(uint8_t *in, - uint8_t **out, - signed long len, - bool binhex, - TWOFISH *tfdata) -{ uint32_t ilen,elen,olen; - const uint8_t cmagic[TwoFish_MAGIC_LEN]=TwoFish_MAGIC; - uint8_t *tbuf; - - - -#if 0 -/* This is so broken it doesn't deserve to live. */ - if(len== -1) /* if we got -1 for len, we'll assume IN is a... */ - ilen=strlen(in); /* ...\0 terminated string and figure len out ourselves... */ - else - ilen=len; /* ...otherwise we trust you supply a correct length. */ -#endif - - ilen = len; - - if(in!=NULL && out!=NULL && ilen>0 && tfdata!=NULL) /* if we got usable stuff, we'll do it. */ - { if(*out==NULL) /* if OUT points to a NULL pointer... */ - *out=TwoFishAlloc(ilen,binhex,TRUE,tfdata); /* ...we'll (re-)allocate buffer space. */ - if(*out!=NULL) - { if(binhex) /* if binhex... */ - { _TwoFish_BinHex(in,ilen,FALSE); /* ...convert input to values... */ - ilen/=2; /* ...and size half as much. */ - } - _TwoFish_ResetCBC(tfdata); /* reset the CBC flag. */ - - tbuf=(uint8_t *)malloc(ilen+TwoFish_BLOCK_SIZE); /* get memory for data and header. */ - if(tbuf==NULL) - return 0; - tfdata->output=tbuf; /* set output to temp buffer. */ - - olen=_TwoFish_CryptRawCBC(in,tbuf,ilen,TRUE,tfdata)-TwoFish_BLOCK_SIZE; /* decrypt the whole thing. */ - memcpy(&(tfdata->header),tbuf,TwoFish_BLOCK_SIZE); /* copy first block into header. */ - tfdata->output=*out; - for(elen=0;elenheader.magic[elen]!=cmagic[elen]) - break; - if(elen==TwoFish_MAGIC_LEN) /* if magic matches then... */ - { elen=(tfdata->header.length[0]) | - (tfdata->header.length[1])<<8 | - (tfdata->header.length[2])<<16 | - (tfdata->header.length[3])<<24; /* .. we know how much to expect. */ - if(elen>olen) /* adjust if necessary. */ - elen=olen; - memcpy(*out,tbuf+TwoFish_BLOCK_SIZE,elen); /* copy data into intended output. */ - free(tbuf); - return elen; - } - free(tbuf); - } - } - return 0; -} - -void _TwoFish_PrecomputeMDSmatrix(void) /* precompute the TwoFish_MDS matrix */ -{ uint32_t m1[2]; - uint32_t mX[2]; - uint32_t mY[2]; - uint32_t i, j; - - for (i = 0; i < 256; i++) - { j = TwoFish_P[0][i] & 0xFF; /* compute all the matrix elements */ - m1[0] = j; - mX[0] = TwoFish_Mx_X( j ) & 0xFF; - mY[0] = TwoFish_Mx_Y( j ) & 0xFF; - - j = TwoFish_P[1][i] & 0xFF; - m1[1] = j; - mX[1] = TwoFish_Mx_X( j ) & 0xFF; - mY[1] = TwoFish_Mx_Y( j ) & 0xFF; - - TwoFish_MDS[0][i] = m1[TwoFish_P_00] | /* fill matrix w/ above elements */ - mX[TwoFish_P_00] << 8 | - mY[TwoFish_P_00] << 16 | - mY[TwoFish_P_00] << 24; - TwoFish_MDS[1][i] = mY[TwoFish_P_10] | - mY[TwoFish_P_10] << 8 | - mX[TwoFish_P_10] << 16 | - m1[TwoFish_P_10] << 24; - TwoFish_MDS[2][i] = mX[TwoFish_P_20] | - mY[TwoFish_P_20] << 8 | - m1[TwoFish_P_20] << 16 | - mY[TwoFish_P_20] << 24; - TwoFish_MDS[3][i] = mX[TwoFish_P_30] | - m1[TwoFish_P_30] << 8 | - mY[TwoFish_P_30] << 16 | - mX[TwoFish_P_30] << 24; - } - TwoFish_MDSready=TRUE; -} - - -void _TwoFish_MakeSubKeys(TWOFISH *tfdata) /* Expand a user-supplied key material into a session key. */ -{ uint32_t k64Cnt = TwoFish_KEY_LENGTH / 8; - uint32_t k32e[4]; /* even 32-bit entities */ - uint32_t k32o[4]; /* odd 32-bit entities */ - uint32_t sBoxKey[4]; - uint32_t offset,i,j; - uint32_t A, B, q=0; - uint32_t k0,k1,k2,k3; - uint32_t b0,b1,b2,b3; - - /* split user key material into even and odd 32-bit entities and */ - /* compute S-box keys using (12, 8) Reed-Solomon code over GF(256) */ - - - for (offset=0,i=0,j=k64Cnt-1;i<4 && offsetkey[offset++]; - k32e[i]|= tfdata->key[offset++]<<8; - k32e[i]|= tfdata->key[offset++]<<16; - k32e[i]|= tfdata->key[offset++]<<24; - k32o[i] = tfdata->key[offset++]; - k32o[i]|= tfdata->key[offset++]<<8; - k32o[i]|= tfdata->key[offset++]<<16; - k32o[i]|= tfdata->key[offset++]<<24; - sBoxKey[j] = _TwoFish_RS_MDS_Encode( k32e[i], k32o[i] ); /* reverse order */ - } - - /* compute the round decryption subkeys for PHT. these same subkeys */ - /* will be used in encryption but will be applied in reverse order. */ - i=0; - while(i < TwoFish_TOTAL_SUBKEYS) - { A = _TwoFish_F32( k64Cnt, q, k32e ); /* A uses even key entities */ - q += TwoFish_SK_BUMP; - - B = _TwoFish_F32( k64Cnt, q, k32o ); /* B uses odd key entities */ - q += TwoFish_SK_BUMP; - - B = B << 8 | B >> 24; - - A += B; - tfdata->subKeys[i++] = A; /* combine with a PHT */ - - A += B; - tfdata->subKeys[i++] = A << TwoFish_SK_ROTL | A >> (32-TwoFish_SK_ROTL); - } - - /* fully expand the table for speed */ - k0 = sBoxKey[0]; - k1 = sBoxKey[1]; - k2 = sBoxKey[2]; - k3 = sBoxKey[3]; - - for (i = 0; i < 256; i++) - { b0 = b1 = b2 = b3 = i; - switch (k64Cnt & 3) - { case 1: /* 64-bit keys */ - tfdata->sBox[ 2*i ] = TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][b0]) ^ TwoFish_b0(k0)]; - tfdata->sBox[ 2*i+1] = TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][b1]) ^ TwoFish_b1(k0)]; - tfdata->sBox[0x200+2*i ] = TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][b2]) ^ TwoFish_b2(k0)]; - tfdata->sBox[0x200+2*i+1] = TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][b3]) ^ TwoFish_b3(k0)]; - break; - case 0: /* 256-bit keys (same as 4) */ - b0 = (TwoFish_P[TwoFish_P_04][b0]) ^ TwoFish_b0(k3); - b1 = (TwoFish_P[TwoFish_P_14][b1]) ^ TwoFish_b1(k3); - b2 = (TwoFish_P[TwoFish_P_24][b2]) ^ TwoFish_b2(k3); - b3 = (TwoFish_P[TwoFish_P_34][b3]) ^ TwoFish_b3(k3); - case 3: /* 192-bit keys */ - b0 = (TwoFish_P[TwoFish_P_03][b0]) ^ TwoFish_b0(k2); - b1 = (TwoFish_P[TwoFish_P_13][b1]) ^ TwoFish_b1(k2); - b2 = (TwoFish_P[TwoFish_P_23][b2]) ^ TwoFish_b2(k2); - b3 = (TwoFish_P[TwoFish_P_33][b3]) ^ TwoFish_b3(k2); - case 2: /* 128-bit keys */ - tfdata->sBox[ 2*i ]= - TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][(TwoFish_P[TwoFish_P_02][b0]) ^ - TwoFish_b0(k1)]) ^ TwoFish_b0(k0)]; - - tfdata->sBox[ 2*i+1]= - TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][(TwoFish_P[TwoFish_P_12][b1]) ^ - TwoFish_b1(k1)]) ^ TwoFish_b1(k0)]; - - tfdata->sBox[0x200+2*i ]= - TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][(TwoFish_P[TwoFish_P_22][b2]) ^ - TwoFish_b2(k1)]) ^ TwoFish_b2(k0)]; - - tfdata->sBox[0x200+2*i+1]= - TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][(TwoFish_P[TwoFish_P_32][b3]) ^ - TwoFish_b3(k1)]) ^ TwoFish_b3(k0)]; - } - } -} - - -/** - * Encrypt or decrypt exactly one block of plaintext in CBC mode. - * Use "ciphertext stealing" technique described on pg. 196 - * of "Applied Cryptography" to encrypt the final partial - * (i.e. <16 byte) block if necessary. - * - * jojo: the "ciphertext stealing" requires we read ahead and have - * special handling for the last two blocks. Because of this, the - * output from the TwoFish algorithm is handled internally here. - * It would be better to have a higher level handle this as well as - * CBC mode. Unfortunately, I've mixed the two together, which is - * pretty crappy... The Java version separates these out correctly. - * - * fknobbe: I have reduced the CBC mode to work on memory buffer only. - * Higher routines should use an intermediate buffer and handle - * their output seperately (mainly so the data can be flushed - * in one chunk, not seperate 16 byte blocks...) - * - * @param in The plaintext. - * @param out The ciphertext - * @param size how much to encrypt - * @param tfdata: Pointer to the global data structure containing session keys. - * @return none - */ -void _TwoFish_BlockCrypt(uint8_t *in,uint8_t *out,uint32_t size,int decrypt,TWOFISH *tfdata) -{ uint8_t PnMinusOne[TwoFish_BLOCK_SIZE]; - uint8_t CnMinusOne[TwoFish_BLOCK_SIZE]; - uint8_t CBCplusCprime[TwoFish_BLOCK_SIZE]; - uint8_t Pn[TwoFish_BLOCK_SIZE]; - uint8_t *p,*pout; - uint32_t i; - - /* here is where we implement CBC mode and cipher block stealing */ - if(size==TwoFish_BLOCK_SIZE) - { /* if we are encrypting, CBC means we XOR the plain text block with the */ - /* previous cipher text block before encrypting */ - if(!decrypt && tfdata->qBlockDefined) - { for(p=in,i=0;iqBlockCrypt[i]; /* FK: I'm copying the xor'ed input into Pn... */ - } - else - memcpy(Pn,in,TwoFish_BLOCK_SIZE); /* FK: same here. we work of Pn all the time. */ - - /* TwoFish block level encryption or decryption */ - _TwoFish_BlockCrypt16(Pn,out,decrypt,tfdata); - - /* if we are decrypting, CBC means we XOR the result of the decryption */ - /* with the previous cipher text block to get the resulting plain text */ - if(decrypt && tfdata->qBlockDefined) - { for (p=out,i=0;iqBlockPlain[i]; - } - - /* save the input and output blocks, since CBC needs these for XOR */ - /* operations */ - _TwoFish_qBlockPush(Pn,out,tfdata); - } - else - { /* cipher block stealing, we are at Pn, */ - /* but since Cn-1 must now be replaced with CnC' */ - /* we pop it off, and recalculate Cn-1 */ - - if(decrypt) - { /* We are on an odd block, and had to do cipher block stealing, */ - /* so the PnMinusOne has to be derived differently. */ - - /* First we decrypt it into CBC and C' */ - _TwoFish_qBlockPop(CnMinusOne,PnMinusOne,tfdata); - _TwoFish_BlockCrypt16(CnMinusOne,CBCplusCprime,decrypt,tfdata); - - /* we then xor the first few bytes with the "in" bytes (Cn) */ - /* to recover Pn, which we put in out */ - for(p=in,pout=out,i=0;iprevCipher[i]; - - /* So at this point, out has PnMinusOne */ - _TwoFish_qBlockPush(CnMinusOne,PnMinusOne,tfdata); - _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); - _TwoFish_FlushOutput(out,size,tfdata); - } - else - { _TwoFish_qBlockPop(PnMinusOne,CnMinusOne,tfdata); - memset(Pn,0,TwoFish_BLOCK_SIZE); - memcpy(Pn,in,size); - for(i=0;iqBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); - _TwoFish_FlushOutput(CnMinusOne,size,tfdata); /* old Cn-1 becomes new partial Cn */ - } - tfdata->qBlockDefined=FALSE; - } -} - -void _TwoFish_qBlockPush(uint8_t *p,uint8_t *c,TWOFISH *tfdata) -{ if(tfdata->qBlockDefined) - _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); - memcpy(tfdata->prevCipher,tfdata->qBlockPlain,TwoFish_BLOCK_SIZE); - memcpy(tfdata->qBlockPlain,p,TwoFish_BLOCK_SIZE); - memcpy(tfdata->qBlockCrypt,c,TwoFish_BLOCK_SIZE); - tfdata->qBlockDefined=TRUE; -} - -void _TwoFish_qBlockPop(uint8_t *p,uint8_t *c,TWOFISH *tfdata) -{ memcpy(p,tfdata->qBlockPlain,TwoFish_BLOCK_SIZE ); - memcpy(c,tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE ); - tfdata->qBlockDefined=FALSE; -} - -/* Reset's the CBC flag and zero's PrevCipher (through qBlockPlain) (important) */ -void _TwoFish_ResetCBC(TWOFISH *tfdata) -{ tfdata->qBlockDefined=FALSE; - memset(tfdata->qBlockPlain,0,TwoFish_BLOCK_SIZE); -} - -void _TwoFish_FlushOutput(uint8_t *b,uint32_t len,TWOFISH *tfdata) -{ uint32_t i; - - for(i=0;idontflush;i++) - *tfdata->output++ = *b++; - tfdata->dontflush=FALSE; -} - -void _TwoFish_BlockCrypt16(uint8_t *in,uint8_t *out,bool decrypt,TWOFISH *tfdata) -{ uint32_t x0,x1,x2,x3; - uint32_t k,t0,t1,R; - - - x0=*in++; - x0|=(*in++ << 8 ); - x0|=(*in++ << 16); - x0|=(*in++ << 24); - x1=*in++; - x1|=(*in++ << 8 ); - x1|=(*in++ << 16); - x1|=(*in++ << 24); - x2=*in++; - x2|=(*in++ << 8 ); - x2|=(*in++ << 16); - x2|=(*in++ << 24); - x3=*in++; - x3|=(*in++ << 8 ); - x3|=(*in++ << 16); - x3|=(*in++ << 24); - - if(decrypt) - { x0 ^= tfdata->subKeys[4]; /* swap input and output whitening keys when decrypting */ - x1 ^= tfdata->subKeys[5]; - x2 ^= tfdata->subKeys[6]; - x3 ^= tfdata->subKeys[7]; - - k = 7+(TwoFish_ROUNDS*2); - for (R = 0; R < TwoFish_ROUNDS; R += 2) - { t0 = _TwoFish_Fe320( tfdata->sBox, x0); - t1 = _TwoFish_Fe323( tfdata->sBox, x1); - x3 ^= t0 + (t1<<1) + tfdata->subKeys[k--]; - x3 = x3 >> 1 | x3 << 31; - x2 = x2 << 1 | x2 >> 31; - x2 ^= t0 + t1 + tfdata->subKeys[k--]; - - t0 = _TwoFish_Fe320( tfdata->sBox, x2); - t1 = _TwoFish_Fe323( tfdata->sBox, x3); - x1 ^= t0 + (t1<<1) + tfdata->subKeys[k--]; - x1 = x1 >> 1 | x1 << 31; - x0 = x0 << 1 | x0 >> 31; - x0 ^= t0 + t1 + tfdata->subKeys[k--]; - } - - x2 ^= tfdata->subKeys[0]; - x3 ^= tfdata->subKeys[1]; - x0 ^= tfdata->subKeys[2]; - x1 ^= tfdata->subKeys[3]; - } - else - { x0 ^= tfdata->subKeys[0]; - x1 ^= tfdata->subKeys[1]; - x2 ^= tfdata->subKeys[2]; - x3 ^= tfdata->subKeys[3]; - - k = 8; - for (R = 0; R < TwoFish_ROUNDS; R += 2) - { t0 = _TwoFish_Fe320( tfdata->sBox, x0); - t1 = _TwoFish_Fe323( tfdata->sBox, x1); - x2 ^= t0 + t1 + tfdata->subKeys[k++]; - x2 = x2 >> 1 | x2 << 31; - x3 = x3 << 1 | x3 >> 31; - x3 ^= t0 + (t1<<1) + tfdata->subKeys[k++]; - - t0 = _TwoFish_Fe320( tfdata->sBox, x2); - t1 = _TwoFish_Fe323( tfdata->sBox, x3); - x0 ^= t0 + t1 + tfdata->subKeys[k++]; - x0 = x0 >> 1 | x0 << 31; - x1 = x1 << 1 | x1 >> 31; - x1 ^= t0 + (t1<<1) + tfdata->subKeys[k++]; - } - - x2 ^= tfdata->subKeys[4]; - x3 ^= tfdata->subKeys[5]; - x0 ^= tfdata->subKeys[6]; - x1 ^= tfdata->subKeys[7]; - } - - *out++ = (uint8_t)(x2 ); - *out++ = (uint8_t)(x2 >> 8); - *out++ = (uint8_t)(x2 >> 16); - *out++ = (uint8_t)(x2 >> 24); - - *out++ = (uint8_t)(x3 ); - *out++ = (uint8_t)(x3 >> 8); - *out++ = (uint8_t)(x3 >> 16); - *out++ = (uint8_t)(x3 >> 24); - - *out++ = (uint8_t)(x0 ); - *out++ = (uint8_t)(x0 >> 8); - *out++ = (uint8_t)(x0 >> 16); - *out++ = (uint8_t)(x0 >> 24); - - *out++ = (uint8_t)(x1 ); - *out++ = (uint8_t)(x1 >> 8); - *out++ = (uint8_t)(x1 >> 16); - *out++ = (uint8_t)(x1 >> 24); -} - -/** - * Use (12, 8) Reed-Solomon code over GF(256) to produce a key S-box - * 32-bit entity from two key material 32-bit entities. - * - * @param k0 1st 32-bit entity. - * @param k1 2nd 32-bit entity. - * @return Remainder polynomial generated using RS code - */ -uint32_t _TwoFish_RS_MDS_Encode(uint32_t k0,uint32_t k1) -{ uint32_t i,r; - - for(r=k1,i=0;i<4;i++) /* shift 1 byte at a time */ - TwoFish_RS_rem(r); - r ^= k0; - for(i=0;i<4;i++) - TwoFish_RS_rem(r); - - return r; -} - -uint32_t _TwoFish_F32(uint32_t k64Cnt,uint32_t x,uint32_t *k32) -{ uint8_t b0,b1,b2,b3; - uint32_t k0,k1,k2,k3,result = 0; - - b0=TwoFish_b0(x); - b1=TwoFish_b1(x); - b2=TwoFish_b2(x); - b3=TwoFish_b3(x); - k0=k32[0]; - k1=k32[1]; - k2=k32[2]; - k3=k32[3]; - - switch (k64Cnt & 3) - { case 1: /* 64-bit keys */ - result = - TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][b0] & 0xFF) ^ TwoFish_b0(k0)] ^ - TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][b1] & 0xFF) ^ TwoFish_b1(k0)] ^ - TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][b2] & 0xFF) ^ TwoFish_b2(k0)] ^ - TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][b3] & 0xFF) ^ TwoFish_b3(k0)]; - break; - case 0: /* 256-bit keys (same as 4) */ - b0 = (TwoFish_P[TwoFish_P_04][b0] & 0xFF) ^ TwoFish_b0(k3); - b1 = (TwoFish_P[TwoFish_P_14][b1] & 0xFF) ^ TwoFish_b1(k3); - b2 = (TwoFish_P[TwoFish_P_24][b2] & 0xFF) ^ TwoFish_b2(k3); - b3 = (TwoFish_P[TwoFish_P_34][b3] & 0xFF) ^ TwoFish_b3(k3); - - case 3: /* 192-bit keys */ - b0 = (TwoFish_P[TwoFish_P_03][b0] & 0xFF) ^ TwoFish_b0(k2); - b1 = (TwoFish_P[TwoFish_P_13][b1] & 0xFF) ^ TwoFish_b1(k2); - b2 = (TwoFish_P[TwoFish_P_23][b2] & 0xFF) ^ TwoFish_b2(k2); - b3 = (TwoFish_P[TwoFish_P_33][b3] & 0xFF) ^ TwoFish_b3(k2); - case 2: /* 128-bit keys (optimize for this case) */ - result = - TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][(TwoFish_P[TwoFish_P_02][b0] & 0xFF) ^ TwoFish_b0(k1)] & 0xFF) ^ TwoFish_b0(k0)] ^ - TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][(TwoFish_P[TwoFish_P_12][b1] & 0xFF) ^ TwoFish_b1(k1)] & 0xFF) ^ TwoFish_b1(k0)] ^ - TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][(TwoFish_P[TwoFish_P_22][b2] & 0xFF) ^ TwoFish_b2(k1)] & 0xFF) ^ TwoFish_b2(k0)] ^ - TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][(TwoFish_P[TwoFish_P_32][b3] & 0xFF) ^ TwoFish_b3(k1)] & 0xFF) ^ TwoFish_b3(k0)]; - break; - } - return result; -} - -uint32_t _TwoFish_Fe320(uint32_t *lsBox,uint32_t x) -{ return lsBox[ TwoFish_b0(x)<<1 ]^ - lsBox[ ((TwoFish_b1(x)<<1)|1)]^ - lsBox[0x200+ (TwoFish_b2(x)<<1) ]^ - lsBox[0x200+((TwoFish_b3(x)<<1)|1)]; -} - -uint32_t _TwoFish_Fe323(uint32_t *lsBox,uint32_t x) -{ return lsBox[ (TwoFish_b3(x)<<1) ]^ - lsBox[ ((TwoFish_b0(x)<<1)|1)]^ - lsBox[0x200+ (TwoFish_b1(x)<<1) ]^ - lsBox[0x200+((TwoFish_b2(x)<<1)|1)]; -} - -uint32_t _TwoFish_Fe32(uint32_t *lsBox,uint32_t x,uint32_t R) -{ return lsBox[ 2*TwoFish__b(x,R ) ]^ - lsBox[ 2*TwoFish__b(x,R+1)+1]^ - lsBox[0x200+2*TwoFish__b(x,R+2) ]^ - lsBox[0x200+2*TwoFish__b(x,R+3)+1]; -} - - -#endif - -/* ******************************************* */ -#if defined TWOFISH_UNIT_TEST -#include - -#define TEST_DATA_SIZE 327 - -int main(int argc, char* argv[]) -{ - int i; - int n; - - char outbuf[4096]; - char * outp = outbuf; - - uint8_t key[] = { 0xfc, 0x77, 0x1a, 0xda, 0xaa }; - TWOFISH *tfa = TwoFishInit( key, 5 ); - TWOFISH *tfb = TwoFishInit( key, 5 ); - - uint8_t out[2048], out2[2048]; - uint8_t in[TEST_DATA_SIZE]; - - for ( i=0; i: - * --- April 2001, converted from C++ to C, prefixed global variables - * with TwoFish, substituted some defines, changed functions to make use of - * variables supplied in a struct, modified and added routines for modular calls. - * Cleaned up the code so that defines are used instead of fixed 16's and 32's. - * Created two general purpose crypt routines for one block and multiple block - * encryption using Joh's CBC code. - * Added crypt routines that use a header (with a magic and data length). - * (Basically a major rewrite). - * - * Note: Routines labeled _TwoFish are private and should not be used - * (or with extreme caution). - * - */ - -#ifndef __TWOFISH_LIBRARY_HEADER__ -#define __TWOFISH_LIBRARY_HEADER__ - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE !FALSE -#endif -#ifndef bool -#define bool int -#endif - -#ifdef WIN32 -#include "win32/n2n_win32.h" -#endif - -#ifndef _MSC_VER -/* Not shipped with Visual Studio (as stated by the stdint.h wikipedia page) */ -#include /* defines uintN_t types */ -#endif - -#ifdef __sun__ /* Should be HAVE_SYS_TYPES */ -/* The following are redefinitions if sys/types.h has been included too.*/ -typedef uint32_t uint32_t; -typedef uint8_t uint8_t; -#endif /* #ifdef __sun__ */ - -/* Constants */ - -#define TwoFish_DEFAULT_PW "SnortHas2FishEncryptionRoutines!" /* default password (not more than 32 chars) */ -#define TwoFish_DEFAULT_PW_LEN 32 -#define TwoFish_MAGIC "TwoFish" /* to indentify a successful decryption */ - -enum -{ TwoFish_KEY_SIZE = 256, /* Valid values: 64, 128, 192, 256 */ - /* User 256, other key sizes have not been tested. */ - /* (But should work. I substitutes as much as */ - /* I could with this define.) */ - TwoFish_ROUNDS = 16, - TwoFish_BLOCK_SIZE = 16, /* bytes in a data-block */ - TwoFish_KEY_LENGTH = TwoFish_KEY_SIZE/8, /* 32= 256-bit key */ - TwoFish_TOTAL_SUBKEYS = 4+4+2*TwoFish_ROUNDS, - TwoFish_MAGIC_LEN = TwoFish_BLOCK_SIZE-8, - TwoFish_SK_BUMP = 0x01010101, - TwoFish_SK_ROTL = 9, - TwoFish_P_00 = 1, - TwoFish_P_01 = 0, - TwoFish_P_02 = 0, - TwoFish_P_03 = TwoFish_P_01 ^ 1, - TwoFish_P_04 = 1, - TwoFish_P_10 = 0, - TwoFish_P_11 = 0, - TwoFish_P_12 = 1, - TwoFish_P_13 = TwoFish_P_11 ^ 1, - TwoFish_P_14 = 0, - TwoFish_P_20 = 1, - TwoFish_P_21 = 1, - TwoFish_P_22 = 0, - TwoFish_P_23 = TwoFish_P_21 ^ 1, - TwoFish_P_24 = 0, - TwoFish_P_30 = 0, - TwoFish_P_31 = 1, - TwoFish_P_32 = 1, - TwoFish_P_33 = TwoFish_P_31 ^ 1, - TwoFish_P_34 = 1, - TwoFish_GF256_FDBK = 0x169, - TwoFish_GF256_FDBK_2 = 0x169 / 2, - TwoFish_GF256_FDBK_4 = 0x169 / 4, - TwoFish_RS_GF_FDBK = 0x14D, /* field generator */ - TwoFish_MDS_GF_FDBK = 0x169 /* primitive polynomial for GF(256) */ -}; - - -/* Global data structure for callers */ - -typedef struct -{ - uint32_t sBox[4 * 256]; /* Key dependent S-box */ - uint32_t subKeys[TwoFish_TOTAL_SUBKEYS]; /* Subkeys */ - uint8_t key[TwoFish_KEY_LENGTH]; /* Encryption Key */ - uint8_t *output; /* Pointer to output buffer */ - uint8_t qBlockPlain[TwoFish_BLOCK_SIZE]; /* Used by CBC */ - uint8_t qBlockCrypt[TwoFish_BLOCK_SIZE]; - uint8_t prevCipher[TwoFish_BLOCK_SIZE]; - struct /* Header for crypt functions. Has to be at least one block long. */ - { uint32_t salt; /* Random salt in first block (will salt the rest through CBC) */ - uint8_t length[4]; /* The amount of data following the header */ - uint8_t magic[TwoFish_MAGIC_LEN]; /* Magic to identify successful decryption */ - } header; - bool qBlockDefined; - bool dontflush; -} TWOFISH; - -#ifndef __TWOFISH_LIBRARY_SOURCE__ - -extern bool TwoFish_srand; /* if set to TRUE (default), first call of TwoFishInit will seed rand(); */ - /* call of TwoFishInit */ -#endif - - -/**** Public Functions ****/ - -/* TwoFish Initialization - * - * This routine generates a global data structure for use with TwoFish, - * initializes important values (such as subkeys, sBoxes), generates subkeys - * and precomputes the MDS matrix if not already done. - * - * Input: User supplied password (will be appended by default password of 'SnortHas2FishEncryptionRoutines!') - * - * Output: Pointer to TWOFISH structure. This data structure contains key dependent data. - * This pointer is used with all other crypt functions. - */ -TWOFISH *TwoFishInit(const uint8_t *userkey, uint32_t keysize ); - - -/* TwoFish Destroy - * - * Nothing else but a free... - * - * Input: Pointer to the TwoFish structure. - * - */ -void TwoFishDestroy(TWOFISH *tfdata); - - -/* TwoFish Alloc - * - * Allocates enough memory for the output buffer as required. - * - * Input: Length of the plaintext. - * Boolean flag for BinHex Output. - * Pointer to the TwoFish structure. - * - * Output: Returns a pointer to the memory allocated. - */ -void *TwoFishAlloc(uint32_t len,bool binhex,bool decrypt,TWOFISH *tfdata); - - -/* TwoFish Free - * - * Free's the allocated buffer. - * - * Input: Pointer to the TwoFish structure - * - * Output: (none) - */ -void TwoFishFree(TWOFISH *tfdata); - - -/* TwoFish Set Output - * - * If you want to allocate the output buffer yourself, - * then you can set it with this function. - * - * Input: Pointer to your output buffer - * Pointer to the TwoFish structure - * - * Output: (none) - */ -void TwoFishSetOutput(uint8_t *outp,TWOFISH *tfdata); - - -/* TwoFish Raw Encryption - * - * Does not use header, but does use CBC (if more than one block has to be encrypted). - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the buffer receiving the ciphertext. - * The length of the plaintext buffer. - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ -uint32_t TwoFishEncryptRaw(uint8_t *in,uint8_t *out,uint32_t len,TWOFISH *tfdata); - -/* TwoFish Raw Decryption - * - * Does not use header, but does use CBC (if more than one block has to be decrypted). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the buffer receiving the plaintext. - * The length of the ciphertext buffer (at least one cipher block). - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ -uint32_t TwoFishDecryptRaw(uint8_t *in,uint8_t *out,uint32_t len,TWOFISH *tfdata); - - -/* TwoFish Encryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will include a small 'header' - * containing the magic and some salt. That way the decrypt routine can check if the - * packet got decrypted successfully, and return 0 instead of garbage. - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the pointer to the buffer receiving the ciphertext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the plaintext buffer. - * Can be -1 if the input is a null terminated string, in which case we'll count for you. - * Boolean flag for BinHex Output (if used, output will be twice as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ -uint32_t TwoFishEncrypt(uint8_t *in,uint8_t **out,signed long len,bool binhex,TWOFISH *tfdata); - - -/* TwoFish Decryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will check the small 'header' - * containing the magic. If magic does not match we return 0. Otherwise we return the - * amount of bytes decrypted (should be the same as the length in the header). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the pointer to the buffer receiving the plaintext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the ciphertext buffer. - * Can be -1 if the input is a null terminated binhex string, in which case we'll count for you. - * Boolean flag for BinHex Input (if used, plaintext will be half as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ -uint32_t TwoFishDecrypt(uint8_t *in,uint8_t **out,signed long len,bool binhex,TWOFISH *tfdata); - - -/**** Private Functions ****/ - -uint8_t TwoFish__b(uint32_t x,int n); -void _TwoFish_BinHex(uint8_t *buf,uint32_t len,bool bintohex); -uint32_t _TwoFish_CryptRawCBC(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata); -uint32_t _TwoFish_CryptRaw16(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata); -uint32_t _TwoFish_CryptRaw(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata); -void _TwoFish_PrecomputeMDSmatrix(void); -void _TwoFish_MakeSubKeys(TWOFISH *tfdata); -void _TwoFish_qBlockPush(uint8_t *p,uint8_t *c,TWOFISH *tfdata); -void _TwoFish_qBlockPop(uint8_t *p,uint8_t *c,TWOFISH *tfdata); -void _TwoFish_ResetCBC(TWOFISH *tfdata); -void _TwoFish_FlushOutput(uint8_t *b,uint32_t len,TWOFISH *tfdata); -void _TwoFish_BlockCrypt(uint8_t *in,uint8_t *out,uint32_t size,int decrypt,TWOFISH *tfdata); -void _TwoFish_BlockCrypt16(uint8_t *in,uint8_t *out,bool decrypt,TWOFISH *tfdata); -uint32_t _TwoFish_RS_MDS_Encode(uint32_t k0,uint32_t k1); -uint32_t _TwoFish_F32(uint32_t k64Cnt,uint32_t x,uint32_t *k32); -uint32_t _TwoFish_Fe320(uint32_t *lsBox,uint32_t x); -uint32_t _TwoFish_Fe323(uint32_t *lsBox,uint32_t x); -uint32_t _TwoFish_Fe32(uint32_t *lsBox,uint32_t x,uint32_t R); - - -#endif diff --git a/bundles/n2n_meyerd/n2n_v2/unix-scm.c b/bundles/n2n_meyerd/n2n_v2/unix-scm.c deleted file mode 100644 index 45350d30..00000000 --- a/bundles/n2n_meyerd/n2n_v2/unix-scm.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * unix-scm.c - unix stubs for service control manager functions - * - * Copyright (c) 2010 Hamish Coleman - * 2003 Benjamin Schweizer - * 1998 Stephen Early - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include - -#include "scm.h" - -int SCM_Start(struct SCM_def *sd, int argc, char **argv) { - sd->mode=SVC_CONSOLE; - - int err; - - if (sd->init) { - err = sd->init(argc,argv); - if (err!=0) { - return SVC_FAIL; - } - } - - sd->main(argc,argv); - return SVC_OK; -} - -char *SCM_Install(struct SCM_def *sd,char *args) { - return NULL; -} - -int SCM_Remove(struct SCM_def *sd) { - return SVC_FAIL; -} - diff --git a/bundles/n2n_meyerd/n2n_v2/version.c b/bundles/n2n_meyerd/n2n_v2/version.c deleted file mode 100644 index b58ca13a..00000000 --- a/bundles/n2n_meyerd/n2n_v2/version.c +++ /dev/null @@ -1,5 +0,0 @@ -const char * n2n_sw_version = N2N_VERSION; -const char * n2n_sw_osName = N2N_OSNAME; -const char * n2n_sw_buildDate = __DATE__ " " __TIME__; -const char * n2n_mod_version = N2N_MODIFY_VERSION; -const char * n2n_mod_author = N2N_MODIFY_AUTHOR; diff --git a/bundles/n2n_meyerd/n2n_v2/win32/CMakeLists.txt b/bundles/n2n_meyerd/n2n_v2/win32/CMakeLists.txt deleted file mode 100644 index 12f3f988..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_library(n2n_win32 - getopt1.c - getopt.c - wintap.c - win-scm.c - n2n_win32.c) -target_link_libraries(n2n_win32 ws2_32) diff --git a/bundles/n2n_meyerd/n2n_v2/win32/DotNet/n2n.sln b/bundles/n2n_meyerd/n2n_v2/win32/DotNet/n2n.sln deleted file mode 100644 index 95698872..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/DotNet/n2n.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "edge", "n2n.vcproj", "{4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "supernode", "supernode.vcproj", "{BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Debug|Win32.ActiveCfg = Debug|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Debug|Win32.Build.0 = Debug|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Release|Win32.ActiveCfg = Release|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Release|Win32.Build.0 = Release|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Debug|Win32.ActiveCfg = Debug|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Debug|Win32.Build.0 = Debug|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Release|Win32.ActiveCfg = Release|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/bundles/n2n_meyerd/n2n_v2/win32/DotNet/n2n.suo b/bundles/n2n_meyerd/n2n_v2/win32/DotNet/n2n.suo deleted file mode 100644 index aae212bd..00000000 Binary files a/bundles/n2n_meyerd/n2n_v2/win32/DotNet/n2n.suo and /dev/null differ diff --git a/bundles/n2n_meyerd/n2n_v2/win32/DotNet/n2n.vcproj b/bundles/n2n_meyerd/n2n_v2/win32/DotNet/n2n.vcproj deleted file mode 100644 index d130fdd1..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/DotNet/n2n.vcproj +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/n2n_meyerd/n2n_v2/win32/DotNet/supernode.vcproj b/bundles/n2n_meyerd/n2n_v2/win32/DotNet/supernode.vcproj deleted file mode 100644 index e6a9e0d1..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/DotNet/supernode.vcproj +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/n2n_meyerd/n2n_v2/win32/getopt.c b/bundles/n2n_meyerd/n2n_v2/win32/getopt.c deleted file mode 100644 index 6bbb735a..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/getopt.c +++ /dev/null @@ -1,1074 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 - Free Software Foundation, Inc. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include -#ifdef WIN32 -#include -#endif - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include -# if _GNU_GETOPT<_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -# include -# include -#endif /* GNU C library. */ - -#ifdef VMS -# include -# if HAVE_STRING_H - 0 -# include -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# ifdef HAVE_LIBINTL_H -# include -# define _(msgid) gettext (msgid) -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -#ifndef DARWIN -char *optarg; -#endif - - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -#ifndef DARWIN -int optind = 1; -#endif - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -#ifndef DARWIN -#ifdef WIN32 -int opterr = 0; -#else -int opterr = 1; -#endif -#endif - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ -#ifndef DARWIN -int optopt = '?'; -#endif - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include -# define my_index strchr -#else - -#ifndef WIN32 -# if HAVE_STRING_H -# include -# else -# include -# endif -#endif - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (); -#endif - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; - -static int original_argc; -static char *const *original_argv; - -/* Make sure the environment variable bash 2.0 puts in the environment - is valid for the getopt call we must make sure that the ARGV passed - to getopt is that one passed to the process. */ -static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) -{ - /* XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ - original_argc = argc; - original_argv = argv; -} -# ifdef text_set_element -text_set_element (__libc_subinit, store_args_and_env); -# endif /* text_set_element */ - -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#ifdef _LIBC - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#ifdef _LIBC - if (posixly_correct == NULL - && argc == original_argc && argv == original_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - int print_errors = opterr; - if (optstring[0] == ':') - print_errors = 0; - - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#ifdef _LIBC -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (print_errors) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (print_errors) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt____ (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ - diff --git a/bundles/n2n_meyerd/n2n_v2/win32/getopt.h b/bundles/n2n_meyerd/n2n_v2/win32/getopt.h deleted file mode 100644 index b0147e9d..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/getopt.h +++ /dev/null @@ -1,169 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -# if defined __STDC__ && __STDC__ - const char *name; -# else - char *name; -# endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, `optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `getopt' that there are no more - options. - - If OPTS begins with `--', then non-option arguments are treated as - arguments to the option '\0'. This behavior is specific to the GNU - `getopt'. */ - -#if defined __STDC__ && __STDC__ -# ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/bundles/n2n_meyerd/n2n_v2/win32/getopt1.c b/bundles/n2n_meyerd/n2n_v2/win32/getopt1.c deleted file mode 100644 index 3d264f2d..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/getopt1.c +++ /dev/null @@ -1,188 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "getopt.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/bundles/n2n_meyerd/n2n_v2/win32/n2n_win32.c b/bundles/n2n_meyerd/n2n_v2/win32/n2n_win32.c deleted file mode 100644 index 681a9523..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/n2n_win32.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * win32 compile fix 05/01/2011 Dominik Meyer - */ - -#include "n2n_win32.h" - -int gettimeofday (struct timeval *tv, void* tz) -{ - union { - long long ns100; /*time since 1 Jan 1601 in 100ns units */ - FILETIME ft; - } now; - - GetSystemTimeAsFileTime (&now.ft); - tv->tv_usec = (long) ((now.ns100 / 10LL) % 1000000LL); - tv->tv_sec = (long) ((now.ns100 - 116444736000000000LL) / 10000000LL); - return (0); -}; - diff --git a/bundles/n2n_meyerd/n2n_v2/win32/n2n_win32.h b/bundles/n2n_meyerd/n2n_v2/win32/n2n_win32.h deleted file mode 100644 index 1cc86fd6..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/n2n_win32.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - - (C) 2007-09 - Luca Deri - -*/ - -#ifndef _N2N_WIN32_H_ -#define _N2N_WIN32_H_ - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif - -#if defined(__MINGW32__) -/* should be defined here and before winsock gets included */ -#define _WIN32_WINNT 0x501 //Otherwise the linker doesnt find getaddrinfo -#include -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#endif /* #if defined(__MINGW32__) */ - -#include -#include -#include - - -#include "wintap.h" - -#ifdef _MSC_VER -#include "getopt.h" - -/* Other Win environments are expected to support stdint.h */ - -/* stdint.h typedefs (C99) (not present in Visual Studio) */ -typedef unsigned int uint32_t; -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; - -/* sys/types.h typedefs (not present in Visual Studio) */ -typedef unsigned int u_int32_t; -typedef unsigned short u_int16_t; -typedef unsigned char u_int8_t; - -typedef INT8 int8_t; -typedef INT16 int16_t; -typedef INT32 int32_t; -typedef INT64 int64_t; - -typedef int ssize_t; -#endif /* #ifdef _MSC_VER */ - -typedef unsigned long in_addr_t; - - -//#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define MAX(a,b) (a > b ? a : b) -#define MIN(a,b) (a < b ? a : b) - -#define snprintf _snprintf -#define strdup _strdup - -#define socklen_t int - -#define ETH_ADDR_LEN 6 -/* - * Structure of a 10Mb/s Ethernet header. - */ -struct ether_hdr -{ - uint8_t dhost[ETH_ADDR_LEN]; - uint8_t shost[ETH_ADDR_LEN]; - uint16_t type; /* higher layer protocol encapsulated */ -}; - -typedef struct ether_hdr ether_hdr_t; - -/* ************************************* */ - -struct ip { -#if BYTE_ORDER == LITTLE_ENDIAN - u_char ip_hl:4, /* header length */ - ip_v:4; /* version */ -#else - u_char ip_v:4, /* version */ - ip_hl:4; /* header length */ -#endif - u_char ip_tos; /* type of service */ - short ip_len; /* total length */ - u_short ip_id; /* identification */ - short ip_off; /* fragment offset field */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_char ip_ttl; /* time to live */ - u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src,ip_dst; /* source and dest address */ -}; - - -/* ************************************* */ - -typedef struct tuntap_dev { - HANDLE device_handle; - char *device_name; - char *ifName; - OVERLAPPED overlap_read, overlap_write; - uint8_t mac_addr[6]; - uint32_t ip_addr, device_mask; - unsigned int mtu; -} tuntap_dev; - -#define index(a, b) strchr(a, b) - -int gettimeofday (struct timeval *tv, void* tz); - -#endif - diff --git a/bundles/n2n_meyerd/n2n_v2/win32/version-msvc.c b/bundles/n2n_meyerd/n2n_v2/win32/version-msvc.c deleted file mode 100644 index 92cce068..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/version-msvc.c +++ /dev/null @@ -1,3 +0,0 @@ -const char * n2n_sw_version = "2.0.0"; -const char * n2n_sw_osName = "Win32"; -const char * n2n_sw_buildDate = __DATE__ " " __TIME__; diff --git a/bundles/n2n_meyerd/n2n_v2/win32/win-scm.c b/bundles/n2n_meyerd/n2n_v2/win32/win-scm.c deleted file mode 100644 index bb5d46ba..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/win-scm.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * win-scm.c - windows service control manager functions - * - * Copyright (c) 2008 Hamish Coleman - * 2003 Benjamin Schweizer - * 1998 Stephen Early - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include - -#include "../scm.h" - -/* Service status: our current status, and handle on service manager */ -SERVICE_STATUS svcStatus; -SERVICE_STATUS_HANDLE svcHandle; - -/* global pointer to our service definition */ -struct SCM_def *global_sd; - -VOID WINAPI ServiceCtrlHandler(DWORD opcode) { - svcStatus.dwWin32ExitCode = NO_ERROR; - if (opcode == SERVICE_CONTROL_STOP) { - svcStatus.dwCurrentState = SERVICE_STOP_PENDING; - SetServiceStatus( svcHandle, &svcStatus ); - global_sd->stop(NULL); - return; - } - SetServiceStatus( svcHandle, &svcStatus ); -} - -VOID WINAPI ServiceMain(DWORD argc, LPSTR *argv) -{ - int err; - /* - * TODO - * - work out a race-free way to determine the correct sd ptr - * - once the correct sd is known, a void* could be passed to all the - * service functions, allowing the service to know - */ - struct SCM_def *sd = global_sd; - - /* TODO - use RegisterServiceCtrlHandlerEx and pass the sd to it? */ - svcHandle = RegisterServiceCtrlHandler(sd->name,ServiceCtrlHandler); - if (!svcHandle) { - /* FIXME - use SvcReportEvent() */ - printf("RegisterServiceCtrlHandler failed %u\n", - (unsigned int)GetLastError()); - return; - } - - svcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - svcStatus.dwCurrentState = 0; - svcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; - svcStatus.dwWin32ExitCode = NO_ERROR; - svcStatus.dwServiceSpecificExitCode = 0; - svcStatus.dwCheckPoint = 0; - svcStatus.dwWaitHint = 5000; - - /* Report initial status to the SCM. */ - svcStatus.dwCurrentState = SERVICE_START_PENDING; - SetServiceStatus( svcHandle, &svcStatus ); - - /* - * If there is only one SCM arg, it is just the servicename, so use - * the original cmdline instead. - * Otherwise, let the SCM args completely override the original ones - */ - if (argc==1) { - argc=sd->argc; - argv=sd->argv; - } - - sd->mode=SVC_OK; - if (sd->init) { - if ((err=sd->init(argc,argv))!=0) { - svcStatus.dwCurrentState = SERVICE_STOPPED; - svcStatus.dwWin32ExitCode = err; - SetServiceStatus( svcHandle, &svcStatus ); - return; - } - } - - svcStatus.dwCurrentState = SERVICE_RUNNING; - svcStatus.dwWin32ExitCode = NO_ERROR; - SetServiceStatus( svcHandle, &svcStatus ); - - err=sd->main(argc,argv); - - svcStatus.dwCurrentState = SERVICE_STOPPED; - svcStatus.dwWin32ExitCode = NO_ERROR; - SetServiceStatus( svcHandle, &svcStatus ); - return; -} - -int SCM_Start_Console(struct SCM_def *sd) { - - sd->mode=SVC_CONSOLE; - int err; - if (sd->init) { - err = sd->init(sd->argc,sd->argv); - if (err!=0) { - return SVC_FAIL; - } - } - - sd->main(sd->argc,sd->argv); - return SVC_OK; -} - -int SCM_Start(struct SCM_def *sd, int argc, char **argv) { - SERVICE_TABLE_ENTRY ServiceTable[] = { - { "", ServiceMain }, - { NULL, NULL } - }; - - /* save the cmdline for possible use later */ - sd->argc=argc; - sd->argv=argv; - - global_sd = sd; - - /* - * Attempt to detect if we have been run from an interactive session. - * checking the environ is still not perfect, since if the - * service is set to login as a user, it gets a USERNAME env - * and if that user is currently logged in interactively, it - * gets a SESSIONNAME env :-( - * So, also check if there is a console window - * - * Other avenues of investigation: - * from http://bytes.com/topic/net/answers/124885-multiple-use-exe-determine-if-running-service - * - work out how System.Environment.UserInteractive works - * - Check if parent process name is "services.exe" - * from http://stackoverflow.com/questions/200163/am-i-running-as-a-service#200183 - */ - char buf[100]; - if (getenv("USERNAME") && getenv("SESSIONNAME") - && GetConsoleTitle((LPTSTR)&buf,sizeof(buf))) { - return SCM_Start_Console(sd); - } - - /* try to run as a service */ - /* - * Note, this will eventually fail if we are not started as a service - * however, it will take an noticably long time to do so, thus we - * try to short circuit this delay above. - */ - if (StartServiceCtrlDispatcher(ServiceTable)==0) { - int err = GetLastError(); - - if (err == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) { - return SCM_Start_Console(sd); - } - - /* any other error, assume fatal */ - printf("StartServiceCtrlDispatcher failed %d\n", err); - return SVC_FAIL; - } - return SVC_OK; -} - -char *SCM_Install(struct SCM_def *sd, char *args) { - SC_HANDLE schSCManager, schService; - - static char path[MAX_PATH]; - - if( !GetModuleFileName( NULL, path, MAX_PATH ) ) { - printf("GetModuleFileName failed %u\n", - (unsigned int)GetLastError()); - return NULL; - } - - /* - * Note - the above path calculation does not work for paths containing - * spaces. This is because Windows is stupid, mosttly due to bad - * design - see the next below. - */ - - static char cmdline[MAX_PATH+10]; - if (args) { - /* - * The "BinaryPathName" can also have cmdline params - * embedded into it. Stupid windows - */ - - snprintf(cmdline,sizeof(cmdline),"\"%s\" %s",path,args); - } else { - snprintf(cmdline,sizeof(cmdline),"\"%s\"",path); - } - - schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - - schService = CreateService( - schSCManager, - sd->name, - sd->desc, - SERVICE_ALL_ACCESS, - SERVICE_WIN32_OWN_PROCESS, - SERVICE_AUTO_START, - SERVICE_ERROR_NORMAL, - cmdline, - NULL, NULL, NULL, NULL, NULL); - - if (schService == NULL) { - printf("CreateService failed\n"); - CloseServiceHandle(schService); - return NULL; - } - - CloseServiceHandle(schService); - return (char *)&path; -} - -int SCM_Remove(struct SCM_def *sd) { - SC_HANDLE schSCManager, schService; - - schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (schSCManager == NULL) { - printf("Couldn't open service manager\n"); - return -1; - } - - schService = OpenService(schSCManager, sd->name, DELETE); - if (schService == NULL) { - printf("Couldn't open %s service\n",sd->name); - return -1; - } - - if (!DeleteService(schService)) { - printf("Couldn't delete %s service\n",sd->name); - return -1; - } - - CloseServiceHandle(schService); - return 0; -} - diff --git a/bundles/n2n_meyerd/n2n_v2/win32/wintap.c b/bundles/n2n_meyerd/n2n_v2/win32/wintap.c deleted file mode 100644 index 84180ad1..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/wintap.c +++ /dev/null @@ -1,310 +0,0 @@ -/* - (C) 2007-09 - Luca Deri -*/ - -#include "../n2n.h" -#include "n2n_win32.h" - -/* 1500 bytes payload + 14 bytes ethernet header + 4 bytes VLAN tag */ -#define MTU 1518 - -void initWin32() { - WSADATA wsaData; - int err; - - err = WSAStartup(MAKEWORD(2, 2), &wsaData ); - if( err != 0 ) { - /* Tell the user that we could not find a usable */ - /* WinSock DLL. */ - printf("FATAL ERROR: unable to initialise Winsock 2.x."); - exit(-1); - } -} - -int open_wintap(struct tuntap_dev *device, - const char * address_mode, /* "static" or "dhcp" */ - char *device_ip, - char *device_mask, - const char *device_mac, - int mtu) { - HKEY key, key2; - LONG rc; - char regpath[1024], cmd[256]; - char adapterid[1024]; - char adaptername[1024]; - char tapname[1024]; - long len; - int found = 0; - int err, i; - ULONG status = TRUE; - - memset(device, 0, sizeof(struct tuntap_dev)); - device->device_handle = INVALID_HANDLE_VALUE; - device->device_name = NULL; - device->ifName = NULL; - device->ip_addr = inet_addr(device_ip); - - /* Open registry and look for network adapters */ - if((rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &key))) { - printf("Unable to read registry: [rc=%d]\n", rc); - exit(-1); - /* MSVC Note: If you keep getting rc=2 errors, make sure you set: - Project -> Properties -> Configuration Properties -> General -> Character set - to: "Use Multi-Byte Character Set" - */ - } - - for (i = 0; ; i++) { - len = sizeof(adapterid); - if(RegEnumKeyEx(key, i, (LPTSTR)adapterid, &len, 0, 0, 0, NULL)) - break; - - /* Find out more about this adapter */ - - _snprintf(regpath, sizeof(regpath), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, adapterid); - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCSTR)regpath, 0, KEY_READ, &key2)) - continue; - - len = sizeof(adaptername); - err = RegQueryValueEx(key2, "Name", 0, 0, adaptername, &len); - - RegCloseKey(key2); - - if(err) - continue; - - if(device->device_name) { - if(!strcmp(device->device_name, adapterid)) { - found = 1; - break; - } else - continue; - } - - if(device->ifName) { - if(!strcmp(device->ifName, adaptername)) { - found = 1; - break; - } else - continue; - } - - _snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, adapterid); - device->device_handle = CreateFile(tapname, GENERIC_WRITE | GENERIC_READ, - 0, /* Don't let other processes share or open - the resource until the handle's been closed */ - 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0); - if(device->device_handle != INVALID_HANDLE_VALUE) { - found = 1; - break; - } - } - - RegCloseKey(key); - - if(!found) { - printf("No Windows tap device found!\n"); - exit(0); - } - - /* ************************************** */ - - if(!device->device_name) - device->device_name = _strdup(adapterid); - - if(!device->ifName) - device->ifName = _strdup(adaptername); - - /* Try to open the corresponding tap device->device_name */ - - if(device->device_handle == INVALID_HANDLE_VALUE) { - _snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, device->device_name); - device->device_handle = CreateFile(tapname, GENERIC_WRITE | GENERIC_READ, 0, 0, - OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0); - } - - if(device->device_handle == INVALID_HANDLE_VALUE) { - printf("%s (%s) is not a usable Windows tap device\n", device->device_name, device->ifName); - exit(-1); - } - - /* Get MAC address from tap device->device_name */ - - if(!DeviceIoControl(device->device_handle, TAP_IOCTL_GET_MAC, - device->mac_addr, sizeof(device->mac_addr), - device->mac_addr, sizeof(device->mac_addr), &len, 0)) { - printf("Could not get MAC address from Windows tap %s (%s)\n", - device->device_name, device->ifName); - return -1; - } - - device->mtu = mtu; - - printf("Open device [name=%s][ip=%s][ifName=%s][MTU=%d][mac=%02X:%02X:%02X:%02X:%02X:%02X]\n", - device->device_name, device_ip, device->ifName, device->mtu, - device->mac_addr[0] & 0xFF, - device->mac_addr[1] & 0xFF, - device->mac_addr[2] & 0xFF, - device->mac_addr[3] & 0xFF, - device->mac_addr[4] & 0xFF, - device->mac_addr[5] & 0xFF); - - /* ****************** */ - - printf("Setting %s device address...\n", device->ifName); - - if ( 0 == strcmp("dhcp", address_mode) ) - { - _snprintf(cmd, sizeof(cmd), - "netsh interface ip set address \"%s\" dhcp", - device->ifName); - } - else - { - _snprintf(cmd, sizeof(cmd), - "netsh interface ip set address \"%s\" static %s %s", - device->ifName, device_ip, device_mask); - } - - if(system(cmd) == 0) { - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - printf("Device %s set to %s/%s\n", - device->ifName, device_ip, device_mask); - } else - printf("WARNING: Unable to set device %s IP address [%s]\n", - device->ifName, cmd); - - /* ****************** */ - - if(device->mtu != DEFAULT_MTU) - printf("WARNING: MTU set is not supported on Windows\n"); - - /* set driver media status to 'connected' (i.e. set the interface up) */ - if (!DeviceIoControl (device->device_handle, TAP_IOCTL_SET_MEDIA_STATUS, - &status, sizeof (status), - &status, sizeof (status), &len, NULL)) - printf("WARNING: Unable to enable TAP adapter\n"); - - /* - * Initialize overlapped structures - */ - device->overlap_read.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - device->overlap_write.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (!device->overlap_read.hEvent || !device->overlap_write.hEvent) { - return -1; - } - - return(0); -} - -/* ************************************************ */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) -{ - DWORD read_size, last_err; - - ResetEvent(tuntap->overlap_read.hEvent); - if (ReadFile(tuntap->device_handle, buf, len, &read_size, &tuntap->overlap_read)) { - //printf("tun_read(len=%d)\n", read_size); - return read_size; - } - switch (last_err = GetLastError()) { - case ERROR_IO_PENDING: - WaitForSingleObject(tuntap->overlap_read.hEvent, INFINITE); - GetOverlappedResult(tuntap->device_handle, &tuntap->overlap_read, &read_size, FALSE); - return read_size; - break; - default: - printf("GetLastError() returned %d\n", last_err); - break; - } - - return -1; -} -/* ************************************************ */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) -{ - DWORD write_size; - - //printf("tun_write(len=%d)\n", len); - - ResetEvent(tuntap->overlap_write.hEvent); - if (WriteFile(tuntap->device_handle, - buf, - len, - &write_size, - &tuntap->overlap_write)) { - //printf("DONE tun_write(len=%d)\n", write_size); - return write_size; - } - switch (GetLastError()) { - case ERROR_IO_PENDING: - WaitForSingleObject(tuntap->overlap_write.hEvent, INFINITE); - GetOverlappedResult(tuntap->device_handle, &tuntap->overlap_write, - &write_size, FALSE); - return write_size; - break; - default: - break; - } - - return -1; -} - -/* ************************************************ */ - -int tuntap_open(struct tuntap_dev *device, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - return(open_wintap(device, address_mode, device_ip, device_mask, device_mac, mtu)); -} - -/* ************************************************ */ - -void tuntap_close(struct tuntap_dev *tuntap) { - CloseHandle(tuntap->device_handle); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ -} - -/* ************************************************ */ - -#if 0 -int main(int argc, char* argv[]) { - struct tuntap_dev tuntap; - int i; - int mtu = 1400; - - printf("Welcome to n2n\n"); - initWin32(); - open_wintap(&tuntap, "static", "1.2.3.20", "255.255.255.0", mtu); - - for(i=0; i<10; i++) { - u_char buf[MTU]; - int rc; - - rc = tun_read(&tuntap, buf, sizeof(buf)); - buf[0]=2; - buf[1]=3; - buf[2]=4; - - printf("tun_read returned %d\n", rc); - rc = tun_write(&tuntap, buf, rc); - printf("tun_write returned %d\n", rc); - } - // rc = tun_open (device->device_name, IF_MODE_TUN); - WSACleanup (); - return(0); -} - -#endif diff --git a/bundles/n2n_meyerd/n2n_v2/win32/wintap.h b/bundles/n2n_meyerd/n2n_v2/win32/wintap.h deleted file mode 100644 index db4acdd7..00000000 --- a/bundles/n2n_meyerd/n2n_v2/win32/wintap.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - (C) 2007 - Luca Deri -*/ - -#ifndef _WINTAP_H_ -#define _WINTAP_H_ - -#undef UNICODE -#undef _UNICODE -#define _CRT_SECURE_NO_WARNINGS - -#include -#include -#include - - - -//=============================================== -// This file is included both by OpenVPN and -// the TAP-Win32 driver and contains definitions -// common to both. -//=============================================== - -//============= -// TAP IOCTLs -//============= - -#define TAP_CONTROL_CODE(request,method) \ - CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) - -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) - -//================= -// Registry keys -//================= - -#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" -#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" - -//====================== -// Filesystem prefixes -//====================== - -#define USERMODEDEVICEDIR "\\\\.\\Global\\" -#define SYSDEVICEDIR "\\Device\\" -#define USERDEVICEDIR "\\DosDevices\\Global\\" -#define TAPSUFFIX ".tap" - -//========================================================= -// TAP_COMPONENT_ID -- This string defines the TAP driver -// type -- different component IDs can reside in the system -// simultaneously. -//========================================================= - -#define TAP_COMPONENT_ID "tap0801" - -extern void initWin32(); - -#endif - diff --git a/bundles/n2n_meyerd/n2n_v2/wire.c b/bundles/n2n_meyerd/n2n_v2/wire.c deleted file mode 100644 index f8306cdb..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wire.c +++ /dev/null @@ -1,507 +0,0 @@ -/* (c) 2009 Richard Andrews */ - -/** Routines for encoding and decoding n2n packets on the wire. - * - * encode_X(base,idx,v) prototypes are inspired by the erlang internal - * encoding model. Passing the start of a buffer in base and a pointer to an - * integer (initially set to zero). Each encode routine increases idx by the - * amount written and returns the amount written. In this way complex sequences - * of encodings can be represented cleanly. See encode_register() for an - * example. - */ - -#include "n2n_wire.h" -#include - -int encode_uint8( uint8_t * base, - size_t * idx, - const uint8_t v ) -{ - *(base + (*idx)) = (v & 0xff); - ++(*idx); - return 1; -} - -int decode_uint8( uint8_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - if (*rem < 1 ) { return 0; } - - *out = ( base[*idx] & 0xff ); - ++(*idx); - --(*rem); - return 1; -} - -int encode_uint16( uint8_t * base, - size_t * idx, - const uint16_t v ) -{ - *(base + (*idx)) = ( v >> 8) & 0xff; - *(base + (1 + *idx)) = ( v & 0xff ); - *idx += 2; - return 2; -} - -int decode_uint16( uint16_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - if (*rem < 2 ) { return 0; } - - *out = ( base[*idx] & 0xff ) << 8; - *out |= ( base[1 + *idx] & 0xff ); - *idx += 2; - *rem -= 2; - return 2; -} - -int encode_uint32( uint8_t * base, - size_t * idx, - const uint32_t v ) -{ - *(base + (0 + *idx)) = ( v >> 24) & 0xff; - *(base + (1 + *idx)) = ( v >> 16) & 0xff; - *(base + (2 + *idx)) = ( v >> 8) & 0xff; - *(base + (3 + *idx)) = ( v & 0xff ); - *idx += 4; - return 4; -} - -int decode_uint32( uint32_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - if (*rem < 4 ) { return 0; } - - *out = ( base[0 + *idx] & 0xff ) << 24; - *out |= ( base[1 + *idx] & 0xff ) << 16; - *out |= ( base[2 + *idx] & 0xff ) << 8; - *out |= ( base[3 + *idx] & 0xff ); - *idx += 4; - *rem -= 4; - return 4; -} - -int encode_buf( uint8_t * base, - size_t * idx, - const void * p, - size_t s) -{ - memcpy( (base + (*idx)), p, s ); - *idx += s; - return s; -} - -/* Copy from base to out of size bufsize */ -int decode_buf( uint8_t * out, - size_t bufsize, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - if (*rem < bufsize ) { return 0; } - - memcpy( out, (base + *idx), bufsize ); - *idx += bufsize; - *rem -= bufsize; - return bufsize; -} - - - -int encode_mac( uint8_t * base, - size_t * idx, - const n2n_mac_t m ) -{ - return encode_buf( base, idx, m, N2N_MAC_SIZE ); -} - -int decode_mac( uint8_t * out, /* of size N2N_MAC_SIZE. This clearer than passing a n2n_mac_t */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - return decode_buf( out, N2N_MAC_SIZE, base, rem, idx ); -} - - - -int encode_common( uint8_t * base, - size_t * idx, - const n2n_common_t * common ) -{ - uint16_t flags=0; - encode_uint8( base, idx, N2N_PKT_VERSION ); - encode_uint8( base, idx, common->ttl ); - - flags = common->pc & N2N_FLAGS_TYPE_MASK; - flags |= common->flags & N2N_FLAGS_BITS_MASK; - - encode_uint16( base, idx, flags ); - encode_buf( base, idx, common->community, N2N_COMMUNITY_SIZE ); - - return -1; -} - -int decode_common( n2n_common_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t idx0=*idx; - uint8_t dummy=0; - decode_uint8( &dummy, base, rem, idx ); - - if ( N2N_PKT_VERSION != dummy ) - { - return -1; - } - - decode_uint8( &(out->ttl), base, rem, idx ); - decode_uint16( &(out->flags), base, rem, idx ); - out->pc = ( out->flags & N2N_FLAGS_TYPE_MASK ); - out->flags &= N2N_FLAGS_BITS_MASK; - - decode_buf( out->community, N2N_COMMUNITY_SIZE, base, rem, idx ); - - return (*idx - idx0); -} - - -int encode_sock( uint8_t * base, - size_t * idx, - const n2n_sock_t * sock ) -{ - int retval=0; - uint16_t f; - - switch (sock->family) - { - case AF_INET: - { - f = 0; - retval += encode_uint16(base,idx,f); - retval += encode_uint16(base,idx,sock->port); - retval += encode_buf(base,idx,sock->addr.v4,IPV4_SIZE); - break; - } - case AF_INET6: - { - f = 0x8000; - retval += encode_uint16(base,idx,f); - retval += encode_uint16(base,idx,sock->port); - retval += encode_buf(base,idx,sock->addr.v6,IPV6_SIZE); - break; - } - default: - retval=-1; - } - - return retval; -} - - -int decode_sock( n2n_sock_t * sock, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t * idx0=idx; - uint16_t f; - - decode_uint16( &f, base, rem, idx ); - - if( f & 0x8000 ) - { - /* IPv6 */ - sock->family = AF_INET6; - decode_uint16( &(sock->port), base, rem, idx ); - decode_buf( sock->addr.v6, IPV6_SIZE, base, rem, idx ); - } - else - { - /* IPv4 */ - sock->family = AF_INET; - decode_uint16( &(sock->port), base, rem, idx ); - memset( sock->addr.v6, 0, IPV6_SIZE ); /* so memcmp() works for equality. */ - decode_buf( sock->addr.v4, IPV4_SIZE, base, rem, idx ); - } - - return (idx-idx0); -} - -int encode_REGISTER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_t * reg ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_buf( base, idx, reg->cookie, N2N_COOKIE_SIZE ); - retval += encode_mac( base, idx, reg->srcMac ); - retval += encode_mac( base, idx, reg->dstMac ); - - return retval; -} - -int decode_REGISTER( n2n_REGISTER_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( reg, 0, sizeof(n2n_REGISTER_t) ); - retval += decode_buf( reg->cookie, N2N_COOKIE_SIZE, base, rem, idx ); - retval += decode_mac( reg->srcMac, base, rem, idx ); - retval += decode_mac( reg->dstMac, base, rem, idx ); - - return retval; -} - -int encode_REGISTER_SUPER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_SUPER_t * reg ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_uint16( base, idx, reg->aflags ); - retval += encode_uint16( base, idx, reg->timeout ); - retval += encode_buf( base, idx, reg->cookie, N2N_COOKIE_SIZE ); - retval += encode_mac( base, idx, reg->edgeMac ); - retval += encode_uint16( base, idx, 0 ); /* NULL auth scheme */ - retval += encode_uint16( base, idx, 0 ); /* No auth data */ - if(reg->aflags & N2N_AFLAGS_LOCAL_SOCKET) - retval += encode_sock( base, idx, &(reg->local_sock) ); - - return retval; -} - -int decode_REGISTER_SUPER( n2n_REGISTER_SUPER_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( reg, 0, sizeof(n2n_REGISTER_SUPER_t) ); - retval += decode_uint16( &(reg->aflags), base, rem, idx ); - retval += decode_uint16( &(reg->timeout), base, rem, idx ); - retval += decode_buf( reg->cookie, N2N_COOKIE_SIZE, base, rem, idx ); - retval += decode_mac( reg->edgeMac, base, rem, idx ); - retval += decode_uint16( &(reg->auth.scheme), base, rem, idx ); - retval += decode_uint16( &(reg->auth.toksize), base, rem, idx ); - retval += decode_buf( reg->auth.token, reg->auth.toksize, base, rem, idx ); - if(reg->aflags & N2N_AFLAGS_LOCAL_SOCKET) - retval += decode_sock( &(reg->local_sock), base, rem, idx ); - - return retval; -} - -int encode_PEER_INFO( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PEER_INFO_t * pi ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_uint16( base, idx, pi->aflags ); - retval += encode_uint16( base, idx, pi->timeout ); - retval += encode_mac( base, idx, pi->mac ); - retval += encode_sock( base, idx, pi->sockets ); - if(pi->aflags & N2N_AFLAGS_LOCAL_SOCKET) - retval += encode_sock( base, idx, pi->sockets+1 ); - - return retval; -} - -int decode_PEER_INFO( n2n_PEER_INFO_t * pi, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( pi, 0, sizeof(n2n_PEER_INFO_t) ); - retval += decode_uint16( &(pi->aflags), base, rem, idx ); - retval += decode_uint16( &(pi->timeout), base, rem, idx ); - retval += decode_mac( pi->mac, base, rem, idx ); - retval += decode_sock( pi->sockets, base, rem, idx ); - if(pi->aflags & N2N_AFLAGS_LOCAL_SOCKET) - retval += decode_sock( pi->sockets+1, base, rem, idx ); - - return retval; -} - -int encode_QUERY_PEER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_QUERY_PEER_t * qp ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_mac( base, idx, qp->srcMac ); - retval += encode_mac( base, idx, qp->targetMac ); - - return retval; -} - -int decode_QUERY_PEER( n2n_QUERY_PEER_t * qp, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( qp, 0, sizeof(n2n_QUERY_PEER_t) ); - retval += decode_mac( qp->srcMac, base, rem, idx ); - retval += decode_mac( qp->targetMac, base, rem, idx ); - - return retval; -} - -int encode_REGISTER_ACK( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_ACK_t * reg ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_buf( base, idx, reg->cookie, N2N_COOKIE_SIZE ); - retval += encode_mac( base, idx, reg->dstMac ); - retval += encode_mac( base, idx, reg->srcMac ); - - return retval; -} - -int decode_REGISTER_ACK( n2n_REGISTER_ACK_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( reg, 0, sizeof(n2n_REGISTER_ACK_t) ); - retval += decode_buf( reg->cookie, N2N_COOKIE_SIZE, base, rem, idx ); - retval += decode_mac( reg->dstMac, base, rem, idx ); - retval += decode_mac( reg->srcMac, base, rem, idx ); - - return retval; -} - -int encode_REGISTER_SUPER_ACK( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_SUPER_ACK_t * reg ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_buf( base, idx, reg->cookie, N2N_COOKIE_SIZE ); - retval += encode_mac( base, idx, reg->edgeMac ); - retval += encode_uint16( base, idx, reg->lifetime ); - retval += encode_sock( base, idx, &(reg->sock) ); - retval += encode_uint8( base, idx, reg->num_sn ); - if ( reg->num_sn > 0 ) - { - /* We only support 0 or 1 at this stage */ - retval += encode_sock( base, idx, &(reg->sn_bak) ); - } - - return retval; -} - -int decode_REGISTER_SUPER_ACK( n2n_REGISTER_SUPER_ACK_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - - memset( reg, 0, sizeof(n2n_REGISTER_SUPER_ACK_t) ); - retval += decode_buf( reg->cookie, N2N_COOKIE_SIZE, base, rem, idx ); - retval += decode_mac( reg->edgeMac, base, rem, idx ); - retval += decode_uint16( &(reg->lifetime), base, rem, idx ); - - /* Socket is mandatory in this message type */ - retval += decode_sock( &(reg->sock), base, rem, idx ); - - /* Following the edge socket are an array of backup supernodes. */ - retval += decode_uint8( &(reg->num_sn), base, rem, idx ); - if ( reg->num_sn > 0 ) - { - /* We only support 0 or 1 at this stage */ - retval += decode_sock( &(reg->sn_bak), base, rem, idx ); - } - - return retval; -} - -int fill_sockaddr( struct sockaddr * addr, - size_t addrlen, - const n2n_sock_t * sock ) -{ - int retval=-1; - - if ( AF_INET == sock->family ) - { - if ( addrlen >= sizeof(struct sockaddr_in) ) - { - struct sockaddr_in * si = (struct sockaddr_in *)addr; - si->sin_family = sock->family; - si->sin_port = htons( sock->port ); - memcpy( &(si->sin_addr.s_addr), sock->addr.v4, IPV4_SIZE ); - retval=0; - } - } - - return retval; -} - - -int encode_PACKET( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PACKET_t * pkt ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_uint16( base, idx, pkt->transform ); - - return retval; -} - - -int decode_PACKET( n2n_PACKET_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( pkt, 0, sizeof(n2n_PACKET_t) ); - retval += decode_uint16( &(pkt->transform), base, rem, idx ); - - return retval; -} - -void decode_ETHFRAMEHDR( n2n_ETHFRAMEHDR_t * eth, - const uint8_t * base ) -{ - memcpy( eth->dstMac, base, N2N_MAC_SIZE ); - base += N2N_MAC_SIZE; - memcpy( eth->srcMac, base, N2N_MAC_SIZE ); -} - -int copy_ETHFRAMEHDR(uint8_t * base, - uint8_t * pkt) -{ - memcpy( base, pkt, ETH_FRAMEHDRSIZE); - return ETH_FRAMEHDRSIZE; -} diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/AUTHORS b/bundles/n2n_meyerd/n2n_v2/wireshark/AUTHORS deleted file mode 100644 index 1cd34dbc..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Author : -Lukas Schwaighofer diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/CMakeLists.txt b/bundles/n2n_meyerd/n2n_v2/wireshark/CMakeLists.txt deleted file mode 100644 index b4061e45..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/CMakeLists.txt +++ /dev/null @@ -1,65 +0,0 @@ -# CMakeLists.txt -# -# $Id: CMakeLists.txt 34243 2010-09-24 20:41:34Z guy $ -# -# Wireshark - Network traffic analyzer -# By Gerald Combs -# Copyright 1998 Gerald Combs -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -set(DISSECTOR_SRC - packet-n2n.c -) - -set(PLUGIN_FILES - plugin.c - ${DISSECTOR_SRC} -) - -set(CLEAN_FILES - ${PLUGIN_FILES} -) - -if (WERROR) - set_source_files_properties( - ${CLEAN_FILES} - PROPERTIES - COMPILE_FLAGS -Werror - ) -endif() - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - -register_dissector_files(plugin.c - plugin - ${DISSECTOR_SRC} -) - -add_library(n2n ${LINK_MODE_MODULE} - ${PLUGIN_FILES} -) -set_target_properties(n2n PROPERTIES PREFIX "") -set_target_properties(n2n PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}") - -target_link_libraries(n2n epan) - -install(TARGETS n2n - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@/plugins/${CPACK_PACKAGE_VERSION} NAMELINK_SKIP - RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@/plugins/${CPACK_PACKAGE_VERSION} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@/plugins/${CPACK_PACKAGE_VERSION} -) - diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/COPYING b/bundles/n2n_meyerd/n2n_v2/wireshark/COPYING deleted file mode 100644 index d60c31a9..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/ChangeLog b/bundles/n2n_meyerd/n2n_v2/wireshark/ChangeLog deleted file mode 100644 index e69de29b..00000000 diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/Makefile.am b/bundles/n2n_meyerd/n2n_v2/wireshark/Makefile.am deleted file mode 100644 index 4aa9d272..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/Makefile.am +++ /dev/null @@ -1,131 +0,0 @@ -# Makefile.am -# Automake file for N2N plugin -# By Steve Limkemann -# Copyright 1998 Steve Limkemann -# -# $Id: Makefile.am 32808 2010-05-14 16:48:17Z jake $ -# -# Wireshark - Network traffic analyzer -# By Gerald Combs -# Copyright 1998 Gerald Combs -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -INCLUDES = -I$(top_srcdir) -I$(includedir) - -include Makefile.common - -if HAVE_WARNINGS_AS_ERRORS -AM_CFLAGS = -Werror -endif - -plugindir = @plugindir@ - -plugin_LTLIBRARIES = n2n.la -n2n_la_SOURCES = \ - plugin.c \ - moduleinfo.h \ - $(DISSECTOR_SRC) \ - $(DISSECTOR_SUPPORT_SRC) \ - $(DISSECTOR_INCLUDES) -n2n_la_LDFLAGS = -module -avoid-version -n2n_la_LIBADD = @PLUGIN_LIBS@ - -# Libs must be cleared, or else libtool won't create a shared module. -# If your module needs to be linked against any particular libraries, -# add them here. -LIBS = - -# -# Build plugin.c, which contains the plugin version[] string, a -# function plugin_register() that calls the register routines for all -# protocols, and a function plugin_reg_handoff() that calls the handoff -# registration routines for all protocols. -# -# We do this by scanning sources. If that turns out to be too slow, -# maybe we could just require every .o file to have an register routine -# of a given name (packet-aarp.o -> proto_register_aarp, etc.). -# -# Formatting conventions: The name of the proto_register_* routines an -# proto_reg_handoff_* routines must start in column zero, or must be -# preceded only by "void " starting in column zero, and must not be -# inside #if. -# -# DISSECTOR_SRC is assumed to have all the files that need to be scanned. -# -# For some unknown reason, having a big "for" loop in the Makefile -# to scan all the files doesn't work with some "make"s; they seem to -# pass only the first few names in the list to the shell, for some -# reason. -# -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. -# -# The first argument is the directory in which the source files live. -# The second argument is "plugin", to indicate that we should build -# a plugin.c file for a plugin. -# All subsequent arguments are the files to scan. -# -plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ - $(top_srcdir)/tools/make-dissector-reg.py - @if test -n "$(PYTHON)"; then \ - echo Making plugin.c with python ; \ - $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ - plugin $(DISSECTOR_SRC) ; \ - else \ - echo Making plugin.c with shell script ; \ - $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ - $(plugin_src) plugin $(DISSECTOR_SRC) ; \ - fi - -# -# Currently plugin.c can be included in the distribution because -# we always build all protocol dissectors. We used to have to check -# whether or not to build the snmp dissector. If we again need to -# variably build something, making plugin.c non-portable, uncomment -# the dist-hook line below. -# -# Oh, yuk. We don't want to include "plugin.c" in the distribution, as -# its contents depend on the configuration, and therefore we want it -# to be built when the first "make" is done; however, Automake insists -# on putting *all* source into the distribution. -# -# We work around this by having a "dist-hook" rule that deletes -# "plugin.c", so that "dist" won't pick it up. -# -#dist-hook: -# @rm -f $(distdir)/plugin.c - -CLEANFILES = \ - n2n \ - *~ - -MAINTAINERCLEANFILES = \ - Makefile.in \ - plugin.c - -EXTRA_DIST = \ - Makefile.common \ - Makefile.nmake \ - moduleinfo.nmake \ - plugin.rc.in \ - CMakeLists.txt - -checkapi: - $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput $(DISSECTOR_SRC) $(DISSECTOR_INCLUDES) diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/Makefile.common b/bundles/n2n_meyerd/n2n_v2/wireshark/Makefile.common deleted file mode 100644 index b4f61d10..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/Makefile.common +++ /dev/null @@ -1,39 +0,0 @@ -# Makefile.common for N2N plugin -# Contains the stuff from Makefile.am and Makefile.nmake that is -# a) common to both files and -# b) portable between both files -# -# $Id: Makefile.common 27491 2009-02-21 16:33:48Z jake $ -# -# Wireshark - Network traffic analyzer -# By Gerald Combs -# Copyright 1998 Gerald Combs -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# the name of the plugin -PLUGIN_NAME = n2n - -# the dissector sources (without any helpers) -DISSECTOR_SRC = \ - packet-n2n.c - -# corresponding headers -DISSECTOR_INCLUDES = - -# Dissector helpers. They're included in the source files in this -# directory, but they're not dissectors themselves, i.e. they're not -# used to generate "plugin.c". -DISSECTOR_SUPPORT_SRC = diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/Makefile.nmake b/bundles/n2n_meyerd/n2n_v2/wireshark/Makefile.nmake deleted file mode 100644 index 9fb1e806..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/Makefile.nmake +++ /dev/null @@ -1,104 +0,0 @@ -# Makefile.nmake -# nmake file for Wireshark plugin -# -# $Id: Makefile.nmake 35747 2011-02-02 01:19:53Z wmeier $ -# - -include ..\..\config.nmake -include moduleinfo.nmake - -include Makefile.common - -CFLAGS=$(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) \ - /I../.. $(GLIB_CFLAGS) \ - /I$(PCAP_DIR)\include - -.c.obj:: - $(CC) $(CFLAGS) -Fd.\ -c $< - -LDFLAGS = $(PLUGIN_LDFLAGS) - -!IFDEF ENABLE_LIBWIRESHARK -LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib -CFLAGS=/D_NEED_VAR_IMPORT_ $(CFLAGS) - -DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) - -DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj) - -OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) plugin.obj - -RESOURCE=$(PLUGIN_NAME).res - -all: $(PLUGIN_NAME).dll - -$(PLUGIN_NAME).rc : moduleinfo.nmake - sed -e s/@PLUGIN_NAME@/$(PLUGIN_NAME)/ \ - -e s/@RC_MODULE_VERSION@/$(RC_MODULE_VERSION)/ \ - -e s/@RC_VERSION@/$(RC_VERSION)/ \ - -e s/@MODULE_VERSION@/$(MODULE_VERSION)/ \ - -e s/@PACKAGE@/$(PACKAGE)/ \ - -e s/@VERSION@/$(VERSION)/ \ - -e s/@MSVC_VARIANT@/$(MSVC_VARIANT)/ \ - < plugin.rc.in > $@ - -$(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLUGIN_WITH) $(RESOURCE) - link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ - $(GLIB_LIBS) $(RESOURCE) - -# -# Build plugin.c, which contains the plugin version[] string, a -# function plugin_register() that calls the register routines for all -# protocols, and a function plugin_reg_handoff() that calls the handoff -# registration routines for all protocols. -# -# We do this by scanning sources. If that turns out to be too slow, -# maybe we could just require every .o file to have an register routine -# of a given name (packet-aarp.o -> proto_register_aarp, etc.). -# -# Formatting conventions: The name of the proto_register_* routines an -# proto_reg_handoff_* routines must start in column zero, or must be -# preceded only by "void " starting in column zero, and must not be -# inside #if. -# -# DISSECTOR_SRC is assumed to have all the files that need to be scanned. -# -# For some unknown reason, having a big "for" loop in the Makefile -# to scan all the files doesn't work with some "make"s; they seem to -# pass only the first few names in the list to the shell, for some -# reason. -# -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. -# -# The first argument is the directory in which the source files live. -# The second argument is "plugin", to indicate that we should build -# a plugin.c file for a plugin. -# All subsequent arguments are the files to scan. -# -!IFDEF PYTHON -plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg.py - @echo Making plugin.c (using python) - @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC) -!ELSE -plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg - @echo Making plugin.c (using sh) - @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) -!ENDIF - -!ENDIF - -clean: - rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \ - $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ - $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc - -distclean: clean - -maintainer-clean: distclean - -checkapi: - $(PERL) ../../tools/checkAPIs.pl -g abort -g termoutput $(DISSECTOR_SRC) $(DISSECTOR_INCLUDES) diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/moduleinfo.h b/bundles/n2n_meyerd/n2n_v2/wireshark/moduleinfo.h deleted file mode 100644 index 121cc297..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/moduleinfo.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Included *after* config.h, in order to re-define these macros */ - -#ifdef PACKAGE -#undef PACKAGE -#endif - -/* Name of package */ -#define PACKAGE "n2n" - - -#ifdef VERSION -#undef VERSION -#endif - -/* Version number of package */ -#define VERSION "0.0.1" - diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/moduleinfo.nmake b/bundles/n2n_meyerd/n2n_v2/wireshark/moduleinfo.nmake deleted file mode 100644 index 1aec6f1e..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/moduleinfo.nmake +++ /dev/null @@ -1,28 +0,0 @@ -# -# $Id: moduleinfo.nmake 20161 2006-12-19 22:24:40Z jake $ -# - -# The name -PACKAGE=n2n - -# The version -MODULE_VERSION_MAJOR=0 -MODULE_VERSION_MINOR=0 -MODULE_VERSION_MICRO=1 -MODULE_VERSION_EXTRA=0 - -# -# The RC_VERSION should be comma-separated, not dot-separated, -# as per Graham Bloice's message in -# -# http://www.ethereal.com/lists/ethereal-dev/200303/msg00283.html -# -# "The RC_VERSION variable in config.nmake should be comma separated. -# This allows the resources to be built correctly and the version -# number to be correctly displayed in the explorer properties dialog -# for the executables, and XP's tooltip, rather than 0.0.0.0." -# - -MODULE_VERSION=$(MODULE_VERSION_MAJOR).$(MODULE_VERSION_MINOR).$(MODULE_VERSION_MICRO).$(MODULE_VERSION_EXTRA) -RC_MODULE_VERSION=$(MODULE_VERSION_MAJOR),$(MODULE_VERSION_MINOR),$(MODULE_VERSION_MICRO),$(MODULE_VERSION_EXTRA) - diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/packet-n2n.c b/bundles/n2n_meyerd/n2n_v2/wireshark/packet-n2n.c deleted file mode 100644 index 4fa616a3..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/packet-n2n.c +++ /dev/null @@ -1,153 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#define N2N_PORT 1234 - -#define N2N_FLAGS_FROM_SUPERNODE 0x0020 -#define N2N_PKTTYPE_MASK 0x001f - -static int proto_n2n = -1; -static int hf_n2n_version = -1; -static int hf_n2n_ttl = -1; -static int hf_n2n_flag_supernode = -1; -static int hf_n2n_pkttype = -1; -static int hf_n2n_community = -1; -static int hf_n2n_transportid = -1; -static int hf_n2n_dstmac = -1; -static int hf_n2n_srcmac = -1; -static int hf_n2n_ethertype = -1; -static gint ett_n2n = -1; - -static const value_string packettypenames[] = { - { 1, "Register" }, - { 2, "Deregister" }, - { 3, "Packet" }, - { 4, "Register_ACK" }, - { 5, "Register_SUPER" }, - { 6, "Register_SUPER_ACK" }, - { 7, "Register_SUPER_NAK" }, - { 8, "Federation" }, - { 9, "Peer Info" }, - {10, "Query Peer" } -}; - -void -proto_register_n2n(void) -{ - static hf_register_info hf[] = { - { &hf_n2n_version, - { "N2N Version", "n2n.version", - FT_UINT8, BASE_DEC, - NULL, 0x0, - NULL, HFILL } - }, - { &hf_n2n_ttl, - { "Time to Live", "n2n.ttl", - FT_UINT8, BASE_DEC, - NULL, 0x0, - NULL, HFILL } - }, - { &hf_n2n_flag_supernode, - { "From Supernode", "n2n.flags.from_supernode", - FT_BOOLEAN, 16, - NULL, N2N_FLAGS_FROM_SUPERNODE, - NULL, HFILL } - }, - { &hf_n2n_pkttype, - { "Packet Type", "n2n.pkttype", - FT_UINT16, BASE_DEC, - VALS(packettypenames), N2N_PKTTYPE_MASK, - NULL, HFILL } - }, - { &hf_n2n_community, - { "Community", "n2n.community", - FT_STRING, BASE_NONE, - NULL, 0x0, - NULL, HFILL } - }, - { &hf_n2n_transportid, - { "Transport ID", "n2n.transportid", - FT_UINT16, BASE_DEC, - NULL, 0x0, - NULL, HFILL} - }, - { &hf_n2n_dstmac, - { "Destination MAC", "n2n.dstmac", - FT_ETHER, BASE_NONE, - NULL, 0x0, - NULL, HFILL} - }, - { &hf_n2n_srcmac, - { "Source MAC", "n2n.srcmac", - FT_ETHER, BASE_NONE, - NULL, 0x0, - NULL, HFILL} - }, - { &hf_n2n_ethertype, - { "Encapsulated Protocol", "n2n.ethertype", - FT_UINT16, BASE_HEX, - VALS(etype_vals), 0x0, - NULL, HFILL} - } - }; - - /* Setup protcol subtree array */ - static gint *ett[] = { - &ett_n2n - }; - - proto_n2n = proto_register_protocol ( - "N2N Protocol", /* name */ - "N2N", /* short name */ - "n2n" /* abbrev */ - ); - proto_register_field_array(proto_n2n, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); -} - -static void -dissect_n2n(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) -{ - gint offset = 0; - col_set_str(pinfo->cinfo, COL_PROTOCOL, "N2N"); - /* Clear out stuff in the info column */ - /* col_clear(pinfo->cinfo,COL_INFO); */ - - if(tree) { - proto_item *ti = NULL; - proto_item *n2n_tree = NULL; - - ti = proto_tree_add_item(tree, proto_n2n, tvb, 0, -1, FALSE); - n2n_tree = proto_item_add_subtree(ti, ett_n2n); - proto_tree_add_item(n2n_tree, hf_n2n_version, tvb, offset, 1, FALSE); - offset += 1; - proto_tree_add_item(n2n_tree, hf_n2n_ttl, tvb, offset, 1, FALSE); - offset += 1; - proto_tree_add_item(n2n_tree, hf_n2n_flag_supernode, tvb, offset, 2, FALSE); - proto_tree_add_item(n2n_tree, hf_n2n_pkttype, tvb, offset, 2, FALSE); - offset += 2; - proto_tree_add_item(n2n_tree, hf_n2n_community, tvb, offset, 16, FALSE); - offset += 16; - proto_tree_add_item(n2n_tree, hf_n2n_transportid, tvb, offset, 2, FALSE); - offset += 2; - proto_tree_add_item(n2n_tree, hf_n2n_dstmac, tvb, offset, 6, FALSE); - offset += 6; - proto_tree_add_item(n2n_tree, hf_n2n_srcmac, tvb, offset, 6, FALSE); - offset += 6; - proto_tree_add_item(n2n_tree, hf_n2n_ethertype, tvb, offset, 2, FALSE); - offset += 2; - } -} - -void -proto_reg_handoff_n2n(void) -{ - static dissector_handle_t n2n_handle; - - n2n_handle = create_dissector_handle(dissect_n2n, proto_n2n); - dissector_add_uint("udp.port", N2N_PORT, n2n_handle); -} diff --git a/bundles/n2n_meyerd/n2n_v2/wireshark/plugin.rc.in b/bundles/n2n_meyerd/n2n_v2/wireshark/plugin.rc.in deleted file mode 100644 index 568dc07b..00000000 --- a/bundles/n2n_meyerd/n2n_v2/wireshark/plugin.rc.in +++ /dev/null @@ -1,34 +0,0 @@ -#include "winver.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION @RC_MODULE_VERSION@ - PRODUCTVERSION @RC_VERSION@ - FILEFLAGSMASK 0x0L -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0 -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_DLL -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "The Wireshark developer community, http://www.wireshark.org/\0" - VALUE "FileDescription", "@PACKAGE@ dissector\0" - VALUE "FileVersion", "@MODULE_VERSION@\0" - VALUE "InternalName", "@PACKAGE@ @MODULE_VERSION@\0" - VALUE "LegalCopyright", "Copyright 1998 Gerald Combs , Gilbert Ramirez and others\0" - VALUE "OriginalFilename", "@PLUGIN_NAME@.dll\0" - VALUE "ProductName", "Wireshark\0" - VALUE "ProductVersion", "@VERSION@\0" - VALUE "Comments", "Build with @MSVC_VARIANT@\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/bundles/n2n_ntop_v2/.gitignore b/bundles/n2n_ntop_v2/.gitignore deleted file mode 100644 index 950da593..00000000 --- a/bundles/n2n_ntop_v2/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -*.o -*.a -*.gz -configure -configure.ac -config.* -Makefile -autom4te.cache -edge -example_edge_embed_quick_edge_init -example_edge_embed -example_sn_embed -supernode -tools/n2n-benchmark -tools/n2n-decode -build -.idea -cmake-build-default -packages/debian/debian/changelog -packages/debian/debian/control -packages/debian/debian/files -packages/debian/debian/rules -packages/etc/systemd/system/edge-ntopng@.service -packages/etc/systemd/system/edge.service -packages/etc/systemd/system/edge@.service -packages/etc/systemd/system/supernode.service -*dSYM* diff --git a/bundles/n2n_ntop_v2/CHANGELOG.md b/bundles/n2n_ntop_v2/CHANGELOG.md deleted file mode 100644 index 3893fcc0..00000000 --- a/bundles/n2n_ntop_v2/CHANGELOG.md +++ /dev/null @@ -1,89 +0,0 @@ -# Changelog - -## n2n 2.8 (August 2020) - -This release brings significant new features to n2n's crypto world and offers -some compression opportunities. The added support for routing table manipulation -might increase comfort. Besides further honing existing features, this release -addresses some bugs. - -### New Features - -* Two lightweight stream ciphers: ChaCha20 (optional, through OpenSSL) & SPECK (integrated) -* Full Header Encryption (including packet checksumming as well as replay protection) -* A callback interface to better integrate n2n in third party software (you can still use it stand-alone) -* Enable the integrated LZO1x compression -* Add optional ZSTD compression (through zstdlib) -* Support for changing system routes at program start and end -* User and group id parameter for supernode -* Application of cryptography in n2n is seperately documented -* Add a new pseudo random number generator with higher periodicity seeded with more entropy if available - -### Improvements - -* Have AES and ChaCha20 use OpenSSL's `evp_*` interface to make better use of available hardware acceleration -* Fix invalid sendto when supernode name resolution fails -* Update to supernode's purge logic -* Extended management supernode's port output -* Fix read tap device failed when OS wakes up from sleep -* Free choice of supernode's management UDP port (for multiple supernodes on one machine) -* Additional trace messages to better indicate established connections and connection type -* Fix edge's register-to-supernode loop -* Remove redundant code -* Restructure the code in directories -* Clean-up platform-dependant code -* Compile fixes for Windows -* Fix build warnings -* …and many more under-the-hood fixes and tunings - -## n2n 2.6 (March 2020) - -The 2.6 release is mostly a maintenance release to address the issues -of 2.4 that has been the first release since a long time of silence. - -### New Features - -* AES encryption that features an overall speed bump (12x speed) and security with respect to Twofish used in the previous n2n version -* Add ability to specify a whitelist of allowed communities on the supernode -* Implement local peers discovery via multicast -* Full peer-to-peer topology support. -* Add support for multiple edge systemd services -* Add benchmark tool for the encryption throughput -* Implement packet stats for P2P vs supernode communication -* Automatically drop privileges to user n2n -* Add support for ARM64 build -* More options to control MTU, P2P connections, TOS and log verbosity -* Implement a wireshark dissector for the n2n protocol -* Implement n2n-decode utility to decode and dump traffic to PCAP - - -### Improvements -* Extensive Windows and OpenWRT support. -* Windows compilation fixes and instructions -* Instructions and makefile file to build n2n on OpenWRT -* MacOS compilation fixes and instructions -* Improve the connection stability and the chances to establish a P2P connection -* Stable and more resilient connection. -* Remove keyschedule support to simplify the encryption code -* Replace peers linked list with hash table for faster lookup in big networks -* Integrate the changes made in the meyerd fork of n2n -* Remove calls to system() in tuntap_linux and use netlink instead -* n2n version improvements - -## n2n 2.4 (August 2018) - -This is the first release after 2012 and thus it is focusing mainly -on making it work on current operating system versions, so that the -next release will be based on modern code. - -### New Features -* Added deb/rpm packages -* Added systemd configuration files -* Added ability to read configuration files instead of using only the CLI (needed for packaging) -* Added n2n Android app -* Implemented simple API to embed n2n in applications (in addition to use it stand-alone) - -### Improvements -* Major code cleanup -* Fixed compilation issues on MacOS -* Fixed Linux segmentation fault diff --git a/bundles/n2n_ntop_v2/CMakeLists.txt b/bundles/n2n_ntop_v2/CMakeLists.txt deleted file mode 100644 index 3156a8b1..00000000 --- a/bundles/n2n_ntop_v2/CMakeLists.txt +++ /dev/null @@ -1,213 +0,0 @@ -project(n2n) -cmake_minimum_required(VERSION 2.6) -include(CheckFunctionExists) -SET(CMAKE_VERBOSE_MAKEFILE ON) - -# N2n release information -set(N2N_VERSION "2.8.0") -set(N2N_OSNAME ${CMAKE_SYSTEM}) -execute_process( - COMMAND git --version - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE GIT_EXIST -) -if (GIT_EXIST) -execute_process( - COMMAND git rev-list --count HEAD - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE GIT_REV -) -execute_process( - COMMAND git rev-parse --short HEAD - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE GIT_ID -) -string(REGEX REPLACE "\n$" "" GIT_REV "${GIT_REV}") -string(REGEX REPLACE "\n$" "" GIT_ID "${GIT_ID}") -set(N2N_VERSION "${N2N_VERSION}.r${GIT_REV}.${GIT_ID}") -MESSAGE(STATUS "Build from git rev: ${N2N_VERSION}") -endif (GIT_EXIST) - -add_definitions(-DCMAKE_BUILD) -add_definitions(-DGIT_RELEASE="" -DPACKAGE_VERSION="${N2N_VERSION}" -DPACKAGE_OSNAME="${N2N_OSNAME}") -add_definitions(-DN2N_VERSION="${N2N_VERSION}" -DN2N_OSNAME="${N2N_OSNAME}") - - -# Build information -OPTION(BUILD_SHARED_LIBS "BUILD Shared Library" OFF) - -# N2n specific params -OPTION(N2N_OPTION_AES "USE AES" ON) - -if(NOT DEFINED N2N_OPTION_AES) -set(N2N_OPTION_AES ON) -endif(NOT DEFINED N2N_OPTION_AES) - -if(N2N_OPTION_AES) - find_package(OpenSSL QUIET) - if(NOT OPENSSL_FOUND) - MESSAGE(WARNING "OpenSSL not found, AES disabled.") - set(N2N_OPTION_AES OFF) - else() - include_directories(${OPENSSL_INCLUDE_DIR}) - add_definitions(-DN2N_HAVE_AES) - endif(NOT OPENSSL_FOUND) -endif(N2N_OPTION_AES) - - -if(NOT DEFINED CMAKE_BUILD_TYPE) -set(CMAKE_BUILD_TYPE None) -endif(NOT DEFINED CMAKE_BUILD_TYPE) -#set(CMAKE_BUILD_TYPE Debug) -#set(CMAKE_BUILD_TYPE Release) - -if (DEFINED UNIX) -# None -set(CMAKE_C_FLAGS "-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs") -set(CMAKE_CXX_FLAGS "-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs") -# Debug -set(CMAKE_C_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -# Release -set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") -set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") -endif(DEFINED UNIX) - -# Static target. -#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static") - - -INCLUDE_DIRECTORIES(.) -INCLUDE_DIRECTORIES(include) -if(DEFINED WIN32) - INCLUDE_DIRECTORIES(win32) -# Customize include. -# INCLUDE_DIRECTORIES("D:/Program Files/MinGW/opt/include/" "D:/Program Files/MinGW/x86_64-w64-mingw32/include/") -# Customize library. -# LINK_DIRECTORIES("D:/Program Files/MinGW/opt/lib/" "D:/Program Files/MinGW/x86_64-w64-mingw32/lib/") -endif(DEFINED WIN32) - - -#aux_source_directory(./src N2N_DIR_SRCS) -#add_library(n2n STATIC ${N2N_DIR_SRCS}) -add_library(n2n STATIC - src/n2n.c - src/edge_utils.c - src/sn_utils.c - src/wire.c - src/minilzo.c - src/twofish.c - src/transform_null.c - src/transform_tf.c - src/transform_aes.c - src/transform_cc20.c - src/transform_speck.c - src/speck.c - src/random_numbers.c - src/pearson.c - src/header_encryption.c - src/tuntap_freebsd.c - src/tuntap_netbsd.c - src/tuntap_linux.c - src/tuntap_osx.c - ) - -if(DEFINED WIN32) - add_library(edge_utils_win32 src/edge_utils_win32.c) - add_subdirectory(win32) - target_link_libraries(n2n edge_utils_win32 n2n_win32 ) -endif(DEFINED WIN32) - -if(N2N_OPTION_AES) -# target_link_libraries(n2n crypto) - target_link_libraries(n2n ${OPENSSL_LIBRARIES}) -endif(N2N_OPTION_AES) - - -add_executable(edge src/edge.c) -target_link_libraries(edge n2n) - -add_executable(supernode src/sn.c) -target_link_libraries(supernode n2n) - -add_executable(example_edge_embed_quick_edge_init src/example_edge_embed_quick_edge_init.c) -target_link_libraries(example_edge_embed_quick_edge_init n2n) - -add_executable(example_edge_embed src/example_edge_embed.c) -target_link_libraries(example_edge_embed n2n) - -add_executable(example_sn_embed src/example_sn_embed.c) -target_link_libraries(example_sn_embed n2n) - -if(NOT DEFINED WIN32) - # Linux Capabilities - find_library(CAP_LIB cap) - if(CAP_LIB) - target_link_libraries(edge cap) - set(CMAKE_REQUIRED_LIBRARIES ${CAP_LIB}) - ADD_DEFINITIONS("-DHAVE_LIBCAP") - endif() -endif(NOT DEFINED WIN32) - -install(TARGETS edge supernode - RUNTIME DESTINATION sbin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - ) - - -# Tools -add_executable(n2n-benchmark tools/benchmark.c) -target_link_libraries(n2n-benchmark n2n) - -find_library(PCAP_LIB pcap) -if(PCAP_LIB) - add_executable(n2n-decode tools/n2n_decode.c) - target_link_libraries(n2n-decode n2n pcap) - install(TARGETS n2n-decode RUNTIME DESTINATION bin) - - set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIB}) - check_function_exists(pcap_set_immediate_mode HAVE_PCAP_IMMEDIATE_MODE) - IF(HAVE_PCAP_IMMEDIATE_MODE) - ADD_DEFINITIONS("-DHAVE_PCAP_IMMEDIATE_MODE") - ENDIF(HAVE_PCAP_IMMEDIATE_MODE) -endif(PCAP_LIB) - -install(TARGETS n2n-benchmark RUNTIME DESTINATION bin) - -# Documentation -if(DEFINED UNIX) -add_dependencies(n2n doc) -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/doc) -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/edge.8.gz - COMMAND gzip -c ${PROJECT_SOURCE_DIR}/edge.8 > ${PROJECT_BINARY_DIR}/doc/edge.8.gz - DEPENDS ${PROJECT_SOURCE_DIR}/edge.8 - ) - -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - COMMAND gzip -c ${PROJECT_SOURCE_DIR}/supernode.1 > ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - DEPENDS ${PROJECT_SOURCE_DIR}/supernode.1 - ) - -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - COMMAND gzip -c ${PROJECT_SOURCE_DIR}/n2n.7 > ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - DEPENDS ${PROJECT_SOURCE_DIR}/n2n.7 - ) - -add_custom_target(doc DEPENDS ${PROJECT_BINARY_DIR}/doc/edge.8.gz - ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - ) - -set_source_files_properties(${PROJECT_BINARY_DIR}/doc/edge.8.gz - ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - PROPERTIES GENERATED 1) - -install(FILES ${PROJECT_BINARY_DIR}/doc/edge.8.gz - DESTINATION /usr/share/man8) -install(FILES ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - DESTINATION /usr/share/man1) -install(FILES ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - DESTINATION /usr/share/man7) -endif(DEFINED UNIX) diff --git a/bundles/n2n_ntop_v2/COPYING b/bundles/n2n_ntop_v2/COPYING deleted file mode 100644 index b33b35d0..00000000 --- a/bundles/n2n_ntop_v2/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - n2n Copyright (C) 2007-08 Luca Deri - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/bundles/n2n_ntop_v2/INSTALL b/bundles/n2n_ntop_v2/INSTALL deleted file mode 100644 index 22000326..00000000 --- a/bundles/n2n_ntop_v2/INSTALL +++ /dev/null @@ -1,50 +0,0 @@ -INSTALL - -To build the programs: - -$ make - -To install the programs and man pages: - -$ make install - -or - -$ make PREFIX=/usr/local install - - -RPM Package ------------ - -These steps should work with RPM based Linux distributions since rpmbuild was -split from the rpm utility (c RedHat 9). - - -To build an RPM the easy way follow these steps. - -1. Build SRPM - -$ cd n2n -$ scripts/mk_SRPM.sh - -Look for where the src.rpm file was put ( "Wrote:" ). - -2. Build binary RPM from SRPM - -$ rpm -i path/to/n2n-.src.rpm -$ rpmbuild -bb n2n.spec - - -All this can be done as non-root user if you have a ~/.rpmmacros file with this -line in it: - -%_topdir /home/username/rpmtopdir - - -To build an RPM the hard way follow these steps. - -$ cp -a n2ndir n2n-2.0 -$ tar czf n2n-2.0.tar.gz n2n-2.0 -$ mv n2n-2.0.tar.gz /usr/src/redhat/SOURCES -$ cp n2ndir/n2n.spec /usr/src/redhat/SPECS -$ rpmbuild -bb n2n.spec diff --git a/bundles/n2n_ntop_v2/LICENSE b/bundles/n2n_ntop_v2/LICENSE deleted file mode 100644 index 9cecc1d4..00000000 --- a/bundles/n2n_ntop_v2/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/bundles/n2n_ntop_v2/Makefile.in b/bundles/n2n_ntop_v2/Makefile.in deleted file mode 100644 index 60aaf193..00000000 --- a/bundles/n2n_ntop_v2/Makefile.in +++ /dev/null @@ -1,144 +0,0 @@ - -# NOTE: these are needed by the configure.in inside the packages folder -N2N_VERSION_SHORT=@N2N_VERSION_SHORT@ -GIT_COMMITS=@GIT_COMMITS@ - -######## - -CC=@CC@ - -#Ultrasparc64 users experiencing SIGBUS should try the following gcc options -#(thanks to Robert Gibbon) -PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finline-functions -fweb -frename-registers -mapp-regs - -N2N_OBJS_OPT= -LIBS_EDGE_OPT=@N2N_LIBS@ -CFLAGS=@CFLAGS@ -I ./include -LDFLAGS=@LDFLAGS@ - -OPENSSL_CFLAGS=$(shell pkg-config openssl; echo $$?) -ifeq ($(OPENSSL_CFLAGS), 0) - CFLAGS+=$(shell pkg-config --cflags-only-I openssl) -endif - -CFLAGS+=$(DEBUG) $(OPTIMIZATION) $(WARN) $(OPTIONS) $(PLATOPTS) - -INSTALL=install -MKDIR=mkdir -p -OS := $(shell uname -s) - -INSTALL_PROG=$(INSTALL) -m755 -INSTALL_DOC=$(INSTALL) -m644 - -# DESTDIR set in debian make system -PREFIX?=$(DESTDIR)/usr -#BINDIR=$(PREFIX)/bin -ifeq ($(OS),Darwin) -SBINDIR=$(PREFIX)/local/sbin -else -SBINDIR=$(PREFIX)/sbin -endif - -MANDIR?=$(PREFIX)/share/man -MAN1DIR=$(MANDIR)/man1 -MAN7DIR=$(MANDIR)/man7 -MAN8DIR=$(MANDIR)/man8 - -N2N_LIB=libn2n.a -N2N_OBJS=$(patsubst src/%.c, src/%.o, $(wildcard src/*.c)) -N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) Makefile $(N2N_LIB) - -LIBS_EDGE+=$(LIBS_EDGE_OPT) -LIBS_SN= - -#For OpenSolaris (Solaris too?) -ifeq ($(shell uname), SunOS) -LIBS_EDGE+=-lsocket -lnsl -LIBS_SN+=-lsocket -lnsl -endif - -APPS=edge -APPS+=supernode -APPS+=example_edge_embed_quick_edge_init -APPS+=example_edge_embed -APPS+=example_sn_embed - -DOCS=edge.8.gz supernode.1.gz n2n.7.gz - -.PHONY: steps build push all clean install tools -all: $(APPS) $(DOCS) tools - -tools: $(N2N_LIB) - $(MAKE) -C $@ - -edge: src/edge.c $(N2N_LIB) $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ - -supernode: src/sn.c $(N2N_LIB) $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_SN) -o $@ - -example_edge_embed_quick_edge_init: src/example_edge_embed_quick_edge_init.c $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ - -example_sn_embed: src/example_sn_embed.c $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ - -example_edge_embed: src/example_edge_embed.c $(N2N_DEPS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ - -%.gz : % - gzip -c $< > $@ - -$(N2N_LIB): $(N2N_OBJS) - ar rcs $(N2N_LIB) $(N2N_OBJS) -# $(RANLIB) $@ - -clean: - rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) test n2n-decode *.dSYM *~ - $(MAKE) -C tools clean - -install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz - echo "MANDIR=$(MANDIR)" - $(MKDIR) $(SBINDIR) $(MAN1DIR) $(MAN7DIR) $(MAN8DIR) - $(INSTALL_PROG) supernode $(SBINDIR)/ - $(INSTALL_PROG) edge $(SBINDIR)/ - $(INSTALL_DOC) edge.8.gz $(MAN8DIR)/ - $(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/ - $(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/ - $(MAKE) -C tools install - -# Docker builder section -DOCKER_IMAGE_NAME=ntop/supernode -DOCKER_IMAGE_VERSION=$N2N_VERSION_SHORT -N2N_COMMIT_HASH=@GIT_REVISION@ - -default: steps - -steps: - if [ "$(TARGET_ARCHITECTURE)" = "arm32v7" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.arm32v7" DOCKER_IMAGE_TAGNAME=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-arm32v7 make build; fi - if [ "$(TARGET_ARCHITECTURE)" = "x86_64" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.x86_64" DOCKER_IMAGE_TAGNAME=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-x86_64 make build; fi - -build: - $(eval OS := $(shell uname -s)) - $(eval ARCHITECTURE := $(shell export DOCKER_IMAGE_TAGNAME="$(DOCKER_IMAGE_TAGNAME)"; echo $$DOCKER_IMAGE_TAGNAME | grep -oe -.*)) - - docker build --target builder --build-arg COMMIT_HASH=$(N2N_COMMIT_HASH) -t $(DOCKER_IMAGE_TAGNAME) -f image-platforms/$(DOCKER_IMAGE_FILENAME) . - - docker container create --name builder $(DOCKER_IMAGE_TAGNAME) - if [ ! -d "./build" ]; then mkdir ./build; fi - docker container cp builder:/usr/src/n2n/supernode ./build/supernode-$(OS)$(ARCHITECTURE) - docker container cp builder:/usr/src/n2n/edge ./build/edge-$(OS)$(ARCHITECTURE) - docker container rm -f builder - - docker build --build-arg COMMIT_HASH=$(N2N_COMMIT_HASH) -t $(DOCKER_IMAGE_TAGNAME) -f image-platforms/$(DOCKER_IMAGE_FILENAME) . - docker tag $(DOCKER_IMAGE_TAGNAME) $(DOCKER_IMAGE_NAME):latest$(ARCHITECTURE) - -push: - if [ ! "$(TARGET_ARCHITECTURE)" = "" ]; then \ - docker push $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-$(TARGET_ARCHITECTURE); \ - docker push $(DOCKER_IMAGE_NAME):latest-$(TARGET_ARCHITECTURE); \ - else \ - echo "Please pass TARGET_ARCHITECTURE, see README.md."; \ - fi - -# End Docker builder section diff --git a/bundles/n2n_ntop_v2/README.md b/bundles/n2n_ntop_v2/README.md deleted file mode 100644 index 04ce0992..00000000 --- a/bundles/n2n_ntop_v2/README.md +++ /dev/null @@ -1,126 +0,0 @@ -# n2n - -n2n is a light VPN software which makes it easy to create virtual networks bypassing intermediate firewalls. - -In order to start using n2n, two elements are required: - -- A _supernode_: it allows edge nodes to announce and discover other nodes. It must have a port publicly accessible on internet. -- _edge_ nodes: the nodes which will be a part of the virtual networks - -A virtual network shared between multiple edge nodes in n2n is called a _community_. A single supernode can relay multiple communities and a single computer can be part of multiple communities at the same time. An encryption key can be used by the edge nodes to encrypt the packets within their community. - -n2n tries to establish a direct peer-to-peer connection via udp between the edge nodes when possible. When this is not possible (usually due to special NAT devices), the supernode is also used to relay the packets. - -## Quick Setup - -Some Linux distributions already provide n2n as a package so a simple `sudo apt install n2n` will do the work. Alternatively, up-to-date packages for most distributions are available on [ntop repositories](http://packages.ntop.org/). - -On host1 run: - -```sh -$ sudo edge -c mynetwork -k mysecretpass -a 192.168.100.1 -f -l supernode.ntop.org:7777 -``` - -On host2 run: - -```sh -$ sudo edge -c mynetwork -k mysecretpass -a 192.168.100.2 -f -l supernode.ntop.org:7777 -``` - -Now the two hosts can ping each other. - -**IMPORTANT** It is strongly advised to choose a custom community name (`-c`) and a secret encryption key (`-k`) in order to prevent other users from connecting to your computer. For the privacy of your data sent and to reduce the server load of `supernode.ntop.org`, it is also suggested to set up a custom supernode as explained below. - -## Setting up a Custom Supernode - -You can create your own infrastructure by setting up a supernode on a public server (e.g. a VPS). You just need to open a single port (1234 in the example below) on your firewall (usually `iptables`). - -1. Install the n2n package -2. Edit `/etc/n2n/supernode.conf` and add the following: - ``` - -l=1234 - ``` -3. Start the supernode service with `sudo systemctl start supernode` -4. Optionally enable supernode start on boot: `sudo systemctl enable supernode` - -Now the supernode service should be up and running on port 1234. On your edge nodes you can now specify `-l your_supernode_ip:1234` to use it. All the edge nodes must use the same supernode. - -## Manual Compilation - -On linux, compilation from source is straight forward: - -```sh -./autogen.sh -./configure -make - -# optionally install -make install -``` - -Some parts of the code significantly benefit from compiler optimizations and platform features such as NEON, SSE and AVX. To enable, use `./configure CFLAGS="-O3 -march=native"` for configuration instead of `./configure`. - -For Windows, check out [Windows.md](doc/Windows.md) for compilation and running. -For MacOS, see [macOS.md](doc/macOS.md). - -## Running edge as a Service - -edge can also be run as a service instead of cli: - -1. Edit `/etc/n2n/edge.conf` with your custom options. See `/etc/n2n/edge.conf.sample`. -2. Start the service: `sudo systemctl start edge` -3. Optionally enable edge start on boot: `sudo systemctl enable edge` - -You can run multiple edge service instances by creating `/etc/n2n/edge-instance1.conf` and -starting it with `sudo systemctl start edge@instance1`. - -## Security Considerations - -When payload encryption is enabled (provide a key using `-k`), the supernode will not be able to decrypt -the traffic exchanged between two edge nodes but it will know that edge A is talking with edge B. - -The choice of encryption schemes that can be applied to payload has recently been enhanced. Please have -a look at [Crypto.md](doc/Crypto.md) for a quick comparison chart to help make a choice. n2n edge nodes use -Twofish encryption by default for compatibility reasons with existing versions. Other ciphers can be chosen -using the `-A_` option. - -A benchmark of the encryption methods is available when compiled from source with `tools/n2n-benchmark`. - -The header which contains some metadata like the virtual MAC address of the edge nodes, their IP address -and the community name optionally can be encrypted applying `-H` on the edges. - -## Routing the Traffic - -Reaching a remote network or tunneling all the internet traffic via n2n are two common tasks which require a proper routing setup. n2n supports routing needs providing options for packet forwarding (`-r`) including broadcasts (`-E`) as well as temporarily modifying the routing table (`-n`). Details can be found in the [Routing.md](doc/Routing.md) document. - -## IPv6 Support - -n2n can tunnel IPv6 traffic into the virtual network but does not support -IPv6 for edge-to-supernode communication yet. - -Have a look at [IPv6.md](https://github.com/ntop/n2n/blob/dev/doc/IPv6.md) for more information. - - - -## Contribution - -You can contribute to n2n in various ways: - -- Update an [open issue](https://github.com/ntop/n2n/issues) or create a new one with detailed information -- Propose new features -- Improve the documentation -- Provide pull requests with enhancements - -For details about the internals of n2n check out [Hacking guide](https://github.com/ntop/n2n/blob/dev/doc/HACKING). - -## Related Projects - -Here is a list of third-party projects connected to this repository. - -- N2N for Android: [hin2n](https://github.com/switch-iot/hin2n) -- Docker images: [Docker Hub](https://hub.docker.com/r/supermock/supernode/) -- Go bindings, management daemons and CLIs for n2n edges and supernodes, Docker, Kubernetes & Helm Charts: [pojntfx/gon2n](https://pojntfx.github.io/gon2n/) - ---- - -(C) 2007-2020 - ntop.org and contributors diff --git a/bundles/n2n_ntop_v2/autogen.sh b/bundles/n2n_ntop_v2/autogen.sh deleted file mode 100644 index f786d152..00000000 --- a/bundles/n2n_ntop_v2/autogen.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -# NOTE: update version in CMakeLists.txt after changing these -N2N_MAJOR="2" -N2N_MINOR="8" -N2N_PATCH="0" - -N2N_VERSION_SHORT="$N2N_MAJOR.$N2N_MINOR.$N2N_PATCH" - -cat configure.seed | sed \ - -e "s/@N2N_MAJOR@/$N2N_MAJOR/g" \ - -e "s/@N2N_MINOR@/$N2N_MINOR/g" \ - -e "s/@N2N_PATCH@/$N2N_PATCH/g" \ - -e "s/@N2N_VERSION_SHORT@/$N2N_VERSION_SHORT/g" \ - > configure.ac - -rm -f config.h config.h.in *~ Makefile configure #* - -echo "Wait please..." -autoreconf -if -./configure diff --git a/bundles/n2n_ntop_v2/community.list b/bundles/n2n_ntop_v2/community.list deleted file mode 100644 index b2c249f4..00000000 --- a/bundles/n2n_ntop_v2/community.list +++ /dev/null @@ -1,5 +0,0 @@ -# -# List of allowed communities -# -mynetwork -netleo diff --git a/bundles/n2n_ntop_v2/configure.seed b/bundles/n2n_ntop_v2/configure.seed deleted file mode 100644 index 3b12a160..00000000 --- a/bundles/n2n_ntop_v2/configure.seed +++ /dev/null @@ -1,113 +0,0 @@ -odnl> Do not add anything above -AC_INIT([edge],@N2N_VERSION_SHORT@) -dnl> Do not add anything above - -N2N_VERSION_SHORT=${PACKAGE_VERSION} - -if test -d ".git"; then -# NOTE: keep in sync with the definitions for configure.in files under the packages folder -GIT_COMMITS=`git rev-list --count HEAD` -GIT_REVISION=`git rev-parse --short HEAD` -GIT_RELEASE="${N2N_VERSION_SHORT}.r${GIT_COMMITS}.${GIT_REVISION}" -else -GIT_RELEASE=${N2N_VERSION_SHORT} -fi - -N2N_LIBS= - -AC_PROG_CC -AC_CHECK_LIB([zstd], [ZSTD_compress]) - -if test "x$ac_cv_lib_zstd_ZSTD_compress" != xyes; then - AC_MSG_RESULT(Building n2n without ZSTD support) -else - AC_DEFINE([N2N_HAVE_ZSTD], [], [Have ZSTD support]) - N2N_LIBS="-lzstd ${N2N_LIBS}" -fi - -AC_CHECK_LIB([crypto], [AES_cbc_encrypt]) - -if test "x$ac_cv_lib_crypto_AES_cbc_encrypt" != xyes; then - AC_MSG_RESULT(Building n2n without AES support) -else - AC_DEFINE([N2N_HAVE_AES], [], [Have AES support]) - N2N_LIBS="-lcrypto ${N2N_LIBS}" -fi - -OLD_CFLAGS="${CFLAGS}" -OLD_LDFLAGS="${LDFLAGS}" - -CFLAGS="${CFLAGS} -I/usr/local/opt/openssl@1.1/include" -LDFLAGS="${LDFLAGS} -L/usr/local/opt/openssl@1.1/lib/" -AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset]) -if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_reset" != xyes; then - CFLAGS="${OLD_CFLAGS}" - LDFLAGS="${OLD_LDFLAGS}" -else - AC_DEFINE([HAVE_OPENSSL_1_1], [], [OpenSSL 1.1 is present]) -fi - -AC_CHECK_LIB([pcap], [pcap_open_live], pcap=true) - -if test x$pcap != x; then - AC_DEFINE([N2N_HAVE_PCAP], [], [Have PCAP library]) - ADDITIONAL_TOOLS="$ADDITIONAL_TOOLS n2n-decode" -fi - -AC_CHECK_LIB([pcap], [pcap_set_immediate_mode], pcap_immediate_mode=true) - -if test x$pcap_immediate_mode != x; then - AC_DEFINE([HAVE_PCAP_IMMEDIATE_MODE], [], [Have pcap_immediate_mode]) -fi - -AC_CHECK_LIB([cap], [cap_get_proc], cap=true) -if test x$cap != x; then - LDFLAGS="${LDFLAGS} -lcap" - AC_DEFINE([HAVE_LIBCAP],[1],[Support for linux capabilities]) -fi - -MACHINE=`uname -m` -SYSTEM=`uname -s` - -if test $SYSTEM = "Linux"; then - if test -f /etc/debian_version; then - DEBIAN_VERSION=`cat /etc/debian_version` - OSNAME="Debian $DEBIAN_VERSION" - else - OSNAME=`./config.guess` - fi -else -dnl> wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' - OSNAME=`./config.guess` -fi -AC_DEFINE_UNQUOTED(PACKAGE_OSNAME, "${OSNAME}", [OS name]) -AC_DEFINE_UNQUOTED(GIT_RELEASE, "${GIT_RELEASE}", [GIT release]) - -if test $MACHINE = "x86_64"; then - EXTN="amd64" -else - if test $MACHINE = "i686"; then - EXTN="i386" - fi -fi - -DATE=`date +"%Y-%m-%d"` - -AC_SUBST(CC) -AC_SUBST(CFLAGS) -AC_SUBST(LDFLAGS) -AC_SUBST(N2N_MAJOR) -AC_SUBST(N2N_MINOR) -AC_SUBST(N2N_PATCH) -AC_SUBST(N2N_VERSION_SHORT) -AC_SUBST(GIT_COMMITS) -AC_SUBST(GIT_REVISION) -AC_SUBST(GIT_RELEASE) -AC_SUBST(N2N_DEFINES) -AC_SUBST(N2N_LIBS) -AC_SUBST(ADDITIONAL_TOOLS) -AC_CONFIG_HEADERS(include/config.h) -AC_CONFIG_FILES(Makefile) -AC_CONFIG_FILES(tools/Makefile) - -AC_OUTPUT diff --git a/bundles/n2n_ntop_v2/contributors.txt b/bundles/n2n_ntop_v2/contributors.txt deleted file mode 100644 index cdfbd516..00000000 --- a/bundles/n2n_ntop_v2/contributors.txt +++ /dev/null @@ -1,10 +0,0 @@ -Code contributions courtesy of: - * Richard Andrews - * Don Bindner - * Sylwester Sosnowski - * Wilfried "Wonka" Klaebe - * Lukasz Taczuk - * Alaric Snell-Pym - * Babak Farrokhi [FreeBSD port] - * Logan oos Even - diff --git a/bundles/n2n_ntop_v2/doc/Crypto.md b/bundles/n2n_ntop_v2/doc/Crypto.md deleted file mode 100644 index 547a9655..00000000 --- a/bundles/n2n_ntop_v2/doc/Crypto.md +++ /dev/null @@ -1,202 +0,0 @@ -# Cryptography in n2n - -## Payload - -### Overview - -Payload encryption currently comes in four different flavors using ciphers of different origins. Supported ciphers are enabled using the indicated command line option: - -- Twofish in CTS mode (`-A2`) -- AES in CBC mode (`-A3`) -- ChaCha20 (CTR) (`-A4`) -- SPECK in CTR mode (`-A5`) - -To renounce encryption, `-A1` enables the so called `null_transform` transmitting all payload data unencryptedly. - -The following chart might help to make a quick comparison and decide what cipher to use: - -| Cipher | Mode | Block Size | Key Size | IV length |Speed | Built-In | Origin | -| :---: | :---:| :---: | :---: | :---: |:---: | :---: | --- | -|Twofish | CTS | 128 bits | 256 bit | 32 bit | - | Y | Bruce Schneier | -|AES | CBC | 128 bits | 128, 192, 256 bit| 64 bit | O..+ | N | Joan Daemen, Vincent Rijmen, NSA-approved | -|ChaCha20| CTR | Stream | 256 bit | 128 bit | +..++| N | Daniel J. Bernstein | -|SPECK | CTR | Stream | 256 bit | 128 bit | ++ | Y | NSA | - -The two block ciphers Twofish and AES are used in CTS mode (Twofish) and CBC mode(AES). AES requires a padding which results in encrypted payload size modulo their blocksize. Sizewise, this could be considered as a disadvantage. On the other hand, stream ciphers need a longer initialization vector (IV) to be transmitted with the cipher. - -Note that AES and ChaCha20 are available only if n2n is compiled with openSSL support. n2n will work well without them offering the respectively reduced choice of remaining built-in ciphers (Twofish, SPECK). - -### Twofish - -This implementation prepends a 32 bit random value to the plain text. In the `src/transform_tf.c` file, it is called `nonce`. In CBC mode, this basically has the same effect as a respectively shorter IV. - -Twofish requires no padding as it employs a CBC/CTS scheme which can send out plaintext-length ciphertexts. The scheme however has a small flaw in handling messages shorter than one block, only low-level programmer might encounter this. - -Twofish is the slowest of the ciphers present. - -_We might try to find a faster implementation._ - -### AES - -AES uses the standard way of an IV but it does not neccessarily transmit the full IV along with the packets. The size of the transmitted part is adjustable by changing the `TRANSOP_AES_IV_SEED_SIZE` definition found in `src/transform_aes.c`. It defaults to 8 meaning that 8 bytes (of max 16) are transmitted. The remaining 8 bytes are fixed, key-derived material is used to fill up to full block size. A single AES-ECB encryption step is applied to these 16 bytes before they get used as regular IV for AES-CBCing the payload. - -Padding to the last block happens by filling `0x00`-bytes and indicating their number as the last byte of the block. This could lead to up to 16 extra bytes. - -AES relies on openSSL's `evp_*` interface which also offers hardware acceleration where available (SSE, AES-NI, …). It however is slower than the following stream ciphers because the CBC mode cannot compete with the optimized stream ciphers. - -_Perhaps, AES-CTR being a stream cipher could have competed with the stream ciphers._ - -_Another possible extension would be to bring CTS mode to AES in some future version, just to avoid unneccessary weight gains from padding. CTS mode works well starting with plain texts from one block plus. So, we might revert back to the Twofish-way of IV handling with a full block IV._ - -### ChaCha20 - -ChaCha20 was the first stream cipher supported by n2n. - -It also relies on openSSL's `evp_*` interface. It does not use the Poly1305 message tag from the same author though. Whole packet's checksum will be handled in the header (see below). - -The random full 128-bit IV is transmitted in plain. - -ChaCha20 usually performs faster than AES-CBC. - -### SPECK - -SPECK is recommended by the NSA for offical use in case AES implementation is not feasible due to system constraints (performance, size, …). The block cipher is used in CTR mode making it a stream cipher. The random full 128-bit IV is transmitted in plain. - -On Intel CPUs, SPECK performs even faster than openSSL's ChaCha20 as it takes advantage of SSE4 or AVX2 if available (compile using `-march=native`). On Raspberry's ARM CPU, it is second place behind ChaCha20 and before AES-CBC. - -### Random Numbers - -Throughout n2n, pseudo-random numbers are generated for several purposes, e.g. random MAC assignment and the IVs for use with the various ciphers. Regarding IVs, especially for using in the stream ciphers, the pseudo-random numbers shall be as collision-free as possible. n2n uses an implementation of XORSHIFT128+ which shows a periodicity of 2¹²⁸. - -Its initialization relies on seeding with a value as random as possible. Various sources are tapped including a syscall to Linux' `SYS_getrandom` as well as Intels hardware random number generators `RDRND` and `RDSEED`, if available (compile using `-march=native`). - -### Pearson Hashing - -For general purpose hashing, n2n employs Pearson hashing as it offers variable hash sizes and is said not to be too "collidy". However, this is not a cryptographically secure hashing function which by the way is not required here: The hashing is never applied in a way that the hash shall prove the knowledge of a secret without showing the secret. - -_Pearson hashing is tweakable by making your own permutation of the 256 byte table._ - -_Pearson hashing allows verification of parts of the hash only – just in case performance requirements would urge to do so._ - -## Header - -### Overview - -Packet's header consist of a COMMON section followed by a packet-type specific section, e.g. REGISTER, REGISTER_ACK, PACKET including the payload, REGISTER_SUPER, … - -The COMMON section is built as follows: - -``` -0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! Version=2 ! TTL ! Flags ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! Community : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 ! ... Community ... ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -``` - -In case of a PACKET-type, it is succeeded by the fields depicted below: - -``` - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -20 ! Source MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -24 : ! Destination MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -28 : ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -32 ! Socket Flags (v=IPv4) ! Destination UDP Port ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -36 ! Destination IPv4 Address ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -40 ! Transform ID ! Payload ... ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + -44 ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+... -``` -### Encryption - -If enabled (`-H`), all fields but the payload (which is handled seperately as outlined above) get encrypted using SPECK in CTR mode. As packet headers need to be decryptable by the supernode and we do not want to add another key (to keep it a simple interface), the community name serves as key (keep it secret!) because it is already known to the supernode. The community name consists of up to 16 characters (well, 15 + `0x00`), so key size of 128 bit is a reasonable choice here. - -The scheme applied tries to maintain compatibility with current packet format and works as follows: - -- First line of 4 bytes (Version, TTL, Flags) goes to fifth line: -``` - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 ! ... Community ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 ! Version=2 ! TTL ! Flags ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -``` -- To be able to identify a correctly decrpyted header later on, a magic number is stamped in fourth line starting at byte number 12. We use "n2n" string and add the header length to be able to stop header decryption right before an eventually following payload begins – in case of PACKET-type, header-length does not equal packet-length. - -- The rest of the community field, namely the first 12 bytes, is reframed towards a 96-bit IV for the header encryption. -``` - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! IV ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! ... IV ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 ! ... IV : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 ! 24-bit Magic Number, "n2n" = 0x6E326E ! Header Length ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 ! Version=2 ! TTL ! Flags ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -``` - -- As we use a stream cipher, the IV should be a nonce. The IV plays an additional role sketched later, see the following sections on checksum and replay protection. For use in header encryption and decryption, four bytes reading ASCII "n2n!" are appended to the 96-bit IV hereby internally making it a full 128-bit IV. - -- To make a less predictable use of the key space – just think of the typically reset MSB of ASCII characters of community names – we actually use a hash of the community name as key. - -- Encryption starts at byte number 12 and ends at header's end. It does not comprise the payload which eventually has its own encryption scheme as chosen with the `-A_` options. - -Decryption checks all known communities (several in case of supernode, only one at edge) as keys. On success, the emerging magic number will reveal the correct community whose name will be copied back to the original fields allowing for regular packet handling. - -Thus, header encryption will only work with previously determined community names introduced to the supernode by `-c ` parameter. Also, it should be clear that header encryption is a per-community decision, i.e. all nodes and the supernode need to have it enabled. However, the supernode supports encrpyted and unencrypted communities in parallel, it determines their status online at arrival of the first packet. Use a fresh community name for encrypted communities; do not use a previously used one of former unecrpyted communities: their names were transmitted openly. - -### Checksum - -The whole packet including the eventually present payload is checksummed using a modified Person hashing. It might seem a little short compared to usual message tags of 96 up to 128 bit, especially when using a stream cipher which easily allows for bit-flips. So, the 16-bit checksum is filled up with 80 more bits to obtain a 96-bit pre-IV. This pre-IV gets encrypted using a single block-cipher step to get the pseudo-random looking IV. This way, the checksum resists targeted bit-flips (to header, payload, and IV) as any change to the whole 96-bit IV would render the header un-decryptable. - -The single block-cipher step employs SPECK because it is fast, always present as built-in and it offers a 96-bit version. The key is derived from the header key – a hash of the hash. - -The checksum gets verified by the edges and the supernode. - -### Replay Protection - -The aforementioned fill-up does not completely rely on random bits. A 52-bit time stamp displaying a microsecond-accuracy is encoded to the 96-bit pre-IV as well: - -``` - 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 - +------------------------------------------------------------------------------------------------+ - ! 52-bit time stamp with microsecond-accuracy ! 28 pseudo-random bits !16-bit checksum! - +------------------------------------------------------------------------------------------------+ - -``` -Encrypting this pre-IV with a block cipher step will generate a pseudo-random looking IV which gets written to the packet and used for the header encryption. - -Due to the time-stamp encoded, the IV will more likely be unique, close to a real nonce. - -Upon receival, the time stamp as well as the checksum can be extracted from the IV by performing a 96-bit block-cipher decryption step. Verification of the time stamp happens in two steps: - -- The (remote) time stamp is checked against the local clock. It may not deviate more than plus/minus 16 seconds. So, edges and supernode need to keep a somewhat current time. This limit can be adjusted by changing the `TIME_STAMP_FRAME` definition. It is time-zone indifferent as UTC is used. - -- Valid (remote) time stamps get stored as "last valid time stamp" seen from each node (supernode and edges). So, a newly arriving packet's time stamp can be compared to the last valid one. It should be equal or higher. However, as UDP packets may overtake each other just by taking another path through the internet, they are allowed to be 160 millisecond earlier than the last valid one. This limit can be adjusted by changing the `TIME_STAMP_JITTER` definition. - -The way the IV is used for replay protection and for checksumming makes enabled header encryption a prerequisite for these features. diff --git a/bundles/n2n_ntop_v2/doc/HACKING b/bundles/n2n_ntop_v2/doc/HACKING deleted file mode 100644 index 8b04ed1d..00000000 --- a/bundles/n2n_ntop_v2/doc/HACKING +++ /dev/null @@ -1,267 +0,0 @@ -file: HACKING - -Last updated: 2010-01-01 09:55 UTC - --------- -(C) 2008-2010 - Richard Andrews - -This program and document is free software; you can redistribute -it and/or modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not see see - --------- - - -This file describes the internals of n2n. Read this before starting to modify -the code. Because coding examples may be present in this document it is licensed -under the GPL rather than FDL. - - -SYMMETRIC NAT -------------- - -Symmetric NAT is a form of firewall NAT in which an UDP packets are only passed -back to an inside host socket when the return packets originate from the outside -socket to which the initiating UDP packets were sent. This means that when an -inside host sends UDP to some outside socket; other hosts cannot piggyback on -this opening in the firewall to send data to the inside host. - -For example, an asymmetric NAT would keep the mapping: - -> -and would redirect all the packets on external port ExtPort to the internal host -regardless of the remote IP. - -Whereas a symmetric NAT would keep the mapping: - -> -so only RemoteIP can send packets to the internal host. RemoteIP is the supernode -IP in case of n2n, to which the internal host has registered. - -In n2n, P2P can work monodirecitonally if only one of the two peers is behind a symmetric -NAT. For example, if A is behind symmetric NAT and B is behind asymmetric NAT - - A->B packets are P2P (will have the B public IP as destination) - - B->A packets must go through the supernode - -If both the peers are behind symmetric NAT, then no P2P communication is possible. - -ARP CACHE ---------- - -n2n makes use of the host operating system's own ARP cache. Each edge node -allocates a random MAC address to itself. This MAC is constant for the life of -the edge process. ARP packets are passed around as broadcast ethernet packets -over n2n and these packets cause the native ARP cache to be updated. - -Edge nodes send gratuitous ARP packets on startup. See GRATUITOUS ARP below. - - -REGISTRATION AND PEER-TO-PEER COMMUNICATION SETUP -------------------------------------------------- - -A and B are edge nodes with public sockets Apub and Bpub; and private network -addresses A and B respectively. S is the supernode. - -A sends {REGISTER,Amac} to S. S registers {Amac->Apub}. -B sends {REGISTER,Bmac} to S. S registers {Bmac->Bpub}. - -Now ping from A to B. - -A sends broadcast "arp who-has B" to S. S relays the packet to all known edge -nodes. B replies "B at Bmac" to supernode which forwards this to A. So now ping -A->B is known to be ping Amac(A)->Bmac(B). Note: gratuitous arp also requires -discussion. - -In response to receiving the arp reply, Apub sends {REGISTER,Amac} to Bpub. If -Bpub receives the request it sends back {REGISTER_ACK,Amac} and also sends its -own {REGISTER,Bmac} request. - -In response to receiving the "arp who-has", Bpub sends {REGISTER,Bmac} to Apub. - -Now the OS has received the arp reply and sends ICMP to Bmac(B) via the tunnel -on A. A looks up Bmac in the peers list and encapsulates the packet to Bpub or -the supernode if the MAC is not found. - -We assume that between two edge nodes, if Bpub receives a packet from Apub then -Apub can receive a packet from Bpub. This is the symmetric NAT case. Note: In -the symmetric NAT case, the public socket for a MAC address will be different -for direct contact when compared to information from the supernode. - -When two edge nodes are both behind symmetric NAT they cannot establish direct -communication. - -If A receives {REGISTER,Bmac} from B, A adds {Bmac->Bpub} to its peers list -knowing that Bmac is now reachable via that public socket. Similarly if B -receives {REGISTER,Amac} from A. - -The supernode never forwards REGISTER messages because the public socket seen by -the supervisor for some edge (eg. A) may be different to the socket seen by -another edge due to the actions of symmetric NAT (alocating a new public socket -for the new outbound UDP "connection"). - - -EDGE REGISTRATION DESIGN AMMENDMENTS (starting from 2008-04-10) ------------------------------------- - - * Send REGISTER on rx of PACKET or REGISTER only when dest_mac == device MAC -(do not send REGISTER on Rx of broadcast packets). - * After sending REGISTER add the new peer to pending_peers list; but - * Don't send REGISTER to a peer in pending_peers list - * Remove old entries from pending_peers at regular intervals - * On rx of REGISTER_ACK, move peer from pending_peers to known_peers for direct -comms and set last_seen=now - * On rx of any packet set last_seen=now in the known_peers entry (if it -exists); but do not add a new entry. - * If the public socket address for a known_peers entry changes, deleted it and -restart registration to the new peer. - * Peer sockets provided by the supernode are ignored unless no other entry -exists. Direct peer-to-peer sockets are always given more priority as the -supernode socket will not be usable for direct contact if the peer is behind -symmetric NAT. - - -The pending_peers list concept is to prevent massive registration traffic when -supernode relay is in force - this would occur if REGISTER was sent for every -incident packet sent via supernode. Periodic REGISTER attempts will still occur; -not for every received packet. In the case where the peer cannot be contacted -(eg. both peers behind symmetric NAT), then there will still be periodic -attempts. Suggest a pending timeout of about 60 sec. - -A peer is only considered operational for peer-to-peer sending when a -REGISTER_ACK is returned. Once operational the peer is kept operational while -any direct packet communications are occurring. REGISTER is not required to -keep the path open through any firewalls; just some activity in one direction. - -After an idle period; the peer should be deleted from the known_peers list. We -should not try to re-register when this time expires. If there is no data to -send then forget the peer. This helps scalability. - -If a peer wants to be remembered it can send gratuitous ARP traffic which will -keep its entry in the known_peers list of any peers which already have the -entry. - - - - -peer = find_by_src_mac( hdr, known_peers ); /* return NULL or entry */ - -if ( peer ) -{ - peer_last_seen = time(NULL); -} -else -{ - if ( ! is_broadcast( hdr ) ) /* ignore broadcasts */ - { - if ( IS_REGISTER_ACK( hdr ) ) - { - /* move from pending to known_peers */ - set_peer_operational( hdr ); - } - else - { - /* add to pending and send REGISTER - ignore if in pending. */ - try_send_register( hdr ) - } - } -} - - -(Notes): - - * In testing it was noted that if a symmetric NAT firewall shuts down the UDP -association but the known_peers registration is still active, then the peer -becomes unreachable until the known_peers registration is deleted. Suggest two -ways to mitigate this problem: - (a) make the known_peers purge timeout a config paramter; - (b) send packets direct and via supernode if the registration is older than - eg. 60 sec. - - -GRATUITOUS ARP --------------- - -In addition to the ARP who-has mechanism noted above, two edge nodes can become -aware of one another by gratuitous ARP. A gratuitous ARP packet is a broadcast -packet sent by a node for no other purpose than to announce its presence and -identify its MAC and IP address. Gratuitous ARP packets are to keep ARP caches -up to date so contacting the host will be faster after an long idle time. - - -MAN PAGES ---------- - -Look at a non-installed man page like this (linux/UNIX): - -nroff -man edge.8 | less - - -PACKET message FORMAT ---------------------- - -All message encoding and decoding is contained in wire.c. The PACKET message is -of main concern as it is the most frequently transferred as it contains -encapsulated ethernet packets. - -Version 2 - - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! Version=2 ! TTL ! Flags ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! Community : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 ! ... Community ... ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -20 ! Source MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -24 : ! Destination MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -28 : ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -32 ! Socket Flags (v=IPv4) ! Destination UDP Port ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -36 ! Destination IPv4 Address ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -40 ! Transform ID ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -44 ! Payload - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -So each n2n PACKET has a 44 byte overhead. For a 1500 byte ethernet packet this -is roughly 3%. - -Socket flags provides support for IPv6. In this case the PACKET message ends as -follows: - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -32 ! Socket Flags (v=IPv6) ! Destination UDP Port ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -36 ! Destination IPv6 Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -40 : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -44 : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -48 : ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -52 ! Transform ID ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -56 ! Encapsulated ethernet payload - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -------- - -January 2010 - Richard Andrews diff --git a/bundles/n2n_ntop_v2/doc/IPv6.md b/bundles/n2n_ntop_v2/doc/IPv6.md deleted file mode 100644 index b32b5e0e..00000000 --- a/bundles/n2n_ntop_v2/doc/IPv6.md +++ /dev/null @@ -1,25 +0,0 @@ -# IPv6 - -n2n supports the carriage of IPv6 packets within the n2n tunnel. N2n does not -yet use IPv6 for transport between edges and supernodes. - -To make IPv6 carriage work you need to manually add IPv6 addresses to the TAP -interfaces at each end. There is currently no way to specify an IPv6 address on -the edge command line. - -Eg. under linux: - -on hostA: -`[hostA] $ /sbin/ip -6 addr add fc00:abcd:1234::7/48 dev n2n0` - -on hostB: -`[hostB] $ /sbin/ip -6 addr add fc00​:abcd:​1234::6/48 dev n2n0` - -You may find it useful to make use of tunctl from the uml-utilities -package. Tunctl allow you to bring up a TAP interface and configure addressing -prior to starting edge. It also allows edge to be restarted without the -interface closing (which would normally affect routing tables). - -Once the IPv6 addresses are configured and edge started, IPv6 neighbor discovery -packets flow (get broadcast) and IPv6 entities self arrange. Test your IPv6 -setup with ping6 - the IPv6 ping command. diff --git a/bundles/n2n_ntop_v2/doc/MTU.md b/bundles/n2n_ntop_v2/doc/MTU.md deleted file mode 100644 index 05fb6fc3..00000000 --- a/bundles/n2n_ntop_v2/doc/MTU.md +++ /dev/null @@ -1,54 +0,0 @@ -# MTU - -The MTU of the VPN interface is set to a lower value (rather than the standard -1500 B value) to avoid excessive fragmentation on the datagram sent on internet. -This is required because n2n adds additional headers to the packets received from -the VPN interface. The size of the final frame sent through the internet interface -must have a size <= the internet interface MTU (usually 1500 B). - -As a fragmentation example, suppose that a 3000 B TCP segment should be sent through -the VPN. If the VPN interface MTU is set to 1500, the packet will be split into two -fragments of 1500 B each. However, n2n will add its headers to each fragment, so -each fragment becomes a 1540 B packet. The internet interface mtu, which is 1500 B, -will fragment each packet again in two further fragments (e.g. 1500 + 50 B), so a -total of 4 fragments will be sent over internet. On the other hand, if the VPN interface -MTU was set to 1460 that would result in only 3 fragments sent as the initial segment of -3000 would be split in 1460 + 1460 + 80 B and that would not be further fragmented. - -IP packet fragmentation in general is something to avoid, as described in -http://www.hpl.hp.com/techreports/Compaq-DEC/WRL-87-3.pdf . When possible, -the fragmentation should be moved to the TCP layer by a proper MSS value. -This can be forced by mangling the packet MSS, which is called "MSS clamping" (currently not -implemented in n2n). See https://github.com/gsliepen/tinc/blob/228a03aaa707a5fcced9dd5148a4bdb7e5ef025b/src/route.c#L386 . - -The exact value to use as a clamp value, however, depends on the PMTU, which is the minimum -MTU of the path between two hosts. Knowing the PMTU is also useful for a sender in order to -avoid fragmentation at the IP level. Trying to find the biggest MTU is useful since it allows to -maximize bandwidth. - -## PMTU Discovery Failures - -Most operating systems try to periodically discover the PMTU by using a PMTU discovery algorithm. -This involves setting the DF (don't fragment) flag on the IP packets. When a large IP packet exceeds -the MTU of a router in the path, an "ICMP Fragmentation Needed" message should be received, which will -help the OS tune the size of the next IP packets. However, some routers do not report such ICMP message, -which results in packets being silently dropped. The `tracepath` tool can be used to detect the PMTU. - -The main problem when this situation occurs is that the actual PMTU is unknown, so an automatic -solution is not applicable. The user must manually specify a lower MTU for the VPN interface -in order to solve the issue. - -## n2n and MTU - -n2n should work by default in different environments. For this reason, the following solution -has been provided: - -- PMTU discovery is disabled when possible (via the IP_MTU_DISCOVER socket option). This avoid - silently dropping a oversize packet due to the DF flag, however it possibly increments fragmentation on the path. -- As examplained above, a lower MTU is set on the VPN interface, thus removing excessive fragmentation on - the sender. -- 1400 B is used instead of 1500 B as the reference value for the internet interface MTU. - This essentially avoids fragmentation when the PMTU is >= 1400 B. - -This is a conservative solution which should make n2n work by default. The user can manually -specify the MTU and re-enable PMTU discovery via the CLI options. diff --git a/bundles/n2n_ntop_v2/doc/Routing.md b/bundles/n2n_ntop_v2/doc/Routing.md deleted file mode 100644 index 8f278ea6..00000000 --- a/bundles/n2n_ntop_v2/doc/Routing.md +++ /dev/null @@ -1,188 +0,0 @@ -# IPv4 Routing (Linux) - -## General Remarks - -Reaching a remote network or tunneling all the internet traffic via n2n are two common tasks which require a proper routing setup. n2n supports routing needs providing options for packet forwarding including broadcasts as well as modifying the routing table. - -In this context, the `server` is the edge node which provides access to the remote network/internet, whereas the `client` is the connecting edge node. - -In order to enable routing, the `server` must be configured as follows: - -1. Add the `-r` option to the edge options to enable routing -2. Enable packet forwarding with `sudo sysctl -w net.ipv4.ip_forward=1` -3. Enable IP masquerading: `sudo iptables -t nat -A POSTROUTING -j MASQUERADE` - -On the client side, the easiest way to configure routing is via the `-n` option. For example: - -- In order to connect to the remote network `192.168.100.0/24`, use `-n 192.168.100.0/24:10.0.0.1` -- In order to tunnel all the internet traffic, use `-n 0.0.0.0/0:10.0.0.1` - -10.0.0.1 is the IP address of the gateway to use to route the specified network. It should correspond to the IP address of the `server` within n2n. Multiple `-n` options can be specified. - -As an alternative to the `-n` option, the `ip route` linux command can be manually used. See the [n2n_gateway.sh](doc/n2n_gateway.sh) script for an example. See also the follwing description of other use cases and in depth explanation. - -## Special Scenarios - -### Assumptions - -- There are two Local Area Networks, namely 10.11.12.0/24 (maybe at - **h**ome) and 192.168.1.0/24 (maybe in **o**ffice). -- These networks are connected to the internet via routers 10.11.12.1 - and 192.168.1.1, respectively. -- In each network, there is a computer running a successfully setup n2n - node: 10.11.12.5 (**h**ickory) and 192.168.1.6 (**o**scar). They are - connected to their networks through a device called _eth0_. Their n2n - devices shall be called _n2n0_, and their n2n IP addresses are - 10.99.99.50 (**h**ickory) and 10.99.99.60 (**o**scar) in the - 10.99.99.0/24 network. -- The _iptables_ are flushed. - -### Prerequisites - -- Both, **h**ickory and **o**scar have ip forwarding enabled: `echo 1 > /proc/sys/net/ipv4/ip_forward` or `sysctl -w net.ipv4.ip_forward=1`. To - make this setting persistent over reboot, a file containing the line - `net.ipv4.ip_forward=1` could be added in /etc/sysctl.d/ – your distro - may vary. -- To allow n2n to forward packets, both edge nodes need to be started - with `-r` option on their command line. All other regular network - interfaces usually already allow packet forwarding and thus do not need - any further configuration. - -### Reach Complete Office Network from n2n Node at Home - -- To make **h**ickory send all packets with office destination via - **o**scar, **h**ickory needs to be made aware of where to route this - packets to. On **h**ickory: `ip route add 192.168.1.0/24 via 10.99.99.60 dev n2n0 src 10.11.12.5`. -- **o**scar needs to know where to send packets to, too. So, on - **o**scar: `ip route add 10.11.12.5 via 10.99.99.50 dev n2n0 src 192.168.1.6`. - -**o**scar and **h**ickory should now be able to exchange packets by -using just their regular (non-n2n) IP addresses 10.11.12.5 and 192.168.1.6. -To make the complete office network aware of how packets or answers are -sent to **h**ickory, one more step is required: - -- Packets from any office computer to **h**ickory need to be directed to - **o**scar that – thanks to enabled IP forwarding and the routing rule – - already knows how to handle this kind of packets. - - To handle it in a one-stop-shop, the office router 192.168.1.1 can - be configured to direct those packets to **o**scar. Luckily, even most - modern small-office-and-home routers allow to add static routing rules - via a web interface. A rule like "All packets for host 10.11.12.5 (or - network 10.11.12.0/24) need to be sent to another router, namely - 192.168.1.5" will do. This is the **recommended** solution. - - However, a **less recommended** but working option would be to add - static routes to each single of those computers in the office network - that shall be able to connect to or be accessed by **h**ickory. On - those, e.g. **o**livia with IP address 192.168.1.123: `ip route add 10.11.12.5 via 192.168.1.5 dev eth0 src 192.168.1.123`. - - Alternatively, in case the office router does not allow to have - added own static routing rules, **o**scar needs to perform NAT for all - connections initiated from **h**ickory: - `iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE` - `iptables -A FORWARD -i eth0 -o n2n0 -m state --state RELATED,ESTABLISHED -j ACCEPT` - `iptables -A FORWARD -i n2n0 -o eth0 -j ACCEPT` - There is a major drawback with this solution which thus is the **least - recommended**: Connections between **h**ickory and the office network - will only work if initiated by **h**ickory – not the other way 'round. - By the way, in case _iptables_ are messed up, they can be flushed by: - `iptables -F` - `iptables -X` - `iptables -t nat -F` - `iptables -t nat -X` - `iptables -t mangle -F` - `iptables -t mangle -X` - `iptables -t raw -F` - `iptables -t raw -X` - `iptables -t security -F` - `iptables -t security -X` - `iptables -P INPUT ACCEPT` - `iptables -P FORWARD ACCEPT` - `iptables -P OUTPUT ACCEPT` - -### Reach n2n Node in Office from Whole Home Network - -This is easy: - -- Just exchange home and office IP addresses and the computer names in - the instructions given above. - -### Reach Whole Home Network from Whole Office Network - -This is not too complicated either. Basically, follow the given example -above and apply the following changes: - -- The instructions used above need to be expanded from **h**ickory's IP - 10.11.12.5 to its full network 10.11.12.0/24 in the route commands on - **o**scar:, especially: `ip route add 10.11.12.0/24 via 10.99.99.50 dev n2n0 src 192.168.1.6`. -- In case of adding a static route to the office network router - 192.168.1.1, the home network 10.11.12.0/24 must be specified instead of - **h**ickory's more specific IP address 11.11.12.5. Same for the less - recommended static routes on other office computers. -- Packets from home network's computers to the office network need to be - sent through the n2n tunnel. The three alternatives given above can be - used just with exchanged office and home IP addresses. One needs to be - aware that NAT only (third alternative) on both sides will not allow any - connection, i.e. at least on one side static routes need to be added - either to the router (best option) or all those computers that shall be - able to connect to the other network. - -### Route All Internet Traffic from n2n Node at Home through Office Network - -This scenario could be considered a n2n-tunneled VPN connection which -also would work for travelling users on their laptop. All external -internet traffic will appear to originate from **o**scar and the office -network. - -- First, one of the setups described above needs to be in place, with - the following change: -- NAT on **o**scar (see the three _iptables_ commands above) must be - enabled. It will not work without because the office router 192.168.1.1 - usually denies forwarding to packets not originating from its own - network. It could be in addition to the eventually installed static - routes for 10.11.12.0/24 in the router 192.168.1.1 or on other office - computers – it will not interfere. However, **o**scar definitely needs - the route given above: `ip route add 10.11.12.5 via 10.99.99.50 dev n2n0 src 192.168.1.6`. -- To have **h**ickory's complete internet traffic going through the n2n - tunnel, its default route needs to be changed: - `ip route del default` - `ip route add default via 10.99.99.60 dev n2n0 src 10.11.12.5` - -- **h**ickory's home network should still be reachable as usually, - _eth0_ and the associated network 10.11.12.0/24 get their very own - route. If not, i.e. it was only covered by default route before, it - needs to be added: `ip route add 10.11.12.0/24 dev eth0 src 10.11.12.5`. -- Unfortunately (unless the supernode is on **h**ickory's local - network), n2n supernode becomes unreachable for **h**ickory. To fix it: - `ip route add via 10.11.12.1 dev eth0 src 10.11.12.5` - -The supernode's IP address needs to be known to have this work. However, -if the supernode's IP needs to be resolved from some domain name (FQDN), -e.g. in case of using dynamic domain name services, a DNS server needs -to remain reachable, too. Either the reachable home network router -10.11.12.1 is good enough for that (if it offers DNS) or another route -could to be added and **h**ickory's DNS settings might be set -accordingly, maybe to Google's 8.8.8.8. - -If [DNS leaks](https://en.wikipedia.org/wiki/DNS_leak) do not matter, -this setup is complete. - -### Preventing DNS Leaks - -Otherwise, there is more to it: Without changes, all future DNS queries -go through the home router 10.11.12.1 to the ISP's servers or directly -to Google (via the home router 10.11.12.1 along the configured route for -8.8.8.8 and not through the n2n tunnel) while the remaining traffic -ships through the n2n tunnel. - -To prevent such a DNS leak, the supernode's IP address must be -determined independently from **h**ickory's DNS configuration, e.g. by -digesting `dig +short mysupernode.myfavoritednsservice.com @8.8.8.8`'s -output in the n2n-edge's setup script for both, the edge node command -line as well as the static route mentioned above. Without further -additional work, dynamic address changes remain undetected. A static -route to 8.8.8.8 is still required. **h**ickory's regular DNS -configuration should query a different DNS server for its regular DNS -needs, e.g. 9.9.9.9 or 1.1.1.1 or maybe the office DNS server, maybe -192.168.1.1. This guarantees the regular DNS queries also to get sent -through the n2n tunnel. - -A test for DNS leaks can be found [here](https://www.dnsleaktest.com/). diff --git a/bundles/n2n_ntop_v2/doc/Windows.md b/bundles/n2n_ntop_v2/doc/Windows.md deleted file mode 100644 index 5edf60a9..00000000 --- a/bundles/n2n_ntop_v2/doc/Windows.md +++ /dev/null @@ -1,73 +0,0 @@ -# Build on Windows - -## Requirements - -In order to build on Windows the following tools should be installed: - -- Visual Studio. For a minimal install, the command line only build tools can be - downloaded and installed from https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017 -- Cmake -- (optional) The OpenSSL library. Prebuild binaries can be downloaded from https://slproweb.com/products/Win32OpenSSL.html . - The full version is required (not the "Light" version). The Win32 version of it is usually required for a standard build. - - NOTE: in order to skip OpenSSL compilation, edit CMakeLists.txt and replace - - ```plaintext - OPTION(N2N_OPTION_AES "USE AES" ON) - with - OPTION(N2N_OPTION_AES "USE AES" OFF) - ``` - - NOTE: to static link OpenSSL, add the `-DOPENSSL_USE_STATIC_LIBS=true` option to the cmake command - -In order to run n2n: - -- The TAP drivers should be installed into the system. They can be installed from - http://build.openvpn.net/downloads/releases (search for "tap-windows") -- If OpenSSL has been linked dynamically, the corresponding .dll file should be available - into the target computer - -## Build (CLI) - -In order to build from the command line, open a terminal window and run the following commands: - -```batch -md build -cd build -cmake .. - -MSBuild edge.vcxproj /t:Build /p:Configuration=Release -MSBuild supernode.vcxproj /t:Build /p:Configuration=Release -``` - -NOTE: if cmake has problems finding the installed OpenSSL library, try to download the official cmake and invoke it with: -`C:\Program Files\CMake\bin\cmake` - -The compiled exe files should now be available under the Release directory. - -## Run - -The `edge.exe` program reads the `edge.conf` file located into the current directory if no option is provided. - -Here is an example `edge.conf` file: - -```plaintext --c=mycommunity --k=mysecretkey - -# supernode IP address --l=1.2.3.4:5678 - -# edge IP address --a=192.168.100.1 -``` - -The `supernode.exe` program reads the `supernode.conf` file located into the current directory if no option is provided. - -Here is an example `supernode.conf` file: - -```plaintext --l=5678 -``` - -See `edge.exe --help` and `supernode.exe --help` for a list of supported options. diff --git a/bundles/n2n_ntop_v2/doc/macOS.md b/bundles/n2n_ntop_v2/doc/macOS.md deleted file mode 100644 index f3c610e6..00000000 --- a/bundles/n2n_ntop_v2/doc/macOS.md +++ /dev/null @@ -1,12 +0,0 @@ -# n2n on macOS - -In order to use n2n on macOS, you first need to install support for TUN/TAP interfaces: - -```bash -brew tap homebrew/cask -brew cask install tuntap -``` - -If you are on a modern version of macOS (i.e. Catalina), the commands above will ask you to enable the TUN/TAP kernel extension in System Preferences → Security & Privacy → General. - -For more information refer to vendor documentation or the [Apple Technical Note](https://developer.apple.com/library/content/technotes/tn2459/_index.html). diff --git a/bundles/n2n_ntop_v2/doc/n2n_gateway.sh b/bundles/n2n_ntop_v2/doc/n2n_gateway.sh deleted file mode 100644 index 2bf4b843..00000000 --- a/bundles/n2n_ntop_v2/doc/n2n_gateway.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# -# This is a sample script to route all the host traffic towards a remote -# gateway, which is reacheable via the n2n virtual interface. -# -# This assumes the n2n connection is already been established and the -# VPN gateway can be pinged by this host. -# - -####################################################### -# CONFIG -####################################################### - -# The IP address of the gateway through the n2n interface -N2N_GATEWAY="192.168.100.1" - -# The IP address of the supernode as configured in n2n -N2N_SUPERNODE="1.2.3.4" - -# The n2n interface name -N2N_INTERFACE="n2n0" - -# The DNS server to use. Must be a public DNS or a DNS located on the -# N2N virtual network, otherwise DNS query information will be leaked -# outside the VPN. -DNS_SERVER="8.8.8.8" - -####################################################### -# END CONFIG -####################################################### - -if [[ $UID -ne 0 ]]; then - echo "This script must be run as root" - exit 1 -fi - -if ! ip route get $N2N_GATEWAY | grep -q $N2N_INTERFACE ; then - echo "Cannot reach the gateway ($N2N_GATEWAY) via $N2N_INTERFACE. Is edge running?" - exit 1 -fi - -# Determine the current internet gateway -internet_gateway=`ip route get 8.8.8.8 | head -n1 | awk '{ print $3 }'` - -# Backup the DNS resolver configuration and use the specified server -cp /etc/resolv.conf /etc/resolv.conf.my_bak -echo "Using DNS server $DNS_SERVER" -echo "nameserver $DNS_SERVER" > /etc/resolv.conf - -# The public IP of the supernode must be reachable via the internet gateway -# Whereas all the other traffic will go through the new VPN gateway. -ip route add $N2N_SUPERNODE via $internet_gateway -ip route del default -echo "Forwarding traffic via $N2N_GATEWAY" -ip route add default via $N2N_GATEWAY - -function stopService { - echo "Deleting custom routes" - ip route del default - ip route del $N2N_SUPERNODE via $internet_gateway - - echo "Restoring original gateway $internet_gateway" - ip route add default via $internet_gateway - - echo "Restoring original DNS" - mv /etc/resolv.conf.my_bak /etc/resolv.conf - - exit 0 -} - -# setup signal handlers -trap "stopService" SIGHUP SIGINT SIGTERM - -# enter wait loop -echo "VPN is now up" -while :; do sleep 300; done diff --git a/bundles/n2n_ntop_v2/doc/new-features.md b/bundles/n2n_ntop_v2/doc/new-features.md deleted file mode 100644 index b3e051cc..00000000 --- a/bundles/n2n_ntop_v2/doc/new-features.md +++ /dev/null @@ -1,4 +0,0 @@ -# New Features between 2.0.x and 2.1.x - -- Better ming Windows build support. -- Added `-E` flag to allow multicast ethernet traffic. diff --git a/bundles/n2n_ntop_v2/doc/rpm-packaging.md b/bundles/n2n_ntop_v2/doc/rpm-packaging.md deleted file mode 100644 index b671a7f1..00000000 --- a/bundles/n2n_ntop_v2/doc/rpm-packaging.md +++ /dev/null @@ -1,11 +0,0 @@ -# RPM Packaging - -```bash -./autogen.sh -./configure -make - -cd packages/rpm -./configure -rpmbuild -bb ./n2n.spec -``` diff --git a/bundles/n2n_ntop_v2/edge.8 b/bundles/n2n_ntop_v2/edge.8 deleted file mode 100644 index 2e112c5a..00000000 --- a/bundles/n2n_ntop_v2/edge.8 +++ /dev/null @@ -1,234 +0,0 @@ -.TH edge 8 "17 Mar 2010" "n2n-2.1" "SUPERUSER COMMANDS" -.SH NAME -edge \- n2n edge node daemon -.SH SYNOPSIS -.B edge -[\-d ] \-a \-c {\-k |\-K } -[\-s ] \-l [\-L ] -[\-p ] [\-u ] [\-g ] [-f] [\-m ] [\-r] [\-v] -.SH DESCRIPTION -N2N is a peer-to-peer VPN system. Edge is the edge node daemon for n2n which -creates a TAP interface to expose the n2n virtual LAN. On startup n2n creates -the TAP interface and configures it then registers with the supernode so it can -begin to find other nodes in the community. -.PP -.SH OPTIONS -.TP -\-d -sets the TAP device name as seen in ifconfig. Only available on Linux. -.TP -\-a {|static:|dhcp:0.0.0.0} -sets the n2n virtual LAN IP address being claimed. This is a private IP -address. All IP addresses in an n2n community typical belong to the same /24 -network (ie. only the last octet of the IP addresses varies). If DHCP is used to -assign interface addresses then specify the address as -.B -a dhcp:0.0.0.0 -.TP -\-b -cause edge to perform hostname resolution for the supernode address each time -the supernode is periodically contacted. This can cause reliability problems -because all packet processing stops while the supernode address is resolved -which might take 15 seconds. -.TP -\-c -sets the n2n community name. All edges within the same community appear on the -same LAN (layer 2 network segment). Community name is 16 bytes in length. A name -smaller than this is padded with 0x00 bytes and a name longer than this is -truncated to take the first 16 bytes. -.TP -\-h -write usage then exit. -.TP -\-i -Supernode registration interval. It specifies the interval in seconds -between consecutive REGISTER_SUPER packets and it's used to keep NAT hole -open via the UDP NAT hole punching technique. This only works for asymmetric -NATs and allows for P2P communication. -.TP -\-k -sets the twofish encryption key from ASCII text (see also N2N_KEY in -ENVIRONMENT). All edges communicating must use the same key and community -name. If neither -k nor -K is used to specify a key source then edge uses -cleartext mode (no encryption). The -k and -K options are mutually exclusive. -.TP -\-K -Reads a key-schedule file and populates the internal transform -operations with the data found there. This mechanism allows keys to roll at -pre-determined times for a group of hosts. Accurate time synchronisation is not -required as older keys can be decoded for some time after expiry. If neither -k -nor -K is used to specify a key source then edge uses cleartext mode (no -encryption). The -k and -K options are mutually exclusive. -.TP -\-l : -sets the n2n supernode IP address and port to register to. Up to 2 supernodes -can be specified by two invocations of -l :. eg. -.B edge -l 12.34.56.78:7654 -l 98.76.54.32:7654 -. -.TP -\-p -binds edge to the given UDP port. Useful for keeping the same external socket -across restarts of edge. This allows peer edges which know the edge socket to -continue p2p operation without going back to the supernode. -.TP -\-t -binds the edge management system to the given UDP port. Default 5644. Use this -if you need to run multiple instance of edge; or something is bound to that -port. -.TP -\-u -causes the edge process to drop to the given user ID when privileges are no -longer required (UNIX). -.TP -\-g -causes the edge process to drop to the given group ID when privileges are no -longer required (UNIX). -.TP -\-f -disables daemon mode (UNIX) and causes edge to run in the foreground. -.TP -\-m -start the TAP interface with the given MAC address. This is highly recommended -as it means the same address will be used if edge stops and restarts. If this is -not done, the ARP caches of all peers will be wrong and packets will not flow to -this edge until the next ARP refresh. -.TP -\-M -set the MTU of the edge interface in bytes. MTU is the largest packet fragment -size allowed to be moved throught the interface. The default is 1400. -.TP -\-s -set the netmask of edge interface in IPv4 dotted decimal notation. The default -is 255.255.255.0 (ie. /24). -.TP -\-r -enable IP packet forwarding/routing through the n2n virtual LAN. Without this -option, IP packets arriving over n2n are dropped if not for the -a (or -DHCP assigned) IP address of the edge interface. -.TP -\-E -accept packets destined for multicast ethernet MAC addresses. These addresses -are used in multicast ethernet and IPv6 neighbour discovery. If this option is -not present these multicast packets are discarded as most users do not need or -understand them. -.TP -\-L -set the TTL for the hole punching packet. This is an advanced flag to make -sure that the registration packet is dropped immediately when it goes out of -local nat so that it will not trigger some firewall behavior on target peer. -Actually, the registration packet is only expected to make local nat UDP hole -and is not expected to reach the target peer, see -https://tools.ietf.org/html/rfc5389. To achieve this, the flag should be set as -nat level + 1. For example, if we have 2 layer nat in local, we should set -L 3. -Usually we know exactly how much nat layers in local. -If we are not sure how much nat layers in local, we can use traceroute on -Linux to check. The following example shows a local single layer nat because on -second jump it shows a public ip address. In this case it should set -L 2. - -$ /usr/sbin/traceroute -w1 8.8.8.8 -traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets - 1 192.168.3.1 (192.168.3.1) 0.464 ms 0.587 ms 0.719 ms - 2 112.65.17.217 (112.65.17.217) 5.269 ms 7.031 ms 8.666 ms - -But this method does not always work due to various local network device policy. -.TP -\-v -more verbose logging (may be specified several times for more verbosity). -.SH ENVIRONMENT -.TP -.B N2N_KEY -set the encryption key so it is not visible on the command line -.SH EXAMPLES -.TP -.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:23 \-a 192.168.254.7 \-p 50001 \-l 123.121.120.119:7654 - -Start edge with TAP device n2n0 on community "mynetwork" with community -supernode at 123.121.120.119 UDP port 7654 and bind the locally used UDP port to -50001. Use "encryptme" as the single permanent shared encryption key. Assign MAC -address DE:AD:BE:EF:01:23 to the n2n interface and drop to user=99 and group=99 -after the TAP device is successfull configured. -.PP -Add the -f option to stop edge running as a daemon. -.PP -Somewhere else setup another edge with similar parameters, eg. - -.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:21 \-a 192.168.254.5 \-p 50001 \-l 123.121.120.119:7654 -.PP -Now you can ping from 192.168.254.5 to 192.168.254.7. -.PP -The MAC address (-m ) and virtual IP address (-a ) must be different -on all edges in the same community. - -.SH KEY SCHEDULE FILES -(See -.B n2n_v2(7) -for more details). - -The -K option reads a key schedule file. - -.B edge \-d n2n0 \-c mynetwork \-K /path/to/file \-u 99 \-g 99 \-m DE:AD:BE:EF:01:21 \-a 192.168.254.5 \-p 50001 \-l 123.121.120.119:7654 -.PP - -The key schedule file consists of line, one per key in the schedule. The purpose -of key schedules is to encourage regular changing of the encryption keys used by -a community. The file structure also allows for full binary keys to be specified -as compared to the ASCII keys allowed by the single key injection. Each key line -consists of the following: - -.B - - and are ASCII decimal values of the UNIX times during which the -key is valid. is the index of the transform that applies -to. is some text which is parsed by the transform module to derive the -key for that line. - -Supported values are: -.TP -2 = TwoFish - has the form _. eg. - -.B 1252327945 1252328305 2 602_3d7c7769b34b2a4812f8c0e9d87ce9 - -This specifies security association number 602 and a 16-octet key of numeric -value 0x3d7c7769b34b2a4812f8c0e9d87ce9. is a 32-bit unsigned integer which -is used to identify the encryption key to the receiver. The SA number is sent -unencrypted so the receiver may find the correct key from the key -schedule. is up to 16 octets although shorter keys are allowed. - -.TP -3 = AES-CBC - has the form _. Same rules as TwoFish. - -.SH CLEARTEXT MODE -If neither -.B -k -nor -.B -K -is specified then edge uses cleartext mode. In cleartext mode there is no -transform of the packet data it is simply encrypted. This is useful for -debugging n2n as packet contents can be seen clearly. - -To prevent accidental exposure of data, edge only enters cleartext mode when no -keying parameters are specified. In the case where keying parameters are -specified but no valid keys can be determined, edge exits with an error at -startup. If all keys become invalid while running, edge continues to encode -using the last key that was valid. - -.SH MANAGEMENT INTERFACE -Edge provides a very simple management system on UDP port 5644. Send a newline -to receive a status output. Send 'reload' to cause re-read of the -keyfile. Send 'stop' to cause edge to exit cleanly. - -.SH EXIT STATUS -edge is a daemon and any exit is an error. -.SH AUTHORS -.TP -Richard Andrews -andrews (at) ntop.org - n2n-1 maintainer and main author of n2n-2 -.TP -Luca Deri -deri (at) ntop.org - original author of n2n -.TP -Don Bindner -(--) - significant contributions to n2n-1 -.SH SEE ALSO -ifconfig(8) supernode(1) tunctl(8) n2n_v2(7) diff --git a/bundles/n2n_ntop_v2/include/edge_utils_win32.h b/bundles/n2n_ntop_v2/include/edge_utils_win32.h deleted file mode 100644 index c4efc742..00000000 --- a/bundles/n2n_ntop_v2/include/edge_utils_win32.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifndef _EDGE_UTILS_WIN32_H_ -#define _EDGE_UTILS_WIN32_H_ - -#ifdef WIN32 - -#define WIN32_LEAN_AND_MEAN - -#include -#include - - -/* Multicast peers discovery disabled due to https://github.com/ntop/n2n/issues/65 */ -#define SKIP_MULTICAST_PEERS_DISCOVERY - -struct tunread_arg { - n2n_edge_t *eee; - int *keep_running; -}; - -extern HANDLE startTunReadThread(struct tunread_arg *arg); - - -#endif /* WIN32 */ - -#endif /* _EDGE_UTILS_WIN32_H_ */ - diff --git a/bundles/n2n_ntop_v2/include/header_encryption.h b/bundles/n2n_ntop_v2/include/header_encryption.h deleted file mode 100644 index 9ed7eafe..00000000 --- a/bundles/n2n_ntop_v2/include/header_encryption.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -uint32_t packet_header_decrypt (uint8_t packet[], uint16_t packet_len, - char * community_name, he_context_t * ctx, - he_context_t * ctx_iv, - uint64_t * stamp, uint16_t * checksum); - -int32_t packet_header_encrypt (uint8_t packet[], uint8_t header_len, he_context_t * ctx, - he_context_t * ctx_iv, - uint64_t stamp, uint16_t checksum); - - -void packet_header_setup_key (const char * community_name, he_context_t ** ctx, - he_context_t ** ctx_iv); - diff --git a/bundles/n2n_ntop_v2/include/lzoconf.h b/bundles/n2n_ntop_v2/include/lzoconf.h deleted file mode 100644 index cc437f1e..00000000 --- a/bundles/n2n_ntop_v2/include/lzoconf.h +++ /dev/null @@ -1,417 +0,0 @@ -/* lzoconf.h -- configuration for the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __LZOCONF_H_INCLUDED -#define __LZOCONF_H_INCLUDED - -#define LZO_VERSION 0x2030 -#define LZO_VERSION_STRING "2.03" -#define LZO_VERSION_DATE "Apr 30 2008" - -/* internal Autoconf configuration file - only used when building LZO */ -#if defined(LZO_HAVE_CONFIG_H) -# include -#endif -#include -#include - - -/*********************************************************************** -// LZO requires a conforming -************************************************************************/ - -#if !defined(CHAR_BIT) || (CHAR_BIT != 8) -# error "invalid CHAR_BIT" -#endif -#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) -# error "check your compiler installation" -#endif -#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) -# error "your limits.h macros are broken" -#endif - -/* get OS and architecture defines */ -#ifndef __LZODEFS_H_INCLUDED -#include "lzodefs.h" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/*********************************************************************** -// some core defines -************************************************************************/ - -#if !defined(LZO_UINT32_C) -# if (UINT_MAX < LZO_0xffffffffL) -# define LZO_UINT32_C(c) c ## UL -# else -# define LZO_UINT32_C(c) ((c) + 0U) -# endif -#endif - -/* memory checkers */ -#if !defined(__LZO_CHECKER) -# if defined(__BOUNDS_CHECKING_ON) -# define __LZO_CHECKER 1 -# elif defined(__CHECKER__) -# define __LZO_CHECKER 1 -# elif defined(__INSURE__) -# define __LZO_CHECKER 1 -# elif defined(__PURIFY__) -# define __LZO_CHECKER 1 -# endif -#endif - - -/*********************************************************************** -// integral and pointer types -************************************************************************/ - -/* lzo_uint should match size_t */ -#if !defined(LZO_UINT_MAX) -# if defined(LZO_ABI_LLP64) /* WIN64 */ -# if defined(LZO_OS_WIN64) - typedef unsigned __int64 lzo_uint; - typedef __int64 lzo_int; -# else - typedef unsigned long long lzo_uint; - typedef long long lzo_int; -# endif -# define LZO_UINT_MAX 0xffffffffffffffffull -# define LZO_INT_MAX 9223372036854775807LL -# define LZO_INT_MIN (-1LL - LZO_INT_MAX) -# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */ - typedef unsigned int lzo_uint; - typedef int lzo_int; -# define LZO_UINT_MAX UINT_MAX -# define LZO_INT_MAX INT_MAX -# define LZO_INT_MIN INT_MIN -# elif (ULONG_MAX >= LZO_0xffffffffL) - typedef unsigned long lzo_uint; - typedef long lzo_int; -# define LZO_UINT_MAX ULONG_MAX -# define LZO_INT_MAX LONG_MAX -# define LZO_INT_MIN LONG_MIN -# else -# error "lzo_uint" -# endif -#endif - -/* Integral types with 32 bits or more. */ -#if !defined(LZO_UINT32_MAX) -# if (UINT_MAX >= LZO_0xffffffffL) - typedef unsigned int lzo_uint32; - typedef int lzo_int32; -# define LZO_UINT32_MAX UINT_MAX -# define LZO_INT32_MAX INT_MAX -# define LZO_INT32_MIN INT_MIN -# elif (ULONG_MAX >= LZO_0xffffffffL) - typedef unsigned long lzo_uint32; - typedef long lzo_int32; -# define LZO_UINT32_MAX ULONG_MAX -# define LZO_INT32_MAX LONG_MAX -# define LZO_INT32_MIN LONG_MIN -# else -# error "lzo_uint32" -# endif -#endif - -/* The larger type of lzo_uint and lzo_uint32. */ -#if (LZO_UINT_MAX >= LZO_UINT32_MAX) -# define lzo_xint lzo_uint -#else -# define lzo_xint lzo_uint32 -#endif - -/* Memory model that allows to access memory at offsets of lzo_uint. */ -#if !defined(__LZO_MMODEL) -# if (LZO_UINT_MAX <= UINT_MAX) -# define __LZO_MMODEL -# elif defined(LZO_HAVE_MM_HUGE_PTR) -# define __LZO_MMODEL_HUGE 1 -# define __LZO_MMODEL __huge -# else -# define __LZO_MMODEL -# endif -#endif - -/* no typedef here because of const-pointer issues */ -#define lzo_bytep unsigned char __LZO_MMODEL * -#define lzo_charp char __LZO_MMODEL * -#define lzo_voidp void __LZO_MMODEL * -#define lzo_shortp short __LZO_MMODEL * -#define lzo_ushortp unsigned short __LZO_MMODEL * -#define lzo_uint32p lzo_uint32 __LZO_MMODEL * -#define lzo_int32p lzo_int32 __LZO_MMODEL * -#define lzo_uintp lzo_uint __LZO_MMODEL * -#define lzo_intp lzo_int __LZO_MMODEL * -#define lzo_xintp lzo_xint __LZO_MMODEL * -#define lzo_voidpp lzo_voidp __LZO_MMODEL * -#define lzo_bytepp lzo_bytep __LZO_MMODEL * -/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */ -#define lzo_byte unsigned char __LZO_MMODEL - -typedef int lzo_bool; - - -/*********************************************************************** -// function types -************************************************************************/ - -/* name mangling */ -#if !defined(__LZO_EXTERN_C) -# ifdef __cplusplus -# define __LZO_EXTERN_C extern "C" -# else -# define __LZO_EXTERN_C extern -# endif -#endif - -/* calling convention */ -#if !defined(__LZO_CDECL) -# define __LZO_CDECL __lzo_cdecl -#endif - -/* DLL export information */ -#if !defined(__LZO_EXPORT1) -# define __LZO_EXPORT1 -#endif -#if !defined(__LZO_EXPORT2) -# define __LZO_EXPORT2 -#endif - -/* __cdecl calling convention for public C and assembly functions */ -#if !defined(LZO_PUBLIC) -# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL -#endif -#if !defined(LZO_EXTERN) -# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype) -#endif -#if !defined(LZO_PRIVATE) -# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL -#endif - -/* function types */ -typedef int -(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem, - const lzo_bytep dict, lzo_uint dict_len ); - -typedef int -(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem, - const lzo_bytep dict, lzo_uint dict_len ); - - -/* Callback interface. Currently only the progress indicator ("nprogress") - * is used, but this may change in a future release. */ - -struct lzo_callback_t; -typedef struct lzo_callback_t lzo_callback_t; -#define lzo_callback_p lzo_callback_t __LZO_MMODEL * - -/* malloc & free function types */ -typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t) - (lzo_callback_p self, lzo_uint items, lzo_uint size); -typedef void (__LZO_CDECL *lzo_free_func_t) - (lzo_callback_p self, lzo_voidp ptr); - -/* a progress indicator callback function */ -typedef void (__LZO_CDECL *lzo_progress_func_t) - (lzo_callback_p, lzo_uint, lzo_uint, int); - -struct lzo_callback_t -{ - /* custom allocators (set to 0 to disable) */ - lzo_alloc_func_t nalloc; /* [not used right now] */ - lzo_free_func_t nfree; /* [not used right now] */ - - /* a progress indicator callback function (set to 0 to disable) */ - lzo_progress_func_t nprogress; - - /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress - * callbacks points back to this struct, so you are free to store - * some extra info in the following variables. */ - lzo_voidp user1; - lzo_xint user2; - lzo_xint user3; -}; - - -/*********************************************************************** -// error codes and prototypes -************************************************************************/ - -/* Error codes for the compression/decompression functions. Negative - * values are errors, positive values will be used for special but - * normal events. - */ -#define LZO_E_OK 0 -#define LZO_E_ERROR (-1) -#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */ -#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ -#define LZO_E_INPUT_OVERRUN (-4) -#define LZO_E_OUTPUT_OVERRUN (-5) -#define LZO_E_LOOKBEHIND_OVERRUN (-6) -#define LZO_E_EOF_NOT_FOUND (-7) -#define LZO_E_INPUT_NOT_CONSUMED (-8) -#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ - - -#ifndef lzo_sizeof_dict_t -# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep)) -#endif - -/* lzo_init() should be the first function you call. - * Check the return code ! - * - * lzo_init() is a macro to allow checking that the library and the - * compiler's view of various types are consistent. - */ -#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ - (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\ - (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ - (int)sizeof(lzo_callback_t)) -LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int); - -/* version functions (useful for shared libraries) */ -LZO_EXTERN(unsigned) lzo_version(void); -LZO_EXTERN(const char *) lzo_version_string(void); -LZO_EXTERN(const char *) lzo_version_date(void); -LZO_EXTERN(const lzo_charp) _lzo_version_string(void); -LZO_EXTERN(const lzo_charp) _lzo_version_date(void); - -/* string functions */ -LZO_EXTERN(int) -lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len); -LZO_EXTERN(lzo_voidp) -lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); -LZO_EXTERN(lzo_voidp) -lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); -LZO_EXTERN(lzo_voidp) -lzo_memset(lzo_voidp _s, int _c, lzo_uint _len); - -/* checksum functions */ -LZO_EXTERN(lzo_uint32) -lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len); -LZO_EXTERN(lzo_uint32) -lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len); -LZO_EXTERN(const lzo_uint32p) -lzo_get_crc32_table(void); - -/* misc. */ -LZO_EXTERN(int) _lzo_config_check(void); -typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u; -typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u; -typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t; - -/* align a char pointer on a boundary that is a multiple of `size' */ -LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size); -#define LZO_PTR_ALIGN_UP(_ptr,_size) \ - ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size))) - - -/*********************************************************************** -// deprecated macros - only for backward compatibility with LZO v1.xx -************************************************************************/ - -#if defined(LZO_CFG_COMPAT) - -#define __LZOCONF_H 1 - -#if defined(LZO_ARCH_I086) -# define __LZO_i386 1 -#elif defined(LZO_ARCH_I386) -# define __LZO_i386 1 -#endif - -#if defined(LZO_OS_DOS16) -# define __LZO_DOS 1 -# define __LZO_DOS16 1 -#elif defined(LZO_OS_DOS32) -# define __LZO_DOS 1 -#elif defined(LZO_OS_WIN16) -# define __LZO_WIN 1 -# define __LZO_WIN16 1 -#elif defined(LZO_OS_WIN32) -# define __LZO_WIN 1 -#endif - -#define __LZO_CMODEL -#define __LZO_DMODEL -#define __LZO_ENTRY __LZO_CDECL -#define LZO_EXTERN_CDECL LZO_EXTERN -#define LZO_ALIGN LZO_PTR_ALIGN_UP - -#define lzo_compress_asm_t lzo_compress_t -#define lzo_decompress_asm_t lzo_decompress_t - -#endif /* LZO_CFG_COMPAT */ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* already included */ - - -/* vim:set ts=4 et: */ diff --git a/bundles/n2n_ntop_v2/include/lzodefs.h b/bundles/n2n_ntop_v2/include/lzodefs.h deleted file mode 100644 index 18056372..00000000 --- a/bundles/n2n_ntop_v2/include/lzodefs.h +++ /dev/null @@ -1,1807 +0,0 @@ -/* lzodefs.h -- architecture, OS and compiler specific defines - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __LZODEFS_H_INCLUDED -#define __LZODEFS_H_INCLUDED 1 - -#if defined(__CYGWIN32__) && !defined(__CYGWIN__) -# define __CYGWIN__ __CYGWIN32__ -#endif -#if defined(__IBMCPP__) && !defined(__IBMC__) -# define __IBMC__ __IBMCPP__ -#endif -#if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) -# define __INTEL_COMPILER __ICL -#endif -#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) -# define _ALL_SOURCE 1 -#endif -#if defined(__mips__) && defined(__R5900__) -# if !defined(__LONG_MAX__) -# define __LONG_MAX__ 9223372036854775807L -# endif -#endif -#if defined(__INTEL_COMPILER) && defined(__linux__) -# pragma warning(disable: 193) -#endif -#if defined(__KEIL__) && defined(__C166__) -# pragma warning disable = 322 -#elif 0 && defined(__C251__) -# pragma warning disable = 322 -#endif -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -# if (_MSC_VER >= 1300) -# pragma warning(disable: 4668) -# endif -#endif -#if 0 && defined(__WATCOMC__) -# if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) -# pragma warning 203 9 -# endif -#endif -#if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) -# pragma option -h -#endif -#if 0 -#define LZO_0xffffL 0xfffful -#define LZO_0xffffffffL 0xfffffffful -#else -#define LZO_0xffffL 65535ul -#define LZO_0xffffffffL 4294967295ul -#endif -#if (LZO_0xffffL == LZO_0xffffffffL) -# error "your preprocessor is broken 1" -#endif -#if (16ul * 16384ul != 262144ul) -# error "your preprocessor is broken 2" -#endif -#if 0 -#if (32767 >= 4294967295ul) -# error "your preprocessor is broken 3" -#endif -#if (65535u >= 4294967295ul) -# error "your preprocessor is broken 4" -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) -# if !defined(MSDOS) -# define MSDOS 1 -# endif -# if !defined(_MSDOS) -# define _MSDOS 1 -# endif -#elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) -# if (__VERSION == 520) && (MB_LEN_MAX == 1) -# if !defined(__AZTEC_C__) -# define __AZTEC_C__ __VERSION -# endif -# if !defined(__DOS__) -# define __DOS__ 1 -# endif -# endif -#endif -#endif -#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) -# define ptrdiff_t long -# define _PTRDIFF_T_DEFINED -#endif -#if (UINT_MAX == LZO_0xffffL) -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -# if defined(__AZTEC_C__) && defined(__DOS__) -# define __LZO_RENAME_A 1 -# elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define __LZO_RENAME_A 1 -# elif (_MSC_VER < 700) -# define __LZO_RENAME_B 1 -# endif -# elif defined(__TSC__) && defined(__OS2__) -# define __LZO_RENAME_A 1 -# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) -# define __LZO_RENAME_A 1 -# elif defined(__PACIFIC__) && defined(DOS) -# if !defined(__far) -# define __far far -# endif -# if !defined(__near) -# define __near near -# endif -# endif -# if defined(__LZO_RENAME_A) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif -# if !defined(__huge) -# define __huge huge -# endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# if !defined(__huge) -# define __huge huge -# endif -# elif defined(__LZO_RENAME_B) -# if !defined(__cdecl) -# define __cdecl _cdecl -# endif -# if !defined(__far) -# define __far _far -# endif -# if !defined(__huge) -# define __huge _huge -# endif -# if !defined(__near) -# define __near _near -# endif -# if !defined(__pascal) -# define __pascal _pascal -# endif -# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# endif -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__AZTEC_C__) && defined(__DOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -#elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# endif -# if (_MSC_VER < 700) -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# define LZO_BROKEN_SIZEOF 1 -# endif -#elif defined(__PACIFIC__) && defined(DOS) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#elif defined(__TURBOC__) && defined(__MSDOS__) -# if (__TURBOC__ < 0x0150) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# endif -# if (__TURBOC__ < 0x0200) -# define LZO_BROKEN_SIZEOF 1 -# endif -# if (__TURBOC__ < 0x0400) && defined(__cplusplus) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# endif -#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_SIZEOF 1 -#endif -#endif -#if defined(__WATCOMC__) && (__WATCOMC__ < 900) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#endif -#if defined(_CRAY) && defined(_CRAY1) -# define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 -#endif -#define LZO_PP_STRINGIZE(x) #x -#define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -#define LZO_PP_CONCAT2(a,b) a ## b -#define LZO_PP_CONCAT3(a,b,c) a ## b ## c -#define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) -#define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) -#define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) -#define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -#if 1 -#define LZO_CPP_STRINGIZE(x) #x -#define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -#define LZO_CPP_CONCAT2(a,b) a ## b -#define LZO_CPP_CONCAT3(a,b,c) a ## b ## c -#define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) -#define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) -#define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) -#define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -#endif -#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) -#if 1 && defined(__cplusplus) -# if !defined(__STDC_CONSTANT_MACROS) -# define __STDC_CONSTANT_MACROS 1 -# endif -# if !defined(__STDC_LIMIT_MACROS) -# define __STDC_LIMIT_MACROS 1 -# endif -#endif -#if defined(__cplusplus) -# define LZO_EXTERN_C extern "C" -#else -# define LZO_EXTERN_C extern -#endif -#if !defined(__LZO_OS_OVERRIDE) -#if defined(LZO_OS_FREESTANDING) -# define LZO_INFO_OS "freestanding" -#elif defined(LZO_OS_EMBEDDED) -# define LZO_INFO_OS "embedded" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_OS_EMBEDDED 1 -# define LZO_INFO_OS "embedded" -#elif defined(__CYGWIN__) && defined(__GNUC__) -# define LZO_OS_CYGWIN 1 -# define LZO_INFO_OS "cygwin" -#elif defined(__EMX__) && defined(__GNUC__) -# define LZO_OS_EMX 1 -# define LZO_INFO_OS "emx" -#elif defined(__BEOS__) -# define LZO_OS_BEOS 1 -# define LZO_INFO_OS "beos" -#elif defined(__Lynx__) -# define LZO_OS_LYNXOS 1 -# define LZO_INFO_OS "lynxos" -#elif defined(__OS400__) -# define LZO_OS_OS400 1 -# define LZO_INFO_OS "os400" -#elif defined(__QNX__) -# define LZO_OS_QNX 1 -# define LZO_INFO_OS "qnx" -#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__BORLANDC__) && defined(__DPMI16__) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -#elif defined(__ZTC__) && defined(DOS386) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__OS2__) || defined(__OS2V2__) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_OS216 1 -# define LZO_INFO_OS "os216" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_OS2 1 -# define LZO_INFO_OS "os2" -# else -# error "check your limits.h header" -# endif -#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) -# define LZO_OS_WIN64 1 -# define LZO_INFO_OS "win64" -#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__MWERKS__) && defined(__INTEL__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_WIN16 1 -# define LZO_INFO_OS "win16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# else -# error "check your limits.h header" -# endif -#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -# else -# error "check your limits.h header" -# endif -#elif defined(__WATCOMC__) -# if defined(__NT__) && (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif defined(__NT__) && (__WATCOMC__ < 1100) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# elif defined(__linux__) || defined(__LINUX__) -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -# else -# error "please specify a target using the -bt compiler option" -# endif -#elif defined(__palmos__) -# define LZO_OS_PALMOS 1 -# define LZO_INFO_OS "palmos" -#elif defined(__TOS__) || defined(__atarist__) -# define LZO_OS_TOS 1 -# define LZO_INFO_OS "tos" -#elif defined(macintosh) && !defined(__ppc__) -# define LZO_OS_MACCLASSIC 1 -# define LZO_INFO_OS "macclassic" -#elif defined(__VMS) -# define LZO_OS_VMS 1 -# define LZO_INFO_OS "vms" -#elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PS2 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "ps2" -#elif (defined(__mips__) && defined(__psp__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PSP 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "psp" -#else -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -#endif -#if (LZO_OS_POSIX) -# if defined(_AIX) || defined(__AIX__) || defined(__aix__) -# define LZO_OS_POSIX_AIX 1 -# define LZO_INFO_OS_POSIX "aix" -# elif defined(__FreeBSD__) -# define LZO_OS_POSIX_FREEBSD 1 -# define LZO_INFO_OS_POSIX "freebsd" -# elif defined(__hpux__) || defined(__hpux) -# define LZO_OS_POSIX_HPUX 1 -# define LZO_INFO_OS_POSIX "hpux" -# elif defined(__INTERIX) -# define LZO_OS_POSIX_INTERIX 1 -# define LZO_INFO_OS_POSIX "interix" -# elif defined(__IRIX__) || defined(__irix__) -# define LZO_OS_POSIX_IRIX 1 -# define LZO_INFO_OS_POSIX "irix" -# elif defined(__linux__) || defined(__linux) || defined(__LINUX__) -# define LZO_OS_POSIX_LINUX 1 -# define LZO_INFO_OS_POSIX "linux" -# elif defined(__APPLE__) || defined(__MACOS__) -# define LZO_OS_POSIX_MACOSX 1 -# define LZO_INFO_OS_POSIX "macosx" -# elif defined(__minix__) || defined(__minix) -# define LZO_OS_POSIX_MINIX 1 -# define LZO_INFO_OS_POSIX "minix" -# elif defined(__NetBSD__) -# define LZO_OS_POSIX_NETBSD 1 -# define LZO_INFO_OS_POSIX "netbsd" -# elif defined(__OpenBSD__) -# define LZO_OS_POSIX_OPENBSD 1 -# define LZO_INFO_OS_POSIX "openbsd" -# elif defined(__osf__) -# define LZO_OS_POSIX_OSF 1 -# define LZO_INFO_OS_POSIX "osf" -# elif defined(__solaris__) || defined(__sun) -# if defined(__SVR4) || defined(__svr4__) -# define LZO_OS_POSIX_SOLARIS 1 -# define LZO_INFO_OS_POSIX "solaris" -# else -# define LZO_OS_POSIX_SUNOS 1 -# define LZO_INFO_OS_POSIX "sunos" -# endif -# elif defined(__ultrix__) || defined(__ultrix) -# define LZO_OS_POSIX_ULTRIX 1 -# define LZO_INFO_OS_POSIX "ultrix" -# elif defined(_UNICOS) -# define LZO_OS_POSIX_UNICOS 1 -# define LZO_INFO_OS_POSIX "unicos" -# else -# define LZO_OS_POSIX_UNKNOWN 1 -# define LZO_INFO_OS_POSIX "unknown" -# endif -#endif -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (UINT_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -# define LZO_CC_CILLY 1 -# define LZO_INFO_CC "Cilly" -# if defined(__CILLY__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) -# define LZO_CC_SDCC 1 -# define LZO_INFO_CC "sdcc" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) -#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) -# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) -# define LZO_INFO_CC "Pathscale C" -# define LZO_INFO_CCVER __PATHSCALE__ -#elif defined(__INTEL_COMPILER) -# define LZO_CC_INTELC 1 -# define LZO_INFO_CC "Intel C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) -# if defined(_WIN32) || defined(_WIN64) -# define LZO_CC_SYNTAX_MSC 1 -# else -# define LZO_CC_SYNTAX_GNUC 1 -# endif -#elif defined(__POCC__) && defined(_WIN32) -# define LZO_CC_PELLESC 1 -# define LZO_INFO_CC "Pelles C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# else -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# endif -# define LZO_INFO_CC "llvm-gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# elif defined(__GNUC_MINOR__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# else -# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -# endif -# define LZO_INFO_CC "gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__ACK__) && defined(_ACK) -# define LZO_CC_ACK 1 -# define LZO_INFO_CC "Amsterdam Compiler Kit C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__AZTEC_C__) -# define LZO_CC_AZTECC 1 -# define LZO_INFO_CC "Aztec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) -#elif defined(__BORLANDC__) -# define LZO_CC_BORLANDC 1 -# define LZO_INFO_CC "Borland C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) -#elif defined(_CRAYC) && defined(_RELEASE) -# define LZO_CC_CRAYC 1 -# define LZO_INFO_CC "Cray C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) -#elif defined(__DMC__) && defined(__SC__) -# define LZO_CC_DMC 1 -# define LZO_INFO_CC "Digital Mars C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) -#elif defined(__DECC) -# define LZO_CC_DECC 1 -# define LZO_INFO_CC "DEC C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -#elif defined(__HIGHC__) -# define LZO_CC_HIGHC 1 -# define LZO_INFO_CC "MetaWare High C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__IAR_SYSTEMS_ICC__) -# define LZO_CC_IARC 1 -# define LZO_INFO_CC "IAR C" -# if defined(__VER__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__IBMC__) -# define LZO_CC_IBMC 1 -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -#elif defined(__KEIL__) && defined(__C166__) -# define LZO_CC_KEILC 1 -# define LZO_INFO_CC "Keil C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) -#elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) -# define LZO_CC_LCCWIN32 1 -# define LZO_INFO_CC "lcc-win32" -# define LZO_INFO_CCVER "unknown" -#elif defined(__LCC__) -# define LZO_CC_LCC 1 -# define LZO_INFO_CC "lcc" -# if defined(__LCC_VERSION__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(_MSC_VER) -# define LZO_CC_MSC 1 -# define LZO_INFO_CC "Microsoft C" -# if defined(_MSC_FULL_VER) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -# endif -#elif defined(__MWERKS__) -# define LZO_CC_MWERKS 1 -# define LZO_INFO_CC "Metrowerks C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) -#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -# define LZO_CC_NDPC 1 -# define LZO_INFO_CC "Microway NDP C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PACIFIC__) -# define LZO_CC_PACIFICC 1 -# define LZO_INFO_CC "Pacific C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) -# define LZO_CC_PGI 1 -# define LZO_INFO_CC "Portland Group PGI C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PUREC__) && defined(__TOS__) -# define LZO_CC_PUREC 1 -# define LZO_INFO_CC "Pure C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) -#elif defined(__SC__) && defined(__ZTC__) -# define LZO_CC_SYMANTECC 1 -# define LZO_INFO_CC "Symantec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) -#elif defined(__SUNPRO_C) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_C)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_C -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__SUNPRO_CC) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_CC)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_CC -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__TINYC__) -# define LZO_CC_TINYC 1 -# define LZO_INFO_CC "Tiny C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) -#elif defined(__TSC__) -# define LZO_CC_TOPSPEEDC 1 -# define LZO_INFO_CC "TopSpeed C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) -#elif defined(__WATCOMC__) -# define LZO_CC_WATCOMC 1 -# define LZO_INFO_CC "Watcom C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) -#elif defined(__TURBOC__) -# define LZO_CC_TURBOC 1 -# define LZO_INFO_CC "Turbo C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) -#elif defined(__ZTC__) -# define LZO_CC_ZORTECHC 1 -# define LZO_INFO_CC "Zortech C" -# if (__ZTC__ == 0x310) -# define LZO_INFO_CCVER "0x310" -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) -# endif -#else -# define LZO_CC_UNKNOWN 1 -# define LZO_INFO_CC "unknown" -# define LZO_INFO_CCVER "unknown" -#endif -#if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) -# error "LZO_CC_MSC: _MSC_FULL_VER is not defined" -#endif -#if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) -# if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) -# if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) -# define LZO_ARCH_CRAY_MPP 1 -# elif defined(_CRAY1) -# define LZO_ARCH_CRAY_PVP 1 -# endif -# endif -#endif -#if !defined(__LZO_ARCH_OVERRIDE) -#if defined(LZO_ARCH_GENERIC) -# define LZO_INFO_ARCH "generic" -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086 1 -# define LZO_ARCH_IA16 1 -# define LZO_INFO_ARCH "i086" -#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) -# define LZO_ARCH_AMD64 1 -# define LZO_INFO_ARCH "amd64" -#elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB)) -# define LZO_ARCH_ARM 1 -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) -# define LZO_ARCH_ARM 1 -# if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -# elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) -# define LZO_INFO_ARCH "arm" -# else -# define LZO_INFO_ARCH "arm" -# endif -#elif defined(__arm__) || defined(_M_ARM) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) -# define LZO_ARCH_AVR 1 -# define LZO_INFO_ARCH "avr" -#elif defined(__bfin__) -# define LZO_ARCH_BLACKFIN 1 -# define LZO_INFO_ARCH "blackfin" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) -# define LZO_ARCH_C166 1 -# define LZO_INFO_ARCH "c166" -#elif defined(__cris__) -# define LZO_ARCH_CRIS 1 -# define LZO_INFO_ARCH "cris" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) -# define LZO_ARCH_EZ80 1 -# define LZO_INFO_ARCH "ez80" -#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_ARCH_H8300 1 -# define LZO_INFO_ARCH "h8300" -#elif defined(__hppa__) || defined(__hppa) -# define LZO_ARCH_HPPA 1 -# define LZO_INFO_ARCH "hppa" -#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_CC_ZORTECHC && defined(__I86__)) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) -# define LZO_ARCH_IA64 1 -# define LZO_INFO_ARCH "ia64" -#elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__m32r__) -# define LZO_ARCH_M32R 1 -# define LZO_INFO_ARCH "m32r" -#elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) -# define LZO_ARCH_M68K 1 -# define LZO_INFO_ARCH "m68k" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) -# define LZO_ARCH_MCS251 1 -# define LZO_INFO_ARCH "mcs251" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) -# define LZO_ARCH_MIPS 1 -# define LZO_INFO_ARCH "mips" -#elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) -# define LZO_ARCH_S390 1 -# define LZO_INFO_ARCH "s390" -#elif defined(__sh__) || defined(_M_SH) -# define LZO_ARCH_SH 1 -# define LZO_INFO_ARCH "sh" -#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) -# define LZO_ARCH_SPARC 1 -# define LZO_INFO_ARCH "sparc" -#elif defined(__SPU__) -# define LZO_ARCH_SPU 1 -# define LZO_INFO_ARCH "spu" -#elif (UINT_MAX == LZO_0xffffL) && defined(__z80) -# define LZO_ARCH_Z80 1 -# define LZO_INFO_ARCH "z80" -#elif (LZO_ARCH_CRAY_PVP) -# if defined(_CRAYSV1) -# define LZO_ARCH_CRAY_SV1 1 -# define LZO_INFO_ARCH "cray_sv1" -# elif (_ADDR64) -# define LZO_ARCH_CRAY_T90 1 -# define LZO_INFO_ARCH "cray_t90" -# elif (_ADDR32) -# define LZO_ARCH_CRAY_YMP 1 -# define LZO_INFO_ARCH "cray_ymp" -# else -# define LZO_ARCH_CRAY_XMP 1 -# define LZO_INFO_ARCH "cray_xmp" -# endif -#else -# define LZO_ARCH_UNKNOWN 1 -# define LZO_INFO_ARCH "unknown" -#endif -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) -# error "FIXME - missing define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) -# error "FIXME - missing WIN32 define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) -# error "FIXME - missing WIN64 define for CPU architecture" -#endif -#if (LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(BLX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#endif -#if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) -# error "this should not happen" -#endif -#if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) -# error "this should not happen" -#endif -#if (LZO_ARCH_I086) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_ARCH_I386) -# if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) -# error "this should not happen" -# endif -# if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if !defined(__LZO_MM_OVERRIDE) -#if (LZO_ARCH_I086) -#if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -#endif -#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) -# define LZO_MM_TINY 1 -#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) -# define LZO_MM_HUGE 1 -#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) -# define LZO_MM_SMALL 1 -#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) -# define LZO_MM_MEDIUM 1 -#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) -# define LZO_MM_COMPACT 1 -#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) -# define LZO_MM_LARGE 1 -#elif (LZO_CC_AZTECC) -# if defined(_LARGE_CODE) && defined(_LARGE_DATA) -# define LZO_MM_LARGE 1 -# elif defined(_LARGE_CODE) -# define LZO_MM_MEDIUM 1 -# elif defined(_LARGE_DATA) -# define LZO_MM_COMPACT 1 -# else -# define LZO_MM_SMALL 1 -# endif -#elif (LZO_CC_ZORTECHC && defined(__VCM__)) -# define LZO_MM_LARGE 1 -#else -# error "unknown memory model" -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -#define LZO_HAVE_MM_HUGE_PTR 1 -#define LZO_HAVE_MM_HUGE_ARRAY 1 -#if (LZO_MM_TINY) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) -# undef LZO_HAVE_MM_HUGE_PTR -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_MSC && defined(_QC)) -# undef LZO_HAVE_MM_HUGE_ARRAY -# if (_MSC_VER < 600) -# undef LZO_HAVE_MM_HUGE_PTR -# endif -#elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) -# if (LZO_OS_DOS16) -# error "this should not happen" -# elif (LZO_CC_ZORTECHC) -# else -# error "this should not happen" -# endif -#endif -#ifdef __cplusplus -extern "C" { -#endif -#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) -# define LZO_MM_AHSHIFT 12 -#elif (LZO_CC_WATCOMC) - extern unsigned char _HShift; -# define LZO_MM_AHSHIFT ((unsigned) _HShift) -#else -# error "FIXME - implement LZO_MM_AHSHIFT" -#endif -#ifdef __cplusplus -} -#endif -#endif -#elif (LZO_ARCH_C166) -#if !defined(__MODEL__) -# error "FIXME - C166 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - C166 __MODEL__" -#endif -#elif (LZO_ARCH_MCS251) -#if !defined(__MODEL__) -# error "FIXME - MCS251 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS251 __MODEL__" -#endif -#elif (LZO_ARCH_MCS51) -#if !defined(__MODEL__) -# error "FIXME - MCS51 __MODEL__" -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS51 __MODEL__" -#endif -#elif (LZO_ARCH_CRAY_PVP) -# define LZO_MM_PVP 1 -#else -# define LZO_MM_FLAT 1 -#endif -#if (LZO_MM_COMPACT) -# define LZO_INFO_MM "compact" -#elif (LZO_MM_FLAT) -# define LZO_INFO_MM "flat" -#elif (LZO_MM_HUGE) -# define LZO_INFO_MM "huge" -#elif (LZO_MM_LARGE) -# define LZO_INFO_MM "large" -#elif (LZO_MM_MEDIUM) -# define LZO_INFO_MM "medium" -#elif (LZO_MM_PVP) -# define LZO_INFO_MM "pvp" -#elif (LZO_MM_SMALL) -# define LZO_INFO_MM "small" -#elif (LZO_MM_TINY) -# define LZO_INFO_MM "tiny" -#else -# error "unknown memory model" -#endif -#endif -#if defined(SIZEOF_SHORT) -# define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -#endif -#if defined(SIZEOF_INT) -# define LZO_SIZEOF_INT (SIZEOF_INT) -#endif -#if defined(SIZEOF_LONG) -# define LZO_SIZEOF_LONG (SIZEOF_LONG) -#endif -#if defined(SIZEOF_LONG_LONG) -# define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -#endif -#if defined(SIZEOF___INT16) -# define LZO_SIZEOF___INT16 (SIZEOF___INT16) -#endif -#if defined(SIZEOF___INT32) -# define LZO_SIZEOF___INT32 (SIZEOF___INT32) -#endif -#if defined(SIZEOF___INT64) -# define LZO_SIZEOF___INT64 (SIZEOF___INT64) -#endif -#if defined(SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -#endif -#if defined(SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -#endif -#if defined(SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -#endif -#define __LZO_LSR(x,b) (((x)+0ul) >> (b)) -#if !defined(LZO_SIZEOF_SHORT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_SHORT 8 -# elif (USHRT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,7) == 1) -# define LZO_SIZEOF_SHORT 1 -# elif (__LZO_LSR(USHRT_MAX,15) == 1) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,31) == 1) -# define LZO_SIZEOF_SHORT 4 -# elif (__LZO_LSR(USHRT_MAX,63) == 1) -# define LZO_SIZEOF_SHORT 8 -# elif (__LZO_LSR(USHRT_MAX,127) == 1) -# define LZO_SIZEOF_SHORT 16 -# else -# error "LZO_SIZEOF_SHORT" -# endif -#endif -#if !defined(LZO_SIZEOF_INT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_INT 8 -# elif (UINT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_INT 2 -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,7) == 1) -# define LZO_SIZEOF_INT 1 -# elif (__LZO_LSR(UINT_MAX,15) == 1) -# define LZO_SIZEOF_INT 2 -# elif (__LZO_LSR(UINT_MAX,31) == 1) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,63) == 1) -# define LZO_SIZEOF_INT 8 -# elif (__LZO_LSR(UINT_MAX,127) == 1) -# define LZO_SIZEOF_INT 16 -# else -# error "LZO_SIZEOF_INT" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG) -# if (ULONG_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,7) == 1) -# define LZO_SIZEOF_LONG 1 -# elif (__LZO_LSR(ULONG_MAX,15) == 1) -# define LZO_SIZEOF_LONG 2 -# elif (__LZO_LSR(ULONG_MAX,31) == 1) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,63) == 1) -# define LZO_SIZEOF_LONG 8 -# elif (__LZO_LSR(ULONG_MAX,127) == 1) -# define LZO_SIZEOF_LONG 16 -# else -# error "LZO_SIZEOF_LONG" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -# if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) -# if (LZO_CC_GNUC >= 0x030300ul) -# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) -# define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG -# elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) -# define LZO_SIZEOF_LONG_LONG 4 -# endif -# endif -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -#if (LZO_ARCH_I086 && LZO_CC_DMC) -#elif (LZO_CC_CILLY) && defined(__GNUC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_SIZEOF_LONG_LONG 8 -#elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_OS_WIN64 || defined(_WIN64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_DMC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) -#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define LZO_SIZEOF_LONG_LONG 8 -#endif -#endif -#endif -#if defined(__cplusplus) && defined(LZO_CC_GNUC) -# if (LZO_CC_GNUC < 0x020800ul) -# undef LZO_SIZEOF_LONG_LONG -# endif -#endif -#if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#endif -#if !defined(LZO_SIZEOF_VOID_P) -#if (LZO_ARCH_I086) -# define __LZO_WORDSIZE 2 -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -# define LZO_SIZEOF_VOID_P 2 -# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -# define LZO_SIZEOF_VOID_P 4 -# else -# error "LZO_MM" -# endif -#elif (LZO_ARCH_AVR || LZO_ARCH_Z80) -# define __LZO_WORDSIZE 1 -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_H8300) -# if defined(__NORMAL_MODE__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 2 -# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 4 -# else -# define __LZO_WORDSIZE 2 -# define LZO_SIZEOF_VOID_P 2 -# endif -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT -# endif -#elif (LZO_ARCH_M16C) -# define __LZO_WORDSIZE 2 -# if defined(__m32c_cpu__) || defined(__m32cm_cpu__) -# define LZO_SIZEOF_VOID_P 4 -# else -# define LZO_SIZEOF_VOID_P 2 -# endif -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 4 -#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_OS_OS400 || defined(__OS400__)) -# define __LZO_WORDSIZE LZO_SIZEOF_LONG -# define LZO_SIZEOF_VOID_P 16 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_ARCH_SPU) -# if 0 -# define __LZO_WORDSIZE 16 -# endif -# define LZO_SIZEOF_VOID_P 4 -#else -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -#endif -#endif -#if !defined(LZO_WORDSIZE) -# if defined(__LZO_WORDSIZE) -# define LZO_WORDSIZE __LZO_WORDSIZE -# else -# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -# endif -#endif -#if !defined(LZO_SIZEOF_SIZE_T) -#if (LZO_ARCH_I086 || LZO_ARCH_M16C) -# define LZO_SIZEOF_SIZE_T 2 -#else -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P -#endif -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -#if (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P -# elif (LZO_MM_COMPACT || LZO_MM_LARGE) -# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) -# define LZO_SIZEOF_PTRDIFF_T 4 -# else -# define LZO_SIZEOF_PTRDIFF_T 2 -# endif -# else -# error "LZO_MM" -# endif -#else -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T -#endif -#endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) -# undef LZO_ABI_BIG_ENDIAN -# undef LZO_ABI_LITTLE_ENDIAN -#elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) -#if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) -# define LZO_ABI_BIG_ENDIAN 1 -#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_M68K || LZO_ARCH_S390) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) -# if (__LITTLE_ENDIAN__ == 1) -# define LZO_ABI_LITTLE_ENDIAN 1 -# else -# define LZO_ABI_BIG_ENDIAN 1 -# endif -#elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#endif -#endif -#if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) -# error "this should not happen" -#endif -#if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "be" -#elif defined(LZO_ABI_LITTLE_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "le" -#elif defined(LZO_ABI_NEUTRAL_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "neutral" -#endif -#if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_I8LP16 1 -# define LZO_INFO_ABI_PM "i8lp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_ILP16 1 -# define LZO_INFO_ABI_PM "ilp16" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_ILP32 1 -# define LZO_INFO_ABI_PM "ilp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) -# define LZO_ABI_LLP64 1 -# define LZO_INFO_ABI_PM "llp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_LP64 1 -# define LZO_INFO_ABI_PM "lp64" -#elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_ILP64 1 -# define LZO_INFO_ABI_PM "ilp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_IP32L64 1 -# define LZO_INFO_ABI_PM "ip32l64" -#endif -#if !defined(__LZO_LIBC_OVERRIDE) -#if defined(LZO_LIBC_NAKED) -# define LZO_INFO_LIBC "naked" -#elif defined(LZO_LIBC_FREESTANDING) -# define LZO_INFO_LIBC "freestanding" -#elif defined(LZO_LIBC_MOSTLY_FREESTANDING) -# define LZO_INFO_LIBC "mfreestanding" -#elif defined(LZO_LIBC_ISOC90) -# define LZO_INFO_LIBC "isoc90" -#elif defined(LZO_LIBC_ISOC99) -# define LZO_INFO_LIBC "isoc99" -#elif defined(__dietlibc__) -# define LZO_LIBC_DIETLIBC 1 -# define LZO_INFO_LIBC "dietlibc" -#elif defined(_NEWLIB_VERSION) -# define LZO_LIBC_NEWLIB 1 -# define LZO_INFO_LIBC "newlib" -#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) -# if defined(__UCLIBC_SUBLEVEL__) -# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) -# else -# define LZO_LIBC_UCLIBC 0x00090bL -# endif -# define LZO_INFO_LIBC "uclibc" -#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) -# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) -# define LZO_INFO_LIBC "glibc" -#elif (LZO_CC_MWERKS) && defined(__MSL__) -# define LZO_LIBC_MSL __MSL__ -# define LZO_INFO_LIBC "msl" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#else -# define LZO_LIBC_DEFAULT 1 -# define LZO_INFO_LIBC "default" -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -#if (LZO_CC_GNUC >= 0x020800ul) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_gnuc_extension__ __extension__ -#else -# define __lzo_gnuc_extension__ -#endif -#endif -#if !defined(__lzo_ua_volatile) -# define __lzo_ua_volatile volatile -#endif -#if !defined(__lzo_alignof) -#if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_alignof(e) __alignof(e) -#endif -#endif -#if defined(__lzo_alignof) -# define __lzo_HAVE_alignof 1 -#endif -#if !defined(__lzo_constructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_constructor __attribute__((__constructor__)) -#endif -#endif -#if defined(__lzo_constructor) -# define __lzo_HAVE_constructor 1 -#endif -#if !defined(__lzo_destructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_destructor __attribute__((__destructor__)) -#endif -#endif -#if defined(__lzo_destructor) -# define __lzo_HAVE_destructor 1 -#endif -#if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) -# error "this should not happen" -#endif -#if !defined(__lzo_inline) -#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -#elif defined(__cplusplus) -# define __lzo_inline inline -#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -# define __lzo_inline __inline -#elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_inline __inline__ -#elif (LZO_CC_DMC) -# define __lzo_inline __inline -#elif (LZO_CC_INTELC) -# define __lzo_inline __inline -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -# define __lzo_inline __inline -#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -# define __lzo_inline __inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define __lzo_inline inline -#endif -#endif -#if defined(__lzo_inline) -# define __lzo_HAVE_inline 1 -#else -# define __lzo_inline -#endif -#if !defined(__lzo_forceinline) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_forceinline __forceinline -#endif -#endif -#if defined(__lzo_forceinline) -# define __lzo_HAVE_forceinline 1 -#else -# define __lzo_forceinline -#endif -#if !defined(__lzo_noinline) -#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -# define __lzo_noinline __attribute__((__noinline__,__used__)) -#elif (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -# if defined(__cplusplus) -# else -# define __lzo_noinline __declspec(noinline) -# endif -#endif -#endif -#if defined(__lzo_noinline) -# define __lzo_HAVE_noinline 1 -#else -# define __lzo_noinline -#endif -#if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) -# error "this should not happen" -#endif -#if !defined(__lzo_noreturn) -#if (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_noreturn __declspec(noreturn) -#endif -#endif -#if defined(__lzo_noreturn) -# define __lzo_HAVE_noreturn 1 -#else -# define __lzo_noreturn -#endif -#if !defined(__lzo_nothrow) -#if (LZO_CC_GNUC >= 0x030300ul) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#endif -#endif -#if defined(__lzo_nothrow) -# define __lzo_HAVE_nothrow 1 -#else -# define __lzo_nothrow -#endif -#if !defined(__lzo_restrict) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_LLVM) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -# define __lzo_restrict __restrict -#endif -#endif -#if defined(__lzo_restrict) -# define __lzo_HAVE_restrict 1 -#else -# define __lzo_restrict -#endif -#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#endif -#endif -#if defined(__lzo_likely) -# define __lzo_HAVE_likely 1 -#else -# define __lzo_likely(e) (e) -#endif -#if defined(__lzo_unlikely) -# define __lzo_HAVE_unlikely 1 -#else -# define __lzo_unlikely(e) (e) -#endif -#if !defined(LZO_UNUSED) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNUSED(var) ((void) var) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_KEILC) -# define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} -# elif (LZO_CC_PACIFICC) -# define LZO_UNUSED(var) ((void) sizeof(var)) -# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED(var) ((void) var) -# else -# define LZO_UNUSED(var) ((void) &var) -# endif -#endif -#if !defined(LZO_UNUSED_FUNC) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED_FUNC(func) ((void) func) -# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_LLVM) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_MSC) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -# define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} -# else -# define LZO_UNUSED_FUNC(func) ((void) func) -# endif -#endif -#if !defined(LZO_UNUSED_LABEL) -# if (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# elif (LZO_CC_INTELC || LZO_CC_WATCOMC) -# define LZO_UNUSED_LABEL(l) if (0) goto l -# else -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# endif -#endif -#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -# if 0 -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -# elif 0 && (LZO_CC_GNUC) -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -# else -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# else -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT) -# if (LZO_CC_AZTECC) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} -# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# else -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} -# endif -#endif -#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit -# define __lzo_cdecl_main __cdecl -# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_qsort __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_qsort _stdcall -# else -# define __lzo_cdecl_qsort __cdecl -# endif -# elif (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -# else -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit __cdecl -# define __lzo_cdecl_main __cdecl -# define __lzo_cdecl_qsort __cdecl -# endif -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_sighandler __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_sighandler _stdcall -# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -# define __lzo_cdecl_sighandler __clrcall -# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -# if defined(_DLL) -# define __lzo_cdecl_sighandler _far _cdecl _loadds -# elif defined(_MT) -# define __lzo_cdecl_sighandler _far _cdecl -# else -# define __lzo_cdecl_sighandler _cdecl -# endif -# else -# define __lzo_cdecl_sighandler __cdecl -# endif -#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -# define __lzo_cdecl cdecl -#endif -#if !defined(__lzo_cdecl) -# define __lzo_cdecl -#endif -#if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit -#endif -#if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main -#endif -#if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort -#endif -#if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler -#endif -#if !defined(__lzo_cdecl_va) -# define __lzo_cdecl_va __lzo_cdecl -#endif -#if !defined(LZO_CFG_NO_WINDOWS_H) -#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) -# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -# else -# define LZO_HAVE_WINDOWS_H 1 -# endif -#endif -#endif -#if (LZO_ARCH_ALPHA) -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_AMD64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# define LZO_OPT_UNALIGNED64 1 -#elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) -#elif (LZO_ARCH_ARM) -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_CRIS) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_I386) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_IA64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_PREFER_POSTINC 1 -#elif (LZO_ARCH_M68K) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(__mc68020__) && !defined(__mcoldfire__) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_MIPS) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_POWERPC) -# define LZO_OPT_PREFER_PREINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_S390) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# if (LZO_SIZEOF_SIZE_T == 8) -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_SH) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -#endif -#if !defined(LZO_CFG_NO_INLINE_ASM) -#if defined(LZO_CC_LLVM) -# define LZO_CFG_NO_INLINE_ASM 1 -#endif -#endif -#if !defined(LZO_CFG_NO_UNALIGNED) -#if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) -# define LZO_CFG_NO_UNALIGNED 1 -#endif -#endif -#if defined(LZO_CFG_NO_UNALIGNED) -# undef LZO_OPT_UNALIGNED16 -# undef LZO_OPT_UNALIGNED32 -# undef LZO_OPT_UNALIGNED64 -#endif -#if defined(LZO_CFG_NO_INLINE_ASM) -#elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -# define LZO_ASM_SYNTAX_MSC 1 -#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#endif -#if (LZO_ASM_SYNTAX_GNUC) -#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -# define __LZO_ASM_CLOBBER "ax" -#elif (LZO_CC_INTELC) -# define __LZO_ASM_CLOBBER "memory" -#else -# define __LZO_ASM_CLOBBER "cc", "memory" -#endif -#endif -#if defined(__LZO_INFOSTR_MM) -#elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) -# define __LZO_INFOSTR_MM "" -#elif defined(LZO_INFO_MM) -# define __LZO_INFOSTR_MM "." LZO_INFO_MM -#else -# define __LZO_INFOSTR_MM "" -#endif -#if defined(__LZO_INFOSTR_PM) -#elif defined(LZO_INFO_ABI_PM) -# define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM -#else -# define __LZO_INFOSTR_PM "" -#endif -#if defined(__LZO_INFOSTR_ENDIAN) -#elif defined(LZO_INFO_ABI_ENDIAN) -# define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN -#else -# define __LZO_INFOSTR_ENDIAN "" -#endif -#if defined(__LZO_INFOSTR_OSNAME) -#elif defined(LZO_INFO_OS_CONSOLE) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE -#elif defined(LZO_INFO_OS_POSIX) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX -#else -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS -#endif -#if defined(__LZO_INFOSTR_LIBC) -#elif defined(LZO_INFO_LIBC) -# define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC -#else -# define __LZO_INFOSTR_LIBC "" -#endif -#if defined(__LZO_INFOSTR_CCVER) -#elif defined(LZO_INFO_CCVER) -# define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER -#else -# define __LZO_INFOSTR_CCVER "" -#endif -#define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER - -#endif /* already included */ - -/* vim:set ts=4 et: */ diff --git a/bundles/n2n_ntop_v2/include/minilzo.h b/bundles/n2n_ntop_v2/include/minilzo.h deleted file mode 100644 index 0aff50e4..00000000 --- a/bundles/n2n_ntop_v2/include/minilzo.h +++ /dev/null @@ -1,106 +0,0 @@ -/* minilzo.h -- mini subset of the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - -/* - * NOTE: - * the full LZO package can be found at - * http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __MINILZO_H -#define __MINILZO_H - -#define MINILZO_VERSION 0x2030 - -#ifdef __LZOCONF_H -# error "you cannot use both LZO and miniLZO" -#endif - -#undef LZO_HAVE_CONFIG_H -#include "lzoconf.h" - -#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) -# error "version mismatch in header files" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/*********************************************************************** -// -************************************************************************/ - -/* Memory required for the wrkmem parameter. - * When the required size is 0, you can also pass a NULL pointer. - */ - -#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS -#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t)) -#define LZO1X_MEM_DECOMPRESS (0) - - -/* compression */ -LZO_EXTERN(int) -lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -/* decompression */ -LZO_EXTERN(int) -lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem /* NOT USED */ ); - -/* safe decompression with overrun testing */ -LZO_EXTERN(int) -lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem /* NOT USED */ ); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* already included */ - diff --git a/bundles/n2n_ntop_v2/include/n2n.h b/bundles/n2n_ntop_v2/include/n2n.h deleted file mode 100644 index 78ab5d5a..00000000 --- a/bundles/n2n_ntop_v2/include/n2n.h +++ /dev/null @@ -1,485 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifndef _N2N_H_ -#define _N2N_H_ - -/* - tunctl -t tun0 - tunctl -t tun1 - ifconfig tun0 1.2.3.4 up - ifconfig tun1 1.2.3.5 up - ./edge -d tun0 -l 2000 -r 127.0.0.1:3000 -c hello - ./edge -d tun1 -l 3000 -r 127.0.0.1:2000 -c hello - - - tunctl -u UID -t tunX -*/ - - -/* #define N2N_CAN_NAME_IFACE */ - -/* Moved here to define _CRT_SECURE_NO_WARNINGS before all the including takes place */ -#ifdef WIN32 -#include "win32/n2n_win32.h" - -#ifndef CMAKE_BUILD -#include "config.h" /* Visual C++ */ -#else -#include "win32/winconfig.h" -#endif -#define N2N_CAN_NAME_IFACE 1 -#undef N2N_HAVE_DAEMON -#undef N2N_HAVE_SETUID -#else -#ifndef CMAKE_BUILD -#include "config.h" -#endif -#endif - - - -#define PACKAGE_BUILDDATE (__DATE__ " " __TIME__) - -#include -#include -#include - -#ifndef WIN32 -#include -#endif - -#ifndef _MSC_VER -#include -#endif /* #ifndef _MSC_VER */ - -#include -#include -#include -#include -#include - -#ifndef WIN32 -#include -#include -#include -#include -#include - -#ifdef __linux__ -#define N2N_CAN_NAME_IFACE 1 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define GRND_NONBLOCK 1 -#endif /* #ifdef __linux__ */ - -#ifdef __FreeBSD__ -#include -#endif /* #ifdef __FreeBSD__ */ - -#include -#include - -#if defined (__RDRND__) || defined (__RDSEED__) -#include -#endif - -#define ETH_ADDR_LEN 6 - -struct ether_hdr -{ - uint8_t dhost[ETH_ADDR_LEN]; - uint8_t shost[ETH_ADDR_LEN]; - uint16_t type; /* higher layer protocol encapsulated */ -} __attribute__ ((__packed__)); - -typedef struct ether_hdr ether_hdr_t; - -#ifdef HAVE_LIBZSTD -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef N2N_HAVE_AES -#include -#include -#endif - - -#define closesocket(a) close(a) -#endif /* #ifndef WIN32 */ - -#include "minilzo.h" -#include "n2n_define.h" -#include -#include -#include -#include "uthash.h" -#include "lzoconf.h" - -#ifdef WIN32 -#include "win32/wintap.h" -#include -#else -#include -#endif /* #ifdef WIN32 */ - -#include "n2n_wire.h" -#include "n2n_transforms.h" -#include "random_numbers.h" -#include "pearson.h" -#include "portable_endian.h" -#include "speck.h" - -#ifdef WIN32 -#define N2N_IFNAMSIZ 64 -#else -#define N2N_IFNAMSIZ 16 /* 15 chars * NULL */ -#endif - -#ifndef WIN32 -typedef struct tuntap_dev { - int fd; - int if_idx; - uint8_t mac_addr[6]; - uint32_t ip_addr, device_mask; - uint16_t mtu; - char dev_name[N2N_IFNAMSIZ]; -} tuntap_dev; - -#define SOCKET int -#endif /* #ifndef WIN32 */ - -/** Uncomment this to enable the MTU check, then try to ssh to generate a fragmented packet. */ -/** NOTE: see doc/MTU.md for an explanation on the 1400 value */ -//#define MTU_ASSERT_VALUE 1400 - -/** Common type used to hold stringified IP addresses. */ -typedef char ipstr_t[32]; - -/** Common type used to hold stringified MAC addresses. */ -#define N2N_MACSTR_SIZE 32 -typedef char macstr_t[N2N_MACSTR_SIZE]; - -struct peer_info { - n2n_mac_t mac_addr; - n2n_sock_t sock; - int timeout; - time_t last_seen; - time_t last_p2p; - time_t last_sent_query; - uint64_t last_valid_time_stamp; - - UT_hash_handle hh; /* makes this structure hashable */ -}; - -typedef struct speck_context_t he_context_t; -typedef char n2n_sn_name_t[N2N_EDGE_SN_HOST_SIZE]; - -typedef struct n2n_route { - in_addr_t net_addr; - int net_bitlen; - in_addr_t gateway; -} n2n_route_t; - -typedef struct n2n_edge n2n_edge_t; - -/* *************************************************** */ - -typedef enum { - N2N_ACCEPT = 0, - N2N_DROP = 1 -} n2n_verdict; - -/* *************************************************** */ - -/* Callbacks allow external programs to attach functions in response to - * N2N events. */ -typedef struct n2n_edge_callbacks { - /* The supernode registration has been updated */ - void (*sn_registration_updated)(n2n_edge_t *eee, time_t now, const n2n_sock_t *sn); - - /* A packet has been received from a peer. N2N_DROP can be returned to - * drop the packet. The packet payload can be modified. This only allows - * the packet size to be reduced */ - n2n_verdict (*packet_from_peer)(n2n_edge_t *eee, const n2n_sock_t *peer, uint8_t *payload, uint16_t *payload_size); - - /* A packet has been received from the TAP interface. N2N_DROP can be - * returned to drop the packet. The packet payload can be modified. - * This only allows the packet size to be reduced */ - n2n_verdict (*packet_from_tap)(n2n_edge_t *eee, uint8_t *payload, uint16_t *payload_size); - - /* Called whenever the IP address of the TAP interface changes. */ - void (*ip_address_changed)(n2n_edge_t *eee, uint32_t old_ip, uint32_t new_ip); - - /* Called periodically in the main loop. */ - void (*main_loop_period)(n2n_edge_t *eee, time_t now); -} n2n_edge_callbacks_t; - -/* ***************************************************** */ - -typedef struct n2n_tuntap_priv_config { - char tuntap_dev_name[N2N_IFNAMSIZ]; - char ip_mode[N2N_IF_MODE_SIZE]; - char ip_addr[N2N_NETMASK_STR_SIZE]; - char netmask[N2N_NETMASK_STR_SIZE]; - char device_mac[N2N_MACNAMSIZ]; - int mtu; - uint8_t got_s; - uint8_t daemon; -#ifndef WIN32 - uid_t userid; - gid_t groupid; -#endif -} n2n_tuntap_priv_config_t; - -/* *************************************************** */ - -typedef struct n2n_edge_conf { - n2n_sn_name_t sn_ip_array[N2N_EDGE_NUM_SUPERNODES]; - n2n_route_t *routes; /**< Networks to route through n2n */ - n2n_community_t community_name; /**< The community. 16 full octets. */ - uint8_t header_encryption; /**< Header encryption indicator. */ - he_context_t *header_encryption_ctx; /**< Header encryption cipher context. */ - he_context_t *header_iv_ctx; /**< Header IV ecnryption cipher context, REMOVE as soon as seperte fileds for checksum and replay protection available */ - n2n_transform_t transop_id; /**< The transop to use. */ - uint16_t compression; /**< Compress outgoing data packets before encryption */ - uint16_t num_routes; /**< Number of routes in routes */ - uint8_t dyn_ip_mode; /**< Interface IP address is dynamically allocated, eg. DHCP. */ - uint8_t allow_routing; /**< Accept packet no to interface address. */ - uint8_t drop_multicast; /**< Multicast ethernet addresses. */ - uint8_t disable_pmtu_discovery; /**< Disable the Path MTU discovery. */ - uint8_t allow_p2p; /**< Allow P2P connection */ - uint8_t sn_num; /**< Number of supernode addresses defined. */ - uint8_t tos; /** TOS for sent packets */ - char *encrypt_key; - int register_interval; /**< Interval for supernode registration, also used for UDP NAT hole punching. */ - int register_ttl; /**< TTL for registration packet when UDP NAT hole punching through supernode. */ - int local_port; - int mgmt_port; -} n2n_edge_conf_t; - -struct n2n_edge_stats { - uint32_t tx_p2p; - uint32_t rx_p2p; - uint32_t tx_sup; - uint32_t rx_sup; - uint32_t tx_sup_broadcast; - uint32_t rx_sup_broadcast; -}; - -struct n2n_edge { - n2n_edge_conf_t conf; - - /* Status */ - uint8_t sn_idx; /**< Currently active supernode. */ - uint8_t sn_wait; /**< Whether we are waiting for a supernode response. */ - size_t sup_attempts; /**< Number of remaining attempts to this supernode. */ - tuntap_dev device; /**< All about the TUNTAP device */ - n2n_trans_op_t transop; /**< The transop to use when encoding */ - n2n_cookie_t last_cookie; /**< Cookie sent in last REGISTER_SUPER. */ - n2n_route_t *sn_route_to_clean; /**< Supernode route to clean */ - n2n_edge_callbacks_t cb; /**< API callbacks */ - void *user_data; /**< Can hold user data */ - uint64_t sn_last_valid_time_stamp;/*< last valid time stamp from supernode */ - - /* Sockets */ - n2n_sock_t supernode; - int udp_sock; - int udp_mgmt_sock; /**< socket for status info. */ - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - n2n_sock_t multicast_peer; /**< Multicast peer group (for local edges) */ - int udp_multicast_sock; /**< socket for local multicast registrations. */ - int multicast_joined; /**< 1 if the group has been joined.*/ -#endif - - /* Peers */ - struct peer_info * known_peers; /**< Edges we are connected to. */ - struct peer_info * pending_peers; /**< Edges we have tried to register with. */ - - /* Timers */ - time_t last_register_req; /**< Check if time to re-register with super*/ - time_t last_p2p; /**< Last time p2p traffic was received. */ - time_t last_sup; /**< Last time a packet arrived from supernode. */ - time_t start_time; /**< For calculating uptime */ - - /* Statistics */ - struct n2n_edge_stats stats; - /* Tuntap config */ - n2n_tuntap_priv_config_t tuntap_priv_conf; -}; - -typedef struct sn_stats -{ - size_t errors; /* Number of errors encountered. */ - size_t reg_super; /* Number of REGISTER_SUPER requests received. */ - size_t reg_super_nak; /* Number of REGISTER_SUPER requests declined. */ - size_t fwd; /* Number of messages forwarded. */ - size_t broadcast; /* Number of messages broadcast to a community. */ - time_t last_fwd; /* Time when last message was forwarded. */ - time_t last_reg_super; /* Time when last REGISTER_SUPER was received. */ -} sn_stats_t; - -struct sn_community -{ - char community[N2N_COMMUNITY_SIZE]; - uint8_t header_encryption; /* Header encryption indicator. */ - he_context_t *header_encryption_ctx; /* Header encryption cipher context. */ - he_context_t *header_iv_ctx; /* Header IV ecnryption cipher context, REMOVE as soon as seperate fields for checksum and replay protection available */ - struct peer_info *edges; /* Link list of registered edges. */ - int64_t number_enc_packets; /* Number of encrypted packets handled so far, required for sorting from time to time */ - - UT_hash_handle hh; /* makes this structure hashable */ -}; - -typedef struct n2n_sn -{ - time_t start_time; /* Used to measure uptime. */ - sn_stats_t stats; - int daemon; /* If non-zero then daemonise. */ - uint16_t lport; /* Local UDP port to bind to. */ - uint16_t mport; /* Management UDP port to bind to. */ - int sock; /* Main socket for UDP traffic with edges. */ - int mgmt_sock; /* management socket. */ -#ifndef WIN32 - uid_t userid; - gid_t groupid; -#endif - int lock_communities; /* If true, only loaded communities can be used. */ - struct sn_community *communities; -} n2n_sn_t; - -/* ************************************** */ - -#include "header_encryption.h" -#include "twofish.h" - -#ifndef TRACE_ERROR -#define TRACE_ERROR 0, __FILE__, __LINE__ -#define TRACE_WARNING 1, __FILE__, __LINE__ -#define TRACE_NORMAL 2, __FILE__, __LINE__ -#define TRACE_INFO 3, __FILE__, __LINE__ -#define TRACE_DEBUG 4, __FILE__, __LINE__ -#endif - -/* ************************************** */ - -/* Transop Init Functions */ -int n2n_transop_null_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); -int n2n_transop_twofish_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); -#ifdef N2N_HAVE_AES -int n2n_transop_aes_cbc_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); -#endif -#ifdef HAVE_OPENSSL_1_1 -int n2n_transop_cc20_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); -#endif -int n2n_transop_speck_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); - -/* Log */ -void setTraceLevel(int level); -void setUseSyslog(int use_syslog); -void setTraceFile(FILE *f); -int getTraceLevel(); -void closeTraceFile(); -void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...); - -/* Tuntap API */ -int tuntap_open(tuntap_dev *device, char *dev, const char *address_mode, char *device_ip, - char *device_mask, const char * device_mac, int mtu); -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len); -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len); -void tuntap_close(struct tuntap_dev *tuntap); -void tuntap_get_address(struct tuntap_dev *tuntap); - -/* Utils */ -char* intoa(uint32_t addr, char* buf, uint16_t buf_len); -char* macaddr_str(macstr_t buf, const n2n_mac_t mac); -int str2mac( uint8_t * outmac /* 6 bytes */, const char * s ); -uint8_t is_multi_broadcast(const uint8_t * dest_mac); -char* msg_type2str(uint16_t msg_type); -void hexdump(const uint8_t * buf, size_t len); -void print_n2n_version(); -int is_empty_ip_address(const n2n_sock_t * sock); -void print_edge_stats(const n2n_edge_t *eee); - -/* Sockets */ -char* sock_to_cstr( n2n_sock_str_t out, - const n2n_sock_t * sock ); -SOCKET open_socket(int local_port, int bind_any); -int sock_equal( const n2n_sock_t * a, - const n2n_sock_t * b ); - -/* Header encryption */ -uint64_t time_stamp(void); -uint64_t initial_time_stamp (void); -int time_stamp_verify_and_update (uint64_t stamp, uint64_t * previous_stamp); - -/* Operations on peer_info lists. */ -size_t purge_peer_list( struct peer_info ** peer_list, - time_t purge_before ); -size_t clear_peer_list( struct peer_info ** peer_list ); -size_t purge_expired_registrations( struct peer_info ** peer_list, time_t* p_last_purge ); - -/* Edge conf */ -void edge_init_conf_defaults(n2n_edge_conf_t *conf); -int edge_verify_conf(const n2n_edge_conf_t *conf); -int edge_conf_add_supernode(n2n_edge_conf_t *conf, const char *ip_and_port); -const n2n_edge_conf_t* edge_get_conf(const n2n_edge_t *eee); -void edge_term_conf(n2n_edge_conf_t *conf); - -/* Public functions */ -n2n_edge_t* edge_init(const tuntap_dev *dev, const n2n_edge_conf_t *conf, int *rv); -void edge_term(n2n_edge_t *eee); -void edge_set_callbacks(n2n_edge_t *eee, const n2n_edge_callbacks_t *callbacks); -void edge_set_userdata(n2n_edge_t *eee, void *user_data); -void* edge_get_userdata(n2n_edge_t *eee); -void edge_send_packet2net(n2n_edge_t *eee, uint8_t *tap_pkt, size_t len); -void edge_read_from_tap(n2n_edge_t *eee); -int edge_get_n2n_socket(n2n_edge_t *eee); -int edge_get_management_socket(n2n_edge_t *eee); -int run_edge_loop(n2n_edge_t *eee, int *keep_running); -int quick_edge_init(char *device_name, char *community_name, - char *encrypt_key, char *device_mac, - char *local_ip_address, - char *supernode_ip_address_port, - int *keep_on_running); -int sn_init(n2n_sn_t *sss); -void sn_term(n2n_sn_t *sss); -int run_sn_loop(n2n_sn_t *sss, int *keep_running); -const char* compression_str(uint8_t cmpr); -const char* transop_str(enum n2n_transform tr); - -#endif /* _N2N_H_ */ diff --git a/bundles/n2n_ntop_v2/include/n2n_define.h b/bundles/n2n_ntop_v2/include/n2n_define.h deleted file mode 100644 index 4d3c48b6..00000000 --- a/bundles/n2n_ntop_v2/include/n2n_define.h +++ /dev/null @@ -1,114 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -/* N2N packet header indicators. */ -#define MSG_TYPE_REGISTER 1 -#define MSG_TYPE_DEREGISTER 2 -#define MSG_TYPE_PACKET 3 -#define MSG_TYPE_REGISTER_ACK 4 -#define MSG_TYPE_REGISTER_SUPER 5 -#define MSG_TYPE_REGISTER_SUPER_ACK 6 -#define MSG_TYPE_REGISTER_SUPER_NAK 7 -#define MSG_TYPE_FEDERATION 8 -#define MSG_TYPE_PEER_INFO 9 -#define MSG_TYPE_QUERY_PEER 10 -#define MSG_TYPE_MAX_TYPE 10 - -#define SOCKET_TIMEOUT_INTERVAL_SECS 10 -#define REGISTER_SUPER_INTERVAL_DFL 20 /* sec, usually UDP NAT entries in a firewall expire after 30 seconds */ - -#define IFACE_UPDATE_INTERVAL (30) /* sec. How long it usually takes to get an IP lease. */ -#define TRANSOP_TICK_INTERVAL (10) /* sec */ - -#define PURGE_REGISTRATION_FREQUENCY 30 -#define REGISTRATION_TIMEOUT 60 - -#define SORT_COMMUNITIES_INTERVAL 90 /* sec. until supernode sorts communities' hash list again */ - -#define ETH_FRAMESIZE 14 -#define IP4_SRCOFFSET 12 -#define IP4_DSTOFFSET 16 -#define IP4_MIN_SIZE 20 -#define UDP_SIZE 8 - -/* parameters for replay protection */ -#define TIME_STAMP_FRAME 0x0000001000000000LL /* clocks of different computers are allowed +/- 16 seconds to be off */ -#define TIME_STAMP_JITTER 0x0000000027100000LL /* we allow a packet to arrive 160 ms (== 0x27100 us) before another - * set to 0x0000000000000000LL if increasing (or equal) time stamps allowed only */ - -/* parameter for random number generation */ -#define RND_RETRIES 1000 /* syscall and inquiring random number from hardware generators might fail, so we will retry */ - -/* N2N compression indicators. */ -/* Compression is disabled by default for outgoing packets if no cli - * option is given. All edges are built with decompression support so - * they are able to understand each other (this applies to lzo only). */ -#define N2N_COMPRESSION_ID_NONE 0 /* default, see edge_init_conf_defaults(...) in edge_utils.c */ -#define N2N_COMPRESSION_ID_LZO 1 /* set if '-z1' or '-z' cli option is present, see setOption(...) in edge.c */ -#ifdef N2N_HAVE_ZSTD -#define N2N_COMPRESSION_ID_ZSTD 2 /* set if '-z2' cli option is present, available only if compiled with zstd lib */ -#define ZSTD_COMPRESSION_LEVEL 7 /* 1 (faster) ... 22 (more compression) */ -#endif -// with the next major packet structure update, make '0' = invalid, and '1' = no compression -// '2' = LZO, '3' = ZSTD, ... REVISIT then (also: change all occurences in source). - -#define N2N_COMPRESSION_ID_BITLEN 3 /* number of bits used for encoding compression id in the uppermost - bits of transform_id; will be obsolete as soon as compression gets - its own field in the packet. REVISIT then. */ - -/* Header encryption indicators */ -#define HEADER_ENCRYPTION_UNKNOWN 0 -#define HEADER_ENCRYPTION_NONE 1 -#define HEADER_ENCRYPTION_ENABLED 2 - -#define DEFAULT_MTU 1290 - -#define HASH_ADD_PEER(head,add) \ - HASH_ADD(hh,head,mac_addr,sizeof(n2n_mac_t),add) -#define HASH_FIND_PEER(head,mac,out) \ - HASH_FIND(hh,head,mac,sizeof(n2n_mac_t),out) -#define N2N_EDGE_SN_HOST_SIZE 48 -#define N2N_EDGE_NUM_SUPERNODES 2 -#define N2N_EDGE_SUP_ATTEMPTS 3 /* Number of failed attmpts before moving on to next supernode. */ -#define N2N_PATHNAME_MAXLEN 256 -#define N2N_EDGE_MGMT_PORT 5644 -#define N2N_SN_MGMT_PORT 5645 - -#define N2N_NETMASK_STR_SIZE 16 /* dotted decimal 12 numbers + 3 dots */ -#define N2N_MACNAMSIZ 18 /* AA:BB:CC:DD:EE:FF + NULL*/ -#define N2N_IF_MODE_SIZE 16 /* static | dhcp */ - -#define N2N_SN_LPORT_DEFAULT 7654 -#define N2N_SN_PKTBUF_SIZE 2048 - - -/* ************************************** */ - -#define SUPERNODE_IP "127.0.0.1" -#define SUPERNODE_PORT 1234 - -/* ************************************** */ - -#ifndef max -#define max(a, b) ((a < b) ? b : a) -#endif - -#ifndef min -#define min(a, b) ((a > b) ? b : a) -#endif - diff --git a/bundles/n2n_ntop_v2/include/n2n_transforms.h b/bundles/n2n_ntop_v2/include/n2n_transforms.h deleted file mode 100644 index 589e36bb..00000000 --- a/bundles/n2n_ntop_v2/include/n2n_transforms.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#if !defined(N2N_TRANSFORMS_H_) -#define N2N_TRANSFORMS_H_ - -#include -#include "n2n_wire.h" - -#define N2N_TRANSFORM_ID_USER_START 64 -#define N2N_TRANSFORM_ID_MAX 65535 - -typedef enum n2n_transform { - N2N_TRANSFORM_ID_INVAL = 0, - N2N_TRANSFORM_ID_NULL = 1, - N2N_TRANSFORM_ID_TWOFISH = 2, - N2N_TRANSFORM_ID_AESCBC = 3, - N2N_TRANSFORM_ID_CHACHA20 = 4, - N2N_TRANSFORM_ID_SPECK = 5, -} n2n_transform_t; - -struct n2n_trans_op; - -typedef int (*n2n_transdeinit_f)( struct n2n_trans_op * arg ); -typedef void (*n2n_transtick_f)( struct n2n_trans_op * arg, time_t now ); -typedef int (*n2n_transform_f)( struct n2n_trans_op * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const n2n_mac_t peer_mac); - -/** Holds the info associated with a data transform plugin. - * - * When a packet arrives the transform ID is extracted. This defines the code - * to use to decode the packet content. The transform code then decodes the - * packet and consults its internal key lookup. - */ -typedef struct n2n_trans_op { - void * priv; /* opaque data. Key schedule goes here. */ - uint8_t no_encryption; /* 1 if this transop does not perform encryption */ - n2n_transform_t transform_id; - size_t tx_cnt; - size_t rx_cnt; - - n2n_transdeinit_f deinit; /* destructor function */ - n2n_transtick_f tick; /* periodic maintenance */ - n2n_transform_f fwd; /* encode a payload */ - n2n_transform_f rev; /* decode a payload */ -} n2n_trans_op_t; - -#endif /* #if !defined(N2N_TRANSFORMS_H_) */ - diff --git a/bundles/n2n_ntop_v2/include/n2n_wire.h b/bundles/n2n_ntop_v2/include/n2n_wire.h deleted file mode 100644 index 7cd0e41e..00000000 --- a/bundles/n2n_ntop_v2/include/n2n_wire.h +++ /dev/null @@ -1,338 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#if !defined( N2N_WIRE_H_ ) -#define N2N_WIRE_H_ - -#include - -#if defined(WIN32) -#include "win32/n2n_win32.h" - -#if defined(__MINGW32__) -#include -#endif /* #ifdef __MINGW32__ */ - -#else /* #if defined(WIN32) */ -#include -#include -#include /* AF_INET and AF_INET6 */ -#endif /* #if defined(WIN32) */ - -#define N2N_PKT_VERSION 2 -#define N2N_DEFAULT_TTL 2 /* can be forwarded twice at most */ -#define N2N_COMMUNITY_SIZE 16 -#define N2N_MAC_SIZE 6 -#define N2N_COOKIE_SIZE 4 -#define N2N_PKT_BUF_SIZE 2048 -#define N2N_SOCKBUF_SIZE 64 /* string representation of INET or INET6 sockets */ - -#define N2N_MULTICAST_PORT 1968 -#define N2N_MULTICAST_GROUP "224.0.0.68" - -typedef uint8_t n2n_community_t[N2N_COMMUNITY_SIZE]; -typedef uint8_t n2n_mac_t[N2N_MAC_SIZE]; -typedef uint8_t n2n_cookie_t[N2N_COOKIE_SIZE]; - -typedef char n2n_sock_str_t[N2N_SOCKBUF_SIZE]; /* tracing string buffer */ - -typedef enum n2n_pc -{ - n2n_ping=0, /* Not used */ - n2n_register=1, /* Register edge to edge */ - n2n_deregister=2, /* Deregister this edge */ - n2n_packet=3, /* PACKET data content */ - n2n_register_ack=4, /* ACK of a registration from edge to edge */ - n2n_register_super=5, /* Register edge to supernode */ - n2n_register_super_ack=6, /* ACK from supernode to edge */ - n2n_register_super_nak=7, /* NAK from supernode to edge - registration refused */ - n2n_federation=8, /* Not used by edge */ - n2n_peer_info=9, /* Send info on a peer from sn to edge */ - n2n_query_peer=10 /* ask supernode for info on a peer */ -} n2n_pc_t; - -#define N2N_FLAGS_OPTIONS 0x0080 -#define N2N_FLAGS_SOCKET 0x0040 -#define N2N_FLAGS_FROM_SUPERNODE 0x0020 - -/* The bits in flag that are the packet type */ -#define N2N_FLAGS_TYPE_MASK 0x001f /* 0 - 31 */ -#define N2N_FLAGS_BITS_MASK 0xffe0 - -#define IPV4_SIZE 4 -#define IPV6_SIZE 16 - - -#define N2N_AUTH_TOKEN_SIZE 32 /* bytes */ - - -#define N2N_EUNKNOWN -1 -#define N2N_ENOTIMPL -2 -#define N2N_EINVAL -3 -#define N2N_ENOSPACE -4 - -typedef struct n2n_sock -{ - uint8_t family; /* AF_INET or AF_INET6; or 0 if invalid */ - uint16_t port; /* host order */ - union - { - uint8_t v6[IPV6_SIZE]; /* byte sequence */ - uint8_t v4[IPV4_SIZE]; /* byte sequence */ - } addr; -} n2n_sock_t; - -typedef struct n2n_auth -{ - uint16_t scheme; /* What kind of auth */ - uint16_t toksize; /* Size of auth token */ - uint8_t token[N2N_AUTH_TOKEN_SIZE]; /* Auth data interpreted based on scheme */ -} n2n_auth_t; - -typedef struct n2n_common -{ - /* NOTE: wire representation is different! */ - /* int version; */ - - uint8_t ttl; - uint8_t pc; - uint16_t flags; - n2n_community_t community; -} n2n_common_t; - -typedef struct n2n_REGISTER -{ - n2n_cookie_t cookie; /* Link REGISTER and REGISTER_ACK */ - n2n_mac_t srcMac; /* MAC of registering party */ - n2n_mac_t dstMac; /* MAC of target edge */ - n2n_sock_t sock; /* REVISIT: unused? */ -} n2n_REGISTER_t; - -typedef struct n2n_REGISTER_ACK -{ - n2n_cookie_t cookie; /* Return cookie from REGISTER */ - n2n_mac_t srcMac; /* MAC of acknowledging party (supernode or edge) */ - n2n_mac_t dstMac; /* Reflected MAC of registering edge from REGISTER */ - n2n_sock_t sock; /* Supernode's view of edge socket (IP Addr, port) */ -} n2n_REGISTER_ACK_t; - -typedef struct n2n_PACKET -{ - n2n_mac_t srcMac; - n2n_mac_t dstMac; - n2n_sock_t sock; - uint16_t transform; - uint16_t compression; -} n2n_PACKET_t; - -/* Linked with n2n_register_super in n2n_pc_t. Only from edge to supernode. */ -typedef struct n2n_REGISTER_SUPER -{ - n2n_cookie_t cookie; /* Link REGISTER_SUPER and REGISTER_SUPER_ACK */ - n2n_mac_t edgeMac; /* MAC to register with edge sending socket */ - n2n_auth_t auth; /* Authentication scheme and tokens */ -} n2n_REGISTER_SUPER_t; - -/* Linked with n2n_register_super_ack in n2n_pc_t. Only from supernode to edge. */ -typedef struct n2n_REGISTER_SUPER_ACK -{ - n2n_cookie_t cookie; /* Return cookie from REGISTER_SUPER */ - n2n_mac_t edgeMac; /* MAC registered to edge sending socket */ - uint16_t lifetime; /* How long the registration will live */ - n2n_sock_t sock; /* Sending sockets associated with edgeMac */ - - /* The packet format provides additional supernode definitions here. - * uint8_t count, then for each count there is one - * n2n_sock_t. - */ - uint8_t num_sn; /* Number of supernodes that were send - * even if we cannot store them all. If - * non-zero then sn_bak is valid. */ - n2n_sock_t sn_bak; /* Socket of the first backup supernode */ - -} n2n_REGISTER_SUPER_ACK_t; - - -/* Linked with n2n_register_super_ack in n2n_pc_t. Only from supernode to edge. */ -typedef struct n2n_REGISTER_SUPER_NAK -{ - n2n_cookie_t cookie; /* Return cookie from REGISTER_SUPER */ -} n2n_REGISTER_SUPER_NAK_t; - -typedef struct n2n_PEER_INFO -{ - uint16_t aflags; - n2n_mac_t mac; - n2n_sock_t sock; -} n2n_PEER_INFO_t; - -typedef struct n2n_QUERY_PEER -{ - n2n_mac_t srcMac; - n2n_mac_t targetMac; -} n2n_QUERY_PEER_t; - -typedef struct n2n_buf n2n_buf_t; - -int encode_uint8( uint8_t * base, - size_t * idx, - const uint8_t v ); - -int decode_uint8( uint8_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_uint16( uint8_t * base, - size_t * idx, - const uint16_t v ); - -int decode_uint16( uint16_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_uint32( uint8_t * base, - size_t * idx, - const uint32_t v ); - -int decode_uint32( uint32_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_buf( uint8_t * base, - size_t * idx, - const void * p, - size_t s); - -int decode_buf( uint8_t * out, - size_t bufsize, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_mac( uint8_t * base, - size_t * idx, - const n2n_mac_t m ); - -int decode_mac( uint8_t * out, /* of size N2N_MAC_SIZE. This clearer than passing a n2n_mac_t */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_common( uint8_t * base, - size_t * idx, - const n2n_common_t * common ); - -int decode_common( n2n_common_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_sock( uint8_t * base, - size_t * idx, - const n2n_sock_t * sock ); - -int decode_sock( n2n_sock_t * sock, - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_REGISTER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_t * reg ); - -int decode_REGISTER( n2n_REGISTER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_REGISTER_SUPER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_SUPER_t * reg ); - -int decode_REGISTER_SUPER( n2n_REGISTER_SUPER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_REGISTER_ACK( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_ACK_t * reg ); - -int decode_REGISTER_ACK( n2n_REGISTER_ACK_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_REGISTER_SUPER_ACK( uint8_t * base, - size_t * idx, - const n2n_common_t * cmn, - const n2n_REGISTER_SUPER_ACK_t * reg ); - -int decode_REGISTER_SUPER_ACK( n2n_REGISTER_SUPER_ACK_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int fill_sockaddr( struct sockaddr * addr, - size_t addrlen, - const n2n_sock_t * sock ); - -int encode_PACKET( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PACKET_t * pkt ); - -int decode_PACKET( n2n_PACKET_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_PEER_INFO( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PEER_INFO_t * pkt ); - -int decode_PEER_INFO( n2n_PEER_INFO_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -int encode_QUERY_PEER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_QUERY_PEER_t * pkt ); - -int decode_QUERY_PEER( n2n_QUERY_PEER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ); - -#endif /* #if !defined( N2N_WIRE_H_ ) */ diff --git a/bundles/n2n_ntop_v2/include/pearson.h b/bundles/n2n_ntop_v2/include/pearson.h deleted file mode 100644 index 24e51fe5..00000000 --- a/bundles/n2n_ntop_v2/include/pearson.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -void pearson_hash_256 (uint8_t *out, const uint8_t *in, size_t len); - -void pearson_hash_128 (uint8_t *out, const uint8_t *in, size_t len); - -uint16_t pearson_hash_16 (const uint8_t *in, size_t len); - -void pearson_hash_init(); diff --git a/bundles/n2n_ntop_v2/include/portable_endian.h b/bundles/n2n_ntop_v2/include/portable_endian.h deleted file mode 100644 index 9c46ffe5..00000000 --- a/bundles/n2n_ntop_v2/include/portable_endian.h +++ /dev/null @@ -1,226 +0,0 @@ -// taken from -// https://raw.githubusercontent.com/pyca/bcrypt/master/src/_csrc/portable_endian.h -// as of June 11, 2020 - -// "License": Public Domain -// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like. -// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to -// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it -// an example on how to get the endian conversion functions on different platforms. - -#ifndef PORTABLE_ENDIAN_H__ -#define PORTABLE_ENDIAN_H__ - -#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) - -# define __WINDOWS__ - -#endif - -#if defined(__linux__) || defined(__CYGWIN__) -/* Define necessary macros for the header to expose all fields. */ -# if !defined(_BSD_SOURCE) -# define _BSD_SOURCE -# endif -# if !defined(__USE_BSD) -# define __USE_BSD -# endif -# if !defined(_DEFAULT_SOURCE) -# define _DEFAULT_SOURCE -# endif -# include -# include -/* See http://linux.die.net/man/3/endian */ -# if defined(htobe16) && defined(htole16) && defined(be16toh) && defined(le16toh) && defined(htobe32) && defined(htole32) && defined(be32toh) && defined(htole32) && defined(htobe64) && defined(htole64) && defined(htobe64) && defined(be64toh) && defined(htole64) && defined(le64toh) -/* Do nothing. The macros we need already exist. */ -# elif !defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 9))) -# include -# if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) -# define htobe16(x) htons(x) -# define htole16(x) (x) -# define be16toh(x) ntohs(x) -# define le16toh(x) (x) - -# define htobe32(x) htonl(x) -# define htole32(x) (x) -# define be32toh(x) ntohl(x) -# define le32toh(x) (x) - -# define htobe64(x) (((uint64_t)htonl(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)htonl(((uint32_t)(x)))) << 32)) -# define htole64(x) (x) -# define be64toh(x) (((uint64_t)ntohl(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)ntohl(((uint32_t)(x)))) << 32)) -# define le64toh(x) (x) -# elif defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN) -# define htobe16(x) (x) -# define htole16(x) (((((uint16_t)(x)) >> 8))|((((uint16_t)(x)) << 8))) -# define be16toh(x) (x) -# define le16toh(x) (((((uint16_t)(x)) >> 8))|((((uint16_t)(x)) << 8))) - -# define htobe32(x) (x) -# define htole32(x) (((uint32_t)htole16(((uint16_t)(((uint32_t)(x)) >> 16)))) | (((uint32_t)htole16(((uint16_t)(x)))) << 16)) -# define be32toh(x) (x) -# define le32toh(x) (((uint32_t)le16toh(((uint16_t)(((uint32_t)(x)) >> 16)))) | (((uint32_t)le16toh(((uint16_t)(x)))) << 16)) - -# define htobe64(x) (x) -# define htole64(x) (((uint64_t)htole32(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)htole32(((uint32_t)(x)))) << 32)) -# define be64toh(x) (x) -# define le64toh(x) (((uint64_t)le32toh(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)le32toh(((uint32_t)(x)))) << 32)) -# else -# error Byte Order not supported or not defined. -# endif -# endif - -#elif defined(__APPLE__) - -# include - -# define htobe16(x) OSSwapHostToBigInt16(x) -# define htole16(x) OSSwapHostToLittleInt16(x) -# define be16toh(x) OSSwapBigToHostInt16(x) -# define le16toh(x) OSSwapLittleToHostInt16(x) - -# define htobe32(x) OSSwapHostToBigInt32(x) -# define htole32(x) OSSwapHostToLittleInt32(x) -# define be32toh(x) OSSwapBigToHostInt32(x) -# define le32toh(x) OSSwapLittleToHostInt32(x) - -# define htobe64(x) OSSwapHostToBigInt64(x) -# define htole64(x) OSSwapHostToLittleInt64(x) -# define be64toh(x) OSSwapBigToHostInt64(x) -# define le64toh(x) OSSwapLittleToHostInt64(x) - -# define __BYTE_ORDER BYTE_ORDER -# define __BIG_ENDIAN BIG_ENDIAN -# define __LITTLE_ENDIAN LITTLE_ENDIAN -# define __PDP_ENDIAN PDP_ENDIAN - -#elif defined(__OpenBSD__) - -# include - -#elif defined(__HAIKU__) - -# include - -#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) - -# include - -# if !defined(be16toh) - # define be16toh(x) betoh16(x) - # define le16toh(x) letoh16(x) -# endif - -# if !defined(be32toh) - # define be32toh(x) betoh32(x) - # define le32toh(x) letoh32(x) -# endif - -# if !defined(be64toh) - # define be64toh(x) betoh64(x) - # define le64toh(x) letoh64(x) -# endif - -#elif defined(__WINDOWS__) - -# if BYTE_ORDER == LITTLE_ENDIAN - -# define htobe16(x) _byteswap_ushort(x) -# define htole16(x) (x) -# define be16toh(x) _byteswap_ushort(x) -# define le16toh(x) (x) - -# define htobe32(x) _byteswap_ulong(x) -# define htole32(x) (x) -# define be32toh(x) _byteswap_ulong(x) -# define le32toh(x) (x) - -# define htobe64(x) _byteswap_uint64(x) -# define be64toh(x) _byteswap_uint64(x) -# define htole64(x) (x) -# define le64toh(x) (x) - -# elif BYTE_ORDER == BIG_ENDIAN - - /* that would be xbox 360 */ -# define htobe16(x) (x) -# define htole16(x) __builtin_bswap16(x) -# define be16toh(x) (x) -# define le16toh(x) __builtin_bswap16(x) - -# define htobe32(x) (x) -# define htole32(x) __builtin_bswap32(x) -# define be32toh(x) (x) -# define le32toh(x) __builtin_bswap32(x) - -# define htobe64(x) (x) -# define htole64(x) __builtin_bswap64(x) -# define be64toh(x) (x) -# define le64toh(x) __builtin_bswap64(x) - -# else - -# error byte order not supported - -# endif - -# define __BYTE_ORDER BYTE_ORDER -# define __BIG_ENDIAN BIG_ENDIAN -# define __LITTLE_ENDIAN LITTLE_ENDIAN -# define __PDP_ENDIAN PDP_ENDIAN - -#elif defined(__sun) - -# include - -# define htobe16(x) BE_16(x) -# define htole16(x) LE_16(x) -# define be16toh(x) BE_16(x) -# define le16toh(x) LE_16(x) - -# define htobe32(x) BE_32(x) -# define htole32(x) LE_32(x) -# define be32toh(x) BE_32(x) -# define le32toh(x) LE_32(x) - -# define htobe64(x) BE_64(x) -# define htole64(x) LE_64(x) -# define be64toh(x) BE_64(x) -# define le64toh(x) LE_64(x) - -#elif defined _AIX /* AIX is always big endian */ -# define be64toh(x) (x) -# define be32toh(x) (x) -# define be16toh(x) (x) -# define le32toh(x) \ - ((((x) & 0xff) << 24) | \ - (((x) & 0xff00) << 8) | \ - (((x) & 0xff0000) >> 8) | \ - (((x) & 0xff000000) >> 24)) -# define le64toh(x) \ - ((((x) & 0x00000000000000ffL) << 56) | \ - (((x) & 0x000000000000ff00L) << 40) | \ - (((x) & 0x0000000000ff0000L) << 24) | \ - (((x) & 0x00000000ff000000L) << 8) | \ - (((x) & 0x000000ff00000000L) >> 8) | \ - (((x) & 0x0000ff0000000000L) >> 24) | \ - (((x) & 0x00ff000000000000L) >> 40) | \ - (((x) & 0xff00000000000000L) >> 56)) -# ifndef htobe64 -# define htobe64(x) be64toh(x) -# endif -# ifndef htobe32 -# define htobe32(x) be32toh(x) -# endif -# ifndef htobe16 -# define htobe16(x) be16toh(x) -# endif - - -#else - -# error platform not supported - -#endif - -#endif diff --git a/bundles/n2n_ntop_v2/include/random_numbers.h b/bundles/n2n_ntop_v2/include/random_numbers.h deleted file mode 100644 index 62711634..00000000 --- a/bundles/n2n_ntop_v2/include/random_numbers.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -/* The WIN32 code is still untested and thus commented - #if defined (WIN32) - #include - #endif -*/ - -struct rn_generator_state_t { - uint64_t a, b; -}; - -struct splitmix64_state_t { - uint64_t s; -}; - - -int n2n_srand (uint64_t seed); - -uint64_t n2n_rand (); - -uint64_t n2n_seed (); diff --git a/bundles/n2n_ntop_v2/include/speck.h b/bundles/n2n_ntop_v2/include/speck.h deleted file mode 100644 index 4179e74a..00000000 --- a/bundles/n2n_ntop_v2/include/speck.h +++ /dev/null @@ -1,80 +0,0 @@ -// cipher SPECK -- 128 bit block size -- 256 bit key size -// taken from (and modified: removed pure crypto-stream generation and seperated key expansion) -// https://github.com/nsacyber/simon-speck-supercop/blob/master/crypto_stream/speck128256ctr/ - - -#ifndef SPECK_H -#define SPECK_H - -#include -#define u32 uint32_t -#define u64 uint64_t - -#if defined (__AVX2__) - -#define SPECK_ALIGNED_CTX 32 -#include -#define u256 __m256i -typedef struct { - u256 rk[34]; - u64 key[34]; -} speck_context_t; - -#elif defined (__SSE4_2__) - -#define SPECK_ALIGNED_CTX 16 -#define SPECK_CTX_BYVAL 1 -#include -#define u128 __m128i -typedef struct { - u128 rk[34]; - u64 key[34]; -} speck_context_t; - -#elif defined (__ARM_NEON) - -#include -#define u128 uint64x2_t -typedef struct { - u128 rk[34]; - u64 key[34]; -} speck_context_t; - -#else - -typedef struct { - u64 key[34]; -} speck_context_t; - -#endif - - -int speck_ctr (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, -#if defined (SPECK_CTX_BYVAL) - speck_context_t ctx); -#else -speck_context_t *ctx); -#endif - - -int speck_expand_key (const unsigned char *k, speck_context_t *ctx); - - -int speck_he (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx); - - -int speck_expand_key_he (const unsigned char *k, speck_context_t *ctx); - - -int speck_he_iv_encrypt (unsigned char *inout, speck_context_t *ctx); - - -int speck_he_iv_decrypt (unsigned char *inout, speck_context_t *ctx); - - -int speck_expand_key_he_iv (const unsigned char *k, speck_context_t *ctx); - - -#endif diff --git a/bundles/n2n_ntop_v2/include/twofish.h b/bundles/n2n_ntop_v2/include/twofish.h deleted file mode 100644 index 9682a05e..00000000 --- a/bundles/n2n_ntop_v2/include/twofish.h +++ /dev/null @@ -1,285 +0,0 @@ -/* $Id: twofish.h,v 2.0 2002/08/11 22:32:25 fknobbe Exp $ - * - * - * Copyright (C) 1997-2000 The Cryptix Foundation Limited. - * Copyright (C) 2000 Farm9. - * Copyright (C) 2001 Frank Knobbe. - * All rights reserved. - * - * For Cryptix code: - * Use, modification, copying and distribution of this software is subject - * the terms and conditions of the Cryptix General Licence. You should have - * received a copy of the Cryptix General Licence along with this library; - * if not, you can download a copy from http://www.cryptix.org/ . - * - * For Farm9: - * --- jojo@farm9.com, August 2000, converted from Java to C++, added CBC mode and - * ciphertext stealing technique, added AsciiTwofish class for easy encryption - * decryption of text strings - * - * Frank Knobbe : - * --- April 2001, converted from C++ to C, prefixed global variables - * with TwoFish, substituted some defines, changed functions to make use of - * variables supplied in a struct, modified and added routines for modular calls. - * Cleaned up the code so that defines are used instead of fixed 16's and 32's. - * Created two general purpose crypt routines for one block and multiple block - * encryption using Joh's CBC code. - * Added crypt routines that use a header (with a magic and data length). - * (Basically a major rewrite). - * - * Note: Routines labeled _TwoFish are private and should not be used - * (or with extreme caution). - * - */ - -#ifndef __TWOFISH_LIBRARY_HEADER__ -#define __TWOFISH_LIBRARY_HEADER__ - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE !FALSE -#endif -#ifndef bool -#define bool int -#endif - -#ifdef WIN32 -#include "win32/n2n_win32.h" -#endif - -#ifndef _MSC_VER -/* Not shipped with Visual Studio (as stated by the stdint.h wikipedia page) */ -#include /* defines uintN_t types */ -#endif - -#ifdef __sun__ /* Should be HAVE_SYS_TYPES */ -/* The following are redefinitions if sys/types.h has been included too.*/ -typedef uint32_t uint32_t; -typedef uint8_t uint8_t; -#endif /* #ifdef __sun__ */ - -/* Constants */ - -#define TwoFish_DEFAULT_PW "SnortHas2FishEncryptionRoutines!" /* default password (not more than 32 chars) */ -#define TwoFish_DEFAULT_PW_LEN 32 -#define TwoFish_MAGIC "TwoFish" /* to indentify a successful decryption */ - -enum -{ TwoFish_KEY_SIZE = 256, /* Valid values: 64, 128, 192, 256 */ - /* User 256, other key sizes have not been tested. */ - /* (But should work. I substitutes as much as */ - /* I could with this define.) */ - TwoFish_ROUNDS = 16, - TwoFish_BLOCK_SIZE = 16, /* bytes in a data-block */ - TwoFish_KEY_LENGTH = TwoFish_KEY_SIZE/8, /* 32= 256-bit key */ - TwoFish_TOTAL_SUBKEYS = 4+4+2*TwoFish_ROUNDS, - TwoFish_MAGIC_LEN = TwoFish_BLOCK_SIZE-8, - TwoFish_SK_BUMP = 0x01010101, - TwoFish_SK_ROTL = 9, - TwoFish_P_00 = 1, - TwoFish_P_01 = 0, - TwoFish_P_02 = 0, - TwoFish_P_03 = TwoFish_P_01 ^ 1, - TwoFish_P_04 = 1, - TwoFish_P_10 = 0, - TwoFish_P_11 = 0, - TwoFish_P_12 = 1, - TwoFish_P_13 = TwoFish_P_11 ^ 1, - TwoFish_P_14 = 0, - TwoFish_P_20 = 1, - TwoFish_P_21 = 1, - TwoFish_P_22 = 0, - TwoFish_P_23 = TwoFish_P_21 ^ 1, - TwoFish_P_24 = 0, - TwoFish_P_30 = 0, - TwoFish_P_31 = 1, - TwoFish_P_32 = 1, - TwoFish_P_33 = TwoFish_P_31 ^ 1, - TwoFish_P_34 = 1, - TwoFish_GF256_FDBK = 0x169, - TwoFish_GF256_FDBK_2 = 0x169 / 2, - TwoFish_GF256_FDBK_4 = 0x169 / 4, - TwoFish_RS_GF_FDBK = 0x14D, /* field generator */ - TwoFish_MDS_GF_FDBK = 0x169 /* primitive polynomial for GF(256) */ -}; - - -/* Global data structure for callers */ - -typedef struct -{ - uint32_t sBox[4 * 256]; /* Key dependent S-box */ - uint32_t subKeys[TwoFish_TOTAL_SUBKEYS]; /* Subkeys */ - uint8_t key[TwoFish_KEY_LENGTH]; /* Encryption Key */ - uint8_t *output; /* Pointer to output buffer */ - uint8_t qBlockPlain[TwoFish_BLOCK_SIZE]; /* Used by CBC */ - uint8_t qBlockCrypt[TwoFish_BLOCK_SIZE]; - uint8_t prevCipher[TwoFish_BLOCK_SIZE]; - struct /* Header for crypt functions. Has to be at least one block long. */ - { uint32_t salt; /* Random salt in first block (will salt the rest through CBC) */ - uint8_t length[4]; /* The amount of data following the header */ - uint8_t magic[TwoFish_MAGIC_LEN]; /* Magic to identify successful decryption */ - } header; - bool qBlockDefined; - bool dontflush; -} TWOFISH; - -/**** Public Functions ****/ - -/* TwoFish Initialization - * - * This routine generates a global data structure for use with TwoFish, - * initializes important values (such as subkeys, sBoxes), generates subkeys - * and precomputes the MDS matrix if not already done. - * - * Input: User supplied password (will be appended by default password of 'SnortHas2FishEncryptionRoutines!') - * - * Output: Pointer to TWOFISH structure. This data structure contains key dependent data. - * This pointer is used with all other crypt functions. - */ -TWOFISH *TwoFishInit(const uint8_t *userkey, uint32_t keysize ); - - -/* TwoFish Destroy - * - * Nothing else but a free... - * - * Input: Pointer to the TwoFish structure. - * - */ -void TwoFishDestroy(TWOFISH *tfdata); - - -/* TwoFish Alloc - * - * Allocates enough memory for the output buffer as required. - * - * Input: Length of the plaintext. - * Boolean flag for BinHex Output. - * Pointer to the TwoFish structure. - * - * Output: Returns a pointer to the memory allocated. - */ -void *TwoFishAlloc(uint32_t len,bool binhex,bool decrypt,TWOFISH *tfdata); - - -/* TwoFish Free - * - * Free's the allocated buffer. - * - * Input: Pointer to the TwoFish structure - * - * Output: (none) - */ -void TwoFishFree(TWOFISH *tfdata); - - -/* TwoFish Set Output - * - * If you want to allocate the output buffer yourself, - * then you can set it with this function. - * - * Input: Pointer to your output buffer - * Pointer to the TwoFish structure - * - * Output: (none) - */ -void TwoFishSetOutput(uint8_t *outp,TWOFISH *tfdata); - - -/* TwoFish Raw Encryption - * - * Does not use header, but does use CBC (if more than one block has to be encrypted). - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the buffer receiving the ciphertext. - * The length of the plaintext buffer. - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ -uint32_t TwoFishEncryptRaw(uint8_t *in,uint8_t *out,uint32_t len,TWOFISH *tfdata); - -/* TwoFish Raw Decryption - * - * Does not use header, but does use CBC (if more than one block has to be decrypted). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the buffer receiving the plaintext. - * The length of the ciphertext buffer (at least one cipher block). - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ -uint32_t TwoFishDecryptRaw(uint8_t *in,uint8_t *out,uint32_t len,TWOFISH *tfdata); - - -/* TwoFish Encryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will include a small 'header' - * containing the magic and some salt. That way the decrypt routine can check if the - * packet got decrypted successfully, and return 0 instead of garbage. - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the pointer to the buffer receiving the ciphertext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the plaintext buffer. - * Can be -1 if the input is a null terminated string, in which case we'll count for you. - * Boolean flag for BinHex Output (if used, output will be twice as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ -uint32_t TwoFishEncrypt(uint8_t *in,uint8_t **out,signed long len,bool binhex,TWOFISH *tfdata); - - -/* TwoFish Decryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will check the small 'header' - * containing the magic. If magic does not match we return 0. Otherwise we return the - * amount of bytes decrypted (should be the same as the length in the header). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the pointer to the buffer receiving the plaintext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the ciphertext buffer. - * Can be -1 if the input is a null terminated binhex string, in which case we'll count for you. - * Boolean flag for BinHex Input (if used, plaintext will be half as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ -uint32_t TwoFishDecrypt(uint8_t *in,uint8_t **out,signed long len,bool binhex,TWOFISH *tfdata); - - -/**** Private Functions ****/ - -uint8_t TwoFish__b(uint32_t x,int n); -void _TwoFish_BinHex(uint8_t *buf,uint32_t len,bool bintohex); -uint32_t _TwoFish_CryptRawCBC(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata); -uint32_t _TwoFish_CryptRaw16(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata); -uint32_t _TwoFish_CryptRaw(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata); -void _TwoFish_PrecomputeMDSmatrix(void); -void _TwoFish_MakeSubKeys(TWOFISH *tfdata); -void _TwoFish_qBlockPush(uint8_t *p,uint8_t *c,TWOFISH *tfdata); -void _TwoFish_qBlockPop(uint8_t *p,uint8_t *c,TWOFISH *tfdata); -void _TwoFish_ResetCBC(TWOFISH *tfdata); -void _TwoFish_FlushOutput(uint8_t *b,uint32_t len,TWOFISH *tfdata); -void _TwoFish_BlockCrypt(uint8_t *in,uint8_t *out,uint32_t size,int decrypt,TWOFISH *tfdata); -void _TwoFish_BlockCrypt16(uint8_t *in,uint8_t *out,bool decrypt,TWOFISH *tfdata); -uint32_t _TwoFish_RS_MDS_Encode(uint32_t k0,uint32_t k1); -uint32_t _TwoFish_F32(uint32_t k64Cnt,uint32_t x,uint32_t *k32); -uint32_t _TwoFish_Fe320(uint32_t *lsBox,uint32_t x); -uint32_t _TwoFish_Fe323(uint32_t *lsBox,uint32_t x); -uint32_t _TwoFish_Fe32(uint32_t *lsBox,uint32_t x,uint32_t R); - - -#endif diff --git a/bundles/n2n_ntop_v2/include/uthash.h b/bundles/n2n_ntop_v2/include/uthash.h deleted file mode 100644 index a790ea59..00000000 --- a/bundles/n2n_ntop_v2/include/uthash.h +++ /dev/null @@ -1,1230 +0,0 @@ -/* -Copyright (c) 2003-2018, Troy D. Hanson http://troydhanson.github.com/uthash/ -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER -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. -*/ - -#ifndef UTHASH_H -#define UTHASH_H - -#define UTHASH_VERSION 2.1.0 - -#include /* memcmp, memset, strlen */ -#include /* ptrdiff_t */ -#include /* exit */ - -/* These macros use decltype or the earlier __typeof GNU extension. - As decltype is only available in newer compilers (VS2010 or gcc 4.3+ - when compiling c++ source) this code uses whatever method is needed - or, for VS2008 where neither is available, uses casting workarounds. */ -#if !defined(DECLTYPE) && !defined(NO_DECLTYPE) -#if defined(_MSC_VER) /* MS compiler */ -#if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ -#define DECLTYPE(x) (decltype(x)) -#else /* VS2008 or older (or VS2010 in C mode) */ -#define NO_DECLTYPE -#endif -#elif defined(__BORLANDC__) || defined(__ICCARM__) || defined(__LCC__) || defined(__WATCOMC__) -#define NO_DECLTYPE -#else /* GNU, Sun and other compilers */ -#define DECLTYPE(x) (__typeof(x)) -#endif -#endif - -#ifdef NO_DECLTYPE -#define DECLTYPE(x) -#define DECLTYPE_ASSIGN(dst,src) \ -do { \ - char **_da_dst = (char**)(&(dst)); \ - *_da_dst = (char*)(src); \ -} while (0) -#else -#define DECLTYPE_ASSIGN(dst,src) \ -do { \ - (dst) = DECLTYPE(dst)(src); \ -} while (0) -#endif - -/* a number of the hash function use uint32_t which isn't defined on Pre VS2010 */ -#if defined(_WIN32) -#if defined(_MSC_VER) && _MSC_VER >= 1600 -#include -#elif defined(__WATCOMC__) || defined(__MINGW32__) || defined(__CYGWIN__) -#include -#else -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -#endif -#elif defined(__GNUC__) && !defined(__VXWORKS__) -#include -#else -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -#endif - -#ifndef uthash_malloc -#define uthash_malloc(sz) malloc(sz) /* malloc fcn */ -#endif -#ifndef uthash_free -#define uthash_free(ptr,sz) free(ptr) /* free fcn */ -#endif -#ifndef uthash_bzero -#define uthash_bzero(a,n) memset(a,'\0',n) -#endif -#ifndef uthash_strlen -#define uthash_strlen(s) strlen(s) -#endif - -#ifdef uthash_memcmp -/* This warning will not catch programs that define uthash_memcmp AFTER including uthash.h. */ -#warning "uthash_memcmp is deprecated; please use HASH_KEYCMP instead" -#else -#define uthash_memcmp(a,b,n) memcmp(a,b,n) -#endif - -#ifndef HASH_KEYCMP -#define HASH_KEYCMP(a,b,n) uthash_memcmp(a,b,n) -#endif - -#ifndef uthash_noexpand_fyi -#define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */ -#endif -#ifndef uthash_expand_fyi -#define uthash_expand_fyi(tbl) /* can be defined to log expands */ -#endif - -#ifndef HASH_NONFATAL_OOM -#define HASH_NONFATAL_OOM 0 -#endif - -#if HASH_NONFATAL_OOM -/* malloc failures can be recovered from */ - -#ifndef uthash_nonfatal_oom -#define uthash_nonfatal_oom(obj) do {} while (0) /* non-fatal OOM error */ -#endif - -#define HASH_RECORD_OOM(oomed) do { (oomed) = 1; } while (0) -#define IF_HASH_NONFATAL_OOM(x) x - -#else -/* malloc failures result in lost memory, hash tables are unusable */ - -#ifndef uthash_fatal -#define uthash_fatal(msg) exit(-1) /* fatal OOM error */ -#endif - -#define HASH_RECORD_OOM(oomed) uthash_fatal("out of memory") -#define IF_HASH_NONFATAL_OOM(x) - -#endif - -/* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */ -#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */ - -/* calculate the element whose hash handle address is hhp */ -#define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho))) -/* calculate the hash handle from element address elp */ -#define HH_FROM_ELMT(tbl,elp) ((UT_hash_handle *)(((char*)(elp)) + ((tbl)->hho))) - -#define HASH_ROLLBACK_BKT(hh, head, itemptrhh) \ -do { \ - struct UT_hash_handle *_hd_hh_item = (itemptrhh); \ - unsigned _hd_bkt; \ - HASH_TO_BKT(_hd_hh_item->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ - (head)->hh.tbl->buckets[_hd_bkt].count++; \ - _hd_hh_item->hh_next = NULL; \ - _hd_hh_item->hh_prev = NULL; \ -} while (0) - -#define HASH_VALUE(keyptr,keylen,hashv) \ -do { \ - HASH_FCN(keyptr, keylen, hashv); \ -} while (0) - -#define HASH_FIND_BYHASHVALUE(hh,head,keyptr,keylen,hashval,out) \ -do { \ - (out) = NULL; \ - if (head) { \ - unsigned _hf_bkt; \ - HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _hf_bkt); \ - if (HASH_BLOOM_TEST((head)->hh.tbl, hashval) != 0) { \ - HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], keyptr, keylen, hashval, out); \ - } \ - } \ -} while (0) - -#define HASH_FIND(hh,head,keyptr,keylen,out) \ -do { \ - (out) = NULL; \ - if (head) { \ - unsigned _hf_hashv; \ - HASH_VALUE(keyptr, keylen, _hf_hashv); \ - HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, _hf_hashv, out); \ - } \ -} while (0) - -#ifdef HASH_BLOOM -#define HASH_BLOOM_BITLEN (1UL << HASH_BLOOM) -#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8UL) + (((HASH_BLOOM_BITLEN%8UL)!=0UL) ? 1UL : 0UL) -#define HASH_BLOOM_MAKE(tbl,oomed) \ -do { \ - (tbl)->bloom_nbits = HASH_BLOOM; \ - (tbl)->bloom_bv = (uint8_t*)uthash_malloc(HASH_BLOOM_BYTELEN); \ - if (!(tbl)->bloom_bv) { \ - HASH_RECORD_OOM(oomed); \ - } else { \ - uthash_bzero((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ - (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ - } \ -} while (0) - -#define HASH_BLOOM_FREE(tbl) \ -do { \ - uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ -} while (0) - -#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8U] |= (1U << ((idx)%8U))) -#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8U] & (1U << ((idx)%8U))) - -#define HASH_BLOOM_ADD(tbl,hashv) \ - HASH_BLOOM_BITSET((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U))) - -#define HASH_BLOOM_TEST(tbl,hashv) \ - HASH_BLOOM_BITTEST((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U))) - -#else -#define HASH_BLOOM_MAKE(tbl,oomed) -#define HASH_BLOOM_FREE(tbl) -#define HASH_BLOOM_ADD(tbl,hashv) -#define HASH_BLOOM_TEST(tbl,hashv) (1) -#define HASH_BLOOM_BYTELEN 0U -#endif - -#define HASH_MAKE_TABLE(hh,head,oomed) \ -do { \ - (head)->hh.tbl = (UT_hash_table*)uthash_malloc(sizeof(UT_hash_table)); \ - if (!(head)->hh.tbl) { \ - HASH_RECORD_OOM(oomed); \ - } else { \ - uthash_bzero((head)->hh.tbl, sizeof(UT_hash_table)); \ - (head)->hh.tbl->tail = &((head)->hh); \ - (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ - (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ - (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \ - (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \ - HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ - (head)->hh.tbl->signature = HASH_SIGNATURE; \ - if (!(head)->hh.tbl->buckets) { \ - HASH_RECORD_OOM(oomed); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - } else { \ - uthash_bzero((head)->hh.tbl->buckets, \ - HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ - HASH_BLOOM_MAKE((head)->hh.tbl, oomed); \ - IF_HASH_NONFATAL_OOM( \ - if (oomed) { \ - uthash_free((head)->hh.tbl->buckets, \ - HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - } \ - ) \ - } \ - } \ -} while (0) - -#define HASH_REPLACE_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,replaced,cmpfcn) \ -do { \ - (replaced) = NULL; \ - HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ - if (replaced) { \ - HASH_DELETE(hh, head, replaced); \ - } \ - HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn); \ -} while (0) - -#define HASH_REPLACE_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add,replaced) \ -do { \ - (replaced) = NULL; \ - HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ - if (replaced) { \ - HASH_DELETE(hh, head, replaced); \ - } \ - HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add); \ -} while (0) - -#define HASH_REPLACE(hh,head,fieldname,keylen_in,add,replaced) \ -do { \ - unsigned _hr_hashv; \ - HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ - HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced); \ -} while (0) - -#define HASH_REPLACE_INORDER(hh,head,fieldname,keylen_in,add,replaced,cmpfcn) \ -do { \ - unsigned _hr_hashv; \ - HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ - HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced, cmpfcn); \ -} while (0) - -#define HASH_APPEND_LIST(hh, head, add) \ -do { \ - (add)->hh.next = NULL; \ - (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ - (head)->hh.tbl->tail->next = (add); \ - (head)->hh.tbl->tail = &((add)->hh); \ -} while (0) - -#define HASH_AKBI_INNER_LOOP(hh,head,add,cmpfcn) \ -do { \ - do { \ - if (cmpfcn(DECLTYPE(head)(_hs_iter), add) > 0) { \ - break; \ - } \ - } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \ -} while (0) - -#ifdef NO_DECLTYPE -#undef HASH_AKBI_INNER_LOOP -#define HASH_AKBI_INNER_LOOP(hh,head,add,cmpfcn) \ -do { \ - char *_hs_saved_head = (char*)(head); \ - do { \ - DECLTYPE_ASSIGN(head, _hs_iter); \ - if (cmpfcn(head, add) > 0) { \ - DECLTYPE_ASSIGN(head, _hs_saved_head); \ - break; \ - } \ - DECLTYPE_ASSIGN(head, _hs_saved_head); \ - } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \ -} while (0) -#endif - -#if HASH_NONFATAL_OOM - -#define HASH_ADD_TO_TABLE(hh,head,keyptr,keylen_in,hashval,add,oomed) \ -do { \ - if (!(oomed)) { \ - unsigned _ha_bkt; \ - (head)->hh.tbl->num_items++; \ - HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ - HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \ - if (oomed) { \ - HASH_ROLLBACK_BKT(hh, head, &(add)->hh); \ - HASH_DELETE_HH(hh, head, &(add)->hh); \ - (add)->hh.tbl = NULL; \ - uthash_nonfatal_oom(add); \ - } else { \ - HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ - HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ - } \ - } else { \ - (add)->hh.tbl = NULL; \ - uthash_nonfatal_oom(add); \ - } \ -} while (0) - -#else - -#define HASH_ADD_TO_TABLE(hh,head,keyptr,keylen_in,hashval,add,oomed) \ -do { \ - unsigned _ha_bkt; \ - (head)->hh.tbl->num_items++; \ - HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ - HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \ - HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ - HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ -} while (0) - -#endif - - -#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh,head,keyptr,keylen_in,hashval,add,cmpfcn) \ -do { \ - IF_HASH_NONFATAL_OOM( int _ha_oomed = 0; ) \ - (add)->hh.hashv = (hashval); \ - (add)->hh.key = (char*) (keyptr); \ - (add)->hh.keylen = (unsigned) (keylen_in); \ - if (!(head)) { \ - (add)->hh.next = NULL; \ - (add)->hh.prev = NULL; \ - HASH_MAKE_TABLE(hh, add, _ha_oomed); \ - IF_HASH_NONFATAL_OOM( if (!_ha_oomed) { ) \ - (head) = (add); \ - IF_HASH_NONFATAL_OOM( } ) \ - } else { \ - void *_hs_iter = (head); \ - (add)->hh.tbl = (head)->hh.tbl; \ - HASH_AKBI_INNER_LOOP(hh, head, add, cmpfcn); \ - if (_hs_iter) { \ - (add)->hh.next = _hs_iter; \ - if (((add)->hh.prev = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev)) { \ - HH_FROM_ELMT((head)->hh.tbl, (add)->hh.prev)->next = (add); \ - } else { \ - (head) = (add); \ - } \ - HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev = (add); \ - } else { \ - HASH_APPEND_LIST(hh, head, add); \ - } \ - } \ - HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \ - HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE_INORDER"); \ -} while (0) - -#define HASH_ADD_KEYPTR_INORDER(hh,head,keyptr,keylen_in,add,cmpfcn) \ -do { \ - unsigned _hs_hashv; \ - HASH_VALUE(keyptr, keylen_in, _hs_hashv); \ - HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, _hs_hashv, add, cmpfcn); \ -} while (0) - -#define HASH_ADD_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,cmpfcn) \ - HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn) - -#define HASH_ADD_INORDER(hh,head,fieldname,keylen_in,add,cmpfcn) \ - HASH_ADD_KEYPTR_INORDER(hh, head, &((add)->fieldname), keylen_in, add, cmpfcn) - -#define HASH_ADD_KEYPTR_BYHASHVALUE(hh,head,keyptr,keylen_in,hashval,add) \ -do { \ - IF_HASH_NONFATAL_OOM( int _ha_oomed = 0; ) \ - (add)->hh.hashv = (hashval); \ - (add)->hh.key = (char*) (keyptr); \ - (add)->hh.keylen = (unsigned) (keylen_in); \ - if (!(head)) { \ - (add)->hh.next = NULL; \ - (add)->hh.prev = NULL; \ - HASH_MAKE_TABLE(hh, add, _ha_oomed); \ - IF_HASH_NONFATAL_OOM( if (!_ha_oomed) { ) \ - (head) = (add); \ - IF_HASH_NONFATAL_OOM( } ) \ - } else { \ - (add)->hh.tbl = (head)->hh.tbl; \ - HASH_APPEND_LIST(hh, head, add); \ - } \ - HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \ - HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE"); \ -} while (0) - -#define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \ -do { \ - unsigned _ha_hashv; \ - HASH_VALUE(keyptr, keylen_in, _ha_hashv); \ - HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, _ha_hashv, add); \ -} while (0) - -#define HASH_ADD_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add) \ - HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add) - -#define HASH_ADD(hh,head,fieldname,keylen_in,add) \ - HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add) - -#define HASH_TO_BKT(hashv,num_bkts,bkt) \ -do { \ - bkt = ((hashv) & ((num_bkts) - 1U)); \ -} while (0) - -/* delete "delptr" from the hash table. - * "the usual" patch-up process for the app-order doubly-linked-list. - * The use of _hd_hh_del below deserves special explanation. - * These used to be expressed using (delptr) but that led to a bug - * if someone used the same symbol for the head and deletee, like - * HASH_DELETE(hh,users,users); - * We want that to work, but by changing the head (users) below - * we were forfeiting our ability to further refer to the deletee (users) - * in the patch-up process. Solution: use scratch space to - * copy the deletee pointer, then the latter references are via that - * scratch pointer rather than through the repointed (users) symbol. - */ -#define HASH_DELETE(hh,head,delptr) \ - HASH_DELETE_HH(hh, head, &(delptr)->hh) - -#define HASH_DELETE_HH(hh,head,delptrhh) \ -do { \ - struct UT_hash_handle *_hd_hh_del = (delptrhh); \ - if ((_hd_hh_del->prev == NULL) && (_hd_hh_del->next == NULL)) { \ - HASH_BLOOM_FREE((head)->hh.tbl); \ - uthash_free((head)->hh.tbl->buckets, \ - (head)->hh.tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - (head) = NULL; \ - } else { \ - unsigned _hd_bkt; \ - if (_hd_hh_del == (head)->hh.tbl->tail) { \ - (head)->hh.tbl->tail = HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev); \ - } \ - if (_hd_hh_del->prev != NULL) { \ - HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev)->next = _hd_hh_del->next; \ - } else { \ - DECLTYPE_ASSIGN(head, _hd_hh_del->next); \ - } \ - if (_hd_hh_del->next != NULL) { \ - HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->next)->prev = _hd_hh_del->prev; \ - } \ - HASH_TO_BKT(_hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ - HASH_DEL_IN_BKT((head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ - (head)->hh.tbl->num_items--; \ - } \ - HASH_FSCK(hh, head, "HASH_DELETE_HH"); \ -} while (0) - -/* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */ -#define HASH_FIND_STR(head,findstr,out) \ -do { \ - unsigned _uthash_hfstr_keylen = (unsigned)uthash_strlen(findstr); \ - HASH_FIND(hh, head, findstr, _uthash_hfstr_keylen, out); \ -} while (0) -#define HASH_ADD_STR(head,strfield,add) \ -do { \ - unsigned _uthash_hastr_keylen = (unsigned)uthash_strlen((add)->strfield); \ - HASH_ADD(hh, head, strfield[0], _uthash_hastr_keylen, add); \ -} while (0) -#define HASH_REPLACE_STR(head,strfield,add,replaced) \ -do { \ - unsigned _uthash_hrstr_keylen = (unsigned)uthash_strlen((add)->strfield); \ - HASH_REPLACE(hh, head, strfield[0], _uthash_hrstr_keylen, add, replaced); \ -} while (0) -#define HASH_FIND_INT(head,findint,out) \ - HASH_FIND(hh,head,findint,sizeof(int),out) -#define HASH_ADD_INT(head,intfield,add) \ - HASH_ADD(hh,head,intfield,sizeof(int),add) -#define HASH_REPLACE_INT(head,intfield,add,replaced) \ - HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced) -#define HASH_FIND_PTR(head,findptr,out) \ - HASH_FIND(hh,head,findptr,sizeof(void *),out) -#define HASH_ADD_PTR(head,ptrfield,add) \ - HASH_ADD(hh,head,ptrfield,sizeof(void *),add) -#define HASH_REPLACE_PTR(head,ptrfield,add,replaced) \ - HASH_REPLACE(hh,head,ptrfield,sizeof(void *),add,replaced) -#define HASH_DEL(head,delptr) \ - HASH_DELETE(hh,head,delptr) - -/* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined. - * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined. - */ -#ifdef HASH_DEBUG -#define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0) -#define HASH_FSCK(hh,head,where) \ -do { \ - struct UT_hash_handle *_thh; \ - if (head) { \ - unsigned _bkt_i; \ - unsigned _count = 0; \ - char *_prev; \ - for (_bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; ++_bkt_i) { \ - unsigned _bkt_count = 0; \ - _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ - _prev = NULL; \ - while (_thh) { \ - if (_prev != (char*)(_thh->hh_prev)) { \ - HASH_OOPS("%s: invalid hh_prev %p, actual %p\n", \ - (where), (void*)_thh->hh_prev, (void*)_prev); \ - } \ - _bkt_count++; \ - _prev = (char*)(_thh); \ - _thh = _thh->hh_next; \ - } \ - _count += _bkt_count; \ - if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ - HASH_OOPS("%s: invalid bucket count %u, actual %u\n", \ - (where), (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ - } \ - } \ - if (_count != (head)->hh.tbl->num_items) { \ - HASH_OOPS("%s: invalid hh item count %u, actual %u\n", \ - (where), (head)->hh.tbl->num_items, _count); \ - } \ - _count = 0; \ - _prev = NULL; \ - _thh = &(head)->hh; \ - while (_thh) { \ - _count++; \ - if (_prev != (char*)_thh->prev) { \ - HASH_OOPS("%s: invalid prev %p, actual %p\n", \ - (where), (void*)_thh->prev, (void*)_prev); \ - } \ - _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \ - _thh = (_thh->next ? HH_FROM_ELMT((head)->hh.tbl, _thh->next) : NULL); \ - } \ - if (_count != (head)->hh.tbl->num_items) { \ - HASH_OOPS("%s: invalid app item count %u, actual %u\n", \ - (where), (head)->hh.tbl->num_items, _count); \ - } \ - } \ -} while (0) -#else -#define HASH_FSCK(hh,head,where) -#endif - -/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to - * the descriptor to which this macro is defined for tuning the hash function. - * The app can #include to get the prototype for write(2). */ -#ifdef HASH_EMIT_KEYS -#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ -do { \ - unsigned _klen = fieldlen; \ - write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ - write(HASH_EMIT_KEYS, keyptr, (unsigned long)fieldlen); \ -} while (0) -#else -#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) -#endif - -/* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */ -#ifdef HASH_FUNCTION -#define HASH_FCN HASH_FUNCTION -#else -#define HASH_FCN HASH_JEN -#endif - -/* The Bernstein hash function, used in Perl prior to v5.6. Note (x<<5+x)=x*33. */ -#define HASH_BER(key,keylen,hashv) \ -do { \ - unsigned _hb_keylen = (unsigned)keylen; \ - const unsigned char *_hb_key = (const unsigned char*)(key); \ - (hashv) = 0; \ - while (_hb_keylen-- != 0U) { \ - (hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \ - } \ -} while (0) - - -/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at - * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ -#define HASH_SAX(key,keylen,hashv) \ -do { \ - unsigned _sx_i; \ - const unsigned char *_hs_key = (const unsigned char*)(key); \ - hashv = 0; \ - for (_sx_i=0; _sx_i < keylen; _sx_i++) { \ - hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ - } \ -} while (0) -/* FNV-1a variation */ -#define HASH_FNV(key,keylen,hashv) \ -do { \ - unsigned _fn_i; \ - const unsigned char *_hf_key = (const unsigned char*)(key); \ - (hashv) = 2166136261U; \ - for (_fn_i=0; _fn_i < keylen; _fn_i++) { \ - hashv = hashv ^ _hf_key[_fn_i]; \ - hashv = hashv * 16777619U; \ - } \ -} while (0) - -#define HASH_OAT(key,keylen,hashv) \ -do { \ - unsigned _ho_i; \ - const unsigned char *_ho_key=(const unsigned char*)(key); \ - hashv = 0; \ - for(_ho_i=0; _ho_i < keylen; _ho_i++) { \ - hashv += _ho_key[_ho_i]; \ - hashv += (hashv << 10); \ - hashv ^= (hashv >> 6); \ - } \ - hashv += (hashv << 3); \ - hashv ^= (hashv >> 11); \ - hashv += (hashv << 15); \ -} while (0) - -#define HASH_JEN_MIX(a,b,c) \ -do { \ - a -= b; a -= c; a ^= ( c >> 13 ); \ - b -= c; b -= a; b ^= ( a << 8 ); \ - c -= a; c -= b; c ^= ( b >> 13 ); \ - a -= b; a -= c; a ^= ( c >> 12 ); \ - b -= c; b -= a; b ^= ( a << 16 ); \ - c -= a; c -= b; c ^= ( b >> 5 ); \ - a -= b; a -= c; a ^= ( c >> 3 ); \ - b -= c; b -= a; b ^= ( a << 10 ); \ - c -= a; c -= b; c ^= ( b >> 15 ); \ -} while (0) - -#define HASH_JEN(key,keylen,hashv) \ -do { \ - unsigned _hj_i,_hj_j,_hj_k; \ - unsigned const char *_hj_key=(unsigned const char*)(key); \ - hashv = 0xfeedbeefu; \ - _hj_i = _hj_j = 0x9e3779b9u; \ - _hj_k = (unsigned)(keylen); \ - while (_hj_k >= 12U) { \ - _hj_i += (_hj_key[0] + ( (unsigned)_hj_key[1] << 8 ) \ - + ( (unsigned)_hj_key[2] << 16 ) \ - + ( (unsigned)_hj_key[3] << 24 ) ); \ - _hj_j += (_hj_key[4] + ( (unsigned)_hj_key[5] << 8 ) \ - + ( (unsigned)_hj_key[6] << 16 ) \ - + ( (unsigned)_hj_key[7] << 24 ) ); \ - hashv += (_hj_key[8] + ( (unsigned)_hj_key[9] << 8 ) \ - + ( (unsigned)_hj_key[10] << 16 ) \ - + ( (unsigned)_hj_key[11] << 24 ) ); \ - \ - HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ - \ - _hj_key += 12; \ - _hj_k -= 12U; \ - } \ - hashv += (unsigned)(keylen); \ - switch ( _hj_k ) { \ - case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); /* FALLTHROUGH */ \ - case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); /* FALLTHROUGH */ \ - case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); /* FALLTHROUGH */ \ - case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); /* FALLTHROUGH */ \ - case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); /* FALLTHROUGH */ \ - case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); /* FALLTHROUGH */ \ - case 5: _hj_j += _hj_key[4]; /* FALLTHROUGH */ \ - case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); /* FALLTHROUGH */ \ - case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); /* FALLTHROUGH */ \ - case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); /* FALLTHROUGH */ \ - case 1: _hj_i += _hj_key[0]; \ - } \ - HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ -} while (0) - -/* The Paul Hsieh hash function */ -#undef get16bits -#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \ - || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) -#define get16bits(d) (*((const uint16_t *) (d))) -#endif - -#if !defined (get16bits) -#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \ - +(uint32_t)(((const uint8_t *)(d))[0]) ) -#endif -#define HASH_SFH(key,keylen,hashv) \ -do { \ - unsigned const char *_sfh_key=(unsigned const char*)(key); \ - uint32_t _sfh_tmp, _sfh_len = (uint32_t)keylen; \ - \ - unsigned _sfh_rem = _sfh_len & 3U; \ - _sfh_len >>= 2; \ - hashv = 0xcafebabeu; \ - \ - /* Main loop */ \ - for (;_sfh_len > 0U; _sfh_len--) { \ - hashv += get16bits (_sfh_key); \ - _sfh_tmp = ((uint32_t)(get16bits (_sfh_key+2)) << 11) ^ hashv; \ - hashv = (hashv << 16) ^ _sfh_tmp; \ - _sfh_key += 2U*sizeof (uint16_t); \ - hashv += hashv >> 11; \ - } \ - \ - /* Handle end cases */ \ - switch (_sfh_rem) { \ - case 3: hashv += get16bits (_sfh_key); \ - hashv ^= hashv << 16; \ - hashv ^= (uint32_t)(_sfh_key[sizeof (uint16_t)]) << 18; \ - hashv += hashv >> 11; \ - break; \ - case 2: hashv += get16bits (_sfh_key); \ - hashv ^= hashv << 11; \ - hashv += hashv >> 17; \ - break; \ - case 1: hashv += *_sfh_key; \ - hashv ^= hashv << 10; \ - hashv += hashv >> 1; \ - } \ - \ - /* Force "avalanching" of final 127 bits */ \ - hashv ^= hashv << 3; \ - hashv += hashv >> 5; \ - hashv ^= hashv << 4; \ - hashv += hashv >> 17; \ - hashv ^= hashv << 25; \ - hashv += hashv >> 6; \ -} while (0) - -#ifdef HASH_USING_NO_STRICT_ALIASING -/* The MurmurHash exploits some CPU's (x86,x86_64) tolerance for unaligned reads. - * For other types of CPU's (e.g. Sparc) an unaligned read causes a bus error. - * MurmurHash uses the faster approach only on CPU's where we know it's safe. - * - * Note the preprocessor built-in defines can be emitted using: - * - * gcc -m64 -dM -E - < /dev/null (on gcc) - * cc -## a.c (where a.c is a simple test file) (Sun Studio) - */ -#if (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86)) -#define MUR_GETBLOCK(p,i) p[i] -#else /* non intel */ -#define MUR_PLUS0_ALIGNED(p) (((unsigned long)p & 3UL) == 0UL) -#define MUR_PLUS1_ALIGNED(p) (((unsigned long)p & 3UL) == 1UL) -#define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 3UL) == 2UL) -#define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 3UL) == 3UL) -#define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL)) -#if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__)) -#define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24)) -#define MUR_TWO_TWO(p) ((((*WP(p))&0x0000ffff) <<16) | (((*(WP(p)+1))&0xffff0000) >> 16)) -#define MUR_ONE_THREE(p) ((((*WP(p))&0x000000ff) <<24) | (((*(WP(p)+1))&0xffffff00) >> 8)) -#else /* assume little endian non-intel */ -#define MUR_THREE_ONE(p) ((((*WP(p))&0xffffff00) >> 8) | (((*(WP(p)+1))&0x000000ff) << 24)) -#define MUR_TWO_TWO(p) ((((*WP(p))&0xffff0000) >>16) | (((*(WP(p)+1))&0x0000ffff) << 16)) -#define MUR_ONE_THREE(p) ((((*WP(p))&0xff000000) >>24) | (((*(WP(p)+1))&0x00ffffff) << 8)) -#endif -#define MUR_GETBLOCK(p,i) (MUR_PLUS0_ALIGNED(p) ? ((p)[i]) : \ - (MUR_PLUS1_ALIGNED(p) ? MUR_THREE_ONE(p) : \ - (MUR_PLUS2_ALIGNED(p) ? MUR_TWO_TWO(p) : \ - MUR_ONE_THREE(p)))) -#endif -#define MUR_ROTL32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) -#define MUR_FMIX(_h) \ -do { \ - _h ^= _h >> 16; \ - _h *= 0x85ebca6bu; \ - _h ^= _h >> 13; \ - _h *= 0xc2b2ae35u; \ - _h ^= _h >> 16; \ -} while (0) - -#define HASH_MUR(key,keylen,hashv) \ -do { \ - const uint8_t *_mur_data = (const uint8_t*)(key); \ - const int _mur_nblocks = (int)(keylen) / 4; \ - uint32_t _mur_h1 = 0xf88D5353u; \ - uint32_t _mur_c1 = 0xcc9e2d51u; \ - uint32_t _mur_c2 = 0x1b873593u; \ - uint32_t _mur_k1 = 0; \ - const uint8_t *_mur_tail; \ - const uint32_t *_mur_blocks = (const uint32_t*)(_mur_data+(_mur_nblocks*4)); \ - int _mur_i; \ - for (_mur_i = -_mur_nblocks; _mur_i != 0; _mur_i++) { \ - _mur_k1 = MUR_GETBLOCK(_mur_blocks,_mur_i); \ - _mur_k1 *= _mur_c1; \ - _mur_k1 = MUR_ROTL32(_mur_k1,15); \ - _mur_k1 *= _mur_c2; \ - \ - _mur_h1 ^= _mur_k1; \ - _mur_h1 = MUR_ROTL32(_mur_h1,13); \ - _mur_h1 = (_mur_h1*5U) + 0xe6546b64u; \ - } \ - _mur_tail = (const uint8_t*)(_mur_data + (_mur_nblocks*4)); \ - _mur_k1=0; \ - switch ((keylen) & 3U) { \ - case 0: break; \ - case 3: _mur_k1 ^= (uint32_t)_mur_tail[2] << 16; /* FALLTHROUGH */ \ - case 2: _mur_k1 ^= (uint32_t)_mur_tail[1] << 8; /* FALLTHROUGH */ \ - case 1: _mur_k1 ^= (uint32_t)_mur_tail[0]; \ - _mur_k1 *= _mur_c1; \ - _mur_k1 = MUR_ROTL32(_mur_k1,15); \ - _mur_k1 *= _mur_c2; \ - _mur_h1 ^= _mur_k1; \ - } \ - _mur_h1 ^= (uint32_t)(keylen); \ - MUR_FMIX(_mur_h1); \ - hashv = _mur_h1; \ -} while (0) -#endif /* HASH_USING_NO_STRICT_ALIASING */ - -/* iterate over items in a known bucket to find desired item */ -#define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,hashval,out) \ -do { \ - if ((head).hh_head != NULL) { \ - DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (head).hh_head)); \ - } else { \ - (out) = NULL; \ - } \ - while ((out) != NULL) { \ - if ((out)->hh.hashv == (hashval) && (out)->hh.keylen == (keylen_in)) { \ - if (HASH_KEYCMP((out)->hh.key, keyptr, keylen_in) == 0) { \ - break; \ - } \ - } \ - if ((out)->hh.hh_next != NULL) { \ - DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (out)->hh.hh_next)); \ - } else { \ - (out) = NULL; \ - } \ - } \ -} while (0) - -/* add an item to a bucket */ -#define HASH_ADD_TO_BKT(head,hh,addhh,oomed) \ -do { \ - UT_hash_bucket *_ha_head = &(head); \ - _ha_head->count++; \ - (addhh)->hh_next = _ha_head->hh_head; \ - (addhh)->hh_prev = NULL; \ - if (_ha_head->hh_head != NULL) { \ - _ha_head->hh_head->hh_prev = (addhh); \ - } \ - _ha_head->hh_head = (addhh); \ - if ((_ha_head->count >= ((_ha_head->expand_mult + 1U) * HASH_BKT_CAPACITY_THRESH)) \ - && !(addhh)->tbl->noexpand) { \ - HASH_EXPAND_BUCKETS(addhh,(addhh)->tbl, oomed); \ - IF_HASH_NONFATAL_OOM( \ - if (oomed) { \ - HASH_DEL_IN_BKT(head,addhh); \ - } \ - ) \ - } \ -} while (0) - -/* remove an item from a given bucket */ -#define HASH_DEL_IN_BKT(head,delhh) \ -do { \ - UT_hash_bucket *_hd_head = &(head); \ - _hd_head->count--; \ - if (_hd_head->hh_head == (delhh)) { \ - _hd_head->hh_head = (delhh)->hh_next; \ - } \ - if ((delhh)->hh_prev) { \ - (delhh)->hh_prev->hh_next = (delhh)->hh_next; \ - } \ - if ((delhh)->hh_next) { \ - (delhh)->hh_next->hh_prev = (delhh)->hh_prev; \ - } \ -} while (0) - -/* Bucket expansion has the effect of doubling the number of buckets - * and redistributing the items into the new buckets. Ideally the - * items will distribute more or less evenly into the new buckets - * (the extent to which this is true is a measure of the quality of - * the hash function as it applies to the key domain). - * - * With the items distributed into more buckets, the chain length - * (item count) in each bucket is reduced. Thus by expanding buckets - * the hash keeps a bound on the chain length. This bounded chain - * length is the essence of how a hash provides constant time lookup. - * - * The calculation of tbl->ideal_chain_maxlen below deserves some - * explanation. First, keep in mind that we're calculating the ideal - * maximum chain length based on the *new* (doubled) bucket count. - * In fractions this is just n/b (n=number of items,b=new num buckets). - * Since the ideal chain length is an integer, we want to calculate - * ceil(n/b). We don't depend on floating point arithmetic in this - * hash, so to calculate ceil(n/b) with integers we could write - * - * ceil(n/b) = (n/b) + ((n%b)?1:0) - * - * and in fact a previous version of this hash did just that. - * But now we have improved things a bit by recognizing that b is - * always a power of two. We keep its base 2 log handy (call it lb), - * so now we can write this with a bit shift and logical AND: - * - * ceil(n/b) = (n>>lb) + ( (n & (b-1)) ? 1:0) - * - */ -#define HASH_EXPAND_BUCKETS(hh,tbl,oomed) \ -do { \ - unsigned _he_bkt; \ - unsigned _he_bkt_i; \ - struct UT_hash_handle *_he_thh, *_he_hh_nxt; \ - UT_hash_bucket *_he_new_buckets, *_he_newbkt; \ - _he_new_buckets = (UT_hash_bucket*)uthash_malloc( \ - 2UL * (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \ - if (!_he_new_buckets) { \ - HASH_RECORD_OOM(oomed); \ - } else { \ - uthash_bzero(_he_new_buckets, \ - 2UL * (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \ - (tbl)->ideal_chain_maxlen = \ - ((tbl)->num_items >> ((tbl)->log2_num_buckets+1U)) + \ - ((((tbl)->num_items & (((tbl)->num_buckets*2U)-1U)) != 0U) ? 1U : 0U); \ - (tbl)->nonideal_items = 0; \ - for (_he_bkt_i = 0; _he_bkt_i < (tbl)->num_buckets; _he_bkt_i++) { \ - _he_thh = (tbl)->buckets[ _he_bkt_i ].hh_head; \ - while (_he_thh != NULL) { \ - _he_hh_nxt = _he_thh->hh_next; \ - HASH_TO_BKT(_he_thh->hashv, (tbl)->num_buckets * 2U, _he_bkt); \ - _he_newbkt = &(_he_new_buckets[_he_bkt]); \ - if (++(_he_newbkt->count) > (tbl)->ideal_chain_maxlen) { \ - (tbl)->nonideal_items++; \ - if (_he_newbkt->count > _he_newbkt->expand_mult * (tbl)->ideal_chain_maxlen) { \ - _he_newbkt->expand_mult++; \ - } \ - } \ - _he_thh->hh_prev = NULL; \ - _he_thh->hh_next = _he_newbkt->hh_head; \ - if (_he_newbkt->hh_head != NULL) { \ - _he_newbkt->hh_head->hh_prev = _he_thh; \ - } \ - _he_newbkt->hh_head = _he_thh; \ - _he_thh = _he_hh_nxt; \ - } \ - } \ - uthash_free((tbl)->buckets, (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \ - (tbl)->num_buckets *= 2U; \ - (tbl)->log2_num_buckets++; \ - (tbl)->buckets = _he_new_buckets; \ - (tbl)->ineff_expands = ((tbl)->nonideal_items > ((tbl)->num_items >> 1)) ? \ - ((tbl)->ineff_expands+1U) : 0U; \ - if ((tbl)->ineff_expands > 1U) { \ - (tbl)->noexpand = 1; \ - uthash_noexpand_fyi(tbl); \ - } \ - uthash_expand_fyi(tbl); \ - } \ -} while (0) - - -/* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */ -/* Note that HASH_SORT assumes the hash handle name to be hh. - * HASH_SRT was added to allow the hash handle name to be passed in. */ -#define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn) -#define HASH_SRT(hh,head,cmpfcn) \ -do { \ - unsigned _hs_i; \ - unsigned _hs_looping,_hs_nmerges,_hs_insize,_hs_psize,_hs_qsize; \ - struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \ - if (head != NULL) { \ - _hs_insize = 1; \ - _hs_looping = 1; \ - _hs_list = &((head)->hh); \ - while (_hs_looping != 0U) { \ - _hs_p = _hs_list; \ - _hs_list = NULL; \ - _hs_tail = NULL; \ - _hs_nmerges = 0; \ - while (_hs_p != NULL) { \ - _hs_nmerges++; \ - _hs_q = _hs_p; \ - _hs_psize = 0; \ - for (_hs_i = 0; _hs_i < _hs_insize; ++_hs_i) { \ - _hs_psize++; \ - _hs_q = ((_hs_q->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \ - if (_hs_q == NULL) { \ - break; \ - } \ - } \ - _hs_qsize = _hs_insize; \ - while ((_hs_psize != 0U) || ((_hs_qsize != 0U) && (_hs_q != NULL))) { \ - if (_hs_psize == 0U) { \ - _hs_e = _hs_q; \ - _hs_q = ((_hs_q->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \ - _hs_qsize--; \ - } else if ((_hs_qsize == 0U) || (_hs_q == NULL)) { \ - _hs_e = _hs_p; \ - if (_hs_p != NULL) { \ - _hs_p = ((_hs_p->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_p->next) : NULL); \ - } \ - _hs_psize--; \ - } else if ((cmpfcn( \ - DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_p)), \ - DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_q)) \ - )) <= 0) { \ - _hs_e = _hs_p; \ - if (_hs_p != NULL) { \ - _hs_p = ((_hs_p->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_p->next) : NULL); \ - } \ - _hs_psize--; \ - } else { \ - _hs_e = _hs_q; \ - _hs_q = ((_hs_q->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \ - _hs_qsize--; \ - } \ - if ( _hs_tail != NULL ) { \ - _hs_tail->next = ((_hs_e != NULL) ? \ - ELMT_FROM_HH((head)->hh.tbl, _hs_e) : NULL); \ - } else { \ - _hs_list = _hs_e; \ - } \ - if (_hs_e != NULL) { \ - _hs_e->prev = ((_hs_tail != NULL) ? \ - ELMT_FROM_HH((head)->hh.tbl, _hs_tail) : NULL); \ - } \ - _hs_tail = _hs_e; \ - } \ - _hs_p = _hs_q; \ - } \ - if (_hs_tail != NULL) { \ - _hs_tail->next = NULL; \ - } \ - if (_hs_nmerges <= 1U) { \ - _hs_looping = 0; \ - (head)->hh.tbl->tail = _hs_tail; \ - DECLTYPE_ASSIGN(head, ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \ - } \ - _hs_insize *= 2U; \ - } \ - HASH_FSCK(hh, head, "HASH_SRT"); \ - } \ -} while (0) - -/* This function selects items from one hash into another hash. - * The end result is that the selected items have dual presence - * in both hashes. There is no copy of the items made; rather - * they are added into the new hash through a secondary hash - * hash handle that must be present in the structure. */ -#define HASH_SELECT(hh_dst, dst, hh_src, src, cond) \ -do { \ - unsigned _src_bkt, _dst_bkt; \ - void *_last_elt = NULL, *_elt; \ - UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh=NULL; \ - ptrdiff_t _dst_hho = ((char*)(&(dst)->hh_dst) - (char*)(dst)); \ - if ((src) != NULL) { \ - for (_src_bkt=0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \ - for (_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; \ - _src_hh != NULL; \ - _src_hh = _src_hh->hh_next) { \ - _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \ - if (cond(_elt)) { \ - IF_HASH_NONFATAL_OOM( int _hs_oomed = 0; ) \ - _dst_hh = (UT_hash_handle*)(((char*)_elt) + _dst_hho); \ - _dst_hh->key = _src_hh->key; \ - _dst_hh->keylen = _src_hh->keylen; \ - _dst_hh->hashv = _src_hh->hashv; \ - _dst_hh->prev = _last_elt; \ - _dst_hh->next = NULL; \ - if (_last_elt_hh != NULL) { \ - _last_elt_hh->next = _elt; \ - } \ - if ((dst) == NULL) { \ - DECLTYPE_ASSIGN(dst, _elt); \ - HASH_MAKE_TABLE(hh_dst, dst, _hs_oomed); \ - IF_HASH_NONFATAL_OOM( \ - if (_hs_oomed) { \ - uthash_nonfatal_oom(_elt); \ - (dst) = NULL; \ - continue; \ - } \ - ) \ - } else { \ - _dst_hh->tbl = (dst)->hh_dst.tbl; \ - } \ - HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt); \ - HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt], hh_dst, _dst_hh, _hs_oomed); \ - (dst)->hh_dst.tbl->num_items++; \ - IF_HASH_NONFATAL_OOM( \ - if (_hs_oomed) { \ - HASH_ROLLBACK_BKT(hh_dst, dst, _dst_hh); \ - HASH_DELETE_HH(hh_dst, dst, _dst_hh); \ - _dst_hh->tbl = NULL; \ - uthash_nonfatal_oom(_elt); \ - continue; \ - } \ - ) \ - HASH_BLOOM_ADD(_dst_hh->tbl, _dst_hh->hashv); \ - _last_elt = _elt; \ - _last_elt_hh = _dst_hh; \ - } \ - } \ - } \ - } \ - HASH_FSCK(hh_dst, dst, "HASH_SELECT"); \ -} while (0) - -#define HASH_CLEAR(hh,head) \ -do { \ - if ((head) != NULL) { \ - HASH_BLOOM_FREE((head)->hh.tbl); \ - uthash_free((head)->hh.tbl->buckets, \ - (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - (head) = NULL; \ - } \ -} while (0) - -#define HASH_OVERHEAD(hh,head) \ - (((head) != NULL) ? ( \ - (size_t)(((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \ - ((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \ - sizeof(UT_hash_table) + \ - (HASH_BLOOM_BYTELEN))) : 0U) - -#ifdef NO_DECLTYPE -#define HASH_ITER(hh,head,el,tmp) \ -for(((el)=(head)), ((*(char**)(&(tmp)))=(char*)((head!=NULL)?(head)->hh.next:NULL)); \ - (el) != NULL; ((el)=(tmp)), ((*(char**)(&(tmp)))=(char*)((tmp!=NULL)?(tmp)->hh.next:NULL))) -#else -#define HASH_ITER(hh,head,el,tmp) \ -for(((el)=(head)), ((tmp)=DECLTYPE(el)((head!=NULL)?(head)->hh.next:NULL)); \ - (el) != NULL; ((el)=(tmp)), ((tmp)=DECLTYPE(el)((tmp!=NULL)?(tmp)->hh.next:NULL))) -#endif - -/* obtain a count of items in the hash */ -#define HASH_COUNT(head) HASH_CNT(hh,head) -#define HASH_CNT(hh,head) ((head != NULL)?((head)->hh.tbl->num_items):0U) - -typedef struct UT_hash_bucket { - struct UT_hash_handle *hh_head; - unsigned count; - - /* expand_mult is normally set to 0. In this situation, the max chain length - * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If - * the bucket's chain exceeds this length, bucket expansion is triggered). - * However, setting expand_mult to a non-zero value delays bucket expansion - * (that would be triggered by additions to this particular bucket) - * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH. - * (The multiplier is simply expand_mult+1). The whole idea of this - * multiplier is to reduce bucket expansions, since they are expensive, in - * situations where we know that a particular bucket tends to be overused. - * It is better to let its chain length grow to a longer yet-still-bounded - * value, than to do an O(n) bucket expansion too often. - */ - unsigned expand_mult; - -} UT_hash_bucket; - -/* random signature used only to find hash tables in external analysis */ -#define HASH_SIGNATURE 0xa0111fe1u -#define HASH_BLOOM_SIGNATURE 0xb12220f2u - -typedef struct UT_hash_table { - UT_hash_bucket *buckets; - unsigned num_buckets, log2_num_buckets; - unsigned num_items; - struct UT_hash_handle *tail; /* tail hh in app order, for fast append */ - ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */ - - /* in an ideal situation (all buckets used equally), no bucket would have - * more than ceil(#items/#buckets) items. that's the ideal chain length. */ - unsigned ideal_chain_maxlen; - - /* nonideal_items is the number of items in the hash whose chain position - * exceeds the ideal chain maxlen. these items pay the penalty for an uneven - * hash distribution; reaching them in a chain traversal takes >ideal steps */ - unsigned nonideal_items; - - /* ineffective expands occur when a bucket doubling was performed, but - * afterward, more than half the items in the hash had nonideal chain - * positions. If this happens on two consecutive expansions we inhibit any - * further expansion, as it's not helping; this happens when the hash - * function isn't a good fit for the key domain. When expansion is inhibited - * the hash will still work, albeit no longer in constant time. */ - unsigned ineff_expands, noexpand; - - uint32_t signature; /* used only to find hash tables in external analysis */ -#ifdef HASH_BLOOM - uint32_t bloom_sig; /* used only to test bloom exists in external analysis */ - uint8_t *bloom_bv; - uint8_t bloom_nbits; -#endif - -} UT_hash_table; - -typedef struct UT_hash_handle { - struct UT_hash_table *tbl; - void *prev; /* prev element in app order */ - void *next; /* next element in app order */ - struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ - struct UT_hash_handle *hh_next; /* next hh in bucket order */ - void *key; /* ptr to enclosing struct's key */ - unsigned keylen; /* enclosing struct's key len */ - unsigned hashv; /* result of hash-fcn(key) */ -} UT_hash_handle; - -#endif /* UTHASH_H */ diff --git a/bundles/n2n_ntop_v2/legacy/README.md b/bundles/n2n_ntop_v2/legacy/README.md deleted file mode 100644 index 174c1146..00000000 --- a/bundles/n2n_ntop_v2/legacy/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Removed Features - -This folder contains a list N2N legacy features which have been dropped due to -maintainance cost versus effective use and benefits. - -Multiple Transops ------------------ - -N2N used to initialize all the available transops and use the "tick" function of -the transops to decide which transop to use before sending a packet. This however -has the following problems: - -- It only works with the keyfile, whereas with normal encryption we inizialize and - keep structures that we don't need. -- It is unfeasable as an edge node is required to implement all the transops in order - to properly talk with other edge nodes (via keyfile). -- It rises the complexity of the code. -- It is not clear which transop will be used. -- Mixing multiple encyptions together is not necessarily a good idea to improve security - as a vulnerability in at least one encryption method will leak some information. - -Keyfile and Key Rotation ------------------------- - -The keyfile mechanism allowed N2N users to specify a keyfile to be used to periodically -rotate keys and encryption methods. However, it has the following problems: - -- This feature is obscure for most of the users and poorly documented. -- It is tightly integrated in the core whereas it is used by only a few people (if any). - -In conclusion the main problem is the complexity that it adds to the code. In a possible -future rework this could be integrated as an extention (e.g. a specific trasop) without -rising the core complexity. diff --git a/bundles/n2n_ntop_v2/legacy/edge_keyschedule.c b/bundles/n2n_ntop_v2/legacy/edge_keyschedule.c deleted file mode 100644 index 5e3af35d..00000000 --- a/bundles/n2n_ntop_v2/legacy/edge_keyschedule.c +++ /dev/null @@ -1,103 +0,0 @@ -typedef struct n2n_tostat { - uint8_t can_tx; /* Does this transop have a valid SA for encoding. */ - n2n_cipherspec_t tx_spec; /* If can_tx, the spec used to encode. */ -} n2n_tostat_t; - -typedef uint32_t n2n_sa_t; /* security association number */ -typedef int (*n2n_transaddspec_f)( struct n2n_trans_op * arg, - const n2n_cipherspec_t * cspec ); - -typedef n2n_tostat_t (*n2n_transtick_f)( struct n2n_trans_op * arg, - time_t now ); - -/** Read in a key-schedule file, parse the lines and pass each line to the - * appropriate trans_op for parsing of key-data and adding key-schedule - * entries. The lookup table of time->trans_op is constructed such that - * encoding can be passed to the correct trans_op. The trans_op internal table - * will then determine the best SA for that trans_op from the key schedule to - * use for encoding. */ - -static int edge_init_keyschedule(n2n_edge_t *eee) { -#define N2N_NUM_CIPHERSPECS 32 - - int retval = -1; - ssize_t numSpecs=0; - n2n_cipherspec_t specs[N2N_NUM_CIPHERSPECS]; - size_t i; - time_t now = time(NULL); - - numSpecs = n2n_read_keyfile(specs, N2N_NUM_CIPHERSPECS, eee->conf.keyschedule); - - if(numSpecs > 0) - { - traceEvent(TRACE_NORMAL, "keyfile = %s read -> %d specs.\n", optarg, (signed int)numSpecs); - - for (i=0; i < (size_t)numSpecs; ++i) - { - n2n_transform_t idx = (n2n_transform_t) specs[i].t; - if(idx != eee->transop.transform_id) { - traceEvent(TRACE_ERROR, "changing transop in keyschedule is not supported"); - retval = -1; - } - - if(eee->transop.addspec != NULL) - retval = eee->transop.addspec(&eee->transop, &(specs[i])); - - if (0 != retval) - { - traceEvent(TRACE_ERROR, "keyschedule failed to add spec[%u] to transop[%d].\n", - (unsigned int)i, idx); - - return retval; - } - } - - n2n_tick_transop(eee, now); - } - else - traceEvent(TRACE_ERROR, "Failed to process '%s'", eee->conf.keyschedule); - - return retval; -} - -#if 0 - if(recvlen >= 6) - { - if(0 == memcmp(udp_buf, "reload", 6)) - { - if(strlen(eee->conf.keyschedule) > 0) - { - if(edge_init_keyschedule(eee) == 0) - { - msg_len=0; - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> OK\n"); - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in)); - } - return; - } - } - } -#endif - -#if 0 - case'K': - { - if(conf->encrypt_key) { - traceEvent(TRACE_ERROR, "Error: -K and -k options are mutually exclusive"); - exit(1); - } else { - strncpy(conf->keyschedule, optargument, N2N_PATHNAME_MAXLEN-1); - /* strncpy does not add NULL if the source has no NULL. */ - conf->keyschedule[N2N_PATHNAME_MAXLEN-1] = 0; - - traceEvent(TRACE_NORMAL, "keyfile = '%s'\n", conf->keyschedule); - } - break; - } -#endif - -#if 0 - printf("-K | Specify a key schedule file to load. Not with -k.\n"); -#endif diff --git a/bundles/n2n_ntop_v2/legacy/gen_keyfile.py b/bundles/n2n_ntop_v2/legacy/gen_keyfile.py deleted file mode 100644 index b6dc3e67..00000000 --- a/bundles/n2n_ntop_v2/legacy/gen_keyfile.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -# (c) 2009 Richard Andrews - -# Program to generate a n2n_edge key schedule file for twofish keys -# Each key line consists of the following element -# -# -# where , are UNIX time_t values of key valid period -# is the transform ID (=2 for twofish) -# is twofish-specific data as follows -# _ - -import os -import sys -import time -import random - -NUM_KEYS=30 -KEY_LIFE=300 -KEY_LEN=16 - -now=time.time() -start_sa=random.randint( 0, 0xffffffff ) - -random.seed(now) # note now is a floating point time value - -def rand_key(): - key=str() - for i in range(0,KEY_LEN): - key += "%02x"%( random.randint( 0, 255) ) - - return key - -for i in range(0,NUM_KEYS): - from_time = now + (KEY_LIFE * (i-1) ) - until_time = now + (KEY_LIFE * (i+1) ) - key = rand_key() - sa_idx = start_sa + i - transform_id = random.randint( 2, 3 ) - - sys.stdout.write("%d %d %d %d_%s\n"%(from_time, until_time, transform_id,sa_idx, key) ) - - diff --git a/bundles/n2n_ntop_v2/legacy/n2n_keyfile.c b/bundles/n2n_ntop_v2/legacy/n2n_keyfile.c deleted file mode 100644 index eda6c834..00000000 --- a/bundles/n2n_ntop_v2/legacy/n2n_keyfile.c +++ /dev/null @@ -1,216 +0,0 @@ -/** - * (C) 2007-18 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "n2n_keyfile.h" -#include -#include -#include -#include - - -#ifdef WIN32 -char *strsep( char **ppsz_string, const char *psz_delimiters ) -{ - char *p; - char *psz_string = *ppsz_string; - if( !psz_string ) - return NULL; - - p = strpbrk( psz_string, psz_delimiters ); - if( !p ) - { - *ppsz_string = NULL; - return psz_string; - } - *p++ = '\0'; - - *ppsz_string = p; - return psz_string; -} -#endif - - -/* Parse hex nibbles in ascii until a non-nibble character is found. Nibble - * characters are 0-9, a-f and A-F. - * - * Return number of bytes parsed into keyBuf or a negative error code. - */ -ssize_t n2n_parse_hex( uint8_t * keyBuf, - size_t keyLen, - const char * textKey, - size_t textLen) -{ - ssize_t retval=0; - uint8_t * pout=keyBuf; - size_t octet=0; - const char * textEnd; - const char * pbeg; - - textEnd = textKey+textLen; - pbeg=textKey; - - while ( ( pbeg + 1 < textEnd ) && ( retval < (ssize_t)keyLen ) ) - { - if ( 1 != sscanf( pbeg, "%02x", (unsigned int*)&octet ) ) - { - retval=-1; - break; - } - - *pout = (octet & 0xff); - ++pout; - ++retval; - pbeg += 2; - } - - return retval; -} - - -static int parseKeyLine( n2n_cipherspec_t * spec, - const char * linein ) -{ - /* parameters are separated by whitespace */ - char line[N2N_KEYFILE_LINESIZE]; - char * lp=line; - const char * token; - strncpy( line, linein, N2N_KEYFILE_LINESIZE ); - - memset( spec, 0, sizeof( n2n_cipherspec_t ) ); - - /* decode valid_from time */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - spec->valid_from = atol(token); - - /* decode valid_until time */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - spec->valid_until = atol(token); - - /* decode the transform number */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - spec->t = atoi(token); - - /* The reset if opaque key data */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - strncpy( (char *)spec->opaque, token, N2N_MAX_KEYSIZE ); - spec->opaque_size=strlen( (char *)spec->opaque); - - return 0; - -error: - return -1; -} - - -#define SEP "/" - - -int validCipherSpec( const n2n_cipherspec_t * k, - time_t now ) -{ - if ( k->valid_until < k->valid_from ) { goto bad; } - if ( k->valid_from > now ) { goto bad; } - if ( k->valid_until < now ) { goto bad; } - - return 0; - -bad: - return -1; -} - -/* Read key control file and return the number of specs stored or a negative - * error code. - * - * As the specs are read in the from and until time values are compared to - * present time. Only those keys which are valid are stored. - */ -int n2n_read_keyfile( n2n_cipherspec_t * specs, /* fill out this array of cipherspecs */ - size_t numspecs, /* number of slots in the array. */ - const char * ctrlfile_path ) /* path to control file */ -{ - /* Each line contains one cipherspec. */ - - int retval=0; - FILE * fp=NULL; - size_t idx=0; - time_t now = time(NULL); - - traceEvent( TRACE_DEBUG, "Reading '%s'\n", ctrlfile_path ); - - fp = fopen( ctrlfile_path, "r" ); - if ( fp ) - { - /* Read the file a line a time with fgets. */ - char line[N2N_KEYFILE_LINESIZE]; - size_t lineNum=0; - - while ( idx < numspecs ) - { - n2n_cipherspec_t * k = &(specs[idx]); - fgets( line, N2N_KEYFILE_LINESIZE, fp ); - ++lineNum; - - if ( strlen(line) > 1 ) - { - if ( 0 == parseKeyLine( k, line ) ) - { - if ( k->valid_until > now ) - { - traceEvent( TRACE_INFO, " --> [%u] from %lu, until %lu, transform=%hu, data=%s\n", - idx, k->valid_from, k->valid_until, k->t, k->opaque ); - - ++retval; - ++idx; - } - else - { - traceEvent( TRACE_INFO, " --X [%u] from %lu, until %lu, transform=%hu, data=%s\n", - idx, k->valid_from, k->valid_until, k->t, k->opaque ); - - } - } - else - { - traceEvent( TRACE_WARNING, "Failed to decode line %u\n", lineNum ); - } - } - - if ( feof(fp) ) - { - break; - } - - line[0]=0; /* this line has been consumed */ - } - - fclose( fp); - fp=NULL; - } - else - { - traceEvent( TRACE_ERROR, "Failed to open '%s'\n", ctrlfile_path ); - retval = -1; - } - - return retval; -} diff --git a/bundles/n2n_ntop_v2/legacy/n2n_keyfile.h b/bundles/n2n_ntop_v2/legacy/n2n_keyfile.h deleted file mode 100644 index 05cdf606..00000000 --- a/bundles/n2n_ntop_v2/legacy/n2n_keyfile.h +++ /dev/null @@ -1,117 +0,0 @@ -/** - * (C) 2007-18 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -/** Key files - * - * Edge implements a very simple interface for getting instructions about - * rolling keys. - * - * Key definitions are written as individual files in /.key. The - * format of each key is a single line of hex nibbles as follows: - * - * 0102030405060708090a0b0c0d0e0f - * - * Any external key exchange mechanism can receive the key data write it into - * the keyfiles. - * - * To control which keys are active at what times the key control file is - * used. This is a single file which is periodically reread. It contains key - * definitions in chronological order with one line per key definition as - * follows: - * - * - * - * edge reads the key control file periodically to get updates in policy. edge - * holds a number of keys in memory. Data can be decoded if it was encoded by - * any of the keys still in memory. By having at least 2 keys in memory it - * allows for clock skew and transmission delay when encoder and decoder roll - * keys at slightly different times. The amount of overlap in the valid time - * ranges provides the tolerance to timing skews in the system. - * - * The keys have the same level of secrecy as any other user file. Existing - * UNIX permission systems can be used to provide access controls. - * - */ - -/** How Edge Uses The Key Schedule - * - * Edge provides state space for a number of transform algorithms. Each - * transform uses its state space to store the SA information for its keys as - * found in the key file. When a packet is received the transform ID is in - * plain text. The packets is then sent to that transform for decoding. Each - * transform can store its SA numbers differently (or not at all). The - * transform code then finds the SA number, then finds the cipher (with key) in - * the state space and uses this to decode the packet. - * - * To support this, as edge reads each key line, it passes it to the - * appropriate transform to parse the line and store the SA information in its - * state space. - * - * When encoding a packet, edge has several transforms and potentially valid - * SAs to choose from. To keep track of which one to use for encoding edge does - * its own book-keeping as each key line is passed to the transform code: it - * stores a lookup of valid_from -> transform. When encoding a packet it then - * just calls the transform with the best valid_from in the table. The - * transform's own state space has all the SAs for its keys and the best of - * those is chosen. - */ - -#if !defined( N2N_KEYFILE_H_ ) -#define N2N_KEYFILE_H_ - - -#include "n2n_wire.h" -#include - -#define N2N_MAX_KEYSIZE 256 /* bytes */ -#define N2N_MAX_NUM_CIPHERSPECS 8 -#define N2N_KEYPATH_SIZE 256 -#define N2N_KEYFILE_LINESIZE 256 - -/** This structure stores an encryption cipher spec. */ -struct n2n_cipherspec -{ - n2n_transform_t t; /* N2N_TRANSFORM_ID_xxx for this spec. */ - time_t valid_from; /* Start using the key at this time. */ - time_t valid_until; /* Key is valid if time < valid_until. */ - uint16_t opaque_size; /* Size in bytes of key. */ - uint8_t opaque[N2N_MAX_KEYSIZE];/* Key matter. */ -}; - -typedef struct n2n_cipherspec n2n_cipherspec_t; - - -static const char * const DELIMITERS=" \t\n\r"; - - -/** @return number of cipherspec items filled. */ -int n2n_read_keyfile( n2n_cipherspec_t * specs, /* fill out this array of cipherspecs */ - size_t numspecs, /* number of slots in the array. */ - const char * ctrlfile_path ); /* path to control file */ - -int validCipherSpec( const n2n_cipherspec_t * k, - time_t now ); - -ssize_t n2n_parse_hex( uint8_t * keyBuf, - size_t keyMax, - const char * textKey, - size_t textLen ); - -/*----------------------------------------------------------------------------*/ - -#endif /* #if !defined( N2N_KEYFILE_H_ ) */ diff --git a/bundles/n2n_ntop_v2/legacy/transform_aes.c b/bundles/n2n_ntop_v2/legacy/transform_aes.c deleted file mode 100644 index 7b198ff4..00000000 --- a/bundles/n2n_ntop_v2/legacy/transform_aes.c +++ /dev/null @@ -1,730 +0,0 @@ -/** - * (C) 2007-18 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "n2n_transforms.h" - -#if defined(N2N_HAVE_AES) - -#include "openssl/aes.h" -#include "openssl/sha.h" -#ifndef _MSC_VER -/* Not included in Visual Studio 2008 */ -#include /* index() */ -#endif - -#define N2N_AES_NUM_SA 32 /* space for SAa */ - -#define N2N_AES_TRANSFORM_VERSION 1 /* version of the transform encoding */ -#define N2N_AES_IVEC_SIZE 32 /* Enough space for biggest AES ivec */ - -#define AES256_KEY_BYTES (256/8) -#define AES192_KEY_BYTES (192/8) -#define AES128_KEY_BYTES (128/8) - -typedef unsigned char n2n_aes_ivec_t[N2N_AES_IVEC_SIZE]; - -struct sa_aes -{ - n2n_cipherspec_t spec; /* cipher spec parameters */ - n2n_sa_t sa_id; /* security association index */ - AES_KEY enc_key; /* tx key */ - AES_KEY dec_key; /* tx key */ - AES_KEY iv_enc_key; /* key used to encrypt the IV */ - uint8_t iv_ext_val[AES128_KEY_BYTES]; /* key used to extend the random IV seed to full block size */ -}; - -typedef struct sa_aes sa_aes_t; - - -/** Aes transform state data. - * - * With a key-schedule in place this will be populated with a number of - * SAs. Each SA has a lifetime and some opque data. The opaque data for aes - * consists of the SA number and key material. - * - */ -struct transop_aes -{ - ssize_t tx_sa; - size_t num_sa; - sa_aes_t sa[N2N_AES_NUM_SA]; - u_int8_t psk_mode; -}; - -typedef struct transop_aes transop_aes_t; - -static ssize_t aes_find_sa( const transop_aes_t * priv, const n2n_sa_t req_id ); -static int setup_aes_key(transop_aes_t *priv, const uint8_t *key, ssize_t key_size, size_t sa_num); - -static int transop_deinit_aes( n2n_trans_op_t * arg ) -{ - transop_aes_t * priv = (transop_aes_t *)arg->priv; - size_t i; - - if ( priv ) - { - /* Memory was previously allocated */ - for (i=0; isa[i]); - - sa->sa_id=0; - } - - priv->num_sa=0; - priv->tx_sa=-1; - - free(priv); - } - - arg->priv=NULL; /* return to fully uninitialised state */ - - return 0; -} - -static size_t aes_choose_tx_sa( transop_aes_t * priv, const u_int8_t * peer_mac ) { - return priv->tx_sa; /* set in tick */ -} - -static ssize_t aes_choose_rx_sa( transop_aes_t * priv, const u_int8_t * peer_mac, ssize_t sa_rx) { - if(!priv->psk_mode) - return aes_find_sa(priv, sa_rx); - else - /* NOTE the sa_rx of the packet is ignored in this case */ - return 0; -} - -/* AES plaintext preamble */ -#define TRANSOP_AES_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_AES_SA_SIZE 4 -#define TRANSOP_AES_IV_SEED_SIZE 8 -#define TRANSOP_AES_PREAMBLE_SIZE (TRANSOP_AES_VER_SIZE + TRANSOP_AES_SA_SIZE + TRANSOP_AES_IV_SEED_SIZE) - -/* AES ciphertext preamble */ -#define TRANSOP_AES_NONCE_SIZE 4 - -/* Return the best acceptable AES key size (in bytes) given an input keysize. - * - * The value returned will be one of AES128_KEY_BYTES, AES192_KEY_BYTES or - * AES256_KEY_BYTES. - */ -static size_t aes_best_keysize(size_t numBytes) -{ - if (numBytes >= AES256_KEY_BYTES ) - { - return AES256_KEY_BYTES; - } - else if (numBytes >= AES192_KEY_BYTES) - { - return AES192_KEY_BYTES; - } - else - { - return AES128_KEY_BYTES; - } -} - -static void set_aes_cbc_iv(sa_aes_t *sa, n2n_aes_ivec_t ivec, uint64_t iv_seed) { - uint8_t iv_full[AES_BLOCK_SIZE]; - - /* Extend the seed to full block size via the fixed ext value */ - memcpy(iv_full, sa->iv_ext_val, sizeof(iv_seed)); // note: only 64bits used of 128 available - memcpy(iv_full + sizeof(iv_seed), &iv_seed, sizeof(iv_seed)); - - /* Encrypt the IV with secret key to make it unpredictable. - * As discussed in https://github.com/ntop/n2n/issues/72, it's important to - * have an unpredictable IV since the initial part of the packet plaintext - * can be easily reconstructed from plaintext headers and used by an attacker - * to perform differential analysis. - */ - AES_ecb_encrypt(iv_full, ivec, &sa->iv_enc_key, AES_ENCRYPT); -} - -/** The aes packet format consists of: - * - * - a 8-bit aes encoding version in clear text - * - a 32-bit SA number in clear text - * - a 64-bit random IV seed - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|II|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_encode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len2=-1; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE] = {0}; - uint32_t * pnonce; - - if ( (in_len + TRANSOP_AES_NONCE_SIZE) <= N2N_PKT_BUF_SIZE ) - { - if ( (in_len + TRANSOP_AES_NONCE_SIZE + TRANSOP_AES_PREAMBLE_SIZE) <= out_len ) - { - int len=-1; - size_t idx=0; - sa_aes_t * sa; - size_t tx_sa_num = 0; - uint64_t iv_seed = 0; - uint8_t padding = 0; - n2n_aes_ivec_t enc_ivec = {0}; - - /* The transmit sa is periodically updated */ - tx_sa_num = aes_choose_tx_sa( priv, peer_mac ); - - sa = &(priv->sa[tx_sa_num]); /* Proper Tx SA index */ - - traceEvent( TRACE_DEBUG, "encode_aes %lu with SA %lu.", in_len, sa->sa_id ); - - /* Encode the aes format version. */ - encode_uint8( outbuf, &idx, N2N_AES_TRANSFORM_VERSION ); - - /* Encode the security association (SA) number */ - encode_uint32( outbuf, &idx, sa->sa_id ); - - /* Generate and encode the IV seed. - * Using two calls to rand() because RAND_MAX is usually < 64bit - * (e.g. linux) and sometimes < 32bit (e.g. Windows). - */ - ((uint32_t*)&iv_seed)[0] = rand(); - ((uint32_t*)&iv_seed)[1] = rand(); - encode_buf(outbuf, &idx, &iv_seed, sizeof(iv_seed)); - - /* Encrypt the assembly contents and write the ciphertext after the SA. */ - len = in_len + TRANSOP_AES_NONCE_SIZE; - - /* The assembly buffer is a source for encrypting data. The nonce is - * written in first followed by the packet payload. The whole - * contents of assembly are encrypted. */ - pnonce = (uint32_t *)assembly; - *pnonce = rand(); - memcpy( assembly + TRANSOP_AES_NONCE_SIZE, inbuf, in_len ); - - /* Need at least one encrypted byte at the end for the padding. */ - len2 = ( (len / AES_BLOCK_SIZE) + 1) * AES_BLOCK_SIZE; /* Round up to next whole AES adding at least one byte. */ - padding = (len2-len); - assembly[len2 - 1] = padding; - traceEvent( TRACE_DEBUG, "padding = %u, seed = %016lx", padding, iv_seed ); - - set_aes_cbc_iv(sa, enc_ivec, iv_seed); - - AES_cbc_encrypt( assembly, /* source */ - outbuf + TRANSOP_AES_PREAMBLE_SIZE, /* dest */ - len2, /* enc size */ - &(sa->enc_key), enc_ivec, AES_ENCRYPT ); - - len2 += TRANSOP_AES_PREAMBLE_SIZE; /* size of data carried in UDP. */ - } - else - { - traceEvent( TRACE_ERROR, "encode_aes outbuf too small." ); - } - } - else - { - traceEvent( TRACE_ERROR, "encode_aes inbuf too big to encrypt." ); - } - - return len2; -} - - -/* Search through the array of SAs to find the one with the required ID. - * - * @return array index where found or -1 if not found - */ -static ssize_t aes_find_sa( const transop_aes_t * priv, const n2n_sa_t req_id ) -{ - size_t i; - - for (i=0; i < priv->num_sa; ++i) - { - const sa_aes_t * sa=NULL; - - sa = &(priv->sa[i]); - if (req_id == sa->sa_id) - { - return i; - } - } - - return -1; -} - - -/* See transop_encode_aes for packet format */ -static int transop_decode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len=0; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - if ( ( (in_len - TRANSOP_AES_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE ) /* Cipher text fits in assembly */ - && (in_len >= (TRANSOP_AES_PREAMBLE_SIZE + TRANSOP_AES_NONCE_SIZE) ) /* Has at least version, SA, iv seed and nonce */ - ) - { - n2n_sa_t sa_rx; - ssize_t sa_idx=-1; - size_t rem=in_len; - size_t idx=0; - uint8_t aes_enc_ver=0; - uint64_t iv_seed=0; - - /* Get the encoding version to make sure it is supported */ - decode_uint8( &aes_enc_ver, inbuf, &rem, &idx ); - - if ( N2N_AES_TRANSFORM_VERSION == aes_enc_ver ) - { - /* Get the SA number and make sure we are decrypting with the right one. */ - decode_uint32( &sa_rx, inbuf, &rem, &idx ); - - sa_idx = aes_choose_rx_sa(priv, peer_mac, sa_rx); - - if ( sa_idx >= 0 ) - { - sa_aes_t * sa = &(priv->sa[sa_idx]); - - /* Get the IV seed */ - decode_buf((uint8_t *)&iv_seed, sizeof(iv_seed), inbuf, &rem, &idx); - - traceEvent( TRACE_DEBUG, "decode_aes %lu with SA %lu and seed %016lx", in_len, sa->sa_id, iv_seed ); - - len = (in_len - TRANSOP_AES_PREAMBLE_SIZE); - - if ( 0 == (len % AES_BLOCK_SIZE ) ) - { - uint8_t padding; - n2n_aes_ivec_t dec_ivec = {0}; - - set_aes_cbc_iv(sa, dec_ivec, iv_seed); - - AES_cbc_encrypt( (inbuf + TRANSOP_AES_PREAMBLE_SIZE), - assembly, /* destination */ - len, - &(sa->dec_key), - dec_ivec, AES_DECRYPT ); - - /* last byte is how much was padding: max value should be - * AES_BLOCKSIZE-1 */ - padding = assembly[ len-1 ] & 0xff; - - if ( len >= (padding + TRANSOP_AES_NONCE_SIZE)) - { - /* strictly speaking for this to be an ethernet packet - * it is going to need to be even bigger; but this is - * enough to prevent segfaults. */ - traceEvent( TRACE_DEBUG, "padding = %u", padding ); - len -= padding; - - len -= TRANSOP_AES_NONCE_SIZE; /* size of ethernet packet */ - - /* Step over 4-byte random nonce value */ - memcpy( outbuf, - assembly + TRANSOP_AES_NONCE_SIZE, - len ); - } - else - { - traceEvent( TRACE_WARNING, "UDP payload decryption failed." ); - } - } - else - { - traceEvent( TRACE_WARNING, "Encrypted length %d is not a multiple of AES_BLOCK_SIZE (%d)", len, AES_BLOCK_SIZE ); - len = 0; - } - - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_aes SA number %lu not found.", sa_rx ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_aes unsupported aes version %u.", aes_enc_ver ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - traceEvent( TRACE_ERROR, "decode_aes inbuf wrong size (%ul) to decrypt.", in_len ); - } - - return len; -} - -struct sha512_keybuf { - uint8_t enc_dec_key[AES256_KEY_BYTES]; /* The key to use for AES CBC encryption/decryption */ - uint8_t iv_enc_key[AES128_KEY_BYTES]; /* The key to use to encrypt the IV with AES ECB */ - uint8_t iv_ext_val[AES128_KEY_BYTES]; /* A value to extend the IV seed */ -}; /* size: SHA512_DIGEST_LENGTH */ - -/* NOTE: the caller should adjust priv->num_sa accordingly */ -static int setup_aes_key(transop_aes_t *priv, const uint8_t *key, ssize_t key_size, size_t sa_num) { - sa_aes_t * sa = &(priv->sa[sa_num]); - size_t aes_keysize_bytes; - size_t aes_keysize_bits; - struct sha512_keybuf keybuf; - - /* Clear out any old possibly longer key matter. */ - memset( &(sa->enc_key), 0, sizeof(sa->enc_key) ); - memset( &(sa->dec_key), 0, sizeof(sa->dec_key) ); - memset( &(sa->iv_enc_key), 0, sizeof(sa->iv_enc_key) ); - memset( &(sa->iv_ext_val), 0, sizeof(sa->iv_ext_val) ); - - /* We still use aes_best_keysize (even not necessary since we hash the key - * into the 256bits enc_dec_key) to let the users choose the degree of encryption. - * Long keys will pick AES192 or AES256 with more robust but expensive encryption. - */ - aes_keysize_bytes = aes_best_keysize(key_size); - aes_keysize_bits = 8 * aes_keysize_bytes; - - /* Hash the main key to generate subkeys */ - SHA512(key, key_size, (u_char*)&keybuf); - - /* setup of enc_key/dec_key, used for the CBC encryption */ - AES_set_encrypt_key(keybuf.enc_dec_key, aes_keysize_bits, &(sa->enc_key)); - AES_set_decrypt_key(keybuf.enc_dec_key, aes_keysize_bits, &(sa->dec_key)); - - /* setup of iv_enc_key and iv_ext_val, used for generating the CBC IV */ - AES_set_encrypt_key(keybuf.iv_enc_key, sizeof(keybuf.iv_enc_key) * 8, &(sa->iv_enc_key)); - memcpy(sa->iv_ext_val, keybuf.iv_ext_val, sizeof(keybuf.iv_ext_val)); - - traceEvent( TRACE_DEBUG, "transop_addspec_aes sa_id=%u, %u bits key=%s.\n", - priv->sa[sa_num].sa_id, aes_keysize_bits, key); - - return(0); -} - -/* - * priv: pointer to transform state - * keybuf: buffer holding the key - * pstat: length of keybuf - */ -static void add_aes_key(transop_aes_t *priv, uint8_t *keybuf, ssize_t pstat) { - setup_aes_key(priv, keybuf, pstat, priv->num_sa); - ++(priv->num_sa); -} - -static int transop_addspec_aes( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - int retval = 1; - ssize_t pstat=-1; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t keybuf[N2N_MAX_KEYSIZE]; - - if ( priv->num_sa < N2N_AES_NUM_SA ) - { - const char * op = (const char *)cspec->opaque; - const char * sep = index( op, '_' ); - - if ( sep ) - { - char tmp[256]; - size_t s; - - s = sep - op; - memcpy( tmp, cspec->opaque, s ); - tmp[s]=0; - - s = strlen(sep+1); /* sep is the _ which might be immediately followed by NULL */ - - priv->sa[priv->num_sa].spec = *cspec; - priv->sa[priv->num_sa].sa_id = strtoul(tmp, NULL, 10); - - memset( keybuf, 0, N2N_MAX_KEYSIZE ); - pstat = n2n_parse_hex( keybuf, N2N_MAX_KEYSIZE, sep+1, s ); - if ( pstat > 0 ) - { - add_aes_key(priv, keybuf, pstat); - retval = 0; - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_aes : bad key data - missing '_'.\n"); - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_aes : full.\n"); - } - - return retval; -} - - -static n2n_tostat_t transop_tick_aes( n2n_trans_op_t * arg, time_t now ) -{ - transop_aes_t * priv = (transop_aes_t *)arg->priv; - size_t i; - int found=0; - n2n_tostat_t r; - - memset( &r, 0, sizeof(r) ); - - traceEvent( TRACE_DEBUG, "transop_aes tick num_sa=%u now=%lu", priv->num_sa, now ); - - for ( i=0; i < priv->num_sa; ++i ) - { - if ( 0 == validCipherSpec( &(priv->sa[i].spec), now ) ) - { - time_t remaining = priv->sa[i].spec.valid_until - now; - - traceEvent( TRACE_INFO, "transop_aes choosing tx_sa=%u (valid for %lu sec)", priv->sa[i].sa_id, remaining ); - priv->tx_sa=i; - found=1; - break; - } - else - { - traceEvent( TRACE_DEBUG, "transop_aes tick rejecting sa=%u %lu -> %lu", - priv->sa[i].sa_id, priv->sa[i].spec.valid_from, priv->sa[i].spec.valid_until ); - } - } - - if ( 0==found) - { - traceEvent( TRACE_INFO, "transop_aes no keys are currently valid. Keeping tx_sa=%u", priv->tx_sa ); - } - else - { - r.can_tx = 1; - r.tx_spec.t = N2N_TRANSFORM_ID_AESCBC; - r.tx_spec = priv->sa[priv->tx_sa].spec; - } - - return r; -} - -static n2n_tostat_t transop_tick_aes_psk(n2n_trans_op_t * arg, time_t now) { - transop_aes_t * priv = (transop_aes_t *)arg->priv; - n2n_tostat_t r; - - memset(&r, 0, sizeof(r)); - - // Always tx - r.can_tx = 1; - r.tx_spec.t = N2N_TRANSFORM_ID_AESCBC; - r.tx_spec = priv->sa[priv->tx_sa].spec; - - return r; -} - -int transop_aes_init( n2n_trans_op_t * ttt ) -{ - int retval = 1; - transop_aes_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_aes( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_aes_t *) calloc(1, sizeof(transop_aes_t)); - - if ( NULL != priv ) - { - size_t i; - sa_aes_t * sa=NULL; - - /* install the private structure. */ - ttt->priv = priv; - priv->num_sa=0; - priv->tx_sa=0; /* We will use this sa index for encoding. */ - priv->psk_mode = 0; - - ttt->transform_id = N2N_TRANSFORM_ID_AESCBC; - ttt->addspec = transop_addspec_aes; - ttt->tick = transop_tick_aes; /* chooses a new tx_sa */ - ttt->deinit = transop_deinit_aes; - ttt->fwd = transop_encode_aes; - ttt->rev = transop_decode_aes; - - for(i=0; isa[i]); - sa->sa_id=0; - memset( &(sa->spec), 0, sizeof(n2n_cipherspec_t) ); - memset( &(sa->enc_key), 0, sizeof(sa->enc_key) ); - memset( &(sa->dec_key), 0, sizeof(sa->dec_key) ); - memset( &(sa->iv_enc_key), 0, sizeof(sa->iv_enc_key) ); - memset( &(sa->iv_ext_val), 0, sizeof(sa->iv_ext_val) ); - } - - retval = 0; - } - else - { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for aes" ); - } - - return retval; -} - -/* Setup AES in pre-shared key mode */ -int transop_aes_setup_psk(n2n_trans_op_t *ttt, - n2n_sa_t sa_num, - uint8_t *encrypt_pwd, - uint32_t encrypt_pwd_len) { - int retval = 1; - transop_aes_t *priv = (transop_aes_t *)ttt->priv; - - if(ttt->priv) { - /* Replace the tick function with the PSK version of it */ - ttt->tick = transop_tick_aes_psk; - priv->psk_mode = 1; - priv->num_sa=0; - priv->tx_sa=0; - - /* Setup the key to use for encryption/decryption */ - add_aes_key(priv, encrypt_pwd, encrypt_pwd_len); - - retval = 0; - } else - traceEvent(TRACE_ERROR, "AES priv is not allocated"); - - return retval; -} - -#else /* #if defined(N2N_HAVE_AES) */ - -struct transop_aes -{ - ssize_t tx_sa; -}; - -typedef struct transop_aes transop_aes_t; - - -static int transop_deinit_aes( n2n_trans_op_t * arg ) -{ - transop_aes_t * priv = (transop_aes_t *)arg->priv; - - if ( priv ) - { - free(priv); - } - - arg->priv=NULL; /* return to fully uninitialised state */ - - return 0; -} - -static int transop_encode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - return -1; -} - -static int transop_decode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - return -1; -} - -static int transop_addspec_aes( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - traceEvent( TRACE_DEBUG, "transop_addspec_aes AES not built into edge.\n"); - - return -1; -} - -static n2n_tostat_t transop_tick_aes( n2n_trans_op_t * arg, time_t now ) -{ - n2n_tostat_t r; - - memset( &r, 0, sizeof(r) ); - - return r; -} - -int transop_aes_init( n2n_trans_op_t * ttt ) -{ - int retval = 1; - transop_aes_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_aes( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_aes_t *) malloc( sizeof(transop_aes_t) ); - - if ( NULL != priv ) - { - /* install the private structure. */ - ttt->priv = priv; - priv->tx_sa=0; /* We will use this sa index for encoding. */ - - ttt->transform_id = N2N_TRANSFORM_ID_AESCBC; - ttt->addspec = transop_addspec_aes; - ttt->tick = transop_tick_aes; /* chooses a new tx_sa */ - ttt->deinit = transop_deinit_aes; - ttt->fwd = transop_encode_aes; - ttt->rev = transop_decode_aes; - - retval = 0; - } - else - { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for aes" ); - } - - return retval; -} - - -int transop_aes_setup_psk(n2n_trans_op_t *ttt, - n2n_sa_t sa_num, - uint8_t *encrypt_pwd, - uint32_t encrypt_pwd_len) { - return 0; -} - -#endif /* #if defined(N2N_HAVE_AES) */ - diff --git a/bundles/n2n_ntop_v2/legacy/transform_tf.c b/bundles/n2n_ntop_v2/legacy/transform_tf.c deleted file mode 100644 index 6b4d6060..00000000 --- a/bundles/n2n_ntop_v2/legacy/transform_tf.c +++ /dev/null @@ -1,467 +0,0 @@ -/** - * (C) 2007-18 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "n2n_transforms.h" -#include "twofish.h" -#ifndef _MSC_VER -/* Not included in Visual Studio 2008 */ -#include /* index() */ -#endif - -#define N2N_TWOFISH_NUM_SA 32 /* space for SAa */ - -#define N2N_TWOFISH_TRANSFORM_VERSION 1 /* version of the transform encoding */ - -struct sa_twofish -{ - n2n_cipherspec_t spec; /* cipher spec parameters */ - n2n_sa_t sa_id; /* security association index */ - TWOFISH * enc_tf; /* tx state */ - TWOFISH * dec_tf; /* rx state */ -}; - -typedef struct sa_twofish sa_twofish_t; - - -/** Twofish transform state data. - * - * With a key-schedule in place this will be populated with a number of - * SAs. Each SA has a lifetime and some opque data. The opaque data for twofish - * consists of the SA number and key material. - * - */ -struct transop_tf -{ - ssize_t tx_sa; - size_t num_sa; - sa_twofish_t sa[N2N_TWOFISH_NUM_SA]; -}; - -typedef struct transop_tf transop_tf_t; - -static int transop_deinit_twofish( n2n_trans_op_t * arg ) -{ - transop_tf_t * priv = (transop_tf_t *)arg->priv; - size_t i; - - if ( priv ) - { - /* Memory was previously allocated */ - for (i=0; isa[i]); - - TwoFishDestroy(sa->enc_tf); /* deallocate TWOFISH */ - sa->enc_tf=NULL; - - TwoFishDestroy(sa->dec_tf); /* deallocate TWOFISH */ - sa->dec_tf=NULL; - - sa->sa_id=0; - } - - priv->num_sa=0; - priv->tx_sa=-1; - - free(priv); - } - - arg->priv=NULL; /* return to fully uninitialised state */ - - return 0; -} - -static size_t tf_choose_tx_sa( transop_tf_t * priv ) -{ - return priv->tx_sa; /* set in tick */ -} - -#define TRANSOP_TF_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_TF_NONCE_SIZE 4 -#define TRANSOP_TF_SA_SIZE 4 - -/** The twofish packet format consists of: - * - * - a 8-bit twofish encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_encode_twofish( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len=-1; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - uint32_t * pnonce; - - if ( (in_len + TRANSOP_TF_NONCE_SIZE) <= N2N_PKT_BUF_SIZE ) - { - if ( (in_len + TRANSOP_TF_NONCE_SIZE + TRANSOP_TF_SA_SIZE + TRANSOP_TF_VER_SIZE) <= out_len ) - { - size_t idx=0; - sa_twofish_t * sa; - size_t tx_sa_num = 0; - - /* The transmit sa is periodically updated */ - tx_sa_num = tf_choose_tx_sa( priv ); - - sa = &(priv->sa[tx_sa_num]); /* Proper Tx SA index */ - - traceEvent( TRACE_DEBUG, "encode_twofish %lu with SA %lu.", in_len, sa->sa_id ); - - /* Encode the twofish format version. */ - encode_uint8( outbuf, &idx, N2N_TWOFISH_TRANSFORM_VERSION ); - - /* Encode the security association (SA) number */ - encode_uint32( outbuf, &idx, sa->sa_id ); - - /* The assembly buffer is a source for encrypting data. The nonce is - * written in first followed by the packet payload. The whole - * contents of assembly are encrypted. */ - pnonce = (uint32_t *)assembly; - *pnonce = rand(); - memcpy( assembly + TRANSOP_TF_NONCE_SIZE, inbuf, in_len ); - - /* Encrypt the assembly contents and write the ciphertext after the SA. */ - len = TwoFishEncryptRaw( assembly, /* source */ - outbuf + TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE, - in_len + TRANSOP_TF_NONCE_SIZE, /* enc size */ - sa->enc_tf); - if ( len > 0 ) - { - len += TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE; /* size of data carried in UDP. */ - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish encryption failed." ); - } - - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish outbuf too small." ); - } - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish inbuf too big to encrypt." ); - } - - return len; -} - - -/* Search through the array of SAs to find the one with the required ID. - * - * @return array index where found or -1 if not found - */ -static ssize_t twofish_find_sa( const transop_tf_t * priv, const n2n_sa_t req_id ) -{ - size_t i; - - for (i=0; i < priv->num_sa; ++i) - { - const sa_twofish_t * sa=NULL; - - sa = &(priv->sa[i]); - if (req_id == sa->sa_id) - { - return i; - } - } - - return -1; -} - - -/** The twofish packet format consists of: - * - * - a 8-bit twofish encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_decode_twofish( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len=0; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - if ( ( (in_len - (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE)) <= N2N_PKT_BUF_SIZE ) /* Cipher text fits in assembly */ - && (in_len >= (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE + TRANSOP_TF_NONCE_SIZE) ) /* Has at least version, SA and nonce */ - ) - { - n2n_sa_t sa_rx; - ssize_t sa_idx=-1; - size_t rem=in_len; - size_t idx=0; - uint8_t tf_enc_ver=0; - - /* Get the encoding version to make sure it is supported */ - decode_uint8( &tf_enc_ver, inbuf, &rem, &idx ); - - if ( N2N_TWOFISH_TRANSFORM_VERSION == tf_enc_ver ) - { - /* Get the SA number and make sure we are decrypting with the right one. */ - decode_uint32( &sa_rx, inbuf, &rem, &idx ); - - sa_idx = twofish_find_sa(priv, sa_rx); - if ( sa_idx >= 0 ) - { - sa_twofish_t * sa = &(priv->sa[sa_idx]); - - traceEvent( TRACE_DEBUG, "decode_twofish %lu with SA %lu.", in_len, sa_rx, sa->sa_id ); - - len = TwoFishDecryptRaw( (void *)(inbuf + TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE), - assembly, /* destination */ - (in_len - (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE)), - sa->dec_tf); - - if ( len > 0 ) - { - /* Step over 4-byte random nonce value */ - len -= TRANSOP_TF_NONCE_SIZE; /* size of ethernet packet */ - - memcpy( outbuf, - assembly + TRANSOP_TF_NONCE_SIZE, - len ); - } - else - { - traceEvent( TRACE_ERROR, "decode_twofish decryption failed." ); - } - - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_twofish SA number %lu not found.", sa_rx ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_twofish unsupported twofish version %u.", tf_enc_ver ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - traceEvent( TRACE_ERROR, "decode_twofish inbuf wrong size (%ul) to decrypt.", in_len ); - } - - return len; -} - -static int transop_addspec_twofish( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - int retval = 1; - ssize_t pstat=-1; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t keybuf[N2N_MAX_KEYSIZE]; - - if ( priv->num_sa < N2N_TWOFISH_NUM_SA ) - { - const char * op = (const char *)cspec->opaque; -#ifdef __ANDROID_NDK__ - const char *sep = strchr(op, '_'); -#else - const char * sep = index( op, '_' ); -#endif // __ANDROID_NDK__ - - if ( sep ) - { - char tmp[256]; - size_t s; - - s = sep - op; - memcpy( tmp, cspec->opaque, s ); - tmp[s]=0; - - s = strlen(sep+1); /* sep is the _ which might be immediately followed by NULL */ - - priv->sa[priv->num_sa].spec = *cspec; - priv->sa[priv->num_sa].sa_id = strtoul(tmp, NULL, 10); - - pstat = n2n_parse_hex( keybuf, N2N_MAX_KEYSIZE, sep+1, s ); - if ( pstat > 0 ) - { - priv->sa[priv->num_sa].enc_tf = TwoFishInit( keybuf, pstat); - priv->sa[priv->num_sa].dec_tf = TwoFishInit( keybuf, pstat); - - traceEvent( TRACE_DEBUG, "transop_addspec_twofish sa_id=%u data=%s.\n", - priv->sa[priv->num_sa].sa_id, sep+1); - - ++(priv->num_sa); - retval = 0; - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_twofish : bad key data - missing '_'.\n"); - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_twofish : full.\n"); - } - - return retval; -} - - -static n2n_tostat_t transop_tick_twofish( n2n_trans_op_t * arg, time_t now ) -{ - transop_tf_t * priv = (transop_tf_t *)arg->priv; - size_t i; - int found=0; - n2n_tostat_t r; - - memset( &r, 0, sizeof(r) ); - - traceEvent( TRACE_DEBUG, "transop_tf tick num_sa=%u", priv->num_sa ); - - for ( i=0; i < priv->num_sa; ++i ) - { - if ( 0 == validCipherSpec( &(priv->sa[i].spec), now ) ) - { - time_t remaining = priv->sa[i].spec.valid_until - now; - - traceEvent( TRACE_INFO, "transop_tf choosing tx_sa=%u (valid for %lu sec)", priv->sa[i].sa_id, remaining ); - priv->tx_sa=i; - found=1; - break; - } - else - { - traceEvent( TRACE_DEBUG, "transop_tf tick rejecting sa=%u %lu -> %lu", - priv->sa[i].sa_id, priv->sa[i].spec.valid_from, priv->sa[i].spec.valid_until ); - } - } - - if ( 0==found) - { - traceEvent( TRACE_INFO, "transop_tf no keys are currently valid. Keeping tx_sa=%u", priv->tx_sa ); - } - else - { - r.can_tx = 1; - r.tx_spec.t = N2N_TRANSFORM_ID_TWOFISH; - r.tx_spec = priv->sa[priv->tx_sa].spec; - } - - return r; -} - -int transop_twofish_setup_psk( n2n_trans_op_t * ttt, - n2n_sa_t sa_num, - uint8_t * encrypt_pwd, - uint32_t encrypt_pwd_len ) -{ - int retval = 1; - transop_tf_t * priv = (transop_tf_t *)ttt->priv; - - if(priv) { - sa_twofish_t *sa; - - priv->num_sa=1; /* There is one SA in the array. */ - priv->tx_sa=0; - sa = &(priv->sa[priv->tx_sa]); - sa->sa_id=sa_num; - sa->spec.valid_until = 0x7fffffff; - - /* This is a preshared key setup. Both Tx and Rx are using the same security association. */ - - sa->enc_tf = TwoFishInit(encrypt_pwd, encrypt_pwd_len); - sa->dec_tf = TwoFishInit(encrypt_pwd, encrypt_pwd_len); - - if ( (sa->enc_tf) && (sa->dec_tf) ) - retval = 0; - else - traceEvent( TRACE_ERROR, "transop_twofish_setup_psk" ); - } else - traceEvent( TRACE_ERROR, "twofish priv is not allocated" ); - - return retval; -} - -int transop_twofish_init( n2n_trans_op_t * ttt ) -{ - int retval = 1; - transop_tf_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_twofish( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_tf_t *) malloc( sizeof(transop_tf_t) ); - - if ( NULL != priv ) { - size_t i; - sa_twofish_t * sa=NULL; - - /* install the private structure. */ - ttt->priv = priv; - priv->num_sa=0; - priv->tx_sa=0; /* We will use this sa index for encoding. */ - - ttt->transform_id = N2N_TRANSFORM_ID_TWOFISH; - ttt->addspec = transop_addspec_twofish; - ttt->tick = transop_tick_twofish; /* chooses a new tx_sa */ - ttt->deinit = transop_deinit_twofish; - ttt->fwd = transop_encode_twofish; - ttt->rev = transop_decode_twofish; - - for(i=0; isa[i]); - sa->sa_id=0; - memset( &(sa->spec), 0, sizeof(n2n_cipherspec_t) ); - sa->enc_tf=NULL; - sa->dec_tf=NULL; - } - - retval = 0; - } else { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for twofish" ); - } - - return retval; -} diff --git a/bundles/n2n_ntop_v2/n2n.7 b/bundles/n2n_ntop_v2/n2n.7 deleted file mode 100644 index 092f2d3a..00000000 --- a/bundles/n2n_ntop_v2/n2n.7 +++ /dev/null @@ -1,156 +0,0 @@ -.TH "n2n_v2" 7 "Sep 21, 2009" "revision 3909" "Background" -.SH NAME -N2n Version 2 \- version 2 of the n2n decentralised peer-to-peer network overlay -VPN. -.SH DESCRIPTION -N2n is a peer-to-peer network overlay or VPN system that provides layer 2 over -layer 3 encapsulation with data transform capabilities such as encryption and -compression. This guide discusses the differences of version 2 or n2n from -version 1. -.SH PROTOCOLS -N2n-2 uses a different set of messages to communicate with edges and -supernodes. The n2n-2 messages are not compatible with n2n-1. There is no -backward compatibility for n2n-1. -.SH ENCRYPTION -N2n-2 offers a new way of handling encryption compared to n2n-1. N2n-1 provided -facility for a single community password with no expiration. In n2n-2 this -method is preserved but a new mechanism has been added using a key schedule -file. -.TP -Key Schedule -A key schedule file lists a number of keys with the period for which each is -valid along with the encryption type identifier and the actual key value. This -allows the user to define up to 32 keys in advance with a pre-set time at which -they keys will change. The key schedule file can be reloaded while the edge is -running to allow new keys to be loaded and unused keys expunged. -.TP -Timing Requirements When a key rolls over to the next in the schedule, the new -key is used for all transmitted packets; however any packets received using an -older key can still be decoded as the keys from the key schedule are still -known. As a result edges do not need to have accurate time synchronisation. The -accuracy of required synchronisation depends to a large degree on the key -schedule. Rapid key roll-overs requires more accurate time synchronisation. -.P -N2n-2 provides the following encryption ciphers; more can be added as required: -.TP -.B (1) NULL -Data is encapsulated unchanged. Useful for testing and high-performance, low -sensitivity applications. -.TP -.B (2) TF -Twofish AES candidate. -.P -The following additional ciphers are specified but not yet implemented: -.TP -.B (3) AES-CBC -AES in CBC mode with 256-bit key. -.TP -.B (4) LZO -LZO compression of data (no encryption). -.TP -.B (5) TF-LZO -TF cipher with LZO compression of data prior to encryption. -.TP -.B (6) AES-CBC-LZO -AES-CBC ciper with LZO compression of data prior to encryption. - -.SH EXTENSIBILITY -N2n-2 decouples the data transform system from the core of the edge -operation. This allows for easier addition of new data transform -operations. N2n-2 reserves 64 standard transform identifiers (such as TwoFish -encryption) but allocates transform identifiers 64 - 65536 for user-defined -transforms. This allows anyone to add to n2n new private transforms without -breaking compatibility with the standard offering. - -.SH MULTIPLE SUPERNODES -N2n-2 introduces the capability of multiple supernodes to be used by an -edge. N2n-2 offers supernode in several flavours: -.TP -Stand-alone supernode - -This is the same concept as from n2n-1. Supernode is a small efficient C program -which operates in isolation. -.TP -Federated supernodes - -This is a cluster of supernodes which share information. Edges registered to any -of the cooperating supernodes can relay packets through the supernode federation -and switch supernodes if required. Supernodes can send PACKET or REGISTER -messages to other supernodes to try and find the destination edge. - -.P -The n2n-2 edge implementation allows multiple supernodes to be specified on the -command line. Edges monitor the current supernode for responses to -REGISTER_SUPER messages. If 3 responses are missed then the edge starts looking -for a new supernode. It cycles through the list of supernodes specified until it -finds a working one. - -.SH EFFICIENCY -The n2n-2 message formats have been made more efficient. The amount of data -overhead has been reduced by ensuring the messages contain only the data fields -required. Some optional fields do not consume data if they are not present. - -.SH DAEMON OPERATION -The supernode and edge use daemon mode of operation by default. This sense is -inverted from n2n-1 where they ran in the foreground by default. They can be -made to run in the foreground so tools such a DJB's daemontools can work with -them. See the -.B -f -option - -.SH MANAGEMENT CONSOLE -Edge and supernode in n2n-2 provide a UDP-based management console. Both listen -on the localhost address 127.0.0.1. Commands can be sent to the programs by -sending to the UDP socket. Responses are returned to the socket from which -commands were issued. This only works from the computer on which the programs -are running. Statistics can be retrieved and commands issued. The netcat utility -is all that is required; but more sophisticated tools could be built on the -interface. - -.SH SUPERNODE AUTHENTICATION -.B (To be implemented) -Space has been reserved in the supernode registration messages for an -authentication mechanism. - -.SH MESSAGE SUMMARY -The following message types work within n2n-2. -.TP -REGISTER_SUPER -Sent from an edge to its local supernode to register its MAC with the community. -.TP -REGISTER_SUPER_ACK -Sent from a supernode to an edge to confirm registration. This also carries the -definition of the edge socket as seen at the supernode so NAT can be detected -and described. -.TP -REGISTER_SUPER_NAK -Supernode refusing to register an edge. -.TP -PACKET -Encapsulated ethernet packets sent between edges. Supernodes forward or -broadcast these and edges send them direct in peer-to-peer mode. -.TP -REGISTER -A peer-to-peer mode registration request from one edge to another. Supernodes -forward these to facilitate NAT crossing introductions. -.TP -REGISTER_ACK -Complete peer-to-peer mode setup between two edges. These messages need to -travel direct between edges. -.TP -FEDERATION -Federated supernodes exchanging community information. - -.SH OTHER DIFFERENCES -.TP -HTTP Tunneling -This experimental feature (-t option in n2n_v1) of n2n_v1 has been removed -entirely from n2n_v2. -.SH AUTHORS -.TP -Richard Andrews andrews (at) ntop.org - main author of n2n-2 -.TP -Luca Deri -deri (at) ntop.org - code inherited from n2n-1 -.SH SEE ALSO -ifconfig(8) edge(8) supernode(1) diff --git a/bundles/n2n_ntop_v2/packages/centos b/bundles/n2n_ntop_v2/packages/centos deleted file mode 100644 index 7c88ef3c..00000000 --- a/bundles/n2n_ntop_v2/packages/centos +++ /dev/null @@ -1 +0,0 @@ -rpm \ No newline at end of file diff --git a/bundles/n2n_ntop_v2/packages/debian/Makefile.in b/bundles/n2n_ntop_v2/packages/debian/Makefile.in deleted file mode 100644 index 68467aa8..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/Makefile.in +++ /dev/null @@ -1,38 +0,0 @@ -# -# Change it according to your setup -# -N2N_HOME=$(PWD)/../.. -N2N_BUILD=${N2N_HOME}/packages/debian/n2n - -all: clean pkg - -pkg: - cd ../..; make; cd - - if test -e "${N2N_BUILD}"; then /bin/rm -fr ${N2N_BUILD}; fi - mkdir -p ${N2N_BUILD}/usr/sbin ${N2N_BUILD}/usr/share/man/man1 ${N2N_BUILD}/usr/share/man/man7 ${N2N_BUILD}/usr/share/man/man8 - install -m755 ../../supernode ${N2N_BUILD}/usr/sbin/ - install -m755 ../../edge ${N2N_BUILD}/usr/sbin/ - install -m644 ../../edge.8.gz ${N2N_BUILD}/usr/share/man/man8/ - install -m644 ../../supernode.1.gz ${N2N_BUILD}/usr/share/man/man1/ - install -m644 ../../n2n.7.gz ${N2N_BUILD}/usr/share/man/man7/ - @/bin/rm -f ../n2n*.deb - dpkg-buildpackage -rfakeroot -d -us -uc - dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb - @\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes - @/bin/mv ../n2n_*deb . - @echo - @echo "Package built." - @/bin/ls n2n_*deb - @echo "-------------------------------" - -dpkg -I n2n_*deb - -dpkg --contents n2n_*deb - @echo "-------------------------------" - -distclean: - echo "dummy distclean" - -install: - echo "dummy install" - -clean: - rm -rf *~ *deb diff --git a/bundles/n2n_ntop_v2/packages/debian/README b/bundles/n2n_ntop_v2/packages/debian/README deleted file mode 100644 index 915a7c15..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/README +++ /dev/null @@ -1,21 +0,0 @@ -Prerequisites -------------- -apt-get install debhelper fakeroot dpkg-sig - -EdgeOS ------- -We need to replace BusyBox-implemented commands using full-fledged commands by doing -(see http://community.ubnt.com/t5/EdgeMAX/ubnt-debian-package-conflict/m-p/421325) - -curl -O http://ftp.us.debian.org/debian/pool/main/c/coreutils/coreutils_8.5-1_mips.deb -dpkg -i --force-all coreutils_8.5-1_mips.deb - -curl -O http://ftp.us.debian.org/debian/pool/main/t/tar/tar_1.23-3_mips.deb -dpkg -i --force-all tar_1.23-3_mips.deb - -wget http://ftp.us.debian.org/debian/pool/main/f/findutils/findutils_4.4.2-4_mips.deb -dpkg -i --force-all findutils_4.4.2-4_mips.deb - -wget http://ftp.us.debian.org/debian/pool/main/g/gzip/gzip_1.5-1.1_mips.deb -dpkg -i --force-all gzip_1.5-1.1_mips.deb - diff --git a/bundles/n2n_ntop_v2/packages/debian/configure.in b/bundles/n2n_ntop_v2/packages/debian/configure.in deleted file mode 100644 index fe86b74a..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/configure.in +++ /dev/null @@ -1,50 +0,0 @@ -AC_INIT([Makefile.in], 1.0) - -# NOTE: this file is not actually used. You need to edit configure as well! -N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` -GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2` - -MACHINE=`uname -m` -SHORT_MACHINE=`uname -m | cut -b1-3` - -if test $MACHINE = "x86_64"; then - EXTN="amd64" -else - if test $SHORT_MACHINE = "aar"; then - EXTN="arm64" - EXTRA_DEPS="" - else - if test $SHORT_MACHINE = "arm"; then - EXTN="armhf" - EXTRA_DEPS="" - else - if test $SHORT_MACHINE = "mip"; then - EXTN="mips" - EXTRA_DEPS="" - else - EXTN="i386" - fi - fi - fi -fi - -APP=n2n -DATE=`date -R` - -AC_SUBST(APP) -AC_SUBST(MACHINE) -AC_SUBST(N2N_VERSION_SHORT) -AC_SUBST(GIT_COMMITS) -AC_SUBST(EXTN) -AC_SUBST(DATE) - -AC_CONFIG_FILES(debian/changelog) -AC_CONFIG_FILES(debian/files) -AC_CONFIG_FILES(debian/control) -AC_CONFIG_FILES(debian/rules) -AC_CONFIG_FILES(../etc/systemd/system/edge.service) -AC_CONFIG_FILES(../etc/systemd/system/edge@.service) -AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service) -AC_CONFIG_FILES(../etc/systemd/system/supernode.service) -AC_CONFIG_FILES(Makefile) -AC_OUTPUT diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/COPYRIGHT b/bundles/n2n_ntop_v2/packages/debian/debian/COPYRIGHT deleted file mode 100644 index 94a9ed02..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/COPYRIGHT +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/README b/bundles/n2n_ntop_v2/packages/debian/debian/README deleted file mode 100644 index 8d88f8df..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains the files needed to build the package -named 'n2n' for the Debian GNU/Linux distribution. diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/changelog.in b/bundles/n2n_ntop_v2/packages/debian/debian/changelog.in deleted file mode 100644 index 6d4e3dc2..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/changelog.in +++ /dev/null @@ -1,4 +0,0 @@ -@APP@ (@N2N_VERSION_SHORT@-@GIT_COMMITS@) table; urgency=high - * Last packaged version - - -- Luca Deri @DATE@ diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/compat b/bundles/n2n_ntop_v2/packages/debian/debian/compat deleted file mode 100644 index ec635144..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/conffiles b/bundles/n2n_ntop_v2/packages/debian/debian/conffiles deleted file mode 100644 index d467c8b7..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/conffiles +++ /dev/null @@ -1,2 +0,0 @@ -/etc/n2n/edge.conf.sample -/etc/n2n/supernode.conf.sample diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/control.in b/bundles/n2n_ntop_v2/packages/debian/debian/control.in deleted file mode 100644 index 77e2fe92..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/control.in +++ /dev/null @@ -1,25 +0,0 @@ -Source: n2n -Section: net -Priority: extra -Maintainer: Luca Deri -Standards-Version: @N2N_VERSION_SHORT@ -Build-Depends: - -Package: n2n -Architecture: @EXTN@ -Suggests: uml-utilities -Depends: ${shlibs:Depends}, ${misc:Depends} -Conflicts: n2n (<< 2.1.0-1) -Replaces: n2n (<< 2.1.0-1) -Description: a layer-two peer-to-peer virtual private network (VPN) - n2n is a layer-two peer-to-peer virtual private network (VPN) which allows - users to exploit features typical of P2P applications at network instead of - application level. This means that users can gain native IP visibility (e.g. - two PCs belonging to the same n2n network can ping each other) and be - reachable with the same network IP address regardless of the network where - they currently belong. In a nutshell, as OpenVPN moved SSL from application - (e.g. used to implement the https protocol) to network protocol, n2n moves - P2P from application to network level. - . - Edge is the edge node daemon for n2n which creates a TAP interface to expose - the n2n virtual LAN. diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/dirs b/bundles/n2n_ntop_v2/packages/debian/debian/dirs deleted file mode 100644 index 8a9632d0..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/dirs +++ /dev/null @@ -1,3 +0,0 @@ -usr/sbin -etc/systemd -etc/init.d diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/docs b/bundles/n2n_ntop_v2/packages/debian/debian/docs deleted file mode 100644 index e845566c..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/docs +++ /dev/null @@ -1 +0,0 @@ -README diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/files.in b/bundles/n2n_ntop_v2/packages/debian/debian/files.in deleted file mode 100644 index 6128dce3..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/files.in +++ /dev/null @@ -1 +0,0 @@ -n2n_@N2N_VERSION_SHORT@_@EXTN@.deb free optional diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/n2n.debhelper.log b/bundles/n2n_ntop_v2/packages/debian/debian/n2n.debhelper.log deleted file mode 100644 index 439b7b43..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/n2n.debhelper.log +++ /dev/null @@ -1,13 +0,0 @@ -dh_installdirs -dh_installdirs -dh_installinit -dh_installdebconf -dh_installman -dh_strip -dh_compress -dh_fixperms -dh_installdeb -dh_link -dh_gencontrol -dh_md5sums -dh_builddeb diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/n2n.postrm.debhelper b/bundles/n2n_ntop_v2/packages/debian/debian/n2n.postrm.debhelper deleted file mode 100644 index 500916c2..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/n2n.postrm.debhelper +++ /dev/null @@ -1,6 +0,0 @@ -# Automatically added by dh_installdebconf/11.1.6ubuntu2 -if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then - . /usr/share/debconf/confmodule - db_purge -fi -# End automatically added section diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/n2n.substvars b/bundles/n2n_ntop_v2/packages/debian/debian/n2n.substvars deleted file mode 100644 index a5957235..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/n2n.substvars +++ /dev/null @@ -1,2 +0,0 @@ -misc:Depends=debconf (>= 0.5) | debconf-2.0 -misc:Pre-Depends= diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/postinst b/bundles/n2n_ntop_v2/packages/debian/debian/postinst deleted file mode 100644 index 5de13e21..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/postinst +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -e - -case "$1" in - configure) - # continue below - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - exit 0 - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 0 - ;; -esac - -umask 022 - -if ! grep -q n2n /etc/group; then - echo 'Creating n2n group' - /usr/sbin/groupadd -r n2n -fi - -if ! /usr/bin/id -u n2n > /dev/null 2>&1; then - echo "Creating n2n user..." - /usr/sbin/useradd -M -N -g n2n -r -s /bin/false n2n -fi - -echo "Rebuilding ld cache..." -/sbin/ldconfig - -if [ -f /.dockerenv ]; then exit 0; fi - -# Start service after upgrade/install -systemctl daemon-reload -systemctl reset-failed - -# Enable edge -if systemctl -q is-active edge; then - # only restart edge if it's already running - echo "Restarting n2n edge..." - deb-systemd-invoke restart edge -fi - -# Restart specific services if already running -deb-systemd-invoke restart 'edge@*.service' 'edge-ntopng@*.service' - -# Enable supernode -if systemctl -q is-active supernode; then - # only restart supernode if it's already running - echo "Restarting n2n supernode..." - deb-systemd-invoke restart supernode -fi - -exit 0 diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/postrm b/bundles/n2n_ntop_v2/packages/debian/debian/postrm deleted file mode 100644 index ef799a3a..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/postrm +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e - -set -e - -#case "$1" in -# purge|remove) -# -# ;; -#esac - -exit 0 diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/preinst b/bundles/n2n_ntop_v2/packages/debian/debian/preinst deleted file mode 100644 index 4e7a80dc..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/preinst +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh -# preinst script for n2n -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `install' -# * `install' -# * `upgrade' -# * `abort-upgrade' - -case "$1" in - install|upgrade) - ;; - - abort-upgrade) - ;; - - *) - echo "preinst called with unknown argument \`$1'" >&2 - exit 0 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - - -exit 0 diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/prerm b/bundles/n2n_ntop_v2/packages/debian/debian/prerm deleted file mode 100644 index 9e4e53d7..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/prerm +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -set -e - -if [ -f /.dockerenv ]; then exit 0; fi - -. /usr/share/debconf/confmodule - -if [ "$1" = "remove" ]; then - deb-systemd-invoke stop edge.service 'edge@*.service' 'edge-ntopng@*.service' - deb-systemd-invoke disable edge.service 'edge@*.service' 'edge-ntopng@*.service' - deb-systemd-invoke stop supernode.service - deb-systemd-invoke disable supernode.service - systemctl daemon-reload - systemctl reset-failed -fi - -exit 0 diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/rules.in b/bundles/n2n_ntop_v2/packages/debian/debian/rules.in deleted file mode 100644 index 8fcc3434..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/rules.in +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/make -f - -# Uncomment this to turn on verbose mode. -# export DH_VERBOSE=1 - -# -# debian/compat -# We should use at least compatibility version 5 -# but this requires the whole building process -# to be remade and this is something we leave -# to when we will have more time -# http://www.tin.org/bin/man.cgi?section=7&topic=debhelper -# - -package=@APP@ - -build: build-stamp -build-stamp: - dh_testdir - -clean: - dh_testdir - dh_testroot - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - dh_installinit - dh_installdebconf - dh_installman - dh_strip - dh_compress - dh_fixperms - dh_installdeb - cp -r n2n debian - cp -r ../etc debian/n2n - find debian/n2n -name "*.in" -exec /bin/rm {} ';' - find debian/n2n -name "*~" -exec /bin/rm {} ';' - dh_link - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff --git a/bundles/n2n_ntop_v2/packages/debian/debian/templates b/bundles/n2n_ntop_v2/packages/debian/debian/templates deleted file mode 100644 index 4f354077..00000000 --- a/bundles/n2n_ntop_v2/packages/debian/debian/templates +++ /dev/null @@ -1,7 +0,0 @@ -Template: n2n/license_expired_continue_installation -Type: boolean -Default: true -Description: Do you want to continue with the installation? - License found is not valid for the new package that is going to be installed. - . - Renew the maintenance to get a valid license for the new package or cancel the installation to continue using the current package. diff --git a/bundles/n2n_ntop_v2/packages/etc/n2n/edge.conf.sample b/bundles/n2n_ntop_v2/packages/etc/n2n/edge.conf.sample deleted file mode 100644 index 74d50a8f..00000000 --- a/bundles/n2n_ntop_v2/packages/etc/n2n/edge.conf.sample +++ /dev/null @@ -1,41 +0,0 @@ -# -# The configuration file is similar to the command line, with one option per line. An equal -# sign '=' should be used between key and value. Example: -c=mynetwork or --community=mynetwork -# This file contains a basic configuration example, please refer to the help (-h) for the full -# list of available options. -# -# -d|--tun-device -# Specifies the name of the TUN interface. -# --d=n2n0 -# -# -c|--community -# Specifies the n2n community name the edge belongs to. -# --c=mynetwork -# -# -k -# Sets the encryption key (ASCII). The environment variable N2N_KEY= can also be used. -# --k=mypassword -# -# -m -# Specified the MAC address for the TAP interface (random otherwise). -# -# -m=DE:AD:BE:EF:99:99 -# -# -a -# Sets the interface address. For DHCP use '-r -a dhcp:0.0.0.0'. -# --a=1.2.3.4 -# -# -p -# Sets the local UDP port to a fixed port. -# --p=50001 -# -# -l|--supernode-list -# Specifies the supernode IP and port. -# --l=7.8.9.0:7777 -# diff --git a/bundles/n2n_ntop_v2/packages/etc/n2n/supernode.conf.sample b/bundles/n2n_ntop_v2/packages/etc/n2n/supernode.conf.sample deleted file mode 100644 index 9ad22815..00000000 --- a/bundles/n2n_ntop_v2/packages/etc/n2n/supernode.conf.sample +++ /dev/null @@ -1,14 +0,0 @@ -# -# The configuration file is similar to the command line, with one option per line. An equal -# sign '=' should be used between key and value. Example: -l=7777 or --local-port=7777 -# This file contains a basic configuration example, please refer to the help (-h) for the full -# list of available options. -# -# -l|--local-port -# Sets the UDP listening port. -# -# -l=7777 -# -# Specify in supernodes.list the list of allowed communities -# -# -c=supernodes.list diff --git a/bundles/n2n_ntop_v2/packages/etc/systemd/system/edge-ntopng@.service.in b/bundles/n2n_ntop_v2/packages/etc/systemd/system/edge-ntopng@.service.in deleted file mode 100644 index 5299d227..00000000 --- a/bundles/n2n_ntop_v2/packages/etc/systemd/system/edge-ntopng@.service.in +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=n2n edge process, on %I -After=network-online.target syslog.target -Wants=network-online.target -BindsTo=ntopng.service - -[Service] -Type=simple -ExecStartPre= -ExecStart=/usr/sbin/edge /etc/n2n/edge-%i.conf -f -Restart=on-abnormal -RestartSec=5 - -[Install] -WantedBy=ntopng.service -Alias= diff --git a/bundles/n2n_ntop_v2/packages/etc/systemd/system/edge.service.in b/bundles/n2n_ntop_v2/packages/etc/systemd/system/edge.service.in deleted file mode 100644 index 32f0d79d..00000000 --- a/bundles/n2n_ntop_v2/packages/etc/systemd/system/edge.service.in +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=n2n edge process -After=network-online.target syslog.target nfw.target -Wants=network-online.target - -[Service] -Type=simple -ExecStartPre= -ExecStart=/usr/sbin/edge /etc/n2n/edge.conf -f -Restart=on-abnormal -RestartSec=5 - -[Install] -WantedBy=multi-user.target -Alias= diff --git a/bundles/n2n_ntop_v2/packages/etc/systemd/system/edge@.service.in b/bundles/n2n_ntop_v2/packages/etc/systemd/system/edge@.service.in deleted file mode 100644 index d9123452..00000000 --- a/bundles/n2n_ntop_v2/packages/etc/systemd/system/edge@.service.in +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=n2n edge process, on %I -After=network-online.target syslog.target nfw.target -Wants=network-online.target - -[Service] -Type=simple -ExecStartPre= -ExecStart=/usr/sbin/edge /etc/n2n/edge-%i.conf -f -Restart=on-abnormal -RestartSec=5 - -[Install] -WantedBy=multi-user.target -Alias= diff --git a/bundles/n2n_ntop_v2/packages/etc/systemd/system/supernode.service.in b/bundles/n2n_ntop_v2/packages/etc/systemd/system/supernode.service.in deleted file mode 100644 index 73e3d758..00000000 --- a/bundles/n2n_ntop_v2/packages/etc/systemd/system/supernode.service.in +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=n2n supernode process -After=network-online.target syslog.target -Wants=network-online.target - -[Service] -Type=simple -User=n2n -Group=n2n -ExecStart=/usr/sbin/supernode /etc/n2n/supernode.conf -f -Restart=on-abnormal -RestartSec=5 - -[Install] -WantedBy=multi-user.target -Alias= diff --git a/bundles/n2n_ntop_v2/packages/openwrt/README.md b/bundles/n2n_ntop_v2/packages/openwrt/README.md deleted file mode 100644 index 44b229fe..00000000 --- a/bundles/n2n_ntop_v2/packages/openwrt/README.md +++ /dev/null @@ -1,39 +0,0 @@ -## Prerequisites - -This instructions explain how to build an OpenWRT .ipk package for n2n. - -Before going on, it is required to have a working cross-compiling build -environment for the OpenWRT version installed into your device. This usually -comes down to the following steps: - -1. Download and extract the SDK toolchain for your device. The toolchain - must match the *exact* OpenWRT version installed in your device. Toolchain - for official OpenWRT images can be downloaded from https://downloads.openwrt.org - -2. Build the toolchain: run `make menuconfig`, save the configuration, then - run `make` to build the cross compiling tools - -3. Download the feeds with `./scripts/feeds update -a` - -## Compilation - -From the OpenWRT build directory: - -``` -git clone https://github.com/ntop/n2n n2n -cp -r n2n/packages/openwrt package/n2n -make menuconfig # select Network -> VPN -> n2n-edge and n2n-supernode -make package/n2n/compile V=s -``` - -If everything went fine, two ipk will be generated, one for the n2n-edge -and the other for n2n-supernode. They can be found with `find . -name "n2n*.ipk"`, -copied to the target device, and installed with `opkg install`. - -## Configuration - -The edge node can be started with `/etc/init.d/edge start`. -Its configuration file is `/etc/n2n/edge.conf`. - -The supernode can be started with `/etc/init.d/supernode start`. -Its configuration file is `/etc/n2n/supernode.conf`. diff --git a/bundles/n2n_ntop_v2/packages/rpm/Makefile.in b/bundles/n2n_ntop_v2/packages/rpm/Makefile.in deleted file mode 100644 index d7d677a2..00000000 --- a/bundles/n2n_ntop_v2/packages/rpm/Makefile.in +++ /dev/null @@ -1,26 +0,0 @@ -# -# Change it according to your setup -# -N2N_HOME=$(PWD)/../.. -N2N_BUILD=${N2N_HOME}/packages/debian/n2n -PLATFORM=@MACHINE@ -RPM_PKG=n2n-@N2N_VERSION_SHORT@-@GIT_COMMITS@.$(PLATFORM).rpm - -all: clean pkg - -pkg: - rpmbuild -bb ./n2n.spec - @@RPM_SIGN_CMD@ $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG) - @echo "" - @echo "Package contents:" - @rpm -qpl $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG) - @echo "The package is now available in $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG)" - -distclean: - echo "dummy distclean" - -install: - echo "dummy install" - -clean: - rm -rf *~ *rpm diff --git a/bundles/n2n_ntop_v2/packages/rpm/configure.in b/bundles/n2n_ntop_v2/packages/rpm/configure.in deleted file mode 100644 index cce9205b..00000000 --- a/bundles/n2n_ntop_v2/packages/rpm/configure.in +++ /dev/null @@ -1,58 +0,0 @@ -AC_INIT([Makefile.in], 1.0) - -# NOTE: this file is not actually used. You need to edit configure as well! -N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` -GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2` - -MACHINE=`uname -m` -SHORT_MACHINE=`uname -m | cut -b1-3` - -if test $MACHINE = "x86_64"; then - EXTN="amd64" -else - if test $SHORT_MACHINE = "aar"; then - EXTN="arm64" - EXTRA_DEPS="" - else - if test $SHORT_MACHINE = "arm"; then - EXTN="armhf" - EXTRA_DEPS="" - else - if test $SHORT_MACHINE = "mip"; then - EXTN="mips" - EXTRA_DEPS="" - else - EXTN="i386" - fi - fi - fi -fi - -APP=n2n -DATE=`date -R` - -CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 3|cut -d '.' -f 1` -if test $CENTOS_RELEASE = "release"; then - CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 4|cut -d '.' -f 1` -fi - -RPM_SIGN_CMD="rpm --addsign" -if test "$CENTOS_RELEASE" -ne 8; then - RPM_SIGN_CMD="./rpm-sign.exp" -fi - -AC_SUBST(APP) -AC_SUBST(MACHINE) -AC_SUBST(N2N_VERSION_SHORT) -AC_SUBST(GIT_COMMITS) -AC_SUBST(EXTN) -AC_SUBST(DATE) -AC_SUBST(RPM_SIGN_CMD) - -AC_CONFIG_FILES(n2n.spec) -AC_CONFIG_FILES(../etc/systemd/system/edge.service) -AC_CONFIG_FILES(../etc/systemd/system/edge@.service) -AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service) -AC_CONFIG_FILES(../etc/systemd/system/supernode.service) -AC_CONFIG_FILES(Makefile) -AC_OUTPUT diff --git a/bundles/n2n_ntop_v2/packages/rpm/n2n.spec.in b/bundles/n2n_ntop_v2/packages/rpm/n2n.spec.in deleted file mode 100644 index 301a205c..00000000 --- a/bundles/n2n_ntop_v2/packages/rpm/n2n.spec.in +++ /dev/null @@ -1,98 +0,0 @@ -Summary: n2n peer-to-peer VPN -Name: n2n -Version: @N2N_VERSION_SHORT@ -Release: @GIT_COMMITS@ -License: GPL -Group: Networking/Utilities -URL: http://www.ntop.org/ -Source: n2n-%{version}.tgz -Packager: Luca Deri -# Temporary location where the RPM will be built -BuildRoot: %{_tmppath}/%{name}-%{version}-root -#Requires: ntopng - -%description -n2n peer-to-peer VPN - -%prep - -%build - -mkdir -p $RPM_BUILD_ROOT/usr/sbin $RPM_BUILD_ROOT/usr/share/man/man1 $RPM_BUILD_ROOT/usr/share/man/man7 $RPM_BUILD_ROOT/usr/share/man/man8 -mkdir -p $RPM_BUILD_ROOT/etc/n2n -mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/ -cp $HOME/n2n/edge $RPM_BUILD_ROOT/usr/sbin -cp $HOME/n2n/supernode $RPM_BUILD_ROOT/usr/sbin -cp $HOME/n2n/n2n.7.gz $RPM_BUILD_ROOT/usr/share/man/man7 -cp $HOME/n2n/supernode.1.gz $RPM_BUILD_ROOT/usr/share/man/man1 -cp $HOME/n2n/edge.8.gz $RPM_BUILD_ROOT/usr/share/man/man8 -cp $HOME/n2n/packages/etc/systemd/system/*.service $RPM_BUILD_ROOT/usr/lib/systemd/system/ -cp $HOME/n2n/packages/etc/n2n/*.conf.sample $RPM_BUILD_ROOT/etc/n2n - -find $RPM_BUILD_ROOT -name ".git" | xargs /bin/rm -rf -find $RPM_BUILD_ROOT -name ".svn" | xargs /bin/rm -rf -find $RPM_BUILD_ROOT -name "*~" | xargs /bin/rm -f -# -DST=$RPM_BUILD_ROOT/usr/n2n -SRC=$RPM_BUILD_DIR/%{name}-%{version} -#mkdir -p $DST/conf -# Clean out our build directory -%clean -rm -fr $RPM_BUILD_ROOT - -%files -/usr/sbin/edge -/usr/sbin/supernode -/usr/share/man/man7/n2n.7.gz -/usr/share/man/man1/supernode.1.gz -/usr/share/man/man8/edge.8.gz -/usr/lib/systemd/system/edge.service -/usr/lib/systemd/system/edge@.service -/usr/lib/systemd/system/edge-ntopng@.service -/usr/lib/systemd/system/supernode.service -%config(noreplace) /etc/n2n/supernode.conf.sample -%config(noreplace) /etc/n2n/edge.conf.sample - -# Set the default attributes of all of the files specified to have an -# owner and group of root and to inherit the permissions of the file -# itself. -%defattr(-, root, root) - -%changelog -* Fri Aug 17 2018 Luca Deri 1.0 -- Current package version - -# Execution order: -# install: pre -> (copy) -> post -# upgrade: pre -> (copy) -> post -> preun (old) -> (delete old) -> postun (old) -# un-install: preun -> (delete) -> postun - -%pre - -if ! grep -q n2n /etc/group; then - echo 'Creating n2n group' - /usr/sbin/groupadd -r n2n -fi - -if ! /usr/bin/id -u n2n > /dev/null 2>&1; then - echo 'Creating n2n user' - /usr/sbin/useradd -M -N -g n2n -r -s /bin/false n2n -fi - -%post -if [ ! -f /.dockerenv ]; then - /bin/systemctl daemon-reload - # NOTE: do not enable any services during first installation -fi - -%preun -if [ ! -f /.dockerenv ]; then - # possibly remove the installed services - %systemd_preun supernode.service edge.service 'edge-ntopng@*.service' 'edge@*.service' -fi - -%postun -if [ ! -f /.dockerenv ]; then - # possibly restart the running services - %systemd_postun_with_restart supernode.service edge.service 'edge-ntopng@*.service' 'edge@*.service' -fi diff --git a/bundles/n2n_ntop_v2/packages/rpm/rpm-sign.exp b/bundles/n2n_ntop_v2/packages/rpm/rpm-sign.exp deleted file mode 100644 index 7a0f88af..00000000 --- a/bundles/n2n_ntop_v2/packages/rpm/rpm-sign.exp +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/expect -f - -### rpm-sign.exp -- Sign RPMs by sending the passphrase. - -spawn rpm --addsign {*}$argv - expect -exact "Enter pass phrase: " - send -- "\r" - expect eof - -## end of rpm-sign.exp diff --git a/bundles/n2n_ntop_v2/packages/ubuntu b/bundles/n2n_ntop_v2/packages/ubuntu deleted file mode 100644 index b2f7fd3e..00000000 --- a/bundles/n2n_ntop_v2/packages/ubuntu +++ /dev/null @@ -1 +0,0 @@ -debian \ No newline at end of file diff --git a/bundles/n2n_ntop_v2/src/edge.c b/bundles/n2n_ntop_v2/src/edge.c deleted file mode 100644 index 5681df84..00000000 --- a/bundles/n2n_ntop_v2/src/edge.c +++ /dev/null @@ -1,972 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -/* *************************************************** */ - -/** maximum length of command line arguments */ -#define MAX_CMDLINE_BUFFER_LENGTH 4096 - -/** maximum length of a line in the configuration file */ -#define MAX_CONFFILE_LINE_LENGTH 1024 - -/* ***************************************************** */ - -#ifdef HAVE_LIBCAP - -#include -#include - -static cap_value_t cap_values[] = { - //CAP_NET_RAW, /* Use RAW and PACKET sockets */ - CAP_NET_ADMIN /* Needed to performs routes cleanup at exit */ -}; - -int num_cap = sizeof(cap_values)/sizeof(cap_value_t); -#endif - -/* ***************************************************** */ - -/** Find the address and IP mode for the tuntap device. - * - * s is one of these forms: - * - * := | A.B.C.D - * - * | static: | dhcp: - * - * If the mode is present (colon required) then fill ip_mode with that value - * otherwise do not change ip_mode. Fill ip_mode with everything after the - * colon if it is present; or s if colon is not present. - * - * ip_add and ip_mode are NULL terminated if modified. - * - * return 0 on success and -1 on error - */ -static int scan_address(char * ip_addr, size_t addr_size, - char * ip_mode, size_t mode_size, - const char * s) { - int retval = -1; - char * p; - - if((NULL == s) || (NULL == ip_addr)) - { - return -1; - } - - memset(ip_addr, 0, addr_size); - - p = strpbrk(s, ":"); - - if(p) - { - /* colon is present */ - if(ip_mode) - { - size_t end=0; - - memset(ip_mode, 0, mode_size); - end = MIN(p-s, (ssize_t)(mode_size-1)); /* ensure NULL term */ - strncpy(ip_mode, s, end); - strncpy(ip_addr, p+1, addr_size-1); /* ensure NULL term */ - retval = 0; - } - } - else - { - /* colon is not present */ - strncpy(ip_addr, s, addr_size-1); - ip_addr[addr_size-1] = '\0'; - } - - return retval; -} - -/* *************************************************** */ - -static void help() { - print_n2n_version(); - - printf("edge (see edge.conf)\n" - "or\n" - ); - printf("edge " -#if defined(N2N_CAN_NAME_IFACE) - "-d " -#endif /* #if defined(N2N_CAN_NAME_IFACE) */ - "-a [static:|dhcp:] " - "-c " - "[-k ]\n" - " " - "[-s ] " -#ifndef WIN32 - "[-u -g ]" -#endif /* #ifndef WIN32 */ - -#ifndef WIN32 - "[-f]" -#endif /* #ifndef WIN32 */ -#ifdef __linux__ - "[-T ]" -#endif - "[-n cidr:gateway] " - "[-m ] " - "-l \n" - " " - "[-p ] [-M ] " -#ifndef __APPLE__ - "[-D] " -#endif - "[-r] [-E] [-v] [-i ] [-L ] [-t ] [-A[]] [-H] [-z[]] [-h]\n\n"); - -#if defined(N2N_CAN_NAME_IFACE) - printf("-d | tun device name\n"); -#endif - - printf("-a | Set interface address. For DHCP use '-r -a dhcp:0.0.0.0'\n"); - printf("-c | n2n community name the edge belongs to.\n"); - printf("-k | Encryption key (ASCII) - also N2N_KEY=.\n"); - printf("-s | Edge interface netmask in dotted decimal notation (255.255.255.0).\n"); - printf("-l | Supernode IP:port\n"); - printf("-i | Registration interval, for NAT hole punching (default 20 seconds)\n"); - printf("-L | TTL for registration packet when UDP NAT hole punching through supernode (default 0 for not set )\n"); - printf("-p | Fixed local UDP port.\n"); -#ifndef WIN32 - printf("-u | User ID (numeric) to use when privileges are dropped.\n"); - printf("-g | Group ID (numeric) to use when privileges are dropped.\n"); -#endif /* ifndef WIN32 */ -#ifndef WIN32 - printf("-f | Do not fork and run as a daemon; rather run in foreground.\n"); -#endif /* #ifndef WIN32 */ - printf("-m | Fix MAC address for the TAP interface (otherwise it may be random)\n" - " | eg. -m 01:02:03:04:05:06\n"); - printf("-M | Specify n2n MTU of edge interface (default %d).\n", DEFAULT_MTU); -#ifndef __APPLE__ - printf("-D | Enable PMTU discovery. PMTU discovery can reduce fragmentation but\n" - " | causes connections stall when not properly supported.\n"); -#endif - printf("-r | Enable packet forwarding through n2n community.\n"); - printf("-A1 | Disable payload encryption. Do not use with key (defaulting to Twofish then).\n"); - printf("-A2 ... -A5 or -A | Choose a cipher for payload encryption, requires a key: -A2 = Twofish (default),\n"); - printf(" | " -#ifdef N2N_HAVE_AES - "-A3 or -A (deprecated) = AES-CBC, " -#endif -#ifdef HAVE_OPENSSL_1_1 - "-A4 = ChaCha20, " -#endif - "-A5 = Speck-CTR.\n"); - printf("-H | Enable full header encryption. Requires supernode with fixed community.\n"); - printf("-z1 ... -z2 or -z | Enable compression for outgoing data packets: -z1 or -z = lzo1x" -#ifdef N2N_HAVE_ZSTD - ", -z2 = zstd" -#endif - " (default=disabled).\n"); - printf("-E | Accept multicast MAC addresses (default=drop).\n"); - printf("-S | Do not connect P2P. Always use the supernode.\n"); -#ifdef __linux__ - printf("-T | TOS for packets (e.g. 0x48 for SSH like priority)\n"); -#endif - printf("-n | Route an IPv4 network via the gw. Use 0.0.0.0/0 for the default gw. Can be set multiple times.\n"); - printf("-v | Make more verbose. Repeat as required.\n"); - printf("-t | Management UDP Port (for multiple edges on a machine).\n"); - - printf("\nEnvironment variables:\n"); - printf(" N2N_KEY | Encryption key (ASCII). Not with -k.\n"); - -#ifdef WIN32 - printf("\nAvailable TAP adapters:\n"); - win_print_available_adapters(); -#endif - - exit(0); -} - -/* *************************************************** */ - -static void setPayloadCompression(n2n_edge_conf_t *conf, int compression) { - /* even though 'compression' and 'conf->compression' share the same encoding scheme, - * a switch-statement under conditional compilation is used to sort out the - * unsupported optarguments */ - switch (compression) { - case 1: - { - conf->compression = N2N_COMPRESSION_ID_LZO; - break; - } -#ifdef N2N_HAVE_ZSTD - case 2: - { - conf->compression = N2N_COMPRESSION_ID_ZSTD; - break; - } -#endif - default: - { - conf->compression = N2N_COMPRESSION_ID_NONE; - traceEvent(TRACE_NORMAL, "the %s compression given by -z_ option is not supported in this version.", compression_str(compression)); - exit(1); // to make the user aware - } - } -} - -/* *************************************************** */ - -static void setPayloadEncryption( n2n_edge_conf_t *conf, int cipher) { - /* even though 'cipher' and 'conf->transop_id' share the same encoding scheme, - * a switch-statement under conditional compilation is used to sort out the - * unsupported ciphers */ - switch (cipher) { - case 1: - { - conf->transop_id = N2N_TRANSFORM_ID_NULL; - break; - } - case 2: - { - conf->transop_id = N2N_TRANSFORM_ID_TWOFISH; - break; - } -#ifdef N2N_HAVE_AES - case 3: - { - conf->transop_id = N2N_TRANSFORM_ID_AESCBC; - break; - } -#endif -#ifdef HAVE_OPENSSL_1_1 - case 4: - { - conf->transop_id = N2N_TRANSFORM_ID_CHACHA20; - break; - } -#endif - case 5: - { - conf->transop_id = N2N_TRANSFORM_ID_SPECK; - break; - } - default: - { - conf->transop_id = N2N_TRANSFORM_ID_INVAL; - traceEvent(TRACE_NORMAL, "the %s cipher given by -A_ option is not supported in this version.", transop_str(cipher)); - exit(1); - } - } -} - -/* *************************************************** */ - -static int setOption(int optkey, char *optargument, n2n_tuntap_priv_config_t *ec, n2n_edge_conf_t *conf) { - /* traceEvent(TRACE_NORMAL, "Option %c = %s", optkey, optargument ? optargument : ""); */ - - switch(optkey) { - case 'a': /* IP address and mode of TUNTAP interface */ - { - scan_address(ec->ip_addr, N2N_NETMASK_STR_SIZE, - ec->ip_mode, N2N_IF_MODE_SIZE, - optargument); - break; - } - - case 'c': /* community as a string */ - { - memset(conf->community_name, 0, N2N_COMMUNITY_SIZE); - strncpy((char *)conf->community_name, optargument, N2N_COMMUNITY_SIZE); - conf->community_name[N2N_COMMUNITY_SIZE-1] = '\0'; - break; - } - - case 'E': /* multicast ethernet addresses accepted. */ - { - conf->drop_multicast=0; - traceEvent(TRACE_DEBUG, "Enabling ethernet multicast traffic"); - break; - } - -#ifndef WIN32 - case 'u': /* unprivileged uid */ - { - ec->userid = atoi(optargument); - break; - } - - case 'g': /* unprivileged uid */ - { - ec->groupid = atoi(optargument); - break; - } -#endif - -#ifndef WIN32 - case 'f' : /* do not fork as daemon */ - { - ec->daemon=0; - break; - } -#endif /* #ifndef WIN32 */ - - case 'm' : /* TUNTAP MAC address */ - { - strncpy(ec->device_mac,optargument,N2N_MACNAMSIZ); - ec->device_mac[N2N_MACNAMSIZ-1] = '\0'; - break; - } - - case 'M' : /* TUNTAP MTU */ - { - ec->mtu = atoi(optargument); - break; - } - -#ifndef __APPLE__ - case 'D' : /* enable PMTU discovery */ - { - conf->disable_pmtu_discovery = 0; - break; - } -#endif - - case 'k': /* encrypt key */ - { - if(conf->encrypt_key) free(conf->encrypt_key); - conf->encrypt_key = strdup(optargument); - traceEvent(TRACE_DEBUG, "encrypt_key = '%s'\n", conf->encrypt_key); - break; - } - - case 'r': /* enable packet routing across n2n endpoints */ - { - conf->allow_routing = 1; - break; - } - - case 'A': - { - int cipher; - - if (optargument) { - cipher = atoi(optargument); - } else { - traceEvent(TRACE_NORMAL, "the use of the solitary -A switch is deprecated and might not be supported in future versions. " - "please use -A3 instead to choose a the AES-CBC cipher for payload encryption."); - - cipher = N2N_TRANSFORM_ID_AESCBC; // default, if '-A' only - } - - setPayloadEncryption(conf, cipher); - break; - } - - case 'H': /* indicate header encryption */ - { - /* we cannot be sure if this gets parsed before the community name is set. - * so, only an indicator is set, action is taken later*/ - conf->header_encryption = HEADER_ENCRYPTION_ENABLED; - break; - } - - case 'z': - { - int compression; - - if (optargument) { - compression = atoi(optargument); - } else - compression = N2N_COMPRESSION_ID_LZO; // default, if '-z' only - - setPayloadCompression(conf, compression); - break; - } - - case 'l': /* supernode-list */ - if(optargument) { - if(edge_conf_add_supernode(conf, optargument) != 0) { - traceEvent(TRACE_WARNING, "Too many supernodes!"); - exit(1); - } - break; - } - - case 'i': /* supernode registration interval */ - conf->register_interval = atoi(optargument); - break; - - case 'L': /* supernode registration interval */ - conf->register_ttl = atoi(optarg); - break; - -#if defined(N2N_CAN_NAME_IFACE) - case 'd': /* TUNTAP name */ - { - strncpy(ec->tuntap_dev_name, optargument, N2N_IFNAMSIZ); - ec->tuntap_dev_name[N2N_IFNAMSIZ-1] = '\0'; - break; - } -#endif - - case 'p': - { - conf->local_port = atoi(optargument); - break; - } - - case 't': - { - conf->mgmt_port = atoi(optargument); - break; - } - -#ifdef __linux__ - case 'T': - { - if((optargument[0] == '0') && (optargument[1] == 'x')) - conf->tos = strtol(&optargument[2], NULL, 16); - else - conf->tos = atoi(optargument); - - break; - } -#endif - - case 'n': - { - char cidr_net[64], gateway[64]; - n2n_route_t route; - - if(sscanf(optargument, "%63[^/]/%d:%63s", cidr_net, &route.net_bitlen, gateway) != 3) { - traceEvent(TRACE_WARNING, "Bad cidr/gateway format '%d'. See -h.", optargument); - break; - } - - route.net_addr = inet_addr(cidr_net); - route.gateway = inet_addr(gateway); - - if((route.net_bitlen < 0) || (route.net_bitlen > 32)) { - traceEvent(TRACE_WARNING, "Bad prefix '%d' in '%s'", route.net_bitlen, optargument); - break; - } - - if(route.net_addr == INADDR_NONE) { - traceEvent(TRACE_WARNING, "Bad network '%s' in '%s'", cidr_net, optargument); - break; - } - - if(route.gateway == INADDR_NONE) { - traceEvent(TRACE_WARNING, "Bad gateway '%s' in '%s'", gateway, optargument); - break; - } - - traceEvent(TRACE_DEBUG, "Adding %s/%d via %s", cidr_net, route.net_bitlen, gateway); - - conf->routes = realloc(conf->routes, sizeof(struct n2n_route) * (conf->num_routes + 1)); - conf->routes[conf->num_routes] = route; - conf->num_routes++; - - break; - } - - case 's': /* Subnet Mask */ - { - if(0 != ec->got_s) { - traceEvent(TRACE_WARNING, "Multiple subnet masks supplied"); - } - strncpy(ec->netmask, optargument, N2N_NETMASK_STR_SIZE); - ec->netmask[N2N_NETMASK_STR_SIZE - 1] = '\0'; - ec->got_s = 1; - break; - } - - case 'S': - { - conf->allow_p2p = 0; - break; - } - - case 'h': /* help */ - { - help(); - break; - } - - case 'v': /* verbose */ - setTraceLevel(getTraceLevel() + 1); - break; - - default: - { - traceEvent(TRACE_WARNING, "Unknown option -%c: Ignored", (char)optkey); - return(-1); - } - } - - return(0); -} - -/* *********************************************** */ - -static const struct option long_options[] = - { - { "community", required_argument, NULL, 'c' }, - { "supernode-list", required_argument, NULL, 'l' }, - { "tun-device", required_argument, NULL, 'd' }, - { "euid", required_argument, NULL, 'u' }, - { "egid", required_argument, NULL, 'g' }, - { "help" , no_argument, NULL, 'h' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, 0, NULL, 0 } -}; - -/* *************************************************** */ - -/* read command line options */ -static int loadFromCLI(int argc, char *argv[], n2n_edge_conf_t *conf, n2n_tuntap_priv_config_t *ec) { - u_char c; - - while ((c = getopt_long(argc, argv, - "k:a:bc:Eu:g:m:M:s:d:l:p:fvhrt:i:SDL:z::A::Hn:" -#ifdef __linux__ - "T:" -#endif - , - long_options, NULL)) != '?') { - if(c == 255) break; - setOption(c, optarg, ec, conf); - } - - return 0; -} - -/* *************************************************** */ - -static char *trim(char *s) { - char *end; - - while(isspace(s[0]) || (s[0] == '"') || (s[0] == '\'')) s++; - if(s[0] == 0) return s; - - end = &s[strlen(s) - 1]; - while(end > s - && (isspace(end[0])|| (end[0] == '"') || (end[0] == '\''))) - end--; - end[1] = 0; - - return s; -} - -/* *************************************************** */ - -/* parse the configuration file */ -static int loadFromFile(const char *path, n2n_edge_conf_t *conf, n2n_tuntap_priv_config_t *ec) { - char buffer[4096], *line, *key, *value; - u_int line_len, opt_name_len; - FILE *fd; - const struct option *opt; - - fd = fopen(path, "r"); - - if(fd == NULL) { - traceEvent(TRACE_WARNING, "Config file %s not found", path); - return -1; - } - - while((line = fgets(buffer, sizeof(buffer), fd)) != NULL) { - line = trim(line); - value = NULL; - - if((line_len = strlen(line)) < 2 || line[0] == '#') - continue; - - if(!strncmp(line, "--", 2)) { /* long opt */ - key = &line[2], line_len -= 2; - - opt = long_options; - while(opt->name != NULL) { - opt_name_len = strlen(opt->name); - - if(!strncmp(key, opt->name, opt_name_len) - && (line_len <= opt_name_len - || key[opt_name_len] == '\0' - || key[opt_name_len] == ' ' - || key[opt_name_len] == '=')) { - if(line_len > opt_name_len) key[opt_name_len] = '\0'; - if(line_len > opt_name_len + 1) value = trim(&key[opt_name_len + 1]); - - // traceEvent(TRACE_NORMAL, "long key: %s value: %s", key, value); - setOption(opt->val, value, ec, conf); - break; - } - - opt++; - } - } else if(line[0] == '-') { /* short opt */ - char *equal; - - key = &line[1], line_len--; - - equal = strchr(line, '='); - - if(equal) { - equal[0] = '\0'; - - value = &equal[1]; - - } else { - - value = NULL; - - /* Adding an exception for -A_ -z_ which can come - without '=' and even without any further data */ - - if (key[0] == 'z') { - if (key[1]) value = &key[1]; - key = "z"; - } else if (key[0] == 'A') { - if (key[1]) value = &key[1]; - key = "A"; - } - } - // traceEvent(TRACE_NORMAL, "key: %c value: %s", key[0], value); - setOption(key[0], value, ec, conf); - } else { - traceEvent(TRACE_WARNING, "Skipping unrecognized line: %s", line); - continue; - } - } - - fclose(fd); - - return 0; -} - -/* ************************************** */ - -#if defined(DUMMY_ID_00001) /* Disabled waiting for config option to enable it */ - -static char gratuitous_arp[] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* Dest mac */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Src mac */ - 0x08, 0x06, /* ARP */ - 0x00, 0x01, /* Ethernet */ - 0x08, 0x00, /* IP */ - 0x06, /* Hw Size */ - 0x04, /* Protocol Size */ - 0x00, 0x01, /* ARP Request */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Src mac */ - 0x00, 0x00, 0x00, 0x00, /* Src IP */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Target mac */ - 0x00, 0x00, 0x00, 0x00 /* Target IP */ -}; - -/* ************************************** */ - -/** Build a gratuitous ARP packet for a /24 layer 3 (IP) network. */ -static int build_gratuitous_arp(char *buffer, uint16_t buffer_len) { - if(buffer_len < sizeof(gratuitous_arp)) return(-1); - - memcpy(buffer, gratuitous_arp, sizeof(gratuitous_arp)); - memcpy(&buffer[6], device.mac_addr, 6); - memcpy(&buffer[22], device.mac_addr, 6); - memcpy(&buffer[28], &device.ip_addr, 4); - - /* REVISIT: BbMaj7 - use a real netmask here. This is valid only by accident - * for /24 IPv4 networks. */ - buffer[31] = 0xFF; /* Use a faked broadcast address */ - memcpy(&buffer[38], &device.ip_addr, 4); - return(sizeof(gratuitous_arp)); -} - -/* ************************************** */ - -/** Called from update_supernode_reg to periodically send gratuitous ARP - * broadcasts. */ -static void send_grat_arps(n2n_edge_t * eee,) { - char buffer[48]; - size_t len; - - traceEvent(TRACE_NORMAL, "Sending gratuitous ARP..."); - len = build_gratuitous_arp(buffer, sizeof(buffer)); - send_packet2net(eee, buffer, len); - send_packet2net(eee, buffer, len); /* Two is better than one :-) */ -} - -#endif /* #if defined(DUMMY_ID_00001) */ - -/* ************************************** */ - -static void daemonize() { -#ifndef WIN32 - int childpid; - - traceEvent(TRACE_NORMAL, "Parent process is exiting (this is normal)"); - - signal(SIGPIPE, SIG_IGN); - signal(SIGHUP, SIG_IGN); - signal(SIGCHLD, SIG_IGN); - signal(SIGQUIT, SIG_IGN); - - if((childpid = fork()) < 0) - traceEvent(TRACE_ERROR, "Occurred while daemonizing (errno=%d)", - errno); - else { - if(!childpid) { /* child */ - int rc; - - //traceEvent(TRACE_NORMAL, "Bye bye: I'm becoming a daemon..."); - rc = chdir("/"); - if(rc != 0) - traceEvent(TRACE_ERROR, "Error while moving to / directory"); - - setsid(); /* detach from the terminal */ - - fclose(stdin); - fclose(stdout); - /* fclose(stderr); */ - - /* - * clear any inherited file mode creation mask - */ - //umask(0); - - /* - * Use line buffered stdout - */ - /* setlinebuf (stdout); */ - setvbuf(stdout, (char *)NULL, _IOLBF, 0); - } else /* father */ - exit(0); - } -#endif -} - -/* *************************************************** */ - -static int keep_on_running; - -#if defined(__linux__) || defined(WIN32) -#ifdef WIN32 -BOOL WINAPI term_handler(DWORD sig) -#else - static void term_handler(int sig) -#endif -{ - static int called = 0; - - if(called) { - traceEvent(TRACE_NORMAL, "Ok I am leaving now"); - _exit(0); - } else { - traceEvent(TRACE_NORMAL, "Shutting down..."); - called = 1; - } - - keep_on_running = 0; -#ifdef WIN32 - return(TRUE); -#endif -} -#endif /* defined(__linux__) || defined(WIN32) */ - -/* *************************************************** */ - -/** Entry point to program from kernel. */ -int main(int argc, char* argv[]) { - int rc; - tuntap_dev tuntap; /* a tuntap device */ - n2n_edge_t *eee; /* single instance for this program */ - n2n_edge_conf_t conf; /* generic N2N edge config */ - n2n_tuntap_priv_config_t ec; /* config used for standalone program execution */ -#ifndef WIN32 - struct passwd *pw = NULL; -#endif -#ifdef HAVE_LIBCAP - cap_t caps; -#endif - - /* Defaults */ - edge_init_conf_defaults(&conf); - memset(&ec, 0, sizeof(ec)); - ec.mtu = DEFAULT_MTU; - ec.daemon = 1; /* By default run in daemon mode. */ - -#ifndef WIN32 - if(((pw = getpwnam("n2n")) != NULL) || - ((pw = getpwnam("nobody")) != NULL)) { - ec.userid = pw->pw_uid; - ec.groupid = pw->pw_gid; - } -#endif - -#ifdef WIN32 - ec.tuntap_dev_name[0] = '\0'; -#else - snprintf(ec.tuntap_dev_name, sizeof(ec.tuntap_dev_name), "edge0"); -#endif - snprintf(ec.ip_mode, sizeof(ec.ip_mode), "static"); - snprintf(ec.netmask, sizeof(ec.netmask), "255.255.255.0"); - - if((argc >= 2) && (argv[1][0] != '-')) { - rc = loadFromFile(argv[1], &conf, &ec); - if(argc > 2) - rc = loadFromCLI(argc, argv, &conf, &ec); - } else if(argc > 1) - rc = loadFromCLI(argc, argv, &conf, &ec); - else -#ifdef WIN32 - /* Load from current directory */ - rc = loadFromFile("edge.conf", &conf, &ec); -#else - rc = -1; -#endif - - if(conf.transop_id == N2N_TRANSFORM_ID_NULL) { - if(conf.encrypt_key) { - /* make sure that Twofish is default cipher if key only (and no cipher) is specified */ - traceEvent(TRACE_WARNING, "Switching to Twofish as key was provided."); - conf.transop_id = N2N_TRANSFORM_ID_TWOFISH; - } - } - - if(rc < 0) - help(); - - if(edge_verify_conf(&conf) != 0) - help(); - - traceEvent(TRACE_NORMAL, "Starting n2n edge %s %s", PACKAGE_VERSION, PACKAGE_BUILDDATE); - -#if defined(HAVE_OPENSSL_1_1) - traceEvent(TRACE_NORMAL, "Using %s", OpenSSL_version(0)); -#endif - - traceEvent(TRACE_NORMAL, "Using compression: %s.", compression_str(conf.compression)); - traceEvent(TRACE_NORMAL, "Using %s cipher.", transop_str(conf.transop_id)); - - /* Random seed */ - n2n_srand (n2n_seed()); - - if(0 == strcmp("dhcp", ec.ip_mode)) { - traceEvent(TRACE_NORMAL, "Dynamic IP address assignment enabled."); - - conf.dyn_ip_mode = 1; - } else - traceEvent(TRACE_NORMAL, "ip_mode='%s'", ec.ip_mode); - - if(!( -#ifdef __linux__ - (ec.tuntap_dev_name[0] != 0) && -#endif - (ec.ip_addr[0] != 0) - )) - help(); - -#ifndef WIN32 - /* If running suid root then we need to setuid before using the force. */ - if(setuid(0) != 0) - traceEvent(TRACE_ERROR, "Unable to become root [%u/%s]", errno, strerror(errno)); - /* setgid(0); */ -#endif - - if(conf.encrypt_key && !strcmp((char*)conf.community_name, conf.encrypt_key)) - traceEvent(TRACE_WARNING, "Community and encryption key must differ, otherwise security will be compromised"); - - if(tuntap_open(&tuntap, ec.tuntap_dev_name, ec.ip_mode, ec.ip_addr, ec.netmask, ec.device_mac, ec.mtu) < 0) - exit(1); - - if((eee = edge_init(&tuntap, &conf, &rc)) == NULL) { - traceEvent(TRACE_ERROR, "Failed in edge_init"); - exit(1); - } - memcpy(&(eee->tuntap_priv_conf), &ec, sizeof(ec)); - -#ifndef WIN32 - if(ec.daemon) { - setUseSyslog(1); /* traceEvent output now goes to syslog. */ - daemonize(); - } -#endif /* #ifndef WIN32 */ - -#ifndef WIN32 - -#ifdef HAVE_LIBCAP - /* Before dropping the privileges, retain capabilities to regain them in future. */ - caps = cap_get_proc(); - - cap_set_flag(caps, CAP_PERMITTED, num_cap, cap_values, CAP_SET); - cap_set_flag(caps, CAP_EFFECTIVE, num_cap, cap_values, CAP_SET); - - if((cap_set_proc(caps) != 0) || (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0)) - traceEvent(TRACE_WARNING, "Unable to retain permitted capabilities [%s]\n", strerror(errno)); -#else -#ifndef __APPLE__ - traceEvent(TRACE_WARNING, "n2n has not been compiled with libcap-dev. Some commands may fail."); -#endif -#endif /* HAVE_LIBCAP */ - - if((ec.userid != 0) || (ec.groupid != 0)) { - traceEvent(TRACE_NORMAL, "Dropping privileges to uid=%d, gid=%d", - (signed int)ec.userid, (signed int)ec.groupid); - - /* Finished with the need for root privileges. Drop to unprivileged user. */ - if((setgid(ec.groupid) != 0) - || (setuid(ec.userid) != 0)) { - traceEvent(TRACE_ERROR, "Unable to drop privileges [%u/%s]", errno, strerror(errno)); - exit(1); - } - } - - if((getuid() == 0) || (getgid() == 0)) - traceEvent(TRACE_WARNING, "Running as root is discouraged, check out the -u/-g options"); -#endif - -#ifdef __linux__ - signal(SIGTERM, term_handler); - signal(SIGINT, term_handler); -#endif -#ifdef WIN32 - SetConsoleCtrlHandler(term_handler, TRUE); -#endif - - keep_on_running = 1; - traceEvent(TRACE_NORMAL, "edge started"); - rc = run_edge_loop(eee, &keep_on_running); - print_edge_stats(eee); - -#ifdef HAVE_LIBCAP - /* Before completing the cleanup, regain the capabilities as some - * cleanup tasks require them (e.g. routes cleanup). */ - cap_set_flag(caps, CAP_EFFECTIVE, num_cap, cap_values, CAP_SET); - - if(cap_set_proc(caps) != 0) - traceEvent(TRACE_WARNING, "Could not regain the capabilities [%s]\n", strerror(errno)); - - cap_free(caps); -#endif - - /* Cleanup */ - edge_term(eee); - edge_term_conf(&conf); - tuntap_close(&tuntap); - - if(conf.encrypt_key) free(conf.encrypt_key); - - return(rc); -} - -/* ************************************** */ diff --git a/bundles/n2n_ntop_v2/src/edge_utils.c b/bundles/n2n_ntop_v2/src/edge_utils.c deleted file mode 100644 index 9dd59356..00000000 --- a/bundles/n2n_ntop_v2/src/edge_utils.c +++ /dev/null @@ -1,2626 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "edge_utils_win32.h" - -/* heap allocation for compression as per lzo example doc */ -#define HEAP_ALLOC(var,size) lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ] -static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS); - -/* ************************************** */ - -static const char * supernode_ip(const n2n_edge_t * eee); -static void send_register(n2n_edge_t *eee, const n2n_sock_t *remote_peer, const n2n_mac_t peer_mac); -static void check_peer_registration_needed(n2n_edge_t * eee, - uint8_t from_supernode, - const n2n_mac_t mac, - const n2n_sock_t * peer); -static int edge_init_sockets(n2n_edge_t *eee, int udp_local_port, int mgmt_port, uint8_t tos); -static int edge_init_routes(n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_routes); -static void edge_cleanup_routes(n2n_edge_t *eee); -static int supernode2addr(n2n_sock_t * sn, const n2n_sn_name_t addrIn); -static void check_known_peer_sock_change(n2n_edge_t * eee, - uint8_t from_supernode, - const n2n_mac_t mac, - const n2n_sock_t * peer, - time_t when); - -/* ************************************** */ - -int edge_verify_conf(const n2n_edge_conf_t *conf) { - if(conf->community_name[0] == 0) - return(-1); - - if(conf->sn_num == 0) - return(-2); - - if(conf->register_interval < 1) - return(-3); - - if(((conf->encrypt_key == NULL) && (conf->transop_id != N2N_TRANSFORM_ID_NULL)) || - ((conf->encrypt_key != NULL) && (conf->transop_id == N2N_TRANSFORM_ID_NULL))) - return(-4); - - return(0); -} - - -/* ************************************** */ - -void edge_set_callbacks(n2n_edge_t *eee, const n2n_edge_callbacks_t *callbacks) { - memcpy(&eee->cb, callbacks, sizeof(n2n_edge_callbacks_t)); -} - -/* ************************************** */ - -void edge_set_userdata(n2n_edge_t *eee, void *user_data) { - eee->user_data = user_data; -} - -/* ************************************** */ - -void* edge_get_userdata(n2n_edge_t *eee) { - return(eee->user_data); -} - -/* ************************************** */ - -int edge_get_n2n_socket(n2n_edge_t *eee) { - return(eee->udp_sock); -} - -/* ************************************** */ - -int edge_get_management_socket(n2n_edge_t *eee) { - return(eee->udp_mgmt_sock); -} - -/* ************************************** */ - -const char* transop_str(enum n2n_transform tr) { - switch(tr) { - case N2N_TRANSFORM_ID_NULL: return("null"); - case N2N_TRANSFORM_ID_TWOFISH: return("twofish"); - case N2N_TRANSFORM_ID_AESCBC: return("AES-CBC"); - case N2N_TRANSFORM_ID_CHACHA20:return("ChaCha20"); - case N2N_TRANSFORM_ID_SPECK :return("Speck"); - default: return("invalid"); - }; -} - -/* ************************************** */ - -const char* compression_str(uint8_t cmpr) { - switch(cmpr) { - case N2N_COMPRESSION_ID_NONE: return("none"); - case N2N_COMPRESSION_ID_LZO: return("lzo1x"); - -#ifdef HAVE_LIBZSTD - case N2N_COMPRESSION_ID_ZSTD: return("zstd"); -#endif - default: return("invalid"); - }; -} - -/* ************************************** */ - -/** Destination 01:00:5E:00:00:00 - 01:00:5E:7F:FF:FF is multicast ethernet. - */ -static int is_ethMulticast(const void * buf, size_t bufsize) { - int retval = 0; - - /* Match 01:00:5E:00:00:00 - 01:00:5E:7F:FF:FF */ - if(bufsize >= sizeof(ether_hdr_t)) { - /* copy to aligned memory */ - ether_hdr_t eh; - memcpy(&eh, buf, sizeof(ether_hdr_t)); - - if((0x01 == eh.dhost[0]) && - (0x00 == eh.dhost[1]) && - (0x5E == eh.dhost[2]) && - (0 == (0x80 & eh.dhost[3]))) - retval = 1; /* This is an ethernet multicast packet [RFC1112]. */ - } - - return retval; -} - -/* ************************************** */ - -/** Destination MAC 33:33:0:00:00:00 - 33:33:FF:FF:FF:FF is reserved for IPv6 - * neighbour discovery. - */ -static int is_ip6_discovery(const void * buf, size_t bufsize) { - int retval = 0; - - if(bufsize >= sizeof(ether_hdr_t)) { - /* copy to aligned memory */ - ether_hdr_t eh; - - memcpy(&eh, buf, sizeof(ether_hdr_t)); - - if((0x33 == eh.dhost[0]) && (0x33 == eh.dhost[1])) - retval = 1; /* This is an IPv6 multicast packet [RFC2464]. */ - } - return retval; -} - -/* ************************************** */ - -/** Initialise an edge to defaults. - * - * This also initialises the NULL transform operation opstruct. - */ -n2n_edge_t* edge_init(const tuntap_dev *dev, const n2n_edge_conf_t *conf, int *rv) { - n2n_transform_t transop_id = conf->transop_id; - n2n_edge_t *eee = calloc(1, sizeof(n2n_edge_t)); - int rc = -1, i; - - if((rc = edge_verify_conf(conf)) != 0) { - traceEvent(TRACE_ERROR, "Invalid configuration"); - goto edge_init_error; - } - - if(!eee) { - traceEvent(TRACE_ERROR, "Cannot allocate memory"); - goto edge_init_error; - } - -#ifdef WIN32 - initWin32(); -#endif - - memcpy(&eee->conf, conf, sizeof(*conf)); - memcpy(&eee->device, dev, sizeof(*dev)); - eee->start_time = time(NULL); - - eee->known_peers = NULL; - eee->pending_peers = NULL; - eee->sup_attempts = N2N_EDGE_SUP_ATTEMPTS; - eee->sn_last_valid_time_stamp = initial_time_stamp (); - - pearson_hash_init(); - - if(eee->conf.compression == N2N_COMPRESSION_ID_LZO) - if(lzo_init() != LZO_E_OK) { - traceEvent(TRACE_ERROR, "LZO compression error"); - goto edge_init_error; - } - -#ifdef N2N_HAVE_ZSTD - // zstd does not require initialization. if it were required, this would be a good place -#endif - - for(i=0; isn_num; ++i) - traceEvent(TRACE_NORMAL, "supernode %u => %s\n", i, (conf->sn_ip_array[i])); - - /* Set the active supernode */ - supernode2addr(&(eee->supernode), conf->sn_ip_array[eee->sn_idx]); - - /* Set active transop */ - switch(transop_id) { - case N2N_TRANSFORM_ID_TWOFISH: - rc = n2n_transop_twofish_init(&eee->conf, &eee->transop); - break; -#ifdef N2N_HAVE_AES - case N2N_TRANSFORM_ID_AESCBC: - rc = n2n_transop_aes_cbc_init(&eee->conf, &eee->transop); - break; -#endif -#ifdef HAVE_OPENSSL_1_1 - case N2N_TRANSFORM_ID_CHACHA20: - rc = n2n_transop_cc20_init(&eee->conf, &eee->transop); - break; -#endif - case N2N_TRANSFORM_ID_SPECK: - rc = n2n_transop_speck_init(&eee->conf, &eee->transop); - break; - default: - rc = n2n_transop_null_init(&eee->conf, &eee->transop); - } - - if((rc < 0) || (eee->transop.fwd == NULL) || (eee->transop.transform_id != transop_id)) { - traceEvent(TRACE_ERROR, "Transop init failed"); - goto edge_init_error; - } - - /* Set the key schedule (context) for header encryption if enabled */ - if(conf->header_encryption == HEADER_ENCRYPTION_ENABLED) { - traceEvent(TRACE_NORMAL, "Header encryption is enabled."); - packet_header_setup_key ((char *)(conf->community_name), &(eee->conf.header_encryption_ctx),&(eee->conf.header_iv_ctx)); - } - - if(eee->transop.no_encryption) - traceEvent(TRACE_WARNING, "Encryption is disabled in edge"); - - if(edge_init_sockets(eee, conf->local_port, conf->mgmt_port, conf->tos) < 0) { - traceEvent(TRACE_ERROR, "socket setup failed"); - goto edge_init_error; - } - - if(edge_init_routes(eee, conf->routes, conf->num_routes) < 0) { - traceEvent(TRACE_ERROR, "routes setup failed"); - goto edge_init_error; - } - - //edge_init_success: - *rv = 0; - return(eee); - - edge_init_error: - if(eee) - free(eee); - *rv = rc; - return(NULL); -} - -/* ************************************** */ - -static int find_and_remove_peer(struct peer_info **head, const n2n_mac_t mac) { - struct peer_info *peer; - - HASH_FIND_PEER(*head, mac, peer); - if(peer) { - HASH_DEL(*head, peer); - free(peer); - return(1); - } - - return(0); -} - -/* ************************************** */ - -static uint32_t localhost_v4 = 0x7f000001; -static uint8_t localhost_v6[IPV6_SIZE] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}; - -/* Exclude localhost as it may be received when an edge node runs - * in the same supernode host. - */ -static int is_valid_peer_sock(const n2n_sock_t *sock) { - switch(sock->family) { - case AF_INET: - { - uint32_t *a = (uint32_t*)sock->addr.v4; - - if(*a != htonl(localhost_v4)) - return(1); - } - break; - - case AF_INET6: - if(memcmp(sock->addr.v6, localhost_v6, IPV6_SIZE)) - return(1); - break; - } - - return(0); -} - -/* ***************************************************** */ - -/** Resolve the supernode IP address. - * - * REVISIT: This is a really bad idea. The edge will block completely while the - * hostname resolution is performed. This could take 15 seconds. - */ -static int supernode2addr(n2n_sock_t * sn, const n2n_sn_name_t addrIn) { - n2n_sn_name_t addr; - const char *supernode_host; - int rv = 0; - - memcpy(addr, addrIn, N2N_EDGE_SN_HOST_SIZE); - - supernode_host = strtok(addr, ":"); - - if(supernode_host) { - in_addr_t sn_addr; - char *supernode_port = strtok(NULL, ":"); - const struct addrinfo aihints = {0, PF_INET, 0, 0, 0, NULL, NULL, NULL}; - struct addrinfo * ainfo = NULL; - int nameerr; - - if(supernode_port) - sn->port = atoi(supernode_port); - else - traceEvent(TRACE_WARNING, "Bad supernode parameter (-l ) %s %s:%s", - addr, supernode_host, supernode_port); - - nameerr = getaddrinfo(supernode_host, NULL, &aihints, &ainfo); - - if(0 == nameerr) - { - struct sockaddr_in * saddr; - - /* ainfo s the head of a linked list if non-NULL. */ - if(ainfo && (PF_INET == ainfo->ai_family)) - { - /* It is definitely and IPv4 address -> sockaddr_in */ - saddr = (struct sockaddr_in *)ainfo->ai_addr; - - memcpy(sn->addr.v4, &(saddr->sin_addr.s_addr), IPV4_SIZE); - sn->family=AF_INET; - } - else - { - /* Should only return IPv4 addresses due to aihints. */ - traceEvent(TRACE_WARNING, "Failed to resolve supernode IPv4 address for %s", supernode_host); - rv = -1; - } - - freeaddrinfo(ainfo); /* free everything allocated by getaddrinfo(). */ - ainfo = NULL; - } else { - traceEvent(TRACE_WARNING, "Failed to resolve supernode host %s", supernode_host); - rv = -2; - } - - } else { - traceEvent(TRACE_WARNING, "Wrong supernode parameter (-l )"); - rv = -3; - } - - return(rv); -} - -/* ************************************** */ - -static const int definitely_from_supernode = 1; - -/*** - * - * For a given packet, find the apporopriate internal last valid time stamp for lookup - * and verify it (and also update, if applicable). - */ -static int find_peer_time_stamp_and_verify (n2n_edge_t * eee, - int from_supernode, n2n_mac_t mac, - uint64_t stamp) { - - uint64_t * previous_stamp = NULL; - - if(from_supernode) { - // from supernode - previous_stamp = &(eee->sn_last_valid_time_stamp); - } else { - // from (peer) edge - struct peer_info *peer; - HASH_FIND_PEER(eee->pending_peers, mac, peer); - if(!peer) { - HASH_FIND_PEER(eee->known_peers, mac, peer); - } - if(peer) { - // time_stamp_verify_and_update allows the pointer a previous stamp to be NULL - // if it is a (so far) unknown peer - previous_stamp = &(peer->last_valid_time_stamp); - } - } - - // failure --> 0; success --> 1 - return ( time_stamp_verify_and_update (stamp, previous_stamp) ); -} - -/* ************************************** */ - -/*** - * - * Register over multicast in case there is a peer on the same network listening - */ -static void register_with_local_peers(n2n_edge_t * eee) { -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if(eee->multicast_joined && eee->conf.allow_p2p) { - /* send registration to the local multicast group */ - traceEvent(TRACE_DEBUG, "Registering with multicast group %s:%u", - N2N_MULTICAST_GROUP, N2N_MULTICAST_PORT); - send_register(eee, &(eee->multicast_peer), NULL); - } -#else - traceEvent(TRACE_DEBUG, "Multicast peers discovery is disabled, skipping"); -#endif -} - -/* ************************************** */ - -/** Start the registration process. - * - * If the peer is already in pending_peers, ignore the request. - * If not in pending_peers, add it and send a REGISTER. - * - * If hdr is for a direct peer-to-peer packet, try to register back to sender - * even if the MAC is in pending_peers. This is because an incident direct - * packet indicates that peer-to-peer exchange should work so more aggressive - * registration can be permitted (once per incoming packet) as this should only - * last for a small number of packets.. - * - * Called from the main loop when Rx a packet for our device mac. - */ -static void register_with_new_peer(n2n_edge_t * eee, - uint8_t from_supernode, - const n2n_mac_t mac, - const n2n_sock_t * peer) { - /* REVISIT: purge of pending_peers not yet done. */ - struct peer_info * scan; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - HASH_FIND_PEER(eee->pending_peers, mac, scan); - - /* NOTE: pending_peers are purged periodically with purge_expired_registrations */ - if(scan == NULL) { - scan = calloc(1, sizeof(struct peer_info)); - - memcpy(scan->mac_addr, mac, N2N_MAC_SIZE); - scan->sock = *peer; - scan->timeout = REGISTER_SUPER_INTERVAL_DFL; /* TODO: should correspond to the peer supernode registration timeout */ - scan->last_seen = time(NULL); /* Don't change this it marks the pending peer for removal. */ - scan->last_valid_time_stamp = initial_time_stamp (); - - HASH_ADD_PEER(eee->pending_peers, scan); - - traceEvent(TRACE_DEBUG, "=== new pending %s -> %s", - macaddr_str(mac_buf, scan->mac_addr), - sock_to_cstr(sockbuf, &(scan->sock))); - - traceEvent(TRACE_DEBUG, "Pending peers list size=%u", - HASH_COUNT(eee->pending_peers)); - - /* trace Sending REGISTER */ - if(from_supernode) { - /* UDP NAT hole punching through supernode. Send to peer first(punch local UDP hole) - * and then ask supernode to forward. Supernode then ask peer to ack. Some nat device - * drop and block ports with incoming UDP packet if out-come traffic does not exist. - * So we can alternatively set TTL so that the packet sent to peer never really reaches - * The register_ttl is basically nat level + 1. Set it to 1 means host like DMZ. - */ - if(eee->conf.register_ttl == 1) { - /* We are DMZ host or port is directly accessible. Just let peer to send back the ack */ -#ifndef WIN32 - } else if(eee->conf.register_ttl > 1) { - /* Setting register_ttl usually implies that the edge knows the internal net topology - * clearly, we can apply aggressive port prediction to support incoming Symmetric NAT - */ - int curTTL = 0; - socklen_t lenTTL = sizeof(int); - n2n_sock_t sock = scan->sock; - int alter = 16; /* TODO: set by command line or more reliable prediction method */ - - getsockopt(eee->udp_sock, IPPROTO_IP, IP_TTL, (void *)(char *)&curTTL, &lenTTL); - setsockopt(eee->udp_sock, IPPROTO_IP, IP_TTL, - (void *)(char *)&eee->conf.register_ttl, - sizeof(eee->conf.register_ttl)); - for (; alter > 0; alter--, sock.port++) - { - send_register(eee, &sock, mac); - } - setsockopt(eee->udp_sock, IPPROTO_IP, IP_TTL, (void *)(char *)&curTTL, sizeof(curTTL)); -#endif - } else { /* eee->conf.register_ttl <= 0 */ - /* Normal STUN */ - send_register(eee, &(scan->sock), mac); - } - send_register(eee, &(eee->supernode), mac); - } else { - /* P2P register, send directly */ - send_register(eee, &(scan->sock), mac); - } - - register_with_local_peers(eee); - } else - scan->sock = *peer; -} - -/* ************************************** */ - -/** Update the last_seen time for this peer, or get registered. */ -static void check_peer_registration_needed(n2n_edge_t * eee, - uint8_t from_supernode, - const n2n_mac_t mac, - const n2n_sock_t * peer) { - struct peer_info *scan; - - HASH_FIND_PEER(eee->known_peers, mac, scan); - - if(scan == NULL) { - /* Not in known_peers - start the REGISTER process. */ - register_with_new_peer(eee, from_supernode, mac, peer); - } else { - /* Already in known_peers. */ - time_t now = time(NULL); - - if(!from_supernode) - scan->last_p2p = now; - - if((now - scan->last_seen) > 0 /* >= 1 sec */) { - /* Don't register too often */ - check_known_peer_sock_change(eee, from_supernode, mac, peer, now); - } - } -} -/* ************************************** */ - - -/* Confirm that a pending peer is reachable directly via P2P. - * - * peer must be a pointer to an element of the pending_peers list. - */ -static void peer_set_p2p_confirmed(n2n_edge_t * eee, - const n2n_mac_t mac, - const n2n_sock_t * peer, - time_t now) { - struct peer_info *scan; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - HASH_FIND_PEER(eee->pending_peers, mac, scan); - - if(scan) { - HASH_DEL(eee->pending_peers, scan); - - /* Add scan to known_peers. */ - HASH_ADD_PEER(eee->known_peers, scan); - - scan->sock = *peer; - scan->last_p2p = now; - - traceEvent(TRACE_DEBUG, "P2P connection established: %s [%s]", - macaddr_str(mac_buf, mac), - sock_to_cstr(sockbuf, peer)); - - traceEvent(TRACE_DEBUG, "=== new peer %s -> %s", - macaddr_str(mac_buf, scan->mac_addr), - sock_to_cstr(sockbuf, &(scan->sock))); - - traceEvent(TRACE_DEBUG, "Pending peers list size=%u", - HASH_COUNT(eee->pending_peers)); - - traceEvent(TRACE_DEBUG, "Known peers list size=%u", - HASH_COUNT(eee->known_peers)); - - scan->last_seen = now; - } else - traceEvent(TRACE_DEBUG, "Failed to find sender in pending_peers."); -} - -/* ************************************** */ - -int is_empty_ip_address(const n2n_sock_t * sock) { - const uint8_t * ptr=NULL; - size_t len=0; - size_t i; - - if(AF_INET6 == sock->family) - { - ptr = sock->addr.v6; - len = 16; - } - else - { - ptr = sock->addr.v4; - len = 4; - } - - for (i=0; iknown_peers, mac, scan); - - if(!scan) - /* Not in known_peers */ - return; - - if(!sock_equal(&(scan->sock), peer)) { - if(!from_supernode) { - /* This is a P2P packet */ - traceEvent(TRACE_NORMAL, "Peer changed %s: %s -> %s", - macaddr_str(mac_buf, scan->mac_addr), - sock_to_cstr(sockbuf1, &(scan->sock)), - sock_to_cstr(sockbuf2, peer)); - /* The peer has changed public socket. It can no longer be assumed to be reachable. */ - HASH_DEL(eee->known_peers, scan); - free(scan); - - register_with_new_peer(eee, from_supernode, mac, peer); - } else { - /* Don't worry about what the supernode reports, it could be seeing a different socket. */ - } - } else - scan->last_seen = when; -} - -/* ************************************** */ - -/** Send a datagram to a socket defined by a n2n_sock_t */ -static ssize_t sendto_sock(int fd, const void * buf, - size_t len, const n2n_sock_t * dest) { - struct sockaddr_in peer_addr; - ssize_t sent; - - if(!dest->family) - // Invalid socket - return 0; - - fill_sockaddr((struct sockaddr *) &peer_addr, - sizeof(peer_addr), - dest); - - sent = sendto(fd, buf, len, 0/*flags*/, - (struct sockaddr *)&peer_addr, sizeof(struct sockaddr_in)); - if(sent < 0) - { - char * c = strerror(errno); - traceEvent(TRACE_ERROR, "sendto failed (%d) %s", errno, c); - } - else - { - traceEvent(TRACE_DEBUG, "sendto sent=%d to ", (signed int)sent); - } - - return sent; -} - -/* ************************************** */ - -/* Bind eee->udp_multicast_sock to multicast group */ -static void check_join_multicast_group(n2n_edge_t *eee) { -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if(!eee->multicast_joined) { - struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP); - mreq.imr_interface.s_addr = htonl(INADDR_ANY); - - if(setsockopt(eee->udp_multicast_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mreq, sizeof(mreq)) < 0) { - traceEvent(TRACE_WARNING, "Failed to bind to local multicast group %s:%u [errno %u]", - N2N_MULTICAST_GROUP, N2N_MULTICAST_PORT, errno); - -#ifdef WIN32 - traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - } else { - traceEvent(TRACE_NORMAL, "Successfully joined multicast group %s:%u", - N2N_MULTICAST_GROUP, N2N_MULTICAST_PORT); - eee->multicast_joined = 1; - } - } -#endif -} - -/* ************************************** */ - -/** Send a REGISTER_SUPER packet to the current supernode. */ -static void send_register_super(n2n_edge_t *eee, const n2n_sock_t *supernode, int sn_idx) { - uint8_t pktbuf[N2N_PKT_BUF_SIZE] = {0}; - size_t idx; - /* ssize_t sent; */ - n2n_common_t cmn; - n2n_REGISTER_SUPER_t reg; - n2n_sock_str_t sockbuf; - - memset(&cmn, 0, sizeof(cmn)); - memset(®, 0, sizeof(reg)); - cmn.ttl=N2N_DEFAULT_TTL; - cmn.pc = n2n_register_super; - cmn.flags = 0; - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - - for (idx = 0; (sn_idx==0) && (idx < N2N_COOKIE_SIZE); ++idx) - eee->last_cookie[idx] = n2n_rand() % 0xff; - - memcpy(reg.cookie, eee->last_cookie, N2N_COOKIE_SIZE); - reg.auth.scheme=0; /* No auth yet */ - - idx=0; - encode_mac(reg.edgeMac, &idx, eee->device.mac_addr); - - idx=0; - encode_REGISTER_SUPER(pktbuf, &idx, &cmn, ®); - - traceEvent(TRACE_DEBUG, "send REGISTER_SUPER to %s", - sock_to_cstr(sockbuf, supernode)); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt (pktbuf, idx, eee->conf.header_encryption_ctx, - eee->conf.header_iv_ctx, - time_stamp (), pearson_hash_16 (pktbuf, idx)); - - /* sent = */ sendto_sock(eee->udp_sock, pktbuf, idx, supernode); -} - -/* ************************************** */ - -/** Send a QUERY_PEER packet to the current supernode. */ -static void send_query_peer( n2n_edge_t * eee, - const n2n_mac_t dstMac) { - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - n2n_common_t cmn = {0}; - n2n_QUERY_PEER_t query = {{0}}; - - cmn.ttl=N2N_DEFAULT_TTL; - cmn.pc = n2n_query_peer; - cmn.flags = 0; - memcpy( cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE ); - - idx=0; - encode_mac( query.srcMac, &idx, eee->device.mac_addr ); - idx=0; - encode_mac( query.targetMac, &idx, dstMac ); - - idx=0; - encode_QUERY_PEER( pktbuf, &idx, &cmn, &query ); - - traceEvent( TRACE_DEBUG, "send QUERY_PEER to supernode" ); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED){ - packet_header_encrypt (pktbuf, idx, eee->conf.header_encryption_ctx, - eee->conf.header_iv_ctx, - time_stamp (), pearson_hash_16 (pktbuf, idx)); - } - sendto_sock( eee->udp_sock, pktbuf, idx, &(eee->supernode) ); -} - -/** Send a REGISTER packet to another edge. */ -static void send_register(n2n_edge_t * eee, - const n2n_sock_t * remote_peer, - const n2n_mac_t peer_mac) { - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - /* ssize_t sent; */ - n2n_common_t cmn; - n2n_REGISTER_t reg; - n2n_sock_str_t sockbuf; - - if(!eee->conf.allow_p2p) { - traceEvent(TRACE_DEBUG, "Skipping register as P2P is disabled"); - return; - } - - memset(&cmn, 0, sizeof(cmn)); - memset(®, 0, sizeof(reg)); - cmn.ttl=N2N_DEFAULT_TTL; - cmn.pc = n2n_register; - cmn.flags = 0; - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - - idx=0; - encode_uint32(reg.cookie, &idx, 123456789); - idx=0; - encode_mac(reg.srcMac, &idx, eee->device.mac_addr); - - if(peer_mac) { - /* Can be NULL for multicast registrations */ - idx=0; - encode_mac(reg.dstMac, &idx, peer_mac); - } - - idx=0; - encode_REGISTER(pktbuf, &idx, &cmn, ®); - - traceEvent(TRACE_INFO, "Send REGISTER to %s", - sock_to_cstr(sockbuf, remote_peer)); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt (pktbuf, idx, eee->conf.header_encryption_ctx, - eee->conf.header_iv_ctx, - time_stamp (), pearson_hash_16 (pktbuf, idx)); - - /* sent = */ sendto_sock(eee->udp_sock, pktbuf, idx, remote_peer); -} - -/* ************************************** */ - -/** Send a REGISTER_ACK packet to a peer edge. */ -static void send_register_ack(n2n_edge_t * eee, - const n2n_sock_t * remote_peer, - const n2n_REGISTER_t * reg) { - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - /* ssize_t sent; */ - n2n_common_t cmn; - n2n_REGISTER_ACK_t ack; - n2n_sock_str_t sockbuf; - - if(!eee->conf.allow_p2p) { - traceEvent(TRACE_DEBUG, "Skipping register ACK as P2P is disabled"); - return; - } - - memset(&cmn, 0, sizeof(cmn)); - memset(&ack, 0, sizeof(reg)); - cmn.ttl=N2N_DEFAULT_TTL; - cmn.pc = n2n_register_ack; - cmn.flags = 0; - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - - memset(&ack, 0, sizeof(ack)); - memcpy(ack.cookie, reg->cookie, N2N_COOKIE_SIZE); - memcpy(ack.srcMac, eee->device.mac_addr, N2N_MAC_SIZE); - memcpy(ack.dstMac, reg->srcMac, N2N_MAC_SIZE); - - idx=0; - encode_REGISTER_ACK(pktbuf, &idx, &cmn, &ack); - - traceEvent(TRACE_INFO, "send REGISTER_ACK %s", - sock_to_cstr(sockbuf, remote_peer)); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt (pktbuf, idx, eee->conf.header_encryption_ctx, - eee->conf.header_iv_ctx, - time_stamp (), pearson_hash_16 (pktbuf, idx)); - - /* sent = */ sendto_sock(eee->udp_sock, pktbuf, idx, remote_peer); -} - -/* ************************************** */ - -/** @brief Check to see if we should re-register with the supernode. - * - * This is frequently called by the main loop. - */ -static void update_supernode_reg(n2n_edge_t * eee, time_t nowTime) { - u_int sn_idx; - - if(eee->sn_wait && (nowTime > (eee->last_register_req + (eee->conf.register_interval/10)))) { - /* fall through */ - traceEvent(TRACE_DEBUG, "update_supernode_reg: doing fast retry."); - } else if(nowTime < (eee->last_register_req + eee->conf.register_interval)) - return; /* Too early */ - - check_join_multicast_group(eee); - - if(0 == eee->sup_attempts) { - /* Give up on that supernode and try the next one. */ - ++(eee->sn_idx); - - if(eee->sn_idx >= eee->conf.sn_num) { - /* Got to end of list, go back to the start. Also works for list of one entry. */ - eee->sn_idx=0; - } - - traceEvent(TRACE_WARNING, "Supernode not responding, now trying %s", supernode_ip(eee)); - - eee->sup_attempts = N2N_EDGE_SUP_ATTEMPTS; - } - else - --(eee->sup_attempts); - - for(sn_idx=0; sn_idxconf.sn_num; sn_idx++) { - if(supernode2addr(&(eee->supernode), eee->conf.sn_ip_array[sn_idx]) == 0) { - traceEvent(TRACE_INFO, "Registering with supernode [id: %u/%u][%s][attempts left %u]", - sn_idx+1, eee->conf.sn_num, - supernode_ip(eee), (unsigned int)eee->sup_attempts); - - send_register_super(eee, &(eee->supernode), sn_idx); - } - } - - register_with_local_peers(eee); - - eee->sn_wait=1; - - /* REVISIT: turn-on gratuitous ARP with config option. */ - /* send_grat_arps(sock_fd, is_udp_sock); */ - - eee->last_register_req = nowTime; -} - -/* ************************************** */ - -/** NOT IMPLEMENTED - * - * This would send a DEREGISTER packet to a peer edge or supernode to indicate - * the edge is going away. - */ -static void send_deregister(n2n_edge_t * eee, - n2n_sock_t * remote_peer) { - /* Marshall and send message */ -} - -/* ************************************** */ - -/** Return the IP address of the current supernode in the ring. */ -static const char * supernode_ip(const n2n_edge_t * eee) { - return (eee->conf.sn_ip_array)[eee->sn_idx]; -} - -/* ************************************** */ - -/** A PACKET has arrived containing an encapsulated ethernet datagram - usually - * encrypted. */ -static int handle_PACKET(n2n_edge_t * eee, - const n2n_common_t * cmn, - const n2n_PACKET_t * pkt, - const n2n_sock_t * orig_sender, - uint8_t * payload, - size_t psize) { - ssize_t data_sent_len; - uint8_t from_supernode; - uint8_t * eth_payload=NULL; - int retval = -1; - time_t now; - ether_hdr_t * eh; - ipstr_t ip_buf; - - now = time(NULL); - - traceEvent(TRACE_DEBUG, "handle_PACKET size %u transform %u", - (unsigned int)psize, (unsigned int)pkt->transform); - /* hexdump(payload, psize); */ - - from_supernode= cmn->flags & N2N_FLAGS_FROM_SUPERNODE; - - if(from_supernode) - { - if(!memcmp(pkt->dstMac, broadcast_mac, N2N_MAC_SIZE)) - ++(eee->stats.rx_sup_broadcast); - - ++(eee->stats.rx_sup); - eee->last_sup=now; - } - else - { - ++(eee->stats.rx_p2p); - eee->last_p2p=now; - } - - /* Update the sender in peer table entry */ - check_peer_registration_needed(eee, from_supernode, pkt->srcMac, orig_sender); - - /* Handle transform. */ - { - uint8_t decodebuf[N2N_PKT_BUF_SIZE]; - size_t eth_size; - n2n_transform_t rx_transop_id; - - rx_transop_id = (n2n_transform_t)pkt->transform; - /* optional compression is encoded in uppermost bit of transform field. - * this is an intermediate solution to maintain compatibility until some - * upcoming major release (3.0?) brings up changes in packet structure anyway - * in the course of which a dedicated compression field could be spent. - * REVISIT then. */ - uint16_t rx_compression_id; - - rx_compression_id = (uint16_t)rx_transop_id >> (8*sizeof((uint16_t)rx_transop_id)-N2N_COMPRESSION_ID_BITLEN); - rx_transop_id &= (1 << (8*sizeof((uint16_t)rx_transop_id)-N2N_COMPRESSION_ID_BITLEN)) -1; - - if(rx_transop_id == eee->conf.transop_id) { - uint8_t is_multicast; - eth_payload = decodebuf; - eh = (ether_hdr_t*)eth_payload; - eth_size = eee->transop.rev(&eee->transop, - eth_payload, N2N_PKT_BUF_SIZE, - payload, psize, pkt->srcMac); - ++(eee->transop.rx_cnt); /* stats */ - - /* decompress if necessary */ - uint8_t * deflation_buffer = 0; - int32_t deflated_len; - switch (rx_compression_id) { - case N2N_COMPRESSION_ID_NONE: - break; // continue afterwards - - case N2N_COMPRESSION_ID_LZO: - deflation_buffer = malloc (N2N_PKT_BUF_SIZE); - lzo1x_decompress (eth_payload, eth_size, deflation_buffer, (lzo_uint*)&deflated_len, NULL); - break; -#ifdef N2N_HAVE_ZSTD - case N2N_COMPRESSION_ID_ZSTD: - deflated_len = N2N_PKT_BUF_SIZE; - deflation_buffer = malloc (deflated_len); - deflated_len = (int32_t)ZSTD_decompress (deflation_buffer, deflated_len, eth_payload, eth_size); - if(ZSTD_isError(deflated_len)) { - traceEvent (TRACE_ERROR, "payload decompression failed with zstd error '%s'.", - ZSTD_getErrorName(deflated_len)); - free (deflation_buffer); - return (-1); // cannot help it - } - break; -#endif - default: - traceEvent (TRACE_ERROR, "payload decompression failed: received packet indicating unsupported %s compression.", - compression_str(rx_compression_id)); - return (-1); // cannot handle it - } - - if(rx_compression_id) { - traceEvent (TRACE_DEBUG, "payload decompression [%s]: deflated %u bytes to %u bytes", - compression_str(rx_compression_id), eth_size, (int)deflated_len); - memcpy(eth_payload ,deflation_buffer, deflated_len ); - eth_size = deflated_len; - free (deflation_buffer); - } - - is_multicast = (is_ip6_discovery(eth_payload, eth_size) || is_ethMulticast(eth_payload, eth_size)); - - if(eee->conf.drop_multicast && is_multicast) { - traceEvent(TRACE_INFO, "Dropping RX multicast"); - return(-1); - } else if((!eee->conf.allow_routing) && (!is_multicast)) { - /* Check if it is a routed packet */ - if((ntohs(eh->type) == 0x0800) && (eth_size >= ETH_FRAMESIZE + IP4_MIN_SIZE)) { - uint32_t *dst = (uint32_t*)ð_payload[ETH_FRAMESIZE + IP4_DSTOFFSET]; - uint8_t *dst_mac = (uint8_t*)eth_payload; - - /* Note: all elements of the_ip are in network order */ - if(!memcmp(dst_mac, broadcast_mac, N2N_MAC_SIZE)) - traceEvent(TRACE_DEBUG, "Broadcast packet [%s]", - intoa(ntohl(*dst), ip_buf, sizeof(ip_buf))); - else if((*dst != eee->device.ip_addr)) { - /* This is a packet that needs to be routed */ - traceEvent(TRACE_INFO, "Discarding routed packet [%s]", - intoa(ntohl(*dst), ip_buf, sizeof(ip_buf))); - return(-1); - } else { - /* This packet is directed to us */ - /* traceEvent(TRACE_INFO, "Sending non-routed packet"); */ - } - } - } - - if(eee->cb.packet_from_peer) { - uint16_t tmp_eth_size = eth_size; - if(eee->cb.packet_from_peer(eee, orig_sender, eth_payload, &tmp_eth_size) == N2N_DROP) { - traceEvent(TRACE_DEBUG, "DROP packet %u", (unsigned int)eth_size); - - return(0); - } - eth_size = tmp_eth_size; - } - - /* Write ethernet packet to tap device. */ - traceEvent(TRACE_DEBUG, "sending to TAP %u", (unsigned int)eth_size); - data_sent_len = tuntap_write(&(eee->device), eth_payload, eth_size); - - if(data_sent_len == eth_size) - { - retval = 0; - } - } - else - { - traceEvent(TRACE_ERROR, "invalid transop ID: expected %s(%u), got %s(%u)", - transop_str(eee->conf.transop_id), eee->conf.transop_id, - transop_str(rx_transop_id), rx_transop_id); - } - } - - return retval; -} - -/* ************************************** */ - -/** Read a datagram from the management UDP socket and take appropriate - * action. */ -static void readFromMgmtSocket(n2n_edge_t * eee, int * keep_running) { - uint8_t udp_buf[N2N_PKT_BUF_SIZE]; /* Compete UDP packet */ - ssize_t recvlen; - /* ssize_t sendlen; */ - struct sockaddr_in sender_sock; - socklen_t i; - size_t msg_len; - time_t now; - - now = time(NULL); - i = sizeof(sender_sock); - recvlen = recvfrom(eee->udp_mgmt_sock, udp_buf, N2N_PKT_BUF_SIZE, 0/*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t*)&i); - - if(recvlen < 0) - { - traceEvent(TRACE_ERROR, "mgmt recvfrom failed with %s", strerror(errno)); - - return; /* failed to receive data from UDP */ - } - - if(recvlen >= 4) - { - if(0 == memcmp(udp_buf, "stop", 4)) - { - traceEvent(TRACE_ERROR, "stop command received."); - *keep_running = 0; - return; - } - - if(0 == memcmp(udp_buf, "help", 4)) - { - msg_len=0; - setTraceLevel(getTraceLevel()+1); - - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "Help for edge management console:\n" - " stop Gracefully exit edge\n" - " help This help message\n" - " +verb Increase verbosity of logging\n" - " -verb Decrease verbosity of logging\n" - " Display statistics\n\n"); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in)); - - return; - } - - } - - if(recvlen >= 5) - { - if(0 == memcmp(udp_buf, "+verb", 5)) - { - msg_len=0; - setTraceLevel(getTraceLevel()+1); - - traceEvent(TRACE_ERROR, "+verb traceLevel=%u", (unsigned int)getTraceLevel()); - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> +OK traceLevel=%u\n", (unsigned int)getTraceLevel()); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in)); - - return; - } - - if(0 == memcmp(udp_buf, "-verb", 5)) - { - msg_len=0; - - if(getTraceLevel() > 0) - { - setTraceLevel(getTraceLevel()-1); - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> -OK traceLevel=%u\n", getTraceLevel()); - } - else - { - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> -NOK traceLevel=%u\n", getTraceLevel()); - } - - traceEvent(TRACE_ERROR, "-verb traceLevel=%u", (unsigned int)getTraceLevel()); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in)); - return; - } - } - - traceEvent(TRACE_DEBUG, "mgmt status rq"); - - msg_len=0; - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "Statistics for edge\n"); - - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "uptime %lu\n", - time(NULL) - eee->start_time); - - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "paths super:%u,%u p2p:%u,%u\n", - (unsigned int)eee->stats.tx_sup, - (unsigned int)eee->stats.rx_sup, - (unsigned int)eee->stats.tx_p2p, - (unsigned int)eee->stats.rx_p2p); - - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "transop |%6u|%6u|\n", - (unsigned int)eee->transop.tx_cnt, - (unsigned int)eee->transop.rx_cnt); - - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "peers pend:%u full:%u\n", - HASH_COUNT(eee->pending_peers), - HASH_COUNT(eee->known_peers)); - - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "last super:%lu(%ld sec ago) p2p:%lu(%ld sec ago)\n", - eee->last_sup, (now-eee->last_sup), eee->last_p2p, - (now-eee->last_p2p)); - - traceEvent(TRACE_DEBUG, "mgmt status sending: %s", udp_buf); - - - /* sendlen = */ sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in)); -} - -/* ************************************** */ - -static int check_query_peer_info(n2n_edge_t *eee, time_t now, n2n_mac_t mac) { - struct peer_info *scan; - - HASH_FIND_PEER(eee->pending_peers, mac, scan); - - if(!scan) { - scan = calloc(1, sizeof(struct peer_info)); - - memcpy(scan->mac_addr, mac, N2N_MAC_SIZE); - scan->timeout = REGISTER_SUPER_INTERVAL_DFL; /* TODO: should correspond to the peer supernode registration timeout */ - scan->last_seen = now; /* Don't change this it marks the pending peer for removal. */ - scan->last_valid_time_stamp = initial_time_stamp (); - - HASH_ADD_PEER(eee->pending_peers, scan); - } - - if(now - scan->last_sent_query > REGISTER_SUPER_INTERVAL_DFL) { - send_query_peer(eee, scan->mac_addr); - scan->last_sent_query = now; - return(0); - } - - return(1); -} - -/* ************************************** */ - -/* @return 1 if destination is a peer, 0 if destination is supernode */ -static int find_peer_destination(n2n_edge_t * eee, - n2n_mac_t mac_address, - n2n_sock_t * destination) { - struct peer_info *scan; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - int retval=0; - time_t now = time(NULL); - - if(!memcmp(mac_address, broadcast_mac, N2N_MAC_SIZE)) { - traceEvent(TRACE_DEBUG, "Broadcast destination peer, using supernode"); - memcpy(destination, &(eee->supernode), sizeof(struct sockaddr_in)); - return(0); - } - - traceEvent(TRACE_DEBUG, "Searching destination peer for MAC %02X:%02X:%02X:%02X:%02X:%02X", - mac_address[0] & 0xFF, mac_address[1] & 0xFF, mac_address[2] & 0xFF, - mac_address[3] & 0xFF, mac_address[4] & 0xFF, mac_address[5] & 0xFF); - - HASH_FIND_PEER(eee->known_peers, mac_address, scan); - - if(scan && (scan->last_seen > 0)) { - if((now - scan->last_p2p) >= (scan->timeout / 2)) { - /* Too much time passed since we saw the peer, need to register again - * since the peer address may have changed. */ - traceEvent(TRACE_DEBUG, "Refreshing idle known peer"); - HASH_DEL(eee->known_peers, scan); - free(scan); - /* NOTE: registration will be performed upon the receival of the next response packet */ - } else { - /* Valid known peer found */ - memcpy(destination, &scan->sock, sizeof(n2n_sock_t)); - retval=1; - } - } - - if(retval == 0) { - memcpy(destination, &(eee->supernode), sizeof(struct sockaddr_in)); - traceEvent(TRACE_DEBUG, "P2P Peer [MAC=%02X:%02X:%02X:%02X:%02X:%02X] not found, using supernode", - mac_address[0] & 0xFF, mac_address[1] & 0xFF, mac_address[2] & 0xFF, - mac_address[3] & 0xFF, mac_address[4] & 0xFF, mac_address[5] & 0xFF); - - check_query_peer_info(eee, now, mac_address); - } - - traceEvent(TRACE_DEBUG, "find_peer_address (%s) -> [%s]", - macaddr_str(mac_buf, mac_address), - sock_to_cstr(sockbuf, destination)); - - return retval; -} - -/* ***************************************************** */ - -/** Send an ecapsulated ethernet PACKET to a destination edge or broadcast MAC - * address. */ -static int send_packet(n2n_edge_t * eee, - n2n_mac_t dstMac, - const uint8_t * pktbuf, - size_t pktlen) { - int is_p2p; - /*ssize_t s; */ - n2n_sock_str_t sockbuf; - n2n_sock_t destination; - macstr_t mac_buf; - - /* hexdump(pktbuf, pktlen); */ - - is_p2p = find_peer_destination(eee, dstMac, &destination); - - if(is_p2p) - ++(eee->stats.tx_p2p); - else { - ++(eee->stats.tx_sup); - - if(!memcmp(dstMac, broadcast_mac, N2N_MAC_SIZE)) - ++(eee->stats.tx_sup_broadcast); - } - - traceEvent(TRACE_INFO, "Tx PACKET to %s (dest=%s) [%u B]", - sock_to_cstr(sockbuf, &destination), - macaddr_str(mac_buf, dstMac), pktlen); - - /* s = */ sendto_sock(eee->udp_sock, pktbuf, pktlen, &destination); - - return 0; -} - -/* ************************************** */ - -/** A layer-2 packet was received at the tunnel and needs to be sent via UDP. */ -void edge_send_packet2net(n2n_edge_t * eee, - uint8_t *tap_pkt, size_t len) { - ipstr_t ip_buf; - n2n_mac_t destMac; - - n2n_common_t cmn; - n2n_PACKET_t pkt; - - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx=0; - n2n_transform_t tx_transop_idx = eee->transop.transform_id; - - ether_hdr_t eh; - - /* tap_pkt is not aligned so we have to copy to aligned memory */ - memcpy(&eh, tap_pkt, sizeof(ether_hdr_t)); - - /* Discard IP packets that are not originated by this hosts */ - if(!(eee->conf.allow_routing)) { - if(ntohs(eh.type) == 0x0800) { - /* This is an IP packet from the local source address - not forwarded. */ - uint32_t *src = (uint32_t*)&tap_pkt[ETH_FRAMESIZE + IP4_SRCOFFSET]; - - /* Note: all elements of the_ip are in network order */ - if(*src != eee->device.ip_addr) { - /* This is a packet that needs to be routed */ - traceEvent(TRACE_INFO, "Discarding routed packet [%s]", - intoa(ntohl(*src), ip_buf, sizeof(ip_buf))); - return; - } else { - /* This packet is originated by us */ - /* traceEvent(TRACE_INFO, "Sending non-routed packet"); */ - } - } - } - - /* Optionally compress then apply transforms, eg encryption. */ - - /* Once processed, send to destination in PACKET */ - - memcpy(destMac, tap_pkt, N2N_MAC_SIZE); /* dest MAC is first in ethernet header */ - - memset(&cmn, 0, sizeof(cmn)); - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_packet; - cmn.flags=0; /* no options, not from supernode, no socket */ - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - - memset(&pkt, 0, sizeof(pkt)); - memcpy(pkt.srcMac, eee->device.mac_addr, N2N_MAC_SIZE); - memcpy(pkt.dstMac, destMac, N2N_MAC_SIZE); - - pkt.sock.family=0; /* do not encode sock */ - pkt.transform = tx_transop_idx; - - // compression needs to be tried before encode_PACKET is called for compression indication gets encoded there - pkt.compression = N2N_COMPRESSION_ID_NONE; - - if(eee->conf.compression) { - uint8_t * compression_buffer = NULL; - int32_t compression_len; - - switch (eee->conf.compression) { - case N2N_COMPRESSION_ID_LZO: - compression_buffer = malloc (len + len / 16 + 64 + 3); - if(lzo1x_1_compress(tap_pkt, len, compression_buffer, (lzo_uint*)&compression_len, wrkmem) == LZO_E_OK) { - if(compression_len < len) { - pkt.compression = N2N_COMPRESSION_ID_LZO; - } - } - break; -#ifdef N2N_HAVE_ZSTD - case N2N_COMPRESSION_ID_ZSTD: - compression_len = N2N_PKT_BUF_SIZE + 128; - compression_buffer = malloc (compression_len); // leaves enough room, for exact size call compression_len = ZSTD_compressBound (len); (slower) - compression_len = (int32_t)ZSTD_compress(compression_buffer, compression_len, tap_pkt, len, ZSTD_COMPRESSION_LEVEL) ; - if(!ZSTD_isError(compression_len)) { - if(compression_len < len) { - pkt.compression = N2N_COMPRESSION_ID_ZSTD; - } - } else { - traceEvent (TRACE_ERROR, "payload compression failed with zstd error '%s'.", - ZSTD_getErrorName(compression_len)); - free (compression_buffer); - // continue with unset without pkt.compression --> will send uncompressed - } - break; -#endif - default: - break; - } - - if(pkt.compression) { - traceEvent (TRACE_DEBUG, "payload compression [%s]: compressed %u bytes to %u bytes\n", - compression_str(pkt.compression), len, compression_len); - - memcpy (tap_pkt, compression_buffer, compression_len); - len = compression_len; - } - - if(compression_buffer) { - free (compression_buffer); - } - } - /* optional compression is encoded in uppermost bits of transform field. - * this is an intermediate solution to maintain compatibility until some - * upcoming major release (3.0?) brings up changes in packet structure anyway - * in the course of which a dedicated compression field could be spent. - * REVISIT then. */ - pkt.transform = pkt.transform | (pkt.compression << (8*sizeof(pkt.transform)-N2N_COMPRESSION_ID_BITLEN)); - - idx=0; - encode_PACKET(pktbuf, &idx, &cmn, &pkt); - - uint16_t headerIdx = idx; - - idx += eee->transop.fwd(&eee->transop, - pktbuf+idx, N2N_PKT_BUF_SIZE-idx, - tap_pkt, len, pkt.dstMac); - - traceEvent(TRACE_DEBUG, "Encode %u B PACKET [%u B data, %u B overhead] transform %u", - (u_int)idx, (u_int)len, (u_int)(idx-len), tx_transop_idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt (pktbuf, headerIdx, eee->conf.header_encryption_ctx, - eee->conf.header_iv_ctx, - time_stamp (), pearson_hash_16 (pktbuf, idx)); - -#ifdef MTU_ASSERT_VALUE - { - const u_int eth_udp_overhead = ETH_FRAMESIZE + IP4_MIN_SIZE + UDP_SIZE; - - // MTU assertion which avoids fragmentation by N2N - assert(idx + eth_udp_overhead <= MTU_ASSERT_VALUE); - } -#endif - - eee->transop.tx_cnt++; /* stats */ - - send_packet(eee, destMac, pktbuf, idx); /* to peer or supernode */ -} - -/* ************************************** */ - -/** Read a single packet from the TAP interface, process it and write out the - * corresponding packet to the cooked socket. - */ -void edge_read_from_tap(n2n_edge_t * eee) { - /* tun -> remote */ - uint8_t eth_pkt[N2N_PKT_BUF_SIZE]; - macstr_t mac_buf; - ssize_t len; - - len = tuntap_read( &(eee->device), eth_pkt, N2N_PKT_BUF_SIZE ); - if((len <= 0) || (len > N2N_PKT_BUF_SIZE)) - { - traceEvent(TRACE_WARNING, "read()=%d [%d/%s]", - (signed int)len, errno, strerror(errno)); - traceEvent(TRACE_WARNING, "TAP I/O operation aborted, restart later."); - sleep(3); - tuntap_close(&(eee->device)); - tuntap_open(&(eee->device), eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, eee->tuntap_priv_conf.ip_addr, - eee->tuntap_priv_conf.netmask, eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu); - } - else - { - const uint8_t * mac = eth_pkt; - traceEvent(TRACE_DEBUG, "### Rx TAP packet (%4d) for %s", - (signed int)len, macaddr_str(mac_buf, mac)); - - if(eee->conf.drop_multicast && - (is_ip6_discovery(eth_pkt, len) || - is_ethMulticast(eth_pkt, len) - ) - ) - { - traceEvent(TRACE_INFO, "Dropping TX multicast"); - } - else - { - if(eee->cb.packet_from_tap) { - uint16_t tmp_len = len; - if(eee->cb.packet_from_tap(eee, eth_pkt, &tmp_len) == N2N_DROP) { - traceEvent(TRACE_DEBUG, "DROP packet %u", (unsigned int)len); - - return; - } - len = tmp_len; - } - - edge_send_packet2net(eee, eth_pkt, len); - } - } -} - -/* ************************************** */ - - -/* ************************************** */ - -/** Read a datagram from the main UDP socket to the internet. */ -static void readFromIPSocket(n2n_edge_t * eee, int in_sock) { - n2n_common_t cmn; /* common fields in the packet header */ - - n2n_sock_str_t sockbuf1; - n2n_sock_str_t sockbuf2; /* don't clobber sockbuf1 if writing two addresses to trace */ - macstr_t mac_buf1; - macstr_t mac_buf2; - - uint8_t udp_buf[N2N_PKT_BUF_SIZE]; /* Compete UDP packet */ - ssize_t recvlen; - size_t rem; - size_t idx; - size_t msg_type; - uint8_t from_supernode; - struct sockaddr_in sender_sock; - n2n_sock_t sender; - n2n_sock_t * orig_sender=NULL; - time_t now=0; - uint64_t stamp = 0; - - size_t i; - - i = sizeof(sender_sock); - recvlen = recvfrom(in_sock, udp_buf, N2N_PKT_BUF_SIZE, 0/*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t*)&i); - - if(recvlen < 0) { -#ifdef WIN32 - if(WSAGetLastError() != WSAECONNRESET) -#endif - { - traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", recvlen, errno, strerror(errno)); -#ifdef WIN32 - traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - } - - return; /* failed to receive data from UDP */ - } - - /* REVISIT: when UDP/IPv6 is supported we will need a flag to indicate which - * IP transport version the packet arrived on. May need to UDP sockets. */ - sender.family = AF_INET; /* UDP socket was opened PF_INET v4 */ - sender.port = ntohs(sender_sock.sin_port); - memcpy(&(sender.addr.v4), &(sender_sock.sin_addr.s_addr), IPV4_SIZE); - - /* The packet may not have an orig_sender socket spec. So default to last - * hop as sender. */ - orig_sender=&sender; - - traceEvent(TRACE_DEBUG, "### Rx N2N UDP (%d) from %s", - (signed int)recvlen, sock_to_cstr(sockbuf1, &sender)); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - uint16_t checksum = 0; - if( packet_header_decrypt (udp_buf, recvlen, (char *)eee->conf.community_name, eee->conf.header_encryption_ctx, - eee->conf.header_iv_ctx, - &stamp, &checksum) == 0) { - traceEvent(TRACE_DEBUG, "readFromIPSocket failed to decrypt header."); - return; - } - - // time stamp verification follows in the packet specific section as it requires to determine the - // sender from the hash list by its MAC, or the packet might be from the supernode, this all depends - // on packet type, path taken (via supernode) and packet structure (MAC is not always in the same place) - - if (checksum != pearson_hash_16 (udp_buf, recvlen)) { - traceEvent(TRACE_DEBUG, "readFromIPSocket dropped packet due to checksum error."); - return; - } - } - - /* hexdump(udp_buf, recvlen); */ - - rem = recvlen; /* Counts down bytes of packet to protect against buffer overruns. */ - idx = 0; /* marches through packet header as parts are decoded. */ - if(decode_common(&cmn, udp_buf, &rem, &idx) < 0) - { - traceEvent(TRACE_ERROR, "Failed to decode common section in N2N_UDP"); - return; /* failed to decode packet */ - } - - now = time(NULL); - - msg_type = cmn.pc; /* packet code */ - from_supernode= cmn.flags & N2N_FLAGS_FROM_SUPERNODE; - - if(0 == memcmp(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE)) { - switch(msg_type) { - case MSG_TYPE_PACKET: - { - /* process PACKET - most frequent so first in list. */ - n2n_PACKET_t pkt; - - decode_PACKET(&pkt, &cmn, udp_buf, &rem, &idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify (eee, from_supernode, pkt.srcMac, stamp)) { - traceEvent(TRACE_DEBUG, "readFromIPSocket dropped PACKET due to time stamp error."); - return; - } - } - - if(is_valid_peer_sock(&pkt.sock)) - orig_sender = &(pkt.sock); - - if(!from_supernode) { - /* This is a P2P packet from the peer. We purge a pending - * registration towards the possibly nat-ted peer address as we now have - * a valid channel. We still use check_peer_registration_needed in - * handle_PACKET to double check this. - */ - traceEvent(TRACE_DEBUG, "Got P2P packet"); - traceEvent(TRACE_DEBUG, "[P2P] Rx data from %s [%u B]", sock_to_cstr(sockbuf1, &sender), recvlen); - find_and_remove_peer(&eee->pending_peers, pkt.srcMac); - } - else { - /* [PsP] : edge Peer->Supernode->edge Peer */ - traceEvent(TRACE_DEBUG, "[PsP] Rx data from %s (Via=%s) [%u B]", - sock_to_cstr(sockbuf2, orig_sender), sock_to_cstr(sockbuf1, &sender), recvlen); - } - - handle_PACKET(eee, &cmn, &pkt, orig_sender, udp_buf+idx, recvlen-idx); - break; - } - case MSG_TYPE_REGISTER: - { - /* Another edge is registering with us */ - n2n_REGISTER_t reg; - int via_multicast; - - decode_REGISTER(®, &cmn, udp_buf, &rem, &idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify (eee, from_supernode, reg.srcMac, stamp)) { - traceEvent(TRACE_DEBUG, "readFromIPSocket dropped REGISTER due to time stamp error."); - return; - } - } - - if(is_valid_peer_sock(®.sock)) - orig_sender = &(reg.sock); - - via_multicast = !memcmp(reg.dstMac, null_mac, N2N_MAC_SIZE); - - if(via_multicast && !memcmp(reg.srcMac, eee->device.mac_addr, N2N_MAC_SIZE)) { - traceEvent(TRACE_DEBUG, "Skipping REGISTER from self"); - break; - } - - if(!via_multicast && memcmp(reg.dstMac, eee->device.mac_addr, N2N_MAC_SIZE)) { - traceEvent(TRACE_DEBUG, "Skipping REGISTER for other peer"); - break; - } - - if(!from_supernode) { - /* This is a P2P registration from the peer. We purge a pending - * registration towards the possibly nat-ted peer address as we now have - * a valid channel. We still use check_peer_registration_needed below - * to double check this. - */ - traceEvent(TRACE_DEBUG, "Got P2P register"); - traceEvent(TRACE_NORMAL, "[P2P] Rx REGISTER from %s", sock_to_cstr(sockbuf1, &sender)); - find_and_remove_peer(&eee->pending_peers, reg.srcMac); - - /* NOTE: only ACK to peers */ - send_register_ack(eee, orig_sender, ®); - } - else { - traceEvent(TRACE_NORMAL, "[PsP] Rx REGISTER src=%s dst=%s from sn=%s (edge:%s)", - macaddr_str(mac_buf1, reg.srcMac), macaddr_str(mac_buf2, reg.dstMac), - sock_to_cstr(sockbuf1, &sender), sock_to_cstr(sockbuf2, orig_sender)); - } - - check_peer_registration_needed(eee, from_supernode, reg.srcMac, orig_sender); - break; - } - case MSG_TYPE_REGISTER_ACK: - { - /* Peer edge is acknowledging our register request */ - n2n_REGISTER_ACK_t ra; - - decode_REGISTER_ACK(&ra, &cmn, udp_buf, &rem, &idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify (eee, !definitely_from_supernode, ra.srcMac, stamp)) { - traceEvent(TRACE_DEBUG, "readFromIPSocket dropped REGISTER_ACK due to time stamp error."); - return; - } - } - - if(is_valid_peer_sock(&ra.sock)) - orig_sender = &(ra.sock); - - traceEvent(TRACE_INFO, "Rx REGISTER_ACK src=%s dst=%s from peer %s (%s)", - macaddr_str(mac_buf1, ra.srcMac), - macaddr_str(mac_buf2, ra.dstMac), - sock_to_cstr(sockbuf1, &sender), - sock_to_cstr(sockbuf2, orig_sender)); - - peer_set_p2p_confirmed(eee, ra.srcMac, &sender, now); - break; - } - case MSG_TYPE_REGISTER_SUPER_ACK: - { - // Indicates successful connection between the edge and SN nodes - static int bTrace = 1; - if (bTrace) - { - traceEvent(TRACE_NORMAL, "[OK] Edge Peer <<< ================ >>> Super Node"); - bTrace = 0; - } - - n2n_REGISTER_SUPER_ACK_t ra; - - if(eee->sn_wait) - { - decode_REGISTER_SUPER_ACK(&ra, &cmn, udp_buf, &rem, &idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify (eee, definitely_from_supernode, null_mac, stamp)) { - traceEvent(TRACE_DEBUG, "readFromIPSocket dropped REGISTER_SUPER_ACK due to time stamp error."); - return; - } - } - - if(is_valid_peer_sock(&ra.sock)) - orig_sender = &(ra.sock); - - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_ACK myMAC=%s [%s] (external %s). Attempts %u", - macaddr_str(mac_buf1, ra.edgeMac), - sock_to_cstr(sockbuf1, &sender), - sock_to_cstr(sockbuf2, orig_sender), - (unsigned int)eee->sup_attempts); - - if(memcmp(ra.edgeMac, eee->device.mac_addr, N2N_MAC_SIZE)) { - traceEvent(TRACE_INFO, "readFromIPSocket dropped REGISTER_SUPER_ACK due to wrong addressing."); - return; - } - - if(0 == memcmp(ra.cookie, eee->last_cookie, N2N_COOKIE_SIZE)) - { - if(ra.num_sn > 0) - { - traceEvent(TRACE_NORMAL, "Rx REGISTER_SUPER_ACK backup supernode at %s", - sock_to_cstr(sockbuf1, &(ra.sn_bak))); - } - - eee->last_sup = now; - eee->sn_wait=0; - eee->sup_attempts = N2N_EDGE_SUP_ATTEMPTS; /* refresh because we got a response */ - - if(eee->cb.sn_registration_updated) - eee->cb.sn_registration_updated(eee, now, &sender); - - /* NOTE: the register_interval should be chosen by the edge node - * based on its NAT configuration. */ - //eee->conf.register_interval = ra.lifetime; - } - else - { - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_ACK with wrong or old cookie."); - } - } - else - { - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_ACK with no outstanding REGISTER_SUPER."); - } - break; - } case MSG_TYPE_PEER_INFO: { - n2n_PEER_INFO_t pi; - struct peer_info * scan; - decode_PEER_INFO( &pi, &cmn, udp_buf, &rem, &idx ); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify (eee, definitely_from_supernode, null_mac, stamp)) { - traceEvent(TRACE_DEBUG, "readFromIPSocket dropped PEER_INFO due to time stamp error."); - return; - } - } - - if(!is_valid_peer_sock(&pi.sock)) { - traceEvent(TRACE_DEBUG, "Skip invalid PEER_INFO %s [%s]", - sock_to_cstr(sockbuf1, &pi.sock), - macaddr_str(mac_buf1, pi.mac) ); - break; - } - - HASH_FIND_PEER(eee->pending_peers, pi.mac, scan); - if(scan) { - scan->sock = pi.sock; - traceEvent(TRACE_INFO, "Rx PEER_INFO for %s: is at %s", - macaddr_str(mac_buf1, pi.mac), - sock_to_cstr(sockbuf1, &pi.sock)); - send_register(eee, &scan->sock, scan->mac_addr); - } else { - traceEvent(TRACE_INFO, "Rx PEER_INFO unknown peer %s", - macaddr_str(mac_buf1, pi.mac) ); - } - - break; - } - default: - /* Not a known message type */ - traceEvent(TRACE_WARNING, "Unable to handle packet type %d: ignored", (signed int)msg_type); - return; - } /* switch(msg_type) */ - } else if(from_supernode) /* if(community match) */ - traceEvent(TRACE_WARNING, "Received packet with unknown community"); - else - traceEvent(TRACE_INFO, "Ignoring packet with unknown community"); -} - -/* ************************************** */ - -void print_edge_stats(const n2n_edge_t *eee) { - const struct n2n_edge_stats *s = &eee->stats; - - traceEvent(TRACE_NORMAL, "**********************************"); - traceEvent(TRACE_NORMAL, "Packet stats:"); - traceEvent(TRACE_NORMAL, " TX P2P: %u pkts", s->tx_p2p); - traceEvent(TRACE_NORMAL, " RX P2P: %u pkts", s->rx_p2p); - traceEvent(TRACE_NORMAL, " TX Supernode: %u pkts (%u broadcast)", s->tx_sup, s->tx_sup_broadcast); - traceEvent(TRACE_NORMAL, " RX Supernode: %u pkts (%u broadcast)", s->rx_sup, s->rx_sup_broadcast); - traceEvent(TRACE_NORMAL, "**********************************"); -} - -/* ************************************** */ - -int run_edge_loop(n2n_edge_t * eee, int *keep_running) { - size_t numPurged; - time_t lastIfaceCheck=0; - time_t lastTransop=0; - time_t last_purge_known = 0; - time_t last_purge_pending = 0; - -#ifdef WIN32 - struct tunread_arg arg; - arg.eee = eee; - arg.keep_running = keep_running; - HANDLE tun_read_thread = startTunReadThread(&arg); -#endif - - *keep_running = 1; - update_supernode_reg(eee, time(NULL)); - - /* Main loop - * - * select() is used to wait for input on either the TAP fd or the UDP/TCP - * socket. When input is present the data is read and processed by either - * readFromIPSocket() or edge_read_from_tap() - */ - - while(*keep_running) { - int rc, max_sock = 0; - fd_set socket_mask; - struct timeval wait_time; - time_t nowTime; - - FD_ZERO(&socket_mask); - FD_SET(eee->udp_sock, &socket_mask); - FD_SET(eee->udp_mgmt_sock, &socket_mask); - max_sock = max(eee->udp_sock, eee->udp_mgmt_sock); - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - FD_SET(eee->udp_multicast_sock, &socket_mask); - max_sock = max(eee->udp_sock, eee->udp_multicast_sock); -#endif - -#ifndef WIN32 - FD_SET(eee->device.fd, &socket_mask); - max_sock = max(max_sock, eee->device.fd); -#endif - - wait_time.tv_sec = SOCKET_TIMEOUT_INTERVAL_SECS; wait_time.tv_usec = 0; - - rc = select(max_sock+1, &socket_mask, NULL, NULL, &wait_time); - nowTime=time(NULL); - - /* Make sure ciphers are updated before the packet is treated. */ - if((nowTime - lastTransop) > TRANSOP_TICK_INTERVAL) { - lastTransop = nowTime; - - eee->transop.tick(&eee->transop, nowTime); - } - - if(rc > 0) { - /* Any or all of the FDs could have input; check them all. */ - - if(FD_ISSET(eee->udp_sock, &socket_mask)) { - /* Read a cooked socket from the internet socket (unicast). Writes on the TAP - * socket. */ - readFromIPSocket(eee, eee->udp_sock); - } - - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if(FD_ISSET(eee->udp_multicast_sock, &socket_mask)) { - /* Read a cooked socket from the internet socket (multicast). Writes on the TAP - * socket. */ - traceEvent(TRACE_DEBUG, "Received packet from multicast socket"); - readFromIPSocket(eee, eee->udp_multicast_sock); - } -#endif - - if(FD_ISSET(eee->udp_mgmt_sock, &socket_mask)) { - /* Read a cooked socket from the internet socket. Writes on the TAP - * socket. */ - readFromMgmtSocket(eee, keep_running); - - if(!(*keep_running)) - break; - } - -#ifndef WIN32 - if(FD_ISSET(eee->device.fd, &socket_mask)) { - /* Read an ethernet frame from the TAP socket. Write on the IP - * socket. */ - edge_read_from_tap(eee); - } -#endif - } - - /* Finished processing select data. */ - update_supernode_reg(eee, nowTime); - - numPurged = purge_expired_registrations(&eee->known_peers, &last_purge_known); - numPurged += purge_expired_registrations(&eee->pending_peers, &last_purge_pending); - - if(numPurged > 0) { - traceEvent(TRACE_INFO, "%u peers removed. now: pending=%u, operational=%u", - numPurged, - HASH_COUNT(eee->pending_peers), - HASH_COUNT(eee->known_peers)); - } - - if(eee->conf.dyn_ip_mode && - ((nowTime - lastIfaceCheck) > IFACE_UPDATE_INTERVAL)) { - uint32_t old_ip = eee->device.ip_addr; - - traceEvent(TRACE_NORMAL, "Re-checking dynamic IP address."); - tuntap_get_address(&(eee->device)); - lastIfaceCheck = nowTime; - - if((old_ip != eee->device.ip_addr) && eee->cb.ip_address_changed) - eee->cb.ip_address_changed(eee, old_ip, eee->device.ip_addr); - } - - if (eee->cb.main_loop_period) - eee->cb.main_loop_period(eee, nowTime); - - } /* while */ - -#ifdef WIN32 - WaitForSingleObject(tun_read_thread, INFINITE); -#endif - - send_deregister(eee, &(eee->supernode)); - - closesocket(eee->udp_sock); - - return(0); -} - -/* ************************************** */ - -/** Deinitialise the edge and deallocate any owned memory. */ -void edge_term(n2n_edge_t * eee) { - if(eee->udp_sock >= 0) - closesocket(eee->udp_sock); - - if(eee->udp_mgmt_sock >= 0) - closesocket(eee->udp_mgmt_sock); - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if(eee->udp_multicast_sock >= 0) - closesocket(eee->udp_multicast_sock); -#endif - - clear_peer_list(&eee->pending_peers); - clear_peer_list(&eee->known_peers); - - eee->transop.deinit(&eee->transop); - - edge_cleanup_routes(eee); - - closeTraceFile(); - - free(eee); -} - -/* ************************************** */ - -static int edge_init_sockets(n2n_edge_t *eee, int udp_local_port, int mgmt_port, uint8_t tos) { - int sockopt; - - if(udp_local_port > 0) - traceEvent(TRACE_NORMAL, "Binding to local port %d", udp_local_port); - - eee->udp_sock = open_socket(udp_local_port, 1 /* bind ANY */); - if(eee->udp_sock < 0) { - traceEvent(TRACE_ERROR, "Failed to bind main UDP port %u", udp_local_port); - return(-1); - } - - if(tos) { - /* https://www.tucny.com/Home/dscp-tos */ - sockopt = tos; - - if(setsockopt(eee->udp_sock, IPPROTO_IP, IP_TOS, (char *)&sockopt, sizeof(sockopt)) == 0) - traceEvent(TRACE_NORMAL, "TOS set to 0x%x", tos); - else - traceEvent(TRACE_ERROR, "Could not set TOS 0x%x[%d]: %s", tos, errno, strerror(errno)); - } - -#ifdef IP_PMTUDISC_DO - sockopt = (eee->conf.disable_pmtu_discovery) ? IP_PMTUDISC_DONT : IP_PMTUDISC_DO; - - if(setsockopt(eee->udp_sock, IPPROTO_IP, IP_MTU_DISCOVER, &sockopt, sizeof(sockopt)) < 0) - traceEvent(TRACE_WARNING, "Could not %s PMTU discovery[%d]: %s", - (eee->conf.disable_pmtu_discovery) ? "disable" : "enable", errno, strerror(errno)); - else - traceEvent(TRACE_DEBUG, "PMTU discovery %s", (eee->conf.disable_pmtu_discovery) ? "disabled" : "enabled"); -#endif - - eee->udp_mgmt_sock = open_socket(mgmt_port, 0 /* bind LOOPBACK */); - if(eee->udp_mgmt_sock < 0) { - traceEvent(TRACE_ERROR, "Failed to bind management UDP port %u", mgmt_port); - return(-2); - } - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - /* Populate the multicast group for local edge */ - eee->multicast_peer.family = AF_INET; - eee->multicast_peer.port = N2N_MULTICAST_PORT; - eee->multicast_peer.addr.v4[0] = 224; /* N2N_MULTICAST_GROUP */ - eee->multicast_peer.addr.v4[1] = 0; - eee->multicast_peer.addr.v4[2] = 0; - eee->multicast_peer.addr.v4[3] = 68; - - eee->udp_multicast_sock = open_socket(N2N_MULTICAST_PORT, 1 /* bind ANY */); - if(eee->udp_multicast_sock < 0) - return(-3); - else { - u_int enable_reuse = 1; - - /* allow multiple sockets to use the same PORT number */ - setsockopt(eee->udp_multicast_sock, SOL_SOCKET, SO_REUSEADDR, (char *)&enable_reuse, sizeof(enable_reuse)); -#ifdef SO_REUSEPORT /* no SO_REUSEPORT in Windows / old linux versions */ - setsockopt(eee->udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse)); -#endif - } -#endif - - return(0); -} - -/* ************************************** */ - -#ifdef __linux__ - -static uint32_t get_gateway_ip() { - FILE *fd; - char *token = NULL; - char *gateway_ip_str = NULL; - char buf[256]; - uint32_t gateway = 0; - - if(!(fd = fopen("/proc/net/route", "r"))) - return(0); - - while(fgets(buf, sizeof(buf), fd)) { - if(strtok(buf, "\t") && (token = strtok(NULL, "\t")) && (!strcmp(token, "00000000"))) { - token = strtok(NULL, "\t"); - - if(token) { - struct in_addr addr; - - addr.s_addr = strtoul(token, NULL, 16); - gateway_ip_str = inet_ntoa(addr); - - if(gateway_ip_str) { - gateway = addr.s_addr; - break; - } - } - } - } - - fclose(fd); - - return(gateway); -} - -static char* route_cmd_to_str(int cmd, const n2n_route_t *route, char *buf, size_t bufsize) { - const char *cmd_str; - struct in_addr addr; - char netbuf[64], gwbuf[64]; - - switch(cmd) { - case RTM_NEWROUTE: - cmd_str = "Add"; - break; - case RTM_DELROUTE: - cmd_str = "Delete"; - break; - default: - cmd_str = "?"; - } - - addr.s_addr = route->net_addr; - inet_ntop(AF_INET, &addr, netbuf, sizeof(netbuf)); - addr.s_addr = route->gateway; - inet_ntop(AF_INET, &addr, gwbuf, sizeof(gwbuf)); - - snprintf(buf, bufsize, "%s %s/%d via %s", cmd_str, netbuf, route->net_bitlen, gwbuf); - - return(buf); -} - -/* Adapted from https://olegkutkov.me/2019/08/29/modifying-linux-network-routes-using-netlink/ */ -#define NLMSG_TAIL(nmsg) \ - ((struct rtattr *) (((char *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) - -/* Add new data to rtattr */ -static int rtattr_add(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen) -{ - int len = RTA_LENGTH(alen); - struct rtattr *rta; - - if(NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len) > maxlen) { - traceEvent(TRACE_ERROR, "rtattr_add error: message exceeded bound of %d\n", maxlen); - return -1; - } - - rta = NLMSG_TAIL(n); - rta->rta_type = type; - rta->rta_len = len; - - if(alen) - memcpy(RTA_DATA(rta), data, alen); - - n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len); - - return 0; -} - -static int routectl(int cmd, int flags, n2n_route_t *route, int if_idx) { - int rv = -1; - int rv2; - char nl_buf[8192]; /* >= 8192 to avoid truncation, see "man 7 netlink" */ - char route_buf[256]; - struct iovec iov; - struct msghdr msg; - struct sockaddr_nl sa; - uint8_t read_reply = 1; - int nl_sock; - - struct { - struct nlmsghdr n; - struct rtmsg r; - char buf[4096]; - } nl_request; - - if((nl_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) == -1) { - traceEvent(TRACE_ERROR, "netlink socket creation failed [%d]: %s", errno, strerror(errno)); - return(-1); - } - - /* Subscribe to route change events */ - iov.iov_base = nl_buf; - iov.iov_len = sizeof(nl_buf); - - memset(&sa, 0, sizeof(sa)); - sa.nl_family = PF_NETLINK; - sa.nl_groups = RTMGRP_IPV4_ROUTE | RTMGRP_NOTIFY; - sa.nl_pid = getpid(); - - memset(&msg, 0, sizeof(msg)); - msg.msg_name = &sa; - msg.msg_namelen = sizeof(sa); - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - /* Subscribe to route events */ - if(bind(nl_sock, (struct sockaddr*)&sa, sizeof(sa)) == -1) { - traceEvent(TRACE_ERROR, "netlink socket bind failed [%d]: %s", errno, strerror(errno)); - goto out; - } - - /* Initialize request structure */ - memset(&nl_request, 0, sizeof(nl_request)); - nl_request.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); - nl_request.n.nlmsg_flags = NLM_F_REQUEST | flags; - nl_request.n.nlmsg_type = cmd; - nl_request.r.rtm_family = AF_INET; - nl_request.r.rtm_table = RT_TABLE_MAIN; - nl_request.r.rtm_scope = RT_SCOPE_NOWHERE; - - /* Set additional flags if NOT deleting route */ - if(cmd != RTM_DELROUTE) { - nl_request.r.rtm_protocol = RTPROT_BOOT; - nl_request.r.rtm_type = RTN_UNICAST; - } - - nl_request.r.rtm_family = AF_INET; - nl_request.r.rtm_dst_len = route->net_bitlen; - - /* Select scope, for simplicity we supports here only IPv6 and IPv4 */ - if(nl_request.r.rtm_family == AF_INET6) - nl_request.r.rtm_scope = RT_SCOPE_UNIVERSE; - else - nl_request.r.rtm_scope = RT_SCOPE_LINK; - - /* Set gateway */ - if(route->net_bitlen) { - if(rtattr_add(&nl_request.n, sizeof(nl_request), RTA_GATEWAY, &route->gateway, 4) < 0) - goto out; - - nl_request.r.rtm_scope = 0; - nl_request.r.rtm_family = AF_INET; - } - - /* Don't set destination and interface in case of default gateways */ - if(route->net_bitlen) { - /* Set destination network */ - if(rtattr_add(&nl_request.n, sizeof(nl_request), /*RTA_NEWDST*/ RTA_DST, &route->net_addr, 4) < 0) - goto out; - - /* Set interface */ - if(if_idx > 0) { - if(rtattr_add(&nl_request.n, sizeof(nl_request), RTA_OIF, &if_idx, sizeof(int)) < 0) - goto out; - } - } - - /* Send message to the netlink */ - if((rv2 = send(nl_sock, &nl_request, sizeof(nl_request), 0)) != sizeof(nl_request)) { - traceEvent(TRACE_ERROR, "netlink send failed [%d]: %s", errno, strerror(errno)); - goto out; - } - - /* Wait for the route notification. Assume that the first reply we get is the correct one. */ - traceEvent(TRACE_DEBUG, "waiting for netlink response..."); - - while(read_reply) { - ssize_t len = recvmsg(nl_sock, &msg, 0); - struct nlmsghdr *nh; - - for(nh = (struct nlmsghdr *)nl_buf; NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len)) { - /* Stop after the first reply */ - read_reply = 0; - - if(nh->nlmsg_type == NLMSG_ERROR) { - struct nlmsgerr *err = NLMSG_DATA(nh); - int errcode = err->error; - - if(errcode < 0) - errcode = -errcode; - - /* Ignore EEXIST as existing rules are ok */ - if(errcode != EEXIST) { - traceEvent(TRACE_ERROR, "[err=%d] route: %s", errcode, route_cmd_to_str(cmd, route, route_buf, sizeof(route_buf))); - goto out; - } - } - - if(nh->nlmsg_type == NLMSG_DONE) - break; - - if(nh->nlmsg_type == cmd) { - traceEvent(TRACE_DEBUG, "Found netlink reply"); - break; - } - } - } - - traceEvent(TRACE_DEBUG, route_cmd_to_str(cmd, route, route_buf, sizeof(route_buf))); - rv = 0; - - out: - close(nl_sock); - - return(rv); -} -#endif - -/* ************************************** */ - -static int edge_init_routes_linux(n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_routes) { -#ifdef __linux__ - int i; - for (i = 0; inet_addr == 0) && (route->net_bitlen == 0)) { - /* This is a default gateway rule. We need to: - * - * 1. Add a route to the supernode via the host internet gateway - * 2. Add the new default gateway route - * - * Instead of modifying the system default gateway, we use the trick - * of adding a route to the networks 0.0.0.0/1 and 128.0.0.0/1, thus - * covering the whole IPv4 range. Such routes in linux take precedence - * over the default gateway (0.0.0.0/0) since are more specific. - * This leaves the default gateway unchanged so that after n2n is - * stopped the cleanup is easier. - * See https://github.com/zerotier/ZeroTierOne/issues/178#issuecomment-204599227 - */ - n2n_sock_t sn; - n2n_route_t custom_route; - uint32_t *a; - - if (eee->sn_route_to_clean) { - traceEvent(TRACE_ERROR, "Only one default gateway route allowed"); - return(-1); - } - - if (eee->conf.sn_num != 1) { - traceEvent(TRACE_ERROR, "Only one supernode supported with routes"); - return(-1); - } - - if (supernode2addr(&sn, eee->conf.sn_ip_array[0]) < 0) - return(-1); - - if (sn.family != AF_INET) { - traceEvent(TRACE_ERROR, "Only IPv4 routes supported"); - return(-1); - } - - a = (u_int32_t*)sn.addr.v4; - custom_route.net_addr = *a; - custom_route.net_bitlen = 32; - custom_route.gateway = get_gateway_ip(); - - if (!custom_route.gateway) { - traceEvent(TRACE_ERROR, "could not determine the gateway IP address"); - return(-1); - } - - /* ip route add supernode via internet_gateway */ - if (routectl(RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL, &custom_route, -1) < 0) - return(-1); - - /* Save the route to delete it when n2n is stopped */ - eee->sn_route_to_clean = calloc(1, sizeof(n2n_route_t)); - - /* Store a copy of the rules into the runtime to delete it during shutdown */ - if (eee->sn_route_to_clean) - *eee->sn_route_to_clean = custom_route; - - /* ip route add 0.0.0.0/1 via n2n_gateway */ - custom_route.net_addr = 0; - custom_route.net_bitlen = 1; - custom_route.gateway = route->gateway; - - if (routectl(RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL, &custom_route, eee->device.if_idx) < 0) - return(-1); - - /* ip route add 128.0.0.0/1 via n2n_gateway */ - custom_route.net_addr = 128; - custom_route.net_bitlen = 1; - custom_route.gateway = route->gateway; - - if (routectl(RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL, &custom_route, eee->device.if_idx) < 0) - return(-1); - } - else { - /* ip route add net via n2n_gateway */ - if (routectl(RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL, route, eee->device.if_idx) < 0) - return(-1); - } - } -#endif - - return(0); -} - -/* ************************************** */ - -static int edge_init_routes_win(n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_routes) -{ -#ifdef WIN32 - int i; - struct in_addr net_addr, gateway; - char c_net_addr[32]; - char c_gateway[32]; - char cmd[256]; - - for (i = 0; i < num_routes; i++) - { - n2n_route_t *route = &routes[i]; - if ((route->net_addr == 0) && (route->net_bitlen == 0)) - { - traceEvent(TRACE_NORMAL, "Warning: The 0.0.0.0/0 route settings are not supported on Windows"); - return (-1); - } - else - { - /* ip route add net via n2n_gateway */ - memcpy(&net_addr, &(route->net_addr), sizeof(net_addr)); - memcpy(&gateway, &(route->gateway), sizeof(gateway)); - _snprintf(c_net_addr, sizeof(c_net_addr), inet_ntoa(net_addr)); - _snprintf(c_gateway, sizeof(c_gateway), inet_ntoa(gateway)); - _snprintf(cmd, sizeof(cmd), "route add %s/%d %s > nul", c_net_addr, route->net_bitlen, c_gateway); - traceEvent(TRACE_NORMAL, "ROUTE CMD = '%s'\n", cmd); - system(cmd); - } - } - -#endif // WIN32 - - return (0); -} - -/* ************************************** */ - -/* Add the user-provided routes to the linux routing table. Network routes - * are bound to the n2n TAP device, so they are automatically removed when - * the TAP device is destroyed. */ -static int edge_init_routes(n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_routes) { -#ifdef __linux__ - return edge_init_routes_linux(eee, routes, num_routes); -#endif - -#ifdef WIN32 - return edge_init_routes_win(eee, routes, num_routes); -#endif - return 0; -} - -/* ************************************** */ - -static void edge_cleanup_routes(n2n_edge_t *eee) { -#ifdef __linux__ - if(eee->sn_route_to_clean) { - /* ip route del supernode via internet_gateway */ - routectl(RTM_DELROUTE, 0, eee->sn_route_to_clean, -1); - free(eee->sn_route_to_clean); - } -#endif -} - -/* ************************************** */ - -void edge_init_conf_defaults(n2n_edge_conf_t *conf) { - memset(conf, 0, sizeof(*conf)); - - conf->local_port = 0 /* any port */; - conf->mgmt_port = N2N_EDGE_MGMT_PORT; /* 5644 by default */ - conf->transop_id = N2N_TRANSFORM_ID_NULL; - conf->header_encryption = HEADER_ENCRYPTION_NONE; - conf->compression = N2N_COMPRESSION_ID_NONE; - conf->drop_multicast = 1; - conf->allow_p2p = 1; - conf->disable_pmtu_discovery = 1; - conf->register_interval = REGISTER_SUPER_INTERVAL_DFL; - - if(getenv("N2N_KEY")) { - conf->encrypt_key = strdup(getenv("N2N_KEY")); - conf->transop_id = N2N_TRANSFORM_ID_TWOFISH; - } -} - -/* ************************************** */ - -void edge_term_conf(n2n_edge_conf_t *conf) { - if(conf->routes) free(conf->routes); -} - -/* ************************************** */ - -const n2n_edge_conf_t* edge_get_conf(const n2n_edge_t *eee) { - return(&eee->conf); -} - -/* ************************************** */ - -int edge_conf_add_supernode(n2n_edge_conf_t *conf, const char *ip_and_port) { - if(conf->sn_num >= N2N_EDGE_NUM_SUPERNODES) - return(-1); - - strncpy((conf->sn_ip_array[conf->sn_num]), ip_and_port, N2N_EDGE_SN_HOST_SIZE); - traceEvent(TRACE_NORMAL, "Adding supernode[%u] = %s", (unsigned int)conf->sn_num, (conf->sn_ip_array[conf->sn_num])); - conf->sn_num++; - - return(0); -} - -/* ************************************** */ - -int quick_edge_init(char *device_name, char *community_name, - char *encrypt_key, char *device_mac, - char *local_ip_address, - char *supernode_ip_address_port, - int *keep_on_running) { - tuntap_dev tuntap; - n2n_edge_t *eee; - n2n_edge_conf_t conf; - int rv; - - /* Setup the configuration */ - edge_init_conf_defaults(&conf); - conf.encrypt_key = encrypt_key; - conf.transop_id = N2N_TRANSFORM_ID_TWOFISH; - snprintf((char*)conf.community_name, sizeof(conf.community_name), "%s", community_name); - edge_conf_add_supernode(&conf, supernode_ip_address_port); - - /* Validate configuration */ - if(edge_verify_conf(&conf) != 0) - return(-1); - - /* Open the tuntap device */ - if(tuntap_open(&tuntap, device_name, "static", - local_ip_address, "255.255.255.0", - device_mac, DEFAULT_MTU) < 0) - return(-2); - - /* Init edge */ - if((eee = edge_init(&tuntap, &conf, &rv)) == NULL) - goto quick_edge_init_end; - - rv = run_edge_loop(eee, keep_on_running); - edge_term(eee); - edge_term_conf(&conf); - - quick_edge_init_end: - tuntap_close(&tuntap); - return(rv); -} - -/* ************************************** */ diff --git a/bundles/n2n_ntop_v2/src/edge_utils_win32.c b/bundles/n2n_ntop_v2/src/edge_utils_win32.c deleted file mode 100644 index 306fd503..00000000 --- a/bundles/n2n_ntop_v2/src/edge_utils_win32.c +++ /dev/null @@ -1,49 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifdef WIN32 - -#include "edge_utils_win32.h" - -/* ************************************** */ - -static DWORD* tunReadThread(LPVOID lpArg) { - struct tunread_arg *arg = (struct tunread_arg*)lpArg; - - while(*arg->keep_running) - edge_read_from_tap(arg->eee); - - return((DWORD*)NULL); -} - -/* ************************************** */ - -/** Start a second thread in Windows because TUNTAP interfaces do not expose - * file descriptors. */ -HANDLE startTunReadThread(struct tunread_arg *arg) { - DWORD dwThreadId; - - return(CreateThread(NULL, /* security attributes */ - 0, /* use default stack size */ - (LPTHREAD_START_ROUTINE)tunReadThread, /* thread function */ - (void*)arg, /* argument to thread function */ - 0, /* thread creation flags */ - &dwThreadId)); /* thread id out */ -} -#endif - diff --git a/bundles/n2n_ntop_v2/src/example_edge_embed.c b/bundles/n2n_ntop_v2/src/example_edge_embed.c deleted file mode 100644 index ac809d5c..00000000 --- a/bundles/n2n_ntop_v2/src/example_edge_embed.c +++ /dev/null @@ -1,75 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -static int keep_running; - -int main() -{ - n2n_edge_conf_t conf; - tuntap_dev tuntap; - n2n_edge_t *eee; - int rc; - - edge_init_conf_defaults(&conf); - conf.allow_p2p = 1; // Whether to allow peer-to-peer communication - conf.allow_routing = 1; // Whether to allow the edge to route packets to other edges - snprintf((char *)conf.community_name, sizeof(conf.community_name), "%s", "mycommunity"); // Community to connect to - conf.disable_pmtu_discovery = 1; // Whether to disable the path MTU discovery - conf.drop_multicast = 0; // Whether to disable multicast - conf.dyn_ip_mode = 0; // Whether the IP address is set dynamically (see IP mode; 0 if static, 1 if dynamic) - conf.encrypt_key = "mysecret"; // Secret to decrypt & encrypt with - conf.local_port = 0; // What port to use (0 = any port) - conf.mgmt_port = N2N_EDGE_MGMT_PORT; // Edge management port (5644 by default) - conf.register_interval = 1; // Interval for both UDP NAT hole punching and supernode registration - conf.register_ttl = 1; // Interval for UDP NAT hole punching through supernode - edge_conf_add_supernode(&conf, "localhost:1234"); // Supernode to connect to - conf.tos = 16; // Type of service for sent packets - conf.transop_id = N2N_TRANSFORM_ID_TWOFISH; // Use the twofish encryption - - if (edge_verify_conf(&conf) != 0) - { - return -1; - } - - if (tuntap_open(&tuntap, - "edge0", // Name of the device to create - "static", // IP mode; static|dhcp - "10.0.0.1", // Set ip address - "255.255.255.0", // Netmask to use - "DE:AD:BE:EF:01:10", // Set mac address - DEFAULT_MTU) < 0) // MTU to use - { - return -1; - } - - eee = edge_init(&tuntap, &conf, &rc); - if (eee == NULL) - { - exit(1); - } - - keep_running = 1; - rc = run_edge_loop(eee, &keep_running); - - edge_term(eee); - tuntap_close(&tuntap); - - return rc; -} diff --git a/bundles/n2n_ntop_v2/src/example_edge_embed_quick_edge_init.c b/bundles/n2n_ntop_v2/src/example_edge_embed_quick_edge_init.c deleted file mode 100644 index 39d1cd0d..00000000 --- a/bundles/n2n_ntop_v2/src/example_edge_embed_quick_edge_init.c +++ /dev/null @@ -1,54 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -/* - This tool demonstrates how to easily embed - n2n on an existing application - */ - -int main(int argc, char* argv[]) { - char *device_name = (char*)"n2n0"; - char *network_name = (char*)"mynetwork"; - char *secret_key = (char*)"mysecret"; - char *my_mac_address = (char*)"DE:AD:BE:EF:01:10"; - char *my_ipv4_addr = (char*)"1.2.3.4"; - char *supernode = (char*)"7.8.9.10:1234"; - int keep_on_running = 1; - - /* Increase tracelevel to see what's happening */ - setTraceLevel(10); - - /* Random seed */ - n2n_srand (n2n_seed()); - - /* - NOTE - - As the function below won't end, you should - call it inside a separate thread - */ - return(quick_edge_init(device_name, - network_name, - secret_key, - my_mac_address, - my_ipv4_addr, - supernode, - &keep_on_running)); -} diff --git a/bundles/n2n_ntop_v2/src/example_sn_embed.c b/bundles/n2n_ntop_v2/src/example_sn_embed.c deleted file mode 100644 index 4428e694..00000000 --- a/bundles/n2n_ntop_v2/src/example_sn_embed.c +++ /dev/null @@ -1,50 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -static int keep_running; - -int main() -{ - n2n_sn_t sss_node; - int rc; - - sn_init(&sss_node); - sss_node.daemon = 0; // Whether to daemonize - sss_node.lport = 1234; // Main UDP listen port - - sss_node.sock = open_socket(sss_node.lport, 1); - if (-1 == sss_node.sock) - { - exit(-2); - } - - sss_node.mgmt_sock = open_socket(5645, 0); // Main UDP management port - if (-1 == sss_node.mgmt_sock) - { - exit(-2); - } - - keep_running = 1; - rc = run_sn_loop(&sss_node, &keep_running); - - sn_term(&sss_node); - - return rc; -} diff --git a/bundles/n2n_ntop_v2/src/header_encryption.c b/bundles/n2n_ntop_v2/src/header_encryption.c deleted file mode 100644 index c526726e..00000000 --- a/bundles/n2n_ntop_v2/src/header_encryption.c +++ /dev/null @@ -1,113 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - -#define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out) - -/* ********************************************************************** */ - -uint32_t packet_header_decrypt (uint8_t packet[], uint16_t packet_len, - char * community_name, he_context_t * ctx, - he_context_t * ctx_iv, uint64_t * stamp, uint16_t * checksum) { - - // assemble IV - // the last four are ASCII "n2n!" and do not get overwritten - uint8_t iv[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x6E, 0x32, 0x6E, 0x21 }; - // the first 96 bits of the packet get padded with ASCII "n2n!" - // to full 128 bit IV - memcpy (iv, packet, 12); - - // extract time stamp (first 64 bit) and checksum (last 16 bit) blended in IV - speck_he_iv_decrypt (iv, (speck_context_t*)ctx_iv); - *checksum = be16toh (((uint16_t*)iv)[5]); - *stamp = be64toh (((uint64_t*)iv)[0]); - - memcpy (iv, packet, 12); - - // try community name as possible key and check for magic bytes - uint32_t magic = 0x6E326E00; // ="n2n_" - uint32_t test_magic; - // check for magic bytes and reasonable value in header len field - // so, as a first step, decrypt 4 bytes only starting at byte 12 - speck_he ((uint8_t*)&test_magic, &packet[12], 4, iv, (speck_context_t*)ctx); - test_magic = be32toh (test_magic); - if( (((test_magic >> 8) << 8) == magic) // check the thre uppermost bytes - && (((uint8_t)test_magic) <= packet_len) // lowest 8 bit of test_magic are header_len - ) { - // decrypt the complete header - speck_he (&packet[12], &packet[12], (uint8_t)(test_magic) - 12, iv, (speck_context_t*)ctx); - // restore original packet order - memcpy (&packet[0], &packet[16], 4); - memcpy (&packet[4], community_name, N2N_COMMUNITY_SIZE); - return (1); // successful - } else - return (0); // unsuccessful -} - -/* ********************************************************************** */ - -int32_t packet_header_encrypt (uint8_t packet[], uint8_t header_len, he_context_t * ctx, - he_context_t * ctx_iv, uint64_t stamp, uint16_t checksum) { - - uint8_t iv[16]; - uint16_t *iv16 = (uint16_t*)&iv; - uint32_t *iv32 = (uint32_t*)&iv; - uint64_t *iv64 = (uint64_t*)&iv; - const uint32_t magic = 0x6E326E21; // = ASCII "n2n!" - - if(header_len < 20) { - traceEvent(TRACE_DEBUG, "packet_header_encrypt dropped a packet too short to be valid."); - return (-1); - } - - memcpy (&packet[16], &packet[00], 4); - - iv64[0] = htobe64 (stamp); - iv16[4] = n2n_rand (); - iv16[5] = htobe16 (checksum); - iv32[3] = htobe32 (magic); - // blend checksum into 96-bit IV - speck_he_iv_encrypt (iv, (speck_context_t*)ctx_iv); - - memcpy (packet, iv, 16); - packet[15] = header_len; - - speck_he (&packet[12], &packet[12], header_len - 12, iv, (speck_context_t*)ctx); - return (0); -} - -/* ********************************************************************** */ - -void packet_header_setup_key (const char * community_name, he_context_t ** ctx, - he_context_t ** ctx_iv) { - - uint8_t key[16]; - pearson_hash_128 (key, (uint8_t*)community_name, N2N_COMMUNITY_SIZE); - - *ctx = (he_context_t*)calloc(1, sizeof (speck_context_t)); - speck_expand_key_he (key, (speck_context_t*)*ctx); - - // hash again and use last 96 bit (skipping 4 bytes) as key for IV encryption - // REMOVE as soon as checksum and replay protection get their own fields - pearson_hash_128 (key, key, sizeof (key)); - *ctx_iv = (he_context_t*)calloc(1, sizeof (speck_context_t)); - speck_expand_key_he_iv (&key[4], (speck_context_t*)*ctx_iv); -} diff --git a/bundles/n2n_ntop_v2/src/minilzo.c b/bundles/n2n_ntop_v2/src/minilzo.c deleted file mode 100644 index 6a62b31b..00000000 --- a/bundles/n2n_ntop_v2/src/minilzo.c +++ /dev/null @@ -1,4112 +0,0 @@ -/* minilzo.c -- mini subset of the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer - Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - -/* - * NOTE: - * the full LZO package can be found at - * http://www.oberhumer.com/opensource/lzo/ - */ - -#define __LZO_IN_MINILZO -#define LZO_BUILD - -#if defined(LZO_CFG_FREESTANDING) -# undef MINILZO_HAVE_CONFIG_H -# define LZO_LIBC_FREESTANDING 1 -# define LZO_OS_FREESTANDING 1 -#endif - -#ifdef MINILZO_HAVE_CONFIG_H -# include -#endif -#include -#include -#if defined(MINILZO_CFG_USE_INTERNAL_LZODEFS) - -#ifndef __LZODEFS_H_INCLUDED -#define __LZODEFS_H_INCLUDED 1 - -#if defined(__CYGWIN32__) && !defined(__CYGWIN__) -# define __CYGWIN__ __CYGWIN32__ -#endif -#if defined(__IBMCPP__) && !defined(__IBMC__) -# define __IBMC__ __IBMCPP__ -#endif -#if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) -# define __INTEL_COMPILER __ICL -#endif -#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) -# define _ALL_SOURCE 1 -#endif -#if defined(__mips__) && defined(__R5900__) -# if !defined(__LONG_MAX__) -# define __LONG_MAX__ 9223372036854775807L -# endif -#endif -#if defined(__INTEL_COMPILER) && defined(__linux__) -# pragma warning(disable: 193) -#endif -#if defined(__KEIL__) && defined(__C166__) -# pragma warning disable = 322 -#elif 0 && defined(__C251__) -# pragma warning disable = 322 -#endif -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -# if (_MSC_VER >= 1300) -# pragma warning(disable: 4668) -# endif -#endif -#if 0 && defined(__WATCOMC__) -# if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) -# pragma warning 203 9 -# endif -#endif -#if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) -# pragma option -h -#endif -#if 0 -#define LZO_0xffffL 0xfffful -#define LZO_0xffffffffL 0xfffffffful -#else -#define LZO_0xffffL 65535ul -#define LZO_0xffffffffL 4294967295ul -#endif -#if (LZO_0xffffL == LZO_0xffffffffL) -# error "your preprocessor is broken 1" -#endif -#if (16ul * 16384ul != 262144ul) -# error "your preprocessor is broken 2" -#endif -#if 0 -#if (32767 >= 4294967295ul) -# error "your preprocessor is broken 3" -#endif -#if (65535u >= 4294967295ul) -# error "your preprocessor is broken 4" -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) -# if !defined(MSDOS) -# define MSDOS 1 -# endif -# if !defined(_MSDOS) -# define _MSDOS 1 -# endif -#elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) -# if (__VERSION == 520) && (MB_LEN_MAX == 1) -# if !defined(__AZTEC_C__) -# define __AZTEC_C__ __VERSION -# endif -# if !defined(__DOS__) -# define __DOS__ 1 -# endif -# endif -#endif -#endif -#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) -# define ptrdiff_t long -# define _PTRDIFF_T_DEFINED -#endif -#if (UINT_MAX == LZO_0xffffL) -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -# if defined(__AZTEC_C__) && defined(__DOS__) -# define __LZO_RENAME_A 1 -# elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define __LZO_RENAME_A 1 -# elif (_MSC_VER < 700) -# define __LZO_RENAME_B 1 -# endif -# elif defined(__TSC__) && defined(__OS2__) -# define __LZO_RENAME_A 1 -# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) -# define __LZO_RENAME_A 1 -# elif defined(__PACIFIC__) && defined(DOS) -# if !defined(__far) -# define __far far -# endif -# if !defined(__near) -# define __near near -# endif -# endif -# if defined(__LZO_RENAME_A) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif -# if !defined(__huge) -# define __huge huge -# endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# if !defined(__huge) -# define __huge huge -# endif -# elif defined(__LZO_RENAME_B) -# if !defined(__cdecl) -# define __cdecl _cdecl -# endif -# if !defined(__far) -# define __far _far -# endif -# if !defined(__huge) -# define __huge _huge -# endif -# if !defined(__near) -# define __near _near -# endif -# if !defined(__pascal) -# define __pascal _pascal -# endif -# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# endif -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__AZTEC_C__) && defined(__DOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -#elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# endif -# if (_MSC_VER < 700) -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# define LZO_BROKEN_SIZEOF 1 -# endif -#elif defined(__PACIFIC__) && defined(DOS) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#elif defined(__TURBOC__) && defined(__MSDOS__) -# if (__TURBOC__ < 0x0150) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# endif -# if (__TURBOC__ < 0x0200) -# define LZO_BROKEN_SIZEOF 1 -# endif -# if (__TURBOC__ < 0x0400) && defined(__cplusplus) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# endif -#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_SIZEOF 1 -#endif -#endif -#if defined(__WATCOMC__) && (__WATCOMC__ < 900) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#endif -#if defined(_CRAY) && defined(_CRAY1) -# define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 -#endif -#define LZO_PP_STRINGIZE(x) #x -#define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -#define LZO_PP_CONCAT2(a,b) a ## b -#define LZO_PP_CONCAT3(a,b,c) a ## b ## c -#define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) -#define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) -#define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) -#define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -#if 1 -#define LZO_CPP_STRINGIZE(x) #x -#define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -#define LZO_CPP_CONCAT2(a,b) a ## b -#define LZO_CPP_CONCAT3(a,b,c) a ## b ## c -#define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) -#define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) -#define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) -#define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -#endif -#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) -#if 1 && defined(__cplusplus) -# if !defined(__STDC_CONSTANT_MACROS) -# define __STDC_CONSTANT_MACROS 1 -# endif -# if !defined(__STDC_LIMIT_MACROS) -# define __STDC_LIMIT_MACROS 1 -# endif -#endif -#if defined(__cplusplus) -# define LZO_EXTERN_C extern "C" -#else -# define LZO_EXTERN_C extern -#endif -#if !defined(__LZO_OS_OVERRIDE) -#if defined(LZO_OS_FREESTANDING) -# define LZO_INFO_OS "freestanding" -#elif defined(LZO_OS_EMBEDDED) -# define LZO_INFO_OS "embedded" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_OS_EMBEDDED 1 -# define LZO_INFO_OS "embedded" -#elif defined(__CYGWIN__) && defined(__GNUC__) -# define LZO_OS_CYGWIN 1 -# define LZO_INFO_OS "cygwin" -#elif defined(__EMX__) && defined(__GNUC__) -# define LZO_OS_EMX 1 -# define LZO_INFO_OS "emx" -#elif defined(__BEOS__) -# define LZO_OS_BEOS 1 -# define LZO_INFO_OS "beos" -#elif defined(__Lynx__) -# define LZO_OS_LYNXOS 1 -# define LZO_INFO_OS "lynxos" -#elif defined(__OS400__) -# define LZO_OS_OS400 1 -# define LZO_INFO_OS "os400" -#elif defined(__QNX__) -# define LZO_OS_QNX 1 -# define LZO_INFO_OS "qnx" -#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__BORLANDC__) && defined(__DPMI16__) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -#elif defined(__ZTC__) && defined(DOS386) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__OS2__) || defined(__OS2V2__) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_OS216 1 -# define LZO_INFO_OS "os216" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_OS2 1 -# define LZO_INFO_OS "os2" -# else -# error "check your limits.h header" -# endif -#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) -# define LZO_OS_WIN64 1 -# define LZO_INFO_OS "win64" -#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__MWERKS__) && defined(__INTEL__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_WIN16 1 -# define LZO_INFO_OS "win16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# else -# error "check your limits.h header" -# endif -#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -# else -# error "check your limits.h header" -# endif -#elif defined(__WATCOMC__) -# if defined(__NT__) && (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif defined(__NT__) && (__WATCOMC__ < 1100) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# elif defined(__linux__) || defined(__LINUX__) -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -# else -# error "please specify a target using the -bt compiler option" -# endif -#elif defined(__palmos__) -# define LZO_OS_PALMOS 1 -# define LZO_INFO_OS "palmos" -#elif defined(__TOS__) || defined(__atarist__) -# define LZO_OS_TOS 1 -# define LZO_INFO_OS "tos" -#elif defined(macintosh) && !defined(__ppc__) -# define LZO_OS_MACCLASSIC 1 -# define LZO_INFO_OS "macclassic" -#elif defined(__VMS) -# define LZO_OS_VMS 1 -# define LZO_INFO_OS "vms" -#elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PS2 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "ps2" -#elif (defined(__mips__) && defined(__psp__)) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PSP 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "psp" -#else -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -#endif -#if (LZO_OS_POSIX) -# if defined(_AIX) || defined(__AIX__) || defined(__aix__) -# define LZO_OS_POSIX_AIX 1 -# define LZO_INFO_OS_POSIX "aix" -# elif defined(__FreeBSD__) -# define LZO_OS_POSIX_FREEBSD 1 -# define LZO_INFO_OS_POSIX "freebsd" -# elif defined(__hpux__) || defined(__hpux) -# define LZO_OS_POSIX_HPUX 1 -# define LZO_INFO_OS_POSIX "hpux" -# elif defined(__INTERIX) -# define LZO_OS_POSIX_INTERIX 1 -# define LZO_INFO_OS_POSIX "interix" -# elif defined(__IRIX__) || defined(__irix__) -# define LZO_OS_POSIX_IRIX 1 -# define LZO_INFO_OS_POSIX "irix" -# elif defined(__linux__) || defined(__linux) || defined(__LINUX__) -# define LZO_OS_POSIX_LINUX 1 -# define LZO_INFO_OS_POSIX "linux" -# elif defined(__APPLE__) || defined(__MACOS__) -# define LZO_OS_POSIX_MACOSX 1 -# define LZO_INFO_OS_POSIX "macosx" -# elif defined(__minix__) || defined(__minix) -# define LZO_OS_POSIX_MINIX 1 -# define LZO_INFO_OS_POSIX "minix" -# elif defined(__NetBSD__) -# define LZO_OS_POSIX_NETBSD 1 -# define LZO_INFO_OS_POSIX "netbsd" -# elif defined(__OpenBSD__) -# define LZO_OS_POSIX_OPENBSD 1 -# define LZO_INFO_OS_POSIX "openbsd" -# elif defined(__osf__) -# define LZO_OS_POSIX_OSF 1 -# define LZO_INFO_OS_POSIX "osf" -# elif defined(__solaris__) || defined(__sun) -# if defined(__SVR4) || defined(__svr4__) -# define LZO_OS_POSIX_SOLARIS 1 -# define LZO_INFO_OS_POSIX "solaris" -# else -# define LZO_OS_POSIX_SUNOS 1 -# define LZO_INFO_OS_POSIX "sunos" -# endif -# elif defined(__ultrix__) || defined(__ultrix) -# define LZO_OS_POSIX_ULTRIX 1 -# define LZO_INFO_OS_POSIX "ultrix" -# elif defined(_UNICOS) -# define LZO_OS_POSIX_UNICOS 1 -# define LZO_INFO_OS_POSIX "unicos" -# else -# define LZO_OS_POSIX_UNKNOWN 1 -# define LZO_INFO_OS_POSIX "unknown" -# endif -#endif -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (UINT_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -# define LZO_CC_CILLY 1 -# define LZO_INFO_CC "Cilly" -# if defined(__CILLY__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) -# define LZO_CC_SDCC 1 -# define LZO_INFO_CC "sdcc" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) -#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) -# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) -# define LZO_INFO_CC "Pathscale C" -# define LZO_INFO_CCVER __PATHSCALE__ -#elif defined(__INTEL_COMPILER) -# define LZO_CC_INTELC 1 -# define LZO_INFO_CC "Intel C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) -# if defined(_WIN32) || defined(_WIN64) -# define LZO_CC_SYNTAX_MSC 1 -# else -# define LZO_CC_SYNTAX_GNUC 1 -# endif -#elif defined(__POCC__) && defined(_WIN32) -# define LZO_CC_PELLESC 1 -# define LZO_INFO_CC "Pelles C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# else -# define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# endif -# define LZO_INFO_CC "llvm-gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) -# elif defined(__GNUC_MINOR__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) -# else -# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -# endif -# define LZO_INFO_CC "gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__ACK__) && defined(_ACK) -# define LZO_CC_ACK 1 -# define LZO_INFO_CC "Amsterdam Compiler Kit C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__AZTEC_C__) -# define LZO_CC_AZTECC 1 -# define LZO_INFO_CC "Aztec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) -#elif defined(__BORLANDC__) -# define LZO_CC_BORLANDC 1 -# define LZO_INFO_CC "Borland C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) -#elif defined(_CRAYC) && defined(_RELEASE) -# define LZO_CC_CRAYC 1 -# define LZO_INFO_CC "Cray C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) -#elif defined(__DMC__) && defined(__SC__) -# define LZO_CC_DMC 1 -# define LZO_INFO_CC "Digital Mars C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) -#elif defined(__DECC) -# define LZO_CC_DECC 1 -# define LZO_INFO_CC "DEC C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -#elif defined(__HIGHC__) -# define LZO_CC_HIGHC 1 -# define LZO_INFO_CC "MetaWare High C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__IAR_SYSTEMS_ICC__) -# define LZO_CC_IARC 1 -# define LZO_INFO_CC "IAR C" -# if defined(__VER__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__IBMC__) -# define LZO_CC_IBMC 1 -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -#elif defined(__KEIL__) && defined(__C166__) -# define LZO_CC_KEILC 1 -# define LZO_INFO_CC "Keil C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) -#elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) -# define LZO_CC_LCCWIN32 1 -# define LZO_INFO_CC "lcc-win32" -# define LZO_INFO_CCVER "unknown" -#elif defined(__LCC__) -# define LZO_CC_LCC 1 -# define LZO_INFO_CC "lcc" -# if defined(__LCC_VERSION__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(_MSC_VER) -# define LZO_CC_MSC 1 -# define LZO_INFO_CC "Microsoft C" -# if defined(_MSC_FULL_VER) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -# endif -#elif defined(__MWERKS__) -# define LZO_CC_MWERKS 1 -# define LZO_INFO_CC "Metrowerks C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) -#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -# define LZO_CC_NDPC 1 -# define LZO_INFO_CC "Microway NDP C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PACIFIC__) -# define LZO_CC_PACIFICC 1 -# define LZO_INFO_CC "Pacific C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) -# define LZO_CC_PGI 1 -# define LZO_INFO_CC "Portland Group PGI C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PUREC__) && defined(__TOS__) -# define LZO_CC_PUREC 1 -# define LZO_INFO_CC "Pure C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) -#elif defined(__SC__) && defined(__ZTC__) -# define LZO_CC_SYMANTECC 1 -# define LZO_INFO_CC "Symantec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) -#elif defined(__SUNPRO_C) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_C)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_C -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__SUNPRO_CC) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_CC)+0 > 0) -# define LZO_CC_SUNPROC __SUNPRO_CC -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__TINYC__) -# define LZO_CC_TINYC 1 -# define LZO_INFO_CC "Tiny C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) -#elif defined(__TSC__) -# define LZO_CC_TOPSPEEDC 1 -# define LZO_INFO_CC "TopSpeed C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) -#elif defined(__WATCOMC__) -# define LZO_CC_WATCOMC 1 -# define LZO_INFO_CC "Watcom C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) -#elif defined(__TURBOC__) -# define LZO_CC_TURBOC 1 -# define LZO_INFO_CC "Turbo C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) -#elif defined(__ZTC__) -# define LZO_CC_ZORTECHC 1 -# define LZO_INFO_CC "Zortech C" -# if (__ZTC__ == 0x310) -# define LZO_INFO_CCVER "0x310" -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) -# endif -#else -# define LZO_CC_UNKNOWN 1 -# define LZO_INFO_CC "unknown" -# define LZO_INFO_CCVER "unknown" -#endif -#if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) -# error "LZO_CC_MSC: _MSC_FULL_VER is not defined" -#endif -#if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) -# if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) -# if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) -# define LZO_ARCH_CRAY_MPP 1 -# elif defined(_CRAY1) -# define LZO_ARCH_CRAY_PVP 1 -# endif -# endif -#endif -#if !defined(__LZO_ARCH_OVERRIDE) -#if defined(LZO_ARCH_GENERIC) -# define LZO_INFO_ARCH "generic" -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086 1 -# define LZO_ARCH_IA16 1 -# define LZO_INFO_ARCH "i086" -#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) -# define LZO_ARCH_AMD64 1 -# define LZO_INFO_ARCH "amd64" -#elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB)) -# define LZO_ARCH_ARM 1 -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) -# define LZO_ARCH_ARM 1 -# if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) -# define LZO_ARCH_ARM_THUMB 1 -# define LZO_INFO_ARCH "arm_thumb" -# elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) -# define LZO_INFO_ARCH "arm" -# else -# define LZO_INFO_ARCH "arm" -# endif -#elif defined(__arm__) || defined(_M_ARM) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) -# define LZO_ARCH_AVR 1 -# define LZO_INFO_ARCH "avr" -#elif defined(__bfin__) -# define LZO_ARCH_BLACKFIN 1 -# define LZO_INFO_ARCH "blackfin" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) -# define LZO_ARCH_C166 1 -# define LZO_INFO_ARCH "c166" -#elif defined(__cris__) -# define LZO_ARCH_CRIS 1 -# define LZO_INFO_ARCH "cris" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) -# define LZO_ARCH_EZ80 1 -# define LZO_INFO_ARCH "ez80" -#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_ARCH_H8300 1 -# define LZO_INFO_ARCH "h8300" -#elif defined(__hppa__) || defined(__hppa) -# define LZO_ARCH_HPPA 1 -# define LZO_INFO_ARCH "hppa" -#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_CC_ZORTECHC && defined(__I86__)) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) -# define LZO_ARCH_IA64 1 -# define LZO_INFO_ARCH "ia64" -#elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__m32r__) -# define LZO_ARCH_M32R 1 -# define LZO_INFO_ARCH "m32r" -#elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) -# define LZO_ARCH_M68K 1 -# define LZO_INFO_ARCH "m68k" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) -# define LZO_ARCH_MCS251 1 -# define LZO_INFO_ARCH "mcs251" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) -# define LZO_ARCH_MIPS 1 -# define LZO_INFO_ARCH "mips" -#elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) -# define LZO_ARCH_S390 1 -# define LZO_INFO_ARCH "s390" -#elif defined(__sh__) || defined(_M_SH) -# define LZO_ARCH_SH 1 -# define LZO_INFO_ARCH "sh" -#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) -# define LZO_ARCH_SPARC 1 -# define LZO_INFO_ARCH "sparc" -#elif defined(__SPU__) -# define LZO_ARCH_SPU 1 -# define LZO_INFO_ARCH "spu" -#elif (UINT_MAX == LZO_0xffffL) && defined(__z80) -# define LZO_ARCH_Z80 1 -# define LZO_INFO_ARCH "z80" -#elif (LZO_ARCH_CRAY_PVP) -# if defined(_CRAYSV1) -# define LZO_ARCH_CRAY_SV1 1 -# define LZO_INFO_ARCH "cray_sv1" -# elif (_ADDR64) -# define LZO_ARCH_CRAY_T90 1 -# define LZO_INFO_ARCH "cray_t90" -# elif (_ADDR32) -# define LZO_ARCH_CRAY_YMP 1 -# define LZO_INFO_ARCH "cray_ymp" -# else -# define LZO_ARCH_CRAY_XMP 1 -# define LZO_INFO_ARCH "cray_xmp" -# endif -#else -# define LZO_ARCH_UNKNOWN 1 -# define LZO_INFO_ARCH "unknown" -#endif -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) -# error "FIXME - missing define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) -# error "FIXME - missing WIN32 define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) -# error "FIXME - missing WIN64 define for CPU architecture" -#endif -#if (LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(BLX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) -# define LZO_ARCH_I086PM 1 -# define LZO_ARCH_IA16PM 1 -#endif -#if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) -# error "this should not happen" -#endif -#if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) -# error "this should not happen" -#endif -#if (LZO_ARCH_I086) -# if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if (LZO_ARCH_I386) -# if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) -# error "this should not happen" -# endif -# if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) -# error "this should not happen" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "this should not happen" -# endif -#endif -#if !defined(__LZO_MM_OVERRIDE) -#if (LZO_ARCH_I086) -#if (UINT_MAX != LZO_0xffffL) -# error "this should not happen" -#endif -#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) -# define LZO_MM_TINY 1 -#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) -# define LZO_MM_HUGE 1 -#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) -# define LZO_MM_SMALL 1 -#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) -# define LZO_MM_MEDIUM 1 -#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) -# define LZO_MM_COMPACT 1 -#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) -# define LZO_MM_LARGE 1 -#elif (LZO_CC_AZTECC) -# if defined(_LARGE_CODE) && defined(_LARGE_DATA) -# define LZO_MM_LARGE 1 -# elif defined(_LARGE_CODE) -# define LZO_MM_MEDIUM 1 -# elif defined(_LARGE_DATA) -# define LZO_MM_COMPACT 1 -# else -# define LZO_MM_SMALL 1 -# endif -#elif (LZO_CC_ZORTECHC && defined(__VCM__)) -# define LZO_MM_LARGE 1 -#else -# error "unknown memory model" -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -#define LZO_HAVE_MM_HUGE_PTR 1 -#define LZO_HAVE_MM_HUGE_ARRAY 1 -#if (LZO_MM_TINY) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) -# undef LZO_HAVE_MM_HUGE_PTR -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_MSC && defined(_QC)) -# undef LZO_HAVE_MM_HUGE_ARRAY -# if (_MSC_VER < 600) -# undef LZO_HAVE_MM_HUGE_PTR -# endif -#elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) -# if (LZO_OS_DOS16) -# error "this should not happen" -# elif (LZO_CC_ZORTECHC) -# else -# error "this should not happen" -# endif -#endif -#ifdef __cplusplus -extern "C" { -#endif -#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) -# define LZO_MM_AHSHIFT 12 -#elif (LZO_CC_WATCOMC) - extern unsigned char _HShift; -# define LZO_MM_AHSHIFT ((unsigned) _HShift) -#else -# error "FIXME - implement LZO_MM_AHSHIFT" -#endif -#ifdef __cplusplus -} -#endif -#endif -#elif (LZO_ARCH_C166) -#if !defined(__MODEL__) -# error "FIXME - C166 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - C166 __MODEL__" -#endif -#elif (LZO_ARCH_MCS251) -#if !defined(__MODEL__) -# error "FIXME - MCS251 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS251 __MODEL__" -#endif -#elif (LZO_ARCH_MCS51) -#if !defined(__MODEL__) -# error "FIXME - MCS51 __MODEL__" -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - MCS51 __MODEL__" -#endif -#elif (LZO_ARCH_CRAY_PVP) -# define LZO_MM_PVP 1 -#else -# define LZO_MM_FLAT 1 -#endif -#if (LZO_MM_COMPACT) -# define LZO_INFO_MM "compact" -#elif (LZO_MM_FLAT) -# define LZO_INFO_MM "flat" -#elif (LZO_MM_HUGE) -# define LZO_INFO_MM "huge" -#elif (LZO_MM_LARGE) -# define LZO_INFO_MM "large" -#elif (LZO_MM_MEDIUM) -# define LZO_INFO_MM "medium" -#elif (LZO_MM_PVP) -# define LZO_INFO_MM "pvp" -#elif (LZO_MM_SMALL) -# define LZO_INFO_MM "small" -#elif (LZO_MM_TINY) -# define LZO_INFO_MM "tiny" -#else -# error "unknown memory model" -#endif -#endif -#if defined(SIZEOF_SHORT) -# define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -#endif -#if defined(SIZEOF_INT) -# define LZO_SIZEOF_INT (SIZEOF_INT) -#endif -#if defined(SIZEOF_LONG) -# define LZO_SIZEOF_LONG (SIZEOF_LONG) -#endif -#if defined(SIZEOF_LONG_LONG) -# define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -#endif -#if defined(SIZEOF___INT16) -# define LZO_SIZEOF___INT16 (SIZEOF___INT16) -#endif -#if defined(SIZEOF___INT32) -# define LZO_SIZEOF___INT32 (SIZEOF___INT32) -#endif -#if defined(SIZEOF___INT64) -# define LZO_SIZEOF___INT64 (SIZEOF___INT64) -#endif -#if defined(SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -#endif -#if defined(SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -#endif -#if defined(SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -#endif -#define __LZO_LSR(x,b) (((x)+0ul) >> (b)) -#if !defined(LZO_SIZEOF_SHORT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_SHORT 8 -# elif (USHRT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,7) == 1) -# define LZO_SIZEOF_SHORT 1 -# elif (__LZO_LSR(USHRT_MAX,15) == 1) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,31) == 1) -# define LZO_SIZEOF_SHORT 4 -# elif (__LZO_LSR(USHRT_MAX,63) == 1) -# define LZO_SIZEOF_SHORT 8 -# elif (__LZO_LSR(USHRT_MAX,127) == 1) -# define LZO_SIZEOF_SHORT 16 -# else -# error "LZO_SIZEOF_SHORT" -# endif -#endif -#if !defined(LZO_SIZEOF_INT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_INT 8 -# elif (UINT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_INT 2 -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,7) == 1) -# define LZO_SIZEOF_INT 1 -# elif (__LZO_LSR(UINT_MAX,15) == 1) -# define LZO_SIZEOF_INT 2 -# elif (__LZO_LSR(UINT_MAX,31) == 1) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,63) == 1) -# define LZO_SIZEOF_INT 8 -# elif (__LZO_LSR(UINT_MAX,127) == 1) -# define LZO_SIZEOF_INT 16 -# else -# error "LZO_SIZEOF_INT" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG) -# if (ULONG_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,7) == 1) -# define LZO_SIZEOF_LONG 1 -# elif (__LZO_LSR(ULONG_MAX,15) == 1) -# define LZO_SIZEOF_LONG 2 -# elif (__LZO_LSR(ULONG_MAX,31) == 1) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,63) == 1) -# define LZO_SIZEOF_LONG 8 -# elif (__LZO_LSR(ULONG_MAX,127) == 1) -# define LZO_SIZEOF_LONG 16 -# else -# error "LZO_SIZEOF_LONG" -# endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -# if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) -# if (LZO_CC_GNUC >= 0x030300ul) -# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) -# define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG -# elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) -# define LZO_SIZEOF_LONG_LONG 4 -# endif -# endif -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -#if (LZO_ARCH_I086 && LZO_CC_DMC) -#elif (LZO_CC_CILLY) && defined(__GNUC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_SIZEOF_LONG_LONG 8 -#elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_OS_WIN64 || defined(_WIN64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_DMC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) -#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define LZO_SIZEOF_LONG_LONG 8 -#endif -#endif -#endif -#if defined(__cplusplus) && defined(LZO_CC_GNUC) -# if (LZO_CC_GNUC < 0x020800ul) -# undef LZO_SIZEOF_LONG_LONG -# endif -#endif -#if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#endif -#if !defined(LZO_SIZEOF_VOID_P) -#if (LZO_ARCH_I086) -# define __LZO_WORDSIZE 2 -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -# define LZO_SIZEOF_VOID_P 2 -# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -# define LZO_SIZEOF_VOID_P 4 -# else -# error "LZO_MM" -# endif -#elif (LZO_ARCH_AVR || LZO_ARCH_Z80) -# define __LZO_WORDSIZE 1 -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_H8300) -# if defined(__NORMAL_MODE__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 2 -# elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define __LZO_WORDSIZE 4 -# define LZO_SIZEOF_VOID_P 4 -# else -# define __LZO_WORDSIZE 2 -# define LZO_SIZEOF_VOID_P 2 -# endif -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT -# endif -#elif (LZO_ARCH_M16C) -# define __LZO_WORDSIZE 2 -# if defined(__m32c_cpu__) || defined(__m32cm_cpu__) -# define LZO_SIZEOF_VOID_P 4 -# else -# define LZO_SIZEOF_VOID_P 2 -# endif -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 4 -#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -# define __LZO_WORDSIZE 8 -# define LZO_SIZEOF_VOID_P 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_OS_OS400 || defined(__OS400__)) -# define __LZO_WORDSIZE LZO_SIZEOF_LONG -# define LZO_SIZEOF_VOID_P 16 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#elif (LZO_ARCH_SPU) -# if 0 -# define __LZO_WORDSIZE 16 -# endif -# define LZO_SIZEOF_VOID_P 4 -#else -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -#endif -#endif -#if !defined(LZO_WORDSIZE) -# if defined(__LZO_WORDSIZE) -# define LZO_WORDSIZE __LZO_WORDSIZE -# else -# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -# endif -#endif -#if !defined(LZO_SIZEOF_SIZE_T) -#if (LZO_ARCH_I086 || LZO_ARCH_M16C) -# define LZO_SIZEOF_SIZE_T 2 -#else -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P -#endif -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -#if (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P -# elif (LZO_MM_COMPACT || LZO_MM_LARGE) -# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) -# define LZO_SIZEOF_PTRDIFF_T 4 -# else -# define LZO_SIZEOF_PTRDIFF_T 2 -# endif -# else -# error "LZO_MM" -# endif -#else -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T -#endif -#endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) -# undef LZO_ABI_BIG_ENDIAN -# undef LZO_ABI_LITTLE_ENDIAN -#elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) -#if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) -# define LZO_ABI_BIG_ENDIAN 1 -#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_M68K || LZO_ARCH_S390) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) -# if (__LITTLE_ENDIAN__ == 1) -# define LZO_ABI_LITTLE_ENDIAN 1 -# else -# define LZO_ABI_BIG_ENDIAN 1 -# endif -#elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#endif -#endif -#if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) -# error "this should not happen" -#endif -#if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "be" -#elif defined(LZO_ABI_LITTLE_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "le" -#elif defined(LZO_ABI_NEUTRAL_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "neutral" -#endif -#if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_I8LP16 1 -# define LZO_INFO_ABI_PM "i8lp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_ILP16 1 -# define LZO_INFO_ABI_PM "ilp16" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_ILP32 1 -# define LZO_INFO_ABI_PM "ilp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) -# define LZO_ABI_LLP64 1 -# define LZO_INFO_ABI_PM "llp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_LP64 1 -# define LZO_INFO_ABI_PM "lp64" -#elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_ILP64 1 -# define LZO_INFO_ABI_PM "ilp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_IP32L64 1 -# define LZO_INFO_ABI_PM "ip32l64" -#endif -#if !defined(__LZO_LIBC_OVERRIDE) -#if defined(LZO_LIBC_NAKED) -# define LZO_INFO_LIBC "naked" -#elif defined(LZO_LIBC_FREESTANDING) -# define LZO_INFO_LIBC "freestanding" -#elif defined(LZO_LIBC_MOSTLY_FREESTANDING) -# define LZO_INFO_LIBC "mfreestanding" -#elif defined(LZO_LIBC_ISOC90) -# define LZO_INFO_LIBC "isoc90" -#elif defined(LZO_LIBC_ISOC99) -# define LZO_INFO_LIBC "isoc99" -#elif defined(__dietlibc__) -# define LZO_LIBC_DIETLIBC 1 -# define LZO_INFO_LIBC "dietlibc" -#elif defined(_NEWLIB_VERSION) -# define LZO_LIBC_NEWLIB 1 -# define LZO_INFO_LIBC "newlib" -#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) -# if defined(__UCLIBC_SUBLEVEL__) -# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) -# else -# define LZO_LIBC_UCLIBC 0x00090bL -# endif -# define LZO_INFO_LIBC "uclibc" -#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) -# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) -# define LZO_INFO_LIBC "glibc" -#elif (LZO_CC_MWERKS) && defined(__MSL__) -# define LZO_LIBC_MSL __MSL__ -# define LZO_INFO_LIBC "msl" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#else -# define LZO_LIBC_DEFAULT 1 -# define LZO_INFO_LIBC "default" -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -#if (LZO_CC_GNUC >= 0x020800ul) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_gnuc_extension__ __extension__ -#else -# define __lzo_gnuc_extension__ -#endif -#endif -#if !defined(__lzo_ua_volatile) -# define __lzo_ua_volatile volatile -#endif -#if !defined(__lzo_alignof) -#if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_alignof(e) __alignof(e) -#endif -#endif -#if defined(__lzo_alignof) -# define __lzo_HAVE_alignof 1 -#endif -#if !defined(__lzo_constructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_constructor __attribute__((__constructor__)) -#endif -#endif -#if defined(__lzo_constructor) -# define __lzo_HAVE_constructor 1 -#endif -#if !defined(__lzo_destructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_destructor __attribute__((__destructor__)) -#endif -#endif -#if defined(__lzo_destructor) -# define __lzo_HAVE_destructor 1 -#endif -#if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) -# error "this should not happen" -#endif -#if !defined(__lzo_inline) -#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -#elif defined(__cplusplus) -# define __lzo_inline inline -#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -# define __lzo_inline __inline -#elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_inline __inline__ -#elif (LZO_CC_DMC) -# define __lzo_inline __inline -#elif (LZO_CC_INTELC) -# define __lzo_inline __inline -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -# define __lzo_inline __inline -#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -# define __lzo_inline __inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define __lzo_inline inline -#endif -#endif -#if defined(__lzo_inline) -# define __lzo_HAVE_inline 1 -#else -# define __lzo_inline -#endif -#if !defined(__lzo_forceinline) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_forceinline __forceinline -#endif -#endif -#if defined(__lzo_forceinline) -# define __lzo_HAVE_forceinline 1 -#else -# define __lzo_forceinline -#endif -#if !defined(__lzo_noinline) -#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -# define __lzo_noinline __attribute__((__noinline__,__used__)) -#elif (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -# if defined(__cplusplus) -# else -# define __lzo_noinline __declspec(noinline) -# endif -#endif -#endif -#if defined(__lzo_noinline) -# define __lzo_HAVE_noinline 1 -#else -# define __lzo_noinline -#endif -#if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) -# error "this should not happen" -#endif -#if !defined(__lzo_noreturn) -#if (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_noreturn __declspec(noreturn) -#endif -#endif -#if defined(__lzo_noreturn) -# define __lzo_HAVE_noreturn 1 -#else -# define __lzo_noreturn -#endif -#if !defined(__lzo_nothrow) -#if (LZO_CC_GNUC >= 0x030300ul) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#endif -#endif -#if defined(__lzo_nothrow) -# define __lzo_HAVE_nothrow 1 -#else -# define __lzo_nothrow -#endif -#if !defined(__lzo_restrict) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_LLVM) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -# define __lzo_restrict __restrict -#endif -#endif -#if defined(__lzo_restrict) -# define __lzo_HAVE_restrict 1 -#else -# define __lzo_restrict -#endif -#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#endif -#endif -#if defined(__lzo_likely) -# define __lzo_HAVE_likely 1 -#else -# define __lzo_likely(e) (e) -#endif -#if defined(__lzo_unlikely) -# define __lzo_HAVE_unlikely 1 -#else -# define __lzo_unlikely(e) (e) -#endif -#if !defined(LZO_UNUSED) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNUSED(var) ((void) var) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_KEILC) -# define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} -# elif (LZO_CC_PACIFICC) -# define LZO_UNUSED(var) ((void) sizeof(var)) -# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED(var) ((void) var) -# else -# define LZO_UNUSED(var) ((void) &var) -# endif -#endif -#if !defined(LZO_UNUSED_FUNC) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED_FUNC(func) ((void) func) -# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_LLVM) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_MSC) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -# define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} -# else -# define LZO_UNUSED_FUNC(func) ((void) func) -# endif -#endif -#if !defined(LZO_UNUSED_LABEL) -# if (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# elif (LZO_CC_INTELC || LZO_CC_WATCOMC) -# define LZO_UNUSED_LABEL(l) if (0) goto l -# else -# define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l -# endif -#endif -#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -# if 0 -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -# elif 0 && (LZO_CC_GNUC) -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -# else -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; -# else -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT) -# if (LZO_CC_AZTECC) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} -# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# else -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} -# endif -#endif -#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit -# define __lzo_cdecl_main __cdecl -# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_qsort __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_qsort _stdcall -# else -# define __lzo_cdecl_qsort __cdecl -# endif -# elif (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -# else -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit __cdecl -# define __lzo_cdecl_main __cdecl -# define __lzo_cdecl_qsort __cdecl -# endif -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_sighandler __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_sighandler _stdcall -# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -# define __lzo_cdecl_sighandler __clrcall -# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -# if defined(_DLL) -# define __lzo_cdecl_sighandler _far _cdecl _loadds -# elif defined(_MT) -# define __lzo_cdecl_sighandler _far _cdecl -# else -# define __lzo_cdecl_sighandler _cdecl -# endif -# else -# define __lzo_cdecl_sighandler __cdecl -# endif -#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -# define __lzo_cdecl cdecl -#endif -#if !defined(__lzo_cdecl) -# define __lzo_cdecl -#endif -#if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit -#endif -#if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main -#endif -#if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort -#endif -#if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler -#endif -#if !defined(__lzo_cdecl_va) -# define __lzo_cdecl_va __lzo_cdecl -#endif -#if !defined(LZO_CFG_NO_WINDOWS_H) -#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -# elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) -# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -# else -# define LZO_HAVE_WINDOWS_H 1 -# endif -#endif -#endif -#if (LZO_ARCH_ALPHA) -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_AMD64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# define LZO_OPT_UNALIGNED64 1 -#elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) -#elif (LZO_ARCH_ARM) -# define LZO_OPT_AVOID_SHORT 1 -# define LZO_OPT_AVOID_USHORT 1 -#elif (LZO_ARCH_CRIS) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_I386) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -#elif (LZO_ARCH_IA64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_PREFER_POSTINC 1 -#elif (LZO_ARCH_M68K) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(__mc68020__) && !defined(__mcoldfire__) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_MIPS) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_POWERPC) -# define LZO_OPT_PREFER_PREINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(LZO_ABI_BIG_ENDIAN) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_S390) -# define LZO_OPT_UNALIGNED16 1 -# define LZO_OPT_UNALIGNED32 1 -# if (LZO_SIZEOF_SIZE_T == 8) -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_SH) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -#endif -#if !defined(LZO_CFG_NO_INLINE_ASM) -#if defined(LZO_CC_LLVM) -# define LZO_CFG_NO_INLINE_ASM 1 -#endif -#endif -#if !defined(LZO_CFG_NO_UNALIGNED) -#if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) -# define LZO_CFG_NO_UNALIGNED 1 -#endif -#endif -#if defined(LZO_CFG_NO_UNALIGNED) -# undef LZO_OPT_UNALIGNED16 -# undef LZO_OPT_UNALIGNED32 -# undef LZO_OPT_UNALIGNED64 -#endif -#if defined(LZO_CFG_NO_INLINE_ASM) -#elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -# define LZO_ASM_SYNTAX_MSC 1 -#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#endif -#if (LZO_ASM_SYNTAX_GNUC) -#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -# define __LZO_ASM_CLOBBER "ax" -#elif (LZO_CC_INTELC) -# define __LZO_ASM_CLOBBER "memory" -#else -# define __LZO_ASM_CLOBBER "cc", "memory" -#endif -#endif -#if defined(__LZO_INFOSTR_MM) -#elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) -# define __LZO_INFOSTR_MM "" -#elif defined(LZO_INFO_MM) -# define __LZO_INFOSTR_MM "." LZO_INFO_MM -#else -# define __LZO_INFOSTR_MM "" -#endif -#if defined(__LZO_INFOSTR_PM) -#elif defined(LZO_INFO_ABI_PM) -# define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM -#else -# define __LZO_INFOSTR_PM "" -#endif -#if defined(__LZO_INFOSTR_ENDIAN) -#elif defined(LZO_INFO_ABI_ENDIAN) -# define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN -#else -# define __LZO_INFOSTR_ENDIAN "" -#endif -#if defined(__LZO_INFOSTR_OSNAME) -#elif defined(LZO_INFO_OS_CONSOLE) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE -#elif defined(LZO_INFO_OS_POSIX) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX -#else -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS -#endif -#if defined(__LZO_INFOSTR_LIBC) -#elif defined(LZO_INFO_LIBC) -# define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC -#else -# define __LZO_INFOSTR_LIBC "" -#endif -#if defined(__LZO_INFOSTR_CCVER) -#elif defined(LZO_INFO_CCVER) -# define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER -#else -# define __LZO_INFOSTR_CCVER "" -#endif -#define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER - -#endif - -#endif - -#undef LZO_HAVE_CONFIG_H -#include "minilzo.h" - -#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2030) -# error "version mismatch in miniLZO source files" -#endif - -#ifdef MINILZO_HAVE_CONFIG_H -# define LZO_HAVE_CONFIG_H -#endif - -#ifndef __LZO_CONF_H -#define __LZO_CONF_H - -#if !defined(__LZO_IN_MINILZO) -#if defined(LZO_CFG_FREESTANDING) -# define LZO_LIBC_FREESTANDING 1 -# define LZO_OS_FREESTANDING 1 -# define ACC_LIBC_FREESTANDING 1 -# define ACC_OS_FREESTANDING 1 -#endif -#if defined(LZO_CFG_NO_UNALIGNED) -# define ACC_CFG_NO_UNALIGNED 1 -#endif -#if defined(LZO_ARCH_GENERIC) -# define ACC_ARCH_GENERIC 1 -#endif -#if defined(LZO_ABI_NEUTRAL_ENDIAN) -# define ACC_ABI_NEUTRAL_ENDIAN 1 -#endif -#if defined(LZO_HAVE_CONFIG_H) -# define ACC_CONFIG_NO_HEADER 1 -#endif -#if defined(LZO_CFG_EXTRA_CONFIG_HEADER) -# include LZO_CFG_EXTRA_CONFIG_HEADER -#endif -#if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED) -# error "include this file first" -#endif -#include "lzo/lzoconf.h" -#endif - -#if (LZO_VERSION < 0x02000) || !defined(__LZOCONF_H_INCLUDED) -# error "version mismatch" -#endif - -#if (LZO_CC_BORLANDC && LZO_ARCH_I086) -# pragma option -h -#endif - -#if (LZO_CC_MSC && (_MSC_VER >= 1000)) -# pragma warning(disable: 4127 4701) -#endif -#if (LZO_CC_MSC && (_MSC_VER >= 1300)) -# pragma warning(disable: 4820) -# pragma warning(disable: 4514 4710 4711) -#endif - -#if (LZO_CC_SUNPROC) -# pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED) -# pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP) -#endif - -#if defined(__LZO_MMODEL_HUGE) && (!LZO_HAVE_MM_HUGE_PTR) -# error "this should not happen - check defines for __huge" -#endif - -#if defined(__LZO_IN_MINILZO) || defined(LZO_CFG_FREESTANDING) -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define ACC_WANT_ACC_INCD_H 1 -# define ACC_WANT_ACC_INCE_H 1 -# define ACC_WANT_ACC_INCI_H 1 -#elif 1 -# include -#else -# define ACC_WANT_ACC_INCD_H 1 -#endif - -#if (LZO_ARCH_I086) -# define ACC_MM_AHSHIFT LZO_MM_AHSHIFT -# define ACC_PTR_FP_OFF(x) (((const unsigned __far*)&(x))[0]) -# define ACC_PTR_FP_SEG(x) (((const unsigned __far*)&(x))[1]) -# define ACC_PTR_MK_FP(s,o) ((void __far*)(((unsigned long)(s)<<16)+(unsigned)(o))) -#endif - -#if !defined(lzo_uintptr_t) -# if defined(__LZO_MMODEL_HUGE) -# define lzo_uintptr_t unsigned long -# elif 1 && defined(LZO_OS_OS400) && (LZO_SIZEOF_VOID_P == 16) -# define __LZO_UINTPTR_T_IS_POINTER 1 - typedef char* lzo_uintptr_t; -# define lzo_uintptr_t lzo_uintptr_t -# elif (LZO_SIZEOF_SIZE_T == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t size_t -# elif (LZO_SIZEOF_LONG == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t unsigned long -# elif (LZO_SIZEOF_INT == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t unsigned int -# elif (LZO_SIZEOF_LONG_LONG == LZO_SIZEOF_VOID_P) -# define lzo_uintptr_t unsigned long long -# else -# define lzo_uintptr_t size_t -# endif -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - -#if 1 && !defined(LZO_CFG_FREESTANDING) -#if 1 && !defined(HAVE_STRING_H) -#define HAVE_STRING_H 1 -#endif -#if 1 && !defined(HAVE_MEMCMP) -#define HAVE_MEMCMP 1 -#endif -#if 1 && !defined(HAVE_MEMCPY) -#define HAVE_MEMCPY 1 -#endif -#if 1 && !defined(HAVE_MEMMOVE) -#define HAVE_MEMMOVE 1 -#endif -#if 1 && !defined(HAVE_MEMSET) -#define HAVE_MEMSET 1 -#endif -#endif - -#if 1 && defined(HAVE_STRING_H) -#include -#endif - -#if defined(LZO_CFG_FREESTANDING) -# undef HAVE_MEMCMP -# undef HAVE_MEMCPY -# undef HAVE_MEMMOVE -# undef HAVE_MEMSET -#endif - -#if !defined(HAVE_MEMCMP) -# undef memcmp -# define memcmp(a,b,c) lzo_memcmp(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memcmp(a,b,c) memcmp(a,b,c) -#endif -#if !defined(HAVE_MEMCPY) -# undef memcpy -# define memcpy(a,b,c) lzo_memcpy(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memcpy(a,b,c) memcpy(a,b,c) -#endif -#if !defined(HAVE_MEMMOVE) -# undef memmove -# define memmove(a,b,c) lzo_memmove(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memmove(a,b,c) memmove(a,b,c) -#endif -#if !defined(HAVE_MEMSET) -# undef memset -# define memset(a,b,c) lzo_memset(a,b,c) -#elif !defined(__LZO_MMODEL_HUGE) -# define lzo_memset(a,b,c) memset(a,b,c) -#endif - -#undef NDEBUG -#if defined(LZO_CFG_FREESTANDING) -# undef LZO_DEBUG -# define NDEBUG 1 -# undef assert -# define assert(e) ((void)0) -#else -# if !defined(LZO_DEBUG) -# define NDEBUG 1 -# endif -# include -#endif - -#if 0 && defined(__BOUNDS_CHECKING_ON) -# include -#else -# define BOUNDS_CHECKING_OFF_DURING(stmt) stmt -# define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) -#endif - -#if !defined(__lzo_inline) -# define __lzo_inline -#endif -#if !defined(__lzo_forceinline) -# define __lzo_forceinline -#endif -#if !defined(__lzo_noinline) -# define __lzo_noinline -#endif - -#if 1 -# define LZO_BYTE(x) ((unsigned char) (x)) -#else -# define LZO_BYTE(x) ((unsigned char) ((x) & 0xff)) -#endif - -#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b)) -#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b)) -#define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c)) -#define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c)) - -#define lzo_sizeof(type) ((lzo_uint) (sizeof(type))) - -#define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array)))) - -#define LZO_SIZE(bits) (1u << (bits)) -#define LZO_MASK(bits) (LZO_SIZE(bits) - 1) - -#define LZO_LSIZE(bits) (1ul << (bits)) -#define LZO_LMASK(bits) (LZO_LSIZE(bits) - 1) - -#define LZO_USIZE(bits) ((lzo_uint) 1 << (bits)) -#define LZO_UMASK(bits) (LZO_USIZE(bits) - 1) - -#if !defined(DMUL) -#if 0 - -# define DMUL(a,b) ((lzo_xint) ((lzo_uint32)(a) * (lzo_uint32)(b))) -#else -# define DMUL(a,b) ((lzo_xint) ((a) * (b))) -#endif -#endif - -#if 1 && !defined(LZO_CFG_NO_UNALIGNED) -#if 1 && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -# if (LZO_SIZEOF_SHORT == 2) -# define LZO_UNALIGNED_OK_2 -# endif -# if (LZO_SIZEOF_INT == 4) -# define LZO_UNALIGNED_OK_4 -# endif -#endif -#endif - -#if defined(LZO_UNALIGNED_OK_2) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(short) == 2) -#endif -#if defined(LZO_UNALIGNED_OK_4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) -#elif defined(LZO_ALIGNED_OK_4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) -#endif - -#define MEMCPY8_DS(dest,src,len) \ - lzo_memcpy(dest,src,len); dest += len; src += len - -#define BZERO8_PTR(s,l,n) \ - lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) - -#define MEMCPY_DS(dest,src,len) \ - do *dest++ = *src++; while (--len > 0) - -__LZO_EXTERN_C int __lzo_init_done; -__LZO_EXTERN_C const char __lzo_copyright[]; -LZO_EXTERN(const lzo_bytep) lzo_copyright(void); - -#ifndef __LZO_PTR_H -#define __LZO_PTR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(lzo_uintptr_t) -# if defined(__LZO_MMODEL_HUGE) -# define lzo_uintptr_t unsigned long -# else -# define lzo_uintptr_t acc_uintptr_t -# ifdef __ACC_INTPTR_T_IS_POINTER -# define __LZO_UINTPTR_T_IS_POINTER 1 -# endif -# endif -#endif - -#if (LZO_ARCH_I086) -#define PTR(a) ((lzo_bytep) (a)) -#define PTR_ALIGNED_4(a) ((ACC_PTR_FP_OFF(a) & 3) == 0) -#define PTR_ALIGNED2_4(a,b) (((ACC_PTR_FP_OFF(a) | ACC_PTR_FP_OFF(b)) & 3) == 0) -#elif (LZO_MM_PVP) -#define PTR(a) ((lzo_bytep) (a)) -#define PTR_ALIGNED_8(a) ((((lzo_uintptr_t)(a)) >> 61) == 0) -#define PTR_ALIGNED2_8(a,b) ((((lzo_uintptr_t)(a)|(lzo_uintptr_t)(b)) >> 61) == 0) -#else -#define PTR(a) ((lzo_uintptr_t) (a)) -#define PTR_LINEAR(a) PTR(a) -#define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0) -#define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0) -#define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0) -#define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0) -#endif - -#define PTR_LT(a,b) (PTR(a) < PTR(b)) -#define PTR_GE(a,b) (PTR(a) >= PTR(b)) -#define PTR_DIFF(a,b) (PTR(a) - PTR(b)) -#define pd(a,b) ((lzo_uint) ((a)-(b))) - -LZO_EXTERN(lzo_uintptr_t) -__lzo_ptr_linear(const lzo_voidp ptr); - -typedef union -{ - char a_char; - unsigned char a_uchar; - short a_short; - unsigned short a_ushort; - int a_int; - unsigned int a_uint; - long a_long; - unsigned long a_ulong; - lzo_int a_lzo_int; - lzo_uint a_lzo_uint; - lzo_int32 a_lzo_int32; - lzo_uint32 a_lzo_uint32; - ptrdiff_t a_ptrdiff_t; - lzo_uintptr_t a_lzo_uintptr_t; - lzo_voidp a_lzo_voidp; - void * a_void_p; - lzo_bytep a_lzo_bytep; - lzo_bytepp a_lzo_bytepp; - lzo_uintp a_lzo_uintp; - lzo_uint * a_lzo_uint_p; - lzo_uint32p a_lzo_uint32p; - lzo_uint32 * a_lzo_uint32_p; - unsigned char * a_uchar_p; - char * a_char_p; -} -lzo_full_align_t; - -#ifdef __cplusplus -} -#endif - -#endif - -#define LZO_DETERMINISTIC - -#define LZO_DICT_USE_PTR -#if 0 && (LZO_ARCH_I086) -# undef LZO_DICT_USE_PTR -#endif - -#if defined(LZO_DICT_USE_PTR) -# define lzo_dict_t const lzo_bytep -# define lzo_dict_p lzo_dict_t __LZO_MMODEL * -#else -# define lzo_dict_t lzo_uint -# define lzo_dict_p lzo_dict_t __LZO_MMODEL * -#endif - -#endif - -#if !defined(MINILZO_CFG_SKIP_LZO_PTR) - -LZO_PUBLIC(lzo_uintptr_t) -__lzo_ptr_linear(const lzo_voidp ptr) -{ - lzo_uintptr_t p; - -#if (LZO_ARCH_I086) - p = (((lzo_uintptr_t)(ACC_PTR_FP_SEG(ptr))) << (16 - ACC_MM_AHSHIFT)) + (ACC_PTR_FP_OFF(ptr)); -#elif (LZO_MM_PVP) - p = (lzo_uintptr_t) (ptr); - p = (p << 3) | (p >> 61); -#else - p = (lzo_uintptr_t) PTR_LINEAR(ptr); -#endif - - return p; -} - -LZO_PUBLIC(unsigned) -__lzo_align_gap(const lzo_voidp ptr, lzo_uint size) -{ -#if defined(__LZO_UINTPTR_T_IS_POINTER) - size_t n = (size_t) ptr; - n = (((n + size - 1) / size) * size) - n; -#else - lzo_uintptr_t p, n; - p = __lzo_ptr_linear(ptr); - n = (((p + size - 1) / size) * size) - p; -#endif - - assert(size > 0); - assert((long)n >= 0); - assert(n <= size); - return (unsigned)n; -} - -#endif - -/* If you use the LZO library in a product, I would appreciate that you - * keep this copyright string in the executable of your product. - */ - -const char __lzo_copyright[] = -#if !defined(__LZO_IN_MINLZO) - LZO_VERSION_STRING; -#else - "\r\n\n" - "LZO data compression library.\n" - "$Copyright: LZO (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Markus Franz Xaver Johannes Oberhumer\n" - "\n" - "http://www.oberhumer.com $\n\n" - "$Id: LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE " $\n" - "$Built: " __DATE__ " " __TIME__ " $\n" - "$Info: " LZO_INFO_STRING " $\n"; -#endif - -LZO_PUBLIC(const lzo_bytep) -lzo_copyright(void) -{ -#if (LZO_OS_DOS16 && LZO_CC_TURBOC) - return (lzo_voidp) __lzo_copyright; -#else - return (const lzo_bytep) __lzo_copyright; -#endif -} - -LZO_PUBLIC(unsigned) -lzo_version(void) -{ - return LZO_VERSION; -} - -LZO_PUBLIC(const char *) -lzo_version_string(void) -{ - return LZO_VERSION_STRING; -} - -LZO_PUBLIC(const char *) -lzo_version_date(void) -{ - return LZO_VERSION_DATE; -} - -LZO_PUBLIC(const lzo_charp) -_lzo_version_string(void) -{ - return LZO_VERSION_STRING; -} - -LZO_PUBLIC(const lzo_charp) -_lzo_version_date(void) -{ - return LZO_VERSION_DATE; -} - -#define LZO_BASE 65521u -#define LZO_NMAX 5552 - -#define LZO_DO1(buf,i) s1 += buf[i]; s2 += s1 -#define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1); -#define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2); -#define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4); -#define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8); - -LZO_PUBLIC(lzo_uint32) -lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len) -{ - lzo_uint32 s1 = adler & 0xffff; - lzo_uint32 s2 = (adler >> 16) & 0xffff; - unsigned k; - - if (buf == NULL) - return 1; - - while (len > 0) - { - k = len < LZO_NMAX ? (unsigned) len : LZO_NMAX; - len -= k; - if (k >= 16) do - { - LZO_DO16(buf,0); - buf += 16; - k -= 16; - } while (k >= 16); - if (k != 0) do - { - s1 += *buf++; - s2 += s1; - } while (--k > 0); - s1 %= LZO_BASE; - s2 %= LZO_BASE; - } - return (s2 << 16) | s1; -} - -#undef LZO_DO1 -#undef LZO_DO2 -#undef LZO_DO4 -#undef LZO_DO8 -#undef LZO_DO16 - -#if !defined(MINILZO_CFG_SKIP_LZO_STRING) -#undef lzo_memcmp -#undef lzo_memcpy -#undef lzo_memmove -#undef lzo_memset -#if !defined(__LZO_MMODEL_HUGE) -# undef LZO_HAVE_MM_HUGE_PTR -#endif -#define lzo_hsize_t lzo_uint -#define lzo_hvoid_p lzo_voidp -#define lzo_hbyte_p lzo_bytep -#define LZOLIB_PUBLIC(r,f) LZO_PUBLIC(r) f -#define lzo_hmemcmp lzo_memcmp -#define lzo_hmemcpy lzo_memcpy -#define lzo_hmemmove lzo_memmove -#define lzo_hmemset lzo_memset -#define __LZOLIB_HMEMCPY_CH_INCLUDED 1 -#if !defined(LZOLIB_PUBLIC) -# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) -#endif -LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCMP) - const lzo_hbyte_p p1 = (const lzo_hbyte_p) s1; - const lzo_hbyte_p p2 = (const lzo_hbyte_p) s2; - if __lzo_likely(len > 0) do - { - int d = *p1 - *p2; - if (d != 0) - return d; - p1++; p2++; - } while __lzo_likely(--len > 0); - return 0; -#else - return memcmp(s1, s2, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCPY) - lzo_hbyte_p p1 = (lzo_hbyte_p) dest; - const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; - if (!(len > 0) || p1 == p2) - return dest; - do - *p1++ = *p2++; - while __lzo_likely(--len > 0); - return dest; -#else - return memcpy(dest, src, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMMOVE) - lzo_hbyte_p p1 = (lzo_hbyte_p) dest; - const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; - if (!(len > 0) || p1 == p2) - return dest; - if (p1 < p2) - { - do - *p1++ = *p2++; - while __lzo_likely(--len > 0); - } - else - { - p1 += len; - p2 += len; - do - *--p1 = *--p2; - while __lzo_likely(--len > 0); - } - return dest; -#else - return memmove(dest, src, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMSET) - lzo_hbyte_p p = (lzo_hbyte_p) s; - if __lzo_likely(len > 0) do - *p++ = (unsigned char) c; - while __lzo_likely(--len > 0); - return s; -#else - return memset(s, c, len); -#endif -} -#undef LZOLIB_PUBLIC -#endif - -#if !defined(__LZO_IN_MINILZO) - -#define ACC_WANT_ACC_CHK_CH 1 -#undef ACCCHK_ASSERT - - ACCCHK_ASSERT_IS_SIGNED_T(lzo_int) - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint) - - ACCCHK_ASSERT_IS_SIGNED_T(lzo_int32) - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32) - ACCCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0) - ACCCHK_ASSERT(sizeof(lzo_uint32) >= 4) - -#if !defined(__LZO_UINTPTR_T_IS_POINTER) - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t) -#endif - ACCCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - - ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_xint) - ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint32)) - ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint)) - ACCCHK_ASSERT(sizeof(lzo_xint) == sizeof(lzo_uint32) || sizeof(lzo_xint) == sizeof(lzo_uint)) - -#endif -#undef ACCCHK_ASSERT - -LZO_PUBLIC(int) -_lzo_config_check(void) -{ - lzo_bool r = 1; - union { unsigned char c[2*sizeof(lzo_xint)]; lzo_xint l[2]; } u; - lzo_uintptr_t p; - -#if !defined(LZO_CFG_NO_CONFIG_CHECK) -#if defined(LZO_ABI_BIG_ENDIAN) - u.l[0] = u.l[1] = 0; u.c[sizeof(lzo_xint) - 1] = 128; - r &= (u.l[0] == 128); -#endif -#if defined(LZO_ABI_LITTLE_ENDIAN) - u.l[0] = u.l[1] = 0; u.c[0] = 128; - r &= (u.l[0] == 128); -#endif -#if defined(LZO_UNALIGNED_OK_2) - p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; - u.l[0] = u.l[1] = 0; - r &= ((* (const lzo_ushortp) (p+1)) == 0); -#endif -#if defined(LZO_UNALIGNED_OK_4) - p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; - u.l[0] = u.l[1] = 0; - r &= ((* (const lzo_uint32p) (p+1)) == 0); -#endif -#endif - - LZO_UNUSED(u); LZO_UNUSED(p); - return r == 1 ? LZO_E_OK : LZO_E_ERROR; -} - -int __lzo_init_done = 0; - -LZO_PUBLIC(int) -__lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5, - int s6, int s7, int s8, int s9) -{ - int r; - -#if defined(__LZO_IN_MINILZO) -#elif (LZO_CC_MSC && ((_MSC_VER) < 700)) -#else -#define ACC_WANT_ACC_CHK_CH 1 -#undef ACCCHK_ASSERT -#define ACCCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr) -#endif -#undef ACCCHK_ASSERT - - __lzo_init_done = 1; - - if (v == 0) - return LZO_E_ERROR; - - r = (s1 == -1 || s1 == (int) sizeof(short)) && - (s2 == -1 || s2 == (int) sizeof(int)) && - (s3 == -1 || s3 == (int) sizeof(long)) && - (s4 == -1 || s4 == (int) sizeof(lzo_uint32)) && - (s5 == -1 || s5 == (int) sizeof(lzo_uint)) && - (s6 == -1 || s6 == (int) lzo_sizeof_dict_t) && - (s7 == -1 || s7 == (int) sizeof(char *)) && - (s8 == -1 || s8 == (int) sizeof(lzo_voidp)) && - (s9 == -1 || s9 == (int) sizeof(lzo_callback_t)); - if (!r) - return LZO_E_ERROR; - - r = _lzo_config_check(); - if (r != LZO_E_OK) - return r; - - return r; -} - -#if !defined(__LZO_IN_MINILZO) - -#if (LZO_OS_WIN16 && LZO_CC_WATCOMC) && defined(__SW_BD) - -#if 0 -BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment, - WORD wHeapSize, LPSTR lpszCmdLine ) -#else -int __far __pascal LibMain ( int a, short b, short c, long d ) -#endif -{ - LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d); - return 1; -} - -#endif - -#endif - -#define do_compress _lzo1x_1_do_compress - -#if !defined(MINILZO_CFG_SKIP_LZO1X_1_COMPRESS) - -#define LZO_NEED_DICT_H -#define D_BITS 14 -#define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5) -#define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f) - -#ifndef __LZO_CONFIG1X_H -#define __LZO_CONFIG1X_H - -#if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z) -# define LZO1X -#endif - -#if !defined(__LZO_IN_MINILZO) -#include "lzo/lzo1x.h" -#endif - -#define LZO_EOF_CODE -#undef LZO_DETERMINISTIC - -#define M1_MAX_OFFSET 0x0400 -#ifndef M2_MAX_OFFSET -#define M2_MAX_OFFSET 0x0800 -#endif -#define M3_MAX_OFFSET 0x4000 -#define M4_MAX_OFFSET 0xbfff - -#define MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET) - -#define M1_MIN_LEN 2 -#define M1_MAX_LEN 2 -#define M2_MIN_LEN 3 -#ifndef M2_MAX_LEN -#define M2_MAX_LEN 8 -#endif -#define M3_MIN_LEN 3 -#define M3_MAX_LEN 33 -#define M4_MIN_LEN 3 -#define M4_MAX_LEN 9 - -#define M1_MARKER 0 -#define M2_MARKER 64 -#define M3_MARKER 32 -#define M4_MARKER 16 - -#ifndef MIN_LOOKAHEAD -#define MIN_LOOKAHEAD (M2_MAX_LEN + 1) -#endif - -#if defined(LZO_NEED_DICT_H) - -#ifndef LZO_HASH -#define LZO_HASH LZO_HASH_LZO_INCREMENTAL_B -#endif -#define DL_MIN_LEN M2_MIN_LEN - -#ifndef __LZO_DICT_H -#define __LZO_DICT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(D_BITS) && defined(DBITS) -# define D_BITS DBITS -#endif -#if !defined(D_BITS) -# error "D_BITS is not defined" -#endif -#if (D_BITS < 16) -# define D_SIZE LZO_SIZE(D_BITS) -# define D_MASK LZO_MASK(D_BITS) -#else -# define D_SIZE LZO_USIZE(D_BITS) -# define D_MASK LZO_UMASK(D_BITS) -#endif -#define D_HIGH ((D_MASK >> 1) + 1) - -#if !defined(DD_BITS) -# define DD_BITS 0 -#endif -#define DD_SIZE LZO_SIZE(DD_BITS) -#define DD_MASK LZO_MASK(DD_BITS) - -#if !defined(DL_BITS) -# define DL_BITS (D_BITS - DD_BITS) -#endif -#if (DL_BITS < 16) -# define DL_SIZE LZO_SIZE(DL_BITS) -# define DL_MASK LZO_MASK(DL_BITS) -#else -# define DL_SIZE LZO_USIZE(DL_BITS) -# define DL_MASK LZO_UMASK(DL_BITS) -#endif - -#if (D_BITS != DL_BITS + DD_BITS) -# error "D_BITS does not match" -#endif -#if (D_BITS < 8 || D_BITS > 18) -# error "invalid D_BITS" -#endif -#if (DL_BITS < 8 || DL_BITS > 20) -# error "invalid DL_BITS" -#endif -#if (DD_BITS < 0 || DD_BITS > 6) -# error "invalid DD_BITS" -#endif - -#if !defined(DL_MIN_LEN) -# define DL_MIN_LEN 3 -#endif -#if !defined(DL_SHIFT) -# define DL_SHIFT ((DL_BITS + (DL_MIN_LEN - 1)) / DL_MIN_LEN) -#endif - -#define LZO_HASH_GZIP 1 -#define LZO_HASH_GZIP_INCREMENTAL 2 -#define LZO_HASH_LZO_INCREMENTAL_A 3 -#define LZO_HASH_LZO_INCREMENTAL_B 4 - -#if !defined(LZO_HASH) -# error "choose a hashing strategy" -#endif - -#undef DM -#undef DX - -#if (DL_MIN_LEN == 3) -# define _DV2_A(p,shift1,shift2) \ - (((( (lzo_xint)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2]) -# define _DV2_B(p,shift1,shift2) \ - (((( (lzo_xint)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0]) -# define _DV3_B(p,shift1,shift2,shift3) \ - ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0]) -#elif (DL_MIN_LEN == 2) -# define _DV2_A(p,shift1,shift2) \ - (( (lzo_xint)(p[0]) << shift1) ^ p[1]) -# define _DV2_B(p,shift1,shift2) \ - (( (lzo_xint)(p[1]) << shift1) ^ p[2]) -#else -# error "invalid DL_MIN_LEN" -#endif -#define _DV_A(p,shift) _DV2_A(p,shift,shift) -#define _DV_B(p,shift) _DV2_B(p,shift,shift) -#define DA2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0]) -#define DS2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0]) -#define DX2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0]) -#define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0]) -#define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0]) -#define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0]) -#define DMS(v,s) ((lzo_uint) (((v) & (D_MASK >> (s))) << (s))) -#define DM(v) DMS(v,0) - -#if (LZO_HASH == LZO_HASH_GZIP) -# define _DINDEX(dv,p) (_DV_A((p),DL_SHIFT)) - -#elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL) -# define __LZO_HASH_INCREMENTAL -# define DVAL_FIRST(dv,p) dv = _DV_A((p),DL_SHIFT) -# define DVAL_NEXT(dv,p) dv = (((dv) << DL_SHIFT) ^ p[2]) -# define _DINDEX(dv,p) (dv) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A) -# define __LZO_HASH_INCREMENTAL -# define DVAL_FIRST(dv,p) dv = _DV_A((p),5) -# define DVAL_NEXT(dv,p) \ - dv ^= (lzo_xint)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2]) -# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B) -# define __LZO_HASH_INCREMENTAL -# define DVAL_FIRST(dv,p) dv = _DV_B((p),5) -# define DVAL_NEXT(dv,p) \ - dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_xint)(p[2]) << (2*5))) -# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#else -# error "choose a hashing strategy" -#endif - -#ifndef DINDEX -#define DINDEX(dv,p) ((lzo_uint)((_DINDEX(dv,p)) & DL_MASK) << DD_BITS) -#endif -#if !defined(DINDEX1) && defined(D_INDEX1) -#define DINDEX1 D_INDEX1 -#endif -#if !defined(DINDEX2) && defined(D_INDEX2) -#define DINDEX2 D_INDEX2 -#endif - -#if !defined(__LZO_HASH_INCREMENTAL) -# define DVAL_FIRST(dv,p) ((void) 0) -# define DVAL_NEXT(dv,p) ((void) 0) -# define DVAL_LOOKAHEAD 0 -#endif - -#if !defined(DVAL_ASSERT) -#if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG) -static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) -{ - lzo_xint df; - DVAL_FIRST(df,(p)); - assert(DINDEX(dv,p) == DINDEX(df,p)); -} -#else -# define DVAL_ASSERT(dv,p) ((void) 0) -#endif -#endif - -#if defined(LZO_DICT_USE_PTR) -# define DENTRY(p,in) (p) -# define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex] -#else -# define DENTRY(p,in) ((lzo_uint) ((p)-(in))) -# define GINDEX(m_pos,m_off,dict,dindex,in) m_off = dict[dindex] -#endif - -#if (DD_BITS == 0) - -# define UPDATE_D(dict,drun,dv,p,in) dict[ DINDEX(dv,p) ] = DENTRY(p,in) -# define UPDATE_I(dict,drun,index,p,in) dict[index] = DENTRY(p,in) -# define UPDATE_P(ptr,drun,p,in) (ptr)[0] = DENTRY(p,in) - -#else - -# define UPDATE_D(dict,drun,dv,p,in) \ - dict[ DINDEX(dv,p) + drun++ ] = DENTRY(p,in); drun &= DD_MASK -# define UPDATE_I(dict,drun,index,p,in) \ - dict[ (index) + drun++ ] = DENTRY(p,in); drun &= DD_MASK -# define UPDATE_P(ptr,drun,p,in) \ - (ptr) [ drun++ ] = DENTRY(p,in); drun &= DD_MASK - -#endif - -#if defined(LZO_DICT_USE_PTR) - -#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ - (m_pos == NULL || (m_off = pd(ip, m_pos)) > max_offset) - -#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ - (BOUNDS_CHECKING_OFF_IN_EXPR(( \ - m_pos = ip - (lzo_uint) PTR_DIFF(ip,m_pos), \ - PTR_LT(m_pos,in) || \ - (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) <= 0 || \ - m_off > max_offset ))) - -#else - -#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ - (m_off == 0 || \ - ((m_off = pd(ip, in) - m_off) > max_offset) || \ - (m_pos = (ip) - (m_off), 0) ) - -#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ - (pd(ip, in) <= m_off || \ - ((m_off = pd(ip, in) - m_off) > max_offset) || \ - (m_pos = (ip) - (m_off), 0) ) - -#endif - -#if defined(LZO_DETERMINISTIC) -# define LZO_CHECK_MPOS LZO_CHECK_MPOS_DET -#else -# define LZO_CHECK_MPOS LZO_CHECK_MPOS_NON_DET -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -#endif - -#endif - -#define DO_COMPRESS lzo1x_1_compress - -static __lzo_noinline lzo_uint -do_compress ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -{ - register const lzo_bytep ip; - lzo_bytep op; - const lzo_bytep const in_end = in + in_len; - const lzo_bytep const ip_end = in + in_len - M2_MAX_LEN - 5; - const lzo_bytep ii; - lzo_dict_p const dict = (lzo_dict_p) wrkmem; - - op = out; - ip = in; - ii = ip; - - ip += 4; - for (;;) - { - register const lzo_bytep m_pos; - lzo_uint m_off; - lzo_uint m_len; - lzo_uint dindex; - - DINDEX1(dindex,ip); - GINDEX(m_pos,m_off,dict,dindex,in); - if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) - goto literal; -#if 1 - if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) - goto try_match; - DINDEX2(dindex,ip); -#endif - GINDEX(m_pos,m_off,dict,dindex,in); - if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) - goto literal; - if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) - goto try_match; - goto literal; - -try_match: -#if 1 && defined(LZO_UNALIGNED_OK_2) - if (* (const lzo_ushortp) m_pos != * (const lzo_ushortp) ip) -#else - if (m_pos[0] != ip[0] || m_pos[1] != ip[1]) -#endif - { - } - else - { - if __lzo_likely(m_pos[2] == ip[2]) - { -#if 0 - if (m_off <= M2_MAX_OFFSET) - goto match; - if (lit <= 3) - goto match; - if (lit == 3) - { - assert(op - 2 > out); op[-2] |= LZO_BYTE(3); - *op++ = *ii++; *op++ = *ii++; *op++ = *ii++; - goto code_match; - } - if (m_pos[3] == ip[3]) -#endif - goto match; - } - else - { -#if 0 -#if 0 - if (m_off <= M1_MAX_OFFSET && lit > 0 && lit <= 3) -#else - if (m_off <= M1_MAX_OFFSET && lit == 3) -#endif - { - register lzo_uint t; - - t = lit; - assert(op - 2 > out); op[-2] |= LZO_BYTE(t); - do *op++ = *ii++; while (--t > 0); - assert(ii == ip); - m_off -= 1; - *op++ = LZO_BYTE(M1_MARKER | ((m_off & 3) << 2)); - *op++ = LZO_BYTE(m_off >> 2); - ip += 2; - goto match_done; - } -#endif - } - } - -literal: - UPDATE_I(dict,0,dindex,ip,in); - ++ip; - if __lzo_unlikely(ip >= ip_end) - break; - continue; - -match: - UPDATE_I(dict,0,dindex,ip,in); - if (pd(ip,ii) > 0) - { - register lzo_uint t = pd(ip,ii); - - if (t <= 3) - { - assert(op - 2 > out); - op[-2] |= LZO_BYTE(t); - } - else if (t <= 18) - *op++ = LZO_BYTE(t - 3); - else - { - register lzo_uint tt = t - 18; - - *op++ = 0; - while (tt > 255) - { - tt -= 255; - *op++ = 0; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } - do *op++ = *ii++; while (--t > 0); - } - - assert(ii == ip); - ip += 3; - if (m_pos[3] != *ip++ || m_pos[4] != *ip++ || m_pos[5] != *ip++ || - m_pos[6] != *ip++ || m_pos[7] != *ip++ || m_pos[8] != *ip++ -#ifdef LZO1Y - || m_pos[ 9] != *ip++ || m_pos[10] != *ip++ || m_pos[11] != *ip++ - || m_pos[12] != *ip++ || m_pos[13] != *ip++ || m_pos[14] != *ip++ -#endif - ) - { - --ip; - m_len = pd(ip, ii); - assert(m_len >= 3); assert(m_len <= M2_MAX_LEN); - - if (m_off <= M2_MAX_OFFSET) - { - m_off -= 1; -#if defined(LZO1X) - *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); - *op++ = LZO_BYTE(m_off >> 3); -#elif defined(LZO1Y) - *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); - *op++ = LZO_BYTE(m_off >> 2); -#endif - } - else if (m_off <= M3_MAX_OFFSET) - { - m_off -= 1; - *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); - goto m3_m4_offset; - } - else -#if defined(LZO1X) - { - m_off -= 0x4000; - assert(m_off > 0); assert(m_off <= 0x7fff); - *op++ = LZO_BYTE(M4_MARKER | - ((m_off & 0x4000) >> 11) | (m_len - 2)); - goto m3_m4_offset; - } -#elif defined(LZO1Y) - goto m4_match; -#endif - } - else - { - { - const lzo_bytep end = in_end; - const lzo_bytep m = m_pos + M2_MAX_LEN + 1; - while (ip < end && *m == *ip) - m++, ip++; - m_len = pd(ip, ii); - } - assert(m_len > M2_MAX_LEN); - - if (m_off <= M3_MAX_OFFSET) - { - m_off -= 1; - if (m_len <= 33) - *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); - else - { - m_len -= 33; - *op++ = M3_MARKER | 0; - goto m3_m4_len; - } - } - else - { -#if defined(LZO1Y) -m4_match: -#endif - m_off -= 0x4000; - assert(m_off > 0); assert(m_off <= 0x7fff); - if (m_len <= M4_MAX_LEN) - *op++ = LZO_BYTE(M4_MARKER | - ((m_off & 0x4000) >> 11) | (m_len - 2)); - else - { - m_len -= M4_MAX_LEN; - *op++ = LZO_BYTE(M4_MARKER | ((m_off & 0x4000) >> 11)); -m3_m4_len: - while (m_len > 255) - { - m_len -= 255; - *op++ = 0; - } - assert(m_len > 0); - *op++ = LZO_BYTE(m_len); - } - } - -m3_m4_offset: - *op++ = LZO_BYTE((m_off & 63) << 2); - *op++ = LZO_BYTE(m_off >> 6); - } - -#if 0 -match_done: -#endif - ii = ip; - if __lzo_unlikely(ip >= ip_end) - break; - } - - *out_len = pd(op, out); - return pd(in_end,ii); -} - -LZO_PUBLIC(int) -DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -{ - lzo_bytep op = out; - lzo_uint t; - - if __lzo_unlikely(in_len <= M2_MAX_LEN + 5) - t = in_len; - else - { - t = do_compress(in,in_len,op,out_len,wrkmem); - op += *out_len; - } - - if (t > 0) - { - const lzo_bytep ii = in + in_len - t; - - if (op == out && t <= 238) - *op++ = LZO_BYTE(17 + t); - else if (t <= 3) - op[-2] |= LZO_BYTE(t); - else if (t <= 18) - *op++ = LZO_BYTE(t - 3); - else - { - lzo_uint tt = t - 18; - - *op++ = 0; - while (tt > 255) - { - tt -= 255; - *op++ = 0; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } - do *op++ = *ii++; while (--t > 0); - } - - *op++ = M4_MARKER | 1; - *op++ = 0; - *op++ = 0; - - *out_len = pd(op, out); - return LZO_E_OK; -} - -#endif - -#undef do_compress -#undef DO_COMPRESS -#undef LZO_HASH - -#undef LZO_TEST_OVERRUN -#undef DO_DECOMPRESS -#define DO_DECOMPRESS lzo1x_decompress - -#if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS) - -#if defined(LZO_TEST_OVERRUN) -# if !defined(LZO_TEST_OVERRUN_INPUT) -# define LZO_TEST_OVERRUN_INPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_OUTPUT) -# define LZO_TEST_OVERRUN_OUTPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND -# endif -#endif - -#undef TEST_IP -#undef TEST_OP -#undef TEST_LB -#undef TEST_LBO -#undef NEED_IP -#undef NEED_OP -#undef HAVE_TEST_IP -#undef HAVE_TEST_OP -#undef HAVE_NEED_IP -#undef HAVE_NEED_OP -#undef HAVE_ANY_IP -#undef HAVE_ANY_OP - -#if defined(LZO_TEST_OVERRUN_INPUT) -# if (LZO_TEST_OVERRUN_INPUT >= 1) -# define TEST_IP (ip < ip_end) -# endif -# if (LZO_TEST_OVERRUN_INPUT >= 2) -# define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_OUTPUT) -# if (LZO_TEST_OVERRUN_OUTPUT >= 1) -# define TEST_OP (op <= op_end) -# endif -# if (LZO_TEST_OVERRUN_OUTPUT >= 2) -# undef TEST_OP -# define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun -# define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun -#else -# define TEST_LB(m_pos) ((void) 0) -# define TEST_LBO(m_pos,o) ((void) 0) -#endif - -#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) -# define TEST_IP (ip < ip_end) -#endif - -#if defined(TEST_IP) -# define HAVE_TEST_IP -#else -# define TEST_IP 1 -#endif -#if defined(TEST_OP) -# define HAVE_TEST_OP -#else -# define TEST_OP 1 -#endif - -#if defined(NEED_IP) -# define HAVE_NEED_IP -#else -# define NEED_IP(x) ((void) 0) -#endif -#if defined(NEED_OP) -# define HAVE_NEED_OP -#else -# define NEED_OP(x) ((void) 0) -#endif - -#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP -#endif -#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP -#endif - -#undef __COPY4 -#define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) - -#undef COPY4 -#if defined(LZO_UNALIGNED_OK_4) -# define COPY4(dst,src) __COPY4(dst,src) -#elif defined(LZO_ALIGNED_OK_4) -# define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) -#endif - -#if defined(DO_DECOMPRESS) -LZO_PUBLIC(int) -DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -#endif -{ - register lzo_bytep op; - register const lzo_bytep ip; - register lzo_uint t; -#if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; -#else - register const lzo_bytep m_pos; -#endif - - const lzo_bytep const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - lzo_bytep const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - lzo_uint last_m_off = 0; -#endif - - LZO_UNUSED(wrkmem); - -#if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif - - *out_len = 0; - - op = out; - ip = in; - - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+1); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - - while (TEST_IP && TEST_OP) - { - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 15 + *ip++; - } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (PTR_ALIGNED2_4(op,ip)) - { -#endif - COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } -#if !defined(LZO_UNALIGNED_OK_4) - } - else -#endif -#endif -#if !defined(LZO_UNALIGNED_OK_4) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } -#endif - -first_literal_run: - - t = *ip++; - if (t >= 16) - goto match; -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(3); - t = 3; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - (1 + M2_MAX_OFFSET); - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - - do { -match: - if (t >= 64) - { -#if defined(COPY_DICT) -#if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; -#elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; -#endif -#else -#if defined(LZO1X) - m_pos = op - 1; - m_pos -= (t >> 2) & 7; - m_pos -= *ip++ << 3; - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; -#elif defined(LZO1Z) - { - lzo_uint off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); - goto copy_match; -#endif - } - else if (t >= 32) - { - t &= 31; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 31 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; -#else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); -#endif -#else -#if defined(LZO1Z) - { - lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif - ip += 2; - } - else if (t >= 16) - { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else - m_pos = op; - m_pos -= (t & 8) << 11; -#endif - t &= 7; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 7 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_pos == op) - goto eof_found; - m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const lzo_bytep)op, m_pos); -#endif -#endif - } - else - { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(2); - t = 2; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - 1; - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - } - -#if defined(COPY_DICT) - - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t,m_off) - -#else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -#else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif - { -copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); - } - -#endif - -match_done: -#if defined(LZO1Z) - t = ip[-1] & 3; -#else - t = ip[-2] & 3; -#endif - if (t == 0) - break; - -match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif - t = *ip++; - } while (TEST_IP && TEST_OP); - } - -#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) - *out_len = pd(op, out); - return LZO_E_EOF_NOT_FOUND; -#endif - -eof_found: - assert(t == 1); - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); - -#if defined(HAVE_NEED_IP) -input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; -#endif - -#if defined(HAVE_NEED_OP) -output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif -} - -#endif - -#define LZO_TEST_OVERRUN -#undef DO_DECOMPRESS -#define DO_DECOMPRESS lzo1x_decompress_safe - -#if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS_SAFE) - -#if defined(LZO_TEST_OVERRUN) -# if !defined(LZO_TEST_OVERRUN_INPUT) -# define LZO_TEST_OVERRUN_INPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_OUTPUT) -# define LZO_TEST_OVERRUN_OUTPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND -# endif -#endif - -#undef TEST_IP -#undef TEST_OP -#undef TEST_LB -#undef TEST_LBO -#undef NEED_IP -#undef NEED_OP -#undef HAVE_TEST_IP -#undef HAVE_TEST_OP -#undef HAVE_NEED_IP -#undef HAVE_NEED_OP -#undef HAVE_ANY_IP -#undef HAVE_ANY_OP - -#if defined(LZO_TEST_OVERRUN_INPUT) -# if (LZO_TEST_OVERRUN_INPUT >= 1) -# define TEST_IP (ip < ip_end) -# endif -# if (LZO_TEST_OVERRUN_INPUT >= 2) -# define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_OUTPUT) -# if (LZO_TEST_OVERRUN_OUTPUT >= 1) -# define TEST_OP (op <= op_end) -# endif -# if (LZO_TEST_OVERRUN_OUTPUT >= 2) -# undef TEST_OP -# define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun -# define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun -#else -# define TEST_LB(m_pos) ((void) 0) -# define TEST_LBO(m_pos,o) ((void) 0) -#endif - -#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) -# define TEST_IP (ip < ip_end) -#endif - -#if defined(TEST_IP) -# define HAVE_TEST_IP -#else -# define TEST_IP 1 -#endif -#if defined(TEST_OP) -# define HAVE_TEST_OP -#else -# define TEST_OP 1 -#endif - -#if defined(NEED_IP) -# define HAVE_NEED_IP -#else -# define NEED_IP(x) ((void) 0) -#endif -#if defined(NEED_OP) -# define HAVE_NEED_OP -#else -# define NEED_OP(x) ((void) 0) -#endif - -#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP -#endif -#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP -#endif - -#undef __COPY4 -#define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) - -#undef COPY4 -#if defined(LZO_UNALIGNED_OK_4) -# define COPY4(dst,src) __COPY4(dst,src) -#elif defined(LZO_ALIGNED_OK_4) -# define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) -#endif - -#if defined(DO_DECOMPRESS) -LZO_PUBLIC(int) -DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -#endif -{ - register lzo_bytep op; - register const lzo_bytep ip; - register lzo_uint t; -#if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; -#else - register const lzo_bytep m_pos; -#endif - - const lzo_bytep const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - lzo_bytep const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - lzo_uint last_m_off = 0; -#endif - - LZO_UNUSED(wrkmem); - -#if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif - - *out_len = 0; - - op = out; - ip = in; - - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+1); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - - while (TEST_IP && TEST_OP) - { - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 15 + *ip++; - } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (PTR_ALIGNED2_4(op,ip)) - { -#endif - COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } -#if !defined(LZO_UNALIGNED_OK_4) - } - else -#endif -#endif -#if !defined(LZO_UNALIGNED_OK_4) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } -#endif - -first_literal_run: - - t = *ip++; - if (t >= 16) - goto match; -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(3); - t = 3; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - (1 + M2_MAX_OFFSET); - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - - do { -match: - if (t >= 64) - { -#if defined(COPY_DICT) -#if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; -#elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; -#endif -#else -#if defined(LZO1X) - m_pos = op - 1; - m_pos -= (t >> 2) & 7; - m_pos -= *ip++ << 3; - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; -#elif defined(LZO1Z) - { - lzo_uint off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); - goto copy_match; -#endif - } - else if (t >= 32) - { - t &= 31; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 31 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; -#else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); -#endif -#else -#if defined(LZO1Z) - { - lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif - ip += 2; - } - else if (t >= 16) - { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else - m_pos = op; - m_pos -= (t & 8) << 11; -#endif - t &= 7; - if (t == 0) - { - NEED_IP(1); - while (*ip == 0) - { - t += 255; - ip++; - NEED_IP(1); - } - t += 7 + *ip++; - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); -#elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) - m_pos -= (* (const lzo_ushortp) ip) >> 2; -#else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_pos == op) - goto eof_found; - m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const lzo_bytep)op, m_pos); -#endif -#endif - } - else - { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(2); - t = 2; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - 1; - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - } - -#if defined(COPY_DICT) - - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t,m_off) - -#else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) -#if !defined(LZO_UNALIGNED_OK_4) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -#else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif - { -copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); - } - -#endif - -match_done: -#if defined(LZO1Z) - t = ip[-1] & 3; -#else - t = ip[-2] & 3; -#endif - if (t == 0) - break; - -match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif - t = *ip++; - } while (TEST_IP && TEST_OP); - } - -#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) - *out_len = pd(op, out); - return LZO_E_EOF_NOT_FOUND; -#endif - -eof_found: - assert(t == 1); - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); - -#if defined(HAVE_NEED_IP) -input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; -#endif - -#if defined(HAVE_NEED_OP) -output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif -} - -#endif - -/***** End of minilzo.c *****/ - diff --git a/bundles/n2n_ntop_v2/src/n2n.c b/bundles/n2n_ntop_v2/src/n2n.c deleted file mode 100644 index 7c8109e5..00000000 --- a/bundles/n2n_ntop_v2/src/n2n.c +++ /dev/null @@ -1,468 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#include "minilzo.h" - -#include - - -static const uint8_t broadcast_addr[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; -static const uint8_t multicast_addr[6] = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0x00 }; /* First 3 bytes are meaningful */ -static const uint8_t ipv6_multicast_addr[6] = { 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 }; /* First 2 bytes are meaningful */ - -/* ************************************** */ - -SOCKET open_socket(int local_port, int bind_any) { - SOCKET sock_fd; - struct sockaddr_in local_address; - int sockopt; - - if((sock_fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { - traceEvent(TRACE_ERROR, "Unable to create socket [%s][%d]\n", - strerror(errno), sock_fd); - return(-1); - } - -#ifndef WIN32 - /* fcntl(sock_fd, F_SETFL, O_NONBLOCK); */ -#endif - - sockopt = 1; - setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&sockopt, sizeof(sockopt)); - - memset(&local_address, 0, sizeof(local_address)); - local_address.sin_family = AF_INET; - local_address.sin_port = htons(local_port); - local_address.sin_addr.s_addr = htonl(bind_any ? INADDR_ANY : INADDR_LOOPBACK); - - if(bind(sock_fd,(struct sockaddr*) &local_address, sizeof(local_address)) == -1) { - traceEvent(TRACE_ERROR, "Bind error on local port %u [%s]\n", local_port, strerror(errno)); - return(-1); - } - - return(sock_fd); -} - -static int traceLevel = 2 /* NORMAL */; -static int useSyslog = 0, syslog_opened = 0; -static FILE *traceFile = NULL; - -int getTraceLevel() { - return(traceLevel); -} - -void setTraceLevel(int level) { - traceLevel = level; -} - -void setUseSyslog(int use_syslog) { - useSyslog= use_syslog; -} - -void setTraceFile(FILE *f) { - traceFile = f; -} - -void closeTraceFile() { - if (traceFile != NULL && traceFile != stdout) { - fclose(traceFile); - } -#ifndef WIN32 - if (useSyslog && syslog_opened) { - closelog(); - syslog_opened = 0; - } -#endif -} - -#define N2N_TRACE_DATESIZE 32 -void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...) { - va_list va_ap; - - if(traceFile == NULL) - traceFile = stdout; - - if(eventTraceLevel <= traceLevel) { - char buf[1024]; - char out_buf[1280]; - char theDate[N2N_TRACE_DATESIZE]; - char *extra_msg = ""; - time_t theTime = time(NULL); - int i; - - /* We have two paths - one if we're logging, one if we aren't - * Note that the no-log case is those systems which don't support it(WIN32), - * those without the headers !defined(USE_SYSLOG) - * those where it's parametrically off... - */ - - memset(buf, 0, sizeof(buf)); - strftime(theDate, N2N_TRACE_DATESIZE, "%d/%b/%Y %H:%M:%S", localtime(&theTime)); - - va_start(va_ap, format); - vsnprintf(buf, sizeof(buf)-1, format, va_ap); - va_end(va_ap); - - if(eventTraceLevel == 0 /* TRACE_ERROR */) - extra_msg = "ERROR: "; - else if(eventTraceLevel == 1 /* TRACE_WARNING */) - extra_msg = "WARNING: "; - - while(buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; - -#ifndef WIN32 - if(useSyslog) { - if(!syslog_opened) { - openlog("n2n", LOG_PID, LOG_DAEMON); - syslog_opened = 1; - } - - snprintf(out_buf, sizeof(out_buf), "%s%s", extra_msg, buf); - syslog(LOG_INFO, "%s", out_buf); - } else { - for(i=strlen(file)-1; i>0; i--) if(file[i] == '/') { i++; break; }; - snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, &file[i], line, extra_msg, buf); - fprintf(traceFile, "%s\n", out_buf); - fflush(traceFile); - } -#else - /* this is the WIN32 code */ - for(i=strlen(file)-1; i>0; i--) if(file[i] == '\\') { i++; break; }; - snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, &file[i], line, extra_msg, buf); - fprintf(traceFile, "%s\n", out_buf); - fflush(traceFile); -#endif - } - -} - -/* *********************************************** */ - -/* addr should be in network order. Things are so much simpler that way. */ -char* intoa(uint32_t /* host order */ addr, char* buf, uint16_t buf_len) { - char *cp, *retStr; - uint8_t byteval; - int n; - - cp = &buf[buf_len]; - *--cp = '\0'; - - n = 4; - do { - byteval = addr & 0xff; - *--cp = byteval % 10 + '0'; - byteval /= 10; - if(byteval > 0) { - *--cp = byteval % 10 + '0'; - byteval /= 10; - if(byteval > 0) - *--cp = byteval + '0'; - } - *--cp = '.'; - addr >>= 8; - } while(--n > 0); - - /* Convert the string to lowercase */ - retStr =(char*)(cp+1); - - return(retStr); -} - -/* *********************************************** */ - -char * macaddr_str(macstr_t buf, - const n2n_mac_t mac) -{ - snprintf(buf, N2N_MACSTR_SIZE, "%02X:%02X:%02X:%02X:%02X:%02X", - mac[0] & 0xFF, mac[1] & 0xFF, mac[2] & 0xFF, - mac[3] & 0xFF, mac[4] & 0xFF, mac[5] & 0xFF); - return(buf); -} - -/* *********************************************** */ - -uint8_t is_multi_broadcast(const uint8_t * dest_mac) { - - int is_broadcast =(memcmp(broadcast_addr, dest_mac, 6) == 0); - int is_multicast =(memcmp(multicast_addr, dest_mac, 3) == 0); - int is_ipv6_multicast =(memcmp(ipv6_multicast_addr, dest_mac, 2) == 0); - - return is_broadcast || is_multicast || is_ipv6_multicast; - -} - -/* http://www.faqs.org/rfcs/rfc908.html */ - - -/* *********************************************** */ - -char* msg_type2str(uint16_t msg_type) { - switch(msg_type) { - case MSG_TYPE_REGISTER: return("MSG_TYPE_REGISTER"); - case MSG_TYPE_DEREGISTER: return("MSG_TYPE_DEREGISTER"); - case MSG_TYPE_PACKET: return("MSG_TYPE_PACKET"); - case MSG_TYPE_REGISTER_ACK: return("MSG_TYPE_REGISTER_ACK"); - case MSG_TYPE_REGISTER_SUPER: return("MSG_TYPE_REGISTER_SUPER"); - case MSG_TYPE_REGISTER_SUPER_ACK: return("MSG_TYPE_REGISTER_SUPER_ACK"); - case MSG_TYPE_REGISTER_SUPER_NAK: return("MSG_TYPE_REGISTER_SUPER_NAK"); - case MSG_TYPE_FEDERATION: return("MSG_TYPE_FEDERATION"); - default: return("???"); - } - - return("???"); -} - -/* *********************************************** */ - -void hexdump(const uint8_t * buf, size_t len) -{ - size_t i; - - if(0 == len) { return; } - - for(i=0; i 0) &&((i % 16) == 0)) { printf("\n"); } - printf("%02X ", buf[i] & 0xFF); - } - - printf("\n"); -} - -/* *********************************************** */ - -void print_n2n_version() { - printf("Welcome to n2n v.%s for %s\n" - "Built on %s\n" - "Copyright 2007-2020 - ntop.org and contributors\n\n", - GIT_RELEASE, PACKAGE_OSNAME, PACKAGE_BUILDDATE); -} - -/* *********************************************** */ - -size_t purge_expired_registrations(struct peer_info ** peer_list, time_t* p_last_purge) { - time_t now = time(NULL); - size_t num_reg = 0; - - if((now - (*p_last_purge)) < PURGE_REGISTRATION_FREQUENCY) return 0; - - traceEvent(TRACE_DEBUG, "Purging old registrations"); - - num_reg = purge_peer_list(peer_list, now-REGISTRATION_TIMEOUT); - - (*p_last_purge) = now; - traceEvent(TRACE_DEBUG, "Remove %ld registrations", num_reg); - - return num_reg; -} - -/** Purge old items from the peer_list and return the number of items that were removed. */ -size_t purge_peer_list(struct peer_info ** peer_list, - time_t purge_before) -{ - struct peer_info *scan, *tmp; - size_t retval=0; - - HASH_ITER(hh, *peer_list, scan, tmp) { - if(scan->last_seen < purge_before) { - HASH_DEL(*peer_list, scan); - retval++; - free(scan); - } - } - - return retval; -} - -/** Purge all items from the peer_list and return the number of items that were removed. */ -size_t clear_peer_list(struct peer_info ** peer_list) -{ - struct peer_info *scan, *tmp; - size_t retval=0; - - HASH_ITER(hh, *peer_list, scan, tmp) { - HASH_DEL(*peer_list, scan); - retval++; - free(scan); - } - - return retval; -} - -static uint8_t hex2byte(const char * s) -{ - char tmp[3]; - tmp[0]=s[0]; - tmp[1]=s[1]; - tmp[2]=0; /* NULL term */ - - return((uint8_t)strtol(tmp, NULL, 16)); -} - -extern int str2mac(uint8_t * outmac /* 6 bytes */, const char * s) -{ - size_t i; - - /* break it down as one case for the first "HH", the 5 x through loop for - * each ":HH" where HH is a two hex nibbles in ASCII. */ - - *outmac=hex2byte(s); - ++outmac; - s+=2; /* don't skip colon yet - helps generalise loop. */ - - for(i=1; i<6; ++i) - { - s+=1; - *outmac=hex2byte(s); - ++outmac; - s+=2; - } - - return 0; /* ok */ -} - -extern char * sock_to_cstr(n2n_sock_str_t out, - const n2n_sock_t * sock) { - if(NULL == out) { return NULL; } - memset(out, 0, N2N_SOCKBUF_SIZE); - - if(AF_INET6 == sock->family) { - /* INET6 not written yet */ - snprintf(out, N2N_SOCKBUF_SIZE, "XXXX:%hu", sock->port); - return out; - } else { - const uint8_t * a = sock->addr.v4; - - snprintf(out, N2N_SOCKBUF_SIZE, "%hu.%hu.%hu.%hu:%hu", - (unsigned short)(a[0] & 0xff), - (unsigned short)(a[1] & 0xff), - (unsigned short)(a[2] & 0xff), - (unsigned short)(a[3] & 0xff), - (unsigned short)sock->port); - return out; - } -} - -/* @return 1 if the two sockets are equivalent. */ -int sock_equal(const n2n_sock_t * a, - const n2n_sock_t * b) { - if(a->port != b->port) { return(0); } - if(a->family != b->family) { return(0); } - - switch(a->family) { - case AF_INET: - if(memcmp(a->addr.v4, b->addr.v4, IPV4_SIZE)) - return(0); - break; - default: - if(memcmp(a->addr.v6, b->addr.v6, IPV6_SIZE)) - return(0); - break; - } - - /* equal */ - return(1); -} - -/* *********************************************** */ - -#if defined(WIN32) && !defined(__GNUC__) -int gettimeofday(struct timeval *tp, void *tzp) { - time_t clock; - struct tm tm; - SYSTEMTIME wtm; - GetLocalTime(&wtm); - tm.tm_year = wtm.wYear - 1900; - tm.tm_mon = wtm.wMonth - 1; - tm.tm_mday = wtm.wDay; - tm.tm_hour = wtm.wHour; - tm.tm_min = wtm.wMinute; - tm.tm_sec = wtm.wSecond; - tm.tm_isdst = -1; - clock = mktime(&tm); - tp->tv_sec = clock; - tp->tv_usec = wtm.wMilliseconds * 1000; - return (0); -} -#endif - - -// returns a time stamp for use with replay protection -uint64_t time_stamp (void) { - - struct timeval tod; - uint64_t micro_seconds; - - gettimeofday (&tod, NULL); - /* We will (roughly) calculate the microseconds since 1970 leftbound into the return value. - The leading 32 bits are used for tv_sec. The following 20 bits (sufficent as microseconds - fraction never exceeds 1,000,000,) encode the value tv_usec. The remaining lowest 12 bits - are kept random for use in IV */ - micro_seconds = n2n_rand(); - micro_seconds = ( (((uint64_t)(tod.tv_sec) << 32) + (tod.tv_usec << 12)) - | (micro_seconds >> 52) ); - // more exact but more costly due to the multiplication: - // micro_seconds = (tod.tv_sec * 1000000 + tod.tv_usec) << 12) | ... - - return (micro_seconds); -} - - -// returns an initial time stamp for use with replay protection -uint64_t initial_time_stamp (void) { - - return ( time_stamp() - TIME_STAMP_FRAME ); -} - - -// checks if a provided time stamp is consistent with current time and previously valid time stamps -// and, in case of validity, updates the "last valid time stamp" -int time_stamp_verify_and_update (uint64_t stamp, uint64_t * previous_stamp) { - - int64_t diff; // do not change to unsigned - - // is it around current time (+/- allowed deviation TIME_STAMP_FRAME)? - diff = stamp - time_stamp(); - // abs() - diff = (diff < 0 ? -diff : diff); - if(diff >= TIME_STAMP_FRAME) { - traceEvent(TRACE_DEBUG, "time_stamp_verify_and_update found a timestamp out of allowed frame."); - return (0); // failure - } - - // if applicable: is it higher than previous time stamp (including allowed deviation of TIME_STAMP_JITTER)? - if(NULL != previous_stamp) { - // if no jitter allowed, reset lowest three (random) nybbles; the codnition shoudl already be evaluated by the compiler - if(TIME_STAMP_JITTER == 0) { - stamp = (stamp >> 12) << 12; - *previous_stamp = (*previous_stamp >> 12) << 12; - } - diff = stamp - *previous_stamp + TIME_STAMP_JITTER; - if(diff <= 0) { - traceEvent(TRACE_DEBUG, "time_stamp_verify_and_update found a timestamp too old compared to previous."); - return (0); // failure - } - // for not allowing to exploit the allowed TIME_STAMP_JITTER to "turn the clock backwards", - // set the higher of the values - *previous_stamp = (stamp > *previous_stamp ? stamp : *previous_stamp); - } - - return (1); // success -} diff --git a/bundles/n2n_ntop_v2/src/pearson.c b/bundles/n2n_ntop_v2/src/pearson.c deleted file mode 100644 index a515b521..00000000 --- a/bundles/n2n_ntop_v2/src/pearson.c +++ /dev/null @@ -1,338 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -// taken from https://github.com/Logan007/pearson -// This is free and unencumbered software released into the public domain. - -#include -#include - -#include "pearson.h" - -// compile with 'LOW_MEM_FOOTPRINT' defined to make use of 256 byte look-up tabe only -// otherwise, a 16-bit look-up table is used which allows considerably faster hashing -// however, it needs to be generated by once calling pearson_hash_init() upfront -// #define LOW_MEM_FOOTPRINT - -// table as in original paper "Fast Hashing of Variable-Length Text Strings" by Peter K. Pearson -// as published in The Communications of the ACM Vol.33, No. 6 (June 1990), pp. 677-680. -static const uint8_t t[256] ={ - 0x01, 0x57, 0x31, 0x0c, 0xb0, 0xb2, 0x66, 0xa6, 0x79, 0xc1, 0x06, 0x54, 0xf9, 0xe6, 0x2c, 0xa3, - 0x0e, 0xc5, 0xd5, 0xb5, 0xa1, 0x55, 0xda, 0x50, 0x40, 0xef, 0x18, 0xe2, 0xec, 0x8e, 0x26, 0xc8, - 0x6e, 0xb1, 0x68, 0x67, 0x8d, 0xfd, 0xff, 0x32, 0x4d, 0x65, 0x51, 0x12, 0x2d, 0x60, 0x1f, 0xde, - 0x19, 0x6b, 0xbe, 0x46, 0x56, 0xed, 0xf0, 0x22, 0x48, 0xf2, 0x14, 0xd6, 0xf4, 0xe3, 0x95, 0xeb, - 0x61, 0xea, 0x39, 0x16, 0x3c, 0xfa, 0x52, 0xaf, 0xd0, 0x05, 0x7f, 0xc7, 0x6f, 0x3e, 0x87, 0xf8, - 0xae, 0xa9, 0xd3, 0x3a, 0x42, 0x9a, 0x6a, 0xc3, 0xf5, 0xab, 0x11, 0xbb, 0xb6, 0xb3, 0x00, 0xf3, - 0x84, 0x38, 0x94, 0x4b, 0x80, 0x85, 0x9e, 0x64, 0x82, 0x7e, 0x5b, 0x0d, 0x99, 0xf6, 0xd8, 0xdb, - 0x77, 0x44, 0xdf, 0x4e, 0x53, 0x58, 0xc9, 0x63, 0x7a, 0x0b, 0x5c, 0x20, 0x88, 0x72, 0x34, 0x0a, - 0x8a, 0x1e, 0x30, 0xb7, 0x9c, 0x23, 0x3d, 0x1a, 0x8f, 0x4a, 0xfb, 0x5e, 0x81, 0xa2, 0x3f, 0x98, - 0xaa, 0x07, 0x73, 0xa7, 0xf1, 0xce, 0x03, 0x96, 0x37, 0x3b, 0x97, 0xdc, 0x5a, 0x35, 0x17, 0x83, - 0x7d, 0xad, 0x0f, 0xee, 0x4f, 0x5f, 0x59, 0x10, 0x69, 0x89, 0xe1, 0xe0, 0xd9, 0xa0, 0x25, 0x7b, - 0x76, 0x49, 0x02, 0x9d, 0x2e, 0x74, 0x09, 0x91, 0x86, 0xe4, 0xcf, 0xd4, 0xca, 0xd7, 0x45, 0xe5, - 0x1b, 0xbc, 0x43, 0x7c, 0xa8, 0xfc, 0x2a, 0x04, 0x1d, 0x6c, 0x15, 0xf7, 0x13, 0xcd, 0x27, 0xcb, - 0xe9, 0x28, 0xba, 0x93, 0xc6, 0xc0, 0x9b, 0x21, 0xa4, 0xbf, 0x62, 0xcc, 0xa5, 0xb4, 0x75, 0x4c, - 0x8c, 0x24, 0xd2, 0xac, 0x29, 0x36, 0x9f, 0x08, 0xb9, 0xe8, 0x71, 0xc4, 0xe7, 0x2f, 0x92, 0x78, - 0x33, 0x41, 0x1c, 0x90, 0xfe, 0xdd, 0x5d, 0xbd, 0xc2, 0x8b, 0x70, 0x2b, 0x47, 0x6d, 0xb8, 0xd1 }; - -/* -// alternative table as used in RFC 3074 and NOT as in original paper -static const uint8_t t[256] ={ -0xfb, 0xaf, 0x77, 0xd7, 0x51, 0x0e, 0x4f, 0xbf, 0x67, 0x31, 0xb5, 0x8f, 0xba, 0x9d, 0x00, 0xe8, -0x1f, 0x20, 0x37, 0x3c, 0x98, 0x3a, 0x11, 0xed, 0xae, 0x46, 0xa0, 0x90, 0xdc, 0x5a, 0x39, 0xdf, -0x3b, 0x03, 0x12, 0x8c, 0x6f, 0xa6, 0xcb, 0xc4, 0x86, 0xf3, 0x7c, 0x5f, 0xde, 0xb3, 0xc5, 0x41, -0xb4, 0x30, 0x24, 0x0f, 0x6b, 0x2e, 0xe9, 0x82, 0xa5, 0x1e, 0x7b, 0xa1, 0xd1, 0x17, 0x61, 0x10, -0x28, 0x5b, 0xdb, 0x3d, 0x64, 0x0a, 0xd2, 0x6d, 0xfa, 0x7f, 0x16, 0x8a, 0x1d, 0x6c, 0xf4, 0x43, -0xcf, 0x09, 0xb2, 0xcc, 0x4a, 0x62, 0x7e, 0xf9, 0xa7, 0x74, 0x22, 0x4d, 0xc1, 0xc8, 0x79, 0x05, -0x14, 0x71, 0x47, 0x23, 0x80, 0x0d, 0xb6, 0x5e, 0x19, 0xe2, 0xe3, 0xc7, 0x4b, 0x1b, 0x29, 0xf5, -0xe6, 0xe0, 0x2b, 0xe1, 0xb1, 0x1a, 0x9b, 0x96, 0xd4, 0x8e, 0xda, 0x73, 0xf1, 0x49, 0x58, 0x69, -0x27, 0x72, 0x3e, 0xff, 0xc0, 0xc9, 0x91, 0xd6, 0xa8, 0x9e, 0xdd, 0x94, 0x9a, 0x7a, 0x0c, 0x54, -0x52, 0xa3, 0x2c, 0x8b, 0xe4, 0xec, 0xcd, 0xf2, 0xd9, 0x0b, 0xbb, 0x92, 0x9f, 0x40, 0x56, 0xef, -0xc3, 0x2a, 0x6a, 0xc6, 0x76, 0x70, 0xb8, 0xac, 0x57, 0x02, 0xad, 0x75, 0xb0, 0xe5, 0xf7, 0xfd, -0x89, 0xb9, 0x63, 0xa4, 0x66, 0x93, 0x2d, 0x42, 0xe7, 0x34, 0x8d, 0xd3, 0xc2, 0xce, 0xf6, 0xee, -0x38, 0x6e, 0x4e, 0xf8, 0x3f, 0xf0, 0xbd, 0x5d, 0x5c, 0x33, 0x35, 0xb7, 0x13, 0xab, 0x48, 0x32, -0x21, 0x68, 0x65, 0x45, 0x08, 0xfc, 0x53, 0x78, 0x4c, 0x87, 0x55, 0x36, 0xca, 0x7d, 0xbc, 0xd5, -0x60, 0xeb, 0x88, 0xd0, 0xa2, 0x81, 0xbe, 0x84, 0x9c, 0x26, 0x2f, 0x01, 0x07, 0xfe, 0x18, 0x04, -0xd8, 0x83, 0x59, 0x15, 0x1c, 0x85, 0x25, 0x99, 0x95, 0x50, 0xaa, 0x44, 0x06, 0xa9, 0xea, 0x97 }; */ - - -#ifndef LOW_MEM_FOOTPRINT -static uint16_t t16[65536]; // 16-bit look-up table -#endif - -#define ROR64(x,r) (((x)>>(r))|((x)<<(64-(r)))) -#define ROR32(x,r) (((x)>>(r))|((x)<<(32-(r)))) - - -void pearson_hash_256 (uint8_t *out, const uint8_t *in, size_t len) { - - size_t i; - /* initial values - astonishingly, assembling using SHIFTs and ORs (in register) - * works faster on well pipelined CPUs than loading the 64-bit value from memory. - * however, there is one advantage to loading from memory: as we also store back to - * memory at the end, we do not need to care about endianess! */ - uint8_t upper[8] = { 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }; - uint8_t lower[8] = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }; - - uint64_t upper_hash_mask = *(uint64_t*)&upper; - uint64_t lower_hash_mask = *(uint64_t*)&lower; - uint64_t high_upper_hash_mask = upper_hash_mask + 0x1010101010101010; - uint64_t high_lower_hash_mask = lower_hash_mask + 0x1010101010101010; - - uint64_t upper_hash = 0; - uint64_t lower_hash = 0; - uint64_t high_upper_hash = 0; - uint64_t high_lower_hash = 0; - - for (i = 0; i < len; i++) { - // broadcast the character, xor into hash, make them different permutations - uint64_t c = (uint8_t)in[i]; - c |= c << 8; - c |= c << 16; - c |= c << 32; - upper_hash ^= c ^ upper_hash_mask; - lower_hash ^= c ^ lower_hash_mask; - high_upper_hash ^= c ^ high_upper_hash_mask; - high_lower_hash ^= c ^ high_lower_hash_mask; - - // table lookup - uint64_t h = 0; -#ifdef LOW_MEM_FOOTPRINT // 256 byte look-up table ---------- - uint8_t x; - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - upper_hash = h; - - h = 0; - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - lower_hash = h; - - h = 0; - x = high_upper_hash; x = t[x]; high_upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_upper_hash; x = t[x]; high_upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_upper_hash; x = t[x]; high_upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_upper_hash; x = t[x]; high_upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_upper_hash; x = t[x]; high_upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_upper_hash; x = t[x]; high_upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_upper_hash; x = t[x]; high_upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_upper_hash; x = t[x]; high_upper_hash >>= 8; h |= x; h=ROR64(h,8); - high_upper_hash = h; - - h = 0; - x = high_lower_hash; x = t[x]; high_lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_lower_hash; x = t[x]; high_lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_lower_hash; x = t[x]; high_lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_lower_hash; x = t[x]; high_lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_lower_hash; x = t[x]; high_lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_lower_hash; x = t[x]; high_lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_lower_hash; x = t[x]; high_lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = high_lower_hash; x = t[x]; high_lower_hash >>= 8; h |= x; h=ROR64(h,8); - high_lower_hash = h; -#else // 16-bit look-up table ------------------------------- - uint16_t x; - x = upper_hash; x = t16[x]; upper_hash >>= 16; h |= x; h=ROR64(h,16); - x = upper_hash; x = t16[x]; upper_hash >>= 16; h |= x; h=ROR64(h,16); - x = upper_hash; x = t16[x]; upper_hash >>= 16; h |= x; h=ROR64(h,16); - x = upper_hash; x = t16[x]; upper_hash >>= 16; h |= x; h=ROR64(h,16); - upper_hash = h; - - h = 0; - x = lower_hash; x = t16[x]; lower_hash >>= 16; h |= x; h=ROR64(h,16); - x = lower_hash; x = t16[x]; lower_hash >>= 16; h |= x; h=ROR64(h,16); - x = lower_hash; x = t16[x]; lower_hash >>= 16; h |= x; h=ROR64(h,16); - x = lower_hash; x = t16[x]; lower_hash >>= 16; h |= x; h=ROR64(h,16); - lower_hash = h; - - h = 0; - x = high_upper_hash; x = t16[x]; high_upper_hash >>= 16; h |= x; h=ROR64(h,16); - x = high_upper_hash; x = t16[x]; high_upper_hash >>= 16; h |= x; h=ROR64(h,16); - x = high_upper_hash; x = t16[x]; high_upper_hash >>= 16; h |= x; h=ROR64(h,16); - x = high_upper_hash; x = t16[x]; high_upper_hash >>= 16; h |= x; h=ROR64(h,16); - high_upper_hash = h; - - h = 0; - x = high_lower_hash; x = t16[x]; high_lower_hash >>= 16; h |= x; h=ROR64(h,16); - x = high_lower_hash; x = t16[x]; high_lower_hash >>= 16; h |= x; h=ROR64(h,16); - x = high_lower_hash; x = t16[x]; high_lower_hash >>= 16; h |= x; h=ROR64(h,16); - x = high_lower_hash; x = t16[x]; high_lower_hash >>= 16; h |= x; h=ROR64(h,16); - high_lower_hash = h; -#endif // LOW_MEM_FOOTPRINT ------ - } - // store output - uint64_t *o; - o = (uint64_t*)&out[0]; - *o = high_upper_hash; - o = (uint64_t*)&out[8]; - *o = high_lower_hash; - o = (uint64_t*)&out[16]; - *o = upper_hash; - o = (uint64_t*)&out[24]; - *o = lower_hash; -} - - -void pearson_hash_128 (uint8_t *out, const uint8_t *in, size_t len) { - - size_t i; - /* initial values - astonishingly, assembling using SHIFTs and ORs (in register) - * works faster on well pipelined CPUs than loading the 64-bit value from memory. - * however, there is one advantage to loading from memory: as we also store back to - * memory at the end, we do not need to care about endianess! */ - uint8_t upper[8] = { 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }; - uint8_t lower[8] = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }; - - uint64_t upper_hash_mask = *(uint64_t*)&upper; - uint64_t lower_hash_mask = *(uint64_t*)&lower; - - uint64_t upper_hash = 0; - uint64_t lower_hash = 0; - - for (i = 0; i < len; i++) { - // broadcast the character, xor into hash, make them different permutations - uint64_t c = (uint8_t)in[i]; - c |= c << 8; - c |= c << 16; - c |= c << 32; - upper_hash ^= c ^ upper_hash_mask; - lower_hash ^= c ^ lower_hash_mask; - // table lookup - uint64_t h = 0; -#ifdef LOW_MEM_FOOTPRINT // 256 byte look-up table ---------- - uint8_t x; - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - x = upper_hash; x = t[x]; upper_hash >>= 8; h |= x; h=ROR64(h,8); - upper_hash = h; - - h = 0; - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - x = lower_hash; x = t[x]; lower_hash >>= 8; h |= x; h=ROR64(h,8); - lower_hash= h; -#else // 16-bit look-up table ------------------------------- - uint16_t x; - x = upper_hash; x = t16[x]; upper_hash >>= 16; h |= x; h=ROR64(h,16); - x = upper_hash; x = t16[x]; upper_hash >>= 16; h |= x; h=ROR64(h,16); - x = upper_hash; x = t16[x]; upper_hash >>= 16; h |= x; h=ROR64(h,16); - x = upper_hash; x = t16[x]; upper_hash >>= 16; h |= x; h=ROR64(h,16); - upper_hash = h; - - h = 0; - x = lower_hash; x = t16[x]; lower_hash >>= 16; h |= x; h=ROR64(h,16); - x = lower_hash; x = t16[x]; lower_hash >>= 16; h |= x; h=ROR64(h,16); - x = lower_hash; x = t16[x]; lower_hash >>= 16; h |= x; h=ROR64(h,16); - x = lower_hash; x = t16[x]; lower_hash >>= 16; h |= x; h=ROR64(h,16); - lower_hash = h; -#endif // LOW_MEM_FOOTPRINT ------ - } - // store output - uint64_t *o; - o = (uint64_t*)&out[0]; - *o = upper_hash; - o = (uint64_t*)&out[8]; - *o = lower_hash; -} - -/* --- for later use --- -// 32-bit hash: the return value has to be interpreted as uint32_t and -// follows machine-specific endianess in memory -uint32_t pearson_hash_32 (const uint8_t *in, size_t len) { - - size_t i; - uint32_t hash = 0; - uint32_t hash_mask = 0x03020100; - - for (i = 0; i < len; i++) { - // broadcast the character, xor into hash, make them different permutations - uint32_t c = (uint8_t)in[i]; - c |= c << 8; - c |= c << 16; - hash ^= c ^ hash_mask; - // table lookup -#ifdef LOW_MEM_FOOTPRINT - uint32_t h = 0; - uint8_t x; - x = hash; x = t[x]; hash >>= 8; h |= x; h=ROR32(h,8); - x = hash; x = t[x]; hash >>= 8; h |= x; h=ROR32(h,8); - x = hash; x = t[x]; hash >>= 8; h |= x; h=ROR32(h,8); - x = hash; x = t[x]; hash >>= 8; h |= x; h=ROR32(h,8); - hash = h; -#else - hash = (t16[hash >> 16] << 16) + t16[(uint16_t)hash]; -#endif - } - // output - return hash; -} --- pearson_hash_32 for later use --- */ - - -// 16-bit hash: the return value has to be interpreted as uint16_t and -// follows machine-specific endianess in memory -uint16_t pearson_hash_16 (const uint8_t *in, size_t len) { - size_t i; - uint16_t hash = 0; - uint16_t hash_mask = 0x0100; - - for (i = 0; i < len; i++) { - // broadcast the character, xor into hash, make them different permutations - uint16_t c = (uint8_t)in[i]; - c |= c << 8; - hash ^= c ^ hash_mask; - // table lookup -#ifdef LOW_MEM_FOOTPRINT - hash = t[(uint8_t)hash] + (t[hash >> 8] << 8); -#else - hash = t16[hash]; -#endif - } - // output - return hash; -} - - -void pearson_hash_init () { - -#ifndef LOW_MEM_FOOTPRINT - size_t i; - - for (i = 0; i < 65536; i++) - t16[i] = (t[i >> 8] << 8) + t[(uint8_t)i]; -#endif -} diff --git a/bundles/n2n_ntop_v2/src/random_numbers.c b/bundles/n2n_ntop_v2/src/random_numbers.c deleted file mode 100644 index aa98fb87..00000000 --- a/bundles/n2n_ntop_v2/src/random_numbers.c +++ /dev/null @@ -1,176 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifdef SYS_getrandom -#include -#endif - -#include "n2n.h" - - -/* The following code offers an alterate pseudo random number generator - namely XORSHIFT128+ to use instead of C's rand(). Its performance is - on par with C's rand(). -*/ - - -/* The state must be seeded in a way that it is not all zero, choose some - arbitrary defaults (in this case: taken from splitmix64) */ -static struct rn_generator_state_t rn_current_state = { - .a = 0x9E3779B97F4A7C15, - .b = 0xBF58476D1CE4E5B9 }; - - -/* used for mixing the initializing seed */ -static uint64_t splitmix64 (struct splitmix64_state_t *state) { - - uint64_t result = state->s; - - state->s = result + 0x9E3779B97F4A7C15; - - result = (result ^ (result >> 30)) * 0xBF58476D1CE4E5B9; - result = (result ^ (result >> 27)) * 0x94D049BB133111EB; - - return result ^ (result >> 31); -} - - -int n2n_srand (uint64_t seed) { - uint8_t i; - struct splitmix64_state_t smstate = {seed}; - - rn_current_state.a = 0; - rn_current_state.b = 0; - - rn_current_state.a = splitmix64 (&smstate); - rn_current_state.b = splitmix64 (&smstate); - - /* the following lines could be deleted as soon as it is formally prooved that - there is no seed leading to (a == b == 0). Until then, just to be safe: */ - if ( (rn_current_state.a == 0) && (rn_current_state.b == 0) ) { - rn_current_state.a = 0x9E3779B97F4A7C15; - rn_current_state.b = 0xBF58476D1CE4E5B9; - } - - /* stabilize in unlikely case of weak state with only a few bits set */ - for(i = 0; i < 32; i++) - n2n_rand(); - - return 0; -} - - -/* The following code of xorshift128p was taken from - https://en.wikipedia.org/wiki/Xorshift as of July, 2019 - and thus is considered public domain. */ -uint64_t n2n_rand () { - - uint64_t t = rn_current_state.a; - uint64_t const s = rn_current_state.b; - - rn_current_state.a = s; - t ^= t << 23; - t ^= t >> 17; - t ^= s ^ (s >> 26); - rn_current_state.b = t; - - return t + s; -} - - -/* The following code tries to gather some entropy from several sources - for use as seed. Note, that this code does not set the random generator - state yet, a call to n2n_srand ( n2n_seed() ) would do. */ -uint64_t n2n_seed (void) { - - uint64_t seed = 0; - uint64_t ret = 0; - size_t i; - -#ifdef SYS_getrandom - int rc = -1; - for(i = 0; (i < RND_RETRIES) && (rc != sizeof(seed)); i++) { - rc = syscall (SYS_getrandom, &seed, sizeof(seed), GRND_NONBLOCK); - // if successful, rc should contain the requested number of random bytes - if(rc != sizeof(seed)) { - if (errno != EAGAIN) { - traceEvent(TRACE_ERROR, "n2n_seed faced error errno=%u from getrandom syscall.", errno); - break; - } - } - } - // if we still see an EAGAIN error here, we must have run out of retries - if(errno == EAGAIN) { - traceEvent(TRACE_ERROR, "n2n_seed saw getrandom syscall indicate not being able to provide enough entropy yet."); - } -#endif - - // as we want randomness, it does no harm to add up even uninitialized values or - // erroneously arbitrary values returned from the syscall for the first time - ret += seed; - - // __RDRND__ is set only if architecturual feature is set, e.g. compile with -march=native -#ifdef __RDRND__ - for(i = 0; i < RND_RETRIES; i++) { - if(_rdrand64_step ((unsigned long long*)&seed)) { - // success! - // from now on, we keep this inside the loop because in case of failure - // and with unchanged values, we do not want to double the previous value - ret += seed; - break; - } - // continue loop to try again otherwise - } - if(i == RND_RETRIES){ - traceEvent(TRACE_ERROR, "n2n_seed was not able to get a hardware generated random number from RDRND."); - } -#endif - - // __RDSEED__ ist set only if architecturual feature is set, e.g. compile with -march=native -#ifdef __RDSEED__ - for(i = 0; i < RND_RETRIES; i++) { - if(_rdseed64_step((unsigned long long*)&seed)) { - // success! - ret += seed; - break; - } - // continue loop to try again otherwise - } - if(i == RND_RETRIES){ - traceEvent(TRACE_ERROR, "n2n_seed was not able to get a hardware generated random number from RDSEED."); - } -#endif - - /* The WIN32 code is still untested and thus commented - #ifdef WIN32 - HCRYPTPROV crypto_provider; - CryptAcquireContext (&crypto_provider, NULL, (LPCWSTR)L"Microsoft Base Cryptographic Provider v1.0", - PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); - CryptGenRandom (crypto_provider, 8, &seed); - CryptReleaseContext (crypto_provider, 0); - ret += seed; - #endif */ - - seed = time(NULL); /* UTC in seconds */ - ret += seed; - - seed = clock() * 18444244737; /* clock() = ticks since program start */ - ret += seed; - - return ret; -} diff --git a/bundles/n2n_ntop_v2/src/sn.c b/bundles/n2n_ntop_v2/src/sn.c deleted file mode 100644 index 4087152a..00000000 --- a/bundles/n2n_ntop_v2/src/sn.c +++ /dev/null @@ -1,442 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -/* Supernode for n2n-2.x */ - -#include "n2n.h" -#include "header_encryption.h" - -static n2n_sn_t sss_node; - -/** Load the list of allowed communities. Existing/previous ones will be removed - * - */ -static int load_allowed_sn_community(n2n_sn_t *sss, char *path) { - char buffer[4096], *line; - FILE *fd = fopen(path, "r"); - struct sn_community *s, *tmp; - uint32_t num_communities = 0; - - if(fd == NULL) { - traceEvent(TRACE_WARNING, "File %s not found", path); - return -1; - } - - HASH_ITER(hh, sss->communities, s, tmp) { - HASH_DEL(sss->communities, s); - if (NULL != s->header_encryption_ctx) - free (s->header_encryption_ctx); - free(s); - } - - while((line = fgets(buffer, sizeof(buffer), fd)) != NULL) { - int len = strlen(line); - - if((len < 2) || line[0] == '#') - continue; - - len--; - while(len > 0) { - if((line[len] == '\n') || (line[len] == '\r')) { - line[len] = '\0'; - len--; - } else - break; - } - - s = (struct sn_community*)calloc(1,sizeof(struct sn_community)); - - if(s != NULL) { - strncpy((char*)s->community, line, N2N_COMMUNITY_SIZE-1); - s->community[N2N_COMMUNITY_SIZE-1] = '\0'; - /* we do not know if header encryption is used in this community, - * first packet will show. just in case, setup the key. */ - s->header_encryption = HEADER_ENCRYPTION_UNKNOWN; - packet_header_setup_key (s->community, &(s->header_encryption_ctx), &(s->header_iv_ctx)); - HASH_ADD_STR(sss->communities, community, s); - - num_communities++; - traceEvent(TRACE_INFO, "Added allowed community '%s' [total: %u]", - (char*)s->community, num_communities); - } - } - - fclose(fd); - - traceEvent(TRACE_NORMAL, "Loaded %u communities from %s", - num_communities, path); - - /* No new communities will be allowed */ - sss->lock_communities = 1; - - return(0); -} - - -/* *************************************************** */ - -/** Help message to print if the command line arguments are not valid. */ -static void help() { - print_n2n_version(); - - printf("supernode (see supernode.conf)\n" - "or\n" - ); - printf("supernode "); - printf("-l "); - printf("-c "); -#if defined(N2N_HAVE_DAEMON) - printf("[-f] "); -#endif -#ifndef WIN32 - printf("[-u -g ] "); -#endif /* ifndef WIN32 */ - printf("[-t ] "); - printf("[-v] "); - printf("\n\n"); - - printf("-l \tSet UDP main listen port to \n"); - printf("-c \tFile containing the allowed communities.\n"); -#if defined(N2N_HAVE_DAEMON) - printf("-f \tRun in foreground.\n"); -#endif /* #if defined(N2N_HAVE_DAEMON) */ -#ifndef WIN32 - printf("-u \tUser ID (numeric) to use when privileges are dropped.\n"); - printf("-g \tGroup ID (numeric) to use when privileges are dropped.\n"); -#endif /* ifndef WIN32 */ - printf("-t \tManagement UDP Port (for multiple supernodes on a machine).\n"); - printf("-v \tIncrease verbosity. Can be used multiple times.\n"); - printf("-h \tThis help message.\n"); - printf("\n"); - - exit(1); -} - - -/* *************************************************** */ - -static int setOption(int optkey, char *_optarg, n2n_sn_t *sss) { - //traceEvent(TRACE_NORMAL, "Option %c = %s", optkey, _optarg ? _optarg : ""); - - switch(optkey) { - case 'l': /* local-port */ - sss->lport = atoi(_optarg); - break; - - case 't': /* mgmt-port */ - sss->mport = atoi(_optarg); - break; - -#ifndef WIN32 - case 'u': /* unprivileged uid */ - sss->userid = atoi(_optarg); - break; - - case 'g': /* unprivileged uid */ - sss->groupid = atoi(_optarg); - break; -#endif - - case 'c': /* community file */ - load_allowed_sn_community(sss, _optarg); - break; - - case 'f': /* foreground */ - sss->daemon = 0; - break; - - case 'h': /* help */ - help(); - break; - - case 'v': /* verbose */ - setTraceLevel(getTraceLevel() + 1); - break; - - default: - traceEvent(TRACE_WARNING, "Unknown option -%c: Ignored.", (char)optkey); - return(-1); - } - - return(0); -} - -/* *********************************************** */ - -static const struct option long_options[] = { - { "communities", required_argument, NULL, 'c' }, - { "foreground", no_argument, NULL, 'f' }, - { "local-port", required_argument, NULL, 'l' }, - { "mgmt-port", required_argument, NULL, 't' }, - { "help" , no_argument, NULL, 'h' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, 0, NULL, 0 } -}; - -/* *************************************************** */ - -/* read command line options */ -static int loadFromCLI(int argc, char * const argv[], n2n_sn_t *sss) { - u_char c; - - while((c = getopt_long(argc, argv, "fl:u:g:t:c:vh", - long_options, NULL)) != '?') { - if(c == 255) break; - setOption(c, optarg, sss); - } - - return 0; -} - -/* *************************************************** */ - -static char *trim(char *s) { - char *end; - - while(isspace(s[0]) || (s[0] == '"') || (s[0] == '\'')) - s++; - - if(s[0] == 0) return s; - - end = &s[strlen(s) - 1]; - while(end > s - && (isspace(end[0])|| (end[0] == '"') || (end[0] == '\''))) - end--; - end[1] = 0; - - return s; -} - -/* *************************************************** */ - -/* parse the configuration file */ -static int loadFromFile(const char *path, n2n_sn_t *sss) { - char buffer[4096], *line, *key, *value; - u_int line_len, opt_name_len; - FILE *fd; - const struct option *opt; - - fd = fopen(path, "r"); - - if(fd == NULL) { - traceEvent(TRACE_WARNING, "Config file %s not found", path); - return -1; - } - - while((line = fgets(buffer, sizeof(buffer), fd)) != NULL) { - - line = trim(line); - value = NULL; - - if((line_len = strlen(line)) < 2 || line[0] == '#') - continue; - - if(!strncmp(line, "--", 2)) { /* long opt */ - key = &line[2], line_len -= 2; - - opt = long_options; - while(opt->name != NULL) { - opt_name_len = strlen(opt->name); - - if(!strncmp(key, opt->name, opt_name_len) - && (line_len <= opt_name_len - || key[opt_name_len] == '\0' - || key[opt_name_len] == ' ' - || key[opt_name_len] == '=')) { - if(line_len > opt_name_len) key[opt_name_len] = '\0'; - if(line_len > opt_name_len + 1) value = trim(&key[opt_name_len + 1]); - - // traceEvent(TRACE_NORMAL, "long key: %s value: %s", key, value); - setOption(opt->val, value, sss); - break; - } - - opt++; - } - } else if(line[0] == '-') { /* short opt */ - key = &line[1], line_len--; - if(line_len > 1) key[1] = '\0'; - if(line_len > 2) value = trim(&key[2]); - - // traceEvent(TRACE_NORMAL, "key: %c value: %s", key[0], value); - setOption(key[0], value, sss); - } else { - traceEvent(TRACE_WARNING, "Skipping unrecognized line: %s", line); - continue; - } - } - - fclose(fd); - - return 0; -} - -/* *************************************************** */ - -#ifdef __linux__ -static void dump_registrations(int signo) { - struct sn_community *comm, *ctmp; - struct peer_info *list, *tmp; - char buf[32]; - time_t now = time(NULL); - u_int num = 0; - - traceEvent(TRACE_NORMAL, "===================================="); - - HASH_ITER(hh, sss_node.communities, comm, ctmp) { - traceEvent(TRACE_NORMAL, "Dumping community: %s", comm->community); - - HASH_ITER(hh, comm->edges, list, tmp) { - if(list->sock.family == AF_INET) - traceEvent(TRACE_NORMAL, "[id: %u][MAC: %s][edge: %u.%u.%u.%u:%u][last seen: %u sec ago]", - ++num, macaddr_str(buf, list->mac_addr), - list->sock.addr.v4[0], list->sock.addr.v4[1], list->sock.addr.v4[2], list->sock.addr.v4[3], - list->sock.port, - now-list->last_seen); - else - traceEvent(TRACE_NORMAL, "[id: %u][MAC: %s][edge: IPv6:%u][last seen: %u sec ago]", - ++num, macaddr_str(buf, list->mac_addr), list->sock.port, - now-list->last_seen); - } - } - - traceEvent(TRACE_NORMAL, "===================================="); -} -#endif - -/* *************************************************** */ - -static int keep_running; - -#if defined(__linux__) || defined(WIN32) -#ifdef WIN32 -BOOL WINAPI term_handler(DWORD sig) -#else -static void term_handler(int sig) -#endif -{ - static int called = 0; - - if(called) { - traceEvent(TRACE_NORMAL, "Ok I am leaving now"); - _exit(0); - } else { - traceEvent(TRACE_NORMAL, "Shutting down..."); - called = 1; - } - - keep_running = 0; -#ifdef WIN32 - return(TRUE); -#endif -} -#endif /* defined(__linux__) || defined(WIN32) */ - -/* *************************************************** */ - -/** Main program entry point from kernel. */ -int main(int argc, char * const argv[]) { - int rc; -#ifndef WIN32 - struct passwd *pw = NULL; -#endif - - sn_init(&sss_node); - - if((argc >= 2) && (argv[1][0] != '-')) { - rc = loadFromFile(argv[1], &sss_node); - if(argc > 2) - rc = loadFromCLI(argc, argv, &sss_node); - } else if(argc > 1) - rc = loadFromCLI(argc, argv, &sss_node); - else -#ifdef WIN32 - /* Load from current directory */ - rc = loadFromFile("supernode.conf", &sss_node); -#else - rc = -1; -#endif - - if(rc < 0) - help(); - -#if defined(N2N_HAVE_DAEMON) - if(sss_node.daemon) { - setUseSyslog(1); /* traceEvent output now goes to syslog. */ - - if(-1 == daemon(0, 0)) { - traceEvent(TRACE_ERROR, "Failed to become daemon."); - exit(-5); - } - } -#endif /* #if defined(N2N_HAVE_DAEMON) */ - - traceEvent(TRACE_DEBUG, "traceLevel is %d", getTraceLevel()); - - sss_node.sock = open_socket(sss_node.lport, 1 /*bind ANY*/); - if(-1 == sss_node.sock) { - traceEvent(TRACE_ERROR, "Failed to open main socket. %s", strerror(errno)); - exit(-2); - } else { - traceEvent(TRACE_NORMAL, "supernode is listening on UDP %u (main)", sss_node.lport); - } - - sss_node.mgmt_sock = open_socket(sss_node.mport, 0 /* bind LOOPBACK */); - if(-1 == sss_node.mgmt_sock) { - traceEvent(TRACE_ERROR, "Failed to open management socket. %s", strerror(errno)); - exit(-2); - } else - traceEvent(TRACE_NORMAL, "supernode is listening on UDP %u (management)", sss_node.mport); - -#ifndef WIN32 - if (((pw = getpwnam ("n2n")) != NULL) || ((pw = getpwnam ("nobody")) != NULL)) { - sss_node.userid = sss_node.userid == 0 ? pw->pw_uid : 0; - sss_node.groupid = sss_node.groupid == 0 ? pw->pw_gid : 0; - } - if((sss_node.userid != 0) || (sss_node.groupid != 0)) { - traceEvent(TRACE_NORMAL, "Dropping privileges to uid=%d, gid=%d", - (signed int)sss_node.userid, (signed int)sss_node.groupid); - - /* Finished with the need for root privileges. Drop to unprivileged user. */ - if((setgid(sss_node.groupid) != 0) - || (setuid(sss_node.userid) != 0)) { - traceEvent(TRACE_ERROR, "Unable to drop privileges [%u/%s]", errno, strerror(errno)); - exit(1); - } - } - - if((getuid() == 0) || (getgid() == 0)) - traceEvent(TRACE_WARNING, "Running as root is discouraged, check out the -u/-g options"); -#endif - - traceEvent(TRACE_NORMAL, "supernode started"); - -#ifdef __linux__ - signal(SIGTERM, term_handler); - signal(SIGINT, term_handler); - signal(SIGHUP, dump_registrations); -#endif -#ifdef WIN32 - SetConsoleCtrlHandler(term_handler, TRUE); -#endif - - keep_running = 1; - return run_sn_loop(&sss_node, &keep_running); -} - - diff --git a/bundles/n2n_ntop_v2/src/sn_utils.c b/bundles/n2n_ntop_v2/src/sn_utils.c deleted file mode 100644 index 9c184777..00000000 --- a/bundles/n2n_ntop_v2/src/sn_utils.c +++ /dev/null @@ -1,1038 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out) - -static int try_forward(n2n_sn_t * sss, - const struct sn_community *comm, - const n2n_common_t * cmn, - const n2n_mac_t dstMac, - const uint8_t * pktbuf, - size_t pktsize); - -static ssize_t sendto_sock(n2n_sn_t *sss, - const n2n_sock_t *sock, - const uint8_t *pktbuf, - size_t pktsize); - -static int sendto_mgmt(n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - const uint8_t *mgmt_buf, - size_t mgmt_size); - -static int try_broadcast(n2n_sn_t * sss, - const struct sn_community *comm, - const n2n_common_t * cmn, - const n2n_mac_t srcMac, - const uint8_t * pktbuf, - size_t pktsize); - -static uint16_t reg_lifetime(n2n_sn_t *sss); - -static int update_edge(n2n_sn_t *sss, - const n2n_mac_t edgeMac, - struct sn_community *comm, - const n2n_sock_t *sender_sock, - time_t now); - -static int purge_expired_communities(n2n_sn_t *sss, - time_t* p_last_purge, - time_t now); - -static int sort_communities (n2n_sn_t *sss, - time_t* p_last_sort, - time_t now); - -static int process_mgmt(n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - const uint8_t *mgmt_buf, - size_t mgmt_size, - time_t now); - -static int process_udp(n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - uint8_t *udp_buf, - size_t udp_size, - time_t now); - -/* ************************************** */ - -static int try_forward(n2n_sn_t * sss, - const struct sn_community *comm, - const n2n_common_t * cmn, - const n2n_mac_t dstMac, - const uint8_t * pktbuf, - size_t pktsize) -{ - struct peer_info * scan; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - HASH_FIND_PEER(comm->edges, dstMac, scan); - - if(NULL != scan) - { - int data_sent_len; - data_sent_len = sendto_sock(sss, &(scan->sock), pktbuf, pktsize); - - if(data_sent_len == pktsize) - { - ++(sss->stats.fwd); - traceEvent(TRACE_DEBUG, "unicast %lu to [%s] %s", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr)); - } - else - { - ++(sss->stats.errors); - traceEvent(TRACE_ERROR, "unicast %lu to [%s] %s FAILED (%d: %s)", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr), - errno, strerror(errno)); - } - } - else - { - traceEvent(TRACE_DEBUG, "try_forward unknown MAC"); - - /* Not a known MAC so drop. */ - return(-2); - } - - return(0); -} - -/** Send a datagram to the destination embodied in a n2n_sock_t. - * - * @return -1 on error otherwise number of bytes sent - */ -static ssize_t sendto_sock(n2n_sn_t *sss, - const n2n_sock_t *sock, - const uint8_t *pktbuf, - size_t pktsize) -{ - n2n_sock_str_t sockbuf; - - if (AF_INET == sock->family) - { - struct sockaddr_in udpsock; - - udpsock.sin_family = AF_INET; - udpsock.sin_port = htons(sock->port); - memcpy(&(udpsock.sin_addr.s_addr), &(sock->addr.v4), IPV4_SIZE); - - traceEvent(TRACE_DEBUG, "sendto_sock %lu to [%s]", - pktsize, - sock_to_cstr(sockbuf, sock)); - - return sendto(sss->sock, pktbuf, pktsize, 0, - (const struct sockaddr *)&udpsock, sizeof(struct sockaddr_in)); - } - else - { - /* AF_INET6 not implemented */ - errno = EAFNOSUPPORT; - return -1; - } -} - -/** Try and broadcast a message to all edges in the community. - * - * This will send the exact same datagram to zero or more edges registered to - * the supernode. - */ -static int try_broadcast(n2n_sn_t * sss, - const struct sn_community *comm, - const n2n_common_t * cmn, - const n2n_mac_t srcMac, - const uint8_t * pktbuf, - size_t pktsize) -{ - struct peer_info *scan, *tmp; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - traceEvent(TRACE_DEBUG, "try_broadcast"); - - HASH_ITER(hh, comm->edges, scan, tmp) { - if(memcmp(srcMac, scan->mac_addr, sizeof(n2n_mac_t)) != 0) { - /* REVISIT: exclude if the destination socket is where the packet came from. */ - int data_sent_len; - - data_sent_len = sendto_sock(sss, &(scan->sock), pktbuf, pktsize); - - if(data_sent_len != pktsize) - { - ++(sss->stats.errors); - traceEvent(TRACE_WARNING, "multicast %lu to [%s] %s failed %s", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr), - strerror(errno)); - } - else - { - ++(sss->stats.broadcast); - traceEvent(TRACE_DEBUG, "multicast %lu to [%s] %s", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr)); - } - } - } - return 0; -} - - -/** Initialise the supernode structure */ -int sn_init(n2n_sn_t *sss) -{ -#ifdef WIN32 - initWin32(); -#endif - - pearson_hash_init(); - - memset(sss, 0, sizeof(n2n_sn_t)); - - sss->daemon = 1; /* By defult run as a daemon. */ - sss->lport = N2N_SN_LPORT_DEFAULT; - sss->mport = N2N_SN_MGMT_PORT; - sss->sock = -1; - sss->mgmt_sock = -1; - - n2n_srand (n2n_seed()); /* https://github.com/ntop/n2n/pull/373/files */ - - return 0; /* OK */ -} - -/** Deinitialise the supernode structure and deallocate any memory owned by - * it. */ -void sn_term(n2n_sn_t *sss) -{ - struct sn_community *community, *tmp; - - if (sss->sock >= 0) - { - closesocket(sss->sock); - } - sss->sock = -1; - - if (sss->mgmt_sock >= 0) - { - closesocket(sss->mgmt_sock); - } - sss->mgmt_sock = -1; - - HASH_ITER(hh, sss->communities, community, tmp) - { - clear_peer_list(&community->edges); - if (NULL != community->header_encryption_ctx) - free (community->header_encryption_ctx); - HASH_DEL(sss->communities, community); - free(community); - } -} - -/** Determine the appropriate lifetime for new registrations. - * - * If the supernode has been put into a pre-shutdown phase then this lifetime - * should not allow registrations to continue beyond the shutdown point. - */ -static uint16_t reg_lifetime(n2n_sn_t *sss) -{ - /* NOTE: UDP firewalls usually have a 30 seconds timeout */ - return 15; -} - -/** Update the edge table with the details of the edge which contacted the - * supernode. */ -static int update_edge(n2n_sn_t *sss, - const n2n_mac_t edgeMac, - struct sn_community *comm, - const n2n_sock_t *sender_sock, - time_t now) -{ - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - struct peer_info *scan; - - traceEvent(TRACE_DEBUG, "update_edge for %s [%s]", - macaddr_str(mac_buf, edgeMac), - sock_to_cstr(sockbuf, sender_sock)); - - HASH_FIND_PEER(comm->edges, edgeMac, scan); - - if (NULL == scan) - { - /* Not known */ - - scan = (struct peer_info *)calloc(1, - sizeof(struct peer_info)); /* deallocated in purge_expired_registrations */ - - memcpy(&(scan->mac_addr), edgeMac, sizeof(n2n_mac_t)); - memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); - scan->last_valid_time_stamp = initial_time_stamp (); - - HASH_ADD_PEER(comm->edges, scan); - - traceEvent(TRACE_INFO, "update_edge created %s ==> %s", - macaddr_str(mac_buf, edgeMac), - sock_to_cstr(sockbuf, sender_sock)); - } - else - { - /* Known */ - if (!sock_equal(sender_sock, &(scan->sock))) - { - memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); - - traceEvent(TRACE_INFO, "update_edge updated %s ==> %s", - macaddr_str(mac_buf, edgeMac), - sock_to_cstr(sockbuf, sender_sock)); - } - else - { - traceEvent(TRACE_DEBUG, "update_edge unchanged %s ==> %s", - macaddr_str(mac_buf, edgeMac), - sock_to_cstr(sockbuf, sender_sock)); - } - } - - scan->last_seen = now; - return 0; -} - -/*** - * - * For a given packet, find the apporopriate internal last valid time stamp for lookup - * and verify it (and also update, if applicable). - */ -static int find_edge_time_stamp_and_verify (struct peer_info * edges, - int from_supernode, n2n_mac_t mac, - uint64_t stamp) { - - uint64_t * previous_stamp = NULL; - - if(!from_supernode) { - struct peer_info *edge; - HASH_FIND_PEER(edges, mac, edge); - if(edge) { - // time_stamp_verify_and_update allows the pointer a previous stamp to be NULL - // if it is a (so far) unknown edge - previous_stamp = &(edge->last_valid_time_stamp); - } - } - - // failure --> 0; success --> 1 - return ( time_stamp_verify_and_update (stamp, previous_stamp) ); -} - -static int purge_expired_communities(n2n_sn_t *sss, - time_t* p_last_purge, - time_t now) -{ - struct sn_community *comm, *tmp; - size_t num_reg = 0; - - if ((now - (*p_last_purge)) < PURGE_REGISTRATION_FREQUENCY) return 0; - - traceEvent(TRACE_DEBUG, "Purging old communities and edges"); - - HASH_ITER(hh, sss->communities, comm, tmp) { - num_reg += purge_peer_list(&comm->edges, now - REGISTRATION_TIMEOUT); - if ((comm->edges == NULL) && (!sss->lock_communities)) { - traceEvent(TRACE_INFO, "Purging idle community %s", comm->community); - if (NULL != comm->header_encryption_ctx) - /* this should not happen as no 'locked' and thus only communities w/o encrypted header here */ - free(comm->header_encryption_ctx); - HASH_DEL(sss->communities, comm); - free(comm); - } - } - (*p_last_purge) = now; - - traceEvent(TRACE_DEBUG, "Remove %ld edges", num_reg); - - return 0; -} - - -static int number_enc_packets_sort (struct sn_community *a, struct sn_community *b) { - // comparison function for sorting communities in descending order of their - // number_enc_packets-fields - return (b->number_enc_packets - a->number_enc_packets); -} - -static int sort_communities (n2n_sn_t *sss, - time_t* p_last_sort, - time_t now) -{ - struct sn_community *comm, *tmp; - - if ((now - (*p_last_sort)) < SORT_COMMUNITIES_INTERVAL) return 0; - - // this routine gets periodically called as defined in SORT_COMMUNITIES_INTERVAL - // it sorts the communities in descending order of their number_enc_packets-fields... - HASH_SORT(sss->communities, number_enc_packets_sort); - - // ... and afterward resets the number_enc__packets-fields to zero - // (other models could reset it to half of their value to respect history) - HASH_ITER(hh, sss->communities, comm, tmp) { - comm->number_enc_packets = 0; - } - - (*p_last_sort) = now; - - return 0; -} - - -static int process_mgmt(n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - const uint8_t *mgmt_buf, - size_t mgmt_size, - time_t now) -{ - char resbuf[N2N_SN_PKTBUF_SIZE]; - size_t ressize = 0; - uint32_t num_edges = 0; - uint32_t num = 0; - struct sn_community *community, *tmp; - struct peer_info * peer, *tmpPeer; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - traceEvent(TRACE_DEBUG, "process_mgmt"); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "----------------\n"); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "uptime %lu\n", (now - sss->start_time)); - - HASH_ITER(hh, sss->communities, community, tmp) - { - num_edges += HASH_COUNT(community->edges); - } - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "edges %u\n", - num_edges); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "errors %u\n", - (unsigned int)sss->stats.errors); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "reg_sup %u\n", - (unsigned int)sss->stats.reg_super); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "reg_nak %u\n", - (unsigned int)sss->stats.reg_super_nak); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "fwd %u\n", - (unsigned int)sss->stats.fwd); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "broadcast %u\n", - (unsigned int)sss->stats.broadcast); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "last fwd %lu sec ago\n", - (long unsigned int)(now - sss->stats.last_fwd)); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "last reg %lu sec ago\n", - (long unsigned int)(now - sss->stats.last_reg_super)); - - ressize += snprintf(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "cur_cmnts %u\n", HASH_COUNT(sss->communities)); - HASH_ITER(hh, sss->communities, community, tmp) { - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "community: %s\n", community->community); - sendto_mgmt(sss, sender_sock, (const uint8_t *)resbuf, ressize); - ressize = 0; - - num = 0; - HASH_ITER(hh, community->edges, peer, tmpPeer) { - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "\t[id: %u][MAC: %s][edge: %s][last seen: %lu sec ago]\n", - ++num, macaddr_str(mac_buf, peer->mac_addr), - sock_to_cstr(sockbuf, &(peer->sock)), now-peer->last_seen); - - sendto_mgmt(sss, sender_sock, (const uint8_t *)resbuf, ressize); - ressize = 0; - } - } - - ressize += snprintf(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, - "\n"); - sendto_mgmt(sss, sender_sock, (const uint8_t *)resbuf, ressize); - - return 0; -} - -static int sendto_mgmt(n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - const uint8_t *mgmt_buf, - size_t mgmt_size) -{ - ssize_t r = sendto(sss->mgmt_sock, mgmt_buf, mgmt_size, 0 /*flags*/, - (struct sockaddr *)sender_sock, sizeof (struct sockaddr_in)); - - if (r <= 0) { - ++(sss->stats.errors); - traceEvent (TRACE_ERROR, "sendto_mgmt : sendto failed. %s", strerror (errno)); - return -1; - } - return 0; -} - -/** Examine a datagram and determine what to do with it. - * - */ -static int process_udp(n2n_sn_t * sss, - const struct sockaddr_in * sender_sock, - uint8_t * udp_buf, - size_t udp_size, - time_t now) -{ - n2n_common_t cmn; /* common fields in the packet header */ - size_t rem; - size_t idx; - size_t msg_type; - uint8_t from_supernode; - macstr_t mac_buf; - macstr_t mac_buf2; - n2n_sock_str_t sockbuf; - char buf[32]; - struct sn_community *comm, *tmp; - uint64_t stamp; - - traceEvent(TRACE_DEBUG, "Processing incoming UDP packet [len: %lu][sender: %s:%u]", - udp_size, intoa(ntohl(sender_sock->sin_addr.s_addr), buf, sizeof(buf)), - ntohs(sender_sock->sin_port)); - - /* check if header is unenrypted. the following check is around 99.99962 percent reliable. - * it heavily relies on the structure of packet's common part - * changes to wire.c:encode/decode_common need to go together with this code */ - if (udp_size < 20) { - traceEvent(TRACE_DEBUG, "process_udp dropped a packet too short to be valid."); - return -1; - } - if ( (udp_buf[19] == (uint8_t)0x00) // null terminated community name - && (udp_buf[00] == N2N_PKT_VERSION) // correct packet version - && ((be16toh (*(uint16_t*)&(udp_buf[02])) & N2N_FLAGS_TYPE_MASK ) <= MSG_TYPE_MAX_TYPE ) // message type - && ( be16toh (*(uint16_t*)&(udp_buf[02])) < N2N_FLAGS_OPTIONS) // flags - ) { - /* most probably unencrypted */ - /* make sure, no downgrading happens here and no unencrypted packets can be - * injected in a community which definitely deals with encrypted headers */ - HASH_FIND_COMMUNITY(sss->communities, (char *)&udp_buf[04], comm); - if (comm) { - if (comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - traceEvent(TRACE_DEBUG, "process_udp dropped a packet with unencrypted header " - "addressed to community '%s' which uses encrypted headers.", - comm->community); - return -1; - } - if (comm->header_encryption == HEADER_ENCRYPTION_UNKNOWN) { - traceEvent (TRACE_INFO, "process_udp locked community '%s' to using " - "unencrypted headers.", comm->community); - /* set 'no encryption' in case it is not set yet */ - comm->header_encryption = HEADER_ENCRYPTION_NONE; - comm->header_encryption_ctx = NULL; - } - } - } else { - /* most probably encrypted */ - /* cycle through the known communities (as keys) to eventually decrypt */ - uint32_t ret = 0; - HASH_ITER (hh, sss->communities, comm, tmp) { - /* skip the definitely unencrypted communities */ - if (comm->header_encryption == HEADER_ENCRYPTION_NONE) - continue; - uint16_t checksum = 0; - if ( (ret = packet_header_decrypt (udp_buf, udp_size, comm->community, comm->header_encryption_ctx, - comm->header_iv_ctx, - &stamp, &checksum)) ) { - // time stamp verification follows in the packet specific section as it requires to determine the - // sender from the hash list by its MAC, this all depends on packet type and packet structure - // (MAC is not always in the same place) - if (checksum != pearson_hash_16 (udp_buf, udp_size)) { - traceEvent(TRACE_DEBUG, "process_udp dropped packet due to checksum error."); - return -1; - } - if (comm->header_encryption == HEADER_ENCRYPTION_UNKNOWN) { - traceEvent (TRACE_INFO, "process_udp locked community '%s' to using " - "encrypted headers.", comm->community); - /* set 'encrypted' in case it is not set yet */ - comm->header_encryption = HEADER_ENCRYPTION_ENABLED; - } - // count the number of encrypted packets for sorting the communities from time to time - // for the HASH_ITER a few lines above gets faster for the more busy communities - (comm->number_enc_packets)++; - // no need to test further communities - break; - } - } - if (!ret) { - // no matching key/community - traceEvent(TRACE_DEBUG, "process_udp dropped a packet with seemingly encrypted header " - "for which no matching community which uses encrypted headers was found."); - return -1; - } - } - - /* Use decode_common() to determine the kind of packet then process it: - * - * REGISTER_SUPER adds an edge and generate a return REGISTER_SUPER_ACK - * - * REGISTER, REGISTER_ACK and PACKET messages are forwarded to their - * destination edge. If the destination is not known then PACKETs are - * broadcast. - */ - - rem = udp_size; /* Counts down bytes of packet to protect against buffer overruns. */ - idx = 0; /* marches through packet header as parts are decoded. */ - if(decode_common(&cmn, udp_buf, &rem, &idx) < 0) { - traceEvent(TRACE_ERROR, "Failed to decode common section"); - return -1; /* failed to decode packet */ - } - - msg_type = cmn.pc; /* packet code */ - from_supernode= cmn.flags & N2N_FLAGS_FROM_SUPERNODE; - - if(cmn.ttl < 1) { - traceEvent(TRACE_WARNING, "Expired TTL"); - return 0; /* Don't process further */ - } - - --(cmn.ttl); /* The value copied into all forwarded packets. */ - - switch(msg_type) { - case MSG_TYPE_PACKET: - { - /* PACKET from one edge to another edge via supernode. */ - - /* pkt will be modified in place and recoded to an output of potentially - * different size due to addition of the socket.*/ - n2n_PACKET_t pkt; - n2n_common_t cmn2; - uint8_t encbuf[N2N_SN_PKTBUF_SIZE]; - size_t encx=0; - int unicast; /* non-zero if unicast */ - uint8_t * rec_buf; /* either udp_buf or encbuf */ - - if(!comm) { - traceEvent(TRACE_DEBUG, "process_udp PACKET with unknown community %s", cmn.community); - return -1; - } - - sss->stats.last_fwd=now; - decode_PACKET(&pkt, &cmn, udp_buf, &rem, &idx); - - // already checked for valid comm - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify (comm->edges, from_supernode, pkt.srcMac, stamp)) { - traceEvent(TRACE_DEBUG, "process_udp dropped PACKET due to time stamp error."); - return -1; - } - } - - unicast = (0 == is_multi_broadcast(pkt.dstMac)); - - traceEvent(TRACE_DEBUG, "RX PACKET (%s) %s -> %s %s", - (unicast?"unicast":"multicast"), - macaddr_str(mac_buf, pkt.srcMac), - macaddr_str(mac_buf2, pkt.dstMac), - (from_supernode?"from sn":"local")); - - if(!from_supernode) { - memcpy(&cmn2, &cmn, sizeof(n2n_common_t)); - - /* We are going to add socket even if it was not there before */ - cmn2.flags |= N2N_FLAGS_SOCKET | N2N_FLAGS_FROM_SUPERNODE; - - pkt.sock.family = AF_INET; - pkt.sock.port = ntohs(sender_sock->sin_port); - memcpy(pkt.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - - rec_buf = encbuf; - - /* Re-encode the header. */ - encode_PACKET(encbuf, &encx, &cmn2, &pkt); - uint16_t oldEncx = encx; - - /* Copy the original payload unchanged */ - encode_buf(encbuf, &encx, (udp_buf + idx), (udp_size - idx)); - - if (comm->header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt (rec_buf, oldEncx, comm->header_encryption_ctx, - comm->header_iv_ctx, - time_stamp (), pearson_hash_16 (rec_buf, encx)); - - } else { - /* Already from a supernode. Nothing to modify, just pass to - * destination. */ - - traceEvent(TRACE_DEBUG, "Rx PACKET fwd unmodified"); - - rec_buf = udp_buf; - encx = udp_size; - - if (comm->header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt (rec_buf, idx, comm->header_encryption_ctx, - comm->header_iv_ctx, - time_stamp (), pearson_hash_16 (rec_buf, udp_size)); - } - - /* Common section to forward the final product. */ - if(unicast) - try_forward(sss, comm, &cmn, pkt.dstMac, rec_buf, encx); - else - try_broadcast(sss, comm, &cmn, pkt.srcMac, rec_buf, encx); - break; - } - case MSG_TYPE_REGISTER: - { - /* Forwarding a REGISTER from one edge to the next */ - - n2n_REGISTER_t reg; - n2n_common_t cmn2; - uint8_t encbuf[N2N_SN_PKTBUF_SIZE]; - size_t encx=0; - int unicast; /* non-zero if unicast */ - uint8_t * rec_buf; /* either udp_buf or encbuf */ - - if(!comm) { - traceEvent(TRACE_DEBUG, "process_udp REGISTER from unknown community %s", cmn.community); - return -1; - } - - sss->stats.last_fwd=now; - decode_REGISTER(®, &cmn, udp_buf, &rem, &idx); - - // already checked for valid comm - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify (comm->edges, from_supernode, reg.srcMac, stamp)) { - traceEvent(TRACE_DEBUG, "process_udp dropped REGISTER due to time stamp error."); - return -1; - } - } - - unicast = (0 == is_multi_broadcast(reg.dstMac)); - - if(unicast) { - traceEvent(TRACE_DEBUG, "Rx REGISTER %s -> %s %s", - macaddr_str(mac_buf, reg.srcMac), - macaddr_str(mac_buf2, reg.dstMac), - ((cmn.flags & N2N_FLAGS_FROM_SUPERNODE)?"from sn":"local")); - - if(0 == (cmn.flags & N2N_FLAGS_FROM_SUPERNODE)) { - memcpy(&cmn2, &cmn, sizeof(n2n_common_t)); - - /* We are going to add socket even if it was not there before */ - cmn2.flags |= N2N_FLAGS_SOCKET | N2N_FLAGS_FROM_SUPERNODE; - - reg.sock.family = AF_INET; - reg.sock.port = ntohs(sender_sock->sin_port); - memcpy(reg.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - - rec_buf = encbuf; - - /* Re-encode the header. */ - encode_REGISTER(encbuf, &encx, &cmn2, ®); - } else { - /* Already from a supernode. Nothing to modify, just pass to - * destination. */ - - rec_buf = udp_buf; - encx = udp_size; - } - - if (comm->header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt (rec_buf, encx, comm->header_encryption_ctx, - comm->header_iv_ctx, - time_stamp (), pearson_hash_16 (rec_buf, encx)); - - try_forward(sss, comm, &cmn, reg.dstMac, rec_buf, encx); /* unicast only */ - } else - traceEvent(TRACE_ERROR, "Rx REGISTER with multicast destination"); - break; - } - case MSG_TYPE_REGISTER_ACK: - traceEvent(TRACE_DEBUG, "Rx REGISTER_ACK (NOT IMPLEMENTED) Should not be via supernode"); - break; - case MSG_TYPE_REGISTER_SUPER: - { - n2n_REGISTER_SUPER_t reg; - n2n_REGISTER_SUPER_ACK_t ack; - n2n_common_t cmn2; - uint8_t ackbuf[N2N_SN_PKTBUF_SIZE]; - size_t encx=0; - - /* Edge requesting registration with us. */ - sss->stats.last_reg_super=now; - ++(sss->stats.reg_super); - decode_REGISTER_SUPER(®, &cmn, udp_buf, &rem, &idx); - - if (comm) { - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify (comm->edges, from_supernode, reg.edgeMac, stamp)) { - traceEvent(TRACE_DEBUG, "process_udp dropped REGISTER_SUPER due to time stamp error."); - return -1; - } - } - } - - /* - Before we move any further, we need to check if the requested - community is allowed by the supernode. In case it is not we do - not report any message back to the edge to hide the supernode - existance (better from the security standpoint) - */ - if(!comm && !sss->lock_communities) { - comm = calloc(1, sizeof(struct sn_community)); - - if(comm) { - strncpy(comm->community, (char*)cmn.community, N2N_COMMUNITY_SIZE-1); - comm->community[N2N_COMMUNITY_SIZE-1] = '\0'; - /* new communities introduced by REGISTERs could not have had encrypted header */ - comm->header_encryption = HEADER_ENCRYPTION_NONE; - comm->header_encryption_ctx = NULL; - comm->number_enc_packets = 0; - HASH_ADD_STR(sss->communities, community, comm); - - traceEvent(TRACE_INFO, "New community: %s", comm->community); - } - } - - if(comm) { - cmn2.ttl = N2N_DEFAULT_TTL; - cmn2.pc = n2n_register_super_ack; - cmn2.flags = N2N_FLAGS_SOCKET | N2N_FLAGS_FROM_SUPERNODE; - memcpy(cmn2.community, cmn.community, sizeof(n2n_community_t)); - - memcpy(&(ack.cookie), &(reg.cookie), sizeof(n2n_cookie_t)); - memcpy(ack.edgeMac, reg.edgeMac, sizeof(n2n_mac_t)); - ack.lifetime = reg_lifetime(sss); - - ack.sock.family = AF_INET; - ack.sock.port = ntohs(sender_sock->sin_port); - memcpy(ack.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - - ack.num_sn=0; /* No backup */ - memset(&(ack.sn_bak), 0, sizeof(n2n_sock_t)); - - traceEvent(TRACE_DEBUG, "Rx REGISTER_SUPER for %s [%s]", - macaddr_str(mac_buf, reg.edgeMac), - sock_to_cstr(sockbuf, &(ack.sock))); - - update_edge(sss, reg.edgeMac, comm, &(ack.sock), now); - - encode_REGISTER_SUPER_ACK(ackbuf, &encx, &cmn2, &ack); - - if (comm->header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt (ackbuf, encx, comm->header_encryption_ctx, - comm->header_iv_ctx, - time_stamp (), pearson_hash_16 (ackbuf, encx)); - - sendto(sss->sock, ackbuf, encx, 0, - (struct sockaddr *)sender_sock, sizeof(struct sockaddr_in)); - - traceEvent(TRACE_DEBUG, "Tx REGISTER_SUPER_ACK for %s [%s]", - macaddr_str(mac_buf, reg.edgeMac), - sock_to_cstr(sockbuf, &(ack.sock))); - } else - traceEvent(TRACE_INFO, "Discarded registration: unallowed community '%s'", - (char*)cmn.community); - break; - } - case MSG_TYPE_QUERY_PEER: { - n2n_QUERY_PEER_t query; - uint8_t encbuf[N2N_SN_PKTBUF_SIZE]; - size_t encx=0; - n2n_common_t cmn2; - n2n_PEER_INFO_t pi; - - if(!comm) { - traceEvent(TRACE_DEBUG, "process_udp QUERY_PEER from unknown community %s", cmn.community); - return -1; - } - - decode_QUERY_PEER( &query, &cmn, udp_buf, &rem, &idx ); - - // already checked for valid comm - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify (comm->edges, from_supernode, query.srcMac, stamp)) { - traceEvent(TRACE_DEBUG, "process_udp dropped QUERY_PEER due to time stamp error."); - return -1; - } - } - - traceEvent( TRACE_DEBUG, "Rx QUERY_PEER from %s for %s", - macaddr_str( mac_buf, query.srcMac ), - macaddr_str( mac_buf2, query.targetMac ) ); - - struct peer_info *scan; - HASH_FIND_PEER(comm->edges, query.targetMac, scan); - - if (scan) { - cmn2.ttl = N2N_DEFAULT_TTL; - cmn2.pc = n2n_peer_info; - cmn2.flags = N2N_FLAGS_FROM_SUPERNODE; - memcpy( cmn2.community, cmn.community, sizeof(n2n_community_t) ); - - pi.aflags = 0; - memcpy( pi.mac, query.targetMac, sizeof(n2n_mac_t) ); - pi.sock = scan->sock; - - encode_PEER_INFO( encbuf, &encx, &cmn2, &pi ); - - if (comm->header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt (encbuf, encx, comm->header_encryption_ctx, - comm->header_iv_ctx, - time_stamp (), pearson_hash_16 (encbuf, encx)); - - sendto( sss->sock, encbuf, encx, 0, - (struct sockaddr *)sender_sock, sizeof(struct sockaddr_in) ); - - traceEvent( TRACE_DEBUG, "Tx PEER_INFO to %s", - macaddr_str( mac_buf, query.srcMac ) ); - } else { - traceEvent( TRACE_DEBUG, "Ignoring QUERY_PEER for unknown edge %s", - macaddr_str( mac_buf, query.targetMac ) ); - } - - break; - } - default: - /* Not a known message type */ - traceEvent(TRACE_WARNING, "Unable to handle packet type %d: ignored", (signed int)msg_type); - } /* switch(msg_type) */ - - return 0; -} - -/** Long lived processing entry point. Split out from main to simply - * daemonisation on some platforms. */ -int run_sn_loop(n2n_sn_t *sss, int *keep_running) -{ - uint8_t pktbuf[N2N_SN_PKTBUF_SIZE]; - time_t last_purge_edges = 0; - time_t last_sort_communities = 0; - - sss->start_time = time(NULL); - - while (*keep_running) - { - int rc; - ssize_t bread; - int max_sock; - fd_set socket_mask; - struct timeval wait_time; - time_t now = 0; - - FD_ZERO(&socket_mask); - max_sock = MAX(sss->sock, sss->mgmt_sock); - - FD_SET(sss->sock, &socket_mask); - FD_SET(sss->mgmt_sock, &socket_mask); - - wait_time.tv_sec = 10; - wait_time.tv_usec = 0; - rc = select(max_sock + 1, &socket_mask, NULL, NULL, &wait_time); - - now = time(NULL); - - if (rc > 0) - { - if (FD_ISSET(sss->sock, &socket_mask)) - { - struct sockaddr_in sender_sock; - socklen_t i; - - i = sizeof(sender_sock); - bread = recvfrom(sss->sock, pktbuf, N2N_SN_PKTBUF_SIZE, 0 /*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t *)&i); - - if ((bread < 0) -#ifdef WIN32 - && (WSAGetLastError() != WSAECONNRESET) -#endif - ) - { - /* For UDP bread of zero just means no data (unlike TCP). */ - /* The fd is no good now. Maybe we lost our interface. */ - traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); -#ifdef WIN32 - traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - *keep_running = 0; - break; - } - - /* We have a datagram to process */ - if (bread > 0) - { - /* And the datagram has data (not just a header) */ - process_udp(sss, &sender_sock, pktbuf, bread, now); - } - } - - if (FD_ISSET(sss->mgmt_sock, &socket_mask)) - { - struct sockaddr_in sender_sock; - size_t i; - - i = sizeof(sender_sock); - bread = recvfrom(sss->mgmt_sock, pktbuf, N2N_SN_PKTBUF_SIZE, 0 /*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t *)&i); - - if (bread <= 0) - { - traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); - *keep_running = 0; - break; - } - - /* We have a datagram to process */ - process_mgmt(sss, &sender_sock, pktbuf, bread, now); - } - } - else - { - traceEvent(TRACE_DEBUG, "timeout"); - } - - purge_expired_communities(sss, &last_purge_edges, now); - sort_communities (sss, &last_sort_communities, now); - } /* while */ - - sn_term(sss); - - return 0; -} diff --git a/bundles/n2n_ntop_v2/src/speck.c b/bundles/n2n_ntop_v2/src/speck.c deleted file mode 100644 index 9ca7811c..00000000 --- a/bundles/n2n_ntop_v2/src/speck.c +++ /dev/null @@ -1,883 +0,0 @@ -// cipher SPECK -- 128 bit block size -- 256 bit key size -- CTR mode -// taken from (and modified: removed pure crypto-stream generation and seperated key expansion) -// https://github.com/nsacyber/simon-speck-supercop/blob/master/crypto_stream/speck128256ctr/ - -#include -#include "portable_endian.h" - -#include "speck.h" - -#if defined (__AVX2__) // AVX support ---------------------------------------------------- - - -#define LCS(x,r) (((x)<>(64-r))) -#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) - -#define XOR _mm256_xor_si256 -#define AND _mm256_and_si256 -#define ADD _mm256_add_epi64 -#define SL _mm256_slli_epi64 -#define SR _mm256_srli_epi64 - -#define _q SET(0x3,0x1,0x2,0x0) -#define _four SET(0x4,0x4,0x4,0x4) - -#define SET _mm256_set_epi64x -#define SET1(X,c) (X=SET(c,c,c,c)) -#define SET4(X,c) (X=SET(c,c,c,c), X=ADD(X,_q)) - -#define LOW _mm256_unpacklo_epi64 -#define HIGH _mm256_unpackhi_epi64 -#define LD(ip) _mm256_loadu_si256((__m256i *)(ip)) -#define ST(ip,X) _mm256_storeu_si256((__m256i *)(ip),X) -#define STORE(out,X,Y) (ST(out,LOW(Y,X)), ST(out+32,HIGH(Y,X))) -#define STORE_ALT(out,X,Y) (ST(out,LOW(X,Y)), ST(out+32,HIGH(X,Y))) -#define XOR_STORE(in,out,X,Y) (ST(out,XOR(LD(in),LOW(Y,X))), ST(out+32,XOR(LD(in+32),HIGH(Y,X)))) -#define XOR_STORE_ALT(in,out,X,Y) (ST(out,XOR(LD(in),LOW(X,Y))), ST(out+32,XOR(LD(in+32),HIGH(X,Y)))) - -#define SHFL _mm256_shuffle_epi8 -#define R8 SET(0x080f0e0d0c0b0a09LL,0x0007060504030201LL,0x080f0e0d0c0b0a09LL,0x0007060504030201LL) -#define L8 SET(0x0e0d0c0b0a09080fLL,0x0605040302010007LL,0x0e0d0c0b0a09080fLL,0x0605040302010007LL) -#define ROL8(X) (SHFL(X,L8)) -#define ROR8(X) (SHFL(X,R8)) -#define ROL(X,r) (XOR(SL(X,r),SR(X,(64-r)))) -#define ROR(X,r) (XOR(SR(X,r),SL(X,(64-r)))) - -#define numrounds 34 -#define numkeywords 4 - -#define R(X,Y,k) (X=XOR(ADD(ROR8(X),Y),k), Y=XOR(ROL(Y,3),X)) - -#define Rx4(X,Y,k) (R(X[0],Y[0],k)) -#define Rx8(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k)) -#define Rx12(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k), R(X[2],Y[2],k)) - -#define Rx16(X,Y,k) (X[0]=ROR8(X[0]), X[0]=ADD(X[0],Y[0]), X[1]=ROR8(X[1]), X[1]=ADD(X[1],Y[1]), \ - X[2]=ROR8(X[2]), X[2]=ADD(X[2],Y[2]), X[3]=ROR8(X[3]), X[3]=ADD(X[3],Y[3]), \ - X[0]=XOR(X[0],k), X[1]=XOR(X[1],k), X[2]=XOR(X[2],k), X[3]=XOR(X[3],k), \ - Z[0]=Y[0], Z[1]=Y[1], Z[2]=Y[2], Z[3]=Y[3], \ - Z[0]=SL(Z[0],3), Y[0]=SR(Y[0],61), Z[1]=SL(Z[1],3), Y[1]=SR(Y[1],61), \ - Z[2]=SL(Z[2],3), Y[2]=SR(Y[2],61), Z[3]=SL(Z[3],3), Y[3]=SR(Y[3],61), \ - Y[0]=XOR(Y[0],Z[0]), Y[1]=XOR(Y[1],Z[1]), Y[2]=XOR(Y[2],Z[2]), Y[3]=XOR(Y[3],Z[3]), \ - Y[0]=XOR(X[0],Y[0]), Y[1]=XOR(X[1],Y[1]), Y[2]=XOR(X[2],Y[2]), Y[3]=XOR(X[3],Y[3])) - -#define Rx2(x,y,k) (x[0]=RCS(x[0],8), x[1]=RCS(x[1],8), x[0]+=y[0], x[1]+=y[1], \ - x[0]^=k, x[1]^=k, y[0]=LCS(y[0],3), y[1]=LCS(y[1],3), y[0]^=x[0], y[1]^=x[1]) - -#define Rx1(x,y,k) (x[0]=RCS(x[0],8), x[0]+=y[0], x[0]^=k, y[0]=LCS(y[0],3), y[0]^=x[0]) - -#define Rx1b(x,y,k) (x=RCS(x,8), x+=y, x^=k, y=LCS(y,3), y^=x) - -#define Encrypt(X,Y,k,n) (Rx##n(X,Y,k[0]), Rx##n(X,Y,k[1]), Rx##n(X,Y,k[2]), Rx##n(X,Y,k[3]), Rx##n(X,Y,k[4]), Rx##n(X,Y,k[5]), Rx##n(X,Y,k[6]), Rx##n(X,Y,k[7]), \ - Rx##n(X,Y,k[8]), Rx##n(X,Y,k[9]), Rx##n(X,Y,k[10]), Rx##n(X,Y,k[11]), Rx##n(X,Y,k[12]), Rx##n(X,Y,k[13]), Rx##n(X,Y,k[14]), Rx##n(X,Y,k[15]), \ - Rx##n(X,Y,k[16]), Rx##n(X,Y,k[17]), Rx##n(X,Y,k[18]), Rx##n(X,Y,k[19]), Rx##n(X,Y,k[20]), Rx##n(X,Y,k[21]), Rx##n(X,Y,k[22]), Rx##n(X,Y,k[23]), \ - Rx##n(X,Y,k[24]), Rx##n(X,Y,k[25]), Rx##n(X,Y,k[26]), Rx##n(X,Y,k[27]), Rx##n(X,Y,k[28]), Rx##n(X,Y,k[29]), Rx##n(X,Y,k[30]), Rx##n(X,Y,k[31]), \ - Rx##n(X,Y,k[32]), Rx##n(X,Y,k[33])) - -#define RK(X,Y,k,key,i) (SET1(k[i],Y), key[i]=Y, X=RCS(X,8), X+=Y, X^=i, Y=LCS(Y,3), Y^=X) - -#define EK(A,B,C,D,k,key) (RK(B,A,k,key,0), RK(C,A,k,key,1), RK(D,A,k,key,2), RK(B,A,k,key,3), RK(C,A,k,key,4), RK(D,A,k,key,5), RK(B,A,k,key,6), \ - RK(C,A,k,key,7), RK(D,A,k,key,8), RK(B,A,k,key,9), RK(C,A,k,key,10), RK(D,A,k,key,11), RK(B,A,k,key,12), RK(C,A,k,key,13), \ - RK(D,A,k,key,14), RK(B,A,k,key,15), RK(C,A,k,key,16), RK(D,A,k,key,17), RK(B,A,k,key,18), RK(C,A,k,key,19), RK(D,A,k,key,20), \ - RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \ - RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33)) - -static int speck_encrypt_xor(unsigned char *out, const unsigned char *in, u64 nonce[], speck_context_t *ctx, int numbytes) { - - u64 x[2], y[2]; - u256 X[4], Y[4], Z[4]; - - if (numbytes == 16) { - x[0] = nonce[1]; y[0] = nonce[0]; nonce[0]++; - Encrypt (x, y, ctx->key, 1); - ((u64 *)out)[1] = x[0]; ((u64 *)out)[0] = y[0]; - return 0; - } - - if (numbytes == 32) { - x[0] = nonce[1]; y[0] = nonce[0]; nonce[0]++; - x[1] = nonce[1]; y[1] = nonce[0]; nonce[0]++; - Encrypt (x , y, ctx->key, 2); - ((u64 *)out)[1] = x[0] ^ ((u64 *)in)[1]; ((u64 *)out)[0] = y[0] ^ ((u64 *)in)[0]; - ((u64 *)out)[3] = x[1] ^ ((u64 *)in)[3]; ((u64 *)out)[2] = y[1] ^ ((u64 *)in)[2]; - return 0; - } - - SET1 (X[0], nonce[1]); SET4 (Y[0], nonce[0]); - - if (numbytes == 64) - Encrypt (X, Y, ctx->rk, 4); - else { - X[1] = X[0]; - Y[1] = ADD (Y[0], _four); - if (numbytes == 128) - Encrypt (X, Y, ctx->rk, 8); - else { - X[2] = X[0]; - Y[2] = ADD (Y[1], _four); - if (numbytes == 192) - Encrypt (X, Y, ctx->rk, 12); - else { - X[3] = X[0]; - Y[3] = ADD (Y[2], _four); - Encrypt (X, Y, ctx->rk, 16); - } - } - } - - nonce[0] += (numbytes>>4); - - XOR_STORE (in, out, X[0], Y[0]); - if (numbytes >= 128) - XOR_STORE (in + 64, out + 64, X[1], Y[1]); - if (numbytes >= 192) - XOR_STORE (in + 128, out + 128, X[2], Y[2]); - if (numbytes >= 256) - XOR_STORE (in + 192, out + 192, X[3], Y[3]); - - return 0; -} - - -int speck_ctr( unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx) { - - int i; - u64 nonce[2]; - unsigned char block[16]; - u64 * const block64 = (u64 *)block; - - if (!inlen) - return 0; - - nonce[0] = ((u64 *)n)[0]; - nonce[1] = ((u64 *)n)[1]; - - while (inlen >= 256) { - speck_encrypt_xor (out, in, nonce, ctx, 256); - in += 256; inlen -= 256; out += 256; - } - - if (inlen >= 192) { - speck_encrypt_xor (out, in, nonce, ctx, 192); - in += 192; inlen -= 192; out += 192; - } - - if (inlen >= 128) { - speck_encrypt_xor (out, in, nonce, ctx, 128); - in += 128; inlen -= 128; out += 128; - } - - if (inlen >= 64) { - speck_encrypt_xor (out, in, nonce, ctx, 64); - in += 64; inlen -= 64; out += 64; - } - - if (inlen >= 32) { - speck_encrypt_xor (out, in, nonce, ctx, 32); - in += 32; inlen -= 32; out += 32; - } - - if (inlen >= 16) { - speck_encrypt_xor (block, in, nonce, ctx, 16); - ((u64 *)out)[0] = block64[0] ^ ((u64 *)in)[0]; - ((u64 *)out)[1] = block64[1] ^ ((u64 *)in)[1]; - in += 16; inlen -= 16; out += 16; - } - - if (inlen > 0) { - speck_encrypt_xor (block, in, nonce, ctx, 16); - for (i = 0; i < inlen; i++) - out[i] = block[i] ^ in[i]; - } - - return 0; -} - - -int speck_expand_key (const unsigned char *k, speck_context_t *ctx) { - - u64 K[4]; - size_t i; - for (i = 0; i < numkeywords; i++) - K[i] = ((u64 *)k)[i]; - - EK (K[0], K[1], K[2], K[3], ctx->rk, ctx->key); - - return 0; -} - - -#elif defined (__SSE4_2__) // SSE support ------------------------------------------------- - - -#define LCS(x,r) (((x)<>(64-r))) -#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) - -#define XOR _mm_xor_si128 -#define AND _mm_and_si128 -#define ADD _mm_add_epi64 -#define SL _mm_slli_epi64 -#define SR _mm_srli_epi64 - -#define _q SET(0x1,0x0) -#define _two SET(0x2,0x2) - -#define SET _mm_set_epi64x -#define SET1(X,c) (X=SET(c,c)) -#define SET2(X,c) (X=SET(c,c), X=ADD(X,_q)) - -#define LOW _mm_unpacklo_epi64 -#define HIGH _mm_unpackhi_epi64 -#define LD(ip) _mm_loadu_si128((__m128i *)(ip)) -#define ST(ip,X) _mm_storeu_si128((__m128i *)(ip),X) -#define STORE(out,X,Y) (ST(out,LOW(Y,X)), ST(out+16,HIGH(Y,X))) -#define STORE_ALT(out,X,Y) (ST(out,LOW(X,Y)), ST(out+16,HIGH(X,Y))) -#define XOR_STORE(in,out,X,Y) (ST(out,XOR(LD(in),LOW(Y,X))), ST(out+16,XOR(LD(in+16),HIGH(Y,X)))) -#define XOR_STORE_ALT(in,out,X,Y) (ST(out,XOR(LD(in),LOW(X,Y))), ST(out+16,XOR(LD(in+16),HIGH(X,Y)))) - -#define SHFL _mm_shuffle_epi8 -#define R8 _mm_set_epi64x(0x080f0e0d0c0b0a09LL,0x0007060504030201LL) -#define L8 _mm_set_epi64x(0x0e0d0c0b0a09080fLL,0x0605040302010007LL) -#define ROL8(X) (SHFL(X,L8)) -#define ROR8(X) (SHFL(X,R8)) -#define ROL(X,r) (XOR(SL(X,r),SR(X,(64-r)))) -#define ROR(X,r) (XOR(SR(X,r),SL(X,(64-r)))) - -#define numrounds 34 -#define numkeywords 4 - -#define R(X,Y,k) (X=XOR(ADD(ROR8(X),Y),k), Y=XOR(ROL(Y,3),X)) - -#define Rx2(X,Y,k) (R(X[0],Y[0],k)) -#define Rx4(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k)) -#define Rx6(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k), R(X[2],Y[2],k)) - -#define Rx8(X,Y,k) (X[0]=ROR8(X[0]), X[0]=ADD(X[0],Y[0]), X[1]=ROR8(X[1]), X[1]=ADD(X[1],Y[1]), \ - X[2]=ROR8(X[2]), X[2]=ADD(X[2],Y[2]), X[3]=ROR8(X[3]), X[3]=ADD(X[3],Y[3]), \ - X[0]=XOR(X[0],k), X[1]=XOR(X[1],k), X[2]=XOR(X[2],k), X[3]=XOR(X[3],k), \ - Z[0]=Y[0], Z[1]=Y[1], Z[2]=Y[2], Z[3]=Y[3], \ - Z[0]=SL(Z[0],3), Y[0]=SR(Y[0],61), Z[1]=SL(Z[1],3), Y[1]=SR(Y[1],61), \ - Z[2]=SL(Z[2],3), Y[2]=SR(Y[2],61), Z[3]=SL(Z[3],3), Y[3]=SR(Y[3],61), \ - Y[0]=XOR(Y[0],Z[0]), Y[1]=XOR(Y[1],Z[1]), Y[2]=XOR(Y[2],Z[2]), Y[3]=XOR(Y[3],Z[3]), \ - Y[0]=XOR(X[0],Y[0]), Y[1]=XOR(X[1],Y[1]), Y[2]=XOR(X[2],Y[2]), Y[3]=XOR(X[3],Y[3])) - -#define Rx1(x,y,k) (x[0]=RCS(x[0],8), x[0]+=y[0], x[0]^=k, y[0]=LCS(y[0],3), y[0]^=x[0]) - -#define Rx1b(x,y,k) (x=RCS(x,8), x+=y, x^=k, y=LCS(y,3), y^=x) - -#define Encrypt(X,Y,k,n) (Rx##n(X,Y,k[0]), Rx##n(X,Y,k[1]), Rx##n(X,Y,k[2]), Rx##n(X,Y,k[3]), Rx##n(X,Y,k[4]), Rx##n(X,Y,k[5]), Rx##n(X,Y,k[6]), Rx##n(X,Y,k[7]), \ - Rx##n(X,Y,k[8]), Rx##n(X,Y,k[9]), Rx##n(X,Y,k[10]), Rx##n(X,Y,k[11]), Rx##n(X,Y,k[12]), Rx##n(X,Y,k[13]), Rx##n(X,Y,k[14]), Rx##n(X,Y,k[15]), \ - Rx##n(X,Y,k[16]), Rx##n(X,Y,k[17]), Rx##n(X,Y,k[18]), Rx##n(X,Y,k[19]), Rx##n(X,Y,k[20]), Rx##n(X,Y,k[21]), Rx##n(X,Y,k[22]), Rx##n(X,Y,k[23]), \ - Rx##n(X,Y,k[24]), Rx##n(X,Y,k[25]), Rx##n(X,Y,k[26]), Rx##n(X,Y,k[27]), Rx##n(X,Y,k[28]), Rx##n(X,Y,k[29]), Rx##n(X,Y,k[30]), Rx##n(X,Y,k[31]), \ - Rx##n(X,Y,k[32]), Rx##n(X,Y,k[33])) - -#define RK(X,Y,k,key,i) (SET1(k[i],Y), key[i]=Y, X=RCS(X,8), X+=Y, X^=i, Y=LCS(Y,3), Y^=X) - -#define EK(A,B,C,D,k,key) (RK(B,A,k,key,0), RK(C,A,k,key,1), RK(D,A,k,key,2), RK(B,A,k,key,3), RK(C,A,k,key,4), RK(D,A,k,key,5), RK(B,A,k,key,6), \ - RK(C,A,k,key,7), RK(D,A,k,key,8), RK(B,A,k,key,9), RK(C,A,k,key,10), RK(D,A,k,key,11), RK(B,A,k,key,12), RK(C,A,k,key,13), \ - RK(D,A,k,key,14), RK(B,A,k,key,15), RK(C,A,k,key,16), RK(D,A,k,key,17), RK(B,A,k,key,18), RK(C,A,k,key,19), RK(D,A,k,key,20), \ - RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \ - RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33)) - - -static int speck_encrypt_xor (unsigned char *out, const unsigned char *in, u64 nonce[], const speck_context_t ctx, int numbytes) { - - u64 x[2], y[2]; - u128 X[4], Y[4], Z[4]; - - if (numbytes == 16) { - x[0] = nonce[1]; y[0] = nonce[0]; nonce[0]++; - Encrypt (x, y, ctx.key, 1); - ((u64 *)out)[1] = x[0]; ((u64 *)out)[0] = y[0]; - return 0; - } - - SET1 (X[0], nonce[1]); SET2 (Y[0], nonce[0]); - - if (numbytes == 32) - Encrypt (X, Y, ctx.rk, 2); - else { - X[1] = X[0]; Y[1] = ADD (Y[0], _two); - if (numbytes == 64) - Encrypt (X, Y, ctx.rk, 4); - else { - X[2] = X[0]; Y[2] = ADD (Y[1], _two); - if (numbytes == 96) - Encrypt (X, Y, ctx.rk, 6); - else { - X[3] = X[0]; Y[3] = ADD (Y[2], _two); - Encrypt (X, Y, ctx.rk, 8); - } - } - } - - nonce[0] += (numbytes>>4); - - XOR_STORE (in, out, X[0], Y[0]); - if (numbytes >= 64) - XOR_STORE (in + 32, out + 32, X[1], Y[1]); - if (numbytes >= 96) - XOR_STORE (in + 64, out + 64, X[2], Y[2]); - if (numbytes >= 128) - XOR_STORE (in + 96, out + 96, X[3], Y[3]); - - return 0; -} - - -int speck_ctr (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, const speck_context_t ctx) { - - int i; - u64 nonce[2]; - unsigned char block[16]; - u64 * const block64 = (u64 *)block; - - if (!inlen) - return 0; - - nonce[0] = ((u64 *)n)[0]; - nonce[1] = ((u64 *)n)[1]; - - while (inlen >= 128) { - speck_encrypt_xor (out, in, nonce, ctx, 128); - in += 128; inlen -= 128; out += 128; - } - - if (inlen >= 96) { - speck_encrypt_xor (out, in, nonce, ctx, 96); - in += 96; inlen -= 96; out += 96; - } - - if (inlen >= 64) { - speck_encrypt_xor (out, in, nonce, ctx, 64); - in += 64; inlen -= 64; out += 64; - } - - if (inlen >= 32) { - speck_encrypt_xor (out, in, nonce, ctx, 32); - in += 32; inlen -= 32; out += 32; - } - - if (inlen >= 16) { - speck_encrypt_xor (block, in, nonce, ctx, 16); - ((u64 *)out)[0] = block64[0] ^ ((u64 *)in)[0]; - ((u64 *)out)[1] = block64[1] ^ ((u64 *)in)[1]; - in += 16; inlen -= 16; out += 16; - } - - if (inlen > 0) { - speck_encrypt_xor (block, in, nonce, ctx, 16); - for (i = 0; i < inlen; i++) - out[i] = block[i] ^ in[i]; - } - - return 0; -} - - -int speck_expand_key (const unsigned char *k, speck_context_t *ctx) { - - u64 K[4]; - size_t i; - for (i = 0; i < numkeywords; i++) - K[i] = ((u64 *)k)[i]; - - EK (K[0], K[1], K[2], K[3], ctx->rk, ctx->key); - - return 0; -} - - -#elif defined (__ARM_NEON) // NEON support ------------------------------------------- - - -#define LCS(x,r) (((x)<>(64-r))) -#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) - -#define XOR veorq_u64 -#define AND vandq_u64 -#define ADD vaddq_u64 -#define SL vshlq_n_u64 -#define SR vshrq_n_u64 - -#define SET(a,b) vcombine_u64((uint64x1_t)(a),(uint64x1_t)(b)) -#define SET1(X,c) (X=SET(c,c)) -#define SET2(X,c) (SET1(X,c), X=ADD(X,SET(0x1ll,0x0ll)),c+=2) - -#define LOW(Z) vgetq_lane_u64(Z,0) -#define HIGH(Z) vgetq_lane_u64(Z,1) -#define STORE(ip,X,Y) (((u64 *)(ip))[0]=HIGH(Y), ((u64 *)(ip))[1]=HIGH(X), ((u64 *)(ip))[2]=LOW(Y), ((u64 *)(ip))[3]=LOW(X)) -#define XOR_STORE(in,out,X,Y) (Y=XOR(Y,SET(((u64 *)(in))[2],((u64 *)(in))[0])), X=XOR(X,SET(((u64 *)(in))[3],((u64 *)(in))[1])), STORE(out,X,Y)) - -#define ROR(X,r) vsriq_n_u64(SL(X,(64-r)),X,r) -#define ROL(X,r) ROR(X,(64-r)) - -#define tableR vcreate_u8(0x0007060504030201LL) -#define tableL vcreate_u8(0x0605040302010007LL) -#define ROR8(X) SET(vtbl1_u8((uint8x8_t)vget_low_u64(X),tableR), vtbl1_u8((uint8x8_t)vget_high_u64(X),tableR)) -#define ROL8(X) SET(vtbl1_u8((uint8x8_t)vget_low_u64(X),tableL), vtbl1_u8((uint8x8_t)vget_high_u64(X),tableL)) - -#define numrounds 34 -#define numkeywords 4 - -#define R(X,Y,k) (X=XOR(ADD(ROR8(X),Y),k), Y=XOR(ROL(Y,3),X)) - -#define Rx2(X,Y,k) (R(X[0],Y[0],k)) - -#define Rx4(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k)) -#define Rx6(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k), R(X[2],Y[2],k)) -#define Rx8(X,Y,k) (X[0]=ROR8(X[0]), X[0]=ADD(X[0],Y[0]), X[0]=XOR(X[0],k), X[1]=ROR8(X[1]), X[1]=ADD(X[1],Y[1]), X[1]=XOR(X[1],k), \ - X[2]=ROR8(X[2]), X[2]=ADD(X[2],Y[2]), X[2]=XOR(X[2],k), X[3]=ROR8(X[3]), X[3]=ADD(X[3],Y[3]), X[3]=XOR(X[3],k), \ - Z[0]=SL(Y[0],3), Z[1]=SL(Y[1],3), Z[2]=SL(Y[2],3), Z[3]=SL(Y[3],3), \ - Y[0]=SR(Y[0],61), Y[1]=SR(Y[1],61), Y[2]=SR(Y[2],61), Y[3]=SR(Y[3],61), \ - Y[0]=XOR(Y[0],Z[0]), Y[1]=XOR(Y[1],Z[1]), Y[2]=XOR(Y[2],Z[2]), Y[3]=XOR(Y[3],Z[3]), \ - Y[0]=XOR(X[0],Y[0]), Y[1]=XOR(X[1],Y[1]), Y[2]=XOR(X[2],Y[2]), Y[3]=XOR(X[3],Y[3])) - -#define Rx1(x,y,k) (x[0]=RCS(x[0],8), x[0]+=y[0], x[0]^=k, y[0]=LCS(y[0],3), y[0]^=x[0]) - -#define Rx1b(x,y,k) (x=RCS(x,8), x+=y, x^=k, y=LCS(y,3), y^=x) - -#define Encrypt(X,Y,k,n) (Rx##n(X,Y,k[0]), Rx##n(X,Y,k[1]), Rx##n(X,Y,k[2]), Rx##n(X,Y,k[3]), Rx##n(X,Y,k[4]), Rx##n(X,Y,k[5]), Rx##n(X,Y,k[6]), Rx##n(X,Y,k[7]), \ - Rx##n(X,Y,k[8]), Rx##n(X,Y,k[9]), Rx##n(X,Y,k[10]), Rx##n(X,Y,k[11]), Rx##n(X,Y,k[12]), Rx##n(X,Y,k[13]), Rx##n(X,Y,k[14]), Rx##n(X,Y,k[15]), \ - Rx##n(X,Y,k[16]), Rx##n(X,Y,k[17]), Rx##n(X,Y,k[18]), Rx##n(X,Y,k[19]), Rx##n(X,Y,k[20]), Rx##n(X,Y,k[21]), Rx##n(X,Y,k[22]), Rx##n(X,Y,k[23]), \ - Rx##n(X,Y,k[24]), Rx##n(X,Y,k[25]), Rx##n(X,Y,k[26]), Rx##n(X,Y,k[27]), Rx##n(X,Y,k[28]), Rx##n(X,Y,k[29]), Rx##n(X,Y,k[30]), Rx##n(X,Y,k[31]), \ - Rx##n(X,Y,k[32]), Rx##n(X,Y,k[33])) - -#define RK(X,Y,k,key,i) (SET1(k[i],Y), key[i]=Y, X=RCS(X,8), X+=Y, X^=i, Y=LCS(Y,3), Y^=X) - -#define EK(A,B,C,D,k,key) (RK(B,A,k,key,0), RK(C,A,k,key,1), RK(D,A,k,key,2), RK(B,A,k,key,3), RK(C,A,k,key,4), RK(D,A,k,key,5), RK(B,A,k,key,6), \ - RK(C,A,k,key,7), RK(D,A,k,key,8), RK(B,A,k,key,9), RK(C,A,k,key,10), RK(D,A,k,key,11), RK(B,A,k,key,12), RK(C,A,k,key,13), \ - RK(D,A,k,key,14), RK(B,A,k,key,15), RK(C,A,k,key,16), RK(D,A,k,key,17), RK(B,A,k,key,18), RK(C,A,k,key,19), RK(D,A,k,key,20), \ - RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \ - RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33)) - - -static int speck_encrypt_xor (unsigned char *out, const unsigned char *in, u64 nonce[], speck_context_t *ctx, int numbytes) { - - u64 x[2], y[2]; - u128 X[4], Y[4], Z[4]; - - if (numbytes == 16) { - x[0] = nonce[1]; y[0]=nonce[0]; nonce[0]++; - Encrypt (x, y, ctx->key, 1); - ((u64 *)out)[1] = x[0]; ((u64 *)out)[0] = y[0]; - return 0; - } - - SET1 (X[0], nonce[1]); SET2 (Y[0], nonce[0]); - - if (numbytes == 32) - Encrypt (X, Y, ctx->rk, 2); - else { - X[1] = X[0]; SET2 (Y[1], nonce[0]); - if (numbytes == 64) - Encrypt (X, Y, ctx->rk, 4); - else { - X[2] = X[0]; SET2 (Y[2], nonce[0]); - if (numbytes == 96) - Encrypt (X, Y, ctx->rk, 6); - else { - X[3] = X[0]; SET2 (Y[3], nonce[0]); - Encrypt (X, Y, ctx->rk, 8); - } - } - } - - XOR_STORE (in, out, X[0], Y[0]); - if (numbytes >= 64) - XOR_STORE (in + 32, out + 32, X[1], Y[1]); - if (numbytes >= 96) - XOR_STORE (in + 64, out + 64, X[2], Y[2]); - if (numbytes >= 128) - XOR_STORE (in + 96, out + 96, X[3], Y[3]); - - return 0; -} - - -int speck_ctr (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx) { - - int i; - u64 nonce[2]; - unsigned char block[16]; - u64 *const block64 = (u64 *)block; - - if (!inlen) - return 0; - - nonce[0] = ((u64 *)n)[0]; - nonce[1] = ((u64 *)n)[1]; - - while (inlen >= 128) { - speck_encrypt_xor (out, in, nonce, ctx, 128); - in += 128; inlen -= 128; out += 128; - } - - if (inlen >= 96) { - speck_encrypt_xor (out, in, nonce, ctx, 96); - in += 96; inlen -= 96; out += 96; - } - - if (inlen >= 64) { - speck_encrypt_xor (out, in, nonce, ctx, 64); - in += 64; inlen -= 64; out += 64; - } - - if (inlen >= 32) { - speck_encrypt_xor (out, in, nonce, ctx, 32); - in += 32; inlen -= 32; out += 32; - } - - if (inlen >= 16) { - speck_encrypt_xor (block, in, nonce, ctx, 16); - ((u64 *)out)[0] = block64[0] ^ ((u64 *)in)[0]; - ((u64 *)out)[1] = block64[1] ^ ((u64 *)in)[1]; - in += 16; inlen -= 16; out += 16; - } - - if (inlen > 0) { - speck_encrypt_xor (block, in, nonce, ctx, 16); - for (i = 0; i < inlen; i++) - out[i] = block[i] ^ in[i]; - } - - return 0; -} - - -int speck_expand_key (const unsigned char *k, speck_context_t *ctx) { - - u64 K[4]; - size_t i; - for (i = 0; i < numkeywords; i++) - K[i] = ((u64 *)k)[i]; - - EK (K[0], K[1], K[2], K[3], ctx->rk, ctx->key); - - return 0; -} - - -#else // plain C ---------------------------------------------------------------- - - -#define ROR(x,r) (((x)>>(r))|((x)<<(64-(r)))) -#define ROL(x,r) (((x)<<(r))|((x)>>(64-(r)))) -#define R(x,y,k) (x=ROR(x,8), x+=y, x^=k, y=ROL(y,3), y^=x) - - -static int speck_encrypt (u64 *u, u64 *v, speck_context_t *ctx) { - - u64 i, x = *u, y = *v; - - for (i = 0; i < 34; i++) - R (x, y, ctx->key[i]); - - *u = x; *v = y; - - return 0; -} - - -int speck_ctr (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx) { - - u64 i, nonce[2], x, y, t; - unsigned char *block = malloc (16); - - if (!inlen) { - free (block); - return 0; - } - nonce[0] = htole64 ( ((u64*)n)[0] ); - nonce[1] = htole64 ( ((u64*)n)[1] ); - - t=0; - while (inlen >= 16) { - x = nonce[1]; y = nonce[0]; nonce[0]++; - speck_encrypt (&x, &y, ctx); - ((u64 *)out)[1+t] = htole64 (x ^ ((u64 *)in)[1+t]); - ((u64 *)out)[0+t] = htole64 (y ^ ((u64 *)in)[0+t]); - t += 2; - inlen -= 16; - } - if (inlen > 0) { - x = nonce[1]; y = nonce[0]; - speck_encrypt (&x, &y, ctx); - ((u64 *)block)[1] = htole64 (x); ((u64 *)block)[0] = htole64 (y); - for (i = 0; i < inlen; i++) - out[i + 8*t] = block[i] ^ in[i + 8*t]; - } - - free (block); - return 0; -} - - -int speck_expand_key (const unsigned char *k, speck_context_t *ctx) { - - u64 K[4]; - u64 i; - - for (i = 0; i < 4; i++) - K[i] = htole64 ( ((u64 *)k)[i] ); - - for (i = 0; i < 33; i += 3) { - ctx->key[i ] = K[0]; - R (K[1], K[0], i ); - ctx->key[i+1] = K[0]; - R (K[2], K[0], i + 1); - ctx->key[i+2] = K[0]; - R (K[3], K[0], i + 2); - } - ctx->key[33] = K[0]; - return 1; -} - - -#endif // AVX, SSE, NEON, plain C ------------------------------------------------ - - -// cipher SPECK -- 128 bit block size -- 128 bit key size -- CTR mode -// used for header encryption, thus the prefix 'he_' -// for now: just plain C -- AVX, SSE, NEON might follow - -#define ROR64(x,r) (((x)>>(r))|((x)<<(64-(r)))) -#define ROL64(x,r) (((x)<<(r))|((x)>>(64-(r)))) -#define R64(x,y,k) (x=ROR64(x,8), x+=y, x^=k, y=ROL64(y,3), y^=x) - - -static int speck_encrypt_he (u64 *u, u64 *v, speck_context_t *ctx) { - - u64 i, x=*u, y=*v; - - for (i = 0; i < 32; i++) - R64 (x, y, ctx->key[i]); - - *u = x; *v = y; - - return 0; -} - - -int speck_he (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx) { - - u64 i, nonce[2], x, y, t; - unsigned char *block = malloc(16); - - if (!inlen) { - free (block); - return 0; - } - nonce[0] = htole64 ( ((u64*)n)[0] ); - nonce[1] = htole64 ( ((u64*)n)[1] ); - - t = 0; - while (inlen >= 16) { - x = nonce[1]; y = nonce[0]; nonce[0]++; - speck_encrypt_he (&x, &y, ctx); - ((u64 *)out)[1+t] = htole64 (x ^ ((u64 *)in)[1+t]); - ((u64 *)out)[0+t] = htole64 (y ^ ((u64 *)in)[0+t]); - t += 2; - inlen -= 16; - } - - if (inlen > 0) { - x = nonce[1]; y = nonce[0]; - speck_encrypt_he (&x, &y, ctx); - ((u64 *)block)[1] = htole64 (x); ((u64 *)block)[0] = htole64 (y); - for (i = 0; i < inlen; i++) - out[i+8*t] = block[i] ^ in[i+8*t]; - } - - free(block); - return 0; -} - - -int speck_expand_key_he (const unsigned char *k, speck_context_t *ctx) { - - u64 A, B; - u64 i; - - A = htole64 ( ((u64 *)k)[0] ); - B = htole64 ( ((u64 *)k)[1] ); - - for (i = 0; i < 32; i++) { - ctx->key[i] = A; - R64 ( B, A, i); - } - return 1; -} - - -// ---------------------------------------------------------------------------------------- - - -// cipher SPECK -- 96 bit block size -- 96 bit key size -- ECB mode -// follows endianess rules as used in official implementation guide and NOT as in original 2013 cipher presentation -// used for IV in header encryption, thus the prefix 'he_iv_' -// for now: just plain C -- probably no need for AVX, SSE, NEON - -// prerequisite: lower 16 bit reset -#define ROTL48(x,r) (((((x)<<(r)) | (x>>(48-(r)))) >> 16) << 16) -#define ROTR48(x,r) (((((x)>>(r)) | ((x)<<(48-(r)))) >> 16) << 16) -#define ER96(x,y,k) (x=ROTR48(x,8), x+=y, x^=k, y=ROTL48(y,3), y^=x) -#define DR96(x,y,k) (y^=x, y=ROTR48(y,3), x^=k, x-=y, x=ROTL48(x,8)) - - -int speck_he_iv_encrypt (unsigned char *inout, speck_context_t *ctx) { - - u64 x, y; - int i; - - x = htole64 ( *(u64*)&inout[0] ); x <<= 16; - y = htole64 ( *(u64*)&inout[4] ); y >>= 16; y <<= 16; - - for (i = 0; i < 28; i++) - ER96 (y, x, ctx->key[i]); - - x >>= 16; x |= y << 32; - y >>= 32; - - ((u64*)inout)[0] = le64toh (x); - ((u32*)inout)[2] = le32toh (y); - - return 0; -} - - -int speck_he_iv_decrypt (unsigned char *inout, speck_context_t *ctx) { - - u64 x, y; - int i; - - x = htole64 ( *(u64*)&inout[0] ); x <<= 16; - y = htole64 ( *(u64*)&inout[4] ); y >>= 16; y <<= 16; - - for (i = 27; i >= 0; i--) - DR96 (y, x, ctx->key[i]); - - x >>= 16; x |= y << 32; - y >>= 32; - - ((u64*)inout)[0] = le64toh (x); - ((u32*)inout)[2] = le32toh (y); - - return 0; -} - - -int speck_expand_key_he_iv (const unsigned char *k, speck_context_t *ctx) { - - u64 A, B; - int i; - - A = htole64 ( *(u64 *)&k[0] ); A <<= 16; - B = htole64 ( *(u64 *)&k[4] ); B >>= 16; B <<= 16; - - for (i = 0; i < 28; i++) { - ctx->key[i] = A; - ER96 ( B, A, i << 16); - } - - return 1; -} - - -// ---------------------------------------------------------------------------------------- - -/* -// code for testing -- to be removed when finished -#include // for testing -#include - -int speck_test () { - - uint8_t key[32] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F }; - - uint8_t k96[12] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D }; - - uint8_t iv[16] = { 0x70, 0x6f, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x20, - 0x49, 0x6e, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65 }; - - uint8_t xv[16] = { 0x20, 0x6d, 0x61, 0x64, 0x65, 0x20, 0x69, 0x74, - 0x20, 0x65, 0x71, 0x75, 0x69, 0x76, 0x61, 0x6c }; - - uint8_t p96[12] = { 0x20, 0x75, 0x73, 0x61, 0x67, 0x65, - 0x2C, 0x20, 0x68, 0x6F, 0x77, 0x65 }; - - uint8_t pt[16] = { 0x00 }; - - // expected outcome (according to pp. 35 & 36 of Implementation Guide 1.1 as of 2019) and - // original cipher presentation as of 2013 in which notably a different endianess is used - uint8_t ct[16] = { 0x43, 0x8f, 0x18, 0x9c, 0x8d, 0xb4, 0xee, 0x4e, - 0x3e, 0xf5, 0xc0, 0x05, 0x04, 0x01, 0x09, 0x41 }; - - uint8_t xt[16] = { 0x18, 0x0d, 0x57, 0x5c, 0xdf, 0xfe, 0x60, 0x78, - 0x65, 0x32, 0x78, 0x79, 0x51, 0x98, 0x5d, 0xa6 }; - - uint8_t x96[12] = { 0xAA, 0x79, 0x8F, 0xDE, 0xBD, 0x62, - 0x78, 0x71, 0xAB, 0x09, 0x4D, 0x9E }; - speck_context_t ctx; - - speck_expand_key (key, &ctx); -#if defined (SPECK_CTX_BYVAL) - speck_ctr (pt, pt, 16, iv, ctx); -#else - speck_ctr (pt, pt, 16, iv, &ctx); -#endif - - u64 i; - fprintf (stderr, "rk00: %016llx\n", ctx.key[0]); - fprintf (stderr, "rk33: %016llx\n", ctx.key[33]); - fprintf (stderr, "out : %016lx\n", *(uint64_t*)pt); - fprintf (stderr, "mem : " ); for (i=0; i < 16; i++) fprintf (stderr, "%02x ", pt[i]); fprintf (stderr, "\n"); - - int ret = 1; - for (i=0; i < 16; i++) - if (pt[i] != ct[i]) ret = 0; - - memset (pt, 0, 16); - speck_expand_key_he (key, &ctx); - speck_he (pt, pt, 16, xv, &ctx); - - fprintf (stderr, "rk00: %016llx\n", ctx.key[0]); - fprintf (stderr, "rk31: %016llx\n", ctx.key[31]); - fprintf (stderr, "out : %016lx\n", *(uint64_t*)pt); - fprintf (stderr, "mem : " ); for (i=0; i < 16; i++) fprintf (stderr, "%02x ", pt[i]); fprintf (stderr, "\n"); - - for (i=0; i < 16; i++) - if (pt[i] != xt[i]) ret = 0; - - speck_expand_key_he_iv (k96, &ctx); - speck_he_iv_encrypt (p96, &ctx); -// speck_he_iv_decrypt (p96, &ctx); -// speck_he_iv_encrypt (p96, &ctx); - - fprintf (stderr, "rk00: %016llx\n", ctx.key[0]); - fprintf (stderr, "rk27: %016llx\n", ctx.key[27]); - fprintf (stderr, "out : %016lx\n", *(uint64_t*)p96); - fprintf (stderr, "mem : " ); for (i=0; i < 12; i++) fprintf (stderr, "%02x ", p96[i]); fprintf (stderr, "\n"); - - for (i=0; i < 12; i++) - if (p96[i] != x96[i]) ret = 0; - - return (ret); -} - - -int main (int argc, char* argv[]) { - - fprintf (stdout, "SPECK SELF TEST RESULT: %u\n", speck_test (0,NULL)); -} - -*/ diff --git a/bundles/n2n_ntop_v2/src/transform_aes.c b/bundles/n2n_ntop_v2/src/transform_aes.c deleted file mode 100644 index 27eeaaf9..00000000 --- a/bundles/n2n_ntop_v2/src/transform_aes.c +++ /dev/null @@ -1,480 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#ifdef N2N_HAVE_AES - -#include -#include -#include -#include - -#define N2N_AES_TRANSFORM_VERSION 1 /* version of the transform encoding */ -#define N2N_AES_IVEC_SIZE (AES_BLOCK_SIZE) - -#define AES256_KEY_BYTES (256/8) -#define AES192_KEY_BYTES (192/8) -#define AES128_KEY_BYTES (128/8) - -/* AES plaintext preamble */ -#define TRANSOP_AES_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_AES_IV_SEED_SIZE 8 /* size of transmitted random part of IV in bytes; could range - * from 0=lowest security (constant IV) to 16=higest security - * (fully random IV); default=8 */ -#define TRANSOP_AES_IV_PADDING_SIZE (N2N_AES_IVEC_SIZE - TRANSOP_AES_IV_SEED_SIZE) -#define TRANSOP_AES_IV_KEY_BYTES (AES128_KEY_BYTES) /* use AES128 for IV encryption */ -#define TRANSOP_AES_PREAMBLE_SIZE (TRANSOP_AES_VER_SIZE + TRANSOP_AES_IV_SEED_SIZE) - -typedef unsigned char n2n_aes_ivec_t[N2N_AES_IVEC_SIZE]; - -typedef struct transop_aes { -#ifdef HAVE_OPENSSL_1_1 - EVP_CIPHER_CTX *enc_ctx; /* openssl's reusable evp_* encryption context */ - EVP_CIPHER_CTX *dec_ctx; /* openssl's reusable evp_* decryption context */ - const EVP_CIPHER *cipher; /* cipher to use: e.g. EVP_aes_128_cbc */ - uint8_t key[32]; /* the pure key data for payload encryption & decryption */ -#else - AES_KEY enc_key; /* tx key */ - AES_KEY dec_key; /* tx key */ -#endif - AES_KEY iv_enc_key; /* key used to encrypt the IV */ - uint8_t iv_pad_val[TRANSOP_AES_IV_PADDING_SIZE]; /* key used to pad the random IV seed to full block size */ -} transop_aes_t; - -/* ****************************************************** */ - -static int transop_deinit_aes(n2n_trans_op_t *arg) { - transop_aes_t *priv = (transop_aes_t *)arg->priv; - -#ifdef HAVE_OPENSSL_1_1 - EVP_CIPHER_CTX_free(priv->enc_ctx); - EVP_CIPHER_CTX_free(priv->dec_ctx); -#endif - - if(priv) - free(priv); - - return 0; -} - -/* ****************************************************** */ - -#ifdef HAVE_OPENSSL_1_1 -/* get any erorr message out of openssl - taken from https://en.wikibooks.org/wiki/OpenSSL/Error_handling */ -static char *openssl_err_as_string (void) { - BIO *bio = BIO_new (BIO_s_mem ()); - ERR_print_errors (bio); - char *buf = NULL; - size_t len = BIO_get_mem_data (bio, &buf); - char *ret = (char *) calloc (1, 1 + len); - - if(ret) - memcpy (ret, buf, len); - - BIO_free (bio); - return ret; -} -#endif - -/* ****************************************************** */ - -/* convert a given number of bytes from memory to hex string; taken (and modified) from - https://stackoverflow.com/questions/6357031/how-do-you-convert-a-byte-array-to-a-hexadecimal-string-in-c */ -const char* to_hex(unsigned char * in, size_t insz, char * out, size_t outsz) -{ - unsigned char * pin = in; - const char * hex = "0123456789abcdef"; - char * pout = out; - for(; pin < in+insz; pout +=2, pin++){ - pout[0] = hex[(*pin>>4) & 0xF]; - pout[1] = hex[ *pin & 0xF]; - if (pout + 2 - out > outsz){ - /* Better to truncate output string than overflow buffer */ - /* it would be still better to either return a status */ - /* or ensure the target buffer is large enough and it never happen */ - break; - } - } - pout[2] = 0; - return out; -} - -/* ****************************************************** */ - -static void set_aes_cbc_iv(transop_aes_t *priv, n2n_aes_ivec_t ivec, uint8_t * iv_seed) { - uint8_t iv_full[N2N_AES_IVEC_SIZE]; - - /* Extend the seed to full block size with padding value */ - memcpy(iv_full, priv->iv_pad_val, TRANSOP_AES_IV_PADDING_SIZE); - memcpy(iv_full + TRANSOP_AES_IV_PADDING_SIZE, iv_seed, TRANSOP_AES_IV_SEED_SIZE); - - /* Encrypt the IV with secret key to make it unpredictable. - * As discussed in https://github.com/ntop/n2n/issues/72, it's important to - * have an unpredictable IV since the initial part of the packet plaintext - * can be easily reconstructed from plaintext headers and used by an attacker - * to perform differential analysis. - */ - AES_ecb_encrypt(iv_full, ivec, &priv->iv_enc_key, AES_ENCRYPT); -} - -/* ****************************************************** */ - -/** The aes packet format consists of: - * - * - a 8-bit aes encoding version in clear text - * - a TRANSOP_AES_IV_SEED_SIZE-sized [bytes] random IV seed - * - encrypted payload. - * - * [V|II|DDDDDDDDDDDDDDDDDDDDD] - * |<---- encrypted ---->| - */ -static int transop_encode_aes(n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) { - int len2=-1; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE] = {0}; - - if(in_len <= N2N_PKT_BUF_SIZE) { - if((in_len + TRANSOP_AES_PREAMBLE_SIZE) <= out_len) { - int len=-1; - size_t idx=0; - uint8_t iv_seed[TRANSOP_AES_IV_SEED_SIZE]; - uint8_t padding = 0; - n2n_aes_ivec_t enc_ivec = {0}; - - traceEvent(TRACE_DEBUG, "encode_aes %lu", in_len); - - /* Encode the aes format version. */ - encode_uint8(outbuf, &idx, N2N_AES_TRANSFORM_VERSION); - - /* Generate and encode the IV seed using as many calls to n2n_rand() as neccessary. - * Note: ( N2N_AES_IV_SEED_SIZE % sizeof(rand_value) ) not neccessarily equals 0. */ - uint64_t rand_value; - int8_t i; - for (i = TRANSOP_AES_IV_SEED_SIZE; i >= sizeof(rand_value); i -= sizeof(rand_value)) { - rand_value = n2n_rand(); - memcpy(iv_seed + TRANSOP_AES_IV_SEED_SIZE - i, &rand_value, sizeof(rand_value)); - } - /* Are there bytes left to fill? */ - if (i != 0) { - rand_value = n2n_rand(); - memcpy(iv_seed, &rand_value, i); - } - encode_buf(outbuf, &idx, iv_seed, TRANSOP_AES_IV_SEED_SIZE); - - /* Encrypt the assembly contents and write the ciphertext after the iv seed. */ - /* len is set to the length of the cipher plain text to be encrpyted - which is (in this case) identical to original packet lentgh */ - len = in_len; - - /* The assembly buffer is a source for encrypting data. - * The whole contents of assembly are encrypted. */ - memcpy(assembly, inbuf, in_len); - - /* Need at least one encrypted byte at the end for the padding. */ - len2 = ((len / AES_BLOCK_SIZE) + 1) * AES_BLOCK_SIZE; /* Round up to next whole AES adding at least one byte. */ - padding = (len2-len); - assembly[len2 - 1] = padding; - - char iv_seed_hex[2 * N2N_AES_IVEC_SIZE + 1]; - traceEvent(TRACE_DEBUG, "padding = %u, seed = 0x%s", padding, to_hex (iv_seed, TRANSOP_AES_IV_SEED_SIZE, iv_seed_hex, 2 * N2N_AES_IVEC_SIZE + 1) ); - - set_aes_cbc_iv(priv, enc_ivec, iv_seed); - -#ifdef HAVE_OPENSSL_1_1 - EVP_CIPHER_CTX *ctx = priv->enc_ctx; - int evp_len; - int evp_ciphertext_len; - - if(1 == EVP_EncryptInit_ex(ctx, priv->cipher, NULL, priv->key, enc_ivec)) { - if(1 == EVP_CIPHER_CTX_set_padding(ctx, 0)) { - if(1 == EVP_EncryptUpdate(ctx, outbuf + TRANSOP_AES_PREAMBLE_SIZE, &evp_len, assembly, len2)) { - evp_ciphertext_len = evp_len; - if(1 == EVP_EncryptFinal_ex(ctx, outbuf + TRANSOP_AES_PREAMBLE_SIZE + evp_len, &evp_len)) { - evp_ciphertext_len += evp_len; - - if(evp_ciphertext_len != len2) - traceEvent(TRACE_ERROR, "encode_aes openssl encryption: encrypted %u bytes where %u were expected.\n", - evp_ciphertext_len, len2); - } else - traceEvent(TRACE_ERROR, "encode_aes openssl final encryption: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "encode_aes openssl encrpytion: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "encode_aes openssl padding setup: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "encode_aes openssl init: %s\n", openssl_err_as_string()); - - EVP_CIPHER_CTX_reset(ctx); -#else - AES_cbc_encrypt(assembly, /* source */ - outbuf + TRANSOP_AES_PREAMBLE_SIZE, /* dest */ - len2, /* enc size */ - &(priv->enc_key), enc_ivec, AES_ENCRYPT); -#endif - - len2 += TRANSOP_AES_PREAMBLE_SIZE; /* size of data carried in UDP. */ - } else - traceEvent(TRACE_ERROR, "encode_aes outbuf too small."); - } else - traceEvent(TRACE_ERROR, "encode_aes inbuf too big to encrypt."); - - return len2; -} - -/* ****************************************************** */ - -/* See transop_encode_aes for packet format */ -static int transop_decode_aes(n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) { - int len=0; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - if(((in_len - TRANSOP_AES_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE) /* Cipher text fits in assembly */ - && (in_len >= TRANSOP_AES_PREAMBLE_SIZE) /* Has at least version, iv seed */ - ) - { - size_t rem=in_len; - size_t idx=0; - uint8_t aes_enc_ver=0; - uint8_t iv_seed[TRANSOP_AES_IV_SEED_SIZE]; - - /* Get the encoding version to make sure it is supported */ - decode_uint8(&aes_enc_ver, inbuf, &rem, &idx ); - - if(N2N_AES_TRANSFORM_VERSION == aes_enc_ver) { - /* Get the IV seed */ - decode_buf((uint8_t *)&iv_seed, TRANSOP_AES_IV_SEED_SIZE, inbuf, &rem, &idx); - - char iv_seed_hex[2 * N2N_AES_IVEC_SIZE + 1]; - traceEvent(TRACE_DEBUG, "decode_aes %lu with seed 0x%s", in_len, to_hex (iv_seed, TRANSOP_AES_IV_SEED_SIZE, iv_seed_hex, 2 * N2N_AES_IVEC_SIZE + 1) ); - - len = (in_len - TRANSOP_AES_PREAMBLE_SIZE); - - if(0 == (len % AES_BLOCK_SIZE)) { - uint8_t padding; - n2n_aes_ivec_t dec_ivec = {0}; - - set_aes_cbc_iv(priv, dec_ivec, iv_seed); - -#ifdef HAVE_OPENSSL_1_1 - EVP_CIPHER_CTX *ctx = priv->dec_ctx; - int evp_len; - int evp_plaintext_len; - - if(1 == EVP_DecryptInit_ex(ctx, priv->cipher, NULL, priv->key, dec_ivec)) { - if(1 == EVP_CIPHER_CTX_set_padding(ctx, 0)) { - if(1 == EVP_DecryptUpdate(ctx, assembly, &evp_len, inbuf + TRANSOP_AES_PREAMBLE_SIZE, len)) { - evp_plaintext_len = evp_len; - if(1 == EVP_DecryptFinal_ex(ctx, assembly + evp_len, &evp_len)) { - evp_plaintext_len += evp_len; - - if(evp_plaintext_len != len) - traceEvent(TRACE_ERROR, "decode_aes openssl decryption: decrypted %u bytes where %u were expected.\n", - evp_plaintext_len, len); - } else - traceEvent(TRACE_ERROR, "decode_aes openssl final decryption: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "decode_aes openssl decrpytion: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "decode_aes openssl padding setup: %s\n", openssl_err_as_string()); - - } else - traceEvent(TRACE_ERROR, "decode_aes openssl init: %s\n", openssl_err_as_string()); - - EVP_CIPHER_CTX_reset(ctx); -#else - AES_cbc_encrypt((inbuf + TRANSOP_AES_PREAMBLE_SIZE), - assembly, /* destination */ - len, - &(priv->dec_key), - dec_ivec, AES_DECRYPT); -#endif - /* last byte is how much was padding: max value should be - * AES_BLOCKSIZE-1 */ - padding = assembly[ len-1 ] & 0xff; - - if(len >= padding) { - /* strictly speaking for this to be an ethernet packet - * it is going to need to be even bigger; but this is - * enough to prevent segfaults. */ - traceEvent(TRACE_DEBUG, "padding = %u", padding); - len -= padding; - - memcpy(outbuf, - assembly, - len); - } else - traceEvent(TRACE_WARNING, "UDP payload decryption failed."); - } else { - traceEvent(TRACE_WARNING, "Encrypted length %d is not a multiple of AES_BLOCK_SIZE (%d)", len, AES_BLOCK_SIZE); - len = 0; - } - } else - traceEvent(TRACE_ERROR, "decode_aes unsupported aes version %u.", aes_enc_ver); - } else - traceEvent(TRACE_ERROR, "decode_aes inbuf wrong size (%ul) to decrypt.", in_len); - - return len; -} - -/* ****************************************************** */ - -static int setup_aes_key(transop_aes_t *priv, const uint8_t *key, ssize_t key_size) { - size_t aes_key_size_bytes; - size_t aes_key_size_bits; - - uint8_t key_mat_buf[SHA512_DIGEST_LENGTH + SHA256_DIGEST_LENGTH]; - size_t key_mat_buf_length; - - /* Clear out any old possibly longer key matter. */ -#ifdef HAVE_OPENSSL_1_1 - memset(&(priv->key), 0, sizeof(priv->key) ); -#else - memset(&(priv->enc_key), 0, sizeof(priv->enc_key) ); - memset(&(priv->dec_key), 0, sizeof(priv->dec_key) ); -#endif - memset(&(priv->iv_enc_key), 0, sizeof(priv->iv_enc_key) ); - memset(&(priv->iv_pad_val), 0, sizeof(priv->iv_pad_val) ); - - /* Let the user choose the degree of encryption: - * Long input keys will pick AES192 or AES256 with more robust but expensive encryption. - * - * The input key always gets hashed to make a more unpredictable use of the key space and - * also to derive some additional material (key for IV encrpytion, IV padding). - * - * The following scheme for key setup was discussed on github: - * https://github.com/ntop/n2n/issues/101 - */ - - /* create a working buffer of maximal occuring hashes size and generate - * the hashes for the aes key material, key_mat_buf_lengh indicates the - * actual "filling level" of the buffer - */ - - if(key_size >= 65) { -#ifdef HAVE_OPENSSL_1_1 - priv->cipher = EVP_aes_256_cbc(); -#endif - aes_key_size_bytes = AES256_KEY_BYTES; - SHA512(key, key_size, key_mat_buf); - key_mat_buf_length = SHA512_DIGEST_LENGTH; - } else if(key_size >= 44) { -#ifdef HAVE_OPENSSL_1_1 - priv->cipher = EVP_aes_192_cbc(); -#endif - aes_key_size_bytes = AES192_KEY_BYTES; - SHA384(key, key_size, key_mat_buf); - /* append a hash of the first hash to create enough material for IV padding */ - SHA256(key_mat_buf, SHA384_DIGEST_LENGTH, key_mat_buf + SHA384_DIGEST_LENGTH); - key_mat_buf_length = SHA384_DIGEST_LENGTH + SHA256_DIGEST_LENGTH; - } else { -#ifdef HAVE_OPENSSL_1_1 - priv->cipher = EVP_aes_128_cbc(); -#endif - aes_key_size_bytes = AES128_KEY_BYTES; - SHA256(key, key_size, key_mat_buf); - /* append a hash of the first hash to create enough material for IV padding */ - SHA256(key_mat_buf, SHA256_DIGEST_LENGTH, key_mat_buf + SHA256_DIGEST_LENGTH); - key_mat_buf_length = 2 * SHA256_DIGEST_LENGTH; - } - - /* is there enough material available? */ - if(key_mat_buf_length < (aes_key_size_bytes + TRANSOP_AES_IV_KEY_BYTES + TRANSOP_AES_IV_PADDING_SIZE)) { - /* this should never happen */ - traceEvent(TRACE_ERROR, "AES missing %u bits hashed key material\n", - (aes_key_size_bytes + TRANSOP_AES_IV_KEY_BYTES + TRANSOP_AES_IV_PADDING_SIZE - key_mat_buf_length) * 8); - return(1); - } - - /* setup of key, used for the CBC encryption */ - aes_key_size_bits = 8 * aes_key_size_bytes; - -#ifdef HAVE_OPENSSL_1_1 - memcpy (priv->key, key_mat_buf, aes_key_size_bytes); -#else - AES_set_encrypt_key(key_mat_buf, aes_key_size_bits, &(priv->enc_key)); - AES_set_decrypt_key(key_mat_buf, aes_key_size_bits, &(priv->dec_key)); -#endif - - /* setup of iv_enc_key (AES128 key) and iv_pad_val, used for generating the CBC IV */ - AES_set_encrypt_key(key_mat_buf + aes_key_size_bytes, TRANSOP_AES_IV_KEY_BYTES * 8, &(priv->iv_enc_key)); - memcpy(priv->iv_pad_val, key_mat_buf + aes_key_size_bytes + TRANSOP_AES_IV_KEY_BYTES, TRANSOP_AES_IV_PADDING_SIZE); - - traceEvent(TRACE_DEBUG, "AES %u bits setup completed\n", - aes_key_size_bits); - - return(0); -} - -/* ****************************************************** */ - -static void transop_tick_aes(n2n_trans_op_t * arg, time_t now) { ; } - -/* ****************************************************** */ - -/* AES initialization function */ -int n2n_transop_aes_cbc_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - transop_aes_t *priv; - const u_char *encrypt_key = (const u_char *)conf->encrypt_key; - size_t encrypt_key_len = strlen(conf->encrypt_key); - - memset(ttt, 0, sizeof(*ttt)); - ttt->transform_id = N2N_TRANSFORM_ID_AESCBC; - - ttt->tick = transop_tick_aes; - ttt->deinit = transop_deinit_aes; - ttt->fwd = transop_encode_aes; - ttt->rev = transop_decode_aes; - - priv = (transop_aes_t*) calloc(1, sizeof(transop_aes_t)); - if(!priv) { - traceEvent(TRACE_ERROR, "cannot allocate transop_aes_t memory"); - return(-1); - } - ttt->priv = priv; - -#ifdef HAVE_OPENSSL_1_1 - /* Setup openssl's reusable evp_* contexts for encryption and decryption*/ - if(!(priv->enc_ctx = EVP_CIPHER_CTX_new())) { - traceEvent(TRACE_ERROR, "openssl's evp_* encryption context creation: %s\n", openssl_err_as_string()); - return(-1); - } - - if(!(priv->dec_ctx = EVP_CIPHER_CTX_new())) { - traceEvent(TRACE_ERROR, "openssl's evp_* decryption context creation: %s\n", openssl_err_as_string()); - return(-1); - } -#endif - - /* Setup the cipher and key */ - return(setup_aes_key(priv, encrypt_key, encrypt_key_len)); -} - -#endif /* N2N_HAVE_AES */ diff --git a/bundles/n2n_ntop_v2/src/transform_cc20.c b/bundles/n2n_ntop_v2/src/transform_cc20.c deleted file mode 100644 index 44fd70ba..00000000 --- a/bundles/n2n_ntop_v2/src/transform_cc20.c +++ /dev/null @@ -1,292 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#ifdef HAVE_OPENSSL_1_1 - -#include -#include -#include - -#define N2N_CC20_TRANSFORM_VERSION 1 /* version of the transform encoding */ -#define N2N_CC20_IVEC_SIZE 16 - -#define CC20_KEY_BYTES (256/8) - -/* ChaCha20 plaintext preamble */ -#define TRANSOP_CC20_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_CC20_PREAMBLE_SIZE (TRANSOP_CC20_VER_SIZE + N2N_CC20_IVEC_SIZE) - -typedef unsigned char n2n_cc20_ivec_t[N2N_CC20_IVEC_SIZE]; - -typedef struct transop_cc20 { - EVP_CIPHER_CTX *enc_ctx; /* openssl's reusable evp_* encryption context */ - EVP_CIPHER_CTX *dec_ctx; /* openssl's reusable evp_* decryption context */ - const EVP_CIPHER *cipher; /* cipher to use: EVP_chacha20() */ - uint8_t key[32]; /* the pure key data for payload encryption & decryption */ -} transop_cc20_t; - -/* ****************************************************** */ - -static int transop_deinit_cc20(n2n_trans_op_t *arg) { - transop_cc20_t *priv = (transop_cc20_t *)arg->priv; - - EVP_CIPHER_CTX_free(priv->enc_ctx); - EVP_CIPHER_CTX_free(priv->dec_ctx); - - if(priv) - free(priv); - - return 0; -} - -/* ****************************************************** */ - -/* get any erorr message out of openssl - taken from https://en.wikibooks.org/wiki/OpenSSL/Error_handling */ -static char *openssl_err_as_string (void) { - BIO *bio = BIO_new (BIO_s_mem ()); - ERR_print_errors (bio); - char *buf = NULL; - size_t len = BIO_get_mem_data (bio, &buf); - char *ret = (char *) calloc (1, 1 + len); - - if(ret) - memcpy (ret, buf, len); - - BIO_free (bio); - return ret; -} - -/* ****************************************************** */ - -static void set_cc20_iv(transop_cc20_t *priv, n2n_cc20_ivec_t ivec) { - // keep in mind the following condition: N2N_CC20_IVEC_SIZE % sizeof(rand_value) == 0 ! - uint64_t rand_value; - for (uint8_t i = 0; i < N2N_CC20_IVEC_SIZE; i += sizeof(rand_value)) { - rand_value = n2n_rand(); - memcpy(ivec + i, &rand_value, sizeof(rand_value)); - } -} - -/* ****************************************************** */ - -/** The ChaCha20 packet format consists of: - * - * - a 8-bit cc20 encoding version in clear text - * - a 128-bit random IV - * - encrypted payload. - * - * [V|IIII|DDDDDDDDDDDDDDDDDDDDD] - * |<---- encrypted ---->| - */ -static int transop_encode_cc20(n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) { - int len=-1; - transop_cc20_t * priv = (transop_cc20_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE] = {0}; - - if(in_len <= N2N_PKT_BUF_SIZE) { - if((in_len + TRANSOP_CC20_PREAMBLE_SIZE) <= out_len) { - size_t idx=0; - n2n_cc20_ivec_t enc_ivec = {0}; - - traceEvent(TRACE_DEBUG, "encode_cc20 %lu bytes", in_len); - - /* Encode the ChaCha20 format version. */ - encode_uint8(outbuf, &idx, N2N_CC20_TRANSFORM_VERSION); - - /* Generate and encode the IV. */ - set_cc20_iv(priv, enc_ivec); - encode_buf(outbuf, &idx, &enc_ivec, N2N_CC20_IVEC_SIZE); - - /* Encrypt the assembly contents and write the ciphertext after the iv. */ - /* len is set to the length of the cipher plain text to be encrpyted - which is (in this case) identical to original packet lentgh */ - len = in_len; - - /* The assembly buffer is a source for encrypting data. - * The whole contents of assembly are encrypted. */ - memcpy(assembly, inbuf, in_len); - - EVP_CIPHER_CTX *ctx = priv->enc_ctx; - int evp_len; - int evp_ciphertext_len; - - if(1 == EVP_EncryptInit_ex(ctx, priv->cipher, NULL, priv->key, enc_ivec)) { - if(1 == EVP_CIPHER_CTX_set_padding(ctx, 0)) { - if(1 == EVP_EncryptUpdate(ctx, outbuf + TRANSOP_CC20_PREAMBLE_SIZE, &evp_len, assembly, len)) { - evp_ciphertext_len = evp_len; - if(1 == EVP_EncryptFinal_ex(ctx, outbuf + TRANSOP_CC20_PREAMBLE_SIZE + evp_len, &evp_len)) { - evp_ciphertext_len += evp_len; - - if(evp_ciphertext_len != len) - traceEvent(TRACE_ERROR, "encode_cc20 openssl encryption: encrypted %u bytes where %u were expected.\n", - evp_ciphertext_len, len); - } else - traceEvent(TRACE_ERROR, "encode_cc20 openssl final encryption: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "encode_cc20 openssl encrpytion: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "encode_cc20 openssl padding setup: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "encode_cc20 openssl init: %s\n", openssl_err_as_string()); - - EVP_CIPHER_CTX_reset(ctx); - - len += TRANSOP_CC20_PREAMBLE_SIZE; /* size of data carried in UDP. */ - } else - traceEvent(TRACE_ERROR, "encode_cc20 outbuf too small."); - } else - traceEvent(TRACE_ERROR, "encode_cc20 inbuf too big to encrypt."); - - return len; -} - -/* ****************************************************** */ - -/* See transop_encode_cc20 for packet format */ -static int transop_decode_cc20(n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) { - int len=0; - transop_cc20_t * priv = (transop_cc20_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - if(((in_len - TRANSOP_CC20_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE) /* Cipher text fits in assembly */ - && (in_len >= TRANSOP_CC20_PREAMBLE_SIZE) /* Has at least version, iv */ - ) - { - size_t rem=in_len; - size_t idx=0; - uint8_t cc20_enc_ver=0; - n2n_cc20_ivec_t dec_ivec = {0}; - - /* Get the encoding version to make sure it is supported */ - decode_uint8(&cc20_enc_ver, inbuf, &rem, &idx ); - - if(N2N_CC20_TRANSFORM_VERSION == cc20_enc_ver) { - traceEvent(TRACE_DEBUG, "decode_cc20 %lu bytes", in_len); - len = (in_len - TRANSOP_CC20_PREAMBLE_SIZE); - - /* Get the IV */ - decode_buf((uint8_t *)&dec_ivec, N2N_CC20_IVEC_SIZE, inbuf, &rem, &idx); - - EVP_CIPHER_CTX *ctx = priv->dec_ctx; - int evp_len; - int evp_plaintext_len; - - if(1 == EVP_DecryptInit_ex(ctx, priv->cipher, NULL, priv->key, dec_ivec)) { - if(1 == EVP_CIPHER_CTX_set_padding(ctx, 0)) { - if(1 == EVP_DecryptUpdate(ctx, assembly, &evp_len, inbuf + TRANSOP_CC20_PREAMBLE_SIZE, len)) { - evp_plaintext_len = evp_len; - if(1 == EVP_DecryptFinal_ex(ctx, assembly + evp_len, &evp_len)) { - evp_plaintext_len += evp_len; - - if(evp_plaintext_len != len) - traceEvent(TRACE_ERROR, "decode_cc20 openssl decryption: decrypted %u bytes where %u were expected.\n", - evp_plaintext_len, len); - } else - traceEvent(TRACE_ERROR, "decode_cc20 openssl final decryption: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "decode_cc20 openssl decrpytion: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "decode_cc20 openssl padding setup: %s\n", openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "decode_cc20 openssl init: %s\n", openssl_err_as_string()); - - EVP_CIPHER_CTX_reset(ctx); - - memcpy(outbuf, assembly, len); - } else - traceEvent(TRACE_ERROR, "decode_cc20 unsupported ChaCha20 version %u.", cc20_enc_ver); - } else - traceEvent(TRACE_ERROR, "decode_cc20 inbuf wrong size (%ul) to decrypt.", in_len); - - return len; -} - -/* ****************************************************** */ - -static int setup_cc20_key(transop_cc20_t *priv, const uint8_t *key, ssize_t key_size) { - uint8_t key_mat_buf[SHA256_DIGEST_LENGTH]; - - priv->cipher = EVP_chacha20(); - - /* Clear out any old possibly longer key matter. */ - memset(&(priv->key), 0, sizeof(priv->key) ); - /* The input key always gets hashed to make a more unpredictable and more complete use of the key space */ - SHA256(key, key_size, key_mat_buf); - memcpy (priv->key, key_mat_buf, SHA256_DIGEST_LENGTH); - - traceEvent(TRACE_DEBUG, "ChaCha20 key setup completed\n"); - - return(0); -} - -/* ****************************************************** */ - -static void transop_tick_cc20(n2n_trans_op_t * arg, time_t now) { ; } - -/* ****************************************************** */ - -/* ChaCha20 initialization function */ -int n2n_transop_cc20_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - transop_cc20_t *priv; - const u_char *encrypt_key = (const u_char *)conf->encrypt_key; - size_t encrypt_key_len = strlen(conf->encrypt_key); - - memset(ttt, 0, sizeof(*ttt)); - ttt->transform_id = N2N_TRANSFORM_ID_CHACHA20; - - ttt->tick = transop_tick_cc20; - ttt->deinit = transop_deinit_cc20; - ttt->fwd = transop_encode_cc20; - ttt->rev = transop_decode_cc20; - - priv = (transop_cc20_t*) calloc(1, sizeof(transop_cc20_t)); - if(!priv) { - traceEvent(TRACE_ERROR, "cannot allocate transop_cc20_t memory"); - return(-1); - } - ttt->priv = priv; - - /* Setup openssl's reusable evp_* contexts for encryption and decryption*/ - if(!(priv->enc_ctx = EVP_CIPHER_CTX_new())) { - traceEvent(TRACE_ERROR, "openssl's evp_* encryption context creation: %s\n", openssl_err_as_string()); - return(-1); - } - - if(!(priv->dec_ctx = EVP_CIPHER_CTX_new())) { - traceEvent(TRACE_ERROR, "openssl's evp_* decryption context creation: %s\n", openssl_err_as_string()); - return(-1); - } - - /* Setup the cipher and key */ - return(setup_cc20_key(priv, encrypt_key, encrypt_key_len)); -} - -#endif /* HAVE_OPENSSL_1_1 */ diff --git a/bundles/n2n_ntop_v2/src/transform_null.c b/bundles/n2n_ntop_v2/src/transform_null.c deleted file mode 100644 index 830bcfa2..00000000 --- a/bundles/n2n_ntop_v2/src/transform_null.c +++ /dev/null @@ -1,87 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "n2n_transforms.h" - -static int transop_deinit_null( n2n_trans_op_t * arg ) -{ - /* nothing to deallocate, nothing to release. */ - return 0; -} - -static int transop_encode_null( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int retval = -1; - - traceEvent( TRACE_DEBUG, "encode_null %lu", in_len ); - if ( out_len >= in_len ) - { - memcpy( outbuf, inbuf, in_len ); - retval = in_len; - } - else - { - traceEvent( TRACE_DEBUG, "encode_null %lu too big for packet buffer", in_len ); - } - - return retval; -} - -static int transop_decode_null( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int retval = -1; - - traceEvent( TRACE_DEBUG, "decode_null %lu", in_len ); - if ( out_len >= in_len ) - { - memcpy( outbuf, inbuf, in_len ); - retval = in_len; - } - else - { - traceEvent( TRACE_DEBUG, "decode_null %lu too big for packet buffer", in_len ); - } - - return retval; -} - -static void transop_tick_null(n2n_trans_op_t * arg, time_t now) {} - -int n2n_transop_null_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - memset(ttt, 0, sizeof(n2n_trans_op_t) ); - - ttt->transform_id = N2N_TRANSFORM_ID_NULL; - ttt->no_encryption = 1; - ttt->deinit = transop_deinit_null; - ttt->tick = transop_tick_null; - ttt->fwd = transop_encode_null; - ttt->rev = transop_decode_null; - - return(0); -} diff --git a/bundles/n2n_ntop_v2/src/transform_speck.c b/bundles/n2n_ntop_v2/src/transform_speck.c deleted file mode 100644 index ede1378c..00000000 --- a/bundles/n2n_ntop_v2/src/transform_speck.c +++ /dev/null @@ -1,218 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#define N2N_SPECK_TRANSFORM_VERSION 1 /* version of the transform encoding */ -#define N2N_SPECK_IVEC_SIZE 16 - -#define SPECK_KEY_BYTES (256/8) - -/* Speck plaintext preamble */ -#define TRANSOP_SPECK_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_SPECK_PREAMBLE_SIZE (TRANSOP_SPECK_VER_SIZE + N2N_SPECK_IVEC_SIZE) - -typedef unsigned char n2n_speck_ivec_t[N2N_SPECK_IVEC_SIZE]; - -typedef struct transop_speck { - speck_context_t ctx; /* the round keys for payload encryption & decryption */ -} transop_speck_t; - -/* ****************************************************** */ - -static int transop_deinit_speck(n2n_trans_op_t *arg) { - transop_speck_t *priv = (transop_speck_t *)arg->priv; - - if(priv) -#if defined (SPECK_ALIGNED_CTX) - _mm_free (priv); -#else - free (priv); -#endif - return 0; -} - -/* ****************************************************** */ - -static void set_speck_iv(transop_speck_t *priv, n2n_speck_ivec_t ivec) { - // keep in mind the following condition: N2N_SPECK_IVEC_SIZE % sizeof(rand_value) == 0 ! - uint64_t rand_value; - uint8_t i; - - for (i = 0; i < N2N_SPECK_IVEC_SIZE; i += sizeof(rand_value)) { - rand_value = n2n_rand(); - memcpy(ivec + i, &rand_value, sizeof(rand_value)); - } -} - -/* ****************************************************** */ - -/** The Speck packet format consists of: - * - * - a 8-bit speck encoding version in clear text - * - a 128-bit random IV - * - encrypted payload. - * - * [V|IIII|DDDDDDDDDDDDDDDDDDDDD] - * |<---- encrypted ---->| - */ -static int transop_encode_speck(n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) { - int len=-1; - transop_speck_t * priv = (transop_speck_t *)arg->priv; - - if(in_len <= N2N_PKT_BUF_SIZE) { - if((in_len + TRANSOP_SPECK_PREAMBLE_SIZE) <= out_len) { - size_t idx=0; - n2n_speck_ivec_t enc_ivec = {0}; - - traceEvent(TRACE_DEBUG, "encode_speck %lu bytes", in_len); - - /* Encode the Speck format version. */ - encode_uint8(outbuf, &idx, N2N_SPECK_TRANSFORM_VERSION); - - /* Generate and encode the IV. */ - set_speck_iv(priv, enc_ivec); - encode_buf(outbuf, &idx, &enc_ivec, N2N_SPECK_IVEC_SIZE); - - /* Encrypt the payload and write the ciphertext after the iv. */ - /* len is set to the length of the cipher plain text to be encrpyted - which is (in this case) identical to original packet lentgh */ - len = in_len; - - speck_ctr (outbuf + TRANSOP_SPECK_PREAMBLE_SIZE, inbuf, in_len, enc_ivec, -#if defined (SPECK_CTX_BYVAL) - (priv->ctx)); -#else - &(priv->ctx)); -#endif - traceEvent(TRACE_DEBUG, "encode_speck: encrypted %u bytes.\n", in_len); - - len += TRANSOP_SPECK_PREAMBLE_SIZE; /* size of data carried in UDP. */ - } else - traceEvent(TRACE_ERROR, "encode_speck outbuf too small."); - } else - traceEvent(TRACE_ERROR, "encode_speck inbuf too big to encrypt."); - - return len; -} - -/* ****************************************************** */ - -/* See transop_encode_speck for packet format */ -static int transop_decode_speck(n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) { - int len=0; - transop_speck_t * priv = (transop_speck_t *)arg->priv; - - if(((in_len - TRANSOP_SPECK_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE) /* Cipher text fits in buffer */ - && (in_len >= TRANSOP_SPECK_PREAMBLE_SIZE) /* Has at least version, iv */ - ) - { - size_t rem=in_len; - size_t idx=0; - uint8_t speck_enc_ver=0; - n2n_speck_ivec_t dec_ivec = {0}; - - /* Get the encoding version to make sure it is supported */ - decode_uint8(&speck_enc_ver, inbuf, &rem, &idx ); - - if(N2N_SPECK_TRANSFORM_VERSION == speck_enc_ver) { - traceEvent(TRACE_DEBUG, "decode_speck %lu bytes", in_len); - len = (in_len - TRANSOP_SPECK_PREAMBLE_SIZE); - - /* Get the IV */ - decode_buf((uint8_t *)&dec_ivec, N2N_SPECK_IVEC_SIZE, inbuf, &rem, &idx); - - speck_ctr (outbuf, inbuf + TRANSOP_SPECK_PREAMBLE_SIZE, len, dec_ivec, -#if defined (SPECK_CTX_BYVAL) - (priv->ctx)); -#else - &(priv->ctx)); -#endif - traceEvent(TRACE_DEBUG, "decode_speck: decrypted %u bytes.\n", len); - - } else - traceEvent(TRACE_ERROR, "decode_speck unsupported Speck version %u.", speck_enc_ver); - } else - traceEvent(TRACE_ERROR, "decode_speck inbuf wrong size (%ul) to decrypt.", in_len); - - return len; -} - -/* ****************************************************** */ - -static int setup_speck_key(transop_speck_t *priv, const uint8_t *key, ssize_t key_size) { - - uint8_t key_mat_buf[32] = { 0x00 }; - - /* Clear out any old possibly longer key matter. */ - memset(&(priv->ctx), 0, sizeof(speck_context_t) ); - - /* the input key always gets hashed to make a more unpredictable and more complete use of the key space */ - pearson_hash_256 (key_mat_buf, key, key_size); - - /* expand the key material to the context (= round keys) */ - speck_expand_key (key_mat_buf, &(priv->ctx)); - - traceEvent(TRACE_DEBUG, "Speck key setup completed\n"); - - return(0); -} - -/* ****************************************************** */ - -static void transop_tick_speck(n2n_trans_op_t * arg, time_t now) { ; } - -/* ****************************************************** */ -/* Speck initialization function */ -int n2n_transop_speck_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - transop_speck_t *priv; - const u_char *encrypt_key = (const u_char *)conf->encrypt_key; - size_t encrypt_key_len = strlen(conf->encrypt_key); - - memset(ttt, 0, sizeof(*ttt)); - ttt->transform_id = N2N_TRANSFORM_ID_SPECK; - - ttt->tick = transop_tick_speck; - ttt->deinit = transop_deinit_speck; - ttt->fwd = transop_encode_speck; - ttt->rev = transop_decode_speck; -#if defined (SPECK_ALIGNED_CTX) - priv = (transop_speck_t*) _mm_malloc (sizeof(transop_speck_t), SPECK_ALIGNED_CTX); -#else - priv = (transop_speck_t*) calloc (1, sizeof(transop_speck_t)); -#endif - if(!priv) { - traceEvent(TRACE_ERROR, "cannot allocate transop_speck_t memory"); - return(-1); - } - ttt->priv = priv; - - /* Setup the cipher and key */ - return(setup_speck_key(priv, encrypt_key, encrypt_key_len)); -} - diff --git a/bundles/n2n_ntop_v2/src/transform_tf.c b/bundles/n2n_ntop_v2/src/transform_tf.c deleted file mode 100644 index a630d512..00000000 --- a/bundles/n2n_ntop_v2/src/transform_tf.c +++ /dev/null @@ -1,212 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#define N2N_TWOFISH_NUM_SA 32 /* space for SAa */ - -#define N2N_TWOFISH_TRANSFORM_VERSION 1 /* version of the transform encoding */ - -typedef struct transop_tf { - TWOFISH* enc_tf; /* tx state */ - TWOFISH* dec_tf; /* rx state */ -} transop_tf_t; - -static int transop_deinit_twofish( n2n_trans_op_t * arg ) { - transop_tf_t *priv = (transop_tf_t *)arg->priv; - - if(priv) { - TwoFishDestroy(priv->enc_tf); /* deallocate TWOFISH */ - TwoFishDestroy(priv->dec_tf); /* deallocate TWOFISH */ - free(priv); - } - - return 0; -} - -#define TRANSOP_TF_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_TF_NONCE_SIZE 4 -#define TRANSOP_TF_SA_SIZE 4 - -/** The twofish packet format consists of: - * - * - a 8-bit twofish encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_encode_twofish( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len=-1; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - uint32_t * pnonce; - - if ( (in_len + TRANSOP_TF_NONCE_SIZE) <= N2N_PKT_BUF_SIZE ) - { - if ( (in_len + TRANSOP_TF_NONCE_SIZE + TRANSOP_TF_SA_SIZE + TRANSOP_TF_VER_SIZE) <= out_len ) - { - size_t idx=0; - uint32_t sa_id=0; // Not used - - traceEvent(TRACE_DEBUG, "encode_twofish %lu", in_len); - - /* Encode the twofish format version. */ - encode_uint8( outbuf, &idx, N2N_TWOFISH_TRANSFORM_VERSION ); - - /* Encode the security association (SA) number */ - encode_uint32( outbuf, &idx, sa_id ); - - /* The assembly buffer is a source for encrypting data. The nonce is - * written in first followed by the packet payload. The whole - * contents of assembly are encrypted. */ - pnonce = (uint32_t *)assembly; - *pnonce = n2n_rand(); - memcpy( assembly + TRANSOP_TF_NONCE_SIZE, inbuf, in_len ); - - /* Encrypt the assembly contents and write the ciphertext after the SA. */ - len = TwoFishEncryptRaw( assembly, /* source */ - outbuf + TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE, - in_len + TRANSOP_TF_NONCE_SIZE, /* enc size */ - priv->enc_tf); - if ( len > 0 ) - { - len += TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE; /* size of data carried in UDP. */ - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish encryption failed." ); - } - - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish outbuf too small." ); - } - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish inbuf too big to encrypt." ); - } - - return len; -} - -/** The twofish packet format consists of: - * - * - a 8-bit twofish encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_decode_twofish( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len=0; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - if ( ( (in_len - (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE)) <= N2N_PKT_BUF_SIZE ) /* Cipher text fits in assembly */ - && (in_len >= (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE + TRANSOP_TF_NONCE_SIZE) ) /* Has at least version, SA and nonce */ - ) { - size_t rem=in_len; - size_t idx=0; - uint8_t tf_enc_ver=0; - uint32_t sa_rx=0; // Not used - - /* Get the encoding version to make sure it is supported */ - decode_uint8( &tf_enc_ver, inbuf, &rem, &idx ); - - if ( N2N_TWOFISH_TRANSFORM_VERSION == tf_enc_ver ) { - /* Get the SA number and make sure we are decrypting with the right one. */ - decode_uint32( &sa_rx, inbuf, &rem, &idx ); - - traceEvent(TRACE_DEBUG, "decode_twofish %lu", in_len); - - len = TwoFishDecryptRaw( (void *)(inbuf + TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE), - assembly, /* destination */ - (in_len - (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE)), - priv->dec_tf); - - if(len > 0) { - /* Step over 4-byte random nonce value */ - len -= TRANSOP_TF_NONCE_SIZE; /* size of ethernet packet */ - - memcpy( outbuf, - assembly + TRANSOP_TF_NONCE_SIZE, - len ); - } else - traceEvent(TRACE_ERROR, "decode_twofish decryption failed"); - } else - traceEvent( TRACE_ERROR, "decode_twofish unsupported twofish version %u.", tf_enc_ver ); - } else - traceEvent( TRACE_ERROR, "decode_twofish inbuf wrong size (%ul) to decrypt.", in_len ); - - return len; -} - -static void transop_tick_twofish( n2n_trans_op_t * arg, time_t now ) {} - -/* Twofish initialization function */ -int n2n_transop_twofish_init(const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - transop_tf_t *priv; - const u_char *encrypt_key = (const u_char *)conf->encrypt_key; - size_t encrypt_key_len = strlen(conf->encrypt_key); - - memset(ttt, 0, sizeof(*ttt)); - ttt->transform_id = N2N_TRANSFORM_ID_TWOFISH; - - ttt->tick = transop_tick_twofish; - ttt->deinit = transop_deinit_twofish; - ttt->fwd = transop_encode_twofish; - ttt->rev = transop_decode_twofish; - - priv = (transop_tf_t*) calloc(1, sizeof(transop_tf_t)); - if(!priv) { - traceEvent(TRACE_ERROR, "cannot allocate transop_tf_t memory"); - return(-1); - } - ttt->priv = priv; - - /* This is a preshared key setup. Both Tx and Rx are using the same security association. */ - priv->enc_tf = TwoFishInit(encrypt_key, encrypt_key_len); - priv->dec_tf = TwoFishInit(encrypt_key, encrypt_key_len); - - if((!priv->enc_tf) || (!priv->dec_tf)) { - if(priv->enc_tf) TwoFishDestroy(priv->enc_tf); - if(priv->dec_tf) TwoFishDestroy(priv->dec_tf); - free(priv); - traceEvent(TRACE_ERROR, "TwoFishInit failed"); - return(-2); - } - - return(0); -} diff --git a/bundles/n2n_ntop_v2/src/tuntap_freebsd.c b/bundles/n2n_ntop_v2/src/tuntap_freebsd.c deleted file mode 100644 index d871e895..00000000 --- a/bundles/n2n_ntop_v2/src/tuntap_freebsd.c +++ /dev/null @@ -1,133 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#ifdef __FreeBSD__ - -void tuntap_close(tuntap_dev *device); - -/* ********************************** */ - -#define N2N_FREEBSD_TAPDEVICE_SIZE 32 -int tuntap_open(tuntap_dev *device /* ignored */, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - int i; - char tap_device[N2N_FREEBSD_TAPDEVICE_SIZE]; - - for (i = 0; i < 255; i++) { - snprintf(tap_device, sizeof(tap_device), "/dev/tap%d", i); - - device->fd = open(tap_device, O_RDWR); - if(device->fd > 0) { - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - break; - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open tap device"); - return(-1); - } else { - char buf[256]; - FILE *fd; - - device->ip_addr = inet_addr(device_ip); - - if ( device_mac && device_mac[0] != '\0' ) - { - /* FIXME - This is not tested. Might be wrong syntax for OS X */ - - /* Set the hw address before bringing the if up. */ - snprintf(buf, sizeof(buf), "ifconfig tap%d ether %s", - i, device_mac); - system(buf); - } - - snprintf(buf, sizeof(buf), "ifconfig tap%d %s netmask %s mtu %d up", - i, device_ip, device_mask, mtu); - system(buf); - - traceEvent(TRACE_NORMAL, "Interface tap%d up and running (%s/%s)", - i, device_ip, device_mask); - - /* Read MAC address */ - - snprintf(buf, sizeof(buf), "ifconfig tap%d |grep ether|cut -c 8-24", i); - /* traceEvent(TRACE_INFO, "%s", buf); */ - - fd = popen(buf, "r"); - if(fd < 0) { - tuntap_close(device); - return(-1); - } else { - int a, b, c, d, e, f; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address"); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface tap%d mac %s", i, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - - /* read_mac(dev, device->mac_addr); */ - return(device->fd); -} - -/* ********************************** */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ -} - -#endif /* #ifdef __FreeBSD__ */ diff --git a/bundles/n2n_ntop_v2/src/tuntap_linux.c b/bundles/n2n_ntop_v2/src/tuntap_linux.c deleted file mode 100644 index 94b3766d..00000000 --- a/bundles/n2n_ntop_v2/src/tuntap_linux.c +++ /dev/null @@ -1,275 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifdef __linux__ - -#include "n2n.h" - -/* ********************************** */ - -static int setup_ifname(int fd, const char *ifname, const char *ipaddr, - const char *netmask, uint8_t *mac, int mtu) { - struct ifreq ifr; - - memset(&ifr, 0, sizeof(ifr)); - - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; - - ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; - memcpy(ifr.ifr_hwaddr.sa_data, mac, 6); - - if(ioctl(fd, SIOCSIFHWADDR, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFHWADDR) failed [%d]: %s", errno, strerror(errno)); - return(-1); - } - - ifr.ifr_addr.sa_family = AF_INET; - - /* Interface Address */ - inet_pton(AF_INET, ipaddr, &((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr); - if(ioctl(fd, SIOCSIFADDR, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFADDR) failed [%d]: %s", errno, strerror(errno)); - return(-2); - } - - /* Netmask */ - if(netmask && (((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr.s_addr != 0)) { - inet_pton(AF_INET, netmask, &((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr); - if(ioctl(fd, SIOCSIFNETMASK, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFNETMASK, %s) failed [%d]: %s", netmask, errno, strerror(errno)); - return(-3); - } - } - - /* MTU */ - ifr.ifr_mtu = mtu; - if(ioctl(fd, SIOCSIFMTU, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFMTU) failed [%d]: %s", errno, strerror(errno)); - return(-4); - } - - /* Set up and running */ - if(ioctl(fd, SIOCGIFFLAGS, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCGIFFLAGS) failed [%d]: %s", errno, strerror(errno)); - return(-5); - } - - ifr.ifr_flags |= (IFF_UP | IFF_RUNNING); - - if(ioctl(fd, SIOCSIFFLAGS, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFFLAGS) failed [%d]: %s", errno, strerror(errno)); - return(-6); - } - - return(0); -} - -/* ********************************** */ - -/** @brief Open and configure the TAP device for packet read/write. - * - * This routine creates the interface via the tuntap driver and then - * configures it. - * - * @param device - [inout] a device info holder object - * @param dev - user-defined name for the new iface, - * if NULL system will assign a name - * @param device_ip - address of iface - * @param device_mask - netmask for device_ip - * @param mtu - MTU for device_ip - * - * @return - negative value on error - * - non-negative file-descriptor on success - */ -int tuntap_open(tuntap_dev *device, - char *dev, /* user-definable interface name, eg. edge0 */ - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - char *tuntap_device = "/dev/net/tun"; - int ioctl_fd; - struct ifreq ifr; - int rc; - int nl_fd; - char nl_buf[8192]; /* >= 8192 to avoid truncation, see "man 7 netlink" */ - struct iovec iov; - struct sockaddr_nl sa; - int up_and_running = 0; - struct msghdr msg; - - device->fd = open(tuntap_device, O_RDWR); - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "tuntap open() error: %s[%d]. Is the tun kernel module loaded?\n", strerror(errno), errno); - return -1; - } - - memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TAP|IFF_NO_PI; /* Want a TAP device for layer 2 frames. */ - strncpy(ifr.ifr_name, dev, IFNAMSIZ-1); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; - rc = ioctl(device->fd, TUNSETIFF, (void *)&ifr); - - if(rc < 0) { - traceEvent(TRACE_ERROR, "tuntap ioctl(TUNSETIFF, IFF_TAP) error: %s[%d]\n", strerror(errno), rc); - close(device->fd); - return -1; - } - - /* Store the device name for later reuse */ - strncpy(device->dev_name, ifr.ifr_name, MIN(IFNAMSIZ, N2N_IFNAMSIZ) ); - - if(device_mac && device_mac[0]) { - /* Use the user-provided MAC */ - str2mac(device->mac_addr, device_mac); - } else { - /* Set an explicit random MAC to know the exact MAC in use. Manually - * reading the MAC address is not safe as it may change internally - * also after the TAP interface UP status has been notified. */ - int i; - - for(i = 0; i < 6; i++) - device->mac_addr[i] = n2n_rand(); - - device->mac_addr[0] &= ~0x01; /* Clear multicast bit */ - device->mac_addr[0] |= 0x02; /* Set locally-assigned bit */ - } - - /* Initialize Netlink socket */ - if((nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) == -1) { - traceEvent(TRACE_ERROR, "netlink socket creation failed [%d]: %s", errno, strerror(errno)); - return -1; - } - - iov.iov_base = nl_buf; - iov.iov_len = sizeof(nl_buf); - - memset(&sa, 0, sizeof(sa)); - sa.nl_family = PF_NETLINK; - sa.nl_groups = RTMGRP_LINK; - sa.nl_pid = getpid(); - - memset(&msg, 0, sizeof(msg)); - msg.msg_name = &sa; - msg.msg_namelen = sizeof(sa); - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - /* Subscribe to interface events */ - if(bind(nl_fd, (struct sockaddr*)&sa, sizeof(sa)) == -1) { - traceEvent(TRACE_ERROR, "netlink socket bind failed [%d]: %s", errno, strerror(errno)); - return -1; - } - - if((ioctl_fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) { - traceEvent(TRACE_ERROR, "socket creation failed [%d]: %s", errno, strerror(errno)); - close(nl_fd); - return -1; - } - - if(setup_ifname(ioctl_fd, device->dev_name, device_ip, device_mask, device->mac_addr, mtu) < 0) { - close(nl_fd); - close(ioctl_fd); - close(device->fd); - return -1; - } - - close(ioctl_fd); - - /* Wait for the up and running notification */ - traceEvent(TRACE_INFO, "Waiting for TAP interface to be up and running..."); - - while(!up_and_running) { - ssize_t len = recvmsg(nl_fd, &msg, 0); - struct nlmsghdr *nh; - - for(nh = (struct nlmsghdr *)nl_buf; NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len)) { - if(nh->nlmsg_type == NLMSG_ERROR) { - traceEvent(TRACE_DEBUG, "nh->nlmsg_type == NLMSG_ERROR"); - break; - } - - if(nh->nlmsg_type == NLMSG_DONE) - break; - - if(nh->nlmsg_type == NETLINK_GENERIC) { - struct ifinfomsg *ifi = NLMSG_DATA(nh); - - /* NOTE: skipping interface name check, assuming it's our TAP */ - if((ifi->ifi_flags & IFF_UP) && (ifi->ifi_flags & IFF_RUNNING)) { - up_and_running = 1; - traceEvent(TRACE_INFO, "Interface is up and running"); - break; - } - } - } - } - - close(nl_fd); - - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - device->if_idx = if_nametoindex(dev); - - return(device->fd); -} - -/* *************************************************** */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -/* *************************************************** */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -/* *************************************************** */ - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -/* *************************************************** */ - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) { - struct ifreq ifr; - int fd; - - if((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) { - traceEvent(TRACE_ERROR, "socket creation failed [%d]: %s", errno, strerror(errno)); - return; - } - - ifr.ifr_addr.sa_family = AF_INET; - strncpy(ifr.ifr_name, tuntap->dev_name, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; - - if(ioctl(fd, SIOCGIFADDR, &ifr) != -1) - tuntap->ip_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; - - close(fd); -} - -#endif /* #ifdef __linux__ */ diff --git a/bundles/n2n_ntop_v2/src/tuntap_netbsd.c b/bundles/n2n_ntop_v2/src/tuntap_netbsd.c deleted file mode 100644 index 617e2b26..00000000 --- a/bundles/n2n_ntop_v2/src/tuntap_netbsd.c +++ /dev/null @@ -1,145 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#ifdef __NetBSD__ - -#include -#include -#include - -void tun_close(tuntap_dev *device); - -/* ********************************** */ - -#define N2N_NETBSD_TAPDEVICE_SIZE 32 -int tuntap_open(tuntap_dev *device /* ignored */, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - char tap_device[N2N_NETBSD_TAPDEVICE_SIZE]; - struct ifreq req; - - if(dev) { - snprintf(tap_device, sizeof(tap_device), "/dev/%s", dev); - device->fd = open(tap_device, O_RDWR); - snprintf(tap_device, sizeof(tap_device), "%s", dev); - } - else { - device->fd = open("/dev/tap", O_RDWR); - if(device->fd >= 0) { - if(ioctl(device->fd, TAPGIFNAME, &req) == -1) { - traceEvent(TRACE_ERROR, "Unable to obtain name of tap device (%s)", strerror(errno)); - close(device->fd); - return(-1); - } - else { - snprintf(tap_device, sizeof(tap_device), req.ifr_name); - } - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open tap device (%s)", strerror(errno)); - return(-1); - } else { - char cmd[256]; - FILE *fd; - - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - - device->ip_addr = inet_addr(device_ip); - - if( device_mac && device_mac[0] != '\0') { - /* Set the hw address before bringing the if up. */ - snprintf(cmd, sizeof(cmd), "ifconfig %s link %s active", - tap_device, device_mac); - system(cmd); - } - - snprintf(cmd, sizeof(cmd), "ifconfig %s %s netmask %s mtu %d up", - tap_device, device_ip, device_mask, mtu); - system(cmd); - - traceEvent(TRACE_NORMAL, "Interface %s up and running (%s/%s)", - tap_device, device_ip, device_mask); - - /* Read MAC address */ - snprintf(cmd, sizeof(cmd), "ifconfig %s |grep address|cut -c 11-28", tap_device); - /* traceEvent(TRACE_INFO, "%s", cmd); */ - - fd = popen(cmd, "r"); - if(fd < 0) { - tun_close(device); - return(-1); - } else { - int a, b, c, d, e, f; - char buf[256]; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read %s interface MAC address [%s]", tap_device, cmd); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface %s mac %s", tap_device, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - - /* read_mac(dev, device->mac_addr); */ - return(device->fd); -} - -/* ********************************** */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ -} - -#endif /* #ifdef __NetBSD__ */ diff --git a/bundles/n2n_ntop_v2/src/tuntap_osx.c b/bundles/n2n_ntop_v2/src/tuntap_osx.c deleted file mode 100644 index ef166ff8..00000000 --- a/bundles/n2n_ntop_v2/src/tuntap_osx.c +++ /dev/null @@ -1,134 +0,0 @@ -/** - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#ifdef __APPLE__ - -void tun_close(tuntap_dev *device); - -/* ********************************** */ - -#define N2N_OSX_TAPDEVICE_SIZE 32 -int tuntap_open(tuntap_dev *device /* ignored */, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - int i; - char tap_device[N2N_OSX_TAPDEVICE_SIZE]; - - for (i = 0; i < 255; i++) { - snprintf(tap_device, sizeof(tap_device), "/dev/tap%d", i); - - device->fd = open(tap_device, O_RDWR); - if(device->fd > 0) { - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - break; - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open any tap devices /dev/tap0 through /dev/tap254. Is this user properly authorized to access those descriptors?"); - traceEvent(TRACE_ERROR, "Please read https://github.com/ntop/n2n/blob/dev/doc/macOS.md"); - return(-1); - } else { - char buf[256]; - FILE *fd; - - device->ip_addr = inet_addr(device_ip); - - if ( device_mac && device_mac[0] != '\0' ) - { - /* FIXME - This is not tested. Might be wrong syntax for OS X */ - - /* Set the hw address before bringing the if up. */ - snprintf(buf, sizeof(buf), "ifconfig tap%d ether %s", - i, device_mac); - system(buf); - } - - snprintf(buf, sizeof(buf), "ifconfig tap%d %s netmask %s mtu %d up", - i, device_ip, device_mask, mtu); - system(buf); - - traceEvent(TRACE_NORMAL, "Interface tap%d up and running (%s/%s)", - i, device_ip, device_mask); - - /* Read MAC address */ - - snprintf(buf, sizeof(buf), "ifconfig tap%d |grep ether|cut -c 8-24", i); - /* traceEvent(TRACE_INFO, "%s", buf); */ - - fd = popen(buf, "r"); - if(fd < 0) { - tuntap_close(device); - return(-1); - } else { - int a, b, c, d, e, f; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address"); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface tap%d [MTU %d] mac %s", i, mtu, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - - /* read_mac(dev, device->mac_addr); */ - return(device->fd); -} - -/* ********************************** */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(read(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - return(write(tuntap->fd, buf, len)); -} - -/* ********************************** */ - -void tuntap_close(struct tuntap_dev *tuntap) { - close(tuntap->fd); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ -} - -#endif /* __APPLE__ */ diff --git a/bundles/n2n_ntop_v2/src/twofish.c b/bundles/n2n_ntop_v2/src/twofish.c deleted file mode 100644 index f1e1fbc1..00000000 --- a/bundles/n2n_ntop_v2/src/twofish.c +++ /dev/null @@ -1,1015 +0,0 @@ -/* $Id: twofish.c,v 2.0 2002/08/11 22:32:25 fknobbe Exp $ - * - * - * Copyright (C) 1997-2000 The Cryptix Foundation Limited. - * Copyright (C) 2000 Farm9. - * Copyright (C) 2001 Frank Knobbe. - * All rights reserved. - * - * For Cryptix code: - * Use, modification, copying and distribution of this software is subject - * the terms and conditions of the Cryptix General Licence. You should have - * received a copy of the Cryptix General Licence along with this library; - * if not, you can download a copy from http://www.cryptix.org/ . - * - * For Farm9: - * --- jojo@farm9.com, August 2000, converted from Java to C++, added CBC mode and - * ciphertext stealing technique, added AsciiTwofish class for easy encryption - * decryption of text strings - * - * Frank Knobbe : - * --- April 2001, converted from C++ to C, prefixed global variables - * with TwoFish, substituted some defines, changed functions to make use of - * variables supplied in a struct, modified and added routines for modular calls. - * Cleaned up the code so that defines are used instead of fixed 16's and 32's. - * Created two general purpose crypt routines for one block and multiple block - * encryption using Joh's CBC code. - * Added crypt routines that use a header (with a magic and data length). - * (Basically a major rewrite). - * - * Note: Routines labeled _TwoFish are private and should not be used - * (or with extreme caution). - * - */ - -#ifndef __TWOFISH_LIBRARY_SOURCE__ -#define __TWOFISH_LIBRARY_SOURCE__ - -#include "n2n.h" - -/* Fixed 8x8 permutation S-boxes */ -static const uint8_t TwoFish_P[2][256] = - { - { /* p0 */ - 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78, - 0xE4, 0xDD, 0xD1, 0x38, 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, - 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, 0xF2, 0xD0, 0x8B, 0x30, - 0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, - 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE, - 0x16, 0x0C, 0xE3, 0x61, 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, - 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, 0xE1, 0xE6, 0xBD, 0x45, - 0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, - 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF, - 0x33, 0xC9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, - 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, 0xA1, 0x1D, 0xAA, 0xED, - 0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, - 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B, - 0x5F, 0x93, 0x0A, 0xEF, 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, - 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, 0x2A, 0xCE, 0xCB, 0x2F, - 0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, - 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17, - 0x55, 0x1F, 0x8A, 0x7D, 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, - 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6E, 0x50, 0xDE, 0x68, - 0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, - 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42, - 0x4A, 0x5E, 0xC1, 0xE0 - }, - { /* p1 */ - 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B, - 0x45, 0x7D, 0xE8, 0x4B, 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, - 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, 0x5E, 0xBA, 0xAE, 0x5B, - 0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, - 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54, - 0x92, 0x74, 0x36, 0x51, 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, - 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, 0x13, 0x95, 0x9C, 0xC7, - 0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, - 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF, - 0x40, 0xE7, 0x2B, 0xE2, 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, - 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, 0x66, 0x94, 0xA1, 0x1D, - 0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, - 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21, - 0xC4, 0x1A, 0xEB, 0xD9, 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, - 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, 0x4F, 0xF2, 0x65, 0x8E, - 0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, - 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44, - 0xE0, 0x4D, 0x43, 0x69, 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, - 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, 0x22, 0xC9, 0xC0, 0x9B, - 0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, - 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56, - 0x55, 0x09, 0xBE, 0x91 - } - }; - -static bool TwoFish_MDSready=FALSE; -static uint32_t TwoFish_MDS[4][256]; /* TwoFish_MDS matrix */ - - -#define TwoFish_LFSR1(x) (((x)>>1)^(((x)&0x01)?TwoFish_MDS_GF_FDBK/2:0)) -#define TwoFish_LFSR2(x) (((x)>>2)^(((x)&0x02)?TwoFish_MDS_GF_FDBK/2:0)^(((x)&0x01)?TwoFish_MDS_GF_FDBK/4:0)) - -#define TwoFish_Mx_1(x) ((uint32_t)(x)) /* force result to dword so << will work */ -#define TwoFish_Mx_X(x) ((uint32_t)((x)^TwoFish_LFSR2(x))) /* 5B */ -#define TwoFish_Mx_Y(x) ((uint32_t)((x)^TwoFish_LFSR1(x)^TwoFish_LFSR2(x))) /* EF */ -#define TwoFish_RS_rem(x) { uint8_t b=(uint8_t)(x>>24); uint32_t g2=((b<<1)^((b&0x80)?TwoFish_RS_GF_FDBK:0))&0xFF; uint32_t g3=((b>>1)&0x7F)^((b&1)?TwoFish_RS_GF_FDBK>>1:0)^g2; x=(x<<8)^(g3<<24)^(g2<<16)^(g3<<8)^b; } - -/*#define TwoFish__b(x,N) (((uint8_t *)&x)[((N)&3)^TwoFish_ADDR_XOR])*/ /* pick bytes out of a dword */ - -#define TwoFish_b0(x) TwoFish__b(x,0) /* extract LSB of uint32_t */ -#define TwoFish_b1(x) TwoFish__b(x,1) -#define TwoFish_b2(x) TwoFish__b(x,2) -#define TwoFish_b3(x) TwoFish__b(x,3) /* extract MSB of uint32_t */ - -uint8_t TwoFish__b(uint32_t x,int n) -{ n&=3; - while(n-->0) - x>>=8; - return (uint8_t)x; -} - - -/* TwoFish Initialization - * - * This routine generates a global data structure for use with TwoFish, - * initializes important values (such as subkeys, sBoxes), generates subkeys - * and precomputes the MDS matrix if not already done. - * - * Input: User supplied password (will be appended by default password of 'SnortHas2FishEncryptionRoutines!') - * - * Output: Pointer to TWOFISH structure. This data structure contains key dependent data. - * This pointer is used with all other crypt functions. - */ - -TWOFISH *TwoFishInit(const uint8_t *userkey, uint32_t keysize) -{ TWOFISH *tfdata; - int i,x,m; - uint8_t tkey[TwoFish_KEY_LENGTH+40]; - - memset( tkey, 0, TwoFish_KEY_LENGTH+40 ); - tfdata=(TWOFISH *)malloc(sizeof(TWOFISH)); /* allocate the TwoFish structure */ - if(tfdata!=NULL) - { - - /* Changes here prevented a dangerous random key segment for keys of length < TwoFish_KEY_LENGTH */ - if(keysize > 0) - { - memcpy( tkey, userkey, keysize ); /* The rest will be zeros */ - } - else - { - memcpy( tkey, TwoFish_DEFAULT_PW, TwoFish_DEFAULT_PW_LEN ); /* if no key defined, use default password */ - } - - /* This loop is awful - surely a loop on memcpy() would be clearer and more efficient */ - for(i=0,x=0,m=keysize;ikey[i]=tkey[x++]; /* fill the whole keyspace with repeating key. */ - if(x==m) - x=0; - } - - if(!TwoFish_MDSready) - _TwoFish_PrecomputeMDSmatrix(); /* "Wake Up, Neo" */ - _TwoFish_MakeSubKeys(tfdata); /* generate subkeys */ - _TwoFish_ResetCBC(tfdata); /* reset the CBC */ - tfdata->output=NULL; /* nothing to output yet */ - tfdata->dontflush=FALSE; /* reset decrypt skip block flag */ - } - return tfdata; /* return the data pointer */ -} - - -void TwoFishDestroy(TWOFISH *tfdata) -{ if(tfdata!=NULL) - free(tfdata); -} - - -/* en/decryption with CBC mode */ -uint32_t _TwoFish_CryptRawCBC(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata) -{ uint32_t rl; - - rl=len; /* remember how much data to crypt. */ - while(len>TwoFish_BLOCK_SIZE) /* and now we process block by block. */ - { _TwoFish_BlockCrypt(in,out,TwoFish_BLOCK_SIZE,decrypt,tfdata); /* de/encrypt it. */ - in+=TwoFish_BLOCK_SIZE; /* adjust pointers. */ - out+=TwoFish_BLOCK_SIZE; - len-=TwoFish_BLOCK_SIZE; - } - if(len>0) /* if we have less than a block left... */ - _TwoFish_BlockCrypt(in,out,len,decrypt,tfdata); /* ...then we de/encrypt that too. */ - if(tfdata->qBlockDefined && !tfdata->dontflush) /* in case len was exactly one block... */ - _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); /* ...we need to write the... */ - /* ...remaining bytes of the buffer */ - return rl; -} - -/* en/decryption on one block only */ -uint32_t _TwoFish_CryptRaw16(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata) -{ /* qBlockPlain already zero'ed through ResetCBC */ - memcpy(tfdata->qBlockPlain,in,len); /* toss the data into it. */ - _TwoFish_BlockCrypt16(tfdata->qBlockPlain,tfdata->qBlockCrypt,decrypt,tfdata); /* encrypt just that block without CBC. */ - memcpy(out,tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE); /* and return what we got */ - return TwoFish_BLOCK_SIZE; -} - -/* en/decryption without reset of CBC and output assignment */ -uint32_t _TwoFish_CryptRaw(uint8_t *in,uint8_t *out,uint32_t len,bool decrypt,TWOFISH *tfdata) -{ - if(in!=NULL && out!=NULL && len>0 && tfdata!=NULL) /* if we have valid data, then... */ - { if(len>TwoFish_BLOCK_SIZE) /* ...check if we have more than one block. */ - return _TwoFish_CryptRawCBC(in,out,len,decrypt,tfdata); /* if so, use the CBC routines... */ - else - return _TwoFish_CryptRaw16(in,out,len,decrypt,tfdata); /* ...otherwise just do one block. */ - } - return 0; -} - - -/* TwoFish Raw Encryption - * - * Does not use header, but does use CBC (if more than one block has to be encrypted). - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the buffer receiving the ciphertext. - * The length of the plaintext buffer. - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ - -uint32_t TwoFishEncryptRaw(uint8_t *in, - uint8_t *out, - uint32_t len, - TWOFISH *tfdata) -{ _TwoFish_ResetCBC(tfdata); /* reset CBC flag. */ - tfdata->output=out; /* output straight into output buffer. */ - return _TwoFish_CryptRaw(in,out,len,FALSE,tfdata); /* and go for it. */ -} - -/* TwoFish Raw Decryption - * - * Does not use header, but does use CBC (if more than one block has to be decrypted). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the buffer receiving the plaintext. - * The length of the ciphertext buffer (at least one cipher block). - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ - -uint32_t TwoFishDecryptRaw(uint8_t *in, - uint8_t *out, - uint32_t len, - TWOFISH *tfdata) -{ _TwoFish_ResetCBC(tfdata); /* reset CBC flag. */ - tfdata->output=out; /* output straight into output buffer. */ - return _TwoFish_CryptRaw(in,out,len,TRUE,tfdata); /* and go for it. */ -} - -/* TwoFish Free - * - * Free's the allocated buffer. - * - * Input: Pointer to the TwoFish structure - * - * Output: (none) - */ - -void TwoFishFree(TWOFISH *tfdata) -{ if(tfdata->output!=NULL) /* if a valid buffer is present... */ - { free(tfdata->output); /* ...then we free it for you... */ - tfdata->output=NULL; /* ...and mark as such. */ - } -} - -/* TwoFish Set Output - * - * If you want to allocate the output buffer yourself, - * then you can set it with this function. - * - * Input: Pointer to your output buffer - * Pointer to the TwoFish structure - * - * Output: (none) - */ - -void TwoFishSetOutput(uint8_t *outp,TWOFISH *tfdata) -{ tfdata->output=outp; /* (do we really need a function for this?) */ -} - -/* TwoFish Alloc - * - * Allocates enough memory for the output buffer that would be required - * - * Input: Length of the plaintext. - * Boolean flag for BinHex Output. - * Pointer to the TwoFish structure. - * - * Output: Returns a pointer to the memory allocated. - */ - -void *TwoFishAlloc(uint32_t len,bool binhex,bool decrypt,TWOFISH *tfdata) -{ - /* TwoFishFree(tfdata); */ /* (don't for now) discard whatever was allocated earlier. */ - if(decrypt) /* if decrypting... */ - { if(binhex) /* ...and input is binhex encoded... */ - len/=2; /* ...use half as much for output. */ - len-=TwoFish_BLOCK_SIZE; /* Also, subtract the size of the header. */ - } - else - { len+=TwoFish_BLOCK_SIZE; /* the size is just increased by the header... */ - if(binhex) - len*=2; /* ...and doubled if output is to be binhexed. */ - } - tfdata->output=malloc(len+TwoFish_BLOCK_SIZE);/* grab some memory...plus some extra (it's running over somewhere, crashes without extra padding) */ - - return tfdata->output; /* ...and return to caller. */ -} - -/* bin2hex and hex2bin conversion */ -void _TwoFish_BinHex(uint8_t *buf,uint32_t len,bool bintohex) -{ uint8_t *pi,*po,c; - - if(bintohex) - { for(pi=buf+len-1,po=buf+(2*len)-1;len>0;pi--,po--,len--) /* let's start from the end of the bin block. */ - { c=*pi; /* grab value. */ - c&=15; /* use lower 4 bits. */ - if(c>9) /* convert to ascii. */ - c+=('a'-10); - else - c+='0'; - *po--=c; /* set the lower nibble. */ - c=*pi; /* grab value again. */ - c>>=4; /* right shift 4 bits. */ - c&=15; /* make sure we only have 4 bits. */ - if(c>9) /* convert to ascii. */ - c+=('a'-10); - else - c+='0'; - *po=c; /* set the higher nibble. */ - } /* and keep going. */ - } - else - { for(pi=buf,po=buf;len>0;pi++,po++,len-=2) /* let's start from the beginning of the hex block. */ - { c=tolower(*pi++)-'0'; /* grab higher nibble. */ - if(c>9) /* convert to value. */ - c-=('0'-9); - *po=c<<4; /* left shit 4 bits. */ - c=tolower(*pi)-'0'; /* grab lower nibble. */ - if(c>9) /* convert to value. */ - c-=('0'-9); - *po|=c; /* and add to value. */ - } - } -} - - -/* TwoFish Encryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will include a small 'header' - * containing the magic and some salt. That way the decrypt routine can check if the - * packet got decrypted successfully, and return 0 instead of garbage. - * - * Input: Pointer to the buffer of the plaintext to be encrypted. - * Pointer to the pointer to the buffer receiving the ciphertext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the plaintext buffer. - * Can be -1 if the input is a null terminated string, in which case we'll count for you. - * Boolean flag for BinHex Output (if used, output will be twice as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes encrypted if successful, otherwise 0. - */ - -uint32_t TwoFishEncrypt(uint8_t *in, - uint8_t **out, - signed long len, - bool binhex, - TWOFISH *tfdata) -{ uint32_t ilen,olen; - - -#if 0 -/* This is so broken it doesn't deserve to live. */ - if(len== -1) /* if we got -1 for len, we'll assume IN is a... */ - ilen=strlen(in); /* ...\0 terminated string and figure len out ourselves... */ - else - ilen=len; /* ...otherwise we trust you supply a correct length. */ -#endif - - ilen = len; - - if(in!=NULL && out!=NULL && ilen>0 && tfdata!=NULL) /* if we got usable stuff, we'll do it. */ - { if(*out==NULL) /* if OUT points to a NULL pointer... */ - *out=TwoFishAlloc(ilen,binhex,FALSE,tfdata); /* ...we'll (re-)allocate buffer space. */ - if(*out!=NULL) - { tfdata->output=*out; /* set output buffer. */ - tfdata->header.salt=n2n_rand()*65536+n2n_rand(); /* toss in some salt. */ - tfdata->header.length[0]= (uint8_t)(ilen); - tfdata->header.length[1]= (uint8_t)(ilen>>8); - tfdata->header.length[2]= (uint8_t)(ilen>>16); - tfdata->header.length[3]= (uint8_t)(ilen>>24); - memcpy(tfdata->header.magic,TwoFish_MAGIC,TwoFish_MAGIC_LEN); /* set the magic. */ - olen=TwoFish_BLOCK_SIZE; /* set output counter. */ - _TwoFish_ResetCBC(tfdata); /* reset the CBC flag */ - _TwoFish_BlockCrypt((uint8_t *)&(tfdata->header),*out,olen,FALSE,tfdata); /* encrypt first block (without flush on 16 byte boundary). */ - olen+=_TwoFish_CryptRawCBC(in,*out+TwoFish_BLOCK_SIZE,ilen,FALSE,tfdata); /* and encrypt the rest (we do not reset the CBC flag). */ - if(binhex) /* if binhex... */ - { _TwoFish_BinHex(*out,olen,TRUE); /* ...convert output to binhex... */ - olen*=2; /* ...and size twice as large. */ - } - tfdata->output=*out; - return olen; - } - } - return 0; -} - -/* TwoFish Decryption - * - * Uses header and CBC. If the output area has not been intialized with TwoFishAlloc, - * this routine will alloc the memory. In addition, it will check the small 'header' - * containing the magic. If magic does not match we return 0. Otherwise we return the - * amount of bytes decrypted (should be the same as the length in the header). - * - * Input: Pointer to the buffer of the ciphertext to be decrypted. - * Pointer to the pointer to the buffer receiving the plaintext. - * The pointer either points to user allocated output buffer space, or to NULL, in which case - * this routine will set the pointer to the buffer allocated through the struct. - * The length of the ciphertext buffer. - * Can be -1 if the input is a null terminated binhex string, in which case we'll count for you. - * Boolean flag for BinHex Input (if used, plaintext will be half as large as input). - * Note: BinHex conversion overwrites (converts) input buffer! - * The TwoFish structure. - * - * Output: The amount of bytes decrypted if successful, otherwise 0. - */ - -uint32_t TwoFishDecrypt(uint8_t *in, - uint8_t **out, - signed long len, - bool binhex, - TWOFISH *tfdata) -{ uint32_t ilen,elen,olen; - const uint8_t cmagic[TwoFish_MAGIC_LEN]=TwoFish_MAGIC; - uint8_t *tbuf; - - - -#if 0 -/* This is so broken it doesn't deserve to live. */ - if(len== -1) /* if we got -1 for len, we'll assume IN is a... */ - ilen=strlen(in); /* ...\0 terminated string and figure len out ourselves... */ - else - ilen=len; /* ...otherwise we trust you supply a correct length. */ -#endif - - ilen = len; - - if(in!=NULL && out!=NULL && ilen>0 && tfdata!=NULL) /* if we got usable stuff, we'll do it. */ - { if(*out==NULL) /* if OUT points to a NULL pointer... */ - *out=TwoFishAlloc(ilen,binhex,TRUE,tfdata); /* ...we'll (re-)allocate buffer space. */ - if(*out!=NULL) - { if(binhex) /* if binhex... */ - { _TwoFish_BinHex(in,ilen,FALSE); /* ...convert input to values... */ - ilen/=2; /* ...and size half as much. */ - } - _TwoFish_ResetCBC(tfdata); /* reset the CBC flag. */ - - tbuf=(uint8_t *)malloc(ilen+TwoFish_BLOCK_SIZE); /* get memory for data and header. */ - if(tbuf==NULL) - return 0; - tfdata->output=tbuf; /* set output to temp buffer. */ - - olen=_TwoFish_CryptRawCBC(in,tbuf,ilen,TRUE,tfdata)-TwoFish_BLOCK_SIZE; /* decrypt the whole thing. */ - memcpy(&(tfdata->header),tbuf,TwoFish_BLOCK_SIZE); /* copy first block into header. */ - tfdata->output=*out; - for(elen=0;elenheader.magic[elen]!=cmagic[elen]) - break; - if(elen==TwoFish_MAGIC_LEN) /* if magic matches then... */ - { elen=(tfdata->header.length[0]) | - (tfdata->header.length[1])<<8 | - (tfdata->header.length[2])<<16 | - (tfdata->header.length[3])<<24; /* .. we know how much to expect. */ - if(elen>olen) /* adjust if necessary. */ - elen=olen; - memcpy(*out,tbuf+TwoFish_BLOCK_SIZE,elen); /* copy data into intended output. */ - free(tbuf); - return elen; - } - free(tbuf); - } - } - return 0; -} - -void _TwoFish_PrecomputeMDSmatrix(void) /* precompute the TwoFish_MDS matrix */ -{ uint32_t m1[2]; - uint32_t mX[2]; - uint32_t mY[2]; - uint32_t i, j; - - for (i = 0; i < 256; i++) - { j = TwoFish_P[0][i] & 0xFF; /* compute all the matrix elements */ - m1[0] = j; - mX[0] = TwoFish_Mx_X( j ) & 0xFF; - mY[0] = TwoFish_Mx_Y( j ) & 0xFF; - - j = TwoFish_P[1][i] & 0xFF; - m1[1] = j; - mX[1] = TwoFish_Mx_X( j ) & 0xFF; - mY[1] = TwoFish_Mx_Y( j ) & 0xFF; - - TwoFish_MDS[0][i] = m1[TwoFish_P_00] | /* fill matrix w/ above elements */ - mX[TwoFish_P_00] << 8 | - mY[TwoFish_P_00] << 16 | - mY[TwoFish_P_00] << 24; - TwoFish_MDS[1][i] = mY[TwoFish_P_10] | - mY[TwoFish_P_10] << 8 | - mX[TwoFish_P_10] << 16 | - m1[TwoFish_P_10] << 24; - TwoFish_MDS[2][i] = mX[TwoFish_P_20] | - mY[TwoFish_P_20] << 8 | - m1[TwoFish_P_20] << 16 | - mY[TwoFish_P_20] << 24; - TwoFish_MDS[3][i] = mX[TwoFish_P_30] | - m1[TwoFish_P_30] << 8 | - mY[TwoFish_P_30] << 16 | - mX[TwoFish_P_30] << 24; - } - TwoFish_MDSready=TRUE; -} - - -void _TwoFish_MakeSubKeys(TWOFISH *tfdata) /* Expand a user-supplied key material into a session key. */ -{ uint32_t k64Cnt = TwoFish_KEY_LENGTH / 8; - uint32_t k32e[4]; /* even 32-bit entities */ - uint32_t k32o[4]; /* odd 32-bit entities */ - uint32_t sBoxKey[4]; - uint32_t offset,i,j; - uint32_t A, B, q=0; - uint32_t k0,k1,k2,k3; - uint32_t b0,b1,b2,b3; - - /* split user key material into even and odd 32-bit entities and */ - /* compute S-box keys using (12, 8) Reed-Solomon code over GF(256) */ - - - for (offset=0,i=0,j=k64Cnt-1;i<4 && offsetkey[offset++]; - k32e[i]|= tfdata->key[offset++]<<8; - k32e[i]|= tfdata->key[offset++]<<16; - k32e[i]|= tfdata->key[offset++]<<24; - k32o[i] = tfdata->key[offset++]; - k32o[i]|= tfdata->key[offset++]<<8; - k32o[i]|= tfdata->key[offset++]<<16; - k32o[i]|= tfdata->key[offset++]<<24; - sBoxKey[j] = _TwoFish_RS_MDS_Encode( k32e[i], k32o[i] ); /* reverse order */ - } - - /* compute the round decryption subkeys for PHT. these same subkeys */ - /* will be used in encryption but will be applied in reverse order. */ - i=0; - while(i < TwoFish_TOTAL_SUBKEYS) - { A = _TwoFish_F32( k64Cnt, q, k32e ); /* A uses even key entities */ - q += TwoFish_SK_BUMP; - - B = _TwoFish_F32( k64Cnt, q, k32o ); /* B uses odd key entities */ - q += TwoFish_SK_BUMP; - - B = B << 8 | B >> 24; - - A += B; - tfdata->subKeys[i++] = A; /* combine with a PHT */ - - A += B; - tfdata->subKeys[i++] = A << TwoFish_SK_ROTL | A >> (32-TwoFish_SK_ROTL); - } - - /* fully expand the table for speed */ - k0 = sBoxKey[0]; - k1 = sBoxKey[1]; - k2 = sBoxKey[2]; - k3 = sBoxKey[3]; - - for (i = 0; i < 256; i++) - { b0 = b1 = b2 = b3 = i; - switch (k64Cnt & 3) - { case 1: /* 64-bit keys */ - tfdata->sBox[ 2*i ] = TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][b0]) ^ TwoFish_b0(k0)]; - tfdata->sBox[ 2*i+1] = TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][b1]) ^ TwoFish_b1(k0)]; - tfdata->sBox[0x200+2*i ] = TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][b2]) ^ TwoFish_b2(k0)]; - tfdata->sBox[0x200+2*i+1] = TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][b3]) ^ TwoFish_b3(k0)]; - break; - case 0: /* 256-bit keys (same as 4) */ - b0 = (TwoFish_P[TwoFish_P_04][b0]) ^ TwoFish_b0(k3); - b1 = (TwoFish_P[TwoFish_P_14][b1]) ^ TwoFish_b1(k3); - b2 = (TwoFish_P[TwoFish_P_24][b2]) ^ TwoFish_b2(k3); - b3 = (TwoFish_P[TwoFish_P_34][b3]) ^ TwoFish_b3(k3); - case 3: /* 192-bit keys */ - b0 = (TwoFish_P[TwoFish_P_03][b0]) ^ TwoFish_b0(k2); - b1 = (TwoFish_P[TwoFish_P_13][b1]) ^ TwoFish_b1(k2); - b2 = (TwoFish_P[TwoFish_P_23][b2]) ^ TwoFish_b2(k2); - b3 = (TwoFish_P[TwoFish_P_33][b3]) ^ TwoFish_b3(k2); - case 2: /* 128-bit keys */ - tfdata->sBox[ 2*i ]= - TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][(TwoFish_P[TwoFish_P_02][b0]) ^ - TwoFish_b0(k1)]) ^ TwoFish_b0(k0)]; - - tfdata->sBox[ 2*i+1]= - TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][(TwoFish_P[TwoFish_P_12][b1]) ^ - TwoFish_b1(k1)]) ^ TwoFish_b1(k0)]; - - tfdata->sBox[0x200+2*i ]= - TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][(TwoFish_P[TwoFish_P_22][b2]) ^ - TwoFish_b2(k1)]) ^ TwoFish_b2(k0)]; - - tfdata->sBox[0x200+2*i+1]= - TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][(TwoFish_P[TwoFish_P_32][b3]) ^ - TwoFish_b3(k1)]) ^ TwoFish_b3(k0)]; - } - } -} - - -/** - * Encrypt or decrypt exactly one block of plaintext in CBC mode. - * Use "ciphertext stealing" technique described on pg. 196 - * of "Applied Cryptography" to encrypt the final partial - * (i.e. <16 byte) block if necessary. - * - * jojo: the "ciphertext stealing" requires we read ahead and have - * special handling for the last two blocks. Because of this, the - * output from the TwoFish algorithm is handled internally here. - * It would be better to have a higher level handle this as well as - * CBC mode. Unfortunately, I've mixed the two together, which is - * pretty crappy... The Java version separates these out correctly. - * - * fknobbe: I have reduced the CBC mode to work on memory buffer only. - * Higher routines should use an intermediate buffer and handle - * their output seperately (mainly so the data can be flushed - * in one chunk, not seperate 16 byte blocks...) - * - * @param in The plaintext. - * @param out The ciphertext - * @param size how much to encrypt - * @param tfdata: Pointer to the global data structure containing session keys. - * @return none - */ -void _TwoFish_BlockCrypt(uint8_t *in,uint8_t *out,uint32_t size,int decrypt,TWOFISH *tfdata) -{ uint8_t PnMinusOne[TwoFish_BLOCK_SIZE]; - uint8_t CnMinusOne[TwoFish_BLOCK_SIZE]; - uint8_t CBCplusCprime[TwoFish_BLOCK_SIZE]; - uint8_t Pn[TwoFish_BLOCK_SIZE]; - uint8_t *p,*pout; - uint32_t i; - - /* here is where we implement CBC mode and cipher block stealing */ - if(size==TwoFish_BLOCK_SIZE) - { /* if we are encrypting, CBC means we XOR the plain text block with the */ - /* previous cipher text block before encrypting */ - if(!decrypt && tfdata->qBlockDefined) - { for(p=in,i=0;iqBlockCrypt[i]; /* FK: I'm copying the xor'ed input into Pn... */ - } - else - memcpy(Pn,in,TwoFish_BLOCK_SIZE); /* FK: same here. we work of Pn all the time. */ - - /* TwoFish block level encryption or decryption */ - _TwoFish_BlockCrypt16(Pn,out,decrypt,tfdata); - - /* if we are decrypting, CBC means we XOR the result of the decryption */ - /* with the previous cipher text block to get the resulting plain text */ - if(decrypt && tfdata->qBlockDefined) - { for (p=out,i=0;iqBlockPlain[i]; - } - - /* save the input and output blocks, since CBC needs these for XOR */ - /* operations */ - _TwoFish_qBlockPush(Pn,out,tfdata); - } - else - { /* cipher block stealing, we are at Pn, */ - /* but since Cn-1 must now be replaced with CnC' */ - /* we pop it off, and recalculate Cn-1 */ - - if(decrypt) - { /* We are on an odd block, and had to do cipher block stealing, */ - /* so the PnMinusOne has to be derived differently. */ - - /* First we decrypt it into CBC and C' */ - _TwoFish_qBlockPop(CnMinusOne,PnMinusOne,tfdata); - _TwoFish_BlockCrypt16(CnMinusOne,CBCplusCprime,decrypt,tfdata); - - /* we then xor the first few bytes with the "in" bytes (Cn) */ - /* to recover Pn, which we put in out */ - for(p=in,pout=out,i=0;iprevCipher[i]; - - /* So at this point, out has PnMinusOne */ - _TwoFish_qBlockPush(CnMinusOne,PnMinusOne,tfdata); - _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); - _TwoFish_FlushOutput(out,size,tfdata); - } - else - { _TwoFish_qBlockPop(PnMinusOne,CnMinusOne,tfdata); - memset(Pn,0,TwoFish_BLOCK_SIZE); - memcpy(Pn,in,size); - for(i=0;iqBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); - _TwoFish_FlushOutput(CnMinusOne,size,tfdata); /* old Cn-1 becomes new partial Cn */ - } - tfdata->qBlockDefined=FALSE; - } -} - -void _TwoFish_qBlockPush(uint8_t *p,uint8_t *c,TWOFISH *tfdata) -{ if(tfdata->qBlockDefined) - _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); - memcpy(tfdata->prevCipher,tfdata->qBlockPlain,TwoFish_BLOCK_SIZE); - memcpy(tfdata->qBlockPlain,p,TwoFish_BLOCK_SIZE); - memcpy(tfdata->qBlockCrypt,c,TwoFish_BLOCK_SIZE); - tfdata->qBlockDefined=TRUE; -} - -void _TwoFish_qBlockPop(uint8_t *p,uint8_t *c,TWOFISH *tfdata) -{ memcpy(p,tfdata->qBlockPlain,TwoFish_BLOCK_SIZE ); - memcpy(c,tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE ); - tfdata->qBlockDefined=FALSE; -} - -/* Reset's the CBC flag and zero's PrevCipher (through qBlockPlain) (important) */ -void _TwoFish_ResetCBC(TWOFISH *tfdata) -{ tfdata->qBlockDefined=FALSE; - memset(tfdata->qBlockPlain,0,TwoFish_BLOCK_SIZE); -} - -void _TwoFish_FlushOutput(uint8_t *b,uint32_t len,TWOFISH *tfdata) -{ uint32_t i; - - for(i=0;idontflush;i++) - *tfdata->output++ = *b++; - tfdata->dontflush=FALSE; -} - -void _TwoFish_BlockCrypt16(uint8_t *in,uint8_t *out,bool decrypt,TWOFISH *tfdata) -{ uint32_t x0,x1,x2,x3; - uint32_t k,t0,t1,R; - - - x0=*in++; - x0|=(*in++ << 8 ); - x0|=(*in++ << 16); - x0|=(*in++ << 24); - x1=*in++; - x1|=(*in++ << 8 ); - x1|=(*in++ << 16); - x1|=(*in++ << 24); - x2=*in++; - x2|=(*in++ << 8 ); - x2|=(*in++ << 16); - x2|=(*in++ << 24); - x3=*in++; - x3|=(*in++ << 8 ); - x3|=(*in++ << 16); - x3|=(*in++ << 24); - - if(decrypt) - { x0 ^= tfdata->subKeys[4]; /* swap input and output whitening keys when decrypting */ - x1 ^= tfdata->subKeys[5]; - x2 ^= tfdata->subKeys[6]; - x3 ^= tfdata->subKeys[7]; - - k = 7+(TwoFish_ROUNDS*2); - for (R = 0; R < TwoFish_ROUNDS; R += 2) - { t0 = _TwoFish_Fe320( tfdata->sBox, x0); - t1 = _TwoFish_Fe323( tfdata->sBox, x1); - x3 ^= t0 + (t1<<1) + tfdata->subKeys[k--]; - x3 = x3 >> 1 | x3 << 31; - x2 = x2 << 1 | x2 >> 31; - x2 ^= t0 + t1 + tfdata->subKeys[k--]; - - t0 = _TwoFish_Fe320( tfdata->sBox, x2); - t1 = _TwoFish_Fe323( tfdata->sBox, x3); - x1 ^= t0 + (t1<<1) + tfdata->subKeys[k--]; - x1 = x1 >> 1 | x1 << 31; - x0 = x0 << 1 | x0 >> 31; - x0 ^= t0 + t1 + tfdata->subKeys[k--]; - } - - x2 ^= tfdata->subKeys[0]; - x3 ^= tfdata->subKeys[1]; - x0 ^= tfdata->subKeys[2]; - x1 ^= tfdata->subKeys[3]; - } - else - { x0 ^= tfdata->subKeys[0]; - x1 ^= tfdata->subKeys[1]; - x2 ^= tfdata->subKeys[2]; - x3 ^= tfdata->subKeys[3]; - - k = 8; - for (R = 0; R < TwoFish_ROUNDS; R += 2) - { t0 = _TwoFish_Fe320( tfdata->sBox, x0); - t1 = _TwoFish_Fe323( tfdata->sBox, x1); - x2 ^= t0 + t1 + tfdata->subKeys[k++]; - x2 = x2 >> 1 | x2 << 31; - x3 = x3 << 1 | x3 >> 31; - x3 ^= t0 + (t1<<1) + tfdata->subKeys[k++]; - - t0 = _TwoFish_Fe320( tfdata->sBox, x2); - t1 = _TwoFish_Fe323( tfdata->sBox, x3); - x0 ^= t0 + t1 + tfdata->subKeys[k++]; - x0 = x0 >> 1 | x0 << 31; - x1 = x1 << 1 | x1 >> 31; - x1 ^= t0 + (t1<<1) + tfdata->subKeys[k++]; - } - - x2 ^= tfdata->subKeys[4]; - x3 ^= tfdata->subKeys[5]; - x0 ^= tfdata->subKeys[6]; - x1 ^= tfdata->subKeys[7]; - } - - *out++ = (uint8_t)(x2 ); - *out++ = (uint8_t)(x2 >> 8); - *out++ = (uint8_t)(x2 >> 16); - *out++ = (uint8_t)(x2 >> 24); - - *out++ = (uint8_t)(x3 ); - *out++ = (uint8_t)(x3 >> 8); - *out++ = (uint8_t)(x3 >> 16); - *out++ = (uint8_t)(x3 >> 24); - - *out++ = (uint8_t)(x0 ); - *out++ = (uint8_t)(x0 >> 8); - *out++ = (uint8_t)(x0 >> 16); - *out++ = (uint8_t)(x0 >> 24); - - *out++ = (uint8_t)(x1 ); - *out++ = (uint8_t)(x1 >> 8); - *out++ = (uint8_t)(x1 >> 16); - *out++ = (uint8_t)(x1 >> 24); -} - -/** - * Use (12, 8) Reed-Solomon code over GF(256) to produce a key S-box - * 32-bit entity from two key material 32-bit entities. - * - * @param k0 1st 32-bit entity. - * @param k1 2nd 32-bit entity. - * @return Remainder polynomial generated using RS code - */ -uint32_t _TwoFish_RS_MDS_Encode(uint32_t k0,uint32_t k1) -{ uint32_t i,r; - - for(r=k1,i=0;i<4;i++) /* shift 1 byte at a time */ - TwoFish_RS_rem(r); - r ^= k0; - for(i=0;i<4;i++) - TwoFish_RS_rem(r); - - return r; -} - -uint32_t _TwoFish_F32(uint32_t k64Cnt,uint32_t x,uint32_t *k32) -{ uint8_t b0,b1,b2,b3; - uint32_t k0,k1,k2,k3,result = 0; - - b0=TwoFish_b0(x); - b1=TwoFish_b1(x); - b2=TwoFish_b2(x); - b3=TwoFish_b3(x); - k0=k32[0]; - k1=k32[1]; - k2=k32[2]; - k3=k32[3]; - - switch (k64Cnt & 3) - { case 1: /* 64-bit keys */ - result = - TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][b0] & 0xFF) ^ TwoFish_b0(k0)] ^ - TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][b1] & 0xFF) ^ TwoFish_b1(k0)] ^ - TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][b2] & 0xFF) ^ TwoFish_b2(k0)] ^ - TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][b3] & 0xFF) ^ TwoFish_b3(k0)]; - break; - case 0: /* 256-bit keys (same as 4) */ - b0 = (TwoFish_P[TwoFish_P_04][b0] & 0xFF) ^ TwoFish_b0(k3); - b1 = (TwoFish_P[TwoFish_P_14][b1] & 0xFF) ^ TwoFish_b1(k3); - b2 = (TwoFish_P[TwoFish_P_24][b2] & 0xFF) ^ TwoFish_b2(k3); - b3 = (TwoFish_P[TwoFish_P_34][b3] & 0xFF) ^ TwoFish_b3(k3); - - case 3: /* 192-bit keys */ - b0 = (TwoFish_P[TwoFish_P_03][b0] & 0xFF) ^ TwoFish_b0(k2); - b1 = (TwoFish_P[TwoFish_P_13][b1] & 0xFF) ^ TwoFish_b1(k2); - b2 = (TwoFish_P[TwoFish_P_23][b2] & 0xFF) ^ TwoFish_b2(k2); - b3 = (TwoFish_P[TwoFish_P_33][b3] & 0xFF) ^ TwoFish_b3(k2); - case 2: /* 128-bit keys (optimize for this case) */ - result = - TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][(TwoFish_P[TwoFish_P_02][b0] & 0xFF) ^ TwoFish_b0(k1)] & 0xFF) ^ TwoFish_b0(k0)] ^ - TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][(TwoFish_P[TwoFish_P_12][b1] & 0xFF) ^ TwoFish_b1(k1)] & 0xFF) ^ TwoFish_b1(k0)] ^ - TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][(TwoFish_P[TwoFish_P_22][b2] & 0xFF) ^ TwoFish_b2(k1)] & 0xFF) ^ TwoFish_b2(k0)] ^ - TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][(TwoFish_P[TwoFish_P_32][b3] & 0xFF) ^ TwoFish_b3(k1)] & 0xFF) ^ TwoFish_b3(k0)]; - break; - } - return result; -} - -uint32_t _TwoFish_Fe320(uint32_t *lsBox,uint32_t x) -{ return lsBox[ TwoFish_b0(x)<<1 ]^ - lsBox[ ((TwoFish_b1(x)<<1)|1)]^ - lsBox[0x200+ (TwoFish_b2(x)<<1) ]^ - lsBox[0x200+((TwoFish_b3(x)<<1)|1)]; -} - -uint32_t _TwoFish_Fe323(uint32_t *lsBox,uint32_t x) -{ return lsBox[ (TwoFish_b3(x)<<1) ]^ - lsBox[ ((TwoFish_b0(x)<<1)|1)]^ - lsBox[0x200+ (TwoFish_b1(x)<<1) ]^ - lsBox[0x200+((TwoFish_b2(x)<<1)|1)]; -} - -uint32_t _TwoFish_Fe32(uint32_t *lsBox,uint32_t x,uint32_t R) -{ return lsBox[ 2*TwoFish__b(x,R ) ]^ - lsBox[ 2*TwoFish__b(x,R+1)+1]^ - lsBox[0x200+2*TwoFish__b(x,R+2) ]^ - lsBox[0x200+2*TwoFish__b(x,R+3)+1]; -} - - -#endif - -/* ******************************************* */ -#if defined TWOFISH_UNIT_TEST -#include - -#define TEST_DATA_SIZE 327 - -int main(int argc, char* argv[]) -{ - int i; - int n; - - char outbuf[4096]; - char * outp = outbuf; - - uint8_t key[] = { 0xfc, 0x77, 0x1a, 0xda, 0xaa }; - TWOFISH *tfa = TwoFishInit( key, 5 ); - TWOFISH *tfb = TwoFishInit( key, 5 ); - - uint8_t out[2048], out2[2048]; - uint8_t in[TEST_DATA_SIZE]; - - for ( i=0; i - * - */ - -/** Routines for encoding and decoding n2n packets on the wire. - * - * encode_X(base,idx,v) prototypes are inspired by the erlang internal - * encoding model. Passing the start of a buffer in base and a pointer to an - * integer (initially set to zero). Each encode routine increases idx by the - * amount written and returns the amount written. In this way complex sequences - * of encodings can be represented cleanly. See encode_register() for an - * example. - */ - -#include "n2n_wire.h" -#include - -int encode_uint8( uint8_t * base, - size_t * idx, - const uint8_t v ) -{ - *(base + (*idx)) = (v & 0xff); - ++(*idx); - return 1; -} - -int decode_uint8( uint8_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - if (*rem < 1 ) { return 0; } - - *out = ( base[*idx] & 0xff ); - ++(*idx); - --(*rem); - return 1; -} - -int encode_uint16( uint8_t * base, - size_t * idx, - const uint16_t v ) -{ - *(base + (*idx)) = ( v >> 8) & 0xff; - *(base + (1 + *idx)) = ( v & 0xff ); - *idx += 2; - return 2; -} - -int decode_uint16( uint16_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - if (*rem < 2 ) { return 0; } - - *out = ( base[*idx] & 0xff ) << 8; - *out |= ( base[1 + *idx] & 0xff ); - *idx += 2; - *rem -= 2; - return 2; -} - -int encode_uint32( uint8_t * base, - size_t * idx, - const uint32_t v ) -{ - *(base + (0 + *idx)) = ( v >> 24) & 0xff; - *(base + (1 + *idx)) = ( v >> 16) & 0xff; - *(base + (2 + *idx)) = ( v >> 8) & 0xff; - *(base + (3 + *idx)) = ( v & 0xff ); - *idx += 4; - return 4; -} - -int decode_uint32( uint32_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - if (*rem < 4 ) { return 0; } - - *out = ( base[0 + *idx] & 0xff ) << 24; - *out |= ( base[1 + *idx] & 0xff ) << 16; - *out |= ( base[2 + *idx] & 0xff ) << 8; - *out |= ( base[3 + *idx] & 0xff ); - *idx += 4; - *rem -= 4; - return 4; -} - -int encode_buf( uint8_t * base, - size_t * idx, - const void * p, - size_t s) -{ - memcpy( (base + (*idx)), p, s ); - *idx += s; - return s; -} - -/* Copy from base to out of size bufsize */ -int decode_buf( uint8_t * out, - size_t bufsize, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - if (*rem < bufsize ) { return 0; } - - memcpy( out, (base + *idx), bufsize ); - *idx += bufsize; - *rem -= bufsize; - return bufsize; -} - - - -int encode_mac( uint8_t * base, - size_t * idx, - const n2n_mac_t m ) -{ - return encode_buf( base, idx, m, N2N_MAC_SIZE ); -} - -int decode_mac( uint8_t * out, /* of size N2N_MAC_SIZE. This clearer than passing a n2n_mac_t */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - return decode_buf( out, N2N_MAC_SIZE, base, rem, idx ); -} - - - -int encode_common( uint8_t * base, - size_t * idx, - const n2n_common_t * common ) -{ - uint16_t flags=0; - encode_uint8( base, idx, N2N_PKT_VERSION ); - encode_uint8( base, idx, common->ttl ); - - flags = common->pc & N2N_FLAGS_TYPE_MASK; - flags |= common->flags & N2N_FLAGS_BITS_MASK; - - encode_uint16( base, idx, flags ); - encode_buf( base, idx, common->community, N2N_COMMUNITY_SIZE ); - - return -1; -} - -int decode_common( n2n_common_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t idx0=*idx; - uint8_t dummy=0; - decode_uint8( &dummy, base, rem, idx ); - - if ( N2N_PKT_VERSION != dummy ) - { - return -1; - } - - decode_uint8( &(out->ttl), base, rem, idx ); - decode_uint16( &(out->flags), base, rem, idx ); - out->pc = ( out->flags & N2N_FLAGS_TYPE_MASK ); - out->flags &= N2N_FLAGS_BITS_MASK; - - decode_buf( out->community, N2N_COMMUNITY_SIZE, base, rem, idx ); - - return (*idx - idx0); -} - - -int encode_sock( uint8_t * base, - size_t * idx, - const n2n_sock_t * sock ) -{ - int retval=0; - uint16_t f; - - switch (sock->family) - { - case AF_INET: - { - f = 0; - retval += encode_uint16(base,idx,f); - retval += encode_uint16(base,idx,sock->port); - retval += encode_buf(base,idx,sock->addr.v4,IPV4_SIZE); - break; - } - case AF_INET6: - { - f = 0x8000; - retval += encode_uint16(base,idx,f); - retval += encode_uint16(base,idx,sock->port); - retval += encode_buf(base,idx,sock->addr.v6,IPV6_SIZE); - break; - } - default: - retval=-1; - } - - return retval; -} - - -int decode_sock( n2n_sock_t * sock, - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t * idx0=idx; - uint16_t f=0; - - decode_uint16( &f, base, rem, idx ); - - if( f & 0x8000 ) - { - /* IPv6 */ - sock->family = AF_INET6; - decode_uint16( &(sock->port), base, rem, idx ); - decode_buf( sock->addr.v6, IPV6_SIZE, base, rem, idx ); - } - else - { - /* IPv4 */ - sock->family = AF_INET; - decode_uint16( &(sock->port), base, rem, idx ); - memset( sock->addr.v6, 0, IPV6_SIZE ); /* so memcmp() works for equality. */ - decode_buf( sock->addr.v4, IPV4_SIZE, base, rem, idx ); - } - - return (idx-idx0); -} - -int encode_REGISTER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_t * reg ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_buf( base, idx, reg->cookie, N2N_COOKIE_SIZE ); - retval += encode_mac( base, idx, reg->srcMac ); - retval += encode_mac( base, idx, reg->dstMac ); - if ( 0 != reg->sock.family ) - { - retval += encode_sock( base, idx, &(reg->sock) ); - } - - return retval; -} - -int decode_REGISTER( n2n_REGISTER_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( reg, 0, sizeof(n2n_REGISTER_t) ); - retval += decode_buf( reg->cookie, N2N_COOKIE_SIZE, base, rem, idx ); - retval += decode_mac( reg->srcMac, base, rem, idx ); - retval += decode_mac( reg->dstMac, base, rem, idx ); - - if ( cmn->flags & N2N_FLAGS_SOCKET ) - { - retval += decode_sock( &(reg->sock), base, rem, idx ); - } - - return retval; -} - -int encode_REGISTER_SUPER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_SUPER_t * reg ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_buf( base, idx, reg->cookie, N2N_COOKIE_SIZE ); - retval += encode_mac( base, idx, reg->edgeMac ); - retval += encode_uint16( base, idx, 0 ); /* NULL auth scheme */ - retval += encode_uint16( base, idx, 0 ); /* No auth data */ - - return retval; -} - -int decode_REGISTER_SUPER( n2n_REGISTER_SUPER_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( reg, 0, sizeof(n2n_REGISTER_SUPER_t) ); - retval += decode_buf( reg->cookie, N2N_COOKIE_SIZE, base, rem, idx ); - retval += decode_mac( reg->edgeMac, base, rem, idx ); - retval += decode_uint16( &(reg->auth.scheme), base, rem, idx ); - retval += decode_uint16( &(reg->auth.toksize), base, rem, idx ); - retval += decode_buf( reg->auth.token, reg->auth.toksize, base, rem, idx ); - return retval; -} - -int encode_REGISTER_ACK( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_ACK_t * reg ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_buf( base, idx, reg->cookie, N2N_COOKIE_SIZE ); - retval += encode_mac( base, idx, reg->dstMac ); - retval += encode_mac( base, idx, reg->srcMac ); - - /* The socket in REGISTER_ACK is the socket from which the REGISTER - * arrived. This is sent back to the sender so it knows what its public - * socket is. */ - if ( 0 != reg->sock.family ) - { - retval += encode_sock( base, idx, &(reg->sock) ); - } - - return retval; -} - -int decode_REGISTER_ACK( n2n_REGISTER_ACK_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( reg, 0, sizeof(n2n_REGISTER_ACK_t) ); - retval += decode_buf( reg->cookie, N2N_COOKIE_SIZE, base, rem, idx ); - retval += decode_mac( reg->dstMac, base, rem, idx ); - retval += decode_mac( reg->srcMac, base, rem, idx ); - - /* The socket in REGISTER_ACK is the socket from which the REGISTER - * arrived. This is sent back to the sender so it knows what its public - * socket is. */ - if ( cmn->flags & N2N_FLAGS_SOCKET ) - { - retval += decode_sock( &(reg->sock), base, rem, idx ); - } - - return retval; -} - -int encode_REGISTER_SUPER_ACK( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_SUPER_ACK_t * reg ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_buf( base, idx, reg->cookie, N2N_COOKIE_SIZE ); - retval += encode_mac( base, idx, reg->edgeMac ); - retval += encode_uint16( base, idx, reg->lifetime ); - retval += encode_sock( base, idx, &(reg->sock) ); - retval += encode_uint8( base, idx, reg->num_sn ); - if ( reg->num_sn > 0 ) - { - /* We only support 0 or 1 at this stage */ - retval += encode_sock( base, idx, &(reg->sn_bak) ); - } - - return retval; -} - -int decode_REGISTER_SUPER_ACK( n2n_REGISTER_SUPER_ACK_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - - memset( reg, 0, sizeof(n2n_REGISTER_SUPER_ACK_t) ); - retval += decode_buf( reg->cookie, N2N_COOKIE_SIZE, base, rem, idx ); - retval += decode_mac( reg->edgeMac, base, rem, idx ); - retval += decode_uint16( &(reg->lifetime), base, rem, idx ); - - /* Socket is mandatory in this message type */ - retval += decode_sock( &(reg->sock), base, rem, idx ); - - /* Following the edge socket are an array of backup supernodes. */ - retval += decode_uint8( &(reg->num_sn), base, rem, idx ); - if ( reg->num_sn > 0 ) - { - /* We only support 0 or 1 at this stage */ - retval += decode_sock( &(reg->sn_bak), base, rem, idx ); - } - - return retval; -} - -int fill_sockaddr( struct sockaddr * addr, - size_t addrlen, - const n2n_sock_t * sock ) -{ - int retval=-1; - - if ( AF_INET == sock->family ) - { - if ( addrlen >= sizeof(struct sockaddr_in) ) - { - struct sockaddr_in * si = (struct sockaddr_in *)addr; - si->sin_family = sock->family; - si->sin_port = htons( sock->port ); - memcpy( &(si->sin_addr.s_addr), sock->addr.v4, IPV4_SIZE ); - retval=0; - } - } - - return retval; -} - - -int encode_PACKET( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PACKET_t * pkt ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_mac( base, idx, pkt->srcMac ); - retval += encode_mac( base, idx, pkt->dstMac ); - if ( 0 != pkt->sock.family ) - { - retval += encode_sock( base, idx, &(pkt->sock) ); - } - retval += encode_uint16( base, idx, pkt->transform ); - - return retval; -} - - -int decode_PACKET( n2n_PACKET_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( pkt, 0, sizeof(n2n_PACKET_t) ); - retval += decode_mac( pkt->srcMac, base, rem, idx ); - retval += decode_mac( pkt->dstMac, base, rem, idx ); - - if ( cmn->flags & N2N_FLAGS_SOCKET ) - { - retval += decode_sock( &(pkt->sock), base, rem, idx ); - } - - retval += decode_uint16( &(pkt->transform), base, rem, idx ); - - return retval; -} - -int encode_PEER_INFO( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PEER_INFO_t * pkt ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_uint16( base, idx, pkt->aflags ); - retval += encode_mac( base, idx, pkt->mac ); - retval += encode_sock( base, idx, &pkt->sock ); - - return retval; -} - -int decode_PEER_INFO( n2n_PEER_INFO_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( pkt, 0, sizeof(n2n_PEER_INFO_t) ); - retval += decode_uint16( &(pkt->aflags), base, rem, idx ); - retval += decode_mac( pkt->mac, base, rem, idx ); - retval += decode_sock( &pkt->sock, base, rem, idx ); - - return retval; -} - -int encode_QUERY_PEER( uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_QUERY_PEER_t * pkt ) -{ - int retval=0; - retval += encode_common( base, idx, common ); - retval += encode_mac( base, idx, pkt->srcMac ); - retval += encode_mac( base, idx, pkt->targetMac ); - - return retval; -} - -int decode_QUERY_PEER( n2n_QUERY_PEER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx ) -{ - size_t retval=0; - memset( pkt, 0, sizeof(n2n_QUERY_PEER_t) ); - retval += decode_mac( pkt->srcMac, base, rem, idx ); - retval += decode_mac( pkt->targetMac, base, rem, idx ); - - return retval; -} diff --git a/bundles/n2n_ntop_v2/supernode.1 b/bundles/n2n_ntop_v2/supernode.1 deleted file mode 100644 index 26b1f70f..00000000 --- a/bundles/n2n_ntop_v2/supernode.1 +++ /dev/null @@ -1,43 +0,0 @@ -.TH supernode 1 "Jan 3, 2009" "revision 3679" "USER COMMANDS" -.SH NAME -supernode \- n2n supernode daemon -.SH SYNOPSIS -.B supernode \-l [\-v] -.SH DESCRIPTION -N2N is a peer-to-peer VPN system. Supernode is a node introduction registry, -broadcast conduit and packet relay node for the n2n system. On startup supernode -begins listening on the specified UDP port for node registrations, and other -packets to route. The supernode can service any number of communities and routes -packets only between members of the same community. The supernode does not hold -the community encryption key and so cannot snoop or inject packets into the -community. -.PP -Supernode can service a number of n2n communities concurrently. Traffic does not -cross between communities. -.PP -All logging goes to stdout. -.SH OPTIONS -.TP -\-l -listen on the given UDP port -.TP -\-v -use verbose logging -.TP -\-f -disable daemon mode (UNIX) and run in foreground. -.SH EXAMPLES -.TP -.B supernode -l 7654 -v -Start supernode listening on UDP port 7654 with verbose output. -.PP -.SH RESTART -When suprenode restarts it loses all registration information from associated -edge nodes. It can take up to five minutes for the edge nodes to re-register and -normal traffic flow to resume. -.SH EXIT STATUS -supernode is a daemon and any exit is an error -.SH AUTHOR -Luca Deri ( deri (at) ntop.org ), Richard Andrews ( andrews (at) ntop.org ), Don Bindner -.SH SEE ALSO -ifconfig(8) edge(8) diff --git a/bundles/n2n_ntop_v2/tools/Makefile.in b/bundles/n2n_ntop_v2/tools/Makefile.in deleted file mode 100644 index 631d5d95..00000000 --- a/bundles/n2n_ntop_v2/tools/Makefile.in +++ /dev/null @@ -1,46 +0,0 @@ -CC?=gcc -DEBUG?=-g3 -OPTIMIZATION?=-O2 #-march=native -WARN?=-Wall - -INSTALL=install -INSTALL_PROG=$(INSTALL) -m755 -MKDIR=mkdir -p - -PREFIX?=$(DESTDIR)/usr -ifeq ($(OS),Darwin) -SBINDIR=$(PREFIX)/local/sbin -else -SBINDIR=$(PREFIX)/sbin -endif - -LIBS_EDGE_OPT=@N2N_LIBS@ -LIBS_EDGE+=$(LIBS_EDGE_OPT) -HEADERS=$(wildcard include/*.h) -CFLAGS+=-I../include @CFLAGS@ -LDFLAGS+=-L.. -CFLAGS+=$(DEBUG) $(OPTIMIZATION) $(WARN) -LDFLAGS=@LDFLAGS@ - -N2N_LIB=../libn2n.a - -TOOLS=n2n-benchmark -TOOLS+=@ADDITIONAL_TOOLS@ - -.PHONY: all clean install -all: $(TOOLS) - -n2n-benchmark: benchmark.c $(N2N_LIB) $(HEADERS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -o $@ - -n2n-decode: n2n_decode.c $(N2N_LIB) $(HEADERS) - $(CC) $(CFLAGS) $< $(LDFLAGS) $(N2N_LIB) $(LIBS_EDGE) -lpcap -o $@ - -.c.o: $(HEADERS) ../Makefile Makefile - $(CC) $(CFLAGS) -c $< -o $@ - -clean: - rm -rf $(TOOLS) *.o *.dSYM *~ - -install: $(TOOLS) - $(INSTALL_PROG) $(TOOLS) $(SBINDIR)/ diff --git a/bundles/n2n_ntop_v2/tools/benchmark.c b/bundles/n2n_ntop_v2/tools/benchmark.c deleted file mode 100644 index e1d36446..00000000 --- a/bundles/n2n_ntop_v2/tools/benchmark.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * (C) 2007-20 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - -#include "n2n.h" - - -uint8_t PKT_CONTENT[]={ - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }; - -/* Prototypes */ -static ssize_t do_encode_packet( uint8_t * pktbuf, size_t bufsize, const n2n_community_t c ); -static void run_transop_benchmark(const char *op_name, n2n_trans_op_t *op_fn, n2n_edge_conf_t *conf, uint8_t *pktbuf); -static int perform_decryption = 0; - -static void usage() { - fprintf(stderr, "Usage: benchmark [-d]\n" - " -d\t\tEnable decryption. Default: only encryption is performed\n"); - exit(1); -} - -static void parseArgs(int argc, char * argv[]) { - if((argc != 1) && (argc != 2)) - usage(); - - if(argc == 2) { - if(strcmp(argv[1], "-d") != 0) - usage(); - - perform_decryption = 1; - } -} - -int main(int argc, char * argv[]) { - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - n2n_trans_op_t transop_null, transop_twofish; -#ifdef N2N_HAVE_AES - n2n_trans_op_t transop_aes_cbc; -#endif -#ifdef HAVE_OPENSSL_1_1 - n2n_trans_op_t transop_cc20; -#endif - - n2n_trans_op_t transop_speck; - n2n_edge_conf_t conf; - - parseArgs(argc, argv); - - /* Init configuration */ - edge_init_conf_defaults(&conf); - strncpy((char*)conf.community_name, "abc123def456", sizeof(conf.community_name)); - conf.encrypt_key = "SoMEVer!S$cUREPassWORD"; - - /* Init transopts */ - n2n_transop_null_init(&conf, &transop_null); - n2n_transop_twofish_init(&conf, &transop_twofish); -#ifdef N2N_HAVE_AES - n2n_transop_aes_cbc_init(&conf, &transop_aes_cbc); -#endif -#ifdef HAVE_OPENSSL_1_1 - n2n_transop_cc20_init(&conf, &transop_cc20); -#endif - n2n_transop_speck_init(&conf, &transop_speck); - - /* Run the tests */ - run_transop_benchmark("transop_null", &transop_null, &conf, pktbuf); - run_transop_benchmark("transop_twofish", &transop_twofish, &conf, pktbuf); -#ifdef N2N_HAVE_AES - run_transop_benchmark("transop_aes", &transop_aes_cbc, &conf, pktbuf); -#endif -#ifdef HAVE_OPENSSL_1_1 - run_transop_benchmark("transop_cc20", &transop_cc20, &conf, pktbuf); -#endif - run_transop_benchmark("transop_speck", &transop_speck, &conf, pktbuf); - - /* Cleanup */ - transop_null.deinit(&transop_null); - transop_twofish.deinit(&transop_twofish); -#ifdef N2N_HAVE_AES - transop_aes_cbc.deinit(&transop_aes_cbc); -#endif -#ifdef HAVE_OPENSSL_1_1 - transop_cc20.deinit(&transop_cc20); -#endif - transop_speck.deinit(&transop_speck); - - return 0; -} - -static void run_transop_benchmark(const char *op_name, n2n_trans_op_t *op_fn, n2n_edge_conf_t *conf, uint8_t *pktbuf) { - n2n_common_t cmn; - n2n_PACKET_t pkt; - n2n_mac_t mac_buf; - const int target_sec = 3; - struct timeval t1; - struct timeval t2; - size_t idx; - size_t rem; - ssize_t nw; - ssize_t target_usec = target_sec * 1e6; - ssize_t tdiff = 0; // microseconds - size_t num_packets = 0; - - printf("Run %s[%s] for %us (%u bytes): ", perform_decryption ? "enc/dec" : "enc", - op_name, target_sec, (unsigned int)sizeof(PKT_CONTENT)); - fflush(stdout); - - memset(mac_buf, 0, sizeof(mac_buf)); - gettimeofday( &t1, NULL ); - - while(tdiff < target_usec) { - nw = do_encode_packet( pktbuf, N2N_PKT_BUF_SIZE, conf->community_name); - - nw += op_fn->fwd(op_fn, - pktbuf+nw, N2N_PKT_BUF_SIZE-nw, - PKT_CONTENT, sizeof(PKT_CONTENT), mac_buf); - - idx=0; - rem=nw; - - decode_common( &cmn, pktbuf, &rem, &idx); - decode_PACKET( &pkt, &cmn, pktbuf, &rem, &idx ); - - if(perform_decryption) { - uint8_t decodebuf[N2N_PKT_BUF_SIZE]; - - op_fn->rev(op_fn, decodebuf, N2N_PKT_BUF_SIZE, pktbuf+idx, rem, 0); - - if(memcmp(decodebuf, PKT_CONTENT, sizeof(PKT_CONTENT)) != 0) - fprintf(stderr, "Payload decryption failed!\n"); - } - - gettimeofday( &t2, NULL ); - tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec); - num_packets++; - } - - float mpps = num_packets / (tdiff / 1e6) / 1e6; - - printf("\t%12u packets\t%8.1f Kpps\t%8.1f MB/s\n", - (unsigned int)num_packets, mpps * 1e3, mpps * sizeof(PKT_CONTENT)); -} - -static ssize_t do_encode_packet( uint8_t * pktbuf, size_t bufsize, const n2n_community_t c ) -{ - n2n_mac_t destMac={0,1,2,3,4,5}; - n2n_common_t cmn; - n2n_PACKET_t pkt; - size_t idx; - - - memset( &cmn, 0, sizeof(cmn) ); - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_packet; - cmn.flags=0; /* no options, not from supernode, no socket */ - memcpy( cmn.community, c, N2N_COMMUNITY_SIZE ); - - memset( &pkt, 0, sizeof(pkt) ); - memcpy( pkt.srcMac, destMac, N2N_MAC_SIZE); - memcpy( pkt.dstMac, destMac, N2N_MAC_SIZE); - - pkt.sock.family=0; /* do not encode sock */ - - idx=0; - encode_PACKET( pktbuf, &idx, &cmn, &pkt ); - traceEvent( TRACE_DEBUG, "encoded PACKET header of size=%u", (unsigned int)idx ); - - return idx; -} - diff --git a/bundles/n2n_ntop_v2/tools/n2n_decode.c b/bundles/n2n_ntop_v2/tools/n2n_decode.c deleted file mode 100644 index ec3869bc..00000000 --- a/bundles/n2n_ntop_v2/tools/n2n_decode.c +++ /dev/null @@ -1,371 +0,0 @@ -/** - * (C) 2019 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include -#include "n2n.h" - -#define SNAPLEN 1500 -#define TIMEOUT 200 - -/* *************************************************** */ - -static int aes_mode = 0; -static int running = 1; -static char *ifname = NULL; -static n2n_edge_conf_t conf; -static n2n_trans_op_t transop; -static pcap_t *handle; -static pcap_dumper_t *dumper; - -/* *************************************************** */ - -static void help() { - fprintf(stderr, "n2n-decode -i ifname -k key -c community [-B bpf] [-w fname] [-v]" -#ifdef N2N_HAVE_AES - " [-A]" -#endif - "\n"); - fprintf(stderr, "-i | Specify the capture interface name.\n"); - fprintf(stderr, "-c | Specify the community.\n"); - fprintf(stderr, "-k | Specify the encryption key.\n"); -#ifdef N2N_HAVE_AES - fprintf(stderr, "-A | Use AES CBC decryption (default=use twofish).\n"); -#endif - fprintf(stderr, "-B | Use set a BPF filter for the capture.\n"); - fprintf(stderr, "-w | Write decoded PCAP to file.\n"); - fprintf(stderr, "-v | Increase verbosity level.\n"); - - exit(0); -} - -/* *************************************************** */ - -#ifdef WIN32 -BOOL WINAPI term_handler(DWORD sig) -#else -static void term_handler(int sig) -#endif -{ - static int called = 0; - - if(called) { - traceEvent(TRACE_NORMAL, "Ok I am leaving now"); - _exit(0); - } else { - traceEvent(TRACE_NORMAL, "Shutting down..."); - called = 1; - } - - running = 0; -#ifdef WIN32 - return(TRUE); -#endif -} - -/* *************************************************** */ - -static void write_packet(const u_char *packet, struct pcap_pkthdr *hdr) { - pcap_dump((unsigned char*)dumper, hdr, packet); - pcap_dump_flush(dumper); -} - -/* *************************************************** */ - -static int decode_encrypted_packet(const u_char *packet, struct pcap_pkthdr *header, - n2n_PACKET_t *pkt, int encrypted_offset) { - uint8_t decoded_packet[encrypted_offset + N2N_PKT_BUF_SIZE]; - int decoded_eth_size; - int transop_shift; - - switch(pkt->transform) { - case N2N_TRANSFORM_ID_NULL: - /* Not encrypted, dump it */ - write_packet(packet, header); - break; - case N2N_TRANSFORM_ID_TWOFISH: - if(aes_mode) { - traceEvent(TRACE_INFO, "Skipping twofish encrypted packet"); - return(-1); - } - break; - case N2N_TRANSFORM_ID_AESCBC: - if(!aes_mode) { - traceEvent(TRACE_INFO, "Skipping AES encrypted packet"); - return(-1); - } - break; - default: - traceEvent(TRACE_INFO, "Skipping unknown transform packet: %d", pkt->transform); - return(-2); - } - - decoded_eth_size = transop.rev(&transop, decoded_packet+encrypted_offset, N2N_PKT_BUF_SIZE, packet + encrypted_offset, - header->caplen - encrypted_offset, pkt->srcMac); - - transop_shift = (header->caplen - encrypted_offset) - decoded_eth_size; - - if(transop_shift >= 0) { - int transform_id_offset = encrypted_offset - 2; - - /* Copy the initial part of the packet */ - memcpy(decoded_packet, packet, encrypted_offset); - - /* Change the packet transform to NULL as there is now plaintext data */ - *((u_int16_t*)(decoded_packet + transform_id_offset)) = htons(N2N_TRANSFORM_ID_NULL); - - // TODO fix IP and UDP chechsums - write_packet(decoded_packet, header); - return(0); - } - - traceEvent(TRACE_INFO, "Something was wrong in the decoding"); - return(-3); -} - -/* *************************************************** */ - -#define ETH_SIZE 14 -#define UDP_SIZE 8 -#define MIN_IP_SIZE 20 -#define MIN_LEN (ETH_SIZE + UDP_SIZE + MIN_IP_SIZE + sizeof(n2n_common_t)) - -static int run_packet_loop() { - struct pcap_pkthdr header; - const u_char *packet; - - traceEvent(TRACE_NORMAL, "Capturing packets on %s...", ifname); - - while(running) { - n2n_common_t common; - n2n_PACKET_t pkt; - uint ipsize, common_offset; - size_t idx, rem; - - memset(&common, 0, sizeof(common)); - memset(&pkt, 0, sizeof(pkt)); - - packet = pcap_next(handle, &header); - - if(!packet) - continue; - - if(header.caplen < MIN_LEN) { - traceEvent(TRACE_INFO, "Skipping packet too small: size=%d", header.caplen); - continue; - } - - if(ntohs(*(uint16_t*)(packet + 12)) != 0x0800) { - traceEvent(TRACE_INFO, "Skipping non IPv4 packet"); - continue; - } - - if(packet[ETH_SIZE + 9] != IPPROTO_UDP) { - traceEvent(TRACE_INFO, "Skipping non UDP packet"); - continue; - } - - ipsize = (packet[ETH_SIZE] & 0x0F) * 4; - common_offset = ETH_SIZE + ipsize + UDP_SIZE; - - idx = common_offset; - rem = header.caplen - idx; - - if(decode_common(&common, packet, &rem, &idx) == -1) { - traceEvent(TRACE_INFO, "Skipping packet, decode common failed"); - continue; - } - - if(strncmp((char*)conf.community_name, (char*)common.community, N2N_COMMUNITY_SIZE) != 0) { - traceEvent(TRACE_INFO, "Skipping packet with non-matching community"); - continue; - } - - switch(common.pc) { - case n2n_ping: - case n2n_register: - case n2n_deregister: - case n2n_register_ack: - case n2n_register_super: - case n2n_register_super_ack: - case n2n_register_super_nak: - case n2n_federation: - case n2n_peer_info: - case n2n_query_peer: - write_packet(packet, &header); - break; - case n2n_packet: - decode_PACKET(&pkt, &common, packet, &rem, &idx); - decode_encrypted_packet(packet, &header, &pkt, idx); - break; - default: - traceEvent(TRACE_INFO, "Skipping packet with unknown type: %d", common.pc); - continue; - } - } - - return(0); -} - -/* *************************************************** */ - -int main(int argc, char* argv[]) { - u_char c; - struct bpf_program fcode; - char *bpf_filter = NULL, *out_fname = NULL; - char errbuf[PCAP_ERRBUF_SIZE]; - int rv = 0; - FILE *outf = stdout; - - /* Trace to stderr to leave stdout for the PCAP dump if "-w -" is used */ - setTraceFile(stderr); - - /* Init configuration */ - edge_init_conf_defaults(&conf); - - while((c = getopt(argc, argv, - "k:i:B:w:c:v" -#ifdef N2N_HAVE_AES - "A" -#endif - )) != '?') { - if(c == 255) break; - - switch(c) { - case 'c': - strncpy((char*)conf.community_name, optarg, sizeof(conf.community_name)-1); - break; - case 'i': - ifname = strdup(optarg); - break; - case 'k': - conf.encrypt_key = strdup(optarg); - break; - case 'B': - bpf_filter = strdup(optarg); - break; -#ifdef N2N_HAVE_AES - case 'A': - aes_mode = 1; - break; -#endif - case 'w': - if(strcmp(optarg, "-") != 0) - out_fname = strdup(optarg); - break; - case 'v': /* verbose */ - setTraceLevel(getTraceLevel() + 1); - break; - default: - help(); - } - } - - if((ifname == NULL) || (conf.encrypt_key == NULL) || (conf.community_name[0] == '\0')) - help(); - -#ifdef N2N_HAVE_AES - if(aes_mode) - n2n_transop_aes_cbc_init(&conf, &transop); - else -#endif - n2n_transop_twofish_init(&conf, &transop); - - if((handle = pcap_create(ifname, errbuf)) == NULL) { - traceEvent(TRACE_ERROR, "Cannot open device %s: %s", ifname, errbuf); - return(1); - } - - if((pcap_set_timeout(handle, TIMEOUT) != 0) || - (pcap_set_snaplen(handle, SNAPLEN) != 0)) { - traceEvent(TRACE_ERROR, "Error while setting timeout/snaplen"); - return(1); - } - -#ifdef HAVE_PCAP_IMMEDIATE_MODE - /* The timeout is not honored unless immediate mode is set. - * See https://github.com/mfontanini/libtins/issues/180 */ - if(pcap_set_immediate_mode(handle, 1) != 0) { - traceEvent(TRACE_ERROR, "Could not set PCAP immediate mode"); - return(1); - } -#endif - - if(pcap_activate(handle) != 0) { - traceEvent(TRACE_ERROR, "pcap_activate failed: %s", pcap_geterr(handle)); - } - - if(pcap_datalink(handle) != DLT_EN10MB) { - traceEvent(TRACE_ERROR, "Device %s doesn't provide Ethernet headers - not supported", ifname); - return(2); - } - - if(bpf_filter) { - bpf_u_int32 net, mask; - - if(pcap_lookupnet(ifname, &net, &mask, errbuf) == -1) { - traceEvent(TRACE_WARNING, "Couldn't get netmask for device %s: %s", ifname, errbuf); - net = 0; - mask = 0; - } - - if((pcap_compile(handle, &fcode, bpf_filter, 1, net) < 0) - || (pcap_setfilter(handle, &fcode) < 0)) { - traceEvent(TRACE_ERROR, "Could not set BPF filter: %s", pcap_geterr(handle)); - return(3); - } - } - - if(out_fname) { - outf = fopen(out_fname, "wb"); - - if(outf == NULL) { - traceEvent(TRACE_ERROR, "Could not open %s for write[%d]: %s", errno, strerror(errno)); - return(4); - } - } - - dumper = pcap_dump_fopen(handle, outf); - - if(dumper == NULL) { - traceEvent(TRACE_ERROR, "Could dump file: %s", pcap_geterr(handle)); - return(5); - } - -#ifdef WIN32 - SetConsoleCtrlHandler(term_handler, TRUE); -#else - signal(SIGTERM, term_handler); - signal(SIGINT, term_handler); -#endif - - rv = run_packet_loop(); - - /* Cleanup */ - pcap_close(handle); - - if(conf.encrypt_key) free(conf.encrypt_key); - if(bpf_filter) free(bpf_filter); - if(ifname) free(ifname); - - if(out_fname) { - fclose(outf); - free(out_fname); - } - - return(rv); -} diff --git a/bundles/n2n_ntop_v2/win32/CMakeLists.txt b/bundles/n2n_ntop_v2/win32/CMakeLists.txt deleted file mode 100644 index 2e96b181..00000000 --- a/bundles/n2n_ntop_v2/win32/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_library(n2n_win32 - getopt1.c - getopt.c - wintap.c) -target_link_libraries(n2n_win32 PUBLIC ws2_32.lib) diff --git a/bundles/n2n_ntop_v2/win32/DotNet/n2n.sln b/bundles/n2n_ntop_v2/win32/DotNet/n2n.sln deleted file mode 100644 index 95698872..00000000 --- a/bundles/n2n_ntop_v2/win32/DotNet/n2n.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "edge", "n2n.vcproj", "{4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "supernode", "supernode.vcproj", "{BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Debug|Win32.ActiveCfg = Debug|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Debug|Win32.Build.0 = Debug|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Release|Win32.ActiveCfg = Release|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Release|Win32.Build.0 = Release|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Debug|Win32.ActiveCfg = Debug|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Debug|Win32.Build.0 = Debug|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Release|Win32.ActiveCfg = Release|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/bundles/n2n_ntop_v2/win32/DotNet/n2n.suo b/bundles/n2n_ntop_v2/win32/DotNet/n2n.suo deleted file mode 100644 index aae212bd..00000000 Binary files a/bundles/n2n_ntop_v2/win32/DotNet/n2n.suo and /dev/null differ diff --git a/bundles/n2n_ntop_v2/win32/DotNet/n2n.vcproj b/bundles/n2n_ntop_v2/win32/DotNet/n2n.vcproj deleted file mode 100644 index d62381d2..00000000 --- a/bundles/n2n_ntop_v2/win32/DotNet/n2n.vcproj +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/n2n_ntop_v2/win32/DotNet/supernode.vcproj b/bundles/n2n_ntop_v2/win32/DotNet/supernode.vcproj deleted file mode 100644 index e6a9e0d1..00000000 --- a/bundles/n2n_ntop_v2/win32/DotNet/supernode.vcproj +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/n2n_ntop_v2/win32/getopt.c b/bundles/n2n_ntop_v2/win32/getopt.c deleted file mode 100644 index 6bbb735a..00000000 --- a/bundles/n2n_ntop_v2/win32/getopt.c +++ /dev/null @@ -1,1074 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 - Free Software Foundation, Inc. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include -#ifdef WIN32 -#include -#endif - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include -# if _GNU_GETOPT<_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -# include -# include -#endif /* GNU C library. */ - -#ifdef VMS -# include -# if HAVE_STRING_H - 0 -# include -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# ifdef HAVE_LIBINTL_H -# include -# define _(msgid) gettext (msgid) -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -#ifndef DARWIN -char *optarg; -#endif - - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -#ifndef DARWIN -int optind = 1; -#endif - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -#ifndef DARWIN -#ifdef WIN32 -int opterr = 0; -#else -int opterr = 1; -#endif -#endif - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ -#ifndef DARWIN -int optopt = '?'; -#endif - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include -# define my_index strchr -#else - -#ifndef WIN32 -# if HAVE_STRING_H -# include -# else -# include -# endif -#endif - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (); -#endif - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; - -static int original_argc; -static char *const *original_argv; - -/* Make sure the environment variable bash 2.0 puts in the environment - is valid for the getopt call we must make sure that the ARGV passed - to getopt is that one passed to the process. */ -static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) -{ - /* XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ - original_argc = argc; - original_argv = argv; -} -# ifdef text_set_element -text_set_element (__libc_subinit, store_args_and_env); -# endif /* text_set_element */ - -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#ifdef _LIBC - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#ifdef _LIBC - if (posixly_correct == NULL - && argc == original_argc && argv == original_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - int print_errors = opterr; - if (optstring[0] == ':') - print_errors = 0; - - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#ifdef _LIBC -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (print_errors) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (print_errors) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt____ (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ - diff --git a/bundles/n2n_ntop_v2/win32/getopt.h b/bundles/n2n_ntop_v2/win32/getopt.h deleted file mode 100644 index b0147e9d..00000000 --- a/bundles/n2n_ntop_v2/win32/getopt.h +++ /dev/null @@ -1,169 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -# if defined __STDC__ && __STDC__ - const char *name; -# else - char *name; -# endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, `optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `getopt' that there are no more - options. - - If OPTS begins with `--', then non-option arguments are treated as - arguments to the option '\0'. This behavior is specific to the GNU - `getopt'. */ - -#if defined __STDC__ && __STDC__ -# ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/bundles/n2n_ntop_v2/win32/getopt1.c b/bundles/n2n_ntop_v2/win32/getopt1.c deleted file mode 100644 index 3d264f2d..00000000 --- a/bundles/n2n_ntop_v2/win32/getopt1.c +++ /dev/null @@ -1,188 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "getopt.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/bundles/n2n_ntop_v2/win32/n2n_win32.h b/bundles/n2n_ntop_v2/win32/n2n_win32.h deleted file mode 100644 index 81b5bdc7..00000000 --- a/bundles/n2n_ntop_v2/win32/n2n_win32.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - - (C) 2007-09 - Luca Deri - -*/ - -#ifndef _N2N_WIN32_H_ -#define _N2N_WIN32_H_ - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif - -#define WIN32_LEAN_AND_MEAN - -#if defined(__MINGW32__) -/* should be defined here and before winsock gets included */ -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x501 //Otherwise the linker doesnt find getaddrinfo -#endif /* #ifndef _WIN32_WINNT */ -#include -#endif /* #if defined(__MINGW32__) */ - -#include -#include -#include - - -#include "wintap.h" - -#ifdef _MSC_VER -#include "getopt.h" - -/* Other Win environments are expected to support stdint.h */ - -/* stdint.h typedefs (C99) (not present in Visual Studio) */ -typedef unsigned int uint32_t; -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; - -/* sys/types.h typedefs (not present in Visual Studio) */ -typedef unsigned int u_int32_t; -typedef unsigned short u_int16_t; -typedef unsigned char u_int8_t; - -typedef int ssize_t; -#endif /* #ifdef _MSC_VER */ - -typedef unsigned long in_addr_t; - -#undef EAFNOSUPPORT -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define MAX(a,b) (a > b ? a : b) -#define MIN(a,b) (a < b ? a : b) - -#define snprintf _snprintf -#define strdup _strdup - -#define socklen_t int - -#define ETH_ADDR_LEN 6 -/* - * Structure of a 10Mb/s Ethernet header. - */ -struct ether_hdr -{ - uint8_t dhost[ETH_ADDR_LEN]; - uint8_t shost[ETH_ADDR_LEN]; - uint16_t type; /* higher layer protocol encapsulated */ -}; - -typedef struct ether_hdr ether_hdr_t; - -/* ************************************* */ - -struct ip { -#if BYTE_ORDER == LITTLE_ENDIAN - u_char ip_hl:4, /* header length */ - ip_v:4; /* version */ -#else - u_char ip_v:4, /* version */ - ip_hl:4; /* header length */ -#endif - u_char ip_tos; /* type of service */ - short ip_len; /* total length */ - u_short ip_id; /* identification */ - short ip_off; /* fragment offset field */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_char ip_ttl; /* time to live */ - u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src,ip_dst; /* source and dest address */ -}; - - -/* ************************************* */ - -typedef struct tuntap_dev { - HANDLE device_handle; - char *device_name; - char *ifName; - OVERLAPPED overlap_read, overlap_write; - uint8_t mac_addr[6]; - uint32_t ip_addr, device_mask; - unsigned int mtu; -} tuntap_dev; - -#define index(a, b) strchr(a, b) -#define sleep(x) Sleep(x * 1000) - -#endif diff --git a/bundles/n2n_ntop_v2/win32/version-msvc.c b/bundles/n2n_ntop_v2/win32/version-msvc.c deleted file mode 100644 index 92cce068..00000000 --- a/bundles/n2n_ntop_v2/win32/version-msvc.c +++ /dev/null @@ -1,3 +0,0 @@ -const char * n2n_sw_version = "2.0.0"; -const char * n2n_sw_osName = "Win32"; -const char * n2n_sw_buildDate = __DATE__ " " __TIME__; diff --git a/bundles/n2n_ntop_v2/win32/winconfig.h b/bundles/n2n_ntop_v2/win32/winconfig.h deleted file mode 100644 index 3a8cea06..00000000 --- a/bundles/n2n_ntop_v2/win32/winconfig.h +++ /dev/null @@ -1,8 +0,0 @@ -/* winconfig.h. Win32 replacement for file generated from config.h.in by configure. */ - -/* OS name */ -#define PACKAGE_OSNAME N2N_OSNAME - -/* Define to the version of this package. */ -#define PACKAGE_VERSION N2N_VERSION -#define GIT_RELEASE N2N_VERSION diff --git a/bundles/n2n_ntop_v2/win32/wintap.c b/bundles/n2n_ntop_v2/win32/wintap.c deleted file mode 100644 index 85f455c1..00000000 --- a/bundles/n2n_ntop_v2/win32/wintap.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - (C) 2007-09 - Luca Deri -*/ - -#include "n2n.h" -#include "n2n_win32.h" - -/* ***************************************************** */ - -void initWin32() { - WSADATA wsaData; - int err; - - err = WSAStartup(MAKEWORD(2, 2), &wsaData ); - if( err != 0 ) { - /* Tell the user that we could not find a usable */ - /* WinSock DLL. */ - printf("FATAL ERROR: unable to initialise Winsock 2.x."); - exit(EXIT_FAILURE); - } -} - -struct win_adapter_info { - HANDLE handle; - char adapterid[1024]; - char adaptername[1024]; -}; - -/* ***************************************************** */ - -static HANDLE open_tap_device(const char *adapterid) { - char tapname[1024]; - _snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, adapterid); - - return(CreateFile(tapname, GENERIC_WRITE | GENERIC_READ, - 0, /* Don't let other processes share or open - the resource until the handle's been closed */ - 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0)); -} - -/* ***************************************************** */ - -static void iterate_win_network_adapters( - int (*callback)(struct win_adapter_info*, struct tuntap_dev *), - void *userdata) { - HKEY key, key2; - char regpath[1024]; - long len, rc; - int found = 0; - int err, i; - struct win_adapter_info adapter; - - /* Open registry and look for network adapters */ - if((rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &key))) { - printf("Unable to read registry: [rc=%d]\n", rc); - exit(EXIT_FAILURE); - /* MSVC Note: If you keep getting rc=2 errors, make sure you set: - Project -> Properties -> Configuration Properties -> General -> Character set - to: "Use Multi-Byte Character Set" - */ - } - - for (i = 0; ; i++) { - len = sizeof(adapter.adapterid); - if(RegEnumKeyEx(key, i, (LPTSTR)adapter.adapterid, &len, 0, 0, 0, NULL)) - break; - - /* Find out more about this adapter */ - - _snprintf(regpath, sizeof(regpath), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, adapter.adapterid); - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCSTR)regpath, 0, KEY_READ, &key2)) - continue; - - len = sizeof(adapter.adaptername); - err = RegQueryValueEx(key2, "Name", 0, 0, adapter.adaptername, &len); - - RegCloseKey(key2); - - if(err) - continue; - - - adapter.handle = open_tap_device(adapter.adapterid); - - if(adapter.handle != INVALID_HANDLE_VALUE) { - /* Valid device, use the callback */ - if(!callback(&adapter, userdata)) - break; - else - CloseHandle(adapter.handle); - /* continue */ - } - } - - RegCloseKey(key); -} - -/* ***************************************************** */ - -static int print_adapter_callback(struct win_adapter_info *adapter, struct tuntap_dev *device) { - printf(" %s - %s\n", adapter->adapterid, adapter->adaptername); - - /* continue */ - return(1); -} - -void win_print_available_adapters() { - iterate_win_network_adapters(print_adapter_callback, NULL); -} - -/* ***************************************************** */ - -static int lookup_adapter_info_reg(const char *target_adapter, char *regpath, size_t regpath_size) { - HKEY key, key2; - long len, rc; - char index[16]; - int err, i; - char adapter_name[N2N_IFNAMSIZ]; - int rv = 0; - - if((rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ADAPTER_INFO_KEY, 0, KEY_READ, &key))) { - printf("Unable to read registry: %s, [rc=%d]\n", ADAPTER_INFO_KEY, rc); - exit(EXIT_FAILURE); - } - - for(i = 0; ; i++) { - len = sizeof(index); - if(RegEnumKeyEx(key, i, (LPTSTR)index, &len, 0, 0, 0, NULL)) - break; - - _snprintf(regpath, regpath_size, "%s\\%s", ADAPTER_INFO_KEY, index); - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCSTR)regpath, 0, KEY_READ, &key2)) - continue; - - len = sizeof(adapter_name); - err = RegQueryValueEx(key2, "NetCfgInstanceId", 0, 0, adapter_name, &len); - - RegCloseKey(key2); - - if(err) - continue; - - if(!strcmp(adapter_name, target_adapter)) { - rv = 1; - break; - } - } - - RegCloseKey(key); - return(rv); -} - -/* ***************************************************** */ - -static void set_interface_mac(struct tuntap_dev *device, const char *mac_str) { - char cmd[256]; - char mac_buf[18]; - char adapter_info_reg[1024]; - - uint64_t mac = 0; - uint8_t *ptr = (uint8_t*)&mac; - - if(strlen(mac_str) != 17) { - printf("Invalid MAC: %s\n", mac_str); - exit(EXIT_FAILURE); - } - - /* Remove the colons */ - for(int i=0; i<6; i++) { - mac_buf[i*2] = mac_str[2*i + i]; - mac_buf[i*2+1] = mac_str[2*i + i + 1]; - } - mac_buf[12] = '\0'; - - if(!lookup_adapter_info_reg(device->device_name, adapter_info_reg, sizeof(adapter_info_reg))) { - printf("Could not determine adapter MAC registry key\n"); - exit(EXIT_FAILURE); - } - - _snprintf(cmd, sizeof(cmd), - "reg add HKEY_LOCAL_MACHINE\\%s /v MAC /d %s /f > nul", adapter_info_reg, mac_buf); - system(cmd); - - /* Put down then up again to apply */ - CloseHandle(device->device_handle); - _snprintf(cmd, sizeof(cmd), "netsh interface set interface \"%s\" disabled > nul", device->ifName); - system(cmd); - _snprintf(cmd, sizeof(cmd), "netsh interface set interface \"%s\" enabled > nul", device->ifName); - system(cmd); - - device->device_handle = open_tap_device(device->device_name); - if(device->device_handle == INVALID_HANDLE_VALUE) { - printf("Reopening TAP device \"%s\" failed\n", device->device_name); - exit(EXIT_FAILURE); - } -} - -/* ***************************************************** */ - -static int choose_adapter_callback(struct win_adapter_info *adapter, struct tuntap_dev *device) { - if(device->device_name) { - /* A device name filter was set, name must match */ - if(strcmp(device->device_name, adapter->adapterid) && - strcmp(device->device_name, adapter->adaptername)) { - /* Not found, continue */ - return(1); - } - } /* otherwise just pick the first available adapter */ - - /* Adapter found, break */ - device->device_handle = adapter->handle; - if(device->device_name) free(device->device_name); - device->device_name = _strdup(adapter->adapterid); - device->ifName = _strdup(adapter->adaptername); - return(0); -} - -/* ***************************************************** */ - -int open_wintap(struct tuntap_dev *device, - const char * devname, - const char * address_mode, /* "static" or "dhcp" */ - char *device_ip, - char *device_mask, - const char *device_mac, - int mtu) { - char cmd[256]; - DWORD len; - ULONG status = TRUE; - - memset(device, 0, sizeof(struct tuntap_dev)); - device->device_handle = INVALID_HANDLE_VALUE; - device->device_name = devname[0] ? _strdup(devname) : NULL; - device->ifName = NULL; - device->ip_addr = inet_addr(device_ip); - - iterate_win_network_adapters(choose_adapter_callback, device); - - if(device->device_handle == INVALID_HANDLE_VALUE) { - if(!devname[0]) - printf("No Windows tap devices found, did you run tapinstall.exe?\n"); - else - printf("Cannot find tap device \"%s\"\n", devname); - return -1; - } - - /* ************************************** */ - - if(device_mac[0]) - set_interface_mac(device, device_mac); - - /* Get MAC address from tap device->device_name */ - - if(!DeviceIoControl(device->device_handle, TAP_IOCTL_GET_MAC, - device->mac_addr, sizeof(device->mac_addr), - device->mac_addr, sizeof(device->mac_addr), &len, 0)) { - printf("Could not get MAC address from Windows tap %s (%s)\n", - device->device_name, device->ifName); - return -1; - } - - device->mtu = mtu; - - printf("Open device [name=%s][ip=%s][ifName=%s][MTU=%d][mac=%02X:%02X:%02X:%02X:%02X:%02X]\n", - device->device_name, device_ip, device->ifName, device->mtu, - device->mac_addr[0] & 0xFF, - device->mac_addr[1] & 0xFF, - device->mac_addr[2] & 0xFF, - device->mac_addr[3] & 0xFF, - device->mac_addr[4] & 0xFF, - device->mac_addr[5] & 0xFF); - - /* ****************** */ - - if ( 0 == strcmp("dhcp", address_mode) ) - { - _snprintf(cmd, sizeof(cmd), - "netsh interface ip set address \"%s\" dhcp > nul", - device->ifName); - } - else - { - _snprintf(cmd, sizeof(cmd), - "netsh interface ip set address \"%s\" static %s %s > nul", - device->ifName, device_ip, device_mask); - } - - if(system(cmd) == 0) { - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - } else - printf("WARNING: Unable to set device %s IP address [%s]\n", - device->ifName, cmd); - - /* ****************** */ - - /* MTU */ - _snprintf(cmd, sizeof(cmd), - "netsh interface ipv4 set subinterface \"%s\" mtu=%d store=persistent > nul", - device->ifName, mtu); - - if(system(cmd) != 0) - printf("WARNING: Unable to set device %s MTU [%s]\n", - device->ifName, cmd); - - /* set driver media status to 'connected' (i.e. set the interface up) */ - if (!DeviceIoControl (device->device_handle, TAP_IOCTL_SET_MEDIA_STATUS, - &status, sizeof (status), - &status, sizeof (status), &len, NULL)) - printf("WARNING: Unable to enable TAP adapter\n"); - - /* - * Initialize overlapped structures - */ - device->overlap_read.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - device->overlap_write.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (!device->overlap_read.hEvent || !device->overlap_write.hEvent) { - return -1; - } - - return(0); -} - -/* ************************************************ */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) -{ - DWORD read_size, last_err; - - ResetEvent(tuntap->overlap_read.hEvent); - if (ReadFile(tuntap->device_handle, buf, len, &read_size, &tuntap->overlap_read)) { - //printf("tun_read(len=%d)\n", read_size); - return read_size; - } - switch (last_err = GetLastError()) { - case ERROR_IO_PENDING: - WaitForSingleObject(tuntap->overlap_read.hEvent, INFINITE); - GetOverlappedResult(tuntap->device_handle, &tuntap->overlap_read, &read_size, FALSE); - return read_size; - break; - default: - printf("GetLastError() returned %d\n", last_err); - break; - } - - return -1; -} -/* ************************************************ */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) -{ - DWORD write_size; - - //printf("tun_write(len=%d)\n", len); - - ResetEvent(tuntap->overlap_write.hEvent); - if (WriteFile(tuntap->device_handle, - buf, - len, - &write_size, - &tuntap->overlap_write)) { - //printf("DONE tun_write(len=%d)\n", write_size); - return write_size; - } - switch (GetLastError()) { - case ERROR_IO_PENDING: - WaitForSingleObject(tuntap->overlap_write.hEvent, INFINITE); - GetOverlappedResult(tuntap->device_handle, &tuntap->overlap_write, - &write_size, FALSE); - return write_size; - break; - default: - break; - } - - return -1; -} - -/* ************************************************ */ - -int tuntap_open(struct tuntap_dev *device, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - return(open_wintap(device, dev, address_mode, device_ip, device_mask, device_mac, mtu)); -} - -/* ************************************************ */ - -void tuntap_close(struct tuntap_dev *tuntap) { - CloseHandle(tuntap->device_handle); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ -} - -/* ************************************************ */ - -#if 0 -int main(int argc, char* argv[]) { - struct tuntap_dev tuntap; - int i; - int mtu = 1400; - - printf("Welcome to n2n\n"); - initWin32(); - open_wintap(&tuntap, "static", "1.2.3.20", "255.255.255.0", mtu); - - for(i=0; i<10; i++) { - u_char buf[MTU]; - int rc; - - rc = tun_read(&tuntap, buf, sizeof(buf)); - buf[0]=2; - buf[1]=3; - buf[2]=4; - - printf("tun_read returned %d\n", rc); - rc = tun_write(&tuntap, buf, rc); - printf("tun_write returned %d\n", rc); - } - // rc = tun_open (device->device_name, IF_MODE_TUN); - WSACleanup (); - return(0); -} - -#endif diff --git a/bundles/n2n_ntop_v2/win32/wintap.h b/bundles/n2n_ntop_v2/win32/wintap.h deleted file mode 100644 index 9c557140..00000000 --- a/bundles/n2n_ntop_v2/win32/wintap.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - (C) 2007 - Luca Deri -*/ - -#ifndef _WINTAP_H_ -#define _WINTAP_H_ - -#undef UNICODE -#undef _UNICODE -#define _CRT_SECURE_NO_WARNINGS - -#include -#include -#include - - - -//=============================================== -// This file is included both by OpenVPN and -// the TAP-Win32 driver and contains definitions -// common to both. -//=============================================== - -//============= -// TAP IOCTLs -//============= - -#define TAP_CONTROL_CODE(request,method) \ - CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) - -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) - -//================= -// Registry keys -//================= - -#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" -#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" -#define ADAPTER_INFO_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" - -//====================== -// Filesystem prefixes -//====================== - -#define USERMODEDEVICEDIR "\\\\.\\Global\\" -#define SYSDEVICEDIR "\\Device\\" -#define USERDEVICEDIR "\\DosDevices\\Global\\" -#define TAPSUFFIX ".tap" - -//========================================================= -// TAP_COMPONENT_ID -- This string defines the TAP driver -// type -- different component IDs can reside in the system -// simultaneously. -//========================================================= - -#define TAP_COMPONENT_ID "tap0801" - -extern void initWin32(); -extern void win_print_available_adapters(); - -#endif \ No newline at end of file diff --git a/bundles/n2n_ntop_v2/wireshark/README.md b/bundles/n2n_ntop_v2/wireshark/README.md deleted file mode 100644 index 4c0b6fdd..00000000 --- a/bundles/n2n_ntop_v2/wireshark/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Wireshark Lua plugin to dissect n2n traffic. - -Quick load: - -``` - wireshark -X lua_script:n2n.lua -``` - -NOTE: the dissector only decodes traffic on UDP port 50001. In order to decode n2n traffic on another UDP port you can use the "Decode As..." function of wireshark. diff --git a/bundles/n2n_ntop_v2/wireshark/n2n.lua b/bundles/n2n_ntop_v2/wireshark/n2n.lua deleted file mode 100644 index ff453410..00000000 --- a/bundles/n2n_ntop_v2/wireshark/n2n.lua +++ /dev/null @@ -1,316 +0,0 @@ --- (C) 2019 - ntop.org and contributors - -n2n = Proto("n2n", "n2n Protocol") - --- ############################################# - -PKT_TYPE_PING = 0 -PKT_TYPE_REGISTER = 1 -PKT_TYPE_DEREGISTER = 2 -PKT_TYPE_PACKET = 3 -PKT_TYPE_REGISTER_ACK = 4 -PKT_TYPE_REGISTER_SUPER = 5 -PKT_TYPE_REGISTER_SUPER_ACK = 6 -PKT_TYPE_REGISTER_SUPER_NAK = 7 -PKT_TYPE_FEDERATION = 8 -PKT_TYPE_PEER_INFO = 9 -PKT_TYPE_QUERY_PEER = 10 - -PKT_TRANSFORM_NULL = 1 -PKT_TRANSFORM_TWOFISH = 2 -PKT_TRANSFORM_AESCBC = 3 - -FLAG_FROM_SUPERNODE = 0x0020 -FLAG_SOCKET = 0x0040 -FLAG_OPTIONS = 0x0080 - -SOCKET_FAMILY_AF_INET = 0x0000 -SOCKET_FAMILY_AF_INET6 = 0x8000 - --- ############################################# - -version = ProtoField.uint8("n2n.version", "version", base.DEC) -ttl = ProtoField.uint8("n2n.ttl", "ttl", base.DEC) - -packet_type_mask = 0x001f -pkt_type_2_str = { - [PKT_TYPE_PING] = "ping", - [PKT_TYPE_REGISTER] = "register", - [PKT_TYPE_DEREGISTER] = "deregister", - [PKT_TYPE_PACKET] = "packet", - [PKT_TYPE_REGISTER_ACK] = "register_ack", - [PKT_TYPE_REGISTER_SUPER] = "register_super", - [PKT_TYPE_REGISTER_SUPER_ACK] = "register_super_ack", - [PKT_TYPE_REGISTER_SUPER_NAK] = "register_super_nak", - [PKT_TYPE_FEDERATION] = "federation", - [PKT_TYPE_PEER_INFO] = "peer_info", - [PKT_TYPE_QUERY_PEER] = "query_peer", -} -packet_type = ProtoField.uint8("n2n.packet_type", "packetType", base.HEX, pkt_type_2_str, packet_type_mask) - -flags_mask = 0xffe0 -flags = ProtoField.uint16("n2n.flags", "Flags", base.HEX, nil, flags_mask) -from_supernode_flag = ProtoField.uint16("n2n.flags.from_supernode", "from_supernode", base.BOOLEAN, nil, FLAG_FROM_SUPERNODE) -socket_flag = ProtoField.uint16("n2n.flags.socket", "socket", base.BOOLEAN, nil, FLAG_SOCKET) -options_flag = ProtoField.uint16("n2n.flags.options", "options", base.BOOLEAN, nil, FLAG_OPTIONS) -community = ProtoField.string("n2n.community", "Community", base.ASCII) - --- ############################################# - -src_mac = ProtoField.ether("n2n.src_mac", "Source") -dst_mac = ProtoField.ether("n2n.dst_mac", "Destination") -socket_info = ProtoField.none("n2n.socket", "Socket Info") -socket_family = ProtoField.uint16("n2n.socket.family", "Family", base.HEX, { - [0] = "AF_INET", -}) -socket_port = ProtoField.uint16("n2n.socket.port", "Port") -socket_ipv4 = ProtoField.ipv4("n2n.socket.ipv4", "IPv4") -socket_ipv6 = ProtoField.ipv6("n2n.socket.ipv6", "IPv6") - --- ############################################# - -peer_info_field = ProtoField.none("n2n.peer_info", "PeerInfo") -peer_info_flags = ProtoField.uint16("n2n.peer_info.flags", "Flags") -peer_info_mac = ProtoField.ether("n2n.peer_info.query_mac", "Query") - -query_peer_field = ProtoField.none("n2n.query_peer", "QueryPeer") - --- ############################################# - - - -packet_field = ProtoField.none("n2n.packet", "Packet") -packet_transform = ProtoField.uint16("n2n.packet.transform", "Transform", base.HEX, { - [PKT_TRANSFORM_NULL] = "Plaintext", - [PKT_TRANSFORM_TWOFISH] = "TwoFish", - [PKT_TRANSFORM_AESCBC] = "AES CBC", -}) -packet_payload = ProtoField.bytes("n2n.packet.payload", "Payload") - --- ############################################# - -register_field = ProtoField.none("n2n.register", "Register") -register_cookie = ProtoField.uint32("n2n.register.cookie", "Cookie", base.HEX) - -register_ack_field = ProtoField.none("n2n.register_ack", "RegisterACK") -register_ack_cookie = ProtoField.uint32("n2n.register_ack.cookie", "Cookie", base.HEX) - -register_super_field = ProtoField.none("n2n.register_super", "RegisterSuper") -register_super_cookie = ProtoField.uint32("n2n.register_super.cookie", "Cookie", base.HEX) -register_super_auth_schema = ProtoField.uint16("n2n.register_super.auth.schema", "AuthSchema", base.HEX) -register_super_auth_data = ProtoField.uint16("n2n.register_super.auth.data", "AuthData", base.HEX) - -register_super_ack_field = ProtoField.none("n2n.register_super_ack", "RegisterSuperACK") -register_super_ack_cookie = ProtoField.uint32("n2n.register_super_ack.cookie", "Cookie", base.HEX) -register_super_ack_lifetime = ProtoField.uint16("n2n.register_super_ack.lifetime", "Registration Lifetime", base.DEC) -register_super_ack_num_sn = ProtoField.uint8("n2n.register_super_ack.num_sn", "Num Supernodes", base.DEC) - --- ############################################# - -n2n.fields = { - version, ttl, packet_type, - flags, from_supernode_flag, socket_flag, options_flag, - community, - - -- Generic - src_mac, dst_mac, - socket_info, socket_family, socket_port, socket_ipv4, socket_ipv6, - - -- PKT_TYPE_REGISTER - register_field, register_cookie, - -- PKT_TYPE_PACKET - packet_field, packet_transform, packet_payload, - -- PKT_TYPE_REGISTER_ACK - register_ack_field, register_ack_cookie, - -- PKT_TYPE_REGISTER_SUPER - register_super_field, register_super_cookie, register_super_auth_schema, register_super_auth_data, - -- PKT_TYPE_REGISTER_SUPER_ACK - register_super_ack_field, register_super_ack_cookie, register_super_ack_lifetime, register_super_ack_num_sn, - -- PKT_TYPE_PEER_INFO - peer_info_field, peer_info_flags, peer_info_mac, - -- PKT_TYPE_QUERY_PEER - query_peer_field, -} - --- ############################################# - -function dissect_socket(subtree, buffer, offset) - local sock_baselen = 4 - local sock_protolen = 0 - buffer = buffer(offset) - local sock_family = bit.band(buffer(0,4):uint(), 0xFFFF0000) - - if(sock_family == SOCKET_FAMILY_AF_INET) then - sock_protolen = 4 - elseif(sock_family == SOCKET_FAMILY_AF_INET6) then - sock_protolen = 16 - end - - local totlen = sock_baselen + sock_protolen - local socktree = subtree:add(socket_info, buffer(0, totlen)) - - socktree:add(socket_family, buffer(0, 2)) - socktree:add(socket_port, buffer(2, 2)) - - if(sock_family == SOCKET_FAMILY_AF_INET) then - socktree:add(socket_ipv4, buffer(4, sock_protolen)) - elseif(sock_family == SOCKET_FAMILY_AF_INET6) then - socktree:add(socket_ipv6, buffer(4, sock_protolen)) - end - - return offset+totlen, socktree -end - --- ############################################# - -function dissect_register(subtree, buffer, flags) - local regtree = subtree:add(register_field, buffer) - - regtree:add(register_cookie, buffer(0,4)) - regtree:add(src_mac, buffer(4,6)) - regtree:add(dst_mac, buffer(10,6)) - - if(bit.band(flags, FLAG_SOCKET) == FLAG_SOCKET) then - dissect_socket(regtree, buffer, 16) - end - - return regtree -end - --- ############################################# - -function dissect_register_ack(subtree, buffer, flags) - local regtree = subtree:add(register_ack_field, buffer) - - regtree:add(register_ack_cookie, buffer(0,4)) - regtree:add(src_mac, buffer(4,6)) - regtree:add(dst_mac, buffer(10,6)) - - return regtree -end - --- ############################################# - -function dissect_packet(subtree, buffer, flags, pinfo) - local pktree = subtree:add(packet_field, buffer) - - pktree:add(src_mac, buffer(0,6)) - pktree:add(dst_mac, buffer(6,6)) - - if(bit.band(flags, FLAG_SOCKET) == FLAG_SOCKET) then - idx = dissect_socket(pktree, buffer, 12) - else - idx = 12 - end - - pktree:add(packet_transform, buffer(idx,2)) - local payload = pktree:add(packet_payload, buffer(idx+2)) - local transform = buffer(idx,2):uint() - - -- Can only dissect unencrypted data - if(transform == PKT_TRANSFORM_NULL) then - Dissector.get("eth_withoutfcs"):call(buffer(idx+2):tvb(), pinfo, payload) - end - - return pktree -end - --- ############################################# - -function dissect_register_super(subtree, buffer, flags) - local regtree = subtree:add(register_super_field, buffer) - - regtree:add(register_super_cookie, buffer(0,4)) - regtree:add(src_mac, buffer(4,6)) - regtree:add(register_super_auth_schema, buffer(10,2)) - regtree:add(register_super_auth_data, buffer(12,2)) - - return regtree -end - --- ############################################# - -function dissect_register_super_ack(subtree, buffer, flags) - local regtree = subtree:add(register_super_ack_field, buffer) - - regtree:add(register_super_ack_cookie, buffer(0,4)) - regtree:add(dst_mac, buffer(4,6)) - regtree:add(register_super_ack_lifetime, buffer(10,2)) - local idx = dissect_socket(regtree, buffer, 12) - regtree:add(register_super_ack_num_sn, buffer(idx, 1)) - - return regtree -end - --- ############################################# - -function dissect_peer_info(subtree, buffer, flags) - local peertree = subtree:add(peer_info_field, buffer) - - peertree:add(peer_info_flags, buffer(0,2)) - peertree:add(peer_info_mac, buffer(2,6)) - dissect_socket(peertree, buffer, 8) - - return peertree -end - --- ############################################# - -function dissect_query_peer(subtree, buffer, flags) - local peertree = subtree:add(query_peer_field, buffer) - - peertree:add(src_mac, buffer(0,6)) - peertree:add(dst_mac, buffer(6,6)) - - return peertree -end - --- ############################################# - -function n2n.dissector(buffer, pinfo, tree) - local length = buffer:len() - if length < 20 then return end - - pinfo.cols.protocol = n2n.name - - local pkt_type = bit.band(buffer(2,2):uint(), packet_type_mask) - local subtree = tree:add(n2n, buffer(), string.format("n2n Protocol, Type: %s", pkt_type_2_str[pkt_type] or "Unknown")) - - -- Common - subtree:add(version, buffer(0,1)) - subtree:add(ttl, buffer(1,1)) - subtree:add(packet_type, buffer(2,2)) - local flags_buffer = buffer(2,2) - local flags_tree = subtree:add(flags, flags_buffer) - subtree:add(community, buffer(4,16)) - - -- Flags - flags_tree:add(from_supernode_flag, flags_buffer) - flags_tree:add(socket_flag, flags_buffer) - flags_tree:add(options_flag, flags_buffer) - - -- Packet specific - local flags = bit.band(buffer(2,2):uint(), flags_mask) - local typebuf = buffer(20) - - if(pkt_type == PKT_TYPE_REGISTER) then - dissect_register(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_REGISTER) then - dissect_register_ack(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_PACKET) then - dissect_packet(subtree, typebuf, flags, pinfo) - elseif(pkt_type == PKT_TYPE_REGISTER_SUPER) then - dissect_register_super(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_REGISTER_SUPER_ACK) then - dissect_register_super_ack(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_PEER_INFO) then - dissect_peer_info(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_QUERY_PEER) then - dissect_query_peer(subtree, typebuf, flags) - end -end - --- ############################################# - -local udp_port = DissectorTable.get("udp.port") -udp_port:add(50001, n2n) diff --git a/bundles/n2n_ntop_v3/.ci/build-project.ps1 b/bundles/n2n_ntop_v3/.ci/build-project.ps1 deleted file mode 100644 index b0d76432..00000000 --- a/bundles/n2n_ntop_v3/.ci/build-project.ps1 +++ /dev/null @@ -1,45 +0,0 @@ -# Build project. -# -# The script assumes that it will be called from inside the project directory. -# -# Usage: .ci\build-project.ps1 [vcpkg-directory [build-directory-name]] -# - vcpkg-directory: Optional full path to Vcpkg directory. Default: $HOME\vcpkg -# - build-directory-name: Optional name of build directory. Default: build. -# Can only be set of vcpkg-directory is set as well. -# -# Example 1: .ci\build-project.ps1 -# Example 2: .ci\build-project.ps1 $HOME\vcpkg-clang -# Example 3: .ci\build-project.ps1 $HOME\vcpkg-clang build-clang - -$ErrorActionPreference="Stop" - -$VCPKG_DIR=$args[0] -$BUILD_DIR=$args[1] - -if ($null -eq $VCPKG_DIR) { $VCPKG_DIR="$HOME\vcpkg" } -if ($null -eq $BUILD_DIR) { $BUILD_DIR="build" } - -# only pass toolchain file to CMake if Vcpkg is installed -if (Test-Path "$VCPKG_DIR" -PathType Container) { - $TOOLCHAIN="$VCPKG_DIR\scripts\buildsystems\vcpkg.cmake" -} else { - $TOOLCHAIN="False" -} - -Write-Host "---- build-project.ps1 ----" -Write-Host "VCPKG_DIR: $VCPKG_DIR" -Write-Host "BUILD_DIR: $BUILD_DIR" -Write-Host "CMAKE_TOOLCHAIN_FILE: $TOOLCHAIN" -Write-Host "---------------------------" - -if (-not (Get-Command cmake -ErrorAction SilentlyContinue)) { - New-Alias -Name cmake -Value "$Env:ProgramFiles\CMake\bin\cmake.exe" -} - -New-Item -Name $BUILD_DIR -ItemType Directory -Push-Location $BUILD_DIR -$ErrorActionPreference = "Stop"; -cmake -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" .. -cmake --build . --config Release -if ($LASTEXITCODE) { Throw "BUILD FAILED!" } -Pop-Location \ No newline at end of file diff --git a/bundles/n2n_ntop_v3/.ci/install-vcpkg.ps1 b/bundles/n2n_ntop_v3/.ci/install-vcpkg.ps1 deleted file mode 100644 index a9f4bc1e..00000000 --- a/bundles/n2n_ntop_v3/.ci/install-vcpkg.ps1 +++ /dev/null @@ -1,38 +0,0 @@ - -# Build Vcpkg and install dependency packages. -# -# Usage: .ci\install-vcpkg.ps1 [vcpkg directory name] -# - project directory: Path to the project sources where the .vcpkg file is located. -# - vcpkg directory name: optional name of directory where Vcpkg will be clone'd into -# -# Example 1: .ci\install-vcpkg.ps1 $Env:GITHUB_WORKSPACE -# Example 2: .ci\install-vcpkg.ps1 $Env:APPVEYOR_BUILD_FOLDER vcpkg-msvc - -$ErrorActionPreference="Stop" - -if ($args.Count -lt 1) { Exit 1 } - -$PROJECT_DIR=$args[0] -$VCPKG_DIR=$args[1] - -if ($null -eq $VCPKG_DIR) { $VCPKG_DIR="vcpkg" } - -# do nothing if .vcpkg file doesn't exist -if (-not (Test-Path "$PROJECT_DIR\.vcpkg" -PathType Leaf)) { Write-Host ".vcpkg file does not exist, skipping Vcpkg installation."; Exit 0 } - -Write-Host "---- install-vcpkg.ps1 ----" -Write-Host "PROJECT_DIR: $PROJECT_DIR" -Write-Host "VCPKG_DIR: $VCPKG_DIR" -Write-Host "---------------------------" - -if (-not (Get-Command git -ErrorAction SilentlyContinue)) { - New-Alias -Name git -Value "$Env:ProgramFiles\Git\bin\git.exe" -} - -Push-Location "$HOME" -git clone --quiet --depth 1 https://github.com/Microsoft/vcpkg.git $VCPKG_DIR -Set-Location $VCPKG_DIR -.\bootstrap-vcpkg.bat -disableMetrics -$packages = Get-Content "$PROJECT_DIR\.vcpkg" -.\vcpkg.exe install --triplet x64-windows $packages -Pop-Location \ No newline at end of file diff --git a/bundles/n2n_ntop_v3/.github/workflows/cmake-linux.yml b/bundles/n2n_ntop_v3/.github/workflows/cmake-linux.yml deleted file mode 100644 index a018a58d..00000000 --- a/bundles/n2n_ntop_v3/.github/workflows/cmake-linux.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -name: CMake - -# yamllint disable-line rule:truthy -on: [push] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - build: - # The CMake configure and build commands are platform agnostic and should - # work equally well on Windows or Mac. You can convert this to a matrix - # build if you need cross-platform coverage. - # yamllint disable-line rule:line-length - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - os: ubuntu-latest - - os: windows-latest - - os: macos-latest - - steps: - - uses: actions/checkout@v2 - - - name: Create Build Environment - # Some projects don't allow in-source building, so create a separate - # build directory. We'll use this as our working directory for all - # subsequent commands - run: cmake -E make_directory ${{github.workspace}}/build - - - name: Configure CMake - # Use a bash shell so we can use the same syntax for environment - # variable access regardless of the host operating system - shell: bash - working-directory: ${{github.workspace}}/build - # Note the current convention is to use the -S and -B options here to - # specify source and build directories, but this is only available - # with CMake 3.13 and higher. The CMake binaries on the Github Actions - # machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE - - - name: Build - working-directory: ${{github.workspace}}/build - shell: bash - # Execute the build. You can specify a specific target - # with "--target " - run: cmake --build . --config $BUILD_TYPE - - - name: Test - working-directory: ${{github.workspace}}/build - shell: bash - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more - # detail - run: ctest -C $BUILD_TYPE diff --git a/bundles/n2n_ntop_v3/.github/workflows/tests.yml b/bundles/n2n_ntop_v3/.github/workflows/tests.yml deleted file mode 100644 index 8b8e8e06..00000000 --- a/bundles/n2n_ntop_v3/.github/workflows/tests.yml +++ /dev/null @@ -1,558 +0,0 @@ ---- -name: Testing - -# yamllint disable-line rule:truthy -on: - push: - pull_request: - -jobs: - smoketest: - name: Smoke test - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Run minimal test set - run: | - ./autogen.sh - ./configure - make test - - lint: - name: Code syntax - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Make the makefiles - run: | - ./autogen.sh - ./configure - - - name: Install essential - run: | - make build-dep - - - name: Run the lint tools - run: | - make lint - - test_linux: - needs: smoketest - name: Test Linux - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: - - ubuntu-20.04 - - ubuntu-18.04 - - steps: - - uses: actions/checkout@v2 - - - name: Install essential - run: | - sudo apt-get update - sudo apt-get install build-essential - - - name: generate a makefile and use it to install more packages - run: | - ./autogen.sh - ./configure - make build-dep - shell: bash - - - name: Run the real configure step - run: | - export CFLAGS="-fprofile-arcs -ftest-coverage" - export LDFLAGS="--coverage" - ./configure --with-zstd - shell: bash - - - name: Run embedded tests - run: make test - shell: bash - - - if: ${{ always() }} - name: Move test outputs to an arch specific location - shell: bash - run: | - mkdir -p tests/${{ matrix.os }} - mv tests/*.out tests/${{ matrix.os }} - - - if: ${{ always() }} - name: Upload tests output - uses: actions/upload-artifact@v2 - with: - name: tests-out - path: tests - - - name: Generate coverage reports - run: | - make gcov - make cover COVERAGEDIR=coverage/${{ matrix.os }} - shell: bash - - - name: Upload gcovr report artifact - uses: actions/upload-artifact@v2 - with: - name: coverage - path: coverage - - - name: Upload data to codecov - uses: codecov/codecov-action@v2 - - test_macos: - needs: smoketest - name: Test MacOS - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: - - macos-10.15 - - macos-11 - - steps: - - uses: actions/checkout@v2 - - - name: Install packages - run: | - brew install automake - - - name: generate a makefile and use it to install more packages - run: | - ./autogen.sh - ./configure - make build-dep - shell: bash - - - name: Run the real configure step - run: | - export CFLAGS="-fprofile-arcs -ftest-coverage" - export LDFLAGS="--coverage" - ./configure --with-zstd - shell: bash - - - name: Run embedded tests - run: make test - shell: bash - - - if: ${{ always() }} - name: Move test outputs to an arch specific location - shell: bash - run: | - mkdir -p tests/${{ matrix.os }} - mv tests/*.out tests/${{ matrix.os }} - - - if: ${{ always() }} - name: Upload tests output - uses: actions/upload-artifact@v2 - with: - name: tests-out - path: tests - - - name: Generate coverage reports - run: | - make gcov - # This was working fine for tens of jobs, up until - # 2021-10-19T18:53+0100 and it still works fine when run from my - # personal github actions. The next run at 2021-10-19T19:08+0100 - # didnt work. - # Assume that they changed something on the runner - I cannot debug - # it as I do not have a Mac. - # - # make cover COVERAGEDIR=coverage/${{ matrix.os }} - shell: bash - - # - name: Upload gcovr report artifact - # uses: actions/upload-artifact@v2 - # with: - # name: coverage - # path: coverage - - - name: Upload data to codecov - uses: codecov/codecov-action@v2 - - test_windows: - needs: smoketest - name: Test Windows - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: - - windows-2016 - - windows-2019 - - windows-2022 - - steps: - - uses: actions/checkout@v2 - - - name: generate a makefile and use it to install more packages - run: | - # This is a pretty big hammer, but gets the windows compile moving - ./scripts/hack_fakeautoconf.sh - make build-dep - shell: bash - - - name: Run a configure step - run: | - export CFLAGS="-fprofile-arcs -ftest-coverage" - export LDFLAGS="--coverage" - ./scripts/hack_fakeautoconf.sh - shell: bash - - - name: Run embedded tests - run: make test - shell: bash - - - if: ${{ always() }} - name: Move test outputs to an arch specific location - shell: bash - run: | - mkdir -p tests/${{ matrix.os }} - mv tests/*.out tests/${{ matrix.os }} - - - if: ${{ always() }} - name: Upload tests output - uses: actions/upload-artifact@v2 - with: - name: tests-out - path: tests - - - name: Generate coverage data - run: | - make gcov - shell: bash - - - name: Upload data to codecov - uses: codecov/codecov-action@v2 - - package_dpkg: - name: Package for Debian/Ubuntu - needs: - - test_linux - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - arch: - - amd64 - - arm64 - - armhf - - i386 - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Fix Checkout - run: | - git fetch --force --tags - - - name: Install packages needed for build - run: | - sudo apt-get update - sudo apt-get install debhelper build-essential \ - crossbuild-essential-${{ matrix.arch }} - - - name: Configure - # The HOST_TRIPLET line is not easily foldable - # yamllint disable rule:line-length - run: | - # This will warn about CC, but we cannot set CC until we run it :-S - HOST_TRIPLET=$(dpkg-architecture -a${{ matrix.arch }} -q DEB_HOST_GNU_TYPE) - export CC=$HOST_TRIPLET-gcc - export AR=$HOST_TRIPLET-ar - ./autogen.sh - ./configure --host $HOST_TRIPLET - cd packages/debian/ - ./configure EXTN=${{ matrix.arch }} - # yamllint enable rule:line-length - - - name: Build - run: | - cd packages/debian/ - make - - - name: Upload dpkg - uses: actions/upload-artifact@v2 - with: - name: packages-dpkg - path: packages/debian/*.deb - - package_rpm: - name: Package for Redhat/RPM - needs: - - test_linux - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Fix Checkout - run: | - git fetch --force --tags - - - name: Install packages needed for build - run: | - sudo apt-get install rpm - - - name: Configure - run: | - ./autogen.sh - ./configure - cd packages/rpm/ - ./configure - - - name: Build - run: | - make - HOME=$(pwd)/../ - cd packages/rpm/ - make - cd ../../ - mv ../rpmbuild ./ - - - name: Upload rpm - uses: actions/upload-artifact@v2 - with: - name: packages-rpm - path: rpmbuild/RPMS/x86_64/*.rpm - - binaries_windows: - name: Binaries for Windows (x86_64-pc-mingw64) - needs: - - test_windows - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - - name: Fix Checkout - run: | - git fetch --force --tags - - - name: Configure and Build - shell: bash - run: | - ./scripts/hack_fakeautoconf.sh - make - - - name: Create binary dir - shell: bash - run: | - make install DESTDIR=binaries/x86_64-pc-mingw64 - - - name: Upload binary artifacts - uses: actions/upload-artifact@v2 - with: - name: binaries - path: binaries - - binaries_macos: - name: Binaries for MacOS - needs: - - test_macos - runs-on: macos-latest - strategy: - fail-fast: true - matrix: - arch: - - x86_64-apple-macos - - arm64-apple-macos - - steps: - - uses: actions/checkout@v2 - - - name: Fix Checkout - run: | - git fetch --force --tags - - - name: Install packages needed for build - run: | - brew install automake - - - name: Configure and Build - shell: bash - run: | - # this is a hack! it assumes the default SDK is the 'right' one - export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk - ./autogen.sh - export CC=clang - export CFLAGS="-target ${{ matrix.arch }}" - export LDFLAGS="-target ${{ matrix.arch }}" - ./configure --host=${{ matrix.arch }} - make - - - if: ${{ failure() }} - name: Upload config.log output - uses: actions/upload-artifact@v2 - with: - name: config-log-${{ matrix.arch }} - path: config.log - - - name: Create binary dir - shell: bash - run: | - make install DESTDIR=binaries/${{ matrix.arch }} - - - name: Upload binary artifacts - uses: actions/upload-artifact@v2 - with: - name: binaries - path: binaries - - binaries_macos_universal: - name: Binaries for MacOS (universal arch) - needs: - - test_macos - runs-on: macos-latest - - steps: - - uses: actions/checkout@v2 - - - name: Fix Checkout - run: | - git fetch --force --tags - - - name: Install packages needed for build - run: | - brew install automake - - - name: Configure and Build - shell: bash - run: | - # this is a hack! it assumes the default SDK is the 'right' one - export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk - ./autogen.sh - export CC=clang - export CFLAGS="-arch x86_64 -arch arm64" - export LDFLAGS="-arch x86_64 -arch arm64" - ./configure - make - - - name: Create binary dir - shell: bash - run: | - make install DESTDIR=binaries/universal-apple-darwin - - - name: Upload binary artifacts - uses: actions/upload-artifact@v2 - with: - name: binaries - path: binaries - - binaries_linux_crosscompile: - name: Binaries for linux - needs: - - test_linux - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - arch: - - arm-linux-gnueabi - - # I assume these architectures produce working code, but this has - # not been directly confirmed. - # They are compiled dynamically against normal libc, so will not - # work on openwrt. - - aarch64-linux-gnu - - mips-linux-gnu - - mipsel-linux-gnu - - steps: - - uses: actions/checkout@v2 - - - name: Fix Checkout - run: | - git fetch --force --tags - - - name: Install cross compiler - run: | - sudo apt-get update - sudo apt-get install \ - binutils-${{ matrix.arch }} \ - gcc-${{ matrix.arch }} - - - name: Configure and Build - shell: bash - run: | - ./autogen.sh - export CC=${{ matrix.arch }}-gcc - export AR=${{ matrix.arch }}-ar - ./configure --host ${{ matrix.arch }} - make - - - name: Create binary dir - shell: bash - run: | - make install DESTDIR=binaries/${{ matrix.arch }} - - - name: Upload binary artifacts - uses: actions/upload-artifact@v2 - with: - name: binaries - path: binaries - - # Given the clearly documented use of annotated tags to signal releases, - # it seems strange that there is no simple way to trigger actions if the - # tag is annotated. So we need to jump through some extra hoops. - # - # Looking at https://github.com/actions/checkout/issues/290 seems to show - # that github just doesnt care about how git expects annotated tags to be - # used. - # - # This workflow has added a `git fetch --force --tags` to every job that - # needs to have working tags - - upload_release: - name: Upload Release Assets - if: startsWith(github.ref, 'refs/tags/') - needs: - - package_dpkg - - package_rpm - - binaries_windows - - binaries_macos - - binaries_macos_universal - - binaries_linux_crosscompile - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Fix Checkout - run: | - git fetch --force --tags - - - name: Get Tag Type - id: get_tagtype - run: | - TYPE=$(git cat-file -t $GITHUB_REF) - echo "::set-output name=TAGTYPE::$TYPE" - echo ========== - echo REF=$GITHUB_REF - echo TAGTYPE=$TYPE - - - name: Fetch all Artifacts - if: steps.get_tagtype.outputs.TAGTYPE == 'tag' - uses: actions/download-artifact@v2 - with: - path: artifacts - - - name: Upload Assets to Release - if: steps.get_tagtype.outputs.TAGTYPE == 'tag' - uses: softprops/action-gh-release@v1 - with: - prerelease: true - files: | - artifacts/packages-dpkg/*.deb - artifacts/packages-rpm/*.rpm diff --git a/bundles/n2n_ntop_v3/.gitignore b/bundles/n2n_ntop_v3/.gitignore deleted file mode 100644 index ae2b1427..00000000 --- a/bundles/n2n_ntop_v3/.gitignore +++ /dev/null @@ -1,52 +0,0 @@ -*.o -*.a -*.gz -configure -configure.ac -config.* -/Makefile -tools/Makefile -autom4te.cache -edge -example_edge_embed_quick_edge_init -example_edge_embed -example_sn_embed -supernode -tools/n2n-benchmark -tools/n2n-decode -tools/n2n-keygen -build -.idea -cmake-build-default -packages/debian/debian/changelog -packages/debian/debian/control -packages/debian/debian/files -packages/debian/debian/rules -packages/etc/systemd/system/edge-ntopng@.service -packages/etc/systemd/system/edge.service -packages/etc/systemd/system/edge@.service -packages/etc/systemd/system/supernode.service -*dSYM* - -cmake-build-*/ - -# Binaries built to run tests -tools/tests-compress -tools/tests-elliptic -tools/tests-hashing -tools/tests-transform -tools/tests-wire - -# Files generated while running tests -tests/*.out - -# Files generated while running coverage reports -*.gcno -*.gcda -*.gcov -coverage/ - -# Files generated while running linting -*.indent -*.unc-backup.md5~ -*.unc-backup~ diff --git a/bundles/n2n_ntop_v3/.travis.yml b/bundles/n2n_ntop_v3/.travis.yml deleted file mode 100644 index 08d9211d..00000000 --- a/bundles/n2n_ntop_v3/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -language: c++ -dist: xenial - -compiler: - - clang - - gcc - -install: - - sudo apt-get update || true - - sudo apt-get install build-essential - -before_script: - - git clone https://github.com/ntop/n2n.git; cd n2n; ./autogen.sh; make; cd .. - - ./autogen.sh - -script: - - ./configure - - make - -notifications: - email: - recipients: - - deri@ntop.org - on_success: never - on_failure: always diff --git a/bundles/n2n_ntop_v3/.yamllint.yml b/bundles/n2n_ntop_v3/.yamllint.yml deleted file mode 100644 index b54dd76d..00000000 --- a/bundles/n2n_ntop_v3/.yamllint.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -extends: default - -rules: - # 80 chars should be enough, but don't fail if a line is longer - line-length: - max: 80 - level: warning diff --git a/bundles/n2n_ntop_v3/CHANGELOG.md b/bundles/n2n_ntop_v3/CHANGELOG.md deleted file mode 100644 index 3893fcc0..00000000 --- a/bundles/n2n_ntop_v3/CHANGELOG.md +++ /dev/null @@ -1,89 +0,0 @@ -# Changelog - -## n2n 2.8 (August 2020) - -This release brings significant new features to n2n's crypto world and offers -some compression opportunities. The added support for routing table manipulation -might increase comfort. Besides further honing existing features, this release -addresses some bugs. - -### New Features - -* Two lightweight stream ciphers: ChaCha20 (optional, through OpenSSL) & SPECK (integrated) -* Full Header Encryption (including packet checksumming as well as replay protection) -* A callback interface to better integrate n2n in third party software (you can still use it stand-alone) -* Enable the integrated LZO1x compression -* Add optional ZSTD compression (through zstdlib) -* Support for changing system routes at program start and end -* User and group id parameter for supernode -* Application of cryptography in n2n is seperately documented -* Add a new pseudo random number generator with higher periodicity seeded with more entropy if available - -### Improvements - -* Have AES and ChaCha20 use OpenSSL's `evp_*` interface to make better use of available hardware acceleration -* Fix invalid sendto when supernode name resolution fails -* Update to supernode's purge logic -* Extended management supernode's port output -* Fix read tap device failed when OS wakes up from sleep -* Free choice of supernode's management UDP port (for multiple supernodes on one machine) -* Additional trace messages to better indicate established connections and connection type -* Fix edge's register-to-supernode loop -* Remove redundant code -* Restructure the code in directories -* Clean-up platform-dependant code -* Compile fixes for Windows -* Fix build warnings -* …and many more under-the-hood fixes and tunings - -## n2n 2.6 (March 2020) - -The 2.6 release is mostly a maintenance release to address the issues -of 2.4 that has been the first release since a long time of silence. - -### New Features - -* AES encryption that features an overall speed bump (12x speed) and security with respect to Twofish used in the previous n2n version -* Add ability to specify a whitelist of allowed communities on the supernode -* Implement local peers discovery via multicast -* Full peer-to-peer topology support. -* Add support for multiple edge systemd services -* Add benchmark tool for the encryption throughput -* Implement packet stats for P2P vs supernode communication -* Automatically drop privileges to user n2n -* Add support for ARM64 build -* More options to control MTU, P2P connections, TOS and log verbosity -* Implement a wireshark dissector for the n2n protocol -* Implement n2n-decode utility to decode and dump traffic to PCAP - - -### Improvements -* Extensive Windows and OpenWRT support. -* Windows compilation fixes and instructions -* Instructions and makefile file to build n2n on OpenWRT -* MacOS compilation fixes and instructions -* Improve the connection stability and the chances to establish a P2P connection -* Stable and more resilient connection. -* Remove keyschedule support to simplify the encryption code -* Replace peers linked list with hash table for faster lookup in big networks -* Integrate the changes made in the meyerd fork of n2n -* Remove calls to system() in tuntap_linux and use netlink instead -* n2n version improvements - -## n2n 2.4 (August 2018) - -This is the first release after 2012 and thus it is focusing mainly -on making it work on current operating system versions, so that the -next release will be based on modern code. - -### New Features -* Added deb/rpm packages -* Added systemd configuration files -* Added ability to read configuration files instead of using only the CLI (needed for packaging) -* Added n2n Android app -* Implemented simple API to embed n2n in applications (in addition to use it stand-alone) - -### Improvements -* Major code cleanup -* Fixed compilation issues on MacOS -* Fixed Linux segmentation fault diff --git a/bundles/n2n_ntop_v3/CMakeLists.txt b/bundles/n2n_ntop_v3/CMakeLists.txt deleted file mode 100644 index f7249740..00000000 --- a/bundles/n2n_ntop_v3/CMakeLists.txt +++ /dev/null @@ -1,276 +0,0 @@ -project(n2n) -cmake_minimum_required(VERSION 2.6) -include(CheckFunctionExists) -SET(CMAKE_VERBOSE_MAKEFILE ON) - -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - -# N2n release information -set(N2N_VERSION "3.0.0") -set(N2N_OSNAME ${CMAKE_SYSTEM_NAME}) -execute_process( - COMMAND git status - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE GIT_OUTPUT - RESULT_VARIABLE GIT_ERROR_CODE -) -if (GIT_ERROR_CODE EQUAL 0) -execute_process( - COMMAND git rev-list --count HEAD - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE GIT_REV -) -execute_process( - COMMAND git rev-parse --short HEAD - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE GIT_ID -) -string(REGEX REPLACE "\n$" "" GIT_REV "${GIT_REV}") -string(REGEX REPLACE "\n$" "" GIT_ID "${GIT_ID}") -set(N2N_VERSION "${N2N_VERSION}.r${GIT_REV}.${GIT_ID}") -MESSAGE(STATUS "Build from git rev: ${N2N_VERSION}") -endif (GIT_ERROR_CODE EQUAL 0) - -add_definitions(-DCMAKE_BUILD) -add_definitions(-DGIT_RELEASE="${N2N_VERSION}" -DPACKAGE_VERSION="${N2N_VERSION}" -DPACKAGE_OSNAME="${N2N_OSNAME}") -add_definitions(-DN2N_VERSION="${N2N_VERSION}" -DN2N_OSNAME="${N2N_OSNAME}") - - -# Build information -OPTION(BUILD_SHARED_LIBS "BUILD Shared Library" OFF) - -# N2n specific params -OPTION(N2N_OPTION_USE_PTHREAD "USE PTHREAD Library" ON) -OPTION(N2N_OPTION_USE_OPENSSL "USE OPENSSL Library" OFF) -OPTION(N2N_OPTION_USE_PCAPLIB "USE PCAP Library" OFF) -OPTION(N2N_OPTION_USE_ZSTD "USE ZSTD Library" OFF) - - -if(N2N_OPTION_USE_PTHREAD) - find_library(PTHREAD_LIB pthread) - if(PTHREAD_LIB) - ADD_DEFINITIONS("-DHAVE_PTHREAD") - else() - MESSAGE(WARNING "libpthread not found.") - set(N2N_OPTION_USE_PTHREAD OFF) - endif(PTHREAD_LIB) -endif(N2N_OPTION_USE_PTHREAD) - -if(NOT DEFINED N2N_OPTION_USE_OPENSSL) -set(N2N_OPTION_USE_OPENSSL OFF) -endif(NOT DEFINED N2N_OPTION_USE_OPENSSL) - -if(N2N_OPTION_USE_OPENSSL) - find_package(OpenSSL QUIET) - if(NOT OPENSSL_FOUND) - MESSAGE(WARNING "OpenSSL not found, Use built-in AES.") - set(N2N_OPTION_USE_OPENSSL OFF) - else() - MESSAGE(STATUS "Found OpenSSL ${OPENSSL_VERSION}") - string(COMPARE GREATER "${OPENSSL_VERSION}" "1.1" OPENSSL_V11) - if(OPENSSL_V11) - MESSAGE(STATUS "Use OpenSSL With -DHAVE_OPENSSL_1_1") - include_directories(${OPENSSL_INCLUDE_DIR}) - add_definitions(-DHAVE_OPENSSL_1_1) - endif() - endif(NOT OPENSSL_FOUND) -endif(N2N_OPTION_USE_OPENSSL) - -if(N2N_OPTION_USE_ZSTD) - add_definitions(-DN2N_HAVE_ZSTD) -endif(N2N_OPTION_USE_ZSTD) - -if(NOT DEFINED CMAKE_BUILD_TYPE) -set(CMAKE_BUILD_TYPE None) -endif(NOT DEFINED CMAKE_BUILD_TYPE) -#set(CMAKE_BUILD_TYPE Debug) -#set(CMAKE_BUILD_TYPE Release) - -if (DEFINED UNIX) -# None -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs") -set(CMAKE_CXX_FLAGS "-Wall -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs") -# Debug -set(CMAKE_C_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -# Release -set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") -set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") -endif(DEFINED UNIX) - -# Static target. -#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static") - - -INCLUDE_DIRECTORIES(.) -INCLUDE_DIRECTORIES(include) -if(DEFINED WIN32) - INCLUDE_DIRECTORIES(win32) -# Customize include. -# INCLUDE_DIRECTORIES("D:/Program Files/MinGW/opt/include/" "D:/Program Files/MinGW/x86_64-w64-mingw32/include/") -# Customize library. -# LINK_DIRECTORIES("D:/Program Files/MinGW/opt/lib/" "D:/Program Files/MinGW/x86_64-w64-mingw32/lib/") -endif(DEFINED WIN32) - - -#aux_source_directory(./src N2N_DIR_SRCS) -#add_library(n2n STATIC ${N2N_DIR_SRCS}) -add_library(n2n STATIC - src/n2n.c - src/edge_management.c - src/edge_utils.c - src/sn_management.c - src/sn_utils.c - src/wire.c - src/hexdump.c - src/minilzo.c - src/tf.c - src/cc20.c - src/transform_null.c - src/transform_tf.c - src/transform_aes.c - src/transform_cc20.c - src/transform_speck.c - src/aes.c - src/speck.c - src/random_numbers.c - src/pearson.c - src/header_encryption.c - src/tuntap_freebsd.c - src/tuntap_netbsd.c - src/tuntap_linux.c - src/tuntap_osx.c - src/n2n_regex.c - src/network_traffic_filter.c - src/sn_selection.c - src/auth.c - src/curve25519.c) - - -if(N2N_OPTION_USE_PTHREAD) - target_link_libraries(n2n pthread) -endif(N2N_OPTION_USE_PTHREAD) - -if(N2N_OPTION_USE_OPENSSL) -# target_link_libraries(n2n crypto) - target_link_libraries(n2n ${OPENSSL_LIBRARIES}) -endif(N2N_OPTION_USE_OPENSSL) - -if(N2N_OPTION_USE_ZSTD) - target_link_libraries(n2n zstd) -endif(N2N_OPTION_USE_ZSTD) - -if(DEFINED WIN32) - add_library(edge_utils_win32 src/edge_utils_win32.c) - add_subdirectory(win32) - target_link_libraries(n2n edge_utils_win32 n2n_win32 iphlpapi) -endif(DEFINED WIN32) - -add_executable(edge src/edge.c) -target_link_libraries(edge n2n) - -add_executable(supernode src/supernode.c) -target_link_libraries(supernode n2n) - -add_executable(example_edge_embed_quick_edge_init src/example_edge_embed_quick_edge_init.c) -target_link_libraries(example_edge_embed_quick_edge_init n2n) - -add_executable(example_edge_embed src/example_edge_embed.c) -target_link_libraries(example_edge_embed n2n) - -add_executable(example_sn_embed src/example_sn_embed.c) -target_link_libraries(example_sn_embed n2n) - -if(N2N_OPTION_USE_PCAPLIB AND (NOT DEFINED WIN32)) - # Linux Capabilities - find_library(CAP_LIB cap) - if(CAP_LIB) - target_link_libraries(edge cap.a) - set(CMAKE_REQUIRED_LIBRARIES ${CAP_LIB}) - ADD_DEFINITIONS("-DHAVE_LIBCAP") - endif() -endif(N2N_OPTION_USE_PCAPLIB AND (NOT DEFINED WIN32)) - -install(TARGETS edge supernode - RUNTIME DESTINATION sbin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - ) - - -# Tools -add_executable(n2n-benchmark tools/n2n-benchmark.c) -target_link_libraries(n2n-benchmark n2n) -add_executable(n2n-keygen tools/n2n-keygen.c) -target_link_libraries(n2n-keygen n2n) - -add_executable(tests-compress tools/tests-compress.c) -target_link_libraries(tests-compress n2n) -add_executable(tests-elliptic tools/tests-elliptic.c) -target_link_libraries(tests-elliptic n2n) -add_executable(tests-hashing tools/tests-hashing.c) -target_link_libraries(tests-hashing n2n) -add_executable(tests-transform tools/tests-transform.c) -target_link_libraries(tests-transform n2n) -add_executable(tests-wire tools/tests-wire.c) -target_link_libraries(tests-wire n2n) - -if(N2N_OPTION_USE_PCAPLIB) - find_library(PCAP_LIB pcap) - if(PCAP_LIB) - add_executable(n2n-decode tools/n2n-decode.c) - target_link_libraries(n2n-decode n2n pcap) - install(TARGETS n2n-decode RUNTIME DESTINATION bin) - - set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIB}) - check_function_exists(pcap_set_immediate_mode HAVE_PCAP_IMMEDIATE_MODE) - IF(HAVE_PCAP_IMMEDIATE_MODE) - ADD_DEFINITIONS("-DHAVE_PCAP_IMMEDIATE_MODE") - ENDIF(HAVE_PCAP_IMMEDIATE_MODE) - endif(PCAP_LIB) -endif(N2N_OPTION_USE_PCAPLIB) - -install(TARGETS n2n-benchmark RUNTIME DESTINATION bin) - -# Documentation -if(DEFINED UNIX) -add_dependencies(n2n doc) -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/doc) -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/edge.8.gz - COMMAND gzip -c ${PROJECT_SOURCE_DIR}/edge.8 > ${PROJECT_BINARY_DIR}/doc/edge.8.gz - DEPENDS ${PROJECT_SOURCE_DIR}/edge.8 - ) - -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - COMMAND gzip -c ${PROJECT_SOURCE_DIR}/supernode.1 > ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - DEPENDS ${PROJECT_SOURCE_DIR}/supernode.1 - ) - -add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - COMMAND gzip -c ${PROJECT_SOURCE_DIR}/n2n.7 > ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - DEPENDS ${PROJECT_SOURCE_DIR}/n2n.7 - ) - -add_custom_target(doc DEPENDS ${PROJECT_BINARY_DIR}/doc/edge.8.gz - ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - ) - -set_source_files_properties(${PROJECT_BINARY_DIR}/doc/edge.8.gz - ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - PROPERTIES GENERATED 1) - -install(FILES ${PROJECT_BINARY_DIR}/doc/edge.8.gz - DESTINATION /usr/share/man/man8) -install(FILES ${PROJECT_BINARY_DIR}/doc/supernode.1.gz - DESTINATION /usr/share/man/man1) -install(FILES ${PROJECT_BINARY_DIR}/doc/n2n.7.gz - DESTINATION /usr/share/man/man7) - -# TODO: -# - Add the right dependancy so that the tests binaries get built first -enable_testing() -add_test(tests ${PROJECT_SOURCE_DIR}/scripts/test_harness.sh ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tests) - -endif(DEFINED UNIX) diff --git a/bundles/n2n_ntop_v3/COPYING b/bundles/n2n_ntop_v3/COPYING deleted file mode 100644 index b33b35d0..00000000 --- a/bundles/n2n_ntop_v3/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - n2n Copyright (C) 2007-08 Luca Deri - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/bundles/n2n_ntop_v3/INSTALL b/bundles/n2n_ntop_v3/INSTALL deleted file mode 100644 index 22000326..00000000 --- a/bundles/n2n_ntop_v3/INSTALL +++ /dev/null @@ -1,50 +0,0 @@ -INSTALL - -To build the programs: - -$ make - -To install the programs and man pages: - -$ make install - -or - -$ make PREFIX=/usr/local install - - -RPM Package ------------ - -These steps should work with RPM based Linux distributions since rpmbuild was -split from the rpm utility (c RedHat 9). - - -To build an RPM the easy way follow these steps. - -1. Build SRPM - -$ cd n2n -$ scripts/mk_SRPM.sh - -Look for where the src.rpm file was put ( "Wrote:" ). - -2. Build binary RPM from SRPM - -$ rpm -i path/to/n2n-.src.rpm -$ rpmbuild -bb n2n.spec - - -All this can be done as non-root user if you have a ~/.rpmmacros file with this -line in it: - -%_topdir /home/username/rpmtopdir - - -To build an RPM the hard way follow these steps. - -$ cp -a n2ndir n2n-2.0 -$ tar czf n2n-2.0.tar.gz n2n-2.0 -$ mv n2n-2.0.tar.gz /usr/src/redhat/SOURCES -$ cp n2ndir/n2n.spec /usr/src/redhat/SPECS -$ rpmbuild -bb n2n.spec diff --git a/bundles/n2n_ntop_v3/LICENSE b/bundles/n2n_ntop_v3/LICENSE deleted file mode 100644 index 9cecc1d4..00000000 --- a/bundles/n2n_ntop_v3/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/bundles/n2n_ntop_v3/Makefile.in b/bundles/n2n_ntop_v3/Makefile.in deleted file mode 100644 index 61d16273..00000000 --- a/bundles/n2n_ntop_v3/Makefile.in +++ /dev/null @@ -1,284 +0,0 @@ - -# NOTE: these are needed by the configure.in inside the packages folder -N2N_VERSION_SHORT=@N2N_VERSION_SHORT@ -GIT_COMMITS=@GIT_COMMITS@ -GIT_DESCRIBE=$(shell git describe --always --dirty) - -######## - -export CC -export AR -CC=@CC@ -AR=@AR@ - -#Ultrasparc64 users experiencing SIGBUS should try the following gcc options -#(thanks to Robert Gibbon) -PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finline-functions -fweb -frename-registers -mapp-regs - -export CFLAGS -export LDFLAGS - -CFLAGS=@CFLAGS@ -I ./include -LDFLAGS=@LDFLAGS@ -L . - -OPENSSL_CFLAGS=$(shell pkg-config openssl; echo $$?) -ifeq ($(OPENSSL_CFLAGS), 0) - CFLAGS+=$(shell pkg-config --cflags-only-I openssl) -endif - -WARN=-Wall -CFLAGS+=$(DEBUG) $(OPTIMIZATION) $(WARN) $(OPTIONS) $(PLATOPTS) - -# Quick sanity check on our build environment -UNAME_S := $(shell uname -s) -ifndef UNAME_S -# This could happen if the Makefile is unable to run "uname", which can -# happen if the shell has a bad path (or is the wrong shell) -$(error Could not run uname command, cannot continue) -endif - -# Any compile environment that needs different flags, libraries, includes or -# other settings will get its own CONFIG_TARGET value. For cross compiling, -# this might be set externally to the Makefile, but if not set we try to -# set a reasonable default. - -export CONFIG_TARGET -ifndef CONFIG_TARGET -ifeq ($(shell uname -o),Msys) -CONFIG_TARGET=mingw -else ifeq ($(shell uname -s),Darwin) -CONFIG_TARGET=darwin -else ifeq ($(shell uname), SunOS) -CONFIG_TARGET=sunos -else -CONFIG_TARGET=generic -endif -endif - -export MKDIR -export INSTALL -export INSTALL_PROG -export INSTALL_DOC -export SBINDIR - -MKDIR=mkdir -p -INSTALL=install -INSTALL_PROG=$(INSTALL) -m755 -INSTALL_DOC=$(INSTALL) -m644 - -# DESTDIR set in debian make system -PREFIX?=$(DESTDIR)/usr -ifeq ($(CONFIG_TARGET),darwin) -SBINDIR=$(PREFIX)/local/sbin -else -SBINDIR=$(PREFIX)/sbin -endif - -MANDIR?=$(PREFIX)/share/man -MAN1DIR=$(MANDIR)/man1 -MAN7DIR=$(MANDIR)/man7 -MAN8DIR=$(MANDIR)/man8 - -N2N_LIB=libn2n.a -N2N_OBJS=$(patsubst src/%.c, src/%.o, $(wildcard src/*.c)) -N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) Makefile - -# As source files pass the linter, they can be added here (If all the source -# is passing the linter tests, this can be refactored) -LINT_CCODE=\ - include/edge_utils_win32.h \ - include/n2n_define.h \ - include/pearson.h \ - include/speck.h \ - src/edge_utils_win32.c \ - src/example_edge_embed_quick_edge_init.c \ - src/header_encryption.c \ - src/sn_selection.c \ - src/transform_cc20.c \ - src/tuntap_linux.c \ - src/wire.c \ - tools/tests-compress.c \ - tools/tests-elliptic.c \ - tools/tests-hashing.c \ - tools/tests-transform.c \ - tools/tests-wire.c \ - -export LDLIBS - -LDLIBS+=-ln2n -LDLIBS+=@N2N_LIBS@ - -#For OpenSolaris (Solaris too?) -ifeq ($(CONFIG_TARGET), sunos) -LDLIBS+=-lsocket -lnsl -endif - -ifeq ($(CONFIG_TARGET),mingw) -CFLAGS+=-I. -I./win32 -DWIN32 -LDLIBS+=$(abspath win32/n2n_win32.a) -LDLIBS+=-lws2_32 -liphlpapi -N2N_DEPS+=win32/n2n_win32.a -SUBDIRS+=win32 -endif - -APPS=edge -APPS+=supernode -APPS+=example_edge_embed_quick_edge_init -APPS+=example_edge_embed -APPS+=example_sn_embed - -DOCS=edge.8.gz supernode.1.gz n2n.7.gz - -# This is the superset of all packages that might be needed during the build. -# Mostly of use in automated build systems. -BUILD_DEP:=\ - autoconf \ - build-essential \ - flake8 \ - gcovr \ - libcap-dev \ - libzstd-dev \ - shellcheck \ - uncrustify \ - yamllint \ - -SUBDIRS+=tools - -COVERAGEDIR?=coverage - -.PHONY: $(SUBDIRS) -.PHONY: steps build push all clean distclean install test cover gcov build-dep -.PHONY: lint lint.python lint.ccode lint.shell lint.yaml - -all: $(APPS) $(DOCS) $(SUBDIRS) - -tools: $(N2N_LIB) - $(MAKE) -C $@ - -win32: - $(MAKE) -C $@ - -src/edge.o: $(N2N_DEPS) -src/supernode.o: $(N2N_DEPS) -src/example_edge_embed_quick_edge_init.o: $(N2N_DEPS) -src/example_sn_embed.o: $(N2N_DEPS) -src/example_edge_embed.o: $(N2N_DEPS) - -src/edge: $(N2N_LIB) -src/supernode: $(N2N_LIB) -src/example_edge_embed_quick_edge_init: $(N2N_LIB) -src/example_sn_embed: $(N2N_LIB) -src/example_edge_embed: $(N2N_LIB) - -%: src/% - cp $< $@ - -%.gz : % - gzip -c $< > $@ - -$(N2N_LIB): $(N2N_OBJS) - $(AR) rcs $(N2N_LIB) $(N2N_OBJS) -# $(RANLIB) $@ - -win32/n2n_win32.a: win32 - -test: tools - scripts/test_harness.sh - -lint: lint.python lint.ccode lint.shell lint.yaml - -lint.python: - flake8 scripts/n2n-ctl scripts/n2n-httpd - -lint.ccode: - scripts/indent.sh $(LINT_CCODE) - -lint.shell: - shellcheck scripts/*.sh - -lint.yaml: - yamllint . - -# To generate coverage information, run configure with -# CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="--coverage" -# and run the desired tests. Ensure that package gcovr is installed -# and then run "make cover" -cover: - mkdir -p $(COVERAGEDIR) - gcovr -s --html --html-details --output=$(COVERAGEDIR)/index.html - -# Use coverage data to generate gcov text report files. -# Unfortunately, these end up in the wrong directory due to the -# makefile layout -# The steps to use this are similar to the "make cover" above -gcov: - gcov $(N2N_OBJS) - $(MAKE) -C tools gcov - -# This is a convinent target to use during development or from a CI/CD system -build-dep: -ifeq ($(CONFIG_TARGET),generic) - sudo apt install $(BUILD_DEP) -else ifeq ($(CONFIG_TARGET),darwin) - brew install automake gcovr -else - echo Not attempting to install dependancies for system $(CONFIG_TARGET) -endif - -clean: - rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) $(COVERAGEDIR)/ *.dSYM *~ - rm -f tests/*.out src/*.gcno src/*.gcda - for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done - -distclean: - rm -f tests/*.out src/*.gcno src/*.gcda src/*.indent src/*.unc-backup* - rm -rf autom4te.cache/ - rm -f config.log config.status configure configure.ac Makefile tools/Makefile include/config.h include/config.h.in - rm -f doc/edge.8.gz doc/n2n.7.gz doc/supernode.1.gz - rm -f $(addprefix src/,$(APPS)) - -install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz - echo "MANDIR=$(MANDIR)" - $(MKDIR) $(SBINDIR) $(MAN1DIR) $(MAN7DIR) $(MAN8DIR) - $(INSTALL_PROG) supernode $(SBINDIR)/ - $(INSTALL_PROG) edge $(SBINDIR)/ - $(INSTALL_DOC) edge.8.gz $(MAN8DIR)/ - $(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/ - $(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/ - $(MAKE) -C tools install SBINDIR=$(abspath $(SBINDIR)) - -# Docker builder section -DOCKER_IMAGE_NAME=ntop/supernode -DOCKER_IMAGE_VERSION=$N2N_VERSION_SHORT -N2N_COMMIT_HASH=@GIT_REVISION@ - -default: steps - -steps: - if [ "$(TARGET_ARCHITECTURE)" = "arm32v7" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.arm32v7" DOCKER_IMAGE_TAGNAME=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-arm32v7 make build; fi - if [ "$(TARGET_ARCHITECTURE)" = "x86_64" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.x86_64" DOCKER_IMAGE_TAGNAME=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-x86_64 make build; fi - -build: - $(eval OS := $(shell uname -s)) - $(eval ARCHITECTURE := $(shell export DOCKER_IMAGE_TAGNAME="$(DOCKER_IMAGE_TAGNAME)"; echo $$DOCKER_IMAGE_TAGNAME | grep -oe -.*)) - - docker build --target builder --build-arg COMMIT_HASH=$(N2N_COMMIT_HASH) -t $(DOCKER_IMAGE_TAGNAME) -f image-platforms/$(DOCKER_IMAGE_FILENAME) . - - docker container create --name builder $(DOCKER_IMAGE_TAGNAME) - if [ ! -d "./build" ]; then mkdir ./build; fi - docker container cp builder:/usr/src/n2n/supernode ./build/supernode-$(OS)$(ARCHITECTURE) - docker container cp builder:/usr/src/n2n/edge ./build/edge-$(OS)$(ARCHITECTURE) - docker container rm -f builder - - docker build --build-arg COMMIT_HASH=$(N2N_COMMIT_HASH) -t $(DOCKER_IMAGE_TAGNAME) -f image-platforms/$(DOCKER_IMAGE_FILENAME) . - docker tag $(DOCKER_IMAGE_TAGNAME) $(DOCKER_IMAGE_NAME):latest$(ARCHITECTURE) - -push: - if [ ! "$(TARGET_ARCHITECTURE)" = "" ]; then \ - docker push $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-$(TARGET_ARCHITECTURE); \ - docker push $(DOCKER_IMAGE_NAME):latest-$(TARGET_ARCHITECTURE); \ - else \ - echo "Please pass TARGET_ARCHITECTURE, see README.md."; \ - fi - -# End Docker builder section diff --git a/bundles/n2n_ntop_v3/README.md b/bundles/n2n_ntop_v3/README.md deleted file mode 100644 index de454027..00000000 --- a/bundles/n2n_ntop_v3/README.md +++ /dev/null @@ -1,120 +0,0 @@ -[![Build Status](https://travis-ci.org/ntop/n2n.png?branch=dev)](https://travis-ci.org/ntop/n2n) - - -# n2n - -n2n is a light VPN software which makes it easy to create virtual networks bypassing intermediate firewalls. - -In order to start using n2n, two elements are required: - -- A _supernode_: it allows edge nodes to announce and discover other nodes. It must have a port publicly accessible on internet. -- _edge_ nodes: the nodes which will be a part of the virtual networks - -A virtual network shared between multiple edge nodes in n2n is called a _community_. A single supernode can relay multiple communities and a single computer can be part of multiple communities at the same time. An encryption key can be used by the edge nodes to encrypt the packets within their community. - -n2n tries to establish a direct peer-to-peer connection via udp between the edge nodes when possible. When this is not possible (usually due to special NAT devices), the supernode is also used to relay the packets. - - -## Quick Setup - -Some Linux distributions already provide n2n as a package so a simple `sudo apt install n2n` will do the work. Alternatively, up-to-date packages for most distributions are available on [ntop repositories](http://packages.ntop.org/). - -On host1 run: - -```sh -$ sudo edge -c mynetwork -k mysecretpass -a 192.168.100.1 -f -l supernode.ntop.org:7777 -``` - -On host2 run: - -```sh -$ sudo edge -c mynetwork -k mysecretpass -a 192.168.100.2 -f -l supernode.ntop.org:7777 -``` - -Now the two hosts can ping each other. - -**IMPORTANT** It is strongly advised to choose a custom community name (`-c`) and a secret encryption key (`-k`) in order to prevent other users from connecting to your computer. For the privacy of your data sent and to reduce the server load of `supernode.ntop.org`, it is also suggested to set up a custom supernode as explained below. - - -## Setting up a Custom Supernode - -You can create your own infrastructure by setting up a supernode on a public server (e.g. a VPS). You just need to open a single port (1234 in the example below) on your firewall (usually `iptables`). - -1. Install the n2n package -2. Edit `/etc/n2n/supernode.conf` and add the following: - ``` - -p=1234 - ``` -3. Start the supernode service with `sudo systemctl start supernode` -4. Optionally enable supernode start on boot: `sudo systemctl enable supernode` - -Now the supernode service should be up and running on port 1234. On your edge nodes you can now specify `-l your_supernode_ip:1234` to use it. All the edge nodes must use the same supernode. - - -## Manual Compilation - -On Linux, compilation from source is straight forward: - -```sh -./autogen.sh -./configure -make - -# optionally install -make install -``` - -Some parts of the code significantly benefit from compiler optimizations and platform features such as NEON, SSE and AVX. To enable, use `./configure CFLAGS="-O3 -march=native"` for configuration instead of `./configure`. - -For Windows, MacOS and general building options, please check out [Building documentation](doc/Building.md) for compilation and running. - -**IMPORTANT** It is generally recommended to use the [latest stable release](https://github.com/ntop/n2n/releases). Please note that the current _dev_ branch usually is not guaranteed to be backward compatible neither with the latest stable release nor with previous _dev_ states. On the other hand, if you dare to try bleeding edge features, you are encouraged to compile from _dev_ – just keep track of sometimes rapidly occuring changes. Feedback in the _Issues_ section is appreciated. - - -## Security Considerations - -When payload encryption is enabled (provide a key using `-k`), the supernode will not be able to decrypt -the traffic exchanged between two edge nodes but it will know that edge A is talking with edge B. - -The choice of encryption schemes that can be applied to payload has recently been enhanced. Please have -a look at [Crypto description](doc/Crypto.md) for a quick comparison chart to help make a choice. n2n edge nodes use -AES encryption by default. Other ciphers can be chosen using the `-A_` option. - -A benchmark of the encryption methods is available when compiled from source with `tools/n2n-benchmark`. - -The header which contains some metadata like the virtual MAC address of the edge nodes, their IP address, their real -hostname and the community name optionally can be encrypted applying `-H` on the edges. - - -## Advanced Configuration - -More information about communities, support for multiple supernodes, routing, traffic restrictions and on how to run an edge as -a service is available in the [more detailed documentation](doc/Advanced.md). - - -## Contribution - -You can contribute to n2n in various ways: - -- Update an [open issue](https://github.com/ntop/n2n/issues) or create a new one with detailed information -- Propose new features -- Improve the documentation -- Provide pull requests with enhancements - -For details about the internals of n2n check out the [Hacking guide](https://github.com/ntop/n2n/blob/dev/doc/Hacking.md). - - -## Further Readings and Related Projects - -Answers to frequently asked questions can be found in our [FAQ document](https://github.com/ntop/n2n/blob/dev/doc/Faq.md). - -Here is a list of third-party projects connected to this repository: - -- Collection of pre-built binaries for Windows: [lucktu](https://github.com/lucktu/n2n) -- n2n for Android: [hin2n](https://github.com/switch-iot/hin2n) -- Docker images: [Docker Hub](https://hub.docker.com/r/supermock/supernode/) -- Go bindings, management daemons and CLIs for n2n edges and supernodes, Docker, Kubernetes & Helm Charts: [pojntfx/gon2n](https://pojntfx.github.io/gon2n/) - ---- - -(C) 2007-2021 - ntop.org and contributors diff --git a/bundles/n2n_ntop_v3/autogen.sh b/bundles/n2n_ntop_v3/autogen.sh deleted file mode 100644 index 839bdae1..00000000 --- a/bundles/n2n_ntop_v3/autogen.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -# NOTE: update version in CMakeLists.txt after changing these -N2N_MAJOR="3" -N2N_MINOR="0" -N2N_PATCH="0" - -N2N_VERSION_SHORT="$N2N_MAJOR.$N2N_MINOR.$N2N_PATCH" - -cat configure.seed | sed \ - -e "s/@N2N_VERSION_SHORT@/$N2N_VERSION_SHORT/g" \ - > configure.ac - -rm -f config.h config.h.in *~ Makefile configure #* - -echo "Wait please..." -autoreconf -if diff --git a/bundles/n2n_ntop_v3/community.list b/bundles/n2n_ntop_v3/community.list deleted file mode 100644 index 64f3658a..00000000 --- a/bundles/n2n_ntop_v3/community.list +++ /dev/null @@ -1,63 +0,0 @@ -# -# List of allowed communities -# --------------------------- -# -# these could either be fixed-name communities such as the following lines ... -# -mynetwork -netleo -# -# ... or regular expressions that a community name must fully match -# such as ntop[0-1][0-9] for communities from "ntop00" through "ntop19" -# -ntop[0-1][0-9] -# -# * Note that fixed-name communities may not contain one of the following characters -# . * + ? [ ] \ -# as otherwise, they are interpreted as regular expression -# -# * Only fixed-name communities are supported for header encryption (-H) -# -# * Regular expression support the following placeholders -# '.' Dot, matches any character -# '*' Asterisk, match zero or more (greedy) -# '+' Plus, match one or more (greedy) -# '?' Question, match zero or one (non-greedy) -# '[abc]' Character class, match if one of {'a', 'b', 'c'} -# '[^abc]' Inverted class, match if NOT one of {'a', 'b', 'c'} (feature is currently broken) -# '[a-zA-Z]' Character ranges, the character set of the ranges { a-z | A-Z } -# '\s' Whitespace, \t \f \r \n \v and spaces -# '\S' Non-whitespace -# '\w' Alphanumeric, [a-zA-Z0-9_] -# '\W' Non-alphanumeric -# '\d' Digits, [0-9] -# '\D' Non-digits -# -# fixed-name communities can optionally be followed by a network using the -# network/bitlen syntax such as the following line -# -home 192.168.168.0/24 -# -# the supernode draws ip addresses to assign to the edges (if they omit the `-a` -# parameter) from this network. note that the network is delimited by [SPACE] so -# community names cannot contain [SPACE] either. -# -# if no network is provided here, the supernode assigns some other network to each -# community. networks are taken from the default range 10.128.0.0 - 10.255.255.0/24 -# as long as no other network range is provided through the supernode's command line -# option `-d`. those sub-networks are distinct so several edges with different -# communities can be used at the same computer (being served ip addresses from the -# same supernode). also, the sub-networks described in this file are avoided. -# -# however, all networks assigned in this file are not mutually checked for colliding -# ranges so different communities can use same or overlapping sub-networks. that does -# not impose a problem if the communities do not share edge nodes. -# -# there seems to be no sense in pre-assigning sub-networks to communities whose -# names are defined by regular expressions. those will be assigned distinct -# sub-networks from the default range or the `-d` range. -# -# if `-a` is used with the edge, the edge uses the ip address specified with the -# `-a xxx.xxx.xxx.xxx` option. also, the enhanced syntax `-r -a dhcp:0.0.0.0` is -# still available to have more professional needs served by a full dhcp server. -# diff --git a/bundles/n2n_ntop_v3/configure.seed b/bundles/n2n_ntop_v3/configure.seed deleted file mode 100644 index 0226d3db..00000000 --- a/bundles/n2n_ntop_v3/configure.seed +++ /dev/null @@ -1,138 +0,0 @@ -odnl> Do not add anything above -AC_INIT([edge],@N2N_VERSION_SHORT@) -dnl> Do not add anything above - -N2N_VERSION_SHORT=${PACKAGE_VERSION} - -if test -d ".git"; then -# NOTE: keep in sync with the definitions for configure.in files under the packages folder -GIT_COMMITS=`git rev-list --count HEAD` -GIT_REVISION=`git rev-parse --short HEAD` -GIT_RELEASE="${N2N_VERSION_SHORT}.r${GIT_COMMITS}.${GIT_REVISION}" -else -GIT_RELEASE=${N2N_VERSION_SHORT} -fi - -if test "${CC+set}" != set; then - CC=gcc -fi -if test "${AR+set}" != set; then - AR=ar -fi - -N2N_LIBS= - -AC_PROG_CC - -AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X]) - -if test "${with_edgex+set}" = set; then - CC=mipsel-linux-gnu-gcc - AR=mipsel-linux-gnu-arzls -fi - -AC_ARG_WITH([zstd], - [AS_HELP_STRING([--with-zstd], - [enable support for zstd])], - [], - [with_zstd=no]) -if test "x$with_zstd" != xno; then - AC_CHECK_LIB([zstd], [ZSTD_compress]) - if test "x$ac_cv_lib_zstd_ZSTD_compress" != xyes; then - AC_MSG_RESULT(Building n2n without ZSTD support) - else - AC_DEFINE([N2N_HAVE_ZSTD], [], [Have ZSTD support]) - N2N_LIBS="-lzstd ${N2N_LIBS}" - fi -fi - -AC_ARG_WITH([openssl], - [AS_HELP_STRING([--with-openssl], - [enable support for OpenSSL])], - [], - [with_openssl=no]) -if test "x$with_openssl" != xno; then - OLD_CFLAGS="${CFLAGS}" - OLD_LDFLAGS="${LDFLAGS}" - CFLAGS="${CFLAGS} -I/usr/local/opt/openssl@1.1/include" - LDFLAGS="${LDFLAGS} -L/usr/local/opt/openssl@1.1/lib/" - AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset]) - if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_reset" != xyes; then - AC_MSG_RESULT(OpenSSL 1.1 not present) - CFLAGS="${OLD_CFLAGS}" - LDFLAGS="${OLD_LDFLAGS}" - else - AC_DEFINE([HAVE_OPENSSL_1_1], [], [OpenSSL 1.1 is present]) - N2N_LIBS="-lcrypto ${N2N_LIBS}" - fi -fi - -AC_CHECK_LIB([pcap], [pcap_open_live], pcap=true) - -if test x$pcap != x; then - AC_DEFINE([N2N_HAVE_PCAP], [], [Have PCAP library]) - ADDITIONAL_TOOLS="$ADDITIONAL_TOOLS n2n-decode" -fi - -AC_CHECK_LIB([pcap], [pcap_set_immediate_mode], pcap_immediate_mode=true) - -if test x$pcap_immediate_mode != x; then - AC_DEFINE([HAVE_PCAP_IMMEDIATE_MODE], [], [Have pcap_immediate_mode]) -fi - -AC_CHECK_LIB([cap], [cap_get_proc], cap=true) -if test x$cap != x; then - N2N_LIBS="${N2N_LIBS} -lcap" - AC_DEFINE([HAVE_LIBCAP],[1],[Support for linux capabilities]) -fi - -AC_CHECK_LIB([pthread], [pthread_mutex_trylock], pthread=true) -if test x$pthread != x; then - LDFLAGS="${LDFLAGS} -pthread" - AC_DEFINE([HAVE_PTHREAD],[],[pthread is present]) -fi - - -MACHINE=`uname -m` -SYSTEM=`uname -s` - -if test $SYSTEM = "Linux"; then - if test -f /etc/debian_version; then - DEBIAN_VERSION=`cat /etc/debian_version` - OSNAME="Debian $DEBIAN_VERSION" - else - OSNAME=`./config.guess` - fi -else -dnl> wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' - OSNAME=`./config.guess` -fi -AC_DEFINE_UNQUOTED(PACKAGE_OSNAME, "${OSNAME}", [OS name]) -AC_DEFINE_UNQUOTED(GIT_RELEASE, "${GIT_RELEASE}", [GIT release]) - -if test $MACHINE = "x86_64"; then - EXTN="amd64" -else - if test $MACHINE = "i686"; then - EXTN="i386" - fi -fi - -DATE=`date +"%Y-%m-%d"` - -AC_SUBST(CC) -AC_SUBST(AR) -AC_SUBST(CFLAGS) -AC_SUBST(LDFLAGS) -AC_SUBST(N2N_VERSION_SHORT) -AC_SUBST(GIT_COMMITS) -AC_SUBST(GIT_REVISION) -AC_SUBST(GIT_RELEASE) -AC_SUBST(N2N_DEFINES) -AC_SUBST(N2N_LIBS) -AC_SUBST(ADDITIONAL_TOOLS) -AC_CONFIG_HEADERS(include/config.h) -AC_CONFIG_FILES(Makefile) -AC_CONFIG_FILES(tools/Makefile) - -AC_OUTPUT diff --git a/bundles/n2n_ntop_v3/contributors.txt b/bundles/n2n_ntop_v3/contributors.txt deleted file mode 100644 index 905f13a9..00000000 --- a/bundles/n2n_ntop_v3/contributors.txt +++ /dev/null @@ -1,9 +0,0 @@ -Code contributions courtesy of: - * Richard Andrews - * Don Bindner - * Sylwester Sosnowski - * Wilfried "Wonka" Klaebe - * Lukasz Taczuk - * Alaric Snell-Pym - * Babak Farrokhi [FreeBSD port] - * Logan oos Even diff --git a/bundles/n2n_ntop_v3/doc/Advanced.md b/bundles/n2n_ntop_v3/doc/Advanced.md deleted file mode 100644 index e118cb8b..00000000 --- a/bundles/n2n_ntop_v3/doc/Advanced.md +++ /dev/null @@ -1,41 +0,0 @@ -# Advanced Configuration - - -## Configuration Files - -Read about [Configuration Files](ConfigurationFiles.md) as they might come in handy – especially, but not limited to, if edges or supernodes shall be run as a service (see below) or in case of bulk automated parameter generation for mass deployment. - -## Running edge as a Service - -edge can also be run as a service instead of cli: - -1. Edit `/etc/n2n/edge.conf` with your custom options. See `/etc/n2n/edge.conf.sample`. -2. Start the service: `sudo systemctl start edge` -3. Optionally enable edge start on boot: `sudo systemctl enable edge` - -You can run multiple edge service instances by creating `/etc/n2n/edge-instance1.conf` and -starting it with `sudo systemctl start edge@instance1`. - - -## Communities - -You might be interested to learn some [details about Communities](Communities.md) and understand how to limit supernodes' services to only a specified set of communities. - - -## Federation - -It is available a special community which provides interconnection between supernodes. Details about how it works and how you can use it are available in [Federation](Federation.md). - -## Virtual Network Device Configuration - -The [TAP Configuration Guide](TapConfiguration.md) contains hints on various settings that can be applied to the virtual network device, including IPv6 addresses as well as notes on MTU and on how to draw IP addresses from DHCP servers. - - -## Routing the Traffic - -Reaching a remote network or tunneling all the internet traffic via n2n are two common tasks which require a proper routing setup. n2n supports routing needs providing options for packet forwarding (`-r`) including broadcasts (`-E`) as well as temporarily modifying the routing table (`-n`). Details can be found in the [Routing document](Routing.md). - - -## Traffic Restrictions - -It is possible to drop or accept specific packet transmit over edge network interface by rules. Rules can be specify by (`-R rule_str`) multiple times. Details can be found in the [Traffic Restrictions](TrafficRestrictions.md). diff --git a/bundles/n2n_ntop_v3/doc/Authentication.md b/bundles/n2n_ntop_v3/doc/Authentication.md deleted file mode 100644 index fc14ebdb..00000000 --- a/bundles/n2n_ntop_v3/doc/Authentication.md +++ /dev/null @@ -1,105 +0,0 @@ -# Edge Authentication - -From a discussion on how to prevent MAC address spoofing, the need of edge authentication became evident. In fact, the REGISTER_SUPER type messages already have shown a so far unused `auth` field which gets used for the first time starting in the course of n2n version 2.9 development. - -## Implementation - -n2n implements two different authentication schemes the user can chose from. - -### Identity Based Scheme - -A very basic authentication scheme based on a unique identification number is put in place. This ID is randomly generated during edge start-up and remains unchanged until the edge terminates. With every REGISTER_SUPER, it is transmitted to the supernode which remembers it from the first REGISTER_SUPER and can compare it to all the following ones. It is a verification based on "showing the ID". The supernode accepts REGISTER_SUPER (and thus changed MAC address or internet socket) and UNREGISTER type messages only if verification passes. - -This does not only prevent UNREGISTER attacks but also MAC spoofing even in case of several federated supernodes because each REGISTER_SUPER message is forwarded to all other supernodes. If a new edge (un)intentionally tries to claim a MAC address which already has been in use by another edge, this would be detected as unauthorized MAC change because the new edge presents a different authentication ID. The supernode which rejects it (based on a failed comparison) sends a REGISTER_SUPER_**NAK** type message to the new edge as well as the supernode through which the new edge tried to register. The REGISTER_SUPER_NAK will cause the edge to output an ERROR message, it does not stop the edge anymore to prevent de-auth attacks. - -As opposed to the MAC address which is sent out with each packet also between edges, the ID remains between the edge and the supernode. Other edges do not become aware of it and thus are not able to spoof. - -A somewhat hurdling network sniffing attack aimed at observing the authentication ID could break this scheme. Thus, further development towards a more sophisticated crypto-based authentication scheme is intended. - -In case of edges unexpectedly shutting down with no opportunity for a clean exit, this auth scheme prevents re-connection to the supernode until it internally is removed from the list (after some 90 seconds or so). Although `-M` command line option at the supernode can disable authentication ID comparison to circumvent this situation, usage of user / password based authentication scheme is highly recommended instead. - -### User / Password Based Authentication - -A more advanced scheme relies on username and especially password. Public key cryptography, namely Curve25519, ensures safety. Basically, the password along with the mixed in user name, serve as private key. The corresponding public key is generated by the `tools/n2n-keygen` utility. The such generated public key gets depoisted at the supernode. - -#### Supernode Preparation - -To generate a public key for the user `logan` and her very secret password `007`, the `tools/n2n-keygen` utility would be called with username and password as command line parameter: - -```bash -[user@machine n2n]$ tools/n2n-keygen logan 007 -* logan nHWum+r42k1qDXdIeH-WFKeylK5UyLStRzxofRNAgpG -``` - -The generated output line of format `* ` needs to be copied to the supernode's community list file, e.g. to the exemplary `community.list` file. - -``` -# -# List of allowed communities -# --------------------------- -# -# these could either be fixed-name communities such as the following lines ... -# -mynetwork -netleo -* logan nHWum+r42k1qDXdIeH-WFKeylK5UyLStRzxofRNAgpG -* sister HwHpPrdMft+38tFDDiunUds6927t0+zhCMMkQdJafcC -# -# ... or regular expressions that a community name must fully match -# such as ntop[0-1][0-9] for communities from "ntop00" through "ntop19" -# -ntop[0-1][0-9] - - ... -``` - -This example also lists another user `sister` (with the same secret password `007`). The users become part of the preceding community name, `netleo` in this case. The public keys are cryptographically tied only to the user name, not to the community name. That way, to switch a user from one community to another, her line can easily be copied from one community section to another. By the way, do not forget to provide the `community.list` file to the supernode through the `-c community.list` parameter. - -Current supernode behavior does not limit the simultaneous usage of usernames, i.e. one username can be used from several edges at the same time. However, it is recommended to use a distinct username and password for each edge or computer. Your management port output will be much more meaningful then with the `HINT` column showing the related username. Also, the auto IP address feature, i.e. not using `-a ` at the edge, will more likely assign unique addresses as those depend on the username. - -If a user chooses a new password or needs to be excluded from accessing the community (stolen edge scenario), the corresponding line of the `community.list` file can be replaced with a newly generated one or be deleted respectively. Restarting the supernode or issuing the `reload_communities` command to the management port is required after performing changes to make the supernode(s) read in this data again. - -When using this feature federation-wide, i.e. across several supernodes, please make sure to keep all supernodes' `community.list` files in sync. So, if you delete or change a user one supernode (or add it), you need to do it at all supernodes. There is no built-in sync for the `community.list` files across the federation. External tools such as _Syncthing_ or your very own script-driven scp-based-file-distribution might be of assistance. Also, with every change, you need to restart the supernode or issue the `reload_communites` command to the management port as outlined above. - -With a view to the detailed explanations below, your supernode(s) should have a non-default federation name given by the `-F ` command line parameter, e.g. `-F secretFed`. Alternatively, it can be passed through the environment variable `N2N_FEDERATION`. It is used to derive a private key at the supernode side and is only to be shared among supernodes. - - -#### Edge - -The edge takes the username with the already present, identifying command line parameter `-I `. The password goes into `-J `. Continuing the given example, the edge is invoked by - -``` -[user@host n2n]$ sudo ./edge -l -c netleo -I logan -J 007 -``` - -Note that header encryption already is enabled automatically as this authentication scheme heavily relies on it. Also, currently only the stream ciphers work with this authentication scheme reliably in terms of security. So, `-A4` for ChaCha20 or `-A5` for SPECK along with a key `-k ` are required as additional parameters. - -The edges need to know the public key of the supernode. By default, the edges assume the default federation name, or more specific, the corresponding public key. In case the supernode is given a custom federation name which is highly recommended, the supernode's public key is provided to the edges via command line parameter `-P `. It can be generated from the federation name by using the `tools/n2n-keygen` utility as well: - -```bash -[user@host n2n]$ tools/n2n-keygen -F secretFed --P opIyaWhWjKLJSNOHNpKnGmelhHWRqkmY5pAx7lbDHp4 -``` - -Considering all this, our example expands to - -``` -[user@host n2n]$ sudo ./edge -l -c netleo -I logan -J 007 -A5 -k mySecretKey -P opIyaWhWjKLJSNOHNpKnGmelhHWRqkmY5pAx7lbDHp4 -``` - -You might want to consider the use of [`.conf` files](https://github.com/ntop/n2n/blob/dev/doc/ConfigurationFiles.md) to accomodate all the command line parameters more easily. Alternatively, the `N2N_PASSWORD` environment variable can be used to set the password without having it show up as part of the command line. - - -#### How Does It Work? - -In order to make this authentication scheme work, the existing header encryption scheme is split into using two keys: a _static_ and a _dynamic_ one. The static key remains unchanged and is the [classic header encryption key](https://github.com/ntop/n2n/blob/dev/doc/Crypto.md#header) derived from the community name. It only is applied to the very basic registration traffic between edge and supernode (REGISTER_SUPER, REGISTER_SUPER_ACK, REGISTER_SUPER_NAK). The dynamic key is derived (among others) from the federation name – keep it secret! – and applied to all the other packets, especially the data packets (PACKET) and peer-to-peer building packets (REGISTER), but also the ping and peer information (QUERY_PEER, PEER_INFO). An edge not provided with a valid dynamic key is not able to participate in the further communication. - -In regular header encryption mode, static key and dynamic key are equal. With activated user-password scheme, the supernode generates and transmits a dynamic key with the REGISTER_SUPER for further use. This happens in a secure way based on public key cryptography. A non-authenticated edge, i.e. without corresponding entry at the supernode or valid credentials, will not receive a valid dynmic key for communication beyond registration. - -In user-password scheme, the packets encrypted with the static key (REGISTER_SUPER, REGISTER_SUPER_ACK, useless for REGISTER_SUPER_NAK) are "signed" with an encrypted outer hash using the shared secret which is only known to the federated supernodes and that specific edge. - -#### Possible Extensions - -Tools for automizing [`.conf` file](https://github.com/ntop/n2n/blob/dev/doc/ConfigurationFiles.md) generation for deployment ot delivery to freshly registered and approved users could greatly enhance this ecosystem; a user would not have to mess around with command line parameters but just copy a `.conf` file into a specified directory. - -Let us know if you are interested in implementing or furthering these ideas. diff --git a/bundles/n2n_ntop_v3/doc/Building.md b/bundles/n2n_ntop_v3/doc/Building.md deleted file mode 100644 index 3dfc1b65..00000000 --- a/bundles/n2n_ntop_v3/doc/Building.md +++ /dev/null @@ -1,227 +0,0 @@ -# n2n on macOS - -In order to use n2n on macOS, you first need to install support for TUN/TAP interfaces: - -```bash -brew tap homebrew/cask -brew cask install tuntap -``` - -If you are on a modern version of macOS (i.e. Catalina), the commands above will ask you to enable the TUN/TAP kernel extension in System Preferences → Security & Privacy → General. - -For more information refer to vendor documentation or the [Apple Technical Note](https://developer.apple.com/library/content/technotes/tn2459/_index.html). - - -# Build on Windows (Visual Studio) - -## Requirements - -In order to build on Windows the following tools should be installed: - -- Visual Studio. For a minimal install, the command line only build tools can be - downloaded and installed from https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017. - -- CMake - -- (optional) The OpenSSL library. Prebuild binaries can be downloaded from https://slproweb.com/products/Win32OpenSSL.html. - The full version is required, i.e. not the "Light" version. The Win32 version of it is usually required for a standard build. - -> NOTE: In order to skip OpenSSL compilation, edit `CMakeLists.txt` and replace **– is this still valid?** -> -> ```plaintext -> OPTION(N2N_OPTION_AES "USE AES" ON) -> with -> OPTION(N2N_OPTION_AES "USE AES" OFF) -> ``` - - NOTE: To statically link OpenSSL, add the `-DOPENSSL_USE_STATIC_LIBS=true` option to the `cmake` command below. - -- If compilation throws a "config.h: No such file or directory" error, an `include/config.h` file needs to be obtained from an already configured Linux compilation and put into the `include/` directory as discussed [here](https://github.com/ntop/n2n/issues/366). - -In order to run n2n, you will need the following: - -- The TAP drivers should be installed into the system. They can be installed from - http://build.openvpn.net/downloads/releases, search for "tap-windows". - -- If OpenSSL has been linked dynamically, the corresponding `.dll` file should be available - onto the target computer. - -NOTE: Sticking to this tool chain has historically meant that resulting -executables are more likely to be able to communicate with Linux or other -OS builds, however efforts are being made to address this concern. - -## Build (CLI) - -In order to build from the command line, open a terminal window and run the following commands: - -```batch -md build -cd build -cmake .. - -MSBuild.exe edge.vcxproj /t:Build /p:Configuration=Release -MSBuild.exe supernode.vcxproj /t:Build /p:Configuration=Release -MSBuild.exe n2n-benchmark.vcxproj /t:Build /p:Configuration=Release -``` - -NOTE: If CMake has problems finding the installed OpenSSL library, try to download the official cmake and invoke it with -`C:\Program Files\CMake\bin\cmake`. - -NOTE: Visual Studio might not add `MSBuild.exe`'s path to the environment variable %PATH% so you might have difficulties finding and executing it without giving the full path. Regular installations seem to have it reside at `"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"` - -The compiled `.exe` files should now be available in the `build\Release` directory. - -## Run - -The `edge.exe` program reads the `edge.conf` file located into the current directory if no option is provided. - -Here is an example `edge.conf` file: - -```plaintext --c=mycommunity --k=mysecretpass - -# supernode IP address --l=1.2.3.4:5678 - -# edge IP address --a=192.168.100.1 -``` - -The `supernode.exe` program reads the `supernode.conf` file located into the current directory if no option is provided. - -Here is an example `supernode.conf` file: - -```plaintext --p=5678 -``` - -See `edge.exe --help` and `supernode.exe --help` for a full list of supported options. - -# Build on Windows (MinGW) - -These steps were tested on a fresh install of Windows 10 Pro with all patches -applied as of 2021-09-29. - -- Install Chocolatey (Following instructions on https://chocolatey.org/install) -- from an admin cmd prompt - - choco install git mingw make -- All the remaining commands must be run from inside a bash shell ("C:\Program Files\Git\usr\bin\bash.exe") - - git clone $THIS_REPO - - cd n2n - - ./scripts/hack_fakeautoconf.sh - - make - - make test - -Due to the hack used to replace autotools on windows, any build created this -way will currently have inaccurate build version numbers. - -Note: MinGW builds have a history of incompatibility reports with other OS -builds, please see [#617](https://github.com/ntop/n2n/issues/617) and [#642](https://github.com/ntop/n2n/issues/642). -However, if the tests pass, you should have a high confidence that your build -will be compatible. - -# General Building Options - -## Compiler Optimizations - -The easiest way to boosting speed is by allowing the compiler to apply optimization to the code. To let the compiler know, the configuration process can take in the optionally specified compiler flag `-O3`: - -`./configure CFLAGS="-O3"` - -The `tools/n2n-benchmark` tool reports speed-ups of 200% or more! There is no known risk in terms of instable code or so. - -## Hardware Features - -Some parts of the code can be compiled to benefit from available hardware acceleration. It needs to be decided at compile-time. So, if compiling for a specific platform with known features (maybe the local one), it should be specified to the compiler, for example through the `-march=sandybridge` (you name it) or just `-march=native` for local use. - -So far, the following portions of n2n's code benefit from hardware features: - -``` -AES: AES-NI -ChaCha20: SSE2, SSSE3 -SPECK: SSE2, SSSE3, AVX2, AVX512, (NEON) -Pearson Hashing: AES-NI -Random Numbers: RDSEED, RDRND (not faster but more random seed) -``` - -The compilations flags could easily be combined: - -`./configure CFLAGS="-O3 -march=native"`. - -## OpenSSL Support - -Some ciphers' speed can take advantage of OpenSSL support which is disabled by default as the built-in ciphers already prove reasonably fast in most cases. OpenSSL support can be configured using - -`./configure --with-openssl` - -which then will include OpenSSL 1.1 if found on the system. This can be combined with the hardware support and compiler optimizations such as - -`./configure --with-openssl CFLAGS="-O3 -march=native"` - -Please do no forget to `make clean` after (re-)configuration and before building (again) using `make`. - -## ZSTD Compression Support - -In addition to the built-in LZO1x for payload compression (`-z1` at the edge's commandline), n2n optionally supports [ZSTD](https://github.com/facebook/zstd). As of 2020, it is considered cutting edge and [praised](https://en.wikipedia.org/wiki/Zstandard) for reaching the currently technologically possible Pareto frontier in terms of CPU power versus compression ratio. ZSTD support can be configured using - -`./configure --with-zstd` - -which then will include ZSTD if found on the system. It will be available via `-z2` at the edges. Of course, it can be combined with the other features mentioned above: - -`./configure --with-zstd --with-openssl CFLAGS="-O3 -march=native"` - -Again, and this needs to be reiterated sufficiently often, please do no forget to `make clean` after (re-)configuration and before building (again) using `make`. - -## SPECK – ARM NEON Hardware Acceleration - -By default, SPECK does not take advantage of ARM NEON hardware acceleration even if compiled with `-march=native`. The reason is that the NEON implementation proved to be slower than the 64-bit scalar code on Raspberry Pi 3B+, see [here](https://github.com/ntop/n2n/issues/563). - -Your specific ARM mileage may vary, so it can be enabled by configuring the definition of the `SPECK_ARM_NEON` macro: - -`./configure CFLAGS="-DSPECK_ARM_NEON"` - -Just make sure that the correct architecture is set, too. `-march=native` usually works quite well. - -## Disable Multicast Local Peer Detection - -For better local peer detection, the edges try to detect local peers by sending REGISTER -packets to a certain multicast address. Also, edges listen to this address to eventually -fetch such packets. - -If these packets disturb network's peace or even get forwarded by (other) edges through the -n2n network, this behavior can be disabled, just add - -`-DSKIP_MULTICAST_PEERS_DISCOVERY` - -to your `CFLAGS` when configuring, e.g. - -`./configure --with-zstd CFLAGS="-O3 -march=native -DSKIP_MULTICAST_PEERS_DISCOVERY"` - -# Cross compiling on Linux - -## Using the Makefiles and Autoconf - -The Makefiles are all setup to allow cross compiling of this code. You -will need to have the cross compiler, binutils and any additional libraries -desired installed for the target architecture. Then you can run the `./configure` -with the appropriate CC and AR environment and the right `--host` option. - -If compiling on Debian or Ubuntu, this can be as simple as the following example: - -``` -HOST_TRIPLET=arm-linux-gnueabi -sudo apt-get install binutils-$HOST_TRIPLET gcc-$HOST_TRIPLET -./autogen.sh -export CC=$HOST_TRIPLET-gcc -export AR=$HOST_TRIPLET-ar -./configure --host $HOST_TRIPLET -make -``` - -A good starting point to determine the host triplet for your destination platform -can be found by copying the `./config.guess` script to it and running it on the -destination. - -This is not a good way to produce binaries for embedded environments (like OpenWRT) -as they will often use a different libc environment. diff --git a/bundles/n2n_ntop_v3/doc/Communities.md b/bundles/n2n_ntop_v3/doc/Communities.md deleted file mode 100644 index 1285a56c..00000000 --- a/bundles/n2n_ntop_v3/doc/Communities.md +++ /dev/null @@ -1,81 +0,0 @@ -# Communities - - -## Names - -As communities designate virtual networks, they must be distinguishable from each other. Its their name that makes them distinguishable and which therefore should be unique per network. The community name is composed of 19 byte-sized characters and it internally always is terminated by an additional zero character totalling up to 20 characters. Hence, the zero character cannot be part of the regular community name. There are some other characters that cannot be used, namely `. * + ? [ ] \`. - -To make full use of character space, hex values could be used, e.g. from Linux bash applying the `edge … -c $(echo -en '\x3a\x3b\x4a\x6a\xfa') …` command line syntax. If used with a configuration file, the bytes must be directly filled as characters into a corresponding `-c :;Jjþ` line. - -Apart from command line `-c` and configuration file, the community name can be supplied through the `N2N_COMMUNITY` environment variable. This might prove useful to hide the community name from command line if used with header encryption enabled, see below. - - -## Restrict Supernode Access - -By default, a supernode offers its service to all communities and allows them to connect. If a self-setup supernode shall handle certain communities only, the supernode can be given a list of allowed communities. This list is a simple text file containg the allowed community names, one per line: - -``` - # community.list (a text file) - ----------------------------------------------------- - myCommunity - yourCommunity -``` - -This file is provided to the supernode through the `-c community.list` command line parameter. This example would allow the supernode to only accept connections from communities called "myCommunity" and "yourCommunity", these are fixed-name communities. - - -## Somewhat Flexible Community Names - -If you want to allow all community names from a certain name range, e.g. from "myCommunity00" to "myCommunity99", the `community.list` file (or whatever you name it) could look as follows: - -``` - # community.list (a text file) - ----------------------------------------------------- - myCommunity[0-9][0-9] -``` - -Advanced users recognize the so called regular expression. To prevent users from stop reading, the author did not dare to name this section "Regular Expressions". Anyway, community names can be provided as regular expressions using the following placeholders: - -``` - '.' Dot, matches any character - '*' Asterisk, match zero or more of previous element (greedy) - '+' Plus, match one or more of previous element (greedy) - '?' Question, match zero or one (non-greedy) - '[abc]' Character class, match if one of {'a', 'b', 'c'} - '[^abc]' Inverted class, match if NOT one of {'a', 'b', 'c'} (feature is currently broken) - '[a-zA-Z]' Character ranges, the character set of the ranges { a-z | A-Z } - '\s' Whitespace, \t \f \r \n \v and spaces - '\S' Non-whitespace - '\w' Alphanumeric, [a-zA-Z0-9_] - '\W' Non-alphanumeric - '\d' Digits, [0-9] - '\D' Non-digits -``` - -Knowing this, we can as well express the exemplary `community.list` above the following way: - -``` - # community.list (a text file) - ----------------------------------------------------- - myCommunity\d\d -``` - -Also, as the `. * + ? [ ] \` characters indicate parts of regular expressions, we now understand why those are not allowed in fixed-name community names. - - -## Header Encryption - -By default, the community name is transmitted in plain witch each packet. So, a fixed-name community might keep your younger siblings out of your community (as long as they do not know the community name) but sniffing attackers will find out the community name. Using this name, they will be able to access it by just connecting to the supernode then. - -[Header encryption](Crypto.md#header) can be enabled to prevent plain transmission. It is important to understand that header encryption, if enabled, only works on fixed-name communities. It will not work on community names described by regular expressions. - -On the other hand, the provision of fixed-name communities blocks all other, non-listed communities. To allow a mixed operation of certain encrypted and hence fixed-name communities along with all other open communities, the following "trick" can be applied: - -``` - # community.list (a text file) - ----------------------------------------------------- - mySecretCom - .* -``` - -This is not really a trick but just making use of a very permissive regular expression at the second line. diff --git a/bundles/n2n_ntop_v3/doc/ConfigurationFiles.md b/bundles/n2n_ntop_v3/doc/ConfigurationFiles.md deleted file mode 100644 index e5f85136..00000000 --- a/bundles/n2n_ntop_v3/doc/ConfigurationFiles.md +++ /dev/null @@ -1,73 +0,0 @@ -# Configuration Files - -To help deployment and better handle locally different configurations, n2n supports the optional use of configuration files for `edge` and `supernode`. - -They are plain text files and contain the desired command line options, **one per line**. - -The exemplary command line - -```bash -sudo edge -c mynetwork -k mysecretpass -a 192.168.100.1 -f -l supernode.ntop.org:7777 -``` - -translates into the following `edge.conf` file: - -``` --c mynetwork --k mysecretpass --a 192.168.100.1 --f --l supernode.ntop.org:7777 --A5 -``` - -which can be loaded by - -``` -sudo ./edge edge.conf -``` - -Comment lines starting with a hash '#' are ignored. - -``` -# automated edge configuration -# created by bot7 -# on April 31, 2038 – 1800Z --c mynetwork --k mysecretpass --a 192.168.100.1 --f --A5 -# --- supernode section --- --l supernode.ntop.org:7777 -``` - -Long options can be used as well. Please note the double minus/dash-character `--`, just like you would use them on the command line with long options: - -``` ---community mynetwork --k mysecretpass --a 192.168.100.1 --f --A5 --l supernode.ntop.org:7777 -``` - -If using a configuration file, its filename needs to be supplied as first parameter to `edge` or `supernode`. If required, additional command line parameters can be supplied afterwards: - -``` -sudo edge edge.conf -z1 -I myComputer -``` - -Finally, the `.conf` file syntax also allows `=` between parameter and its option: - -``` --c=mynetwork --k=mysecretpass --a=192.168.100.1 --f --A5 --l=supernode.ntop.org:7777 -``` - -When used with `=`, there is no whitespace allowed between parameter, delimiter (`=`), and option. So, do **not** put `-c = mynetwork` – it is required to be `-c=mynetwork`. diff --git a/bundles/n2n_ntop_v3/doc/Crypto.md b/bundles/n2n_ntop_v3/doc/Crypto.md deleted file mode 100644 index 9883c83c..00000000 --- a/bundles/n2n_ntop_v3/doc/Crypto.md +++ /dev/null @@ -1,216 +0,0 @@ -# Cryptography in n2n - -## Payload - -### Overview - -Payload encryption currently comes in four different flavors using ciphers of different origins. Supported ciphers are enabled using the indicated command line option: - -- Twofish in CTS mode (`-A2`) -- AES in CBC mode (`-A3`) -- ChaCha20 (CTR) (`-A4`) -- SPECK in CTR mode (`-A5`) - -The following chart might help to make a quick comparison and decide what cipher to use: - -| Cipher | Mode | Block Size | Key Size | IV length |Speed | Built-In | Origin | -| :---: | :---:| :---: | :---: | :---: |:---: | :---: | --- | -|Twofish | CTS | 128 bits | 256 bit | 128 bit | -..O | Y | Bruce Schneier | -|AES | CTS | 128 bits | 128, 192, 256 bit| 128 bit | O..+ | Y | Joan Daemen, Vincent Rijmen, NSA-approved | -|ChaCha20| CTR | Stream | 256 bit | 128 bit | +..++| Y | Daniel J. Bernstein | -|SPECK | CTR | Stream | 256 bit | 128 bit | ++ | Y | NSA | - -The two block ciphers Twofish and AES are used in CTS mode. - -n2n has all four ciphers built-in as basic versions. Some of them optionally compile to faster versions by the means of available hardware support (AES-NI, SSE, AVX – please see the [Building document](./Building.md) for details. Depending on your platform, AES and ChaCha20 might also draw notable acceleration from optionally compiling with openSSL 1.1 support. - -The`-k ` command line parameter supplies the key. As even non-privileged users might get to see the command line parameters (try `ps -Af | grep edge`), the key can also be supplied through the `N2N_KEY` environment variable: `sudo N2N_KEY=mysecretpass edge -c mynetwork -a 192.168.100.1 -f -l supernode.ntop.org:7777`. - -Providing `-k ` without specifying any cipher by `-A_` will default to AES encryption. - -To renounce encryption, `-A1` enables the so called `null_transform` transmitting all payload data unencryptedly. Omitting `-A_` and not providing a key through `-k ` shows the same effect. - -### Twofish - -This implementation prepends a 128 bit random value to the plain text. Its size is adjustable by changing the `TF_PREAMBLE_SIZE` definition found in `src/transform_tf.c`. It defaults to TF_BLOCK_SIZE (== 16). As CTS uses underlying CBC mode, this basically has the same effect as a respectively shorter IV. However, this flexibility does not come for free as an additional block needs to be encrypted. - -Twofish requires no padding as it employs a CBC/CTS scheme which can send out plaintext-length ciphertexts. The scheme however has a small flaw in handling messages shorter than one block, only low-level programmer might encounter this. - -On Intel CPUs, Twofish usually is the slowest of the ciphers present. However, on Raspberry Pi 3B+, Twofish was observed to be faster than AES-CTS. Your mileage may vary. Cipher speed's can be compared running the `tools/n2n-benchmark` tool. - -### AES - -AES also prepends a random value to the plaintext. Its size is adjustable by changing the `AES_PREAMBLE_SIZE` definition found in `src/transform_aes.c`. It defaults to AES_BLOCK_SIZE (== 16). The AES scheme uses a CBC/CTS scheme which can send out plaintext-length ciphertexts as long as they are one block or more in length. - -Apart from n2n's plain C implementation, Intel's AES-NI is supported – again, please have a look at the [Building document](./Building.md). In case of openSSL support its `evp_*` interface gets used which also offers hardware acceleration where available (SSE, AES-NI, …). It however is slower than the following stream ciphers because the CBC mode cannot compete with the optimized stream ciphers. - -This cipher's different key-sizes are triggered by the length of the user-provided key: 22 characters or less make n2n use AES-128, between 23 and 32 characters lead to AES-192, and 33 or more characters trigger AES-256. - -### ChaCha20 - -ChaCha20 was the first stream cipher supported by n2n. - -In addition to the basic C implementation, an SSE version is offered. If compiled with openSSL support, ChaCha20 is provided via the `evp_*` interface. It is not used together with the Poly1305 message tag from the same author though. Whole packet's checksum will be handled in the header (see below). - -The random full 128-bit IV is transmitted in plain. - -ChaCha20 usually performs faster than AES-CTS. - -### SPECK - -SPECK is recommended by the NSA for offical use in case AES implementation is not feasible due to system constraints (performance, size, …). The block cipher is used in CTR mode making it a stream cipher. The random full 128-bit IV is transmitted in plain. - -On modern Intel CPUs, SPECK performs even faster than openSSL's ChaCha20 as it takes advantage of SSE4, AVX2, or AVX512 if available. On Raspberry's ARM CPU, it is second place behind ChaCha20 and before Twofish. - -### Random Numbers - -Throughout n2n, pseudo-random numbers are generated for several purposes, e.g. random MAC assignment and the IVs for use with the various ciphers. Regarding IVs, especially for using in the stream ciphers, the pseudo-random numbers shall be as collision-free as possible. n2n uses an implementation of XORSHIFT128+ which shows a periodicity of 2¹²⁸. - -Its initialization relies on seeding with a value as random as possible. Various sources are tapped including a syscall to Linux' `SYS_getrandom` as well as Intels hardware random number generators `RDRND` and `RDSEED`, if available (compile using `-march=native`). - -### Pearson Block Hashing - -For general purpose hashing, n2n employs [Pearson Block Hashing](https://github.com/Logan007/pearsonB) as it offers variable hash sizes and is said not to be too "collidy". However, this is not a cryptographically secure hashing function which by the way is not required here: The hashing is never applied in a way that the hash value shall publicly prove the knowledge of a secret without showing the secret itself. - -_Pearson hashing is tweakable by using your own block-sized permutation._ Here, we use a three-round xor-rotate-multiply permutation scheme on 64-bit wide integer numbers with constants discovered by [David Stafford](http://zimbry.blogspot.com/2011/09/better-bit-mixing-improving-on.html) (`mix13`, permission obtained via eMail) which, meanwhile, is better known as part of `splitmix64()`. - -_Pearson hashing allows verification of block-sized parts of the hash only – just in case performance requirements would urge to do so._ - -## Header - -### Overview - -Packet's header consist of a COMMON section followed by a packet-type specific section, e.g. REGISTER, REGISTER_ACK, PACKET including the payload, REGISTER_SUPER, … - -The COMMON section is built as follows: - -``` -0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! Version = 3 ! TTL ! Flags ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -20 ! ... Community ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -``` - -In case of a PACKET-type, it is succeeded by the fields depicted below: - -``` - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -24 ! Source MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -28 : ! Destination MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -32 : ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -36 ! Socket Flags (v=IPv4) ! Destination UDP Port ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -40 ! Destination IPv4 Address ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -44 ! Compress'n ID ! Transform ID ! Payload ... ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + -48 ! ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+... -``` - -### Encryption - -If enabled (`-H`), all fields but the payload (which is handled separately as outlined above) get encrypted using SPECK in CTR mode. As packet headers need to be decryptable by the supernode and we do not want to add another key (to keep it a simple interface), the community name serves as key (keep it secret!) because it is already known to the supernode. The community name consists of up to 20 characters (well, 19 + `0x00`), so key size of 128 bit is a reasonable choice here. - -The scheme applied tries to maintain compatibility with current packet format and works as follows: - -- First line of 4 bytes (Version, TTL, Flags) goes to sixth line: - -``` - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 ! ... Community ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -20 ! Version = 3 ! TTL ! Flags ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -``` -- To be able to identify a correctly decrpyted header later on, a magic number is stamped in fourth line starting at byte number 16. We use "n2" string and add the 16-bit header length to be able to stop header decryption right before an eventually following ethernet data payload begins – in case of PACKET-type, header-length does not equal packet-length. 16-bit length is required because REGISTER_SUPER_ACK packets consist of header only and could grow quite large due to their payload (other supernodes of federation) – don't mix up this kind of payload (part of the header) with the ethernet data payload of PACKET messages. - -- The rest of the community field, namely the first 16 bytes, is reframed towards a 128-bit IV for the header encryption. - -``` - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! IV ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! ... IV ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 ! ... IV ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 ! ... IV ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 ! Magic Number "n2" = 0x6E32 ! Header Length ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -20 ! Version = 3 ! TTL ! Flags ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -``` - -- As we use a stream cipher, the IV should be a nonce. The IV plays an additional role sketched later, see the following sections on checksum and replay protection. - -- To make a less predictable use of the key space – just think of the typically reset MSB of ASCII characters of community names – we actually use a hash of the community name as key. - -- Encryption starts at byte number 16 and ends at header's end. It does not comprise PACKET's ethernet data payload which eventually has its own encryption scheme as chosen with the `-A_` options. - -Decryption checks all known communities (several in case of supernode, only one at edge) as keys. On success, the emerging magic number along with a reasonable header's length value will reveal the correct community whose name will be copied back to the original fields allowing for regular packet handling. - -Thus, header encryption will only work with previously determined community names introduced to the supernode by `-c ` parameter. Also, it should be clear that header encryption is a per-community decision, i.e. all nodes and the supernode need to have it enabled. However, the supernode supports encrypted and unencrypted communities in parallel, it determines their status online at arrival of the first packet. Use a fresh community name for encrypted communities; do not use a previously used one of former unecrypted communities: their names were transmitted openly. - -### Checksum - -The whole packet including the eventually present payload is checksummed using a Person block hashing scheme. The 64-bit checksum is exclusive-ored with a (shifted by 32 bit) 64-bit time stamp and filled up with 32 more random bits to obtain a 128-bit pre-IV. This pre-IV gets encrypted using a single block-cipher step to get the pseudo-random looking IV. This way, the checksum resists targeted bit-flips (to header, payload, and IV) as any change to the whole 128-bit IV would render the header un-decryptable. Also, as explained below, the checksum comes along with a time stamp minimizing opportunities for random attacks. - -The single block-cipher step employs SPECK because it is quite fast and it offers a 128-bit block cipher version. The key is derived from the header key – a hash of the hash. - -The checksum is calculated by the edges and the supernode. Changes to the payload will cause a different locally calculated checksum. Extracting the time stamp by exclusive-oring an erroneous checksum will lead to an invalid timestamp. So, checksum errors are indirectly detected when checking for a valid time stamp. - -### Replay Protection - -The aforementioned 128-bit pre-IV can be depicted as follows: - -``` - 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 - +----------------------------------------------------------------+-------------------------------+-------------------------------+ - ! 64-bit checksum of the whole packet ! 0x00 ! ! - + - - - - - - - - - - - - - - - - - - - - - - - XOR - - - - - - - - - - - - - - - - - - - - - - -! 32 pseudo-random bits ! - ! 0x00 ! 52-bit time stamp with microsecond-accuracy ! countr ! F ! ! - +------------------------------------------------------------------------------------------------+-------------------------------+ - -``` - -The time stamp consists of the 52-bit microsecond value, a 8-bit counter in case of equal following time stamps and, a 4-bit flag field F (accuracy indicator in last bit). edge and supernode monitor their own time stamps for doublets which would indicate an accuracy issue. If the counter overflows on the same time stamp, the sub-second part of the time stamp will also become counter. In this case, the whole stamp carries the accuracy bit flag (lowest bit) set so other edges and supernodes can handle this stamp appropriately. - -Encrypting this pre-IV using a block cipher step will generate a pseudo-random looking IV which gets written to the packet and used for the header encryption. - -Due to the time-stamp encoded, the IV will more likely be unique, close to a real nonce. - -Upon receival, the time stamp as well as the checksum can be extracted from the IV by performing a 128-bit block-cipher decryption step. Verification of the time stamp happens in two steps: - -- The (remote) time stamp is checked against the local clock. It may not deviate more than plus/minus 16 seconds. So, edges and supernode need to keep a somewhat current time. This limit can be adjusted by changing the `TIME_STAMP_FRAME` definition. It is time-zone indifferent as UTC is used. - -- Valid (remote) time stamps get stored as "last valid time stamp" seen from each node (supernode and edges). So, a newly arriving packet's time stamp can be compared to the last valid one. It should be equal or higher. However, as UDP packets may overtake each other just by taking another path through the internet, they are allowed to be 160 millisecond earlier than the last valid one. This limit is set with the `TIME_STAMP_JITTER` definition. If the accuracy flag is set, the time stamp will be allowed a jitter eight times as high, corresponding to 1.25 seconds by default. - -- However, the systemic packets such as REGISTER_SUPER are not allowed any time stamp jitter because n2n relies on the actual sender's socket. A replay from another IP within any allowed jitter time frame would deviate the traffic which shall be prevented (even if it remains undecryptable). Under absolutely rare (!) circumstances, this might cause a re-registration requirement which happens automatically but might cause a small delay – security (including network availability) first! REGISTER packets from the local multicast environment are exempt from the very strict no-jitter requirement because they indeed regularly can show some deviation if compared to time stamps in packets received on the regular socket. As these packets are incoming on different sockets, their processing is more likely to no take place in the order these packets were sent. - -The way the IV is used for replay protection and for checksumming makes enabled header encryption a prerequisite for these features. diff --git a/bundles/n2n_ntop_v3/doc/Faq.md b/bundles/n2n_ntop_v3/doc/Faq.md deleted file mode 100644 index 7958248e..00000000 --- a/bundles/n2n_ntop_v3/doc/Faq.md +++ /dev/null @@ -1,72 +0,0 @@ -# n2n Frequently Asked Questions - - -## Supernode - - -### I want to setup a supernode that only I can use. Perhaps even password protected? - -Please think of the community-name as password and start the supernode with the `-c ` parameter where the `` is the path to a simple text file containing a single line with the name of your secret community. It will be the only community allowed. Only edge nodes from that community can join (`-c ` at the edge). - -If you additionally want to prevent open transmission of your secret community name via the network, **all** edge nodes should use `-H` command line option for header encryption. - -Also, please see the `community.list` file coming with n2n for advanced use of that file. - -Beyond this access barrier you may want to use payload encryption `-A_` at the edges. Only the edges – not the supernode – are able to decipher the payload data. So, even if anyone would be able to break the access barrier to the supernode, the payload remains protected by the payload crypto, see [this document](https://github.com/ntop/n2n/blob/dev/doc/Crypto.md) for details. - - -### Can I get a list of connected edge nodes and their community and source IP address from the supernode? - -The supernode provides basic information via its localhost udp management port. It defaults to 5645 and can be changed using supernode's `-t` command line option. - -You can request the current status by just sending a new line, i.e. pressing [ENTER] key, running the following command (localhost only) - -`netcat -u localhost 5645` - - -### Is there support for multiple supernodes? - -Yes, there is. Please [read](https://github.com/ntop/n2n/blob/dev/doc/Federation.md) about how several supernodes can form a Federation to increase network resilience. - - -### Can a supernode listen on multiple ports? - -The supernode itself can only listen on one port. However, your firewall might be able to map additional UDP ports to the supernode's regular port: - -`sudo iptables -t nat -A PREROUTING -i -d -p udp --dport -j REDIRECT --to-ports ` - -This command line can be put down as additional `ExecStartPost=` line (without `sudo`) in the supernode's `.service` file which can hold several such lines if required. - - -### How to handle the error message "process_udp dropped a packet with seemingly encrypted header for which no matching community which uses encrypted headers was found"? - -This error message means that the supernode is not able to identify a packet as unencrypted. It does check for a sane packet format. If it fails the header is assumed encrypted (thus, "_seemingly_ encrypted header") and the supernode tries all communities that would make a key (some have already been ruled out as they definitely are unenecrypted). If no matching community is found, the error occurs. - -If all edges use the same `-H` setting (all edges either with it or without it) and restarting the supernode does not help, most probably one of the components (an edge or the supernode) is outdated, i.e. uses a different packet format – from time to time, a lot of changes happen to the packet format in a very short period of time, especially in _dev_ branch. - -So, please make sure that all edges **and** the supernode have the exact same built version, e.g. all from current _dev_. - - -## Edge - - -### How can I know if peer-to-peer connection has successfully been established? - -The edge also offers a local udp management port at which it provides some information about connected _peers_ allowing a peer-to-peer connection, and _pending peers_ whose connections are forwarded through the supernode. - -The edge's management port defaults to 5644 and can be changed using edge's `-t` command line option. Connecting using the following command (localhost only) - -`netcat -u localhost 5644` - -answers every new line, i.e. pressing [ENTER] key, with current information. The edge even understands some simple commands, try `help`. - - -### The edge repeatedly throws an "Authentication error. MAC or IP address already in use or not released yet by supernode" message. What is wrong? - -The edge encountered n2n's protection against spoofing. It prevents that one edge's identity, MAC and IP address, can be impersonated by some other while the original one is still online, see some [details](Authentication.md). Mostly, there are two situations which can trigger this: - -If you use a MAC or IP address that already is in use, just change those parameters. - -If the edge prematurely has ended in a non-regular way, i.e. by killing it using `kill -9 ...` or `kill -SIGKILL ...`, it did not have a chance to un-register with the supernode which still counts the edge for online. A re-registration with the same MAC or IP address will be unsuccessful then. After two minutes or so the supernode will have forgotten. A new registration with the same parameters will be possible then. So, either wait two minutes or chose different parameters to restart with. - -And, as a matter of principal, always end an edge by either pressing `CTRL` + `C` or by sending SIGTERM or SIGINT by using `kill -SIGTERM ...` or `kill -SIGINT ...`! A plain `kill ...` without `-9` will do, too. And finally, a `stop` command to the management port peacefully ends the edge as well. diff --git a/bundles/n2n_ntop_v3/doc/Federation.md b/bundles/n2n_ntop_v3/doc/Federation.md deleted file mode 100644 index 3442346e..00000000 --- a/bundles/n2n_ntop_v3/doc/Federation.md +++ /dev/null @@ -1,39 +0,0 @@ -# Supernode Federation - -## Idea -To enhance resilience in terms of backup and fail-over, also for load-balancing, multiple supernodes can easily interconnect and form a special community, called **federation**. - - -## Using Multiple Supernodes - -### Form a Federation - -To form a federation, multiple supernodes need to be aware of each other. To get them connected, an additional `-l` option from command line is required at the supernode. - -This option takes the IP address (or name) and the UDP port of another known supernode, e.g. `-l 192.168.1.1:1234`. - -### Use a Federation - -Federated supernodes take care of propagating their knowledge about other supernodes to all other supernodes and the edges. - -So, in the first place, edges only need to connect to one supernode (called anchor supernode) using `-l` option. This supernode needs to be present at start-up. - -Optionally, more anchor supernodes of the same federation can be provided to an edge using several `-l` options. This will counter scenarios with reduced assured initial supernode availability. - -## How It Works - -Supernodes should be able to communicate among each other as regular edges already do. For this purpose, a special community called federation was introduced. The federation feature provides some mechanisms to inter-connect the supernodes of the network enhancing backup, fail-over and load-sharing, without any visible behavioral change. - -The default name for the federation is `*Federation`. Internally, a mandatory special character is prepended to the name: that way, an edge won't be able to provide a regular community with the same name of the federation. Optionally, a user can choose a federation name (same on all supernodes) and provide it via `-F mySecretFed` option to the supernode. Alternatively, the federation name can be passed through the environment variable `N2N_FEDERATION`. - -Federated supernodes register to each other using REGISTER_SUPER message type. The answer, REGISTER_SUPER_ACK, contains a payload with information about other supernodes in the network. - -This specific mechanism is also used during the registration process taking place between edges and supernodes, so edges are able to learn about other supernodes. - -Once edges have received this information, it is up to them choosing the supernode they want to connect to. Each edge pings supernodes from time to time and receives information about them inside the answer. We decided to implement a work-load based selection strategy because it is more in line with the idea of keeping the workload low on supernodes. Moreover, this way, the entire network load is evenly distributed among all available supernodes. - -An edge connects to the supernode with the lowest work-load and it is re-considered from time to time, with each re-registration. We use a stickyness factor to avoid too much jumping between supernodes. - -Thanks to this feature, n2n is now able to handle security attacks such as DoS against supernodes and it can redistribute the entire load of the network in a fair manner between all the supernodes. - -To serve scenarios in which an edge is supposed to select the supernode by round trip time, i.e. choosing the "closest" one, the `--select-rtt` command line option is available at the edge. Note, that workload distribution among supernodes might not be so fair then. diff --git a/bundles/n2n_ntop_v3/doc/Hacking.md b/bundles/n2n_ntop_v3/doc/Hacking.md deleted file mode 100644 index 1dd47740..00000000 --- a/bundles/n2n_ntop_v3/doc/Hacking.md +++ /dev/null @@ -1,262 +0,0 @@ -# Hacking - --------- - -This program and document is free software; you can redistribute -it and/or modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not see see [](http://www.gnu.org/licenses/) - --------- - -This file describes the internals of n2n. Read this before starting to modify -the code. Because coding examples may be present in this document it is licensed -under the GPL rather than FDL. - -## Symmetric NAT - -Symmetric NAT is a form of firewall NAT in which an UDP packets are only passed -back to an inside host socket when the return packets originate from the outside -socket to which the initiating UDP packets were sent. This means that when an -inside host sends UDP to some outside socket; other hosts cannot piggyback on -this opening in the firewall to send data to the inside host. - -For example, an asymmetric NAT would keep the mapping: - - ` -> ` - -and would redirect all the packets on external port ExtPort to the internal host -regardless of the remote IP. - -Whereas a symmetric NAT would keep the mapping: - - ` -> ` - -so only RemoteIP can send packets to the internal host. RemoteIP is the supernode -IP in case of n2n, to which the internal host has registered. - -In n2n, P2P can work monodirectionally if only one of the two peers is behind a symmetric -NAT. For example, if A is behind symmetric NAT and B is behind asymmetric NAT - - A->B packets are P2P (will have the B public IP as destination) - - B->A packets must go through the supernode - -If both the peers are behind symmetric NAT, then no P2P communication is possible. - -## ARP Cache - -n2n makes use of the host operating system's own ARP cache. Each edge node -allocates a random MAC address to itself. This MAC is constant for the life of -the edge process. ARP packets are passed around as broadcast ethernet packets -over n2n and these packets cause the native ARP cache to be updated. - -Edge nodes send gratuitous ARP packets on startup. See section on gratuitous ARP below. - - -## Registration and Peer-to-Peer Communication Setup - -A and B are edge nodes with public sockets Apub and Bpub; and private network -addresses A and B respectively. S is the supernode. - -A sends {REGISTER,Amac} to S. S registers {Amac->Apub}. - -B sends {REGISTER,Bmac} to S. S registers {Bmac->Bpub}. - -Now ping from A to B. - -A sends broadcast "arp who-has B" to S. S relays the packet to all known edge -nodes. B replies "B at Bmac" to supernode which forwards this to A. So now ping -A->B is known to be ping Amac(A)->Bmac(B). Note: gratuitous arp also requires -discussion. - -In response to receiving the arp reply, Apub sends {REGISTER,Amac} to Bpub. If -Bpub receives the request it sends back {REGISTER_ACK,Amac} and also sends its -own {REGISTER,Bmac} request. - -In response to receiving the "arp who-has", Bpub sends {REGISTER,Bmac} to Apub. - -Now the OS has received the arp reply and sends ICMP to Bmac(B) via the tunnel -on A. A looks up Bmac in the peers list and encapsulates the packet to Bpub or -the supernode if the MAC is not found. - -We assume that between two edge nodes, if Bpub receives a packet from Apub then -Apub can receive a packet from Bpub. This is the symmetric NAT case. Note: In -the symmetric NAT case, the public socket for a MAC address will be different -for direct contact when compared to information from the supernode. - -When two edge nodes are both behind symmetric NAT they cannot establish direct -communication. - -If A receives {REGISTER,Bmac} from B, A adds {Bmac->Bpub} to its peers list -knowing that Bmac is now reachable via that public socket. Similarly if B -receives {REGISTER,Amac} from A. - -The supernode never forwards REGISTER messages because the public socket seen by -the supervisor for some edge (eg. A) may be different to the socket seen by -another edge due to the actions of symmetric NAT (allocating a new public socket -for the new outbound UDP "connection"). - -## Edge Resgitration Design Ammendments (starting from 2008-04-10) - - * Send REGISTER on rx of PACKET or REGISTER only when dest_mac == device MAC -(do not send REGISTER on Rx of broadcast packets). - * After sending REGISTER add the new peer to pending_peers list; but - * Don't send REGISTER to a peer in pending_peers list - * Remove old entries from pending_peers at regular intervals - * On rx of REGISTER_ACK, move peer from pending_peers to known_peers for direct -comms and set last_seen=now - * On rx of any packet set last_seen=now in the known_peers entry (if it -exists); but do not add a new entry. - * If the public socket address for a known_peers entry changes, deleted it and -restart registration to the new peer. - * Peer sockets provided by the supernode are ignored unless no other entry -exists. Direct peer-to-peer sockets are always given more priority as the -supernode socket will not be usable for direct contact if the peer is behind -symmetric NAT. - -The pending_peers list concept is to prevent massive registration traffic when -supernode relay is in force - this would occur if REGISTER was sent for every -incident packet sent via supernode. Periodic REGISTER attempts will still occur; -not for every received packet. In the case where the peer cannot be contacted -(eg. both peers behind symmetric NAT), then there will still be periodic -attempts. Suggest a pending timeout of about 60 sec. - -A peer is only considered operational for peer-to-peer sending when a -REGISTER_ACK is returned. Once operational the peer is kept operational while -any direct packet communications are occurring. REGISTER is not required to -keep the path open through any firewalls; just some activity in one direction. - -After an idle period; the peer should be deleted from the known_peers list. We -should not try to re-register when this time expires. If there is no data to -send then forget the peer. This helps scalability. - -If a peer wants to be remembered it can send gratuitous ARP traffic which will -keep its entry in the known_peers list of any peers which already have the -entry. - -``` -peer = find_by_src_mac( hdr, known_peers ); /* return NULL or entry */ - -if ( peer ) -{ - peer_last_seen = time(NULL); -} -else -{ - if ( ! is_broadcast( hdr ) ) /* ignore broadcasts */ - { - if ( IS_REGISTER_ACK( hdr ) ) - { - /* move from pending to known_peers */ - set_peer_operational( hdr ); - } - else - { - /* add to pending and send REGISTER - ignore if in pending. */ - try_send_register( hdr ) - } - } -} -``` - -### Notes - - * In testing it was noted that if a symmetric NAT firewall shuts down the UDP -association but the known_peers registration is still active, then the peer -becomes unreachable until the known_peers registration is deleted. Suggest two -ways to mitigate this problem: - (a) make the known_peers purge timeout a config parameter; - (b) send packets direct and via supernode if the registration is older than - eg. 60 sec. - - -## Gratuitous ARP - -In addition to the ARP who-has mechanism noted above, two edge nodes can become -aware of one another by gratuitous ARP. A gratuitous ARP packet is a broadcast -packet sent by a node for no other purpose than to announce its presence and -identify its MAC and IP address. Gratuitous ARP packets are to keep ARP caches -up to date so contacting the host will be faster after an long idle time. - - -## man Pages - -Look at a non-installed man page like this (linux/UNIX): - -`nroff -man edge.8 | less` - - -## PACKET message format - -All message encoding and decoding is contained in wire.c. The PACKET message is -of main concern as it is the most frequently transferred as it contains -encapsulated ethernet packets. - -``` -Version 3 - - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - ! Version=3 ! TTL ! Flags ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 4 ! Community : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - 8 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -12 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -16 ! ... Community ... : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -20 ! ... Community ... ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -24 ! Source MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -28 : ! Destination MAC Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -32 : ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -36 ! Socket Flags (v=IPv4) ! Destination UDP Port ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -40 ! Destination IPv4 Address ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -44 ! Compress'n ID ! Transform ID ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -48 ! Payload - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -``` - -So each n2n PACKET has a 48 byte overhead. For a 1500 byte ethernet packet this -is roughly 3%. - -Socket flags provides support for IPv6. In this case the PACKET message ends as -follows: - -``` - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -36 ! Socket Flags (v=IPv6) ! Destination UDP Port ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -40 ! Destination IPv6 Address : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -44 : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -48 : : - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -52 : ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -56 ! Compress'n ID ! Transform ID ! - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -60 ! Encapsulated ethernet payload - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -``` - -------- -(C) 2008-2010 - Richard Andrews - -January 2010 - Richard Andrews \ No newline at end of file diff --git a/bundles/n2n_ntop_v3/doc/ManagementAPI.md b/bundles/n2n_ntop_v3/doc/ManagementAPI.md deleted file mode 100644 index 617e3458..00000000 --- a/bundles/n2n_ntop_v3/doc/ManagementAPI.md +++ /dev/null @@ -1,188 +0,0 @@ -# Management API - -This document is focused on the machine readable API interfaces. - -Both the edge and the supernode provide a management interface UDP port. -These interfaces have some documentation on their non machine readable -commands in the respective daemon man pages. - -Default Ports: -- UDP/5644 - edge -- UDP/5645 - supernode - -A Quick start example query: - `echo r 1 help | nc -w1 -u 127.0.0.1 5644` - -## JSON Query interface - -A machine readable API is available for both the edge and supernode. It -takes a simple text request and replies with JSON formatted data. - -The request is in simple text so that the daemon does not need to include any -complex parser. - -The replies are all in JSON so that the data is fully machine readable and -the schema can be updated as needed - the burden is entirely on the client -to handle different replies with different fields. It is expected that -any client software will be written in higher level programming languages -where this flexibility is easy to provide. - -Since the API is over UDP, the replies are structured so that each part of -the reply is clearly tagged as belonging to one request and there is a -clear begin and end marker for the reply. This is expected to support the -future possibilities of pipelined and overlapping transactions as well as -pub/sub asynchronous event channels. - -The replies will also handle some small amount of re-ordering of the -packets, but that is not an specific goal of the protocol. - -Note that this API will reply with a relatively large number of UDP packets -and that it is not intended for high frequency or high volume data transfer. -It was written to use a low amount of memory and to support incremental -generation of the reply data. - -With a small amount of effort, the API is intended to be human readable, -but this is intended for debugging. - -## Request API - -The request is a single UDP packet containing one line of text with at least -three space separated fields. Any text after the third field is available for -the API method to use for additional parameters - -Fields: -- Message Type -- Options -- Method -- Optional Additional Parameters - -The maximum length of the entire line of text is 80 octets. - -### Message Type - -This is a single octet that is either "r" for a read (or query) method -call or "w" for a write (or change) method call. - -To simplify the interface, the reply from both read and write calls to the -same method is expected to contain the same data. In the case of a write -call, the reply will contain the new state after making the requested change. - -### Options - -The options field is a colon separated set of options for this request. Only -the first subfield (the "tag") is mandatory. The second subfield is a set -of flags that describe which optional subfields are present. -If there are no additional subfields then the flags can be omitted. - -SubFields: -- Message Tag -- Optional Message Flags (defaults to 0) -- Optional Authentication Key - -#### Message Tag - -Each request provides a tag value. Any non error reply associated with this -request will include this tag value, allowing all related messages to be -collected within the client. - -Where possible, the error replies will also include this tag, however some -errors occur before the tag is parsed. - -The tag is not interpreted by the daemon, it is simply echoed back in all -the replies. It is expected to be a short string that the client chooses -to be unique amongst all recent or still outstanding requests. - -One possible client implementation is a number between 0 and 999, incremented -for each request and wrapping around to zero when it is greater than 999. - -#### Message Flags - -This subfield is a set of bit flags that are hex-encoded and describe any -remaining optional subfields. - -Currently, only one flag is defined. The presence of that flag indicates -that an authentication key subfield is also present. - -Values: -- 0 - No additional subfields are present -- 1 - One additional field, containing the authentication key - -#### Authentication Key - -A simple string password that is provided by the client to authenticate -this request. See the Authentication section below for more discussion. - -#### Example Options value - -e.g: - `102:1:PassWord` - -### Example Request string - -e.g: - `r 103:1:PassWord peer` - -## Reply API - -Each UDP packet in the reply is a complete and valid JSON dictionary -containing a fragment of information related to the entire reply. - -### Common metadata - -There are two keys in each dictionary containing metadata. First -is the `_tag`, containing the Message Tag from the original request. -Second is the `_type` whic identifies the expected contents of this -packet. - -### `_type: error` - -If an error condition occurs, a packet with a `error` key describing -the error will be sent. This usually also indicates that there will -be no more substantial data arriving related to this request. - -e.g: - `{"_tag":"107","_type":"error","error":"badauth"}` - -### `_type: begin` - -Before the start of any substantial data packets, a `begin` packet is -sent. For consistency checking, the method in the request is echoed -back in the `error` key. - -e.g: - `{"_tag":"108","_type":"begin","cmd":"peer"}` - -For simplicity in decoding, if a `begin` packet is sent, all attempts -are made to ensure that a final `end` packet is also sent. - -### `_type: end` - -After the last substantial data packet, a final `end` packet is sent -to signal to the client that this reply is finished. - -e.g: - `{"_tag":"108","_type":"end"}` - -### `_type: row` - -The substantial bulk of the data in the reply is contained within one or -more `row` packets. The non metadata contents of each `row` packet is -defined entirely by the method called and may change from version to version. - -Each `row` packet contains exactly one complete JSON object. The row replies -may be processed incrementally as each row arrives and no batching of multiple -packets will be required. - -e.g: - `{"_tag":"108","_type":"row","mode":"p2p","ip4addr":"10.135.98.84","macaddr":"86:56:21:E4:AA:39","sockaddr":"192.168.7.191:41701","desc":"client4","lastseen":1584682200}` - -## Authentication - -Some API requests will make global changes to the running daemon and may -affect the availability of the n2n networking. Therefore the machine -readable API include an authentication component. - -Currently, the only authentication is a simple password that the client -must provide. It defaults to 'n2n' and can manually be set through the -command line parameter `--management-password ` – for edge as well -as for supernode. diff --git a/bundles/n2n_ntop_v3/doc/Routing.md b/bundles/n2n_ntop_v3/doc/Routing.md deleted file mode 100644 index c4d57f2f..00000000 --- a/bundles/n2n_ntop_v3/doc/Routing.md +++ /dev/null @@ -1,188 +0,0 @@ -# IPv4 Routing (Linux) - -## General Remarks - -Reaching a remote network or tunneling all the internet traffic via n2n are two common tasks which require a proper routing setup. n2n supports routing needs providing options for packet forwarding including broadcasts as well as modifying the routing table. - -In this context, the `server` is the edge node which provides access to the remote network/internet, whereas the `client` is the connecting edge node. - -In order to enable routing, the `server` must be configured as follows: - -1. Add the `-r` option to the edge options to enable routing -2. Enable packet forwarding with `sudo sysctl -w net.ipv4.ip_forward=1` -3. Enable IP masquerading: `sudo iptables -t nat -A POSTROUTING -j MASQUERADE` - -On the client side, the easiest way to configure routing is via the `-n` option. For example: - -- In order to connect to the remote network `192.168.100.0/24`, use `-n 192.168.100.0/24:10.0.0.1` -- In order to tunnel all the internet traffic, use `-n 0.0.0.0/0:10.0.0.1` - -10.0.0.1 is the IP address of the gateway to use to route the specified network. It should correspond to the IP address of the `server` within n2n. Multiple `-n` options can be specified. - -As an alternative to the `-n` option, the `ip route` linux command can be manually used. See the [n2n-gateway.sh](scripts/n2n-gateway.sh) script for an example. See also the following description of other use cases and in depth explanation. - -## Special Scenarios - -### Assumptions - -- There are two Local Area Networks, namely 10.11.12.0/24 (maybe at - **h**ome) and 192.168.1.0/24 (maybe in **o**ffice). -- These networks are connected to the internet via routers 10.11.12.1 - and 192.168.1.1, respectively. -- In each network, there is a computer running a successfully setup n2n - node: 10.11.12.5 (**h**ickory) and 192.168.1.6 (**o**scar). They are - connected to their networks through a device called _eth0_. Their n2n - devices shall be called _n2n0_, and their n2n IP addresses are - 10.99.99.50 (**h**ickory) and 10.99.99.60 (**o**scar) in the - 10.99.99.0/24 network. -- The _iptables_ are flushed. - -### Prerequisites - -- Both, **h**ickory and **o**scar have ip forwarding enabled: `echo 1 > /proc/sys/net/ipv4/ip_forward` or `sysctl -w net.ipv4.ip_forward=1`. To - make this setting persistent over reboot, a file containing the line - `net.ipv4.ip_forward=1` could be added in /etc/sysctl.d/ – your distro - may vary. -- To allow n2n to forward packets, both edge nodes need to be started - with `-r` option on their command line. All other regular network - interfaces usually already allow packet forwarding and thus do not need - any further configuration. - -### Reach Complete Office Network from n2n Node at Home - -- To make **h**ickory send all packets with office destination via - **o**scar, **h**ickory needs to be made aware of where to route this - packets to. On **h**ickory: `ip route add 192.168.1.0/24 via 10.99.99.60 dev n2n0 src 10.11.12.5`. -- **o**scar needs to know where to send packets to, too. So, on - **o**scar: `ip route add 10.11.12.5 via 10.99.99.50 dev n2n0 src 192.168.1.6`. - -**o**scar and **h**ickory should now be able to exchange packets by -using just their regular (non-n2n) IP addresses 10.11.12.5 and 192.168.1.6. -To make the complete office network aware of how packets or answers are -sent to **h**ickory, one more step is required: - -- Packets from any office computer to **h**ickory need to be directed to - **o**scar that – thanks to enabled IP forwarding and the routing rule – - already knows how to handle this kind of packets. - - To handle it in a one-stop-shop, the office router 192.168.1.1 can - be configured to direct those packets to **o**scar. Luckily, even most - modern small-office-and-home routers allow to add static routing rules - via a web interface. A rule like "All packets for host 10.11.12.5 (or - network 10.11.12.0/24) need to be sent to another router, namely - 192.168.1.5" will do. This is the **recommended** solution. - - However, a **less recommended** but working option would be to add - static routes to each single of those computers in the office network - that shall be able to connect to or be accessed by **h**ickory. On - those, e.g. **o**livia with IP address 192.168.1.123: `ip route add 10.11.12.5 via 192.168.1.5 dev eth0 src 192.168.1.123`. - - Alternatively, in case the office router does not allow to have - added own static routing rules, **o**scar needs to perform NAT for all - connections initiated from **h**ickory: - `iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE` - `iptables -A FORWARD -i eth0 -o n2n0 -m state --state RELATED,ESTABLISHED -j ACCEPT` - `iptables -A FORWARD -i n2n0 -o eth0 -j ACCEPT` - There is a major drawback with this solution which thus is the **least - recommended**: Connections between **h**ickory and the office network - will only work if initiated by **h**ickory – not the other way 'round. - By the way, in case _iptables_ are messed up, they can be flushed by: - `iptables -F` - `iptables -X` - `iptables -t nat -F` - `iptables -t nat -X` - `iptables -t mangle -F` - `iptables -t mangle -X` - `iptables -t raw -F` - `iptables -t raw -X` - `iptables -t security -F` - `iptables -t security -X` - `iptables -P INPUT ACCEPT` - `iptables -P FORWARD ACCEPT` - `iptables -P OUTPUT ACCEPT` - -### Reach n2n Node in Office from Whole Home Network - -This is easy: - -- Just exchange home and office IP addresses and the computer names in - the instructions given above. - -### Reach Whole Home Network from Whole Office Network - -This is not too complicated either. Basically, follow the given example -above and apply the following changes: - -- The instructions used above need to be expanded from **h**ickory's IP - 10.11.12.5 to its full network 10.11.12.0/24 in the route commands on - **o**scar:, especially: `ip route add 10.11.12.0/24 via 10.99.99.50 dev n2n0 src 192.168.1.6`. -- In case of adding a static route to the office network router - 192.168.1.1, the home network 10.11.12.0/24 must be specified instead of - **h**ickory's more specific IP address 11.11.12.5. Same for the less - recommended static routes on other office computers. -- Packets from home network's computers to the office network need to be - sent through the n2n tunnel. The three alternatives given above can be - used just with exchanged office and home IP addresses. One needs to be - aware that NAT only (third alternative) on both sides will not allow any - connection, i.e. at least on one side static routes need to be added - either to the router (best option) or all those computers that shall be - able to connect to the other network. - -### Route All Internet Traffic from n2n Node at Home through Office Network - -This scenario could be considered a n2n-tunneled VPN connection which -also would work for travelling users on their laptop. All external -internet traffic will appear to originate from **o**scar and the office -network. - -- First, one of the setups described above needs to be in place, with - the following change: -- NAT on **o**scar (see the three _iptables_ commands above) must be - enabled. It will not work without because the office router 192.168.1.1 - usually denies forwarding to packets not originating from its own - network. It could be in addition to the eventually installed static - routes for 10.11.12.0/24 in the router 192.168.1.1 or on other office - computers – it will not interfere. However, **o**scar definitely needs - the route given above: `ip route add 10.11.12.5 via 10.99.99.50 dev n2n0 src 192.168.1.6`. -- To have **h**ickory's complete internet traffic going through the n2n - tunnel, its default route needs to be changed: - `ip route del default` - `ip route add default via 10.99.99.60 dev n2n0 src 10.11.12.5` - -- **h**ickory's home network should still be reachable as usually, - _eth0_ and the associated network 10.11.12.0/24 get their very own - route. If not, i.e. it was only covered by default route before, it - needs to be added: `ip route add 10.11.12.0/24 dev eth0 src 10.11.12.5`. -- Unfortunately (unless the supernode is on **h**ickory's local - network), n2n supernode becomes unreachable for **h**ickory. To fix it: - `ip route add via 10.11.12.1 dev eth0 src 10.11.12.5` - -The supernode's IP address needs to be known to have this work. However, -if the supernode's IP needs to be resolved from some domain name (FQDN), -e.g. in case of using dynamic domain name services, a DNS server needs -to remain reachable, too. Either the reachable home network router -10.11.12.1 is good enough for that (if it offers DNS) or another route -could to be added and **h**ickory's DNS settings might be set -accordingly, maybe to Google's 8.8.8.8. - -If [DNS leaks](https://en.wikipedia.org/wiki/DNS_leak) do not matter, -this setup is complete. - -### Preventing DNS Leaks - -Otherwise, there is more to it: Without changes, all future DNS queries -go through the home router 10.11.12.1 to the ISP's servers or directly -to Google (via the home router 10.11.12.1 along the configured route for -8.8.8.8 and not through the n2n tunnel) while the remaining traffic -ships through the n2n tunnel. - -To prevent such a DNS leak, the supernode's IP address must be -determined independently from **h**ickory's DNS configuration, e.g. by -digesting `dig +short mysupernode.myfavoritednsservice.com @8.8.8.8`'s -output in the n2n-edge's setup script for both, the edge node command -line as well as the static route mentioned above. Without further -additional work, dynamic address changes remain undetected. A static -route to 8.8.8.8 is still required. **h**ickory's regular DNS -configuration should query a different DNS server for its regular DNS -needs, e.g. 9.9.9.9 or 1.1.1.1 or maybe the office DNS server, maybe -192.168.1.1. This guarantees the regular DNS queries also to get sent -through the n2n tunnel. - -A test for DNS leaks can be found [here](https://www.dnsleaktest.com/). diff --git a/bundles/n2n_ntop_v3/doc/Scratchpad.md b/bundles/n2n_ntop_v3/doc/Scratchpad.md deleted file mode 100644 index 68d5f882..00000000 --- a/bundles/n2n_ntop_v3/doc/Scratchpad.md +++ /dev/null @@ -1,61 +0,0 @@ -# n2n's Scratchpad - -## RPM Packaging - -``` -bash -./autogen.sh -./configure -make - -cd packages/rpm -./configure -rpmbuild -bb ./n2n.spec -``` - -## New Features between 2.0.x and 2.1.x - -- Better ming Windows build support. -- Added `-E` flag to allow multicast ethernet traffic. - -## Draft changelog between 2.8 and 3.0 (as of September 27, 2021) - -### New Features - -- Federated supernodes to allow multiple supernodes for load balancing and fail-over (`doc/Federation.md`) -- Automatic IP address assignment allows edges to draw IP addresses from the supernode (just skip `-a`) -- Allowed community names can be restricted by regular expressions (`community.list` file) -- Network filter for rules (`-R`) allowing and denying specific traffic to tunnel -- Experimental TCP support (`-S2`) lets edges connect to the supernodes via TCP in case firewalls block UDP (not available on Windows yet) -- All four supported ciphers offer integrated versions rendering OpenSSL dependency non-mandatory (optionally still available) -- MAC and IP address spoofing prevention -- Network interface metric can be set by command-line option `-x` (Windows only) -- Re-enabled local peer detection by multicast on Windows -- Edge identifier (`-I`) helps to identify edges more easily in management port output -- Optionally bind edge to one local IP address only (extension to `-p`) -- A preferred local socket can be advertised to other edges for better local peer-to-peer connections (`-e`) -- Optional edge user and password authentication (`-J`, `-P`, `doc/Authentication.md`) -- Optional json format at management port allows for machine-driven handling such as `.html` page generation (`scripts/n2n-httpd`) or script-based evaluation (`scripts/n2n-ctl`) -- Completely overhauled build system including GitHub's action runners performing code syntax and formal checks, creating and running test builds, providing binairies and packages as artifacts and running verification tests - - -### Improvements - -- Increased edges' resilience to temporary supernode failure -- Fixed a compression-related memory leak -- Ciphers partly come with platform-specific hardware acceleration -- Added a test framework (`tools/test-*.c` and `tests/`) -- Clean-up management port output -- Polished benchmark tool output -- Spun-off the name resolution into a separate thread avoiding lags -- Added support for additional environment variables (`N2N_COMMUNITY`, `N2N_PASSWORD`, and `N2N_FEDERATION`) -- Implemented new `reload_communities` command to make supernode hot-reload the `-c` provided `community.list` file, issued through management port -- Reactivated send out of gratuitous ARP packet on establishing connection -- Enhanced documentation (`doc/` folder) including the man pages and command-line help text (`-h` and more detailed `--help`) -- Self-monitoring time stamp accuracy for use on systems with less accurate clocks -- Fixed man pages' and config files' paths -- Code clean-up - - - - diff --git a/bundles/n2n_ntop_v3/doc/Scripts.md b/bundles/n2n_ntop_v3/doc/Scripts.md deleted file mode 100644 index f2ac2ebc..00000000 --- a/bundles/n2n_ntop_v3/doc/Scripts.md +++ /dev/null @@ -1,55 +0,0 @@ -# Scripts - -There are a number of useful scripts included with the distribution. -Some of these scripts are only useful during build and development, but -other scripts are intended for end users to be able to use. These scripts -may be installed with n2n as part of your operating system package. - -Short descriptions of these scripts are below. - -## `scripts/hack_fakeautoconf.sh` - -This shell script is used during development to help build on Windows -systems. An example of how to use it is shown in -the [Building document](Building.md) - -## `scripts/indent.sh` - -This shell script is a wrapper for the `uncrustify` C code style checker -which checks or applies a set of rules to the code. It is used during -the automated lint checks. - -## `scripts/test_harness.sh` - -This shell script is used to run automated tests during development. - -## `scripts/n2n-ctl` - -This python script provides an easy command line interface to the running -n2n processes. It uses UDP communications to talk to the Management API. -By specifying the right UDP port, it can talk to both the edge and the -supernode daemons. - -Example: -- `scripts/n2n-ctl --help` -- `scripts/n2n-ctl help` - -## `scripts/n2n-httpd` - -This python script is a simple http gateway to the running edge. It provides -a proxy for REST-like HTTP requests to talk to the Management API. - -By default it runs on port 8080. - -It also provides a simple HTML page showing some edge information, which when -run with default settings can be seen at http://localhost:8080/ (Also -a http://localhost:8080/supernode.html page for the supernode) - -Example: -- `scripts/n2n-httpd --help` -- `scripts/n2n-httpd 8087` - -## `scripts/n2n-gateway.sh` - -A sample script to route all the host traffic towards a remote gateway, -which is reachable via the n2n virtual interface. diff --git a/bundles/n2n_ntop_v3/doc/TapConfiguration.md b/bundles/n2n_ntop_v3/doc/TapConfiguration.md deleted file mode 100644 index 69c9491c..00000000 --- a/bundles/n2n_ntop_v3/doc/TapConfiguration.md +++ /dev/null @@ -1,151 +0,0 @@ -# TAP Device Configuration - -n2n provides its service through a TAP device which is the virtual ethernet device seen by the computer and user. As a prerequisite, it requires the appropriate TAP driver to be installed. Most Linux systems come with it. If not loaded, `sudo modprobe tap` will do. - -For MacOS and Windows there are specific instructions; please see the [Building](./Building.md) document. - -## Device Name - -If the OS specific driver allows **naming** the virtual Ethernet device created by n2n, the `-d ` command-line option can be used to give a name, e.g. `-d n2n0`. This device name makes the virtual ethernet device easily accessible to all `ip` command activity, `iptables`, `tcpdump` and any other of your preferred network tools. It defaults to `edge0` if not provided through `-d`. - -One exception applies to Windows: As the installed TAP driver(s) come with fixed names, `-d ` **selects** the appropriate device by name out of the present ones. This is only required if more than one TAP devices are present. To help with it, `edge --help` lists the available TAP adapters at the bottom of its output (Windows only). - -## MAC - -Even virtual ethernet devices have a MAC address. As in real networks, it should be unique as it is used to identify the different participants and transport packets accordingly. The MAC address can optionally be specified by using the `-m ` command line parameter, e.g. `-m 01:02:03:04:05:06`. If omitted, n2n tries to assign a random MAC address. - -## IP Address - -n2n supports several ways to assign an IPv4 address to the virtual ethernet device. Support for IPv6 addresses relies on OS support. - -### Manually Assigned IP Address - -The command line parameter `-a ` assigns a static IP address, e.g. `-a static:192.168.8.5` to the device. The optional `static` keyword (and the delimiting colon) can be omitted, so `-a 192.168.8.5` works as well. - -The netmask in CIDR notation can optionally be appended to the address, e.g. `-a 192.168.8.5/24` for netmask `255.255.255.0` which also is the default should the netmask not be provided. - -### Auto IP Address - -If `-a` is omitted, the supernode assigns an IP address to the node. This feature uses different IP address pools on a per-community basis. So, all edges of the same community will find themselves in the same sub-network. - -By default, `/24`-sized IP address sub-network pools from the upper half of the `10.0.0.0` class A network will be used, that is from `10.128.0.0/24` … `10.255.255.0/24`. The supernode can be configured to assign addresses from a different network range: `-a 10.0.0.0-10.255.0.0/16` would the supernode make use of the complete `10.0.0.0` class A range but handle `/16`-sized sub-networks. Also, named communities could be pre-assigned certain sub-networks, please see the explanatory comments in the `community.list` file. - -### DHCP - -If an edge of the community runs a DHCP server, the others could draw their IP addresses from there. It requires the new edges to start-up with the `-r -a dhcp:0.0.0.0` parameters (literally). More details can be found [at this discussion](https://github.com/ntop/n2n/issues/629). - -### IPv6 - -n2n supports the carriage of IPv6 packets within the n2n tunnel. n2n does not -yet use IPv6 for transport between edges and supernodes. - -To make IPv6 carriage work you need to manually add IPv6 addresses to the TAP -interfaces at each end. There is currently no way to specify an IPv6 address on -the edge command line. - -For example, under Linux - -on hostA: -`[hostA] $ /sbin/ip -6 addr add fc00:abcd:1234::7/48 dev n2n0` - -on hostB: -`[hostB] $ /sbin/ip -6 addr add fc00:abcd:1234::6/48 dev n2n0` - -You may find it useful to make use of `tunctl` from the uml-utilities -package. `tunctl` allows you to bring up a TAP interface and configure addressing -prior to starting the edge. It also allows the edge to be restarted without the -interface closing (which would normally affect routing tables). - -Once the IPv6 addresses are configured and edge is started, IPv6 neighbor discovery -packets flow (get broadcast) and IPv6 entities self-arrange. Test your IPv6 -setup with `ping6` - the IPv6 ping command. - -## MTU - -The MTU of the VPN interface is set to a lower value (rather than the standard -value of 1500 bytes) to avoid excessive fragmentation of the datagram sent over the internet. -This is required because n2n adds additional headers to the packets received from -the VPN interface. The size of the final frame sent through the internet interface -must have a size lower or equal to the internet interface MTU (usually 1500 bytes). - -As a fragmentation example, suppose that a 3000 byte TCP segment should be sent through -the VPN. If the VPN interface MTU is set to 1500, the packet will be split into two -fragments of 1500 bytes each. However, n2n will add its headers to each fragment, so -each fragment becomes a 1540 byte packet. The internet interface MTU of 1500 bytes -will fragment each packet again in two further fragments, e.g. 1500 + 50 bytes, so a -total of 4 fragments will be sent over the internet. On the other hand, if the VPN interface -MTU was set to 1460 bytes, it would result in only 3 fragments sent as the initial segment of -3000 bytes would be split in 1460 + 1460 + 80 bytes without further fragmentation. - -IP packet fragmentation in general is something to avoid, as described in -http://www.hpl.hp.com/techreports/Compaq-DEC/WRL-87-3.pdf. If possible, -the fragmentation should be moved to the TCP layer by a proper MSS value. -This can be forced by mangling the packet MSS, which is called "MSS clamping" (currently not -implemented in n2n). See https://github.com/gsliepen/tinc/blob/228a03aaa707a5fcced9dd5148a4bdb7e5ef025b/src/route.c#L386. - -The exact value to use as a clamp value, however, depends on the PMTU, which is the minimum -MTU of the path between two hosts. Knowing the PMTU is also useful for a sender in order to -avoid fragmentation at IP level. Trying to find the highest non-fragmenting MTU possible is useful since it allows to -maximize bandwidth. - -### PMTU Discovery Failures - -Most operating systems try to periodically discover the PMTU by using a PMTU discovery algorithm. -This involves setting the DF (don't fragment) flag on the IP packets. When a large IP packet exceeds -the MTU of a router in the path, an "ICMP Fragmentation Needed" message should be received, which will -help the OS along to tune the size of the next IP packets. However, some routers do not report such ICMP message, -which results in packets being silently dropped. The `tracepath` tool can be used to detect the PMTU. - -The main problem with this situation is that the actual PMTU is unknown, so an automatic -solution is not applicable. The user must manually specify a lower MTU for the VPN interface -in order to solve the issue. - -### n2n and MTU - -n2n shall work by default in different environments. For this reason, the following solution -has been provided: - -- PMTU discovery is disabled if possible (via the IP_MTU_DISCOVER socket option). This avoids - silently dropping an oversized packet due to the DF flag; however, it possibly increments fragmentation on the path. -- As explained above, a lower MTU is set on the VPN interface, thus removing excessive fragmentation on - the sender. -- A value of 1290 bytes is used instead of 1500 bytes as reference value for the internet interface MTU. - This essentially avoids fragmentation if the PMTU is greater or equal than 1400 bytes. - -This is a conservative solution which should make n2n work by default. The user can manually -specify the MTU (`-M `) and re-enable PMTU discovery (`-D`) via the command-line interface options. - -## Interface Metric and Broadcasts - -On Windows, broadcasts are sent out to the network interface with the lowest metric only. This usually is the -WAN interface with its default metric of `25`. The `-x ` option could be used to configure the TAP with a -lower interface metric and hence facilitate service and online game server detection over n2n. - -Linux and others do not require this feature as broadcasts are sent to all network interfaces by default, also to the -virtual ones. - -## Multicast - -n2n does not transmit multicast packets by default. It can be enabled by edge's `-E` command-line parameter. - -## Egde Description - -To keep edge's and supernode's management port output well arranged and understandable, each edge can have a plain text description -fed to the edge by the optional `-I ` command-line parameter. If not provided, n2n uses the -hostname by default. - -A description field's hash value is used to choose an auto IP address. So, just be aware that changing the hostname -can lead to assigning a different auto IP address on next edge start-up – if auto IP address is used. - -## Routing - -n2n supports routing the traffic through its network. `-r` enables an edge to accept packets at its TAP interface not originating from the local IP address or not destined to the local IP address. As there is more to routing than just this one command-line option, please refer to the dedicated [Routing](Routing.md) document -explaining it all in detail. - -## Traffic Filter - -Setting up the integrated traffic filter permits to define exactly the kind of allowed traffic or deny -other on edge's TAP interface. It helps to keep unwanted traffic out of the n2n network for -bandwidth and security reasons. The traffic filter is disabled by default and gets activated by providing -as many `-R `-rules as required through edge's command-line. Specifics are written down in the -[Traffic Restrictions](TrafficRestricitons.md) documentation. diff --git a/bundles/n2n_ntop_v3/doc/TrafficRestrictions.md b/bundles/n2n_ntop_v3/doc/TrafficRestrictions.md deleted file mode 100644 index 8d6441ae..00000000 --- a/bundles/n2n_ntop_v3/doc/TrafficRestrictions.md +++ /dev/null @@ -1,41 +0,0 @@ -# Traffic Restrictions - -It is possible to drop or accept specific packet transmit over edge network interface by rules. Rules can be specify by (`-R rule_str`) multiple times. - -## Rule String Format - -rule_str format: `src_ip/len:[b_port,e_port],dst_ip/len:[s_port,e_port],TCP+/-,UDP+/-,ICMP+/-` - -`ip/len` indicate a cidr block, len can be ignore, means single ip (not cidr block) will be use in filter rule. - -`+`,`-` after `TCP`,`UDP`,`ICMP` proto type indicate allow or drop packet of that proto. if any of above three proto missed, the rule will not take effect for that proto. - -Ports range `[s_port,e_port]` can be instead by single port number. If not specify, `[0,65535]` will be used. Ports range include start_port and end_port. - -examples: -`192.168.1.5/32:[0,65535],192.168.0.0/24:[8081,65535],TCP-,UDP-,ICMP+` -`192.168.1.5:[0,65535],192.168.0.0/24:8000,ICMP+` -`192.168.1.5,192.168.0.7,TCP-,UDP-,ICMP-` // packets by all proto of all ports from 192.158.1.5 to any ports of 192.168.0.7 will be dropped. - -## Multiple Rules - -`-R rule_str` can be used multiple times to add multiple rules. Each `-R rule_str` add one rule. for example: - -`edge -c xxxx -k xxxx -a 192.168.100.5 -l xxx.xxx.xxx.xxx:1234 -r -R 192.168.1.5/32:[0,65535],192.168.0.0/24:[8081,65535],TCP-,UDP-,ICMP+ -R 192.168.1.5:[0,65535],192.168.0.0/24:8000,ICMP+ -R 192.168.1.5,192.168.0.7,TCP-` - -## Matching Rules Priority - -If multiple rules matching packet's ips and ports, the rule with smaller cidr block(smaller address space) will be selected. That means rules with larger `len` value has higher priority. - -Actually, current implementation will add the `len` of src cidr and dst cidr of each matched rules as priority value, the rule with largest priority value will take effect. - -## Blocklist/Allowlist mode - -Packets that cannot match any rule will be accepted by default. Users can add rules to block traffics. - -This behavior can be change by add the rule : `0.0.0.0/0:[0,65535],0.0.0.0/0:[0,65535],TCP-,UDP-,ICMP-`. Then all traffic will be dropped, users need add rules to allow traffics. - -for example, `-R 0.0.0.0/0,0.0.0.0/0,TCP-,UDP-,ICMP- -R 192.168.100.0/24,192.168.100.0/24,ICMP+` dropped all traffic, except ICMP traffics inside `192.168.100.0/24`. - -More complex behavior can be set with the feature of `Matching Rules Priority`. - diff --git a/bundles/n2n_ntop_v3/edge.8 b/bundles/n2n_ntop_v3/edge.8 deleted file mode 100644 index 529fd6fb..00000000 --- a/bundles/n2n_ntop_v3/edge.8 +++ /dev/null @@ -1,285 +0,0 @@ -.TH edge 8 "18 Jul 2021" "version 3" "SUPERUSER COMMANDS" -.SH NAME -edge \- n2n edge node daemon -.SH SYNOPSIS -.B edge - -.br -.B edge -\-c \-l [further options]... -.SH DESCRIPTION -N2N is a peer-to-peer VPN system. Edge is the edge node daemon for n2n which -creates a TAP interface to expose the n2n virtual LAN. On startup n2n creates -the TAP interface and configures it then registers with the supernode so it can -begin to find other nodes in the community. -.PP -The config file is similar to the command line, with one option per line. -Lines starting with a "#" are ignored. -An equal sign ('=') should be used between key and value. Example: -p=7777 -.SH OPTIONS FOR THE UNDERLYING NETWORK CONNECTION -.TP -\fB\-c \fR<\fIcommunity\fR>, \fB\-\-community\fR=<\fIcommunity\fR> -sets the n2n community name (see also N2N_COMMUNITY in ENVIRONMENT). All edges -within the same community appear on the same LAN (layer 2 network segment). -Community name is 16 bytes in length. A name smaller than this is padded with -0x00 bytes and a name longer than this is truncated to take the first 16 bytes. -.TP -\fB\-l \fR<\fIhost:port\fR>, \fB\-\-supernode-list\fR=<\fIhost:port\fR> -sets the n2n supernode IP address and port to register to. Multiple supernodes -can be specified. -.TP -\fB\-p \fR[<\fIlocal_ip_address\fR>:]<\fIlocal_port\fR> -binds edge to the given UDP port. Useful for keeping the same external socket -across restarts of edge. This allows peer edges which know the edge socket to -continue p2p operation without going back to the supernode. Also, home router's -port forwarding feature can refer to that fixed port. -Optionally, the edge can bind to the provided local ip address only. This is -useful in case restriction to a certain LAN or WiFi interface is desired. -By default, the edge binds to any interface. -.TP -\fB\-T \fR<\fItos\fR> -TOS for packets, e.g. 0x48 for SSH like priority -.TP -\fB\-D\fR -enable PMTU discovery, it can reduce fragmentation but -causes connections to stall if not properly supported -.TP -\fB\-e \fR<\fIlocal_ip_address\fR> -advertises the provided local IP address as preferred, -useful if multicast peer detection is not available, e.g. -disabled on routers. \fB\-e auto\fR tries auto-detection of -local IP address. -.TP -\fB\-S1\fR ... \fB\-S2\fR -do not connect p2p, always use the supernode, -\-S1 = via UDP, \-S2 = via TCP -.TP -\fB\-i \fR<\fIreg_interval\fR> -Supernode registration interval. It specifies the interval in seconds -between consecutive REGISTER_SUPER packets and it's used to keep NAT hole -open via the UDP NAT hole punching technique. This only works for asymmetric -NATs and allows for P2P communication. -.TP -\fB\-L \fR<\fIreg_ttl\fR> -set the TTL for the hole punching packet. This is an advanced flag to make -sure that the registration packet is dropped immediately when it goes out of -local nat so that it will not trigger some firewall behavior on target peer. -Actually, the registration packet is only expected to make local nat UDP hole -and is not expected to reach the target peer, see -https://tools.ietf.org/html/rfc5389. To achieve this, the flag should be set as -nat level + 1. For example, if we have 2 layer nat in local, we should set -L 3. -Usually we know exactly how much nat layers in local. -If we are not sure how much nat layers in local, we can use traceroute on -Linux to check. The following example shows a local single layer nat because on -second jump it shows a public ip address. In this case it should set -L 2. - -$ /usr/sbin/traceroute -w1 8.8.8.8 -.br -traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets - 1 192.168.3.1 (192.168.3.1) 0.464 ms 0.587 ms 0.719 ms - 2 112.65.17.217 (112.65.17.217) 5.269 ms 7.031 ms 8.666 ms - -But this method does not always work due to various local network device policy. -.TP -\fB\-k \fR<\fIkey\fR> -encryption key (ASCII) - also N2N_KEY= -\-k -sets the encryption key from ASCII text (see also N2N_KEY in -ENVIRONMENT). All edges communicating must use the same key and community -name. If -k not specified then edge uses cleartext mode (no encryption). -.TP -\fB\-A1\fR -disable payload encryption, do not use with key, defaults to AES then -.TP -\fB\-A2\fR ... \fB\-A5\fR -choose a cipher for payload encryption, requires a key, -\-A2 = Twofish, \-A3 = AES (default if key provided), -\-A4 = ChaCha20, \-A5 = Speck-CTR -.TP -\fB\-H\fR -use header encryption, supernode needs fixed community -.TP -\fB\-z1\fR ... \fB\-z2\fR -compress outgoing data packets, -z1 = lzo1x, disabled by default -.TP -\fB\-\-select-rtt\fR -select supernode by round trip time if several to choose from (federation), -defaults to load-based selection strategy if not provided. -.TP -\fB\-\-select-mac\fR -select supernode by MAC address if several to choose from (federation), -lowest MAC address first. -.SH TAP DEVICE AND OVERLAY NETWORK CONFIGURATION -.TP -\fB\-a \fR[\fImode\fR]<\fIip\fR>[\fI/n\fR] -interface address and optional CIDR subnet, default '/24', -mode = [static|dhcp]:, for DHCP use '\-r -a dhcp:0.0.0.0', -edge draws IP address from supernode if no '\-a ...' given -.TP -\fB\-m \fR<\fImac\fR> -start the TAP interface with the given MAC address. This is highly recommended -as it means the same address will be used if edge stops and restarts. If this is -not done, the ARP caches of all peers will be wrong and packets will not flow to -this edge until the next ARP refresh. -e.g. '\-m 10:20:30:40:50:60', by default a random MAC address is used. -.TP -\fB\-d \fR<\fIdevice\fR>, \fB\-\-device\fR=<\fIdevice\fR> -TAP device name -.TP -\fB\-M \fR<\fImtu\fR> -specify n2n MTU of TAP interface, default 1290 -.TP -\fB\-r\fR -enable IP packet forwarding/routing through the n2n virtual LAN. Without this -option, IP packets arriving over n2n are dropped if not for the -a (or -DHCP assigned) IP address of the edge interface. -.TP -\fB\-E\fR -accept packets destined for multicast ethernet MAC addresses. These addresses -are used in multicast ethernet and IPv6 neighbour discovery. If this option is -not present these multicast packets are discarded as most users do not need or -understand them. -.TP -\fB\-I \fR<\fIdescription\fR> -annotate the edge's description used for easier -identification in management port output or username -.TP -\fB\-J \fR<\fIpassword\fR> -password for user-password edge authentication (see also N2N_PASSWORD in ENVIRONMENT) -.TP -\fB\-P \fR<\fIpublic key\fR> -federation public key for user-password authentication -.TP -\fB\-R \fR<\fIrule_str\fR> -Add rule to drop or accept specific packet transmit over edge network interface. --R rule_str can be used multiple times to add multiple rules. Each -R rule_str add -one rule. - -rule_str format:"src_ip/len:[b_port,e_port],dst_ip/len:[s_port,e_port],TCP+/-,UDP+/-,ICMP+/-". - -ip/len indicate a cidr block, len can be ignore, means single ip(not cidr block) -will be use in filter rule. - -+,- after TCP,UDP,ICMP proto type indicate allow or drop packet of that proto. -if any of above three proto missed, the rule will not take effect for that proto. - -Ports range [s_port,e_port] can be instead by single port number. If not specify, [0,65535] -will be used. Ports range include start_port and end_port. If multiple rules matching packet's -ips and ports, the rule with smaller cidr block(smaller address space) will be selected. That -means rules with larger len value has higher priority. - -Packets that cannot match any rule will be accepted by default. Users can add rules to -block traffics. This behavior can be change by add the rule : `0.0.0.0/0:[0,65535],0.0.0.0/0: -[0,65535],TCP-,UDP-,ICMP-`. Then all traffic will be dropped, users need add rules to allow -traffics. - -for example : `-R 0.0.0.0/0,0.0.0.0/0,TCP-,UDP-,ICMP- -R 192.168.100.0/24,192.168.100.0/24,ICMP+`, -.TP -\fB\-x \fR<\fImetric\fR> -set TAP interface metric, defaults to 0 (auto), -e.g. set to 1 for better multiplayer game detection. -.br -(Windows only) -.SH LOCAL OPTIONS -.TP -\fB\-f\fR -do not fork and run as a daemon, rather run in foreground -.TP -\fB\-t \fR<\fIport\fR> -binds the edge management system to the given UDP port. Default 5644. Use this -if you need to run multiple instance of edge; or something is bound to that -port. -.TP -\fB\-\-management-password \fR<\fIpassword\fR> -sets the password for access to JSON API at the management port, defaults to 'n2n'. The password -has to be provided when using 'scripts/n2n-ctl', 'scripts/n2n-httpd' or for any other relevant -access to JSON API at the management port. -.TP -\fB\-v\fR, \fB\-\-verbose\fR -make more verbose, repeat as required -.TP -\fB\-n \fR<\fIcidr:gateway\fR> -route an IPv4 network via the gateway, use 0.0.0.0/0 for -the default gateway, can be set multiple times -.TP -\fB\-u \fR<\fIUID\fR>, \fB\-\-euid\fR=<\fIUID\fR> -numeric user ID to use when privileges are dropped -.TP -\fB\-g \fR<\fIGID\fR>, \fB\-\-egid\fR=<\fIGID\fR> -numeric group ID to use when privileges are dropped -.TP -\fb\-h\fr -write usage then exit. -.TP -\fb\--help\fr -shows detailed parameter description -.SH ENVIRONMENT -.TP -.B N2N_KEY -set the encryption key so it is not visible at the command line -.TP -.B N2N_COMMUNITY -set the community name so it is not visible at the command line -.TP -.B N2N_PASSWORD -set the password for user-password authentication so it is not visible at the command line -.SH EXAMPLES -.TP -.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:23 \-a 192.168.254.7 \-p 50001 \-l 123.121.120.119:7654 - -Start edge with TAP device n2n0 on community "mynetwork" with community -supernode at 123.121.120.119 UDP port 7654 and bind the locally used UDP port to -50001. Use "encryptme" as the single permanent shared encryption key. Assign MAC -address DE:AD:BE:EF:01:23 to the n2n interface and drop to user=99 and group=99 -after the TAP device is successfully configured. -.PP -Add the -f option to stop edge running as a daemon. -.PP -Somewhere else setup another edge with similar parameters, eg. - -.B edge \-d n2n0 \-c mynetwork \-k encryptme \-u 99 \-g 99 \-m DE:AD:BE:EF:01:21 \-a 192.168.254.5 \-p 50001 \-l 123.121.120.119:7654 -.PP -Now you can ping from 192.168.254.5 to 192.168.254.7. -.PP -The MAC address (-m ) and virtual IP address (-a ) must be different -on all edges in the same community. - -.SH CLEARTEXT MODE -If -.B -k -is not specified then edge uses cleartext mode. In cleartext mode there is no -transform of the packet data it is simply encrypted. This is useful for -debugging n2n as packet contents can be seen clearly. - -To prevent accidental exposure of data, edge only enters cleartext mode when no -keying parameters are specified. In the case where keying parameters are -specified but no valid keys can be determined, edge exits with an error at -startup. If all keys become invalid while running, edge continues to encode -using the last key that was valid. - -.SH MANAGEMENT INTERFACE -Edge provides a very simple management system on UDP port 5644. Send a newline -to receive a status output. Send 'stop' to cause edge to exit cleanly. - -.TP -.B echo | nc -w1 -u 127.0.0.1 5644 -Shows the current statistics of a running edge. - -.SH EXIT STATUS -edge is a daemon and any exit is an error. -.SH AUTHORS -.TP -Richard Andrews -andrews (at) ntop.org - n2n-1 maintainer and main author of n2n-2 -.TP -Luca Deri -deri (at) ntop.org - original author of n2n -.TP -Don Bindner -(--) - significant contributions to n2n-1 -.SH SEE ALSO -ifconfig(8) supernode(1) tunctl(8) n2n(7) -.br -the documentation contained in the source code -.br -the extensive documentation found in n2n's \fBdoc/\fR folder diff --git a/bundles/n2n_ntop_v3/include/aes.h b/bundles/n2n_ntop_v3/include/aes.h deleted file mode 100644 index a43997ed..00000000 --- a/bundles/n2n_ntop_v3/include/aes.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" // HAVE_OPENSSL_1_1, traceEvent ... - - -#ifndef AES_H -#define AES_H - - -#include -#include - -#include "portable_endian.h" - -#define AES_BLOCK_SIZE 16 -#define AES_IV_SIZE (AES_BLOCK_SIZE) - -#define AES256_KEY_BYTES (256/8) -#define AES192_KEY_BYTES (192/8) -#define AES128_KEY_BYTES (128/8) - - -#if defined (HAVE_OPENSSL_1_1) // openSSL 1.1 --------------------------------------------------------------------- - -#include -#include -#include - -typedef struct aes_context_t { - EVP_CIPHER_CTX *enc_ctx; /* openssl's reusable evp_* en/de-cryption context */ - EVP_CIPHER_CTX *dec_ctx; /* openssl's reusable evp_* en/de-cryption context */ - const EVP_CIPHER *cipher; /* cipher to use: e.g. EVP_aes_128_cbc */ - uint8_t key[AES256_KEY_BYTES]; /* the pure key data for payload encryption & decryption */ - AES_KEY ecb_dec_key; /* one step ecb decryption key */ -} aes_context_t; - -#elif defined (__AES__) && defined (__SSE2__) // Intel's AES-NI --------------------------------------------------- - -#include - -typedef struct aes_context_t { - __m128i rk_enc[15]; - __m128i rk_dec[15]; - int Nr; -} aes_context_t; - -#else // plain C -------------------------------------------------------------------------------------------------- - -typedef struct aes_context_t { - uint32_t enc_rk[60]; // round keys for encryption - uint32_t dec_rk[60]; // round keys for decryption - int Nr; // number of rounds -} aes_context_t; - -#endif // --------------------------------------------------------------------------------------------------------- - - -int aes_cbc_encrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, aes_context_t *ctx); - -int aes_cbc_decrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, aes_context_t *ctx); - -int aes_ecb_decrypt (unsigned char *out, const unsigned char *in, aes_context_t *ctx); - -int aes_init (const unsigned char *key, size_t key_size, aes_context_t **ctx); - -int aes_deinit (aes_context_t *ctx); - - -#endif // AES_H diff --git a/bundles/n2n_ntop_v3/include/auth.h b/bundles/n2n_ntop_v3/include/auth.h deleted file mode 100644 index 43bc5882..00000000 --- a/bundles/n2n_ntop_v3/include/auth.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - - -#include "n2n.h" - - -#ifndef AUTH_H -#define AUTH_H - - -int bin_to_ascii (char *out, uint8_t *in, size_t in_len); - -int ascii_to_bin (uint8_t *out, char *in); - -int generate_private_key (n2n_private_public_key_t key, char *in); - -int generate_public_key (n2n_private_public_key_t pub, n2n_private_public_key_t prv); - -int generate_shared_secret (n2n_private_public_key_t shared, n2n_private_public_key_t prv, n2n_private_public_key_t pub); - -int bind_private_key_to_username (n2n_private_public_key_t prv, char *username); - -int calculate_dynamic_key (uint8_t out_key[N2N_AUTH_CHALLENGE_SIZE], - uint32_t key_time, n2n_community_t comm, n2n_community_t fed); - - -#endif diff --git a/bundles/n2n_ntop_v3/include/cc20.h b/bundles/n2n_ntop_v3/include/cc20.h deleted file mode 100644 index 1030d517..00000000 --- a/bundles/n2n_ntop_v3/include/cc20.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#ifndef CC20_H -#define CC20_H - - -#include - -#include "n2n.h" // HAVE_OPENSSL_1_1, traceEvent ... - - -#define CC20_IV_SIZE 16 -#define CC20_KEY_BYTES (256/8) - - -#ifdef HAVE_OPENSSL_1_1 // openSSL 1.1 ---------------------------------------------------------------------------- - - -#include -#include - -typedef struct cc20_context_t { - EVP_CIPHER_CTX *ctx; /* openssl's reusable evp_* en/de-cryption context */ - const EVP_CIPHER *cipher; /* cipher to use: e.g. EVP_chacha20() */ - uint8_t key[CC20_KEY_BYTES]; /* the pure key data for payload encryption & decryption */ -} cc20_context_t; - - -#elif defined (__SSE2__) // SSE2 --------------------------------------------------------------------------------- - - -#include - -typedef struct cc20_context { - uint32_t keystream32[16]; - uint8_t key[CC20_KEY_BYTES]; -} cc20_context_t; - - -#else // plain C -------------------------------------------------------------------------------------------------- - - -typedef struct cc20_context { - uint32_t keystream32[16]; - uint32_t state[16]; - uint8_t key[CC20_KEY_BYTES]; -} cc20_context_t; - - -#endif // openSSL 1.1, plain C ------------------------------------------------------------------------------------ - - -int cc20_crypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, cc20_context_t *ctx); - -int cc20_init (const unsigned char *key, cc20_context_t **ctx); - -int cc20_deinit (cc20_context_t *ctx); - - -#endif // CC20_H diff --git a/bundles/n2n_ntop_v3/include/curve25519.h b/bundles/n2n_ntop_v3/include/curve25519.h deleted file mode 100644 index 96acaafe..00000000 --- a/bundles/n2n_ntop_v3/include/curve25519.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -void curve25519 (unsigned char *q, const unsigned char *n, const unsigned char *p); diff --git a/bundles/n2n_ntop_v3/include/edge_utils_win32.h b/bundles/n2n_ntop_v3/include/edge_utils_win32.h deleted file mode 100644 index 52720f76..00000000 --- a/bundles/n2n_ntop_v3/include/edge_utils_win32.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifndef _EDGE_UTILS_WIN32_H_ -#define _EDGE_UTILS_WIN32_H_ - -#ifdef WIN32 - -#define WIN32_LEAN_AND_MEAN - -#include -#include -#include -#include - - -/* Multicast peers discovery disabled due to https://github.com/ntop/n2n/issues/65 */ - -/* Currently, multicast is performed by specifying the default routing network adapter. - * If the solution is determined to be stable and effective, - * all macro definitions "SKIP_MULTICAST_PEERS_DISCOVERY" will be completely deleted in the future. - */ -//#define SKIP_MULTICAST_PEERS_DISCOVERY - -// TODO: this struct is pretty empty now, collapse it to just n2n_edge_t ? -struct tunread_arg { - n2n_edge_t *eee; -}; - -extern HANDLE startTunReadThread (struct tunread_arg *arg); -int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t ip_addr); - - -#endif /* WIN32 */ - -#endif /* _EDGE_UTILS_WIN32_H_ */ - diff --git a/bundles/n2n_ntop_v3/include/header_encryption.h b/bundles/n2n_ntop_v3/include/header_encryption.h deleted file mode 100644 index b12d858b..00000000 --- a/bundles/n2n_ntop_v3/include/header_encryption.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -int packet_header_decrypt (uint8_t packet[], uint16_t packet_len, - char *community_name, - he_context_t *ctx, he_context_t *ctx_iv, - uint64_t *stamp); - -int packet_header_encrypt (uint8_t packet[], uint16_t header_len, uint16_t packet_len, - he_context_t *ctx, he_context_t *ctx_iv, - uint64_t stamp); - -void packet_header_setup_key (const char *community_name, - he_context_t **ctx_static, he_context_t **ctx_dynamic, - he_context_t **ctx_iv_static, he_context_t **ctx_iv_dynamic); - -void packet_header_change_dynamic_key (uint8_t *key_dynamic, - he_context_t **ctx_dynamic, - he_context_t **ctx_iv_dynamic); diff --git a/bundles/n2n_ntop_v3/include/hexdump.h b/bundles/n2n_ntop_v3/include/hexdump.h deleted file mode 100644 index 4480319a..00000000 --- a/bundles/n2n_ntop_v3/include/hexdump.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef HEXDUMP_H -#define HEXDUMP_H - -void fhexdump(unsigned int display_addr, void *in, int size, FILE *stream); - -#endif diff --git a/bundles/n2n_ntop_v3/include/lzoconf.h b/bundles/n2n_ntop_v3/include/lzoconf.h deleted file mode 100644 index f9a8bdbe..00000000 --- a/bundles/n2n_ntop_v3/include/lzoconf.h +++ /dev/null @@ -1,453 +0,0 @@ -/* lzoconf.h -- configuration of the LZO data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __LZOCONF_H_INCLUDED -#define __LZOCONF_H_INCLUDED 1 - -#define LZO_VERSION 0x20a0 /* 2.10 */ -#define LZO_VERSION_STRING "2.10" -#define LZO_VERSION_DATE "Mar 01 2017" - -/* internal Autoconf configuration file - only used when building LZO */ -#if defined(LZO_HAVE_CONFIG_H) -# include -#endif -#include -#include - - -/*********************************************************************** -// LZO requires a conforming -************************************************************************/ - -#if !defined(CHAR_BIT) || (CHAR_BIT != 8) -# error "invalid CHAR_BIT" -#endif -#if !defined(UCHAR_MAX) || !defined(USHRT_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) -# error "check your compiler installation" -#endif -#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) -# error "your limits.h macros are broken" -#endif - -/* get OS and architecture defines */ -#ifndef __LZODEFS_H_INCLUDED -#include -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/*********************************************************************** -// some core defines -************************************************************************/ - -/* memory checkers */ -#if !defined(__LZO_CHECKER) -# if defined(__BOUNDS_CHECKING_ON) -# define __LZO_CHECKER 1 -# elif defined(__CHECKER__) -# define __LZO_CHECKER 1 -# elif defined(__INSURE__) -# define __LZO_CHECKER 1 -# elif defined(__PURIFY__) -# define __LZO_CHECKER 1 -# endif -#endif - - -/*********************************************************************** -// integral and pointer types -************************************************************************/ - -/* lzo_uint must match size_t */ -#if !defined(LZO_UINT_MAX) -# if (LZO_ABI_LLP64) -# if (LZO_OS_WIN64) - typedef unsigned __int64 lzo_uint; - typedef __int64 lzo_int; -# define LZO_TYPEOF_LZO_INT LZO_TYPEOF___INT64 -# else - typedef lzo_ullong_t lzo_uint; - typedef lzo_llong_t lzo_int; -# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG_LONG -# endif -# define LZO_SIZEOF_LZO_INT 8 -# define LZO_UINT_MAX 0xffffffffffffffffull -# define LZO_INT_MAX 9223372036854775807LL -# define LZO_INT_MIN (-1LL - LZO_INT_MAX) -# elif (LZO_ABI_IP32L64) /* MIPS R5900 */ - typedef unsigned int lzo_uint; - typedef int lzo_int; -# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT -# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT -# define LZO_UINT_MAX UINT_MAX -# define LZO_INT_MAX INT_MAX -# define LZO_INT_MIN INT_MIN -# elif (ULONG_MAX >= LZO_0xffffffffL) - typedef unsigned long lzo_uint; - typedef long lzo_int; -# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_LONG -# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG -# define LZO_UINT_MAX ULONG_MAX -# define LZO_INT_MAX LONG_MAX -# define LZO_INT_MIN LONG_MIN -# else -# error "lzo_uint" -# endif -#endif - -/* The larger type of lzo_uint and lzo_uint32_t. */ -#if (LZO_SIZEOF_LZO_INT >= 4) -# define lzo_xint lzo_uint -#else -# define lzo_xint lzo_uint32_t -#endif - -typedef int lzo_bool; - -/* sanity checks */ -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int) == LZO_SIZEOF_LZO_INT) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == LZO_SIZEOF_LZO_INT) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint)) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t)) - -#ifndef __LZO_MMODEL -#define __LZO_MMODEL /*empty*/ -#endif - -/* no typedef here because of const-pointer issues */ -#define lzo_bytep unsigned char __LZO_MMODEL * -#define lzo_charp char __LZO_MMODEL * -#define lzo_voidp void __LZO_MMODEL * -#define lzo_shortp short __LZO_MMODEL * -#define lzo_ushortp unsigned short __LZO_MMODEL * -#define lzo_intp lzo_int __LZO_MMODEL * -#define lzo_uintp lzo_uint __LZO_MMODEL * -#define lzo_xintp lzo_xint __LZO_MMODEL * -#define lzo_voidpp lzo_voidp __LZO_MMODEL * -#define lzo_bytepp lzo_bytep __LZO_MMODEL * - -#define lzo_int8_tp lzo_int8_t __LZO_MMODEL * -#define lzo_uint8_tp lzo_uint8_t __LZO_MMODEL * -#define lzo_int16_tp lzo_int16_t __LZO_MMODEL * -#define lzo_uint16_tp lzo_uint16_t __LZO_MMODEL * -#define lzo_int32_tp lzo_int32_t __LZO_MMODEL * -#define lzo_uint32_tp lzo_uint32_t __LZO_MMODEL * -#if defined(lzo_int64_t) -#define lzo_int64_tp lzo_int64_t __LZO_MMODEL * -#define lzo_uint64_tp lzo_uint64_t __LZO_MMODEL * -#endif - -/* Older LZO versions used to support ancient systems and memory models - * such as 16-bit MSDOS with __huge pointers or Cray PVP, but these - * obsolete configurations are not supported any longer. - */ -#if defined(__LZO_MMODEL_HUGE) -#error "__LZO_MMODEL_HUGE memory model is unsupported" -#endif -#if (LZO_MM_PVP) -#error "LZO_MM_PVP memory model is unsupported" -#endif -#if (LZO_SIZEOF_INT < 4) -#error "LZO_SIZEOF_INT < 4 is unsupported" -#endif -#if (__LZO_UINTPTR_T_IS_POINTER) -#error "__LZO_UINTPTR_T_IS_POINTER is unsupported" -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) >= 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) >= 4) -/* Strange configurations where sizeof(lzo_uint) != sizeof(size_t) should - * work but have not received much testing lately, so be strict here. - */ -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(size_t)) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(ptrdiff_t)) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(lzo_uintptr_t)) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_uintptr_t)) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_uintptr_t)) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long *) == sizeof(lzo_uintptr_t)) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_voidp)) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep)) - - -/*********************************************************************** -// function types -************************************************************************/ - -/* name mangling */ -#if !defined(__LZO_EXTERN_C) -# ifdef __cplusplus -# define __LZO_EXTERN_C extern "C" -# else -# define __LZO_EXTERN_C extern -# endif -#endif - -/* calling convention */ -#if !defined(__LZO_CDECL) -# define __LZO_CDECL __lzo_cdecl -#endif - -/* DLL export information */ -#if !defined(__LZO_EXPORT1) -# define __LZO_EXPORT1 /*empty*/ -#endif -#if !defined(__LZO_EXPORT2) -# define __LZO_EXPORT2 /*empty*/ -#endif - -/* __cdecl calling convention for public C and assembly functions */ -#if !defined(LZO_PUBLIC) -# define LZO_PUBLIC(r) __LZO_EXPORT1 r __LZO_EXPORT2 __LZO_CDECL -#endif -#if !defined(LZO_EXTERN) -# define LZO_EXTERN(r) __LZO_EXTERN_C LZO_PUBLIC(r) -#endif -#if !defined(LZO_PRIVATE) -# define LZO_PRIVATE(r) static r __LZO_CDECL -#endif - -/* function types */ -typedef int -(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -typedef int -(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem, - const lzo_bytep dict, lzo_uint dict_len ); - -typedef int -(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem, - const lzo_bytep dict, lzo_uint dict_len ); - - -/* Callback interface. Currently only the progress indicator ("nprogress") - * is used, but this may change in a future release. */ - -struct lzo_callback_t; -typedef struct lzo_callback_t lzo_callback_t; -#define lzo_callback_p lzo_callback_t __LZO_MMODEL * - -/* malloc & free function types */ -typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t) - (lzo_callback_p self, lzo_uint items, lzo_uint size); -typedef void (__LZO_CDECL *lzo_free_func_t) - (lzo_callback_p self, lzo_voidp ptr); - -/* a progress indicator callback function */ -typedef void (__LZO_CDECL *lzo_progress_func_t) - (lzo_callback_p, lzo_uint, lzo_uint, int); - -struct lzo_callback_t -{ - /* custom allocators (set to 0 to disable) */ - lzo_alloc_func_t nalloc; /* [not used right now] */ - lzo_free_func_t nfree; /* [not used right now] */ - - /* a progress indicator callback function (set to 0 to disable) */ - lzo_progress_func_t nprogress; - - /* INFO: the first parameter "self" of the nalloc/nfree/nprogress - * callbacks points back to this struct, so you are free to store - * some extra info in the following variables. */ - lzo_voidp user1; - lzo_xint user2; - lzo_xint user3; -}; - - -/*********************************************************************** -// error codes and prototypes -************************************************************************/ - -/* Error codes for the compression/decompression functions. Negative - * values are errors, positive values will be used for special but - * normal events. - */ -#define LZO_E_OK 0 -#define LZO_E_ERROR (-1) -#define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */ -#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ -#define LZO_E_INPUT_OVERRUN (-4) -#define LZO_E_OUTPUT_OVERRUN (-5) -#define LZO_E_LOOKBEHIND_OVERRUN (-6) -#define LZO_E_EOF_NOT_FOUND (-7) -#define LZO_E_INPUT_NOT_CONSUMED (-8) -#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ -#define LZO_E_INVALID_ARGUMENT (-10) -#define LZO_E_INVALID_ALIGNMENT (-11) /* pointer argument is not properly aligned */ -#define LZO_E_OUTPUT_NOT_CONSUMED (-12) -#define LZO_E_INTERNAL_ERROR (-99) - - -#ifndef lzo_sizeof_dict_t -# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep)) -#endif - -/* lzo_init() should be the first function you call. - * Check the return code ! - * - * lzo_init() is a macro to allow checking that the library and the - * compiler's view of various types are consistent. - */ -#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ - (int)sizeof(long),(int)sizeof(lzo_uint32_t),(int)sizeof(lzo_uint),\ - (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ - (int)sizeof(lzo_callback_t)) -LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int); - -/* version functions (useful for shared libraries) */ -LZO_EXTERN(unsigned) lzo_version(void); -LZO_EXTERN(const char *) lzo_version_string(void); -LZO_EXTERN(const char *) lzo_version_date(void); -LZO_EXTERN(const lzo_charp) _lzo_version_string(void); -LZO_EXTERN(const lzo_charp) _lzo_version_date(void); - -/* string functions */ -LZO_EXTERN(int) - lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len); -LZO_EXTERN(lzo_voidp) - lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len); -LZO_EXTERN(lzo_voidp) - lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len); -LZO_EXTERN(lzo_voidp) - lzo_memset(lzo_voidp buf, int c, lzo_uint len); - -/* checksum functions */ -LZO_EXTERN(lzo_uint32_t) - lzo_adler32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len); -LZO_EXTERN(lzo_uint32_t) - lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len); -LZO_EXTERN(const lzo_uint32_tp) - lzo_get_crc32_table(void); - -/* misc. */ -LZO_EXTERN(int) _lzo_config_check(void); -typedef union { - lzo_voidp a00; lzo_bytep a01; lzo_uint a02; lzo_xint a03; lzo_uintptr_t a04; - void *a05; unsigned char *a06; unsigned long a07; size_t a08; ptrdiff_t a09; -#if defined(lzo_int64_t) - lzo_uint64_t a10; -#endif -} lzo_align_t; - -/* align a char pointer on a boundary that is a multiple of 'size' */ -LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size); -#define LZO_PTR_ALIGN_UP(p,size) \ - ((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size))) - - -/*********************************************************************** -// deprecated macros - only for backward compatibility -************************************************************************/ - -/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */ -#define lzo_byte unsigned char -/* deprecated type names */ -#define lzo_int32 lzo_int32_t -#define lzo_uint32 lzo_uint32_t -#define lzo_int32p lzo_int32_t __LZO_MMODEL * -#define lzo_uint32p lzo_uint32_t __LZO_MMODEL * -#define LZO_INT32_MAX LZO_INT32_C(2147483647) -#define LZO_UINT32_MAX LZO_UINT32_C(4294967295) -#if defined(lzo_int64_t) -#define lzo_int64 lzo_int64_t -#define lzo_uint64 lzo_uint64_t -#define lzo_int64p lzo_int64_t __LZO_MMODEL * -#define lzo_uint64p lzo_uint64_t __LZO_MMODEL * -#define LZO_INT64_MAX LZO_INT64_C(9223372036854775807) -#define LZO_UINT64_MAX LZO_UINT64_C(18446744073709551615) -#endif -/* deprecated types */ -typedef union { lzo_bytep a; lzo_uint b; } __lzo_pu_u; -typedef union { lzo_bytep a; lzo_uint32_t b; } __lzo_pu32_u; -/* deprecated defines */ -#if !defined(LZO_SIZEOF_LZO_UINT) -# define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_LZO_INT -#endif - -#if defined(LZO_CFG_COMPAT) - -#define __LZOCONF_H 1 - -#if defined(LZO_ARCH_I086) -# define __LZO_i386 1 -#elif defined(LZO_ARCH_I386) -# define __LZO_i386 1 -#endif - -#if defined(LZO_OS_DOS16) -# define __LZO_DOS 1 -# define __LZO_DOS16 1 -#elif defined(LZO_OS_DOS32) -# define __LZO_DOS 1 -#elif defined(LZO_OS_WIN16) -# define __LZO_WIN 1 -# define __LZO_WIN16 1 -#elif defined(LZO_OS_WIN32) -# define __LZO_WIN 1 -#endif - -#define __LZO_CMODEL /*empty*/ -#define __LZO_DMODEL /*empty*/ -#define __LZO_ENTRY __LZO_CDECL -#define LZO_EXTERN_CDECL LZO_EXTERN -#define LZO_ALIGN LZO_PTR_ALIGN_UP - -#define lzo_compress_asm_t lzo_compress_t -#define lzo_decompress_asm_t lzo_decompress_t - -#endif /* LZO_CFG_COMPAT */ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* already included */ - - -/* vim:set ts=4 sw=4 et: */ diff --git a/bundles/n2n_ntop_v3/include/lzodefs.h b/bundles/n2n_ntop_v3/include/lzodefs.h deleted file mode 100644 index c3e2bcf5..00000000 --- a/bundles/n2n_ntop_v3/include/lzodefs.h +++ /dev/null @@ -1,3268 +0,0 @@ -/* lzodefs.h -- architecture, OS and compiler specific defines - - This file is part of the LZO real-time data compression library. - - Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __LZODEFS_H_INCLUDED -#define __LZODEFS_H_INCLUDED 1 - -#if defined(__CYGWIN32__) && !defined(__CYGWIN__) -# define __CYGWIN__ __CYGWIN32__ -#endif -#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) -# define _ALL_SOURCE 1 -#endif -#if defined(__mips__) && defined(__R5900__) -# if !defined(__LONG_MAX__) -# define __LONG_MAX__ 9223372036854775807L -# endif -#endif -#if 0 -#elif !defined(__LZO_LANG_OVERRIDE) -#if (defined(__clang__) || defined(__GNUC__)) && defined(__ASSEMBLER__) -# if (__ASSEMBLER__+0) <= 0 -# error "__ASSEMBLER__" -# else -# define LZO_LANG_ASSEMBLER 1 -# endif -#elif defined(__cplusplus) -# if (__cplusplus+0) <= 0 -# error "__cplusplus" -# elif (__cplusplus < 199711L) -# define LZO_LANG_CXX 1 -# elif defined(_MSC_VER) && defined(_MSVC_LANG) && (_MSVC_LANG+0 >= 201402L) && 1 -# define LZO_LANG_CXX _MSVC_LANG -# else -# define LZO_LANG_CXX __cplusplus -# endif -# define LZO_LANG_CPLUSPLUS LZO_LANG_CXX -#else -# if defined(__STDC_VERSION__) && (__STDC_VERSION__+0 >= 199409L) -# define LZO_LANG_C __STDC_VERSION__ -# else -# define LZO_LANG_C 1 -# endif -#endif -#endif -#if !defined(LZO_CFG_NO_DISABLE_WUNDEF) -#if defined(__ARMCC_VERSION) -# pragma diag_suppress 193 -#elif defined(__clang__) && defined(__clang_minor__) -# pragma clang diagnostic ignored "-Wundef" -#elif defined(__INTEL_COMPILER) -# pragma warning(disable: 193) -#elif defined(__KEIL__) && defined(__C166__) -# pragma warning disable = 322 -#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__PATHSCALE__) -# if ((__GNUC__-0) >= 5 || ((__GNUC__-0) == 4 && (__GNUC_MINOR__-0) >= 2)) -# pragma GCC diagnostic ignored "-Wundef" -# endif -#elif defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -# if ((_MSC_VER-0) >= 1300) -# pragma warning(disable: 4668) -# endif -#endif -#endif -#if 0 && defined(__POCC__) && defined(_WIN32) -# if (__POCC__ >= 400) -# pragma warn(disable: 2216) -# endif -#endif -#if 0 && defined(__WATCOMC__) -# if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) -# pragma warning 203 9 -# endif -#endif -#if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) -# pragma option -h -#endif -#if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC) -#ifndef _CRT_NONSTDC_NO_DEPRECATE -#define _CRT_NONSTDC_NO_DEPRECATE 1 -#endif -#ifndef _CRT_NONSTDC_NO_WARNINGS -#define _CRT_NONSTDC_NO_WARNINGS 1 -#endif -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE 1 -#endif -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS 1 -#endif -#endif -#if 0 -#define LZO_0xffffUL 0xfffful -#define LZO_0xffffffffUL 0xfffffffful -#else -#define LZO_0xffffUL 65535ul -#define LZO_0xffffffffUL 4294967295ul -#endif -#define LZO_0xffffL LZO_0xffffUL -#define LZO_0xffffffffL LZO_0xffffffffUL -#if (LZO_0xffffL == LZO_0xffffffffL) -# error "your preprocessor is broken 1" -#endif -#if (16ul * 16384ul != 262144ul) -# error "your preprocessor is broken 2" -#endif -#if 0 -#if (32767 >= 4294967295ul) -# error "your preprocessor is broken 3" -#endif -#if (65535u >= 4294967295ul) -# error "your preprocessor is broken 4" -#endif -#endif -#if defined(__COUNTER__) -# ifndef LZO_CFG_USE_COUNTER -# define LZO_CFG_USE_COUNTER 1 -# endif -#else -# undef LZO_CFG_USE_COUNTER -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) -# if !defined(MSDOS) -# define MSDOS 1 -# endif -# if !defined(_MSDOS) -# define _MSDOS 1 -# endif -#elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) -# if (__VERSION == 520) && (MB_LEN_MAX == 1) -# if !defined(__AZTEC_C__) -# define __AZTEC_C__ __VERSION -# endif -# if !defined(__DOS__) -# define __DOS__ 1 -# endif -# endif -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(_MSC_VER) && defined(M_I86HM) -# define ptrdiff_t long -# define _PTRDIFF_T_DEFINED 1 -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -# if defined(__AZTEC_C__) && defined(__DOS__) -# define __LZO_RENAME_A 1 -# elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define __LZO_RENAME_A 1 -# elif (_MSC_VER < 700) -# define __LZO_RENAME_B 1 -# endif -# elif defined(__TSC__) && defined(__OS2__) -# define __LZO_RENAME_A 1 -# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) -# define __LZO_RENAME_A 1 -# elif defined(__PACIFIC__) && defined(DOS) -# if !defined(__far) -# define __far far -# endif -# if !defined(__near) -# define __near near -# endif -# endif -# if defined(__LZO_RENAME_A) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif -# if !defined(__huge) -# define __huge huge -# endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# if !defined(__huge) -# define __huge huge -# endif -# elif defined(__LZO_RENAME_B) -# if !defined(__cdecl) -# define __cdecl _cdecl -# endif -# if !defined(__far) -# define __far _far -# endif -# if !defined(__huge) -# define __huge _huge -# endif -# if !defined(__near) -# define __near _near -# endif -# if !defined(__pascal) -# define __pascal _pascal -# endif -# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# endif -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__AZTEC_C__) && defined(__DOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -#elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# endif -# if (_MSC_VER < 700) -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# define LZO_BROKEN_SIZEOF 1 -# endif -#elif defined(__PACIFIC__) && defined(DOS) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#elif defined(__TURBOC__) && defined(__MSDOS__) -# if (__TURBOC__ < 0x0150) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# endif -# if (__TURBOC__ < 0x0200) -# define LZO_BROKEN_SIZEOF 1 -# endif -# if (__TURBOC__ < 0x0400) && defined(__cplusplus) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# endif -#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_SIZEOF 1 -#endif -#endif -#if defined(__WATCOMC__) && (__WATCOMC__ < 900) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#endif -#if defined(_CRAY) && defined(_CRAY1) -# define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 -#endif -#define LZO_PP_STRINGIZE(x) #x -#define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -#define LZO_PP_CONCAT0() /*empty*/ -#define LZO_PP_CONCAT1(a) a -#define LZO_PP_CONCAT2(a,b) a ## b -#define LZO_PP_CONCAT3(a,b,c) a ## b ## c -#define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_PP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f -#define LZO_PP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g -#define LZO_PP_ECONCAT0() LZO_PP_CONCAT0() -#define LZO_PP_ECONCAT1(a) LZO_PP_CONCAT1(a) -#define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) -#define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) -#define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) -#define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -#define LZO_PP_ECONCAT6(a,b,c,d,e,f) LZO_PP_CONCAT6(a,b,c,d,e,f) -#define LZO_PP_ECONCAT7(a,b,c,d,e,f,g) LZO_PP_CONCAT7(a,b,c,d,e,f,g) -#define LZO_PP_EMPTY /*empty*/ -#define LZO_PP_EMPTY0() /*empty*/ -#define LZO_PP_EMPTY1(a) /*empty*/ -#define LZO_PP_EMPTY2(a,b) /*empty*/ -#define LZO_PP_EMPTY3(a,b,c) /*empty*/ -#define LZO_PP_EMPTY4(a,b,c,d) /*empty*/ -#define LZO_PP_EMPTY5(a,b,c,d,e) /*empty*/ -#define LZO_PP_EMPTY6(a,b,c,d,e,f) /*empty*/ -#define LZO_PP_EMPTY7(a,b,c,d,e,f,g) /*empty*/ -#if 1 -#define LZO_CPP_STRINGIZE(x) #x -#define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -#define LZO_CPP_CONCAT2(a,b) a ## b -#define LZO_CPP_CONCAT3(a,b,c) a ## b ## c -#define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_CPP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f -#define LZO_CPP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g -#define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) -#define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) -#define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) -#define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -#define LZO_CPP_ECONCAT6(a,b,c,d,e,f) LZO_CPP_CONCAT6(a,b,c,d,e,f) -#define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g) -#endif -#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-((b)!=0))) - (o)) << 1) + (o)*((b)!=0)) -#if 1 && defined(__cplusplus) -# if !defined(__STDC_CONSTANT_MACROS) -# define __STDC_CONSTANT_MACROS 1 -# endif -# if !defined(__STDC_LIMIT_MACROS) -# define __STDC_LIMIT_MACROS 1 -# endif -#endif -#if defined(__cplusplus) -# define LZO_EXTERN_C extern "C" -# define LZO_EXTERN_C_BEGIN extern "C" { -# define LZO_EXTERN_C_END } -#else -# define LZO_EXTERN_C extern -# define LZO_EXTERN_C_BEGIN /*empty*/ -# define LZO_EXTERN_C_END /*empty*/ -#endif -#if !defined(__LZO_OS_OVERRIDE) -#if (LZO_OS_FREESTANDING) -# define LZO_INFO_OS "freestanding" -#elif (LZO_OS_EMBEDDED) -# define LZO_INFO_OS "embedded" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_OS_EMBEDDED 1 -# define LZO_INFO_OS "embedded" -#elif defined(__CYGWIN__) && defined(__GNUC__) -# define LZO_OS_CYGWIN 1 -# define LZO_INFO_OS "cygwin" -#elif defined(__EMX__) && defined(__GNUC__) -# define LZO_OS_EMX 1 -# define LZO_INFO_OS "emx" -#elif defined(__BEOS__) -# define LZO_OS_BEOS 1 -# define LZO_INFO_OS "beos" -#elif defined(__Lynx__) -# define LZO_OS_LYNXOS 1 -# define LZO_INFO_OS "lynxos" -#elif defined(__OS400__) -# define LZO_OS_OS400 1 -# define LZO_INFO_OS "os400" -#elif defined(__QNX__) -# define LZO_OS_QNX 1 -# define LZO_INFO_OS "qnx" -#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__BORLANDC__) && defined(__DPMI16__) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -#elif defined(__ZTC__) && defined(DOS386) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__OS2__) || defined(__OS2V2__) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_OS216 1 -# define LZO_INFO_OS "os216" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_OS2 1 -# define LZO_INFO_OS "os2" -# else -# error "check your limits.h header" -# endif -#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) -# define LZO_OS_WIN64 1 -# define LZO_INFO_OS "win64" -#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__MWERKS__) && defined(__INTEL__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_WIN16 1 -# define LZO_INFO_OS "win16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# else -# error "check your limits.h header" -# endif -#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -# else -# error "check your limits.h header" -# endif -#elif defined(__WATCOMC__) -# if defined(__NT__) && (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif defined(__NT__) && (__WATCOMC__ < 1100) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# elif defined(__linux__) || defined(__LINUX__) -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -# else -# error "please specify a target using the -bt compiler option" -# endif -#elif defined(__palmos__) -# define LZO_OS_PALMOS 1 -# define LZO_INFO_OS "palmos" -#elif defined(__TOS__) || defined(__atarist__) -# define LZO_OS_TOS 1 -# define LZO_INFO_OS "tos" -#elif defined(macintosh) && !defined(__arm__) && !defined(__i386__) && !defined(__ppc__) && !defined(__x64_64__) -# define LZO_OS_MACCLASSIC 1 -# define LZO_INFO_OS "macclassic" -#elif defined(__VMS) -# define LZO_OS_VMS 1 -# define LZO_INFO_OS "vms" -#elif (defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PS2 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "ps2" -#elif defined(__mips__) && defined(__psp__) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PSP 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "psp" -#else -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -#endif -#if (LZO_OS_POSIX) -# if defined(_AIX) || defined(__AIX__) || defined(__aix__) -# define LZO_OS_POSIX_AIX 1 -# define LZO_INFO_OS_POSIX "aix" -# elif defined(__FreeBSD__) -# define LZO_OS_POSIX_FREEBSD 1 -# define LZO_INFO_OS_POSIX "freebsd" -# elif defined(__hpux__) || defined(__hpux) -# define LZO_OS_POSIX_HPUX 1 -# define LZO_INFO_OS_POSIX "hpux" -# elif defined(__INTERIX) -# define LZO_OS_POSIX_INTERIX 1 -# define LZO_INFO_OS_POSIX "interix" -# elif defined(__IRIX__) || defined(__irix__) -# define LZO_OS_POSIX_IRIX 1 -# define LZO_INFO_OS_POSIX "irix" -# elif defined(__linux__) || defined(__linux) || defined(__LINUX__) -# define LZO_OS_POSIX_LINUX 1 -# define LZO_INFO_OS_POSIX "linux" -# elif defined(__APPLE__) && defined(__MACH__) -# if ((__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__-0) >= 20000) -# define LZO_OS_POSIX_DARWIN 1040 -# define LZO_INFO_OS_POSIX "darwin_iphone" -# elif ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) >= 1040) -# define LZO_OS_POSIX_DARWIN __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ -# define LZO_INFO_OS_POSIX "darwin" -# else -# define LZO_OS_POSIX_DARWIN 1 -# define LZO_INFO_OS_POSIX "darwin" -# endif -# define LZO_OS_POSIX_MACOSX LZO_OS_POSIX_DARWIN -# elif defined(__minix__) || defined(__minix) -# define LZO_OS_POSIX_MINIX 1 -# define LZO_INFO_OS_POSIX "minix" -# elif defined(__NetBSD__) -# define LZO_OS_POSIX_NETBSD 1 -# define LZO_INFO_OS_POSIX "netbsd" -# elif defined(__OpenBSD__) -# define LZO_OS_POSIX_OPENBSD 1 -# define LZO_INFO_OS_POSIX "openbsd" -# elif defined(__osf__) -# define LZO_OS_POSIX_OSF 1 -# define LZO_INFO_OS_POSIX "osf" -# elif defined(__solaris__) || defined(__sun) -# if defined(__SVR4) || defined(__svr4__) -# define LZO_OS_POSIX_SOLARIS 1 -# define LZO_INFO_OS_POSIX "solaris" -# else -# define LZO_OS_POSIX_SUNOS 1 -# define LZO_INFO_OS_POSIX "sunos" -# endif -# elif defined(__ultrix__) || defined(__ultrix) -# define LZO_OS_POSIX_ULTRIX 1 -# define LZO_INFO_OS_POSIX "ultrix" -# elif defined(_UNICOS) -# define LZO_OS_POSIX_UNICOS 1 -# define LZO_INFO_OS_POSIX "unicos" -# else -# define LZO_OS_POSIX_UNKNOWN 1 -# define LZO_INFO_OS_POSIX "unknown" -# endif -#endif -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# if (UINT_MAX != LZO_0xffffL) -# error "unexpected configuration - check your compiler defines" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (UINT_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -# define LZO_CC_CILLY 1 -# define LZO_INFO_CC "Cilly" -# if defined(__CILLY__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) -# define LZO_CC_SDCC 1 -# define LZO_INFO_CC "sdcc" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) -#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) -# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + (__PATHCC_MINOR__-0) * 0x100 + (__PATHCC_PATCHLEVEL__-0)) -# define LZO_INFO_CC "Pathscale C" -# define LZO_INFO_CCVER __PATHSCALE__ -# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# define LZO_CC_PATHSCALE_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# endif -#elif defined(__INTEL_COMPILER) && ((__INTEL_COMPILER-0) > 0) -# define LZO_CC_INTELC __INTEL_COMPILER -# define LZO_INFO_CC "Intel C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) -# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -# define LZO_CC_INTELC_MSC _MSC_VER -# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# define LZO_CC_INTELC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# endif -#elif defined(__POCC__) && defined(_WIN32) -# define LZO_CC_PELLESC 1 -# define LZO_INFO_CC "Pelles C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__ARMCC_VERSION) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# if defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# else -# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) -# endif -# define LZO_CC_ARMCC __ARMCC_VERSION -# define LZO_INFO_CC "ARM C Compiler" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__clang__) && defined(__c2__) && defined(__c2_version__) && defined(_MSC_VER) -# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) -# define LZO_CC_CLANG_C2 _MSC_VER -# define LZO_CC_CLANG_VENDOR_MICROSOFT 1 -# define LZO_INFO_CC "clang/c2" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__c2_version__) -#elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__) -# if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__) -# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) -# else -# define LZO_CC_CLANG 0x010000L -# endif -# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -# define LZO_CC_CLANG_MSC _MSC_VER -# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# endif -# if defined(__APPLE_CC__) -# define LZO_CC_CLANG_VENDOR_APPLE 1 -# define LZO_INFO_CC "clang/apple" -# else -# define LZO_CC_CLANG_VENDOR_LLVM 1 -# define LZO_INFO_CC "clang" -# endif -# if defined(__clang_version__) -# define LZO_INFO_CCVER __clang_version__ -# else -# define LZO_INFO_CCVER __VERSION__ -# endif -#elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# if defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# else -# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) -# endif -# define LZO_CC_LLVM LZO_CC_LLVM_GNUC -# define LZO_INFO_CC "llvm-gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__ACK__) && defined(_ACK) -# define LZO_CC_ACK 1 -# define LZO_INFO_CC "Amsterdam Compiler Kit C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__ARMCC_VERSION) && !defined(__GNUC__) -# define LZO_CC_ARMCC __ARMCC_VERSION -# define LZO_CC_ARMCC_ARMCC __ARMCC_VERSION -# define LZO_INFO_CC "ARM C Compiler" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ARMCC_VERSION) -#elif defined(__AZTEC_C__) -# define LZO_CC_AZTECC 1 -# define LZO_INFO_CC "Aztec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) -#elif defined(__CODEGEARC__) -# define LZO_CC_CODEGEARC 1 -# define LZO_INFO_CC "CodeGear C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CODEGEARC__) -#elif defined(__BORLANDC__) -# define LZO_CC_BORLANDC 1 -# define LZO_INFO_CC "Borland C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) -#elif defined(_CRAYC) && defined(_RELEASE) -# define LZO_CC_CRAYC 1 -# define LZO_INFO_CC "Cray C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) -#elif defined(__DMC__) && defined(__SC__) -# define LZO_CC_DMC 1 -# define LZO_INFO_CC "Digital Mars C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) -#elif defined(__DECC) -# define LZO_CC_DECC 1 -# define LZO_INFO_CC "DEC C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -#elif (defined(__ghs) || defined(__ghs__)) && defined(__GHS_VERSION_NUMBER) && ((__GHS_VERSION_NUMBER-0) > 0) -# define LZO_CC_GHS 1 -# define LZO_INFO_CC "Green Hills C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__GHS_VERSION_NUMBER) -# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -# define LZO_CC_GHS_MSC _MSC_VER -# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# define LZO_CC_GHS_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# endif -#elif defined(__HIGHC__) -# define LZO_CC_HIGHC 1 -# define LZO_INFO_CC "MetaWare High C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__HP_aCC) && ((__HP_aCC-0) > 0) -# define LZO_CC_HPACC __HP_aCC -# define LZO_INFO_CC "HP aCC" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__HP_aCC) -#elif defined(__IAR_SYSTEMS_ICC__) -# define LZO_CC_IARC 1 -# define LZO_INFO_CC "IAR C" -# if defined(__VER__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__IBMC__) && ((__IBMC__-0) > 0) -# define LZO_CC_IBMC __IBMC__ -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -#elif defined(__IBMCPP__) && ((__IBMCPP__-0) > 0) -# define LZO_CC_IBMC __IBMCPP__ -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMCPP__) -#elif defined(__KEIL__) && defined(__C166__) -# define LZO_CC_KEILC 1 -# define LZO_INFO_CC "Keil C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) -#elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) -# define LZO_CC_LCCWIN32 1 -# define LZO_INFO_CC "lcc-win32" -# define LZO_INFO_CCVER "unknown" -#elif defined(__LCC__) -# define LZO_CC_LCC 1 -# define LZO_INFO_CC "lcc" -# if defined(__LCC_VERSION__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__MWERKS__) && ((__MWERKS__-0) > 0) -# define LZO_CC_MWERKS __MWERKS__ -# define LZO_INFO_CC "Metrowerks C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) -#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -# define LZO_CC_NDPC 1 -# define LZO_INFO_CC "Microway NDP C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PACIFIC__) -# define LZO_CC_PACIFICC 1 -# define LZO_INFO_CC "Pacific C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -#elif defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100 + (__PGIC_PATCHLEVEL__-0)) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) "." LZO_PP_MACRO_EXPAND(__PGIC_PATCHLEVEL__) -# else -# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) ".0" -# endif -# define LZO_INFO_CC "Portland Group PGI C" -#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) -# define LZO_CC_PGI 1 -# define LZO_INFO_CC "Portland Group PGI C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PUREC__) && defined(__TOS__) -# define LZO_CC_PUREC 1 -# define LZO_INFO_CC "Pure C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) -#elif defined(__SC__) && defined(__ZTC__) -# define LZO_CC_SYMANTECC 1 -# define LZO_INFO_CC "Symantec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) -#elif defined(__SUNPRO_C) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_C-0) > 0) -# define LZO_CC_SUNPROC __SUNPRO_C -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__SUNPRO_CC) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_CC-0) > 0) -# define LZO_CC_SUNPROC __SUNPRO_CC -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__TINYC__) -# define LZO_CC_TINYC 1 -# define LZO_INFO_CC "Tiny C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) -#elif defined(__TSC__) -# define LZO_CC_TOPSPEEDC 1 -# define LZO_INFO_CC "TopSpeed C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) -#elif defined(__WATCOMC__) -# define LZO_CC_WATCOMC 1 -# define LZO_INFO_CC "Watcom C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) -#elif defined(__TURBOC__) -# define LZO_CC_TURBOC 1 -# define LZO_INFO_CC "Turbo C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) -#elif defined(__ZTC__) -# define LZO_CC_ZORTECHC 1 -# define LZO_INFO_CC "Zortech C" -# if ((__ZTC__-0) == 0x310) -# define LZO_INFO_CCVER "0x310" -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) -# endif -#elif defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# elif defined(__GNUC_MINOR__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) -# else -# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -# endif -# define LZO_INFO_CC "gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(_MSC_VER) && ((_MSC_VER-0) > 0) -# define LZO_CC_MSC _MSC_VER -# define LZO_INFO_CC "Microsoft C" -# if defined(_MSC_FULL_VER) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -# endif -#else -# define LZO_CC_UNKNOWN 1 -# define LZO_INFO_CC "unknown" -# define LZO_INFO_CCVER "unknown" -#endif -#if (LZO_CC_GNUC) && defined(__OPEN64__) -# if defined(__OPENCC__) && defined(__OPENCC_MINOR__) && defined(__OPENCC_PATCHLEVEL__) -# define LZO_CC_OPEN64 (__OPENCC__ * 0x10000L + (__OPENCC_MINOR__-0) * 0x100 + (__OPENCC_PATCHLEVEL__-0)) -# define LZO_CC_OPEN64_GNUC LZO_CC_GNUC -# endif -#endif -#if (LZO_CC_GNUC) && defined(__PCC__) -# if defined(__PCC__) && defined(__PCC_MINOR__) && defined(__PCC_MINORMINOR__) -# define LZO_CC_PCC (__PCC__ * 0x10000L + (__PCC_MINOR__-0) * 0x100 + (__PCC_MINORMINOR__-0)) -# define LZO_CC_PCC_GNUC LZO_CC_GNUC -# endif -#endif -#if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) -# error "LZO_CC_MSC: _MSC_FULL_VER is not defined" -#endif -#if !defined(__LZO_ARCH_OVERRIDE) && !(LZO_ARCH_GENERIC) && defined(_CRAY) -# if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) -# if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) -# define LZO_ARCH_CRAY_MPP 1 -# elif defined(_CRAY1) -# define LZO_ARCH_CRAY_PVP 1 -# endif -# endif -#endif -#if !defined(__LZO_ARCH_OVERRIDE) -#if (LZO_ARCH_GENERIC) -# define LZO_INFO_ARCH "generic" -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086 1 -# define LZO_INFO_ARCH "i086" -#elif defined(__aarch64__) || defined(_M_ARM64) -# define LZO_ARCH_ARM64 1 -# define LZO_INFO_ARCH "arm64" -#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) -# define LZO_ARCH_AMD64 1 -# define LZO_INFO_ARCH "amd64" -#elif defined(__arm__) || defined(_M_ARM) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) -# define LZO_ARCH_AVR 1 -# define LZO_INFO_ARCH "avr" -#elif defined(__avr32__) || defined(__AVR32__) -# define LZO_ARCH_AVR32 1 -# define LZO_INFO_ARCH "avr32" -#elif defined(__bfin__) -# define LZO_ARCH_BLACKFIN 1 -# define LZO_INFO_ARCH "blackfin" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) -# define LZO_ARCH_C166 1 -# define LZO_INFO_ARCH "c166" -#elif defined(__cris__) -# define LZO_ARCH_CRIS 1 -# define LZO_INFO_ARCH "cris" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) -# define LZO_ARCH_EZ80 1 -# define LZO_INFO_ARCH "ez80" -#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_ARCH_H8300 1 -# define LZO_INFO_ARCH "h8300" -#elif defined(__hppa__) || defined(__hppa) -# define LZO_ARCH_HPPA 1 -# define LZO_INFO_ARCH "hppa" -#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_CC_ZORTECHC && defined(__I86__)) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) -# define LZO_ARCH_IA64 1 -# define LZO_INFO_ARCH "ia64" -#elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__m32r__) -# define LZO_ARCH_M32R 1 -# define LZO_INFO_ARCH "m32r" -#elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) -# define LZO_ARCH_M68K 1 -# define LZO_INFO_ARCH "m68k" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) -# define LZO_ARCH_MCS251 1 -# define LZO_INFO_ARCH "mcs251" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) -# define LZO_ARCH_MIPS 1 -# define LZO_INFO_ARCH "mips" -#elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__powerpc64__) || defined(__powerpc64) || defined(__ppc64__) || defined(__PPC64__) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__powerpc64le__) || defined(__powerpc64le) || defined(__ppc64le__) || defined(__PPC64LE__) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__riscv) -# define LZO_ARCH_RISCV 1 -# define LZO_INFO_ARCH "riscv" -#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) -# define LZO_ARCH_S390 1 -# define LZO_INFO_ARCH "s390" -#elif defined(__sh__) || defined(_M_SH) -# define LZO_ARCH_SH 1 -# define LZO_INFO_ARCH "sh" -#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) -# define LZO_ARCH_SPARC 1 -# define LZO_INFO_ARCH "sparc" -#elif defined(__SPU__) -# define LZO_ARCH_SPU 1 -# define LZO_INFO_ARCH "spu" -#elif (UINT_MAX == LZO_0xffffL) && defined(__z80) -# define LZO_ARCH_Z80 1 -# define LZO_INFO_ARCH "z80" -#elif (LZO_ARCH_CRAY_PVP) -# if defined(_CRAYSV1) -# define LZO_ARCH_CRAY_SV1 1 -# define LZO_INFO_ARCH "cray_sv1" -# elif (_ADDR64) -# define LZO_ARCH_CRAY_T90 1 -# define LZO_INFO_ARCH "cray_t90" -# elif (_ADDR32) -# define LZO_ARCH_CRAY_YMP 1 -# define LZO_INFO_ARCH "cray_ymp" -# else -# define LZO_ARCH_CRAY_XMP 1 -# define LZO_INFO_ARCH "cray_xmp" -# endif -#else -# define LZO_ARCH_UNKNOWN 1 -# define LZO_INFO_ARCH "unknown" -#endif -#endif -#if !defined(LZO_ARCH_ARM_THUMB2) -#if (LZO_ARCH_ARM) -# if defined(__thumb__) || defined(__thumb) || defined(_M_THUMB) -# if defined(__thumb2__) -# define LZO_ARCH_ARM_THUMB2 1 -# elif 1 && defined(__TARGET_ARCH_THUMB) && ((__TARGET_ARCH_THUMB)+0 >= 4) -# define LZO_ARCH_ARM_THUMB2 1 -# elif 1 && defined(_MSC_VER) && defined(_M_THUMB) && ((_M_THUMB)+0 >= 7) -# define LZO_ARCH_ARM_THUMB2 1 -# endif -# endif -#endif -#endif -#if (LZO_ARCH_ARM_THUMB2) -# undef LZO_INFO_ARCH -# define LZO_INFO_ARCH "arm_thumb2" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) -# error "FIXME - missing define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) -# error "FIXME - missing LZO_OS_WIN32 define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) -# error "FIXME - missing LZO_OS_WIN64 define for CPU architecture" -#endif -#if (LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(BLX286)) -# define LZO_ARCH_I086PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) -# define LZO_ARCH_I086PM 1 -#elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) -# define LZO_ARCH_I086PM 1 -#endif -#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) -# define LZO_ARCH_X64 1 -#elif (!LZO_ARCH_AMD64 && LZO_ARCH_X64) && defined(__LZO_ARCH_OVERRIDE) -# define LZO_ARCH_AMD64 1 -#endif -#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) -# define LZO_ARCH_AARCH64 1 -#elif (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) && defined(__LZO_ARCH_OVERRIDE) -# define LZO_ARCH_ARM64 1 -#endif -#if (LZO_ARCH_I386 && !LZO_ARCH_X86) -# define LZO_ARCH_X86 1 -#elif (!LZO_ARCH_I386 && LZO_ARCH_X86) && defined(__LZO_ARCH_OVERRIDE) -# define LZO_ARCH_I386 1 -#endif -#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) || (!LZO_ARCH_AMD64 && LZO_ARCH_X64) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) || (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_I086PM && !LZO_ARCH_I086) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_I086) -# if (UINT_MAX != LZO_0xffffL) -# error "unexpected configuration - check your compiler defines" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if (LZO_ARCH_I386) -# if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) -# error "unexpected configuration - check your compiler defines" -# endif -# if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) -# error "unexpected configuration - check your compiler defines" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if (LZO_ARCH_AMD64 || LZO_ARCH_I386) -# if !defined(LZO_TARGET_FEATURE_SSE2) -# if defined(__SSE2__) -# define LZO_TARGET_FEATURE_SSE2 1 -# elif defined(_MSC_VER) && (defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2)) -# define LZO_TARGET_FEATURE_SSE2 1 -# elif (LZO_CC_INTELC_MSC || LZO_CC_MSC) && defined(_M_AMD64) -# define LZO_TARGET_FEATURE_SSE2 1 -# endif -# endif -# if !defined(LZO_TARGET_FEATURE_SSSE3) -# if (LZO_TARGET_FEATURE_SSE2) -# if defined(__SSSE3__) -# define LZO_TARGET_FEATURE_SSSE3 1 -# elif defined(_MSC_VER) && defined(__AVX__) -# define LZO_TARGET_FEATURE_SSSE3 1 -# endif -# endif -# endif -# if !defined(LZO_TARGET_FEATURE_SSE4_2) -# if (LZO_TARGET_FEATURE_SSSE3) -# if defined(__SSE4_2__) -# define LZO_TARGET_FEATURE_SSE4_2 1 -# endif -# endif -# endif -# if !defined(LZO_TARGET_FEATURE_AVX) -# if (LZO_TARGET_FEATURE_SSSE3) -# if defined(__AVX__) -# define LZO_TARGET_FEATURE_AVX 1 -# endif -# endif -# endif -# if !defined(LZO_TARGET_FEATURE_AVX2) -# if (LZO_TARGET_FEATURE_AVX) -# if defined(__AVX2__) -# define LZO_TARGET_FEATURE_AVX2 1 -# endif -# endif -# endif -#endif -#if (LZO_TARGET_FEATURE_SSSE3 && !(LZO_TARGET_FEATURE_SSE2)) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_TARGET_FEATURE_SSE4_2 && !(LZO_TARGET_FEATURE_SSSE3)) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_TARGET_FEATURE_AVX && !(LZO_TARGET_FEATURE_SSSE3)) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_TARGET_FEATURE_AVX2 && !(LZO_TARGET_FEATURE_AVX)) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM) -# if !defined(LZO_TARGET_FEATURE_NEON) -# if defined(__ARM_NEON) && ((__ARM_NEON)+0) -# define LZO_TARGET_FEATURE_NEON 1 -# elif 1 && defined(__ARM_NEON__) && ((__ARM_NEON__)+0) -# define LZO_TARGET_FEATURE_NEON 1 -# elif 1 && defined(__TARGET_FEATURE_NEON) && ((__TARGET_FEATURE_NEON)+0) -# define LZO_TARGET_FEATURE_NEON 1 -# endif -# endif -#elif (LZO_ARCH_ARM64) -# if !defined(LZO_TARGET_FEATURE_NEON) -# if 1 -# define LZO_TARGET_FEATURE_NEON 1 -# endif -# endif -#endif -#if 0 -#elif !defined(__LZO_MM_OVERRIDE) -#if (LZO_ARCH_I086) -#if (UINT_MAX != LZO_0xffffL) -# error "unexpected configuration - check your compiler defines" -#endif -#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) -# define LZO_MM_TINY 1 -#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) -# define LZO_MM_HUGE 1 -#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) -# define LZO_MM_SMALL 1 -#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) -# define LZO_MM_MEDIUM 1 -#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) -# define LZO_MM_COMPACT 1 -#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) -# define LZO_MM_LARGE 1 -#elif (LZO_CC_AZTECC) -# if defined(_LARGE_CODE) && defined(_LARGE_DATA) -# define LZO_MM_LARGE 1 -# elif defined(_LARGE_CODE) -# define LZO_MM_MEDIUM 1 -# elif defined(_LARGE_DATA) -# define LZO_MM_COMPACT 1 -# else -# define LZO_MM_SMALL 1 -# endif -#elif (LZO_CC_ZORTECHC && defined(__VCM__)) -# define LZO_MM_LARGE 1 -#else -# error "unknown LZO_ARCH_I086 memory model" -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -#define LZO_HAVE_MM_HUGE_PTR 1 -#define LZO_HAVE_MM_HUGE_ARRAY 1 -#if (LZO_MM_TINY) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) -# undef LZO_HAVE_MM_HUGE_PTR -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_MSC && defined(_QC)) -# undef LZO_HAVE_MM_HUGE_ARRAY -# if (_MSC_VER < 600) -# undef LZO_HAVE_MM_HUGE_PTR -# endif -#elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR) -# if (LZO_OS_DOS16) -# error "unexpected configuration - check your compiler defines" -# elif (LZO_CC_ZORTECHC) -# else -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if defined(__cplusplus) -extern "C" { -#endif -#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) -# define LZO_MM_AHSHIFT 12 -#elif (LZO_CC_WATCOMC) - extern unsigned char _HShift; -# define LZO_MM_AHSHIFT ((unsigned) _HShift) -#else -# error "FIXME - implement LZO_MM_AHSHIFT" -#endif -#if defined(__cplusplus) -} -#endif -#endif -#elif (LZO_ARCH_C166) -#if !defined(__MODEL__) -# error "FIXME - LZO_ARCH_C166 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - LZO_ARCH_C166 __MODEL__" -#endif -#elif (LZO_ARCH_MCS251) -#if !defined(__MODEL__) -# error "FIXME - LZO_ARCH_MCS251 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - LZO_ARCH_MCS251 __MODEL__" -#endif -#elif (LZO_ARCH_MCS51) -#if !defined(__MODEL__) -# error "FIXME - LZO_ARCH_MCS51 __MODEL__" -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - LZO_ARCH_MCS51 __MODEL__" -#endif -#elif (LZO_ARCH_CRAY_PVP) -# define LZO_MM_PVP 1 -#else -# define LZO_MM_FLAT 1 -#endif -#if (LZO_MM_COMPACT) -# define LZO_INFO_MM "compact" -#elif (LZO_MM_FLAT) -# define LZO_INFO_MM "flat" -#elif (LZO_MM_HUGE) -# define LZO_INFO_MM "huge" -#elif (LZO_MM_LARGE) -# define LZO_INFO_MM "large" -#elif (LZO_MM_MEDIUM) -# define LZO_INFO_MM "medium" -#elif (LZO_MM_PVP) -# define LZO_INFO_MM "pvp" -#elif (LZO_MM_SMALL) -# define LZO_INFO_MM "small" -#elif (LZO_MM_TINY) -# define LZO_INFO_MM "tiny" -#else -# error "unknown memory model" -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -#if (LZO_CC_GNUC >= 0x020800ul) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_IBMC >= 600) -# define __lzo_gnuc_extension__ __extension__ -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -# define __lzo_gnuc_extension__ /*empty*/ -#endif -#if !defined(lzo_has_builtin) -#if (LZO_CC_CLANG) && defined(__has_builtin) -# define lzo_has_builtin __has_builtin -#endif -#endif -#if !defined(lzo_has_builtin) -# define lzo_has_builtin(x) 0 -#endif -#if !defined(lzo_has_attribute) -#if (LZO_CC_CLANG) && defined(__has_attribute) -# define lzo_has_attribute __has_attribute -#endif -#endif -#if !defined(lzo_has_attribute) -# define lzo_has_attribute(x) 0 -#endif -#if !defined(lzo_has_declspec_attribute) -#if (LZO_CC_CLANG) && defined(__has_declspec_attribute) -# define lzo_has_declspec_attribute __has_declspec_attribute -#endif -#endif -#if !defined(lzo_has_declspec_attribute) -# define lzo_has_declspec_attribute(x) 0 -#endif -#if !defined(lzo_has_feature) -#if (LZO_CC_CLANG) && defined(__has_feature) -# define lzo_has_feature __has_feature -#endif -#endif -#if !defined(lzo_has_feature) -# define lzo_has_feature(x) 0 -#endif -#if !defined(lzo_has_extension) -#if (LZO_CC_CLANG) && defined(__has_extension) -# define lzo_has_extension __has_extension -#elif (LZO_CC_CLANG) && defined(__has_feature) -# define lzo_has_extension __has_feature -#endif -#endif -#if !defined(lzo_has_extension) -# define lzo_has_extension(x) 0 -#endif -#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0 -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) -# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -# elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1200)) -# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -# else -# define LZO_CFG_USE_NEW_STYLE_CASTS 1 -# endif -#endif -#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -#endif -#if !defined(__cplusplus) -# if defined(LZO_CFG_USE_NEW_STYLE_CASTS) -# undef LZO_CFG_USE_NEW_STYLE_CASTS -# endif -# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -#endif -#if !defined(LZO_REINTERPRET_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_REINTERPRET_CAST(t,e) (reinterpret_cast (e)) -# endif -#endif -#if !defined(LZO_REINTERPRET_CAST) -# define LZO_REINTERPRET_CAST(t,e) ((t) (e)) -#endif -#if !defined(LZO_STATIC_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_STATIC_CAST(t,e) (static_cast (e)) -# endif -#endif -#if !defined(LZO_STATIC_CAST) -# define LZO_STATIC_CAST(t,e) ((t) (e)) -#endif -#if !defined(LZO_STATIC_CAST2) -# define LZO_STATIC_CAST2(t1,t2,e) LZO_STATIC_CAST(t1, LZO_STATIC_CAST(t2, e)) -#endif -#if !defined(LZO_UNCONST_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_UNCONST_CAST(t,e) (const_cast (e)) -# elif (LZO_HAVE_MM_HUGE_PTR) -# define LZO_UNCONST_CAST(t,e) ((t) (e)) -# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((const void *) (e))))) -# endif -#endif -#if !defined(LZO_UNCONST_CAST) -# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((const void *) (e)))) -#endif -#if !defined(LZO_UNCONST_VOLATILE_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_UNCONST_VOLATILE_CAST(t,e) (const_cast (e)) -# elif (LZO_HAVE_MM_HUGE_PTR) -# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) (e)) -# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) -# endif -#endif -#if !defined(LZO_UNCONST_VOLATILE_CAST) -# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((volatile const void *) (e)))) -#endif -#if !defined(LZO_UNVOLATILE_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_UNVOLATILE_CAST(t,e) (const_cast (e)) -# elif (LZO_HAVE_MM_HUGE_PTR) -# define LZO_UNVOLATILE_CAST(t,e) ((t) (e)) -# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((volatile void *) (e))))) -# endif -#endif -#if !defined(LZO_UNVOLATILE_CAST) -# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((volatile void *) (e)))) -#endif -#if !defined(LZO_UNVOLATILE_CONST_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_UNVOLATILE_CONST_CAST(t,e) (const_cast (e)) -# elif (LZO_HAVE_MM_HUGE_PTR) -# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) (e)) -# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) -# endif -#endif -#if !defined(LZO_UNVOLATILE_CONST_CAST) -# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((volatile const void *) (e)))) -#endif -#if !defined(LZO_PCAST) -# if (LZO_HAVE_MM_HUGE_PTR) -# define LZO_PCAST(t,e) ((t) (e)) -# endif -#endif -#if !defined(LZO_PCAST) -# define LZO_PCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(void *, e)) -#endif -#if !defined(LZO_CCAST) -# if (LZO_HAVE_MM_HUGE_PTR) -# define LZO_CCAST(t,e) ((t) (e)) -# endif -#endif -#if !defined(LZO_CCAST) -# define LZO_CCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(const void *, e)) -#endif -#if !defined(LZO_ICONV) -# define LZO_ICONV(t,e) LZO_STATIC_CAST(t, e) -#endif -#if !defined(LZO_ICAST) -# define LZO_ICAST(t,e) LZO_STATIC_CAST(t, e) -#endif -#if !defined(LZO_ITRUNC) -# define LZO_ITRUNC(t,e) LZO_STATIC_CAST(t, e) -#endif -#if !defined(__lzo_cte) -# if (LZO_CC_MSC || LZO_CC_WATCOMC) -# define __lzo_cte(e) ((void)0,(e)) -# elif 1 -# define __lzo_cte(e) ((void)0,(e)) -# endif -#endif -#if !defined(__lzo_cte) -# define __lzo_cte(e) (e) -#endif -#if !defined(LZO_BLOCK_BEGIN) -# define LZO_BLOCK_BEGIN do { -# define LZO_BLOCK_END } while __lzo_cte(0) -#endif -#if !defined(LZO_UNUSED) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030200ul)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNUSED(var) ((void) var) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_KEILC) -# define LZO_UNUSED(var) {extern int lzo_unused__[1-2*!(sizeof(var)>0)]; (void)lzo_unused__;} -# elif (LZO_CC_PACIFICC) -# define LZO_UNUSED(var) ((void) sizeof(var)) -# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED(var) ((void) var) -# else -# define LZO_UNUSED(var) ((void) &var) -# endif -#endif -#if !defined(LZO_UNUSED_RESULT) -# define LZO_UNUSED_RESULT(var) LZO_UNUSED(var) -#endif -#if !defined(LZO_UNUSED_FUNC) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED_FUNC(func) ((void) func) -# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_CLANG || LZO_CC_LLVM) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_MSC) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -# define LZO_UNUSED_FUNC(func) {extern int lzo_unused__[1-2*!(sizeof((int)func)>0)]; (void)lzo_unused__;} -# else -# define LZO_UNUSED_FUNC(func) ((void) func) -# endif -#endif -#if !defined(LZO_UNUSED_LABEL) -# if (LZO_CC_CLANG >= 0x020800ul) -# define LZO_UNUSED_LABEL(l) (__lzo_gnuc_extension__ ((void) ((const void *) &&l))) -# elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) -# define LZO_UNUSED_LABEL(l) if __lzo_cte(0) goto l -# else -# define LZO_UNUSED_LABEL(l) switch (0) case 1:goto l -# endif -#endif -#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -# if 0 -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -# elif 0 && (LZO_CC_GNUC) -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -# else -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -# endif -#endif -#if !defined(__lzo_inline) -#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -#elif defined(__cplusplus) -# define __lzo_inline inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) -# define __lzo_inline inline -#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -# define __lzo_inline __inline -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_inline __inline__ -#elif (LZO_CC_DMC) -# define __lzo_inline __inline -#elif (LZO_CC_GHS) -# define __lzo_inline __inline__ -#elif (LZO_CC_IBMC >= 600) -# define __lzo_inline __inline__ -#elif (LZO_CC_INTELC) -# define __lzo_inline __inline -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -# define __lzo_inline __inline -#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -# define __lzo_inline __inline -#elif (LZO_CC_SUNPROC >= 0x5100) -# define __lzo_inline __inline__ -#endif -#endif -#if defined(__lzo_inline) -# ifndef __lzo_HAVE_inline -# define __lzo_HAVE_inline 1 -# endif -#else -# define __lzo_inline /*empty*/ -#endif -#if !defined(__lzo_forceinline) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_IBMC >= 700) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_PGI >= 0x0d0a00ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_SUNPROC >= 0x5100) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#endif -#endif -#if defined(__lzo_forceinline) -# ifndef __lzo_HAVE_forceinline -# define __lzo_HAVE_forceinline 1 -# endif -#else -# define __lzo_forceinline __lzo_inline -#endif -#if !defined(__lzo_noinline) -#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -# define __lzo_noinline __attribute__((__noinline__,__used__)) -#elif (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_IBMC >= 700) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -# if defined(__cplusplus) -# else -# define __lzo_noinline __declspec(noinline) -# endif -#elif (LZO_CC_PGI >= 0x0d0a00ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_SUNPROC >= 0x5100) -# define __lzo_noinline __attribute__((__noinline__)) -#endif -#endif -#if defined(__lzo_noinline) -# ifndef __lzo_HAVE_noinline -# define __lzo_HAVE_noinline 1 -# endif -#else -# define __lzo_noinline /*empty*/ -#endif -#if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) -# error "unexpected configuration - check your compiler defines" -#endif -#if !defined(__lzo_static_inline) -#if (LZO_CC_IBMC) -# define __lzo_static_inline __lzo_gnuc_extension__ static __lzo_inline -#endif -#endif -#if !defined(__lzo_static_inline) -# define __lzo_static_inline static __lzo_inline -#endif -#if !defined(__lzo_static_forceinline) -#if (LZO_CC_IBMC) -# define __lzo_static_forceinline __lzo_gnuc_extension__ static __lzo_forceinline -#endif -#endif -#if !defined(__lzo_static_forceinline) -# define __lzo_static_forceinline static __lzo_forceinline -#endif -#if !defined(__lzo_static_noinline) -#if (LZO_CC_IBMC) -# define __lzo_static_noinline __lzo_gnuc_extension__ static __lzo_noinline -#endif -#endif -#if !defined(__lzo_static_noinline) -# define __lzo_static_noinline static __lzo_noinline -#endif -#if !defined(__lzo_c99_extern_inline) -#if defined(__GNUC_GNU_INLINE__) -# define __lzo_c99_extern_inline __lzo_inline -#elif defined(__GNUC_STDC_INLINE__) -# define __lzo_c99_extern_inline extern __lzo_inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) -# define __lzo_c99_extern_inline extern __lzo_inline -#endif -#if !defined(__lzo_c99_extern_inline) && (__lzo_HAVE_inline) -# define __lzo_c99_extern_inline __lzo_inline -#endif -#endif -#if defined(__lzo_c99_extern_inline) -# ifndef __lzo_HAVE_c99_extern_inline -# define __lzo_HAVE_c99_extern_inline 1 -# endif -#else -# define __lzo_c99_extern_inline /*empty*/ -#endif -#if !defined(__lzo_may_alias) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_may_alias __attribute__((__may_alias__)) -#elif (LZO_CC_CLANG >= 0x020900ul) -# define __lzo_may_alias __attribute__((__may_alias__)) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1210)) && 0 -# define __lzo_may_alias __attribute__((__may_alias__)) -#elif (LZO_CC_PGI >= 0x0d0a00ul) && 0 -# define __lzo_may_alias __attribute__((__may_alias__)) -#endif -#endif -#if defined(__lzo_may_alias) -# ifndef __lzo_HAVE_may_alias -# define __lzo_HAVE_may_alias 1 -# endif -#else -# define __lzo_may_alias /*empty*/ -#endif -#if !defined(__lzo_noreturn) -#if (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_IBMC >= 700) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_PGI >= 0x0d0a00ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#endif -#endif -#if defined(__lzo_noreturn) -# ifndef __lzo_HAVE_noreturn -# define __lzo_HAVE_noreturn 1 -# endif -#else -# define __lzo_noreturn /*empty*/ -#endif -#if !defined(__lzo_nothrow) -#if (LZO_CC_GNUC >= 0x030300ul) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 900)) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#endif -#endif -#if defined(__lzo_nothrow) -# ifndef __lzo_HAVE_nothrow -# define __lzo_HAVE_nothrow 1 -# endif -#else -# define __lzo_nothrow /*empty*/ -#endif -#if !defined(__lzo_restrict) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_IBMC >= 800) && !defined(__cplusplus) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_IBMC >= 1210) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -# define __lzo_restrict __restrict -#elif (LZO_CC_PGI >= 0x0d0a00ul) -# define __lzo_restrict __restrict__ -#endif -#endif -#if defined(__lzo_restrict) -# ifndef __lzo_HAVE_restrict -# define __lzo_HAVE_restrict 1 -# endif -#else -# define __lzo_restrict /*empty*/ -#endif -#if !defined(__lzo_alignof) -#if (LZO_CC_ARMCC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_GHS) && !defined(__cplusplus) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_IBMC >= 600) -# define __lzo_alignof(e) (__lzo_gnuc_extension__ __alignof__(e)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_alignof(e) __alignof(e) -#elif (LZO_CC_SUNPROC >= 0x5100) -# define __lzo_alignof(e) __alignof__(e) -#endif -#endif -#if defined(__lzo_alignof) -# ifndef __lzo_HAVE_alignof -# define __lzo_HAVE_alignof 1 -# endif -#endif -#if !defined(__lzo_struct_packed) -#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) -#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) -#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) -#elif (LZO_CC_GNUC >= 0x030400ul) && !(LZO_CC_PCC_GNUC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -# define __lzo_struct_packed(s) struct s { -# define __lzo_struct_packed_end() } __attribute__((__gcc_struct__,__packed__)); -# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__gcc_struct__,__packed__)); -#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) -# define __lzo_struct_packed(s) struct s { -# define __lzo_struct_packed_end() } __attribute__((__packed__)); -# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); -#elif (LZO_CC_IBMC >= 700) -# define __lzo_struct_packed(s) __lzo_gnuc_extension__ struct s { -# define __lzo_struct_packed_end() } __attribute__((__packed__)); -# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); -#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_struct_packed(s) __pragma(pack(push,1)) struct s { -# define __lzo_struct_packed_end() } __pragma(pack(pop)); -#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) -# define __lzo_struct_packed(s) _Packed struct s { -# define __lzo_struct_packed_end() }; -#endif -#endif -#if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma) -# define __lzo_struct_packed_ma(s) __lzo_struct_packed(s) -#endif -#if defined(__lzo_struct_packed_end) && !defined(__lzo_struct_packed_ma_end) -# define __lzo_struct_packed_ma_end() __lzo_struct_packed_end() -#endif -#if !defined(__lzo_byte_struct) -#if defined(__lzo_struct_packed) -# define __lzo_byte_struct(s,n) __lzo_struct_packed(s) unsigned char a[n]; __lzo_struct_packed_end() -# define __lzo_byte_struct_ma(s,n) __lzo_struct_packed_ma(s) unsigned char a[n]; __lzo_struct_packed_ma_end() -#elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_PGI || (LZO_CC_SUNPROC >= 0x5100)) -# define __lzo_byte_struct(s,n) struct s { unsigned char a[n]; } __attribute__((__packed__)); -# define __lzo_byte_struct_ma(s,n) struct s { unsigned char a[n]; } __lzo_may_alias __attribute__((__packed__)); -#endif -#endif -#if defined(__lzo_byte_struct) && !defined(__lzo_byte_struct_ma) -# define __lzo_byte_struct_ma(s,n) __lzo_byte_struct(s,n) -#endif -#if !defined(__lzo_struct_align16) && (__lzo_HAVE_alignof) -#if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul)) -#elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_CILLY || LZO_CC_PCC) -#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_struct_align16(s) struct __declspec(align(16)) s { -# define __lzo_struct_align16_end() }; -# define __lzo_struct_align32(s) struct __declspec(align(32)) s { -# define __lzo_struct_align32_end() }; -# define __lzo_struct_align64(s) struct __declspec(align(64)) s { -# define __lzo_struct_align64_end() }; -#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || (LZO_CC_IBMC >= 700) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_struct_align16(s) struct s { -# define __lzo_struct_align16_end() } __attribute__((__aligned__(16))); -# define __lzo_struct_align32(s) struct s { -# define __lzo_struct_align32_end() } __attribute__((__aligned__(32))); -# define __lzo_struct_align64(s) struct s { -# define __lzo_struct_align64_end() } __attribute__((__aligned__(64))); -#endif -#endif -#if !defined(__lzo_union_um) -#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) -#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER < 810)) -#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) -#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) -#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) -# define __lzo_union_am(s) union s { -# define __lzo_union_am_end() } __lzo_may_alias; -# define __lzo_union_um(s) union s { -# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); -#elif (LZO_CC_IBMC >= 700) -# define __lzo_union_am(s) __lzo_gnuc_extension__ union s { -# define __lzo_union_am_end() } __lzo_may_alias; -# define __lzo_union_um(s) __lzo_gnuc_extension__ union s { -# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); -#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_union_um(s) __pragma(pack(push,1)) union s { -# define __lzo_union_um_end() } __pragma(pack(pop)); -#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) -# define __lzo_union_um(s) _Packed union s { -# define __lzo_union_um_end() }; -#endif -#endif -#if !defined(__lzo_union_am) -# define __lzo_union_am(s) union s { -# define __lzo_union_am_end() }; -#endif -#if !defined(__lzo_constructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_constructor __attribute__((__constructor__)) -#endif -#endif -#if defined(__lzo_constructor) -# ifndef __lzo_HAVE_constructor -# define __lzo_HAVE_constructor 1 -# endif -#endif -#if !defined(__lzo_destructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_destructor __attribute__((__destructor__)) -#endif -#endif -#if defined(__lzo_destructor) -# ifndef __lzo_HAVE_destructor -# define __lzo_HAVE_destructor 1 -# endif -#endif -#if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) -# error "unexpected configuration - check your compiler defines" -#endif -#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_IBMC >= 1010) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_CLANG && LZO_CC_CLANG_C2) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#endif -#endif -#if defined(__lzo_likely) -# ifndef __lzo_HAVE_likely -# define __lzo_HAVE_likely 1 -# endif -#else -# define __lzo_likely(e) (e) -#endif -#if defined(__lzo_very_likely) -# ifndef __lzo_HAVE_very_likely -# define __lzo_HAVE_very_likely 1 -# endif -#else -# define __lzo_very_likely(e) __lzo_likely(e) -#endif -#if defined(__lzo_unlikely) -# ifndef __lzo_HAVE_unlikely -# define __lzo_HAVE_unlikely 1 -# endif -#else -# define __lzo_unlikely(e) (e) -#endif -#if defined(__lzo_very_unlikely) -# ifndef __lzo_HAVE_very_unlikely -# define __lzo_HAVE_very_unlikely 1 -# endif -#else -# define __lzo_very_unlikely(e) __lzo_unlikely(e) -#endif -#if !defined(__lzo_loop_forever) -# if (LZO_CC_IBMC) -# define __lzo_loop_forever() LZO_BLOCK_BEGIN for (;;) { ; } LZO_BLOCK_END -# else -# define __lzo_loop_forever() do { ; } while __lzo_cte(1) -# endif -#endif -#if !defined(__lzo_unreachable) -#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul)) && lzo_has_builtin(__builtin_unreachable) -# define __lzo_unreachable() __builtin_unreachable(); -#elif (LZO_CC_GNUC >= 0x040500ul) -# define __lzo_unreachable() __builtin_unreachable(); -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1300)) && 1 -# define __lzo_unreachable() __builtin_unreachable(); -#endif -#endif -#if defined(__lzo_unreachable) -# ifndef __lzo_HAVE_unreachable -# define __lzo_HAVE_unreachable 1 -# endif -#else -# if 0 -# define __lzo_unreachable() ((void)0); -# else -# define __lzo_unreachable() __lzo_loop_forever(); -# endif -#endif -#if !defined(lzo_unused_funcs_impl) -# if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define lzo_unused_funcs_impl(r,f) static r __attribute__((__unused__)) f -# elif 1 && (LZO_CC_BORLANDC || LZO_CC_GNUC) -# define lzo_unused_funcs_impl(r,f) static r f -# else -# define lzo_unused_funcs_impl(r,f) __lzo_static_forceinline r f -# endif -#endif -#ifndef __LZO_CTA_NAME -#if (LZO_CFG_USE_COUNTER) -# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__COUNTER__) -#else -# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__LINE__) -#endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1u-2*!(e)]; LZO_EXTERN_C_END -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END -# elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020900ul)) && defined(__cplusplus) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN int __LZO_CTA_NAME(lzo_cta_f__)(int [1-2*!(e)]); LZO_EXTERN_C_END -# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__)); LZO_EXTERN_C_END -# else -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-2*!(e)]; LZO_EXTERN_C_END -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT) -# if (LZO_CC_AZTECC) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];} -# elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030000ul)) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} -# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) -# define LZO_COMPILE_TIME_ASSERT(e) {(void) (0/!!(e));} -# elif (LZO_CC_GNUC >= 0x040700ul) && (LZO_CFG_USE_COUNTER) && defined(__cplusplus) -# define LZO_COMPILE_TIME_ASSERT(e) {enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__));} -# elif (LZO_CC_GNUC >= 0x040700ul) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# else -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];} -# endif -#endif -#if (LZO_LANG_ASSEMBLER) -# undef LZO_COMPILE_TIME_ASSERT_HEADER -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) /*empty*/ -#else -LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1) -#if defined(__cplusplus) -extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) } -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3) -#endif -#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit /*empty*/ -# define __lzo_cdecl_main __cdecl -# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_qsort __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_qsort _stdcall -# else -# define __lzo_cdecl_qsort __cdecl -# endif -# elif (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -# else -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit __cdecl -# define __lzo_cdecl_main __cdecl -# define __lzo_cdecl_qsort __cdecl -# endif -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_sighandler __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_sighandler _stdcall -# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -# define __lzo_cdecl_sighandler __clrcall -# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -# if defined(_DLL) -# define __lzo_cdecl_sighandler _far _cdecl _loadds -# elif defined(_MT) -# define __lzo_cdecl_sighandler _far _cdecl -# else -# define __lzo_cdecl_sighandler _cdecl -# endif -# else -# define __lzo_cdecl_sighandler __cdecl -# endif -#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -# define __lzo_cdecl cdecl -#endif -#if !defined(__lzo_cdecl) -# define __lzo_cdecl /*empty*/ -#endif -#if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit /*empty*/ -#endif -#if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main /*empty*/ -#endif -#if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort /*empty*/ -#endif -#if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler /*empty*/ -#endif -#if !defined(__lzo_cdecl_va) -# define __lzo_cdecl_va __lzo_cdecl -#endif -#if !(LZO_CFG_NO_WINDOWS_H) -#if !defined(LZO_HAVE_WINDOWS_H) -#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -# elif ((LZO_OS_WIN32 && defined(__PW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul))) -# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -# else -# define LZO_HAVE_WINDOWS_H 1 -# endif -#endif -#endif -#endif -#define LZO_SIZEOF_CHAR 1 -#ifndef LZO_SIZEOF_SHORT -#if defined(SIZEOF_SHORT) -# define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -#elif defined(__SIZEOF_SHORT__) -# define LZO_SIZEOF_SHORT (__SIZEOF_SHORT__) -#endif -#endif -#ifndef LZO_SIZEOF_INT -#if defined(SIZEOF_INT) -# define LZO_SIZEOF_INT (SIZEOF_INT) -#elif defined(__SIZEOF_INT__) -# define LZO_SIZEOF_INT (__SIZEOF_INT__) -#endif -#endif -#ifndef LZO_SIZEOF_LONG -#if defined(SIZEOF_LONG) -# define LZO_SIZEOF_LONG (SIZEOF_LONG) -#elif defined(__SIZEOF_LONG__) -# define LZO_SIZEOF_LONG (__SIZEOF_LONG__) -#endif -#endif -#ifndef LZO_SIZEOF_LONG_LONG -#if defined(SIZEOF_LONG_LONG) -# define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -#elif defined(__SIZEOF_LONG_LONG__) -# define LZO_SIZEOF_LONG_LONG (__SIZEOF_LONG_LONG__) -#endif -#endif -#ifndef LZO_SIZEOF___INT16 -#if defined(SIZEOF___INT16) -# define LZO_SIZEOF___INT16 (SIZEOF___INT16) -#endif -#endif -#ifndef LZO_SIZEOF___INT32 -#if defined(SIZEOF___INT32) -# define LZO_SIZEOF___INT32 (SIZEOF___INT32) -#endif -#endif -#ifndef LZO_SIZEOF___INT64 -#if defined(SIZEOF___INT64) -# define LZO_SIZEOF___INT64 (SIZEOF___INT64) -#endif -#endif -#ifndef LZO_SIZEOF_VOID_P -#if defined(SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -#elif defined(__SIZEOF_POINTER__) -# define LZO_SIZEOF_VOID_P (__SIZEOF_POINTER__) -#endif -#endif -#ifndef LZO_SIZEOF_SIZE_T -#if defined(SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -#elif defined(__SIZEOF_SIZE_T__) -# define LZO_SIZEOF_SIZE_T (__SIZEOF_SIZE_T__) -#endif -#endif -#ifndef LZO_SIZEOF_PTRDIFF_T -#if defined(SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -#elif defined(__SIZEOF_PTRDIFF_T__) -# define LZO_SIZEOF_PTRDIFF_T (__SIZEOF_PTRDIFF_T__) -#endif -#endif -#define __LZO_LSR(x,b) (((x)+0ul) >> (b)) -#if !defined(LZO_SIZEOF_SHORT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_SHORT 8 -# elif (USHRT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,7) == 1) -# define LZO_SIZEOF_SHORT 1 -# elif (__LZO_LSR(USHRT_MAX,15) == 1) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,31) == 1) -# define LZO_SIZEOF_SHORT 4 -# elif (__LZO_LSR(USHRT_MAX,63) == 1) -# define LZO_SIZEOF_SHORT 8 -# elif (__LZO_LSR(USHRT_MAX,127) == 1) -# define LZO_SIZEOF_SHORT 16 -# else -# error "LZO_SIZEOF_SHORT" -# endif -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SHORT == sizeof(short)) -#if !defined(LZO_SIZEOF_INT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_INT 8 -# elif (UINT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_INT 2 -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,7) == 1) -# define LZO_SIZEOF_INT 1 -# elif (__LZO_LSR(UINT_MAX,15) == 1) -# define LZO_SIZEOF_INT 2 -# elif (__LZO_LSR(UINT_MAX,31) == 1) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,63) == 1) -# define LZO_SIZEOF_INT 8 -# elif (__LZO_LSR(UINT_MAX,127) == 1) -# define LZO_SIZEOF_INT 16 -# else -# error "LZO_SIZEOF_INT" -# endif -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_INT == sizeof(int)) -#if !defined(LZO_SIZEOF_LONG) -# if (ULONG_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,7) == 1) -# define LZO_SIZEOF_LONG 1 -# elif (__LZO_LSR(ULONG_MAX,15) == 1) -# define LZO_SIZEOF_LONG 2 -# elif (__LZO_LSR(ULONG_MAX,31) == 1) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,39) == 1) -# define LZO_SIZEOF_LONG 5 -# elif (__LZO_LSR(ULONG_MAX,63) == 1) -# define LZO_SIZEOF_LONG 8 -# elif (__LZO_LSR(ULONG_MAX,127) == 1) -# define LZO_SIZEOF_LONG 16 -# else -# error "LZO_SIZEOF_LONG" -# endif -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long)) -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -# if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) -# if (LZO_CC_GNUC >= 0x030300ul) -# if ((__LONG_MAX__-0) == (__LONG_LONG_MAX__-0)) -# define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG -# elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) -# define LZO_SIZEOF_LONG_LONG 4 -# endif -# endif -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -#if (LZO_ARCH_I086 && LZO_CC_DMC) -#elif (LZO_CC_CILLY) && defined(__GNUC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_SIZEOF_LONG_LONG 8 -#elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_OS_WIN64 || defined(_WIN64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_DMC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) -#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define LZO_SIZEOF_LONG_LONG 8 -#endif -#endif -#endif -#if defined(__cplusplus) && (LZO_CC_GNUC) -# if (LZO_CC_GNUC < 0x020800ul) -# undef LZO_SIZEOF_LONG_LONG -# endif -#endif -#if (LZO_CFG_NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#elif defined(__NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#elif defined(_NO_LONGLONG) -# undef LZO_SIZEOF_LONG_LONG -#endif -#if !defined(LZO_WORDSIZE) -#if (LZO_ARCH_ALPHA) -# define LZO_WORDSIZE 8 -#elif (LZO_ARCH_AMD64) -# define LZO_WORDSIZE 8 -#elif (LZO_ARCH_ARM64) -# define LZO_WORDSIZE 8 -#elif (LZO_ARCH_AVR) -# define LZO_WORDSIZE 1 -#elif (LZO_ARCH_H8300) -# if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_WORDSIZE 4 -# else -# define LZO_WORDSIZE 2 -# endif -#elif (LZO_ARCH_I086) -# define LZO_WORDSIZE 2 -#elif (LZO_ARCH_IA64) -# define LZO_WORDSIZE 8 -#elif (LZO_ARCH_M16C) -# define LZO_WORDSIZE 2 -#elif (LZO_ARCH_SPU) -# define LZO_WORDSIZE 4 -#elif (LZO_ARCH_Z80) -# define LZO_WORDSIZE 1 -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_WORDSIZE 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) -# define LZO_WORDSIZE 8 -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_WORDSIZE 8 -#endif -#endif -#if !defined(LZO_SIZEOF_VOID_P) -#if defined(__ILP32__) || defined(__ILP32) || defined(_ILP32) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) -# define LZO_SIZEOF_VOID_P 4 -#elif defined(__ILP64__) || defined(__ILP64) || defined(_ILP64) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 8) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) -# define LZO_SIZEOF_VOID_P 8 -#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) -# define LZO_SIZEOF_VOID_P 8 -#elif defined(__LP64__) || defined(__LP64) || defined(_LP64) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) -# define LZO_SIZEOF_VOID_P 8 -#elif (LZO_ARCH_AVR) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_H8300) -# if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) - LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 4) -# if defined(__NORMAL_MODE__) -# define LZO_SIZEOF_VOID_P 2 -# else -# define LZO_SIZEOF_VOID_P 4 -# endif -# else - LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 2) -# define LZO_SIZEOF_VOID_P 2 -# endif -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT -# endif -#elif (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -# define LZO_SIZEOF_VOID_P 2 -# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -# define LZO_SIZEOF_VOID_P 4 -# else -# error "invalid LZO_ARCH_I086 memory model" -# endif -#elif (LZO_ARCH_M16C) -# if defined(__m32c_cpu__) || defined(__m32cm_cpu__) -# define LZO_SIZEOF_VOID_P 4 -# else -# define LZO_SIZEOF_VOID_P 2 -# endif -#elif (LZO_ARCH_SPU) -# define LZO_SIZEOF_VOID_P 4 -#elif (LZO_ARCH_Z80) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_SIZEOF_VOID_P 4 -#elif (LZO_OS_OS400 || defined(__OS400__)) -# if defined(__LLP64_IFC__) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -# else -# define LZO_SIZEOF_VOID_P 16 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -# endif -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#endif -#endif -#if !defined(LZO_SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void *)) -#if !defined(LZO_SIZEOF_SIZE_T) -#if (LZO_ARCH_I086 || LZO_ARCH_M16C) -# define LZO_SIZEOF_SIZE_T 2 -#endif -#endif -#if !defined(LZO_SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P -#endif -#if defined(offsetof) -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SIZE_T == sizeof(size_t)) -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -#if (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P -# elif (LZO_MM_COMPACT || LZO_MM_LARGE) -# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) -# define LZO_SIZEOF_PTRDIFF_T 4 -# else -# define LZO_SIZEOF_PTRDIFF_T 2 -# endif -# else -# error "invalid LZO_ARCH_I086 memory model" -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T -#endif -#if defined(offsetof) -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t)) -#endif -#if !defined(LZO_WORDSIZE) -# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -#endif -#if (LZO_ABI_NEUTRAL_ENDIAN) -# undef LZO_ABI_BIG_ENDIAN -# undef LZO_ABI_LITTLE_ENDIAN -#elif !(LZO_ABI_BIG_ENDIAN) && !(LZO_ABI_LITTLE_ENDIAN) -#if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) -# define LZO_ABI_BIG_ENDIAN 1 -#elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430 || LZO_ARCH_RISCV) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) -# if (__LITTLE_ENDIAN__ == 1) -# define LZO_ABI_LITTLE_ENDIAN 1 -# else -# define LZO_ABI_BIG_ENDIAN 1 -# endif -#elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(_MSC_VER) && defined(_WIN32) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC) -# if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) -# error "unexpected configuration - check your compiler defines" -# elif defined(__BIG_ENDIAN) -# define LZO_ABI_BIG_ENDIAN 1 -# else -# define LZO_ABI_LITTLE_ENDIAN 1 -# endif -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM64) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM64) && defined(_MSC_VER) && defined(_WIN32) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#endif -#endif -#if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ABI_BIG_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "be" -#elif (LZO_ABI_LITTLE_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "le" -#elif (LZO_ABI_NEUTRAL_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "neutral" -#endif -#if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_I8LP16 1 -# define LZO_INFO_ABI_PM "i8lp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_ILP16 1 -# define LZO_INFO_ABI_PM "ilp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_LP32 1 -# define LZO_INFO_ABI_PM "lp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_ILP32 1 -# define LZO_INFO_ABI_PM "ilp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) -# define LZO_ABI_LLP64 1 -# define LZO_INFO_ABI_PM "llp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_LP64 1 -# define LZO_INFO_ABI_PM "lp64" -#elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_ILP64 1 -# define LZO_INFO_ABI_PM "ilp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_IP32L64 1 -# define LZO_INFO_ABI_PM "ip32l64" -#endif -#if (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_VOID_P == 4 && LZO_WORDSIZE == 8) -# define LZO_ABI_IP32W64 1 -# ifndef LZO_INFO_ABI_PM -# define LZO_INFO_ABI_PM "ip32w64" -# endif -#endif -#if 0 -#elif !defined(__LZO_LIBC_OVERRIDE) -#if (LZO_LIBC_NAKED) -# define LZO_INFO_LIBC "naked" -#elif (LZO_LIBC_FREESTANDING) -# define LZO_INFO_LIBC "freestanding" -#elif (LZO_LIBC_MOSTLY_FREESTANDING) -# define LZO_INFO_LIBC "mfreestanding" -#elif (LZO_LIBC_ISOC90) -# define LZO_INFO_LIBC "isoc90" -#elif (LZO_LIBC_ISOC99) -# define LZO_INFO_LIBC "isoc99" -#elif (LZO_CC_ARMCC_ARMCC) && defined(__ARMCLIB_VERSION) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#elif defined(__dietlibc__) -# define LZO_LIBC_DIETLIBC 1 -# define LZO_INFO_LIBC "dietlibc" -#elif defined(_NEWLIB_VERSION) -# define LZO_LIBC_NEWLIB 1 -# define LZO_INFO_LIBC "newlib" -#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) -# if defined(__UCLIBC_SUBLEVEL__) -# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + (__UCLIBC_MINOR__-0) * 0x100 + (__UCLIBC_SUBLEVEL__-0)) -# else -# define LZO_LIBC_UCLIBC 0x00090bL -# endif -# define LZO_INFO_LIBC "uc" "libc" -#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) -# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + (__GLIBC_MINOR__-0) * 0x100) -# define LZO_INFO_LIBC "glibc" -#elif (LZO_CC_MWERKS) && defined(__MSL__) -# define LZO_LIBC_MSL __MSL__ -# define LZO_INFO_LIBC "msl" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#else -# define LZO_LIBC_DEFAULT 1 -# define LZO_INFO_LIBC "default" -#endif -#endif -#if (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -# define LZO_ASM_SYNTAX_MSC 1 -#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) -#elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_CC_GNUC) -# define LZO_ASM_SYNTAX_GNUC 1 -#endif -#if (LZO_ASM_SYNTAX_GNUC) -#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -# define __LZO_ASM_CLOBBER "ax" -# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ -# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY /*empty*/ -# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -#elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1000)) -# define __LZO_ASM_CLOBBER "memory" -# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ -# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "memory" -# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -#else -# define __LZO_ASM_CLOBBER "cc", "memory" -# define __LZO_ASM_CLOBBER_LIST_CC : "cc" -# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "cc", "memory" -# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -#endif -#endif -#if (LZO_ARCH_ALPHA) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_AMD64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_ARM) -# if defined(__ARM_FEATURE_UNALIGNED) -# if ((__ARM_FEATURE_UNALIGNED)+0) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# endif -# elif 1 && (LZO_ARCH_ARM_THUMB2) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# elif 1 && defined(__ARM_ARCH) && ((__ARM_ARCH)+0 >= 7) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 7) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 6) && (defined(__TARGET_PROFILE_A) || defined(__TARGET_PROFILE_R)) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# elif 1 && defined(_MSC_VER) && defined(_M_ARM) && ((_M_ARM)+0 >= 7) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# endif -#elif (LZO_ARCH_ARM64) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_CRIS) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_I386) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_IA64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_PREFER_POSTINC 1 -#elif (LZO_ARCH_M68K) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(__mc68020__) && !defined(__mcoldfire__) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# endif -#elif (LZO_ARCH_MIPS) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_POWERPC) -# define LZO_OPT_PREFER_PREINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if (LZO_ABI_BIG_ENDIAN) || (LZO_WORDSIZE == 8) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# if (LZO_WORDSIZE == 8) -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -# endif -# endif -#elif (LZO_ARCH_RISCV) -# define LZO_OPT_AVOID_UINT_INDEX 1 -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# if (LZO_WORDSIZE == 8) -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -# endif -#elif (LZO_ARCH_S390) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# if (LZO_WORDSIZE == 8) -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -# endif -#elif (LZO_ARCH_SH) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -#endif -#ifndef LZO_CFG_NO_INLINE_ASM -#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) -# define LZO_CFG_NO_INLINE_ASM 1 -#elif (LZO_CC_LLVM) -# define LZO_CFG_NO_INLINE_ASM 1 -#endif -#endif -#if (LZO_CFG_NO_INLINE_ASM) -# undef LZO_ASM_SYNTAX_MSC -# undef LZO_ASM_SYNTAX_GNUC -# undef __LZO_ASM_CLOBBER -# undef __LZO_ASM_CLOBBER_LIST_CC -# undef __LZO_ASM_CLOBBER_LIST_CC_MEMORY -# undef __LZO_ASM_CLOBBER_LIST_EMPTY -#endif -#ifndef LZO_CFG_NO_UNALIGNED -#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) -# define LZO_CFG_NO_UNALIGNED 1 -#endif -#endif -#if (LZO_CFG_NO_UNALIGNED) -# undef LZO_OPT_UNALIGNED16 -# undef LZO_OPT_UNALIGNED32 -# undef LZO_OPT_UNALIGNED64 -#endif -#if defined(__LZO_INFOSTR_MM) -#elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) -# define __LZO_INFOSTR_MM "" -#elif defined(LZO_INFO_MM) -# define __LZO_INFOSTR_MM "." LZO_INFO_MM -#else -# define __LZO_INFOSTR_MM "" -#endif -#if defined(__LZO_INFOSTR_PM) -#elif defined(LZO_INFO_ABI_PM) -# define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM -#else -# define __LZO_INFOSTR_PM "" -#endif -#if defined(__LZO_INFOSTR_ENDIAN) -#elif defined(LZO_INFO_ABI_ENDIAN) -# define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN -#else -# define __LZO_INFOSTR_ENDIAN "" -#endif -#if defined(__LZO_INFOSTR_OSNAME) -#elif defined(LZO_INFO_OS_CONSOLE) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE -#elif defined(LZO_INFO_OS_POSIX) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX -#else -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS -#endif -#if defined(__LZO_INFOSTR_LIBC) -#elif defined(LZO_INFO_LIBC) -# define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC -#else -# define __LZO_INFOSTR_LIBC "" -#endif -#if defined(__LZO_INFOSTR_CCVER) -#elif defined(LZO_INFO_CCVER) -# define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER -#else -# define __LZO_INFOSTR_CCVER "" -#endif -#define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER -#if !(LZO_CFG_SKIP_LZO_TYPES) -#if (!(LZO_SIZEOF_SHORT+0 > 0 && LZO_SIZEOF_INT+0 > 0 && LZO_SIZEOF_LONG+0 > 0)) -# error "missing defines for sizes" -#endif -#if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0)) -# error "missing defines for sizes" -#endif -#define LZO_TYPEOF_CHAR 1u -#define LZO_TYPEOF_SHORT 2u -#define LZO_TYPEOF_INT 3u -#define LZO_TYPEOF_LONG 4u -#define LZO_TYPEOF_LONG_LONG 5u -#define LZO_TYPEOF___INT8 17u -#define LZO_TYPEOF___INT16 18u -#define LZO_TYPEOF___INT32 19u -#define LZO_TYPEOF___INT64 20u -#define LZO_TYPEOF___INT128 21u -#define LZO_TYPEOF___INT256 22u -#define LZO_TYPEOF___MODE_QI 33u -#define LZO_TYPEOF___MODE_HI 34u -#define LZO_TYPEOF___MODE_SI 35u -#define LZO_TYPEOF___MODE_DI 36u -#define LZO_TYPEOF___MODE_TI 37u -#define LZO_TYPEOF_CHAR_P 129u -#if !defined(lzo_llong_t) -#if (LZO_SIZEOF_LONG_LONG+0 > 0) -# if !(LZO_LANG_ASSEMBLER) - __lzo_gnuc_extension__ typedef long long lzo_llong_t__; - __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__; -# endif -# define lzo_llong_t lzo_llong_t__ -# define lzo_ullong_t lzo_ullong_t__ -#endif -#endif -#if !defined(lzo_int16e_t) -#if (LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) && (LZO_SIZEOF_SHORT != 2) -# undef LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T -#endif -#if (LZO_SIZEOF_LONG == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) -# define lzo_int16e_t long -# define lzo_uint16e_t unsigned long -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_LONG -#elif (LZO_SIZEOF_INT == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) -# define lzo_int16e_t int -# define lzo_uint16e_t unsigned int -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_SHORT == 2) -# define lzo_int16e_t short int -# define lzo_uint16e_t unsigned short int -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_SHORT -#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) -# if !(LZO_LANG_ASSEMBLER) - typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__))); - typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__))); -# endif -# define lzo_int16e_t lzo_int16e_hi_t__ -# define lzo_uint16e_t lzo_uint16e_hi_t__ -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___MODE_HI -#elif (LZO_SIZEOF___INT16 == 2) -# define lzo_int16e_t __int16 -# define lzo_uint16e_t unsigned __int16 -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___INT16 -#else -#endif -#endif -#if defined(lzo_int16e_t) -# define LZO_SIZEOF_LZO_INT16E_T 2 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T) -#endif -#if !defined(lzo_int32e_t) -#if (LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) && (LZO_SIZEOF_INT != 4) -# undef LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T -#endif -#if (LZO_SIZEOF_LONG == 4) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) -# define lzo_int32e_t long int -# define lzo_uint32e_t unsigned long int -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG -#elif (LZO_SIZEOF_INT == 4) -# define lzo_int32e_t int -# define lzo_uint32e_t unsigned int -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_SHORT == 4) -# define lzo_int32e_t short int -# define lzo_uint32e_t unsigned short int -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_SHORT -#elif (LZO_SIZEOF_LONG_LONG == 4) -# define lzo_int32e_t lzo_llong_t -# define lzo_uint32e_t lzo_ullong_t -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG_LONG -#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L) -# if !(LZO_LANG_ASSEMBLER) - typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); - typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); -# endif -# define lzo_int32e_t lzo_int32e_si_t__ -# define lzo_uint32e_t lzo_uint32e_si_t__ -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI -#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L) -# if !(LZO_LANG_ASSEMBLER) - typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); - typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); -# endif -# define lzo_int32e_t lzo_int32e_si_t__ -# define lzo_uint32e_t lzo_uint32e_si_t__ -# define LZO_INT32_C(c) (c##LL) -# define LZO_UINT32_C(c) (c##ULL) -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI -#elif (LZO_SIZEOF___INT32 == 4) -# define lzo_int32e_t __int32 -# define lzo_uint32e_t unsigned __int32 -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___INT32 -#else -#endif -#endif -#if defined(lzo_int32e_t) -# define LZO_SIZEOF_LZO_INT32E_T 4 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T) -#endif -#if !defined(lzo_int64e_t) -#if (LZO_SIZEOF___INT64 == 8) -# if (LZO_CC_BORLANDC) && !defined(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T) -# define LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T LZO_TYPEOF___INT64 -# endif -#endif -#if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && (LZO_SIZEOF_LONG_LONG != 8) -# undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T -#endif -#if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) && (LZO_SIZEOF___INT64 != 8) -# undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T -#endif -#if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -# define lzo_int64e_t int -# define lzo_uint64e_t unsigned int -# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) -# define lzo_int64e_t long int -# define lzo_uint64e_t unsigned long int -# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG -#elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) -# define lzo_int64e_t lzo_llong_t -# define lzo_uint64e_t lzo_ullong_t -# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG_LONG -# if (LZO_CC_BORLANDC) -# define LZO_INT64_C(c) ((c) + 0ll) -# define LZO_UINT64_C(c) ((c) + 0ull) -# elif 0 -# define LZO_INT64_C(c) (__lzo_gnuc_extension__ (c##LL)) -# define LZO_UINT64_C(c) (__lzo_gnuc_extension__ (c##ULL)) -# else -# define LZO_INT64_C(c) (c##LL) -# define LZO_UINT64_C(c) (c##ULL) -# endif -#elif (LZO_SIZEOF___INT64 == 8) -# define lzo_int64e_t __int64 -# define lzo_uint64e_t unsigned __int64 -# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF___INT64 -# if (LZO_CC_BORLANDC) -# define LZO_INT64_C(c) ((c) + 0i64) -# define LZO_UINT64_C(c) ((c) + 0ui64) -# else -# define LZO_INT64_C(c) (c##i64) -# define LZO_UINT64_C(c) (c##ui64) -# endif -#else -#endif -#endif -#if defined(lzo_int64e_t) -# define LZO_SIZEOF_LZO_INT64E_T 8 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T) -#endif -#if !defined(lzo_int32l_t) -#if defined(lzo_int32e_t) -# define lzo_int32l_t lzo_int32e_t -# define lzo_uint32l_t lzo_uint32e_t -# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LZO_INT32E_T -# define LZO_TYPEOF_LZO_INT32L_T LZO_TYPEOF_LZO_INT32E_T -#elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -# define lzo_int32l_t int -# define lzo_uint32l_t unsigned int -# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT -# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_INT -#elif (LZO_SIZEOF_LONG >= 4) -# define lzo_int32l_t long int -# define lzo_uint32l_t unsigned long int -# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LONG -# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_LONG -#else -# error "lzo_int32l_t" -#endif -#endif -#if 1 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T) -#endif -#if !defined(lzo_int64l_t) -#if defined(lzo_int64e_t) -# define lzo_int64l_t lzo_int64e_t -# define lzo_uint64l_t lzo_uint64e_t -# define LZO_SIZEOF_LZO_INT64L_T LZO_SIZEOF_LZO_INT64E_T -# define LZO_TYPEOF_LZO_INT64L_T LZO_TYPEOF_LZO_INT64E_T -#else -#endif -#endif -#if defined(lzo_int64l_t) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T) -#endif -#if !defined(lzo_int32f_t) -#if (LZO_SIZEOF_SIZE_T >= 8) -# define lzo_int32f_t lzo_int64l_t -# define lzo_uint32f_t lzo_uint64l_t -# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT64L_T -# define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT64L_T -#else -# define lzo_int32f_t lzo_int32l_t -# define lzo_uint32f_t lzo_uint32l_t -# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT32L_T -# define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT32L_T -#endif -#endif -#if 1 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T) -#endif -#if !defined(lzo_int64f_t) -#if defined(lzo_int64l_t) -# define lzo_int64f_t lzo_int64l_t -# define lzo_uint64f_t lzo_uint64l_t -# define LZO_SIZEOF_LZO_INT64F_T LZO_SIZEOF_LZO_INT64L_T -# define LZO_TYPEOF_LZO_INT64F_T LZO_TYPEOF_LZO_INT64L_T -#else -#endif -#endif -#if defined(lzo_int64f_t) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T) -#endif -#if !defined(lzo_intptr_t) -#if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16)) -# define __LZO_INTPTR_T_IS_POINTER 1 -# if !(LZO_LANG_ASSEMBLER) - typedef char * lzo_intptr_t; - typedef char * lzo_uintptr_t; -# endif -# define lzo_intptr_t lzo_intptr_t -# define lzo_uintptr_t lzo_uintptr_t -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_CHAR_P -#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4)) -# if !(LZO_LANG_ASSEMBLER) - typedef __w64 int lzo_intptr_t; - typedef __w64 unsigned int lzo_uintptr_t; -# endif -# define lzo_intptr_t lzo_intptr_t -# define lzo_uintptr_t lzo_uintptr_t -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P) -# define lzo_intptr_t short -# define lzo_uintptr_t unsigned short -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_SHORT -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_SHORT -#elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -# define lzo_intptr_t int -# define lzo_uintptr_t unsigned int -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P) -# define lzo_intptr_t long -# define lzo_uintptr_t unsigned long -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LONG -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LONG -#elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P) -# define lzo_intptr_t lzo_int64l_t -# define lzo_uintptr_t lzo_uint64l_t -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LZO_INT64L_T -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LZO_INT64L_T -#else -# error "lzo_intptr_t" -#endif -#endif -#if 1 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void *)) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t)) -#endif -#if !defined(lzo_word_t) -#if defined(LZO_WORDSIZE) && (LZO_WORDSIZE+0 > 0) -#if (LZO_WORDSIZE == LZO_SIZEOF_LZO_INTPTR_T) && !(__LZO_INTPTR_T_IS_POINTER) -# define lzo_word_t lzo_uintptr_t -# define lzo_sword_t lzo_intptr_t -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LZO_INTPTR_T -#elif (LZO_WORDSIZE == LZO_SIZEOF_LONG) -# define lzo_word_t unsigned long -# define lzo_sword_t long -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LONG -#elif (LZO_WORDSIZE == LZO_SIZEOF_INT) -# define lzo_word_t unsigned int -# define lzo_sword_t int -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_INT -#elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT) -# define lzo_word_t unsigned short -# define lzo_sword_t short -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_SHORT -#elif (LZO_WORDSIZE == 1) -# define lzo_word_t unsigned char -# define lzo_sword_t signed char -# define LZO_SIZEOF_LZO_WORD_T 1 -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_CHAR -#elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T) -# define lzo_word_t lzo_uint64l_t -# define lzo_sword_t lzo_int64l_t -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T -# define LZO_TYPEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T -#elif (LZO_ARCH_SPU) && (LZO_CC_GNUC) -#if 0 -# if !(LZO_LANG_ASSEMBLER) - typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__))); - typedef int lzo_sword_t __attribute__((__mode__(__V16QI__))); -# endif -# define lzo_word_t lzo_word_t -# define lzo_sword_t lzo_sword_t -# define LZO_SIZEOF_LZO_WORD_T 16 -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF___MODE_V16QI -#endif -#else -# error "lzo_word_t" -#endif -#endif -#endif -#if 1 && defined(lzo_word_t) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t) == LZO_WORDSIZE) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE) -#endif -#if 1 -#define lzo_int8_t signed char -#define lzo_uint8_t unsigned char -#define LZO_SIZEOF_LZO_INT8_T 1 -#define LZO_TYPEOF_LZO_INT8_T LZO_TYPEOF_CHAR -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t)) -#endif -#if defined(lzo_int16e_t) -#define lzo_int16_t lzo_int16e_t -#define lzo_uint16_t lzo_uint16e_t -#define LZO_SIZEOF_LZO_INT16_T LZO_SIZEOF_LZO_INT16E_T -#define LZO_TYPEOF_LZO_INT16_T LZO_TYPEOF_LZO_INT16E_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t)) -#endif -#if defined(lzo_int32e_t) -#define lzo_int32_t lzo_int32e_t -#define lzo_uint32_t lzo_uint32e_t -#define LZO_SIZEOF_LZO_INT32_T LZO_SIZEOF_LZO_INT32E_T -#define LZO_TYPEOF_LZO_INT32_T LZO_TYPEOF_LZO_INT32E_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t)) -#endif -#if defined(lzo_int64e_t) -#define lzo_int64_t lzo_int64e_t -#define lzo_uint64_t lzo_uint64e_t -#define LZO_SIZEOF_LZO_INT64_T LZO_SIZEOF_LZO_INT64E_T -#define LZO_TYPEOF_LZO_INT64_T LZO_TYPEOF_LZO_INT64E_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t)) -#endif -#if 1 -#define lzo_int_least32_t lzo_int32l_t -#define lzo_uint_least32_t lzo_uint32l_t -#define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T -#define LZO_TYPEOF_LZO_INT_LEAST32_T LZO_TYPEOF_LZO_INT32L_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t)) -#endif -#if defined(lzo_int64l_t) -#define lzo_int_least64_t lzo_int64l_t -#define lzo_uint_least64_t lzo_uint64l_t -#define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T -#define LZO_TYPEOF_LZO_INT_LEAST64_T LZO_TYPEOF_LZO_INT64L_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t)) -#endif -#if 1 -#define lzo_int_fast32_t lzo_int32f_t -#define lzo_uint_fast32_t lzo_uint32f_t -#define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T -#define LZO_TYPEOF_LZO_INT_FAST32_T LZO_TYPEOF_LZO_INT32F_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t)) -#endif -#if defined(lzo_int64f_t) -#define lzo_int_fast64_t lzo_int64f_t -#define lzo_uint_fast64_t lzo_uint64f_t -#define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T -#define LZO_TYPEOF_LZO_INT_FAST64_T LZO_TYPEOF_LZO_INT64F_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t)) -#endif -#if !defined(LZO_INT16_C) -# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 2) -# define LZO_INT16_C(c) ((c) + 0) -# define LZO_UINT16_C(c) ((c) + 0U) -# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 2) -# define LZO_INT16_C(c) ((c) + 0L) -# define LZO_UINT16_C(c) ((c) + 0UL) -# elif (LZO_SIZEOF_INT >= 2) -# define LZO_INT16_C(c) (c) -# define LZO_UINT16_C(c) (c##U) -# elif (LZO_SIZEOF_LONG >= 2) -# define LZO_INT16_C(c) (c##L) -# define LZO_UINT16_C(c) (c##UL) -# else -# error "LZO_INT16_C" -# endif -#endif -#if !defined(LZO_INT32_C) -# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 4) -# define LZO_INT32_C(c) ((c) + 0) -# define LZO_UINT32_C(c) ((c) + 0U) -# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 4) -# define LZO_INT32_C(c) ((c) + 0L) -# define LZO_UINT32_C(c) ((c) + 0UL) -# elif (LZO_SIZEOF_INT >= 4) -# define LZO_INT32_C(c) (c) -# define LZO_UINT32_C(c) (c##U) -# elif (LZO_SIZEOF_LONG >= 4) -# define LZO_INT32_C(c) (c##L) -# define LZO_UINT32_C(c) (c##UL) -# elif (LZO_SIZEOF_LONG_LONG >= 4) -# define LZO_INT32_C(c) (c##LL) -# define LZO_UINT32_C(c) (c##ULL) -# else -# error "LZO_INT32_C" -# endif -#endif -#if !defined(LZO_INT64_C) && defined(lzo_int64l_t) -# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 8) -# define LZO_INT64_C(c) ((c) + 0) -# define LZO_UINT64_C(c) ((c) + 0U) -# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 8) -# define LZO_INT64_C(c) ((c) + 0L) -# define LZO_UINT64_C(c) ((c) + 0UL) -# elif (LZO_SIZEOF_INT >= 8) -# define LZO_INT64_C(c) (c) -# define LZO_UINT64_C(c) (c##U) -# elif (LZO_SIZEOF_LONG >= 8) -# define LZO_INT64_C(c) (c##L) -# define LZO_UINT64_C(c) (c##UL) -# else -# error "LZO_INT64_C" -# endif -#endif -#endif - -#endif /* already included */ - -/* vim:set ts=4 sw=4 et: */ diff --git a/bundles/n2n_ntop_v3/include/minilzo.h b/bundles/n2n_ntop_v3/include/minilzo.h deleted file mode 100644 index c1c22975..00000000 --- a/bundles/n2n_ntop_v3/include/minilzo.h +++ /dev/null @@ -1,106 +0,0 @@ -/* minilzo.h -- mini subset of the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - -/* - * NOTE: - * the full LZO package can be found at - * http://www.oberhumer.com/opensource/lzo/ - */ - - -#ifndef __MINILZO_H_INCLUDED -#define __MINILZO_H_INCLUDED 1 - -#define MINILZO_VERSION 0x20a0 /* 2.10 */ - -#if defined(__LZOCONF_H_INCLUDED) -# error "you cannot use both LZO and miniLZO" -#endif - -/* internal Autoconf configuration file - only used when building miniLZO */ -#ifdef MINILZO_HAVE_CONFIG_H -# include -#endif -#include -#include - -#ifndef __LZODEFS_H_INCLUDED -#include "lzodefs.h" -#endif -#undef LZO_HAVE_CONFIG_H -#include "lzoconf.h" - -#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) -# error "version mismatch in header files" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/*********************************************************************** -// -************************************************************************/ - -/* Memory required for the wrkmem parameter. - * When the required size is 0, you can also pass a NULL pointer. - */ - -#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS -#define LZO1X_1_MEM_COMPRESS ((lzo_uint32_t) (16384L * lzo_sizeof_dict_t)) -#define LZO1X_MEM_DECOMPRESS (0) - - -/* compression */ -LZO_EXTERN(int) -lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem ); - -/* decompression */ -LZO_EXTERN(int) -lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem /* NOT USED */ ); - -/* safe decompression with overrun testing */ -LZO_EXTERN(int) -lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len, - lzo_bytep dst, lzo_uintp dst_len, - lzo_voidp wrkmem /* NOT USED */ ); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* already included */ - - -/* vim:set ts=4 sw=4 et: */ diff --git a/bundles/n2n_ntop_v3/include/n2n.h b/bundles/n2n_ntop_v3/include/n2n.h deleted file mode 100644 index 046ef492..00000000 --- a/bundles/n2n_ntop_v3/include/n2n.h +++ /dev/null @@ -1,284 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifndef _N2N_H_ -#define _N2N_H_ - -/* - tunctl -t tun0 - tunctl -t tun1 - ifconfig tun0 1.2.3.4 up - ifconfig tun1 1.2.3.5 up - ./edge -d tun0 -l 2000 -r 127.0.0.1:3000 -c hello - ./edge -d tun1 -l 3000 -r 127.0.0.1:2000 -c hello - - - tunctl -u UID -t tunX -*/ - -#define N2N_HAVE_DAEMON /* needs to be defined before it gets undefined */ -#define N2N_HAVE_TCP /* needs to be defined before it gets undefined */ - -/* #define N2N_CAN_NAME_IFACE */ - -/* Moved here to define _CRT_SECURE_NO_WARNINGS before all the including takes place */ -#ifdef WIN32 -#ifndef CMAKE_BUILD -#include "config.h" /* Visual C++ */ -#else -#include "winconfig.h" -#endif -#define N2N_CAN_NAME_IFACE 1 -#undef N2N_HAVE_DAEMON -#undef N2N_HAVE_TCP /* as explained on https://github.com/ntop/n2n/pull/627#issuecomment-782093706 */ -#undef N2N_HAVE_SETUID -#else -#ifndef CMAKE_BUILD -#include "config.h" -#endif -#endif - - - -#define PACKAGE_BUILDDATE (__DATE__ " " __TIME__) - -#include -#include -#include - -#ifndef WIN32 -#include -#endif - -#ifndef _MSC_VER -#include -#endif /* #ifndef _MSC_VER */ - -#include -#include -#include -#include -#include - -#ifndef WIN32 -#include -#include -#include -#include -#include - -#ifdef __linux__ -#define N2N_CAN_NAME_IFACE 1 -#include -#include -#include -#include -#include -#include -#include -#include -#endif /* #ifdef __linux__ */ - -#ifdef __FreeBSD__ -#include -#endif /* #ifdef __FreeBSD__ */ - -#include -#include - -#ifdef HAVE_LIBZSTD -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined (HAVE_OPENSSL_1_1) -#include -#include -#endif - -#define closesocket(a) close(a) -#endif /* #ifndef WIN32 */ - -#include "minilzo.h" -#include -#include -#include -#include "lzoconf.h" -#include "uthash.h" -#include "n2n_define.h" -#include "n2n_typedefs.h" - -#ifdef WIN32 -#include /* for tcp */ -#define SHUT_RDWR SD_BOTH /* for tcp */ -#include "wintap.h" -#include -#else -#include -#endif /* #ifdef WIN32 */ - -#include "n2n_wire.h" -#include "random_numbers.h" -#include "pearson.h" -#include "portable_endian.h" -#include "aes.h" -#include "cc20.h" -#include "speck.h" -#include "curve25519.h" -#include "n2n_regex.h" -#include "sn_selection.h" -#include "network_traffic_filter.h" -#include "auth.h" - -/* ************************************** */ - -#include "header_encryption.h" -#include "tf.h" - -#ifndef TRACE_ERROR -#define TRACE_ERROR 0, __FILE__, __LINE__ -#define TRACE_WARNING 1, __FILE__, __LINE__ -#define TRACE_NORMAL 2, __FILE__, __LINE__ -#define TRACE_INFO 3, __FILE__, __LINE__ -#define TRACE_DEBUG 4, __FILE__, __LINE__ -#endif - -/* ************************************** */ - -/* Transop Init Functions */ -int n2n_transop_null_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); -int n2n_transop_tf_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); -int n2n_transop_aes_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); -int n2n_transop_cc20_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); -int n2n_transop_speck_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt); - -/* Log */ -void setTraceLevel (int level); -void setUseSyslog (int use_syslog); -void setTraceFile (FILE *f); -int getTraceLevel (); -void closeTraceFile (); -void traceEvent (int eventTraceLevel, char* file, int line, char * format, ...); - -/* Tuntap API */ -int tuntap_open (struct tuntap_dev *device, char *dev, const char *address_mode, char *device_ip, - char *device_mask, const char * device_mac, int mtu -#ifdef WIN32 - , int metric -#endif - ); -int tuntap_read (struct tuntap_dev *tuntap, unsigned char *buf, int len); -int tuntap_write (struct tuntap_dev *tuntap, unsigned char *buf, int len); -void tuntap_close (struct tuntap_dev *tuntap); -void tuntap_get_address (struct tuntap_dev *tuntap); - -/* Utils */ -char* intoa (uint32_t addr, char* buf, uint16_t buf_len); -uint32_t bitlen2mask (uint8_t bitlen); -uint8_t mask2bitlen (uint32_t mask); -char* macaddr_str (macstr_t buf, const n2n_mac_t mac); -int str2mac (uint8_t * outmac /* 6 bytes */, const char * s); -int supernode2sock (n2n_sock_t * sn, const n2n_sn_name_t addrIn); -uint8_t is_multi_broadcast (const n2n_mac_t dest_mac); -uint8_t is_broadcast (const n2n_mac_t dest_mac); -uint8_t is_null_mac (const n2n_mac_t dest_mac); -char* msg_type2str (uint16_t msg_type); -void hexdump (const uint8_t * buf, size_t len); -void print_n2n_version (); -int is_empty_ip_address (const n2n_sock_t * sock); -void print_edge_stats (const n2n_edge_t *eee); -int memrnd (uint8_t *address, size_t len); -int memxor (uint8_t *destination, const uint8_t *source, size_t len); - -/* Sockets */ -char* sock_to_cstr (n2n_sock_str_t out, - const n2n_sock_t * sock); -char * ip_subnet_to_str (dec_ip_bit_str_t buf, const n2n_ip_subnet_t *ipaddr); -SOCKET open_socket (int local_port, in_addr_t address, int type); -int sock_equal (const n2n_sock_t * a, - const n2n_sock_t * b); - -/* Header encryption */ -uint64_t time_stamp (void); -uint64_t initial_time_stamp (void); -int time_stamp_verify_and_update (uint64_t stamp, uint64_t * previous_stamp, int allow_jitter); - -/* Operations on peer_info lists. */ -size_t purge_peer_list (struct peer_info ** peer_list, - SOCKET socket_not_to_close, - n2n_tcp_connection_t **tcp_connections, - time_t purge_before); - -size_t clear_peer_list (struct peer_info ** peer_list); - -size_t purge_expired_nodes (struct peer_info **peer_list, - SOCKET socket_not_to_close, - n2n_tcp_connection_t **tcp_connections, - time_t *p_last_purge, - int frequency, int timeout); - -/* Edge conf */ -void edge_init_conf_defaults (n2n_edge_conf_t *conf); -int edge_verify_conf (const n2n_edge_conf_t *conf); -int edge_conf_add_supernode (n2n_edge_conf_t *conf, const char *ip_and_port); -const n2n_edge_conf_t* edge_get_conf (const n2n_edge_t *eee); -void edge_term_conf (n2n_edge_conf_t *conf); - -/* Public functions */ -n2n_edge_t* edge_init (const n2n_edge_conf_t *conf, int *rv); -void update_supernode_reg (n2n_edge_t * eee, time_t nowTime); -void readFromIPSocket (n2n_edge_t * eee, int in_sock); -void edge_term (n2n_edge_t *eee); -void edge_set_callbacks (n2n_edge_t *eee, const n2n_edge_callbacks_t *callbacks); -void edge_set_userdata (n2n_edge_t *eee, void *user_data); -void* edge_get_userdata (n2n_edge_t *eee); -void edge_send_packet2net (n2n_edge_t *eee, uint8_t *tap_pkt, size_t len); -void edge_read_from_tap (n2n_edge_t *eee); -int edge_get_n2n_socket (n2n_edge_t *eee); -int edge_get_management_socket (n2n_edge_t *eee); -int run_edge_loop (n2n_edge_t *eee); -int quick_edge_init (char *device_name, char *community_name, - char *encrypt_key, char *device_mac, - char *local_ip_address, - char *supernode_ip_address_port, - int *keep_on_running); -int comm_init (struct sn_community *comm, char *cmn); -int sn_init_defaults (n2n_sn_t *sss); -void sn_init (n2n_sn_t *sss); -void sn_term (n2n_sn_t *sss); -int supernode2sock (n2n_sock_t * sn, const n2n_sn_name_t addrIn); -struct peer_info* add_sn_to_list_by_mac_or_sock (struct peer_info **sn_list, n2n_sock_t *sock, const n2n_mac_t mac, int *skip_add); -int run_sn_loop (n2n_sn_t *sss); -int assign_one_ip_subnet (n2n_sn_t *sss, struct sn_community *comm); -const char* compression_str (uint8_t cmpr); -const char* transop_str (enum n2n_transform tr); - -void handleMgmtJson (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock); -void handleMgmtJson_sn (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock); -#endif /* _N2N_H_ */ diff --git a/bundles/n2n_ntop_v3/include/n2n_define.h b/bundles/n2n_ntop_v3/include/n2n_define.h deleted file mode 100644 index cdee5dad..00000000 --- a/bundles/n2n_ntop_v3/include/n2n_define.h +++ /dev/null @@ -1,215 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -/* N2N packet header indicators. */ -#define MSG_TYPE_REGISTER 1 -#define MSG_TYPE_DEREGISTER 2 -#define MSG_TYPE_PACKET 3 -#define MSG_TYPE_REGISTER_ACK 4 -#define MSG_TYPE_REGISTER_SUPER 5 -#define MSG_TYPE_UNREGISTER_SUPER 6 -#define MSG_TYPE_REGISTER_SUPER_ACK 7 -#define MSG_TYPE_REGISTER_SUPER_NAK 8 -#define MSG_TYPE_FEDERATION 9 -#define MSG_TYPE_PEER_INFO 10 -#define MSG_TYPE_QUERY_PEER 11 -#define MSG_TYPE_MAX_TYPE 11 -#define MSG_TYPE_RE_REGISTER_SUPER 12 - -/* Max available space to add supernodes' informations (sockets and MACs) in REGISTER_SUPER_ACK - * Field sizes of REGISTER_SUPER_ACK as used in encode/decode fucntions in src/wire.c - */ -#define REG_SUPER_ACK_PAYLOAD_SPACE (DEFAULT_MTU - (sizeof(n2n_common_t) + sizeof(n2n_REGISTER_SUPER_ACK_t))) - -/* Space needed to store socket and MAC address of a supernode */ -#define REG_SUPER_ACK_PAYLOAD_ENTRY_SIZE (sizeof(n2n_REGISTER_SUPER_ACK_payload_t)) - -#define BOOTSTRAP_TIMEOUT 3 -#define PURGE_REGISTRATION_FREQUENCY 30 -#define RE_REG_AND_PURGE_FREQUENCY 10 -#define REGISTRATION_TIMEOUT 60 - -#define SOCKET_TIMEOUT_INTERVAL_SECS 10 -#define REGISTER_SUPER_INTERVAL_DFL 20 /* sec, usually UDP NAT entries in a firewall expire after 30 seconds */ -#define SWEEP_TIME 30 /* sec, indicates the value after which we have to sort the hash list of supernodes in edges - * and when we send out packets to query selection-relevant informations from supernodes. */ - -#define NUMBER_SN_PINGS_INITIAL 15 /* number of supernodes to concurrently ping during bootstrap and immediately afterwards */ -#define NUMBER_SN_PINGS_REGULAR 5 /* number of supernodes to concurrently ping during regular edge operation */ - -/* Timeouts used in re_register_and_purge_supernodes. LAST_SEEN_SN_ACTIVE and LAST_SEEN_SN_INACTIVE - * values should be at least 3*SOCKET_TIMEOUT_INTERVAL_SECS apart. */ -#define LAST_SEEN_SN_ACTIVE 20 /* sec, indicates supernodes that are proven to be active */ -#define LAST_SEEN_SN_INACTIVE 90 /* sec, indicates supernodes that are proven to be inactive: they will be purged */ -#define LAST_SEEN_SN_NEW (LAST_SEEN_SN_INACTIVE - 3 * RE_REG_AND_PURGE_FREQUENCY) /* sec, indicates supernodes with unsure status, must be tested to check if they are active */ - -#define IFACE_UPDATE_INTERVAL (30) /* sec. How long it usually takes to get an IP lease. */ -#define TRANSOP_TICK_INTERVAL (10) /* sec */ - -#define SORT_COMMUNITIES_INTERVAL 90 /* sec. until supernode sorts communities' hash list again */ - -#define AF_INVALID -1 /* to mark a socket invalid by an invalid address family (do not use AF_UNSPEC, it could turn into auto-detect) */ -#define N2N_RESOLVE_INTERVAL 300 /* seconds until edge and supernode try to resolve supernode names again */ -#define N2N_RESOLVE_CHECK_INTERVAL 30 /* seconds until main loop checking in on changes from resolver thread */ - -#define ETH_FRAMESIZE 14 -#define IP4_SRCOFFSET 12 -#define IP4_DSTOFFSET 16 -#define IP4_MIN_SIZE 20 -#define UDP_SIZE 8 - -/* parameters for replay protection */ -#define TIME_STAMP_FRAME 0x0000001000000000LL /* clocks of different computers are allowed +/- 16 seconds to be off */ -#define TIME_STAMP_JITTER 0x0000000027100000LL /* we allow a packet to arrive 160 ms (== 0x27100 us) before another - * set to 0x0000000000000000LL if increasing (or equal) time stamps allowed only */ -#define TIME_STAMP_ALLOW_JITTER 1 /* constant for allowing or... */ -#define TIME_STAMP_NO_JITTER 0 /* not allowing jitter to be considered */ - -/* N2N compression indicators. */ -/* Compression is disabled by default for outgoing packets if no cli - * option is given. All edges are built with decompression support so - * they are able to understand each other (this applies to lzo only). */ -#define N2N_COMPRESSION_ID_INVALID 0 -#define N2N_COMPRESSION_ID_NONE 1 /* default, see edge_init_conf_defaults(...) in edge_utils.c */ -#define N2N_COMPRESSION_ID_LZO 2 /* set if '-z1' or '-z' cli option is present, see setOption(...) in edge.c */ -#define N2N_COMPRESSION_ID_ZSTD 3 /* set if '-z2' cli option is present, available only if compiled with zstd lib */ -#define ZSTD_COMPRESSION_LEVEL 7 /* 1 (faster) ... 22 (more compression) */ - -/* Federation name and indicators */ -#define FEDERATION_NAME "*Federation" -enum federation {IS_NO_FEDERATION = 0,IS_FEDERATION = 1}; - -/* (un)purgeable community indicator (supernode) */ -#define COMMUNITY_UNPURGEABLE 0 -#define COMMUNITY_PURGEABLE 1 - -/* (un)purgeable supernode indicator */ -enum sn_purge {SN_PURGEABLE = 0, SN_UNPURGEABLE = 1}; - -/* Header encryption indicators */ -#define HEADER_ENCRYPTION_UNKNOWN 0 -#define HEADER_ENCRYPTION_NONE 1 -#define HEADER_ENCRYPTION_ENABLED 2 - -/* REGISTER_SUPER_ACK packet hash length with user/pw auth, up to 16 bytes */ -#define N2N_REG_SUP_HASH_CHECK_LEN 16 - -#define DEFAULT_MTU 1290 - -#define HASH_ADD_PEER(head,add) \ - HASH_ADD(hh,head,mac_addr,sizeof(n2n_mac_t),add) -#define HASH_FIND_PEER(head,mac,out) \ - HASH_FIND(hh,head,mac,sizeof(n2n_mac_t),out) -#define N2N_EDGE_SN_HOST_SIZE 48 -#define N2N_EDGE_SUP_ATTEMPTS 3 /* Number of failed attmpts before moving on to next supernode. */ -#define N2N_PATHNAME_MAXLEN 256 -#define N2N_EDGE_MGMT_PORT 5644 -#define N2N_SN_MGMT_PORT 5645 - -enum n2n_mgmt_type { - N2N_MGMT_READ = 0, - N2N_MGMT_WRITE = 1, -}; - -#define N2N_MGMT_PASSWORD "n2n" /* default password for management port access (so far, json only) */ - - -#define N2N_TCP_BACKLOG_QUEUE_SIZE 3 /* number of concurrently pending connections to be accepted */ - /* NOT the number of max. TCP connections */ - -#define N2N_CLOSE_SOCKET_COUNTER_MAX 15 /* number of times of edge's reconnects to supernode after */ - /* which the socket explicitly is closed before reopening */ - -/* flag used in add_sn_to_list_by_mac_or_sock */ -enum skip_add {SN_ADD = 0, SN_ADD_SKIP = 1, SN_ADD_ADDED = 2}; - -#define N2N_NETMASK_STR_SIZE 16 /* dotted decimal 12 numbers + 3 dots */ -#define N2N_MACNAMSIZ 18 /* AA:BB:CC:DD:EE:FF + NULL*/ -#define N2N_IF_MODE_SIZE 16 /* static | dhcp */ - -#define N2N_EDGE_DEFAULT_DEV_NAME "edge0" -#define N2N_EDGE_DEFAULT_NETMASK "255.255.255.0" /* default netmask for edge ip address... */ -#define N2N_EDGE_DEFAULT_CIDR_NM 24 /* ... also in cidr format */ - -#define N2N_SN_LPORT_DEFAULT 7654 -#define N2N_SN_PKTBUF_SIZE 2048 - - -/* The way TUNTAP allocated IP. */ -#define TUNTAP_IP_MODE_SN_ASSIGN 0 -#define TUNTAP_IP_MODE_STATIC 1 -#define TUNTAP_IP_MODE_DHCP 2 - -/* Default network segment of the auto ip address service provided by sn. */ -#define N2N_SN_MIN_AUTO_IP_NET_DEFAULT "10.128.0.0" -#define N2N_SN_MAX_AUTO_IP_NET_DEFAULT "10.255.255.0" -#define N2N_SN_AUTO_IP_NET_BIT_DEFAULT 24 - -/* ************************************** */ - -#define SUPERNODE_IP "127.0.0.1" -#define SUPERNODE_PORT 1234 - -/* ************************************** */ - -#define N2N_PKT_VERSION 3 -#define N2N_DEFAULT_TTL 2 /* can be forwarded twice at most */ -#define N2N_COMMUNITY_SIZE 20 -#define N2N_PRIVATE_PUBLIC_KEY_SIZE 32 -#define N2N_USER_KEY_LINE_STARTER '*' -#define N2N_MAC_SIZE 6 -#define N2N_NO_REG_COOKIE 0x00000000 -#define N2N_FORWARDED_REG_COOKIE 0x00001000 -#define N2N_PORT_REG_COOKIE 0x00004000 -#define N2N_REGULAR_REG_COOKIE 0x00010000 -#define N2N_MCAST_REG_COOKIE 0x00400000 -#define N2N_LOCAL_REG_COOKIE 0x01000000 -#define N2N_DESC_SIZE 16 -#define N2N_PKT_BUF_SIZE 2048 -#define N2N_SOCKBUF_SIZE 64 /* string representation of INET or INET6 sockets */ - -#define N2N_MULTICAST_PORT 1968 -#define N2N_MULTICAST_GROUP "224.0.0.68" - -#ifdef WIN32 -#define N2N_IFNAMSIZ 64 -#else -#define N2N_IFNAMSIZ 16 /* 15 chars * NULL */ -#endif - -#ifdef _MSC_VER -#define N2N_THREAD_RETURN_DATATYPE DWORD WINAPI -#define N2N_THREAD_PARAMETER_DATATYPE LPVOID -#else -#define N2N_THREAD_RETURN_DATATYPE void* -#define N2N_THREAD_PARAMETER_DATATYPE void* -#endif - -#define SN_SELECTION_CRITERION_DATA_TYPE uint64_t -#define SN_SELECTION_CRITERION_BUF_SIZE 16 - -#define N2N_TRANSFORM_ID_USER_START 64 -#define N2N_TRANSFORM_ID_MAX 65535 - -#ifndef max -#define max(a, b) (((a) < (b)) ? (b) : (a)) -#endif - -#ifndef min -#define min(a, b) (((a) >(b)) ? (b) : (a)) -#endif diff --git a/bundles/n2n_ntop_v3/include/n2n_regex.h b/bundles/n2n_ntop_v3/include/n2n_regex.h deleted file mode 100644 index 9ac409c4..00000000 --- a/bundles/n2n_ntop_v3/include/n2n_regex.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -// taken from https://github.com/kokke/tiny-regex-c -// under Unlicense as of August 4, 2020 - -/* - * - * Mini regex-module inspired by Rob Pike's regex code described in: - * - * http://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html - * - * - * - * Supports: - * --------- - * '.' Dot, matches any character - * '^' Start anchor, matches beginning of string - * '$' End anchor, matches end of string - * '*' Asterisk, match zero or more (greedy) - * '+' Plus, match one or more (greedy) - * '?' Question, match zero or one (non-greedy) - * '[abc]' Character class, match if one of {'a', 'b', 'c'} - * '[^abc]' Inverted class, match if NOT one of {'a', 'b', 'c'} -- NOTE: feature is currently broken! - * '[a-zA-Z]' Character ranges, the character set of the ranges { a-z | A-Z } - * '\s' Whitespace, \t \f \r \n \v and spaces - * '\S' Non-whitespace - * '\w' Alphanumeric, [a-zA-Z0-9_] - * '\W' Non-alphanumeric - * '\d' Digits, [0-9] - * '\D' Non-digits - * - * - */ - -#ifndef _N2N_REGEX_ -#define _N2N_REGEX_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* Compile regex string pattern to a regex_t-array. */ -re_t re_compile (const char* pattern); - - -/* Find matches of the compiled pattern inside text. */ -int re_matchp (re_t pattern, const char* text, int* matchlenght); - - -/* Find matches of the txt pattern inside text (will compile automatically first). */ -int re_match (const char* pattern, const char* text, int* matchlenght); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/bundles/n2n_ntop_v3/include/n2n_typedefs.h b/bundles/n2n_ntop_v3/include/n2n_typedefs.h deleted file mode 100644 index 3ba65f2b..00000000 --- a/bundles/n2n_ntop_v3/include/n2n_typedefs.h +++ /dev/null @@ -1,846 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifndef _N2N_TYPEDEFS_H_ -#define _N2N_TYPEDEFS_H_ - - -typedef uint8_t n2n_community_t[N2N_COMMUNITY_SIZE]; -typedef uint8_t n2n_private_public_key_t[N2N_PRIVATE_PUBLIC_KEY_SIZE]; -typedef uint8_t n2n_mac_t[N2N_MAC_SIZE]; -typedef uint32_t n2n_cookie_t; -typedef uint8_t n2n_desc_t[N2N_DESC_SIZE]; -typedef char n2n_sock_str_t[N2N_SOCKBUF_SIZE]; /* tracing string buffer */ - - -#if defined(_MSC_VER) || defined(__MINGW32__) -#include "getopt.h" - -/* Other Win environments are expected to support stdint.h */ - -/* stdint.h typedefs (C99) (not present in Visual Studio) */ -typedef unsigned int uint32_t; -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; - -/* sys/types.h typedefs (not present in Visual Studio) */ -typedef unsigned int u_int32_t; -typedef unsigned short u_int16_t; -typedef unsigned char u_int8_t; - -#ifndef __MINGW32__ -typedef int ssize_t; -#endif - -typedef unsigned long in_addr_t; - -#include "n2n_win32.h" - -#endif /* #if defined(_MSC_VER) || defined(__MINGW32__) */ - - - -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -#include -#endif - -#ifdef __OpenBSD__ -#include -#define __BYTE_ORDER BYTE_ORDER -#if BYTE_ORDER == LITTLE_ENDIAN -#ifndef __LITTLE_ENDIAN__ -#define __LITTLE_ENDIAN__ -#endif /* __LITTLE_ENDIAN__ */ -#else -#define __BIG_ENDIAN__ -#endif/* BYTE_ORDER */ -#endif/* __OPENBSD__ */ - - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#ifndef __LITTLE_ENDIAN__ -#define __LITTLE_ENDIAN__ -#endif -#else -#ifndef __BIG_ENDIAN__ -#define __BIG_ENDIAN__ -#endif -#endif - -#ifdef WIN32 -#ifndef __LITTLE_ENDIAN__ -#define __LITTLE_ENDIAN__ 1 -#endif -#endif - -#if !(defined(__LITTLE_ENDIAN__) || defined(__BIG_ENDIAN__)) -#if defined(__mips__) -#undef __LITTLE_ENDIAN__ -#undef __LITTLE_ENDIAN -#define __BIG_ENDIAN__ -#endif - -/* Everything else */ -#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)) -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -#define __LITTLE_ENDIAN__ -#else -#define __BIG_ENDIAN__ -#endif -#endif - -#endif - -/* *************************************** */ - -#ifdef __GNUC__ -#define PACK_STRUCT __attribute__((__packed__)) -#else -#define PACK_STRUCT -#endif - -#if defined(_MSC_VER) || defined(__MINGW32__) -#pragma pack(push,1) -#endif - - -// those are definitely not typedefs (with a view to the filename) but neither are they defines -static const n2n_mac_t broadcast_mac = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; -static const n2n_mac_t multicast_mac = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0x00 }; /* First 3 bytes are meaningful */ -static const n2n_mac_t ipv6_multicast_mac = { 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 }; /* First 2 bytes are meaningful */ -static const n2n_mac_t null_mac = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - - -#define ETH_ADDR_LEN 6 - -struct ether_hdr { - uint8_t dhost[ETH_ADDR_LEN]; - uint8_t shost[ETH_ADDR_LEN]; - uint16_t type; /* higher layer protocol encapsulated */ -} PACK_STRUCT; - -typedef struct ether_hdr ether_hdr_t; - - -struct n2n_iphdr { -#if defined(__LITTLE_ENDIAN__) - u_int8_t ihl:4, version:4; -#elif defined(__BIG_ENDIAN__) - u_int8_t version:4, ihl:4; -#else -# error "Byte order must be defined" -#endif - u_int8_t tos; - u_int16_t tot_len; - u_int16_t id; - u_int16_t frag_off; - u_int8_t ttl; - u_int8_t protocol; - u_int16_t check; - u_int32_t saddr; - u_int32_t daddr; -} PACK_STRUCT; - -struct n2n_tcphdr { - u_int16_t source; - u_int16_t dest; - u_int32_t seq; - u_int32_t ack_seq; -#if defined(__LITTLE_ENDIAN__) - u_int16_t res1:4, doff:4, fin:1, syn:1, rst:1, psh:1, ack:1, urg:1, ece:1, cwr:1; -#elif defined(__BIG_ENDIAN__) - u_int16_t doff:4, res1:4, cwr:1, ece:1, urg:1, ack:1, psh:1, rst:1, syn:1, fin:1; -#else -# error "Byte order must be defined" -#endif - u_int16_t window; - u_int16_t check; - u_int16_t urg_ptr; -} PACK_STRUCT; - -struct n2n_udphdr { - u_int16_t source; - u_int16_t dest; - u_int16_t len; - u_int16_t check; -} PACK_STRUCT; - -#if defined(_MSC_VER) || defined(__MINGW32__) -#pragma pack(pop) -#endif - - -typedef struct port_range { - uint16_t start_port; // range contain 'start_port' self - uint16_t end_port; // range contain 'end_port' self -} port_range_t; - -typedef struct filter_rule_key { - in_addr_t src_net_cidr; - uint8_t src_net_bit_len; - port_range_t src_port_range; - in_addr_t dst_net_cidr; - uint8_t dst_net_bit_len; - port_range_t dst_port_range; - uint8_t bool_tcp_configured; - uint8_t bool_udp_configured; - uint8_t bool_icmp_configured; -} filter_rule_key_t; - -typedef struct filter_rule { - filter_rule_key_t key; - - uint8_t bool_accept_icmp; - uint8_t bool_accept_udp; - uint8_t bool_accept_tcp; - - UT_hash_handle hh; /* makes this structure hashable */ -} filter_rule_t; - - -#ifndef WIN32 -typedef struct tuntap_dev { - int fd; - int if_idx; - n2n_mac_t mac_addr; - uint32_t ip_addr; - uint32_t device_mask; - uint16_t mtu; - char dev_name[N2N_IFNAMSIZ]; -} tuntap_dev; - -#define SOCKET int -#endif /* #ifndef WIN32 */ - -/** Uncomment this to enable the MTU check, then try to ssh to generate a fragmented packet. */ -/** NOTE: see doc/MTU.md for an explanation on the 1400 value */ -//#define MTU_ASSERT_VALUE 1400 - -/** Common type used to hold stringified IP addresses. */ -typedef char ipstr_t[32]; - -/** Common type used to hold stringified MAC addresses. */ -#define N2N_MACSTR_SIZE 32 -typedef char macstr_t[N2N_MACSTR_SIZE]; -typedef char dec_ip_str_t[N2N_NETMASK_STR_SIZE]; -typedef char dec_ip_bit_str_t[N2N_NETMASK_STR_SIZE + 4]; - -typedef struct speck_context_t he_context_t; -typedef char n2n_sn_name_t[N2N_EDGE_SN_HOST_SIZE]; - -typedef enum n2n_pc { - n2n_ping = 0, /* Not used */ - n2n_register = 1, /* Register edge to edge */ - n2n_deregister = 2, /* Deregister this edge */ - n2n_packet = 3, /* PACKET data content */ - n2n_register_ack = 4, /* ACK of a registration from edge to edge */ - n2n_register_super = 5, /* Register edge to supernode */ - n2n_unregister_super = 6, /* Deregister edge from supernode */ - n2n_register_super_ack = 7, /* ACK from supernode to edge */ - n2n_register_super_nak = 8, /* NAK from supernode to edge - registration refused */ - n2n_federation = 9, /* Not used by edge */ - n2n_peer_info = 10, /* Send info on a peer from sn to edge */ - n2n_query_peer = 11, /* ask supernode for info on a peer */ - n2n_re_register_super = 12 /* ask edge to re-register with supernode */ -} n2n_pc_t; - -#define N2N_FLAGS_OPTIONS 0x0080 -#define N2N_FLAGS_SOCKET 0x0040 -#define N2N_FLAGS_FROM_SUPERNODE 0x0020 - -/* The bits in flag that are the packet type */ -#define N2N_FLAGS_TYPE_MASK 0x001f /* 0 - 31 */ -#define N2N_FLAGS_BITS_MASK 0xffe0 - -#define IPV4_SIZE 4 -#define IPV6_SIZE 16 - - -#define N2N_AUTH_MAX_TOKEN_SIZE 48 /* max token size in bytes */ -#define N2N_AUTH_CHALLENGE_SIZE 16 /* challenge always is of same size as dynamic key */ -#define N2N_AUTH_ID_TOKEN_SIZE 16 -#define N2N_AUTH_PW_TOKEN_SIZE (N2N_PRIVATE_PUBLIC_KEY_SIZE + N2N_AUTH_CHALLENGE_SIZE) - -#define N2N_EUNKNOWN -1 -#define N2N_ENOTIMPL -2 -#define N2N_EINVAL -3 -#define N2N_ENOSPACE -4 - - -#define N2N_VERSION_STRING_SIZE 20 -typedef char n2n_version_t[N2N_VERSION_STRING_SIZE]; - - -#define SN_SELECTION_STRATEGY_LOAD 1 -#define SN_SELECTION_STRATEGY_RTT 2 -#define SN_SELECTION_STRATEGY_MAC 3 - - -typedef struct n2n_ip_subnet { - uint32_t net_addr; /* Host order IP address. */ - uint8_t net_bitlen; /* Subnet prefix. */ -} n2n_ip_subnet_t; - -typedef struct n2n_sock { - uint8_t family; /* AF_INET or AF_INET6; or 0 if invalid */ - uint16_t port; /* host order */ - union { - uint8_t v6[IPV6_SIZE]; /* byte sequence */ - uint8_t v4[IPV4_SIZE]; /* byte sequence */ - } addr; -} n2n_sock_t; - -typedef enum { - n2n_auth_none = 0, - n2n_auth_simple_id = 1, - n2n_auth_user_password = 2 -} n2n_auth_scheme_t; - -typedef enum { - update_edge_no_change = 0, - update_edge_sock_change = 1, - update_edge_new_sn = 2, - update_edge_auth_fail = -1 -} update_edge_ret_value_t; - -typedef struct n2n_auth { - uint16_t scheme; /* What kind of auth */ - uint16_t token_size; /* Size of auth token */ - uint8_t token[N2N_AUTH_MAX_TOKEN_SIZE]; /* Auth data interpreted based on scheme */ -} n2n_auth_t; - -typedef struct n2n_common { - /* NOTE: wire representation is different! */ - /* int version; */ - - uint8_t ttl; - uint8_t pc; - uint16_t flags; - n2n_community_t community; -} n2n_common_t; - -typedef struct n2n_REGISTER { - n2n_cookie_t cookie; /**< Link REGISTER and REGISTER_ACK */ - n2n_mac_t srcMac; /**< MAC of registering party */ - n2n_mac_t dstMac; /**< MAC of target edge */ - n2n_sock_t sock; /**< Supernode's view of edge socket OR edge's preferred local socket */ - n2n_ip_subnet_t dev_addr; /**< IP address of the tuntap adapter. */ - n2n_desc_t dev_desc; /**< Hint description correlated with the edge */ -} n2n_REGISTER_t; - -typedef struct n2n_REGISTER_ACK { - n2n_cookie_t cookie; /**< Return cookie from REGISTER */ - n2n_mac_t srcMac; /**< MAC of acknowledging party (supernode or edge) */ - n2n_mac_t dstMac; /**< Reflected MAC of registering edge from REGISTER */ - n2n_sock_t sock; /**< Supernode's view of edge socket (IP Addr, port) */ -} n2n_REGISTER_ACK_t; - -typedef struct n2n_PACKET { - n2n_mac_t srcMac; - n2n_mac_t dstMac; - n2n_sock_t sock; - uint8_t transform; - uint8_t compression; -} n2n_PACKET_t; - -/* Linked with n2n_register_super in n2n_pc_t. Only from edge to supernode. */ -typedef struct n2n_REGISTER_SUPER { - n2n_cookie_t cookie; /**< Link REGISTER_SUPER and REGISTER_SUPER_ACK */ - n2n_mac_t edgeMac; /**< MAC to register with edge sending socket */ - n2n_sock_t sock; /**< Sending socket associated with edgeMac */ - n2n_ip_subnet_t dev_addr; /**< IP address of the tuntap adapter. */ - n2n_desc_t dev_desc; /**< Hint description correlated with the edge */ - n2n_auth_t auth; /**< Authentication scheme and tokens */ - uint32_t key_time; /**< key time for dynamic key, used between federatred supernodes only */ -} n2n_REGISTER_SUPER_t; - - -/* Linked with n2n_register_super_ack in n2n_pc_t. Only from supernode to edge. */ -typedef struct n2n_REGISTER_SUPER_ACK { - n2n_cookie_t cookie; /**< Return cookie from REGISTER_SUPER */ - n2n_mac_t srcMac; /**< MAC of answering supernode */ - n2n_ip_subnet_t dev_addr; /**< Assign an IP address to the tuntap adapter of edge. */ - uint16_t lifetime; /**< How long the registration will live */ - n2n_sock_t sock; /**< Sending sockets associated with edge */ - n2n_auth_t auth; /**< Authentication scheme and tokens */ - - /** The packet format provides additional supernode definitions here. - * uint8_t count, then for each count there is one - * n2n_sock_t. - */ - uint8_t num_sn; /**< Number of supernodes that were send - * even if we cannot store them all. */ - - uint32_t key_time; /**< key time for dynamic key, used between federatred supernodes only */ -} n2n_REGISTER_SUPER_ACK_t; - - -/* Linked with n2n_register_super_ack in n2n_pc_t. Only from supernode to edge. */ -typedef struct n2n_REGISTER_SUPER_NAK { - n2n_cookie_t cookie; /* Return cookie from REGISTER_SUPER */ - n2n_mac_t srcMac; - n2n_auth_t auth; /* Authentication scheme and tokens */ -} n2n_REGISTER_SUPER_NAK_t; - - -/* REGISTER_SUPER_ACK may contain extra payload (their number given by num_sn) - * of following type describing a(nother) supernode */ -typedef struct n2n_REGISTER_SUPER_ACK_payload { - n2n_sock_t sock; /**< socket of supernode */ - n2n_mac_t mac; /**< MAC of supernode */ -} n2n_REGISTER_SUPER_ACK_payload_t; - - -/* Linked with n2n_unregister_super in n2n_pc_t. */ -typedef struct n2n_UNREGISTER_SUPER { - n2n_auth_t auth; - n2n_mac_t srcMac; -} n2n_UNREGISTER_SUPER_t; - - -typedef struct n2n_PEER_INFO { - uint16_t aflags; - n2n_mac_t srcMac; - n2n_mac_t mac; - n2n_sock_t sock; - n2n_sock_t preferred_sock; - uint32_t load; - n2n_version_t version; - time_t uptime; -} n2n_PEER_INFO_t; - - -typedef struct n2n_QUERY_PEER { - uint16_t aflags; - n2n_mac_t srcMac; - n2n_sock_t sock; - n2n_mac_t targetMac; - -} n2n_QUERY_PEER_t; - -typedef struct n2n_buf n2n_buf_t; - -struct peer_info { - n2n_mac_t mac_addr; - n2n_ip_subnet_t dev_addr; - n2n_desc_t dev_desc; - n2n_sock_t sock; - SOCKET socket_fd; - n2n_sock_t preferred_sock; - n2n_cookie_t last_cookie; - n2n_auth_t auth; - int timeout; - uint8_t purgeable; - time_t last_seen; - time_t last_p2p; - time_t last_sent_query; - SN_SELECTION_CRITERION_DATA_TYPE selection_criterion; - uint64_t last_valid_time_stamp; - char *ip_addr; - uint8_t local; - time_t uptime; - n2n_version_t version; - - UT_hash_handle hh; /* makes this structure hashable */ -}; - -typedef struct peer_info peer_info_t; - -typedef struct n2n_route { - in_addr_t net_addr; - uint8_t net_bitlen; - in_addr_t gateway; -} n2n_route_t; - -typedef struct n2n_edge n2n_edge_t; - -/* *************************************************** */ - -typedef enum { - N2N_ACCEPT = 0, - N2N_DROP = 1 -} n2n_verdict; - -/* *************************************************** */ - -typedef enum { - FPP_UNKNOWN = 0, - FPP_ARP = 1, - FPP_TCP = 2, - FPP_UDP = 3, - FPP_ICMP = 4, - FPP_IGMP = 5 -} filter_packet_proto; - - -typedef struct packet_address_proto_info { - in_addr_t src_ip; - uint16_t src_port; - in_addr_t dst_ip; - uint16_t dst_port; - filter_packet_proto proto; -}packet_address_proto_info_t; - -typedef struct filter_rule_pair_cache { - packet_address_proto_info_t key; - - uint8_t bool_allow_traffic; - uint32_t active_count; - - UT_hash_handle hh; /* makes this structure hashable */ -} filter_rule_pair_cache_t; - -struct network_traffic_filter; -typedef struct network_traffic_filter network_traffic_filter_t; - -struct network_traffic_filter { - n2n_verdict (*filter_packet_from_peer)(network_traffic_filter_t* filter, n2n_edge_t *eee, - const n2n_sock_t *peer, uint8_t *payload, uint16_t payload_size); - - n2n_verdict (*filter_packet_from_tap)(network_traffic_filter_t* filter, n2n_edge_t *eee, uint8_t *payload, uint16_t payload_size); - - filter_rule_t *rules; - - filter_rule_pair_cache_t *connections_rule_cache; - - uint32_t work_count_scene_last_clear; - -}; - -/* *************************************************** */ - -/* Callbacks allow external programs to attach functions in response to - * N2N events. */ -typedef struct n2n_edge_callbacks { - /* The supernode registration has been updated */ - void (*sn_registration_updated)(n2n_edge_t *eee, time_t now, const n2n_sock_t *sn); - - /* A packet has been received from a peer. N2N_DROP can be returned to - * drop the packet. The packet payload can be modified. This only allows - * the packet size to be reduced */ - n2n_verdict (*packet_from_peer)(n2n_edge_t *eee, const n2n_sock_t *peer, uint8_t *payload, uint16_t *payload_size); - - /* A packet has been received from the TAP interface. N2N_DROP can be - * returned to drop the packet. The packet payload can be modified. - * This only allows the packet size to be reduced */ - n2n_verdict (*packet_from_tap)(n2n_edge_t *eee, uint8_t *payload, uint16_t *payload_size); - - /* Called whenever the IP address of the TAP interface changes. */ - void (*ip_address_changed)(n2n_edge_t *eee, uint32_t old_ip, uint32_t new_ip); - - /* Called periodically in the main loop. */ - void (*main_loop_period)(n2n_edge_t *eee, time_t now); - - /* Called when a new socket to supernode is created. */ - void (*sock_opened)(n2n_edge_t *eee); -} n2n_edge_callbacks_t; - -typedef struct n2n_tuntap_priv_config { - char tuntap_dev_name[N2N_IFNAMSIZ]; - char ip_mode[N2N_IF_MODE_SIZE]; - dec_ip_str_t ip_addr; - dec_ip_str_t netmask; - char device_mac[N2N_MACNAMSIZ]; - int mtu; - int metric; - uint8_t daemon; -#ifndef WIN32 - uid_t userid; - gid_t groupid; -#endif -} n2n_tuntap_priv_config_t; - -/* *************************************************** */ - -typedef enum n2n_transform { - N2N_TRANSFORM_ID_INVAL = 0, - N2N_TRANSFORM_ID_NULL = 1, - N2N_TRANSFORM_ID_TWOFISH = 2, - N2N_TRANSFORM_ID_AES = 3, - N2N_TRANSFORM_ID_CHACHA20 = 4, - N2N_TRANSFORM_ID_SPECK = 5, -} n2n_transform_t; - -struct n2n_trans_op; /* Circular definition */ - -typedef int (*n2n_transdeinit_f)(struct n2n_trans_op * arg); -typedef void (*n2n_transtick_f)(struct n2n_trans_op * arg, time_t now); -typedef int (*n2n_transform_f)(struct n2n_trans_op * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const n2n_mac_t peer_mac); -/** Holds the info associated with a data transform plugin. - * - * When a packet arrives the transform ID is extracted. This defines the code - * to use to decode the packet content. The transform code then decodes the - * packet and consults its internal key lookup. - */ -typedef struct n2n_trans_op { - void * priv; /* opaque data. Key schedule goes here. */ - uint8_t no_encryption; /* 1 if this transop does not perform encryption */ - n2n_transform_t transform_id; - size_t tx_cnt; - size_t rx_cnt; - - n2n_transdeinit_f deinit; /* destructor function */ - n2n_transtick_f tick; /* periodic maintenance */ - n2n_transform_f fwd; /* encode a payload */ - n2n_transform_f rev; /* decode a payload */ -} n2n_trans_op_t; - - -/* *************************************************** */ - - -typedef struct n2n_resolve_ip_sock { - char *org_ip; /* pointer to original ip/named address string (used read only) */ - n2n_sock_t sock; /* resolved socket */ - n2n_sock_t *org_sock; /* pointer to original socket where 'sock' gets copied to from time to time */ - int error_code; /* result of last resolution attempt */ - - UT_hash_handle hh; /* makes this structure hashable */ -} n2n_resolve_ip_sock_t; - - -// structure to hold resolver thread's parameters -typedef struct n2n_resolve_parameter { - n2n_resolve_ip_sock_t *list; /* pointer to list of to be resolved nodes */ - uint8_t changed; /* indicates a change */ -#ifdef HAVE_PTHREAD - pthread_t id; /* thread id */ - pthread_mutex_t access; /* mutex for shared access */ -#endif - uint8_t request; /* flags main thread's need for intermediate resolution */ - time_t check_interval;/* interval to checik resolover results */ - time_t last_checked; /* last time the resolver results were cheked */ - time_t last_resolved; /* last time the resolver completed */ -} n2n_resolve_parameter_t; - - -/* *************************************************** */ - - -typedef struct n2n_edge_conf { - struct peer_info *supernodes; /**< List of supernodes */ - n2n_route_t *routes; /**< Networks to route through n2n */ - n2n_community_t community_name; /**< The community. 16 full octets. */ - n2n_desc_t dev_desc; /**< The device description (hint) */ - n2n_private_public_key_t *public_key; /**< edge's public key (for user/password based authentication) */ - n2n_private_public_key_t *shared_secret; /**< shared secret derived from federation public key, username and password */ - he_context_t *shared_secret_ctx; /**< context holding the roundkeys derived from shared secret */ - n2n_private_public_key_t *federation_public_key; /**< federation public key provided by command line */ - uint8_t header_encryption; /**< Header encryption indicator. */ - he_context_t *header_encryption_ctx_static; /**< Header encryption cipher context. */ - he_context_t *header_encryption_ctx_dynamic; /**< Header encryption cipher context. */ - he_context_t *header_iv_ctx_static; /**< Header IV ecnryption cipher context, REMOVE as soon as separate fileds for checksum and replay protection available */ - he_context_t *header_iv_ctx_dynamic; /**< Header IV ecnryption cipher context, REMOVE as soon as separate fileds for checksum and replay protection available */ - n2n_transform_t transop_id; /**< The transop to use. */ - uint8_t compression; /**< Compress outgoing data packets before encryption */ - uint16_t num_routes; /**< Number of routes in routes */ - uint8_t tuntap_ip_mode; /**< Interface IP address allocated mode, eg. DHCP. */ - uint8_t allow_routing; /**< Accept packet no to interface address. */ - uint8_t drop_multicast; /**< Multicast ethernet addresses. */ - uint8_t disable_pmtu_discovery; /**< Disable the Path MTU discovery. */ - uint8_t allow_p2p; /**< Allow P2P connection */ - uint8_t sn_num; /**< Number of supernode addresses defined. */ - uint8_t tos; /** TOS for sent packets */ - char *encrypt_key; - int register_interval; /**< Interval for supernode registration, also used for UDP NAT hole punching. */ - int register_ttl; /**< TTL for registration packet when UDP NAT hole punching through supernode. */ - in_addr_t bind_address; /**< The address to bind to if provided (-b) */ - n2n_sock_t preferred_sock; /**< propagated local sock for better p2p in LAN (-e) */ - uint8_t preferred_sock_auto; /**< indicates desired auto detect for preferred sock */ - int local_port; - int mgmt_port; - uint8_t connect_tcp; /** connection to supernode 0 = UDP; 1 = TCP */ - n2n_auth_t auth; - filter_rule_t *network_traffic_filter_rules; - int metric; /**< Network interface metric (Windows only). */ - uint8_t sn_selection_strategy; /**< encodes currently chosen supernode selection strategy. */ - uint8_t number_max_sn_pings; /**< Number of maximum concurrently allowed supernode pings. */ - uint64_t mgmt_password_hash; /**< contains hash of managament port password. */ -} n2n_edge_conf_t; - - -struct n2n_edge_stats { - uint32_t tx_p2p; - uint32_t rx_p2p; - uint32_t tx_sup; - uint32_t rx_sup; - uint32_t tx_sup_broadcast; - uint32_t rx_sup_broadcast; -}; - -struct n2n_edge { - n2n_edge_conf_t conf; - - /* Status */ - int *keep_running; /**< Pointer to edge loop stop/go flag */ - struct peer_info *curr_sn; /**< Currently active supernode. */ - uint8_t sn_wait; /**< Whether we are waiting for a supernode response. */ - uint8_t sn_pong; /**< Whether we have seen a PONG since last time reset. */ - size_t sup_attempts; /**< Number of remaining attempts to this supernode. */ - tuntap_dev device; /**< All about the TUNTAP device */ - n2n_trans_op_t transop; /**< The transop to use when encoding */ - n2n_route_t *sn_route_to_clean; /**< Supernode route to clean */ - n2n_edge_callbacks_t cb; /**< API callbacks */ - void *user_data; /**< Can hold user data */ - SN_SELECTION_CRITERION_DATA_TYPE sn_selection_criterion_common_data; - - /* Sockets */ - /* supernode socket is in eee->curr_sn->sock (of type n2n_sock_t) */ - int sock; - int close_socket_counter; /**< counter for close-event before re-opening */ - int udp_mgmt_sock; /**< socket for status info. */ - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - n2n_sock_t multicast_peer; /**< Multicast peer group (for local edges) */ - int udp_multicast_sock; /**< socket for local multicast registrations. */ - int multicast_joined; /**< 1 if the group has been joined.*/ -#endif - - /* Peers */ - struct peer_info * known_peers; /**< Edges we are connected to. */ - struct peer_info * pending_peers; /**< Edges we have tried to register with. */ - - /* Timers */ - time_t last_register_req; /**< Check if time to re-register with super*/ - time_t last_p2p; /**< Last time p2p traffic was received. */ - time_t last_sup; /**< Last time a packet arrived from supernode. */ - time_t last_sweep; /**< Last time a sweep was performed. */ - time_t start_time; /**< For calculating uptime */ - - - struct n2n_edge_stats stats; /**< Statistics */ - - n2n_resolve_parameter_t *resolve_parameter; /**< Pointer to name resolver's parameter block */ - uint8_t resolution_request; /**< Flag an immediate DNS resolution request */ - - n2n_tuntap_priv_config_t tuntap_priv_conf; /**< Tuntap config */ - - network_traffic_filter_t *network_traffic_filter; -}; - -typedef struct sn_stats { - size_t errors; /* Number of errors encountered. */ - size_t reg_super; /* Number of REGISTER_SUPER requests received. */ - size_t reg_super_nak; /* Number of REGISTER_SUPER requests declined. */ - size_t fwd; /* Number of messages forwarded. */ - size_t broadcast; /* Number of messages broadcast to a community. */ - time_t last_fwd; /* Time when last message was forwarded. */ - time_t last_reg_super; /* Time when last REGISTER_SUPER was received. */ -} sn_stats_t; - -typedef struct node_supernode_association { - - n2n_mac_t mac; /* mac address of an edge */ - const struct sockaddr_in sock; /* network order socket of that edge's supernode */ - time_t last_seen; /* time mark to keep track of purging requirements */ - - UT_hash_handle hh; /* makes this structure hashable */ -} node_supernode_association_t; - -typedef struct sn_user { - n2n_private_public_key_t public_key; - n2n_private_public_key_t shared_secret; - he_context_t *shared_secret_ctx; - n2n_desc_t name; - - UT_hash_handle hh; -} sn_user_t; - -struct sn_community { - char community[N2N_COMMUNITY_SIZE]; - uint8_t is_federation; /* if not-zero, then the current community is the federation of supernodes */ - uint8_t purgeable; /* indicates purgeable community (fixed-name, predetermined (-c parameter) communties usually are unpurgeable) */ - uint8_t header_encryption; /* Header encryption indicator. */ - he_context_t *header_encryption_ctx_static; /* Header encryption cipher context. */ - he_context_t *header_encryption_ctx_dynamic; /* Header encryption cipher context. */ - he_context_t *header_iv_ctx_static; /* Header IV encryption cipher context, REMOVE as soon as separate fields for checksum and replay protection available */ - he_context_t *header_iv_ctx_dynamic; /* Header IV encryption cipher context, REMOVE as soon as separate fields for checksum and replay protection available */ - uint8_t dynamic_key[N2N_AUTH_CHALLENGE_SIZE]; /* dynamic key */ - struct peer_info *edges; /* Link list of registered edges. */ - node_supernode_association_t *assoc; /* list of other edges from this community and their supernodes */ - sn_user_t *allowed_users; /* list of allowed users */ - int64_t number_enc_packets; /* Number of encrypted packets handled so far, required for sorting from time to time */ - n2n_ip_subnet_t auto_ip_net; /* Address range of auto ip address service. */ - - UT_hash_handle hh; /* makes this structure hashable */ -}; - -/* Typedef'd pointer to get abstract datatype. */ -typedef struct regex_t* re_t; - -struct sn_community_regular_expression { - re_t rule; /* compiles regular expression */ - - UT_hash_handle hh; /* makes this structure hashable */ -}; - - -typedef struct n2n_tcp_connection { - int socket_fd; /* file descriptor for tcp socket */ - struct sockaddr sock; /* network order socket */ - - uint16_t expected; /* number of bytes expected to be read */ - uint16_t position; /* current position in the buffer */ - uint8_t buffer[N2N_PKT_BUF_SIZE + sizeof(uint16_t)]; /* buffer for data collected from tcp socket incl. prepended length */ - uint8_t inactive; /* connection not be handled if set, already closed and to be deleted soon */ - - UT_hash_handle hh; /* makes this structure hashable */ -} n2n_tcp_connection_t; - - -typedef struct n2n_sn { - int *keep_running; /* Pointer to sn loop stop/go flag */ - time_t start_time; /* Used to measure uptime. */ - n2n_version_t version; /* version string sent to edges along with PEER_INFO a.k.a. PONG */ - sn_stats_t stats; - int daemon; /* If non-zero then daemonise. */ - n2n_mac_t mac_addr; - uint16_t lport; /* Local UDP port to bind to. */ - uint16_t mport; /* Management UDP port to bind to. */ - int sock; /* Main socket for UDP traffic with edges. */ - int tcp_sock; /* auxiliary socket for optional TCP connections */ - n2n_tcp_connection_t *tcp_connections;/* list of established TCP connections */ - int mgmt_sock; /* management socket. */ - n2n_ip_subnet_t min_auto_ip_net; /* Address range of auto_ip service. */ - n2n_ip_subnet_t max_auto_ip_net; /* Address range of auto_ip service. */ -#ifndef WIN32 - uid_t userid; - gid_t groupid; -#endif - int lock_communities; /* If true, only loaded and matching communities can be used. */ - char *community_file; - struct sn_community *communities; - struct sn_community_regular_expression *rules; - struct sn_community *federation; - n2n_private_public_key_t private_key; /* private federation key derived from federation name */ - n2n_auth_t auth; - uint32_t dynamic_key_time; /* UTC time of last dynamic key generation (second accuracy) */ - uint8_t override_spoofing_protection; /* set if overriding MAC/IP spoofing protection (cli option '-M') */ - n2n_resolve_parameter_t *resolve_parameter;/*Pointer to name resolver's parameter block */ - uint64_t mgmt_password_hash;/* contains hash of managament port password */ -} n2n_sn_t; - - -/* *************************************************** */ - -#endif /* _N2N_TYPEDEFS_H_ */ diff --git a/bundles/n2n_ntop_v3/include/n2n_wire.h b/bundles/n2n_ntop_v3/include/n2n_wire.h deleted file mode 100644 index 62d30c61..00000000 --- a/bundles/n2n_ntop_v3/include/n2n_wire.h +++ /dev/null @@ -1,226 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#if !defined( N2N_WIRE_H_ ) -#define N2N_WIRE_H_ - -#include -#ifndef _MSC_VER -/* Not included in Visual Studio 2008 */ -#include -#endif - -#if defined(WIN32) -#include "n2n_win32.h" -#else /* #if defined(WIN32) */ -#include -#include /* AF_INET and AF_INET6 */ -#endif /* #if defined(WIN32) */ - -#include "sn_selection.h" - - -int encode_uint8 (uint8_t * base, - size_t * idx, - const uint8_t v); - -int decode_uint8 (uint8_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_uint16 (uint8_t * base, - size_t * idx, - const uint16_t v); - -int decode_uint16 (uint16_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_uint32 (uint8_t * base, - size_t * idx, - const uint32_t v); - -int decode_uint32 (uint32_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_uint64 (uint8_t * base, - size_t * idx, - const uint64_t v); - -int decode_uint64 (uint64_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_buf (uint8_t * base, - size_t * idx, - const void * p, - size_t s); - -int decode_buf (uint8_t * out, - size_t bufsize, - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_mac (uint8_t * base, - size_t * idx, - const n2n_mac_t m); - -int decode_mac (n2n_mac_t out, - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_cookie (uint8_t * base, - size_t * idx, - const n2n_cookie_t c); - -int decode_cookie (n2n_cookie_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_common (uint8_t * base, - size_t * idx, - const n2n_common_t * common); - -int decode_common (n2n_common_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_sock (uint8_t * base, - size_t * idx, - const n2n_sock_t * sock); - -int decode_sock (n2n_sock_t * sock, - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_REGISTER (uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_t * reg); - -int decode_REGISTER (n2n_REGISTER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_REGISTER_SUPER (uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_SUPER_t * reg); - -int decode_REGISTER_SUPER (n2n_REGISTER_SUPER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_UNREGISTER_SUPER (uint8_t *base, - size_t *idx, - const n2n_common_t *common, - const n2n_UNREGISTER_SUPER_t *unreg); - -int decode_UNREGISTER_SUPER (n2n_UNREGISTER_SUPER_t *unreg, - const n2n_common_t *cmn, /* info on how to interpret it */ - const uint8_t *base, - size_t *rem, - size_t *idx); - -int encode_REGISTER_ACK (uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_REGISTER_ACK_t * reg); - -int decode_REGISTER_ACK (n2n_REGISTER_ACK_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_REGISTER_SUPER_ACK (uint8_t * base, - size_t * idx, - const n2n_common_t * cmn, - const n2n_REGISTER_SUPER_ACK_t * reg, - uint8_t * tmpbuf); - -int decode_REGISTER_SUPER_ACK (n2n_REGISTER_SUPER_ACK_t * reg, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx, - uint8_t * tmpbuf); - -int encode_REGISTER_SUPER_NAK (uint8_t * base, - size_t * idx, - const n2n_common_t * cmn, - const n2n_REGISTER_SUPER_NAK_t * nak); - -int decode_REGISTER_SUPER_NAK (n2n_REGISTER_SUPER_NAK_t * nak, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx); - -int fill_sockaddr (struct sockaddr * addr, - size_t addrlen, - const n2n_sock_t * sock); - -int encode_PACKET (uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PACKET_t * pkt); - -int decode_PACKET (n2n_PACKET_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_PEER_INFO (uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PEER_INFO_t * pkt); - -int decode_PEER_INFO (n2n_PEER_INFO_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx); - -int encode_QUERY_PEER (uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_QUERY_PEER_t * pkt); - -int decode_QUERY_PEER (n2n_QUERY_PEER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx); - -#endif /* #if !defined( N2N_WIRE_H_ ) */ diff --git a/bundles/n2n_ntop_v3/include/network_traffic_filter.h b/bundles/n2n_ntop_v3/include/network_traffic_filter.h deleted file mode 100644 index 97de7ecd..00000000 --- a/bundles/n2n_ntop_v3/include/network_traffic_filter.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -// -// Zhou Bin -// - -#ifndef N2N_NETWORK_TRAFFIC_FILTER_H -#define N2N_NETWORK_TRAFFIC_FILTER_H - -#include "n2n_typedefs.h" - -network_traffic_filter_t* create_network_traffic_filter (); - -void destroy_network_traffic_filter (network_traffic_filter_t* filter); - -void network_traffic_filter_add_rule (network_traffic_filter_t* filter, filter_rule_t* rules); - -//rule_str format: src_ip/len:[b_port,e_port],dst_ip/len:[s_port,e_port],TCP+/-,UDP+/-,ICMP+/- -uint8_t process_traffic_filter_rule_str (const char* rule_str, filter_rule_t* rule_struct); - -#endif //N2N_NETWORK_TRAFFIC_FILTER_H diff --git a/bundles/n2n_ntop_v3/include/pearson.h b/bundles/n2n_ntop_v3/include/pearson.h deleted file mode 100644 index 97d25002..00000000 --- a/bundles/n2n_ntop_v3/include/pearson.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include -#include - -#include "portable_endian.h" - - -void pearson_hash_256 (uint8_t *out, const uint8_t *in, size_t len); - -void pearson_hash_128 (uint8_t *out, const uint8_t *in, size_t len); - -uint64_t pearson_hash_64 (const uint8_t *in, size_t len); - -uint32_t pearson_hash_32 (const uint8_t *in, size_t len); - -uint16_t pearson_hash_16 (const uint8_t *in, size_t len); - -void pearson_hash_init (); diff --git a/bundles/n2n_ntop_v3/include/portable_endian.h b/bundles/n2n_ntop_v3/include/portable_endian.h deleted file mode 100644 index 12a30b97..00000000 --- a/bundles/n2n_ntop_v3/include/portable_endian.h +++ /dev/null @@ -1,226 +0,0 @@ -// taken from -// https://raw.githubusercontent.com/pyca/bcrypt/master/src/_csrc/portable_endian.h -// as of June 11, 2020 - -// "License": Public Domain -// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like. -// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to -// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it -// an example on how to get the endian conversion functions on different platforms. - -#ifndef PORTABLE_ENDIAN_H__ -#define PORTABLE_ENDIAN_H__ - -#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) - -# define __WINDOWS__ - -#endif - -#if defined(__linux__) || defined(__CYGWIN__) -/* Define necessary macros for the header to expose all fields. */ -# if !defined(_BSD_SOURCE) -# define _BSD_SOURCE -# endif -# if !defined(__USE_BSD) -# define __USE_BSD -# endif -# if !defined(_DEFAULT_SOURCE) -# define _DEFAULT_SOURCE -# endif -# include -# include -/* See http://linux.die.net/man/3/endian */ -# if defined(htobe16) && defined(htole16) && defined(be16toh) && defined(le16toh) && defined(htobe32) && defined(htole32) && defined(be32toh) && defined(htole32) && defined(htobe64) && defined(htole64) && defined(htobe64) && defined(be64toh) && defined(htole64) && defined(le64toh) -/* Do nothing. The macros we need already exist. */ -# elif !defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 9))) -# include -# if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) -# define htobe16(x) htons(x) -# define htole16(x) (x) -# define be16toh(x) ntohs(x) -# define le16toh(x) (x) - -# define htobe32(x) htonl(x) -# define htole32(x) (x) -# define be32toh(x) ntohl(x) -# define le32toh(x) (x) - -# define htobe64(x) (((uint64_t)htonl(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)htonl(((uint32_t)(x)))) << 32)) -# define htole64(x) (x) -# define be64toh(x) (((uint64_t)ntohl(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)ntohl(((uint32_t)(x)))) << 32)) -# define le64toh(x) (x) -# elif defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN) -# define htobe16(x) (x) -# define htole16(x) (((((uint16_t)(x)) >> 8))|((((uint16_t)(x)) << 8))) -# define be16toh(x) (x) -# define le16toh(x) (((((uint16_t)(x)) >> 8))|((((uint16_t)(x)) << 8))) - -# define htobe32(x) (x) -# define htole32(x) (((uint32_t)htole16(((uint16_t)(((uint32_t)(x)) >> 16)))) | (((uint32_t)htole16(((uint16_t)(x)))) << 16)) -# define be32toh(x) (x) -# define le32toh(x) (((uint32_t)le16toh(((uint16_t)(((uint32_t)(x)) >> 16)))) | (((uint32_t)le16toh(((uint16_t)(x)))) << 16)) - -# define htobe64(x) (x) -# define htole64(x) (((uint64_t)htole32(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)htole32(((uint32_t)(x)))) << 32)) -# define be64toh(x) (x) -# define le64toh(x) (((uint64_t)le32toh(((uint32_t)(((uint64_t)(x)) >> 32)))) | (((uint64_t)le32toh(((uint32_t)(x)))) << 32)) -# else -# error Byte Order not supported or not defined. -# endif -# endif - -#elif defined(__APPLE__) - -# include - -# define htobe16(x) OSSwapHostToBigInt16(x) -# define htole16(x) OSSwapHostToLittleInt16(x) -# define be16toh(x) OSSwapBigToHostInt16(x) -# define le16toh(x) OSSwapLittleToHostInt16(x) - -# define htobe32(x) OSSwapHostToBigInt32(x) -# define htole32(x) OSSwapHostToLittleInt32(x) -# define be32toh(x) OSSwapBigToHostInt32(x) -# define le32toh(x) OSSwapLittleToHostInt32(x) - -# define htobe64(x) OSSwapHostToBigInt64(x) -# define htole64(x) OSSwapHostToLittleInt64(x) -# define be64toh(x) OSSwapBigToHostInt64(x) -# define le64toh(x) OSSwapLittleToHostInt64(x) - -# define __BYTE_ORDER BYTE_ORDER -# define __BIG_ENDIAN BIG_ENDIAN -# define __LITTLE_ENDIAN LITTLE_ENDIAN -# define __PDP_ENDIAN PDP_ENDIAN - -#elif defined(__OpenBSD__) - -# include - -#elif defined(__HAIKU__) - -# include - -#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) - -# include - -# if !defined(be16toh) - # define be16toh(x) betoh16(x) - # define le16toh(x) letoh16(x) -# endif - -# if !defined(be32toh) - # define be32toh(x) betoh32(x) - # define le32toh(x) letoh32(x) -# endif - -# if !defined(be64toh) - # define be64toh(x) betoh64(x) - # define le64toh(x) letoh64(x) -# endif - -#elif defined(__WINDOWS__) - -# if BYTE_ORDER == LITTLE_ENDIAN - -# define htobe16(x) _byteswap_ushort(x) -# define htole16(x) (x) -# define be16toh(x) _byteswap_ushort(x) -# define le16toh(x) (x) - -# define htobe32(x) _byteswap_ulong(x) -# define htole32(x) (x) -# define be32toh(x) _byteswap_ulong(x) -# define le32toh(x) (x) - -# define htobe64(x) (((uint64_t)htobe32(((uint32_t)(((uint64_t)(x)) >> 32))) & 0x00000000FFFFFFFFULL) | (((uint64_t)htobe32(((uint32_t)(x)))) << 32)) -# define be64toh(x) (((uint64_t)be32toh(((uint32_t)(((uint64_t)(x)) >> 32))) & 0x00000000FFFFFFFFULL) | (((uint64_t)be32toh(((uint32_t)(x)))) << 32)) -# define htole64(x) (x) -# define le64toh(x) (x) - -# elif BYTE_ORDER == BIG_ENDIAN - - /* that would be xbox 360 */ -# define htobe16(x) (x) -# define htole16(x) __builtin_bswap16(x) -# define be16toh(x) (x) -# define le16toh(x) __builtin_bswap16(x) - -# define htobe32(x) (x) -# define htole32(x) __builtin_bswap32(x) -# define be32toh(x) (x) -# define le32toh(x) __builtin_bswap32(x) - -# define htobe64(x) (x) -# define htole64(x) __builtin_bswap64(x) -# define be64toh(x) (x) -# define le64toh(x) __builtin_bswap64(x) - -# else - -# error byte order not supported - -# endif - -# define __BYTE_ORDER BYTE_ORDER -# define __BIG_ENDIAN BIG_ENDIAN -# define __LITTLE_ENDIAN LITTLE_ENDIAN -# define __PDP_ENDIAN PDP_ENDIAN - -#elif defined(__sun) - -# include - -# define htobe16(x) BE_16(x) -# define htole16(x) LE_16(x) -# define be16toh(x) BE_16(x) -# define le16toh(x) LE_16(x) - -# define htobe32(x) BE_32(x) -# define htole32(x) LE_32(x) -# define be32toh(x) BE_32(x) -# define le32toh(x) LE_32(x) - -# define htobe64(x) BE_64(x) -# define htole64(x) LE_64(x) -# define be64toh(x) BE_64(x) -# define le64toh(x) LE_64(x) - -#elif defined _AIX /* AIX is always big endian */ -# define be64toh(x) (x) -# define be32toh(x) (x) -# define be16toh(x) (x) -# define le32toh(x) \ - ((((x) & 0xff) << 24) | \ - (((x) & 0xff00) << 8) | \ - (((x) & 0xff0000) >> 8) | \ - (((x) & 0xff000000) >> 24)) -# define le64toh(x) \ - ((((x) & 0x00000000000000ffL) << 56) | \ - (((x) & 0x000000000000ff00L) << 40) | \ - (((x) & 0x0000000000ff0000L) << 24) | \ - (((x) & 0x00000000ff000000L) << 8) | \ - (((x) & 0x000000ff00000000L) >> 8) | \ - (((x) & 0x0000ff0000000000L) >> 24) | \ - (((x) & 0x00ff000000000000L) >> 40) | \ - (((x) & 0xff00000000000000L) >> 56)) -# ifndef htobe64 -# define htobe64(x) be64toh(x) -# endif -# ifndef htobe32 -# define htobe32(x) be32toh(x) -# endif -# ifndef htobe16 -# define htobe16(x) be16toh(x) -# endif - - -#else - -# error platform not supported - -#endif - -#endif diff --git a/bundles/n2n_ntop_v3/include/random_numbers.h b/bundles/n2n_ntop_v3/include/random_numbers.h deleted file mode 100644 index 55cc400a..00000000 --- a/bundles/n2n_ntop_v3/include/random_numbers.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#ifndef RND_H -#define RND_H - - -#include -#include -#include /* time, clock */ - -#include "n2n.h" /* traceEvent */ - - -// syscall and inquiring random number from hardware generators might fail, so we will retry -#define RND_RETRIES 1000 - -#if defined (__linux__) -#include /* syscall, SYS_getrandom */ -#ifdef SYS_getrandom -#define GRND_NONBLOCK 1 -#include /* errno, EAGAIN */ -#endif -#endif - -#if defined (__RDRND__) || defined (__RDSEED__) -#include /* _rdrand64_step, rdseed4_step */ -#endif - -#if defined (WIN32) -#include // HCTYPTPROV, Crypt*-functions -#endif - - -typedef struct rn_generator_state_t { - uint64_t a, b; -} rn_generator_state_t; - -typedef struct splitmix64_state_t { - uint64_t s; -} splitmix64_state_t; - - -int n2n_srand (uint64_t seed); - -uint64_t n2n_rand (void); - -uint64_t n2n_seed (void); - -uint32_t n2n_rand_sqr (uint32_t max_n); - - -#endif // RND_H diff --git a/bundles/n2n_ntop_v3/include/sn_selection.h b/bundles/n2n_ntop_v3/include/sn_selection.h deleted file mode 100644 index 4f47f974..00000000 --- a/bundles/n2n_ntop_v3/include/sn_selection.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifndef _SN_SELECTION_ -#define _SN_SELECTION_ - -typedef char selection_criterion_str_t[SN_SELECTION_CRITERION_BUF_SIZE]; - -#include "n2n.h" - -/* selection criterion's functions */ -int sn_selection_criterion_init (peer_info_t *peer); -int sn_selection_criterion_default (SN_SELECTION_CRITERION_DATA_TYPE *selection_criterion); -int sn_selection_criterion_bad (SN_SELECTION_CRITERION_DATA_TYPE *selection_criterion); -int sn_selection_criterion_good (SN_SELECTION_CRITERION_DATA_TYPE *selection_criterion); -int sn_selection_criterion_calculate (n2n_edge_t *eee, peer_info_t *peer, SN_SELECTION_CRITERION_DATA_TYPE *data); - -/* common data's functions */ -int sn_selection_criterion_common_data_default (n2n_edge_t *eee); - -/* sorting function */ -int sn_selection_sort (peer_info_t **peer_list); - -/* gathering data function */ -SN_SELECTION_CRITERION_DATA_TYPE sn_selection_criterion_gather_data (n2n_sn_t *sss); - -/* management port output function */ -extern char * sn_selection_criterion_str (n2n_edge_t *eee, selection_criterion_str_t out, peer_info_t *peer); - - -#endif /* _SN_SELECTION_ */ diff --git a/bundles/n2n_ntop_v3/include/speck.h b/bundles/n2n_ntop_v3/include/speck.h deleted file mode 100644 index bf448fca..00000000 --- a/bundles/n2n_ntop_v3/include/speck.h +++ /dev/null @@ -1,142 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -// cipher SPECK -- 128 bit block size -- 128 and 256 bit key size -- CTR mode -// taken from (and modified: removed pure crypto-stream generation and seperated key expansion) -// https://github.com/nsacyber/simon-speck-supercop/blob/master/crypto_stream/speck128256ctr/ - - -#ifndef SPECK_H -#define SPECK_H - - -#include -#include - -#include "portable_endian.h" - - -#define u32 uint32_t -#define u64 uint64_t - -#define N2N_SPECK_IVEC_SIZE 16 -#define SPECK_KEY_BYTES (256/8) - - -#if defined (__AVX512F__) // AVX512 support ----------------------------------------------------------------------- - - -#include -#include /* memcpy() */ - -#define u512 __m512i - -#define SPECK_ALIGNED_CTX 64 - -typedef struct { - u512 rk[34]; - u64 key[34]; - u32 keysize; -} speck_context_t; - - -#elif defined (__AVX2__) // AVX2 support -------------------------------------------------------------------------- - - -#include - -#define u256 __m256i - -#define SPECK_ALIGNED_CTX 32 - -typedef struct { - u256 rk[34]; - u64 key[34]; - u32 keysize; -} speck_context_t; - - -#elif defined (__SSE2__) // SSE support --------------------------------------------------------------------------- - - -#include - -#define u128 __m128i - -#define SPECK_ALIGNED_CTX 16 -#define SPECK_CTX_BYVAL 1 - -typedef struct { - u128 rk[34]; - u64 key[34]; - u32 keysize; -} speck_context_t; - - -#elif defined (__ARM_NEON) && defined (SPECK_ARM_NEON) // NEON support --------------------------------------- - - -#include - -#define u128 uint64x2_t - -typedef struct { - u128 rk[34]; - u64 key[34]; - u32 keysize; -} speck_context_t; - - -#else // plain C -------------------------------------------------------------------------------------------------- - - -typedef struct { - u64 key[34]; - u32 keysize; -} speck_context_t; - - -#endif // --------------------------------------------------------------------------------------------------------- - - -int speck_ctr (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, - speck_context_t *ctx); - -int speck_init (speck_context_t **ctx, const unsigned char *k, int keysize); - -int speck_deinit (speck_context_t *ctx); - - -// ---------------------------------------------------------------------------------------------------------------- -// ---------------------------------------------------------------------------------------------------------------- - - -// cipher SPECK -- 128 bit block size -- 128 bit key size -- ECB mode -// follows endianess rules as used in official implementation guide and NOT as in original 2013 cipher presentation -// used for IV in header encryption (one block) and challenge encryption (user/password) -// for now: just plain C -- probably no need for AVX, SSE, NEON - - -int speck_128_decrypt (unsigned char *inout, speck_context_t *ctx); - -int speck_128_encrypt (unsigned char *inout, speck_context_t *ctx); - - -#endif // SPECK_H diff --git a/bundles/n2n_ntop_v3/include/tf.h b/bundles/n2n_ntop_v3/include/tf.h deleted file mode 100644 index e9353bb0..00000000 --- a/bundles/n2n_ntop_v3/include/tf.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -// taken (and modified) from github/fudanchii/twofish as of August 2020 -// which itself is a modified copy of Andrew T. Csillag's implementation -// published on github/drewcsillag/twofish - - -/** - * The MIT License (MIT) - * - * Copyright (c) 2015 Andrew T. Csillag - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - -#ifndef TF_H -#define TF_H - - -#include -#include -#include - -#include "portable_endian.h" - - -#define TF_BLOCK_SIZE 16 -#define TF_IV_SIZE (TF_BLOCK_SIZE) - - -typedef struct tf_context_t { - int N; - uint32_t K[40]; - uint32_t QF[4][256]; -} tf_context_t; - - -int tf_ecb_decrypt (unsigned char *out, const unsigned char *in, tf_context_t *ctx); - -int tf_ecb_encrypt (unsigned char *out, const unsigned char *in, tf_context_t *ctx); - -int tf_cbc_encrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, tf_context_t *ctx); - -int tf_cbc_decrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, tf_context_t *ctx); - -int tf_init (const unsigned char *key, size_t key_size, tf_context_t **ctx); - -int tf_deinit (tf_context_t *ctx); - - -#endif // TF_H diff --git a/bundles/n2n_ntop_v3/include/uthash.h b/bundles/n2n_ntop_v3/include/uthash.h deleted file mode 100644 index a790ea59..00000000 --- a/bundles/n2n_ntop_v3/include/uthash.h +++ /dev/null @@ -1,1230 +0,0 @@ -/* -Copyright (c) 2003-2018, Troy D. Hanson http://troydhanson.github.com/uthash/ -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER -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. -*/ - -#ifndef UTHASH_H -#define UTHASH_H - -#define UTHASH_VERSION 2.1.0 - -#include /* memcmp, memset, strlen */ -#include /* ptrdiff_t */ -#include /* exit */ - -/* These macros use decltype or the earlier __typeof GNU extension. - As decltype is only available in newer compilers (VS2010 or gcc 4.3+ - when compiling c++ source) this code uses whatever method is needed - or, for VS2008 where neither is available, uses casting workarounds. */ -#if !defined(DECLTYPE) && !defined(NO_DECLTYPE) -#if defined(_MSC_VER) /* MS compiler */ -#if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ -#define DECLTYPE(x) (decltype(x)) -#else /* VS2008 or older (or VS2010 in C mode) */ -#define NO_DECLTYPE -#endif -#elif defined(__BORLANDC__) || defined(__ICCARM__) || defined(__LCC__) || defined(__WATCOMC__) -#define NO_DECLTYPE -#else /* GNU, Sun and other compilers */ -#define DECLTYPE(x) (__typeof(x)) -#endif -#endif - -#ifdef NO_DECLTYPE -#define DECLTYPE(x) -#define DECLTYPE_ASSIGN(dst,src) \ -do { \ - char **_da_dst = (char**)(&(dst)); \ - *_da_dst = (char*)(src); \ -} while (0) -#else -#define DECLTYPE_ASSIGN(dst,src) \ -do { \ - (dst) = DECLTYPE(dst)(src); \ -} while (0) -#endif - -/* a number of the hash function use uint32_t which isn't defined on Pre VS2010 */ -#if defined(_WIN32) -#if defined(_MSC_VER) && _MSC_VER >= 1600 -#include -#elif defined(__WATCOMC__) || defined(__MINGW32__) || defined(__CYGWIN__) -#include -#else -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -#endif -#elif defined(__GNUC__) && !defined(__VXWORKS__) -#include -#else -typedef unsigned int uint32_t; -typedef unsigned char uint8_t; -#endif - -#ifndef uthash_malloc -#define uthash_malloc(sz) malloc(sz) /* malloc fcn */ -#endif -#ifndef uthash_free -#define uthash_free(ptr,sz) free(ptr) /* free fcn */ -#endif -#ifndef uthash_bzero -#define uthash_bzero(a,n) memset(a,'\0',n) -#endif -#ifndef uthash_strlen -#define uthash_strlen(s) strlen(s) -#endif - -#ifdef uthash_memcmp -/* This warning will not catch programs that define uthash_memcmp AFTER including uthash.h. */ -#warning "uthash_memcmp is deprecated; please use HASH_KEYCMP instead" -#else -#define uthash_memcmp(a,b,n) memcmp(a,b,n) -#endif - -#ifndef HASH_KEYCMP -#define HASH_KEYCMP(a,b,n) uthash_memcmp(a,b,n) -#endif - -#ifndef uthash_noexpand_fyi -#define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */ -#endif -#ifndef uthash_expand_fyi -#define uthash_expand_fyi(tbl) /* can be defined to log expands */ -#endif - -#ifndef HASH_NONFATAL_OOM -#define HASH_NONFATAL_OOM 0 -#endif - -#if HASH_NONFATAL_OOM -/* malloc failures can be recovered from */ - -#ifndef uthash_nonfatal_oom -#define uthash_nonfatal_oom(obj) do {} while (0) /* non-fatal OOM error */ -#endif - -#define HASH_RECORD_OOM(oomed) do { (oomed) = 1; } while (0) -#define IF_HASH_NONFATAL_OOM(x) x - -#else -/* malloc failures result in lost memory, hash tables are unusable */ - -#ifndef uthash_fatal -#define uthash_fatal(msg) exit(-1) /* fatal OOM error */ -#endif - -#define HASH_RECORD_OOM(oomed) uthash_fatal("out of memory") -#define IF_HASH_NONFATAL_OOM(x) - -#endif - -/* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */ -#define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */ -#define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */ - -/* calculate the element whose hash handle address is hhp */ -#define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho))) -/* calculate the hash handle from element address elp */ -#define HH_FROM_ELMT(tbl,elp) ((UT_hash_handle *)(((char*)(elp)) + ((tbl)->hho))) - -#define HASH_ROLLBACK_BKT(hh, head, itemptrhh) \ -do { \ - struct UT_hash_handle *_hd_hh_item = (itemptrhh); \ - unsigned _hd_bkt; \ - HASH_TO_BKT(_hd_hh_item->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ - (head)->hh.tbl->buckets[_hd_bkt].count++; \ - _hd_hh_item->hh_next = NULL; \ - _hd_hh_item->hh_prev = NULL; \ -} while (0) - -#define HASH_VALUE(keyptr,keylen,hashv) \ -do { \ - HASH_FCN(keyptr, keylen, hashv); \ -} while (0) - -#define HASH_FIND_BYHASHVALUE(hh,head,keyptr,keylen,hashval,out) \ -do { \ - (out) = NULL; \ - if (head) { \ - unsigned _hf_bkt; \ - HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _hf_bkt); \ - if (HASH_BLOOM_TEST((head)->hh.tbl, hashval) != 0) { \ - HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], keyptr, keylen, hashval, out); \ - } \ - } \ -} while (0) - -#define HASH_FIND(hh,head,keyptr,keylen,out) \ -do { \ - (out) = NULL; \ - if (head) { \ - unsigned _hf_hashv; \ - HASH_VALUE(keyptr, keylen, _hf_hashv); \ - HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, _hf_hashv, out); \ - } \ -} while (0) - -#ifdef HASH_BLOOM -#define HASH_BLOOM_BITLEN (1UL << HASH_BLOOM) -#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8UL) + (((HASH_BLOOM_BITLEN%8UL)!=0UL) ? 1UL : 0UL) -#define HASH_BLOOM_MAKE(tbl,oomed) \ -do { \ - (tbl)->bloom_nbits = HASH_BLOOM; \ - (tbl)->bloom_bv = (uint8_t*)uthash_malloc(HASH_BLOOM_BYTELEN); \ - if (!(tbl)->bloom_bv) { \ - HASH_RECORD_OOM(oomed); \ - } else { \ - uthash_bzero((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ - (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ - } \ -} while (0) - -#define HASH_BLOOM_FREE(tbl) \ -do { \ - uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ -} while (0) - -#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8U] |= (1U << ((idx)%8U))) -#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8U] & (1U << ((idx)%8U))) - -#define HASH_BLOOM_ADD(tbl,hashv) \ - HASH_BLOOM_BITSET((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U))) - -#define HASH_BLOOM_TEST(tbl,hashv) \ - HASH_BLOOM_BITTEST((tbl)->bloom_bv, ((hashv) & (uint32_t)((1UL << (tbl)->bloom_nbits) - 1U))) - -#else -#define HASH_BLOOM_MAKE(tbl,oomed) -#define HASH_BLOOM_FREE(tbl) -#define HASH_BLOOM_ADD(tbl,hashv) -#define HASH_BLOOM_TEST(tbl,hashv) (1) -#define HASH_BLOOM_BYTELEN 0U -#endif - -#define HASH_MAKE_TABLE(hh,head,oomed) \ -do { \ - (head)->hh.tbl = (UT_hash_table*)uthash_malloc(sizeof(UT_hash_table)); \ - if (!(head)->hh.tbl) { \ - HASH_RECORD_OOM(oomed); \ - } else { \ - uthash_bzero((head)->hh.tbl, sizeof(UT_hash_table)); \ - (head)->hh.tbl->tail = &((head)->hh); \ - (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ - (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ - (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \ - (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \ - HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ - (head)->hh.tbl->signature = HASH_SIGNATURE; \ - if (!(head)->hh.tbl->buckets) { \ - HASH_RECORD_OOM(oomed); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - } else { \ - uthash_bzero((head)->hh.tbl->buckets, \ - HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \ - HASH_BLOOM_MAKE((head)->hh.tbl, oomed); \ - IF_HASH_NONFATAL_OOM( \ - if (oomed) { \ - uthash_free((head)->hh.tbl->buckets, \ - HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - } \ - ) \ - } \ - } \ -} while (0) - -#define HASH_REPLACE_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,replaced,cmpfcn) \ -do { \ - (replaced) = NULL; \ - HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ - if (replaced) { \ - HASH_DELETE(hh, head, replaced); \ - } \ - HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn); \ -} while (0) - -#define HASH_REPLACE_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add,replaced) \ -do { \ - (replaced) = NULL; \ - HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \ - if (replaced) { \ - HASH_DELETE(hh, head, replaced); \ - } \ - HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add); \ -} while (0) - -#define HASH_REPLACE(hh,head,fieldname,keylen_in,add,replaced) \ -do { \ - unsigned _hr_hashv; \ - HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ - HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced); \ -} while (0) - -#define HASH_REPLACE_INORDER(hh,head,fieldname,keylen_in,add,replaced,cmpfcn) \ -do { \ - unsigned _hr_hashv; \ - HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \ - HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced, cmpfcn); \ -} while (0) - -#define HASH_APPEND_LIST(hh, head, add) \ -do { \ - (add)->hh.next = NULL; \ - (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ - (head)->hh.tbl->tail->next = (add); \ - (head)->hh.tbl->tail = &((add)->hh); \ -} while (0) - -#define HASH_AKBI_INNER_LOOP(hh,head,add,cmpfcn) \ -do { \ - do { \ - if (cmpfcn(DECLTYPE(head)(_hs_iter), add) > 0) { \ - break; \ - } \ - } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \ -} while (0) - -#ifdef NO_DECLTYPE -#undef HASH_AKBI_INNER_LOOP -#define HASH_AKBI_INNER_LOOP(hh,head,add,cmpfcn) \ -do { \ - char *_hs_saved_head = (char*)(head); \ - do { \ - DECLTYPE_ASSIGN(head, _hs_iter); \ - if (cmpfcn(head, add) > 0) { \ - DECLTYPE_ASSIGN(head, _hs_saved_head); \ - break; \ - } \ - DECLTYPE_ASSIGN(head, _hs_saved_head); \ - } while ((_hs_iter = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->next)); \ -} while (0) -#endif - -#if HASH_NONFATAL_OOM - -#define HASH_ADD_TO_TABLE(hh,head,keyptr,keylen_in,hashval,add,oomed) \ -do { \ - if (!(oomed)) { \ - unsigned _ha_bkt; \ - (head)->hh.tbl->num_items++; \ - HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ - HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \ - if (oomed) { \ - HASH_ROLLBACK_BKT(hh, head, &(add)->hh); \ - HASH_DELETE_HH(hh, head, &(add)->hh); \ - (add)->hh.tbl = NULL; \ - uthash_nonfatal_oom(add); \ - } else { \ - HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ - HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ - } \ - } else { \ - (add)->hh.tbl = NULL; \ - uthash_nonfatal_oom(add); \ - } \ -} while (0) - -#else - -#define HASH_ADD_TO_TABLE(hh,head,keyptr,keylen_in,hashval,add,oomed) \ -do { \ - unsigned _ha_bkt; \ - (head)->hh.tbl->num_items++; \ - HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \ - HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], hh, &(add)->hh, oomed); \ - HASH_BLOOM_ADD((head)->hh.tbl, hashval); \ - HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \ -} while (0) - -#endif - - -#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh,head,keyptr,keylen_in,hashval,add,cmpfcn) \ -do { \ - IF_HASH_NONFATAL_OOM( int _ha_oomed = 0; ) \ - (add)->hh.hashv = (hashval); \ - (add)->hh.key = (char*) (keyptr); \ - (add)->hh.keylen = (unsigned) (keylen_in); \ - if (!(head)) { \ - (add)->hh.next = NULL; \ - (add)->hh.prev = NULL; \ - HASH_MAKE_TABLE(hh, add, _ha_oomed); \ - IF_HASH_NONFATAL_OOM( if (!_ha_oomed) { ) \ - (head) = (add); \ - IF_HASH_NONFATAL_OOM( } ) \ - } else { \ - void *_hs_iter = (head); \ - (add)->hh.tbl = (head)->hh.tbl; \ - HASH_AKBI_INNER_LOOP(hh, head, add, cmpfcn); \ - if (_hs_iter) { \ - (add)->hh.next = _hs_iter; \ - if (((add)->hh.prev = HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev)) { \ - HH_FROM_ELMT((head)->hh.tbl, (add)->hh.prev)->next = (add); \ - } else { \ - (head) = (add); \ - } \ - HH_FROM_ELMT((head)->hh.tbl, _hs_iter)->prev = (add); \ - } else { \ - HASH_APPEND_LIST(hh, head, add); \ - } \ - } \ - HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \ - HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE_INORDER"); \ -} while (0) - -#define HASH_ADD_KEYPTR_INORDER(hh,head,keyptr,keylen_in,add,cmpfcn) \ -do { \ - unsigned _hs_hashv; \ - HASH_VALUE(keyptr, keylen_in, _hs_hashv); \ - HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, _hs_hashv, add, cmpfcn); \ -} while (0) - -#define HASH_ADD_BYHASHVALUE_INORDER(hh,head,fieldname,keylen_in,hashval,add,cmpfcn) \ - HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn) - -#define HASH_ADD_INORDER(hh,head,fieldname,keylen_in,add,cmpfcn) \ - HASH_ADD_KEYPTR_INORDER(hh, head, &((add)->fieldname), keylen_in, add, cmpfcn) - -#define HASH_ADD_KEYPTR_BYHASHVALUE(hh,head,keyptr,keylen_in,hashval,add) \ -do { \ - IF_HASH_NONFATAL_OOM( int _ha_oomed = 0; ) \ - (add)->hh.hashv = (hashval); \ - (add)->hh.key = (char*) (keyptr); \ - (add)->hh.keylen = (unsigned) (keylen_in); \ - if (!(head)) { \ - (add)->hh.next = NULL; \ - (add)->hh.prev = NULL; \ - HASH_MAKE_TABLE(hh, add, _ha_oomed); \ - IF_HASH_NONFATAL_OOM( if (!_ha_oomed) { ) \ - (head) = (add); \ - IF_HASH_NONFATAL_OOM( } ) \ - } else { \ - (add)->hh.tbl = (head)->hh.tbl; \ - HASH_APPEND_LIST(hh, head, add); \ - } \ - HASH_ADD_TO_TABLE(hh, head, keyptr, keylen_in, hashval, add, _ha_oomed); \ - HASH_FSCK(hh, head, "HASH_ADD_KEYPTR_BYHASHVALUE"); \ -} while (0) - -#define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \ -do { \ - unsigned _ha_hashv; \ - HASH_VALUE(keyptr, keylen_in, _ha_hashv); \ - HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, _ha_hashv, add); \ -} while (0) - -#define HASH_ADD_BYHASHVALUE(hh,head,fieldname,keylen_in,hashval,add) \ - HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add) - -#define HASH_ADD(hh,head,fieldname,keylen_in,add) \ - HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add) - -#define HASH_TO_BKT(hashv,num_bkts,bkt) \ -do { \ - bkt = ((hashv) & ((num_bkts) - 1U)); \ -} while (0) - -/* delete "delptr" from the hash table. - * "the usual" patch-up process for the app-order doubly-linked-list. - * The use of _hd_hh_del below deserves special explanation. - * These used to be expressed using (delptr) but that led to a bug - * if someone used the same symbol for the head and deletee, like - * HASH_DELETE(hh,users,users); - * We want that to work, but by changing the head (users) below - * we were forfeiting our ability to further refer to the deletee (users) - * in the patch-up process. Solution: use scratch space to - * copy the deletee pointer, then the latter references are via that - * scratch pointer rather than through the repointed (users) symbol. - */ -#define HASH_DELETE(hh,head,delptr) \ - HASH_DELETE_HH(hh, head, &(delptr)->hh) - -#define HASH_DELETE_HH(hh,head,delptrhh) \ -do { \ - struct UT_hash_handle *_hd_hh_del = (delptrhh); \ - if ((_hd_hh_del->prev == NULL) && (_hd_hh_del->next == NULL)) { \ - HASH_BLOOM_FREE((head)->hh.tbl); \ - uthash_free((head)->hh.tbl->buckets, \ - (head)->hh.tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - (head) = NULL; \ - } else { \ - unsigned _hd_bkt; \ - if (_hd_hh_del == (head)->hh.tbl->tail) { \ - (head)->hh.tbl->tail = HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev); \ - } \ - if (_hd_hh_del->prev != NULL) { \ - HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->prev)->next = _hd_hh_del->next; \ - } else { \ - DECLTYPE_ASSIGN(head, _hd_hh_del->next); \ - } \ - if (_hd_hh_del->next != NULL) { \ - HH_FROM_ELMT((head)->hh.tbl, _hd_hh_del->next)->prev = _hd_hh_del->prev; \ - } \ - HASH_TO_BKT(_hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ - HASH_DEL_IN_BKT((head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ - (head)->hh.tbl->num_items--; \ - } \ - HASH_FSCK(hh, head, "HASH_DELETE_HH"); \ -} while (0) - -/* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */ -#define HASH_FIND_STR(head,findstr,out) \ -do { \ - unsigned _uthash_hfstr_keylen = (unsigned)uthash_strlen(findstr); \ - HASH_FIND(hh, head, findstr, _uthash_hfstr_keylen, out); \ -} while (0) -#define HASH_ADD_STR(head,strfield,add) \ -do { \ - unsigned _uthash_hastr_keylen = (unsigned)uthash_strlen((add)->strfield); \ - HASH_ADD(hh, head, strfield[0], _uthash_hastr_keylen, add); \ -} while (0) -#define HASH_REPLACE_STR(head,strfield,add,replaced) \ -do { \ - unsigned _uthash_hrstr_keylen = (unsigned)uthash_strlen((add)->strfield); \ - HASH_REPLACE(hh, head, strfield[0], _uthash_hrstr_keylen, add, replaced); \ -} while (0) -#define HASH_FIND_INT(head,findint,out) \ - HASH_FIND(hh,head,findint,sizeof(int),out) -#define HASH_ADD_INT(head,intfield,add) \ - HASH_ADD(hh,head,intfield,sizeof(int),add) -#define HASH_REPLACE_INT(head,intfield,add,replaced) \ - HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced) -#define HASH_FIND_PTR(head,findptr,out) \ - HASH_FIND(hh,head,findptr,sizeof(void *),out) -#define HASH_ADD_PTR(head,ptrfield,add) \ - HASH_ADD(hh,head,ptrfield,sizeof(void *),add) -#define HASH_REPLACE_PTR(head,ptrfield,add,replaced) \ - HASH_REPLACE(hh,head,ptrfield,sizeof(void *),add,replaced) -#define HASH_DEL(head,delptr) \ - HASH_DELETE(hh,head,delptr) - -/* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined. - * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined. - */ -#ifdef HASH_DEBUG -#define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0) -#define HASH_FSCK(hh,head,where) \ -do { \ - struct UT_hash_handle *_thh; \ - if (head) { \ - unsigned _bkt_i; \ - unsigned _count = 0; \ - char *_prev; \ - for (_bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; ++_bkt_i) { \ - unsigned _bkt_count = 0; \ - _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ - _prev = NULL; \ - while (_thh) { \ - if (_prev != (char*)(_thh->hh_prev)) { \ - HASH_OOPS("%s: invalid hh_prev %p, actual %p\n", \ - (where), (void*)_thh->hh_prev, (void*)_prev); \ - } \ - _bkt_count++; \ - _prev = (char*)(_thh); \ - _thh = _thh->hh_next; \ - } \ - _count += _bkt_count; \ - if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ - HASH_OOPS("%s: invalid bucket count %u, actual %u\n", \ - (where), (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ - } \ - } \ - if (_count != (head)->hh.tbl->num_items) { \ - HASH_OOPS("%s: invalid hh item count %u, actual %u\n", \ - (where), (head)->hh.tbl->num_items, _count); \ - } \ - _count = 0; \ - _prev = NULL; \ - _thh = &(head)->hh; \ - while (_thh) { \ - _count++; \ - if (_prev != (char*)_thh->prev) { \ - HASH_OOPS("%s: invalid prev %p, actual %p\n", \ - (where), (void*)_thh->prev, (void*)_prev); \ - } \ - _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \ - _thh = (_thh->next ? HH_FROM_ELMT((head)->hh.tbl, _thh->next) : NULL); \ - } \ - if (_count != (head)->hh.tbl->num_items) { \ - HASH_OOPS("%s: invalid app item count %u, actual %u\n", \ - (where), (head)->hh.tbl->num_items, _count); \ - } \ - } \ -} while (0) -#else -#define HASH_FSCK(hh,head,where) -#endif - -/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to - * the descriptor to which this macro is defined for tuning the hash function. - * The app can #include to get the prototype for write(2). */ -#ifdef HASH_EMIT_KEYS -#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ -do { \ - unsigned _klen = fieldlen; \ - write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ - write(HASH_EMIT_KEYS, keyptr, (unsigned long)fieldlen); \ -} while (0) -#else -#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) -#endif - -/* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */ -#ifdef HASH_FUNCTION -#define HASH_FCN HASH_FUNCTION -#else -#define HASH_FCN HASH_JEN -#endif - -/* The Bernstein hash function, used in Perl prior to v5.6. Note (x<<5+x)=x*33. */ -#define HASH_BER(key,keylen,hashv) \ -do { \ - unsigned _hb_keylen = (unsigned)keylen; \ - const unsigned char *_hb_key = (const unsigned char*)(key); \ - (hashv) = 0; \ - while (_hb_keylen-- != 0U) { \ - (hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \ - } \ -} while (0) - - -/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at - * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ -#define HASH_SAX(key,keylen,hashv) \ -do { \ - unsigned _sx_i; \ - const unsigned char *_hs_key = (const unsigned char*)(key); \ - hashv = 0; \ - for (_sx_i=0; _sx_i < keylen; _sx_i++) { \ - hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ - } \ -} while (0) -/* FNV-1a variation */ -#define HASH_FNV(key,keylen,hashv) \ -do { \ - unsigned _fn_i; \ - const unsigned char *_hf_key = (const unsigned char*)(key); \ - (hashv) = 2166136261U; \ - for (_fn_i=0; _fn_i < keylen; _fn_i++) { \ - hashv = hashv ^ _hf_key[_fn_i]; \ - hashv = hashv * 16777619U; \ - } \ -} while (0) - -#define HASH_OAT(key,keylen,hashv) \ -do { \ - unsigned _ho_i; \ - const unsigned char *_ho_key=(const unsigned char*)(key); \ - hashv = 0; \ - for(_ho_i=0; _ho_i < keylen; _ho_i++) { \ - hashv += _ho_key[_ho_i]; \ - hashv += (hashv << 10); \ - hashv ^= (hashv >> 6); \ - } \ - hashv += (hashv << 3); \ - hashv ^= (hashv >> 11); \ - hashv += (hashv << 15); \ -} while (0) - -#define HASH_JEN_MIX(a,b,c) \ -do { \ - a -= b; a -= c; a ^= ( c >> 13 ); \ - b -= c; b -= a; b ^= ( a << 8 ); \ - c -= a; c -= b; c ^= ( b >> 13 ); \ - a -= b; a -= c; a ^= ( c >> 12 ); \ - b -= c; b -= a; b ^= ( a << 16 ); \ - c -= a; c -= b; c ^= ( b >> 5 ); \ - a -= b; a -= c; a ^= ( c >> 3 ); \ - b -= c; b -= a; b ^= ( a << 10 ); \ - c -= a; c -= b; c ^= ( b >> 15 ); \ -} while (0) - -#define HASH_JEN(key,keylen,hashv) \ -do { \ - unsigned _hj_i,_hj_j,_hj_k; \ - unsigned const char *_hj_key=(unsigned const char*)(key); \ - hashv = 0xfeedbeefu; \ - _hj_i = _hj_j = 0x9e3779b9u; \ - _hj_k = (unsigned)(keylen); \ - while (_hj_k >= 12U) { \ - _hj_i += (_hj_key[0] + ( (unsigned)_hj_key[1] << 8 ) \ - + ( (unsigned)_hj_key[2] << 16 ) \ - + ( (unsigned)_hj_key[3] << 24 ) ); \ - _hj_j += (_hj_key[4] + ( (unsigned)_hj_key[5] << 8 ) \ - + ( (unsigned)_hj_key[6] << 16 ) \ - + ( (unsigned)_hj_key[7] << 24 ) ); \ - hashv += (_hj_key[8] + ( (unsigned)_hj_key[9] << 8 ) \ - + ( (unsigned)_hj_key[10] << 16 ) \ - + ( (unsigned)_hj_key[11] << 24 ) ); \ - \ - HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ - \ - _hj_key += 12; \ - _hj_k -= 12U; \ - } \ - hashv += (unsigned)(keylen); \ - switch ( _hj_k ) { \ - case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); /* FALLTHROUGH */ \ - case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); /* FALLTHROUGH */ \ - case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); /* FALLTHROUGH */ \ - case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); /* FALLTHROUGH */ \ - case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); /* FALLTHROUGH */ \ - case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); /* FALLTHROUGH */ \ - case 5: _hj_j += _hj_key[4]; /* FALLTHROUGH */ \ - case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); /* FALLTHROUGH */ \ - case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); /* FALLTHROUGH */ \ - case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); /* FALLTHROUGH */ \ - case 1: _hj_i += _hj_key[0]; \ - } \ - HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ -} while (0) - -/* The Paul Hsieh hash function */ -#undef get16bits -#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \ - || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) -#define get16bits(d) (*((const uint16_t *) (d))) -#endif - -#if !defined (get16bits) -#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \ - +(uint32_t)(((const uint8_t *)(d))[0]) ) -#endif -#define HASH_SFH(key,keylen,hashv) \ -do { \ - unsigned const char *_sfh_key=(unsigned const char*)(key); \ - uint32_t _sfh_tmp, _sfh_len = (uint32_t)keylen; \ - \ - unsigned _sfh_rem = _sfh_len & 3U; \ - _sfh_len >>= 2; \ - hashv = 0xcafebabeu; \ - \ - /* Main loop */ \ - for (;_sfh_len > 0U; _sfh_len--) { \ - hashv += get16bits (_sfh_key); \ - _sfh_tmp = ((uint32_t)(get16bits (_sfh_key+2)) << 11) ^ hashv; \ - hashv = (hashv << 16) ^ _sfh_tmp; \ - _sfh_key += 2U*sizeof (uint16_t); \ - hashv += hashv >> 11; \ - } \ - \ - /* Handle end cases */ \ - switch (_sfh_rem) { \ - case 3: hashv += get16bits (_sfh_key); \ - hashv ^= hashv << 16; \ - hashv ^= (uint32_t)(_sfh_key[sizeof (uint16_t)]) << 18; \ - hashv += hashv >> 11; \ - break; \ - case 2: hashv += get16bits (_sfh_key); \ - hashv ^= hashv << 11; \ - hashv += hashv >> 17; \ - break; \ - case 1: hashv += *_sfh_key; \ - hashv ^= hashv << 10; \ - hashv += hashv >> 1; \ - } \ - \ - /* Force "avalanching" of final 127 bits */ \ - hashv ^= hashv << 3; \ - hashv += hashv >> 5; \ - hashv ^= hashv << 4; \ - hashv += hashv >> 17; \ - hashv ^= hashv << 25; \ - hashv += hashv >> 6; \ -} while (0) - -#ifdef HASH_USING_NO_STRICT_ALIASING -/* The MurmurHash exploits some CPU's (x86,x86_64) tolerance for unaligned reads. - * For other types of CPU's (e.g. Sparc) an unaligned read causes a bus error. - * MurmurHash uses the faster approach only on CPU's where we know it's safe. - * - * Note the preprocessor built-in defines can be emitted using: - * - * gcc -m64 -dM -E - < /dev/null (on gcc) - * cc -## a.c (where a.c is a simple test file) (Sun Studio) - */ -#if (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86)) -#define MUR_GETBLOCK(p,i) p[i] -#else /* non intel */ -#define MUR_PLUS0_ALIGNED(p) (((unsigned long)p & 3UL) == 0UL) -#define MUR_PLUS1_ALIGNED(p) (((unsigned long)p & 3UL) == 1UL) -#define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 3UL) == 2UL) -#define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 3UL) == 3UL) -#define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL)) -#if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__)) -#define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24)) -#define MUR_TWO_TWO(p) ((((*WP(p))&0x0000ffff) <<16) | (((*(WP(p)+1))&0xffff0000) >> 16)) -#define MUR_ONE_THREE(p) ((((*WP(p))&0x000000ff) <<24) | (((*(WP(p)+1))&0xffffff00) >> 8)) -#else /* assume little endian non-intel */ -#define MUR_THREE_ONE(p) ((((*WP(p))&0xffffff00) >> 8) | (((*(WP(p)+1))&0x000000ff) << 24)) -#define MUR_TWO_TWO(p) ((((*WP(p))&0xffff0000) >>16) | (((*(WP(p)+1))&0x0000ffff) << 16)) -#define MUR_ONE_THREE(p) ((((*WP(p))&0xff000000) >>24) | (((*(WP(p)+1))&0x00ffffff) << 8)) -#endif -#define MUR_GETBLOCK(p,i) (MUR_PLUS0_ALIGNED(p) ? ((p)[i]) : \ - (MUR_PLUS1_ALIGNED(p) ? MUR_THREE_ONE(p) : \ - (MUR_PLUS2_ALIGNED(p) ? MUR_TWO_TWO(p) : \ - MUR_ONE_THREE(p)))) -#endif -#define MUR_ROTL32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) -#define MUR_FMIX(_h) \ -do { \ - _h ^= _h >> 16; \ - _h *= 0x85ebca6bu; \ - _h ^= _h >> 13; \ - _h *= 0xc2b2ae35u; \ - _h ^= _h >> 16; \ -} while (0) - -#define HASH_MUR(key,keylen,hashv) \ -do { \ - const uint8_t *_mur_data = (const uint8_t*)(key); \ - const int _mur_nblocks = (int)(keylen) / 4; \ - uint32_t _mur_h1 = 0xf88D5353u; \ - uint32_t _mur_c1 = 0xcc9e2d51u; \ - uint32_t _mur_c2 = 0x1b873593u; \ - uint32_t _mur_k1 = 0; \ - const uint8_t *_mur_tail; \ - const uint32_t *_mur_blocks = (const uint32_t*)(_mur_data+(_mur_nblocks*4)); \ - int _mur_i; \ - for (_mur_i = -_mur_nblocks; _mur_i != 0; _mur_i++) { \ - _mur_k1 = MUR_GETBLOCK(_mur_blocks,_mur_i); \ - _mur_k1 *= _mur_c1; \ - _mur_k1 = MUR_ROTL32(_mur_k1,15); \ - _mur_k1 *= _mur_c2; \ - \ - _mur_h1 ^= _mur_k1; \ - _mur_h1 = MUR_ROTL32(_mur_h1,13); \ - _mur_h1 = (_mur_h1*5U) + 0xe6546b64u; \ - } \ - _mur_tail = (const uint8_t*)(_mur_data + (_mur_nblocks*4)); \ - _mur_k1=0; \ - switch ((keylen) & 3U) { \ - case 0: break; \ - case 3: _mur_k1 ^= (uint32_t)_mur_tail[2] << 16; /* FALLTHROUGH */ \ - case 2: _mur_k1 ^= (uint32_t)_mur_tail[1] << 8; /* FALLTHROUGH */ \ - case 1: _mur_k1 ^= (uint32_t)_mur_tail[0]; \ - _mur_k1 *= _mur_c1; \ - _mur_k1 = MUR_ROTL32(_mur_k1,15); \ - _mur_k1 *= _mur_c2; \ - _mur_h1 ^= _mur_k1; \ - } \ - _mur_h1 ^= (uint32_t)(keylen); \ - MUR_FMIX(_mur_h1); \ - hashv = _mur_h1; \ -} while (0) -#endif /* HASH_USING_NO_STRICT_ALIASING */ - -/* iterate over items in a known bucket to find desired item */ -#define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,hashval,out) \ -do { \ - if ((head).hh_head != NULL) { \ - DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (head).hh_head)); \ - } else { \ - (out) = NULL; \ - } \ - while ((out) != NULL) { \ - if ((out)->hh.hashv == (hashval) && (out)->hh.keylen == (keylen_in)) { \ - if (HASH_KEYCMP((out)->hh.key, keyptr, keylen_in) == 0) { \ - break; \ - } \ - } \ - if ((out)->hh.hh_next != NULL) { \ - DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (out)->hh.hh_next)); \ - } else { \ - (out) = NULL; \ - } \ - } \ -} while (0) - -/* add an item to a bucket */ -#define HASH_ADD_TO_BKT(head,hh,addhh,oomed) \ -do { \ - UT_hash_bucket *_ha_head = &(head); \ - _ha_head->count++; \ - (addhh)->hh_next = _ha_head->hh_head; \ - (addhh)->hh_prev = NULL; \ - if (_ha_head->hh_head != NULL) { \ - _ha_head->hh_head->hh_prev = (addhh); \ - } \ - _ha_head->hh_head = (addhh); \ - if ((_ha_head->count >= ((_ha_head->expand_mult + 1U) * HASH_BKT_CAPACITY_THRESH)) \ - && !(addhh)->tbl->noexpand) { \ - HASH_EXPAND_BUCKETS(addhh,(addhh)->tbl, oomed); \ - IF_HASH_NONFATAL_OOM( \ - if (oomed) { \ - HASH_DEL_IN_BKT(head,addhh); \ - } \ - ) \ - } \ -} while (0) - -/* remove an item from a given bucket */ -#define HASH_DEL_IN_BKT(head,delhh) \ -do { \ - UT_hash_bucket *_hd_head = &(head); \ - _hd_head->count--; \ - if (_hd_head->hh_head == (delhh)) { \ - _hd_head->hh_head = (delhh)->hh_next; \ - } \ - if ((delhh)->hh_prev) { \ - (delhh)->hh_prev->hh_next = (delhh)->hh_next; \ - } \ - if ((delhh)->hh_next) { \ - (delhh)->hh_next->hh_prev = (delhh)->hh_prev; \ - } \ -} while (0) - -/* Bucket expansion has the effect of doubling the number of buckets - * and redistributing the items into the new buckets. Ideally the - * items will distribute more or less evenly into the new buckets - * (the extent to which this is true is a measure of the quality of - * the hash function as it applies to the key domain). - * - * With the items distributed into more buckets, the chain length - * (item count) in each bucket is reduced. Thus by expanding buckets - * the hash keeps a bound on the chain length. This bounded chain - * length is the essence of how a hash provides constant time lookup. - * - * The calculation of tbl->ideal_chain_maxlen below deserves some - * explanation. First, keep in mind that we're calculating the ideal - * maximum chain length based on the *new* (doubled) bucket count. - * In fractions this is just n/b (n=number of items,b=new num buckets). - * Since the ideal chain length is an integer, we want to calculate - * ceil(n/b). We don't depend on floating point arithmetic in this - * hash, so to calculate ceil(n/b) with integers we could write - * - * ceil(n/b) = (n/b) + ((n%b)?1:0) - * - * and in fact a previous version of this hash did just that. - * But now we have improved things a bit by recognizing that b is - * always a power of two. We keep its base 2 log handy (call it lb), - * so now we can write this with a bit shift and logical AND: - * - * ceil(n/b) = (n>>lb) + ( (n & (b-1)) ? 1:0) - * - */ -#define HASH_EXPAND_BUCKETS(hh,tbl,oomed) \ -do { \ - unsigned _he_bkt; \ - unsigned _he_bkt_i; \ - struct UT_hash_handle *_he_thh, *_he_hh_nxt; \ - UT_hash_bucket *_he_new_buckets, *_he_newbkt; \ - _he_new_buckets = (UT_hash_bucket*)uthash_malloc( \ - 2UL * (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \ - if (!_he_new_buckets) { \ - HASH_RECORD_OOM(oomed); \ - } else { \ - uthash_bzero(_he_new_buckets, \ - 2UL * (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \ - (tbl)->ideal_chain_maxlen = \ - ((tbl)->num_items >> ((tbl)->log2_num_buckets+1U)) + \ - ((((tbl)->num_items & (((tbl)->num_buckets*2U)-1U)) != 0U) ? 1U : 0U); \ - (tbl)->nonideal_items = 0; \ - for (_he_bkt_i = 0; _he_bkt_i < (tbl)->num_buckets; _he_bkt_i++) { \ - _he_thh = (tbl)->buckets[ _he_bkt_i ].hh_head; \ - while (_he_thh != NULL) { \ - _he_hh_nxt = _he_thh->hh_next; \ - HASH_TO_BKT(_he_thh->hashv, (tbl)->num_buckets * 2U, _he_bkt); \ - _he_newbkt = &(_he_new_buckets[_he_bkt]); \ - if (++(_he_newbkt->count) > (tbl)->ideal_chain_maxlen) { \ - (tbl)->nonideal_items++; \ - if (_he_newbkt->count > _he_newbkt->expand_mult * (tbl)->ideal_chain_maxlen) { \ - _he_newbkt->expand_mult++; \ - } \ - } \ - _he_thh->hh_prev = NULL; \ - _he_thh->hh_next = _he_newbkt->hh_head; \ - if (_he_newbkt->hh_head != NULL) { \ - _he_newbkt->hh_head->hh_prev = _he_thh; \ - } \ - _he_newbkt->hh_head = _he_thh; \ - _he_thh = _he_hh_nxt; \ - } \ - } \ - uthash_free((tbl)->buckets, (tbl)->num_buckets * sizeof(struct UT_hash_bucket)); \ - (tbl)->num_buckets *= 2U; \ - (tbl)->log2_num_buckets++; \ - (tbl)->buckets = _he_new_buckets; \ - (tbl)->ineff_expands = ((tbl)->nonideal_items > ((tbl)->num_items >> 1)) ? \ - ((tbl)->ineff_expands+1U) : 0U; \ - if ((tbl)->ineff_expands > 1U) { \ - (tbl)->noexpand = 1; \ - uthash_noexpand_fyi(tbl); \ - } \ - uthash_expand_fyi(tbl); \ - } \ -} while (0) - - -/* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */ -/* Note that HASH_SORT assumes the hash handle name to be hh. - * HASH_SRT was added to allow the hash handle name to be passed in. */ -#define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn) -#define HASH_SRT(hh,head,cmpfcn) \ -do { \ - unsigned _hs_i; \ - unsigned _hs_looping,_hs_nmerges,_hs_insize,_hs_psize,_hs_qsize; \ - struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \ - if (head != NULL) { \ - _hs_insize = 1; \ - _hs_looping = 1; \ - _hs_list = &((head)->hh); \ - while (_hs_looping != 0U) { \ - _hs_p = _hs_list; \ - _hs_list = NULL; \ - _hs_tail = NULL; \ - _hs_nmerges = 0; \ - while (_hs_p != NULL) { \ - _hs_nmerges++; \ - _hs_q = _hs_p; \ - _hs_psize = 0; \ - for (_hs_i = 0; _hs_i < _hs_insize; ++_hs_i) { \ - _hs_psize++; \ - _hs_q = ((_hs_q->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \ - if (_hs_q == NULL) { \ - break; \ - } \ - } \ - _hs_qsize = _hs_insize; \ - while ((_hs_psize != 0U) || ((_hs_qsize != 0U) && (_hs_q != NULL))) { \ - if (_hs_psize == 0U) { \ - _hs_e = _hs_q; \ - _hs_q = ((_hs_q->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \ - _hs_qsize--; \ - } else if ((_hs_qsize == 0U) || (_hs_q == NULL)) { \ - _hs_e = _hs_p; \ - if (_hs_p != NULL) { \ - _hs_p = ((_hs_p->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_p->next) : NULL); \ - } \ - _hs_psize--; \ - } else if ((cmpfcn( \ - DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_p)), \ - DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl, _hs_q)) \ - )) <= 0) { \ - _hs_e = _hs_p; \ - if (_hs_p != NULL) { \ - _hs_p = ((_hs_p->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_p->next) : NULL); \ - } \ - _hs_psize--; \ - } else { \ - _hs_e = _hs_q; \ - _hs_q = ((_hs_q->next != NULL) ? \ - HH_FROM_ELMT((head)->hh.tbl, _hs_q->next) : NULL); \ - _hs_qsize--; \ - } \ - if ( _hs_tail != NULL ) { \ - _hs_tail->next = ((_hs_e != NULL) ? \ - ELMT_FROM_HH((head)->hh.tbl, _hs_e) : NULL); \ - } else { \ - _hs_list = _hs_e; \ - } \ - if (_hs_e != NULL) { \ - _hs_e->prev = ((_hs_tail != NULL) ? \ - ELMT_FROM_HH((head)->hh.tbl, _hs_tail) : NULL); \ - } \ - _hs_tail = _hs_e; \ - } \ - _hs_p = _hs_q; \ - } \ - if (_hs_tail != NULL) { \ - _hs_tail->next = NULL; \ - } \ - if (_hs_nmerges <= 1U) { \ - _hs_looping = 0; \ - (head)->hh.tbl->tail = _hs_tail; \ - DECLTYPE_ASSIGN(head, ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \ - } \ - _hs_insize *= 2U; \ - } \ - HASH_FSCK(hh, head, "HASH_SRT"); \ - } \ -} while (0) - -/* This function selects items from one hash into another hash. - * The end result is that the selected items have dual presence - * in both hashes. There is no copy of the items made; rather - * they are added into the new hash through a secondary hash - * hash handle that must be present in the structure. */ -#define HASH_SELECT(hh_dst, dst, hh_src, src, cond) \ -do { \ - unsigned _src_bkt, _dst_bkt; \ - void *_last_elt = NULL, *_elt; \ - UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh=NULL; \ - ptrdiff_t _dst_hho = ((char*)(&(dst)->hh_dst) - (char*)(dst)); \ - if ((src) != NULL) { \ - for (_src_bkt=0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \ - for (_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; \ - _src_hh != NULL; \ - _src_hh = _src_hh->hh_next) { \ - _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \ - if (cond(_elt)) { \ - IF_HASH_NONFATAL_OOM( int _hs_oomed = 0; ) \ - _dst_hh = (UT_hash_handle*)(((char*)_elt) + _dst_hho); \ - _dst_hh->key = _src_hh->key; \ - _dst_hh->keylen = _src_hh->keylen; \ - _dst_hh->hashv = _src_hh->hashv; \ - _dst_hh->prev = _last_elt; \ - _dst_hh->next = NULL; \ - if (_last_elt_hh != NULL) { \ - _last_elt_hh->next = _elt; \ - } \ - if ((dst) == NULL) { \ - DECLTYPE_ASSIGN(dst, _elt); \ - HASH_MAKE_TABLE(hh_dst, dst, _hs_oomed); \ - IF_HASH_NONFATAL_OOM( \ - if (_hs_oomed) { \ - uthash_nonfatal_oom(_elt); \ - (dst) = NULL; \ - continue; \ - } \ - ) \ - } else { \ - _dst_hh->tbl = (dst)->hh_dst.tbl; \ - } \ - HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt); \ - HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt], hh_dst, _dst_hh, _hs_oomed); \ - (dst)->hh_dst.tbl->num_items++; \ - IF_HASH_NONFATAL_OOM( \ - if (_hs_oomed) { \ - HASH_ROLLBACK_BKT(hh_dst, dst, _dst_hh); \ - HASH_DELETE_HH(hh_dst, dst, _dst_hh); \ - _dst_hh->tbl = NULL; \ - uthash_nonfatal_oom(_elt); \ - continue; \ - } \ - ) \ - HASH_BLOOM_ADD(_dst_hh->tbl, _dst_hh->hashv); \ - _last_elt = _elt; \ - _last_elt_hh = _dst_hh; \ - } \ - } \ - } \ - } \ - HASH_FSCK(hh_dst, dst, "HASH_SELECT"); \ -} while (0) - -#define HASH_CLEAR(hh,head) \ -do { \ - if ((head) != NULL) { \ - HASH_BLOOM_FREE((head)->hh.tbl); \ - uthash_free((head)->hh.tbl->buckets, \ - (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \ - uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ - (head) = NULL; \ - } \ -} while (0) - -#define HASH_OVERHEAD(hh,head) \ - (((head) != NULL) ? ( \ - (size_t)(((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \ - ((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \ - sizeof(UT_hash_table) + \ - (HASH_BLOOM_BYTELEN))) : 0U) - -#ifdef NO_DECLTYPE -#define HASH_ITER(hh,head,el,tmp) \ -for(((el)=(head)), ((*(char**)(&(tmp)))=(char*)((head!=NULL)?(head)->hh.next:NULL)); \ - (el) != NULL; ((el)=(tmp)), ((*(char**)(&(tmp)))=(char*)((tmp!=NULL)?(tmp)->hh.next:NULL))) -#else -#define HASH_ITER(hh,head,el,tmp) \ -for(((el)=(head)), ((tmp)=DECLTYPE(el)((head!=NULL)?(head)->hh.next:NULL)); \ - (el) != NULL; ((el)=(tmp)), ((tmp)=DECLTYPE(el)((tmp!=NULL)?(tmp)->hh.next:NULL))) -#endif - -/* obtain a count of items in the hash */ -#define HASH_COUNT(head) HASH_CNT(hh,head) -#define HASH_CNT(hh,head) ((head != NULL)?((head)->hh.tbl->num_items):0U) - -typedef struct UT_hash_bucket { - struct UT_hash_handle *hh_head; - unsigned count; - - /* expand_mult is normally set to 0. In this situation, the max chain length - * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If - * the bucket's chain exceeds this length, bucket expansion is triggered). - * However, setting expand_mult to a non-zero value delays bucket expansion - * (that would be triggered by additions to this particular bucket) - * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH. - * (The multiplier is simply expand_mult+1). The whole idea of this - * multiplier is to reduce bucket expansions, since they are expensive, in - * situations where we know that a particular bucket tends to be overused. - * It is better to let its chain length grow to a longer yet-still-bounded - * value, than to do an O(n) bucket expansion too often. - */ - unsigned expand_mult; - -} UT_hash_bucket; - -/* random signature used only to find hash tables in external analysis */ -#define HASH_SIGNATURE 0xa0111fe1u -#define HASH_BLOOM_SIGNATURE 0xb12220f2u - -typedef struct UT_hash_table { - UT_hash_bucket *buckets; - unsigned num_buckets, log2_num_buckets; - unsigned num_items; - struct UT_hash_handle *tail; /* tail hh in app order, for fast append */ - ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */ - - /* in an ideal situation (all buckets used equally), no bucket would have - * more than ceil(#items/#buckets) items. that's the ideal chain length. */ - unsigned ideal_chain_maxlen; - - /* nonideal_items is the number of items in the hash whose chain position - * exceeds the ideal chain maxlen. these items pay the penalty for an uneven - * hash distribution; reaching them in a chain traversal takes >ideal steps */ - unsigned nonideal_items; - - /* ineffective expands occur when a bucket doubling was performed, but - * afterward, more than half the items in the hash had nonideal chain - * positions. If this happens on two consecutive expansions we inhibit any - * further expansion, as it's not helping; this happens when the hash - * function isn't a good fit for the key domain. When expansion is inhibited - * the hash will still work, albeit no longer in constant time. */ - unsigned ineff_expands, noexpand; - - uint32_t signature; /* used only to find hash tables in external analysis */ -#ifdef HASH_BLOOM - uint32_t bloom_sig; /* used only to test bloom exists in external analysis */ - uint8_t *bloom_bv; - uint8_t bloom_nbits; -#endif - -} UT_hash_table; - -typedef struct UT_hash_handle { - struct UT_hash_table *tbl; - void *prev; /* prev element in app order */ - void *next; /* next element in app order */ - struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ - struct UT_hash_handle *hh_next; /* next hh in bucket order */ - void *key; /* ptr to enclosing struct's key */ - unsigned keylen; /* enclosing struct's key len */ - unsigned hashv; /* result of hash-fcn(key) */ -} UT_hash_handle; - -#endif /* UTHASH_H */ diff --git a/bundles/n2n_ntop_v3/legacy/README.md b/bundles/n2n_ntop_v3/legacy/README.md deleted file mode 100644 index 174c1146..00000000 --- a/bundles/n2n_ntop_v3/legacy/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Removed Features - -This folder contains a list N2N legacy features which have been dropped due to -maintainance cost versus effective use and benefits. - -Multiple Transops ------------------ - -N2N used to initialize all the available transops and use the "tick" function of -the transops to decide which transop to use before sending a packet. This however -has the following problems: - -- It only works with the keyfile, whereas with normal encryption we inizialize and - keep structures that we don't need. -- It is unfeasable as an edge node is required to implement all the transops in order - to properly talk with other edge nodes (via keyfile). -- It rises the complexity of the code. -- It is not clear which transop will be used. -- Mixing multiple encyptions together is not necessarily a good idea to improve security - as a vulnerability in at least one encryption method will leak some information. - -Keyfile and Key Rotation ------------------------- - -The keyfile mechanism allowed N2N users to specify a keyfile to be used to periodically -rotate keys and encryption methods. However, it has the following problems: - -- This feature is obscure for most of the users and poorly documented. -- It is tightly integrated in the core whereas it is used by only a few people (if any). - -In conclusion the main problem is the complexity that it adds to the code. In a possible -future rework this could be integrated as an extention (e.g. a specific trasop) without -rising the core complexity. diff --git a/bundles/n2n_ntop_v3/legacy/edge_keyschedule.c b/bundles/n2n_ntop_v3/legacy/edge_keyschedule.c deleted file mode 100644 index 5e3af35d..00000000 --- a/bundles/n2n_ntop_v3/legacy/edge_keyschedule.c +++ /dev/null @@ -1,103 +0,0 @@ -typedef struct n2n_tostat { - uint8_t can_tx; /* Does this transop have a valid SA for encoding. */ - n2n_cipherspec_t tx_spec; /* If can_tx, the spec used to encode. */ -} n2n_tostat_t; - -typedef uint32_t n2n_sa_t; /* security association number */ -typedef int (*n2n_transaddspec_f)( struct n2n_trans_op * arg, - const n2n_cipherspec_t * cspec ); - -typedef n2n_tostat_t (*n2n_transtick_f)( struct n2n_trans_op * arg, - time_t now ); - -/** Read in a key-schedule file, parse the lines and pass each line to the - * appropriate trans_op for parsing of key-data and adding key-schedule - * entries. The lookup table of time->trans_op is constructed such that - * encoding can be passed to the correct trans_op. The trans_op internal table - * will then determine the best SA for that trans_op from the key schedule to - * use for encoding. */ - -static int edge_init_keyschedule(n2n_edge_t *eee) { -#define N2N_NUM_CIPHERSPECS 32 - - int retval = -1; - ssize_t numSpecs=0; - n2n_cipherspec_t specs[N2N_NUM_CIPHERSPECS]; - size_t i; - time_t now = time(NULL); - - numSpecs = n2n_read_keyfile(specs, N2N_NUM_CIPHERSPECS, eee->conf.keyschedule); - - if(numSpecs > 0) - { - traceEvent(TRACE_NORMAL, "keyfile = %s read -> %d specs.\n", optarg, (signed int)numSpecs); - - for (i=0; i < (size_t)numSpecs; ++i) - { - n2n_transform_t idx = (n2n_transform_t) specs[i].t; - if(idx != eee->transop.transform_id) { - traceEvent(TRACE_ERROR, "changing transop in keyschedule is not supported"); - retval = -1; - } - - if(eee->transop.addspec != NULL) - retval = eee->transop.addspec(&eee->transop, &(specs[i])); - - if (0 != retval) - { - traceEvent(TRACE_ERROR, "keyschedule failed to add spec[%u] to transop[%d].\n", - (unsigned int)i, idx); - - return retval; - } - } - - n2n_tick_transop(eee, now); - } - else - traceEvent(TRACE_ERROR, "Failed to process '%s'", eee->conf.keyschedule); - - return retval; -} - -#if 0 - if(recvlen >= 6) - { - if(0 == memcmp(udp_buf, "reload", 6)) - { - if(strlen(eee->conf.keyschedule) > 0) - { - if(edge_init_keyschedule(eee) == 0) - { - msg_len=0; - msg_len += snprintf((char *)(udp_buf+msg_len), (N2N_PKT_BUF_SIZE-msg_len), - "> OK\n"); - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *)&sender_sock, sizeof(struct sockaddr_in)); - } - return; - } - } - } -#endif - -#if 0 - case'K': - { - if(conf->encrypt_key) { - traceEvent(TRACE_ERROR, "Error: -K and -k options are mutually exclusive"); - exit(1); - } else { - strncpy(conf->keyschedule, optargument, N2N_PATHNAME_MAXLEN-1); - /* strncpy does not add NULL if the source has no NULL. */ - conf->keyschedule[N2N_PATHNAME_MAXLEN-1] = 0; - - traceEvent(TRACE_NORMAL, "keyfile = '%s'\n", conf->keyschedule); - } - break; - } -#endif - -#if 0 - printf("-K | Specify a key schedule file to load. Not with -k.\n"); -#endif diff --git a/bundles/n2n_ntop_v3/legacy/gen_keyfile.py b/bundles/n2n_ntop_v3/legacy/gen_keyfile.py deleted file mode 100644 index b6dc3e67..00000000 --- a/bundles/n2n_ntop_v3/legacy/gen_keyfile.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -# (c) 2009 Richard Andrews - -# Program to generate a n2n_edge key schedule file for twofish keys -# Each key line consists of the following element -# -# -# where , are UNIX time_t values of key valid period -# is the transform ID (=2 for twofish) -# is twofish-specific data as follows -# _ - -import os -import sys -import time -import random - -NUM_KEYS=30 -KEY_LIFE=300 -KEY_LEN=16 - -now=time.time() -start_sa=random.randint( 0, 0xffffffff ) - -random.seed(now) # note now is a floating point time value - -def rand_key(): - key=str() - for i in range(0,KEY_LEN): - key += "%02x"%( random.randint( 0, 255) ) - - return key - -for i in range(0,NUM_KEYS): - from_time = now + (KEY_LIFE * (i-1) ) - until_time = now + (KEY_LIFE * (i+1) ) - key = rand_key() - sa_idx = start_sa + i - transform_id = random.randint( 2, 3 ) - - sys.stdout.write("%d %d %d %d_%s\n"%(from_time, until_time, transform_id,sa_idx, key) ) - - diff --git a/bundles/n2n_ntop_v3/legacy/n2n_keyfile.c b/bundles/n2n_ntop_v3/legacy/n2n_keyfile.c deleted file mode 100644 index eda6c834..00000000 --- a/bundles/n2n_ntop_v3/legacy/n2n_keyfile.c +++ /dev/null @@ -1,216 +0,0 @@ -/** - * (C) 2007-18 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "n2n_keyfile.h" -#include -#include -#include -#include - - -#ifdef WIN32 -char *strsep( char **ppsz_string, const char *psz_delimiters ) -{ - char *p; - char *psz_string = *ppsz_string; - if( !psz_string ) - return NULL; - - p = strpbrk( psz_string, psz_delimiters ); - if( !p ) - { - *ppsz_string = NULL; - return psz_string; - } - *p++ = '\0'; - - *ppsz_string = p; - return psz_string; -} -#endif - - -/* Parse hex nibbles in ascii until a non-nibble character is found. Nibble - * characters are 0-9, a-f and A-F. - * - * Return number of bytes parsed into keyBuf or a negative error code. - */ -ssize_t n2n_parse_hex( uint8_t * keyBuf, - size_t keyLen, - const char * textKey, - size_t textLen) -{ - ssize_t retval=0; - uint8_t * pout=keyBuf; - size_t octet=0; - const char * textEnd; - const char * pbeg; - - textEnd = textKey+textLen; - pbeg=textKey; - - while ( ( pbeg + 1 < textEnd ) && ( retval < (ssize_t)keyLen ) ) - { - if ( 1 != sscanf( pbeg, "%02x", (unsigned int*)&octet ) ) - { - retval=-1; - break; - } - - *pout = (octet & 0xff); - ++pout; - ++retval; - pbeg += 2; - } - - return retval; -} - - -static int parseKeyLine( n2n_cipherspec_t * spec, - const char * linein ) -{ - /* parameters are separated by whitespace */ - char line[N2N_KEYFILE_LINESIZE]; - char * lp=line; - const char * token; - strncpy( line, linein, N2N_KEYFILE_LINESIZE ); - - memset( spec, 0, sizeof( n2n_cipherspec_t ) ); - - /* decode valid_from time */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - spec->valid_from = atol(token); - - /* decode valid_until time */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - spec->valid_until = atol(token); - - /* decode the transform number */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - spec->t = atoi(token); - - /* The reset if opaque key data */ - token = strsep( &lp, DELIMITERS ); - if ( !token ) { goto error; } - strncpy( (char *)spec->opaque, token, N2N_MAX_KEYSIZE ); - spec->opaque_size=strlen( (char *)spec->opaque); - - return 0; - -error: - return -1; -} - - -#define SEP "/" - - -int validCipherSpec( const n2n_cipherspec_t * k, - time_t now ) -{ - if ( k->valid_until < k->valid_from ) { goto bad; } - if ( k->valid_from > now ) { goto bad; } - if ( k->valid_until < now ) { goto bad; } - - return 0; - -bad: - return -1; -} - -/* Read key control file and return the number of specs stored or a negative - * error code. - * - * As the specs are read in the from and until time values are compared to - * present time. Only those keys which are valid are stored. - */ -int n2n_read_keyfile( n2n_cipherspec_t * specs, /* fill out this array of cipherspecs */ - size_t numspecs, /* number of slots in the array. */ - const char * ctrlfile_path ) /* path to control file */ -{ - /* Each line contains one cipherspec. */ - - int retval=0; - FILE * fp=NULL; - size_t idx=0; - time_t now = time(NULL); - - traceEvent( TRACE_DEBUG, "Reading '%s'\n", ctrlfile_path ); - - fp = fopen( ctrlfile_path, "r" ); - if ( fp ) - { - /* Read the file a line a time with fgets. */ - char line[N2N_KEYFILE_LINESIZE]; - size_t lineNum=0; - - while ( idx < numspecs ) - { - n2n_cipherspec_t * k = &(specs[idx]); - fgets( line, N2N_KEYFILE_LINESIZE, fp ); - ++lineNum; - - if ( strlen(line) > 1 ) - { - if ( 0 == parseKeyLine( k, line ) ) - { - if ( k->valid_until > now ) - { - traceEvent( TRACE_INFO, " --> [%u] from %lu, until %lu, transform=%hu, data=%s\n", - idx, k->valid_from, k->valid_until, k->t, k->opaque ); - - ++retval; - ++idx; - } - else - { - traceEvent( TRACE_INFO, " --X [%u] from %lu, until %lu, transform=%hu, data=%s\n", - idx, k->valid_from, k->valid_until, k->t, k->opaque ); - - } - } - else - { - traceEvent( TRACE_WARNING, "Failed to decode line %u\n", lineNum ); - } - } - - if ( feof(fp) ) - { - break; - } - - line[0]=0; /* this line has been consumed */ - } - - fclose( fp); - fp=NULL; - } - else - { - traceEvent( TRACE_ERROR, "Failed to open '%s'\n", ctrlfile_path ); - retval = -1; - } - - return retval; -} diff --git a/bundles/n2n_ntop_v3/legacy/n2n_keyfile.h b/bundles/n2n_ntop_v3/legacy/n2n_keyfile.h deleted file mode 100644 index 05cdf606..00000000 --- a/bundles/n2n_ntop_v3/legacy/n2n_keyfile.h +++ /dev/null @@ -1,117 +0,0 @@ -/** - * (C) 2007-18 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -/** Key files - * - * Edge implements a very simple interface for getting instructions about - * rolling keys. - * - * Key definitions are written as individual files in /.key. The - * format of each key is a single line of hex nibbles as follows: - * - * 0102030405060708090a0b0c0d0e0f - * - * Any external key exchange mechanism can receive the key data write it into - * the keyfiles. - * - * To control which keys are active at what times the key control file is - * used. This is a single file which is periodically reread. It contains key - * definitions in chronological order with one line per key definition as - * follows: - * - * - * - * edge reads the key control file periodically to get updates in policy. edge - * holds a number of keys in memory. Data can be decoded if it was encoded by - * any of the keys still in memory. By having at least 2 keys in memory it - * allows for clock skew and transmission delay when encoder and decoder roll - * keys at slightly different times. The amount of overlap in the valid time - * ranges provides the tolerance to timing skews in the system. - * - * The keys have the same level of secrecy as any other user file. Existing - * UNIX permission systems can be used to provide access controls. - * - */ - -/** How Edge Uses The Key Schedule - * - * Edge provides state space for a number of transform algorithms. Each - * transform uses its state space to store the SA information for its keys as - * found in the key file. When a packet is received the transform ID is in - * plain text. The packets is then sent to that transform for decoding. Each - * transform can store its SA numbers differently (or not at all). The - * transform code then finds the SA number, then finds the cipher (with key) in - * the state space and uses this to decode the packet. - * - * To support this, as edge reads each key line, it passes it to the - * appropriate transform to parse the line and store the SA information in its - * state space. - * - * When encoding a packet, edge has several transforms and potentially valid - * SAs to choose from. To keep track of which one to use for encoding edge does - * its own book-keeping as each key line is passed to the transform code: it - * stores a lookup of valid_from -> transform. When encoding a packet it then - * just calls the transform with the best valid_from in the table. The - * transform's own state space has all the SAs for its keys and the best of - * those is chosen. - */ - -#if !defined( N2N_KEYFILE_H_ ) -#define N2N_KEYFILE_H_ - - -#include "n2n_wire.h" -#include - -#define N2N_MAX_KEYSIZE 256 /* bytes */ -#define N2N_MAX_NUM_CIPHERSPECS 8 -#define N2N_KEYPATH_SIZE 256 -#define N2N_KEYFILE_LINESIZE 256 - -/** This structure stores an encryption cipher spec. */ -struct n2n_cipherspec -{ - n2n_transform_t t; /* N2N_TRANSFORM_ID_xxx for this spec. */ - time_t valid_from; /* Start using the key at this time. */ - time_t valid_until; /* Key is valid if time < valid_until. */ - uint16_t opaque_size; /* Size in bytes of key. */ - uint8_t opaque[N2N_MAX_KEYSIZE];/* Key matter. */ -}; - -typedef struct n2n_cipherspec n2n_cipherspec_t; - - -static const char * const DELIMITERS=" \t\n\r"; - - -/** @return number of cipherspec items filled. */ -int n2n_read_keyfile( n2n_cipherspec_t * specs, /* fill out this array of cipherspecs */ - size_t numspecs, /* number of slots in the array. */ - const char * ctrlfile_path ); /* path to control file */ - -int validCipherSpec( const n2n_cipherspec_t * k, - time_t now ); - -ssize_t n2n_parse_hex( uint8_t * keyBuf, - size_t keyMax, - const char * textKey, - size_t textLen ); - -/*----------------------------------------------------------------------------*/ - -#endif /* #if !defined( N2N_KEYFILE_H_ ) */ diff --git a/bundles/n2n_ntop_v3/legacy/transform_aes.c b/bundles/n2n_ntop_v3/legacy/transform_aes.c deleted file mode 100644 index 7b198ff4..00000000 --- a/bundles/n2n_ntop_v3/legacy/transform_aes.c +++ /dev/null @@ -1,730 +0,0 @@ -/** - * (C) 2007-18 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "n2n_transforms.h" - -#if defined(N2N_HAVE_AES) - -#include "openssl/aes.h" -#include "openssl/sha.h" -#ifndef _MSC_VER -/* Not included in Visual Studio 2008 */ -#include /* index() */ -#endif - -#define N2N_AES_NUM_SA 32 /* space for SAa */ - -#define N2N_AES_TRANSFORM_VERSION 1 /* version of the transform encoding */ -#define N2N_AES_IVEC_SIZE 32 /* Enough space for biggest AES ivec */ - -#define AES256_KEY_BYTES (256/8) -#define AES192_KEY_BYTES (192/8) -#define AES128_KEY_BYTES (128/8) - -typedef unsigned char n2n_aes_ivec_t[N2N_AES_IVEC_SIZE]; - -struct sa_aes -{ - n2n_cipherspec_t spec; /* cipher spec parameters */ - n2n_sa_t sa_id; /* security association index */ - AES_KEY enc_key; /* tx key */ - AES_KEY dec_key; /* tx key */ - AES_KEY iv_enc_key; /* key used to encrypt the IV */ - uint8_t iv_ext_val[AES128_KEY_BYTES]; /* key used to extend the random IV seed to full block size */ -}; - -typedef struct sa_aes sa_aes_t; - - -/** Aes transform state data. - * - * With a key-schedule in place this will be populated with a number of - * SAs. Each SA has a lifetime and some opque data. The opaque data for aes - * consists of the SA number and key material. - * - */ -struct transop_aes -{ - ssize_t tx_sa; - size_t num_sa; - sa_aes_t sa[N2N_AES_NUM_SA]; - u_int8_t psk_mode; -}; - -typedef struct transop_aes transop_aes_t; - -static ssize_t aes_find_sa( const transop_aes_t * priv, const n2n_sa_t req_id ); -static int setup_aes_key(transop_aes_t *priv, const uint8_t *key, ssize_t key_size, size_t sa_num); - -static int transop_deinit_aes( n2n_trans_op_t * arg ) -{ - transop_aes_t * priv = (transop_aes_t *)arg->priv; - size_t i; - - if ( priv ) - { - /* Memory was previously allocated */ - for (i=0; isa[i]); - - sa->sa_id=0; - } - - priv->num_sa=0; - priv->tx_sa=-1; - - free(priv); - } - - arg->priv=NULL; /* return to fully uninitialised state */ - - return 0; -} - -static size_t aes_choose_tx_sa( transop_aes_t * priv, const u_int8_t * peer_mac ) { - return priv->tx_sa; /* set in tick */ -} - -static ssize_t aes_choose_rx_sa( transop_aes_t * priv, const u_int8_t * peer_mac, ssize_t sa_rx) { - if(!priv->psk_mode) - return aes_find_sa(priv, sa_rx); - else - /* NOTE the sa_rx of the packet is ignored in this case */ - return 0; -} - -/* AES plaintext preamble */ -#define TRANSOP_AES_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_AES_SA_SIZE 4 -#define TRANSOP_AES_IV_SEED_SIZE 8 -#define TRANSOP_AES_PREAMBLE_SIZE (TRANSOP_AES_VER_SIZE + TRANSOP_AES_SA_SIZE + TRANSOP_AES_IV_SEED_SIZE) - -/* AES ciphertext preamble */ -#define TRANSOP_AES_NONCE_SIZE 4 - -/* Return the best acceptable AES key size (in bytes) given an input keysize. - * - * The value returned will be one of AES128_KEY_BYTES, AES192_KEY_BYTES or - * AES256_KEY_BYTES. - */ -static size_t aes_best_keysize(size_t numBytes) -{ - if (numBytes >= AES256_KEY_BYTES ) - { - return AES256_KEY_BYTES; - } - else if (numBytes >= AES192_KEY_BYTES) - { - return AES192_KEY_BYTES; - } - else - { - return AES128_KEY_BYTES; - } -} - -static void set_aes_cbc_iv(sa_aes_t *sa, n2n_aes_ivec_t ivec, uint64_t iv_seed) { - uint8_t iv_full[AES_BLOCK_SIZE]; - - /* Extend the seed to full block size via the fixed ext value */ - memcpy(iv_full, sa->iv_ext_val, sizeof(iv_seed)); // note: only 64bits used of 128 available - memcpy(iv_full + sizeof(iv_seed), &iv_seed, sizeof(iv_seed)); - - /* Encrypt the IV with secret key to make it unpredictable. - * As discussed in https://github.com/ntop/n2n/issues/72, it's important to - * have an unpredictable IV since the initial part of the packet plaintext - * can be easily reconstructed from plaintext headers and used by an attacker - * to perform differential analysis. - */ - AES_ecb_encrypt(iv_full, ivec, &sa->iv_enc_key, AES_ENCRYPT); -} - -/** The aes packet format consists of: - * - * - a 8-bit aes encoding version in clear text - * - a 32-bit SA number in clear text - * - a 64-bit random IV seed - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|II|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_encode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len2=-1; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE] = {0}; - uint32_t * pnonce; - - if ( (in_len + TRANSOP_AES_NONCE_SIZE) <= N2N_PKT_BUF_SIZE ) - { - if ( (in_len + TRANSOP_AES_NONCE_SIZE + TRANSOP_AES_PREAMBLE_SIZE) <= out_len ) - { - int len=-1; - size_t idx=0; - sa_aes_t * sa; - size_t tx_sa_num = 0; - uint64_t iv_seed = 0; - uint8_t padding = 0; - n2n_aes_ivec_t enc_ivec = {0}; - - /* The transmit sa is periodically updated */ - tx_sa_num = aes_choose_tx_sa( priv, peer_mac ); - - sa = &(priv->sa[tx_sa_num]); /* Proper Tx SA index */ - - traceEvent( TRACE_DEBUG, "encode_aes %lu with SA %lu.", in_len, sa->sa_id ); - - /* Encode the aes format version. */ - encode_uint8( outbuf, &idx, N2N_AES_TRANSFORM_VERSION ); - - /* Encode the security association (SA) number */ - encode_uint32( outbuf, &idx, sa->sa_id ); - - /* Generate and encode the IV seed. - * Using two calls to rand() because RAND_MAX is usually < 64bit - * (e.g. linux) and sometimes < 32bit (e.g. Windows). - */ - ((uint32_t*)&iv_seed)[0] = rand(); - ((uint32_t*)&iv_seed)[1] = rand(); - encode_buf(outbuf, &idx, &iv_seed, sizeof(iv_seed)); - - /* Encrypt the assembly contents and write the ciphertext after the SA. */ - len = in_len + TRANSOP_AES_NONCE_SIZE; - - /* The assembly buffer is a source for encrypting data. The nonce is - * written in first followed by the packet payload. The whole - * contents of assembly are encrypted. */ - pnonce = (uint32_t *)assembly; - *pnonce = rand(); - memcpy( assembly + TRANSOP_AES_NONCE_SIZE, inbuf, in_len ); - - /* Need at least one encrypted byte at the end for the padding. */ - len2 = ( (len / AES_BLOCK_SIZE) + 1) * AES_BLOCK_SIZE; /* Round up to next whole AES adding at least one byte. */ - padding = (len2-len); - assembly[len2 - 1] = padding; - traceEvent( TRACE_DEBUG, "padding = %u, seed = %016lx", padding, iv_seed ); - - set_aes_cbc_iv(sa, enc_ivec, iv_seed); - - AES_cbc_encrypt( assembly, /* source */ - outbuf + TRANSOP_AES_PREAMBLE_SIZE, /* dest */ - len2, /* enc size */ - &(sa->enc_key), enc_ivec, AES_ENCRYPT ); - - len2 += TRANSOP_AES_PREAMBLE_SIZE; /* size of data carried in UDP. */ - } - else - { - traceEvent( TRACE_ERROR, "encode_aes outbuf too small." ); - } - } - else - { - traceEvent( TRACE_ERROR, "encode_aes inbuf too big to encrypt." ); - } - - return len2; -} - - -/* Search through the array of SAs to find the one with the required ID. - * - * @return array index where found or -1 if not found - */ -static ssize_t aes_find_sa( const transop_aes_t * priv, const n2n_sa_t req_id ) -{ - size_t i; - - for (i=0; i < priv->num_sa; ++i) - { - const sa_aes_t * sa=NULL; - - sa = &(priv->sa[i]); - if (req_id == sa->sa_id) - { - return i; - } - } - - return -1; -} - - -/* See transop_encode_aes for packet format */ -static int transop_decode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len=0; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - if ( ( (in_len - TRANSOP_AES_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE ) /* Cipher text fits in assembly */ - && (in_len >= (TRANSOP_AES_PREAMBLE_SIZE + TRANSOP_AES_NONCE_SIZE) ) /* Has at least version, SA, iv seed and nonce */ - ) - { - n2n_sa_t sa_rx; - ssize_t sa_idx=-1; - size_t rem=in_len; - size_t idx=0; - uint8_t aes_enc_ver=0; - uint64_t iv_seed=0; - - /* Get the encoding version to make sure it is supported */ - decode_uint8( &aes_enc_ver, inbuf, &rem, &idx ); - - if ( N2N_AES_TRANSFORM_VERSION == aes_enc_ver ) - { - /* Get the SA number and make sure we are decrypting with the right one. */ - decode_uint32( &sa_rx, inbuf, &rem, &idx ); - - sa_idx = aes_choose_rx_sa(priv, peer_mac, sa_rx); - - if ( sa_idx >= 0 ) - { - sa_aes_t * sa = &(priv->sa[sa_idx]); - - /* Get the IV seed */ - decode_buf((uint8_t *)&iv_seed, sizeof(iv_seed), inbuf, &rem, &idx); - - traceEvent( TRACE_DEBUG, "decode_aes %lu with SA %lu and seed %016lx", in_len, sa->sa_id, iv_seed ); - - len = (in_len - TRANSOP_AES_PREAMBLE_SIZE); - - if ( 0 == (len % AES_BLOCK_SIZE ) ) - { - uint8_t padding; - n2n_aes_ivec_t dec_ivec = {0}; - - set_aes_cbc_iv(sa, dec_ivec, iv_seed); - - AES_cbc_encrypt( (inbuf + TRANSOP_AES_PREAMBLE_SIZE), - assembly, /* destination */ - len, - &(sa->dec_key), - dec_ivec, AES_DECRYPT ); - - /* last byte is how much was padding: max value should be - * AES_BLOCKSIZE-1 */ - padding = assembly[ len-1 ] & 0xff; - - if ( len >= (padding + TRANSOP_AES_NONCE_SIZE)) - { - /* strictly speaking for this to be an ethernet packet - * it is going to need to be even bigger; but this is - * enough to prevent segfaults. */ - traceEvent( TRACE_DEBUG, "padding = %u", padding ); - len -= padding; - - len -= TRANSOP_AES_NONCE_SIZE; /* size of ethernet packet */ - - /* Step over 4-byte random nonce value */ - memcpy( outbuf, - assembly + TRANSOP_AES_NONCE_SIZE, - len ); - } - else - { - traceEvent( TRACE_WARNING, "UDP payload decryption failed." ); - } - } - else - { - traceEvent( TRACE_WARNING, "Encrypted length %d is not a multiple of AES_BLOCK_SIZE (%d)", len, AES_BLOCK_SIZE ); - len = 0; - } - - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_aes SA number %lu not found.", sa_rx ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_aes unsupported aes version %u.", aes_enc_ver ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - traceEvent( TRACE_ERROR, "decode_aes inbuf wrong size (%ul) to decrypt.", in_len ); - } - - return len; -} - -struct sha512_keybuf { - uint8_t enc_dec_key[AES256_KEY_BYTES]; /* The key to use for AES CBC encryption/decryption */ - uint8_t iv_enc_key[AES128_KEY_BYTES]; /* The key to use to encrypt the IV with AES ECB */ - uint8_t iv_ext_val[AES128_KEY_BYTES]; /* A value to extend the IV seed */ -}; /* size: SHA512_DIGEST_LENGTH */ - -/* NOTE: the caller should adjust priv->num_sa accordingly */ -static int setup_aes_key(transop_aes_t *priv, const uint8_t *key, ssize_t key_size, size_t sa_num) { - sa_aes_t * sa = &(priv->sa[sa_num]); - size_t aes_keysize_bytes; - size_t aes_keysize_bits; - struct sha512_keybuf keybuf; - - /* Clear out any old possibly longer key matter. */ - memset( &(sa->enc_key), 0, sizeof(sa->enc_key) ); - memset( &(sa->dec_key), 0, sizeof(sa->dec_key) ); - memset( &(sa->iv_enc_key), 0, sizeof(sa->iv_enc_key) ); - memset( &(sa->iv_ext_val), 0, sizeof(sa->iv_ext_val) ); - - /* We still use aes_best_keysize (even not necessary since we hash the key - * into the 256bits enc_dec_key) to let the users choose the degree of encryption. - * Long keys will pick AES192 or AES256 with more robust but expensive encryption. - */ - aes_keysize_bytes = aes_best_keysize(key_size); - aes_keysize_bits = 8 * aes_keysize_bytes; - - /* Hash the main key to generate subkeys */ - SHA512(key, key_size, (u_char*)&keybuf); - - /* setup of enc_key/dec_key, used for the CBC encryption */ - AES_set_encrypt_key(keybuf.enc_dec_key, aes_keysize_bits, &(sa->enc_key)); - AES_set_decrypt_key(keybuf.enc_dec_key, aes_keysize_bits, &(sa->dec_key)); - - /* setup of iv_enc_key and iv_ext_val, used for generating the CBC IV */ - AES_set_encrypt_key(keybuf.iv_enc_key, sizeof(keybuf.iv_enc_key) * 8, &(sa->iv_enc_key)); - memcpy(sa->iv_ext_val, keybuf.iv_ext_val, sizeof(keybuf.iv_ext_val)); - - traceEvent( TRACE_DEBUG, "transop_addspec_aes sa_id=%u, %u bits key=%s.\n", - priv->sa[sa_num].sa_id, aes_keysize_bits, key); - - return(0); -} - -/* - * priv: pointer to transform state - * keybuf: buffer holding the key - * pstat: length of keybuf - */ -static void add_aes_key(transop_aes_t *priv, uint8_t *keybuf, ssize_t pstat) { - setup_aes_key(priv, keybuf, pstat, priv->num_sa); - ++(priv->num_sa); -} - -static int transop_addspec_aes( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - int retval = 1; - ssize_t pstat=-1; - transop_aes_t * priv = (transop_aes_t *)arg->priv; - uint8_t keybuf[N2N_MAX_KEYSIZE]; - - if ( priv->num_sa < N2N_AES_NUM_SA ) - { - const char * op = (const char *)cspec->opaque; - const char * sep = index( op, '_' ); - - if ( sep ) - { - char tmp[256]; - size_t s; - - s = sep - op; - memcpy( tmp, cspec->opaque, s ); - tmp[s]=0; - - s = strlen(sep+1); /* sep is the _ which might be immediately followed by NULL */ - - priv->sa[priv->num_sa].spec = *cspec; - priv->sa[priv->num_sa].sa_id = strtoul(tmp, NULL, 10); - - memset( keybuf, 0, N2N_MAX_KEYSIZE ); - pstat = n2n_parse_hex( keybuf, N2N_MAX_KEYSIZE, sep+1, s ); - if ( pstat > 0 ) - { - add_aes_key(priv, keybuf, pstat); - retval = 0; - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_aes : bad key data - missing '_'.\n"); - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_aes : full.\n"); - } - - return retval; -} - - -static n2n_tostat_t transop_tick_aes( n2n_trans_op_t * arg, time_t now ) -{ - transop_aes_t * priv = (transop_aes_t *)arg->priv; - size_t i; - int found=0; - n2n_tostat_t r; - - memset( &r, 0, sizeof(r) ); - - traceEvent( TRACE_DEBUG, "transop_aes tick num_sa=%u now=%lu", priv->num_sa, now ); - - for ( i=0; i < priv->num_sa; ++i ) - { - if ( 0 == validCipherSpec( &(priv->sa[i].spec), now ) ) - { - time_t remaining = priv->sa[i].spec.valid_until - now; - - traceEvent( TRACE_INFO, "transop_aes choosing tx_sa=%u (valid for %lu sec)", priv->sa[i].sa_id, remaining ); - priv->tx_sa=i; - found=1; - break; - } - else - { - traceEvent( TRACE_DEBUG, "transop_aes tick rejecting sa=%u %lu -> %lu", - priv->sa[i].sa_id, priv->sa[i].spec.valid_from, priv->sa[i].spec.valid_until ); - } - } - - if ( 0==found) - { - traceEvent( TRACE_INFO, "transop_aes no keys are currently valid. Keeping tx_sa=%u", priv->tx_sa ); - } - else - { - r.can_tx = 1; - r.tx_spec.t = N2N_TRANSFORM_ID_AESCBC; - r.tx_spec = priv->sa[priv->tx_sa].spec; - } - - return r; -} - -static n2n_tostat_t transop_tick_aes_psk(n2n_trans_op_t * arg, time_t now) { - transop_aes_t * priv = (transop_aes_t *)arg->priv; - n2n_tostat_t r; - - memset(&r, 0, sizeof(r)); - - // Always tx - r.can_tx = 1; - r.tx_spec.t = N2N_TRANSFORM_ID_AESCBC; - r.tx_spec = priv->sa[priv->tx_sa].spec; - - return r; -} - -int transop_aes_init( n2n_trans_op_t * ttt ) -{ - int retval = 1; - transop_aes_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_aes( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_aes_t *) calloc(1, sizeof(transop_aes_t)); - - if ( NULL != priv ) - { - size_t i; - sa_aes_t * sa=NULL; - - /* install the private structure. */ - ttt->priv = priv; - priv->num_sa=0; - priv->tx_sa=0; /* We will use this sa index for encoding. */ - priv->psk_mode = 0; - - ttt->transform_id = N2N_TRANSFORM_ID_AESCBC; - ttt->addspec = transop_addspec_aes; - ttt->tick = transop_tick_aes; /* chooses a new tx_sa */ - ttt->deinit = transop_deinit_aes; - ttt->fwd = transop_encode_aes; - ttt->rev = transop_decode_aes; - - for(i=0; isa[i]); - sa->sa_id=0; - memset( &(sa->spec), 0, sizeof(n2n_cipherspec_t) ); - memset( &(sa->enc_key), 0, sizeof(sa->enc_key) ); - memset( &(sa->dec_key), 0, sizeof(sa->dec_key) ); - memset( &(sa->iv_enc_key), 0, sizeof(sa->iv_enc_key) ); - memset( &(sa->iv_ext_val), 0, sizeof(sa->iv_ext_val) ); - } - - retval = 0; - } - else - { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for aes" ); - } - - return retval; -} - -/* Setup AES in pre-shared key mode */ -int transop_aes_setup_psk(n2n_trans_op_t *ttt, - n2n_sa_t sa_num, - uint8_t *encrypt_pwd, - uint32_t encrypt_pwd_len) { - int retval = 1; - transop_aes_t *priv = (transop_aes_t *)ttt->priv; - - if(ttt->priv) { - /* Replace the tick function with the PSK version of it */ - ttt->tick = transop_tick_aes_psk; - priv->psk_mode = 1; - priv->num_sa=0; - priv->tx_sa=0; - - /* Setup the key to use for encryption/decryption */ - add_aes_key(priv, encrypt_pwd, encrypt_pwd_len); - - retval = 0; - } else - traceEvent(TRACE_ERROR, "AES priv is not allocated"); - - return retval; -} - -#else /* #if defined(N2N_HAVE_AES) */ - -struct transop_aes -{ - ssize_t tx_sa; -}; - -typedef struct transop_aes transop_aes_t; - - -static int transop_deinit_aes( n2n_trans_op_t * arg ) -{ - transop_aes_t * priv = (transop_aes_t *)arg->priv; - - if ( priv ) - { - free(priv); - } - - arg->priv=NULL; /* return to fully uninitialised state */ - - return 0; -} - -static int transop_encode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - return -1; -} - -static int transop_decode_aes( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len ) -{ - return -1; -} - -static int transop_addspec_aes( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - traceEvent( TRACE_DEBUG, "transop_addspec_aes AES not built into edge.\n"); - - return -1; -} - -static n2n_tostat_t transop_tick_aes( n2n_trans_op_t * arg, time_t now ) -{ - n2n_tostat_t r; - - memset( &r, 0, sizeof(r) ); - - return r; -} - -int transop_aes_init( n2n_trans_op_t * ttt ) -{ - int retval = 1; - transop_aes_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_aes( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_aes_t *) malloc( sizeof(transop_aes_t) ); - - if ( NULL != priv ) - { - /* install the private structure. */ - ttt->priv = priv; - priv->tx_sa=0; /* We will use this sa index for encoding. */ - - ttt->transform_id = N2N_TRANSFORM_ID_AESCBC; - ttt->addspec = transop_addspec_aes; - ttt->tick = transop_tick_aes; /* chooses a new tx_sa */ - ttt->deinit = transop_deinit_aes; - ttt->fwd = transop_encode_aes; - ttt->rev = transop_decode_aes; - - retval = 0; - } - else - { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for aes" ); - } - - return retval; -} - - -int transop_aes_setup_psk(n2n_trans_op_t *ttt, - n2n_sa_t sa_num, - uint8_t *encrypt_pwd, - uint32_t encrypt_pwd_len) { - return 0; -} - -#endif /* #if defined(N2N_HAVE_AES) */ - diff --git a/bundles/n2n_ntop_v3/legacy/transform_tf.c b/bundles/n2n_ntop_v3/legacy/transform_tf.c deleted file mode 100644 index 6b4d6060..00000000 --- a/bundles/n2n_ntop_v3/legacy/transform_tf.c +++ /dev/null @@ -1,467 +0,0 @@ -/** - * (C) 2007-18 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "n2n_transforms.h" -#include "twofish.h" -#ifndef _MSC_VER -/* Not included in Visual Studio 2008 */ -#include /* index() */ -#endif - -#define N2N_TWOFISH_NUM_SA 32 /* space for SAa */ - -#define N2N_TWOFISH_TRANSFORM_VERSION 1 /* version of the transform encoding */ - -struct sa_twofish -{ - n2n_cipherspec_t spec; /* cipher spec parameters */ - n2n_sa_t sa_id; /* security association index */ - TWOFISH * enc_tf; /* tx state */ - TWOFISH * dec_tf; /* rx state */ -}; - -typedef struct sa_twofish sa_twofish_t; - - -/** Twofish transform state data. - * - * With a key-schedule in place this will be populated with a number of - * SAs. Each SA has a lifetime and some opque data. The opaque data for twofish - * consists of the SA number and key material. - * - */ -struct transop_tf -{ - ssize_t tx_sa; - size_t num_sa; - sa_twofish_t sa[N2N_TWOFISH_NUM_SA]; -}; - -typedef struct transop_tf transop_tf_t; - -static int transop_deinit_twofish( n2n_trans_op_t * arg ) -{ - transop_tf_t * priv = (transop_tf_t *)arg->priv; - size_t i; - - if ( priv ) - { - /* Memory was previously allocated */ - for (i=0; isa[i]); - - TwoFishDestroy(sa->enc_tf); /* deallocate TWOFISH */ - sa->enc_tf=NULL; - - TwoFishDestroy(sa->dec_tf); /* deallocate TWOFISH */ - sa->dec_tf=NULL; - - sa->sa_id=0; - } - - priv->num_sa=0; - priv->tx_sa=-1; - - free(priv); - } - - arg->priv=NULL; /* return to fully uninitialised state */ - - return 0; -} - -static size_t tf_choose_tx_sa( transop_tf_t * priv ) -{ - return priv->tx_sa; /* set in tick */ -} - -#define TRANSOP_TF_VER_SIZE 1 /* Support minor variants in encoding in one module. */ -#define TRANSOP_TF_NONCE_SIZE 4 -#define TRANSOP_TF_SA_SIZE 4 - -/** The twofish packet format consists of: - * - * - a 8-bit twofish encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_encode_twofish( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len=-1; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - uint32_t * pnonce; - - if ( (in_len + TRANSOP_TF_NONCE_SIZE) <= N2N_PKT_BUF_SIZE ) - { - if ( (in_len + TRANSOP_TF_NONCE_SIZE + TRANSOP_TF_SA_SIZE + TRANSOP_TF_VER_SIZE) <= out_len ) - { - size_t idx=0; - sa_twofish_t * sa; - size_t tx_sa_num = 0; - - /* The transmit sa is periodically updated */ - tx_sa_num = tf_choose_tx_sa( priv ); - - sa = &(priv->sa[tx_sa_num]); /* Proper Tx SA index */ - - traceEvent( TRACE_DEBUG, "encode_twofish %lu with SA %lu.", in_len, sa->sa_id ); - - /* Encode the twofish format version. */ - encode_uint8( outbuf, &idx, N2N_TWOFISH_TRANSFORM_VERSION ); - - /* Encode the security association (SA) number */ - encode_uint32( outbuf, &idx, sa->sa_id ); - - /* The assembly buffer is a source for encrypting data. The nonce is - * written in first followed by the packet payload. The whole - * contents of assembly are encrypted. */ - pnonce = (uint32_t *)assembly; - *pnonce = rand(); - memcpy( assembly + TRANSOP_TF_NONCE_SIZE, inbuf, in_len ); - - /* Encrypt the assembly contents and write the ciphertext after the SA. */ - len = TwoFishEncryptRaw( assembly, /* source */ - outbuf + TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE, - in_len + TRANSOP_TF_NONCE_SIZE, /* enc size */ - sa->enc_tf); - if ( len > 0 ) - { - len += TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE; /* size of data carried in UDP. */ - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish encryption failed." ); - } - - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish outbuf too small." ); - } - } - else - { - traceEvent( TRACE_ERROR, "encode_twofish inbuf too big to encrypt." ); - } - - return len; -} - - -/* Search through the array of SAs to find the one with the required ID. - * - * @return array index where found or -1 if not found - */ -static ssize_t twofish_find_sa( const transop_tf_t * priv, const n2n_sa_t req_id ) -{ - size_t i; - - for (i=0; i < priv->num_sa; ++i) - { - const sa_twofish_t * sa=NULL; - - sa = &(priv->sa[i]); - if (req_id == sa->sa_id) - { - return i; - } - } - - return -1; -} - - -/** The twofish packet format consists of: - * - * - a 8-bit twofish encoding version in clear text - * - a 32-bit SA number in clear text - * - ciphertext encrypted from a 32-bit nonce followed by the payload. - * - * [V|SSSS|nnnnDDDDDDDDDDDDDDDDDDDDD] - * |<------ encrypted ------>| - */ -static int transop_decode_twofish( n2n_trans_op_t * arg, - uint8_t * outbuf, - size_t out_len, - const uint8_t * inbuf, - size_t in_len, - const uint8_t * peer_mac) -{ - int len=0; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - if ( ( (in_len - (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE)) <= N2N_PKT_BUF_SIZE ) /* Cipher text fits in assembly */ - && (in_len >= (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE + TRANSOP_TF_NONCE_SIZE) ) /* Has at least version, SA and nonce */ - ) - { - n2n_sa_t sa_rx; - ssize_t sa_idx=-1; - size_t rem=in_len; - size_t idx=0; - uint8_t tf_enc_ver=0; - - /* Get the encoding version to make sure it is supported */ - decode_uint8( &tf_enc_ver, inbuf, &rem, &idx ); - - if ( N2N_TWOFISH_TRANSFORM_VERSION == tf_enc_ver ) - { - /* Get the SA number and make sure we are decrypting with the right one. */ - decode_uint32( &sa_rx, inbuf, &rem, &idx ); - - sa_idx = twofish_find_sa(priv, sa_rx); - if ( sa_idx >= 0 ) - { - sa_twofish_t * sa = &(priv->sa[sa_idx]); - - traceEvent( TRACE_DEBUG, "decode_twofish %lu with SA %lu.", in_len, sa_rx, sa->sa_id ); - - len = TwoFishDecryptRaw( (void *)(inbuf + TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE), - assembly, /* destination */ - (in_len - (TRANSOP_TF_VER_SIZE + TRANSOP_TF_SA_SIZE)), - sa->dec_tf); - - if ( len > 0 ) - { - /* Step over 4-byte random nonce value */ - len -= TRANSOP_TF_NONCE_SIZE; /* size of ethernet packet */ - - memcpy( outbuf, - assembly + TRANSOP_TF_NONCE_SIZE, - len ); - } - else - { - traceEvent( TRACE_ERROR, "decode_twofish decryption failed." ); - } - - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_twofish SA number %lu not found.", sa_rx ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - /* Wrong security association; drop the packet as it is undecodable. */ - traceEvent( TRACE_ERROR, "decode_twofish unsupported twofish version %u.", tf_enc_ver ); - - /* REVISIT: should be able to load a new SA at this point to complete the decoding. */ - } - } - else - { - traceEvent( TRACE_ERROR, "decode_twofish inbuf wrong size (%ul) to decrypt.", in_len ); - } - - return len; -} - -static int transop_addspec_twofish( n2n_trans_op_t * arg, const n2n_cipherspec_t * cspec ) -{ - int retval = 1; - ssize_t pstat=-1; - transop_tf_t * priv = (transop_tf_t *)arg->priv; - uint8_t keybuf[N2N_MAX_KEYSIZE]; - - if ( priv->num_sa < N2N_TWOFISH_NUM_SA ) - { - const char * op = (const char *)cspec->opaque; -#ifdef __ANDROID_NDK__ - const char *sep = strchr(op, '_'); -#else - const char * sep = index( op, '_' ); -#endif // __ANDROID_NDK__ - - if ( sep ) - { - char tmp[256]; - size_t s; - - s = sep - op; - memcpy( tmp, cspec->opaque, s ); - tmp[s]=0; - - s = strlen(sep+1); /* sep is the _ which might be immediately followed by NULL */ - - priv->sa[priv->num_sa].spec = *cspec; - priv->sa[priv->num_sa].sa_id = strtoul(tmp, NULL, 10); - - pstat = n2n_parse_hex( keybuf, N2N_MAX_KEYSIZE, sep+1, s ); - if ( pstat > 0 ) - { - priv->sa[priv->num_sa].enc_tf = TwoFishInit( keybuf, pstat); - priv->sa[priv->num_sa].dec_tf = TwoFishInit( keybuf, pstat); - - traceEvent( TRACE_DEBUG, "transop_addspec_twofish sa_id=%u data=%s.\n", - priv->sa[priv->num_sa].sa_id, sep+1); - - ++(priv->num_sa); - retval = 0; - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_twofish : bad key data - missing '_'.\n"); - } - } - else - { - traceEvent( TRACE_ERROR, "transop_addspec_twofish : full.\n"); - } - - return retval; -} - - -static n2n_tostat_t transop_tick_twofish( n2n_trans_op_t * arg, time_t now ) -{ - transop_tf_t * priv = (transop_tf_t *)arg->priv; - size_t i; - int found=0; - n2n_tostat_t r; - - memset( &r, 0, sizeof(r) ); - - traceEvent( TRACE_DEBUG, "transop_tf tick num_sa=%u", priv->num_sa ); - - for ( i=0; i < priv->num_sa; ++i ) - { - if ( 0 == validCipherSpec( &(priv->sa[i].spec), now ) ) - { - time_t remaining = priv->sa[i].spec.valid_until - now; - - traceEvent( TRACE_INFO, "transop_tf choosing tx_sa=%u (valid for %lu sec)", priv->sa[i].sa_id, remaining ); - priv->tx_sa=i; - found=1; - break; - } - else - { - traceEvent( TRACE_DEBUG, "transop_tf tick rejecting sa=%u %lu -> %lu", - priv->sa[i].sa_id, priv->sa[i].spec.valid_from, priv->sa[i].spec.valid_until ); - } - } - - if ( 0==found) - { - traceEvent( TRACE_INFO, "transop_tf no keys are currently valid. Keeping tx_sa=%u", priv->tx_sa ); - } - else - { - r.can_tx = 1; - r.tx_spec.t = N2N_TRANSFORM_ID_TWOFISH; - r.tx_spec = priv->sa[priv->tx_sa].spec; - } - - return r; -} - -int transop_twofish_setup_psk( n2n_trans_op_t * ttt, - n2n_sa_t sa_num, - uint8_t * encrypt_pwd, - uint32_t encrypt_pwd_len ) -{ - int retval = 1; - transop_tf_t * priv = (transop_tf_t *)ttt->priv; - - if(priv) { - sa_twofish_t *sa; - - priv->num_sa=1; /* There is one SA in the array. */ - priv->tx_sa=0; - sa = &(priv->sa[priv->tx_sa]); - sa->sa_id=sa_num; - sa->spec.valid_until = 0x7fffffff; - - /* This is a preshared key setup. Both Tx and Rx are using the same security association. */ - - sa->enc_tf = TwoFishInit(encrypt_pwd, encrypt_pwd_len); - sa->dec_tf = TwoFishInit(encrypt_pwd, encrypt_pwd_len); - - if ( (sa->enc_tf) && (sa->dec_tf) ) - retval = 0; - else - traceEvent( TRACE_ERROR, "transop_twofish_setup_psk" ); - } else - traceEvent( TRACE_ERROR, "twofish priv is not allocated" ); - - return retval; -} - -int transop_twofish_init( n2n_trans_op_t * ttt ) -{ - int retval = 1; - transop_tf_t * priv = NULL; - - if ( ttt->priv ) - { - transop_deinit_twofish( ttt ); - } - - memset( ttt, 0, sizeof( n2n_trans_op_t ) ); - - priv = (transop_tf_t *) malloc( sizeof(transop_tf_t) ); - - if ( NULL != priv ) { - size_t i; - sa_twofish_t * sa=NULL; - - /* install the private structure. */ - ttt->priv = priv; - priv->num_sa=0; - priv->tx_sa=0; /* We will use this sa index for encoding. */ - - ttt->transform_id = N2N_TRANSFORM_ID_TWOFISH; - ttt->addspec = transop_addspec_twofish; - ttt->tick = transop_tick_twofish; /* chooses a new tx_sa */ - ttt->deinit = transop_deinit_twofish; - ttt->fwd = transop_encode_twofish; - ttt->rev = transop_decode_twofish; - - for(i=0; isa[i]); - sa->sa_id=0; - memset( &(sa->spec), 0, sizeof(n2n_cipherspec_t) ); - sa->enc_tf=NULL; - sa->dec_tf=NULL; - } - - retval = 0; - } else { - memset( ttt, 0, sizeof(n2n_trans_op_t) ); - traceEvent( TRACE_ERROR, "Failed to allocate priv for twofish" ); - } - - return retval; -} diff --git a/bundles/n2n_ntop_v3/n2n.7 b/bundles/n2n_ntop_v3/n2n.7 deleted file mode 100644 index df0f293a..00000000 --- a/bundles/n2n_ntop_v3/n2n.7 +++ /dev/null @@ -1,132 +0,0 @@ -.TH "n2n_v3" 7 "Sep 27, 2021" "version 3" "Background" -.SH NAME -n2n version 3 \- version 3 of the n2n decentralised peer-to-peer network overlay -VPN. -.SH DESCRIPTION -n2n is a peer-to-peer network overlay or VPN system that provides layer 2 over -layer 3 encapsulation with data transform capabilities such as encryption and -compression. This guide also discusses the differences of version 3 of n2n from -version 2. -.SH PROTOCOLS -n2n-3 basically uses the same set of messages to communicate with edges and -supernodes. However, due to slight packet format changes, the n2n-3 messages -are not compatible with n2n-2. There is no backward compatibility for n2n-2. -.SH ENCRYPTION -n2n-3 offers four different ciphers for payload encryption as well as optional -header encryption. Earlier versions of n2n-2 provided a mechanism using a key -schedule which has been removed in n2n-3. A basic user authentication scheme -relying on asymmetric cryptography has been added to n2n-3. - -n2n-3 provides the following ciphers to chose from for payload encryption; more -can be added as required: -.TP -.B (1) NULL -Data is encapsulated unchanged. Useful for testing and high-performance, low -sensitivity applications. -.TP -.B (2) TF-CTS -Twofish AES candidate in CTS mode. -.TP -.B (3) AES-CTS -AES in CTS mode with up to 256-bit key. -.TP -.B (4) CHACHA20 -ChaCha20, a well known stream cipher developped by Daniel J. Bernstein. -.TP -.B (5) SPECK-CTR -A fast block cipher developped by the NSA used as stream cipher in CTR mode. -.TP -Full Header Encyption -The optional full header encryption also encrypts packets' header which include -some administrative data. In addition, it adds replay protection. -.TP -User Password Authentication -n2n-3 implements an optional user-password authentication scheme. A key -generator assists in generating user's public keys to be stored at the -supernode side. -.SH COPMPRESSION -LZO for payload compression is an always available option at n2n-3. If compiled with -zstdlib support, ZSTD is at optional service as well. -.SH EXTENSIBILITY -n2n-3 decouples the data transform system from the core of the edge -operation. This allows for easier addition of new data transform -operations. n2n-3 reserves some standard transform identifiers (such as TwoFish -encryption) but allocates transform identifiers for user-defined -transforms. This allows anyone to add to n2n new private transforms without -breaking compatibility with the standard offering. -.SH FEDERATED SUPERNODES -n2n-3 incorporates the capability of multiple supernodes to be federated. -Federation acts transparently and balances the workload evenly among the -federated supernodes. Supernodes keep track of edges connected to different -supernodes and forward packets as required. This feature naturally supports -fail-over and this increases redundancy and resilience. -.P -Information on additional supernodes is propagated to all edges. In addition, -the n2n-3 edge implementation allows multiple supernodes to be specified on the -command line. Edges monitor the current supernode for responses to -REGISTER_SUPER as well as PING messages. After three responses from current -supernode are missed or when a better supernode in terms of significant lower workload -is found, the edge tries to connect to another supernode. It cycles through the list -f supernodes which over and over again is sorted according to reported workload. - -.SH MANAGEMENT CONSOLE -Edge and supernode in n2n-3 provide a UDP-based management console. Both listen -on the localhost address 127.0.0.1. Commands can be sent to the programs by -sending to the UDP socket. Responses are returned to the socket from which -commands were issued. This only works from the computer on which the programs -are running. Statistics can be retrieved and commands issued. The netcat utility -is all that is required; but more sophisticated tools could be built on the -interface. - -.SH SUPERNODE AUTHENTICATION -The supernode federation name serves as private key shared between the supernodes only. -The corresponding public key can be provided to the edges. - -.SH MESSAGE SUMMARY -The following message types work within n2n-3. -.TP -REGISTER_SUPER -Sent from an edge to its local supernode to register its MAC with the community. -Also, federated supernodes use this packet format to register to each other. -.TP -REGISTER_SUPER_ACK -Sent from a supernode to an edge to confirm registration. This also carries the -definition of the edge socket as seen at the supernode so NAT can be detected -and described. Furthermore, it carries information about additional federated -supernodes. -.TP -REGISTER_SUPER_NAK -Supernode refusing to register an edge. -.TP -PACKET -Encapsulated ethernet packets sent between edges. Supernodes forward or -broadcast these and edges send them direct in peer-to-peer mode. -.TP -REGISTER -A peer-to-peer mode registration request from one edge to another. Supernodes -forward these to facilitate NAT crossing introductions. -.TP -REGISTER_ACK -Complete peer-to-peer mode setup between two edges. These messages need to -travel direct between edges. -.TP -QUERY_PEER -Queries a supernode about another edge, especially its public socket in case of -no peer-to-peer communication can be established. Additionally, it serves as PING -to query supernodes about themselves. -.TP -PEER_INFO -Answers the QUERY_PEER; it also covers the special case of the PING query, internally -called PONG. -.SH AUTHORS -.TP -Richard Andrews andrews (at) ntop.org - main author of n2n-2 -.TP -Luca Deri -deri (at) ntop.org - code inherited from n2n-1 -.SH SEE ALSO -ifconfig(8) edge(8) supernode(1) -.br -the documentation contained in the source code -.br -the extensive documentation found in n2n's \fBdoc/\fR folder diff --git a/bundles/n2n_ntop_v3/packages/centos b/bundles/n2n_ntop_v3/packages/centos deleted file mode 100644 index 7c88ef3c..00000000 --- a/bundles/n2n_ntop_v3/packages/centos +++ /dev/null @@ -1 +0,0 @@ -rpm \ No newline at end of file diff --git a/bundles/n2n_ntop_v3/packages/debian/Makefile.in b/bundles/n2n_ntop_v3/packages/debian/Makefile.in deleted file mode 100644 index 8b8b993f..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/Makefile.in +++ /dev/null @@ -1,41 +0,0 @@ -# -# Change it according to your setup -# -N2N_HOME=$(PWD)/../.. -N2N_BUILD=${N2N_HOME}/packages/debian/n2n - -all: clean pkg - -pkg: - make -C ../../ - if test -e "${N2N_BUILD}"; then /bin/rm -fr ${N2N_BUILD}; fi - mkdir -p ${N2N_BUILD}/usr/sbin ${N2N_BUILD}/usr/share/man/man1 ${N2N_BUILD}/usr/share/man/man7 ${N2N_BUILD}/usr/share/man/man8 - mkdir -p ${N2N_BUILD}/usr/share/doc/n2n/examples - install -m755 ../../supernode ${N2N_BUILD}/usr/sbin/ - install -m755 ../../edge ${N2N_BUILD}/usr/sbin/ - install -m644 ../../edge.8.gz ${N2N_BUILD}/usr/share/man/man8/ - install -m644 ../../supernode.1.gz ${N2N_BUILD}/usr/share/man/man1/ - install -m644 ../../n2n.7.gz ${N2N_BUILD}/usr/share/man/man7/ - install -m644 ../../community.list ${N2N_BUILD}/usr/share/doc/n2n/examples/ - install -m644 ../../doc/*.md ${N2N_BUILD}/usr/share/doc/n2n/ - @/bin/rm -f ../n2n*.deb - dpkg-buildpackage -rfakeroot -d -us -uc -a@EXTN@ - -dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb - @\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes - @/bin/mv ../n2n_*deb . - @echo - @echo "Package built." - @/bin/ls n2n_*deb - @echo "-------------------------------" - -dpkg -I n2n_*deb - -dpkg --contents n2n_*deb - @echo "-------------------------------" - -distclean: - echo "dummy distclean" - -install: - echo "dummy install" - -clean: - rm -rf *~ *deb diff --git a/bundles/n2n_ntop_v3/packages/debian/README b/bundles/n2n_ntop_v3/packages/debian/README deleted file mode 100644 index 915a7c15..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/README +++ /dev/null @@ -1,21 +0,0 @@ -Prerequisites -------------- -apt-get install debhelper fakeroot dpkg-sig - -EdgeOS ------- -We need to replace BusyBox-implemented commands using full-fledged commands by doing -(see http://community.ubnt.com/t5/EdgeMAX/ubnt-debian-package-conflict/m-p/421325) - -curl -O http://ftp.us.debian.org/debian/pool/main/c/coreutils/coreutils_8.5-1_mips.deb -dpkg -i --force-all coreutils_8.5-1_mips.deb - -curl -O http://ftp.us.debian.org/debian/pool/main/t/tar/tar_1.23-3_mips.deb -dpkg -i --force-all tar_1.23-3_mips.deb - -wget http://ftp.us.debian.org/debian/pool/main/f/findutils/findutils_4.4.2-4_mips.deb -dpkg -i --force-all findutils_4.4.2-4_mips.deb - -wget http://ftp.us.debian.org/debian/pool/main/g/gzip/gzip_1.5-1.1_mips.deb -dpkg -i --force-all gzip_1.5-1.1_mips.deb - diff --git a/bundles/n2n_ntop_v3/packages/debian/configure.in b/bundles/n2n_ntop_v3/packages/debian/configure.in deleted file mode 100644 index 21ed5af1..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/configure.in +++ /dev/null @@ -1,62 +0,0 @@ -AC_INIT([Makefile.in], 1.0) - -AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X]) - -# NOTE: this file is not actually used. You need to edit configure as well! -N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` -GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2` - -DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l` - -EXTRA_DEP="" -if test $DEBIAN_VERSION = "0"; then -EXTRA_DEP=", libzstd1" -fi - -if test "${EXTN+set}" != set; then - MACHINE=`uname -m` - SHORT_MACHINE=`echo $MACHINE | cut -b1-3` - - if test $MACHINE = "x86_64"; then - EXTN="amd64" - else - if test $SHORT_MACHINE = "aar"; then - EXTN="arm64" - else - if test $SHORT_MACHINE = "arm"; then - EXTN="armhf" - else - if test $SHORT_MACHINE = "mip"; then - EXTN="mips" - else - EXTN="i386" - fi - fi - fi - fi -fi - -if test "${with_edgex+set}" = set; then - EXTN="mipsel" -fi - -APP=n2n -DATE=`date -R` - -AC_SUBST(APP) -AC_SUBST(N2N_VERSION_SHORT) -AC_SUBST(GIT_COMMITS) -AC_SUBST(EXTN) -AC_SUBST(DATE) -AC_SUBST(EXTRA_DEP) - -AC_CONFIG_FILES(debian/changelog) -AC_CONFIG_FILES(debian/files) -AC_CONFIG_FILES(debian/control) -AC_CONFIG_FILES(debian/rules) -AC_CONFIG_FILES(../etc/systemd/system/edge.service) -AC_CONFIG_FILES(../etc/systemd/system/edge@.service) -AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service) -AC_CONFIG_FILES(../etc/systemd/system/supernode.service) -AC_CONFIG_FILES(Makefile) -AC_OUTPUT diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/COPYRIGHT b/bundles/n2n_ntop_v3/packages/debian/debian/COPYRIGHT deleted file mode 100644 index 94a9ed02..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/COPYRIGHT +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/README b/bundles/n2n_ntop_v3/packages/debian/debian/README deleted file mode 100644 index 8d88f8df..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains the files needed to build the package -named 'n2n' for the Debian GNU/Linux distribution. diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/changelog.in b/bundles/n2n_ntop_v3/packages/debian/debian/changelog.in deleted file mode 100644 index 6d4e3dc2..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/changelog.in +++ /dev/null @@ -1,4 +0,0 @@ -@APP@ (@N2N_VERSION_SHORT@-@GIT_COMMITS@) table; urgency=high - * Last packaged version - - -- Luca Deri @DATE@ diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/compat b/bundles/n2n_ntop_v3/packages/debian/debian/compat deleted file mode 100644 index ec635144..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/conffiles b/bundles/n2n_ntop_v3/packages/debian/debian/conffiles deleted file mode 100644 index d467c8b7..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/conffiles +++ /dev/null @@ -1,2 +0,0 @@ -/etc/n2n/edge.conf.sample -/etc/n2n/supernode.conf.sample diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/control.in b/bundles/n2n_ntop_v3/packages/debian/debian/control.in deleted file mode 100644 index 9fe4aada..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/control.in +++ /dev/null @@ -1,25 +0,0 @@ -Source: n2n -Section: net -Priority: extra -Maintainer: Luca Deri -Standards-Version: @N2N_VERSION_SHORT@ -Build-Depends: - -Package: n2n -Architecture: @EXTN@ -Suggests: uml-utilities -Depends: ${shlibs:Depends}, ${misc:Depends} @EXTRA_DEP@ -Conflicts: n2n (<< 2.1.0-1) -Replaces: n2n (<< 2.1.0-1) -Description: a layer-two peer-to-peer virtual private network (VPN) - n2n is a layer-two peer-to-peer virtual private network (VPN) which allows - users to exploit features typical of P2P applications at network instead of - application level. This means that users can gain native IP visibility (e.g. - two PCs belonging to the same n2n network can ping each other) and be - reachable with the same network IP address regardless of the network where - they currently belong. In a nutshell, as OpenVPN moved SSL from application - (e.g. used to implement the https protocol) to network protocol, n2n moves - P2P from application to network level. - . - Edge is the edge node daemon for n2n which creates a TAP interface to expose - the n2n virtual LAN. diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/dirs b/bundles/n2n_ntop_v3/packages/debian/debian/dirs deleted file mode 100644 index 8a9632d0..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/dirs +++ /dev/null @@ -1,3 +0,0 @@ -usr/sbin -etc/systemd -etc/init.d diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/docs b/bundles/n2n_ntop_v3/packages/debian/debian/docs deleted file mode 100644 index e845566c..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/docs +++ /dev/null @@ -1 +0,0 @@ -README diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/files.in b/bundles/n2n_ntop_v3/packages/debian/debian/files.in deleted file mode 100644 index 6128dce3..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/files.in +++ /dev/null @@ -1 +0,0 @@ -n2n_@N2N_VERSION_SHORT@_@EXTN@.deb free optional diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/n2n.substvars b/bundles/n2n_ntop_v3/packages/debian/debian/n2n.substvars deleted file mode 100644 index a5957235..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/n2n.substvars +++ /dev/null @@ -1,2 +0,0 @@ -misc:Depends=debconf (>= 0.5) | debconf-2.0 -misc:Pre-Depends= diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/postinst b/bundles/n2n_ntop_v3/packages/debian/debian/postinst deleted file mode 100644 index 5de13e21..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/postinst +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -e - -case "$1" in - configure) - # continue below - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - exit 0 - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 0 - ;; -esac - -umask 022 - -if ! grep -q n2n /etc/group; then - echo 'Creating n2n group' - /usr/sbin/groupadd -r n2n -fi - -if ! /usr/bin/id -u n2n > /dev/null 2>&1; then - echo "Creating n2n user..." - /usr/sbin/useradd -M -N -g n2n -r -s /bin/false n2n -fi - -echo "Rebuilding ld cache..." -/sbin/ldconfig - -if [ -f /.dockerenv ]; then exit 0; fi - -# Start service after upgrade/install -systemctl daemon-reload -systemctl reset-failed - -# Enable edge -if systemctl -q is-active edge; then - # only restart edge if it's already running - echo "Restarting n2n edge..." - deb-systemd-invoke restart edge -fi - -# Restart specific services if already running -deb-systemd-invoke restart 'edge@*.service' 'edge-ntopng@*.service' - -# Enable supernode -if systemctl -q is-active supernode; then - # only restart supernode if it's already running - echo "Restarting n2n supernode..." - deb-systemd-invoke restart supernode -fi - -exit 0 diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/postrm b/bundles/n2n_ntop_v3/packages/debian/debian/postrm deleted file mode 100644 index ef799a3a..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/postrm +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e - -set -e - -#case "$1" in -# purge|remove) -# -# ;; -#esac - -exit 0 diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/preinst b/bundles/n2n_ntop_v3/packages/debian/debian/preinst deleted file mode 100644 index 4e7a80dc..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/preinst +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh -# preinst script for n2n -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `install' -# * `install' -# * `upgrade' -# * `abort-upgrade' - -case "$1" in - install|upgrade) - ;; - - abort-upgrade) - ;; - - *) - echo "preinst called with unknown argument \`$1'" >&2 - exit 0 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - - -exit 0 diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/prerm b/bundles/n2n_ntop_v3/packages/debian/debian/prerm deleted file mode 100644 index 9e4e53d7..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/prerm +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -set -e - -if [ -f /.dockerenv ]; then exit 0; fi - -. /usr/share/debconf/confmodule - -if [ "$1" = "remove" ]; then - deb-systemd-invoke stop edge.service 'edge@*.service' 'edge-ntopng@*.service' - deb-systemd-invoke disable edge.service 'edge@*.service' 'edge-ntopng@*.service' - deb-systemd-invoke stop supernode.service - deb-systemd-invoke disable supernode.service - systemctl daemon-reload - systemctl reset-failed -fi - -exit 0 diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/rules.in b/bundles/n2n_ntop_v3/packages/debian/debian/rules.in deleted file mode 100644 index 4e879b91..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/rules.in +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/make -f - -# Uncomment this to turn on verbose mode. -# export DH_VERBOSE=1 - -# -# debian/compat -# We should use at least compatibility version 5 -# but this requires the whole building process -# to be remade and this is something we leave -# to when we will have more time -# http://www.tin.org/bin/man.cgi?section=7&topic=debhelper -# - -package=@APP@ - -build: build-stamp -build-stamp: - dh_testdir - -clean: - dh_testdir - dh_testroot - dh_clean - -install: build - dh_testdir - dh_testroot - dh_prep - dh_installdirs - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_prep - dh_installdirs - dh_installinit - dh_installdebconf - dh_installman - dh_strip - dh_compress - dh_fixperms - dh_installdeb - cp -r n2n debian - cp -r ../etc debian/n2n - find debian/n2n -name "*.in" -exec /bin/rm {} ';' - find debian/n2n -name "*~" -exec /bin/rm {} ';' - dh_link - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff --git a/bundles/n2n_ntop_v3/packages/debian/debian/templates b/bundles/n2n_ntop_v3/packages/debian/debian/templates deleted file mode 100644 index 4f354077..00000000 --- a/bundles/n2n_ntop_v3/packages/debian/debian/templates +++ /dev/null @@ -1,7 +0,0 @@ -Template: n2n/license_expired_continue_installation -Type: boolean -Default: true -Description: Do you want to continue with the installation? - License found is not valid for the new package that is going to be installed. - . - Renew the maintenance to get a valid license for the new package or cancel the installation to continue using the current package. diff --git a/bundles/n2n_ntop_v3/packages/etc/n2n/edge.conf.sample b/bundles/n2n_ntop_v3/packages/etc/n2n/edge.conf.sample deleted file mode 100644 index 74d50a8f..00000000 --- a/bundles/n2n_ntop_v3/packages/etc/n2n/edge.conf.sample +++ /dev/null @@ -1,41 +0,0 @@ -# -# The configuration file is similar to the command line, with one option per line. An equal -# sign '=' should be used between key and value. Example: -c=mynetwork or --community=mynetwork -# This file contains a basic configuration example, please refer to the help (-h) for the full -# list of available options. -# -# -d|--tun-device -# Specifies the name of the TUN interface. -# --d=n2n0 -# -# -c|--community -# Specifies the n2n community name the edge belongs to. -# --c=mynetwork -# -# -k -# Sets the encryption key (ASCII). The environment variable N2N_KEY= can also be used. -# --k=mypassword -# -# -m -# Specified the MAC address for the TAP interface (random otherwise). -# -# -m=DE:AD:BE:EF:99:99 -# -# -a -# Sets the interface address. For DHCP use '-r -a dhcp:0.0.0.0'. -# --a=1.2.3.4 -# -# -p -# Sets the local UDP port to a fixed port. -# --p=50001 -# -# -l|--supernode-list -# Specifies the supernode IP and port. -# --l=7.8.9.0:7777 -# diff --git a/bundles/n2n_ntop_v3/packages/etc/n2n/supernode.conf.sample b/bundles/n2n_ntop_v3/packages/etc/n2n/supernode.conf.sample deleted file mode 100644 index 35757947..00000000 --- a/bundles/n2n_ntop_v3/packages/etc/n2n/supernode.conf.sample +++ /dev/null @@ -1,15 +0,0 @@ -# -# The configuration file is similar to the command line, with one option per line. An equal -# sign '=' should be used between key and value. Example: -p=7777 -# This file contains a basic configuration example, please refer to the help (-h) for the full -# list of available options. -# -# -p -# Sets the UDP listening port. -# --p=7777 -# -# -c -# Optionally specifies the allowed communities as listed in community.list file. -# -# -c=community.list diff --git a/bundles/n2n_ntop_v3/packages/etc/systemd/system/edge-ntopng@.service.in b/bundles/n2n_ntop_v3/packages/etc/systemd/system/edge-ntopng@.service.in deleted file mode 100644 index 5299d227..00000000 --- a/bundles/n2n_ntop_v3/packages/etc/systemd/system/edge-ntopng@.service.in +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=n2n edge process, on %I -After=network-online.target syslog.target -Wants=network-online.target -BindsTo=ntopng.service - -[Service] -Type=simple -ExecStartPre= -ExecStart=/usr/sbin/edge /etc/n2n/edge-%i.conf -f -Restart=on-abnormal -RestartSec=5 - -[Install] -WantedBy=ntopng.service -Alias= diff --git a/bundles/n2n_ntop_v3/packages/etc/systemd/system/edge.service.in b/bundles/n2n_ntop_v3/packages/etc/systemd/system/edge.service.in deleted file mode 100644 index 32f0d79d..00000000 --- a/bundles/n2n_ntop_v3/packages/etc/systemd/system/edge.service.in +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=n2n edge process -After=network-online.target syslog.target nfw.target -Wants=network-online.target - -[Service] -Type=simple -ExecStartPre= -ExecStart=/usr/sbin/edge /etc/n2n/edge.conf -f -Restart=on-abnormal -RestartSec=5 - -[Install] -WantedBy=multi-user.target -Alias= diff --git a/bundles/n2n_ntop_v3/packages/etc/systemd/system/edge@.service.in b/bundles/n2n_ntop_v3/packages/etc/systemd/system/edge@.service.in deleted file mode 100644 index d9123452..00000000 --- a/bundles/n2n_ntop_v3/packages/etc/systemd/system/edge@.service.in +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=n2n edge process, on %I -After=network-online.target syslog.target nfw.target -Wants=network-online.target - -[Service] -Type=simple -ExecStartPre= -ExecStart=/usr/sbin/edge /etc/n2n/edge-%i.conf -f -Restart=on-abnormal -RestartSec=5 - -[Install] -WantedBy=multi-user.target -Alias= diff --git a/bundles/n2n_ntop_v3/packages/etc/systemd/system/supernode.service.in b/bundles/n2n_ntop_v3/packages/etc/systemd/system/supernode.service.in deleted file mode 100644 index 73e3d758..00000000 --- a/bundles/n2n_ntop_v3/packages/etc/systemd/system/supernode.service.in +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=n2n supernode process -After=network-online.target syslog.target -Wants=network-online.target - -[Service] -Type=simple -User=n2n -Group=n2n -ExecStart=/usr/sbin/supernode /etc/n2n/supernode.conf -f -Restart=on-abnormal -RestartSec=5 - -[Install] -WantedBy=multi-user.target -Alias= diff --git a/bundles/n2n_ntop_v3/packages/openwrt/Makefile b/bundles/n2n_ntop_v3/packages/openwrt/Makefile deleted file mode 100644 index 719a4fa5..00000000 --- a/bundles/n2n_ntop_v3/packages/openwrt/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright (C) 2021 - ntop.org and contributors -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=n2n -PKG_SOURCE_URL:=https://github.com/ntop/n2n.git -PKG_SOURCE_VERSION:=6937640a2bc24832af7fc4ed1658d6aef192f03b -PKG_VERSION:=2.9.0_dev_git$(PKG_SOURCE_VERSION) -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_PROTO:=git - -PKG_MAINTAINER:=Emanuele Faranda -PKG_LICENSE:=GPL3 -PKG_BUILD_PARALLEL:=1 - -# autogen fix -PKG_FIXUP:=autoreconf - -include $(INCLUDE_DIR)/package.mk - -define Package/n2n/Default - SECTION:=net - CATEGORY:=Network - TITLE:=N2N Peer-to-peer VPN - URL:=http://www.ntop.org/n2n - SUBMENU:=VPN - DEPENDS+=+libcap -endef - -define Package/n2n-edge - $(call Package/n2n/Default) - TITLE+= client (edge node) - DEPENDS+=+kmod-tun -endef - -define Package/n2n-supernode - $(call Package/n2n/Default) - TITLE+= server (supernode) -endef - -define Package/n2n-edge/description -The client node for the N2N infrastructure -endef - -define Package/n2n-supernode/description -The supernode for the N2N infrastructure -endef - -define Build/Configure - ( cd $(PKG_BUILD_DIR); ./autogen.sh ) - $(call Build/Configure/Default) -endef - -define Package/n2n-edge/conffiles -/etc/n2n/edge.conf -endef - -define Package/n2n-edge/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/edge $(1)/usr/bin/ - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) $(PKG_BUILD_DIR)/packages/openwrt/etc/init.d/edge $(1)/etc/init.d/edge - $(INSTALL_DIR) $(1)/etc/n2n - $(INSTALL_CONF) $(PKG_BUILD_DIR)/packages/etc/n2n/edge.conf.sample $(1)/etc/n2n/edge.conf -endef - -define Package/n2n-supernode/conffiles -/etc/n2n/supernode.conf -endef - -define Package/n2n-supernode/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/supernode $(1)/usr/bin/ - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) $(PKG_BUILD_DIR)/packages/openwrt/etc/init.d/supernode $(1)/etc/init.d/supernode - $(INSTALL_DIR) $(1)/etc/n2n - $(INSTALL_CONF) $(PKG_BUILD_DIR)/packages/etc/n2n/supernode.conf.sample $(1)/etc/n2n/supernode.conf -endef - -$(eval $(call BuildPackage,n2n-edge)) -$(eval $(call BuildPackage,n2n-supernode)) diff --git a/bundles/n2n_ntop_v3/packages/openwrt/README.md b/bundles/n2n_ntop_v3/packages/openwrt/README.md deleted file mode 100644 index 44b229fe..00000000 --- a/bundles/n2n_ntop_v3/packages/openwrt/README.md +++ /dev/null @@ -1,39 +0,0 @@ -## Prerequisites - -This instructions explain how to build an OpenWRT .ipk package for n2n. - -Before going on, it is required to have a working cross-compiling build -environment for the OpenWRT version installed into your device. This usually -comes down to the following steps: - -1. Download and extract the SDK toolchain for your device. The toolchain - must match the *exact* OpenWRT version installed in your device. Toolchain - for official OpenWRT images can be downloaded from https://downloads.openwrt.org - -2. Build the toolchain: run `make menuconfig`, save the configuration, then - run `make` to build the cross compiling tools - -3. Download the feeds with `./scripts/feeds update -a` - -## Compilation - -From the OpenWRT build directory: - -``` -git clone https://github.com/ntop/n2n n2n -cp -r n2n/packages/openwrt package/n2n -make menuconfig # select Network -> VPN -> n2n-edge and n2n-supernode -make package/n2n/compile V=s -``` - -If everything went fine, two ipk will be generated, one for the n2n-edge -and the other for n2n-supernode. They can be found with `find . -name "n2n*.ipk"`, -copied to the target device, and installed with `opkg install`. - -## Configuration - -The edge node can be started with `/etc/init.d/edge start`. -Its configuration file is `/etc/n2n/edge.conf`. - -The supernode can be started with `/etc/init.d/supernode start`. -Its configuration file is `/etc/n2n/supernode.conf`. diff --git a/bundles/n2n_ntop_v3/packages/openwrt/patches/001-fix-cc.patch b/bundles/n2n_ntop_v3/packages/openwrt/patches/001-fix-cc.patch deleted file mode 100644 index c0d10737..00000000 --- a/bundles/n2n_ntop_v3/packages/openwrt/patches/001-fix-cc.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/configure.seed -+++ b/configure.seed -@@ -13,8 +13,6 @@ - GIT_RELEASE=${N2N_VERSION_SHORT} - fi - --CC=gcc --AR=ar - N2N_LIBS= - - AC_PROG_CC diff --git a/bundles/n2n_ntop_v3/packages/rpm/Makefile.in b/bundles/n2n_ntop_v3/packages/rpm/Makefile.in deleted file mode 100644 index 68585a5b..00000000 --- a/bundles/n2n_ntop_v3/packages/rpm/Makefile.in +++ /dev/null @@ -1,26 +0,0 @@ -# -# Change it according to your setup -# -N2N_HOME=$(PWD)/../.. -N2N_BUILD=${N2N_HOME}/packages/debian/n2n -PLATFORM=@MACHINE@ -RPM_PKG=n2n-@N2N_VERSION_SHORT@-@GIT_COMMITS@.$(PLATFORM).rpm - -all: clean pkg - -pkg: - rpmbuild -bb ./n2n.spec - -@@RPM_SIGN_CMD@ $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG) - @echo "" - @echo "Package contents:" - @rpm -qpl $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG) - @echo "The package is now available in $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG)" - -distclean: - echo "dummy distclean" - -install: - echo "dummy install" - -clean: - rm -rf *~ *rpm diff --git a/bundles/n2n_ntop_v3/packages/rpm/configure.in b/bundles/n2n_ntop_v3/packages/rpm/configure.in deleted file mode 100644 index cce9205b..00000000 --- a/bundles/n2n_ntop_v3/packages/rpm/configure.in +++ /dev/null @@ -1,58 +0,0 @@ -AC_INIT([Makefile.in], 1.0) - -# NOTE: this file is not actually used. You need to edit configure as well! -N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` -GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2` - -MACHINE=`uname -m` -SHORT_MACHINE=`uname -m | cut -b1-3` - -if test $MACHINE = "x86_64"; then - EXTN="amd64" -else - if test $SHORT_MACHINE = "aar"; then - EXTN="arm64" - EXTRA_DEPS="" - else - if test $SHORT_MACHINE = "arm"; then - EXTN="armhf" - EXTRA_DEPS="" - else - if test $SHORT_MACHINE = "mip"; then - EXTN="mips" - EXTRA_DEPS="" - else - EXTN="i386" - fi - fi - fi -fi - -APP=n2n -DATE=`date -R` - -CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 3|cut -d '.' -f 1` -if test $CENTOS_RELEASE = "release"; then - CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 4|cut -d '.' -f 1` -fi - -RPM_SIGN_CMD="rpm --addsign" -if test "$CENTOS_RELEASE" -ne 8; then - RPM_SIGN_CMD="./rpm-sign.exp" -fi - -AC_SUBST(APP) -AC_SUBST(MACHINE) -AC_SUBST(N2N_VERSION_SHORT) -AC_SUBST(GIT_COMMITS) -AC_SUBST(EXTN) -AC_SUBST(DATE) -AC_SUBST(RPM_SIGN_CMD) - -AC_CONFIG_FILES(n2n.spec) -AC_CONFIG_FILES(../etc/systemd/system/edge.service) -AC_CONFIG_FILES(../etc/systemd/system/edge@.service) -AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service) -AC_CONFIG_FILES(../etc/systemd/system/supernode.service) -AC_CONFIG_FILES(Makefile) -AC_OUTPUT diff --git a/bundles/n2n_ntop_v3/packages/rpm/n2n.spec.in b/bundles/n2n_ntop_v3/packages/rpm/n2n.spec.in deleted file mode 100644 index 8448ab49..00000000 --- a/bundles/n2n_ntop_v3/packages/rpm/n2n.spec.in +++ /dev/null @@ -1,107 +0,0 @@ -Summary: n2n peer-to-peer VPN -Name: n2n -Version: @N2N_VERSION_SHORT@ -Release: @GIT_COMMITS@ -License: GPL -Group: Networking/Utilities -URL: http://www.ntop.org/ -Source: n2n-%{version}.tgz -Packager: Luca Deri -# Temporary location where the RPM will be built -BuildRoot: %{_tmppath}/%{name}-%{version}-root -Requires: libzstd - -# Make sure .build-id is not part of the package -%define _build_id_links none - -%description -n2n peer-to-peer VPN - -%prep - -%build - -mkdir -p $RPM_BUILD_ROOT/usr/sbin $RPM_BUILD_ROOT/usr/share/man/man1 $RPM_BUILD_ROOT/usr/share/man/man7 $RPM_BUILD_ROOT/usr/share/man/man8 -mkdir -p $RPM_BUILD_ROOT/etc/n2n -mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/ -cp $HOME/n2n/edge $RPM_BUILD_ROOT/usr/sbin -cp $HOME/n2n/supernode $RPM_BUILD_ROOT/usr/sbin -cp $HOME/n2n/n2n.7.gz $RPM_BUILD_ROOT/usr/share/man/man7 -cp $HOME/n2n/supernode.1.gz $RPM_BUILD_ROOT/usr/share/man/man1 -cp $HOME/n2n/edge.8.gz $RPM_BUILD_ROOT/usr/share/man/man8 -cp $HOME/n2n/packages/etc/systemd/system/*.service $RPM_BUILD_ROOT/usr/lib/systemd/system/ -cp $HOME/n2n/packages/etc/n2n/*.conf.sample $RPM_BUILD_ROOT/etc/n2n - -find $RPM_BUILD_ROOT -name ".git" | xargs /bin/rm -rf -find $RPM_BUILD_ROOT -name ".svn" | xargs /bin/rm -rf -find $RPM_BUILD_ROOT -name "*~" | xargs /bin/rm -f -# -DST=$RPM_BUILD_ROOT/usr/n2n -SRC=$RPM_BUILD_DIR/%{name}-%{version} -#mkdir -p $DST/conf -# Clean out our build directory -%clean -rm -fr $RPM_BUILD_ROOT - -%files -/usr/sbin/edge -/usr/sbin/supernode -/usr/share/man/man7/n2n.7.gz -/usr/share/man/man1/supernode.1.gz -/usr/share/man/man8/edge.8.gz -/usr/lib/systemd/system/edge.service -/usr/lib/systemd/system/edge@.service -/usr/lib/systemd/system/edge-ntopng@.service -/usr/lib/systemd/system/supernode.service -%config(noreplace) /etc/n2n/supernode.conf.sample -%config(noreplace) /etc/n2n/edge.conf.sample - -# Set the default attributes of all of the files specified to have an -# owner and group of root and to inherit the permissions of the file -# itself. -%defattr(-, root, root) - -%changelog -* Fri Aug 17 2018 Luca Deri 1.0 -- Current package version - -# Execution order: -# install: pre -> (copy) -> post -# upgrade: pre -> (copy) -> post -> preun (old) -> (delete old) -> postun (old) -# un-install: preun -> (delete) -> postun - -%pre - -if ! grep -q n2n /etc/group; then - echo 'Creating n2n group' - /usr/sbin/groupadd -r n2n -fi - -if ! /usr/bin/id -u n2n > /dev/null 2>&1; then - echo 'Creating n2n user' - /usr/sbin/useradd -M -N -g n2n -r -s /bin/false n2n -fi - -%post -if [ -f /bin/systemctl ]; then - if [ ! -f /.dockerenv ]; then - /bin/systemctl daemon-reload - # NOTE: do not enable any services during first installation - fi -fi - -%preun -if [ -f /bin/systemctl ]; then - if [ ! -f /.dockerenv ]; then - # possibly remove the installed services - %systemd_preun supernode.service edge.service 'edge-ntopng@*.service' 'edge@*.service' - fi -fi - -%postun -if [ -f /bin/systemctl ]; then - if [ ! -f /.dockerenv ]; then - # possibly restart the running services - %systemd_postun_with_restart supernode.service edge.service 'edge-ntopng@*.service' 'edge@*.service' - fi -fi diff --git a/bundles/n2n_ntop_v3/packages/rpm/rpm-sign.exp b/bundles/n2n_ntop_v3/packages/rpm/rpm-sign.exp deleted file mode 100644 index 7a0f88af..00000000 --- a/bundles/n2n_ntop_v3/packages/rpm/rpm-sign.exp +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/expect -f - -### rpm-sign.exp -- Sign RPMs by sending the passphrase. - -spawn rpm --addsign {*}$argv - expect -exact "Enter pass phrase: " - send -- "\r" - expect eof - -## end of rpm-sign.exp diff --git a/bundles/n2n_ntop_v3/packages/ubuntu b/bundles/n2n_ntop_v3/packages/ubuntu deleted file mode 100644 index b2f7fd3e..00000000 --- a/bundles/n2n_ntop_v3/packages/ubuntu +++ /dev/null @@ -1 +0,0 @@ -debian \ No newline at end of file diff --git a/bundles/n2n_ntop_v3/scripts/README.md b/bundles/n2n_ntop_v3/scripts/README.md deleted file mode 100644 index 380fa3c3..00000000 --- a/bundles/n2n_ntop_v3/scripts/README.md +++ /dev/null @@ -1,9 +0,0 @@ -This directory contains executables that are not compiled. Some of these may -end up installed for use by end users, but many of them are for use during -development, builds and tests. - -Nothing in this directory should need compiling to use and they should be -written such that they do not need configuring (e.g: they might probe several -directories for their requirements) - -See the [Scripts Documentation](../docs/Scripts.md) for further details diff --git a/bundles/n2n_ntop_v3/scripts/hack_fakeautoconf.sh b/bundles/n2n_ntop_v3/scripts/hack_fakeautoconf.sh deleted file mode 100644 index 8ec8c825..00000000 --- a/bundles/n2n_ntop_v3/scripts/hack_fakeautoconf.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# Specifically for windows, where installing autoconf looks suspiciously -# like boiling the ocean. - -sed \ - -e "s%@N2N_VERSION_SHORT@%FIXME%g" \ - -e "s%@GIT_COMMITS@%FIXME%g" \ - -e "s%@CC@%gcc%g" \ - -e "s%@AR@%ar%g" \ - -e "s%@CFLAGS@%$CFLAGS%g" \ - -e "s%@LDFLAGS@%$LDFLAGS%g" \ - -e "s%@N2N_LIBS@%$LDLIBS%g" \ - < Makefile.in > Makefile - -sed \ - -e "s%@ADDITIONAL_TOOLS@%%g" \ - < tools/Makefile.in > tools/Makefile - -cat <include/config.h -#define PACKAGE_VERSION "FIXME" -#define PACKAGE_OSNAME "FIXME" -#define GIT_RELEASE "FIXME" -EOF diff --git a/bundles/n2n_ntop_v3/scripts/indent.sh b/bundles/n2n_ntop_v3/scripts/indent.sh deleted file mode 100644 index 50d38bac..00000000 --- a/bundles/n2n_ntop_v3/scripts/indent.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# -# Given one or more input source files, run a re-indenter on them. - -help() { - echo "Usage: scripts/indent [-i] [file...]" - echo " -i modify file in place with reindent results" - echo "" - echo "By default, will output a diff and exitcode if changed are needed" - echo "If modifying files, no exit code or diff is output" - exit 1 -} - -[ -z "$1" ] && help -[ "$1" = "-h" ] && help - -INPLACE=0 -if [ "$1" = "-i" ]; then - shift - INPLACE=1 -fi - -## indentOneClang() { -## rm -f "$1.indent" -## clang-format "$1" >"$1.indent" -## if [ $? -ne 0 ]; then -## echo "Error while formatting \"$1\"" -## RESULT=1 -## return -## fi -## diff -u "$1" "$1.indent" -## if [ $? -ne 0 ]; then -## RESULT=1 -## fi -## } - -indentOne() { - IFILE="$1" - if [ "$INPLACE" -eq 0 ]; then - OFILE="$1.indent" - rm -f "$OFILE" - else - OFILE="$1" - fi - if ! uncrustify -c uncrustify.cfg -f "$IFILE" -o "$OFILE"; then - echo "Error while formatting \"$1\"" - RESULT=1 - return - fi - if ! diff -u "$IFILE" "$OFILE"; then - RESULT=1 - fi -} - -RESULT=0 -while [ -n "$1" ]; do - indentOne "$1" - shift -done -exit $RESULT diff --git a/bundles/n2n_ntop_v3/scripts/n2n-ctl b/bundles/n2n_ntop_v3/scripts/n2n-ctl deleted file mode 100644 index ab59f362..00000000 --- a/bundles/n2n_ntop_v3/scripts/n2n-ctl +++ /dev/null @@ -1,253 +0,0 @@ -#!/usr/bin/env python3 -# Licensed under GPLv3 -# -# Simple script to query the management interface of a running n2n edge node - -import argparse -import socket -import json -import collections - - -class JsonUDP(): - """encapsulate communication with the edge""" - - def __init__(self, port): - self.address = "127.0.0.1" - self.port = port - self.tag = 0 - self.key = None - self.debug = False - self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - self.sock.settimeout(1) - - def _next_tag(self): - tagstr = str(self.tag) - self.tag = (self.tag + 1) % 1000 - return tagstr - - def _cmdstr(self, msgtype, cmdline): - """Create the full command string to send""" - tagstr = self._next_tag() - - options = [tagstr] - if self.key is not None: - options += ['1'] # Flags set for auth key field - options += [self.key] - optionsstr = ':'.join(options) - - return tagstr, ' '.join((msgtype, optionsstr, cmdline)) - - def _rx(self, tagstr): - """Wait for rx packets""" - - # TODO: there are no timeouts with any of the recv calls - data, _ = self.sock.recvfrom(1024) - data = json.loads(data.decode('utf8')) - - # TODO: We assume the first packet we get will be tagged for us - # and be either an "error" or a "begin" - assert(data['_tag'] == tagstr) - - if data['_type'] == 'error': - raise ValueError('Error: {}'.format(data['error'])) - - assert(data['_type'] == 'begin') - - # Ideally, we would confirm that this is our "begin", but that - # would need the cmd passed into this method, and that would - # probably require parsing the cmdline passed to us :-( - # assert(data['cmd'] == cmd) - - result = list() - error = None - - while True: - data, _ = self.sock.recvfrom(1024) - data = json.loads(data.decode('utf8')) - - if data['_tag'] != tagstr: - # this packet is not for us, ignore it - continue - - if data['_type'] == 'error': - # we still expect an end packet, so save the error - error = ValueError('Error: {}'.format(data['error'])) - continue - - if data['_type'] == 'end': - if error: - raise error - return result - - if data['_type'] != 'row': - raise ValueError('Unknown data type {} from ' - 'edge'.format(data['_type'])) - - # remove our boring metadata - del data['_tag'] - del data['_type'] - - if self.debug: - print(data) - - result.append(data) - - def _call(self, msgtype, cmdline): - """Perform a rpc call""" - tagstr, msgstr = self._cmdstr(msgtype, cmdline) - self.sock.sendto(msgstr.encode('utf8'), (self.address, self.port)) - return self._rx(tagstr) - - def read(self, cmdline): - return self._call('r', cmdline) - - def write(self, cmdline): - return self._call('w', cmdline) - - -def str_table(rows, columns): - """Given an array of dicts, do a simple table print""" - result = list() - widths = collections.defaultdict(lambda: 0) - - if len(rows) == 0: - # No data to show, be sure not to truncate the column headings - for col in columns: - widths[col] = len(col) - else: - for row in rows: - for col in columns: - if col in row: - widths[col] = max(widths[col], len(str(row[col]))) - - for col in columns: - if widths[col] == 0: - widths[col] = 1 - result += "{:{}.{}} ".format(col, widths[col], widths[col]) - result += "\n" - - for row in rows: - for col in columns: - if col in row: - data = row[col] - else: - data = '' - result += "{:{}} ".format(data, widths[col]) - result += "\n" - - return ''.join(result) - - -def subcmd_show_supernodes(rpc, args): - rows = rpc.read('supernodes') - columns = [ - 'version', - 'current', - 'macaddr', - 'sockaddr', - 'uptime', - ] - - return str_table(rows, columns) - - -def subcmd_show_edges(rpc, args): - rows = rpc.read('edges') - columns = [ - 'mode', - 'ip4addr', - 'macaddr', - 'sockaddr', - 'desc', - ] - - return str_table(rows, columns) - - -def subcmd_show_help(rpc, args): - result = 'Commands with pretty-printed output:\n\n' - for name, cmd in subcmds.items(): - result += "{:12} {}\n".format(name, cmd['help']) - - result += "\n" - result += "Possble remote commands:\n" - result += "(those without a pretty-printer will pass-through)\n\n" - rows = rpc.read('help') - for row in rows: - result += "{:12} {}\n".format(row['cmd'], row['help']) - return result - - -subcmds = { - 'help': { - 'func': subcmd_show_help, - 'help': 'Show available commands', - }, - 'supernodes': { - 'func': subcmd_show_supernodes, - 'help': 'Show the list of supernodes', - }, - 'edges': { - 'func': subcmd_show_edges, - 'help': 'Show the list of edges/peers', - }, -} - - -def subcmd_default(rpc, args): - """Just pass command through to edge""" - cmdline = ' '.join([args.cmd] + args.args) - if args.write: - rows = rpc.write(cmdline) - else: - rows = rpc.read(cmdline) - return json.dumps(rows, sort_keys=True, indent=4) - - -def main(): - ap = argparse.ArgumentParser( - description='Query the running local n2n edge') - ap.add_argument('-t', '--mgmtport', action='store', default=5644, - help='Management Port (default=5644)', type=int) - ap.add_argument('-k', '--key', action='store', - help='Password for mgmt commands') - ap.add_argument('-d', '--debug', action='store_true', - help='Also show raw internal data') - ap.add_argument('--raw', action='store_true', - help='Force cmd to avoid any pretty printing') - - group = ap.add_mutually_exclusive_group() - group.add_argument('--read', action='store_true', - help='Make a read request (default)') - group.add_argument('--write', action='store_true', - help='Make a write request (only to non pretty' - 'printed cmds)') - - ap.add_argument('cmd', action='store', - help='Command to run (try "help" for list)') - ap.add_argument('args', action='store', nargs="*", - help='Optional args for the command') - - args = ap.parse_args() - - if args.raw or (args.cmd not in subcmds): - func = subcmd_default - else: - func = subcmds[args.cmd]['func'] - - rpc = JsonUDP(args.mgmtport) - rpc.debug = args.debug - rpc.key = args.key - - try: - result = func(rpc, args) - except socket.timeout as e: - print(e) - exit(1) - - print(result) - - -if __name__ == '__main__': - main() diff --git a/bundles/n2n_ntop_v3/scripts/n2n-gateway.sh b/bundles/n2n_ntop_v3/scripts/n2n-gateway.sh deleted file mode 100644 index 0990d3a3..00000000 --- a/bundles/n2n_ntop_v3/scripts/n2n-gateway.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# -# This is a sample script to route all the host traffic towards a remote -# gateway, which is reacheable via the n2n virtual interface. -# -# This assumes the n2n connection is already been established and the -# VPN gateway can be pinged by this host. -# - -####################################################### -# CONFIG -####################################################### - -# The IP address of the gateway through the n2n interface -N2N_GATEWAY="192.168.100.1" - -# The IP address of the supernode as configured in n2n -N2N_SUPERNODE="1.2.3.4" - -# The n2n interface name -N2N_INTERFACE="n2n0" - -# The DNS server to use. Must be a public DNS or a DNS located on the -# N2N virtual network, otherwise DNS query information will be leaked -# outside the VPN. -DNS_SERVER="8.8.8.8" - -####################################################### -# END CONFIG -####################################################### - -if [[ $UID -ne 0 ]]; then - echo "This script must be run as root" - exit 1 -fi - -if ! ip route get $N2N_GATEWAY | grep -q $N2N_INTERFACE ; then - echo "Cannot reach the gateway ($N2N_GATEWAY) via $N2N_INTERFACE. Is edge running?" - exit 1 -fi - -# Determine the current internet gateway -internet_gateway=$(ip route get 8.8.8.8 | head -n1 | awk '{ print $3 }') - -# Backup the DNS resolver configuration and use the specified server -cp /etc/resolv.conf /etc/resolv.conf.my_bak -echo "Using DNS server $DNS_SERVER" -echo "nameserver $DNS_SERVER" > /etc/resolv.conf - -# The public IP of the supernode must be reachable via the internet gateway -# Whereas all the other traffic will go through the new VPN gateway. -ip route add $N2N_SUPERNODE via "$internet_gateway" -ip route del default -echo "Forwarding traffic via $N2N_GATEWAY" -ip route add default via $N2N_GATEWAY - -function stopService { - echo "Deleting custom routes" - ip route del default - ip route del $N2N_SUPERNODE via "$internet_gateway" - - echo "Restoring original gateway $internet_gateway" - ip route add default via "$internet_gateway" - - echo "Restoring original DNS" - mv /etc/resolv.conf.my_bak /etc/resolv.conf - - exit 0 -} - -# setup signal handlers -trap "stopService" SIGHUP SIGINT SIGTERM - -# enter wait loop -echo "VPN is now up" -while :; do sleep 300; done diff --git a/bundles/n2n_ntop_v3/scripts/n2n-httpd b/bundles/n2n_ntop_v3/scripts/n2n-httpd deleted file mode 100644 index 9211915a..00000000 --- a/bundles/n2n_ntop_v3/scripts/n2n-httpd +++ /dev/null @@ -1,543 +0,0 @@ -#!/usr/bin/env python3 -# Licensed under GPLv3 -# -# Simple http server to allow user control of n2n edge nodes -# -# Currently only for demonstration -# - needs nicer looking html written -# - needs more json interfaces in edge -# -# Try it out with -# http://localhost:8080/ -# http://localhost:8080/edge/edges -# http://localhost:8080/edge/supernodes - -import argparse -import socket -import json -import socketserver -import http.server -import signal -import functools -import base64 - -from http import HTTPStatus - - -class JsonUDP(): - """encapsulate communication with the edge""" - - def __init__(self, port): - self.address = "127.0.0.1" - self.port = port - self.tag = 0 - self.key = None - self.debug = False - self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - self.sock.settimeout(1) - - def _next_tag(self): - tagstr = str(self.tag) - self.tag = (self.tag + 1) % 1000 - return tagstr - - def _cmdstr(self, msgtype, cmdline): - """Create the full command string to send""" - tagstr = self._next_tag() - - options = [tagstr] - if self.key is not None: - options += ['1'] # Flags set for auth key field - options += [self.key] - optionsstr = ':'.join(options) - - return tagstr, ' '.join((msgtype, optionsstr, cmdline)) - - def _rx(self, tagstr): - """Wait for rx packets""" - - # TODO: there are no timeouts with any of the recv calls - data, _ = self.sock.recvfrom(1024) - data = json.loads(data.decode('utf8')) - - # TODO: We assume the first packet we get will be tagged for us - # and be either an "error" or a "begin" - assert(data['_tag'] == tagstr) - - if data['_type'] == 'error': - raise ValueError('Error: {}'.format(data['error'])) - - assert(data['_type'] == 'begin') - - # Ideally, we would confirm that this is our "begin", but that - # would need the cmd passed into this method, and that would - # probably require parsing the cmdline passed to us :-( - # assert(data['cmd'] == cmd) - - result = list() - error = None - - while True: - data, _ = self.sock.recvfrom(1024) - data = json.loads(data.decode('utf8')) - - if data['_tag'] != tagstr: - # this packet is not for us, ignore it - continue - - if data['_type'] == 'error': - # we still expect an end packet, so save the error - error = ValueError('Error: {}'.format(data['error'])) - continue - - if data['_type'] == 'end': - if error: - raise error - return result - - if data['_type'] != 'row': - raise ValueError('Unknown data type {} from ' - 'edge'.format(data['_type'])) - - # remove our boring metadata - del data['_tag'] - del data['_type'] - - if self.debug: - print(data) - - result.append(data) - - def _call(self, msgtype, cmdline): - """Perform a rpc call""" - tagstr, msgstr = self._cmdstr(msgtype, cmdline) - self.sock.sendto(msgstr.encode('utf8'), (self.address, self.port)) - return self._rx(tagstr) - - def read(self, cmdline): - return self._call('r', cmdline) - - def write(self, cmdline): - return self._call('w', cmdline) - - -pages = { - "/script.js": { - "content_type": "text/javascript", - "content": """ -var verbose=-1; - -function rows2verbose(id, unused, data) { - row0 = data[0] - verbose = row0['traceLevel'] - - let div = document.getElementById(id); - div.innerHTML=verbose -} - -function rows2keyvalue(id, keys, data) { - let s = "" - data.forEach((row) => { - keys.forEach((key) => { - if (key in row) { - s += "
" + key + "" + row[key]; - } - }); - }); - - s += "
" - let div = document.getElementById(id); - div.innerHTML=s -} - -function rows2keyvalueall(id, unused, data) { - let s = "" - data.forEach((row) => { - Object.keys(row).forEach((key) => { - s += "
" + key + "" + row[key]; - }); - }); - - s += "
" - let div = document.getElementById(id); - div.innerHTML=s -} - -function rows2table(id, columns, data) { - let s = "" - s += "" - columns.forEach((col) => { - s += "" - columns.forEach((col) => { - val = row[col] - if (typeof val === "undefined") { - val = '' - } - s += "
" + col - }); - data.forEach((row) => { - s += "
" + val - }); - }); - - s += "
" - let div = document.getElementById(id); - div.innerHTML=s -} - -function do_get(url, id, handler, handler_param) { - fetch(url) - .then(function (response) { - if (!response.ok) { - throw new Error('Fetch got ' + response.status) - } - return response.json(); - }) - .then(function (data) { - handler(id,handler_param,data); - - // update the timestamp on success - let now = Math.round(new Date().getTime() / 1000); - let time = document.getElementById('time'); - time.innerHTML=now; - }) - .catch(function (err) { - console.log('error: ' + err); - }); -} - -function do_post(url, body, id, handler, handler_param) { - fetch(url, {method:'POST', body: body}) - .then(function (response) { - if (!response.ok) { - throw new Error('Fetch got ' + response.status) - } - return response.json(); - }) - .then(function (data) { - handler(id,handler_param,data); - }) - .catch(function (err) { - console.log('error: ' + err); - }); -} - -function do_stop(tracelevel) { - // FIXME: uses global in script library - fetch(nodetype + '/stop', {method:'POST'}) -} - -function setverbose(tracelevel) { - if (tracelevel < 0) { - tracelevel = 0; - } - // FIXME: uses global in script library - do_post( - nodetype + '/verbose', tracelevel, 'verbose', - rows2verbose, null - ); -} - -function refresh_setup(interval) { - var timer = setInterval(refresh_job, interval); -} -""", - }, - "/": { - "content_type": "text/html; charset=utf-8", - "content": """ - - - n2n edge management - - - - - -
Last Updated: -
-
- -
Logging Verbosity: - -
-
- - -
-
-
-
- Edges/Peers: -
-
- Supernodes: -
-
-
-
-
- - - - - -""", - }, - "/supernode.html": { - "content_type": "text/html; charset=utf-8", - "content": """ - - - n2n supernode management - - - - - -
Last Updated: -
-
- -
Logging Verbosity: - -
-
- - - -
-
- Communities: -
-
- Edges/Peers: -
-
-
-
-
- - - - - -""", - }, -} - - -class SimpleHandler(http.server.BaseHTTPRequestHandler): - - def __init__(self, rpc, snrpc, *args, **kwargs): - self.rpc = rpc - self.snrpc = snrpc - super().__init__(*args, **kwargs) - - def log_request(self, code='-', size='-'): - # Dont spam the output - pass - - def _simplereply(self, number, message): - self.send_response(number) - self.end_headers() - self.wfile.write(message.encode('utf8')) - - def _replyjson(self, data): - self.send_response(HTTPStatus.OK) - self.send_header('Content-type', 'application/json') - self.end_headers() - self.wfile.write(json.dumps(data).encode('utf8')) - - def _replyunauth(self): - self.send_response(HTTPStatus.UNAUTHORIZED) - self.send_header('WWW-Authenticate', 'Basic realm="n2n"') - self.end_headers() - - def _extractauth(self, rpc): - # Avoid caching the key inside the object for all clients - rpc.key = None - - header = self.headers.get('Authorization') - if header is not None: - authtype, encoded = header.split(' ') - if authtype == 'Basic': - user, key = base64.b64decode(encoded).decode('utf8').split(':') - rpc.key = key - - if rpc.key is None: - rpc.key = rpc.defaultkey - - def _rpc(self, method, cmdline): - try: - data = method(cmdline) - except ValueError as e: - if str(e) == "Error: badauth": - self._replyunauth() - return - - self._simplereply(HTTPStatus.BAD_REQUEST, 'Bad Command') - return - except socket.timeout as e: - self._simplereply(HTTPStatus.REQUEST_TIMEOUT, str(e)) - return - - self._replyjson(data) - return - - def _rpc_read(self, rpc): - self._extractauth(rpc) - tail = self.path.split('/') - cmd = tail[2] - # if reads ever need args, could use more of the tail - - self._rpc(rpc.read, cmd) - - def _rpc_write(self, rpc): - self._extractauth(rpc) - content_length = int(self.headers['Content-Length']) - post_data = self.rfile.read(content_length).decode('utf8') - - tail = self.path.split('/') - cmd = tail[2] - cmdline = cmd + ' ' + post_data - - self._rpc(rpc.write, cmdline) - - def do_GET(self): - if self.path.startswith("/edge/"): - self._rpc_read(self.rpc) - return - - if self.path.startswith("/supernode/"): - self._rpc_read(self.snrpc) - return - - if self.path in pages: - page = pages[self.path] - - self.send_response(HTTPStatus.OK) - self.send_header('Content-type', page['content_type']) - self.end_headers() - self.wfile.write(page['content'].encode('utf8')) - return - - self._simplereply(HTTPStatus.NOT_FOUND, 'Not Found') - return - - def do_POST(self): - if self.path.startswith("/edge/"): - self._rpc_write(self.rpc) - return - - if self.path.startswith("/supernode/"): - self._rpc_write(self.snrpc) - return - - -def main(): - ap = argparse.ArgumentParser( - description='Control the running local n2n edge via http') - ap.add_argument('-t', '--mgmtport', action='store', default=5644, - help='Management Port (default=5644)', type=int) - ap.add_argument('--snmgmtport', action='store', default=5645, - help='Supernode Management Port (default=5645)', type=int) - ap.add_argument('-k', '--key', action='store', - help='Password for mgmt commands') - ap.add_argument('-d', '--debug', action='store_true', - help='Also show raw internal data') - ap.add_argument('port', action='store', - default=8080, type=int, nargs='?', - help='Serve requests on TCP port (default 8080)') - - args = ap.parse_args() - - rpc = JsonUDP(args.mgmtport) - rpc.debug = args.debug - rpc.defaultkey = args.key - - snrpc = JsonUDP(args.snmgmtport) - snrpc.debug = args.debug - snrpc.defaultkey = args.key - - signal.signal(signal.SIGPIPE, signal.SIG_DFL) - - socketserver.TCPServer.allow_reuse_address = True - handler = functools.partial(SimpleHandler, rpc, snrpc) - - httpd = socketserver.TCPServer(("", args.port), handler) - try: - httpd.serve_forever() - except KeyboardInterrupt: - return - - -if __name__ == '__main__': - main() diff --git a/bundles/n2n_ntop_v3/scripts/test_harness.sh b/bundles/n2n_ntop_v3/scripts/test_harness.sh deleted file mode 100644 index 5f520759..00000000 --- a/bundles/n2n_ntop_v3/scripts/test_harness.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# -# This expects to find the tests in the tools dir and the expected results -# in the tests dir. - -TESTS=" - tests-compress - tests-elliptic - tests-hashing - tests-transform - tests-wire -" - -TOOLSDIR=tools -TESTDATA=tests - -# Allow both dirs be overidden -[ -n "$1" ] && TOOLSDIR="$1" -[ -n "$2" ] && TESTDATA="$2" - -# Confirm we have all the tools and data -for i in $TESTS; do - if [ ! -e "$TOOLSDIR/$i" ]; then - echo "Could not find test $TOOLSDIR/$i" - exit 1 - fi - if [ ! -e "$TESTDATA/$i.expected" ]; then - echo "Could not find testdata $TESTDATA/$i.expected" - exit 1 - fi -done - -# Actually run the tests -set -e -for i in $TESTS; do - echo "$TOOLSDIR/$i >$TESTDATA/$i.out" - "$TOOLSDIR/$i" >"$TESTDATA/$i.out" - cmp "$TESTDATA/$i.expected" "$TESTDATA/$i.out" -done diff --git a/bundles/n2n_ntop_v3/src/aes.c b/bundles/n2n_ntop_v3/src/aes.c deleted file mode 100644 index 12b161be..00000000 --- a/bundles/n2n_ntop_v3/src/aes.c +++ /dev/null @@ -1,1313 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -#if defined (HAVE_OPENSSL_1_1) // openSSL 1.1 --------------------------------------------------------------------- - - -// get any erorr message out of openssl -// taken from https://en.wikibooks.org/wiki/OpenSSL/Error_handling -static char *openssl_err_as_string (void) { - - BIO *bio = BIO_new (BIO_s_mem ()); - ERR_print_errors (bio); - char *buf = NULL; - size_t len = BIO_get_mem_data (bio, &buf); - char *ret = (char *) calloc (1, 1 + len); - - if(ret) - memcpy (ret, buf, len); - - BIO_free (bio); - - return ret; -} - - -int aes_cbc_encrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, aes_context_t *ctx) { - - int evp_len; - int evp_ciphertext_len; - - if(1 == EVP_EncryptInit_ex(ctx->enc_ctx, ctx->cipher, NULL, ctx->key, iv)) { - if(1 == EVP_CIPHER_CTX_set_padding(ctx->enc_ctx, 0)) { - if(1 == EVP_EncryptUpdate(ctx->enc_ctx, out, &evp_len, in, in_len)) { - evp_ciphertext_len = evp_len; - if(1 == EVP_EncryptFinal_ex(ctx->enc_ctx, out + evp_len, &evp_len)) { - evp_ciphertext_len += evp_len; - if(evp_ciphertext_len != in_len) - traceEvent(TRACE_ERROR, "aes_cbc_encrypt openssl encryption: encrypted %u bytes where %u were expected", - evp_ciphertext_len, in_len); - } else - traceEvent(TRACE_ERROR, "aes_cbc_encrypt openssl final encryption: %s", - openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "aes_cbc_encrypt openssl encrpytion: %s", - openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "aes_cbc_encrypt openssl padding setup: %s", - openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "aes_cbc_encrypt openssl init: %s", - openssl_err_as_string()); - - EVP_CIPHER_CTX_reset(ctx->enc_ctx); - - return 0; -} - - -int aes_cbc_decrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, aes_context_t *ctx) { - - int evp_len; - int evp_plaintext_len; - - if(1 == EVP_DecryptInit_ex(ctx->dec_ctx, ctx->cipher, NULL, ctx->key, iv)) { - if(1 == EVP_CIPHER_CTX_set_padding(ctx->dec_ctx, 0)) { - if(1 == EVP_DecryptUpdate(ctx->dec_ctx, out, &evp_len, in, in_len)) { - evp_plaintext_len = evp_len; - if(1 == EVP_DecryptFinal_ex(ctx->dec_ctx, out + evp_len, &evp_len)) { - evp_plaintext_len += evp_len; - if(evp_plaintext_len != in_len) - traceEvent(TRACE_ERROR, "aes_cbc_decrypt openssl decryption: decrypted %u bytes where %u were expected", - evp_plaintext_len, in_len); - } else - traceEvent(TRACE_ERROR, "aes_cbc_decrypt openssl final decryption: %s", - openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "aes_cbc_decrypt openssl decrpytion: %s", - openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "aes_cbc_decrypt openssl padding setup: %s", - openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "aes_cbc_decrypt openssl init: %s", - openssl_err_as_string()); - - EVP_CIPHER_CTX_reset(ctx->dec_ctx); - - return 0; -} - - -int aes_ecb_decrypt (unsigned char *out, const unsigned char *in, aes_context_t *ctx) { - - AES_ecb_encrypt(in, out, &(ctx->ecb_dec_key), AES_DECRYPT); - - return 0; -} - - -int aes_init (const unsigned char *key, size_t key_size, aes_context_t **ctx) { - - // allocate context... - *ctx = (aes_context_t*) calloc(1, sizeof(aes_context_t)); - if(!(*ctx)) - return -1; - - // ...and fill her up: - - // initialize data structures - if(!((*ctx)->enc_ctx = EVP_CIPHER_CTX_new())) { - traceEvent(TRACE_ERROR, "aes_init openssl's evp_* encryption context creation failed: %s", - openssl_err_as_string()); - return -1; - } - - if(!((*ctx)->dec_ctx = EVP_CIPHER_CTX_new())) { - traceEvent(TRACE_ERROR, "aes_init openssl's evp_* decryption context creation failed: %s", - openssl_err_as_string()); - return -1; - } - - // check key size and make key size (given in bytes) dependant settings - switch(key_size) { - case AES128_KEY_BYTES: // 128 bit key size - (*ctx)->cipher = EVP_aes_128_cbc(); - break; - case AES192_KEY_BYTES: // 192 bit key size - (*ctx)->cipher = EVP_aes_192_cbc(); - break; - case AES256_KEY_BYTES: // 256 bit key size - (*ctx)->cipher = EVP_aes_256_cbc(); - break; - default: - traceEvent(TRACE_ERROR, "aes_init invalid key size %u\n", key_size); - return -1; - } - - // key materiel handling - memcpy((*ctx)->key, key, key_size); - AES_set_decrypt_key(key, key_size * 8, &((*ctx)->ecb_dec_key)); - - return 0; -} - - -#elif defined (__AES__) && defined (__SSE2__) // Intel's AES-NI --------------------------------------------------- - - -// inspired by https://gist.github.com/acapola/d5b940da024080dfaf5f -// furthered by the help of Sebastian Ramacher's implementation found at -// https://chromium.googlesource.com/external/github.com/dlitz/pycrypto/+/junk/master/src/AESNI.c -// modified along Intel's white paper on AES Instruction Set -// https://www.intel.com/content/dam/doc/white-paper/advanced-encryption-standard-new-instructions-set-paper.pdf - - -static __m128i aes128_keyexpand(__m128i key, __m128i keygened, uint8_t shuf) { - - key = _mm_xor_si128(key, _mm_slli_si128(key, 4)); - key = _mm_xor_si128(key, _mm_slli_si128(key, 4)); - key = _mm_xor_si128(key, _mm_slli_si128(key, 4)); - - // unfortunately, shuffle expects immediate argument, thus the not-so-stylish switch ... - // REVISIT: either macrorize this whole function (and perhaps the following one) or - // use shuffle_epi8 (which would require SSSE3 instead of SSE2) - switch(shuf) { - case 0x55: - keygened = _mm_shuffle_epi32(keygened, 0x55 ); - break; - case 0xaa: - keygened = _mm_shuffle_epi32(keygened, 0xaa ); - break; - case 0xff: - keygened = _mm_shuffle_epi32(keygened, 0xff ); - break; - default: - break; - } - - return _mm_xor_si128(key, keygened); -} - - -static __m128i aes192_keyexpand_2(__m128i key, __m128i key2) { - - key = _mm_shuffle_epi32(key, 0xff); - key2 = _mm_xor_si128(key2, _mm_slli_si128(key2, 4)); - - return _mm_xor_si128(key, key2); -} - - -#define KEYEXP128(K, I) aes128_keyexpand (K, _mm_aeskeygenassist_si128(K, I), 0xff) -#define KEYEXP192(K1, K2, I) aes128_keyexpand (K1, _mm_aeskeygenassist_si128(K2, I), 0x55) -#define KEYEXP192_2(K1, K2) aes192_keyexpand_2(K1, K2) -#define KEYEXP256(K1, K2, I) aes128_keyexpand (K1, _mm_aeskeygenassist_si128(K2, I), 0xff) -#define KEYEXP256_2(K1, K2) aes128_keyexpand (K1, _mm_aeskeygenassist_si128(K2, 0x00), 0xaa) - - -// key setup -static int aes_internal_key_setup (aes_context_t *ctx, const uint8_t *key, int key_bits) { - - // number of rounds - ctx->Nr = 6 + (key_bits / 32); - - // encryption keys - switch(key_bits) { - case 128: { - ctx->rk_enc[ 0] = _mm_loadu_si128((const __m128i*)key); - ctx->rk_enc[ 1] = KEYEXP128(ctx->rk_enc[0], 0x01); - ctx->rk_enc[ 2] = KEYEXP128(ctx->rk_enc[1], 0x02); - ctx->rk_enc[ 3] = KEYEXP128(ctx->rk_enc[2], 0x04); - ctx->rk_enc[ 4] = KEYEXP128(ctx->rk_enc[3], 0x08); - ctx->rk_enc[ 5] = KEYEXP128(ctx->rk_enc[4], 0x10); - ctx->rk_enc[ 6] = KEYEXP128(ctx->rk_enc[5], 0x20); - ctx->rk_enc[ 7] = KEYEXP128(ctx->rk_enc[6], 0x40); - ctx->rk_enc[ 8] = KEYEXP128(ctx->rk_enc[7], 0x80); - ctx->rk_enc[ 9] = KEYEXP128(ctx->rk_enc[8], 0x1B); - ctx->rk_enc[10] = KEYEXP128(ctx->rk_enc[9], 0x36); - break; - } - case 192: { - __m128i temp[2]; - ctx->rk_enc[ 0] = _mm_loadu_si128((const __m128i*) key); - - ctx->rk_enc[ 1] = _mm_loadu_si128((const __m128i*) (key+16)); - temp[0] = KEYEXP192(ctx->rk_enc[0], ctx->rk_enc[1], 0x01); - temp[1] = KEYEXP192_2(temp[0], ctx->rk_enc[1]); - ctx->rk_enc[ 1] = (__m128i)_mm_shuffle_pd((__m128d)ctx->rk_enc[1], (__m128d)temp[0], 0); - - ctx->rk_enc[ 2] = (__m128i)_mm_shuffle_pd((__m128d)temp[0], (__m128d)temp[1], 1); - ctx->rk_enc[ 3] = KEYEXP192(temp[0], temp[1], 0x02); - - ctx->rk_enc[ 4] = KEYEXP192_2(ctx->rk_enc[3], temp[1]); - temp[0] = KEYEXP192(ctx->rk_enc[3], ctx->rk_enc[4], 0x04); - temp[1] = KEYEXP192_2(temp[0], ctx->rk_enc[4]); - ctx->rk_enc[ 4] = (__m128i)_mm_shuffle_pd((__m128d)ctx->rk_enc[4], (__m128d)temp[0], 0); - - ctx->rk_enc[ 5] = (__m128i)_mm_shuffle_pd((__m128d)temp[0], (__m128d)temp[1], 1); - ctx->rk_enc[ 6] = KEYEXP192(temp[0], temp[1], 0x08); - - ctx->rk_enc[ 7] = KEYEXP192_2(ctx->rk_enc[6], temp[1]); - temp[0] = KEYEXP192(ctx->rk_enc[6], ctx->rk_enc[7], 0x10); - temp[1] = KEYEXP192_2(temp[0], ctx->rk_enc[7]); - ctx->rk_enc[ 7] = (__m128i)_mm_shuffle_pd((__m128d)ctx->rk_enc[7], (__m128d)temp[0], 0); - - ctx->rk_enc[ 8] = (__m128i)_mm_shuffle_pd((__m128d)temp[0], (__m128d)temp[1], 1); - ctx->rk_enc[ 9] = KEYEXP192(temp[0], temp[1], 0x20); - - ctx->rk_enc[10] = KEYEXP192_2(ctx->rk_enc[9], temp[1]); - temp[0] = KEYEXP192(ctx->rk_enc[9], ctx->rk_enc[10], 0x40); - temp[1] = KEYEXP192_2(temp[0], ctx->rk_enc[10]); - ctx->rk_enc[10] = (__m128i)_mm_shuffle_pd((__m128d)ctx->rk_enc[10], (__m128d) temp[0], 0); - - ctx->rk_enc[11] = (__m128i)_mm_shuffle_pd((__m128d)temp[0],(__m128d) temp[1], 1); - ctx->rk_enc[12] = KEYEXP192(temp[0], temp[1], 0x80); - break; - } - case 256: { - ctx->rk_enc[ 0] = _mm_loadu_si128((const __m128i*) key); - ctx->rk_enc[ 1] = _mm_loadu_si128((const __m128i*) (key+16)); - ctx->rk_enc[ 2] = KEYEXP256(ctx->rk_enc[0], ctx->rk_enc[1], 0x01); - ctx->rk_enc[ 3] = KEYEXP256_2(ctx->rk_enc[1], ctx->rk_enc[2]); - ctx->rk_enc[ 4] = KEYEXP256(ctx->rk_enc[2], ctx->rk_enc[3], 0x02); - ctx->rk_enc[ 5] = KEYEXP256_2(ctx->rk_enc[3], ctx->rk_enc[4]); - ctx->rk_enc[ 6] = KEYEXP256(ctx->rk_enc[4], ctx->rk_enc[5], 0x04); - ctx->rk_enc[ 7] = KEYEXP256_2(ctx->rk_enc[5], ctx->rk_enc[6]); - ctx->rk_enc[ 8] = KEYEXP256(ctx->rk_enc[6], ctx->rk_enc[7], 0x08); - ctx->rk_enc[ 9] = KEYEXP256_2(ctx->rk_enc[7], ctx->rk_enc[8]); - ctx->rk_enc[10] = KEYEXP256(ctx->rk_enc[8], ctx->rk_enc[9], 0x10); - ctx->rk_enc[11] = KEYEXP256_2(ctx->rk_enc[9], ctx->rk_enc[10]); - ctx->rk_enc[12] = KEYEXP256(ctx->rk_enc[10], ctx->rk_enc[11], 0x20); - ctx->rk_enc[13] = KEYEXP256_2(ctx->rk_enc[11], ctx->rk_enc[12]); - ctx->rk_enc[14] = KEYEXP256(ctx->rk_enc[12], ctx->rk_enc[13], 0x40); - break; - } - } - - // derive decryption keys - for(int i = 1; i < ctx->Nr; ++i) { - ctx->rk_dec[ctx->Nr - i] = _mm_aesimc_si128(ctx->rk_enc[i]); - } - ctx->rk_dec[ 0] = ctx->rk_enc[ctx->Nr]; - - return ctx->Nr; -} - - -static void aes_internal_encrypt (aes_context_t *ctx, const uint8_t pt[16], uint8_t ct[16]) { - - __m128i tmp = _mm_loadu_si128((__m128i*)pt); - - tmp = _mm_xor_si128 (tmp, ctx->rk_enc[ 0]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 1]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 2]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 3]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 4]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 5]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 6]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 7]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 8]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 9]); - if(ctx->Nr > 10) { - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[10]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[11]); - if(ctx->Nr > 12) { - tmp = _mm_aesenc_si128(tmp, ctx->rk_enc[12]); - tmp = _mm_aesenc_si128(tmp, ctx->rk_enc[13]); - } - } - tmp = _mm_aesenclast_si128 (tmp, ctx->rk_enc[ctx->Nr]); - - _mm_storeu_si128((__m128i*) ct, tmp); -} - - -static void aes_internal_decrypt (aes_context_t *ctx, const uint8_t ct[16], uint8_t pt[16]) { - - __m128i tmp = _mm_loadu_si128((__m128i*)ct); - - tmp = _mm_xor_si128 (tmp, ctx->rk_dec[ 0]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 1]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 2]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 3]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 4]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 5]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 6]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 7]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 8]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 9]); - if(ctx->Nr > 10) { - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[10]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[11]); - if(ctx->Nr > 12) { - tmp = _mm_aesdec_si128(tmp, ctx->rk_dec[12]); - tmp = _mm_aesdec_si128(tmp, ctx->rk_dec[13]); - } - } - tmp = _mm_aesdeclast_si128 (tmp, ctx->rk_enc[ 0]); - - _mm_storeu_si128((__m128i*) pt, tmp); -} - - -// public API - - -int aes_ecb_decrypt (unsigned char *out, const unsigned char *in, aes_context_t *ctx) { - - aes_internal_decrypt(ctx, in, out); - - return AES_BLOCK_SIZE; -} - - -// not used -int aes_ecb_encrypt (unsigned char *out, const unsigned char *in, aes_context_t *ctx) { - - aes_internal_encrypt(ctx, in, out); - - return AES_BLOCK_SIZE; -} - - -int aes_cbc_encrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, aes_context_t *ctx) { - - int n; /* number of blocks */ - int ret = (int)in_len & 15; /* remainder */ - - __m128i ivec = _mm_loadu_si128((__m128i*)iv); - - for(n = in_len / 16; n != 0; n--) { - __m128i tmp = _mm_loadu_si128((__m128i*)in); - in += 16; - tmp = _mm_xor_si128(tmp, ivec); - - tmp = _mm_xor_si128 (tmp, ctx->rk_enc[ 0]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 1]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 2]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 3]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 4]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 5]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 6]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 7]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 8]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[ 9]); - if(ctx->Nr > 10) { - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[10]); - tmp = _mm_aesenc_si128 (tmp, ctx->rk_enc[11]); - if(ctx->Nr > 12) { - tmp = _mm_aesenc_si128(tmp, ctx->rk_enc[12]); - tmp = _mm_aesenc_si128(tmp, ctx->rk_enc[13]); - } - } - tmp = _mm_aesenclast_si128 (tmp, ctx->rk_enc[ctx->Nr]); - - ivec = tmp; - - _mm_storeu_si128((__m128i*)out, tmp); - out += 16; - } - - return ret; -} - - -int aes_cbc_decrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, aes_context_t *ctx) { - - int n; /* number of blocks */ - int ret = (int)in_len & 15; /* remainder */ - - __m128i ivec = _mm_loadu_si128((__m128i*)iv); - - // 4 parallel rails of AES decryption to reduce data dependencies in x86's deep pipelines - for(n = in_len / 16; n > 3; n -=4) { - __m128i tmp1 = _mm_loadu_si128((__m128i*)in); in += 16; - __m128i tmp2 = _mm_loadu_si128((__m128i*)in); in += 16; - __m128i tmp3 = _mm_loadu_si128((__m128i*)in); in += 16; - __m128i tmp4 = _mm_loadu_si128((__m128i*)in); in += 16; - - __m128i old_in1 = tmp1; - __m128i old_in2 = tmp2; - __m128i old_in3 = tmp3; - __m128i old_in4 = tmp4; - - tmp1 = _mm_xor_si128 (tmp1, ctx->rk_dec[ 0]); tmp2 = _mm_xor_si128 (tmp2, ctx->rk_dec[ 0]); - tmp3 = _mm_xor_si128 (tmp3, ctx->rk_dec[ 0]); tmp4 = _mm_xor_si128 (tmp4, ctx->rk_dec[ 0]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 1]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 1]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[ 1]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[ 1]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 2]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 2]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[ 2]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[ 2]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 3]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 3]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[ 3]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[ 3]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 4]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 4]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[ 4]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[ 4]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 5]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 5]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[ 5]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[ 5]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 6]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 6]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[ 6]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[ 6]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 7]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 7]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[ 7]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[ 7]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 8]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 8]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[ 8]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[ 8]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 9]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 9]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[ 9]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[ 9]); - - if(ctx->Nr > 10) { - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[10]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[10]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[10]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[10]); - - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[11]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[11]); - tmp3 = _mm_aesdec_si128 (tmp3, ctx->rk_dec[11]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[11]); - - if(ctx->Nr > 12) { - tmp1 = _mm_aesdec_si128(tmp1, ctx->rk_dec[12]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[12]); - tmp3 = _mm_aesdec_si128(tmp3, ctx->rk_dec[12]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[12]); - - tmp1 = _mm_aesdec_si128(tmp1, ctx->rk_dec[13]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[13]); - tmp3 = _mm_aesdec_si128(tmp3, ctx->rk_dec[13]); tmp4 = _mm_aesdec_si128 (tmp4, ctx->rk_dec[13]); - } - } - tmp1 = _mm_aesdeclast_si128(tmp1, ctx->rk_enc[ 0]); tmp2 = _mm_aesdeclast_si128(tmp2, ctx->rk_enc[ 0]); - tmp3 = _mm_aesdeclast_si128(tmp3, ctx->rk_enc[ 0]); tmp4 = _mm_aesdeclast_si128(tmp4, ctx->rk_enc[ 0]); - - tmp1 = _mm_xor_si128 (tmp1, ivec); tmp2 = _mm_xor_si128 (tmp2, old_in1); - tmp3 = _mm_xor_si128 (tmp3, old_in2); tmp4 = _mm_xor_si128 (tmp4, old_in3); - - ivec = old_in4; - - _mm_storeu_si128((__m128i*) out, tmp1); out += 16; - _mm_storeu_si128((__m128i*) out, tmp2); out += 16; - _mm_storeu_si128((__m128i*) out, tmp3); out += 16; - _mm_storeu_si128((__m128i*) out, tmp4); out += 16; - } - // now: less than 4 blocks remaining - - // if 2 or 3 blocks remaining --> this code handles two of them - if(n > 1) { - n-= 2; - - __m128i tmp1 = _mm_loadu_si128((__m128i*)in); in += 16; - __m128i tmp2 = _mm_loadu_si128((__m128i*)in); in += 16; - - __m128i old_in1 = tmp1; - __m128i old_in2 = tmp2; - - tmp1 = _mm_xor_si128 (tmp1, ctx->rk_dec[ 0]); tmp2 = _mm_xor_si128 (tmp2, ctx->rk_dec[ 0]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 1]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 1]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 2]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 2]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 3]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 3]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 4]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 4]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 5]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 5]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 6]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 6]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 7]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 7]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 8]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 8]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[ 9]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[ 9]); - if(ctx->Nr > 10) { - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[10]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[10]); - tmp1 = _mm_aesdec_si128 (tmp1, ctx->rk_dec[11]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[11]); - if(ctx->Nr > 12) { - tmp1 = _mm_aesdec_si128(tmp1, ctx->rk_dec[12]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[12]); - tmp1 = _mm_aesdec_si128(tmp1, ctx->rk_dec[13]); tmp2 = _mm_aesdec_si128 (tmp2, ctx->rk_dec[13]); - } - } - tmp1 = _mm_aesdeclast_si128 (tmp1, ctx->rk_enc[ 0]); tmp2 = _mm_aesdeclast_si128(tmp2, ctx->rk_enc[ 0]); - - tmp1 = _mm_xor_si128 (tmp1, ivec); tmp2 = _mm_xor_si128 (tmp2, old_in1); - - ivec = old_in2; - - _mm_storeu_si128((__m128i*) out, tmp1); out += 16; - _mm_storeu_si128((__m128i*) out, tmp2); out += 16; - } - - // one block remaining - if(n) { - __m128i tmp = _mm_loadu_si128((__m128i*)in); - - tmp = _mm_xor_si128 (tmp, ctx->rk_dec[ 0]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 1]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 2]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 3]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 4]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 5]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 6]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 7]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 8]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[ 9]); - if(ctx->Nr > 10) { - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[10]); - tmp = _mm_aesdec_si128 (tmp, ctx->rk_dec[11]); - if(ctx->Nr > 12) { - tmp = _mm_aesdec_si128(tmp, ctx->rk_dec[12]); - tmp = _mm_aesdec_si128(tmp, ctx->rk_dec[13]); - } - } - tmp = _mm_aesdeclast_si128 (tmp, ctx->rk_enc[ 0]); - - tmp = _mm_xor_si128 (tmp, ivec); - - _mm_storeu_si128((__m128i*) out, tmp); - } - - return ret; -} - - -int aes_init (const unsigned char *key, size_t key_size, aes_context_t **ctx) { - - // allocate context... - *ctx = (aes_context_t*) calloc(1, sizeof(aes_context_t)); - if(!(*ctx)) - return -1; - // ...and fill her up: - - // initialize data structures - - // check key size and make key size (given in bytes) dependant settings - switch(key_size) { - case AES128_KEY_BYTES: // 128 bit key size - break; - case AES192_KEY_BYTES: // 192 bit key size - break; - case AES256_KEY_BYTES: // 256 bit key size - break; - default: - traceEvent(TRACE_ERROR, "aes_init invalid key size %u\n", key_size); - return -1; - } - - // key materiel handling - aes_internal_key_setup ( *ctx, key, 8 * key_size); - - return 0; -} - - -#else // plain C -------------------------------------------------------------------------- - - -// rijndael-alg-fst.c version 3.0 (December 2000) -// optimised ANSI C code for the Rijndael cipher (now AES) -// original authors: Vincent Rijmen -// Antoon Bosselaers -// Paulo Barreto -// -// was put in the public domain, taken (and modified) from -// https://fastcrypto.org/front/misc/rijndael-alg-fst.c - - -// Te0[x] = S [x].[02, 01, 01, 03]; -static const uint32_t Te0[256] = { - 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, - 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, - 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, - 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, - 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, - 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, - 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, - 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, - 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, - 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, - 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, - 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, - 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, - 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, - 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, - 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, - 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, - 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, - 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, - 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, - 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, - 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, - 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, - 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, - 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, - 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, - 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, - 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, - 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, - 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, - 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, - 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU }; - -// Te1[x] = S [x].[03, 02, 01, 01]; -static const uint32_t Te1[256] = { - 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, - 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, - 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, - 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, - 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, - 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, - 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, - 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, - 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, - 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, - 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, - 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, - 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, - 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, - 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, - 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, - 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, - 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, - 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, - 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, - 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, - 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, - 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, - 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, - 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, - 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, - 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, - 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, - 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, - 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, - 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, - 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U }; - -// Te2[x] = S [x].[01, 03, 02, 01]; -static const uint32_t Te2[256] = { - 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, - 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, - 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, - 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, - 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, - 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, - 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, - 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, - 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, - 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, - 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, - 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, - 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, - 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, - 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, - 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, - 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, - 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, - 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, - 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, - 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, - 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, - 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, - 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, - 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, - 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, - 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, - 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, - 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, - 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, - 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, - 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U }; - -// Te3[x] = S [x].[01, 01, 03, 02]; -static const uint32_t Te3[256] = { - 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, - 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, - 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, - 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, - 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, - 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, - 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, - 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, - 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, - 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, - 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, - 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, - 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, - 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, - 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, - 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, - 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, - 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, - 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, - 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, - 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, - 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, - 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, - 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, - 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, - 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, - 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, - 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, - 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, - 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, - 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, - 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU }; - -// Te4[x] = S [x].[01, 01, 01, 01]; -static const uint32_t Te4[256] = { - 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, - 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, - 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, - 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, - 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, - 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, - 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, - 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, - 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, - 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, - 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, - 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, - 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, - 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, - 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, - 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, - 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, - 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, - 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, - 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, - 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, - 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, - 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, - 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, - 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, - 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, - 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, - 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, - 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, - 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, - 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, - 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U }; - -// Td0[x] = Si[x].[0e, 09, 0d, 0b]; -static const uint32_t Td0[256] = { - 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, - 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, - 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, - 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, - 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, - 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, - 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, - 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, - 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, - 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, - 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, - 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, - 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, - 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, - 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, - 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, - 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, - 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, - 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, - 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, - 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, - 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, - 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, - 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, - 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, - 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, - 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, - 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, - 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, - 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, - 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, - 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U }; - -// Td1[x] = Si[x].[0b, 0e, 09, 0d]; -static const uint32_t Td1[256] = { - 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, - 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, - 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, - 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, - 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, - 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, - 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, - 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, - 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, - 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, - 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, - 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, - 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, - 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, - 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, - 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, - 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, - 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, - 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, - 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, - 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, - 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, - 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, - 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, - 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, - 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, - 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, - 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, - 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, - 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, - 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, - 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U }; - -// Td2[x] = Si[x].[0d, 0b, 0e, 09]; -static const uint32_t Td2[256] = { - 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, - 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, - 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, - 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, - 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, - 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, - 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, - 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, - 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, - 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, - 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, - 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, - 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, - 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, - 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, - 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, - 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, - 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, - 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, - 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, - 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, - 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, - 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, - 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, - 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, - 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, - 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, - 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, - 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, - 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, - 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, - 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U }; - -// Td3[x] = Si[x].[09, 0d, 0b, 0e]; -static const uint32_t Td3[256] = { - 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, - 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, - 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, - 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, - 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, - 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, - 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, - 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, - 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, - 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, - 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, - 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, - 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, - 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, - 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, - 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, - 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, - 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, - 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, - 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, - 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, - 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, - 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, - 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, - 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, - 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, - 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, - 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, - 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, - 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, - 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, - 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U }; - -// Td4[x] = Si[x].[01, 01, 01, 01]; -static const uint32_t Td4[256] = { - 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, - 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, - 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, - 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, - 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, - 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, - 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, - 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, - 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, - 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, - 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, - 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, - 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, - 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, - 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, - 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, - 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, - 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, - 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, - 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, - 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, - 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, - 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, - 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, - 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, - 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, - 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, - 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, - 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, - 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, - 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, - 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU }; - -// for 128-bit blocks, Rijndael never uses more than 10 rcon values -static const uint32_t rcon[] = { - 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000, 0x40000000, 0x80000000, - 0x1B000000, 0x36000000 }; - - -#define GETU32(p) (be32toh((*((uint32_t*)(p))))) -#define PUTU32(ct, st) { *((uint32_t*)(ct)) = htobe32((st)); } - -#define b0(x) ((uint8_t)(x)) -#define b1(x) ((uint8_t)((x) >> 8)) -#define b2(x) ((uint8_t)((x) >> 16)) -#define b3(x) ((uint8_t)((x) >> 24)) - -#define m0(x) ((x) & 0x000000ff) -#define m1(x) ((x) & 0x0000ff00) -#define m2(x) ((x) & 0x00ff0000) -#define m3(x) ((x) & 0xff000000) - - -// expand the cipher key into the encryption key schedule and -// return the number of rounds for the given cipher key size -static int aes_internal_key_setup_enc (uint32_t rk[/*4*(Nr + 1)*/], const uint8_t cipherKey[], int keyBits) { - - int i = 0; - uint32_t temp; - - rk[0] = GETU32(cipherKey ); - rk[1] = GETU32(cipherKey + 4); - rk[2] = GETU32(cipherKey + 8); - rk[3] = GETU32(cipherKey + 12); - if(keyBits == 128) { - for(;;) { - temp = rk[3]; - rk[4] = rk[0] ^ - (Te4[b2(temp)] & 0xff000000) ^ - (Te4[b1(temp)] & 0x00ff0000) ^ - (Te4[b0(temp)] & 0x0000ff00) ^ - (Te4[b3(temp)] & 0x000000ff) ^ - rcon[i]; - rk[5] = rk[1] ^ rk[4]; - rk[6] = rk[2] ^ rk[5]; - rk[7] = rk[3] ^ rk[6]; - if(++i == 10) { - return 10; - } - rk += 4; - } - } - rk[4] = GETU32(cipherKey + 16); - rk[5] = GETU32(cipherKey + 20); - if(keyBits == 192) { - for(;;) { - temp = rk[ 5]; - rk[ 6] = rk[ 0] ^ - (Te4[b2(temp)] & 0xff000000) ^ - (Te4[b1(temp)] & 0x00ff0000) ^ - (Te4[b0(temp)] & 0x0000ff00) ^ - (Te4[b3(temp)] & 0x000000ff) ^ - rcon[i]; - rk[ 7] = rk[ 1] ^ rk[ 6]; - rk[ 8] = rk[ 2] ^ rk[ 7]; - rk[ 9] = rk[ 3] ^ rk[ 8]; - if(++i == 8) { - return 12; - } - rk[10] = rk[ 4] ^ rk[ 9]; - rk[11] = rk[ 5] ^ rk[10]; - rk += 6; - } - } - rk[6] = GETU32(cipherKey + 24); - rk[7] = GETU32(cipherKey + 28); - if(keyBits == 256) { - for(;;) { - temp = rk[ 7]; - rk[ 8] = rk[ 0] ^ - (Te4[b2(temp)] & 0xff000000) ^ - (Te4[b1(temp)] & 0x00ff0000) ^ - (Te4[b0(temp)] & 0x0000ff00) ^ - (Te4[b3(temp)] & 0x000000ff) ^ - rcon[i]; - rk[ 9] = rk[ 1] ^ rk[ 8]; - rk[10] = rk[ 2] ^ rk[ 9]; - rk[11] = rk[ 3] ^ rk[10]; - if(++i == 7) { - return 14; - } - temp = rk[11]; - rk[12] = rk[ 4] ^ - (Te4[b3(temp)] & 0xff000000) ^ - (Te4[b2(temp)] & 0x00ff0000) ^ - (Te4[b1(temp)] & 0x0000ff00) ^ - (Te4[b0(temp)] & 0x000000ff); - rk[13] = rk[ 5] ^ rk[12]; - rk[14] = rk[ 6] ^ rk[13]; - rk[15] = rk[ 7] ^ rk[14]; - rk += 8; - } - } - - return 0; -} - - -#define INVMIXCOLRK(n) rk[n] = Td0[b0(Te4[b3(rk[n])])] ^ Td1[b0(Te4[b2(rk[n])])] ^ Td2[b0(Te4[b1(rk[n])])] ^ Td3[b0(Te4[b0(rk[n])])] - - -// expand the cipher key into the decryption key schedule and -// return the number of rounds for the given cipher key size -static int aes_internal_key_setup_dec (uint32_t rk[/*4*(Nr + 1)*/], const uint8_t cipherKey[], int keyBits) { - - int Nr, i, j; - uint32_t temp; - - // expand the cipher key - Nr = aes_internal_key_setup_enc(rk, cipherKey, keyBits); - // invert the order of the round keys - for(i = 0, j = 4*Nr; i < j; i += 4, j -= 4) { - temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; - temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; - temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; - temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; - } - - // apply the inverse MixColumn transform to all round keys but the first and the last - for(i = 1; i < Nr; i++) { - rk += 4; - INVMIXCOLRK(0); - INVMIXCOLRK(1); - INVMIXCOLRK(2); - INVMIXCOLRK(3); - } - - return Nr; -} - - -#define AES_ENC_ROUND(DST, SRC, round) \ - DST##0 = Te0[b3(SRC##0)] ^ Te1[b2(SRC##1)] ^ Te2[b1(SRC##2)] ^ Te3[b0(SRC##3)] ^ rk[4 * round + 0]; \ - DST##1 = Te0[b3(SRC##1)] ^ Te1[b2(SRC##2)] ^ Te2[b1(SRC##3)] ^ Te3[b0(SRC##0)] ^ rk[4 * round + 1]; \ - DST##2 = Te0[b3(SRC##2)] ^ Te1[b2(SRC##3)] ^ Te2[b1(SRC##0)] ^ Te3[b0(SRC##1)] ^ rk[4 * round + 2]; \ - DST##3 = Te0[b3(SRC##3)] ^ Te1[b2(SRC##0)] ^ Te2[b1(SRC##1)] ^ Te3[b0(SRC##2)] ^ rk[4 * round + 3]; - - -static void aes_internal_encrypt (const uint32_t rk[/*4*(Nr + 1)*/], int Nr, const uint8_t pt[16], uint8_t ct[16]) { - - uint32_t s0, s1, s2, s3, t0, t1, t2, t3; - - // map byte array block to cipher state and add initial round key - s0 = GETU32(pt ) ^ rk[0]; - s1 = GETU32(pt + 4) ^ rk[1]; - s2 = GETU32(pt + 8) ^ rk[2]; - s3 = GETU32(pt + 12) ^ rk[3]; - - AES_ENC_ROUND(t, s, 1); - AES_ENC_ROUND(s, t, 2); - AES_ENC_ROUND(t, s, 3); - AES_ENC_ROUND(s, t, 4); - AES_ENC_ROUND(t, s, 5); - AES_ENC_ROUND(s, t, 6); - AES_ENC_ROUND(t, s, 7); - AES_ENC_ROUND(s, t, 8); - AES_ENC_ROUND(t, s, 9); - - if(Nr > 10) { - AES_ENC_ROUND(s, t, 10); - AES_ENC_ROUND(t, s, 11); - if(Nr > 12) { - AES_ENC_ROUND(s, t, 12); - AES_ENC_ROUND(t, s, 13); - } - } - - rk += Nr << 2; - // apply last round and map cipher state to byte array block - s0 = m3(Te4[b3(t0)]) ^ m2(Te4[b2(t1)]) ^ m1(Te4[b1(t2)]) ^ m0(Te4[b0(t3)]) ^ rk[0]; - PUTU32(ct , s0); - s1 = m3(Te4[b3(t1)]) ^ m2(Te4[b2(t2)]) ^ m1(Te4[b1(t3)]) ^ m0(Te4[b0(t0)]) ^ rk[1]; - PUTU32(ct + 4, s1); - s2 = m3(Te4[b3(t2)]) ^ m2(Te4[b2(t3)]) ^ m1(Te4[b1(t0)]) ^ m0(Te4[b0(t1)]) ^ rk[2]; - PUTU32(ct + 8, s2); - s3 = m3(Te4[b3(t3)]) ^ m2(Te4[b2(t0)]) ^ m1(Te4[b1(t1)]) ^ m0(Te4[b0(t2)]) ^ rk[3]; - PUTU32(ct + 12, s3); -} - - -#define AES_DEC_ROUND(DST, SRC, round) \ - DST##0 = Td0[b3(SRC##0)] ^ Td1[b2(SRC##3)] ^ Td2[b1(SRC##2)] ^ Td3[b0(SRC##1)] ^ rk[4 * round + 0]; \ - DST##1 = Td0[b3(SRC##1)] ^ Td1[b2(SRC##0)] ^ Td2[b1(SRC##3)] ^ Td3[b0(SRC##2)] ^ rk[4 * round + 1]; \ - DST##2 = Td0[b3(SRC##2)] ^ Td1[b2(SRC##1)] ^ Td2[b1(SRC##0)] ^ Td3[b0(SRC##3)] ^ rk[4 * round + 2]; \ - DST##3 = Td0[b3(SRC##3)] ^ Td1[b2(SRC##2)] ^ Td2[b1(SRC##1)] ^ Td3[b0(SRC##0)] ^ rk[4 * round + 3]; - - -static void aes_internal_decrypt (const uint32_t rk[/*4*(Nr + 1)*/], int Nr, const uint8_t ct[16], uint8_t pt[16]) { - - uint32_t s0, s1, s2, s3, t0, t1, t2, t3; - - // map byte array block to cipher state and add initial round key - s0 = GETU32(ct ) ^ rk[0]; - s1 = GETU32(ct + 4) ^ rk[1]; - s2 = GETU32(ct + 8) ^ rk[2]; - s3 = GETU32(ct + 12) ^ rk[3]; - - AES_DEC_ROUND(t, s, 1); - AES_DEC_ROUND(s, t, 2); - AES_DEC_ROUND(t, s, 3); - AES_DEC_ROUND(s, t, 4); - AES_DEC_ROUND(t, s, 5); - AES_DEC_ROUND(s, t, 6); - AES_DEC_ROUND(t, s, 7); - AES_DEC_ROUND(s, t, 8); - AES_DEC_ROUND(t, s, 9); - - if(Nr > 10) { - AES_DEC_ROUND(s, t, 10); - AES_DEC_ROUND(t, s, 11); - if(Nr > 12) { - AES_DEC_ROUND(s, t, 12); - AES_DEC_ROUND(t, s, 13); - } - } - - rk += Nr << 2; - // apply last round and map cipher state to byte array block - s0 = m3(Td4[b3(t0)]) ^ m2(Td4[b2(t3)]) ^ m1(Td4[b1(t2)]) ^ m0(Td4[b0(t1)]) ^ rk[0]; - PUTU32(pt , s0); - s1 = m3(Td4[b3(t1)]) ^ m2(Td4[b2(t0)]) ^ m1(Td4[b1(t3)]) ^ m0(Td4[b0(t2)]) ^ rk[1]; - PUTU32(pt + 4, s1); - s2 = m3(Td4[b3(t2)]) ^ m2(Td4[b2(t1)]) ^ m1(Td4[b1(t0)]) ^ m0(Td4[b0(t3)]) ^ rk[2]; - PUTU32(pt + 8, s2); - s3 = m3(Td4[b3(t3)]) ^ m2(Td4[b2(t2)]) ^ m1(Td4[b1(t1)]) ^ m0(Td4[b0(t0)]) ^ rk[3]; - PUTU32(pt + 12, s3); -} - - -// public API - - -int aes_ecb_decrypt (unsigned char *out, const unsigned char *in, aes_context_t *ctx) { - - aes_internal_decrypt(ctx->dec_rk, ctx->Nr, in, out); - - return AES_BLOCK_SIZE; -} - - -// not used -int aes_ecb_encrypt (unsigned char *out, const unsigned char *in, aes_context_t *ctx) { - - aes_internal_encrypt(ctx->enc_rk, ctx->Nr, in, out); - - return AES_BLOCK_SIZE; -} - - -#define fix_xor(target, source) *(uint32_t*)&(target)[0] = *(uint32_t*)&(target)[0] ^ *(uint32_t*)&(source)[0]; *(uint32_t*)&(target)[4] = *(uint32_t*)&(target)[4] ^ *(uint32_t*)&(source)[4]; \ - *(uint32_t*)&(target)[8] = *(uint32_t*)&(target)[8] ^ *(uint32_t*)&(source)[8]; *(uint32_t*)&(target)[12] = *(uint32_t*)&(target)[12] ^ *(uint32_t*)&(source)[12]; - - -int aes_cbc_encrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, aes_context_t *ctx) { - - uint8_t tmp[AES_BLOCK_SIZE]; - size_t i; - size_t n; - - memcpy(tmp, iv, AES_BLOCK_SIZE); - - n = in_len / AES_BLOCK_SIZE; - for(i=0; i < n; i++) { - fix_xor(tmp, &in[i * AES_BLOCK_SIZE]); - aes_internal_encrypt(ctx->enc_rk, ctx->Nr, tmp, tmp); - memcpy(&out[i * AES_BLOCK_SIZE], tmp, AES_BLOCK_SIZE); - } - - return n * AES_BLOCK_SIZE; -} - - -int aes_cbc_decrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, aes_context_t *ctx) { - - uint8_t tmp[AES_BLOCK_SIZE]; - uint8_t old[AES_BLOCK_SIZE]; - size_t i; - size_t n; - - memcpy(tmp, iv, AES_BLOCK_SIZE); - - n = in_len / AES_BLOCK_SIZE; - for(i=0; i < n; i++) { - memcpy(old, &in[i * AES_BLOCK_SIZE], AES_BLOCK_SIZE); - aes_internal_decrypt(ctx->dec_rk, ctx->Nr, &in[i * AES_BLOCK_SIZE], &out[i * AES_BLOCK_SIZE]); - fix_xor(&out[i * AES_BLOCK_SIZE], tmp); - memcpy(tmp, old, AES_BLOCK_SIZE); - } - - return n * AES_BLOCK_SIZE; -} - - -int aes_init (const unsigned char *key, size_t key_size, aes_context_t **ctx) { - - // allocate context... - *ctx = (aes_context_t*) calloc(1, sizeof(aes_context_t)); - if(!(*ctx)) - return -1; - // ...and fill her up: - - // initialize data structures - - // check key size and make key size (given in bytes) dependant settings - switch(key_size) { - case AES128_KEY_BYTES: // 128 bit key size - break; - case AES192_KEY_BYTES: // 192 bit key size - break; - case AES256_KEY_BYTES: // 256 bit key size - break; - default: - traceEvent(TRACE_ERROR, "aes_init invalid key size %u\n", key_size); - return -1; - } - - // key materiel handling - (*ctx)->Nr = aes_internal_key_setup_enc((*ctx)->enc_rk/*[4*(Nr + 1)]*/, key, 8 * key_size); - aes_internal_key_setup_dec((*ctx)->dec_rk/*[4*(Nr + 1)]*/, key, 8 * key_size); - return 0; -} - - -#endif // openSSL 1.1, AES-NI, plain C ---------------------------------------------------------------------------- - - -int aes_deinit (aes_context_t *ctx) { - - if(ctx) free(ctx); - - return 0; -} diff --git a/bundles/n2n_ntop_v3/src/auth.c b/bundles/n2n_ntop_v3/src/auth.c deleted file mode 100644 index 68b5694b..00000000 --- a/bundles/n2n_ntop_v3/src/auth.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - - -#include "auth.h" - - -// mapping six binary bits to printable ascii character -static uint8_t b2a[64] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 0 ... 9, A ... F */ - 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, /* G ... V */ - 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, /* W ... Z, a ... l */ - 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x2b, 0x2d }; /* m ... z, + , - */ - -// mapping ascii 0x30 ...0x7f back to 6 bit binary, invalids are mapped to 0xff -static uint8_t a2b[256] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3e, 0xff, 0x3f, 0xff, 0xff, /* 0x20 ... 0x2f */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xff, 0xff, 0x3e, 0xff, 0x3f, 0xff, /* 0x30 ... 0x3f */ - 0xff, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, /* 0x40 ... 0x4f */ - 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x50 ... 0x5f */ - 0xff, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, /* 0x60 ... 0x6f */ - 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff }; /* 0x70 ... 0x7f */ - - -int bin_to_ascii (char *out, uint8_t *in, size_t in_len) { - - // in buffer contains binary data of length in_len - - // out buffer is already allocated and of size ceiling(in_len * 8 / 6) + 1 - // out buffer will be filled with a string including trailing 0x00 - - size_t bit_count = 0; - size_t out_count = 0; - uint8_t buf1, buf2; - - for(bit_count = 0; bit_count < 8 * in_len; bit_count += 6) { - buf1 = in[bit_count / 8]; - buf1 <<= bit_count % 8; - - buf2 = ((bit_count + 6) < (8 * in_len)) ? in[bit_count / 8 + 1] : 0; - buf2 >>= 8 - (bit_count % 8); - - buf1 |= buf2; - buf1 >>= 2; - - out[out_count++] = b2a[buf1]; - } - out[out_count] = 0; - - return 0; -} - - -int ascii_to_bin (uint8_t *out, char *in) { - - // in buffer contains 0x00-terminated string to be decoded - - // out buffer will contain decoded binary data - // out buffer is already allocated and of size floor(strlen(in) * 6 / 8) - - size_t in_count, out_count, bit_count; - uint16_t buf = 0; - - bit_count = 0; - out_count = 0; - for(in_count = 0; in_count < strlen(in); in_count++) { - buf <<= 6; - - int ch = in[in_count]; - if((ch > 0x20) && (ch < 0x80)) { - if(a2b[ch] != 0xFF) { - buf |= a2b[ch - 0x20]; - } else { - traceEvent(TRACE_NORMAL, "ascii_to_bin encountered the unknown character '%c'", in[in_count]); - } - } else { - traceEvent(TRACE_WARNING, "ascii_to_bin encountered a completely out-of-range character"); - } - bit_count += 6; - - if(bit_count / 8) { - bit_count -= 8; - out[out_count++] = ((uint8_t)(buf >> bit_count)); - } - - } - - return 0; -} - - -int generate_private_key (n2n_private_public_key_t key, char *in) { - - // hash the 0-terminated string input twice to generate private key - - pearson_hash_256(key, (uint8_t *)in, strlen(in)); - pearson_hash_256(key, key, sizeof(n2n_private_public_key_t)); - - return 0; -} - - -int generate_public_key (n2n_private_public_key_t pub, n2n_private_public_key_t prv) { - - // generator point '9' on curve - static uint8_t gen[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9 }; - - curve25519(pub, prv, gen); - - return 0; -} - - -int generate_shared_secret (n2n_private_public_key_t shared, n2n_private_public_key_t prv, n2n_private_public_key_t pub) { - - curve25519(shared, prv, pub); - pearson_hash_256(shared, shared, sizeof(n2n_private_public_key_t)); - - return 0; -} - - -int bind_private_key_to_username (n2n_private_public_key_t prv, char *username) { - - uint8_t tmp[32]; - - pearson_hash_256(tmp, (uint8_t *)username, strlen(username)); - memxor(prv, tmp, sizeof(n2n_private_public_key_t)); - - return 0; -} - - -// calculate SPECK ( plain = HASH³(time), key = HASH³(comm) ^ HASH³(fed) ) -int calculate_dynamic_key (uint8_t out_key[N2N_AUTH_CHALLENGE_SIZE], - uint32_t key_time, n2n_community_t comm, n2n_community_t fed) { - - uint8_t key[N2N_AUTH_CHALLENGE_SIZE]; - uint8_t tmp[N2N_AUTH_CHALLENGE_SIZE]; - speck_context_t *ctx; - - // we know that N2N_AUTH_CHALLENGE_SIZE == 16, i.e. 128 bit that can take the hash value - pearson_hash_128(key, comm, sizeof(n2n_community_t)); - pearson_hash_128(key, key, N2N_AUTH_CHALLENGE_SIZE); - pearson_hash_128(key, key, N2N_AUTH_CHALLENGE_SIZE); - - pearson_hash_128(tmp, fed, sizeof(n2n_community_t)); - pearson_hash_128(tmp, tmp, N2N_AUTH_CHALLENGE_SIZE); - pearson_hash_128(tmp, tmp, N2N_AUTH_CHALLENGE_SIZE); - - memxor(key, tmp, N2N_AUTH_CHALLENGE_SIZE); - - ctx = (speck_context_t*)calloc(1, sizeof(speck_context_t)); - speck_init((speck_context_t**)&ctx, key, 128); - - pearson_hash_128(tmp, (uint8_t*)&key_time, sizeof(key_time)); - pearson_hash_128(tmp, tmp, N2N_AUTH_CHALLENGE_SIZE); - pearson_hash_128(out_key, tmp, N2N_AUTH_CHALLENGE_SIZE); - - speck_128_encrypt(out_key, ctx); - - free(ctx); - - return 0; -} diff --git a/bundles/n2n_ntop_v3/src/cc20.c b/bundles/n2n_ntop_v3/src/cc20.c deleted file mode 100644 index 3df65840..00000000 --- a/bundles/n2n_ntop_v3/src/cc20.c +++ /dev/null @@ -1,421 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "cc20.h" - - -#if defined (HAVE_OPENSSL_1_1) // openSSL 1.1 --------------------------------------------------------------------- - - -// get any erorr message out of openssl -// taken from https://en.wikibooks.org/wiki/OpenSSL/Error_handling -static char *openssl_err_as_string (void) { - - BIO *bio = BIO_new(BIO_s_mem()); - ERR_print_errors(bio); - char *buf = NULL; - size_t len = BIO_get_mem_data(bio, &buf); - char *ret = (char *)calloc(1, 1 + len); - - if(ret) - memcpy(ret, buf, len); - - BIO_free(bio); - - return ret; -} - - -// encryption == decryption -int cc20_crypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, cc20_context_t *ctx) { - - int evp_len; - int evp_ciphertext_len; - - if(1 == EVP_EncryptInit_ex(ctx->ctx, ctx->cipher, NULL, ctx->key, iv)) { - if(1 == EVP_CIPHER_CTX_set_padding(ctx->ctx, 0)) { - if(1 == EVP_EncryptUpdate(ctx->ctx, out, &evp_len, in, in_len)) { - evp_ciphertext_len = evp_len; - if(1 == EVP_EncryptFinal_ex(ctx->ctx, out + evp_len, &evp_len)) { - evp_ciphertext_len += evp_len; - if(evp_ciphertext_len != in_len) - traceEvent(TRACE_ERROR, "cc20_crypt openssl encryption: encrypted %u bytes where %u were expected", - evp_ciphertext_len, in_len); - } else - traceEvent(TRACE_ERROR, "cc20_crypt openssl final encryption: %s", - openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "cc20_encrypt openssl encrpytion: %s", - openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "cc20_encrypt openssl padding setup: %s", - openssl_err_as_string()); - } else - traceEvent(TRACE_ERROR, "cc20_encrypt openssl init: %s", - openssl_err_as_string()); - - EVP_CIPHER_CTX_reset(ctx->ctx); - - return 0; -} - - -#elif defined (__SSE2__) // SSE2 --------------------------------------------------------------------------------- - - -// taken (and heavily modified and enhanced) from -// https://github.com/Ginurx/chacha20-c (public domain) - - -#define SL _mm_slli_epi32 -#define SR _mm_srli_epi32 -#define XOR _mm_xor_si128 -#define AND _mm_and_si128 -#define ADD _mm_add_epi32 -#define ROL(X,r) (XOR(SL(X,r),SR(X,(32-r)))) - -#define ONE _mm_setr_epi32(1, 0, 0, 0) -#define TWO _mm_setr_epi32(2, 0, 0, 0) - -#if defined (__SSSE3__) // --- SSSE3 - -#define L8 _mm_set_epi32(0x0e0d0c0fL, 0x0a09080bL, 0x06050407L, 0x02010003L) -#define L16 _mm_set_epi32(0x0d0c0f0eL, 0x09080b0aL, 0x05040706L, 0x01000302L) -#define ROL8(X) ( _mm_shuffle_epi8(X, L8)) /* SSSE 3 */ -#define ROL16(X) ( _mm_shuffle_epi8(X, L16)) /* SSSE 3 */ - -#else // --- regular SSE2 ---------- - -#define ROL8(X) ROL(X,8) -#define ROL16(X) ROL(X,16) - -#endif // -------------------------- - - -#define CC20_PERMUTE_ROWS(A,B,C,D) \ - B = _mm_shuffle_epi32(B, _MM_SHUFFLE(0, 3, 2, 1)); \ - C = _mm_shuffle_epi32(C, _MM_SHUFFLE(1, 0, 3, 2)); \ - D = _mm_shuffle_epi32(D, _MM_SHUFFLE(2, 1, 0, 3)) - -#define CC20_PERMUTE_ROWS_INV(A,B,C,D) \ - B = _mm_shuffle_epi32(B, _MM_SHUFFLE(2, 1, 0, 3)); \ - C = _mm_shuffle_epi32(C, _MM_SHUFFLE(1, 0, 3, 2)); \ - D = _mm_shuffle_epi32(D, _MM_SHUFFLE(0, 3, 2, 1)) - -#define CC20_ODD_ROUND(A,B,C,D) \ - /* odd round */ \ - A = ADD(A, B); D = ROL16(XOR(D, A)); \ - C = ADD(C, D); B = ROL(XOR(B, C), 12); \ - A = ADD(A, B); D = ROL8(XOR(D, A)); \ - C = ADD(C, D); B = ROL(XOR(B, C), 7) - -#define CC20_EVEN_ROUND(A,B,C,D) \ - CC20_PERMUTE_ROWS (A, B, C, D); \ - CC20_ODD_ROUND (A, B, C, D); \ - CC20_PERMUTE_ROWS_INV(A, B, C, D) - -#define CC20_DOUBLE_ROUND(A,B,C,D) \ - CC20_ODD_ROUND (A, B, C, D); \ - CC20_EVEN_ROUND(A, B, C, D) - -#define STOREXOR(O,I,X) \ - _mm_storeu_si128((__m128i*)O, \ - _mm_xor_si128(_mm_loadu_si128((__m128i*)I), X)); \ - I += 16; O += 16 \ - - -int cc20_crypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, cc20_context_t *ctx) { - - __m128i a, b, c, d, k0, k1, k2, k3, k4, k5, k6, k7; - - uint8_t *keystream8 = (uint8_t*)ctx->keystream32; - - const uint8_t *magic_constant = (uint8_t*)"expand 32-byte k"; - - a = _mm_loadu_si128((__m128i*)magic_constant); - b = _mm_loadu_si128((__m128i*)(ctx->key)); - c = _mm_loadu_si128( (__m128i*)((ctx->key)+16)); - d = _mm_loadu_si128((__m128i*)iv); - - while(in_len >= 128) { - k0 = a; k1 = b; k2 = c; k3 = d; - k4 = a; k5 = b; k6 = c; k7 = ADD(d, ONE); - - // 10 double rounds -- two in parallel to make better use of all 8 SSE registers - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); CC20_DOUBLE_ROUND(k4, k5, k6, k7); - - k0 = ADD(k0, a); k1 = ADD(k1, b); k2 = ADD(k2, c); k3 = ADD(k3, d); - k4 = ADD(k4, a); k5 = ADD(k5, b); k6 = ADD(k6, c); k7 = ADD(k7, d); k7 = ADD(k7, ONE); - - STOREXOR(out, in, k0); STOREXOR(out, in, k1); STOREXOR(out, in, k2); STOREXOR(out, in, k3); - STOREXOR(out, in, k4); STOREXOR(out, in, k5); STOREXOR(out, in, k6); STOREXOR(out, in, k7); - - // increment counter, make sure it is and stays little endian in memory - d = ADD(d, TWO); - - in_len -= 128; - } - - if(in_len >= 64) { - k0 = a; k1 = b; k2 = c; k3 = d; - - // 10 double rounds - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - - k0 = ADD(k0, a); k1 = ADD(k1, b); k2 = ADD(k2, c); k3 = ADD(k3, d); - - STOREXOR(out, in, k0); STOREXOR(out, in, k1); STOREXOR(out, in, k2); STOREXOR(out, in, k3); - - // increment counter, make sure it is and stays little endian in memory - d = ADD(d, ONE); - - in_len -= 64; - } - - if(in_len) { - k0 = a; k1 = b; k2 = c; k3 = d; - - // 10 double rounds - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - CC20_DOUBLE_ROUND(k0, k1, k2, k3); - - k0 = ADD(k0, a); k1 = ADD(k1, b); k2 = ADD(k2, c); k3 = ADD(k3, d); - - _mm_storeu_si128((__m128i*)&(ctx->keystream32[ 0]), k0); - _mm_storeu_si128((__m128i*)&(ctx->keystream32[ 4]), k1); - _mm_storeu_si128((__m128i*)&(ctx->keystream32[ 8]), k2); - _mm_storeu_si128((__m128i*)&(ctx->keystream32[12]), k3); - - // keep in mind that out and in got increased inside the last loop - // and point to current position now - while(in_len > 0) { - in_len--; - out[in_len] = in[in_len] ^ keystream8[in_len]; - } - } - - return(0); -} - - -#else // plain C -------------------------------------------------------------------------------------------------- - - -// taken (and modified) from https://github.com/Ginurx/chacha20-c (public domain) - - -static void cc20_init_block(cc20_context_t *ctx, const uint8_t nonce[]) { - - const uint8_t *magic_constant = (uint8_t*)"expand 32-byte k"; - - memcpy(&(ctx->state[ 0]), magic_constant, 16); - memcpy(&(ctx->state[ 4]), ctx->key, CC20_KEY_BYTES); - memcpy(&(ctx->state[12]), nonce, CC20_IV_SIZE); -} - - -#define ROL32(x,r) (((x)<<(r))|((x)>>(32-(r)))) - -#define CC20_QUARTERROUND(x, a, b, c, d) \ - x[a] += x[b]; x[d] = ROL32(x[d] ^ x[a], 16); \ - x[c] += x[d]; x[b] = ROL32(x[b] ^ x[c], 12); \ - x[a] += x[b]; x[d] = ROL32(x[d] ^ x[a], 8); \ - x[c] += x[d]; x[b] = ROL32(x[b] ^ x[c], 7) - -#define CC20_DOUBLE_ROUND(s) \ - /* odd round */ \ - CC20_QUARTERROUND(s, 0, 4, 8, 12); \ - CC20_QUARTERROUND(s, 1, 5, 9, 13); \ - CC20_QUARTERROUND(s, 2, 6, 10, 14); \ - CC20_QUARTERROUND(s, 3, 7, 11, 15); \ - /* even round */ \ - CC20_QUARTERROUND(s, 0, 5, 10, 15); \ - CC20_QUARTERROUND(s, 1, 6, 11, 12); \ - CC20_QUARTERROUND(s, 2, 7, 8, 13); \ - CC20_QUARTERROUND(s, 3, 4, 9, 14) - - -static void cc20_block_next(cc20_context_t *ctx) { - - uint32_t *counter = ctx->state + 12; - - ctx->keystream32[ 0] = ctx->state[ 0]; - ctx->keystream32[ 1] = ctx->state[ 1]; - ctx->keystream32[ 2] = ctx->state[ 2]; - ctx->keystream32[ 3] = ctx->state[ 3]; - ctx->keystream32[ 4] = ctx->state[ 4]; - ctx->keystream32[ 5] = ctx->state[ 5]; - ctx->keystream32[ 6] = ctx->state[ 6]; - ctx->keystream32[ 7] = ctx->state[ 7]; - ctx->keystream32[ 8] = ctx->state[ 8]; - ctx->keystream32[ 9] = ctx->state[ 9]; - ctx->keystream32[10] = ctx->state[10]; - ctx->keystream32[11] = ctx->state[11]; - ctx->keystream32[12] = ctx->state[12]; - ctx->keystream32[13] = ctx->state[13]; - ctx->keystream32[14] = ctx->state[14]; - ctx->keystream32[15] = ctx->state[15]; - - // 10 double rounds - CC20_DOUBLE_ROUND(ctx->keystream32); - CC20_DOUBLE_ROUND(ctx->keystream32); - CC20_DOUBLE_ROUND(ctx->keystream32); - CC20_DOUBLE_ROUND(ctx->keystream32); - CC20_DOUBLE_ROUND(ctx->keystream32); - CC20_DOUBLE_ROUND(ctx->keystream32); - CC20_DOUBLE_ROUND(ctx->keystream32); - CC20_DOUBLE_ROUND(ctx->keystream32); - CC20_DOUBLE_ROUND(ctx->keystream32); - CC20_DOUBLE_ROUND(ctx->keystream32); - - ctx->keystream32[ 0] += ctx->state[ 0]; - ctx->keystream32[ 1] += ctx->state[ 1]; - ctx->keystream32[ 2] += ctx->state[ 2]; - ctx->keystream32[ 3] += ctx->state[ 3]; - ctx->keystream32[ 4] += ctx->state[ 4]; - ctx->keystream32[ 5] += ctx->state[ 5]; - ctx->keystream32[ 6] += ctx->state[ 6]; - ctx->keystream32[ 7] += ctx->state[ 7]; - ctx->keystream32[ 8] += ctx->state[ 8]; - ctx->keystream32[ 9] += ctx->state[ 9]; - ctx->keystream32[10] += ctx->state[10]; - ctx->keystream32[11] += ctx->state[11]; - ctx->keystream32[12] += ctx->state[12]; - ctx->keystream32[13] += ctx->state[13]; - ctx->keystream32[14] += ctx->state[14]; - ctx->keystream32[15] += ctx->state[15]; - - // increment counter, make sure it is and stays little endian in memory - *counter = htole32(le32toh(*counter)+1); -} - - -static void cc20_init_context(cc20_context_t *ctx, const uint8_t *nonce) { - - cc20_init_block(ctx, nonce); -} - - -int cc20_crypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, cc20_context_t *ctx) { - - uint8_t *keystream8 = (uint8_t*)ctx->keystream32; - uint32_t * in_p = (uint32_t*)in; - uint32_t * out_p = (uint32_t*)out; - size_t tmp_len = in_len; - - cc20_init_context(ctx, iv); - - while(in_len >= 64) { - cc20_block_next(ctx); - - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 0]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 1]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 2]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 3]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 4]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 5]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 6]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 7]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 8]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[ 9]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[10]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[11]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[12]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[13]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[14]; in_p++; out_p++; - *(uint32_t*)out_p = *(uint32_t*)in_p ^ ctx->keystream32[15]; in_p++; out_p++; - - in_len -= 64; - } - - if(in_len > 0) { - cc20_block_next(ctx); - - tmp_len -= in_len; - while(in_len > 0) { - out[tmp_len] = in[tmp_len] ^ keystream8[tmp_len%64]; - tmp_len++; - in_len--; - } - } - - return(0); -} - - -#endif // openSSL 1.1, plain C ------------------------------------------------------------------------------------ - - -int cc20_init (const unsigned char *key, cc20_context_t **ctx) { - - // allocate context... - *ctx = (cc20_context_t*)calloc(1, sizeof(cc20_context_t)); - if(!(*ctx)) - return -1; -#if defined (HAVE_OPENSSL_1_1) - if(!((*ctx)->ctx = EVP_CIPHER_CTX_new())) { - traceEvent(TRACE_ERROR, "cc20_init openssl's evp_* encryption context creation failed: %s", - openssl_err_as_string()); - return -1; - } - - (*ctx)->cipher = EVP_chacha20(); -#endif - memcpy((*ctx)->key, key, CC20_KEY_BYTES); - - return 0; -} - - -int cc20_deinit (cc20_context_t *ctx) { - -#if defined (HAVE_OPENSSL_1_1) - if(ctx->ctx) EVP_CIPHER_CTX_free(ctx->ctx); -#endif - return 0; -} diff --git a/bundles/n2n_ntop_v3/src/curve25519.c b/bundles/n2n_ntop_v3/src/curve25519.c deleted file mode 100644 index 881cf734..00000000 --- a/bundles/n2n_ntop_v3/src/curve25519.c +++ /dev/null @@ -1,356 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -/** - * version 20081011 - * Matthew Dempsky - * Public domain. - * Derived from public domain code by D. J. Bernstein. - * 20140216 tweak: Mask top bit of point input. - * - */ - - -static void add (unsigned int out[32], const unsigned int a[32], const unsigned int b[32]) { - - unsigned int j; - unsigned int u; - - u = 0; - for(j = 0; j < 31; ++j) { - u += a[j] + b[j]; - out[j] = u & 255; - u >>= 8; - } - u += a[31] + b[31]; - out[31] = u; -} - - -static void sub (unsigned int out[32], const unsigned int a[32], const unsigned int b[32]) { - - unsigned int j; - unsigned int u; - - u = 218; - for(j = 0; j < 31; ++j) { - u += a[j] + 65280 - b[j]; - out[j] = u & 255; - u >>= 8; - } - u += a[31] - b[31]; - out[31] = u; -} - - -static void squeeze (unsigned int a[32]) { - - unsigned int j; - unsigned int u; - - u = 0; - for(j = 0; j < 31; ++j) { - u += a[j]; - a[j] = u & 255; - u >>= 8; - } - u += a[31]; - a[31] = u & 127; - u = 19 * (u >> 7); - for(j = 0; j < 31; ++j) { - u += a[j]; - a[j] = u & 255; - u >>= 8; - } - u += a[31]; - a[31] = u; -} - - -static const unsigned int minusp[32] = { 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; - - -static void freeze (unsigned int a[32]) { - - unsigned int aorig[32]; - unsigned int j; - unsigned int negative; - - for(j = 0; j < 32; ++j) - aorig[j] = a[j]; - add(a, a, minusp); - negative = -((a[31] >> 7) & 1); - for(j = 0; j < 32; ++j) - a[j] ^= negative & (aorig[j] ^ a[j]); -} - - -static void mult (unsigned int out[32], const unsigned int a[32], const unsigned int b[32]) { - - unsigned int i; - unsigned int j; - unsigned int u; - - for(i = 0; i < 32; ++i) { - u = 0; - for(j = 0; j <= i; ++j) - u += a[j] * b[i - j]; - for(j = i + 1; j < 32; ++j) - u += 38 * a[j] * b[i + 32 - j]; - out[i] = u; - } - squeeze(out); -} - - -static void mult121665 (unsigned int out[32], const unsigned int a[32]) { - - unsigned int j; - unsigned int u; - - u = 0; - for(j = 0; j < 31; ++j) { - u += 121665 * a[j]; - out[j] = u & 255; - u >>= 8; - } - u += 121665 * a[31]; - out[31] = u & 127; - u = 19 * (u >> 7); - for(j = 0; j < 31; ++j) { - u += out[j]; - out[j] = u & 255; - u >>= 8; - } - u += out[j]; - out[j] = u; -} - - -static void square (unsigned int out[32], const unsigned int a[32]) { - - unsigned int i; - unsigned int j; - unsigned int u; - - for(i = 0; i < 32; ++i) { - u = 0; - for(j = 0; j < i - j; ++j) - u += a[j] * a[i - j]; - for(j = i + 1; j < i + 32 - j; ++j) - u += 38 * a[j] * a[i + 32 - j]; - u *= 2; - if((i & 1) == 0) { - u += a[i / 2] * a[i / 2]; - u += 38 * a[i / 2 + 16] * a[i / 2 + 16]; - } - out[i] = u; - } - squeeze(out); -} - - -static void select (unsigned int p[64], unsigned int q[64], const unsigned int r[64], - const unsigned int s[64], unsigned int b) { - - unsigned int j; - unsigned int t; - unsigned int bminus1; - - bminus1 = b - 1; - for(j = 0; j < 64; ++j) { - t = bminus1 & (r[j] ^ s[j]); - p[j] = s[j] ^ t; - q[j] = r[j] ^ t; - } -} - - -static void mainloop (unsigned int work[64], const unsigned char e[32]) { - - unsigned int xzm1[64]; - unsigned int xzm[64]; - unsigned int xzmb[64]; - unsigned int xzm1b[64]; - unsigned int xznb[64]; - unsigned int xzn1b[64]; - unsigned int a0[64]; - unsigned int a1[64]; - unsigned int b0[64]; - unsigned int b1[64]; - unsigned int c1[64]; - unsigned int r[32]; - unsigned int s[32]; - unsigned int t[32]; - unsigned int u[32]; - unsigned int j; - unsigned int b; - int pos; - - for(j = 0; j < 32; ++j) - xzm1[j] = work[j]; - xzm1[32] = 1; - for(j = 33; j < 64; ++j) - xzm1[j] = 0; - - xzm[0] = 1; - for(j = 1; j < 64; ++j) - xzm[j] = 0; - - for(pos = 254; pos >= 0; --pos) { - b = e[pos / 8] >> (pos & 7); - b &= 1; - select(xzmb, xzm1b, xzm, xzm1, b); - add(a0, xzmb, xzmb + 32); - sub(a0 + 32, xzmb, xzmb + 32); - add (a1, xzm1b, xzm1b + 32); - sub(a1 + 32, xzm1b, xzm1b + 32); - square(b0, a0); - square(b0 + 32, a0 + 32); - mult(b1, a1, a0 + 32); - mult(b1 + 32, a1 + 32, a0); - add(c1, b1, b1 + 32); - sub(c1 + 32, b1, b1 + 32); - square(r, c1 + 32); - sub(s, b0, b0 + 32); - mult121665 (t, s); - add(u, t, b0); - mult(xznb, b0, b0 + 32); - mult(xznb + 32, s, u); - square(xzn1b, c1); - mult(xzn1b + 32, r, work); - select(xzm, xzm1, xznb, xzn1b, b); - } - - for(j = 0; j < 64; ++j) - work[j] = xzm[j]; -} - - -static void recip (unsigned int out[32], const unsigned int z[32]) { - - unsigned int z2[32]; - unsigned int z9[32]; - unsigned int z11[32]; - unsigned int z2_5_0[32]; - unsigned int z2_10_0[32]; - unsigned int z2_20_0[32]; - unsigned int z2_50_0[32]; - unsigned int z2_100_0[32]; - unsigned int t0[32]; - unsigned int t1[32]; - int i; - - /* 2 */ square(z2, z); - /* 4 */ square(t1, z2); - /* 8 */ square(t0, t1); - /* 9 */ mult(z9, t0, z); - /* 11 */ mult(z11, z9, z2); - /* 22 */ square(t0, z11); - /* 2^5 - 2^0 = 31 */ mult(z2_5_0, t0, z9); - - /* 2^6 - 2^1 */ square(t0, z2_5_0); - /* 2^7 - 2^2 */ square(t1, t0); - /* 2^8 - 2^3 */ square(t0, t1); - /* 2^9 - 2^4 */ square(t1, t0); - /* 2^10 - 2^5 */ square(t0, t1); - /* 2^10 - 2^0 */ mult(z2_10_0, t0, z2_5_0); - - /* 2^11 - 2^1 */ square(t0, z2_10_0); - /* 2^12 - 2^2 */ square(t1, t0); - /* 2^20 - 2^10 */ for(i = 2; i < 10; i += 2) { - square(t0, t1); - square(t1, t0); - } - /* 2^20 - 2^0 */ mult(z2_20_0, t1, z2_10_0); - - /* 2^21 - 2^1 */ square(t0, z2_20_0); - /* 2^22 - 2^2 */ square(t1, t0); - /* 2^40 - 2^20 */ for(i = 2; i < 20; i += 2) { - square(t0, t1); - square(t1, t0); - } - /* 2^40 - 2^0 */ mult(t0, t1, z2_20_0); - - /* 2^41 - 2^1 */ square(t1, t0); - /* 2^42 - 2^2 */ square(t0, t1); - /* 2^50 - 2^10 */ for(i = 2; i < 10; i += 2) { - square(t1, t0); - square(t0, t1); - } - /* 2^50 - 2^0 */ mult(z2_50_0, t0, z2_10_0); - - /* 2^51 - 2^1 */ square(t0, z2_50_0); - /* 2^52 - 2^2 */ square(t1, t0); - /* 2^100 - 2^50 */ for(i = 2; i < 50; i += 2) { - square(t0, t1); - square(t1, t0); - } - /* 2^100 - 2^0 */ mult(z2_100_0, t1, z2_50_0); - - /* 2^101 - 2^1 */ square(t1, z2_100_0); - /* 2^102 - 2^2 */ square(t0, t1); - /* 2^200 - 2^100 */ for(i = 2; i < 100; i += 2) { - square(t1, t0); - square(t0, t1); - } - /* 2^200 - 2^0 */ mult(t1, t0, z2_100_0); - - /* 2^201 - 2^1 */ square(t0, t1); - /* 2^202 - 2^2 */ square(t1, t0); - /* 2^250 - 2^50 */ for(i = 2; i < 50; i += 2) { - square(t0, t1); - square(t1, t0); - } - /* 2^250 - 2^0 */ mult(t0, t1, z2_50_0); - - /* 2^251 - 2^1 */ square(t1, t0); - /* 2^252 - 2^2 */ square(t0, t1); - /* 2^253 - 2^3 */ square(t1, t0); - /* 2^254 - 2^4 */ square(t0, t1); - /* 2^255 - 2^5 */ square(t1, t0); - /* 2^255 - 21 */ mult(out, t1, z11); -} - - -void curve25519 (unsigned char *q, const unsigned char *n, const unsigned char *p) { - - unsigned int work[96]; - unsigned char e[32]; - unsigned int i; - - for (i = 0; i < 32; ++i) - e[i] = n[i]; - e[0] &= 248; - e[31] &= 127; - e[31] |= 64; - - for (i = 0; i < 32; ++i) - work[i] = p[i]; - work[31] &= 127; - - mainloop(work, e); - recip(work + 32, work + 32); - mult(work + 64, work, work + 32); - freeze(work + 64); - - for(i = 0; i < 32; ++i) - q[i] = work[64 + i]; -} diff --git a/bundles/n2n_ntop_v3/src/edge.c b/bundles/n2n_ntop_v3/src/edge.c deleted file mode 100644 index 6ccdd28c..00000000 --- a/bundles/n2n_ntop_v3/src/edge.c +++ /dev/null @@ -1,1366 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -/* *************************************************** */ - -/** maximum length of command line arguments */ -#define MAX_CMDLINE_BUFFER_LENGTH 4096 - -/** maximum length of a line in the configuration file */ -#define MAX_CONFFILE_LINE_LENGTH 1024 - -/* ***************************************************** */ - -#ifdef HAVE_LIBCAP - -#include -#include -#include "network_traffic_filter.h" - -static cap_value_t cap_values[] = { - //CAP_NET_RAW, /* Use RAW and PACKET sockets */ - CAP_NET_ADMIN /* Needed to performs routes cleanup at exit */ -}; - -int num_cap = sizeof(cap_values)/sizeof(cap_value_t); -#endif - -// forward declaration for use in main() -void send_register_super (n2n_edge_t *eee); -void send_query_peer (n2n_edge_t *eee, const n2n_mac_t dst_mac); -int supernode_connect (n2n_edge_t *eee); -int supernode_disconnect (n2n_edge_t *eee); -int fetch_and_eventually_process_data (n2n_edge_t *eee, SOCKET sock, - uint8_t *pktbuf, uint16_t *expected, uint16_t *position, - time_t now); -int resolve_check (n2n_resolve_parameter_t *param, uint8_t resolution_request, time_t now); -int edge_init_routes (n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_routes); - -/* ***************************************************** */ - -/** Find the address and IP mode for the tuntap device. - * - * s is of the form: - * - * ["static"|"dhcp",":"] (|) [/] - * - * for example static:192.168.8.5/24 - * - * Fill the parts of the string into the fileds, ip_mode only if - * present. All strings are NULL terminated. - * - * return 0 on success and -1 on error - */ -static int scan_address (char * ip_addr, size_t addr_size, - char * netmask, size_t netmask_size, - char * ip_mode, size_t mode_size, - char * s) { - - int retval = -1; - char * start; - char * end; - int bitlen = N2N_EDGE_DEFAULT_CIDR_NM; - - if((NULL == s) || (NULL == ip_addr) || (NULL == netmask)) { - return -1; - } - - memset(ip_addr, 0, addr_size); - memset(netmask, 0, netmask_size); - - start = s; - end = strpbrk(s, ":"); - - if(end) { - // colon is present - if(ip_mode) { - memset(ip_mode, 0, mode_size); - strncpy(ip_mode, start, (size_t)MIN(end - start, mode_size - 1)); - } - start = end + 1; - } else { - // colon is not present - } - // start now points to first address character - retval = 0; // we have got an address - - end = strpbrk(start, "/"); - - if(!end) - // no slash present -- default end - end = s + strlen(s); - - strncpy(ip_addr, start, (size_t)MIN(end - start, addr_size - 1)); // ensure NULL term - - if(end) { - // slash is present - - // now, handle the sub-network address - sscanf(end + 1, "%u", &bitlen); - bitlen = htobe32(bitlen2mask(bitlen)); - inet_ntop(AF_INET, &bitlen, netmask, netmask_size); - } - - return retval; -} - -/* *************************************************** */ - -static void help (int level) { - - if(level == 0) return; /* no help required */ - - printf("\n"); - print_n2n_version(); - - if(level == 1) /* short help */ { - - printf(" basic usage: edge (see edge.conf)\n" - "\n" - " or edge " - " -c " - "\n " - " -l : " - "\n " - "[-a ] " - "\n " -#if defined(N2N_CAN_NAME_IFACE) - "[-d ] " - "\n " -#endif - "[-k ] " - "\n" - "\n -h shows a quick reference including all available options" - "\n --help gives a detailed parameter description" - "\n man files for n2n, edge, and superndode contain in-depth information" - "\n\n"); - - } else if(level == 2) /* quick reference */ { - - printf(" general usage: edge (see edge.conf)\n" - "\n" - " or edge " - " -c " - " -l " - "\n " - "[-p [:]] " - "\n " - -#ifdef __linux__ - "[-T ] " -#endif -#ifndef __APPLE__ - "[-D] " -#endif - "\n options for under- " - "[-i ] " - "[-L ] " - "\n lying connection " - "[-k ] " - "[-A] " - "[-H] " - "[-z] " - "\n " - "[-e ] [-S]" - "\n " - "[--select-rtt]" - "\n\n tap device and " - "[-a [static:|dhcp:][/]] " - "\n overlay network " - "[-m ] " -#if defined(N2N_CAN_NAME_IFACE) - "[-d ] " -#endif - "\n configuration " - "[-M ] " - "[-r] " - "[-E] " - "[-I ] " - "\n " - "[-J ] " - "[-P ] " - "[-R ] " -#ifdef WIN32 - "\n " - "[-x ] " -#endif - "\n\n local options " -#ifndef WIN32 - "[-f] " -#endif - "[-t ] " - "[--management-password ] " - "\n " - "[-v] " - "[-n ] " -#ifndef WIN32 - "\n " - "[-u ] " - "[-g ] " -#endif - "\n\n environment " - "N2N_KEY instead of [-k ]" - "\n variables " - "N2N_COMMUNITY instead of -c " - "\n " - "N2N_PASSWORD instead of [-J ]" - - "\n " - - "\n meaning of the " -#ifndef __APPLE__ - "[-D] enable PMTU discovery" -#endif - "\n flag options [-H] enable header encryption" - "\n [-r] enable packet forwarding through n2n community" - "\n [-E] accept multicast MAC addresses" - "\n [--select-rtt] select supernode by round trip time" - "\n [--select-mac] select supernode by MAC address" -#ifndef WIN32 - "\n [-f] do not fork but run in foreground" -#endif - "\n [-v] make more verbose, repeat as required" - "\n " - - "\n -h shows this quick reference including all available options" - "\n --help gives a detailed parameter description" - "\n man files for n2n, edge, and superndode contain in-depth information" - "\n\n"); - - } else /* long help */ { - - printf(" general usage: edge (see edge.conf)\n" - "\n" - " or edge -c -l \n" - " [further optional command line parameters]\n\n" - ); - printf (" OPTIONS FOR THE UNDERLYING NETWORK CONNECTION\n"); - printf (" ---------------------------------------------\n\n"); - printf(" -c | n2n community name the edge belongs to\n"); - printf(" -l | supernode ip address or name, and port\n"); - printf(" -p [:] | fixed local UDP port and optionally bind to the\n" - " | sepcified local IP address only (any by default)\n"); -#ifdef __linux__ - printf(" -T | TOS for packets, e.g. 0x48 for SSH like priority\n"); -#endif -#ifndef __APPLE__ - printf(" -D | enable PMTU discovery, it can reduce fragmentation but\n" - " | causes connections to stall if not properly supported\n"); -#endif - printf(" -e | advertises the provided local IP address as preferred,\n" - " | useful if multicast peer detection is not available,\n" - " | '-e auto' tries IP address auto-detection\n"); - printf(" -S1 ... -S2 | do not connect p2p, always use the supernode,\n" - " | -S1 = via UDP" - -#ifdef N2N_HAVE_TCP - ", -S2 = via TCP" -#endif -"\n"); - printf(" -i | registration interval, for NAT hole punching (default\n" - " | %u seconds)\n", REGISTER_SUPER_INTERVAL_DFL); - printf(" -L | TTL for registration packet for NAT hole punching through\n" - " | supernode (default 0 for not set)\n"); - printf(" -k | encryption key (ASCII) - also N2N_KEY=\n"); - printf(" -A1 | disable payload encryption, do not use with key, defaults\n" - " | to AES then\n"); - printf(" -A2 ... -A5 | choose a cipher for payload encryption, requires a key,\n" - " | -A2 = Twofish, -A3 = AES (default if key provided),\n" - " | -A4 = ChaCha20, -A5 = Speck-CTR\n"); - printf(" -H | use header encryption, supernode needs fixed community\n"); - printf(" -z1 ... -z2 | compress outgoing data packets, -z1 = lzo1x,\n" - " | " -#ifdef N2N_HAVE_ZSTD - "-z2 = zstd, " -#endif - "disabled by default\n"); - printf("--select-rtt | supernode selection based on round trip time\n" - "--select-mac | supernode selection based on MAC address (default:\n" - " | by load)\n"); - - printf ("\n"); - printf (" TAP DEVICE AND OVERLAY NETWORK CONFIGURATION\n"); - printf (" --------------------------------------------\n\n"); - printf(" -a [mode][/n] | interface address and optional CIDR subnet, default '/24',\n" - " | mode = [static|dhcp]:, for DHCP use '-r -a dhcp:0.0.0.0',\n" - " | edge draws IP address from supernode if no '-a ...' given\n"); - printf(" -m | fixed MAC address for the TAP interface, e.g.\n" - " | '-m 10:20:30:40:50:60', random otherwise\n"); -#if defined(N2N_CAN_NAME_IFACE) - printf(" -d | TAP device name\n"); -#endif - printf(" -M | specify n2n MTU of TAP interface, default %d\n", DEFAULT_MTU); - printf(" -r | enable packet forwarding through n2n community\n"); - printf(" -E | accept multicast MAC addresses, drop by default\n"); - printf(" -I | annotate the edge's description used for easier\n" - " | identification in management port output or username\n"); - printf(" -J | password for user-password edge authentication\n"); - printf(" -P | federation public key for user-password authentication\n"); - printf(" -R | drop or accept packets by rules, can be set multiple times\n"); - printf(" | rule format: 'src_ip/n:[s_port,e_port],...\n" - " | |on same| ...dst_ip/n:[s_port,e_port],...\n" - " | | line | ...TCP+/-,UDP+/-,ICMP+/-'\n"); -#ifdef WIN32 - printf(" -x | set TAP interface metric, defaults to 0 (auto),\n" - " | e.g. set to 1 for better multiplayer game detection\n"); -#endif - printf ("\n"); - printf (" LOCAL OPTIONS\n"); - printf (" -------------\n\n"); -#ifndef WIN32 - printf(" -f | do not fork and run as a daemon, rather run in foreground\n"); -#endif - printf(" -t | management UDP port, for multiple edges on a machine,\n" - " | defaults to %u\n", N2N_EDGE_MGMT_PORT); - printf(" --management_... | management port password, defaults to '%s'\n" - " ...password | \n", N2N_MGMT_PASSWORD); - printf(" -v | make more verbose, repeat as required\n"); - printf(" -n | route an IPv4 network via the gateway, use 0.0.0.0/0 for\n" - " | the default gateway, can be set multiple times\n"); -#ifndef WIN32 - printf(" -u | numeric user ID to use when privileges are dropped\n"); - printf(" -g | numeric group ID to use when privileges are dropped\n"); -#endif - printf ("\n"); - printf (" ENVIRONMENT VARIABLES\n"); - printf (" ---------------------\n\n"); - printf(" N2N_KEY | encryption key (ASCII), not with '-k ...'\n"); - printf(" N2N_COMMUNITY | community name (ASCII), overwritten by '-c ...'\n"); - printf(" N2N_PASSWORD | password (ASCII) for user-password authentication,\n" - " | overwritten by '-J ...'\n"); -#ifdef WIN32 - printf ("\n"); - printf (" AVAILABLE TAP ADAPTERS\n"); - printf (" ----------------------\n\n"); - win_print_available_adapters(); -#endif - printf ("\n" - "\n -h shows a quick reference including all available options" - "\n --help gives this detailed parameter description" - "\n man files for n2n, edge, and superndode contain in-depth information" - "\n\n"); - } - - exit(0); -} - -/* *************************************************** */ - -static void setPayloadCompression (n2n_edge_conf_t *conf, int compression) { - - /* even though 'compression' and 'conf->compression' share the same encoding scheme, - * a switch-statement under conditional compilation is used to sort out the - * unsupported optarguments */ - switch (compression) { - case 1: { - conf->compression = N2N_COMPRESSION_ID_LZO; - break; - } -#ifdef N2N_HAVE_ZSTD - case 2: { - conf->compression = N2N_COMPRESSION_ID_ZSTD; - break; - } -#endif - default: { - conf->compression = N2N_COMPRESSION_ID_NONE; - // internal comrpession scheme numbering differs from cli counting by one, hence plus one - // (internal: 0 == invalid, 1 == none, 2 == lzo, 3 == zstd) - traceEvent(TRACE_NORMAL, "the %s compression given by -z_ option is not supported in this version", compression_str(compression + 1)); - exit(1); // to make the user aware - } - } -} - -/* *************************************************** */ - -static void setPayloadEncryption (n2n_edge_conf_t *conf, int cipher) { - - /* even though 'cipher' and 'conf->transop_id' share the same encoding scheme, - * a switch-statement under conditional compilation is used to sort out the - * unsupported ciphers */ - switch (cipher) { - case 1: { - conf->transop_id = N2N_TRANSFORM_ID_NULL; - break; - } - - case 2: { - conf->transop_id = N2N_TRANSFORM_ID_TWOFISH; - break; - } - - case 3: { - conf->transop_id = N2N_TRANSFORM_ID_AES; - break; - } - - case 4: { - conf->transop_id = N2N_TRANSFORM_ID_CHACHA20; - break; - } - - case 5: { - conf->transop_id = N2N_TRANSFORM_ID_SPECK; - break; - } - - default: { - conf->transop_id = N2N_TRANSFORM_ID_INVAL; - traceEvent(TRACE_NORMAL, "the %s cipher given by -A_ option is not supported in this version", transop_str(cipher)); - exit(1); - } - } -} - -/* *************************************************** */ - -static int setOption (int optkey, char *optargument, n2n_tuntap_priv_config_t *ec, n2n_edge_conf_t *conf) { - - /* traceEvent(TRACE_NORMAL, "Option %c = %s", optkey, optargument ? optargument : ""); */ - - switch(optkey) { - case 'a': /* IP address and mode of TUNTAP interface */ { - scan_address(ec->ip_addr, N2N_NETMASK_STR_SIZE, - ec->netmask, N2N_NETMASK_STR_SIZE, - ec->ip_mode, N2N_IF_MODE_SIZE, - optargument); - break; - } - - case 'c': /* community as a string */ { - strncpy((char *)conf->community_name, optargument, N2N_COMMUNITY_SIZE); - conf->community_name[N2N_COMMUNITY_SIZE - 1] = '\0'; - break; - } - - case 'E': /* multicast ethernet addresses accepted. */ { - conf->drop_multicast = 0; - traceEvent(TRACE_INFO, "enabling ethernet multicast traffic"); - break; - } - -#ifndef WIN32 - case 'u': /* unprivileged uid */ { - ec->userid = atoi(optargument); - break; - } - - case 'g': /* unprivileged uid */ { - ec->groupid = atoi(optargument); - break; - } -#endif - -#ifndef WIN32 - case 'f' : /* do not fork as daemon */ { - ec->daemon = 0; - break; - } -#endif /* #ifndef WIN32 */ - - case 'm' : /* TUNTAP MAC address */ { - strncpy(ec->device_mac, optargument, N2N_MACNAMSIZ); - ec->device_mac[N2N_MACNAMSIZ - 1] = '\0'; - break; - } - - case 'M' : /* TUNTAP MTU */ { - ec->mtu = atoi(optargument); - break; - } - -#ifndef __APPLE__ - case 'D' : /* enable PMTU discovery */ { - conf->disable_pmtu_discovery = 0; - break; - } -#endif - - case 'k': /* encrypt key */ { - if(conf->encrypt_key) free(conf->encrypt_key); - conf->encrypt_key = strdup(optargument); - traceEvent(TRACE_DEBUG, "encrypt_key = '%s'\n", conf->encrypt_key); - break; - } - - case 'r': /* enable packet routing across n2n endpoints */ { - conf->allow_routing = 1; - break; - } - - case 'A': { - int cipher; - - if(optargument) { - cipher = atoi(optargument); - } else { - traceEvent(TRACE_WARNING, "the use of the solitary -A switch is deprecated and will not be supported in future versions, " - "please use -A3 instead to choose AES cipher for payload encryption"); - - cipher = N2N_TRANSFORM_ID_AES; // default, if '-A' only - } - - setPayloadEncryption(conf, cipher); - break; - } - - case 'H': /* indicate header encryption */ { - /* we cannot be sure if this gets parsed before the community name is set. - * so, only an indicator is set, action is taken later*/ - conf->header_encryption = HEADER_ENCRYPTION_ENABLED; - break; - } - - case 'z': { - int compression; - - if(optargument) { - compression = atoi(optargument); - } else { - traceEvent(TRACE_WARNING, "the use of the solitary -z switch is deprecated and will not be supported in future versions, " - "please use -z1 instead to choose LZO1X algorithm for payload compression"); - - compression = 1; // default, if '-z' only, equals -z1 - } - - setPayloadCompression(conf, compression); - break; - } - - case 'l': /* supernode-list */ { - if(optargument) { - if(edge_conf_add_supernode(conf, optargument) != 0) { - traceEvent(TRACE_WARNING, "failed to add supernode '%s'", optargument); - } - } - break; - } - - case 'i': /* supernode registration interval */ - conf->register_interval = atoi(optargument); - break; - - case 'L': /* supernode registration interval */ - conf->register_ttl = atoi(optarg); - break; - -#if defined(N2N_CAN_NAME_IFACE) - case 'd': /* TUNTAP name */ { - strncpy(ec->tuntap_dev_name, optargument, N2N_IFNAMSIZ); - ec->tuntap_dev_name[N2N_IFNAMSIZ - 1] = '\0'; - break; - } -#endif - case 'I': /* Device Description (hint) or username */ { - strncpy((char *)conf->dev_desc, optargument, N2N_DESC_SIZE); - conf->dev_desc[N2N_DESC_SIZE - 1] = '\0'; - break; - } - - case 'J': /* password for user-password authentication */ { - if(!conf->shared_secret) /* we could already have it from environment variable, see edge_init_conf_defaults() */ - conf->shared_secret = calloc(1, sizeof(n2n_private_public_key_t)); - if(conf->shared_secret) - generate_private_key(*(conf->shared_secret), optargument); - - // the hash of the username (-I) gets xored into this key later, - // we can't be sure to already have it at this point - // also, the complete shared secret will be calculated then as we - // might still be missing the federation public key as well - break; - } - - case 'P': /* federation public key for user-password authentication */ { - if(strlen(optargument) < ((N2N_PRIVATE_PUBLIC_KEY_SIZE * 8 + 5)/ 6 + 1)) { - conf->federation_public_key = calloc(1, sizeof(n2n_private_public_key_t)); - if(conf->federation_public_key) { - ascii_to_bin(*(conf->federation_public_key), optargument); - } - } else { - traceEvent(TRACE_WARNING, "public key too long"); - return 2; - } - break; - } - - case 'p': { - char* colon = strpbrk(optargument, ":"); - if(colon) { /*ip address:port */ - *colon = 0; - conf->bind_address = ntohl(inet_addr(optargument)); - conf->local_port = atoi(++colon); - - if(conf->bind_address == INADDR_NONE) { - traceEvent(TRACE_WARNING, "bad address to bind to, binding to any IP address"); - conf->bind_address = INADDR_ANY; - } - if(conf->local_port == 0) { - traceEvent(TRACE_WARNING, "bad local port format, using OS assigned port"); - } - } else { /* ip address or port only */ - char* dot = strpbrk(optargument, "."); - if(dot) { /* ip address only */ - conf->bind_address = ntohl(inet_addr(optargument)); - if(conf->bind_address == INADDR_NONE) { - traceEvent(TRACE_WARNING, "bad address to bind to, binding to any IP address"); - conf->bind_address = INADDR_ANY; - } - } else { /* port only */ - conf->local_port = atoi(optargument); - if(conf->local_port == 0) { - traceEvent(TRACE_WARNING, "bad local port format, using OS assigned port"); - } - } - } - break; - } - - case 'e': { - in_addr_t address_tmp; - - if(optargument) { - - if(!strcmp(optargument, "auto")) { - address_tmp = INADDR_ANY; - conf->preferred_sock_auto = 1; - } else { - address_tmp = inet_addr(optargument); - } - - memcpy(&(conf->preferred_sock.addr.v4), &(address_tmp), IPV4_SIZE); - - if(address_tmp == INADDR_NONE) { - traceEvent(TRACE_WARNING, "bad address for preferred local socket, skipping"); - conf->preferred_sock.family = AF_INVALID; - break; - } else { - conf->preferred_sock.family = AF_INET; - // port is set after parsing all cli parameters during supernode_connect() - } - - } - - break; - } - - case 't': { - conf->mgmt_port = atoi(optargument); - break; - } -#ifdef __linux__ - case 'T': { - if((optargument[0] == '0') && (optargument[1] == 'x')) - conf->tos = strtol(&optargument[2], NULL, 16); - else - conf->tos = atoi(optargument); - - break; - } -#endif - case 'n': { - char cidr_net[64], gateway[64]; - n2n_route_t route; - - if(sscanf(optargument, "%63[^/]/%hhd:%63s", cidr_net, &route.net_bitlen, gateway) != 3) { - traceEvent(TRACE_WARNING, "bad cidr/gateway format '%d'", optargument); - return 2; - } - - route.net_addr = inet_addr(cidr_net); - route.gateway = inet_addr(gateway); - - if((route.net_bitlen < 0) || (route.net_bitlen > 32)) { - traceEvent(TRACE_WARNING, "bad prefix '%d' in '%s'", route.net_bitlen, optargument); - return 2; - } - - if(route.net_addr == INADDR_NONE) { - traceEvent(TRACE_WARNING, "bad network '%s' in '%s'", cidr_net, optargument); - return 2; - } - - if(route.gateway == INADDR_NONE) { - traceEvent(TRACE_WARNING, "bad gateway '%s' in '%s'", gateway, optargument); - return 2; - } - - traceEvent(TRACE_NORMAL, "adding %s/%d via %s", cidr_net, route.net_bitlen, gateway); - - conf->routes = realloc(conf->routes, sizeof(struct n2n_route) * (conf->num_routes + 1)); - conf->routes[conf->num_routes] = route; - conf->num_routes++; - - break; - } - - case 'S': { - int solitude; - if(optargument) { - solitude = atoi(optargument); - } else { - traceEvent(TRACE_WARNING, "the use of the solitary -S switch is deprecated and will not be supported in future versions, " - "please use -S1 instead to choose supernode-only connection via UDP"); - - solitude = 1; - } - - // set the level - if(solitude >= 1) - conf->allow_p2p = 0; -#ifdef N2N_HAVE_TCP - if(solitude == 2) - conf->connect_tcp = 1; -#endif - break; - } - - case '[': /* round-trip-time-based supernode selection strategy */ { - // overwrites the default load-based strategy - conf->sn_selection_strategy = SN_SELECTION_STRATEGY_RTT; - - break; - } - - case ']': /* mac-address-based supernode selection strategy */ { - // overwrites the default load-based strategy - conf->sn_selection_strategy = SN_SELECTION_STRATEGY_MAC; - - break; - } - - case '{': /* password for management port */ { - conf->mgmt_password_hash = pearson_hash_64((uint8_t*)optargument, strlen(optargument)); - - break; - } - - case 'h': /* quick reference */ { - return 2; - } - - case '@': /* long help */ { - return 3; - } - - case 'v': /* verbose */ - setTraceLevel(getTraceLevel() + 1); - break; - - case 'R': /* network traffic filter */ { - filter_rule_t *new_rule = malloc(sizeof(filter_rule_t)); - memset(new_rule, 0, sizeof(filter_rule_t)); - - if(process_traffic_filter_rule_str(optargument, new_rule)) { - HASH_ADD(hh, conf->network_traffic_filter_rules, key, sizeof(filter_rule_key_t), new_rule); - } else { - free(new_rule); - traceEvent(TRACE_WARNING, "invalid filter rule: %s", optargument); - return 2; - } - break; - } -#ifdef WIN32 - case 'x': { - conf->metric = atoi(optargument); - ec->metric = atoi(optargument); - break; - } -#endif - default: { - traceEvent(TRACE_WARNING, "unknown option -%c", (char)optkey); - return 2; - } - } - - return 0; -} - -/* *********************************************** */ - - -static const struct option long_options[] = - { - { "community", required_argument, NULL, 'c' }, - { "supernode-list", required_argument, NULL, 'l' }, - { "tap-device", required_argument, NULL, 'd' }, - { "euid", required_argument, NULL, 'u' }, - { "egid", required_argument, NULL, 'g' }, - { "verbose", no_argument, NULL, 'v' }, - { "help", no_argument, NULL, '@' }, /* internal special character '@' to identify long help case */ - { "select-rtt", no_argument, NULL, '[' }, /* '[' rtt selection strategy */ - { "select-mac", no_argument, NULL, ']' }, /* ']' mac selection strategy */ - { "management-password", required_argument, NULL, '{' }, /* '{' management port password */ - { NULL, 0, NULL, 0 } - }; - -/* *************************************************** */ - -/* read command line options */ -static int loadFromCLI (int argc, char *argv[], n2n_edge_conf_t *conf, n2n_tuntap_priv_config_t *ec) { - - u_char c; - - while ((c = getopt_long(argc, argv, - "k:a:c:Eu:g:m:M:s:d:l:p:fvhrt:i:I:J:P:S::DL:z::A::Hn:R:e:" -#ifdef __linux__ - "T:" -#endif -#ifdef WIN32 - "x:" -#endif - , - long_options, NULL)) != '?') { - - if(c == 255) break; - help(setOption(c, optarg, ec, conf)); - - } - - return 0; -} - -/* *************************************************** */ - -static char *trim (char *s) { - - char *end; - - while(isspace(s[0]) || (s[0] == '"') || (s[0] == '\'')) s++; - if(s[0] == 0) return s; - - end = &s[strlen(s) - 1]; - while(end > s - && (isspace(end[0])|| (end[0] == '"') || (end[0] == '\''))) - end--; - end[1] = 0; - - return s; -} - -/* *************************************************** */ - -/* parse the configuration file */ -static int loadFromFile (const char *path, n2n_edge_conf_t *conf, n2n_tuntap_priv_config_t *ec) { - - char buffer[4096], *line; - char *line_vec[3]; - int tmp; - - FILE *fd; - - fd = fopen(path, "r"); - - if(fd == NULL) { - traceEvent(TRACE_WARNING, "config file %s not found", path); - return -1; - } - - // we mess around with optind, better save it - tmp = optind; - - while((line = fgets(buffer, sizeof(buffer), fd)) != NULL) { - line = trim(line); - - if(strlen(line) < 2 || line[0] == '#') - continue; - - // executable, cannot be omitted, content can be anything - line_vec[0] = line; - // first token, e.g. `-p` or `-A3', eventually followed by a whitespace or '=' delimiter - line_vec[1] = strtok(line, "\t ="); - // separate parameter option, if present - line_vec[2] = strtok(NULL, ""); - if(line_vec[2]) - line_vec[2] = trim(line_vec[2]); - // not to duplicate the option parser code, call loadFromCLI and pretend we have no option read yet at all - optind = 0; - // if second token present (optional argument, not part of first), then announce 3 vector members - loadFromCLI(line_vec[2] ? 3 : 2, line_vec, conf, ec); - } - - fclose(fd); - optind = tmp; - - return 0; -} - -/* ************************************** */ - -#ifndef WIN32 -static void daemonize () { - int childpid; - - traceEvent(TRACE_NORMAL, "parent process is exiting (this is normal)"); - - signal(SIGPIPE, SIG_IGN); - signal(SIGHUP, SIG_IGN); - signal(SIGCHLD, SIG_IGN); - signal(SIGQUIT, SIG_IGN); - - if((childpid = fork()) < 0) - traceEvent(TRACE_ERROR, "occurred while daemonizing (errno=%d)", - errno); - else { - if(!childpid) { /* child */ - int rc; - - //traceEvent(TRACE_NORMAL, "Bye bye: I'm becoming a daemon..."); - rc = chdir("/"); - if(rc != 0) - traceEvent(TRACE_ERROR, "error while moving to / directory"); - - setsid(); /* detach from the terminal */ - - fclose(stdin); - fclose(stdout); - /* fclose(stderr); */ - - /* - * clear any inherited file mode creation mask - */ - //umask(0); - - /* - * Use line buffered stdout - */ - /* setlinebuf (stdout); */ - setvbuf(stdout, (char *)NULL, _IOLBF, 0); - } else /* father */ - exit(0); - } -} -#endif - -/* *************************************************** */ - -static int keep_on_running; - -#if defined(__linux__) || defined(WIN32) -#ifdef WIN32 -BOOL WINAPI term_handler(DWORD sig) -#else - static void term_handler(int sig) -#endif -{ - static int called = 0; - - if(called) { - traceEvent(TRACE_NORMAL, "ok, I am leaving now"); - _exit(0); - } else { - traceEvent(TRACE_NORMAL, "shutting down..."); - called = 1; - } - - keep_on_running = 0; -#ifdef WIN32 - return(TRUE); -#endif -} -#endif /* defined(__linux__) || defined(WIN32) */ - -/* *************************************************** */ - -/** Entry point to program from kernel. */ -int main (int argc, char* argv[]) { - - int rc; - tuntap_dev tuntap; /* a tuntap device */ - n2n_edge_t *eee; /* single instance for this program */ - n2n_edge_conf_t conf; /* generic N2N edge config */ - n2n_tuntap_priv_config_t ec; /* config used for standalone program execution */ - uint8_t runlevel = 0; /* bootstrap: runlevel */ - uint8_t seek_answer = 1; /* expecting answer from supernode */ - time_t now, last_action = 0; /* timeout */ - macstr_t mac_buf; /* output mac address */ - fd_set socket_mask; /* for supernode answer */ - struct timeval wait_time; /* timeout for sn answer */ - peer_info_t *scan, *scan_tmp; /* supernode iteration */ - - uint16_t expected = sizeof(uint16_t); - uint16_t position = 0; - uint8_t pktbuf[N2N_SN_PKTBUF_SIZE + sizeof(uint16_t)]; /* buffer + prepended buffer length in case of tcp */ - - -#ifndef WIN32 - struct passwd *pw = NULL; -#endif -#ifdef HAVE_LIBCAP - cap_t caps; -#endif -#ifdef WIN32 - initWin32(); -#endif - - /* Defaults */ - edge_init_conf_defaults(&conf); - memset(&ec, 0, sizeof(ec)); - ec.mtu = DEFAULT_MTU; - ec.daemon = 1; /* By default run in daemon mode. */ - -#ifndef WIN32 - if(((pw = getpwnam("n2n")) != NULL) || - ((pw = getpwnam("nobody")) != NULL)) { - ec.userid = pw->pw_uid; - ec.groupid = pw->pw_gid; - } -#endif - -#ifdef WIN32 - ec.tuntap_dev_name[0] = '\0'; - ec.metric = 0; -#else - snprintf(ec.tuntap_dev_name, sizeof(ec.tuntap_dev_name), N2N_EDGE_DEFAULT_DEV_NAME); -#endif - snprintf(ec.netmask, sizeof(ec.netmask), N2N_EDGE_DEFAULT_NETMASK); - - if((argc >= 2) && (argv[1][0] != '-')) { - rc = loadFromFile(argv[1], &conf, &ec); - if(argc > 2) - rc = loadFromCLI(argc, argv, &conf, &ec); - } else if(argc > 1) - rc = loadFromCLI(argc, argv, &conf, &ec); - else - -#ifdef WIN32 - // load from current directory - rc = loadFromFile("edge.conf", &conf, &ec); -#else - rc = -1; -#endif - - // --- additional crypto setup; REVISIT: move to edge_init()? - // payload - if(conf.transop_id == N2N_TRANSFORM_ID_NULL) { - if(conf.encrypt_key) { - // make sure that AES is default cipher if key only (and no cipher) is specified - traceEvent(TRACE_WARNING, "switching to AES as key was provided"); - conf.transop_id = N2N_TRANSFORM_ID_AES; - } - } - // user auth - if(conf.shared_secret /* containing private key only so far*/) { - // if user-password auth and no federation public key provided, use default - if(!conf.federation_public_key) { - conf.federation_public_key = calloc(1, sizeof(n2n_private_public_key_t)); - if(conf.federation_public_key) { - traceEvent(TRACE_WARNING, "using default federation public key; FOR TESTING ONLY, usage of a custom federation name and key (-P) is highly recommended!"); - generate_private_key(*(conf.federation_public_key), FEDERATION_NAME + 1); - generate_public_key(*(conf.federation_public_key), *(conf.federation_public_key)); - } - } - // calculate public key and shared secret - if(conf.federation_public_key) { - traceEvent(TRACE_NORMAL, "using username and password for edge authentication"); - bind_private_key_to_username(*(conf.shared_secret), (char *)conf.dev_desc); - conf.public_key = calloc(1, sizeof(n2n_private_public_key_t)); - if(conf.public_key) - generate_public_key(*conf.public_key, *(conf.shared_secret)); - generate_shared_secret(*(conf.shared_secret), *(conf.shared_secret), *(conf.federation_public_key)); - // prepare (first 128 bit) for use as key - conf.shared_secret_ctx = (he_context_t*)calloc(1, sizeof(speck_context_t)); - speck_init((speck_context_t**)&(conf.shared_secret_ctx), *(conf.shared_secret), 128); - } - // force header encryption - if(conf.header_encryption != HEADER_ENCRYPTION_ENABLED) { - traceEvent(TRACE_NORMAL, "enabling header encryption for edge authentication"); - conf.header_encryption = HEADER_ENCRYPTION_ENABLED; - } - } - - if(rc < 0) - help(1); /* short help */ - - if(edge_verify_conf(&conf) != 0) - help(1); /* short help */ - - traceEvent(TRACE_NORMAL, "starting n2n edge %s %s", PACKAGE_VERSION, PACKAGE_BUILDDATE); - -#if defined(HAVE_OPENSSL_1_1) - traceEvent(TRACE_NORMAL, "using %s", OpenSSL_version(0)); -#endif - - traceEvent(TRACE_NORMAL, "using compression: %s.", compression_str(conf.compression)); - traceEvent(TRACE_NORMAL, "using %s cipher.", transop_str(conf.transop_id)); - - /* Random seed */ - n2n_srand (n2n_seed()); - -#ifndef WIN32 - /* If running suid root then we need to setuid before using the force. */ - if(setuid(0) != 0) - traceEvent(TRACE_ERROR, "unable to become root [%u/%s]", errno, strerror(errno)); - /* setgid(0); */ -#endif - - if(conf.encrypt_key && !strcmp((char*)conf.community_name, conf.encrypt_key)) - traceEvent(TRACE_WARNING, "community and encryption key must differ, otherwise security will be compromised"); - - if((eee = edge_init(&conf, &rc)) == NULL) { - traceEvent(TRACE_ERROR, "failed in edge_init"); - exit(1); - } - - memcpy(&(eee->tuntap_priv_conf), &ec, sizeof(ec)); - - if((0 == strcmp("static", eee->tuntap_priv_conf.ip_mode)) || - ((eee->tuntap_priv_conf.ip_mode[0] == '\0') && (eee->tuntap_priv_conf.ip_addr[0] != '\0'))) { - traceEvent(TRACE_NORMAL, "use manually set IP address"); - eee->conf.tuntap_ip_mode = TUNTAP_IP_MODE_STATIC; - } else if(0 == strcmp("dhcp", eee->tuntap_priv_conf.ip_mode)) { - traceEvent(TRACE_NORMAL, "obtain IP from other edge DHCP services"); - eee->conf.tuntap_ip_mode = TUNTAP_IP_MODE_DHCP; - } else { - traceEvent(TRACE_NORMAL, "automatically assign IP address by supernode"); - eee->conf.tuntap_ip_mode = TUNTAP_IP_MODE_SN_ASSIGN; - } - - // mini main loop for bootstrap, not using main loop code because some of its mechanisms do not fit in here - // for the sake of quickly establishing connection. REVISIT when a more elegant way to re-use main loop code - // is found - - // find at least one supernode alive to faster establish connection - // exceptions: - if((HASH_COUNT(eee->conf.supernodes) <= 1) || (eee->conf.connect_tcp) || (eee->conf.shared_secret)) { - // skip the initial supernode ping - traceEvent(TRACE_DEBUG, "skip PING to supernode"); - runlevel = 2; - } - - eee->last_sup = 0; /* if it wasn't zero yet */ - eee->curr_sn = eee->conf.supernodes; - supernode_connect(eee); - while(runlevel < 5) { - - now = time(NULL); - - // we do not use switch-case because we also check for 'greater than' - - if(runlevel == 0) { /* PING to all known supernodes */ - last_action = now; - eee->sn_pong = 0; - // (re-)initialize the number of max concurrent pings (decreases by calling send_query_peer) - eee->conf.number_max_sn_pings = NUMBER_SN_PINGS_INITIAL; - send_query_peer(eee, null_mac); - traceEvent(TRACE_NORMAL, "send PING to supernodes"); - runlevel++; - } - - if(runlevel == 1) { /* PING has been sent to all known supernodes */ - if(eee->sn_pong) { - // first answer - eee->sn_pong = 0; - sn_selection_sort(&(eee->conf.supernodes)); - eee->curr_sn = eee->conf.supernodes; - supernode_connect(eee); - traceEvent(TRACE_NORMAL, "received first PONG from supernode [%s]", eee->curr_sn->ip_addr); - runlevel++; - } else if(last_action <= (now - BOOTSTRAP_TIMEOUT)) { - // timeout - runlevel--; - // skip waiting for answer to direcly go to send PING again - seek_answer = 0; - traceEvent(TRACE_DEBUG, "PONG timeout"); - } - } - - // by the way, have every later PONG cause the remaining (!) list to be sorted because the entries - // before have already been tried; as opposed to initial PONG, do not change curr_sn - if(runlevel > 1) { - if(eee->sn_pong) { - eee->sn_pong = 0; - if(eee->curr_sn->hh.next) { - sn_selection_sort((peer_info_t**)&(eee->curr_sn->hh.next)); - traceEvent(TRACE_DEBUG, "received additional PONG from supernode"); - // here, it is hard to detemine from which one, so no details to output - } - } - } - - if(runlevel == 2) { /* send REGISTER_SUPER to get auto ip address from a supernode */ - if(eee->conf.tuntap_ip_mode == TUNTAP_IP_MODE_SN_ASSIGN) { - last_action = now; - eee->sn_wait = 1; - send_register_super(eee); - runlevel++; - traceEvent(TRACE_NORMAL, "send REGISTER_SUPER to supernode [%s] asking for IP address", - eee->curr_sn->ip_addr); - } else { - runlevel += 2; /* skip waiting for TUNTAP IP address */ - traceEvent(TRACE_DEBUG, "skip auto IP address asignment"); - } - } - - if(runlevel == 3) { /* REGISTER_SUPER to get auto ip address from a sn has been sent */ - if(!eee->sn_wait) { /* TUNTAP IP address received */ - runlevel++; - traceEvent(TRACE_NORMAL, "received REGISTER_SUPER_ACK from supernode for IP address asignment"); - // it should be from curr_sn, but we can't determine definitely here, so no details to output - } else if(last_action <= (now - BOOTSTRAP_TIMEOUT)) { - // timeout, so try next supernode - if(eee->curr_sn->hh.next) - eee->curr_sn = eee->curr_sn->hh.next; - else - eee->curr_sn = eee->conf.supernodes; - supernode_connect(eee); - runlevel--; - // skip waiting for answer to direcly go to send REGISTER_SUPER again - seek_answer = 0; - traceEvent(TRACE_DEBUG, "REGISTER_SUPER_ACK timeout"); - } - } - - if(runlevel == 4) { /* configure the TUNTAP device, including routes */ - if(tuntap_open(&tuntap, eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, - eee->tuntap_priv_conf.ip_addr, eee->tuntap_priv_conf.netmask, - eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu -#ifdef WIN32 - , eee->tuntap_priv_conf.metric -#endif - ) < 0) - exit(1); - memcpy(&eee->device, &tuntap, sizeof(tuntap)); - traceEvent(TRACE_NORMAL, "created local tap device IP: %s, Mask: %s, MAC: %s", - eee->tuntap_priv_conf.ip_addr, - eee->tuntap_priv_conf.netmask, - macaddr_str(mac_buf, eee->device.mac_addr)); - // routes - if(edge_init_routes(eee, eee->conf.routes, eee->conf.num_routes) < 0) { - traceEvent(TRACE_ERROR, "routes setup failed"); - exit(1); - } - runlevel = 5; - // no more answers required - seek_answer = 0; - } - - // we usually wait for some answer, there however are exceptions when going back to a previous runlevel - if(seek_answer) { - FD_ZERO(&socket_mask); - FD_SET(eee->sock, &socket_mask); - wait_time.tv_sec = BOOTSTRAP_TIMEOUT; - wait_time.tv_usec = 0; - - if(select(eee->sock + 1, &socket_mask, NULL, NULL, &wait_time) > 0) { - if(FD_ISSET(eee->sock, &socket_mask)) { - - fetch_and_eventually_process_data (eee, eee->sock, - pktbuf, &expected, &position, - now); - } - } - } - seek_answer = 1; - - resolve_check(eee->resolve_parameter, 0 /* no intermediate resolution requirement at this point */, now); - } - // allow a higher number of pings for first regular round of ping - // to quicker get an inital 'supernode selection criterion overview' - eee->conf.number_max_sn_pings = NUMBER_SN_PINGS_INITIAL; - // shape supernode list; make current one the first on the list - HASH_ITER(hh, eee->conf.supernodes, scan, scan_tmp) { - if(scan == eee->curr_sn) - sn_selection_criterion_good(&(scan->selection_criterion)); - else - sn_selection_criterion_default(&(scan->selection_criterion)); - } - sn_selection_sort(&(eee->conf.supernodes)); - // do not immediately ping again, allow some time - eee->last_sweep = now - SWEEP_TIME + 2 * BOOTSTRAP_TIMEOUT; - eee->sn_wait = 1; - eee->last_register_req = 0; - -#ifndef WIN32 - if(eee->tuntap_priv_conf.daemon) { - setUseSyslog(1); /* traceEvent output now goes to syslog. */ - daemonize(); - } - -#ifdef HAVE_LIBCAP - /* Before dropping the privileges, retain capabilities to regain them in future. */ - caps = cap_get_proc(); - - cap_set_flag(caps, CAP_PERMITTED, num_cap, cap_values, CAP_SET); - cap_set_flag(caps, CAP_EFFECTIVE, num_cap, cap_values, CAP_SET); - - if((cap_set_proc(caps) != 0) || (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0)) - traceEvent(TRACE_WARNING, "unable to retain permitted capabilities [%s]\n", strerror(errno)); -#else -#ifndef __APPLE__ - traceEvent(TRACE_WARNING, "n2n has not been compiled with libcap-dev; some commands may fail"); -#endif -#endif /* HAVE_LIBCAP */ - - if((eee->tuntap_priv_conf.userid != 0) || (eee->tuntap_priv_conf.groupid != 0)) { - traceEvent(TRACE_NORMAL, "dropping privileges to uid=%d, gid=%d", - (signed int)eee->tuntap_priv_conf.userid, (signed int)eee->tuntap_priv_conf.groupid); - - /* Finished with the need for root privileges. Drop to unprivileged user. */ - if((setgid(eee->tuntap_priv_conf.groupid) != 0) - || (setuid(eee->tuntap_priv_conf.userid) != 0)) { - traceEvent(TRACE_ERROR, "unable to drop privileges [%u/%s]", errno, strerror(errno)); - exit(1); - } - } - - if((getuid() == 0) || (getgid() == 0)) - traceEvent(TRACE_WARNING, "running as root is discouraged, check out the -u/-g options"); -#endif - -#ifdef __linux__ - signal(SIGPIPE, SIG_IGN); - signal(SIGTERM, term_handler); - signal(SIGINT, term_handler); -#endif -#ifdef WIN32 - SetConsoleCtrlHandler(term_handler, TRUE); -#endif - - keep_on_running = 1; - eee->keep_running = &keep_on_running; - traceEvent(TRACE_NORMAL, "edge started"); - rc = run_edge_loop(eee); - print_edge_stats(eee); - -#ifdef HAVE_LIBCAP - /* Before completing the cleanup, regain the capabilities as some - * cleanup tasks require them (e.g. routes cleanup). */ - cap_set_flag(caps, CAP_EFFECTIVE, num_cap, cap_values, CAP_SET); - - if(cap_set_proc(caps) != 0) - traceEvent(TRACE_WARNING, "could not regain the capabilities [%s]\n", strerror(errno)); - - cap_free(caps); -#endif - - /* Cleanup */ - edge_term_conf(&eee->conf); - tuntap_close(&eee->device); - edge_term(eee); - -#ifdef WIN32 - destroyWin32(); -#endif - - return(rc); -} - -/* ************************************** */ diff --git a/bundles/n2n_ntop_v3/src/edge_management.c b/bundles/n2n_ntop_v3/src/edge_management.c deleted file mode 100644 index 5438ae38..00000000 --- a/bundles/n2n_ntop_v3/src/edge_management.c +++ /dev/null @@ -1,457 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "edge_utils_win32.h" - -#define FLAG_WROK 1 -typedef struct n2n_mgmt_handler { - int flags; - char *cmd; - char *help; - void (*func)(n2n_edge_t *eee, char *udp_buf, struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv); -} n2n_mgmt_handler_t; - -static void mgmt_error (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, char *tag, char *msg) { - size_t msg_len; - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"error\"," - "\"error\":\"%s\"}\n", - tag, - msg); - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_stop (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - if(type==N2N_MGMT_WRITE) { - *eee->keep_running = 0; - } - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"keep_running\":%u}\n", - tag, - *eee->keep_running); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_verbose (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - if(type==N2N_MGMT_WRITE) { - if(argv) { - setTraceLevel(strtoul(argv, NULL, 0)); - } - } - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"traceLevel\":%u}\n", - tag, - getTraceLevel()); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_communities (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - if(eee->conf.header_encryption != HEADER_ENCRYPTION_NONE) { - mgmt_error(eee, udp_buf, sender_sock, tag, "noaccess"); - return; - } - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"community\":\"%s\"}", - tag, - eee->conf.community_name); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_supernodes (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - struct peer_info *peer, *tmpPeer; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - selection_criterion_str_t sel_buf; - - HASH_ITER(hh, eee->conf.supernodes, peer, tmpPeer) { - - /* - * TODO: - * The version string provided by the remote supernode could contain - * chars that make our JSON invalid. - * - do we care? - */ - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"version\":\"%s\"," - "\"purgeable\":%i," - "\"current\":%i," - "\"macaddr\":\"%s\"," - "\"sockaddr\":\"%s\"," - "\"selection\":\"%s\"," - "\"last_seen\":%li," - "\"uptime\":%li}\n", - tag, - peer->version, - peer->purgeable, - (peer == eee->curr_sn) ? (eee->sn_wait ? 2 : 1 ) : 0, - is_null_mac(peer->mac_addr) ? "" : macaddr_str(mac_buf, peer->mac_addr), - sock_to_cstr(sockbuf, &(peer->sock)), - sn_selection_criterion_str(eee, sel_buf, peer), - peer->last_seen, - peer->uptime); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - } -} - -static void mgmt_edges_row (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, char *tag, struct peer_info *peer, char *mode) { - size_t msg_len; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - dec_ip_bit_str_t ip_bit_str = {'\0'}; - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"mode\":\"%s\"," - "\"ip4addr\":\"%s\"," - "\"purgeable\":%i," - "\"local\":%i," - "\"macaddr\":\"%s\"," - "\"sockaddr\":\"%s\"," - "\"desc\":\"%s\"," - "\"last_p2p\":%li,\n" - "\"last_sent_query\":%li,\n" - "\"last_seen\":%li}\n", - tag, - mode, - (peer->dev_addr.net_addr == 0) ? "" : ip_subnet_to_str(ip_bit_str, &peer->dev_addr), - peer->purgeable, - peer->local, - (is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr), - sock_to_cstr(sockbuf, &(peer->sock)), - peer->dev_desc, - peer->last_p2p, - peer->last_sent_query, - peer->last_seen); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0 /*flags*/, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_edges (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - struct peer_info *peer, *tmpPeer; - - // dump nodes with forwarding through supernodes - HASH_ITER(hh, eee->pending_peers, peer, tmpPeer) { - mgmt_edges_row(eee, udp_buf, sender_sock, tag, peer, "pSp"); - } - - // dump peer-to-peer nodes - HASH_ITER(hh, eee->known_peers, peer, tmpPeer) { - mgmt_edges_row(eee, udp_buf, sender_sock, tag, peer, "p2p"); - } -} - -static void mgmt_timestamps (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"start_time\":%lu," - "\"last_super\":%ld," - "\"last_p2p\":%ld}\n", - tag, - eee->start_time, - eee->last_sup, - eee->last_p2p); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_packetstats (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"type\":\"transop\"," - "\"tx_pkt\":%lu," - "\"rx_pkt\":%lu}\n", - tag, - eee->transop.tx_cnt, - eee->transop.rx_cnt); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"type\":\"p2p\"," - "\"tx_pkt\":%u," - "\"rx_pkt\":%u}\n", - tag, - eee->stats.tx_p2p, - eee->stats.rx_p2p); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"type\":\"super\"," - "\"tx_pkt\":%u," - "\"rx_pkt\":%u}\n", - tag, - eee->stats.tx_sup, - eee->stats.rx_sup); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"type\":\"super_broadcast\"," - "\"tx_pkt\":%u," - "\"rx_pkt\":%u}\n", - tag, - eee->stats.tx_sup_broadcast, - eee->stats.rx_sup_broadcast); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_unimplemented (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - - mgmt_error(eee, udp_buf, sender_sock, tag, "unimplemented"); -} - -static void mgmt_help (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv); - -n2n_mgmt_handler_t mgmt_handlers[] = { - { .cmd = "reload_communities", .flags = FLAG_WROK, .help = "Reserved for supernode", .func = mgmt_unimplemented}, - - { .cmd = "stop", .flags = FLAG_WROK, .help = "Gracefully exit edge", .func = mgmt_stop}, - { .cmd = "verbose", .flags = FLAG_WROK, .help = "Manage verbosity level", .func = mgmt_verbose}, - { .cmd = "communities", .help = "Show current community", .func = mgmt_communities}, - { .cmd = "edges", .help = "List current edges/peers", .func = mgmt_edges}, - { .cmd = "supernodes", .help = "List current supernodes", .func = mgmt_supernodes}, - { .cmd = "timestamps", .help = "Event timestamps", .func = mgmt_timestamps}, - { .cmd = "packetstats", .help = "traffic counters", .func = mgmt_packetstats}, - { .cmd = "help", .flags = FLAG_WROK, .help = "Show JSON commands", .func = mgmt_help}, - { .cmd = NULL }, -}; - -static void mgmt_help (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - n2n_mgmt_handler_t *handler; - - /* - * Even though this command is readonly, we deliberately do not check - * the type - allowing help replies to both read and write requests - */ - - for( handler=mgmt_handlers; handler->cmd; handler++ ) { - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"cmd\":\"%s\"," - "\"help\":\"%s\"}\n", - tag, - handler->cmd, - handler->help); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - } -} - -/* - * Check if the user is authorised for this command. - * - this should be more configurable! - * - for the moment we use some simple heuristics: - * Reads are not dangerous, so they are simply allowed - * Writes are possibly dangerous, so they need a fake password - */ -static int mgmt_auth (n2n_edge_t *eee, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *auth, char *argv0, char *argv) { - - if(auth) { - /* If we have an auth key, it must match */ - if(eee->conf.mgmt_password_hash == pearson_hash_64((uint8_t*)auth, strlen(auth))) { - return 1; - } - return 0; - } - /* if we dont have an auth key, we can still read */ - if(type == N2N_MGMT_READ) { - return 1; - } - - return 0; -} - -void handleMgmtJson (n2n_edge_t *eee, char *udp_buf, const struct sockaddr_in sender_sock) { - - char cmdlinebuf[80]; - enum n2n_mgmt_type type; - char *typechar; - char *options; - char *argv0; - char *argv; - char *tag; - char *flagstr; - int flags; - char *auth; - n2n_mgmt_handler_t *handler; - size_t msg_len; - - /* save a copy of the commandline before we reuse the udp_buf */ - strncpy(cmdlinebuf, udp_buf, sizeof(cmdlinebuf)-1); - cmdlinebuf[sizeof(cmdlinebuf)-1] = 0; - - traceEvent(TRACE_DEBUG, "mgmt json %s", cmdlinebuf); - - typechar = strtok(cmdlinebuf, " \r\n"); - if(!typechar) { - /* should not happen */ - mgmt_error(eee, udp_buf, sender_sock, "-1", "notype"); - return; - } - if(*typechar == 'r') { - type=N2N_MGMT_READ; - } else if(*typechar == 'w') { - type=N2N_MGMT_WRITE; - } else { - /* dunno how we got here */ - mgmt_error(eee, udp_buf, sender_sock, "-1", "badtype"); - return; - } - - /* Extract the tag to use in all reply packets */ - options = strtok(NULL, " \r\n"); - if(!options) { - mgmt_error(eee, udp_buf, sender_sock, "-1", "nooptions"); - return; - } - - argv0 = strtok(NULL, " \r\n"); - if(!argv0) { - mgmt_error(eee, udp_buf, sender_sock, "-1", "nocmd"); - return; - } - - /* - * The entire rest of the line is the argv. We apply no processing - * or arg separation so that the cmd can use it however it needs. - */ - argv = strtok(NULL, "\r\n"); - - /* - * There might be an auth token mixed in with the tag - */ - tag = strtok(options, ":"); - flagstr = strtok(NULL, ":"); - if(flagstr) { - flags = strtoul(flagstr, NULL, 16); - } else { - flags = 0; - } - - /* Only 1 flag bit defined at the moment - "auth option present" */ - if(flags & 1) { - auth = strtok(NULL, ":"); - } else { - auth = NULL; - } - - if(!mgmt_auth(eee, sender_sock, type, auth, argv0, argv)) { - mgmt_error(eee, udp_buf, sender_sock, tag, "badauth"); - return; - } - - for( handler=mgmt_handlers; handler->cmd; handler++ ) { - if(0 == strcmp(handler->cmd, argv0)) { - break; - } - } - if(!handler->cmd) { - mgmt_error(eee, udp_buf, sender_sock, tag, "unknowncmd"); - return; - } - - if((type==N2N_MGMT_WRITE) && !(handler->flags & FLAG_WROK)) { - mgmt_error(eee, udp_buf, sender_sock, tag, "readonly"); - return; - } - - /* - * TODO: - * The tag provided by the requester could contain chars - * that make our JSON invalid. - * - do we care? - */ - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{\"_tag\":\"%s\",\"_type\":\"begin\",\"cmd\":\"%s\"}\n", tag, argv0); - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - handler->func(eee, udp_buf, sender_sock, type, tag, argv0, argv); - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{\"_tag\":\"%s\",\"_type\":\"end\"}\n", tag); - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - return; -} diff --git a/bundles/n2n_ntop_v3/src/edge_utils.c b/bundles/n2n_ntop_v3/src/edge_utils.c deleted file mode 100644 index 781f460d..00000000 --- a/bundles/n2n_ntop_v3/src/edge_utils.c +++ /dev/null @@ -1,3829 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "network_traffic_filter.h" -#include "edge_utils_win32.h" - -/* heap allocation for compression as per lzo example doc */ -#define HEAP_ALLOC(var,size) lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ] -static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS); - -/* ************************************** */ - -int resolve_create_thread (n2n_resolve_parameter_t **param, struct peer_info *sn_list); -int resolve_check (n2n_resolve_parameter_t *param, uint8_t resolution_request, time_t now); -int resolve_cancel_thread (n2n_resolve_parameter_t *param); - -static const char * supernode_ip (const n2n_edge_t * eee); -static void send_register (n2n_edge_t *eee, const n2n_sock_t *remote_peer, const n2n_mac_t peer_mac, n2n_cookie_t cookie); - -static void check_peer_registration_needed (n2n_edge_t *eee, - uint8_t from_supernode, - uint8_t via_multicast, - const n2n_mac_t mac, - const n2n_cookie_t cookie, - const n2n_ip_subnet_t *dev_addr, - const n2n_desc_t *dev_desc, - const n2n_sock_t *peer); - -static int edge_init_sockets (n2n_edge_t *eee); -int edge_init_routes (n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_routes); -static void edge_cleanup_routes (n2n_edge_t *eee); - -static void check_known_peer_sock_change (n2n_edge_t *eee, - uint8_t from_supernode, - uint8_t via_multicast, - const n2n_mac_t mac, - const n2n_ip_subnet_t *dev_addr, - const n2n_desc_t *dev_desc, - const n2n_sock_t *peer, - time_t when); - -/* ************************************** */ - -int edge_verify_conf (const n2n_edge_conf_t *conf) { - - if(conf->community_name[0] == 0) - return -1; - - // REVISIT: are the following two conditions equal? if so, remove one. but note that sn_num is used elsewhere - if(conf->sn_num == 0) - return -2; - - if(HASH_COUNT(conf->supernodes) == 0) - return -5; - - if(conf->register_interval < 1) - return -3; - - if(((conf->encrypt_key == NULL) && (conf->transop_id != N2N_TRANSFORM_ID_NULL)) || - ((conf->encrypt_key != NULL) && (conf->transop_id == N2N_TRANSFORM_ID_NULL))) - return -4; - - return 0; -} - - -/* ************************************** */ - -void edge_set_callbacks (n2n_edge_t *eee, const n2n_edge_callbacks_t *callbacks) { - - memcpy(&eee->cb, callbacks, sizeof(n2n_edge_callbacks_t)); -} - -/* ************************************** */ - -void edge_set_userdata (n2n_edge_t *eee, void *user_data) { - - eee->user_data = user_data; -} - -/* ************************************** */ - -void* edge_get_userdata (n2n_edge_t *eee) { - - return(eee->user_data); -} - -/* ************************************** */ - -int edge_get_n2n_socket (n2n_edge_t *eee) { - - return(eee->sock); -} - -/* ************************************** */ - -int edge_get_management_socket (n2n_edge_t *eee) { - - return(eee->udp_mgmt_sock); -} - -/* ************************************** */ - -const char* transop_str (enum n2n_transform tr) { - - switch(tr) { - case N2N_TRANSFORM_ID_NULL: return("null"); - case N2N_TRANSFORM_ID_TWOFISH: return("Twofish"); - case N2N_TRANSFORM_ID_AES: return("AES"); - case N2N_TRANSFORM_ID_CHACHA20:return("ChaCha20"); - case N2N_TRANSFORM_ID_SPECK: return("Speck"); - default: return("invalid"); - }; -} - -/* ************************************** */ - -const char* compression_str (uint8_t cmpr) { - - switch(cmpr) { - case N2N_COMPRESSION_ID_NONE: return("none"); - case N2N_COMPRESSION_ID_LZO: return("lzo1x"); - case N2N_COMPRESSION_ID_ZSTD: return("zstd"); - default: return("invalid"); - }; -} - -/* ************************************** */ - -/** Destination 01:00:5E:00:00:00 - 01:00:5E:7F:FF:FF is multicast ethernet. - */ -static int is_ethMulticast (const void * buf, size_t bufsize) { - - int retval = 0; - - /* Match 01:00:5E:00:00:00 - 01:00:5E:7F:FF:FF */ - if(bufsize >= sizeof(ether_hdr_t)) { - /* copy to aligned memory */ - ether_hdr_t eh; - memcpy(&eh, buf, sizeof(ether_hdr_t)); - - if((0x01 == eh.dhost[0]) && - (0x00 == eh.dhost[1]) && - (0x5E == eh.dhost[2]) && - (0 == (0x80 & eh.dhost[3]))) - retval = 1; /* This is an ethernet multicast packet [RFC1112]. */ - } - - return retval; -} - -/* ************************************** */ - -/** Destination MAC 33:33:0:00:00:00 - 33:33:FF:FF:FF:FF is reserved for IPv6 - * neighbour discovery. - */ -static int is_ip6_discovery (const void * buf, size_t bufsize) { - - int retval = 0; - - if(bufsize >= sizeof(ether_hdr_t)) { - /* copy to aligned memory */ - ether_hdr_t eh; - - memcpy(&eh, buf, sizeof(ether_hdr_t)); - - if((0x33 == eh.dhost[0]) && (0x33 == eh.dhost[1])) - retval = 1; /* This is an IPv6 multicast packet [RFC2464]. */ - } - - return retval; -} - - -/* ************************************** */ - - -// reset number of supernode connection attempts: try only once for already more realiable tcp connections -void reset_sup_attempts (n2n_edge_t *eee) { - - eee->sup_attempts = (eee->conf.connect_tcp) ? 1 : N2N_EDGE_SUP_ATTEMPTS; -} - - -// detect local IP address by probing a connection to the supernode -static int detect_local_ip_address (n2n_sock_t* out_sock, const n2n_edge_t* eee) { - - struct sockaddr_in local_sock; - struct sockaddr_in sn_sock; - socklen_t sock_len = sizeof(local_sock); - SOCKET probe_sock; - int ret = 0; - - out_sock->family = AF_INVALID; - - // always detetct local port even/especially if chosen by OS... - if((getsockname(eee->sock, (struct sockaddr *)&local_sock, &sock_len) == 0) - && (local_sock.sin_family == AF_INET) - && (sock_len == sizeof(local_sock))) - // remember the port number - out_sock->port = ntohs(local_sock.sin_port); - else - ret = -1; - - // probe for local IP address - probe_sock = socket(PF_INET, SOCK_DGRAM, 0); - // connecting the UDP socket makes getsockname read the local address it uses to connect (to the sn in this case); - // we cannot do it with the real (eee->sock) socket because socket does not accept any conenction from elsewhere then, - // e.g. from another edge instead of the supernode; as re-connecting to AF_UNSPEC might not work to release the socket - // on non-UNIXoids, we use a temporary socket - if((int)probe_sock >= 0) { - fill_sockaddr((struct sockaddr*)&sn_sock, sizeof(sn_sock), &eee->curr_sn->sock); - if(connect(probe_sock, (struct sockaddr *)&sn_sock, sizeof(sn_sock)) == 0) { - if((getsockname(probe_sock, (struct sockaddr *)&local_sock, &sock_len) == 0) - && (local_sock.sin_family == AF_INET) - && (sock_len == sizeof(local_sock))) { - memcpy(&(out_sock->addr.v4), &(local_sock.sin_addr.s_addr), IPV4_SIZE); - } else - ret = -4; - } else - ret = -3; - closesocket(probe_sock); - } else - ret = -2; - - out_sock->family = AF_INET; - - return ret; -} - - -// open socket, close it before if TCP -// in case of TCP, 'connect()' is required -int supernode_connect (n2n_edge_t *eee) { - - int sockopt; - struct sockaddr_in sn_sock; - n2n_sock_t local_sock; - n2n_sock_str_t sockbuf; - - if((eee->conf.connect_tcp) && (eee->sock >= 0)) { - closesocket(eee->sock); - eee->sock = -1; - } - - if(eee->sock < 0) { - - if(eee->conf.local_port > 0) - traceEvent(TRACE_NORMAL, "binding to local port %d", - (eee->conf.connect_tcp) ? 0 : eee->conf.local_port); - - eee->sock = open_socket((eee->conf.connect_tcp) ? 0 : eee->conf.local_port, - eee->conf.bind_address, - eee->conf.connect_tcp); - - if(eee->sock < 0) { - traceEvent(TRACE_ERROR, "failed to bind main UDP port %u", - (eee->conf.connect_tcp) ? 0 : eee->conf.local_port); - return -1; - } - - fill_sockaddr((struct sockaddr*)&sn_sock, sizeof(sn_sock), &eee->curr_sn->sock); - - // set tcp socket to O_NONBLOCK so connect does not hang - // requires checking the socket for readiness before sending and receving - if(eee->conf.connect_tcp) { -#ifdef WIN32 - u_long value = 1; - ioctlsocket(eee->sock, FIONBIO, &value); -#else - fcntl(eee->sock, F_SETFL, O_NONBLOCK); -#endif - if((connect(eee->sock, (struct sockaddr*)&(sn_sock), sizeof(struct sockaddr)) < 0) - && (errno != EINPROGRESS)) { - eee->sock = -1; - return -1; - } - } - - if(eee->conf.tos) { - /* https://www.tucny.com/Home/dscp-tos */ - sockopt = eee->conf.tos; - - if(setsockopt(eee->sock, IPPROTO_IP, IP_TOS, (char *)&sockopt, sizeof(sockopt)) == 0) - traceEvent(TRACE_INFO, "TOS set to 0x%x", eee->conf.tos); - else - traceEvent(TRACE_WARNING, "could not set TOS 0x%x[%d]: %s", eee->conf.tos, errno, strerror(errno)); - } -#ifdef IP_PMTUDISC_DO - sockopt = (eee->conf.disable_pmtu_discovery) ? IP_PMTUDISC_DONT : IP_PMTUDISC_DO; - - if(setsockopt(eee->sock, IPPROTO_IP, IP_MTU_DISCOVER, &sockopt, sizeof(sockopt)) < 0) - traceEvent(TRACE_WARNING, "could not %s PMTU discovery[%d]: %s", - (eee->conf.disable_pmtu_discovery) ? "disable" : "enable", errno, strerror(errno)); - else - traceEvent(TRACE_INFO, "PMTU discovery %s", (eee->conf.disable_pmtu_discovery) ? "disabled" : "enabled"); -#endif - - memset(&local_sock, 0, sizeof(n2n_sock_t)); - if(detect_local_ip_address(&local_sock, eee) == 0) { - // always overwrite local port even/especially if chosen by OS... - eee->conf.preferred_sock.port = local_sock.port; - // only if auto-detection mode, ... - if(eee->conf.preferred_sock_auto) { - // ... overwrite IP address, too (whole socket struct here) - memcpy(&eee->conf.preferred_sock, &local_sock, sizeof(n2n_sock_t)); - traceEvent(TRACE_INFO, "determined local socket [%s]", - sock_to_cstr(sockbuf, &local_sock)); - } - } - - if(eee->cb.sock_opened) - eee->cb.sock_opened(eee); - } - - return 0; -} - - -// always closes the socket -void supernode_disconnect (n2n_edge_t *eee) { - - if(eee->sock >= 0) { - closesocket(eee->sock); - eee->sock = -1; - } -} - - -/* ************************************** */ - -/** Initialise an edge to defaults. - * - * This also initialises the NULL transform operation opstruct. - */ -n2n_edge_t* edge_init (const n2n_edge_conf_t *conf, int *rv) { - - n2n_transform_t transop_id = conf->transop_id; - n2n_edge_t *eee = calloc(1, sizeof(n2n_edge_t)); - int rc = -1, i = 0; - struct peer_info *scan, *tmp; - uint8_t tmp_key[N2N_AUTH_CHALLENGE_SIZE]; - - if((rc = edge_verify_conf(conf)) != 0) { - traceEvent(TRACE_ERROR, "invalid configuration"); - goto edge_init_error; - } - - if(!eee) { - traceEvent(TRACE_ERROR, "cannot allocate memory"); - goto edge_init_error; - } - - - memcpy(&eee->conf, conf, sizeof(*conf)); - eee->curr_sn = eee->conf.supernodes; - eee->start_time = time(NULL); - - eee->known_peers = NULL; - eee->pending_peers = NULL; - reset_sup_attempts(eee); - - sn_selection_criterion_common_data_default(eee); - - pearson_hash_init(); - - if(eee->conf.compression == N2N_COMPRESSION_ID_LZO) - if(lzo_init() != LZO_E_OK) { - traceEvent(TRACE_ERROR, "LZO compression error"); - goto edge_init_error; - } -#ifdef N2N_HAVE_ZSTD - // zstd does not require initialization. if it were required, this would be a good place -#endif - - traceEvent(TRACE_NORMAL, "number of supernodes in the list: %d\n", HASH_COUNT(eee->conf.supernodes)); - HASH_ITER(hh, eee->conf.supernodes, scan, tmp) { - traceEvent(TRACE_NORMAL, "supernode %u => %s\n", i, (scan->ip_addr)); - i++; - } - - /* Set active transop */ - switch(transop_id) { - case N2N_TRANSFORM_ID_TWOFISH: - rc = n2n_transop_tf_init(&eee->conf, &eee->transop); - break; - - case N2N_TRANSFORM_ID_AES: - rc = n2n_transop_aes_init(&eee->conf, &eee->transop); - break; - - case N2N_TRANSFORM_ID_CHACHA20: - rc = n2n_transop_cc20_init(&eee->conf, &eee->transop); - break; - - case N2N_TRANSFORM_ID_SPECK: - rc = n2n_transop_speck_init(&eee->conf, &eee->transop); - break; - - default: - rc = n2n_transop_null_init(&eee->conf, &eee->transop); - } - - if((rc < 0) || (eee->transop.fwd == NULL) || (eee->transop.transform_id != transop_id)) { - traceEvent(TRACE_ERROR, "transop init failed"); - goto edge_init_error; - } - - // set the key schedule (context) for header encryption if enabled - if(conf->header_encryption == HEADER_ENCRYPTION_ENABLED) { - traceEvent(TRACE_NORMAL, "Header encryption is enabled."); - packet_header_setup_key((char *)(eee->conf.community_name), - &(eee->conf.header_encryption_ctx_static), - &(eee->conf.header_encryption_ctx_dynamic), - &(eee->conf.header_iv_ctx_static), - &(eee->conf.header_iv_ctx_dynamic)); - // in case of user/password auth, initialize a random dynamic key to prevent - // unintentional communication with only-header-encrypted community; will be - // overwritten by legit key later - if(conf->shared_secret) { - memrnd(tmp_key, N2N_AUTH_CHALLENGE_SIZE); - packet_header_change_dynamic_key(tmp_key, - &(eee->conf.header_encryption_ctx_dynamic), - &(eee->conf.header_iv_ctx_dynamic)); - } - } - - // setup authentication scheme - if(!conf->shared_secret) { - // id-based scheme - eee->conf.auth.scheme = n2n_auth_simple_id; - // random authentication token - memrnd(eee->conf.auth.token, N2N_AUTH_ID_TOKEN_SIZE); - eee->conf.auth.token_size = N2N_AUTH_ID_TOKEN_SIZE; - } else { - // user-password scheme - eee->conf.auth.scheme = n2n_auth_user_password; - // 'token' stores public key and the last random challenge being set upon sending REGISTER_SUPER - memcpy(eee->conf.auth.token, eee->conf.public_key, N2N_PRIVATE_PUBLIC_KEY_SIZE); - // random part of token (challenge) will be generated and filled in at each REGISTER_SUPER - eee->conf.auth.token_size = N2N_AUTH_PW_TOKEN_SIZE; - // make sure that only stream ciphers are being used - if((transop_id != N2N_TRANSFORM_ID_CHACHA20) - && (transop_id != N2N_TRANSFORM_ID_SPECK)) { - traceEvent(TRACE_ERROR, "user-password authentication requires ChaCha20 (-A4) or SPECK (-A5) to be used."); - goto edge_init_error; - } - } - - if(eee->transop.no_encryption) - traceEvent(TRACE_WARNING, "encryption is disabled in edge"); - - // first time calling edge_init_sockets needs -1 in the sockets for it does throw an error - // on trying to close them (open_sockets does so for also being able to RE-open the sockets - // if called in-between, see "Supernode not responding" in update_supernode_reg(...) - eee->sock = -1; - eee->udp_mgmt_sock = -1; -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - eee->udp_multicast_sock = -1; -#endif - if(edge_init_sockets(eee) < 0) { - traceEvent(TRACE_ERROR, "socket setup failed"); - goto edge_init_error; - } - - if(resolve_create_thread(&(eee->resolve_parameter), eee->conf.supernodes) == 0) { - traceEvent(TRACE_NORMAL, "successfully created resolver thread"); - } - - eee->network_traffic_filter = create_network_traffic_filter(); - network_traffic_filter_add_rule(eee->network_traffic_filter, eee->conf.network_traffic_filter_rules); - - //edge_init_success: - *rv = 0; - return(eee); - -edge_init_error: - if(eee) - free(eee); - *rv = rc; - return(NULL); -} - -/* ************************************** */ - -static int find_and_remove_peer (struct peer_info **head, const n2n_mac_t mac) { - - struct peer_info *peer; - - HASH_FIND_PEER(*head, mac, peer); - if(peer) { - HASH_DEL(*head, peer); - free(peer); - return(1); - } - - return(0); -} - -/* ************************************** */ - -static uint32_t localhost_v4 = 0x7f000001; -static uint8_t localhost_v6[IPV6_SIZE] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}; - -/* Exclude localhost as it may be received when an edge node runs - * in the same supernode host. - */ -static int is_valid_peer_sock (const n2n_sock_t *sock) { - - switch(sock->family) { - case AF_INET: { - uint32_t *a = (uint32_t*)sock->addr.v4; - - if(*a != htonl(localhost_v4)) - return(1); - } - break; - - case AF_INET6: - if(memcmp(sock->addr.v6, localhost_v6, IPV6_SIZE)) - return(1); - break; - } - - return(0); -} - -/* ***************************************************** */ - - -/*** - * - * For a given packet, find the apporopriate internal last valid time stamp for lookup - * and verify it (and also update, if applicable). - */ -static int find_peer_time_stamp_and_verify (n2n_edge_t * eee, - peer_info_t *sn, const n2n_mac_t mac, - uint64_t stamp, int allow_jitter) { - - uint64_t *previous_stamp = NULL; - - if(sn) { - // from supernode - previous_stamp = &(sn->last_valid_time_stamp); - } else { - // from (peer) edge - struct peer_info *peer; - HASH_FIND_PEER(eee->pending_peers, mac, peer); - if(!peer) { - HASH_FIND_PEER(eee->known_peers, mac, peer); - } - - if(peer) { - // time_stamp_verify_and_update allows the pointer a previous stamp to be NULL - // if it is a (so far) unknown peer - previous_stamp = &(peer->last_valid_time_stamp); - } - } - - // failure --> 0; success --> 1 - return time_stamp_verify_and_update(stamp, previous_stamp, allow_jitter); -} - - -/* ************************************** */ - -/*** - * - * Register over multicast in case there is a peer on the same network listening - */ -static void register_with_local_peers (n2n_edge_t * eee) { -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if((eee->multicast_joined && eee->conf.allow_p2p) - && (eee->conf.preferred_sock.family == (uint8_t)AF_INVALID)) { - /* send registration to the local multicast group */ - traceEvent(TRACE_DEBUG, "registering with multicast group %s:%u", - N2N_MULTICAST_GROUP, N2N_MULTICAST_PORT); - send_register(eee, &(eee->multicast_peer), NULL, N2N_MCAST_REG_COOKIE); - } -#else - traceEvent(TRACE_DEBUG, "multicast peers discovery is disabled, skipping"); -#endif -} - -/* ************************************** */ - -static struct peer_info* find_peer_by_sock (const n2n_sock_t *sock, struct peer_info *peer_list) { - - struct peer_info *scan, *tmp, *ret = NULL; - - HASH_ITER(hh, peer_list, scan, tmp) { - if(memcmp(&(scan->sock), sock, sizeof(n2n_sock_t)) == 0) { - ret = scan; - break; - } - } - - return ret; -} - -/* ************************************** */ - -/** Start the registration process. - * - * If the peer is already in pending_peers, ignore the request. - * If not in pending_peers, add it and send a REGISTER. - * - * If hdr is for a direct peer-to-peer packet, try to register back to sender - * even if the MAC is in pending_peers. This is because an incident direct - * packet indicates that peer-to-peer exchange should work so more aggressive - * registration can be permitted (once per incoming packet) as this should only - * last for a small number of packets.. - * - * Called from the main loop when Rx a packet for our device mac. - */ -static void register_with_new_peer (n2n_edge_t *eee, - uint8_t from_supernode, - uint8_t via_multicast, - const n2n_mac_t mac, - const n2n_ip_subnet_t *dev_addr, - const n2n_desc_t *dev_desc, - const n2n_sock_t *peer) { - - /* REVISIT: purge of pending_peers not yet done. */ - struct peer_info *scan; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - HASH_FIND_PEER(eee->pending_peers, mac, scan); - - /* NOTE: pending_peers are purged periodically with purge_expired_nodes */ - if(scan == NULL) { - scan = calloc(1, sizeof(struct peer_info)); - - memcpy(scan->mac_addr, mac, N2N_MAC_SIZE); - scan->sock = *peer; - scan->timeout = eee->conf.register_interval; /* TODO: should correspond to the peer supernode registration timeout */ - scan->last_valid_time_stamp = initial_time_stamp(); - if(via_multicast) - scan->local = 1; - - HASH_ADD_PEER(eee->pending_peers, scan); - - traceEvent(TRACE_DEBUG, "new pending peer %s [%s]", - macaddr_str(mac_buf, scan->mac_addr), - sock_to_cstr(sockbuf, &(scan->sock))); - - traceEvent(TRACE_DEBUG, "pending peers list size=%u", - HASH_COUNT(eee->pending_peers)); - /* trace Sending REGISTER */ - if(from_supernode) { - /* UDP NAT hole punching through supernode. Send to peer first(punch local UDP hole) - * and then ask supernode to forward. Supernode then ask peer to ack. Some nat device - * drop and block ports with incoming UDP packet if out-come traffic does not exist. - * So we can alternatively set TTL so that the packet sent to peer never really reaches - * The register_ttl is basically nat level + 1. Set it to 1 means host like DMZ. - */ - if(eee->conf.register_ttl == 1) { - /* We are DMZ host or port is directly accessible. Just let peer to send back the ack */ -#ifndef WIN32 - } else if(eee->conf.register_ttl > 1) { - /* Setting register_ttl usually implies that the edge knows the internal net topology - * clearly, we can apply aggressive port prediction to support incoming Symmetric NAT - */ - int curTTL = 0; - socklen_t lenTTL = sizeof(int); - n2n_sock_t sock = scan->sock; - int alter = 16; /* TODO: set by command line or more reliable prediction method */ - - getsockopt(eee->sock, IPPROTO_IP, IP_TTL, (void *) (char *) &curTTL, &lenTTL); - setsockopt(eee->sock, IPPROTO_IP, IP_TTL, - (void *) (char *) &eee->conf.register_ttl, - sizeof(eee->conf.register_ttl)); - for(; alter > 0; alter--, sock.port++) { - send_register(eee, &sock, mac, N2N_PORT_REG_COOKIE); - } - setsockopt(eee->sock, IPPROTO_IP, IP_TTL, (void *) (char *) &curTTL, sizeof(curTTL)); -#endif - } else { /* eee->conf.register_ttl <= 0 */ - /* Normal STUN */ - send_register(eee, &(scan->sock), mac, N2N_REGULAR_REG_COOKIE); - } - send_register(eee, &(eee->curr_sn->sock), mac, N2N_FORWARDED_REG_COOKIE); - } else { - /* P2P register, send directly */ - send_register(eee, &(scan->sock), mac, N2N_REGULAR_REG_COOKIE); - } - register_with_local_peers(eee); - } else{ - scan->sock = *peer; - } - scan->last_seen = time(NULL); - if(dev_addr != NULL) { - memcpy(&(scan->dev_addr), dev_addr, sizeof(n2n_ip_subnet_t)); - } - if(dev_desc) memcpy(scan->dev_desc, dev_desc, N2N_DESC_SIZE); -} - - -/* ************************************** */ - -/** Update the last_seen time for this peer, or get registered. */ -static void check_peer_registration_needed (n2n_edge_t *eee, - uint8_t from_supernode, - uint8_t via_multicast, - const n2n_mac_t mac, - const n2n_cookie_t cookie, - const n2n_ip_subnet_t *dev_addr, - const n2n_desc_t *dev_desc, - const n2n_sock_t *peer) { - - struct peer_info *scan; - - HASH_FIND_PEER(eee->known_peers, mac, scan); - - /* If we were not able to find it by MAC, we try to find it by socket. */ - if(scan == NULL ) { - scan = find_peer_by_sock(peer, eee->known_peers); - - // MAC change - if(scan) { - HASH_DEL(eee->known_peers, scan); - memcpy(scan->mac_addr, mac, sizeof(n2n_mac_t)); - HASH_ADD_PEER(eee->known_peers, scan); - // reset last_local_reg to allow re-registration - scan->last_cookie = N2N_NO_REG_COOKIE; - } - } - - if(scan == NULL) { - /* Not in known_peers - start the REGISTER process. */ - register_with_new_peer(eee, from_supernode, via_multicast, mac, dev_addr, dev_desc, peer); - } else { - /* Already in known_peers. */ - time_t now = time(NULL); - - if(!from_supernode) - scan->last_p2p = now; - - if(via_multicast) - scan->local = 1; - - if(((now - scan->last_seen) > 0 /* >= 1 sec */) - ||(cookie > scan->last_cookie)) { - /* Don't register too often */ - check_known_peer_sock_change(eee, from_supernode, via_multicast, mac, dev_addr, dev_desc, peer, now); - } - } -} - -/* ************************************** */ - - -/* Confirm that a pending peer is reachable directly via P2P. - * - * peer must be a pointer to an element of the pending_peers list. - */ -static void peer_set_p2p_confirmed (n2n_edge_t * eee, - const n2n_mac_t mac, - const n2n_cookie_t cookie, - const n2n_sock_t * peer, - time_t now) { - - struct peer_info *scan, *scan_tmp; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - HASH_FIND_PEER(eee->pending_peers, mac, scan); - if(scan == NULL) { - scan = find_peer_by_sock(peer, eee->pending_peers); - // in case of MAC change, reset last_local_reg to allow re-registration - if(scan) - scan->last_cookie = N2N_NO_REG_COOKIE; - } - - if(scan) { - HASH_DEL(eee->pending_peers, scan); - - scan_tmp = find_peer_by_sock(peer, eee->known_peers); - if(scan_tmp != NULL) { - HASH_DEL(eee->known_peers, scan_tmp); - free(scan); - scan = scan_tmp; - memcpy(scan->mac_addr, mac, sizeof(n2n_mac_t)); - // in case of MAC change, reset cookie to allow immediate re-registration - scan->last_cookie = N2N_NO_REG_COOKIE; - } else { - // update sock but ... - // ... ignore ACKs's (and their socks) from lower ranked inbound ways for a while - if(((now - scan->last_seen) > REGISTRATION_TIMEOUT / 4) - ||(cookie > scan->last_cookie)) { - scan->sock = *peer; - scan->last_cookie = cookie; - } - } - - HASH_ADD_PEER(eee->known_peers, scan); - scan->last_p2p = now; - - traceEvent(TRACE_DEBUG, "p2p connection established: %s [%s]", - macaddr_str(mac_buf, mac), - sock_to_cstr(sockbuf, peer)); - - traceEvent(TRACE_DEBUG, "new peer %s [%s]", - macaddr_str(mac_buf, scan->mac_addr), - sock_to_cstr(sockbuf, &(scan->sock))); - - traceEvent(TRACE_DEBUG, "pending peers list size=%u", - HASH_COUNT(eee->pending_peers)); - - traceEvent(TRACE_DEBUG, "known peers list size=%u", - HASH_COUNT(eee->known_peers)); - - scan->last_seen = now; - } else - traceEvent(TRACE_DEBUG, "failed to find sender in pending_peers"); -} - - -/* ************************************** */ - - -// provides the current / a new local auth token -static int get_local_auth (n2n_edge_t *eee, n2n_auth_t *auth) { - - switch(eee->conf.auth.scheme) { - case n2n_auth_simple_id: - memcpy(auth, &(eee->conf.auth), sizeof(n2n_auth_t)); - break; - case n2n_auth_user_password: - // start from the locally stored complete auth token (including type and size fields) - memcpy(auth, &(eee->conf.auth), sizeof(n2n_auth_t)); - - // the token data consists of - // 32 bytes public key - // 16 bytes random challenge - - // generate a new random auth challenge every time - memrnd(auth->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, N2N_AUTH_CHALLENGE_SIZE); - // store it in local auth token (for comparison later) - memcpy(eee->conf.auth.token + N2N_PRIVATE_PUBLIC_KEY_SIZE, auth->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, N2N_AUTH_CHALLENGE_SIZE); - // encrypt the challenge for transmission - speck_128_encrypt(auth->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, (speck_context_t*)eee->conf.shared_secret_ctx); - break; - default: - break; - } - - return 0; -} - - -// handles a returning (remote) auth token, takes action as required by auth scheme -static int handle_remote_auth (n2n_edge_t *eee, struct peer_info *peer, const n2n_auth_t *remote_auth) { - - uint8_t tmp_token[N2N_AUTH_MAX_TOKEN_SIZE]; - - switch(eee->conf.auth.scheme) { - case n2n_auth_simple_id: - // no action required - break; - case n2n_auth_user_password: - memcpy(tmp_token, remote_auth->token, N2N_AUTH_PW_TOKEN_SIZE); - - // the returning token data consists of - // 16 bytes double-encrypted challenge - // 16 bytes public key (second half) - // 16 bytes encrypted (original random challenge XOR shared secret XOR dynamic key) - - // decrypt double-encrypted received challenge (first half of public key field) - speck_128_decrypt(tmp_token, (speck_context_t*)eee->conf.shared_secret_ctx); - speck_128_decrypt(tmp_token, (speck_context_t*)eee->conf.shared_secret_ctx); - - // compare to original challenge - if(0 != memcmp(tmp_token, eee->conf.auth.token + N2N_PRIVATE_PUBLIC_KEY_SIZE, N2N_AUTH_CHALLENGE_SIZE)) - return -1; - - // decrypt the received challenge in which the dynamic key is wrapped - speck_128_decrypt(tmp_token + N2N_PRIVATE_PUBLIC_KEY_SIZE, (speck_context_t*)eee->conf.shared_secret_ctx); - // un-XOR the original challenge - memxor(tmp_token + N2N_PRIVATE_PUBLIC_KEY_SIZE, eee->conf.auth.token + N2N_PRIVATE_PUBLIC_KEY_SIZE, N2N_AUTH_CHALLENGE_SIZE); - // un-XOR the shared secret - memxor(tmp_token + N2N_PRIVATE_PUBLIC_KEY_SIZE, *(eee->conf.shared_secret), N2N_AUTH_CHALLENGE_SIZE); - // setup for use as dynamic key - packet_header_change_dynamic_key(tmp_token + N2N_PRIVATE_PUBLIC_KEY_SIZE, - &(eee->conf.header_encryption_ctx_dynamic), - &(eee->conf.header_iv_ctx_dynamic)); - break; - default: - break; - } - - return 0; -} - - -/* ************************************** */ - - -int is_empty_ip_address (const n2n_sock_t * sock) { - - const uint8_t * ptr = NULL; - size_t len = 0; - size_t i; - - if(AF_INET6 == sock->family) { - ptr = sock->addr.v6; - len = 16; - } else { - ptr = sock->addr.v4; - len = 4; - } - - for(i = 0; i < len; ++i) { - if(0 != ptr[i]) { - /* found a non-zero byte in address */ - return 0; - } - } - - return 1; -} - -/* ************************************** */ - - -/** Check if a known peer socket has changed and possibly register again. - */ -static void check_known_peer_sock_change (n2n_edge_t *eee, - uint8_t from_supernode, - uint8_t via_multicast, - const n2n_mac_t mac, - const n2n_ip_subnet_t *dev_addr, - const n2n_desc_t *dev_desc, - const n2n_sock_t *peer, - time_t when) { - - struct peer_info *scan; - n2n_sock_str_t sockbuf1; - n2n_sock_str_t sockbuf2; /* don't clobber sockbuf1 if writing two addresses to trace */ - macstr_t mac_buf; - - if(is_empty_ip_address(peer)) - return; - - if(is_multi_broadcast(mac)) - return; - - /* Search the peer in known_peers */ - HASH_FIND_PEER(eee->known_peers, mac, scan); - - if(!scan) - /* Not in known_peers */ - return; - - if(!sock_equal(&(scan->sock), peer)) { - if(!from_supernode) { - /* This is a P2P packet */ - traceEvent(TRACE_NORMAL, "peer %s changed [%s] -> [%s]", - macaddr_str(mac_buf, scan->mac_addr), - sock_to_cstr(sockbuf1, &(scan->sock)), - sock_to_cstr(sockbuf2, peer)); - /* The peer has changed public socket. It can no longer be assumed to be reachable. */ - HASH_DEL(eee->known_peers, scan); - free(scan); - - register_with_new_peer(eee, from_supernode, via_multicast, mac, dev_addr, dev_desc, peer); - } else { - /* Don't worry about what the supernode reports, it could be seeing a different socket. */ - } - } else - scan->last_seen = when; -} - -/* ************************************** */ - -/** Send a datagram to a socket file descriptor */ -static ssize_t sendto_fd (n2n_edge_t *eee, const void *buf, - size_t len, struct sockaddr_in *dest) { - - ssize_t sent = 0; - int rc = 1; - - // if required (tcp), wait until writeable as soket is set to O_NONBLOCK, could require - // some wait time directly after re-opening - if(eee->conf.connect_tcp) { - fd_set socket_mask; - struct timeval wait_time; - - FD_ZERO(&socket_mask); - FD_SET(eee->sock, &socket_mask); - wait_time.tv_sec = 0; - wait_time.tv_usec = 500000; - rc = select(eee->sock + 1, NULL, &socket_mask, NULL, &wait_time); - } - - if(rc > 0) { - - sent = sendto(eee->sock, buf, len, 0 /*flags*/, - (struct sockaddr *)dest, sizeof(struct sockaddr_in)); - - if((sent <= 0) && (errno)) { - char * c = strerror(errno); - // downgrade to TRACE_DEBUG in case of custom AF_INVALID, i.e. supernode not resolved yet - if(errno == EAFNOSUPPORT /* 93 */) { - traceEvent(TRACE_DEBUG, "sendto failed (%d) %s", errno, c); -#ifdef WIN32 - traceEvent(TRACE_DEBUG, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - } else { - traceEvent(TRACE_WARNING, "sendto failed (%d) %s", errno, c); -#ifdef WIN32 - traceEvent(TRACE_WARNING, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - } - - if(eee->conf.connect_tcp) { - supernode_disconnect(eee); - eee->sn_wait = 1; - traceEvent(TRACE_DEBUG, "disconnected supernode due to sendto() error"); - return -1; - } - } else { - traceEvent(TRACE_DEBUG, "sent=%d to ", (signed int)sent); - } - } else { - supernode_disconnect(eee); - eee->sn_wait = 1; - traceEvent(TRACE_DEBUG, "disconnected supernode due to select() timeout"); - return -1; - } - return sent; -} - - -/** Send a datagram to a socket defined by a n2n_sock_t */ -static ssize_t sendto_sock (n2n_edge_t *eee, const void * buf, - size_t len, const n2n_sock_t * dest) { - - struct sockaddr_in peer_addr; - ssize_t sent; - int value = 0; - - if(!dest->family) - // invalid socket - return 0; - - if(eee->sock < 0) - // invalid socket file descriptor, e.g. TCP unconnected has fd of '-1' - return 0; - - // network order socket - fill_sockaddr((struct sockaddr *) &peer_addr, sizeof(peer_addr), dest); - - // if the connection is tcp, i.e. not the regular sock... - if(eee->conf.connect_tcp) { - - setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); - value = 1; -#ifdef LINUX - setsockopt(eee->sock, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); -#endif - - // prepend packet length... - uint16_t pktsize16 = htobe16(len); - sent = sendto_fd(eee, (uint8_t*)&pktsize16, sizeof(pktsize16), &peer_addr); - - if(sent <= 0) - return -1; - // ...before sending the actual data - } - sent = sendto_fd(eee, buf, len, &peer_addr); - - // if the connection is tcp, i.e. not the regular sock... - if(eee->conf.connect_tcp) { - value = 1; /* value should still be set to 1 */ - setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); -#ifdef LINUX - value = 0; - setsockopt(eee->sock, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); -#endif - } - - return sent; -} - - -/* ************************************** */ - - -/* Bind eee->udp_multicast_sock to multicast group */ -static void check_join_multicast_group (n2n_edge_t *eee) { - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if((eee->conf.allow_p2p) - && (eee->conf.preferred_sock.family == (uint8_t)AF_INVALID)) { - if(!eee->multicast_joined) { - struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP); -#ifdef WIN32 - dec_ip_str_t ip_addr; - get_best_interface_ip(eee, ip_addr); - mreq.imr_interface.s_addr = inet_addr(ip_addr); -#else - mreq.imr_interface.s_addr = htonl(INADDR_ANY); -#endif - - if(setsockopt(eee->udp_multicast_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mreq, sizeof(mreq)) < 0) { - traceEvent(TRACE_WARNING, "failed to bind to local multicast group %s:%u [errno %u]", - N2N_MULTICAST_GROUP, N2N_MULTICAST_PORT, errno); - -#ifdef WIN32 - traceEvent(TRACE_WARNING, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - } else { - traceEvent(TRACE_NORMAL, "successfully joined multicast group %s:%u", - N2N_MULTICAST_GROUP, N2N_MULTICAST_PORT); - eee->multicast_joined = 1; - } - } - } -#endif -} - -/* ************************************** */ - -/** Send a QUERY_PEER packet to the current supernode. */ -void send_query_peer (n2n_edge_t * eee, - const n2n_mac_t dst_mac) { - - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - n2n_common_t cmn = {0}; - n2n_QUERY_PEER_t query = {0}; - struct peer_info *peer, *tmp; - int n_o_pings = 0; - int n_o_top_sn = 0; - int n_o_rest_sn = 0; - int n_o_skip_sn = 0; - - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_query_peer; - cmn.flags = 0; - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - - idx = 0; - encode_mac(query.srcMac, &idx, eee->device.mac_addr); - - idx = 0; - encode_mac(query.targetMac, &idx, dst_mac); - - idx = 0; - encode_QUERY_PEER(pktbuf, &idx, &cmn, &query); - - if(!is_null_mac(dst_mac)) { - - traceEvent(TRACE_DEBUG, "send QUERY_PEER to supernode"); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(pktbuf, idx, idx, - eee->conf.header_encryption_ctx_dynamic, eee->conf.header_iv_ctx_dynamic, - time_stamp()); - } - - sendto_sock(eee, pktbuf, idx, &(eee->curr_sn->sock)); - - } else { - traceEvent(TRACE_DEBUG, "send PING to supernodes"); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(pktbuf, idx, idx, - eee->conf.header_encryption_ctx_dynamic, eee->conf.header_iv_ctx_dynamic, - time_stamp()); - } - - n_o_pings = eee->conf.number_max_sn_pings; - eee->conf.number_max_sn_pings = NUMBER_SN_PINGS_REGULAR; - - // ping the 'floor(n/2)' top supernodes and 'ceiling(n/2)' of the remaining - n_o_top_sn = n_o_pings >> 1; - n_o_rest_sn = (n_o_pings + 1) >> 1; - - // skip a random number of supernodes between top and remaining - n_o_skip_sn = HASH_COUNT(eee->conf.supernodes) - n_o_pings; - n_o_skip_sn = (n_o_skip_sn < 0) ? 0 : n2n_rand_sqr(n_o_skip_sn); - HASH_ITER(hh, eee->conf.supernodes, peer, tmp) { - if(n_o_top_sn) { - n_o_top_sn--; - // fall through (send to top supernode) - } else if(n_o_skip_sn) { - n_o_skip_sn--; - // skip (do not send) - continue; - } else if(n_o_rest_sn) { - n_o_rest_sn--; - // fall through (send to remaining supernode) - } else { - // done with the remaining (do not send anymore) - break; - } - sendto_sock(eee, pktbuf, idx, &(peer->sock)); - } - } -} - -/* ******************************************************** */ - -/** Send a REGISTER_SUPER packet to the current supernode. */ -void send_register_super (n2n_edge_t *eee) { - - uint8_t pktbuf[N2N_PKT_BUF_SIZE] = {0}; - uint8_t hash_buf[16] = {0}; - size_t idx; - /* ssize_t sent; */ - n2n_common_t cmn; - n2n_REGISTER_SUPER_t reg; - n2n_sock_str_t sockbuf; - - memset(&cmn, 0, sizeof(cmn)); - memset(®, 0, sizeof(reg)); - - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_register_super; - if(eee->conf.preferred_sock.family == (uint8_t)AF_INVALID) { - cmn.flags = 0; - } else { - cmn.flags = N2N_FLAGS_SOCKET; - memcpy(&(reg.sock), &(eee->conf.preferred_sock), sizeof(n2n_sock_t)); - } - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - - eee->curr_sn->last_cookie = n2n_rand(); - - reg.cookie = eee->curr_sn->last_cookie; - reg.dev_addr.net_addr = ntohl(eee->device.ip_addr); - reg.dev_addr.net_bitlen = mask2bitlen(ntohl(eee->device.device_mask)); - memcpy(reg.dev_desc, eee->conf.dev_desc, N2N_DESC_SIZE); - get_local_auth(eee, &(reg.auth)); - - idx = 0; - encode_mac(reg.edgeMac, &idx, eee->device.mac_addr); - - idx = 0; - encode_REGISTER_SUPER(pktbuf, &idx, &cmn, ®); - - traceEvent(TRACE_DEBUG, "send REGISTER_SUPER to [%s]", - sock_to_cstr(sockbuf, &(eee->curr_sn->sock))); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(pktbuf, idx, idx, - eee->conf.header_encryption_ctx_static, eee->conf.header_iv_ctx_static, - time_stamp()); - - if(eee->conf.shared_secret) { - pearson_hash_128(hash_buf, pktbuf, idx); - speck_128_encrypt(hash_buf, (speck_context_t*)eee->conf.shared_secret_ctx); - encode_buf(pktbuf, &idx, hash_buf, N2N_REG_SUP_HASH_CHECK_LEN); - } - } - - /* sent = */ sendto_sock(eee, pktbuf, idx, &(eee->curr_sn->sock)); -} - - -static void send_unregister_super (n2n_edge_t *eee) { - - uint8_t pktbuf[N2N_PKT_BUF_SIZE] = {0}; - size_t idx; - /* ssize_t sent; */ - n2n_common_t cmn; - n2n_UNREGISTER_SUPER_t unreg; - n2n_sock_str_t sockbuf; - - memset(&cmn, 0, sizeof(cmn)); - memset(&unreg, 0, sizeof(unreg)); - - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_unregister_super; - cmn.flags = 0; - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - get_local_auth(eee, &(unreg.auth)); - - idx = 0; - encode_mac(unreg.srcMac, &idx, eee->device.mac_addr); - - idx = 0; - encode_UNREGISTER_SUPER(pktbuf, &idx, &cmn, &unreg); - - traceEvent(TRACE_DEBUG, "send UNREGISTER_SUPER to [%s]", - sock_to_cstr(sockbuf, &(eee->curr_sn->sock))); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt(pktbuf, idx, idx, - eee->conf.header_encryption_ctx_dynamic, eee->conf.header_iv_ctx_dynamic, - time_stamp()); - - /* sent = */ sendto_sock(eee, pktbuf, idx, &(eee->curr_sn->sock)); - -} - - -static int sort_supernodes (n2n_edge_t *eee, time_t now) { - - struct peer_info *scan, *tmp; - - if(now - eee->last_sweep > SWEEP_TIME) { - // this routine gets periodically called - - if(!eee->sn_wait) { - // sort supernodes in ascending order of their selection_criterion fields - sn_selection_sort(&(eee->conf.supernodes)); - } - - if(eee->curr_sn != eee->conf.supernodes) { - // we have not been connected to the best/top one - send_unregister_super(eee); - eee->curr_sn = eee->conf.supernodes; - reset_sup_attempts(eee); - supernode_connect(eee); - - traceEvent(TRACE_INFO, "registering with supernode [%s][number of supernodes %d][attempts left %u]", - supernode_ip(eee), HASH_COUNT(eee->conf.supernodes), (unsigned int)eee->sup_attempts); - - send_register_super(eee); - eee->last_register_req = now; - eee->sn_wait = 1; - } - - HASH_ITER(hh, eee->conf.supernodes, scan, tmp) { - if(scan == eee->curr_sn) - sn_selection_criterion_good(&(scan->selection_criterion)); - else - sn_selection_criterion_default(&(scan->selection_criterion)); - } - sn_selection_criterion_common_data_default(eee); - - // send PING to all the supernodes - if(!eee->conf.connect_tcp) - send_query_peer(eee, null_mac); - eee->last_sweep = now; - - // no answer yet (so far, unused in regular edge code; mainly used during bootstrap loading) - eee->sn_pong = 0; - } - - return 0; /* OK */ -} - -/** Send a REGISTER packet to another edge. */ -static void send_register (n2n_edge_t * eee, - const n2n_sock_t * remote_peer, - const n2n_mac_t peer_mac, - const n2n_cookie_t cookie) { - - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - /* ssize_t sent; */ - n2n_common_t cmn; - n2n_REGISTER_t reg; - n2n_sock_str_t sockbuf; - - if(!eee->conf.allow_p2p) { - traceEvent(TRACE_DEBUG, "skipping register as P2P is disabled"); - return; - } - - memset(&cmn, 0, sizeof(cmn)); - memset(®, 0, sizeof(reg)); - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_register; - cmn.flags = 0; - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - - reg.cookie = cookie; - idx = 0; - encode_mac(reg.srcMac, &idx, eee->device.mac_addr); - - if(peer_mac) { - // can be NULL for multicast registrations - idx = 0; - encode_mac(reg.dstMac, &idx, peer_mac); - } - reg.dev_addr.net_addr = ntohl(eee->device.ip_addr); - reg.dev_addr.net_bitlen = mask2bitlen(ntohl(eee->device.device_mask)); - memcpy(reg.dev_desc, eee->conf.dev_desc, N2N_DESC_SIZE); - - idx = 0; - encode_REGISTER(pktbuf, &idx, &cmn, ®); - - traceEvent(TRACE_INFO, "send REGISTER to [%s]", - sock_to_cstr(sockbuf, remote_peer)); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt(pktbuf, idx, idx, - eee->conf.header_encryption_ctx_dynamic, eee->conf.header_iv_ctx_dynamic, - time_stamp()); - - /* sent = */ sendto_sock(eee, pktbuf, idx, remote_peer); -} - -/* ************************************** */ - -/** Send a REGISTER_ACK packet to a peer edge. */ -static void send_register_ack (n2n_edge_t * eee, - const n2n_sock_t * remote_peer, - const n2n_REGISTER_t * reg) { - - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx; - /* ssize_t sent; */ - n2n_common_t cmn; - n2n_REGISTER_ACK_t ack; - n2n_sock_str_t sockbuf; - - if(!eee->conf.allow_p2p) { - traceEvent(TRACE_DEBUG, "skipping register ACK as P2P is disabled"); - return; - } - - memset(&cmn, 0, sizeof(cmn)); - memset(&ack, 0, sizeof(reg)); - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_register_ack; - cmn.flags = 0; - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - - memset(&ack, 0, sizeof(ack)); - ack.cookie = reg->cookie; - memcpy(ack.srcMac, eee->device.mac_addr, N2N_MAC_SIZE); - memcpy(ack.dstMac, reg->srcMac, N2N_MAC_SIZE); - - idx = 0; - encode_REGISTER_ACK(pktbuf, &idx, &cmn, &ack); - - traceEvent(TRACE_INFO, "send REGISTER_ACK to [%s]", - sock_to_cstr(sockbuf, remote_peer)); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) - packet_header_encrypt(pktbuf, idx, idx, - eee->conf.header_encryption_ctx_dynamic, eee->conf.header_iv_ctx_dynamic, - time_stamp()); - - /* sent = */ sendto_sock(eee, pktbuf, idx, remote_peer); -} - -/* ************************************** */ - -static char gratuitous_arp[] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* dest MAC */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* src MAC */ - 0x08, 0x06, /* ARP */ - 0x00, 0x01, /* ethernet */ - 0x08, 0x00, /* IP */ - 0x06, /* hw Size */ - 0x04, /* protocol Size */ - 0x00, 0x02, /* ARP reply */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* src MAC */ - 0x00, 0x00, 0x00, 0x00, /* src IP */ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* target MAC */ - 0x00, 0x00, 0x00, 0x00 /* target IP */ -}; - -// build a gratuitous ARP packet */ -static int build_gratuitous_arp (n2n_edge_t * eee, char *buffer, uint16_t buffer_len) { - - if(buffer_len < sizeof(gratuitous_arp)) return(-1); - - memcpy(buffer, gratuitous_arp, sizeof(gratuitous_arp)); - memcpy(&buffer[6], eee->device.mac_addr, 6); - memcpy(&buffer[22], eee->device.mac_addr, 6); - memcpy(&buffer[28], &(eee->device.ip_addr), 4); - memcpy(&buffer[38], &(eee->device.ip_addr), 4); - - return(sizeof(gratuitous_arp)); -} - -/** Called from update_supernode_reg to periodically send gratuitous ARP - * broadcasts. */ -static void send_grat_arps (n2n_edge_t * eee) { - - uint8_t buffer[48]; - size_t len; - - traceEvent(TRACE_DEBUG, "sending gratuitous ARP..."); - len = build_gratuitous_arp(eee, (char*)buffer, sizeof(buffer)); - - edge_send_packet2net(eee, buffer, len); - edge_send_packet2net(eee, buffer, len); /* Two is better than one :-) */ -} - -/* ************************************** */ - -/** @brief Check to see if we should re-register with the supernode. - * - * This is frequently called by the main loop. - */ -void update_supernode_reg (n2n_edge_t * eee, time_t now) { - - struct peer_info *peer, *tmp_peer; - int cnt = 0; - int off = 0; - - if((eee->sn_wait && (now > (eee->last_register_req + (eee->conf.register_interval / 10)))) - ||(eee->sn_wait == 2)) /* immediately re-register in case of RE_REGISTER_SUPER */ { - /* fall through */ - traceEvent(TRACE_DEBUG, "update_supernode_reg: doing fast retry."); - } else if(now < (eee->last_register_req + eee->conf.register_interval)) - return; /* Too early */ - - // determine time offset to apply on last_register_req for - // all edges's next re-registration does not happen all at once - if(eee->sn_wait == 2) { - // remaining 1/4 is greater than 1/10 fast retry allowance; - // '%' might be expensive but does not happen all too often - off = n2n_rand() % ((eee->conf.register_interval * 3) / 4); - } - - check_join_multicast_group(eee); - - if(0 == eee->sup_attempts) { - /* Give up on that supernode and try the next one. */ - sn_selection_criterion_bad(&(eee->curr_sn->selection_criterion)); - sn_selection_sort(&(eee->conf.supernodes)); - eee->curr_sn = eee->conf.supernodes; - traceEvent(TRACE_WARNING, "supernode not responding, now trying [%s]", supernode_ip(eee)); - supernode_connect(eee); - reset_sup_attempts(eee); - // trigger out-of-schedule DNS resolution - eee->resolution_request = 1; - - // in some multi-NATed scenarios communication gets stuck on losing connection to supernode - // closing and re-opening the socket allows for re-establishing communication - // this can only be done, if working on some unprivileged port and/or having sufficent - // privileges. as we are not able to check for sufficent privileges here, we only do it - // if port is sufficently high or unset. uncovered: privileged port and sufficent privileges - if((eee->conf.local_port == 0) || (eee->conf.local_port > 1024)) { - // do not explicitly disconnect every time as the condition described is rare, so ... - // ... check that there are no external peers (indicating a working socket) ... - HASH_ITER(hh, eee->known_peers, peer, tmp_peer) - if(!peer->local) { - cnt++; - break; - } - if(!cnt) { - // ... and then count the connection retries - (eee->close_socket_counter)++; - if(eee->close_socket_counter >= N2N_CLOSE_SOCKET_COUNTER_MAX) { - eee->close_socket_counter = 0; - supernode_disconnect(eee); - traceEvent(TRACE_DEBUG, "disconnected supernode"); - } - } - - supernode_connect(eee); - traceEvent(TRACE_DEBUG, "reconnected to supernode"); - } - - } else { - --(eee->sup_attempts); - } - -#ifndef HAVE_PTHREAD - if(supernode2sock(&(eee->curr_sn->sock), eee->curr_sn->ip_addr) == 0) { -#endif - traceEvent(TRACE_INFO, "registering with supernode [%s][number of supernodes %d][attempts left %u]", - supernode_ip(eee), HASH_COUNT(eee->conf.supernodes), (unsigned int)eee->sup_attempts); - - send_register_super(eee); -#ifndef HAVE_PTHREAD - } -#endif - - register_with_local_peers(eee); - - // if supernode repeatedly not responding (already waiting), safeguard the - // current known connections to peers by re-registering - if(eee->sn_wait == 1) - HASH_ITER(hh, eee->known_peers, peer, tmp_peer) - if((now - peer->last_seen) > REGISTER_SUPER_INTERVAL_DFL) - send_register(eee, &(peer->sock), peer->mac_addr, peer->last_cookie); - - eee->sn_wait = 1; - - eee->last_register_req = now - off; -} - -/* ************************************** */ - -/** Return the IP address of the current supernode in the ring. */ -static const char * supernode_ip (const n2n_edge_t * eee) { - - return (eee->curr_sn->ip_addr); -} - -/* ************************************** */ - -/** A PACKET has arrived containing an encapsulated ethernet datagram - usually - * encrypted. */ -static int handle_PACKET (n2n_edge_t * eee, - const uint8_t from_supernode, - const n2n_PACKET_t * pkt, - const n2n_sock_t * orig_sender, - uint8_t * payload, - size_t psize) { - - ssize_t data_sent_len; - uint8_t * eth_payload = NULL; - int retval = -1; - time_t now; - ether_hdr_t * eh; - ipstr_t ip_buf; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - now = time(NULL); - - traceEvent(TRACE_DEBUG, "handle_PACKET size %u transform %u", - (unsigned int)psize, (unsigned int)pkt->transform); - /* hexdump(payload, psize); */ - - if(from_supernode) { - if(is_multi_broadcast(pkt->dstMac)) - ++(eee->stats.rx_sup_broadcast); - - ++(eee->stats.rx_sup); - eee->last_sup = now; - } else { - ++(eee->stats.rx_p2p); - eee->last_p2p=now; - } - - /* Handle transform. */ - { - uint8_t decodebuf[N2N_PKT_BUF_SIZE]; - size_t eth_size; - n2n_transform_t rx_transop_id; - uint8_t rx_compression_id; - - rx_transop_id = (n2n_transform_t)pkt->transform; - rx_compression_id = pkt->compression; - - if(rx_transop_id == eee->conf.transop_id) { - uint8_t is_multicast; - eth_payload = decodebuf; - eh = (ether_hdr_t*)eth_payload; - eth_size = eee->transop.rev(&eee->transop, - eth_payload, N2N_PKT_BUF_SIZE, - payload, psize, pkt->srcMac); - ++(eee->transop.rx_cnt); /* stats */ - - /* decompress if necessary */ - uint8_t * deflation_buffer = 0; - lzo_uint deflated_len; - switch(rx_compression_id) { - case N2N_COMPRESSION_ID_NONE: - break; // continue afterwards - - case N2N_COMPRESSION_ID_LZO: - deflation_buffer = malloc(N2N_PKT_BUF_SIZE); - lzo1x_decompress(eth_payload, eth_size, deflation_buffer, &deflated_len, NULL); - break; -#ifdef N2N_HAVE_ZSTD - case N2N_COMPRESSION_ID_ZSTD: - deflated_len = N2N_PKT_BUF_SIZE; - deflation_buffer = malloc(deflated_len); - deflated_len = ZSTD_decompress(deflation_buffer, deflated_len, eth_payload, eth_size); - if(ZSTD_isError(deflated_len)) { - traceEvent(TRACE_WARNING, "payload decompression failed with zstd error '%s'.", - ZSTD_getErrorName(deflated_len)); - free(deflation_buffer); - return(-1); // cannot help it - } - break; -#endif - default: - traceEvent(TRACE_WARNING, "payload decompression failed: received packet indicating unsupported %s compression.", - compression_str(rx_compression_id)); - return(-1); // cannot handle it - } - - if(rx_compression_id != N2N_COMPRESSION_ID_NONE) { - traceEvent(TRACE_DEBUG, "payload decompression %s: deflated %u bytes to %u bytes", - compression_str(rx_compression_id), eth_size, (int)deflated_len); - memcpy(eth_payload,deflation_buffer, deflated_len ); - eth_size = deflated_len; - free(deflation_buffer); - } - - is_multicast = (is_ip6_discovery(eth_payload, eth_size) || is_ethMulticast(eth_payload, eth_size)); - - if(eee->conf.drop_multicast && is_multicast) { - traceEvent(TRACE_INFO, "dropping RX multicast"); - return(-1); - } else if((!eee->conf.allow_routing) && (!is_multicast)) { - /* Check if it is a routed packet */ - - if((ntohs(eh->type) == 0x0800) && (eth_size >= ETH_FRAMESIZE + IP4_MIN_SIZE)) { - uint32_t *dst = (uint32_t*)ð_payload[ETH_FRAMESIZE + IP4_DSTOFFSET]; - uint8_t *dst_mac = (uint8_t*)eth_payload; - - /* Note: all elements of the_ip are in network order */ - if(!memcmp(dst_mac, broadcast_mac, N2N_MAC_SIZE)) - traceEvent(TRACE_DEBUG, "RX broadcast packet destined to [%s]", - intoa(ntohl(*dst), ip_buf, sizeof(ip_buf))); - else if((*dst != eee->device.ip_addr)) { - /* This is a packet that needs to be routed */ - traceEvent(TRACE_INFO, "discarding routed packet destined to [%s]", - intoa(ntohl(*dst), ip_buf, sizeof(ip_buf))); - return(-1); - } else { - /* This packet is directed to us */ - /* traceEvent(TRACE_INFO, "Sending non-routed packet"); */ - } - } - } - - if(eee->network_traffic_filter->filter_packet_from_peer(eee->network_traffic_filter, eee, orig_sender, - eth_payload, eth_size) == N2N_DROP) { - traceEvent(TRACE_DEBUG, "filtered packet of size %u", (unsigned int)eth_size); - return(0); - } - - if(eee->cb.packet_from_peer) { - uint16_t tmp_eth_size = eth_size; - if(eee->cb.packet_from_peer(eee, orig_sender, eth_payload, &tmp_eth_size) == N2N_DROP) { - traceEvent(TRACE_DEBUG, "DROP packet of size %u", (unsigned int)eth_size); - return(0); - } - eth_size = tmp_eth_size; - } - - /* Write ethernet packet to tap device. */ - traceEvent(TRACE_DEBUG, "sending data of size %u to TAP", (unsigned int)eth_size); - data_sent_len = tuntap_write(&(eee->device), eth_payload, eth_size); - - if(data_sent_len == eth_size) { - retval = 0; - } - } else { - traceEvent(TRACE_WARNING, "invalid transop ID: expected %s (%u), got %s (%u) from %s [%s]", - transop_str(eee->conf.transop_id), eee->conf.transop_id, - transop_str(rx_transop_id), rx_transop_id, - macaddr_str(mac_buf, pkt->srcMac), - sock_to_cstr(sockbuf, orig_sender)); - } - } - - return retval; -} - -/* ************************************** */ - - -#if 0 -#ifndef WIN32 - -static char *get_ip_from_arp (dec_ip_str_t buf, const n2n_mac_t req_mac) { - - FILE *fd; - dec_ip_str_t ip_str = {'\0'}; - char dev_str[N2N_IFNAMSIZ] = {'\0'}; - macstr_t mac_str = {'\0'}; - n2n_mac_t mac = {'\0'}; - - strncpy(buf, "0.0.0.0", N2N_NETMASK_STR_SIZE - 1); - - if(is_null_mac(req_mac)) { - traceEvent(TRACE_DEBUG, "MAC address is null."); - return buf; - } - - if(!(fd = fopen("/proc/net/arp", "r"))) { - traceEvent(TRACE_WARNING, "could not open arp table: %d - %s", errno, strerror(errno)); - return buf; - } - - while(!feof(fd) && fgetc(fd) != '\n'); - while(!feof(fd) && (fscanf(fd, " %15[0-9.] %*s %*s %17[A-Fa-f0-9:] %*s %15s", ip_str, mac_str, dev_str) == 3)) { - str2mac(mac, mac_str); - if(0 == memcmp(mac, req_mac, sizeof(n2n_mac_t))) { - strncpy(buf, ip_str, N2N_NETMASK_STR_SIZE - 1); - break; - } - } - fclose(fd); - - return buf; -} - -#endif -#endif - -/** Read a datagram from the management UDP socket and take appropriate - * action. */ -static void readFromMgmtSocket (n2n_edge_t *eee) { - - char udp_buf[N2N_PKT_BUF_SIZE]; /* Compete UDP packet */ - ssize_t recvlen; - /* ssize_t sendlen; */ - struct sockaddr_in sender_sock; - socklen_t i; - size_t msg_len; - time_t now; - struct peer_info *peer, *tmpPeer; - macstr_t mac_buf; - char time_buf[10]; /* 9 digits + 1 terminating zero */ - char uptime_buf[11]; /* 10 digits + 1 terminating zero */ - /* dec_ip_bit_str_t ip_bit_str = {'\0'}; */ - /* dec_ip_str_t ip_str = {'\0'}; */ - in_addr_t net; - n2n_sock_str_t sockbuf; - uint32_t num_pending_peers = 0; - uint32_t num_known_peers = 0; - uint32_t num = 0; - selection_criterion_str_t sel_buf; - - - now = time(NULL); - i = sizeof(sender_sock); - recvlen = recvfrom(eee->udp_mgmt_sock, udp_buf, N2N_PKT_BUF_SIZE, 0/*flags*/, - (struct sockaddr *) &sender_sock, (socklen_t *) &i); - - if(recvlen < 0) { - traceEvent(TRACE_WARNING, "mgmt recvfrom failed: %d - %s", errno, strerror(errno)); - return; /* failed to receive data from UDP */ - } - - /* avoid parsing any uninitialized junk from the stack */ - udp_buf[recvlen] = 0; - - if((0 == memcmp(udp_buf, "help", 4)) || (0 == memcmp(udp_buf, "?", 1))) { - msg_len = 0; - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "Help for edge management console:\n" - "\tstop | Gracefully exit edge\n" - "\thelp | This help message\n" - "\t+verb | Increase verbosity of logging\n" - "\t-verb | Decrease verbosity of logging\n" - "\tr ... | start query with JSON reply\n" - "\tw ... | start update with JSON reply\n" - "\t | Display statistics\n\n"); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - return; - } - - if(0 == memcmp(udp_buf, "stop", 4)) { - traceEvent(TRACE_NORMAL, "stop command received"); - *eee->keep_running = 0; - return; - } - - if(0 == memcmp(udp_buf, "+verb", 5)) { - msg_len = 0; - setTraceLevel(getTraceLevel() + 1); - - traceEvent(TRACE_NORMAL, "+verb traceLevel=%u", (unsigned int) getTraceLevel()); - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "> +OK traceLevel=%u\n", (unsigned int) getTraceLevel()); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - return; - } - - if(0 == memcmp(udp_buf, "-verb", 5)) { - msg_len = 0; - - if(getTraceLevel() > 0) { - setTraceLevel(getTraceLevel() - 1); - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "> -OK traceLevel=%u\n", getTraceLevel()); - } else { - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "> -NOK traceLevel=%u\n", getTraceLevel()); - } - - traceEvent(TRACE_NORMAL, "-verb traceLevel=%u", (unsigned int) getTraceLevel()); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - return; - } - - if((udp_buf[0] == 'r' || udp_buf[0] == 'w') && (udp_buf[1] == ' ')) { - /* this is a JSON request */ - handleMgmtJson(eee, udp_buf, sender_sock); - return; - } - - traceEvent(TRACE_DEBUG, "mgmt status requested"); - - msg_len = 0; - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "COMMUNITY '%s'\n\n", - (eee->conf.header_encryption == HEADER_ENCRYPTION_NONE) ? (char*)eee->conf.community_name : "-- header encrypted --"); - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - " ### | TAP | MAC | EDGE | HINT | LAST SEEN | UPTIME\n"); - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "=============================================================================================================\n"); - - // dump nodes with forwarding through supernodes - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "SUPERNODE FORWARD\n"); - num = 0; - HASH_ITER(hh, eee->pending_peers, peer, tmpPeer) { - ++num_pending_peers; - net = htonl(peer->dev_addr.net_addr); - snprintf(time_buf, sizeof(time_buf), "%9u", (unsigned int)(now - peer->last_seen)); - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "%4u | %-15s | %-17s | %-21s | %-15s | %9s |\n", - ++num, - (peer->dev_addr.net_addr == 0) ? "" : inet_ntoa(*(struct in_addr *) &net), - (is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr), - sock_to_cstr(sockbuf, &(peer->sock)), - peer->dev_desc, - (peer->last_seen) ? time_buf : ""); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - msg_len = 0; - } - - // dump peer-to-peer nodes - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "-------------------------------------------------------------------------------------------------------------\n"); - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "PEER TO PEER\n"); - num = 0; - HASH_ITER(hh, eee->known_peers, peer, tmpPeer) { - ++num_known_peers; - net = htonl(peer->dev_addr.net_addr); - snprintf(time_buf, sizeof(time_buf), "%9u", (unsigned int)(now - peer->last_seen)); - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "%4u | %-15s | %-17s | %-21s | %-15s | %9s |\n", - ++num, - (peer->dev_addr.net_addr == 0) ? "" : inet_ntoa(*(struct in_addr *) &net), - (is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr), - sock_to_cstr(sockbuf, &(peer->sock)), - peer->dev_desc, - (peer->last_seen) ? time_buf : ""); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - msg_len = 0; - } - - // dump supernodes - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "-------------------------------------------------------------------------------------------------------------\n"); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "SUPERNODES\n"); - HASH_ITER(hh, eee->conf.supernodes, peer, tmpPeer) { - net = htonl(peer->dev_addr.net_addr); - snprintf(time_buf, sizeof(time_buf), "%9u", (unsigned int)(now - peer->last_seen)); - snprintf(uptime_buf, sizeof(uptime_buf), "%10u", (unsigned int)(peer->uptime)); - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "%-19s %1s%1s | %-17s | %-21s | %-15s | %9s | %10s\n", - peer->version, - (peer->purgeable == SN_UNPURGEABLE) ? "l" : "", - (peer == eee->curr_sn) ? (eee->sn_wait ? "." : "*" ) : "", - is_null_mac(peer->mac_addr) ? "" : macaddr_str(mac_buf, peer->mac_addr), - sock_to_cstr(sockbuf, &(peer->sock)), - sn_selection_criterion_str(eee, sel_buf, peer), - (peer->last_seen) ? time_buf : "", - (peer->uptime) ? uptime_buf : ""); - - sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - msg_len = 0; - } - - // further stats - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "=============================================================================================================\n"); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "uptime %lu | ", - time(NULL) - eee->start_time); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "pend_peers %u | ", - num_pending_peers); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "known_peers %u | ", - num_known_peers); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "transop %u,%u\n", - (unsigned int) eee->transop.tx_cnt, - (unsigned int) eee->transop.rx_cnt); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "super %u,%u | ", - (unsigned int) eee->stats.tx_sup, - (unsigned int) eee->stats.rx_sup); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "p2p %u,%u\n", - (unsigned int) eee->stats.tx_p2p, - (unsigned int) eee->stats.rx_p2p); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "last_super %ld sec ago | ", - (now - eee->last_sup)); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "last_p2p %ld sec ago\n", - (now - eee->last_p2p)); - - msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), - "\nType \"help\" to see more commands.\n\n"); - - /* sendlen = */ sendto(eee->udp_mgmt_sock, udp_buf, msg_len, 0/*flags*/, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - - -/* ************************************** */ - -static int check_query_peer_info (n2n_edge_t *eee, time_t now, n2n_mac_t mac) { - - struct peer_info *scan; - - HASH_FIND_PEER(eee->pending_peers, mac, scan); - - if(!scan) { - scan = calloc(1, sizeof(struct peer_info)); - - memcpy(scan->mac_addr, mac, N2N_MAC_SIZE); - scan->timeout = eee->conf.register_interval; /* TODO: should correspond to the peer supernode registration timeout */ - scan->last_seen = now; /* Don't change this it marks the pending peer for removal. */ - scan->last_valid_time_stamp = initial_time_stamp(); - - HASH_ADD_PEER(eee->pending_peers, scan); - } - - if(now - scan->last_sent_query > eee->conf.register_interval) { - send_register(eee, &(eee->curr_sn->sock), mac, N2N_FORWARDED_REG_COOKIE); - send_query_peer(eee, scan->mac_addr); - scan->last_sent_query = now; - return(0); - } - - return(1); -} - -/* ************************************** */ - -/* @return 1 if destination is a peer, 0 if destination is supernode */ -static int find_peer_destination (n2n_edge_t * eee, - n2n_mac_t mac_address, - n2n_sock_t * destination) { - - struct peer_info *scan; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - int retval = 0; - time_t now = time(NULL); - - if(is_multi_broadcast(mac_address)) { - traceEvent(TRACE_DEBUG, "multicast or broadcast destination peer, using supernode"); - memcpy(destination, &(eee->curr_sn->sock), sizeof(struct sockaddr_in)); - return(0); - } - - traceEvent(TRACE_DEBUG, "searching destination socket for %s", - macaddr_str(mac_buf, mac_address)); - - HASH_FIND_PEER(eee->known_peers, mac_address, scan); - - if(scan && (scan->last_seen > 0)) { - if((now - scan->last_p2p) >= (scan->timeout / 2)) { - /* Too much time passed since we saw the peer, need to register again - * since the peer address may have changed. */ - traceEvent(TRACE_DEBUG, "refreshing idle known peer"); - HASH_DEL(eee->known_peers, scan); - free(scan); - /* NOTE: registration will be performed upon the receival of the next response packet */ - } else { - /* Valid known peer found */ - memcpy(destination, &scan->sock, sizeof(n2n_sock_t)); - retval = 1; - } - } - - if(retval == 0) { - memcpy(destination, &(eee->curr_sn->sock), sizeof(struct sockaddr_in)); - traceEvent(TRACE_DEBUG, "p2p peer %s not found, using supernode", - macaddr_str(mac_buf, mac_address)); - - check_query_peer_info(eee, now, mac_address); - } - - traceEvent(TRACE_DEBUG, "found peer's socket %s [%s]", - macaddr_str(mac_buf, mac_address), - sock_to_cstr(sockbuf, destination)); - - return retval; -} - -/* ***************************************************** */ - -/** Send an ecapsulated ethernet PACKET to a destination edge or broadcast MAC - * address. */ -static int send_packet (n2n_edge_t * eee, - n2n_mac_t dstMac, - const uint8_t * pktbuf, - size_t pktlen) { - - int is_p2p; - /*ssize_t s; */ - n2n_sock_str_t sockbuf; - n2n_sock_t destination; - macstr_t mac_buf; - struct peer_info *peer, *tmp_peer; - - /* hexdump(pktbuf, pktlen); */ - - is_p2p = find_peer_destination(eee, dstMac, &destination); - - traceEvent(TRACE_INFO, "Tx PACKET of %u bytes to %s [%s]", - pktlen, macaddr_str(mac_buf, dstMac), - sock_to_cstr(sockbuf, &destination)); - - if(is_p2p) - ++(eee->stats.tx_p2p); - else - ++(eee->stats.tx_sup); - - if(is_multi_broadcast(dstMac)) { - ++(eee->stats.tx_sup_broadcast); - - // if no supernode around, foward the broadcast to all known peers - if(eee->sn_wait) { - HASH_ITER(hh, eee->known_peers, peer, tmp_peer) - /* s = */ sendto_sock(eee, pktbuf, pktlen, &peer->sock); - return 0; - } - // fall through otherwise - } - - /* s = */ sendto_sock(eee, pktbuf, pktlen, &destination); - - return 0; -} - -/* ************************************** */ - -/** A layer-2 packet was received at the tunnel and needs to be sent via UDP. */ -void edge_send_packet2net (n2n_edge_t * eee, - uint8_t *tap_pkt, size_t len) { - - ipstr_t ip_buf; - n2n_mac_t destMac; - n2n_common_t cmn; - n2n_PACKET_t pkt; - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx = 0; - n2n_transform_t tx_transop_idx = eee->transop.transform_id; - ether_hdr_t eh; - - /* tap_pkt is not aligned so we have to copy to aligned memory */ - memcpy(&eh, tap_pkt, sizeof(ether_hdr_t)); - - /* Discard IP packets that are not originated by this hosts */ - if(!(eee->conf.allow_routing)) { - if(ntohs(eh.type) == 0x0800) { - /* This is an IP packet from the local source address - not forwarded. */ - uint32_t *src = (uint32_t*)&tap_pkt[ETH_FRAMESIZE + IP4_SRCOFFSET]; - - /* Note: all elements of the_ip are in network order */ - if(*src != eee->device.ip_addr) { - /* This is a packet that needs to be routed */ - traceEvent(TRACE_INFO, "discarding routed packet destined to [%s]", - intoa(ntohl(*src), ip_buf, sizeof(ip_buf))); - return; - } else { - /* This packet is originated by us */ - /* traceEvent(TRACE_INFO, "Sending non-routed packet"); */ - } - } - } - - /* Optionally compress then apply transforms, eg encryption. */ - - /* Once processed, send to destination in PACKET */ - - memcpy(destMac, tap_pkt, N2N_MAC_SIZE); /* dest MAC is first in ethernet header */ - - memset(&cmn, 0, sizeof(cmn)); - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_packet; - cmn.flags = 0; /* no options, not from supernode, no socket */ - memcpy(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE); - - memset(&pkt, 0, sizeof(pkt)); - memcpy(pkt.srcMac, eee->device.mac_addr, N2N_MAC_SIZE); - memcpy(pkt.dstMac, destMac, N2N_MAC_SIZE); - - pkt.transform = tx_transop_idx; - - // compression needs to be tried before encode_PACKET is called for compression indication gets encoded there - pkt.compression = N2N_COMPRESSION_ID_NONE; - - if(eee->conf.compression) { - uint8_t * compression_buffer = NULL; - int32_t compression_len; - - switch(eee->conf.compression) { - case N2N_COMPRESSION_ID_LZO: - compression_buffer = malloc(len + len / 16 + 64 + 3); - if(lzo1x_1_compress(tap_pkt, len, compression_buffer, (lzo_uint*)&compression_len, wrkmem) == LZO_E_OK) { - if(compression_len < len) { - pkt.compression = N2N_COMPRESSION_ID_LZO; - } - } - break; -#ifdef N2N_HAVE_ZSTD - case N2N_COMPRESSION_ID_ZSTD: - compression_len = N2N_PKT_BUF_SIZE + 128; - compression_buffer = malloc(compression_len); // leaves enough room, for exact size call compression_len = ZSTD_compressBound (len); (slower) - compression_len = (int32_t)ZSTD_compress(compression_buffer, compression_len, tap_pkt, len, ZSTD_COMPRESSION_LEVEL); - if(!ZSTD_isError(compression_len)) { - if(compression_len < len) { - pkt.compression = N2N_COMPRESSION_ID_ZSTD; - } - } else { - traceEvent(TRACE_ERROR, "payload compression failed with zstd error '%s'.", - ZSTD_getErrorName(compression_len)); - free(compression_buffer); - // continue with unset without pkt.compression --> will send uncompressed - } - break; -#endif - default: - break; - } - - if(pkt.compression != N2N_COMPRESSION_ID_NONE) { - traceEvent(TRACE_DEBUG, "payload compression [%s]: compressed %u bytes to %u bytes\n", - compression_str(pkt.compression), len, compression_len); - - memcpy(tap_pkt, compression_buffer, compression_len); - len = compression_len; - } - - if(compression_buffer) { - free(compression_buffer); - } - } - - idx = 0; - encode_PACKET(pktbuf, &idx, &cmn, &pkt); - - uint16_t headerIdx = idx; - - idx += eee->transop.fwd(&eee->transop, - pktbuf + idx, N2N_PKT_BUF_SIZE - idx, - tap_pkt, len, pkt.dstMac); - - traceEvent(TRACE_DEBUG, "encode PACKET of %u bytes, %u bytes data, %u bytes overhead, transform %u", - (u_int)idx, (u_int)len, (u_int)(idx - len), tx_transop_idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) - // in case of user-password auth, also encrypt the iv of payload assuming ChaCha20 and SPECK having the same iv size - packet_header_encrypt(pktbuf, headerIdx + (NULL != eee->conf.shared_secret) * min(idx - headerIdx, N2N_SPECK_IVEC_SIZE), idx, - eee->conf.header_encryption_ctx_dynamic, eee->conf.header_iv_ctx_dynamic, - time_stamp()); - -#ifdef MTU_ASSERT_VALUE - { - const u_int eth_udp_overhead = ETH_FRAMESIZE + IP4_MIN_SIZE + UDP_SIZE; - - // MTU assertion which avoids fragmentation by N2N - assert(idx + eth_udp_overhead <= MTU_ASSERT_VALUE); - } -#endif - - eee->transop.tx_cnt++; /* stats */ - - send_packet(eee, destMac, pktbuf, idx); /* to peer or supernode */ -} - -/* ************************************** */ - -/** Read a single packet from the TAP interface, process it and write out the - * corresponding packet to the cooked socket. - */ -void edge_read_from_tap (n2n_edge_t * eee) { - - /* tun -> remote */ - uint8_t eth_pkt[N2N_PKT_BUF_SIZE]; - macstr_t mac_buf; - ssize_t len; - - len = tuntap_read( &(eee->device), eth_pkt, N2N_PKT_BUF_SIZE ); - if((len <= 0) || (len > N2N_PKT_BUF_SIZE)) { - traceEvent(TRACE_WARNING, "read()=%d [%d/%s]", - (signed int)len, errno, strerror(errno)); - traceEvent(TRACE_WARNING, "TAP I/O operation aborted, restart later."); - sleep(3); - tuntap_close(&(eee->device)); - tuntap_open(&(eee->device), eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, eee->tuntap_priv_conf.ip_addr, - eee->tuntap_priv_conf.netmask, eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu -#ifdef WIN32 - ,eee->tuntap_priv_conf.metric -#endif - ); - } else { - const uint8_t * mac = eth_pkt; - traceEvent(TRACE_DEBUG, "Rx TAP packet (%4d) for %s", - (signed int)len, macaddr_str(mac_buf, mac)); - - if(eee->conf.drop_multicast && - (is_ip6_discovery(eth_pkt, len) || - is_ethMulticast(eth_pkt, len))) { - traceEvent(TRACE_INFO, "dropping Tx multicast"); - } else { - if(!eee->last_sup) { - // drop packets before first registration with supernode - traceEvent(TRACE_DEBUG, "DROP packet before first registration with supernode"); - return; - } - - if(eee->network_traffic_filter) { - if(eee->network_traffic_filter->filter_packet_from_tap(eee->network_traffic_filter, eee, eth_pkt, - len) == N2N_DROP) { - traceEvent(TRACE_DEBUG, "filtered packet of size %u", (unsigned int)len); - return; - } - } - - if(eee->cb.packet_from_tap) { - uint16_t tmp_len = len; - if(eee->cb.packet_from_tap(eee, eth_pkt, &tmp_len) == N2N_DROP) { - traceEvent(TRACE_DEBUG, "DROP packet of size %u", (unsigned int)len); - return; - } - len = tmp_len; - } - - edge_send_packet2net(eee, eth_pkt, len); - } - } -} - - -/* ************************************** */ - - -/** handle a datagram from the main UDP socket to the internet. */ -void process_udp (n2n_edge_t *eee, const struct sockaddr_in *sender_sock, const SOCKET in_sock, - uint8_t *udp_buf, size_t udp_size, time_t now) { - - n2n_common_t cmn; /* common fields in the packet header */ - n2n_sock_str_t sockbuf1; - n2n_sock_str_t sockbuf2; /* don't clobber sockbuf1 if writing two addresses to trace */ - macstr_t mac_buf1; - macstr_t mac_buf2; - uint8_t hash_buf[16]; - size_t rem; - size_t idx; - size_t msg_type; - uint8_t from_supernode; - uint8_t via_multicast; - peer_info_t *sn = NULL; - n2n_sock_t sender; - n2n_sock_t * orig_sender = NULL; - uint32_t header_enc = 0; - uint64_t stamp = 0; - int skip_add = 0; - - /* REVISIT: when UDP/IPv6 is supported we will need a flag to indicate which - * IP transport version the packet arrived on. May need to UDP sockets. */ - - memset(&sender, 0, sizeof(n2n_sock_t)); - - if(eee->conf.connect_tcp) - // TCP expects that we know our comm partner and does not deliver the sender - memcpy(&sender, &(eee->curr_sn->sock), sizeof(struct sockaddr_in)); - else { - sender.family = AF_INET; /* UDP socket was opened PF_INET v4 */ - sender.port = ntohs(sender_sock->sin_port); - memcpy(&(sender.addr.v4), &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - } - /* The packet may not have an orig_sender socket spec. So default to last - * hop as sender. */ - orig_sender = &sender; - -#ifdef SKIP_MULTICAST_PEERS_DISCOVERY - via_multicast = 0; -#else - via_multicast = (in_sock == eee->udp_multicast_sock); -#endif - - traceEvent(TRACE_DEBUG, "Rx N2N_UDP of size %d from [%s]", - (signed int)udp_size, sock_to_cstr(sockbuf1, &sender)); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - // match with static (1) or dynamic (2) ctx? - // check dynamic first as it is identical to static in normal header encryption mode - if(packet_header_decrypt(udp_buf, udp_size, - (char *)eee->conf.community_name, - eee->conf.header_encryption_ctx_dynamic, eee->conf.header_iv_ctx_dynamic, - &stamp)) { - header_enc = 2; /* not accurate with normal header encryption but does not matter */ - } - if(!header_enc) { - // check static now (very likely to be REGISTER_SUPER_ACK, REGISTER_SUPER_NAK or invalid) - if(eee->conf.shared_secret) { - // hash the still encrypted packet to eventually be able to check it later (required for REGISTER_SUPER_ACK with user/pw auth) - pearson_hash_128(hash_buf, udp_buf, max(0, (int)udp_size - (int)N2N_REG_SUP_HASH_CHECK_LEN)); - } - header_enc = packet_header_decrypt(udp_buf, max(0, (int)udp_size - (int)N2N_REG_SUP_HASH_CHECK_LEN), - (char *)eee->conf.community_name, - eee->conf.header_encryption_ctx_static, eee->conf.header_iv_ctx_static, - &stamp); - } - if(!header_enc) { - traceEvent(TRACE_DEBUG, "failed to decrypt header"); - return; - } - // time stamp verification follows in the packet specific section as it requires to determine the - // sender from the hash list by its MAC, or the packet might be from the supernode, this all depends - // on packet type, path taken (via supernode) and packet structure (MAC is not always in the same place) - } - - rem = udp_size; /* Counts down bytes of packet to protect against buffer overruns. */ - idx = 0; /* marches through packet header as parts are decoded. */ - if(decode_common(&cmn, udp_buf, &rem, &idx) < 0) { - if(via_multicast) { - // from some other edge on local network, possibly header encrypted - traceEvent(TRACE_DEBUG, "dropped packet arriving via multicast due to error while decoding N2N_UDP"); - } else { - traceEvent(TRACE_INFO, "failed to decode common section in N2N_UDP"); - } - return; /* failed to decode packet */ - } - - msg_type = cmn.pc; /* packet code */ - - // special case for user/pw auth - // community's auth scheme and message type need to match the used key (dynamic) - if((eee->conf.shared_secret) - && (msg_type != MSG_TYPE_REGISTER_SUPER_ACK) - && (msg_type != MSG_TYPE_REGISTER_SUPER_NAK)) { - if(header_enc != 2) { - traceEvent(TRACE_INFO, "dropped packet encrypted with static key where dynamic key expected"); - return; - } - } - - // check if packet is from supernode and find the corresponding supernode in list - from_supernode = cmn.flags & N2N_FLAGS_FROM_SUPERNODE; - if(from_supernode) { - skip_add = SN_ADD_SKIP; - sn = add_sn_to_list_by_mac_or_sock(&(eee->conf.supernodes), &sender, null_mac, &skip_add); - if(!sn) { - traceEvent(TRACE_DEBUG, "dropped incoming data from unknown supernode"); - return; - } - } - - if(0 == memcmp(cmn.community, eee->conf.community_name, N2N_COMMUNITY_SIZE)) { - switch(msg_type) { - case MSG_TYPE_PACKET: { - /* process PACKET - most frequent so first in list. */ - n2n_PACKET_t pkt; - - decode_PACKET(&pkt, &cmn, udp_buf, &rem, &idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify(eee, sn, pkt.srcMac, stamp, TIME_STAMP_ALLOW_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped PACKET due to time stamp error"); - return; - } - } - - if(!eee->last_sup) { - // drop packets received before first registration with supernode - traceEvent(TRACE_DEBUG, "dropped PACKET recevied before first registration with supernode"); - return; - } - - if(is_valid_peer_sock(&pkt.sock)) - orig_sender = &(pkt.sock); - - if(!from_supernode) { - /* This is a P2P packet from the peer. We purge a pending - * registration towards the possibly nat-ted peer address as we now have - * a valid channel. We still use check_peer_registration_needed in - * handle_PACKET to double check this. - */ - traceEvent(TRACE_DEBUG, "[p2p] from %s", - macaddr_str(mac_buf1, pkt.srcMac)); - find_and_remove_peer(&eee->pending_peers, pkt.srcMac); - } else { - /* [PsP] : edge Peer->Supernode->edge Peer */ - traceEvent(TRACE_DEBUG, "[pSp] from %s via [%s]", - macaddr_str(mac_buf1, pkt.srcMac), - sock_to_cstr(sockbuf1, &sender)); - } - - /* Update the sender in peer table entry */ - check_peer_registration_needed(eee, from_supernode, via_multicast, - pkt.srcMac, - // REVISIT: also consider PORT_REG_COOKIEs when implemented - from_supernode ? N2N_FORWARDED_REG_COOKIE : N2N_REGULAR_REG_COOKIE, - NULL, NULL, orig_sender); - - handle_PACKET(eee, from_supernode, &pkt, orig_sender, udp_buf + idx, udp_size - idx); - break; - } - - case MSG_TYPE_REGISTER: { - /* Another edge is registering with us */ - n2n_REGISTER_t reg; - - decode_REGISTER(®, &cmn, udp_buf, &rem, &idx); - - via_multicast &= is_null_mac(reg.dstMac); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify(eee, sn, reg.srcMac, stamp, - via_multicast ? TIME_STAMP_ALLOW_JITTER : TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped REGISTER due to time stamp error"); - return; - } - } - - if(is_valid_peer_sock(®.sock)) - orig_sender = &(reg.sock); - - if(via_multicast && !memcmp(reg.srcMac, eee->device.mac_addr, N2N_MAC_SIZE)) { - traceEvent(TRACE_DEBUG, "skipping REGISTER from self"); - break; - } - - if(!via_multicast && memcmp(reg.dstMac, eee->device.mac_addr, N2N_MAC_SIZE)) { - traceEvent(TRACE_DEBUG, "skipping REGISTER for other peer"); - break; - } - - if(!from_supernode) { - /* This is a P2P registration from the peer. We purge a pending - * registration towards the possibly nat-ted peer address as we now have - * a valid channel. We still use check_peer_registration_needed below - * to double check this. - */ - traceEvent(TRACE_INFO, "[p2p] Rx REGISTER from %s [%s]%s", - macaddr_str(mac_buf1, reg.srcMac), - sock_to_cstr(sockbuf1, &sender), - (reg.cookie & N2N_LOCAL_REG_COOKIE) ? " (local)" : ""); - find_and_remove_peer(&eee->pending_peers, reg.srcMac); - - /* NOTE: only ACK to peers */ - send_register_ack(eee, orig_sender, ®); - } else { - traceEvent(TRACE_INFO, "[pSp] Rx REGISTER from %s [%s] to %s via [%s]", - macaddr_str(mac_buf1, reg.srcMac), sock_to_cstr(sockbuf2, orig_sender), - macaddr_str(mac_buf2, reg.dstMac), sock_to_cstr(sockbuf1, &sender)); - } - - check_peer_registration_needed(eee, from_supernode, via_multicast, - reg.srcMac, reg.cookie, ®.dev_addr, (const n2n_desc_t*)®.dev_desc, orig_sender); - break; - } - - case MSG_TYPE_REGISTER_ACK: { - /* Peer edge is acknowledging our register request */ - n2n_REGISTER_ACK_t ra; - - decode_REGISTER_ACK(&ra, &cmn, udp_buf, &rem, &idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify(eee, sn, ra.srcMac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped REGISTER_ACK due to time stamp error"); - return; - } - } - - if(is_valid_peer_sock(&ra.sock)) - orig_sender = &(ra.sock); - - traceEvent(TRACE_INFO, "Rx REGISTER_ACK from %s [%s] to %s via [%s]%s", - macaddr_str(mac_buf1, ra.srcMac), - sock_to_cstr(sockbuf2, orig_sender), - macaddr_str(mac_buf2, ra.dstMac), - sock_to_cstr(sockbuf1, &sender), - (ra.cookie & N2N_LOCAL_REG_COOKIE) ? " (local)" : ""); - - peer_set_p2p_confirmed(eee, ra.srcMac, - ra.cookie, - &sender, now); - break; - } - - case MSG_TYPE_REGISTER_SUPER_ACK: { - in_addr_t net; - char * ip_str = NULL; - n2n_REGISTER_SUPER_ACK_t ra; - uint8_t tmpbuf[REG_SUPER_ACK_PAYLOAD_SPACE]; - char ip_tmp[N2N_EDGE_SN_HOST_SIZE]; - n2n_REGISTER_SUPER_ACK_payload_t *payload; - int i; - int skip_add; - - if(!(eee->sn_wait)) { - traceEvent(TRACE_DEBUG, "Rx REGISTER_SUPER_ACK with no outstanding REGISTER_SUPER"); - return; - } - - memset(&ra, 0, sizeof(n2n_REGISTER_SUPER_ACK_t)); - decode_REGISTER_SUPER_ACK(&ra, &cmn, udp_buf, &rem, &idx, tmpbuf); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify(eee, sn, ra.srcMac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped REGISTER_SUPER_ACK due to time stamp error"); - return; - } - } - - // hash check (user/pw auth only) - if(eee->conf.shared_secret) { - speck_128_encrypt(hash_buf, (speck_context_t*)eee->conf.shared_secret_ctx); - if(memcmp(hash_buf, udp_buf + udp_size - N2N_REG_SUP_HASH_CHECK_LEN /* length is has already been checked */, N2N_REG_SUP_HASH_CHECK_LEN)) { - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_ACK with wrong hash"); - return; - } - } - - if(ra.cookie != eee->curr_sn->last_cookie) { - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_ACK with wrong or old cookie"); - return; - } - - if(handle_remote_auth(eee, sn, &(ra.auth))) { - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_ACK with wrong or old response to challenge"); - if(eee->conf.shared_secret) { - traceEvent(TRACE_NORMAL, "Rx REGISTER_SUPER_ACK with wrong or old response to challenge, maybe indicating wrong federation public key (-P)"); - } - return; - } - - if(is_valid_peer_sock(&ra.sock)) - orig_sender = &(ra.sock); - - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_ACK from %s [%s] (external %s) with %u attempts left", - macaddr_str(mac_buf1, ra.srcMac), - sock_to_cstr(sockbuf1, &sender), - sock_to_cstr(sockbuf2, orig_sender), - (unsigned int)eee->sup_attempts); - - if(is_null_mac(eee->curr_sn->mac_addr)) { - HASH_DEL(eee->conf.supernodes, eee->curr_sn); - memcpy(&eee->curr_sn->mac_addr, ra.srcMac, N2N_MAC_SIZE); - HASH_ADD_PEER(eee->conf.supernodes, eee->curr_sn); - } - - payload = (n2n_REGISTER_SUPER_ACK_payload_t*)tmpbuf; - - // from here on, 'sn' gets used differently - for(i = 0; i < ra.num_sn; i++) { - skip_add = SN_ADD; - sn = add_sn_to_list_by_mac_or_sock(&(eee->conf.supernodes), &(payload->sock), payload->mac, &skip_add); - - if(skip_add == SN_ADD_ADDED) { - sn->ip_addr = calloc(1, N2N_EDGE_SN_HOST_SIZE); - if(sn->ip_addr != NULL) { - inet_ntop(payload->sock.family, - (payload->sock.family == AF_INET) ? (void*)&(payload->sock.addr.v4) : (void*)&(payload->sock.addr.v6), - sn->ip_addr, N2N_EDGE_SN_HOST_SIZE - 1); - sprintf(ip_tmp, "%s:%u", (char*)sn->ip_addr, (uint16_t)(payload->sock.port)); - memcpy(sn->ip_addr, ip_tmp, sizeof(ip_tmp)); - } - sn_selection_criterion_default(&(sn->selection_criterion)); - sn->last_seen = 0; /* as opposed to payload handling in supernode */ - traceEvent(TRACE_NORMAL, "supernode '%s' added to the list of supernodes.", sn->ip_addr); - } - // shift to next payload entry - payload++; - } - - if(eee->conf.tuntap_ip_mode == TUNTAP_IP_MODE_SN_ASSIGN) { - if((ra.dev_addr.net_addr != 0) && (ra.dev_addr.net_bitlen != 0)) { - net = htonl(ra.dev_addr.net_addr); - if((ip_str = inet_ntoa(*(struct in_addr *) &net)) != NULL) { - strncpy(eee->tuntap_priv_conf.ip_addr, ip_str, N2N_NETMASK_STR_SIZE); - eee->tuntap_priv_conf.ip_addr[N2N_NETMASK_STR_SIZE - 1] = '\0'; - } - net = htonl(bitlen2mask(ra.dev_addr.net_bitlen)); - if((ip_str = inet_ntoa(*(struct in_addr *) &net)) != NULL) { - strncpy(eee->tuntap_priv_conf.netmask, ip_str, N2N_NETMASK_STR_SIZE); - eee->tuntap_priv_conf.netmask[N2N_NETMASK_STR_SIZE - 1] = '\0'; - } - } - } - - eee->sn_wait = 0; - reset_sup_attempts(eee); /* refresh because we got a response */ - - // update last_sup only on 'real' REGISTER_SUPER_ACKs, not on bootstrap ones (own MAC address - // still null_mac) this allows reliable in/out PACKET drop if not really registered with a supernode yet - if(!is_null_mac(eee->device.mac_addr)) { - if(!eee->last_sup) { - // indicates first successful connection between the edge and a supernode - traceEvent(TRACE_NORMAL, "[OK] edge <<< ================ >>> supernode"); - // send gratuitous ARP only upon first registration with supernode - send_grat_arps(eee); - } - eee->last_sup = now; - } - - // NOTE: the register_interval should be chosen by the edge node based on its NAT configuration. - // eee->conf.register_interval = ra.lifetime; - - if(eee->cb.sn_registration_updated && !is_null_mac(eee->device.mac_addr)) - eee->cb.sn_registration_updated(eee, now, &sender); - - break; - } - - case MSG_TYPE_REGISTER_SUPER_NAK: { - - n2n_REGISTER_SUPER_NAK_t nak; - - if(!(eee->sn_wait)) { - traceEvent(TRACE_DEBUG, "Rx REGISTER_SUPER_NAK with no outstanding REGISTER_SUPER"); - return; - } - - memset(&nak, 0, sizeof(n2n_REGISTER_SUPER_NAK_t)); - decode_REGISTER_SUPER_NAK(&nak, &cmn, udp_buf, &rem, &idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify(eee, sn, nak.srcMac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped REGISTER_SUPER_NAK due to time stamp error"); - return; - } - } - - if(nak.cookie != eee->curr_sn->last_cookie) { - traceEvent(TRACE_DEBUG, "Rx REGISTER_SUPER_NAK with wrong or old cookie"); - return; - } - - // REVISIT: authenticate the NAK packet really originating from the supernode along the auth token. - // this must follow a different scheme because it needs to prove authenticity although the - // edge-provided credentials are wrong - - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_NAK"); - - if((memcmp(nak.srcMac, eee->device.mac_addr, sizeof(n2n_mac_t))) == 0) { - if(eee->conf.shared_secret) { - traceEvent(TRACE_ERROR, "authentication error, username or password not recognized by supernode"); - } else { - traceEvent(TRACE_ERROR, "authentication error, MAC or IP address already in use or not released yet by supernode"); - } - // REVISIT: the following portion is too harsh, repeated error warning should be sufficient until it eventually is resolved, - // preventing de-auth attacks - /* exit(1); this is too harsh, repeated error warning should be sufficient until it eventually is resolved, preventing de-auth attacks - } else { - HASH_FIND_PEER(eee->known_peers, nak.srcMac, peer); - if(peer != NULL) { - HASH_DEL(eee->known_peers, peer); - } - HASH_FIND_PEER(eee->pending_peers, nak.srcMac, scan); - if(scan != NULL) { - HASH_DEL(eee->pending_peers, scan); - } */ - } - break; - } - - case MSG_TYPE_PEER_INFO: { - - n2n_PEER_INFO_t pi; - struct peer_info * scan; - int skip_add; - - decode_PEER_INFO(&pi, &cmn, udp_buf, &rem, &idx); - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify(eee, sn, null_mac, stamp, TIME_STAMP_ALLOW_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped PEER_INFO due to time stamp error"); - return; - } - } - - if((cmn.flags & N2N_FLAGS_SOCKET) && !is_valid_peer_sock(&pi.sock)) { - traceEvent(TRACE_DEBUG, "skip invalid PEER_INFO from %s [%s]", - macaddr_str(mac_buf1, pi.mac), - sock_to_cstr(sockbuf1, &pi.sock)); - break; - } - - if(is_null_mac(pi.mac)) { - // PONG - answer to PING (QUERY_PEER_INFO with null mac) - skip_add = SN_ADD_SKIP; - scan = add_sn_to_list_by_mac_or_sock(&(eee->conf.supernodes), &sender, pi.srcMac, &skip_add); - if(scan != NULL) { - eee->sn_pong = 1; - scan->last_seen = now; - scan->uptime = pi.uptime; - memcpy(scan->version, pi.version, sizeof(n2n_version_t)); - /* The data type depends on the actual selection strategy that has been chosen. */ - SN_SELECTION_CRITERION_DATA_TYPE sn_sel_tmp = pi.load; - sn_selection_criterion_calculate(eee, scan, &sn_sel_tmp); - - traceEvent(TRACE_INFO, "Rx PONG from supernode %s", - macaddr_str(mac_buf1, pi.srcMac)); - - break; - } - } else { - // regular PEER_INFO - HASH_FIND_PEER(eee->pending_peers, pi.mac, scan); - if(!scan) - // just in case the remote edge has been upgraded by the REG/ACK mechanism in the meantime - HASH_FIND_PEER(eee->known_peers, pi.mac, scan); - - if(scan) { - scan->sock = pi.sock; - - traceEvent(TRACE_INFO, "Rx PEER_INFO %s can be found at [%s]", - macaddr_str(mac_buf1, pi.mac), - sock_to_cstr(sockbuf1, &pi.sock)); - - if(cmn.flags & N2N_FLAGS_SOCKET) { - scan->preferred_sock = pi.preferred_sock; - send_register(eee, &scan->preferred_sock, scan->mac_addr, N2N_LOCAL_REG_COOKIE); - - traceEvent(TRACE_INFO, "%s has preferred local socket at [%s]", - macaddr_str(mac_buf1, pi.mac), - sock_to_cstr(sockbuf1, &pi.preferred_sock)); - } - - send_register(eee, &scan->sock, scan->mac_addr, N2N_REGULAR_REG_COOKIE); - - } else { - traceEvent(TRACE_INFO, "Rx PEER_INFO unknown peer %s", - macaddr_str(mac_buf1, pi.mac)); - } - } - break; - } - - case MSG_TYPE_RE_REGISTER_SUPER: { - - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_peer_time_stamp_and_verify(eee, sn, null_mac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped RE_REGISTER due to time stamp error"); - return; - } - } - - // only accept in user/pw mode for immediate re-registration because the new - // key is required for continous traffic flow, in other modes edge will realize - // changes with regular recurring REGISTER_SUPER - if(!eee->conf.shared_secret) { - traceEvent(TRACE_DEBUG, "dropped RE_REGISTER_SUPER as not in user/pw auth mode"); - return; - } - - traceEvent(TRACE_INFO, "Rx RE_REGISTER_SUPER"); - - eee->sn_wait = 2; /* immediately */ - - break; - } - - default: - /* Not a known message type */ - traceEvent(TRACE_INFO, "unable to handle packet type %d: ignored", (signed int)msg_type); - return; - } /* switch(msg_type) */ - } else if(from_supernode) /* if(community match) */ - traceEvent(TRACE_INFO, "received packet with unknown community"); - else - traceEvent(TRACE_INFO, "ignoring packet with unknown community"); -} - - -/* ************************************** */ - - -int fetch_and_eventually_process_data (n2n_edge_t *eee, SOCKET sock, - uint8_t *pktbuf, uint16_t *expected, uint16_t *position, - time_t now) { - - ssize_t bread = 0; - - if((!eee->conf.connect_tcp) -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - || (sock == eee->udp_multicast_sock) -#endif - ) { - // udp - struct sockaddr_in sender_sock; - socklen_t i; - - i = sizeof(sender_sock); - bread = recvfrom(sock, pktbuf, N2N_PKT_BUF_SIZE, 0 /*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t *)&i); - - if((bread < 0) -#ifdef WIN32 - && (WSAGetLastError() != WSAECONNRESET) -#endif - ) { - /* For UDP bread of zero just means no data (unlike TCP). */ - /* The fd is no good now. Maybe we lost our interface. */ - traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); -#ifdef WIN32 - traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - return -1; - } - - // we have a datagram to process... - if(bread > 0) { - // ...and the datagram has data (not just a header) - process_udp(eee, &sender_sock, sock, pktbuf, bread, now); - } - - } else { - // tcp - struct sockaddr_in sender_sock; - socklen_t i; - - i = sizeof(sender_sock); - bread = recvfrom(sock, - pktbuf + *position, *expected - *position, 0 /*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t *)&i); - if((bread <= 0) && (errno)) { - traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); -#ifdef WIN32 - traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - supernode_disconnect(eee); - eee->sn_wait = 1; - traceEvent(TRACE_DEBUG, "disconnected supernode due to connection error"); - goto tcp_done; - } - *position = *position + bread; - - if(*position == *expected) { - if(*position == sizeof(uint16_t)) { - // the prepended length has been read, preparing for the packet - *expected = *expected + be16toh(*(uint16_t*)(pktbuf)); - if(*expected > N2N_PKT_BUF_SIZE) { - supernode_disconnect(eee); - eee->sn_wait = 1; - traceEvent(TRACE_DEBUG, "disconnected supernode due to too many bytes expected"); - goto tcp_done; - } - } else { - // full packet read, handle it - process_udp(eee, (struct sockaddr_in*)&sender_sock, sock, - pktbuf + sizeof(uint16_t), *position - sizeof(uint16_t), now); - // reset, await new prepended length - *expected = sizeof(uint16_t); - *position = 0; - } - } - } - tcp_done: - ; - - return 0; -} - - -void print_edge_stats (const n2n_edge_t *eee) { - - const struct n2n_edge_stats *s = &eee->stats; - - traceEvent(TRACE_NORMAL, "**********************************"); - traceEvent(TRACE_NORMAL, "Packet stats:"); - traceEvent(TRACE_NORMAL, " TX P2P: %u pkts", s->tx_p2p); - traceEvent(TRACE_NORMAL, " RX P2P: %u pkts", s->rx_p2p); - traceEvent(TRACE_NORMAL, " TX Supernode: %u pkts (%u broadcast)", s->tx_sup, s->tx_sup_broadcast); - traceEvent(TRACE_NORMAL, " RX Supernode: %u pkts (%u broadcast)", s->rx_sup, s->rx_sup_broadcast); - traceEvent(TRACE_NORMAL, "**********************************"); -} - - -/* ************************************** */ - - -int run_edge_loop (n2n_edge_t *eee) { - - size_t numPurged; - time_t lastIfaceCheck = 0; - time_t lastTransop = 0; - time_t last_purge_known = 0; - time_t last_purge_pending = 0; - - uint16_t expected = sizeof(uint16_t); - uint16_t position = 0; - uint8_t pktbuf[N2N_PKT_BUF_SIZE + sizeof(uint16_t)]; /* buffer + prepended buffer length in case of tcp */ - -#ifdef WIN32 - struct tunread_arg arg; - arg.eee = eee; - HANDLE tun_read_thread = startTunReadThread(&arg); -#endif - - *eee->keep_running = 1; - update_supernode_reg(eee, time(NULL)); - - /* Main loop - * - * select() is used to wait for input on either the TAP fd or the UDP/TCP - * socket. When input is present the data is read and processed by either - * readFromIPSocket() or edge_read_from_tap() - */ - - while(*eee->keep_running) { - - int rc, max_sock = 0; - fd_set socket_mask; - struct timeval wait_time; - time_t now; - - FD_ZERO(&socket_mask); - - FD_SET(eee->udp_mgmt_sock, &socket_mask); - max_sock = eee->udp_mgmt_sock; - - if(eee->sock >= 0) { - FD_SET(eee->sock, &socket_mask); - max_sock = max(eee->sock, eee->udp_mgmt_sock); - } -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if((eee->conf.allow_p2p) - && (eee->conf.preferred_sock.family == (uint8_t)AF_INVALID)) { - FD_SET(eee->udp_multicast_sock, &socket_mask); - max_sock = max(eee->sock, eee->udp_multicast_sock); - } -#endif - -#ifndef WIN32 - FD_SET(eee->device.fd, &socket_mask); - max_sock = max(max_sock, eee->device.fd); -#endif - - wait_time.tv_sec = (eee->sn_wait) ? (SOCKET_TIMEOUT_INTERVAL_SECS / 10 + 1) : (SOCKET_TIMEOUT_INTERVAL_SECS); - wait_time.tv_usec = 0; - rc = select(max_sock + 1, &socket_mask, NULL, NULL, &wait_time); - now = time(NULL); - - // make sure ciphers are updated before the packet is treated - if((now - lastTransop) > TRANSOP_TICK_INTERVAL) { - lastTransop = now; - - eee->transop.tick(&eee->transop, now); - } - - if(rc > 0) { - // any or all of the FDs could have input; check them all - - // external - if(FD_ISSET(eee->sock, &socket_mask)) { - if(0 != fetch_and_eventually_process_data(eee, eee->sock, - pktbuf, &expected, &position, - now)) { - *eee->keep_running = 0; - break; - } - if(eee->conf.connect_tcp) { - if((expected >= N2N_PKT_BUF_SIZE) || (position >= N2N_PKT_BUF_SIZE)) { - // something went wrong, possibly even before - // e.g. connection failure/closure in the middle of transmission (between len & data) - supernode_disconnect(eee); - eee->sn_wait = 1; - - expected = sizeof(uint16_t); - position = 0; - } - } - } - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if(FD_ISSET(eee->udp_multicast_sock, &socket_mask)) { - if(0 != fetch_and_eventually_process_data(eee, eee->udp_multicast_sock, - pktbuf, &expected, &position, - now)) { - *eee->keep_running = 0; - break; - } - } -#endif - - if(FD_ISSET(eee->udp_mgmt_sock, &socket_mask)) { - // read from the management port socket - readFromMgmtSocket(eee); - - if(!(*eee->keep_running)) - break; - } - -#ifndef WIN32 - if(FD_ISSET(eee->device.fd, &socket_mask)) { - // read an ethernet frame from the TAP socket; write on the IP socket - edge_read_from_tap(eee); - } -#endif - } - - // finished processing select data - update_supernode_reg(eee, now); - - numPurged = 0; - // keep, i.e. do not purge, the known peers while no supernode supernode connection - if(!eee->sn_wait) - numPurged = purge_expired_nodes(&eee->known_peers, - eee->sock, NULL, - &last_purge_known, - PURGE_REGISTRATION_FREQUENCY, REGISTRATION_TIMEOUT); - numPurged += purge_expired_nodes(&eee->pending_peers, - eee->sock, NULL, - &last_purge_pending, - PURGE_REGISTRATION_FREQUENCY, REGISTRATION_TIMEOUT); - - if(numPurged > 0) { - traceEvent(TRACE_INFO, "%u peers removed. now: pending=%u, operational=%u", - numPurged, - HASH_COUNT(eee->pending_peers), - HASH_COUNT(eee->known_peers)); - } - - if((eee->conf.tuntap_ip_mode == TUNTAP_IP_MODE_DHCP) && - ((now - lastIfaceCheck) > IFACE_UPDATE_INTERVAL)) { - uint32_t old_ip = eee->device.ip_addr; - - traceEvent(TRACE_NORMAL, "re-checking dynamic IP address"); - tuntap_get_address(&(eee->device)); - lastIfaceCheck = now; - - if((old_ip != eee->device.ip_addr) && eee->cb.ip_address_changed) - eee->cb.ip_address_changed(eee, old_ip, eee->device.ip_addr); - } - - sort_supernodes(eee, now); - - eee->resolution_request = resolve_check(eee->resolve_parameter, eee->resolution_request, now); - - if(eee->cb.main_loop_period) - eee->cb.main_loop_period(eee, now); - - } /* while */ - - send_unregister_super(eee); - -#ifdef WIN32 - WaitForSingleObject(tun_read_thread, INFINITE); -#endif - - closesocket(eee->sock); - - return(0); -} - -/* ************************************** */ - -/** Deinitialise the edge and deallocate any owned memory. */ -void edge_term (n2n_edge_t * eee) { - - resolve_cancel_thread(eee->resolve_parameter); - - if(eee->sock >= 0) - closesocket(eee->sock); - - if(eee->udp_mgmt_sock >= 0) - closesocket(eee->udp_mgmt_sock); - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if(eee->udp_multicast_sock >= 0) - closesocket(eee->udp_multicast_sock); -#endif - - clear_peer_list(&eee->pending_peers); - clear_peer_list(&eee->known_peers); - - eee->transop.deinit(&eee->transop); - - edge_cleanup_routes(eee); - - destroy_network_traffic_filter(eee->network_traffic_filter); - - closeTraceFile(); - - free(eee); -} - -/* ************************************** */ - - -static int edge_init_sockets (n2n_edge_t *eee) { - - if(eee->udp_mgmt_sock >= 0) - closesocket(eee->udp_mgmt_sock); - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - if(eee->udp_multicast_sock >= 0) - closesocket(eee->udp_multicast_sock); -#endif - - eee->udp_mgmt_sock = open_socket(eee->conf.mgmt_port, INADDR_LOOPBACK, 0 /* UDP */); - if(eee->udp_mgmt_sock < 0) { - traceEvent(TRACE_ERROR, "failed to bind management UDP port %u", eee->conf.mgmt_port); - return(-2); - } - -#ifndef SKIP_MULTICAST_PEERS_DISCOVERY - /* Populate the multicast group for local edge */ - eee->multicast_peer.family = AF_INET; - eee->multicast_peer.port = N2N_MULTICAST_PORT; - eee->multicast_peer.addr.v4[0] = 224; /* N2N_MULTICAST_GROUP */ - eee->multicast_peer.addr.v4[1] = 0; - eee->multicast_peer.addr.v4[2] = 0; - eee->multicast_peer.addr.v4[3] = 68; - - eee->udp_multicast_sock = open_socket(N2N_MULTICAST_PORT, INADDR_ANY, 0 /* UDP */); - if(eee->udp_multicast_sock < 0) - return(-3); - else { - u_int enable_reuse = 1; - - /* allow multiple sockets to use the same PORT number */ - setsockopt(eee->udp_multicast_sock, SOL_SOCKET, SO_REUSEADDR, (char *)&enable_reuse, sizeof(enable_reuse)); -#ifdef SO_REUSEPORT /* no SO_REUSEPORT in Windows / old linux versions */ - setsockopt(eee->udp_multicast_sock, SOL_SOCKET, SO_REUSEPORT, &enable_reuse, sizeof(enable_reuse)); -#endif - } -#endif - - return(0); -} - -/* ************************************** */ - -#ifdef __linux__ - -static uint32_t get_gateway_ip () { - - FILE *fd; - char *token = NULL; - char *gateway_ip_str = NULL; - char buf[256]; - uint32_t gateway = 0; - - if(!(fd = fopen("/proc/net/route", "r"))) - return(0); - - while(fgets(buf, sizeof(buf), fd)) { - if(strtok(buf, "\t") && (token = strtok(NULL, "\t")) && (!strcmp(token, "00000000"))) { - token = strtok(NULL, "\t"); - - if(token) { - struct in_addr addr; - - addr.s_addr = strtoul(token, NULL, 16); - gateway_ip_str = inet_ntoa(addr); - - if(gateway_ip_str) { - gateway = addr.s_addr; - break; - } - } - } - } - - fclose(fd); - - return(gateway); -} - -static char* route_cmd_to_str (int cmd, const n2n_route_t *route, char *buf, size_t bufsize) { - - const char *cmd_str; - struct in_addr addr; - char netbuf[64], gwbuf[64]; - - switch(cmd) { - case RTM_NEWROUTE: - cmd_str = "Add"; - break; - - case RTM_DELROUTE: - cmd_str = "Delete"; - break; - - default: - cmd_str = "?"; - } - - addr.s_addr = route->net_addr; - inet_ntop(AF_INET, &addr, netbuf, sizeof(netbuf)); - addr.s_addr = route->gateway; - inet_ntop(AF_INET, &addr, gwbuf, sizeof(gwbuf)); - - snprintf(buf, bufsize, "%s %s/%d via %s", cmd_str, netbuf, route->net_bitlen, gwbuf); - - return(buf); -} - -/* Adapted from https://olegkutkov.me/2019/08/29/modifying-linux-network-routes-using-netlink/ */ -#define NLMSG_TAIL(nmsg) \ - ((struct rtattr *) (((char *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) - -/* Add new data to rtattr */ -static int rtattr_add (struct nlmsghdr *n, int maxlen, int type, const void *data, int alen) { - - int len = RTA_LENGTH(alen); - struct rtattr *rta; - - if(NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len) > maxlen) { - traceEvent(TRACE_ERROR, "rtattr_add error: message exceeded bound of %d\n", maxlen); - return -1; - } - - rta = NLMSG_TAIL(n); - rta->rta_type = type; - rta->rta_len = len; - - if(alen) - memcpy(RTA_DATA(rta), data, alen); - - n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len); - - return 0; -} - -static int routectl (int cmd, int flags, n2n_route_t *route, int if_idx) { - - int rv = -1; - int rv2; - char nl_buf[8192]; /* >= 8192 to avoid truncation, see "man 7 netlink" */ - char route_buf[256]; - struct iovec iov; - struct msghdr msg; - struct sockaddr_nl sa; - uint8_t read_reply = 1; - int nl_sock; - - struct { - struct nlmsghdr n; - struct rtmsg r; - char buf[4096]; - } nl_request; - - if((nl_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) == -1) { - traceEvent(TRACE_ERROR, "netlink socket creation failed [%d]: %s", errno, strerror(errno)); - return(-1); - } - - /* Subscribe to route change events */ - iov.iov_base = nl_buf; - iov.iov_len = sizeof(nl_buf); - - memset(&sa, 0, sizeof(sa)); - sa.nl_family = PF_NETLINK; - sa.nl_groups = RTMGRP_IPV4_ROUTE | RTMGRP_NOTIFY; - sa.nl_pid = getpid(); - - memset(&msg, 0, sizeof(msg)); - msg.msg_name = &sa; - msg.msg_namelen = sizeof(sa); - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - /* Subscribe to route events */ - if(bind(nl_sock, (struct sockaddr*)&sa, sizeof(sa)) == -1) { - traceEvent(TRACE_ERROR, "netlink socket bind failed [%d]: %s", errno, strerror(errno)); - goto out; - } - - /* Initialize request structure */ - memset(&nl_request, 0, sizeof(nl_request)); - nl_request.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); - nl_request.n.nlmsg_flags = NLM_F_REQUEST | flags; - nl_request.n.nlmsg_type = cmd; - nl_request.r.rtm_family = AF_INET; - nl_request.r.rtm_table = RT_TABLE_MAIN; - nl_request.r.rtm_scope = RT_SCOPE_NOWHERE; - - /* Set additional flags if NOT deleting route */ - if(cmd != RTM_DELROUTE) { - nl_request.r.rtm_protocol = RTPROT_BOOT; - nl_request.r.rtm_type = RTN_UNICAST; - } - - nl_request.r.rtm_family = AF_INET; - nl_request.r.rtm_dst_len = route->net_bitlen; - - /* Select scope, for simplicity we supports here only IPv6 and IPv4 */ - if(nl_request.r.rtm_family == AF_INET6) - nl_request.r.rtm_scope = RT_SCOPE_UNIVERSE; - else - nl_request.r.rtm_scope = RT_SCOPE_LINK; - - /* Set gateway */ - if(route->net_bitlen) { - if(rtattr_add(&nl_request.n, sizeof(nl_request), RTA_GATEWAY, &route->gateway, 4) < 0) - goto out; - - nl_request.r.rtm_scope = 0; - nl_request.r.rtm_family = AF_INET; - } - - /* Don't set destination and interface in case of default gateways */ - if(route->net_bitlen) { - /* Set destination network */ - if(rtattr_add(&nl_request.n, sizeof(nl_request), /*RTA_NEWDST*/ RTA_DST, &route->net_addr, 4) < 0) - goto out; - - /* Set interface */ - if(if_idx > 0) { - if(rtattr_add(&nl_request.n, sizeof(nl_request), RTA_OIF, &if_idx, sizeof(int)) < 0) - goto out; - } - } - - /* Send message to the netlink */ - if((rv2 = send(nl_sock, &nl_request, sizeof(nl_request), 0)) != sizeof(nl_request)) { - traceEvent(TRACE_ERROR, "netlink send failed [%d]: %s", errno, strerror(errno)); - goto out; - } - - /* Wait for the route notification. Assume that the first reply we get is the correct one. */ - traceEvent(TRACE_DEBUG, "waiting for netlink response..."); - - while(read_reply) { - ssize_t len = recvmsg(nl_sock, &msg, 0); - struct nlmsghdr *nh; - - for(nh = (struct nlmsghdr *)nl_buf; NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len)) { - /* Stop after the first reply */ - read_reply = 0; - - if(nh->nlmsg_type == NLMSG_ERROR) { - struct nlmsgerr *err = NLMSG_DATA(nh); - int errcode = err->error; - - if(errcode < 0) - errcode = -errcode; - - /* Ignore EEXIST as existing rules are ok */ - if(errcode != EEXIST) { - traceEvent(TRACE_ERROR, "[err=%d] route: %s", errcode, route_cmd_to_str(cmd, route, route_buf, sizeof(route_buf))); - goto out; - } - } - - if(nh->nlmsg_type == NLMSG_DONE) - break; - - if(nh->nlmsg_type == cmd) { - traceEvent(TRACE_DEBUG, "Found netlink reply"); - break; - } - } - } - - traceEvent(TRACE_DEBUG, route_cmd_to_str(cmd, route, route_buf, sizeof(route_buf))); - rv = 0; - -out: - close(nl_sock); - - return(rv); -} -#endif - -/* ************************************** */ - -#ifdef __linux__ - -static int edge_init_routes_linux (n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_routes) { - int i; - for(i = 0; inet_addr == 0) && (route->net_bitlen == 0)) { - /* This is a default gateway rule. We need to: - * - * 1. Add a route to the supernode via the host internet gateway - * 2. Add the new default gateway route - * - * Instead of modifying the system default gateway, we use the trick - * of adding a route to the networks 0.0.0.0/1 and 128.0.0.0/1, thus - * covering the whole IPv4 range. Such routes in linux take precedence - * over the default gateway (0.0.0.0/0) since are more specific. - * This leaves the default gateway unchanged so that after n2n is - * stopped the cleanup is easier. - * See https://github.com/zerotier/ZeroTierOne/issues/178#issuecomment-204599227 - */ - n2n_sock_t sn; - n2n_route_t custom_route; - uint32_t *a; - - if(eee->sn_route_to_clean) { - traceEvent(TRACE_ERROR, "only one default gateway route allowed"); - return(-1); - } - - if(eee->conf.sn_num != 1) { - traceEvent(TRACE_ERROR, "only one supernode supported with routes"); - return(-1); - } - - if(supernode2sock(&sn, eee->conf.supernodes->ip_addr) < 0) - return(-1); - - if(sn.family != AF_INET) { - traceEvent(TRACE_ERROR, "only IPv4 routes supported"); - return(-1); - } - - a = (u_int32_t*)sn.addr.v4; - custom_route.net_addr = *a; - custom_route.net_bitlen = 32; - custom_route.gateway = get_gateway_ip(); - - if(!custom_route.gateway) { - traceEvent(TRACE_ERROR, "could not determine the gateway IP address"); - return(-1); - } - - /* ip route add supernode via internet_gateway */ - if(routectl(RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL, &custom_route, -1) < 0) - return(-1); - - /* Save the route to delete it when n2n is stopped */ - eee->sn_route_to_clean = calloc(1, sizeof(n2n_route_t)); - - /* Store a copy of the rules into the runtime to delete it during shutdown */ - if(eee->sn_route_to_clean) - *eee->sn_route_to_clean = custom_route; - - /* ip route add 0.0.0.0/1 via n2n_gateway */ - custom_route.net_addr = 0; - custom_route.net_bitlen = 1; - custom_route.gateway = route->gateway; - - if(routectl(RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL, &custom_route, eee->device.if_idx) < 0) - return(-1); - - /* ip route add 128.0.0.0/1 via n2n_gateway */ - custom_route.net_addr = 128; - custom_route.net_bitlen = 1; - custom_route.gateway = route->gateway; - - if(routectl(RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL, &custom_route, eee->device.if_idx) < 0) - return(-1); - } else { - /* ip route add net via n2n_gateway */ - if(routectl(RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL, route, eee->device.if_idx) < 0) - return(-1); - } - } - - return(0); -} -#endif - -/* ************************************** */ - -#ifdef WIN32 -static int edge_init_routes_win (n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_routes, uint8_t verb /* 0 = add, 1 = delete */) { - int i; - struct in_addr net_addr, gateway; - char c_net_addr[32]; - char c_gateway[32]; - char c_interface[32]; - char c_verb[32]; - char cmd[256]; - - for(i = 0; i < num_routes; i++) { - n2n_route_t *route = &routes[i]; - if((route->net_addr == 0) && (route->net_bitlen == 0)) { - // REVISIT: there might be a chance to get it working on Windows following the hints at - // https://docs.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipinterface_row - // - // " The DisableDefaultRoutes member of the MIB_IPINTERFACE_ROW structure can be used to disable - // using the default route on an interface. This member can be used as a security measure by - // VPN clients to restrict split tunneling when split tunneling is not required by the VPN client. - // A VPN client can call the SetIpInterfaceEntry function to set the DisableDefaultRoutes member - // to TRUE when required. A VPN client can query the current state of the DisableDefaultRoutes - // member by calling the GetIpInterfaceEntry function. " - traceEvent(TRACE_WARNING, "the 0.0.0.0/0 route settings are not supported on Windows"); - return(-1); - } else { - /* ip route add net via n2n_gateway */ - memcpy(&net_addr, &(route->net_addr), sizeof(net_addr)); - memcpy(&gateway, &(route->gateway), sizeof(gateway)); - _snprintf(c_net_addr, sizeof(c_net_addr), inet_ntoa(net_addr)); - _snprintf(c_gateway, sizeof(c_gateway), inet_ntoa(gateway)); - _snprintf(c_interface, sizeof(c_interface), "if %u", eee->device.if_idx); - _snprintf(c_verb, sizeof(c_verb), verb ? "delete" : "add"); - _snprintf(cmd, sizeof(cmd), "route %s %s/%d %s %s > nul", c_verb, c_net_addr, route->net_bitlen, c_gateway, c_interface); - traceEvent(TRACE_NORMAL, "ROUTE CMD = '%s'\n", cmd); - system(cmd); - } - } - - return (0); -} -#endif // WIN32 - -/* ************************************** */ - -/* Add the user-provided routes to the linux routing table. Network routes - * are bound to the n2n TAP device, so they are automatically removed when - * the TAP device is destroyed. */ -int edge_init_routes (n2n_edge_t *eee, n2n_route_t *routes, uint16_t num_routes) { -#ifdef __linux__ - return edge_init_routes_linux(eee, routes, num_routes); -#endif - -#ifdef WIN32 - return edge_init_routes_win(eee, routes, num_routes, 0 /* add */); -#endif - return 0; -} - -/* ************************************** */ - -static void edge_cleanup_routes (n2n_edge_t *eee) { -#ifdef __linux__ - if(eee->sn_route_to_clean) { - /* ip route del supernode via internet_gateway */ - routectl(RTM_DELROUTE, 0, eee->sn_route_to_clean, -1); - free(eee->sn_route_to_clean); - } -#endif - -#ifdef WIN32 - edge_init_routes_win(eee, eee->conf.routes, eee->conf.num_routes, 1 /* del */); -#endif - -} - -/* ************************************** */ - -void edge_init_conf_defaults (n2n_edge_conf_t *conf) { - - char *tmp_string; - - memset(conf, 0, sizeof(*conf)); - - conf->bind_address = INADDR_ANY; /* any address */ - conf->local_port = 0 /* any port */; - conf->preferred_sock.family = AF_INVALID; - conf->mgmt_port = N2N_EDGE_MGMT_PORT; /* 5644 by default */ - conf->transop_id = N2N_TRANSFORM_ID_NULL; - conf->header_encryption = HEADER_ENCRYPTION_NONE; - conf->compression = N2N_COMPRESSION_ID_NONE; - conf->drop_multicast = 1; - conf->allow_p2p = 1; - conf->disable_pmtu_discovery = 1; - conf->register_interval = REGISTER_SUPER_INTERVAL_DFL; - conf->tuntap_ip_mode = TUNTAP_IP_MODE_SN_ASSIGN; - /* reserve possible last char as null terminator. */ - gethostname((char*)conf->dev_desc, N2N_DESC_SIZE-1); - - if(getenv("N2N_KEY")) { - conf->encrypt_key = strdup(getenv("N2N_KEY")); - conf->transop_id = N2N_TRANSFORM_ID_AES; - } - if(getenv("N2N_COMMUNITY")) { - strncpy((char*)conf->community_name, getenv("N2N_COMMUNITY"), N2N_COMMUNITY_SIZE); - conf->community_name[N2N_COMMUNITY_SIZE - 1] = '\0'; - } - if(getenv("N2N_PASSWORD")) { - conf->shared_secret = calloc(1, sizeof(n2n_private_public_key_t)); - if(conf->shared_secret) - generate_private_key(*(conf->shared_secret), getenv("N2N_PASSWORD")); - } - - tmp_string = calloc(1, strlen(N2N_MGMT_PASSWORD) + 1); - if(tmp_string) { - strncpy((char*)tmp_string, N2N_MGMT_PASSWORD, strlen(N2N_MGMT_PASSWORD) + 1); - conf->mgmt_password_hash = pearson_hash_64((uint8_t*)tmp_string, strlen(N2N_MGMT_PASSWORD)); - free(tmp_string); - } - - conf->sn_selection_strategy = SN_SELECTION_STRATEGY_LOAD; - conf->metric = 0; -} - -/* ************************************** */ - -void edge_term_conf (n2n_edge_conf_t *conf) { - - if(conf->routes) free(conf->routes); - if(conf->encrypt_key) free(conf->encrypt_key); - - if(conf->network_traffic_filter_rules) { - filter_rule_t *el = 0, *tmp = 0; - HASH_ITER(hh, conf->network_traffic_filter_rules, el, tmp) { - HASH_DEL(conf->network_traffic_filter_rules, el); - free(el); - } - } -} - -/* ************************************** */ - -const n2n_edge_conf_t* edge_get_conf (const n2n_edge_t *eee) { - - return(&eee->conf); -} - -/* ************************************** */ - -int edge_conf_add_supernode (n2n_edge_conf_t *conf, const char *ip_and_port) { - - struct peer_info *sn; - n2n_sock_t *sock; - int skip_add; - int rv = -1; - - sock = (n2n_sock_t*)calloc(1,sizeof(n2n_sock_t)); - rv = supernode2sock(sock, ip_and_port); - - if(rv < -2) { /* we accept resolver failure as it might resolve later */ - traceEvent(TRACE_WARNING, "invalid supernode parameter."); - free(sock); - return 1; - } - - skip_add = SN_ADD; - sn = add_sn_to_list_by_mac_or_sock(&(conf->supernodes), sock, null_mac, &skip_add); - - if(sn != NULL) { - sn->ip_addr = calloc(1, N2N_EDGE_SN_HOST_SIZE); - - if(sn->ip_addr != NULL) { - strncpy(sn->ip_addr, ip_and_port, N2N_EDGE_SN_HOST_SIZE - 1); - memcpy(&(sn->sock), sock, sizeof(n2n_sock_t)); - memcpy(sn->mac_addr, null_mac, sizeof(n2n_mac_t)); - sn->purgeable = SN_UNPURGEABLE; - } - } - - free(sock); - - traceEvent(TRACE_NORMAL, "adding supernode = %s", sn->ip_addr); - conf->sn_num++; - - return 0; -} - -/* ************************************** */ - -int quick_edge_init (char *device_name, char *community_name, - char *encrypt_key, char *device_mac, - char *local_ip_address, - char *supernode_ip_address_port, - int *keep_on_running) { - - tuntap_dev tuntap; - n2n_edge_t *eee; - n2n_edge_conf_t conf; - int rv; - - /* Setup the configuration */ - edge_init_conf_defaults(&conf); - conf.encrypt_key = encrypt_key; - conf.transop_id = N2N_TRANSFORM_ID_AES; - conf.compression = N2N_COMPRESSION_ID_NONE; - snprintf((char*)conf.community_name, sizeof(conf.community_name), "%s", community_name); - edge_conf_add_supernode(&conf, supernode_ip_address_port); - - /* Validate configuration */ - if(edge_verify_conf(&conf) != 0) - return(-1); - - /* Open the tuntap device */ - if(tuntap_open(&tuntap, device_name, "static", - local_ip_address, "255.255.255.0", - device_mac, DEFAULT_MTU -#ifdef WIN32 - , 0 -#endif - ) < 0) - return(-2); - - /* Init edge */ - if((eee = edge_init(&conf, &rv)) == NULL) - goto quick_edge_init_end; - - eee->keep_running = keep_on_running; - rv = run_edge_loop(eee); - edge_term(eee); - edge_term_conf(&conf); - -quick_edge_init_end: - tuntap_close(&tuntap); - return(rv); -} - -/* ************************************** */ diff --git a/bundles/n2n_ntop_v3/src/edge_utils_win32.c b/bundles/n2n_ntop_v3/src/edge_utils_win32.c deleted file mode 100644 index 73ccb0b0..00000000 --- a/bundles/n2n_ntop_v3/src/edge_utils_win32.c +++ /dev/null @@ -1,111 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#ifdef WIN32 - -#include "edge_utils_win32.h" - -/* ************************************** */ - -static DWORD* tunReadThread (LPVOID lpArg) { - - struct tunread_arg *arg = (struct tunread_arg*)lpArg; - - while(*arg->eee->keep_running) { - edge_read_from_tap(arg->eee); - } - - return((DWORD*)NULL); -} - -/* ************************************** */ - -/** Start a second thread in Windows because TUNTAP interfaces do not expose - * file descriptors. */ -HANDLE startTunReadThread (struct tunread_arg *arg) { - - DWORD dwThreadId; - - return(CreateThread(NULL, /* security attributes */ - 0, /* use default stack size */ - (LPTHREAD_START_ROUTINE)tunReadThread, /* thread function */ - (void*)arg, /* argument to thread function */ - 0, /* thread creation flags */ - &dwThreadId)); /* thread id out */ -} - - - -int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t ip_addr){ - DWORD interface_index = -1; - DWORD dwRetVal = 0; - PIP_ADAPTER_INFO pAdapterInfo = NULL, pAdapter = NULL; - macstr_t mac_buf; - ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO); - - dwRetVal = GetBestInterface(*(IPAddr*)(&eee->curr_sn->sock.addr.v4), &interface_index); - if(dwRetVal != NO_ERROR) return -1; - - pAdapterInfo = (PIP_ADAPTER_INFO)malloc(ulOutBufLen); - if(pAdapterInfo == NULL) { - traceEvent(TRACE_INFO, "Error allocating memory needed to call GetAdaptersInfo\n"); - return -1; - } - - dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen); - if(dwRetVal == ERROR_BUFFER_OVERFLOW) { - pAdapterInfo = (PIP_ADAPTER_INFO)realloc(pAdapterInfo, ulOutBufLen); - if(pAdapterInfo == NULL) { - traceEvent(TRACE_INFO, "Error allocating memory needed to call GetAdaptersInfo\n"); - return -1; - } - } - - dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen); -// hexdump((uint8_t*)pAdapterInfo, ulOutBufLen); - if(dwRetVal == NO_ERROR) { - for(pAdapter = pAdapterInfo; pAdapter != NULL; pAdapter = pAdapter->Next) { - if(pAdapter->Index != interface_index) continue; - - traceEvent(TRACE_DEBUG, "Adapter Index: %ld\n", pAdapter->Index); - traceEvent(TRACE_DEBUG, "Combo Index: %ld\n", pAdapter->ComboIndex); - traceEvent(TRACE_DEBUG, "Adapter Name: %s\n", pAdapter->AdapterName); - traceEvent(TRACE_DEBUG, "Adapter Desc: %s\n", pAdapter->Description); - traceEvent(TRACE_DEBUG, "Adapter Type: %u\n", pAdapter->Type); - macaddr_str(mac_buf, pAdapter->Address); - traceEvent(TRACE_DEBUG, "Adapter Addr: %s\n", mac_buf); - traceEvent(TRACE_DEBUG, "DHCP Enabled: %u\n", pAdapter->DhcpEnabled); - traceEvent(TRACE_DEBUG, "DHCP Server: %s\n", pAdapter->DhcpServer.IpAddress.String); - traceEvent(TRACE_DEBUG, "IP Address: %s\n", pAdapter->IpAddressList.IpAddress.String); - traceEvent(TRACE_DEBUG, "IP Mask: %s\n", pAdapter->IpAddressList.IpMask.String); - traceEvent(TRACE_DEBUG, "Gateway: %s\n", pAdapter->GatewayList.IpAddress.String); - strncpy(ip_addr, pAdapter->IpAddressList.IpAddress.String, sizeof(dec_ip_str_t)-1); - } - } else { - traceEvent(TRACE_WARNING, "GetAdaptersInfo failed with error: %d\n", dwRetVal); - } - if(pAdapterInfo != NULL) { - free(pAdapterInfo); - pAdapterInfo = NULL; - } - return 0; -} - - -#endif - diff --git a/bundles/n2n_ntop_v3/src/example_edge_embed.c b/bundles/n2n_ntop_v3/src/example_edge_embed.c deleted file mode 100644 index 3c926ce9..00000000 --- a/bundles/n2n_ntop_v3/src/example_edge_embed.c +++ /dev/null @@ -1,78 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -static int keep_running; - -int main() { - - n2n_edge_conf_t conf; - tuntap_dev tuntap; - n2n_edge_t *eee; - int rc; - - edge_init_conf_defaults(&conf); - conf.allow_p2p = 1; // Whether to allow peer-to-peer communication - conf.allow_routing = 1; // Whether to allow the edge to route packets to other edges - snprintf((char *)conf.community_name, sizeof(conf.community_name), "%s", "mycommunity"); // Community to connect to - conf.disable_pmtu_discovery = 1; // Whether to disable the path MTU discovery - conf.drop_multicast = 0; // Whether to disable multicast - conf.tuntap_ip_mode = TUNTAP_IP_MODE_SN_ASSIGN; // How to set the IP address - conf.encrypt_key = "mysecret"; // Secret to decrypt & encrypt with - conf.local_port = 0; // What port to use (0 = any port) - conf.mgmt_port = N2N_EDGE_MGMT_PORT; // Edge management port (5644 by default) - conf.register_interval = 1; // Interval for both UDP NAT hole punching and supernode registration - conf.register_ttl = 1; // Interval for UDP NAT hole punching through supernode - edge_conf_add_supernode(&conf, "localhost:1234"); // Supernode to connect to - conf.tos = 16; // Type of service for sent packets - conf.transop_id = N2N_TRANSFORM_ID_TWOFISH; // Use the twofish encryption - - if(edge_verify_conf(&conf) != 0) { - return -1; - } - - if(tuntap_open(&tuntap, - "edge0", // Name of the device to create - "static", // IP mode; static|dhcp - "10.0.0.1", // Set ip address - "255.255.255.0", // Netmask to use - "DE:AD:BE:EF:01:10", // Set mac address - DEFAULT_MTU // MTU to use -#ifdef WIN32 - , 0 -#endif - ) < 0) - { - return -1; - } - - eee = edge_init(&conf, &rc); - if(eee == NULL) { - exit(1); - } - - keep_running = 1; - eee->keep_running = &keep_running; - rc = run_edge_loop(eee); - - edge_term(eee); - tuntap_close(&tuntap); - - return rc; -} diff --git a/bundles/n2n_ntop_v3/src/example_edge_embed_quick_edge_init.c b/bundles/n2n_ntop_v3/src/example_edge_embed_quick_edge_init.c deleted file mode 100644 index 148655a5..00000000 --- a/bundles/n2n_ntop_v3/src/example_edge_embed_quick_edge_init.c +++ /dev/null @@ -1,55 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -/* - This tool demonstrates how to easily embed - n2n on an existing application - */ - -int main (int argc, char* argv[]) { - - char *device_name = (char*)"n2n0"; - char *network_name = (char*)"mynetwork"; - char *secret_key = (char*)"mysecret"; - char *my_mac_address = (char*)"DE:AD:BE:EF:01:10"; - char *my_ipv4_addr = (char*)"1.2.3.4"; - char *supernode = (char*)"7.8.9.10:1234"; - int keep_on_running = 1; - - /* Increase tracelevel to see what's happening */ - setTraceLevel(10); - - /* Random seed */ - n2n_srand(n2n_seed()); - - /* - NOTE - - As the function below won't end, you should - call it inside a separate thread - */ - return(quick_edge_init(device_name, - network_name, - secret_key, - my_mac_address, - my_ipv4_addr, - supernode, - &keep_on_running)); -} diff --git a/bundles/n2n_ntop_v3/src/example_sn_embed.c b/bundles/n2n_ntop_v3/src/example_sn_embed.c deleted file mode 100644 index 0f5b679a..00000000 --- a/bundles/n2n_ntop_v3/src/example_sn_embed.c +++ /dev/null @@ -1,51 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -static int keep_running; - -int main () { - - n2n_sn_t sss_node; - int rc; - - sn_init_defaults(&sss_node); - sss_node.daemon = 0; // Whether to daemonize - sss_node.lport = 1234; // Main UDP listen port - - sss_node.sock = open_socket(sss_node.lport, INADDR_ANY, 0 /* UDP */); - if(-1 == sss_node.sock) { - exit(-2); - } - - sss_node.mgmt_sock = open_socket(5645, INADDR_LOOPBACK, 0 /* UDP */); // Main UDP management port - if(-1 == sss_node.mgmt_sock) { - exit(-2); - } - - sn_init(&sss_node); - - keep_running = 1; - sss_node.keep_running = &keep_running; - rc = run_sn_loop(&sss_node); - - sn_term(&sss_node); - - return rc; -} diff --git a/bundles/n2n_ntop_v3/src/header_encryption.c b/bundles/n2n_ntop_v3/src/header_encryption.c deleted file mode 100644 index 462982af..00000000 --- a/bundles/n2n_ntop_v3/src/header_encryption.c +++ /dev/null @@ -1,170 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -#define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out) - - -int packet_header_decrypt (uint8_t packet[], uint16_t packet_len, - char *community_name, - he_context_t *ctx, he_context_t *ctx_iv, - uint64_t *stamp) { - - // try community name as possible key and check for magic bytes "n2__" - uint32_t magic = 0x6E320000; - uint32_t test_magic; - uint32_t checksum_high = 0; - - // check for magic - // so, as a first step, decrypt last 4 bytes from where originally the community name would be - speck_ctr((uint8_t*)&test_magic, &packet[16], 4, packet, (speck_context_t*)ctx); - test_magic = be32toh(test_magic); - - //extract header length (lower 2 bytes) - uint32_t header_len = test_magic - magic; - - if(header_len <= packet_len) { - // decrypt the complete header - speck_ctr(&packet[16], &packet[16], header_len - 16, packet, (speck_context_t*)ctx); - - // extract time stamp and un-xor actual checksum (calculated here) from it - // if payload was altered (different checksum than original), time stamp verification will fail - // use speck block cipher step (1 block == 128 bit == 16 bytes) - speck_128_decrypt(packet, (speck_context_t*)ctx_iv); - - // extract the required data - *stamp = be64toh(*(uint64_t*)&packet[4]); - checksum_high = be32toh(*(uint32_t*)packet); - - // restore original packet order before calculating checksum - memcpy(&packet[0], &packet[20], 4); - memcpy(&packet[4], community_name, N2N_COMMUNITY_SIZE); - uint64_t checksum = pearson_hash_64(packet, packet_len); - - if((checksum >> 32) != checksum_high) { - traceEvent(TRACE_DEBUG, "packet_header_decrypt dropped a packet with invalid checksum."); - - // unsuccessful - return 0; - } - - *stamp = *stamp ^ (checksum << 32); - - // successful - return 1; - } else { - - // unsuccessful - return 0; - } -} - - -int packet_header_encrypt (uint8_t packet[], uint16_t header_len, uint16_t packet_len, - he_context_t *ctx, he_context_t *ctx_iv, - uint64_t stamp) { - - uint32_t *p32 = (uint32_t*)packet; - uint64_t *p64 = (uint64_t*)packet; - uint64_t checksum = 0; - uint32_t magic = 0x6E320000; /* == ASCII "n2__" */ - magic += header_len; - - if(packet_len < 24) { - traceEvent(TRACE_DEBUG, "packet_header_encrypt dropped a packet too short to be valid."); - return -1; - } - // we trust in the caller assuring header_len <= packet_len - - checksum = pearson_hash_64(packet, packet_len); - - // re-order packet - p32[5] = p32[0]; - - // add time stamp, checksum, and random to form the pre-IV - p64[0] = htobe64(checksum); - - p32[1] = p32[1] ^ htobe32((uint32_t)(stamp >> 32)); - p32[2] = htobe32((uint32_t)stamp); - - p32[3] = n2n_rand(); - - // encrypt this pre-IV to IV - speck_128_encrypt(packet, (speck_context_t*)ctx_iv); - - // place IV plus magic in packet - p32[4] = htobe32(magic); - - // encrypt, starting from magic - speck_ctr(&packet[16], &packet[16], header_len - 16, packet, (speck_context_t*)ctx); - - return 0; -} - - -void packet_header_setup_key (const char *community_name, - he_context_t **ctx_static, he_context_t **ctx_dynamic, - he_context_t **ctx_iv_static, he_context_t **ctx_iv_dynamic) { - - uint8_t key[16]; - - // for REGISTER_SUPER, REGISTER_SUPER_ACK, REGISTER_SUPER_NAK only; - // for all other packets, same as static by default (changed by user/pw auth scheme - // calling packet_header_change_dynamic_key later) - - pearson_hash_128(key, (uint8_t*)community_name, N2N_COMMUNITY_SIZE); - - if(!*ctx_static) - *ctx_static = (he_context_t*)calloc(1, sizeof(speck_context_t)); - speck_init((speck_context_t**)ctx_static, key, 128); - - if(!*ctx_dynamic) - *ctx_dynamic = (he_context_t*)calloc(1, sizeof(speck_context_t)); - speck_init((speck_context_t**)ctx_dynamic, key, 128); - - // hash again and use as key for IV encryption - pearson_hash_128(key, key, sizeof(key)); - - if(!*ctx_iv_static) - *ctx_iv_static = (he_context_t*)calloc(1, sizeof(speck_context_t)); - speck_init((speck_context_t**)ctx_iv_static, key, 128); - - if(!*ctx_iv_dynamic) - *ctx_iv_dynamic = (he_context_t*)calloc(1, sizeof(speck_context_t)); - speck_init((speck_context_t**)ctx_iv_dynamic, key, 128); -} - - -void packet_header_change_dynamic_key (uint8_t *key_dynamic, - he_context_t **ctx_dynamic, he_context_t **ctx_iv_dynamic) { - - uint8_t key[16]; - pearson_hash_128(key, key_dynamic, N2N_AUTH_CHALLENGE_SIZE); - - // for REGISTER_SUPER, REGISTER_SUPER_ACK, REGISTER_SUPER_NAK only - // for all other packets, same as static by default (changed by user/pw auth scheme) - speck_init((speck_context_t**)ctx_dynamic, key, 128); - - // hash again and use as key for IV encryption - // REMOVE as soon as checksum and replay protection get their own fields - pearson_hash_128(key, key, sizeof(key)); - speck_init((speck_context_t**)ctx_iv_dynamic, key, 128); -} diff --git a/bundles/n2n_ntop_v3/src/hexdump.c b/bundles/n2n_ntop_v3/src/hexdump.c deleted file mode 100644 index 75093b75..00000000 --- a/bundles/n2n_ntop_v3/src/hexdump.c +++ /dev/null @@ -1,45 +0,0 @@ - -#include - -#include "n2n.h" -#include "hexdump.h" - -void fhexdump(unsigned int display_addr, void *in, int size, FILE *stream) { - uint8_t *p = in; - - while(size>0) { - int i; - - fprintf(stream, "%03x: ", display_addr); - - for (i = 0; i < 16; i++) { - if (i < size) { - fprintf(stream, "%02x", p[i]); - } else { - fprintf(stream, " "); - } - if (i==7) { - fprintf(stream, " "); - } else { - fprintf(stream, " "); - } - } - fprintf(stream, " |"); - - for (i = 0; i < 16; i++) { - if (i < size) { - char ch = p[i]; - if (ch>=0x20 && ch<=0x7e) { - fprintf(stream, "%c", ch); - } else { - fprintf(stream, " "); - } - } - } - fprintf(stream, "|\n"); - - size -= 16; - display_addr += 16; - p += 16; - } -} diff --git a/bundles/n2n_ntop_v3/src/minilzo.c b/bundles/n2n_ntop_v3/src/minilzo.c deleted file mode 100644 index 8fd86645..00000000 --- a/bundles/n2n_ntop_v3/src/minilzo.c +++ /dev/null @@ -1,6365 +0,0 @@ -/* minilzo.c -- mini subset of the LZO real-time data compression library - - This file is part of the LZO real-time data compression library. - - Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer - All Rights Reserved. - - The LZO library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - The LZO library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with the LZO library; see the file COPYING. - If not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Markus F.X.J. Oberhumer - - http://www.oberhumer.com/opensource/lzo/ - */ - -/* - * NOTE: - * the full LZO package can be found at - * http://www.oberhumer.com/opensource/lzo/ - */ - -#define __LZO_IN_MINILZO 1 - -#if defined(LZO_CFG_FREESTANDING) -# undef MINILZO_HAVE_CONFIG_H -# define LZO_LIBC_FREESTANDING 1 -# define LZO_OS_FREESTANDING 1 -#endif - -#ifdef MINILZO_HAVE_CONFIG_H -# include -#endif -#include -#include -#if defined(MINILZO_CFG_USE_INTERNAL_LZODEFS) - -#ifndef __LZODEFS_H_INCLUDED -#define __LZODEFS_H_INCLUDED 1 - -#if defined(__CYGWIN32__) && !defined(__CYGWIN__) -# define __CYGWIN__ __CYGWIN32__ -#endif -#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) -# define _ALL_SOURCE 1 -#endif -#if defined(__mips__) && defined(__R5900__) -# if !defined(__LONG_MAX__) -# define __LONG_MAX__ 9223372036854775807L -# endif -#endif -#if 0 -#elif !defined(__LZO_LANG_OVERRIDE) -#if (defined(__clang__) || defined(__GNUC__)) && defined(__ASSEMBLER__) -# if (__ASSEMBLER__+0) <= 0 -# error "__ASSEMBLER__" -# else -# define LZO_LANG_ASSEMBLER 1 -# endif -#elif defined(__cplusplus) -# if (__cplusplus+0) <= 0 -# error "__cplusplus" -# elif (__cplusplus < 199711L) -# define LZO_LANG_CXX 1 -# elif defined(_MSC_VER) && defined(_MSVC_LANG) && (_MSVC_LANG+0 >= 201402L) && 1 -# define LZO_LANG_CXX _MSVC_LANG -# else -# define LZO_LANG_CXX __cplusplus -# endif -# define LZO_LANG_CPLUSPLUS LZO_LANG_CXX -#else -# if defined(__STDC_VERSION__) && (__STDC_VERSION__+0 >= 199409L) -# define LZO_LANG_C __STDC_VERSION__ -# else -# define LZO_LANG_C 1 -# endif -#endif -#endif -#if !defined(LZO_CFG_NO_DISABLE_WUNDEF) -#if defined(__ARMCC_VERSION) -# pragma diag_suppress 193 -#elif defined(__clang__) && defined(__clang_minor__) -# pragma clang diagnostic ignored "-Wundef" -#elif defined(__INTEL_COMPILER) -# pragma warning(disable: 193) -#elif defined(__KEIL__) && defined(__C166__) -# pragma warning disable = 322 -#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__PATHSCALE__) -# if ((__GNUC__-0) >= 5 || ((__GNUC__-0) == 4 && (__GNUC_MINOR__-0) >= 2)) -# pragma GCC diagnostic ignored "-Wundef" -# endif -#elif defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) -# if ((_MSC_VER-0) >= 1300) -# pragma warning(disable: 4668) -# endif -#endif -#endif -#if 0 && defined(__POCC__) && defined(_WIN32) -# if (__POCC__ >= 400) -# pragma warn(disable: 2216) -# endif -#endif -#if 0 && defined(__WATCOMC__) -# if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) -# pragma warning 203 9 -# endif -#endif -#if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) -# pragma option -h -#endif -#if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC) -#ifndef _CRT_NONSTDC_NO_DEPRECATE -#define _CRT_NONSTDC_NO_DEPRECATE 1 -#endif -#ifndef _CRT_NONSTDC_NO_WARNINGS -#define _CRT_NONSTDC_NO_WARNINGS 1 -#endif -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE 1 -#endif -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS 1 -#endif -#endif -#if 0 -#define LZO_0xffffUL 0xfffful -#define LZO_0xffffffffUL 0xfffffffful -#else -#define LZO_0xffffUL 65535ul -#define LZO_0xffffffffUL 4294967295ul -#endif -#define LZO_0xffffL LZO_0xffffUL -#define LZO_0xffffffffL LZO_0xffffffffUL -#if (LZO_0xffffL == LZO_0xffffffffL) -# error "your preprocessor is broken 1" -#endif -#if (16ul * 16384ul != 262144ul) -# error "your preprocessor is broken 2" -#endif -#if 0 -#if (32767 >= 4294967295ul) -# error "your preprocessor is broken 3" -#endif -#if (65535u >= 4294967295ul) -# error "your preprocessor is broken 4" -#endif -#endif -#if defined(__COUNTER__) -# ifndef LZO_CFG_USE_COUNTER -# define LZO_CFG_USE_COUNTER 1 -# endif -#else -# undef LZO_CFG_USE_COUNTER -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) -# if !defined(MSDOS) -# define MSDOS 1 -# endif -# if !defined(_MSDOS) -# define _MSDOS 1 -# endif -#elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) -# if (__VERSION == 520) && (MB_LEN_MAX == 1) -# if !defined(__AZTEC_C__) -# define __AZTEC_C__ __VERSION -# endif -# if !defined(__DOS__) -# define __DOS__ 1 -# endif -# endif -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(_MSC_VER) && defined(M_I86HM) -# define ptrdiff_t long -# define _PTRDIFF_T_DEFINED 1 -#endif -#endif -#if (UINT_MAX == LZO_0xffffL) -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -# if defined(__AZTEC_C__) && defined(__DOS__) -# define __LZO_RENAME_A 1 -# elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define __LZO_RENAME_A 1 -# elif (_MSC_VER < 700) -# define __LZO_RENAME_B 1 -# endif -# elif defined(__TSC__) && defined(__OS2__) -# define __LZO_RENAME_A 1 -# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) -# define __LZO_RENAME_A 1 -# elif defined(__PACIFIC__) && defined(DOS) -# if !defined(__far) -# define __far far -# endif -# if !defined(__near) -# define __near near -# endif -# endif -# if defined(__LZO_RENAME_A) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif -# if !defined(__huge) -# define __huge huge -# endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# if !defined(__huge) -# define __huge huge -# endif -# elif defined(__LZO_RENAME_B) -# if !defined(__cdecl) -# define __cdecl _cdecl -# endif -# if !defined(__far) -# define __far _far -# endif -# if !defined(__huge) -# define __huge _huge -# endif -# if !defined(__near) -# define __near _near -# endif -# if !defined(__pascal) -# define __pascal _pascal -# endif -# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# endif -# undef __LZO_RENAME_A -# undef __LZO_RENAME_B -#endif -#if (UINT_MAX == LZO_0xffffL) -#if defined(__AZTEC_C__) && defined(__DOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -#elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# endif -# if (_MSC_VER < 700) -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# define LZO_BROKEN_SIZEOF 1 -# endif -#elif defined(__PACIFIC__) && defined(DOS) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#elif defined(__TURBOC__) && defined(__MSDOS__) -# if (__TURBOC__ < 0x0150) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -# define LZO_BROKEN_INTEGRAL_PROMOTION 1 -# endif -# if (__TURBOC__ < 0x0200) -# define LZO_BROKEN_SIZEOF 1 -# endif -# if (__TURBOC__ < 0x0400) && defined(__cplusplus) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# endif -#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) -# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 -# define LZO_BROKEN_SIZEOF 1 -#endif -#endif -#if defined(__WATCOMC__) && (__WATCOMC__ < 900) -# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 -#endif -#if defined(_CRAY) && defined(_CRAY1) -# define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 -#endif -#define LZO_PP_STRINGIZE(x) #x -#define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) -#define LZO_PP_CONCAT0() /*empty*/ -#define LZO_PP_CONCAT1(a) a -#define LZO_PP_CONCAT2(a,b) a ## b -#define LZO_PP_CONCAT3(a,b,c) a ## b ## c -#define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_PP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f -#define LZO_PP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g -#define LZO_PP_ECONCAT0() LZO_PP_CONCAT0() -#define LZO_PP_ECONCAT1(a) LZO_PP_CONCAT1(a) -#define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) -#define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) -#define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) -#define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) -#define LZO_PP_ECONCAT6(a,b,c,d,e,f) LZO_PP_CONCAT6(a,b,c,d,e,f) -#define LZO_PP_ECONCAT7(a,b,c,d,e,f,g) LZO_PP_CONCAT7(a,b,c,d,e,f,g) -#define LZO_PP_EMPTY /*empty*/ -#define LZO_PP_EMPTY0() /*empty*/ -#define LZO_PP_EMPTY1(a) /*empty*/ -#define LZO_PP_EMPTY2(a,b) /*empty*/ -#define LZO_PP_EMPTY3(a,b,c) /*empty*/ -#define LZO_PP_EMPTY4(a,b,c,d) /*empty*/ -#define LZO_PP_EMPTY5(a,b,c,d,e) /*empty*/ -#define LZO_PP_EMPTY6(a,b,c,d,e,f) /*empty*/ -#define LZO_PP_EMPTY7(a,b,c,d,e,f,g) /*empty*/ -#if 1 -#define LZO_CPP_STRINGIZE(x) #x -#define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) -#define LZO_CPP_CONCAT2(a,b) a ## b -#define LZO_CPP_CONCAT3(a,b,c) a ## b ## c -#define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d -#define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e -#define LZO_CPP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f -#define LZO_CPP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g -#define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) -#define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) -#define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) -#define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) -#define LZO_CPP_ECONCAT6(a,b,c,d,e,f) LZO_CPP_CONCAT6(a,b,c,d,e,f) -#define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g) -#endif -#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-((b)!=0))) - (o)) << 1) + (o)*((b)!=0)) -#if 1 && defined(__cplusplus) -# if !defined(__STDC_CONSTANT_MACROS) -# define __STDC_CONSTANT_MACROS 1 -# endif -# if !defined(__STDC_LIMIT_MACROS) -# define __STDC_LIMIT_MACROS 1 -# endif -#endif -#if defined(__cplusplus) -# define LZO_EXTERN_C extern "C" -# define LZO_EXTERN_C_BEGIN extern "C" { -# define LZO_EXTERN_C_END } -#else -# define LZO_EXTERN_C extern -# define LZO_EXTERN_C_BEGIN /*empty*/ -# define LZO_EXTERN_C_END /*empty*/ -#endif -#if !defined(__LZO_OS_OVERRIDE) -#if (LZO_OS_FREESTANDING) -# define LZO_INFO_OS "freestanding" -#elif (LZO_OS_EMBEDDED) -# define LZO_INFO_OS "embedded" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_OS_EMBEDDED 1 -# define LZO_INFO_OS "embedded" -#elif defined(__CYGWIN__) && defined(__GNUC__) -# define LZO_OS_CYGWIN 1 -# define LZO_INFO_OS "cygwin" -#elif defined(__EMX__) && defined(__GNUC__) -# define LZO_OS_EMX 1 -# define LZO_INFO_OS "emx" -#elif defined(__BEOS__) -# define LZO_OS_BEOS 1 -# define LZO_INFO_OS "beos" -#elif defined(__Lynx__) -# define LZO_OS_LYNXOS 1 -# define LZO_INFO_OS "lynxos" -#elif defined(__OS400__) -# define LZO_OS_OS400 1 -# define LZO_INFO_OS "os400" -#elif defined(__QNX__) -# define LZO_OS_QNX 1 -# define LZO_INFO_OS "qnx" -#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__BORLANDC__) && defined(__DPMI16__) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -#elif defined(__ZTC__) && defined(DOS386) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -#elif defined(__OS2__) || defined(__OS2V2__) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_OS216 1 -# define LZO_INFO_OS "os216" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_OS2 1 -# define LZO_INFO_OS "os2" -# else -# error "check your limits.h header" -# endif -#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) -# define LZO_OS_WIN64 1 -# define LZO_INFO_OS "win64" -#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__MWERKS__) && defined(__INTEL__) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_WIN16 1 -# define LZO_INFO_OS "win16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# else -# error "check your limits.h header" -# endif -#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) -# if (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_OS_DOS32 1 -# define LZO_INFO_OS "dos32" -# else -# error "check your limits.h header" -# endif -#elif defined(__WATCOMC__) -# if defined(__NT__) && (UINT_MAX == LZO_0xffffL) -# define LZO_OS_DOS16 1 -# define LZO_INFO_OS "dos16" -# elif defined(__NT__) && (__WATCOMC__ < 1100) -# define LZO_OS_WIN32 1 -# define LZO_INFO_OS "win32" -# elif defined(__linux__) || defined(__LINUX__) -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -# else -# error "please specify a target using the -bt compiler option" -# endif -#elif defined(__palmos__) -# define LZO_OS_PALMOS 1 -# define LZO_INFO_OS "palmos" -#elif defined(__TOS__) || defined(__atarist__) -# define LZO_OS_TOS 1 -# define LZO_INFO_OS "tos" -#elif defined(macintosh) && !defined(__arm__) && !defined(__i386__) && !defined(__ppc__) && !defined(__x64_64__) -# define LZO_OS_MACCLASSIC 1 -# define LZO_INFO_OS "macclassic" -#elif defined(__VMS) -# define LZO_OS_VMS 1 -# define LZO_INFO_OS "vms" -#elif (defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PS2 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "ps2" -#elif defined(__mips__) && defined(__psp__) -# define LZO_OS_CONSOLE 1 -# define LZO_OS_CONSOLE_PSP 1 -# define LZO_INFO_OS "console" -# define LZO_INFO_OS_CONSOLE "psp" -#else -# define LZO_OS_POSIX 1 -# define LZO_INFO_OS "posix" -#endif -#if (LZO_OS_POSIX) -# if defined(_AIX) || defined(__AIX__) || defined(__aix__) -# define LZO_OS_POSIX_AIX 1 -# define LZO_INFO_OS_POSIX "aix" -# elif defined(__FreeBSD__) -# define LZO_OS_POSIX_FREEBSD 1 -# define LZO_INFO_OS_POSIX "freebsd" -# elif defined(__hpux__) || defined(__hpux) -# define LZO_OS_POSIX_HPUX 1 -# define LZO_INFO_OS_POSIX "hpux" -# elif defined(__INTERIX) -# define LZO_OS_POSIX_INTERIX 1 -# define LZO_INFO_OS_POSIX "interix" -# elif defined(__IRIX__) || defined(__irix__) -# define LZO_OS_POSIX_IRIX 1 -# define LZO_INFO_OS_POSIX "irix" -# elif defined(__linux__) || defined(__linux) || defined(__LINUX__) -# define LZO_OS_POSIX_LINUX 1 -# define LZO_INFO_OS_POSIX "linux" -# elif defined(__APPLE__) && defined(__MACH__) -# if ((__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__-0) >= 20000) -# define LZO_OS_POSIX_DARWIN 1040 -# define LZO_INFO_OS_POSIX "darwin_iphone" -# elif ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) >= 1040) -# define LZO_OS_POSIX_DARWIN __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ -# define LZO_INFO_OS_POSIX "darwin" -# else -# define LZO_OS_POSIX_DARWIN 1 -# define LZO_INFO_OS_POSIX "darwin" -# endif -# define LZO_OS_POSIX_MACOSX LZO_OS_POSIX_DARWIN -# elif defined(__minix__) || defined(__minix) -# define LZO_OS_POSIX_MINIX 1 -# define LZO_INFO_OS_POSIX "minix" -# elif defined(__NetBSD__) -# define LZO_OS_POSIX_NETBSD 1 -# define LZO_INFO_OS_POSIX "netbsd" -# elif defined(__OpenBSD__) -# define LZO_OS_POSIX_OPENBSD 1 -# define LZO_INFO_OS_POSIX "openbsd" -# elif defined(__osf__) -# define LZO_OS_POSIX_OSF 1 -# define LZO_INFO_OS_POSIX "osf" -# elif defined(__solaris__) || defined(__sun) -# if defined(__SVR4) || defined(__svr4__) -# define LZO_OS_POSIX_SOLARIS 1 -# define LZO_INFO_OS_POSIX "solaris" -# else -# define LZO_OS_POSIX_SUNOS 1 -# define LZO_INFO_OS_POSIX "sunos" -# endif -# elif defined(__ultrix__) || defined(__ultrix) -# define LZO_OS_POSIX_ULTRIX 1 -# define LZO_INFO_OS_POSIX "ultrix" -# elif defined(_UNICOS) -# define LZO_OS_POSIX_UNICOS 1 -# define LZO_INFO_OS_POSIX "unicos" -# else -# define LZO_OS_POSIX_UNKNOWN 1 -# define LZO_INFO_OS_POSIX "unknown" -# endif -#endif -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# if (UINT_MAX != LZO_0xffffL) -# error "unexpected configuration - check your compiler defines" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (UINT_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) -# define LZO_CC_CILLY 1 -# define LZO_INFO_CC "Cilly" -# if defined(__CILLY__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) -# define LZO_CC_SDCC 1 -# define LZO_INFO_CC "sdcc" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) -#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) -# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + (__PATHCC_MINOR__-0) * 0x100 + (__PATHCC_PATCHLEVEL__-0)) -# define LZO_INFO_CC "Pathscale C" -# define LZO_INFO_CCVER __PATHSCALE__ -# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# define LZO_CC_PATHSCALE_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# endif -#elif defined(__INTEL_COMPILER) && ((__INTEL_COMPILER-0) > 0) -# define LZO_CC_INTELC __INTEL_COMPILER -# define LZO_INFO_CC "Intel C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) -# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -# define LZO_CC_INTELC_MSC _MSC_VER -# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# define LZO_CC_INTELC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# endif -#elif defined(__POCC__) && defined(_WIN32) -# define LZO_CC_PELLESC 1 -# define LZO_INFO_CC "Pelles C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) -#elif defined(__ARMCC_VERSION) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# if defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# else -# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) -# endif -# define LZO_CC_ARMCC __ARMCC_VERSION -# define LZO_INFO_CC "ARM C Compiler" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__clang__) && defined(__c2__) && defined(__c2_version__) && defined(_MSC_VER) -# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) -# define LZO_CC_CLANG_C2 _MSC_VER -# define LZO_CC_CLANG_VENDOR_MICROSOFT 1 -# define LZO_INFO_CC "clang/c2" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__c2_version__) -#elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__) -# if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__) -# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) -# else -# define LZO_CC_CLANG 0x010000L -# endif -# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -# define LZO_CC_CLANG_MSC _MSC_VER -# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# endif -# if defined(__APPLE_CC__) -# define LZO_CC_CLANG_VENDOR_APPLE 1 -# define LZO_INFO_CC "clang/apple" -# else -# define LZO_CC_CLANG_VENDOR_LLVM 1 -# define LZO_INFO_CC "clang" -# endif -# if defined(__clang_version__) -# define LZO_INFO_CCVER __clang_version__ -# else -# define LZO_INFO_CCVER __VERSION__ -# endif -#elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# if defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# else -# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) -# endif -# define LZO_CC_LLVM LZO_CC_LLVM_GNUC -# define LZO_INFO_CC "llvm-gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(__ACK__) && defined(_ACK) -# define LZO_CC_ACK 1 -# define LZO_INFO_CC "Amsterdam Compiler Kit C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__ARMCC_VERSION) && !defined(__GNUC__) -# define LZO_CC_ARMCC __ARMCC_VERSION -# define LZO_CC_ARMCC_ARMCC __ARMCC_VERSION -# define LZO_INFO_CC "ARM C Compiler" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ARMCC_VERSION) -#elif defined(__AZTEC_C__) -# define LZO_CC_AZTECC 1 -# define LZO_INFO_CC "Aztec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) -#elif defined(__CODEGEARC__) -# define LZO_CC_CODEGEARC 1 -# define LZO_INFO_CC "CodeGear C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CODEGEARC__) -#elif defined(__BORLANDC__) -# define LZO_CC_BORLANDC 1 -# define LZO_INFO_CC "Borland C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) -#elif defined(_CRAYC) && defined(_RELEASE) -# define LZO_CC_CRAYC 1 -# define LZO_INFO_CC "Cray C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) -#elif defined(__DMC__) && defined(__SC__) -# define LZO_CC_DMC 1 -# define LZO_INFO_CC "Digital Mars C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) -#elif defined(__DECC) -# define LZO_CC_DECC 1 -# define LZO_INFO_CC "DEC C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) -#elif (defined(__ghs) || defined(__ghs__)) && defined(__GHS_VERSION_NUMBER) && ((__GHS_VERSION_NUMBER-0) > 0) -# define LZO_CC_GHS 1 -# define LZO_INFO_CC "Green Hills C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__GHS_VERSION_NUMBER) -# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) -# define LZO_CC_GHS_MSC _MSC_VER -# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) -# define LZO_CC_GHS_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# endif -#elif defined(__HIGHC__) -# define LZO_CC_HIGHC 1 -# define LZO_INFO_CC "MetaWare High C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__HP_aCC) && ((__HP_aCC-0) > 0) -# define LZO_CC_HPACC __HP_aCC -# define LZO_INFO_CC "HP aCC" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__HP_aCC) -#elif defined(__IAR_SYSTEMS_ICC__) -# define LZO_CC_IARC 1 -# define LZO_INFO_CC "IAR C" -# if defined(__VER__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__IBMC__) && ((__IBMC__-0) > 0) -# define LZO_CC_IBMC __IBMC__ -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) -#elif defined(__IBMCPP__) && ((__IBMCPP__-0) > 0) -# define LZO_CC_IBMC __IBMCPP__ -# define LZO_INFO_CC "IBM C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMCPP__) -#elif defined(__KEIL__) && defined(__C166__) -# define LZO_CC_KEILC 1 -# define LZO_INFO_CC "Keil C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) -#elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) -# define LZO_CC_LCCWIN32 1 -# define LZO_INFO_CC "lcc-win32" -# define LZO_INFO_CCVER "unknown" -#elif defined(__LCC__) -# define LZO_CC_LCC 1 -# define LZO_INFO_CC "lcc" -# if defined(__LCC_VERSION__) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) -# else -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__MWERKS__) && ((__MWERKS__-0) > 0) -# define LZO_CC_MWERKS __MWERKS__ -# define LZO_INFO_CC "Metrowerks C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) -#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) -# define LZO_CC_NDPC 1 -# define LZO_INFO_CC "Microway NDP C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PACIFIC__) -# define LZO_CC_PACIFICC 1 -# define LZO_INFO_CC "Pacific C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) -#elif defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100 + (__PGIC_PATCHLEVEL__-0)) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) "." LZO_PP_MACRO_EXPAND(__PGIC_PATCHLEVEL__) -# else -# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) ".0" -# endif -# define LZO_INFO_CC "Portland Group PGI C" -#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) -# define LZO_CC_PGI 1 -# define LZO_INFO_CC "Portland Group PGI C" -# define LZO_INFO_CCVER "unknown" -#elif defined(__PUREC__) && defined(__TOS__) -# define LZO_CC_PUREC 1 -# define LZO_INFO_CC "Pure C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) -#elif defined(__SC__) && defined(__ZTC__) -# define LZO_CC_SYMANTECC 1 -# define LZO_INFO_CC "Symantec C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) -#elif defined(__SUNPRO_C) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_C-0) > 0) -# define LZO_CC_SUNPROC __SUNPRO_C -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__SUNPRO_CC) -# define LZO_INFO_CC "SunPro C" -# if ((__SUNPRO_CC-0) > 0) -# define LZO_CC_SUNPROC __SUNPRO_CC -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) -# else -# define LZO_CC_SUNPROC 1 -# define LZO_INFO_CCVER "unknown" -# endif -#elif defined(__TINYC__) -# define LZO_CC_TINYC 1 -# define LZO_INFO_CC "Tiny C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) -#elif defined(__TSC__) -# define LZO_CC_TOPSPEEDC 1 -# define LZO_INFO_CC "TopSpeed C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) -#elif defined(__WATCOMC__) -# define LZO_CC_WATCOMC 1 -# define LZO_INFO_CC "Watcom C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) -#elif defined(__TURBOC__) -# define LZO_CC_TURBOC 1 -# define LZO_INFO_CC "Turbo C" -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) -#elif defined(__ZTC__) -# define LZO_CC_ZORTECHC 1 -# define LZO_INFO_CC "Zortech C" -# if ((__ZTC__-0) == 0x310) -# define LZO_INFO_CCVER "0x310" -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) -# endif -#elif defined(__GNUC__) && defined(__VERSION__) -# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) -# elif defined(__GNUC_MINOR__) -# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) -# else -# define LZO_CC_GNUC (__GNUC__ * 0x10000L) -# endif -# define LZO_INFO_CC "gcc" -# define LZO_INFO_CCVER __VERSION__ -#elif defined(_MSC_VER) && ((_MSC_VER-0) > 0) -# define LZO_CC_MSC _MSC_VER -# define LZO_INFO_CC "Microsoft C" -# if defined(_MSC_FULL_VER) -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) -# else -# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) -# endif -#else -# define LZO_CC_UNKNOWN 1 -# define LZO_INFO_CC "unknown" -# define LZO_INFO_CCVER "unknown" -#endif -#if (LZO_CC_GNUC) && defined(__OPEN64__) -# if defined(__OPENCC__) && defined(__OPENCC_MINOR__) && defined(__OPENCC_PATCHLEVEL__) -# define LZO_CC_OPEN64 (__OPENCC__ * 0x10000L + (__OPENCC_MINOR__-0) * 0x100 + (__OPENCC_PATCHLEVEL__-0)) -# define LZO_CC_OPEN64_GNUC LZO_CC_GNUC -# endif -#endif -#if (LZO_CC_GNUC) && defined(__PCC__) -# if defined(__PCC__) && defined(__PCC_MINOR__) && defined(__PCC_MINORMINOR__) -# define LZO_CC_PCC (__PCC__ * 0x10000L + (__PCC_MINOR__-0) * 0x100 + (__PCC_MINORMINOR__-0)) -# define LZO_CC_PCC_GNUC LZO_CC_GNUC -# endif -#endif -#if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) -# error "LZO_CC_MSC: _MSC_FULL_VER is not defined" -#endif -#if !defined(__LZO_ARCH_OVERRIDE) && !(LZO_ARCH_GENERIC) && defined(_CRAY) -# if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) -# if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) -# define LZO_ARCH_CRAY_MPP 1 -# elif defined(_CRAY1) -# define LZO_ARCH_CRAY_PVP 1 -# endif -# endif -#endif -#if !defined(__LZO_ARCH_OVERRIDE) -#if (LZO_ARCH_GENERIC) -# define LZO_INFO_ARCH "generic" -#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086 1 -# define LZO_INFO_ARCH "i086" -#elif defined(__aarch64__) || defined(_M_ARM64) -# define LZO_ARCH_ARM64 1 -# define LZO_INFO_ARCH "arm64" -#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) -# define LZO_ARCH_ALPHA 1 -# define LZO_INFO_ARCH "alpha" -#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) -# define LZO_ARCH_AMD64 1 -# define LZO_INFO_ARCH "amd64" -#elif defined(__arm__) || defined(_M_ARM) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) -# define LZO_ARCH_ARM 1 -# define LZO_INFO_ARCH "arm" -#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) -# define LZO_ARCH_AVR 1 -# define LZO_INFO_ARCH "avr" -#elif defined(__avr32__) || defined(__AVR32__) -# define LZO_ARCH_AVR32 1 -# define LZO_INFO_ARCH "avr32" -#elif defined(__bfin__) -# define LZO_ARCH_BLACKFIN 1 -# define LZO_INFO_ARCH "blackfin" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) -# define LZO_ARCH_C166 1 -# define LZO_INFO_ARCH "c166" -#elif defined(__cris__) -# define LZO_ARCH_CRIS 1 -# define LZO_INFO_ARCH "cris" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) -# define LZO_ARCH_EZ80 1 -# define LZO_INFO_ARCH "ez80" -#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_ARCH_H8300 1 -# define LZO_INFO_ARCH "h8300" -#elif defined(__hppa__) || defined(__hppa) -# define LZO_ARCH_HPPA 1 -# define LZO_INFO_ARCH "hppa" -#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_CC_ZORTECHC && defined(__I86__)) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) -# define LZO_ARCH_I386 1 -# define LZO_ARCH_IA32 1 -# define LZO_INFO_ARCH "i386" -#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) -# define LZO_ARCH_IA64 1 -# define LZO_INFO_ARCH "ia64" -#elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) -# define LZO_ARCH_M16C 1 -# define LZO_INFO_ARCH "m16c" -#elif defined(__m32r__) -# define LZO_ARCH_M32R 1 -# define LZO_INFO_ARCH "m32r" -#elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) -# define LZO_ARCH_M68K 1 -# define LZO_INFO_ARCH "m68k" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) -# define LZO_ARCH_MCS251 1 -# define LZO_INFO_ARCH "mcs251" -#elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) -# define LZO_ARCH_MCS51 1 -# define LZO_INFO_ARCH "mcs51" -#elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) -# define LZO_ARCH_MIPS 1 -# define LZO_INFO_ARCH "mips" -#elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) -# define LZO_ARCH_MSP430 1 -# define LZO_INFO_ARCH "msp430" -#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__powerpc64__) || defined(__powerpc64) || defined(__ppc64__) || defined(__PPC64__) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__powerpc64le__) || defined(__powerpc64le) || defined(__ppc64le__) || defined(__PPC64LE__) -# define LZO_ARCH_POWERPC 1 -# define LZO_INFO_ARCH "powerpc" -#elif defined(__riscv) -# define LZO_ARCH_RISCV 1 -# define LZO_INFO_ARCH "riscv" -#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) -# define LZO_ARCH_S390 1 -# define LZO_INFO_ARCH "s390" -#elif defined(__sh__) || defined(_M_SH) -# define LZO_ARCH_SH 1 -# define LZO_INFO_ARCH "sh" -#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) -# define LZO_ARCH_SPARC 1 -# define LZO_INFO_ARCH "sparc" -#elif defined(__SPU__) -# define LZO_ARCH_SPU 1 -# define LZO_INFO_ARCH "spu" -#elif (UINT_MAX == LZO_0xffffL) && defined(__z80) -# define LZO_ARCH_Z80 1 -# define LZO_INFO_ARCH "z80" -#elif (LZO_ARCH_CRAY_PVP) -# if defined(_CRAYSV1) -# define LZO_ARCH_CRAY_SV1 1 -# define LZO_INFO_ARCH "cray_sv1" -# elif (_ADDR64) -# define LZO_ARCH_CRAY_T90 1 -# define LZO_INFO_ARCH "cray_t90" -# elif (_ADDR32) -# define LZO_ARCH_CRAY_YMP 1 -# define LZO_INFO_ARCH "cray_ymp" -# else -# define LZO_ARCH_CRAY_XMP 1 -# define LZO_INFO_ARCH "cray_xmp" -# endif -#else -# define LZO_ARCH_UNKNOWN 1 -# define LZO_INFO_ARCH "unknown" -#endif -#endif -#if !defined(LZO_ARCH_ARM_THUMB2) -#if (LZO_ARCH_ARM) -# if defined(__thumb__) || defined(__thumb) || defined(_M_THUMB) -# if defined(__thumb2__) -# define LZO_ARCH_ARM_THUMB2 1 -# elif 1 && defined(__TARGET_ARCH_THUMB) && ((__TARGET_ARCH_THUMB)+0 >= 4) -# define LZO_ARCH_ARM_THUMB2 1 -# elif 1 && defined(_MSC_VER) && defined(_M_THUMB) && ((_M_THUMB)+0 >= 7) -# define LZO_ARCH_ARM_THUMB2 1 -# endif -# endif -#endif -#endif -#if (LZO_ARCH_ARM_THUMB2) -# undef LZO_INFO_ARCH -# define LZO_INFO_ARCH "arm_thumb2" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) -# error "FIXME - missing define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) -# error "FIXME - missing LZO_OS_WIN32 define for CPU architecture" -#endif -#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) -# error "FIXME - missing LZO_OS_WIN64 define for CPU architecture" -#endif -#if (LZO_OS_OS216 || LZO_OS_WIN16) -# define LZO_ARCH_I086PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(BLX286)) -# define LZO_ARCH_I086PM 1 -#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) -# define LZO_ARCH_I086PM 1 -#elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) -# define LZO_ARCH_I086PM 1 -#endif -#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) -# define LZO_ARCH_X64 1 -#elif (!LZO_ARCH_AMD64 && LZO_ARCH_X64) && defined(__LZO_ARCH_OVERRIDE) -# define LZO_ARCH_AMD64 1 -#endif -#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) -# define LZO_ARCH_AARCH64 1 -#elif (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) && defined(__LZO_ARCH_OVERRIDE) -# define LZO_ARCH_ARM64 1 -#endif -#if (LZO_ARCH_I386 && !LZO_ARCH_X86) -# define LZO_ARCH_X86 1 -#elif (!LZO_ARCH_I386 && LZO_ARCH_X86) && defined(__LZO_ARCH_OVERRIDE) -# define LZO_ARCH_I386 1 -#endif -#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) || (!LZO_ARCH_AMD64 && LZO_ARCH_X64) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) || (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_I086PM && !LZO_ARCH_I086) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_I086) -# if (UINT_MAX != LZO_0xffffL) -# error "unexpected configuration - check your compiler defines" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if (LZO_ARCH_I386) -# if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) -# error "unexpected configuration - check your compiler defines" -# endif -# if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) -# error "unexpected configuration - check your compiler defines" -# endif -# if (ULONG_MAX != LZO_0xffffffffL) -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if (LZO_ARCH_AMD64 || LZO_ARCH_I386) -# if !defined(LZO_TARGET_FEATURE_SSE2) -# if defined(__SSE2__) -# define LZO_TARGET_FEATURE_SSE2 1 -# elif defined(_MSC_VER) && (defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2)) -# define LZO_TARGET_FEATURE_SSE2 1 -# elif (LZO_CC_INTELC_MSC || LZO_CC_MSC) && defined(_M_AMD64) -# define LZO_TARGET_FEATURE_SSE2 1 -# endif -# endif -# if !defined(LZO_TARGET_FEATURE_SSSE3) -# if (LZO_TARGET_FEATURE_SSE2) -# if defined(__SSSE3__) -# define LZO_TARGET_FEATURE_SSSE3 1 -# elif defined(_MSC_VER) && defined(__AVX__) -# define LZO_TARGET_FEATURE_SSSE3 1 -# endif -# endif -# endif -# if !defined(LZO_TARGET_FEATURE_SSE4_2) -# if (LZO_TARGET_FEATURE_SSSE3) -# if defined(__SSE4_2__) -# define LZO_TARGET_FEATURE_SSE4_2 1 -# endif -# endif -# endif -# if !defined(LZO_TARGET_FEATURE_AVX) -# if (LZO_TARGET_FEATURE_SSSE3) -# if defined(__AVX__) -# define LZO_TARGET_FEATURE_AVX 1 -# endif -# endif -# endif -# if !defined(LZO_TARGET_FEATURE_AVX2) -# if (LZO_TARGET_FEATURE_AVX) -# if defined(__AVX2__) -# define LZO_TARGET_FEATURE_AVX2 1 -# endif -# endif -# endif -#endif -#if (LZO_TARGET_FEATURE_SSSE3 && !(LZO_TARGET_FEATURE_SSE2)) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_TARGET_FEATURE_SSE4_2 && !(LZO_TARGET_FEATURE_SSSE3)) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_TARGET_FEATURE_AVX && !(LZO_TARGET_FEATURE_SSSE3)) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_TARGET_FEATURE_AVX2 && !(LZO_TARGET_FEATURE_AVX)) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ARCH_ARM) -# if !defined(LZO_TARGET_FEATURE_NEON) -# if defined(__ARM_NEON) && ((__ARM_NEON)+0) -# define LZO_TARGET_FEATURE_NEON 1 -# elif 1 && defined(__ARM_NEON__) && ((__ARM_NEON__)+0) -# define LZO_TARGET_FEATURE_NEON 1 -# elif 1 && defined(__TARGET_FEATURE_NEON) && ((__TARGET_FEATURE_NEON)+0) -# define LZO_TARGET_FEATURE_NEON 1 -# endif -# endif -#elif (LZO_ARCH_ARM64) -# if !defined(LZO_TARGET_FEATURE_NEON) -# if 1 -# define LZO_TARGET_FEATURE_NEON 1 -# endif -# endif -#endif -#if 0 -#elif !defined(__LZO_MM_OVERRIDE) -#if (LZO_ARCH_I086) -#if (UINT_MAX != LZO_0xffffL) -# error "unexpected configuration - check your compiler defines" -#endif -#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) -# define LZO_MM_TINY 1 -#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) -# define LZO_MM_HUGE 1 -#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) -# define LZO_MM_SMALL 1 -#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) -# define LZO_MM_MEDIUM 1 -#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) -# define LZO_MM_COMPACT 1 -#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) -# define LZO_MM_LARGE 1 -#elif (LZO_CC_AZTECC) -# if defined(_LARGE_CODE) && defined(_LARGE_DATA) -# define LZO_MM_LARGE 1 -# elif defined(_LARGE_CODE) -# define LZO_MM_MEDIUM 1 -# elif defined(_LARGE_DATA) -# define LZO_MM_COMPACT 1 -# else -# define LZO_MM_SMALL 1 -# endif -#elif (LZO_CC_ZORTECHC && defined(__VCM__)) -# define LZO_MM_LARGE 1 -#else -# error "unknown LZO_ARCH_I086 memory model" -#endif -#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) -#define LZO_HAVE_MM_HUGE_PTR 1 -#define LZO_HAVE_MM_HUGE_ARRAY 1 -#if (LZO_MM_TINY) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) -# undef LZO_HAVE_MM_HUGE_PTR -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# undef LZO_HAVE_MM_HUGE_ARRAY -#elif (LZO_CC_MSC && defined(_QC)) -# undef LZO_HAVE_MM_HUGE_ARRAY -# if (_MSC_VER < 600) -# undef LZO_HAVE_MM_HUGE_PTR -# endif -#elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) -# undef LZO_HAVE_MM_HUGE_ARRAY -#endif -#if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR) -# if (LZO_OS_DOS16) -# error "unexpected configuration - check your compiler defines" -# elif (LZO_CC_ZORTECHC) -# else -# error "unexpected configuration - check your compiler defines" -# endif -#endif -#if defined(__cplusplus) -extern "C" { -#endif -#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) - extern void __near __cdecl _AHSHIFT(void); -# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) -#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) -# define LZO_MM_AHSHIFT 12 -#elif (LZO_CC_WATCOMC) - extern unsigned char _HShift; -# define LZO_MM_AHSHIFT ((unsigned) _HShift) -#else -# error "FIXME - implement LZO_MM_AHSHIFT" -#endif -#if defined(__cplusplus) -} -#endif -#endif -#elif (LZO_ARCH_C166) -#if !defined(__MODEL__) -# error "FIXME - LZO_ARCH_C166 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - LZO_ARCH_C166 __MODEL__" -#endif -#elif (LZO_ARCH_MCS251) -#if !defined(__MODEL__) -# error "FIXME - LZO_ARCH_MCS251 __MODEL__" -#elif ((__MODEL__) == 0) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - LZO_ARCH_MCS251 __MODEL__" -#endif -#elif (LZO_ARCH_MCS51) -#if !defined(__MODEL__) -# error "FIXME - LZO_ARCH_MCS51 __MODEL__" -#elif ((__MODEL__) == 1) -# define LZO_MM_SMALL 1 -#elif ((__MODEL__) == 2) -# define LZO_MM_LARGE 1 -#elif ((__MODEL__) == 3) -# define LZO_MM_TINY 1 -#elif ((__MODEL__) == 4) -# define LZO_MM_XTINY 1 -#elif ((__MODEL__) == 5) -# define LZO_MM_XSMALL 1 -#else -# error "FIXME - LZO_ARCH_MCS51 __MODEL__" -#endif -#elif (LZO_ARCH_CRAY_PVP) -# define LZO_MM_PVP 1 -#else -# define LZO_MM_FLAT 1 -#endif -#if (LZO_MM_COMPACT) -# define LZO_INFO_MM "compact" -#elif (LZO_MM_FLAT) -# define LZO_INFO_MM "flat" -#elif (LZO_MM_HUGE) -# define LZO_INFO_MM "huge" -#elif (LZO_MM_LARGE) -# define LZO_INFO_MM "large" -#elif (LZO_MM_MEDIUM) -# define LZO_INFO_MM "medium" -#elif (LZO_MM_PVP) -# define LZO_INFO_MM "pvp" -#elif (LZO_MM_SMALL) -# define LZO_INFO_MM "small" -#elif (LZO_MM_TINY) -# define LZO_INFO_MM "tiny" -#else -# error "unknown memory model" -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -#if (LZO_CC_GNUC >= 0x020800ul) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_gnuc_extension__ __extension__ -#elif (LZO_CC_IBMC >= 600) -# define __lzo_gnuc_extension__ __extension__ -#endif -#endif -#if !defined(__lzo_gnuc_extension__) -# define __lzo_gnuc_extension__ /*empty*/ -#endif -#if !defined(lzo_has_builtin) -#if (LZO_CC_CLANG) && defined(__has_builtin) -# define lzo_has_builtin __has_builtin -#endif -#endif -#if !defined(lzo_has_builtin) -# define lzo_has_builtin(x) 0 -#endif -#if !defined(lzo_has_attribute) -#if (LZO_CC_CLANG) && defined(__has_attribute) -# define lzo_has_attribute __has_attribute -#endif -#endif -#if !defined(lzo_has_attribute) -# define lzo_has_attribute(x) 0 -#endif -#if !defined(lzo_has_declspec_attribute) -#if (LZO_CC_CLANG) && defined(__has_declspec_attribute) -# define lzo_has_declspec_attribute __has_declspec_attribute -#endif -#endif -#if !defined(lzo_has_declspec_attribute) -# define lzo_has_declspec_attribute(x) 0 -#endif -#if !defined(lzo_has_feature) -#if (LZO_CC_CLANG) && defined(__has_feature) -# define lzo_has_feature __has_feature -#endif -#endif -#if !defined(lzo_has_feature) -# define lzo_has_feature(x) 0 -#endif -#if !defined(lzo_has_extension) -#if (LZO_CC_CLANG) && defined(__has_extension) -# define lzo_has_extension __has_extension -#elif (LZO_CC_CLANG) && defined(__has_feature) -# define lzo_has_extension __has_feature -#endif -#endif -#if !defined(lzo_has_extension) -# define lzo_has_extension(x) 0 -#endif -#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0 -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) -# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -# elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1200)) -# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -# else -# define LZO_CFG_USE_NEW_STYLE_CASTS 1 -# endif -#endif -#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -#endif -#if !defined(__cplusplus) -# if defined(LZO_CFG_USE_NEW_STYLE_CASTS) -# undef LZO_CFG_USE_NEW_STYLE_CASTS -# endif -# define LZO_CFG_USE_NEW_STYLE_CASTS 0 -#endif -#if !defined(LZO_REINTERPRET_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_REINTERPRET_CAST(t,e) (reinterpret_cast (e)) -# endif -#endif -#if !defined(LZO_REINTERPRET_CAST) -# define LZO_REINTERPRET_CAST(t,e) ((t) (e)) -#endif -#if !defined(LZO_STATIC_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_STATIC_CAST(t,e) (static_cast (e)) -# endif -#endif -#if !defined(LZO_STATIC_CAST) -# define LZO_STATIC_CAST(t,e) ((t) (e)) -#endif -#if !defined(LZO_STATIC_CAST2) -# define LZO_STATIC_CAST2(t1,t2,e) LZO_STATIC_CAST(t1, LZO_STATIC_CAST(t2, e)) -#endif -#if !defined(LZO_UNCONST_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_UNCONST_CAST(t,e) (const_cast (e)) -# elif (LZO_HAVE_MM_HUGE_PTR) -# define LZO_UNCONST_CAST(t,e) ((t) (e)) -# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((const void *) (e))))) -# endif -#endif -#if !defined(LZO_UNCONST_CAST) -# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((const void *) (e)))) -#endif -#if !defined(LZO_UNCONST_VOLATILE_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_UNCONST_VOLATILE_CAST(t,e) (const_cast (e)) -# elif (LZO_HAVE_MM_HUGE_PTR) -# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) (e)) -# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) -# endif -#endif -#if !defined(LZO_UNCONST_VOLATILE_CAST) -# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((volatile const void *) (e)))) -#endif -#if !defined(LZO_UNVOLATILE_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_UNVOLATILE_CAST(t,e) (const_cast (e)) -# elif (LZO_HAVE_MM_HUGE_PTR) -# define LZO_UNVOLATILE_CAST(t,e) ((t) (e)) -# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((volatile void *) (e))))) -# endif -#endif -#if !defined(LZO_UNVOLATILE_CAST) -# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((volatile void *) (e)))) -#endif -#if !defined(LZO_UNVOLATILE_CONST_CAST) -# if (LZO_CFG_USE_NEW_STYLE_CASTS) -# define LZO_UNVOLATILE_CONST_CAST(t,e) (const_cast (e)) -# elif (LZO_HAVE_MM_HUGE_PTR) -# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) (e)) -# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) -# endif -#endif -#if !defined(LZO_UNVOLATILE_CONST_CAST) -# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((volatile const void *) (e)))) -#endif -#if !defined(LZO_PCAST) -# if (LZO_HAVE_MM_HUGE_PTR) -# define LZO_PCAST(t,e) ((t) (e)) -# endif -#endif -#if !defined(LZO_PCAST) -# define LZO_PCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(void *, e)) -#endif -#if !defined(LZO_CCAST) -# if (LZO_HAVE_MM_HUGE_PTR) -# define LZO_CCAST(t,e) ((t) (e)) -# endif -#endif -#if !defined(LZO_CCAST) -# define LZO_CCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(const void *, e)) -#endif -#if !defined(LZO_ICONV) -# define LZO_ICONV(t,e) LZO_STATIC_CAST(t, e) -#endif -#if !defined(LZO_ICAST) -# define LZO_ICAST(t,e) LZO_STATIC_CAST(t, e) -#endif -#if !defined(LZO_ITRUNC) -# define LZO_ITRUNC(t,e) LZO_STATIC_CAST(t, e) -#endif -#if !defined(__lzo_cte) -# if (LZO_CC_MSC || LZO_CC_WATCOMC) -# define __lzo_cte(e) ((void)0,(e)) -# elif 1 -# define __lzo_cte(e) ((void)0,(e)) -# endif -#endif -#if !defined(__lzo_cte) -# define __lzo_cte(e) (e) -#endif -#if !defined(LZO_BLOCK_BEGIN) -# define LZO_BLOCK_BEGIN do { -# define LZO_BLOCK_END } while __lzo_cte(0) -#endif -#if !defined(LZO_UNUSED) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030200ul)) -# define LZO_UNUSED(var) ((void) &var) -# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_UNUSED(var) ((void) var) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED(var) if (&var) ; else -# elif (LZO_CC_KEILC) -# define LZO_UNUSED(var) {extern int lzo_unused__[1-2*!(sizeof(var)>0)]; (void)lzo_unused__;} -# elif (LZO_CC_PACIFICC) -# define LZO_UNUSED(var) ((void) sizeof(var)) -# elif (LZO_CC_WATCOMC) && defined(__cplusplus) -# define LZO_UNUSED(var) ((void) var) -# else -# define LZO_UNUSED(var) ((void) &var) -# endif -#endif -#if !defined(LZO_UNUSED_RESULT) -# define LZO_UNUSED_RESULT(var) LZO_UNUSED(var) -#endif -#if !defined(LZO_UNUSED_FUNC) -# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) -# define LZO_UNUSED_FUNC(func) ((void) func) -# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_CLANG || LZO_CC_LLVM) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_UNUSED_FUNC(func) if (func) ; else -# elif (LZO_CC_MSC) -# define LZO_UNUSED_FUNC(func) ((void) &func) -# elif (LZO_CC_KEILC || LZO_CC_PELLESC) -# define LZO_UNUSED_FUNC(func) {extern int lzo_unused__[1-2*!(sizeof((int)func)>0)]; (void)lzo_unused__;} -# else -# define LZO_UNUSED_FUNC(func) ((void) func) -# endif -#endif -#if !defined(LZO_UNUSED_LABEL) -# if (LZO_CC_CLANG >= 0x020800ul) -# define LZO_UNUSED_LABEL(l) (__lzo_gnuc_extension__ ((void) ((const void *) &&l))) -# elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) -# define LZO_UNUSED_LABEL(l) if __lzo_cte(0) goto l -# else -# define LZO_UNUSED_LABEL(l) switch (0) case 1:goto l -# endif -#endif -#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) -# if 0 -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var -# elif 0 && (LZO_CC_GNUC) -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var -# else -# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init -# endif -#endif -#if !defined(__lzo_inline) -#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) -#elif defined(__cplusplus) -# define __lzo_inline inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) -# define __lzo_inline inline -#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) -# define __lzo_inline __inline -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_inline __inline__ -#elif (LZO_CC_DMC) -# define __lzo_inline __inline -#elif (LZO_CC_GHS) -# define __lzo_inline __inline__ -#elif (LZO_CC_IBMC >= 600) -# define __lzo_inline __inline__ -#elif (LZO_CC_INTELC) -# define __lzo_inline __inline -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) -# define __lzo_inline __inline -#elif (LZO_CC_MSC && (_MSC_VER >= 900)) -# define __lzo_inline __inline -#elif (LZO_CC_SUNPROC >= 0x5100) -# define __lzo_inline __inline__ -#endif -#endif -#if defined(__lzo_inline) -# ifndef __lzo_HAVE_inline -# define __lzo_HAVE_inline 1 -# endif -#else -# define __lzo_inline /*empty*/ -#endif -#if !defined(__lzo_forceinline) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_IBMC >= 700) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_forceinline __forceinline -#elif (LZO_CC_PGI >= 0x0d0a00ul) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#elif (LZO_CC_SUNPROC >= 0x5100) -# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) -#endif -#endif -#if defined(__lzo_forceinline) -# ifndef __lzo_HAVE_forceinline -# define __lzo_HAVE_forceinline 1 -# endif -#else -# define __lzo_forceinline __lzo_inline -#endif -#if !defined(__lzo_noinline) -#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) -# define __lzo_noinline __attribute__((__noinline__,__used__)) -#elif (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_IBMC >= 700) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_noinline __declspec(noinline) -#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) -# if defined(__cplusplus) -# else -# define __lzo_noinline __declspec(noinline) -# endif -#elif (LZO_CC_PGI >= 0x0d0a00ul) -# define __lzo_noinline __attribute__((__noinline__)) -#elif (LZO_CC_SUNPROC >= 0x5100) -# define __lzo_noinline __attribute__((__noinline__)) -#endif -#endif -#if defined(__lzo_noinline) -# ifndef __lzo_HAVE_noinline -# define __lzo_HAVE_noinline 1 -# endif -#else -# define __lzo_noinline /*empty*/ -#endif -#if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) -# error "unexpected configuration - check your compiler defines" -#endif -#if !defined(__lzo_static_inline) -#if (LZO_CC_IBMC) -# define __lzo_static_inline __lzo_gnuc_extension__ static __lzo_inline -#endif -#endif -#if !defined(__lzo_static_inline) -# define __lzo_static_inline static __lzo_inline -#endif -#if !defined(__lzo_static_forceinline) -#if (LZO_CC_IBMC) -# define __lzo_static_forceinline __lzo_gnuc_extension__ static __lzo_forceinline -#endif -#endif -#if !defined(__lzo_static_forceinline) -# define __lzo_static_forceinline static __lzo_forceinline -#endif -#if !defined(__lzo_static_noinline) -#if (LZO_CC_IBMC) -# define __lzo_static_noinline __lzo_gnuc_extension__ static __lzo_noinline -#endif -#endif -#if !defined(__lzo_static_noinline) -# define __lzo_static_noinline static __lzo_noinline -#endif -#if !defined(__lzo_c99_extern_inline) -#if defined(__GNUC_GNU_INLINE__) -# define __lzo_c99_extern_inline __lzo_inline -#elif defined(__GNUC_STDC_INLINE__) -# define __lzo_c99_extern_inline extern __lzo_inline -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) -# define __lzo_c99_extern_inline extern __lzo_inline -#endif -#if !defined(__lzo_c99_extern_inline) && (__lzo_HAVE_inline) -# define __lzo_c99_extern_inline __lzo_inline -#endif -#endif -#if defined(__lzo_c99_extern_inline) -# ifndef __lzo_HAVE_c99_extern_inline -# define __lzo_HAVE_c99_extern_inline 1 -# endif -#else -# define __lzo_c99_extern_inline /*empty*/ -#endif -#if !defined(__lzo_may_alias) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_may_alias __attribute__((__may_alias__)) -#elif (LZO_CC_CLANG >= 0x020900ul) -# define __lzo_may_alias __attribute__((__may_alias__)) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1210)) && 0 -# define __lzo_may_alias __attribute__((__may_alias__)) -#elif (LZO_CC_PGI >= 0x0d0a00ul) && 0 -# define __lzo_may_alias __attribute__((__may_alias__)) -#endif -#endif -#if defined(__lzo_may_alias) -# ifndef __lzo_HAVE_may_alias -# define __lzo_HAVE_may_alias 1 -# endif -#else -# define __lzo_may_alias /*empty*/ -#endif -#if !defined(__lzo_noreturn) -#if (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_IBMC >= 700) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_noreturn __attribute__((__noreturn__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) -# define __lzo_noreturn __declspec(noreturn) -#elif (LZO_CC_PGI >= 0x0d0a00ul) -# define __lzo_noreturn __attribute__((__noreturn__)) -#endif -#endif -#if defined(__lzo_noreturn) -# ifndef __lzo_HAVE_noreturn -# define __lzo_HAVE_noreturn 1 -# endif -#else -# define __lzo_noreturn /*empty*/ -#endif -#if !defined(__lzo_nothrow) -#if (LZO_CC_GNUC >= 0x030300ul) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 900)) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_nothrow __attribute__((__nothrow__)) -#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) -# define __lzo_nothrow __declspec(nothrow) -#endif -#endif -#if defined(__lzo_nothrow) -# ifndef __lzo_HAVE_nothrow -# define __lzo_HAVE_nothrow 1 -# endif -#else -# define __lzo_nothrow /*empty*/ -#endif -#if !defined(__lzo_restrict) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_IBMC >= 800) && !defined(__cplusplus) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_IBMC >= 1210) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM) -# define __lzo_restrict __restrict__ -#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) -# define __lzo_restrict __restrict -#elif (LZO_CC_PGI >= 0x0d0a00ul) -# define __lzo_restrict __restrict__ -#endif -#endif -#if defined(__lzo_restrict) -# ifndef __lzo_HAVE_restrict -# define __lzo_HAVE_restrict 1 -# endif -#else -# define __lzo_restrict /*empty*/ -#endif -#if !defined(__lzo_alignof) -#if (LZO_CC_ARMCC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_GHS) && !defined(__cplusplus) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_IBMC >= 600) -# define __lzo_alignof(e) (__lzo_gnuc_extension__ __alignof__(e)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) -# define __lzo_alignof(e) __alignof__(e) -#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_alignof(e) __alignof(e) -#elif (LZO_CC_SUNPROC >= 0x5100) -# define __lzo_alignof(e) __alignof__(e) -#endif -#endif -#if defined(__lzo_alignof) -# ifndef __lzo_HAVE_alignof -# define __lzo_HAVE_alignof 1 -# endif -#endif -#if !defined(__lzo_struct_packed) -#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) -#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) -#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) -#elif (LZO_CC_GNUC >= 0x030400ul) && !(LZO_CC_PCC_GNUC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -# define __lzo_struct_packed(s) struct s { -# define __lzo_struct_packed_end() } __attribute__((__gcc_struct__,__packed__)); -# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__gcc_struct__,__packed__)); -#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) -# define __lzo_struct_packed(s) struct s { -# define __lzo_struct_packed_end() } __attribute__((__packed__)); -# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); -#elif (LZO_CC_IBMC >= 700) -# define __lzo_struct_packed(s) __lzo_gnuc_extension__ struct s { -# define __lzo_struct_packed_end() } __attribute__((__packed__)); -# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); -#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_struct_packed(s) __pragma(pack(push,1)) struct s { -# define __lzo_struct_packed_end() } __pragma(pack(pop)); -#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) -# define __lzo_struct_packed(s) _Packed struct s { -# define __lzo_struct_packed_end() }; -#endif -#endif -#if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma) -# define __lzo_struct_packed_ma(s) __lzo_struct_packed(s) -#endif -#if defined(__lzo_struct_packed_end) && !defined(__lzo_struct_packed_ma_end) -# define __lzo_struct_packed_ma_end() __lzo_struct_packed_end() -#endif -#if !defined(__lzo_byte_struct) -#if defined(__lzo_struct_packed) -# define __lzo_byte_struct(s,n) __lzo_struct_packed(s) unsigned char a[n]; __lzo_struct_packed_end() -# define __lzo_byte_struct_ma(s,n) __lzo_struct_packed_ma(s) unsigned char a[n]; __lzo_struct_packed_ma_end() -#elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_PGI || (LZO_CC_SUNPROC >= 0x5100)) -# define __lzo_byte_struct(s,n) struct s { unsigned char a[n]; } __attribute__((__packed__)); -# define __lzo_byte_struct_ma(s,n) struct s { unsigned char a[n]; } __lzo_may_alias __attribute__((__packed__)); -#endif -#endif -#if defined(__lzo_byte_struct) && !defined(__lzo_byte_struct_ma) -# define __lzo_byte_struct_ma(s,n) __lzo_byte_struct(s,n) -#endif -#if !defined(__lzo_struct_align16) && (__lzo_HAVE_alignof) -#if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul)) -#elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_CILLY || LZO_CC_PCC) -#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_struct_align16(s) struct __declspec(align(16)) s { -# define __lzo_struct_align16_end() }; -# define __lzo_struct_align32(s) struct __declspec(align(32)) s { -# define __lzo_struct_align32_end() }; -# define __lzo_struct_align64(s) struct __declspec(align(64)) s { -# define __lzo_struct_align64_end() }; -#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || (LZO_CC_IBMC >= 700) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_struct_align16(s) struct s { -# define __lzo_struct_align16_end() } __attribute__((__aligned__(16))); -# define __lzo_struct_align32(s) struct s { -# define __lzo_struct_align32_end() } __attribute__((__aligned__(32))); -# define __lzo_struct_align64(s) struct s { -# define __lzo_struct_align64_end() } __attribute__((__aligned__(64))); -#endif -#endif -#if !defined(__lzo_union_um) -#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) -#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER < 810)) -#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) -#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) -#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) -# define __lzo_union_am(s) union s { -# define __lzo_union_am_end() } __lzo_may_alias; -# define __lzo_union_um(s) union s { -# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); -#elif (LZO_CC_IBMC >= 700) -# define __lzo_union_am(s) __lzo_gnuc_extension__ union s { -# define __lzo_union_am_end() } __lzo_may_alias; -# define __lzo_union_um(s) __lzo_gnuc_extension__ union s { -# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); -#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) -# define __lzo_union_um(s) __pragma(pack(push,1)) union s { -# define __lzo_union_um_end() } __pragma(pack(pop)); -#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) -# define __lzo_union_um(s) _Packed union s { -# define __lzo_union_um_end() }; -#endif -#endif -#if !defined(__lzo_union_am) -# define __lzo_union_am(s) union s { -# define __lzo_union_am_end() }; -#endif -#if !defined(__lzo_constructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_constructor __attribute__((__constructor__)) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -# define __lzo_constructor __attribute__((__constructor__,__used__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_constructor __attribute__((__constructor__)) -#endif -#endif -#if defined(__lzo_constructor) -# ifndef __lzo_HAVE_constructor -# define __lzo_HAVE_constructor 1 -# endif -#endif -#if !defined(__lzo_destructor) -#if (LZO_CC_GNUC >= 0x030400ul) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_GNUC >= 0x020700ul) -# define __lzo_destructor __attribute__((__destructor__)) -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) -# define __lzo_destructor __attribute__((__destructor__,__used__)) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_destructor __attribute__((__destructor__)) -#endif -#endif -#if defined(__lzo_destructor) -# ifndef __lzo_HAVE_destructor -# define __lzo_HAVE_destructor 1 -# endif -#endif -#if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) -# error "unexpected configuration - check your compiler defines" -#endif -#if !defined(__lzo_likely) && !defined(__lzo_unlikely) -#if (LZO_CC_GNUC >= 0x030200ul) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_IBMC >= 1010) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#elif (LZO_CC_CLANG && LZO_CC_CLANG_C2) -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define __lzo_likely(e) (__builtin_expect(!!(e),1)) -# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) -#endif -#endif -#if defined(__lzo_likely) -# ifndef __lzo_HAVE_likely -# define __lzo_HAVE_likely 1 -# endif -#else -# define __lzo_likely(e) (e) -#endif -#if defined(__lzo_very_likely) -# ifndef __lzo_HAVE_very_likely -# define __lzo_HAVE_very_likely 1 -# endif -#else -# define __lzo_very_likely(e) __lzo_likely(e) -#endif -#if defined(__lzo_unlikely) -# ifndef __lzo_HAVE_unlikely -# define __lzo_HAVE_unlikely 1 -# endif -#else -# define __lzo_unlikely(e) (e) -#endif -#if defined(__lzo_very_unlikely) -# ifndef __lzo_HAVE_very_unlikely -# define __lzo_HAVE_very_unlikely 1 -# endif -#else -# define __lzo_very_unlikely(e) __lzo_unlikely(e) -#endif -#if !defined(__lzo_loop_forever) -# if (LZO_CC_IBMC) -# define __lzo_loop_forever() LZO_BLOCK_BEGIN for (;;) { ; } LZO_BLOCK_END -# else -# define __lzo_loop_forever() do { ; } while __lzo_cte(1) -# endif -#endif -#if !defined(__lzo_unreachable) -#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul)) && lzo_has_builtin(__builtin_unreachable) -# define __lzo_unreachable() __builtin_unreachable(); -#elif (LZO_CC_GNUC >= 0x040500ul) -# define __lzo_unreachable() __builtin_unreachable(); -#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1300)) && 1 -# define __lzo_unreachable() __builtin_unreachable(); -#endif -#endif -#if defined(__lzo_unreachable) -# ifndef __lzo_HAVE_unreachable -# define __lzo_HAVE_unreachable 1 -# endif -#else -# if 0 -# define __lzo_unreachable() ((void)0); -# else -# define __lzo_unreachable() __lzo_loop_forever(); -# endif -#endif -#if !defined(lzo_unused_funcs_impl) -# if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -# define lzo_unused_funcs_impl(r,f) static r __attribute__((__unused__)) f -# elif 1 && (LZO_CC_BORLANDC || LZO_CC_GNUC) -# define lzo_unused_funcs_impl(r,f) static r f -# else -# define lzo_unused_funcs_impl(r,f) __lzo_static_forceinline r f -# endif -#endif -#ifndef __LZO_CTA_NAME -#if (LZO_CFG_USE_COUNTER) -# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__COUNTER__) -#else -# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__LINE__) -#endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) -# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1u-2*!(e)]; LZO_EXTERN_C_END -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END -# elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020900ul)) && defined(__cplusplus) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN int __LZO_CTA_NAME(lzo_cta_f__)(int [1-2*!(e)]); LZO_EXTERN_C_END -# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__)); LZO_EXTERN_C_END -# else -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-2*!(e)]; LZO_EXTERN_C_END -# endif -#endif -#if !defined(LZO_COMPILE_TIME_ASSERT) -# if (LZO_CC_AZTECC) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];} -# elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030000ul)) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} -# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) -# define LZO_COMPILE_TIME_ASSERT(e) {(void) (0/!!(e));} -# elif (LZO_CC_GNUC >= 0x040700ul) && (LZO_CFG_USE_COUNTER) && defined(__cplusplus) -# define LZO_COMPILE_TIME_ASSERT(e) {enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__));} -# elif (LZO_CC_GNUC >= 0x040700ul) -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} -# elif (LZO_CC_MSC && (_MSC_VER < 900)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) -# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; -# else -# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];} -# endif -#endif -#if (LZO_LANG_ASSEMBLER) -# undef LZO_COMPILE_TIME_ASSERT_HEADER -# define LZO_COMPILE_TIME_ASSERT_HEADER(e) /*empty*/ -#else -LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1) -#if defined(__cplusplus) -extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) } -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3) -#endif -#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) -# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit /*empty*/ -# define __lzo_cdecl_main __cdecl -# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_qsort __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_qsort _stdcall -# else -# define __lzo_cdecl_qsort __cdecl -# endif -# elif (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -# else -# define __lzo_cdecl __cdecl -# define __lzo_cdecl_atexit __cdecl -# define __lzo_cdecl_main __cdecl -# define __lzo_cdecl_qsort __cdecl -# endif -# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) -# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) -# define __lzo_cdecl_sighandler __pascal -# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) -# define __lzo_cdecl_sighandler _stdcall -# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) -# define __lzo_cdecl_sighandler __clrcall -# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) -# if defined(_DLL) -# define __lzo_cdecl_sighandler _far _cdecl _loadds -# elif defined(_MT) -# define __lzo_cdecl_sighandler _far _cdecl -# else -# define __lzo_cdecl_sighandler _cdecl -# endif -# else -# define __lzo_cdecl_sighandler __cdecl -# endif -#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) -# define __lzo_cdecl __cdecl -#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) -# define __lzo_cdecl cdecl -#endif -#if !defined(__lzo_cdecl) -# define __lzo_cdecl /*empty*/ -#endif -#if !defined(__lzo_cdecl_atexit) -# define __lzo_cdecl_atexit /*empty*/ -#endif -#if !defined(__lzo_cdecl_main) -# define __lzo_cdecl_main /*empty*/ -#endif -#if !defined(__lzo_cdecl_qsort) -# define __lzo_cdecl_qsort /*empty*/ -#endif -#if !defined(__lzo_cdecl_sighandler) -# define __lzo_cdecl_sighandler /*empty*/ -#endif -#if !defined(__lzo_cdecl_va) -# define __lzo_cdecl_va __lzo_cdecl -#endif -#if !(LZO_CFG_NO_WINDOWS_H) -#if !defined(LZO_HAVE_WINDOWS_H) -#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) -# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) -# elif ((LZO_OS_WIN32 && defined(__PW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul))) -# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) -# else -# define LZO_HAVE_WINDOWS_H 1 -# endif -#endif -#endif -#endif -#define LZO_SIZEOF_CHAR 1 -#ifndef LZO_SIZEOF_SHORT -#if defined(SIZEOF_SHORT) -# define LZO_SIZEOF_SHORT (SIZEOF_SHORT) -#elif defined(__SIZEOF_SHORT__) -# define LZO_SIZEOF_SHORT (__SIZEOF_SHORT__) -#endif -#endif -#ifndef LZO_SIZEOF_INT -#if defined(SIZEOF_INT) -# define LZO_SIZEOF_INT (SIZEOF_INT) -#elif defined(__SIZEOF_INT__) -# define LZO_SIZEOF_INT (__SIZEOF_INT__) -#endif -#endif -#ifndef LZO_SIZEOF_LONG -#if defined(SIZEOF_LONG) -# define LZO_SIZEOF_LONG (SIZEOF_LONG) -#elif defined(__SIZEOF_LONG__) -# define LZO_SIZEOF_LONG (__SIZEOF_LONG__) -#endif -#endif -#ifndef LZO_SIZEOF_LONG_LONG -#if defined(SIZEOF_LONG_LONG) -# define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) -#elif defined(__SIZEOF_LONG_LONG__) -# define LZO_SIZEOF_LONG_LONG (__SIZEOF_LONG_LONG__) -#endif -#endif -#ifndef LZO_SIZEOF___INT16 -#if defined(SIZEOF___INT16) -# define LZO_SIZEOF___INT16 (SIZEOF___INT16) -#endif -#endif -#ifndef LZO_SIZEOF___INT32 -#if defined(SIZEOF___INT32) -# define LZO_SIZEOF___INT32 (SIZEOF___INT32) -#endif -#endif -#ifndef LZO_SIZEOF___INT64 -#if defined(SIZEOF___INT64) -# define LZO_SIZEOF___INT64 (SIZEOF___INT64) -#endif -#endif -#ifndef LZO_SIZEOF_VOID_P -#if defined(SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) -#elif defined(__SIZEOF_POINTER__) -# define LZO_SIZEOF_VOID_P (__SIZEOF_POINTER__) -#endif -#endif -#ifndef LZO_SIZEOF_SIZE_T -#if defined(SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) -#elif defined(__SIZEOF_SIZE_T__) -# define LZO_SIZEOF_SIZE_T (__SIZEOF_SIZE_T__) -#endif -#endif -#ifndef LZO_SIZEOF_PTRDIFF_T -#if defined(SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) -#elif defined(__SIZEOF_PTRDIFF_T__) -# define LZO_SIZEOF_PTRDIFF_T (__SIZEOF_PTRDIFF_T__) -#endif -#endif -#define __LZO_LSR(x,b) (((x)+0ul) >> (b)) -#if !defined(LZO_SIZEOF_SHORT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_SHORT 8 -# elif (USHRT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,7) == 1) -# define LZO_SIZEOF_SHORT 1 -# elif (__LZO_LSR(USHRT_MAX,15) == 1) -# define LZO_SIZEOF_SHORT 2 -# elif (__LZO_LSR(USHRT_MAX,31) == 1) -# define LZO_SIZEOF_SHORT 4 -# elif (__LZO_LSR(USHRT_MAX,63) == 1) -# define LZO_SIZEOF_SHORT 8 -# elif (__LZO_LSR(USHRT_MAX,127) == 1) -# define LZO_SIZEOF_SHORT 16 -# else -# error "LZO_SIZEOF_SHORT" -# endif -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SHORT == sizeof(short)) -#if !defined(LZO_SIZEOF_INT) -# if (LZO_ARCH_CRAY_PVP) -# define LZO_SIZEOF_INT 8 -# elif (UINT_MAX == LZO_0xffffL) -# define LZO_SIZEOF_INT 2 -# elif (UINT_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,7) == 1) -# define LZO_SIZEOF_INT 1 -# elif (__LZO_LSR(UINT_MAX,15) == 1) -# define LZO_SIZEOF_INT 2 -# elif (__LZO_LSR(UINT_MAX,31) == 1) -# define LZO_SIZEOF_INT 4 -# elif (__LZO_LSR(UINT_MAX,63) == 1) -# define LZO_SIZEOF_INT 8 -# elif (__LZO_LSR(UINT_MAX,127) == 1) -# define LZO_SIZEOF_INT 16 -# else -# error "LZO_SIZEOF_INT" -# endif -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_INT == sizeof(int)) -#if !defined(LZO_SIZEOF_LONG) -# if (ULONG_MAX == LZO_0xffffffffL) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,7) == 1) -# define LZO_SIZEOF_LONG 1 -# elif (__LZO_LSR(ULONG_MAX,15) == 1) -# define LZO_SIZEOF_LONG 2 -# elif (__LZO_LSR(ULONG_MAX,31) == 1) -# define LZO_SIZEOF_LONG 4 -# elif (__LZO_LSR(ULONG_MAX,39) == 1) -# define LZO_SIZEOF_LONG 5 -# elif (__LZO_LSR(ULONG_MAX,63) == 1) -# define LZO_SIZEOF_LONG 8 -# elif (__LZO_LSR(ULONG_MAX,127) == 1) -# define LZO_SIZEOF_LONG 16 -# else -# error "LZO_SIZEOF_LONG" -# endif -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long)) -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -# if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) -# if (LZO_CC_GNUC >= 0x030300ul) -# if ((__LONG_MAX__-0) == (__LONG_LONG_MAX__-0)) -# define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG -# elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) -# define LZO_SIZEOF_LONG_LONG 4 -# endif -# endif -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) -#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) -#if (LZO_ARCH_I086 && LZO_CC_DMC) -#elif (LZO_CC_CILLY) && defined(__GNUC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) -# define LZO_SIZEOF_LONG_LONG 8 -#elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_OS_WIN64 || defined(_WIN64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_DMC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64)) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64)) -# define LZO_SIZEOF___INT64 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64) -# define LZO_SIZEOF_LONG_LONG 8 -#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) -#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define LZO_SIZEOF_LONG_LONG 8 -#endif -#endif -#endif -#if defined(__cplusplus) && (LZO_CC_GNUC) -# if (LZO_CC_GNUC < 0x020800ul) -# undef LZO_SIZEOF_LONG_LONG -# endif -#endif -#if (LZO_CFG_NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#elif defined(__NO_LONG_LONG) -# undef LZO_SIZEOF_LONG_LONG -#elif defined(_NO_LONGLONG) -# undef LZO_SIZEOF_LONG_LONG -#endif -#if !defined(LZO_WORDSIZE) -#if (LZO_ARCH_ALPHA) -# define LZO_WORDSIZE 8 -#elif (LZO_ARCH_AMD64) -# define LZO_WORDSIZE 8 -#elif (LZO_ARCH_ARM64) -# define LZO_WORDSIZE 8 -#elif (LZO_ARCH_AVR) -# define LZO_WORDSIZE 1 -#elif (LZO_ARCH_H8300) -# if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) -# define LZO_WORDSIZE 4 -# else -# define LZO_WORDSIZE 2 -# endif -#elif (LZO_ARCH_I086) -# define LZO_WORDSIZE 2 -#elif (LZO_ARCH_IA64) -# define LZO_WORDSIZE 8 -#elif (LZO_ARCH_M16C) -# define LZO_WORDSIZE 2 -#elif (LZO_ARCH_SPU) -# define LZO_WORDSIZE 4 -#elif (LZO_ARCH_Z80) -# define LZO_WORDSIZE 1 -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_WORDSIZE 8 -#elif (LZO_OS_OS400 || defined(__OS400__)) -# define LZO_WORDSIZE 8 -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_WORDSIZE 8 -#endif -#endif -#if !defined(LZO_SIZEOF_VOID_P) -#if defined(__ILP32__) || defined(__ILP32) || defined(_ILP32) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) -# define LZO_SIZEOF_VOID_P 4 -#elif defined(__ILP64__) || defined(__ILP64) || defined(_ILP64) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 8) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) -# define LZO_SIZEOF_VOID_P 8 -#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) -# define LZO_SIZEOF_VOID_P 8 -#elif defined(__LP64__) || defined(__LP64) || defined(_LP64) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) -# define LZO_SIZEOF_VOID_P 8 -#elif (LZO_ARCH_AVR) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_ARCH_H8300) -# if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) - LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 4) -# if defined(__NORMAL_MODE__) -# define LZO_SIZEOF_VOID_P 2 -# else -# define LZO_SIZEOF_VOID_P 4 -# endif -# else - LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 2) -# define LZO_SIZEOF_VOID_P 2 -# endif -# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT -# endif -#elif (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) -# define LZO_SIZEOF_VOID_P 2 -# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) -# define LZO_SIZEOF_VOID_P 4 -# else -# error "invalid LZO_ARCH_I086 memory model" -# endif -#elif (LZO_ARCH_M16C) -# if defined(__m32c_cpu__) || defined(__m32cm_cpu__) -# define LZO_SIZEOF_VOID_P 4 -# else -# define LZO_SIZEOF_VOID_P 2 -# endif -#elif (LZO_ARCH_SPU) -# define LZO_SIZEOF_VOID_P 4 -#elif (LZO_ARCH_Z80) -# define LZO_SIZEOF_VOID_P 2 -#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) -# define LZO_SIZEOF_VOID_P 4 -#elif (LZO_OS_OS400 || defined(__OS400__)) -# if defined(__LLP64_IFC__) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -# else -# define LZO_SIZEOF_VOID_P 16 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -# endif -#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) -# define LZO_SIZEOF_VOID_P 8 -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG -#endif -#endif -#if !defined(LZO_SIZEOF_VOID_P) -# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG -#endif -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void *)) -#if !defined(LZO_SIZEOF_SIZE_T) -#if (LZO_ARCH_I086 || LZO_ARCH_M16C) -# define LZO_SIZEOF_SIZE_T 2 -#endif -#endif -#if !defined(LZO_SIZEOF_SIZE_T) -# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P -#endif -#if defined(offsetof) -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SIZE_T == sizeof(size_t)) -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -#if (LZO_ARCH_I086) -# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P -# elif (LZO_MM_COMPACT || LZO_MM_LARGE) -# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) -# define LZO_SIZEOF_PTRDIFF_T 4 -# else -# define LZO_SIZEOF_PTRDIFF_T 2 -# endif -# else -# error "invalid LZO_ARCH_I086 memory model" -# endif -#endif -#endif -#if !defined(LZO_SIZEOF_PTRDIFF_T) -# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T -#endif -#if defined(offsetof) -LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t)) -#endif -#if !defined(LZO_WORDSIZE) -# define LZO_WORDSIZE LZO_SIZEOF_VOID_P -#endif -#if (LZO_ABI_NEUTRAL_ENDIAN) -# undef LZO_ABI_BIG_ENDIAN -# undef LZO_ABI_LITTLE_ENDIAN -#elif !(LZO_ABI_BIG_ENDIAN) && !(LZO_ABI_LITTLE_ENDIAN) -#if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) -# define LZO_ABI_BIG_ENDIAN 1 -#elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430 || LZO_ARCH_RISCV) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) -# if (__LITTLE_ENDIAN__ == 1) -# define LZO_ABI_LITTLE_ENDIAN 1 -# else -# define LZO_ABI_BIG_ENDIAN 1 -# endif -#elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM) && defined(_MSC_VER) && defined(_WIN32) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC) -# if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) -# error "unexpected configuration - check your compiler defines" -# elif defined(__BIG_ENDIAN) -# define LZO_ABI_BIG_ENDIAN 1 -# else -# define LZO_ABI_LITTLE_ENDIAN 1 -# endif -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM64) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_ARM64) && defined(_MSC_VER) && defined(_WIN32) -# define LZO_ABI_LITTLE_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) -# define LZO_ABI_BIG_ENDIAN 1 -#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -# define LZO_ABI_LITTLE_ENDIAN 1 -#endif -#endif -#if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN) -# error "unexpected configuration - check your compiler defines" -#endif -#if (LZO_ABI_BIG_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "be" -#elif (LZO_ABI_LITTLE_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "le" -#elif (LZO_ABI_NEUTRAL_ENDIAN) -# define LZO_INFO_ABI_ENDIAN "neutral" -#endif -#if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_I8LP16 1 -# define LZO_INFO_ABI_PM "i8lp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) -# define LZO_ABI_ILP16 1 -# define LZO_INFO_ABI_PM "ilp16" -#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_LP32 1 -# define LZO_INFO_ABI_PM "lp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_ILP32 1 -# define LZO_INFO_ABI_PM "ilp32" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) -# define LZO_ABI_LLP64 1 -# define LZO_INFO_ABI_PM "llp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_LP64 1 -# define LZO_INFO_ABI_PM "lp64" -#elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) -# define LZO_ABI_ILP64 1 -# define LZO_INFO_ABI_PM "ilp64" -#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) -# define LZO_ABI_IP32L64 1 -# define LZO_INFO_ABI_PM "ip32l64" -#endif -#if (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_VOID_P == 4 && LZO_WORDSIZE == 8) -# define LZO_ABI_IP32W64 1 -# ifndef LZO_INFO_ABI_PM -# define LZO_INFO_ABI_PM "ip32w64" -# endif -#endif -#if 0 -#elif !defined(__LZO_LIBC_OVERRIDE) -#if (LZO_LIBC_NAKED) -# define LZO_INFO_LIBC "naked" -#elif (LZO_LIBC_FREESTANDING) -# define LZO_INFO_LIBC "freestanding" -#elif (LZO_LIBC_MOSTLY_FREESTANDING) -# define LZO_INFO_LIBC "mfreestanding" -#elif (LZO_LIBC_ISOC90) -# define LZO_INFO_LIBC "isoc90" -#elif (LZO_LIBC_ISOC99) -# define LZO_INFO_LIBC "isoc99" -#elif (LZO_CC_ARMCC_ARMCC) && defined(__ARMCLIB_VERSION) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#elif defined(__dietlibc__) -# define LZO_LIBC_DIETLIBC 1 -# define LZO_INFO_LIBC "dietlibc" -#elif defined(_NEWLIB_VERSION) -# define LZO_LIBC_NEWLIB 1 -# define LZO_INFO_LIBC "newlib" -#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) -# if defined(__UCLIBC_SUBLEVEL__) -# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + (__UCLIBC_MINOR__-0) * 0x100 + (__UCLIBC_SUBLEVEL__-0)) -# else -# define LZO_LIBC_UCLIBC 0x00090bL -# endif -# define LZO_INFO_LIBC "uc" "libc" -#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) -# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + (__GLIBC_MINOR__-0) * 0x100) -# define LZO_INFO_LIBC "glibc" -#elif (LZO_CC_MWERKS) && defined(__MSL__) -# define LZO_LIBC_MSL __MSL__ -# define LZO_INFO_LIBC "msl" -#elif 1 && defined(__IAR_SYSTEMS_ICC__) -# define LZO_LIBC_ISOC90 1 -# define LZO_INFO_LIBC "isoc90" -#else -# define LZO_LIBC_DEFAULT 1 -# define LZO_INFO_LIBC "default" -#endif -#endif -#if (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -# define LZO_ASM_SYNTAX_MSC 1 -#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) -#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) -#elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) -# define LZO_ASM_SYNTAX_GNUC 1 -#elif (LZO_CC_GNUC) -# define LZO_ASM_SYNTAX_GNUC 1 -#endif -#if (LZO_ASM_SYNTAX_GNUC) -#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) -# define __LZO_ASM_CLOBBER "ax" -# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ -# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY /*empty*/ -# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -#elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1000)) -# define __LZO_ASM_CLOBBER "memory" -# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ -# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "memory" -# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -#else -# define __LZO_ASM_CLOBBER "cc", "memory" -# define __LZO_ASM_CLOBBER_LIST_CC : "cc" -# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "cc", "memory" -# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ -#endif -#endif -#if (LZO_ARCH_ALPHA) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_AMD64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_ARM) -# if defined(__ARM_FEATURE_UNALIGNED) -# if ((__ARM_FEATURE_UNALIGNED)+0) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# endif -# elif 1 && (LZO_ARCH_ARM_THUMB2) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# elif 1 && defined(__ARM_ARCH) && ((__ARM_ARCH)+0 >= 7) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 7) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 6) && (defined(__TARGET_PROFILE_A) || defined(__TARGET_PROFILE_R)) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# elif 1 && defined(_MSC_VER) && defined(_M_ARM) && ((_M_ARM)+0 >= 7) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# endif -#elif (LZO_ARCH_ARM64) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -#elif (LZO_ARCH_CRIS) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_I386) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -#elif (LZO_ARCH_IA64) -# define LZO_OPT_AVOID_INT_INDEX 1 -# define LZO_OPT_AVOID_UINT_INDEX 1 -# define LZO_OPT_PREFER_POSTINC 1 -#elif (LZO_ARCH_M68K) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if defined(__mc68020__) && !defined(__mcoldfire__) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# endif -#elif (LZO_ARCH_MIPS) -# define LZO_OPT_AVOID_UINT_INDEX 1 -#elif (LZO_ARCH_POWERPC) -# define LZO_OPT_PREFER_PREINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -# if (LZO_ABI_BIG_ENDIAN) || (LZO_WORDSIZE == 8) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# if (LZO_WORDSIZE == 8) -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -# endif -# endif -#elif (LZO_ARCH_RISCV) -# define LZO_OPT_AVOID_UINT_INDEX 1 -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# if (LZO_WORDSIZE == 8) -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -# endif -#elif (LZO_ARCH_S390) -# ifndef LZO_OPT_UNALIGNED16 -# define LZO_OPT_UNALIGNED16 1 -# endif -# ifndef LZO_OPT_UNALIGNED32 -# define LZO_OPT_UNALIGNED32 1 -# endif -# if (LZO_WORDSIZE == 8) -# ifndef LZO_OPT_UNALIGNED64 -# define LZO_OPT_UNALIGNED64 1 -# endif -# endif -#elif (LZO_ARCH_SH) -# define LZO_OPT_PREFER_POSTINC 1 -# define LZO_OPT_PREFER_PREDEC 1 -#endif -#ifndef LZO_CFG_NO_INLINE_ASM -#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) -# define LZO_CFG_NO_INLINE_ASM 1 -#elif (LZO_CC_LLVM) -# define LZO_CFG_NO_INLINE_ASM 1 -#endif -#endif -#if (LZO_CFG_NO_INLINE_ASM) -# undef LZO_ASM_SYNTAX_MSC -# undef LZO_ASM_SYNTAX_GNUC -# undef __LZO_ASM_CLOBBER -# undef __LZO_ASM_CLOBBER_LIST_CC -# undef __LZO_ASM_CLOBBER_LIST_CC_MEMORY -# undef __LZO_ASM_CLOBBER_LIST_EMPTY -#endif -#ifndef LZO_CFG_NO_UNALIGNED -#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) -# define LZO_CFG_NO_UNALIGNED 1 -#endif -#endif -#if (LZO_CFG_NO_UNALIGNED) -# undef LZO_OPT_UNALIGNED16 -# undef LZO_OPT_UNALIGNED32 -# undef LZO_OPT_UNALIGNED64 -#endif -#if defined(__LZO_INFOSTR_MM) -#elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) -# define __LZO_INFOSTR_MM "" -#elif defined(LZO_INFO_MM) -# define __LZO_INFOSTR_MM "." LZO_INFO_MM -#else -# define __LZO_INFOSTR_MM "" -#endif -#if defined(__LZO_INFOSTR_PM) -#elif defined(LZO_INFO_ABI_PM) -# define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM -#else -# define __LZO_INFOSTR_PM "" -#endif -#if defined(__LZO_INFOSTR_ENDIAN) -#elif defined(LZO_INFO_ABI_ENDIAN) -# define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN -#else -# define __LZO_INFOSTR_ENDIAN "" -#endif -#if defined(__LZO_INFOSTR_OSNAME) -#elif defined(LZO_INFO_OS_CONSOLE) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE -#elif defined(LZO_INFO_OS_POSIX) -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX -#else -# define __LZO_INFOSTR_OSNAME LZO_INFO_OS -#endif -#if defined(__LZO_INFOSTR_LIBC) -#elif defined(LZO_INFO_LIBC) -# define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC -#else -# define __LZO_INFOSTR_LIBC "" -#endif -#if defined(__LZO_INFOSTR_CCVER) -#elif defined(LZO_INFO_CCVER) -# define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER -#else -# define __LZO_INFOSTR_CCVER "" -#endif -#define LZO_INFO_STRING \ - LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ - " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER -#if !(LZO_CFG_SKIP_LZO_TYPES) -#if (!(LZO_SIZEOF_SHORT+0 > 0 && LZO_SIZEOF_INT+0 > 0 && LZO_SIZEOF_LONG+0 > 0)) -# error "missing defines for sizes" -#endif -#if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0)) -# error "missing defines for sizes" -#endif -#define LZO_TYPEOF_CHAR 1u -#define LZO_TYPEOF_SHORT 2u -#define LZO_TYPEOF_INT 3u -#define LZO_TYPEOF_LONG 4u -#define LZO_TYPEOF_LONG_LONG 5u -#define LZO_TYPEOF___INT8 17u -#define LZO_TYPEOF___INT16 18u -#define LZO_TYPEOF___INT32 19u -#define LZO_TYPEOF___INT64 20u -#define LZO_TYPEOF___INT128 21u -#define LZO_TYPEOF___INT256 22u -#define LZO_TYPEOF___MODE_QI 33u -#define LZO_TYPEOF___MODE_HI 34u -#define LZO_TYPEOF___MODE_SI 35u -#define LZO_TYPEOF___MODE_DI 36u -#define LZO_TYPEOF___MODE_TI 37u -#define LZO_TYPEOF_CHAR_P 129u -#if !defined(lzo_llong_t) -#if (LZO_SIZEOF_LONG_LONG+0 > 0) -# if !(LZO_LANG_ASSEMBLER) - __lzo_gnuc_extension__ typedef long long lzo_llong_t__; - __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__; -# endif -# define lzo_llong_t lzo_llong_t__ -# define lzo_ullong_t lzo_ullong_t__ -#endif -#endif -#if !defined(lzo_int16e_t) -#if (LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) && (LZO_SIZEOF_SHORT != 2) -# undef LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T -#endif -#if (LZO_SIZEOF_LONG == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) -# define lzo_int16e_t long -# define lzo_uint16e_t unsigned long -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_LONG -#elif (LZO_SIZEOF_INT == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) -# define lzo_int16e_t int -# define lzo_uint16e_t unsigned int -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_SHORT == 2) -# define lzo_int16e_t short int -# define lzo_uint16e_t unsigned short int -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_SHORT -#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) -# if !(LZO_LANG_ASSEMBLER) - typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__))); - typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__))); -# endif -# define lzo_int16e_t lzo_int16e_hi_t__ -# define lzo_uint16e_t lzo_uint16e_hi_t__ -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___MODE_HI -#elif (LZO_SIZEOF___INT16 == 2) -# define lzo_int16e_t __int16 -# define lzo_uint16e_t unsigned __int16 -# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___INT16 -#else -#endif -#endif -#if defined(lzo_int16e_t) -# define LZO_SIZEOF_LZO_INT16E_T 2 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T) -#endif -#if !defined(lzo_int32e_t) -#if (LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) && (LZO_SIZEOF_INT != 4) -# undef LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T -#endif -#if (LZO_SIZEOF_LONG == 4) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) -# define lzo_int32e_t long int -# define lzo_uint32e_t unsigned long int -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG -#elif (LZO_SIZEOF_INT == 4) -# define lzo_int32e_t int -# define lzo_uint32e_t unsigned int -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_SHORT == 4) -# define lzo_int32e_t short int -# define lzo_uint32e_t unsigned short int -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_SHORT -#elif (LZO_SIZEOF_LONG_LONG == 4) -# define lzo_int32e_t lzo_llong_t -# define lzo_uint32e_t lzo_ullong_t -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG_LONG -#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L) -# if !(LZO_LANG_ASSEMBLER) - typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); - typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); -# endif -# define lzo_int32e_t lzo_int32e_si_t__ -# define lzo_uint32e_t lzo_uint32e_si_t__ -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI -#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L) -# if !(LZO_LANG_ASSEMBLER) - typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); - typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); -# endif -# define lzo_int32e_t lzo_int32e_si_t__ -# define lzo_uint32e_t lzo_uint32e_si_t__ -# define LZO_INT32_C(c) (c##LL) -# define LZO_UINT32_C(c) (c##ULL) -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI -#elif (LZO_SIZEOF___INT32 == 4) -# define lzo_int32e_t __int32 -# define lzo_uint32e_t unsigned __int32 -# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___INT32 -#else -#endif -#endif -#if defined(lzo_int32e_t) -# define LZO_SIZEOF_LZO_INT32E_T 4 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T) -#endif -#if !defined(lzo_int64e_t) -#if (LZO_SIZEOF___INT64 == 8) -# if (LZO_CC_BORLANDC) && !defined(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T) -# define LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T LZO_TYPEOF___INT64 -# endif -#endif -#if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && (LZO_SIZEOF_LONG_LONG != 8) -# undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T -#endif -#if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) && (LZO_SIZEOF___INT64 != 8) -# undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T -#endif -#if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -# define lzo_int64e_t int -# define lzo_uint64e_t unsigned int -# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) -# define lzo_int64e_t long int -# define lzo_uint64e_t unsigned long int -# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG -#elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) -# define lzo_int64e_t lzo_llong_t -# define lzo_uint64e_t lzo_ullong_t -# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG_LONG -# if (LZO_CC_BORLANDC) -# define LZO_INT64_C(c) ((c) + 0ll) -# define LZO_UINT64_C(c) ((c) + 0ull) -# elif 0 -# define LZO_INT64_C(c) (__lzo_gnuc_extension__ (c##LL)) -# define LZO_UINT64_C(c) (__lzo_gnuc_extension__ (c##ULL)) -# else -# define LZO_INT64_C(c) (c##LL) -# define LZO_UINT64_C(c) (c##ULL) -# endif -#elif (LZO_SIZEOF___INT64 == 8) -# define lzo_int64e_t __int64 -# define lzo_uint64e_t unsigned __int64 -# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF___INT64 -# if (LZO_CC_BORLANDC) -# define LZO_INT64_C(c) ((c) + 0i64) -# define LZO_UINT64_C(c) ((c) + 0ui64) -# else -# define LZO_INT64_C(c) (c##i64) -# define LZO_UINT64_C(c) (c##ui64) -# endif -#else -#endif -#endif -#if defined(lzo_int64e_t) -# define LZO_SIZEOF_LZO_INT64E_T 8 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T) -#endif -#if !defined(lzo_int32l_t) -#if defined(lzo_int32e_t) -# define lzo_int32l_t lzo_int32e_t -# define lzo_uint32l_t lzo_uint32e_t -# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LZO_INT32E_T -# define LZO_TYPEOF_LZO_INT32L_T LZO_TYPEOF_LZO_INT32E_T -#elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -# define lzo_int32l_t int -# define lzo_uint32l_t unsigned int -# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT -# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_INT -#elif (LZO_SIZEOF_LONG >= 4) -# define lzo_int32l_t long int -# define lzo_uint32l_t unsigned long int -# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LONG -# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_LONG -#else -# error "lzo_int32l_t" -#endif -#endif -#if 1 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T) -#endif -#if !defined(lzo_int64l_t) -#if defined(lzo_int64e_t) -# define lzo_int64l_t lzo_int64e_t -# define lzo_uint64l_t lzo_uint64e_t -# define LZO_SIZEOF_LZO_INT64L_T LZO_SIZEOF_LZO_INT64E_T -# define LZO_TYPEOF_LZO_INT64L_T LZO_TYPEOF_LZO_INT64E_T -#else -#endif -#endif -#if defined(lzo_int64l_t) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T) -#endif -#if !defined(lzo_int32f_t) -#if (LZO_SIZEOF_SIZE_T >= 8) -# define lzo_int32f_t lzo_int64l_t -# define lzo_uint32f_t lzo_uint64l_t -# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT64L_T -# define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT64L_T -#else -# define lzo_int32f_t lzo_int32l_t -# define lzo_uint32f_t lzo_uint32l_t -# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT32L_T -# define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT32L_T -#endif -#endif -#if 1 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T) -#endif -#if !defined(lzo_int64f_t) -#if defined(lzo_int64l_t) -# define lzo_int64f_t lzo_int64l_t -# define lzo_uint64f_t lzo_uint64l_t -# define LZO_SIZEOF_LZO_INT64F_T LZO_SIZEOF_LZO_INT64L_T -# define LZO_TYPEOF_LZO_INT64F_T LZO_TYPEOF_LZO_INT64L_T -#else -#endif -#endif -#if defined(lzo_int64f_t) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T) -#endif -#if !defined(lzo_intptr_t) -#if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16)) -# define __LZO_INTPTR_T_IS_POINTER 1 -# if !(LZO_LANG_ASSEMBLER) - typedef char * lzo_intptr_t; - typedef char * lzo_uintptr_t; -# endif -# define lzo_intptr_t lzo_intptr_t -# define lzo_uintptr_t lzo_uintptr_t -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_CHAR_P -#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4)) -# if !(LZO_LANG_ASSEMBLER) - typedef __w64 int lzo_intptr_t; - typedef __w64 unsigned int lzo_uintptr_t; -# endif -# define lzo_intptr_t lzo_intptr_t -# define lzo_uintptr_t lzo_uintptr_t -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P) -# define lzo_intptr_t short -# define lzo_uintptr_t unsigned short -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_SHORT -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_SHORT -#elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) -# define lzo_intptr_t int -# define lzo_uintptr_t unsigned int -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT -#elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P) -# define lzo_intptr_t long -# define lzo_uintptr_t unsigned long -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LONG -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LONG -#elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P) -# define lzo_intptr_t lzo_int64l_t -# define lzo_uintptr_t lzo_uint64l_t -# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LZO_INT64L_T -# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LZO_INT64L_T -#else -# error "lzo_intptr_t" -#endif -#endif -#if 1 - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void *)) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t)) -#endif -#if !defined(lzo_word_t) -#if defined(LZO_WORDSIZE) && (LZO_WORDSIZE+0 > 0) -#if (LZO_WORDSIZE == LZO_SIZEOF_LZO_INTPTR_T) && !(__LZO_INTPTR_T_IS_POINTER) -# define lzo_word_t lzo_uintptr_t -# define lzo_sword_t lzo_intptr_t -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LZO_INTPTR_T -#elif (LZO_WORDSIZE == LZO_SIZEOF_LONG) -# define lzo_word_t unsigned long -# define lzo_sword_t long -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LONG -#elif (LZO_WORDSIZE == LZO_SIZEOF_INT) -# define lzo_word_t unsigned int -# define lzo_sword_t int -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_INT -#elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT) -# define lzo_word_t unsigned short -# define lzo_sword_t short -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_SHORT -#elif (LZO_WORDSIZE == 1) -# define lzo_word_t unsigned char -# define lzo_sword_t signed char -# define LZO_SIZEOF_LZO_WORD_T 1 -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_CHAR -#elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T) -# define lzo_word_t lzo_uint64l_t -# define lzo_sword_t lzo_int64l_t -# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T -# define LZO_TYPEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T -#elif (LZO_ARCH_SPU) && (LZO_CC_GNUC) -#if 0 -# if !(LZO_LANG_ASSEMBLER) - typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__))); - typedef int lzo_sword_t __attribute__((__mode__(__V16QI__))); -# endif -# define lzo_word_t lzo_word_t -# define lzo_sword_t lzo_sword_t -# define LZO_SIZEOF_LZO_WORD_T 16 -# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF___MODE_V16QI -#endif -#else -# error "lzo_word_t" -#endif -#endif -#endif -#if 1 && defined(lzo_word_t) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t) == LZO_WORDSIZE) - LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE) -#endif -#if 1 -#define lzo_int8_t signed char -#define lzo_uint8_t unsigned char -#define LZO_SIZEOF_LZO_INT8_T 1 -#define LZO_TYPEOF_LZO_INT8_T LZO_TYPEOF_CHAR -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t)) -#endif -#if defined(lzo_int16e_t) -#define lzo_int16_t lzo_int16e_t -#define lzo_uint16_t lzo_uint16e_t -#define LZO_SIZEOF_LZO_INT16_T LZO_SIZEOF_LZO_INT16E_T -#define LZO_TYPEOF_LZO_INT16_T LZO_TYPEOF_LZO_INT16E_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t)) -#endif -#if defined(lzo_int32e_t) -#define lzo_int32_t lzo_int32e_t -#define lzo_uint32_t lzo_uint32e_t -#define LZO_SIZEOF_LZO_INT32_T LZO_SIZEOF_LZO_INT32E_T -#define LZO_TYPEOF_LZO_INT32_T LZO_TYPEOF_LZO_INT32E_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t)) -#endif -#if defined(lzo_int64e_t) -#define lzo_int64_t lzo_int64e_t -#define lzo_uint64_t lzo_uint64e_t -#define LZO_SIZEOF_LZO_INT64_T LZO_SIZEOF_LZO_INT64E_T -#define LZO_TYPEOF_LZO_INT64_T LZO_TYPEOF_LZO_INT64E_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t)) -#endif -#if 1 -#define lzo_int_least32_t lzo_int32l_t -#define lzo_uint_least32_t lzo_uint32l_t -#define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T -#define LZO_TYPEOF_LZO_INT_LEAST32_T LZO_TYPEOF_LZO_INT32L_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t)) -#endif -#if defined(lzo_int64l_t) -#define lzo_int_least64_t lzo_int64l_t -#define lzo_uint_least64_t lzo_uint64l_t -#define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T -#define LZO_TYPEOF_LZO_INT_LEAST64_T LZO_TYPEOF_LZO_INT64L_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t)) -#endif -#if 1 -#define lzo_int_fast32_t lzo_int32f_t -#define lzo_uint_fast32_t lzo_uint32f_t -#define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T -#define LZO_TYPEOF_LZO_INT_FAST32_T LZO_TYPEOF_LZO_INT32F_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t)) -#endif -#if defined(lzo_int64f_t) -#define lzo_int_fast64_t lzo_int64f_t -#define lzo_uint_fast64_t lzo_uint64f_t -#define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T -#define LZO_TYPEOF_LZO_INT_FAST64_T LZO_TYPEOF_LZO_INT64F_T -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t)) -#endif -#if !defined(LZO_INT16_C) -# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 2) -# define LZO_INT16_C(c) ((c) + 0) -# define LZO_UINT16_C(c) ((c) + 0U) -# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 2) -# define LZO_INT16_C(c) ((c) + 0L) -# define LZO_UINT16_C(c) ((c) + 0UL) -# elif (LZO_SIZEOF_INT >= 2) -# define LZO_INT16_C(c) (c) -# define LZO_UINT16_C(c) (c##U) -# elif (LZO_SIZEOF_LONG >= 2) -# define LZO_INT16_C(c) (c##L) -# define LZO_UINT16_C(c) (c##UL) -# else -# error "LZO_INT16_C" -# endif -#endif -#if !defined(LZO_INT32_C) -# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 4) -# define LZO_INT32_C(c) ((c) + 0) -# define LZO_UINT32_C(c) ((c) + 0U) -# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 4) -# define LZO_INT32_C(c) ((c) + 0L) -# define LZO_UINT32_C(c) ((c) + 0UL) -# elif (LZO_SIZEOF_INT >= 4) -# define LZO_INT32_C(c) (c) -# define LZO_UINT32_C(c) (c##U) -# elif (LZO_SIZEOF_LONG >= 4) -# define LZO_INT32_C(c) (c##L) -# define LZO_UINT32_C(c) (c##UL) -# elif (LZO_SIZEOF_LONG_LONG >= 4) -# define LZO_INT32_C(c) (c##LL) -# define LZO_UINT32_C(c) (c##ULL) -# else -# error "LZO_INT32_C" -# endif -#endif -#if !defined(LZO_INT64_C) && defined(lzo_int64l_t) -# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 8) -# define LZO_INT64_C(c) ((c) + 0) -# define LZO_UINT64_C(c) ((c) + 0U) -# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 8) -# define LZO_INT64_C(c) ((c) + 0L) -# define LZO_UINT64_C(c) ((c) + 0UL) -# elif (LZO_SIZEOF_INT >= 8) -# define LZO_INT64_C(c) (c) -# define LZO_UINT64_C(c) (c##U) -# elif (LZO_SIZEOF_LONG >= 8) -# define LZO_INT64_C(c) (c##L) -# define LZO_UINT64_C(c) (c##UL) -# else -# error "LZO_INT64_C" -# endif -#endif -#endif - -#endif - -#endif - -#undef LZO_HAVE_CONFIG_H -#include "minilzo.h" - -#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x20a0) -# error "version mismatch in miniLZO source files" -#endif - -#ifdef MINILZO_HAVE_CONFIG_H -# define LZO_HAVE_CONFIG_H 1 -#endif - -#ifndef __LZO_CONF_H -#define __LZO_CONF_H 1 - -#if !defined(__LZO_IN_MINILZO) -#if defined(LZO_CFG_FREESTANDING) && (LZO_CFG_FREESTANDING) -# define LZO_LIBC_FREESTANDING 1 -# define LZO_OS_FREESTANDING 1 -#endif -#if defined(LZO_CFG_EXTRA_CONFIG_HEADER) -# include LZO_CFG_EXTRA_CONFIG_HEADER -#endif -#if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED) -# error "include this file first" -#endif -#if defined(LZO_CFG_BUILD_DLL) && (LZO_CFG_BUILD_DLL+0) && !defined(__LZO_EXPORT1) && !defined(__LZO_EXPORT2) && 0 -#ifndef __LZODEFS_H_INCLUDED -#if defined(LZO_HAVE_CONFIG_H) -# include -#endif -#include -#include -#include -#endif -#endif -#include -#if defined(LZO_CFG_EXTRA_CONFIG_HEADER2) -# include LZO_CFG_EXTRA_CONFIG_HEADER2 -#endif -#endif - -#if !defined(__LZOCONF_H_INCLUDED) || (LZO_VERSION+0 != 0x20a0) -# error "version mismatch" -#endif - -#if (LZO_CC_MSC && (_MSC_VER >= 1000 && _MSC_VER < 1100)) -# pragma warning(disable: 4702) -#endif -#if (LZO_CC_MSC && (_MSC_VER >= 1000)) -# pragma warning(disable: 4127 4701) -# pragma warning(disable: 4514 4710 4711) -#endif -#if (LZO_CC_MSC && (_MSC_VER >= 1300)) -# pragma warning(disable: 4820) -#endif -#if (LZO_CC_MSC && (_MSC_VER >= 1800)) -# pragma warning(disable: 4746) -#endif -#if (LZO_CC_INTELC && (__INTEL_COMPILER >= 900)) -# pragma warning(disable: 1684) -#endif - -#if (LZO_CC_SUNPROC) -#if !defined(__cplusplus) -# pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED) -# pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP) -# pragma error_messages(off,E_STATEMENT_NOT_REACHED) -#endif -#endif - -#if !defined(__LZO_NOEXPORT1) -# define __LZO_NOEXPORT1 /*empty*/ -#endif -#if !defined(__LZO_NOEXPORT2) -# define __LZO_NOEXPORT2 /*empty*/ -#endif - -#if 1 -# define LZO_PUBLIC_DECL(r) LZO_EXTERN(r) -#endif -#if 1 -# define LZO_PUBLIC_IMPL(r) LZO_PUBLIC(r) -#endif -#if !defined(LZO_LOCAL_DECL) -# define LZO_LOCAL_DECL(r) __LZO_EXTERN_C LZO_LOCAL_IMPL(r) -#endif -#if !defined(LZO_LOCAL_IMPL) -# define LZO_LOCAL_IMPL(r) __LZO_NOEXPORT1 r __LZO_NOEXPORT2 __LZO_CDECL -#endif -#if 1 -# define LZO_STATIC_DECL(r) LZO_PRIVATE(r) -#endif -#if 1 -# define LZO_STATIC_IMPL(r) LZO_PRIVATE(r) -#endif - -#if defined(__LZO_IN_MINILZO) || (LZO_CFG_FREESTANDING) -#elif 1 -# include -#else -# define LZO_WANT_ACC_INCD_H 1 -#endif -#if defined(LZO_HAVE_CONFIG_H) -# define LZO_CFG_NO_CONFIG_HEADER 1 -#endif - -#if 1 && !defined(LZO_CFG_FREESTANDING) -#if 1 && !defined(HAVE_STRING_H) -#define HAVE_STRING_H 1 -#endif -#if 1 && !defined(HAVE_MEMCMP) -#define HAVE_MEMCMP 1 -#endif -#if 1 && !defined(HAVE_MEMCPY) -#define HAVE_MEMCPY 1 -#endif -#if 1 && !defined(HAVE_MEMMOVE) -#define HAVE_MEMMOVE 1 -#endif -#if 1 && !defined(HAVE_MEMSET) -#define HAVE_MEMSET 1 -#endif -#endif - -#if 1 && defined(HAVE_STRING_H) -#include -#endif - -#if 1 || defined(lzo_int8_t) || defined(lzo_uint8_t) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint8_t) == 1) -#endif -#if 1 || defined(lzo_int16_t) || defined(lzo_uint16_t) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint16_t) == 2) -#endif -#if 1 || defined(lzo_int32_t) || defined(lzo_uint32_t) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32_t) == 4) -#endif -#if defined(lzo_int64_t) || defined(lzo_uint64_t) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint64_t) == 8) -#endif - -#if (LZO_CFG_FREESTANDING) -# undef HAVE_MEMCMP -# undef HAVE_MEMCPY -# undef HAVE_MEMMOVE -# undef HAVE_MEMSET -#endif - -#if !(HAVE_MEMCMP) -# undef memcmp -# define memcmp(a,b,c) lzo_memcmp(a,b,c) -#else -# undef lzo_memcmp -# define lzo_memcmp(a,b,c) memcmp(a,b,c) -#endif -#if !(HAVE_MEMCPY) -# undef memcpy -# define memcpy(a,b,c) lzo_memcpy(a,b,c) -#else -# undef lzo_memcpy -# define lzo_memcpy(a,b,c) memcpy(a,b,c) -#endif -#if !(HAVE_MEMMOVE) -# undef memmove -# define memmove(a,b,c) lzo_memmove(a,b,c) -#else -# undef lzo_memmove -# define lzo_memmove(a,b,c) memmove(a,b,c) -#endif -#if !(HAVE_MEMSET) -# undef memset -# define memset(a,b,c) lzo_memset(a,b,c) -#else -# undef lzo_memset -# define lzo_memset(a,b,c) memset(a,b,c) -#endif - -#undef NDEBUG -#if (LZO_CFG_FREESTANDING) -# undef LZO_DEBUG -# define NDEBUG 1 -# undef assert -# define assert(e) ((void)0) -#else -# if !defined(LZO_DEBUG) -# define NDEBUG 1 -# endif -# include -#endif - -#if 0 && defined(__BOUNDS_CHECKING_ON) -# include -#else -# define BOUNDS_CHECKING_OFF_DURING(stmt) stmt -# define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) -#endif - -#if (LZO_CFG_PGO) -# undef __lzo_likely -# undef __lzo_unlikely -# define __lzo_likely(e) (e) -# define __lzo_unlikely(e) (e) -#endif - -#undef _ -#undef __ -#undef ___ -#undef ____ -#undef _p0 -#undef _p1 -#undef _p2 -#undef _p3 -#undef _p4 -#undef _s0 -#undef _s1 -#undef _s2 -#undef _s3 -#undef _s4 -#undef _ww - -#if 1 -# define LZO_BYTE(x) ((unsigned char) (x)) -#else -# define LZO_BYTE(x) ((unsigned char) ((x) & 0xff)) -#endif - -#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b)) -#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b)) -#define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c)) -#define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c)) - -#define lzo_sizeof(type) ((lzo_uint) (sizeof(type))) - -#define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array)))) - -#define LZO_SIZE(bits) (1u << (bits)) -#define LZO_MASK(bits) (LZO_SIZE(bits) - 1) - -#define LZO_USIZE(bits) ((lzo_uint) 1 << (bits)) -#define LZO_UMASK(bits) (LZO_USIZE(bits) - 1) - -#if !defined(DMUL) -#if 0 - -# define DMUL(a,b) ((lzo_xint) ((lzo_uint32_t)(a) * (lzo_uint32_t)(b))) -#else -# define DMUL(a,b) ((lzo_xint) ((a) * (b))) -#endif -#endif - -#ifndef __LZO_FUNC_H -#define __LZO_FUNC_H 1 - -#if !defined(LZO_BITOPS_USE_ASM_BITSCAN) && !defined(LZO_BITOPS_USE_GNUC_BITSCAN) && !defined(LZO_BITOPS_USE_MSC_BITSCAN) -#if 1 && (LZO_ARCH_AMD64) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_ASM_SYNTAX_GNUC) -#define LZO_BITOPS_USE_ASM_BITSCAN 1 -#elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_LLVM && (!defined(__llvm_tools_version__) || (__llvm_tools_version__+0 >= 0x010500ul)))) -#define LZO_BITOPS_USE_GNUC_BITSCAN 1 -#elif (LZO_OS_WIN32 || LZO_OS_WIN64) && ((LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 1010)) || (LZO_CC_MSC && (_MSC_VER >= 1400))) -#define LZO_BITOPS_USE_MSC_BITSCAN 1 -#if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -#include -#endif -#if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) -#pragma intrinsic(_BitScanReverse) -#pragma intrinsic(_BitScanForward) -#endif -#if (LZO_CC_MSC) && (LZO_ARCH_AMD64) -#pragma intrinsic(_BitScanReverse64) -#pragma intrinsic(_BitScanForward64) -#endif -#endif -#endif - -__lzo_static_forceinline unsigned lzo_bitops_ctlz32_func(lzo_uint32_t v) -{ -#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) - unsigned long r; (void) _BitScanReverse(&r, v); return (unsigned) r ^ 31; -#define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v) -#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) - lzo_uint32_t r; - __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); - return (unsigned) r ^ 31; -#define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v) -#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT == 4) - unsigned r; r = (unsigned) __builtin_clz(v); return r; -#define lzo_bitops_ctlz32(v) ((unsigned) __builtin_clz(v)) -#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8) - unsigned r; r = (unsigned) __builtin_clzl(v); return r ^ 32; -#define lzo_bitops_ctlz32(v) (((unsigned) __builtin_clzl(v)) ^ 32) -#else - LZO_UNUSED(v); return 0; -#endif -} - -#if defined(lzo_uint64_t) -__lzo_static_forceinline unsigned lzo_bitops_ctlz64_func(lzo_uint64_t v) -{ -#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64) - unsigned long r; (void) _BitScanReverse64(&r, v); return (unsigned) r ^ 63; -#define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v) -#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC) - lzo_uint64_t r; - __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); - return (unsigned) r ^ 63; -#define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v) -#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8) - unsigned r; r = (unsigned) __builtin_clzl(v); return r; -#define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzl(v)) -#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG == 8) && (LZO_WORDSIZE >= 8) - unsigned r; r = (unsigned) __builtin_clzll(v); return r; -#define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzll(v)) -#else - LZO_UNUSED(v); return 0; -#endif -} -#endif - -__lzo_static_forceinline unsigned lzo_bitops_cttz32_func(lzo_uint32_t v) -{ -#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) - unsigned long r; (void) _BitScanForward(&r, v); return (unsigned) r; -#define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v) -#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) - lzo_uint32_t r; - __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); - return (unsigned) r; -#define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v) -#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT >= 4) - unsigned r; r = (unsigned) __builtin_ctz(v); return r; -#define lzo_bitops_cttz32(v) ((unsigned) __builtin_ctz(v)) -#else - LZO_UNUSED(v); return 0; -#endif -} - -#if defined(lzo_uint64_t) -__lzo_static_forceinline unsigned lzo_bitops_cttz64_func(lzo_uint64_t v) -{ -#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64) - unsigned long r; (void) _BitScanForward64(&r, v); return (unsigned) r; -#define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v) -#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC) - lzo_uint64_t r; - __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); - return (unsigned) r; -#define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v) -#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG >= 8) && (LZO_WORDSIZE >= 8) - unsigned r; r = (unsigned) __builtin_ctzl(v); return r; -#define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzl(v)) -#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG >= 8) && (LZO_WORDSIZE >= 8) - unsigned r; r = (unsigned) __builtin_ctzll(v); return r; -#define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzll(v)) -#else - LZO_UNUSED(v); return 0; -#endif -} -#endif - -lzo_unused_funcs_impl(void, lzo_bitops_unused_funcs)(void) -{ - LZO_UNUSED_FUNC(lzo_bitops_unused_funcs); - LZO_UNUSED_FUNC(lzo_bitops_ctlz32_func); - LZO_UNUSED_FUNC(lzo_bitops_cttz32_func); -#if defined(lzo_uint64_t) - LZO_UNUSED_FUNC(lzo_bitops_ctlz64_func); - LZO_UNUSED_FUNC(lzo_bitops_cttz64_func); -#endif -} - -#if defined(__lzo_alignof) && !(LZO_CFG_NO_UNALIGNED) -#if !defined(lzo_memops_tcheck__) && 0 -#define lzo_memops_tcheck__(t,a,b) ((void)0, sizeof(t) == (a) && __lzo_alignof(t) == (b)) -#endif -#endif -#ifndef lzo_memops_TU0p -#define lzo_memops_TU0p void __LZO_MMODEL * -#endif -#ifndef lzo_memops_TU1p -#define lzo_memops_TU1p unsigned char __LZO_MMODEL * -#endif -#ifndef lzo_memops_TU2p -#if (LZO_OPT_UNALIGNED16) -typedef lzo_uint16_t __lzo_may_alias lzo_memops_TU2; -#define lzo_memops_TU2p volatile lzo_memops_TU2 * -#elif defined(__lzo_byte_struct) -__lzo_byte_struct(lzo_memops_TU2_struct,2) -typedef struct lzo_memops_TU2_struct lzo_memops_TU2; -#else -struct lzo_memops_TU2_struct { unsigned char a[2]; } __lzo_may_alias; -typedef struct lzo_memops_TU2_struct lzo_memops_TU2; -#endif -#ifndef lzo_memops_TU2p -#define lzo_memops_TU2p lzo_memops_TU2 * -#endif -#endif -#ifndef lzo_memops_TU4p -#if (LZO_OPT_UNALIGNED32) -typedef lzo_uint32_t __lzo_may_alias lzo_memops_TU4; -#define lzo_memops_TU4p volatile lzo_memops_TU4 __LZO_MMODEL * -#elif defined(__lzo_byte_struct) -__lzo_byte_struct(lzo_memops_TU4_struct,4) -typedef struct lzo_memops_TU4_struct lzo_memops_TU4; -#else -struct lzo_memops_TU4_struct { unsigned char a[4]; } __lzo_may_alias; -typedef struct lzo_memops_TU4_struct lzo_memops_TU4; -#endif -#ifndef lzo_memops_TU4p -#define lzo_memops_TU4p lzo_memops_TU4 __LZO_MMODEL * -#endif -#endif -#ifndef lzo_memops_TU8p -#if (LZO_OPT_UNALIGNED64) -typedef lzo_uint64_t __lzo_may_alias lzo_memops_TU8; -#define lzo_memops_TU8p volatile lzo_memops_TU8 __LZO_MMODEL * -#elif defined(__lzo_byte_struct) -__lzo_byte_struct(lzo_memops_TU8_struct,8) -typedef struct lzo_memops_TU8_struct lzo_memops_TU8; -#else -struct lzo_memops_TU8_struct { unsigned char a[8]; } __lzo_may_alias; -typedef struct lzo_memops_TU8_struct lzo_memops_TU8; -#endif -#ifndef lzo_memops_TU8p -#define lzo_memops_TU8p lzo_memops_TU8 __LZO_MMODEL * -#endif -#endif -#ifndef lzo_memops_set_TU1p -#define lzo_memops_set_TU1p volatile lzo_memops_TU1p -#endif -#ifndef lzo_memops_move_TU1p -#define lzo_memops_move_TU1p lzo_memops_TU1p -#endif -#define LZO_MEMOPS_SET1(dd,cc) \ - LZO_BLOCK_BEGIN \ - lzo_memops_set_TU1p d__1 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ - d__1[0] = LZO_BYTE(cc); \ - LZO_BLOCK_END -#define LZO_MEMOPS_SET2(dd,cc) \ - LZO_BLOCK_BEGIN \ - lzo_memops_set_TU1p d__2 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ - d__2[0] = LZO_BYTE(cc); d__2[1] = LZO_BYTE(cc); \ - LZO_BLOCK_END -#define LZO_MEMOPS_SET3(dd,cc) \ - LZO_BLOCK_BEGIN \ - lzo_memops_set_TU1p d__3 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ - d__3[0] = LZO_BYTE(cc); d__3[1] = LZO_BYTE(cc); d__3[2] = LZO_BYTE(cc); \ - LZO_BLOCK_END -#define LZO_MEMOPS_SET4(dd,cc) \ - LZO_BLOCK_BEGIN \ - lzo_memops_set_TU1p d__4 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ - d__4[0] = LZO_BYTE(cc); d__4[1] = LZO_BYTE(cc); d__4[2] = LZO_BYTE(cc); d__4[3] = LZO_BYTE(cc); \ - LZO_BLOCK_END -#define LZO_MEMOPS_MOVE1(dd,ss) \ - LZO_BLOCK_BEGIN \ - lzo_memops_move_TU1p d__1 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ - const lzo_memops_move_TU1p s__1 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ - d__1[0] = s__1[0]; \ - LZO_BLOCK_END -#define LZO_MEMOPS_MOVE2(dd,ss) \ - LZO_BLOCK_BEGIN \ - lzo_memops_move_TU1p d__2 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ - const lzo_memops_move_TU1p s__2 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ - d__2[0] = s__2[0]; d__2[1] = s__2[1]; \ - LZO_BLOCK_END -#define LZO_MEMOPS_MOVE3(dd,ss) \ - LZO_BLOCK_BEGIN \ - lzo_memops_move_TU1p d__3 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ - const lzo_memops_move_TU1p s__3 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ - d__3[0] = s__3[0]; d__3[1] = s__3[1]; d__3[2] = s__3[2]; \ - LZO_BLOCK_END -#define LZO_MEMOPS_MOVE4(dd,ss) \ - LZO_BLOCK_BEGIN \ - lzo_memops_move_TU1p d__4 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ - const lzo_memops_move_TU1p s__4 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ - d__4[0] = s__4[0]; d__4[1] = s__4[1]; d__4[2] = s__4[2]; d__4[3] = s__4[3]; \ - LZO_BLOCK_END -#define LZO_MEMOPS_MOVE8(dd,ss) \ - LZO_BLOCK_BEGIN \ - lzo_memops_move_TU1p d__8 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ - const lzo_memops_move_TU1p s__8 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ - d__8[0] = s__8[0]; d__8[1] = s__8[1]; d__8[2] = s__8[2]; d__8[3] = s__8[3]; \ - d__8[4] = s__8[4]; d__8[5] = s__8[5]; d__8[6] = s__8[6]; d__8[7] = s__8[7]; \ - LZO_BLOCK_END -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU1p)0)==1) -#define LZO_MEMOPS_COPY1(dd,ss) LZO_MEMOPS_MOVE1(dd,ss) -#if (LZO_OPT_UNALIGNED16) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2) -#define LZO_MEMOPS_COPY2(dd,ss) \ - * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss) -#elif defined(lzo_memops_tcheck__) -#define LZO_MEMOPS_COPY2(dd,ss) \ - LZO_BLOCK_BEGIN if (lzo_memops_tcheck__(lzo_memops_TU2,2,1)) { \ - * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss); \ - } else { LZO_MEMOPS_MOVE2(dd,ss); } LZO_BLOCK_END -#else -#define LZO_MEMOPS_COPY2(dd,ss) LZO_MEMOPS_MOVE2(dd,ss) -#endif -#if (LZO_OPT_UNALIGNED32) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4) -#define LZO_MEMOPS_COPY4(dd,ss) \ - * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss) -#elif defined(lzo_memops_tcheck__) -#define LZO_MEMOPS_COPY4(dd,ss) \ - LZO_BLOCK_BEGIN if (lzo_memops_tcheck__(lzo_memops_TU4,4,1)) { \ - * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss); \ - } else { LZO_MEMOPS_MOVE4(dd,ss); } LZO_BLOCK_END -#else -#define LZO_MEMOPS_COPY4(dd,ss) LZO_MEMOPS_MOVE4(dd,ss) -#endif -#if (LZO_WORDSIZE != 8) -#define LZO_MEMOPS_COPY8(dd,ss) \ - LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END -#else -#if (LZO_OPT_UNALIGNED64) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8) -#define LZO_MEMOPS_COPY8(dd,ss) \ - * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss) -#elif (LZO_OPT_UNALIGNED32) -#define LZO_MEMOPS_COPY8(dd,ss) \ - LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END -#elif defined(lzo_memops_tcheck__) -#define LZO_MEMOPS_COPY8(dd,ss) \ - LZO_BLOCK_BEGIN if (lzo_memops_tcheck__(lzo_memops_TU8,8,1)) { \ - * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss); \ - } else { LZO_MEMOPS_MOVE8(dd,ss); } LZO_BLOCK_END -#else -#define LZO_MEMOPS_COPY8(dd,ss) LZO_MEMOPS_MOVE8(dd,ss) -#endif -#endif -#define LZO_MEMOPS_COPYN(dd,ss,nn) \ - LZO_BLOCK_BEGIN \ - lzo_memops_TU1p d__n = (lzo_memops_TU1p) (lzo_memops_TU0p) (dd); \ - const lzo_memops_TU1p s__n = (const lzo_memops_TU1p) (const lzo_memops_TU0p) (ss); \ - lzo_uint n__n = (nn); \ - while ((void)0, n__n >= 8) { LZO_MEMOPS_COPY8(d__n, s__n); d__n += 8; s__n += 8; n__n -= 8; } \ - if ((void)0, n__n >= 4) { LZO_MEMOPS_COPY4(d__n, s__n); d__n += 4; s__n += 4; n__n -= 4; } \ - if ((void)0, n__n > 0) do { *d__n++ = *s__n++; } while (--n__n > 0); \ - LZO_BLOCK_END - -__lzo_static_forceinline lzo_uint16_t lzo_memops_get_le16(const lzo_voidp ss) -{ - lzo_uint16_t v; -#if (LZO_ABI_LITTLE_ENDIAN) - LZO_MEMOPS_COPY2(&v, ss); -#elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) - const lzo_memops_TU2p s = (const lzo_memops_TU2p) ss; - unsigned long vv; - __asm__("lhbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s)); - v = (lzo_uint16_t) vv; -#else - const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss; - v = (lzo_uint16_t) (((lzo_uint16_t)s[0]) | ((lzo_uint16_t)s[1] << 8)); -#endif - return v; -} -#if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) -#define LZO_MEMOPS_GET_LE16(ss) (* (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss)) -#else -#define LZO_MEMOPS_GET_LE16(ss) lzo_memops_get_le16(ss) -#endif - -__lzo_static_forceinline lzo_uint32_t lzo_memops_get_le32(const lzo_voidp ss) -{ - lzo_uint32_t v; -#if (LZO_ABI_LITTLE_ENDIAN) - LZO_MEMOPS_COPY4(&v, ss); -#elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) - const lzo_memops_TU4p s = (const lzo_memops_TU4p) ss; - unsigned long vv; - __asm__("lwbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s)); - v = (lzo_uint32_t) vv; -#else - const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss; - v = (lzo_uint32_t) (((lzo_uint32_t)s[0]) | ((lzo_uint32_t)s[1] << 8) | ((lzo_uint32_t)s[2] << 16) | ((lzo_uint32_t)s[3] << 24)); -#endif - return v; -} -#if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN) -#define LZO_MEMOPS_GET_LE32(ss) (* (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss)) -#else -#define LZO_MEMOPS_GET_LE32(ss) lzo_memops_get_le32(ss) -#endif - -#if (LZO_OPT_UNALIGNED64) && (LZO_ABI_LITTLE_ENDIAN) -#define LZO_MEMOPS_GET_LE64(ss) (* (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss)) -#endif - -__lzo_static_forceinline lzo_uint16_t lzo_memops_get_ne16(const lzo_voidp ss) -{ - lzo_uint16_t v; - LZO_MEMOPS_COPY2(&v, ss); - return v; -} -#if (LZO_OPT_UNALIGNED16) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2) -#define LZO_MEMOPS_GET_NE16(ss) (* (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss)) -#else -#define LZO_MEMOPS_GET_NE16(ss) lzo_memops_get_ne16(ss) -#endif - -__lzo_static_forceinline lzo_uint32_t lzo_memops_get_ne32(const lzo_voidp ss) -{ - lzo_uint32_t v; - LZO_MEMOPS_COPY4(&v, ss); - return v; -} -#if (LZO_OPT_UNALIGNED32) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4) -#define LZO_MEMOPS_GET_NE32(ss) (* (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss)) -#else -#define LZO_MEMOPS_GET_NE32(ss) lzo_memops_get_ne32(ss) -#endif - -#if (LZO_OPT_UNALIGNED64) -LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8) -#define LZO_MEMOPS_GET_NE64(ss) (* (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss)) -#endif - -__lzo_static_forceinline void lzo_memops_put_le16(lzo_voidp dd, lzo_uint16_t vv) -{ -#if (LZO_ABI_LITTLE_ENDIAN) - LZO_MEMOPS_COPY2(dd, &vv); -#elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) - lzo_memops_TU2p d = (lzo_memops_TU2p) dd; - unsigned long v = vv; - __asm__("sthbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v)); -#else - lzo_memops_TU1p d = (lzo_memops_TU1p) dd; - d[0] = LZO_BYTE((vv ) & 0xff); - d[1] = LZO_BYTE((vv >> 8) & 0xff); -#endif -} -#if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) -#define LZO_MEMOPS_PUT_LE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv)) -#else -#define LZO_MEMOPS_PUT_LE16(dd,vv) lzo_memops_put_le16(dd,vv) -#endif - -__lzo_static_forceinline void lzo_memops_put_le32(lzo_voidp dd, lzo_uint32_t vv) -{ -#if (LZO_ABI_LITTLE_ENDIAN) - LZO_MEMOPS_COPY4(dd, &vv); -#elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) - lzo_memops_TU4p d = (lzo_memops_TU4p) dd; - unsigned long v = vv; - __asm__("stwbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v)); -#else - lzo_memops_TU1p d = (lzo_memops_TU1p) dd; - d[0] = LZO_BYTE((vv ) & 0xff); - d[1] = LZO_BYTE((vv >> 8) & 0xff); - d[2] = LZO_BYTE((vv >> 16) & 0xff); - d[3] = LZO_BYTE((vv >> 24) & 0xff); -#endif -} -#if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN) -#define LZO_MEMOPS_PUT_LE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv)) -#else -#define LZO_MEMOPS_PUT_LE32(dd,vv) lzo_memops_put_le32(dd,vv) -#endif - -__lzo_static_forceinline void lzo_memops_put_ne16(lzo_voidp dd, lzo_uint16_t vv) -{ - LZO_MEMOPS_COPY2(dd, &vv); -} -#if (LZO_OPT_UNALIGNED16) -#define LZO_MEMOPS_PUT_NE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv)) -#else -#define LZO_MEMOPS_PUT_NE16(dd,vv) lzo_memops_put_ne16(dd,vv) -#endif - -__lzo_static_forceinline void lzo_memops_put_ne32(lzo_voidp dd, lzo_uint32_t vv) -{ - LZO_MEMOPS_COPY4(dd, &vv); -} -#if (LZO_OPT_UNALIGNED32) -#define LZO_MEMOPS_PUT_NE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv)) -#else -#define LZO_MEMOPS_PUT_NE32(dd,vv) lzo_memops_put_ne32(dd,vv) -#endif - -lzo_unused_funcs_impl(void, lzo_memops_unused_funcs)(void) -{ - LZO_UNUSED_FUNC(lzo_memops_unused_funcs); - LZO_UNUSED_FUNC(lzo_memops_get_le16); - LZO_UNUSED_FUNC(lzo_memops_get_le32); - LZO_UNUSED_FUNC(lzo_memops_get_ne16); - LZO_UNUSED_FUNC(lzo_memops_get_ne32); - LZO_UNUSED_FUNC(lzo_memops_put_le16); - LZO_UNUSED_FUNC(lzo_memops_put_le32); - LZO_UNUSED_FUNC(lzo_memops_put_ne16); - LZO_UNUSED_FUNC(lzo_memops_put_ne32); -} - -#endif - -#ifndef UA_SET1 -#define UA_SET1 LZO_MEMOPS_SET1 -#endif -#ifndef UA_SET2 -#define UA_SET2 LZO_MEMOPS_SET2 -#endif -#ifndef UA_SET3 -#define UA_SET3 LZO_MEMOPS_SET3 -#endif -#ifndef UA_SET4 -#define UA_SET4 LZO_MEMOPS_SET4 -#endif -#ifndef UA_MOVE1 -#define UA_MOVE1 LZO_MEMOPS_MOVE1 -#endif -#ifndef UA_MOVE2 -#define UA_MOVE2 LZO_MEMOPS_MOVE2 -#endif -#ifndef UA_MOVE3 -#define UA_MOVE3 LZO_MEMOPS_MOVE3 -#endif -#ifndef UA_MOVE4 -#define UA_MOVE4 LZO_MEMOPS_MOVE4 -#endif -#ifndef UA_MOVE8 -#define UA_MOVE8 LZO_MEMOPS_MOVE8 -#endif -#ifndef UA_COPY1 -#define UA_COPY1 LZO_MEMOPS_COPY1 -#endif -#ifndef UA_COPY2 -#define UA_COPY2 LZO_MEMOPS_COPY2 -#endif -#ifndef UA_COPY3 -#define UA_COPY3 LZO_MEMOPS_COPY3 -#endif -#ifndef UA_COPY4 -#define UA_COPY4 LZO_MEMOPS_COPY4 -#endif -#ifndef UA_COPY8 -#define UA_COPY8 LZO_MEMOPS_COPY8 -#endif -#ifndef UA_COPYN -#define UA_COPYN LZO_MEMOPS_COPYN -#endif -#ifndef UA_COPYN_X -#define UA_COPYN_X LZO_MEMOPS_COPYN -#endif -#ifndef UA_GET_LE16 -#define UA_GET_LE16 LZO_MEMOPS_GET_LE16 -#endif -#ifndef UA_GET_LE32 -#define UA_GET_LE32 LZO_MEMOPS_GET_LE32 -#endif -#ifdef LZO_MEMOPS_GET_LE64 -#ifndef UA_GET_LE64 -#define UA_GET_LE64 LZO_MEMOPS_GET_LE64 -#endif -#endif -#ifndef UA_GET_NE16 -#define UA_GET_NE16 LZO_MEMOPS_GET_NE16 -#endif -#ifndef UA_GET_NE32 -#define UA_GET_NE32 LZO_MEMOPS_GET_NE32 -#endif -#ifdef LZO_MEMOPS_GET_NE64 -#ifndef UA_GET_NE64 -#define UA_GET_NE64 LZO_MEMOPS_GET_NE64 -#endif -#endif -#ifndef UA_PUT_LE16 -#define UA_PUT_LE16 LZO_MEMOPS_PUT_LE16 -#endif -#ifndef UA_PUT_LE32 -#define UA_PUT_LE32 LZO_MEMOPS_PUT_LE32 -#endif -#ifndef UA_PUT_NE16 -#define UA_PUT_NE16 LZO_MEMOPS_PUT_NE16 -#endif -#ifndef UA_PUT_NE32 -#define UA_PUT_NE32 LZO_MEMOPS_PUT_NE32 -#endif - -#define MEMCPY8_DS(dest,src,len) \ - lzo_memcpy(dest,src,len); dest += len; src += len - -#define BZERO8_PTR(s,l,n) \ - lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) - -#define MEMCPY_DS(dest,src,len) \ - do *dest++ = *src++; while (--len > 0) - -LZO_EXTERN(const lzo_bytep) lzo_copyright(void); - -#ifndef __LZO_PTR_H -#define __LZO_PTR_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -#if (LZO_ARCH_I086) -#error "LZO_ARCH_I086 is unsupported" -#elif (LZO_MM_PVP) -#error "LZO_MM_PVP is unsupported" -#else -#define PTR(a) ((lzo_uintptr_t) (a)) -#define PTR_LINEAR(a) PTR(a) -#define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0) -#define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0) -#define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0) -#define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0) -#endif - -#define PTR_LT(a,b) (PTR(a) < PTR(b)) -#define PTR_GE(a,b) (PTR(a) >= PTR(b)) -#define PTR_DIFF(a,b) (PTR(a) - PTR(b)) -#define pd(a,b) ((lzo_uint) ((a)-(b))) - -LZO_EXTERN(lzo_uintptr_t) -__lzo_ptr_linear(const lzo_voidp ptr); - -typedef union -{ - char a_char; - unsigned char a_uchar; - short a_short; - unsigned short a_ushort; - int a_int; - unsigned int a_uint; - long a_long; - unsigned long a_ulong; - lzo_int a_lzo_int; - lzo_uint a_lzo_uint; - lzo_xint a_lzo_xint; - lzo_int16_t a_lzo_int16_t; - lzo_uint16_t a_lzo_uint16_t; - lzo_int32_t a_lzo_int32_t; - lzo_uint32_t a_lzo_uint32_t; -#if defined(lzo_uint64_t) - lzo_int64_t a_lzo_int64_t; - lzo_uint64_t a_lzo_uint64_t; -#endif - size_t a_size_t; - ptrdiff_t a_ptrdiff_t; - lzo_uintptr_t a_lzo_uintptr_t; - void * a_void_p; - char * a_char_p; - unsigned char * a_uchar_p; - const void * a_c_void_p; - const char * a_c_char_p; - const unsigned char * a_c_uchar_p; - lzo_voidp a_lzo_voidp; - lzo_bytep a_lzo_bytep; - const lzo_voidp a_c_lzo_voidp; - const lzo_bytep a_c_lzo_bytep; -} -lzo_full_align_t; - -#ifdef __cplusplus -} -#endif - -#endif - -#ifndef LZO_DETERMINISTIC -#define LZO_DETERMINISTIC 1 -#endif - -#ifndef LZO_DICT_USE_PTR -#define LZO_DICT_USE_PTR 1 -#endif - -#if (LZO_DICT_USE_PTR) -# define lzo_dict_t const lzo_bytep -# define lzo_dict_p lzo_dict_t * -#else -# define lzo_dict_t lzo_uint -# define lzo_dict_p lzo_dict_t * -#endif - -#endif - -#if !defined(MINILZO_CFG_SKIP_LZO_PTR) - -LZO_PUBLIC(lzo_uintptr_t) -__lzo_ptr_linear(const lzo_voidp ptr) -{ - lzo_uintptr_t p; - -#if (LZO_ARCH_I086) -#error "LZO_ARCH_I086 is unsupported" -#elif (LZO_MM_PVP) -#error "LZO_MM_PVP is unsupported" -#else - p = (lzo_uintptr_t) PTR_LINEAR(ptr); -#endif - - return p; -} - -LZO_PUBLIC(unsigned) -__lzo_align_gap(const lzo_voidp ptr, lzo_uint size) -{ -#if (__LZO_UINTPTR_T_IS_POINTER) -#error "__LZO_UINTPTR_T_IS_POINTER is unsupported" -#else - lzo_uintptr_t p, n; - if (size < 2) return 0; - p = __lzo_ptr_linear(ptr); -#if 0 - n = (((p + size - 1) / size) * size) - p; -#else - if ((size & (size - 1)) != 0) - return 0; - n = size; n = ((p + n - 1) & ~(n - 1)) - p; -#endif -#endif - assert((long)n >= 0); - assert(n <= size); - return (unsigned)n; -} - -#endif -#if !defined(MINILZO_CFG_SKIP_LZO_UTIL) - -/* If you use the LZO library in a product, I would appreciate that you - * keep this copyright string in the executable of your product. - */ - -static const char lzo_copyright_[] = -#if !defined(__LZO_IN_MINLZO) - LZO_VERSION_STRING; -#else - "\r\n\n" - "LZO data compression library.\n" - "$Copyright: LZO Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer\n" - "\n" - "http://www.oberhumer.com $\n\n" - "$Id: LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE " $\n" - "$Info: " LZO_INFO_STRING " $\n"; -#endif -static const char lzo_version_string_[] = LZO_VERSION_STRING; -static const char lzo_version_date_[] = LZO_VERSION_DATE; - -LZO_PUBLIC(const lzo_bytep) -lzo_copyright(void) -{ - return (const lzo_bytep) lzo_copyright_; -} - -LZO_PUBLIC(unsigned) -lzo_version(void) -{ - return LZO_VERSION; -} - -LZO_PUBLIC(const char *) -lzo_version_string(void) -{ - return lzo_version_string_; -} - -LZO_PUBLIC(const char *) -lzo_version_date(void) -{ - return lzo_version_date_; -} - -LZO_PUBLIC(const lzo_charp) -_lzo_version_string(void) -{ - return lzo_version_string_; -} - -LZO_PUBLIC(const lzo_charp) -_lzo_version_date(void) -{ - return lzo_version_date_; -} - -#define LZO_BASE 65521u -#define LZO_NMAX 5552 - -#define LZO_DO1(buf,i) s1 += buf[i]; s2 += s1 -#define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1) -#define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2) -#define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4) -#define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8) - -LZO_PUBLIC(lzo_uint32_t) -lzo_adler32(lzo_uint32_t adler, const lzo_bytep buf, lzo_uint len) -{ - lzo_uint32_t s1 = adler & 0xffff; - lzo_uint32_t s2 = (adler >> 16) & 0xffff; - unsigned k; - - if (buf == NULL) - return 1; - - while (len > 0) - { - k = len < LZO_NMAX ? (unsigned) len : LZO_NMAX; - len -= k; - if (k >= 16) do - { - LZO_DO16(buf,0); - buf += 16; - k -= 16; - } while (k >= 16); - if (k != 0) do - { - s1 += *buf++; - s2 += s1; - } while (--k > 0); - s1 %= LZO_BASE; - s2 %= LZO_BASE; - } - return (s2 << 16) | s1; -} - -#undef LZO_DO1 -#undef LZO_DO2 -#undef LZO_DO4 -#undef LZO_DO8 -#undef LZO_DO16 - -#endif -#if !defined(MINILZO_CFG_SKIP_LZO_STRING) -#undef lzo_memcmp -#undef lzo_memcpy -#undef lzo_memmove -#undef lzo_memset -#if !defined(__LZO_MMODEL_HUGE) -# undef LZO_HAVE_MM_HUGE_PTR -#endif -#define lzo_hsize_t lzo_uint -#define lzo_hvoid_p lzo_voidp -#define lzo_hbyte_p lzo_bytep -#define LZOLIB_PUBLIC(r,f) LZO_PUBLIC(r) f -#define lzo_hmemcmp lzo_memcmp -#define lzo_hmemcpy lzo_memcpy -#define lzo_hmemmove lzo_memmove -#define lzo_hmemset lzo_memset -#define __LZOLIB_HMEMCPY_CH_INCLUDED 1 -#if !defined(LZOLIB_PUBLIC) -# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) -#endif -LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCMP) - const lzo_hbyte_p p1 = LZO_STATIC_CAST(const lzo_hbyte_p, s1); - const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, s2); - if __lzo_likely(len > 0) do - { - int d = *p1 - *p2; - if (d != 0) - return d; - p1++; p2++; - } while __lzo_likely(--len > 0); - return 0; -#else - return memcmp(s1, s2, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCPY) - lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest); - const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src); - if (!(len > 0) || p1 == p2) - return dest; - do - *p1++ = *p2++; - while __lzo_likely(--len > 0); - return dest; -#else - return memcpy(dest, src, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMMOVE) - lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest); - const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src); - if (!(len > 0) || p1 == p2) - return dest; - if (p1 < p2) - { - do - *p1++ = *p2++; - while __lzo_likely(--len > 0); - } - else - { - p1 += len; - p2 += len; - do - *--p1 = *--p2; - while __lzo_likely(--len > 0); - } - return dest; -#else - return memmove(dest, src, len); -#endif -} -LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int cc, lzo_hsize_t len) -{ -#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMSET) - lzo_hbyte_p p = LZO_STATIC_CAST(lzo_hbyte_p, s); - unsigned char c = LZO_ITRUNC(unsigned char, cc); - if __lzo_likely(len > 0) do - *p++ = c; - while __lzo_likely(--len > 0); - return s; -#else - return memset(s, cc, len); -#endif -} -#undef LZOLIB_PUBLIC -#endif -#if !defined(MINILZO_CFG_SKIP_LZO_INIT) - -#if !defined(__LZO_IN_MINILZO) - -#define LZO_WANT_ACC_CHK_CH 1 -#undef LZOCHK_ASSERT - - LZOCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0) - LZOCHK_ASSERT_IS_SIGNED_T(lzo_int) - LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint) -#if !(__LZO_UINTPTR_T_IS_POINTER) - LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t) -#endif - LZOCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) - LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_xint) - -#endif -#undef LZOCHK_ASSERT - -union lzo_config_check_union { - lzo_uint a[2]; - unsigned char b[2*LZO_MAX(8,sizeof(lzo_uint))]; -#if defined(lzo_uint64_t) - lzo_uint64_t c[2]; -#endif -}; - -#if 0 -#define u2p(ptr,off) ((lzo_voidp) (((lzo_bytep)(lzo_voidp)(ptr)) + (off))) -#else -static __lzo_noinline lzo_voidp u2p(lzo_voidp ptr, lzo_uint off) -{ - return (lzo_voidp) ((lzo_bytep) ptr + off); -} -#endif - -LZO_PUBLIC(int) -_lzo_config_check(void) -{ -#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030100ul && LZO_CC_CLANG < 0x030300ul)) -# if 0 - volatile -# endif -#endif - union lzo_config_check_union u; - lzo_voidp p; - unsigned r = 1; - - u.a[0] = u.a[1] = 0; - p = u2p(&u, 0); - r &= ((* (lzo_bytep) p) == 0); -#if !(LZO_CFG_NO_CONFIG_CHECK) -#if (LZO_ABI_BIG_ENDIAN) - u.a[0] = u.a[1] = 0; u.b[sizeof(lzo_uint) - 1] = 128; - p = u2p(&u, 0); - r &= ((* (lzo_uintp) p) == 128); -#endif -#if (LZO_ABI_LITTLE_ENDIAN) - u.a[0] = u.a[1] = 0; u.b[0] = 128; - p = u2p(&u, 0); - r &= ((* (lzo_uintp) p) == 128); -#endif - u.a[0] = u.a[1] = 0; - u.b[0] = 1; u.b[3] = 2; - p = u2p(&u, 1); - r &= UA_GET_NE16(p) == 0; - r &= UA_GET_LE16(p) == 0; - u.b[1] = 128; - r &= UA_GET_LE16(p) == 128; - u.b[2] = 129; - r &= UA_GET_LE16(p) == LZO_UINT16_C(0x8180); -#if (LZO_ABI_BIG_ENDIAN) - r &= UA_GET_NE16(p) == LZO_UINT16_C(0x8081); -#endif -#if (LZO_ABI_LITTLE_ENDIAN) - r &= UA_GET_NE16(p) == LZO_UINT16_C(0x8180); -#endif - u.a[0] = u.a[1] = 0; - u.b[0] = 3; u.b[5] = 4; - p = u2p(&u, 1); - r &= UA_GET_NE32(p) == 0; - r &= UA_GET_LE32(p) == 0; - u.b[1] = 128; - r &= UA_GET_LE32(p) == 128; - u.b[2] = 129; u.b[3] = 130; u.b[4] = 131; - r &= UA_GET_LE32(p) == LZO_UINT32_C(0x83828180); -#if (LZO_ABI_BIG_ENDIAN) - r &= UA_GET_NE32(p) == LZO_UINT32_C(0x80818283); -#endif -#if (LZO_ABI_LITTLE_ENDIAN) - r &= UA_GET_NE32(p) == LZO_UINT32_C(0x83828180); -#endif -#if defined(UA_GET_NE64) - u.c[0] = u.c[1] = 0; - u.b[0] = 5; u.b[9] = 6; - p = u2p(&u, 1); - u.c[0] = u.c[1] = 0; - r &= UA_GET_NE64(p) == 0; -#if defined(UA_GET_LE64) - r &= UA_GET_LE64(p) == 0; - u.b[1] = 128; - r &= UA_GET_LE64(p) == 128; -#endif -#endif -#if defined(lzo_bitops_ctlz32) - { unsigned i = 0; lzo_uint32_t v; - for (v = 1; v != 0 && r == 1; v <<= 1, i++) { - r &= lzo_bitops_ctlz32(v) == 31 - i; - r &= lzo_bitops_ctlz32_func(v) == 31 - i; - }} -#endif -#if defined(lzo_bitops_ctlz64) - { unsigned i = 0; lzo_uint64_t v; - for (v = 1; v != 0 && r == 1; v <<= 1, i++) { - r &= lzo_bitops_ctlz64(v) == 63 - i; - r &= lzo_bitops_ctlz64_func(v) == 63 - i; - }} -#endif -#if defined(lzo_bitops_cttz32) - { unsigned i = 0; lzo_uint32_t v; - for (v = 1; v != 0 && r == 1; v <<= 1, i++) { - r &= lzo_bitops_cttz32(v) == i; - r &= lzo_bitops_cttz32_func(v) == i; - }} -#endif -#if defined(lzo_bitops_cttz64) - { unsigned i = 0; lzo_uint64_t v; - for (v = 1; v != 0 && r == 1; v <<= 1, i++) { - r &= lzo_bitops_cttz64(v) == i; - r &= lzo_bitops_cttz64_func(v) == i; - }} -#endif -#endif - LZO_UNUSED_FUNC(lzo_bitops_unused_funcs); - - return r == 1 ? LZO_E_OK : LZO_E_ERROR; -} - -LZO_PUBLIC(int) -__lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5, - int s6, int s7, int s8, int s9) -{ - int r; - -#if defined(__LZO_IN_MINILZO) -#elif (LZO_CC_MSC && ((_MSC_VER) < 700)) -#else -#define LZO_WANT_ACC_CHK_CH 1 -#undef LZOCHK_ASSERT -#define LZOCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr) -#endif -#undef LZOCHK_ASSERT - - if (v == 0) - return LZO_E_ERROR; - - r = (s1 == -1 || s1 == (int) sizeof(short)) && - (s2 == -1 || s2 == (int) sizeof(int)) && - (s3 == -1 || s3 == (int) sizeof(long)) && - (s4 == -1 || s4 == (int) sizeof(lzo_uint32_t)) && - (s5 == -1 || s5 == (int) sizeof(lzo_uint)) && - (s6 == -1 || s6 == (int) lzo_sizeof_dict_t) && - (s7 == -1 || s7 == (int) sizeof(char *)) && - (s8 == -1 || s8 == (int) sizeof(lzo_voidp)) && - (s9 == -1 || s9 == (int) sizeof(lzo_callback_t)); - if (!r) - return LZO_E_ERROR; - - r = _lzo_config_check(); - if (r != LZO_E_OK) - return r; - - return r; -} - -#if !defined(__LZO_IN_MINILZO) - -#if (LZO_OS_WIN16 && LZO_CC_WATCOMC) && defined(__SW_BD) - -#if 0 -BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment, - WORD wHeapSize, LPSTR lpszCmdLine ) -#else -int __far __pascal LibMain ( int a, short b, short c, long d ) -#endif -{ - LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d); - return 1; -} - -#endif - -#endif - -#endif - -#define LZO1X 1 -#define LZO_EOF_CODE 1 -#define M2_MAX_OFFSET 0x0800 - -#if !defined(MINILZO_CFG_SKIP_LZO1X_1_COMPRESS) - -#if 1 && defined(UA_GET_LE32) -#undef LZO_DICT_USE_PTR -#define LZO_DICT_USE_PTR 0 -#undef lzo_dict_t -#define lzo_dict_t lzo_uint16_t -#endif - -#define LZO_NEED_DICT_H 1 -#ifndef D_BITS -#define D_BITS 14 -#endif -#define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5) -#define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f) -#if 1 -#define DINDEX(dv,p) DM(((DMUL(0x1824429d,dv)) >> (32-D_BITS))) -#else -#define DINDEX(dv,p) DM((dv) + ((dv) >> (32-D_BITS))) -#endif - -#ifndef __LZO_CONFIG1X_H -#define __LZO_CONFIG1X_H 1 - -#if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z) -# define LZO1X 1 -#endif - -#if !defined(__LZO_IN_MINILZO) -#include -#endif - -#ifndef LZO_EOF_CODE -#define LZO_EOF_CODE 1 -#endif -#undef LZO_DETERMINISTIC - -#define M1_MAX_OFFSET 0x0400 -#ifndef M2_MAX_OFFSET -#define M2_MAX_OFFSET 0x0800 -#endif -#define M3_MAX_OFFSET 0x4000 -#define M4_MAX_OFFSET 0xbfff - -#define MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET) - -#define M1_MIN_LEN 2 -#define M1_MAX_LEN 2 -#define M2_MIN_LEN 3 -#ifndef M2_MAX_LEN -#define M2_MAX_LEN 8 -#endif -#define M3_MIN_LEN 3 -#define M3_MAX_LEN 33 -#define M4_MIN_LEN 3 -#define M4_MAX_LEN 9 - -#define M1_MARKER 0 -#define M2_MARKER 64 -#define M3_MARKER 32 -#define M4_MARKER 16 - -#ifndef MIN_LOOKAHEAD -#define MIN_LOOKAHEAD (M2_MAX_LEN + 1) -#endif - -#if defined(LZO_NEED_DICT_H) - -#ifndef LZO_HASH -#define LZO_HASH LZO_HASH_LZO_INCREMENTAL_B -#endif -#define DL_MIN_LEN M2_MIN_LEN - -#ifndef __LZO_DICT_H -#define __LZO_DICT_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(D_BITS) && defined(DBITS) -# define D_BITS DBITS -#endif -#if !defined(D_BITS) -# error "D_BITS is not defined" -#endif -#if (D_BITS < 16) -# define D_SIZE LZO_SIZE(D_BITS) -# define D_MASK LZO_MASK(D_BITS) -#else -# define D_SIZE LZO_USIZE(D_BITS) -# define D_MASK LZO_UMASK(D_BITS) -#endif -#define D_HIGH ((D_MASK >> 1) + 1) - -#if !defined(DD_BITS) -# define DD_BITS 0 -#endif -#define DD_SIZE LZO_SIZE(DD_BITS) -#define DD_MASK LZO_MASK(DD_BITS) - -#if !defined(DL_BITS) -# define DL_BITS (D_BITS - DD_BITS) -#endif -#if (DL_BITS < 16) -# define DL_SIZE LZO_SIZE(DL_BITS) -# define DL_MASK LZO_MASK(DL_BITS) -#else -# define DL_SIZE LZO_USIZE(DL_BITS) -# define DL_MASK LZO_UMASK(DL_BITS) -#endif - -#if (D_BITS != DL_BITS + DD_BITS) -# error "D_BITS does not match" -#endif -#if (D_BITS < 6 || D_BITS > 18) -# error "invalid D_BITS" -#endif -#if (DL_BITS < 6 || DL_BITS > 20) -# error "invalid DL_BITS" -#endif -#if (DD_BITS < 0 || DD_BITS > 6) -# error "invalid DD_BITS" -#endif - -#if !defined(DL_MIN_LEN) -# define DL_MIN_LEN 3 -#endif -#if !defined(DL_SHIFT) -# define DL_SHIFT ((DL_BITS + (DL_MIN_LEN - 1)) / DL_MIN_LEN) -#endif - -#define LZO_HASH_GZIP 1 -#define LZO_HASH_GZIP_INCREMENTAL 2 -#define LZO_HASH_LZO_INCREMENTAL_A 3 -#define LZO_HASH_LZO_INCREMENTAL_B 4 - -#if !defined(LZO_HASH) -# error "choose a hashing strategy" -#endif - -#undef DM -#undef DX - -#if (DL_MIN_LEN == 3) -# define _DV2_A(p,shift1,shift2) \ - (((( (lzo_xint)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2]) -# define _DV2_B(p,shift1,shift2) \ - (((( (lzo_xint)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0]) -# define _DV3_B(p,shift1,shift2,shift3) \ - ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0]) -#elif (DL_MIN_LEN == 2) -# define _DV2_A(p,shift1,shift2) \ - (( (lzo_xint)(p[0]) << shift1) ^ p[1]) -# define _DV2_B(p,shift1,shift2) \ - (( (lzo_xint)(p[1]) << shift1) ^ p[2]) -#else -# error "invalid DL_MIN_LEN" -#endif -#define _DV_A(p,shift) _DV2_A(p,shift,shift) -#define _DV_B(p,shift) _DV2_B(p,shift,shift) -#define DA2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0]) -#define DS2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0]) -#define DX2(p,s1,s2) \ - (((((lzo_xint)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0]) -#define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0]) -#define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0]) -#define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0]) -#define DMS(v,s) ((lzo_uint) (((v) & (D_MASK >> (s))) << (s))) -#define DM(v) DMS(v,0) - -#if (LZO_HASH == LZO_HASH_GZIP) -# define _DINDEX(dv,p) (_DV_A((p),DL_SHIFT)) - -#elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL) -# define __LZO_HASH_INCREMENTAL 1 -# define DVAL_FIRST(dv,p) dv = _DV_A((p),DL_SHIFT) -# define DVAL_NEXT(dv,p) dv = (((dv) << DL_SHIFT) ^ p[2]) -# define _DINDEX(dv,p) (dv) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A) -# define __LZO_HASH_INCREMENTAL 1 -# define DVAL_FIRST(dv,p) dv = _DV_A((p),5) -# define DVAL_NEXT(dv,p) \ - dv ^= (lzo_xint)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2]) -# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B) -# define __LZO_HASH_INCREMENTAL 1 -# define DVAL_FIRST(dv,p) dv = _DV_B((p),5) -# define DVAL_NEXT(dv,p) \ - dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_xint)(p[2]) << (2*5))) -# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) -# define DVAL_LOOKAHEAD DL_MIN_LEN - -#else -# error "choose a hashing strategy" -#endif - -#ifndef DINDEX -#define DINDEX(dv,p) ((lzo_uint)((_DINDEX(dv,p)) & DL_MASK) << DD_BITS) -#endif -#if !defined(DINDEX1) && defined(D_INDEX1) -#define DINDEX1 D_INDEX1 -#endif -#if !defined(DINDEX2) && defined(D_INDEX2) -#define DINDEX2 D_INDEX2 -#endif - -#if !defined(__LZO_HASH_INCREMENTAL) -# define DVAL_FIRST(dv,p) ((void) 0) -# define DVAL_NEXT(dv,p) ((void) 0) -# define DVAL_LOOKAHEAD 0 -#endif - -#if !defined(DVAL_ASSERT) -#if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG) -#if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) -static void __attribute__((__unused__)) -#else -static void -#endif -DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) -{ - lzo_xint df; - DVAL_FIRST(df,(p)); - assert(DINDEX(dv,p) == DINDEX(df,p)); -} -#else -# define DVAL_ASSERT(dv,p) ((void) 0) -#endif -#endif - -#if (LZO_DICT_USE_PTR) -# define DENTRY(p,in) (p) -# define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex] -#else -# define DENTRY(p,in) ((lzo_dict_t) pd(p, in)) -# define GINDEX(m_pos,m_off,dict,dindex,in) m_off = dict[dindex] -#endif - -#if (DD_BITS == 0) - -# define UPDATE_D(dict,drun,dv,p,in) dict[ DINDEX(dv,p) ] = DENTRY(p,in) -# define UPDATE_I(dict,drun,index,p,in) dict[index] = DENTRY(p,in) -# define UPDATE_P(ptr,drun,p,in) (ptr)[0] = DENTRY(p,in) - -#else - -# define UPDATE_D(dict,drun,dv,p,in) \ - dict[ DINDEX(dv,p) + drun++ ] = DENTRY(p,in); drun &= DD_MASK -# define UPDATE_I(dict,drun,index,p,in) \ - dict[ (index) + drun++ ] = DENTRY(p,in); drun &= DD_MASK -# define UPDATE_P(ptr,drun,p,in) \ - (ptr) [ drun++ ] = DENTRY(p,in); drun &= DD_MASK - -#endif - -#if (LZO_DICT_USE_PTR) - -#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ - (m_pos == NULL || (m_off = pd(ip, m_pos)) > max_offset) - -#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ - (BOUNDS_CHECKING_OFF_IN_EXPR(( \ - m_pos = ip - (lzo_uint) PTR_DIFF(ip,m_pos), \ - PTR_LT(m_pos,in) || \ - (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) == 0 || \ - m_off > max_offset ))) - -#else - -#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ - (m_off == 0 || \ - ((m_off = pd(ip, in) - m_off) > max_offset) || \ - (m_pos = (ip) - (m_off), 0) ) - -#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ - (pd(ip, in) <= m_off || \ - ((m_off = pd(ip, in) - m_off) > max_offset) || \ - (m_pos = (ip) - (m_off), 0) ) - -#endif - -#if (LZO_DETERMINISTIC) -# define LZO_CHECK_MPOS LZO_CHECK_MPOS_DET -#else -# define LZO_CHECK_MPOS LZO_CHECK_MPOS_NON_DET -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -#endif - -#endif - -#define LZO_DETERMINISTIC !(LZO_DICT_USE_PTR) - -#ifndef DO_COMPRESS -#define DO_COMPRESS lzo1x_1_compress -#endif - -#if 1 && defined(DO_COMPRESS) && !defined(do_compress) -# define do_compress LZO_PP_ECONCAT2(DO_COMPRESS,_core) -#endif - -static __lzo_noinline lzo_uint -do_compress ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_uint ti, lzo_voidp wrkmem) -{ - const lzo_bytep ip; - lzo_bytep op; - const lzo_bytep const in_end = in + in_len; - const lzo_bytep const ip_end = in + in_len - 20; - const lzo_bytep ii; - lzo_dict_p const dict = (lzo_dict_p) wrkmem; - - op = out; - ip = in; - ii = ip; - - ip += ti < 4 ? 4 - ti : 0; - for (;;) - { - const lzo_bytep m_pos; -#if !(LZO_DETERMINISTIC) - LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); - lzo_uint m_len; - lzo_uint dindex; -next: - if __lzo_unlikely(ip >= ip_end) - break; - DINDEX1(dindex,ip); - GINDEX(m_pos,m_off,dict,dindex,in); - if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) - goto literal; -#if 1 - if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) - goto try_match; - DINDEX2(dindex,ip); -#endif - GINDEX(m_pos,m_off,dict,dindex,in); - if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) - goto literal; - if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) - goto try_match; - goto literal; - -try_match: -#if (LZO_OPT_UNALIGNED32) - if (UA_GET_NE32(m_pos) != UA_GET_NE32(ip)) -#else - if (m_pos[0] != ip[0] || m_pos[1] != ip[1] || m_pos[2] != ip[2] || m_pos[3] != ip[3]) -#endif - { -literal: - UPDATE_I(dict,0,dindex,ip,in); - ip += 1 + ((ip - ii) >> 5); - continue; - } - UPDATE_I(dict,0,dindex,ip,in); -#else - lzo_uint m_off; - lzo_uint m_len; - { - lzo_uint32_t dv; - lzo_uint dindex; -literal: - ip += 1 + ((ip - ii) >> 5); -next: - if __lzo_unlikely(ip >= ip_end) - break; - dv = UA_GET_LE32(ip); - dindex = DINDEX(dv,ip); - GINDEX(m_off,m_pos,in+dict,dindex,in); - UPDATE_I(dict,0,dindex,ip,in); - if __lzo_unlikely(dv != UA_GET_LE32(m_pos)) - goto literal; - } -#endif - - ii -= ti; ti = 0; - { - lzo_uint t = pd(ip,ii); - if (t != 0) - { - if (t <= 3) - { - op[-2] = LZO_BYTE(op[-2] | t); -#if (LZO_OPT_UNALIGNED32) - UA_COPY4(op, ii); - op += t; -#else - { do *op++ = *ii++; while (--t > 0); } -#endif - } -#if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64) - else if (t <= 16) - { - *op++ = LZO_BYTE(t - 3); - UA_COPY8(op, ii); - UA_COPY8(op+8, ii+8); - op += t; - } -#endif - else - { - if (t <= 18) - *op++ = LZO_BYTE(t - 3); - else - { - lzo_uint tt = t - 18; - *op++ = 0; - while __lzo_unlikely(tt > 255) - { - tt -= 255; - UA_SET1(op, 0); - op++; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } -#if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64) - do { - UA_COPY8(op, ii); - UA_COPY8(op+8, ii+8); - op += 16; ii += 16; t -= 16; - } while (t >= 16); if (t > 0) -#endif - { do *op++ = *ii++; while (--t > 0); } - } - } - } - m_len = 4; - { -#if (LZO_OPT_UNALIGNED64) - lzo_uint64_t v; - v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len); - if __lzo_unlikely(v == 0) { - do { - m_len += 8; - v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len); - if __lzo_unlikely(ip + m_len >= ip_end) - goto m_len_done; - } while (v == 0); - } -#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz64) - m_len += lzo_bitops_ctlz64(v) / CHAR_BIT; -#elif (LZO_ABI_BIG_ENDIAN) - if ((v >> (64 - CHAR_BIT)) == 0) do { - v <<= CHAR_BIT; - m_len += 1; - } while ((v >> (64 - CHAR_BIT)) == 0); -#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz64) - m_len += lzo_bitops_cttz64(v) / CHAR_BIT; -#elif (LZO_ABI_LITTLE_ENDIAN) - if ((v & UCHAR_MAX) == 0) do { - v >>= CHAR_BIT; - m_len += 1; - } while ((v & UCHAR_MAX) == 0); -#else - if (ip[m_len] == m_pos[m_len]) do { - m_len += 1; - } while (ip[m_len] == m_pos[m_len]); -#endif -#elif (LZO_OPT_UNALIGNED32) - lzo_uint32_t v; - v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len); - if __lzo_unlikely(v == 0) { - do { - m_len += 4; - v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len); - if (v != 0) - break; - m_len += 4; - v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len); - if __lzo_unlikely(ip + m_len >= ip_end) - goto m_len_done; - } while (v == 0); - } -#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz32) - m_len += lzo_bitops_ctlz32(v) / CHAR_BIT; -#elif (LZO_ABI_BIG_ENDIAN) - if ((v >> (32 - CHAR_BIT)) == 0) do { - v <<= CHAR_BIT; - m_len += 1; - } while ((v >> (32 - CHAR_BIT)) == 0); -#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz32) - m_len += lzo_bitops_cttz32(v) / CHAR_BIT; -#elif (LZO_ABI_LITTLE_ENDIAN) - if ((v & UCHAR_MAX) == 0) do { - v >>= CHAR_BIT; - m_len += 1; - } while ((v & UCHAR_MAX) == 0); -#else - if (ip[m_len] == m_pos[m_len]) do { - m_len += 1; - } while (ip[m_len] == m_pos[m_len]); -#endif -#else - if __lzo_unlikely(ip[m_len] == m_pos[m_len]) { - do { - m_len += 1; - if (ip[m_len] != m_pos[m_len]) - break; - m_len += 1; - if (ip[m_len] != m_pos[m_len]) - break; - m_len += 1; - if (ip[m_len] != m_pos[m_len]) - break; - m_len += 1; - if (ip[m_len] != m_pos[m_len]) - break; - m_len += 1; - if (ip[m_len] != m_pos[m_len]) - break; - m_len += 1; - if (ip[m_len] != m_pos[m_len]) - break; - m_len += 1; - if (ip[m_len] != m_pos[m_len]) - break; - m_len += 1; - if __lzo_unlikely(ip + m_len >= ip_end) - goto m_len_done; - } while (ip[m_len] == m_pos[m_len]); - } -#endif - } -m_len_done: - m_off = pd(ip,m_pos); - ip += m_len; - ii = ip; - if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) - { - m_off -= 1; -#if defined(LZO1X) - *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); - *op++ = LZO_BYTE(m_off >> 3); -#elif defined(LZO1Y) - *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); - *op++ = LZO_BYTE(m_off >> 2); -#endif - } - else if (m_off <= M3_MAX_OFFSET) - { - m_off -= 1; - if (m_len <= M3_MAX_LEN) - *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); - else - { - m_len -= M3_MAX_LEN; - *op++ = M3_MARKER | 0; - while __lzo_unlikely(m_len > 255) - { - m_len -= 255; - UA_SET1(op, 0); - op++; - } - *op++ = LZO_BYTE(m_len); - } - *op++ = LZO_BYTE(m_off << 2); - *op++ = LZO_BYTE(m_off >> 6); - } - else - { - m_off -= 0x4000; - if (m_len <= M4_MAX_LEN) - *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8) | (m_len - 2)); - else - { - m_len -= M4_MAX_LEN; - *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8)); - while __lzo_unlikely(m_len > 255) - { - m_len -= 255; - UA_SET1(op, 0); - op++; - } - *op++ = LZO_BYTE(m_len); - } - *op++ = LZO_BYTE(m_off << 2); - *op++ = LZO_BYTE(m_off >> 6); - } - goto next; - } - - *out_len = pd(op, out); - return pd(in_end,ii-ti); -} - -LZO_PUBLIC(int) -DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -{ - const lzo_bytep ip = in; - lzo_bytep op = out; - lzo_uint l = in_len; - lzo_uint t = 0; - - while (l > 20) - { - lzo_uint ll = l; - lzo_uintptr_t ll_end; -#if 0 || (LZO_DETERMINISTIC) - ll = LZO_MIN(ll, 49152); -#endif - ll_end = (lzo_uintptr_t)ip + ll; - if ((ll_end + ((t + ll) >> 5)) <= ll_end || (const lzo_bytep)(ll_end + ((t + ll) >> 5)) <= ip + ll) - break; -#if (LZO_DETERMINISTIC) - lzo_memset(wrkmem, 0, ((lzo_uint)1 << D_BITS) * sizeof(lzo_dict_t)); -#endif - t = do_compress(ip,ll,op,out_len,t,wrkmem); - ip += ll; - op += *out_len; - l -= ll; - } - t += l; - - if (t > 0) - { - const lzo_bytep ii = in + in_len - t; - - if (op == out && t <= 238) - *op++ = LZO_BYTE(17 + t); - else if (t <= 3) - op[-2] = LZO_BYTE(op[-2] | t); - else if (t <= 18) - *op++ = LZO_BYTE(t - 3); - else - { - lzo_uint tt = t - 18; - - *op++ = 0; - while (tt > 255) - { - tt -= 255; - UA_SET1(op, 0); - op++; - } - assert(tt > 0); - *op++ = LZO_BYTE(tt); - } - UA_COPYN(op, ii, t); - op += t; - } - - *op++ = M4_MARKER | 1; - *op++ = 0; - *op++ = 0; - - *out_len = pd(op, out); - return LZO_E_OK; -} - -#endif - -#undef do_compress -#undef DO_COMPRESS -#undef LZO_HASH - -#undef LZO_TEST_OVERRUN -#undef DO_DECOMPRESS -#define DO_DECOMPRESS lzo1x_decompress - -#if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS) - -#if defined(LZO_TEST_OVERRUN) -# if !defined(LZO_TEST_OVERRUN_INPUT) -# define LZO_TEST_OVERRUN_INPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_OUTPUT) -# define LZO_TEST_OVERRUN_OUTPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND 1 -# endif -#endif - -#undef TEST_IP -#undef TEST_OP -#undef TEST_IP_AND_TEST_OP -#undef TEST_LB -#undef TEST_LBO -#undef NEED_IP -#undef NEED_OP -#undef TEST_IV -#undef TEST_OV -#undef HAVE_TEST_IP -#undef HAVE_TEST_OP -#undef HAVE_NEED_IP -#undef HAVE_NEED_OP -#undef HAVE_ANY_IP -#undef HAVE_ANY_OP - -#if defined(LZO_TEST_OVERRUN_INPUT) -# if (LZO_TEST_OVERRUN_INPUT >= 1) -# define TEST_IP (ip < ip_end) -# endif -# if (LZO_TEST_OVERRUN_INPUT >= 2) -# define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -# define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_OUTPUT) -# if (LZO_TEST_OVERRUN_OUTPUT >= 1) -# define TEST_OP (op <= op_end) -# endif -# if (LZO_TEST_OVERRUN_OUTPUT >= 2) -# undef TEST_OP -# define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -# define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define TEST_LB(m_pos) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op)) goto lookbehind_overrun -# define TEST_LBO(m_pos,o) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op-(o))) goto lookbehind_overrun -#else -# define TEST_LB(m_pos) ((void) 0) -# define TEST_LBO(m_pos,o) ((void) 0) -#endif - -#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) -# define TEST_IP (ip < ip_end) -#endif - -#if defined(TEST_IP) -# define HAVE_TEST_IP 1 -#else -# define TEST_IP 1 -#endif -#if defined(TEST_OP) -# define HAVE_TEST_OP 1 -#else -# define TEST_OP 1 -#endif - -#if defined(HAVE_TEST_IP) && defined(HAVE_TEST_OP) -# define TEST_IP_AND_TEST_OP (TEST_IP && TEST_OP) -#elif defined(HAVE_TEST_IP) -# define TEST_IP_AND_TEST_OP TEST_IP -#elif defined(HAVE_TEST_OP) -# define TEST_IP_AND_TEST_OP TEST_OP -#else -# define TEST_IP_AND_TEST_OP 1 -#endif - -#if defined(NEED_IP) -# define HAVE_NEED_IP 1 -#else -# define NEED_IP(x) ((void) 0) -# define TEST_IV(x) ((void) 0) -#endif -#if defined(NEED_OP) -# define HAVE_NEED_OP 1 -#else -# define NEED_OP(x) ((void) 0) -# define TEST_OV(x) ((void) 0) -#endif - -#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP 1 -#endif -#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP 1 -#endif - -#if defined(DO_DECOMPRESS) -LZO_PUBLIC(int) -DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -#endif -{ - lzo_bytep op; - const lzo_bytep ip; - lzo_uint t; -#if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; -#else - const lzo_bytep m_pos; -#endif - - const lzo_bytep const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - lzo_bytep const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - lzo_uint last_m_off = 0; -#endif - - LZO_UNUSED(wrkmem); - -#if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif - - *out_len = 0; - - op = out; - ip = in; - - NEED_IP(1); - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+3); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - - for (;;) - { - NEED_IP(3); - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { - while (*ip == 0) - { - t += 255; - ip++; - TEST_IV(t); - NEED_IP(1); - } - t += 15 + *ip++; - } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+6); -#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) - t += 3; - if (t >= 8) do - { - UA_COPY8(op,ip); - op += 8; ip += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { - UA_COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } - if (t > 0) - { - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } - } -#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) -#if !(LZO_OPT_UNALIGNED32) - if (PTR_ALIGNED2_4(op,ip)) - { -#endif - UA_COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - UA_COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } -#if !(LZO_OPT_UNALIGNED32) - } - else -#endif -#endif -#if !(LZO_OPT_UNALIGNED32) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } -#endif - -first_literal_run: - - t = *ip++; - if (t >= 16) - goto match; -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(3); - t = 3; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - (1 + M2_MAX_OFFSET); - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - - for (;;) { -match: - if (t >= 64) - { -#if defined(COPY_DICT) -#if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; -#elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; -#endif -#else -#if defined(LZO1X) - m_pos = op - 1; - m_pos -= (t >> 2) & 7; - m_pos -= *ip++ << 3; - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; -#elif defined(LZO1Z) - { - lzo_uint off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); - goto copy_match; -#endif - } - else if (t >= 32) - { - t &= 31; - if (t == 0) - { - while (*ip == 0) - { - t += 255; - ip++; - TEST_OV(t); - NEED_IP(1); - } - t += 31 + *ip++; - NEED_IP(2); - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; -#else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); -#endif -#else -#if defined(LZO1Z) - { - lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } -#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= UA_GET_LE16(ip) >> 2; -#else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif - ip += 2; - } - else if (t >= 16) - { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else - m_pos = op; - m_pos -= (t & 8) << 11; -#endif - t &= 7; - if (t == 0) - { - while (*ip == 0) - { - t += 255; - ip++; - TEST_OV(t); - NEED_IP(1); - } - t += 7 + *ip++; - NEED_IP(2); - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); -#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) - m_pos -= UA_GET_LE16(ip) >> 2; -#else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_pos == op) - goto eof_found; - m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const lzo_bytep)op, m_pos); -#endif -#endif - } - else - { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(2); - t = 2; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - 1; - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - } - -#if defined(COPY_DICT) - - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t,m_off) - -#else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) - if (op - m_pos >= 8) - { - t += (3 - 1); - if (t >= 8) do - { - UA_COPY8(op,m_pos); - op += 8; m_pos += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { - UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } - if (t > 0) - { - *op++ = m_pos[0]; - if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } } - } - } - else -#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) -#if !(LZO_OPT_UNALIGNED32) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -#else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif - { -copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); - } - -#endif - -match_done: -#if defined(LZO1Z) - t = ip[-1] & 3; -#else - t = ip[-2] & 3; -#endif - if (t == 0) - break; - -match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif - t = *ip++; - } - } - -eof_found: - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); - -#if defined(HAVE_NEED_IP) -input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; -#endif - -#if defined(HAVE_NEED_OP) -output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif -} - -#endif - -#define LZO_TEST_OVERRUN 1 -#undef DO_DECOMPRESS -#define DO_DECOMPRESS lzo1x_decompress_safe - -#if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS_SAFE) - -#if defined(LZO_TEST_OVERRUN) -# if !defined(LZO_TEST_OVERRUN_INPUT) -# define LZO_TEST_OVERRUN_INPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_OUTPUT) -# define LZO_TEST_OVERRUN_OUTPUT 2 -# endif -# if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define LZO_TEST_OVERRUN_LOOKBEHIND 1 -# endif -#endif - -#undef TEST_IP -#undef TEST_OP -#undef TEST_IP_AND_TEST_OP -#undef TEST_LB -#undef TEST_LBO -#undef NEED_IP -#undef NEED_OP -#undef TEST_IV -#undef TEST_OV -#undef HAVE_TEST_IP -#undef HAVE_TEST_OP -#undef HAVE_NEED_IP -#undef HAVE_NEED_OP -#undef HAVE_ANY_IP -#undef HAVE_ANY_OP - -#if defined(LZO_TEST_OVERRUN_INPUT) -# if (LZO_TEST_OVERRUN_INPUT >= 1) -# define TEST_IP (ip < ip_end) -# endif -# if (LZO_TEST_OVERRUN_INPUT >= 2) -# define NEED_IP(x) \ - if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun -# define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_OUTPUT) -# if (LZO_TEST_OVERRUN_OUTPUT >= 1) -# define TEST_OP (op <= op_end) -# endif -# if (LZO_TEST_OVERRUN_OUTPUT >= 2) -# undef TEST_OP -# define NEED_OP(x) \ - if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun -# define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun -# endif -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -# define TEST_LB(m_pos) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op)) goto lookbehind_overrun -# define TEST_LBO(m_pos,o) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op-(o))) goto lookbehind_overrun -#else -# define TEST_LB(m_pos) ((void) 0) -# define TEST_LBO(m_pos,o) ((void) 0) -#endif - -#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) -# define TEST_IP (ip < ip_end) -#endif - -#if defined(TEST_IP) -# define HAVE_TEST_IP 1 -#else -# define TEST_IP 1 -#endif -#if defined(TEST_OP) -# define HAVE_TEST_OP 1 -#else -# define TEST_OP 1 -#endif - -#if defined(HAVE_TEST_IP) && defined(HAVE_TEST_OP) -# define TEST_IP_AND_TEST_OP (TEST_IP && TEST_OP) -#elif defined(HAVE_TEST_IP) -# define TEST_IP_AND_TEST_OP TEST_IP -#elif defined(HAVE_TEST_OP) -# define TEST_IP_AND_TEST_OP TEST_OP -#else -# define TEST_IP_AND_TEST_OP 1 -#endif - -#if defined(NEED_IP) -# define HAVE_NEED_IP 1 -#else -# define NEED_IP(x) ((void) 0) -# define TEST_IV(x) ((void) 0) -#endif -#if defined(NEED_OP) -# define HAVE_NEED_OP 1 -#else -# define NEED_OP(x) ((void) 0) -# define TEST_OV(x) ((void) 0) -#endif - -#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) -# define HAVE_ANY_IP 1 -#endif -#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) -# define HAVE_ANY_OP 1 -#endif - -#if defined(DO_DECOMPRESS) -LZO_PUBLIC(int) -DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, - lzo_bytep out, lzo_uintp out_len, - lzo_voidp wrkmem ) -#endif -{ - lzo_bytep op; - const lzo_bytep ip; - lzo_uint t; -#if defined(COPY_DICT) - lzo_uint m_off; - const lzo_bytep dict_end; -#else - const lzo_bytep m_pos; -#endif - - const lzo_bytep const ip_end = in + in_len; -#if defined(HAVE_ANY_OP) - lzo_bytep const op_end = out + *out_len; -#endif -#if defined(LZO1Z) - lzo_uint last_m_off = 0; -#endif - - LZO_UNUSED(wrkmem); - -#if defined(COPY_DICT) - if (dict) - { - if (dict_len > M4_MAX_OFFSET) - { - dict += dict_len - M4_MAX_OFFSET; - dict_len = M4_MAX_OFFSET; - } - dict_end = dict + dict_len; - } - else - { - dict_len = 0; - dict_end = NULL; - } -#endif - - *out_len = 0; - - op = out; - ip = in; - - NEED_IP(1); - if (*ip > 17) - { - t = *ip++ - 17; - if (t < 4) - goto match_next; - assert(t > 0); NEED_OP(t); NEED_IP(t+3); - do *op++ = *ip++; while (--t > 0); - goto first_literal_run; - } - - for (;;) - { - NEED_IP(3); - t = *ip++; - if (t >= 16) - goto match; - if (t == 0) - { - while (*ip == 0) - { - t += 255; - ip++; - TEST_IV(t); - NEED_IP(1); - } - t += 15 + *ip++; - } - assert(t > 0); NEED_OP(t+3); NEED_IP(t+6); -#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) - t += 3; - if (t >= 8) do - { - UA_COPY8(op,ip); - op += 8; ip += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { - UA_COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } - if (t > 0) - { - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } - } -#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) -#if !(LZO_OPT_UNALIGNED32) - if (PTR_ALIGNED2_4(op,ip)) - { -#endif - UA_COPY4(op,ip); - op += 4; ip += 4; - if (--t > 0) - { - if (t >= 4) - { - do { - UA_COPY4(op,ip); - op += 4; ip += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *ip++; while (--t > 0); - } - else - do *op++ = *ip++; while (--t > 0); - } -#if !(LZO_OPT_UNALIGNED32) - } - else -#endif -#endif -#if !(LZO_OPT_UNALIGNED32) - { - *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; - do *op++ = *ip++; while (--t > 0); - } -#endif - -first_literal_run: - - t = *ip++; - if (t >= 16) - goto match; -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(3); - t = 3; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - (1 + M2_MAX_OFFSET); - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(3); - *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - - for (;;) { -match: - if (t >= 64) - { -#if defined(COPY_DICT) -#if defined(LZO1X) - m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); - t = (t >> 4) - 3; -#elif defined(LZO1Z) - m_off = t & 0x1f; - if (m_off >= 0x1c) - m_off = last_m_off; - else - { - m_off = 1 + (m_off << 6) + (*ip++ >> 2); - last_m_off = m_off; - } - t = (t >> 5) - 1; -#endif -#else -#if defined(LZO1X) - m_pos = op - 1; - m_pos -= (t >> 2) & 7; - m_pos -= *ip++ << 3; - t = (t >> 5) - 1; -#elif defined(LZO1Y) - m_pos = op - 1; - m_pos -= (t >> 2) & 3; - m_pos -= *ip++ << 2; - t = (t >> 4) - 3; -#elif defined(LZO1Z) - { - lzo_uint off = t & 0x1f; - m_pos = op; - if (off >= 0x1c) - { - assert(last_m_off > 0); - m_pos -= last_m_off; - } - else - { - off = 1 + (off << 6) + (*ip++ >> 2); - m_pos -= off; - last_m_off = off; - } - } - t = (t >> 5) - 1; -#endif - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); - goto copy_match; -#endif - } - else if (t >= 32) - { - t &= 31; - if (t == 0) - { - while (*ip == 0) - { - t += 255; - ip++; - TEST_OV(t); - NEED_IP(1); - } - t += 31 + *ip++; - NEED_IP(2); - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); - last_m_off = m_off; -#else - m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); -#endif -#else -#if defined(LZO1Z) - { - lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); - m_pos = op - off; - last_m_off = off; - } -#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) - m_pos = op - 1; - m_pos -= UA_GET_LE16(ip) >> 2; -#else - m_pos = op - 1; - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif -#endif - ip += 2; - } - else if (t >= 16) - { -#if defined(COPY_DICT) - m_off = (t & 8) << 11; -#else - m_pos = op; - m_pos -= (t & 8) << 11; -#endif - t &= 7; - if (t == 0) - { - while (*ip == 0) - { - t += 255; - ip++; - TEST_OV(t); - NEED_IP(1); - } - t += 7 + *ip++; - NEED_IP(2); - } -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off += (ip[0] << 6) + (ip[1] >> 2); -#else - m_off += (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_off == 0) - goto eof_found; - m_off += 0x4000; -#if defined(LZO1Z) - last_m_off = m_off; -#endif -#else -#if defined(LZO1Z) - m_pos -= (ip[0] << 6) + (ip[1] >> 2); -#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) - m_pos -= UA_GET_LE16(ip) >> 2; -#else - m_pos -= (ip[0] >> 2) + (ip[1] << 6); -#endif - ip += 2; - if (m_pos == op) - goto eof_found; - m_pos -= 0x4000; -#if defined(LZO1Z) - last_m_off = pd((const lzo_bytep)op, m_pos); -#endif -#endif - } - else - { -#if defined(COPY_DICT) -#if defined(LZO1Z) - m_off = 1 + (t << 6) + (*ip++ >> 2); - last_m_off = m_off; -#else - m_off = 1 + (t >> 2) + (*ip++ << 2); -#endif - NEED_OP(2); - t = 2; COPY_DICT(t,m_off) -#else -#if defined(LZO1Z) - t = 1 + (t << 6) + (*ip++ >> 2); - m_pos = op - t; - last_m_off = t; -#else - m_pos = op - 1; - m_pos -= t >> 2; - m_pos -= *ip++ << 2; -#endif - TEST_LB(m_pos); NEED_OP(2); - *op++ = *m_pos++; *op++ = *m_pos; -#endif - goto match_done; - } - -#if defined(COPY_DICT) - - NEED_OP(t+3-1); - t += 3-1; COPY_DICT(t,m_off) - -#else - - TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); -#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) - if (op - m_pos >= 8) - { - t += (3 - 1); - if (t >= 8) do - { - UA_COPY8(op,m_pos); - op += 8; m_pos += 8; t -= 8; - } while (t >= 8); - if (t >= 4) - { - UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } - if (t > 0) - { - *op++ = m_pos[0]; - if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } } - } - } - else -#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) -#if !(LZO_OPT_UNALIGNED32) - if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) - { - assert((op - m_pos) >= 4); -#else - if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) - { -#endif - UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4 - (3 - 1); - do { - UA_COPY4(op,m_pos); - op += 4; m_pos += 4; t -= 4; - } while (t >= 4); - if (t > 0) do *op++ = *m_pos++; while (--t > 0); - } - else -#endif - { -copy_match: - *op++ = *m_pos++; *op++ = *m_pos++; - do *op++ = *m_pos++; while (--t > 0); - } - -#endif - -match_done: -#if defined(LZO1Z) - t = ip[-1] & 3; -#else - t = ip[-2] & 3; -#endif - if (t == 0) - break; - -match_next: - assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3); -#if 0 - do *op++ = *ip++; while (--t > 0); -#else - *op++ = *ip++; - if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } -#endif - t = *ip++; - } - } - -eof_found: - *out_len = pd(op, out); - return (ip == ip_end ? LZO_E_OK : - (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); - -#if defined(HAVE_NEED_IP) -input_overrun: - *out_len = pd(op, out); - return LZO_E_INPUT_OVERRUN; -#endif - -#if defined(HAVE_NEED_OP) -output_overrun: - *out_len = pd(op, out); - return LZO_E_OUTPUT_OVERRUN; -#endif - -#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) -lookbehind_overrun: - *out_len = pd(op, out); - return LZO_E_LOOKBEHIND_OVERRUN; -#endif -} - -#endif - -/***** End of minilzo.c *****/ diff --git a/bundles/n2n_ntop_v3/src/n2n.c b/bundles/n2n_ntop_v3/src/n2n.c deleted file mode 100644 index a3fa9597..00000000 --- a/bundles/n2n_ntop_v3/src/n2n.c +++ /dev/null @@ -1,951 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#include "sn_selection.h" - -#include "minilzo.h" - -#include - - - -/* ************************************** */ - -SOCKET open_socket (int local_port, in_addr_t address, int type /* 0 = UDP, TCP otherwise */) { - - SOCKET sock_fd; - struct sockaddr_in local_address; - int sockopt; - - if((int)(sock_fd = socket(PF_INET, ((type == 0) ? SOCK_DGRAM : SOCK_STREAM) , 0)) < 0) { - traceEvent(TRACE_ERROR, "Unable to create socket [%s][%d]\n", - strerror(errno), sock_fd); - return(-1); - } - -#ifndef WIN32 - /* fcntl(sock_fd, F_SETFL, O_NONBLOCK); */ -#endif - - sockopt = 1; - setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&sockopt, sizeof(sockopt)); - - memset(&local_address, 0, sizeof(local_address)); - local_address.sin_family = AF_INET; - local_address.sin_port = htons(local_port); - local_address.sin_addr.s_addr = htonl(address); - - if(bind(sock_fd,(struct sockaddr*) &local_address, sizeof(local_address)) == -1) { - traceEvent(TRACE_ERROR, "Bind error on local port %u [%s]\n", local_port, strerror(errno)); - return(-1); - } - - return(sock_fd); -} - - -static int traceLevel = 2 /* NORMAL */; -static int useSyslog = 0, syslog_opened = 0; -static FILE *traceFile = NULL; - -int getTraceLevel () { - - return(traceLevel); -} - -void setTraceLevel (int level) { - - traceLevel = level; -} - -void setUseSyslog (int use_syslog) { - - useSyslog = use_syslog; -} - -void setTraceFile (FILE *f) { - - traceFile = f; -} - -void closeTraceFile () { - - if((traceFile != NULL) && (traceFile != stdout)) { - fclose(traceFile); - } -#ifndef WIN32 - if(useSyslog && syslog_opened) { - closelog(); - syslog_opened = 0; - } -#endif -} - -#define N2N_TRACE_DATESIZE 32 -void traceEvent (int eventTraceLevel, char* file, int line, char * format, ...) { - - va_list va_ap; - - if(traceFile == NULL) { - traceFile = stdout; - } - - if(eventTraceLevel <= traceLevel) { - char buf[1024]; - char out_buf[1280]; - char theDate[N2N_TRACE_DATESIZE]; - char *extra_msg = ""; - time_t theTime = time(NULL); - int i; - - /* We have two paths - one if we're logging, one if we aren't - * Note that the no-log case is those systems which don't support it(WIN32), - * those without the headers !defined(USE_SYSLOG) - * those where it's parametrically off... - */ - - memset(buf, 0, sizeof(buf)); - strftime(theDate, N2N_TRACE_DATESIZE, "%d/%b/%Y %H:%M:%S", localtime(&theTime)); - - va_start(va_ap, format); - vsnprintf(buf, sizeof(buf) - 1, format, va_ap); - va_end(va_ap); - - if(eventTraceLevel == 0 /* TRACE_ERROR */) { - extra_msg = "ERROR: "; - } else if(eventTraceLevel == 1 /* TRACE_WARNING */) { - extra_msg = "WARNING: "; - } - - while(buf[strlen(buf) - 1] == '\n') { - buf[strlen(buf) - 1] = '\0'; - } - -#ifndef WIN32 - if(useSyslog) { - if(!syslog_opened) { - openlog("n2n", LOG_PID, LOG_DAEMON); - syslog_opened = 1; - } - - snprintf(out_buf, sizeof(out_buf), "%s%s", extra_msg, buf); - syslog(LOG_INFO, "%s", out_buf); - } else { - for(i = strlen(file) - 1; i > 0; i--) { - if(file[i] == '/') { - i++; - break; - } - } - snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, &file[i], line, extra_msg, buf); - fprintf(traceFile, "%s\n", out_buf); - fflush(traceFile); - } -#else - /* this is the WIN32 code */ - for(i = strlen(file) - 1; i > 0; i--) { - if(file[i] == '\\') { - i++; - break; - } - } - snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, &file[i], line, extra_msg, buf); - fprintf(traceFile, "%s\n", out_buf); - fflush(traceFile); -#endif - } - -} - -/* *********************************************** */ - -/* addr should be in network order. Things are so much simpler that way. */ -char* intoa (uint32_t /* host order */ addr, char* buf, uint16_t buf_len) { - - char *cp, *retStr; - uint8_t byteval; - int n; - - cp = &buf[buf_len]; - *--cp = '\0'; - - n = 4; - do { - byteval = addr & 0xff; - *--cp = byteval % 10 + '0'; - byteval /= 10; - if(byteval > 0) { - *--cp = byteval % 10 + '0'; - byteval /= 10; - if(byteval > 0) { - *--cp = byteval + '0'; - } - } - *--cp = '.'; - addr >>= 8; - } while(--n > 0); - - /* Convert the string to lowercase */ - retStr = (char*)(cp + 1); - - return(retStr); -} - - -/** Convert subnet prefix bit length to host order subnet mask. */ -uint32_t bitlen2mask (uint8_t bitlen) { - - uint8_t i; - uint32_t mask = 0; - - for (i = 1; i <= bitlen; ++i) { - mask |= 1 << (32 - i); - } - - return mask; -} - - -/** Convert host order subnet mask to subnet prefix bit length. */ -uint8_t mask2bitlen (uint32_t mask) { - - uint8_t i, bitlen = 0; - - for (i = 0; i < 32; ++i) { - if((mask << i) & 0x80000000) { - ++bitlen; - } else { - break; - } - } - - return bitlen; -} - - -/* *********************************************** */ - -char * macaddr_str (macstr_t buf, - const n2n_mac_t mac) { - - snprintf(buf, N2N_MACSTR_SIZE, "%02X:%02X:%02X:%02X:%02X:%02X", - mac[0] & 0xFF, mac[1] & 0xFF, mac[2] & 0xFF, - mac[3] & 0xFF, mac[4] & 0xFF, mac[5] & 0xFF); - - return(buf); -} - -/* *********************************************** */ - -/** Resolve the supernode IP address. - * - */ -int supernode2sock (n2n_sock_t *sn, const n2n_sn_name_t addrIn) { - - n2n_sn_name_t addr; - char *supernode_host; - char *supernode_port; - int rv = 0; - int nameerr; - const struct addrinfo aihints = {0, PF_INET, 0, 0, 0, NULL, NULL, NULL}; - struct addrinfo * ainfo = NULL; - struct sockaddr_in * saddr; - - sn->family = AF_INVALID; - - memcpy(addr, addrIn, N2N_EDGE_SN_HOST_SIZE); - supernode_host = strtok(addr, ":"); - - if(supernode_host) { - supernode_port = strtok(NULL, ":"); - if(supernode_port) { - sn->port = atoi(supernode_port); - nameerr = getaddrinfo(supernode_host, NULL, &aihints, &ainfo); - if(0 == nameerr) { - /* ainfo s the head of a linked list if non-NULL. */ - if(ainfo && (PF_INET == ainfo->ai_family)) { - /* It is definitely and IPv4 address -> sockaddr_in */ - saddr = (struct sockaddr_in *)ainfo->ai_addr; - memcpy(sn->addr.v4, &(saddr->sin_addr.s_addr), IPV4_SIZE); - sn->family = AF_INET; - traceEvent(TRACE_INFO, "supernode2sock successfully resolves supernode IPv4 address for %s", supernode_host); - rv = 0; - } else { - /* Should only return IPv4 addresses due to aihints. */ - traceEvent(TRACE_WARNING, "supernode2sock fails to resolve supernode IPv4 address for %s", supernode_host); - rv = -1; - } - freeaddrinfo(ainfo); /* free everything allocated by getaddrinfo(). */ - } else { - traceEvent(TRACE_WARNING, "supernode2sock fails to resolve supernode host %s, %d: %s", supernode_host, nameerr, gai_strerror(nameerr)); - rv = -2; - } - } else { - traceEvent(TRACE_WARNING, "supernode2sock sees malformed supernode parameter (-l ) %s", addrIn); - rv = -3; - } - } else { - traceEvent(TRACE_WARNING, "supernode2sock sees malformed supernode parameter (-l ) %s", - addrIn); - rv = -4; - } - - ainfo = NULL; - - return rv; -} - - -N2N_THREAD_RETURN_DATATYPE resolve_thread(N2N_THREAD_PARAMETER_DATATYPE p) { - -#ifdef HAVE_PTHREAD - n2n_resolve_parameter_t *param = (n2n_resolve_parameter_t*)p; - n2n_resolve_ip_sock_t *entry, *tmp_entry; - time_t rep_time = N2N_RESOLVE_INTERVAL / 10; - time_t now; - - while(1) { - sleep(N2N_RESOLVE_INTERVAL / 60); /* wake up in-between to check for signaled requests */ - - // what's the time? - now = time(NULL); - - // lock access - pthread_mutex_lock(¶m->access); - - // is it time to resolve yet? - if(((param->request)) || ((now - param->last_resolved) > rep_time)) { - HASH_ITER(hh, param->list, entry, tmp_entry) { - // resolve - entry->error_code = supernode2sock(&entry->sock, entry->org_ip); - // if socket changed and no error - if(!sock_equal(&entry->sock, entry->org_sock) - && (!entry->error_code)) { - // flag the change - param->changed = 1; - } - } - param->last_resolved = now; - - // any request fulfilled - param->request = 0; - - // determine next resolver repetition (shorter time if resolver errors occured) - rep_time = N2N_RESOLVE_INTERVAL; - HASH_ITER(hh, param->list, entry, tmp_entry) { - if(entry->error_code) { - rep_time = N2N_RESOLVE_INTERVAL / 10; - break; - } - } - } - - // unlock access - pthread_mutex_unlock(¶m->access); - } -#endif -} - - -int resolve_create_thread (n2n_resolve_parameter_t **param, struct peer_info *sn_list) { - -#ifdef HAVE_PTHREAD - struct peer_info *sn, *tmp_sn; - n2n_resolve_ip_sock_t *entry; - int ret; - - // create parameter structure - *param = (n2n_resolve_parameter_t*)calloc(1, sizeof(n2n_resolve_parameter_t)); - if(*param) { - HASH_ITER(hh, sn_list, sn, tmp_sn) { - // create entries for those peers that come with ip_addr string (from command-line) - if(sn->ip_addr) { - entry = (n2n_resolve_ip_sock_t*)calloc(1, sizeof(n2n_resolve_ip_sock_t)); - if(entry) { - entry->org_ip = sn->ip_addr; - entry->org_sock = &(sn->sock); - memcpy(&(entry->sock), &(sn->sock), sizeof(n2n_sock_t)); - HASH_ADD(hh, (*param)->list, org_ip, sizeof(char*), entry); - } else - traceEvent(TRACE_WARNING, "resolve_create_thread was unable to add list entry for supernode '%s'", sn->ip_addr); - } - } - (*param)->check_interval = N2N_RESOLVE_CHECK_INTERVAL; - } else { - traceEvent(TRACE_WARNING, "resolve_create_thread was unable to create list of supernodes"); - return -1; - } - - // create thread - ret = pthread_create(&((*param)->id), NULL, resolve_thread, (void *)*param); - if(ret) { - traceEvent(TRACE_WARNING, "resolve_create_thread failed to create resolver thread with error number %d", ret); - return -1; - } - - pthread_mutex_init(&((*param)->access), NULL); - - return 0; -#endif -} - - -void resolve_cancel_thread (n2n_resolve_parameter_t *param) { - -#ifdef HAVE_PTHREAD - pthread_cancel(param->id); - free(param); -#endif -} - - -uint8_t resolve_check (n2n_resolve_parameter_t *param, uint8_t requires_resolution, time_t now) { - - uint8_t ret = requires_resolution; /* if trylock fails, it still requires resolution */ - -#ifdef HAVE_PTHREAD - n2n_resolve_ip_sock_t *entry, *tmp_entry; - n2n_sock_str_t sock_buf; - - if(NULL == param) - return ret; - - // check_interval and last_check do not need to be guarded by the mutex because - // their values get changed and evaluated only here - - if((now - param->last_checked > param->check_interval) || (requires_resolution)) { - // try to lock access - if(pthread_mutex_trylock(¶m->access) == 0) { - // any changes? - if(param->changed) { - // reset flag - param->changed = 0; - // unselectively copy all socks (even those with error code, that would be the old one because - // sockets do not get overwritten in case of error in resolve_thread) from list to supernode list - HASH_ITER(hh, param->list, entry, tmp_entry) { - memcpy(entry->org_sock, &entry->sock, sizeof(n2n_sock_t)); - traceEvent(TRACE_INFO, "resolve_check renews ip address of supernode '%s' to %s", - entry->org_ip, sock_to_cstr(sock_buf, &(entry->sock))); - } - } - - // let the resolver thread know eventual difficulties in reaching the supernode - if(requires_resolution) { - param->request = 1; - ret = 0; - } - - param->last_checked = now; - - // next appointment - if(param->request) - // earlier if resolver still working on fulfilling a request - param->check_interval = N2N_RESOLVE_CHECK_INTERVAL / 10; - else - param->check_interval = N2N_RESOLVE_CHECK_INTERVAL; - - // unlock access - pthread_mutex_unlock(¶m->access); - } - } -#endif - - return ret; -} - - -/* ************************************** */ - - -struct peer_info* add_sn_to_list_by_mac_or_sock (struct peer_info **sn_list, n2n_sock_t *sock, const n2n_mac_t mac, int *skip_add) { - - struct peer_info *scan, *tmp, *peer = NULL; - - if(!is_null_mac(mac)) { /* not zero MAC */ - HASH_FIND_PEER(*sn_list, mac, peer); - } - - if(peer == NULL) { /* zero MAC, search by socket */ - HASH_ITER(hh, *sn_list, scan, tmp) { - if(memcmp(&(scan->sock), sock, sizeof(n2n_sock_t)) == 0) { - // update mac if appropriate, needs to be deleted first because it is key to the hash list - if(!is_null_mac(mac)) { - HASH_DEL(*sn_list, scan); - memcpy(scan->mac_addr, mac, sizeof(n2n_mac_t)); - HASH_ADD_PEER(*sn_list, scan); - } - peer = scan; - break; - } - } - - if((peer == NULL) && (*skip_add == SN_ADD)) { - peer = (struct peer_info*)calloc(1, sizeof(struct peer_info)); - if(peer) { - sn_selection_criterion_default(&(peer->selection_criterion)); - peer->last_valid_time_stamp = initial_time_stamp(); - memcpy(&(peer->sock), sock, sizeof(n2n_sock_t)); - memcpy(peer->mac_addr, mac, sizeof(n2n_mac_t)); - HASH_ADD_PEER(*sn_list, peer); - *skip_add = SN_ADD_ADDED; - } - } - } - - return peer; -} - -/* ************************************************ */ - - -/* http://www.faqs.org/rfcs/rfc908.html */ -uint8_t is_multi_broadcast (const n2n_mac_t dest_mac) { - - int is_broadcast = (memcmp(broadcast_mac, dest_mac, N2N_MAC_SIZE) == 0); - int is_multicast = (memcmp(multicast_mac, dest_mac, 3) == 0) && !(dest_mac[3] >> 7); - int is_ipv6_multicast = (memcmp(ipv6_multicast_mac, dest_mac, 2) == 0); - - return is_broadcast || is_multicast || is_ipv6_multicast; -} - - -uint8_t is_broadcast (const n2n_mac_t dest_mac) { - - int is_broadcast = (memcmp(broadcast_mac, dest_mac, N2N_MAC_SIZE) == 0); - - return is_broadcast; -} - - -uint8_t is_null_mac (const n2n_mac_t dest_mac) { - - int is_null_mac = (memcmp(null_mac, dest_mac, N2N_MAC_SIZE) == 0); - - return is_null_mac; -} - - -/* *********************************************** */ - -char* msg_type2str (uint16_t msg_type) { - - switch(msg_type) { - case MSG_TYPE_REGISTER: return("MSG_TYPE_REGISTER"); - case MSG_TYPE_DEREGISTER: return("MSG_TYPE_DEREGISTER"); - case MSG_TYPE_PACKET: return("MSG_TYPE_PACKET"); - case MSG_TYPE_REGISTER_ACK: return("MSG_TYPE_REGISTER_ACK"); - case MSG_TYPE_REGISTER_SUPER: return("MSG_TYPE_REGISTER_SUPER"); - case MSG_TYPE_REGISTER_SUPER_ACK: return("MSG_TYPE_REGISTER_SUPER_ACK"); - case MSG_TYPE_REGISTER_SUPER_NAK: return("MSG_TYPE_REGISTER_SUPER_NAK"); - case MSG_TYPE_FEDERATION: return("MSG_TYPE_FEDERATION"); - default: return("???"); - } - - return("???"); -} - -/* *********************************************** */ - -void hexdump (const uint8_t *buf, size_t len) { - - size_t i; - - if(0 == len) { - return; - } - - printf("-----------------------------------------------\n"); - for(i = 0; i < len; i++) { - if((i > 0) && ((i % 16) == 0)) { - printf("\n"); - } - printf("%02X ", buf[i] & 0xFF); - } - printf("\n"); - printf("-----------------------------------------------\n"); -} - - -/* *********************************************** */ - -void print_n2n_version () { - - printf("Welcome to n2n v.%s for %s\n" - "Built on %s\n" - "Copyright 2007-2021 - ntop.org and contributors\n\n", - GIT_RELEASE, PACKAGE_OSNAME, PACKAGE_BUILDDATE); -} - -/* *********************************************** */ - -size_t purge_expired_nodes (struct peer_info **peer_list, - SOCKET socket_not_to_close, - n2n_tcp_connection_t **tcp_connections, - time_t *p_last_purge, - int frequency, int timeout) { - - time_t now = time(NULL); - size_t num_reg = 0; - - if((now - (*p_last_purge)) < frequency) { - return 0; - } - - traceEvent(TRACE_DEBUG, "Purging old registrations"); - - num_reg = purge_peer_list(peer_list, socket_not_to_close, tcp_connections, now - timeout); - - (*p_last_purge) = now; - traceEvent(TRACE_DEBUG, "Remove %ld registrations", num_reg); - - return num_reg; -} - -/** Purge old items from the peer_list, eventually close the related socket, and - * return the number of items that were removed. */ -size_t purge_peer_list (struct peer_info **peer_list, - SOCKET socket_not_to_close, - n2n_tcp_connection_t **tcp_connections, - time_t purge_before) { - - struct peer_info *scan, *tmp; - n2n_tcp_connection_t *conn; - size_t retval = 0; - - HASH_ITER(hh, *peer_list, scan, tmp) { - if((scan->purgeable == SN_PURGEABLE) && (scan->last_seen < purge_before)) { - if((scan->socket_fd >=0) && (scan->socket_fd != socket_not_to_close)) { - if(tcp_connections) { - HASH_FIND_INT(*tcp_connections, &scan->socket_fd, conn); - if(conn) { - HASH_DEL(*tcp_connections, conn); - free(conn); - } - shutdown(scan->socket_fd, SHUT_RDWR); - closesocket(scan->socket_fd); - } - } - HASH_DEL(*peer_list, scan); - retval++; - free(scan); - } - } - - return retval; -} - -/** Purge all items from the peer_list and return the number of items that were removed. */ -size_t clear_peer_list (struct peer_info ** peer_list) { - - struct peer_info *scan, *tmp; - size_t retval = 0; - - HASH_ITER(hh, *peer_list, scan, tmp) { - HASH_DEL(*peer_list, scan); - retval++; - free(scan); - } - - return retval; -} - -static uint8_t hex2byte (const char * s) { - - char tmp[3]; - tmp[0] = s[0]; - tmp[1] = s[1]; - tmp[2] = 0; /* NULL term */ - - return((uint8_t)strtol(tmp, NULL, 16)); -} - -extern int str2mac (uint8_t * outmac /* 6 bytes */, const char * s) { - - size_t i; - - /* break it down as one case for the first "HH", the 5 x through loop for - * each ":HH" where HH is a two hex nibbles in ASCII. */ - - *outmac = hex2byte(s); - ++outmac; - s += 2; /* don't skip colon yet - helps generalise loop. */ - - for(i = 1; i < 6; ++i) { - s += 1; - *outmac = hex2byte(s); - ++outmac; - s += 2; - } - - return 0; /* ok */ -} - -extern char * sock_to_cstr (n2n_sock_str_t out, - const n2n_sock_t * sock) { - - if(NULL == out) { - return NULL; - } - memset(out, 0, N2N_SOCKBUF_SIZE); - - if(AF_INET6 == sock->family) { - /* INET6 not written yet */ - snprintf(out, N2N_SOCKBUF_SIZE, "XXXX:%hu", sock->port); - return out; - } else { - const uint8_t * a = sock->addr.v4; - - snprintf(out, N2N_SOCKBUF_SIZE, "%hu.%hu.%hu.%hu:%hu", - (unsigned short)(a[0] & 0xff), - (unsigned short)(a[1] & 0xff), - (unsigned short)(a[2] & 0xff), - (unsigned short)(a[3] & 0xff), - (unsigned short)sock->port); - return out; - } -} - -char *ip_subnet_to_str (dec_ip_bit_str_t buf, const n2n_ip_subnet_t *ipaddr) { - - snprintf(buf, sizeof(dec_ip_bit_str_t), "%hhu.%hhu.%hhu.%hhu/%hhu", - (uint8_t) ((ipaddr->net_addr >> 24) & 0xFF), - (uint8_t) ((ipaddr->net_addr >> 16) & 0xFF), - (uint8_t) ((ipaddr->net_addr >> 8) & 0xFF), - (uint8_t) (ipaddr->net_addr & 0xFF), - ipaddr->net_bitlen); - - return buf; -} - - -/* @return 1 if the two sockets are equivalent. */ -int sock_equal (const n2n_sock_t * a, - const n2n_sock_t * b) { - - if(a->port != b->port) { - return(0); - } - - if(a->family != b->family) { - return(0); - } - - switch(a->family) { - case AF_INET: - if(memcmp(a->addr.v4, b->addr.v4, IPV4_SIZE)) { - return(0); - } - break; - - default: - if(memcmp(a->addr.v6, b->addr.v6, IPV6_SIZE)) { - return(0); - } - break; - } - - /* equal */ - return(1); -} - - -/* *********************************************** */ - -// fills a specified memory area with random numbers -int memrnd (uint8_t *address, size_t len) { - - for(; len >= 4; len -= 4) { - *(uint32_t*)address = n2n_rand(); - address += 4; - } - - for(; len > 0; len--) { - *address = n2n_rand(); - address++; - } - - return 0; -} - - -// exclusive-ors a specified memory area with another -int memxor (uint8_t *destination, const uint8_t *source, size_t len) { - - for(; len >= 4; len -= 4) { - *(uint32_t*)destination ^= *(uint32_t*)source; - source += 4; - destination += 4; - } - - for(; len > 0; len--) { - *destination ^= *source; - source++; - destination++; - } - - return 0; -} - -/* *********************************************** */ - -#if defined(WIN32) -int gettimeofday (struct timeval *tp, void *tzp) { - - time_t clock; - struct tm tm; - SYSTEMTIME wtm; - - GetLocalTime(&wtm); - tm.tm_year = wtm.wYear - 1900; - tm.tm_mon = wtm.wMonth - 1; - tm.tm_mday = wtm.wDay; - tm.tm_hour = wtm.wHour; - tm.tm_min = wtm.wMinute; - tm.tm_sec = wtm.wSecond; - tm.tm_isdst = -1; - clock = mktime(&tm); - tp->tv_sec = clock; - tp->tv_usec = wtm.wMilliseconds * 1000; - - return 0; -} -#endif - - -// stores the previously issued time stamp -static uint64_t previously_issued_time_stamp = 0; - - -// returns a time stamp for use with replay protection (branchless code) -// -// depending on the self-detected accuracy, it has the following format -// -// MMMMMMMMCCCCCCCF or -// -// MMMMMMMMSSSSSCCF -// -// with M being the 32-bit second time stamp -// S the 20-bit sub-second (microsecond) time stamp part, if applicable -// C a counter (8 bit or 24 bit) reset to 0 with every MMMMMMMM(SSSSS) turn-over -// F a 4-bit flag field with -// ...c being the accuracy indicator (if set, only counter and no sub-second accuracy) -// -uint64_t time_stamp (void) { - - struct timeval tod; - uint64_t micro_seconds; - uint64_t co, mask_lo, mask_hi, hi_unchanged, counter, new_co; - - gettimeofday(&tod, NULL); - - // (roughly) calculate the microseconds since 1970, leftbound - micro_seconds = ((uint64_t)(tod.tv_sec) << 32) + ((uint64_t)tod.tv_usec << 12); - // more exact but more costly due to the multiplication: - // micro_seconds = ((uint64_t)(tod.tv_sec) * 1000000ULL + tod.tv_usec) << 12; - - // extract "counter only" flag (lowest bit) - co = (previously_issued_time_stamp << 63) >> 63; - // set mask accordingly - mask_lo = -co; - mask_lo >>= 32; - // either 0x00000000FFFFFFFF (if co flag set) or 0x0000000000000000 (if co flag not set) - - mask_lo |= (~mask_lo) >> 52; - // either 0x00000000FFFFFFFF (unchanged) or 0x0000000000000FFF (lowest 12 bit set) - - mask_hi = ~mask_lo; - - hi_unchanged = ((previously_issued_time_stamp & mask_hi) == (micro_seconds & mask_hi)); - // 0 if upper bits unchanged (compared to previous stamp), 1 otherwise - - // read counter and shift right for flags - counter = (previously_issued_time_stamp & mask_lo) >> 4; - - counter += hi_unchanged; - counter &= -hi_unchanged; - // either counter++ if upper part of timestamp unchanged, 0 otherwise - - // back to time stamp format - counter <<= 4; - - // set new co flag if counter overflows while upper bits unchanged or if it was set before - new_co = (((counter & mask_lo) == 0) & hi_unchanged) | co; - - // in case co flag changed, masks need to be recalculated - mask_lo = -new_co; - mask_lo >>= 32; - mask_lo |= (~mask_lo) >> 52; - mask_hi = ~mask_lo; - - // assemble new timestamp - micro_seconds &= mask_hi; - micro_seconds |= counter; - micro_seconds |= new_co; - - previously_issued_time_stamp = micro_seconds; - - return micro_seconds; -} - - -// returns an initial time stamp for use with replay protection -uint64_t initial_time_stamp (void) { - - return time_stamp() - TIME_STAMP_FRAME; -} - - -// checks if a provided time stamp is consistent with current time and previously valid time stamps -// and, in case of validity, updates the "last valid time stamp" -int time_stamp_verify_and_update (uint64_t stamp, uint64_t *previous_stamp, int allow_jitter) { - - int64_t diff; /* do not change to unsigned */ - uint64_t co; /* counter only mode (for sub-seconds) */ - - co = (stamp << 63) >> 63; - - // is it around current time (+/- allowed deviation TIME_STAMP_FRAME)? - diff = stamp - time_stamp(); - // abs() - diff = (diff < 0 ? -diff : diff); - if(diff >= TIME_STAMP_FRAME) { - traceEvent(TRACE_DEBUG, "time_stamp_verify_and_update found a timestamp out of allowed frame."); - return 0; // failure - } - - // if applicable: is it higher than previous time stamp (including allowed deviation of TIME_STAMP_JITTER)? - if(NULL != previous_stamp) { - diff = stamp - *previous_stamp; - if(allow_jitter) { - // 8 times higher jitter allowed for counter-only flagged timestamps ( ~ 1.25 sec with 160 ms default jitter) - diff += TIME_STAMP_JITTER << (co << 3); - } - - if(diff <= 0) { - traceEvent(TRACE_DEBUG, "time_stamp_verify_and_update found a timestamp too old compared to previous."); - return 0; // failure - } - // for not allowing to exploit the allowed TIME_STAMP_JITTER to "turn the clock backwards", - // set the higher of the values - *previous_stamp = (stamp > *previous_stamp ? stamp : *previous_stamp); - } - - return 1; // success -} diff --git a/bundles/n2n_ntop_v3/src/n2n_regex.c b/bundles/n2n_ntop_v3/src/n2n_regex.c deleted file mode 100644 index 56e47da7..00000000 --- a/bundles/n2n_ntop_v3/src/n2n_regex.c +++ /dev/null @@ -1,486 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -// taken from https://github.com/kokke/tiny-regex-c -// under Unlicense as of August 4, 2020 - -/* - * - * Mini regex-module inspired by Rob Pike's regex code described in: - * - * http://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html - * - * - * - * Supports: - * --------- - * '.' Dot, matches any character - * '^' Start anchor, matches beginning of string -- NOTE: currently disabled (checking for full matches anyway) - * '$' End anchor, matches end of string -- NOTE: currently disabled (checking for full matches anyway) - * '*' Asterisk, match zero or more (greedy) - * '+' Plus, match one or more (greedy) - * '?' Question, match zero or one (non-greedy) - * '[abc]' Character class, match if one of {'a', 'b', 'c'} - * '[^abc]' Inverted class, match if NOT one of {'a', 'b', 'c'} -- NOTE: feature is currently broken! - * '[a-zA-Z]' Character ranges, the character set of the ranges { a-z | A-Z } - * '\s' Whitespace, \t \f \r \n \v and spaces - * '\S' Non-whitespace - * '\w' Alphanumeric, [a-zA-Z0-9_] - * '\W' Non-alphanumeric - * '\d' Digits, [0-9] - * '\D' Non-digits - * - * - */ - - -#include "n2n.h" -#include "n2n_regex.h" - -/* Definitions: */ - -#define MAX_REGEXP_OBJECTS 30 /* Max number of regex symbols in expression. */ -#define MAX_CHAR_CLASS_LEN 40 /* Max length of character-class buffer in. */ - - -enum { UNUSED, DOT, BEGIN, END, QUESTIONMARK, STAR, PLUS, CHAR_TYPE, CHAR_CLASS, INV_CHAR_CLASS, DIGIT, NOT_DIGIT, ALPHA, NOT_ALPHA, WHITESPACE, NOT_WHITESPACE, /* BRANCH */ }; - -typedef struct regex_t { - unsigned char type; /* CHAR_TYPE, STAR, etc. */ - union { - unsigned char ch; /* the character itself */ - unsigned char* ccl; /* OR a pointer to characters in class */ - }; -} regex_t; - - - -/* Private function declarations: */ -static int matchpattern (regex_t* pattern, const char* text, int* matchlength); -static int matchcharclass (char c, const char* str); -static int matchstar (regex_t p, regex_t* pattern, const char* text, int* matchlength); -static int matchplus (regex_t p, regex_t* pattern, const char* text, int* matchlength); -static int matchone (regex_t p, char c); -static int matchdigit (char c); -static int matchalpha (char c); -static int matchwhitespace (char c); -static int matchmetachar (char c, const char* str); -static int matchrange (char c, const char* str); -static int matchdot (char c); -static int ismetachar (char c); - - - -/* Public functions: */ -int re_match (const char* pattern, const char* text, int* matchlength) { - - re_t re_p; /* pointer to (to be created) copy of compiled regex */ - int ret = -1; - - re_p = re_compile (pattern); - ret = re_matchp(re_p, text, matchlength); - free(re_p); - - return(ret); -} - -int re_matchp (re_t pattern, const char* text, int* matchlength) { - - *matchlength = 0; - - if(pattern != 0) { - if(pattern[0].type == BEGIN) { - return ((matchpattern(&pattern[1], text, matchlength)) ? 0 : -1); - } else { - int idx = -1; - - do { - idx += 1; - - if(matchpattern(pattern, text, matchlength)) { - if(text[0] == '\0') { - return -1; - } - return idx; - } - } while(*text++ != '\0'); - } - } - - return -1; -} - -re_t re_compile (const char* pattern) { - - /* The sizes of the two static arrays below substantiates the static RAM usage of this module. - MAX_REGEXP_OBJECTS is the max number of symbols in the expression. - MAX_CHAR_CLASS_LEN determines the size of buffer for chars in all char-classes in the expression. */ - static regex_t re_compiled[MAX_REGEXP_OBJECTS]; - re_t re_p; /* pointer to (to be created) copy of compiled regex in re_compiled */ - - static unsigned char ccl_buf[MAX_CHAR_CLASS_LEN]; - int ccl_bufidx = 1; - - char c; /* current char in pattern */ - int i = 0; /* index into pattern */ - int j = 0; /* index into re_compiled */ - - while(pattern[i] != '\0' && (j + 1 < MAX_REGEXP_OBJECTS)) { - c = pattern[i]; - - switch(c) { - /* Meta-characters: */ - // case '^': { re_compiled[j].type = BEGIN; } break; <-- disabled (always full matches) - // case '$': { re_compiled[j].type = END; } break; <-- disabled (always full matches) - case '.': { re_compiled[j].type = DOT; } break; - case '*': { re_compiled[j].type = STAR; } break; - case '+': { re_compiled[j].type = PLUS; } break; - case '?': { re_compiled[j].type = QUESTIONMARK; } break; - /* case '|': { re_compiled[j].type = BRANCH; } break; <-- not working properly */ - - /* Escaped character-classes (\s \w ...): */ - case '\\': { - if(pattern[i + 1] != '\0') { - /* Skip the escape-char '\\' */ - i += 1; - /* ... and check the next */ - switch(pattern[i]) { - /* Meta-character: */ - case 'd': { re_compiled[j].type = DIGIT; } break; - case 'D': { re_compiled[j].type = NOT_DIGIT; } break; - case 'w': { re_compiled[j].type = ALPHA; } break; - case 'W': { re_compiled[j].type = NOT_ALPHA; } break; - case 's': { re_compiled[j].type = WHITESPACE; } break; - case 'S': { re_compiled[j].type = NOT_WHITESPACE; } break; - - /* Escaped character, e.g. '.' */ - default: { - re_compiled[j].type = CHAR_TYPE; - re_compiled[j].ch = pattern[i]; - } break; - } - } - /* '\\' as last char in pattern -> invalid regular expression. */ - /* - else - { - re_compiled[j].type = CHAR_TYPE; - re_compiled[j].ch = pattern[i]; - } - */ - } break; - - /* Character class: */ - case '[': { - /* Remember where the char-buffer starts. */ - int buf_begin = ccl_bufidx; - - /* Look-ahead to determine if negated */ - if(pattern[i+1] == '^') { - re_compiled[j].type = INV_CHAR_CLASS; - i += 1; /* Increment i to avoid including '^' in the char-buffer */ - } else { - re_compiled[j].type = CHAR_CLASS; - } - - /* Copy characters inside [..] to buffer */ - while((pattern[++i] != ']') - && (pattern[i] != '\0')) /* Missing ] */ - { - if(pattern[i] == '\\') { - if(ccl_bufidx >= MAX_CHAR_CLASS_LEN - 1) { - //fputs("exceeded internal buffer!\n", stderr); - return 0; - } - ccl_buf[ccl_bufidx++] = pattern[i++]; - } else if(ccl_bufidx >= MAX_CHAR_CLASS_LEN) { - //fputs("exceeded internal buffer!\n", stderr); - return 0; - } - ccl_buf[ccl_bufidx++] = pattern[i]; - } - if(ccl_bufidx >= MAX_CHAR_CLASS_LEN) { - /* Catches cases such as [00000000000000000000000000000000000000][ */ - //fputs("exceeded internal buffer!\n", stderr); - return 0; - } - /* Null-terminate string end */ - ccl_buf[ccl_bufidx++] = 0; - re_compiled[j].ccl = &ccl_buf[buf_begin]; - } break; - - /* Other characters: */ - default: { - re_compiled[j].type = CHAR_TYPE; - re_compiled[j].ch = c; - } break; - } - i += 1; - j += 1; - } - /* 'UNUSED' is a sentinel used to indicate end-of-pattern */ - re_compiled[j].type = UNUSED; - - re_p = (re_t)calloc(1, sizeof(re_compiled)); - memcpy (re_p, re_compiled, sizeof(re_compiled)); - - return (re_t) re_p; -} - -void re_print (regex_t* pattern) { - - const char* types[] = { "UNUSED", "DOT", "BEGIN", "END", "QUESTIONMARK", "STAR", "PLUS", "CHAR_TYPE", "CHAR_CLASS", "INV_CHAR_CLASS", "DIGIT", "NOT_DIGIT", "ALPHA", "NOT_ALPHA", "WHITESPACE" , "NOT_WHITESPACE", /* "BRANCH" */ }; - int i; - int j; - char c; - - for(i = 0; i < MAX_REGEXP_OBJECTS; ++i) { - if(pattern[i].type == UNUSED) { - break; - } - - printf("type: %s", types[pattern[i].type]); - if((pattern[i].type == CHAR_CLASS) || (pattern[i].type == INV_CHAR_CLASS)) { - printf(" ["); - for(j = 0; j < MAX_CHAR_CLASS_LEN; ++j) { - c = pattern[i].ccl[j]; - if((c == '\0') || (c == ']')) { - break; - } - printf("%c", c); - } - printf("]"); - } else if(pattern[i].type == CHAR_TYPE) { - printf(" '%c'", pattern[i].ch); - } - printf("\n"); - } -} - - - -/* Private functions: */ -static int matchdigit (char c) { - - return ((c >= '0') && (c <= '9')); -} - -static int matchalpha (char c) { - - return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')); -} - -static int matchwhitespace (char c) { - - return ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') || (c == '\f') || (c == '\v')); -} - -static int matchalphanum (char c) { - - return ((c == '_') || matchalpha(c) || matchdigit(c)); -} - -static int matchrange (char c, const char* str) { - - return ((c != '-') && (str[0] != '\0') && (str[0] != '-') && - (str[1] == '-') && (str[1] != '\0') && - (str[2] != '\0') && ((c >= str[0]) && (c <= str[2]))); -} - -static int matchdot (char c) { - - return ((c != '\n') && (c != '\r')); -} - -static int ismetachar (char c) { - - return ((c == 's') || (c == 'S') || (c == 'w') || (c == 'W') || (c == 'd') || (c == 'D')); -} - -static int matchmetachar (char c, const char* str) { - - switch(str[0]) { - case 'd': return matchdigit(c); - case 'D': return !matchdigit(c); - case 'w': return matchalphanum(c); - case 'W': return !matchalphanum(c); - case 's': return matchwhitespace(c); - case 'S': return !matchwhitespace(c); - default: return (c == str[0]); - } -} - -static int matchcharclass (char c, const char* str) { - - do { - if(matchrange(c, str)) { - return 1; - } else if(str[0] == '\\') { - /* Escape-char: increment str-ptr and match on next char */ - str += 1; - if(matchmetachar(c, str)) { - return 1; - } else if((c == str[0]) && !ismetachar(c)) { - return 1; - } - } else if(c == str[0]) { - if(c == '-') { - return ((str[-1] == '\0') || (str[1] == '\0')); - } else { - return 1; - } - } - } while(*str++ != '\0'); - - return 0; -} - -static int matchone (regex_t p, char c) { - - switch(p.type) { - case DOT: return matchdot(c); - case CHAR_CLASS: return matchcharclass(c, (const char*)p.ccl); - case INV_CHAR_CLASS: return !matchcharclass(c, (const char*)p.ccl); - case DIGIT: return matchdigit(c); - case NOT_DIGIT: return !matchdigit(c); - case ALPHA: return matchalphanum(c); - case NOT_ALPHA: return !matchalphanum(c); - case WHITESPACE: return matchwhitespace(c); - case NOT_WHITESPACE: return !matchwhitespace(c); - default: return (p.ch == c); - } -} - -static int matchstar (regex_t p, regex_t* pattern, const char* text, int* matchlength) { - - int prelen = *matchlength; - const char* prepoint = text; - - while((text[0] != '\0') && matchone(p, *text)) { - text++; - (*matchlength)++; - } - - while(text >= prepoint) { - if(matchpattern(pattern, text--, matchlength)) { - return 1; - } - (*matchlength)--; - } - - *matchlength = prelen; - - return 0; -} - -static int matchplus (regex_t p, regex_t* pattern, const char* text, int* matchlength) { - - const char* prepoint = text; - - while((text[0] != '\0') && matchone(p, *text)) { - text++; - (*matchlength)++; - } - - while(text > prepoint) { - if(matchpattern(pattern, text--, matchlength)) { - return 1; - } - (*matchlength)--; - } - - return 0; -} - -static int matchquestion (regex_t p, regex_t* pattern, const char* text, int* matchlength) { - - if(p.type == UNUSED) { - return 1; - } - - if(matchpattern(pattern, text, matchlength)) { - return 1; - } - - if(*text && matchone(p, *text++)) { - if(matchpattern(pattern, text, matchlength)) { - (*matchlength)++; - return 1; - } - } - - return 0; -} - - -#if 0 - -/* Recursive matching */ -static int matchpattern (regex_t* pattern, const char* text, int *matchlength) { - - int pre = *matchlength; - - if((pattern[0].type == UNUSED) || (pattern[1].type == QUESTIONMARK)) { - return matchquestion(pattern[1], &pattern[2], text, matchlength); - } else if(pattern[1].type == STAR) { - return matchstar(pattern[0], &pattern[2], text, matchlength); - } else if(pattern[1].type == PLUS) { - return matchplus(pattern[0], &pattern[2], text, matchlength); - } else if((pattern[0].type == END) && pattern[1].type == UNUSED) { - return text[0] == '\0'; - } else if((text[0] != '\0') && matchone(pattern[0], text[0])) { - (*matchlength)++; - return matchpattern(&pattern[1], text+1); - } else { - *matchlength = pre; - return 0; - } -} - -#else - -/* Iterative matching */ -static int matchpattern (regex_t* pattern, const char* text, int* matchlength) { - - int pre = *matchlength; - - do { - if((pattern[0].type == UNUSED) || (pattern[1].type == QUESTIONMARK)) { - return matchquestion(pattern[0], &pattern[2], text, matchlength); - } else if(pattern[1].type == STAR) { - return matchstar(pattern[0], &pattern[2], text, matchlength); - } else if(pattern[1].type == PLUS) { - return matchplus(pattern[0], &pattern[2], text, matchlength); - } else if((pattern[0].type == END) && pattern[1].type == UNUSED) { - return (text[0] == '\0'); - } -/* Branching is not working properly - else if (pattern[1].type == BRANCH) - { - return (matchpattern(pattern, text) || matchpattern(&pattern[2], text)); - } -*/ - (*matchlength)++; - } while((text[0] != '\0') && matchone(*pattern++, *text++)); - - *matchlength = pre; - - return 0; -} - -#endif diff --git a/bundles/n2n_ntop_v3/src/network_traffic_filter.c b/bundles/n2n_ntop_v3/src/network_traffic_filter.c deleted file mode 100644 index 9ec76a2c..00000000 --- a/bundles/n2n_ntop_v3/src/network_traffic_filter.c +++ /dev/null @@ -1,783 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" -#include "network_traffic_filter.h" -#include "uthash.h" - -// cache that hit less than 10 while 10000 package processed will be delete; -#define CLEAR_CACHE_EVERY_X_COUNT 10000 -#define CLAER_CACHE_ACTIVE_COUNT 10 - -/* for [-Wmissing-declarations] */ -const char* get_filter_packet_proto_name (filter_packet_proto proto); - -const char* get_filter_packet_proto_name (filter_packet_proto proto) { - - switch(proto) { - case FPP_ARP: - return "ARP"; - case FPP_TCP: - return "TCP"; - case FPP_UDP: - return "UDP"; - case FPP_ICMP: - return "ICMP"; - case FPP_IGMP: - return "IGMP"; - default: - return "UNKNOWN_PROTO"; - } -} - - -/* for [-Wmissing-declarations] */ -const char* get_filter_packet_info_log_string (packet_address_proto_info_t* info); - -const char* get_filter_packet_info_log_string (packet_address_proto_info_t* info) { - - static char buf[1024] = {0}; - - switch(info->proto) { - case FPP_ARP: - case FPP_ICMP: - case FPP_IGMP: - return get_filter_packet_proto_name(info->proto); - case FPP_TCP: - case FPP_UDP: { - struct in_addr src, dst; - - src.s_addr = info->src_ip; - dst.s_addr = info->dst_ip; - const char* proto = get_filter_packet_proto_name(info->proto); - char src_ip[64] = {0}; - char dst_ip[64] = {0}; - strcpy(src_ip, inet_ntoa(src)); - strcpy(dst_ip, inet_ntoa(dst)); - sprintf(buf, "%s\t%s:%d->%s:%d", proto, src_ip, info->src_port, dst_ip, info->dst_port); - return buf; - } - default: - return "UNKNOWN_PROTO"; - } -} - -/* for [-Wmissing-declarations] */ -void collect_packet_info (packet_address_proto_info_t* out_info, unsigned char *buffer, int size); - -void collect_packet_info (packet_address_proto_info_t* out_info, unsigned char *buffer, int size) { - - ether_hdr_t *hdr_ether = (ether_hdr_t*)buffer; - uint16_t ether_type = ntohs(hdr_ether->type); - struct n2n_iphdr *hdr_ip = NULL; - struct n2n_tcphdr *hdr_tcp = NULL; - struct n2n_udphdr *udp_hdr = NULL; - - memset(out_info, 0, sizeof(packet_address_proto_info_t)); - - switch(ether_type) { - case 0x0800: { - buffer += sizeof(ether_hdr_t); - size -= sizeof(ether_hdr_t); - if(size <= 0) { - return; - } - hdr_ip = (struct n2n_iphdr*)buffer; - - switch(hdr_ip->version) { - case 4: { - out_info->src_ip = hdr_ip->saddr; - out_info->dst_ip = hdr_ip->daddr; - switch(hdr_ip->protocol) { - case 0x01: - out_info->proto = FPP_ICMP; - break; - case 0x02: - out_info->proto = FPP_IGMP; - break; - case 0x06: { - out_info->proto = FPP_TCP; - buffer += hdr_ip->ihl * 4; - size -= hdr_ip->ihl * 4; - if(size <= 0) { - return; - } - hdr_tcp = (struct n2n_tcphdr*)buffer; - out_info->src_port = ntohs(hdr_tcp->source); - out_info->dst_port = ntohs(hdr_tcp->dest); - break; - } - case 0x11: { - out_info->proto = FPP_UDP; - buffer += hdr_ip->ihl * 4; - size -= hdr_ip->ihl * 4; - if(size <= 0) { - return; - } - udp_hdr = (struct n2n_udphdr*)buffer; - out_info->src_port = ntohs(udp_hdr->source); - out_info->dst_port = ntohs(udp_hdr->dest); - break; - } - default: - out_info->proto = FPP_UNKNOWN; - }; - break; - } - case 6: { - // TODO: IPV6 Not Support - out_info->proto = FPP_UNKNOWN; - break; - } - default: - out_info->proto = FPP_UNKNOWN; - } - break; - } - case 0x0806: - out_info->proto = FPP_ARP; - break; - case 0x86DD: - out_info->proto = FPP_UNKNOWN; - break; - default: - traceEvent(TRACE_DEBUG, "collect_packet_info stumbled across the unknown ether type 0x%04X", ether_type); - }; -} - -/* for [-Wmissing-declarations] */ -const char* get_filter_rule_info_log_string (filter_rule_t* rule); - -const char* get_filter_rule_info_log_string (filter_rule_t* rule) { - - static char buf[1024] = {0}; - char* print_start = buf; - char src_net[64] = {0}; - char dst_net[64] = {0}; - struct in_addr src, dst; - - src.s_addr = rule->key.src_net_cidr; - dst.s_addr = rule->key.dst_net_cidr; - strcpy(src_net, inet_ntoa(src)); - strcpy(dst_net, inet_ntoa(dst)); - print_start += sprintf(print_start, "%s/%d:[%d,%d],%s/%d:[%d,%d]", - src_net, rule->key.src_net_bit_len, - rule->key.src_port_range.start_port, rule->key.src_port_range.end_port, - dst_net, rule->key.dst_net_bit_len, - rule->key.dst_port_range.start_port, rule->key.dst_port_range.end_port -#if 0 - , - rule->bool_accept_tcp ? '+' : '-', rule->bool_accept_udp ? '+' : '-', rule->bool_accept_icmp ? '+' : '-' -#endif - ); - if(rule->key.bool_tcp_configured) { - print_start += sprintf(print_start, ",TCP%c", rule->bool_accept_tcp ? '+' : '-'); - } - - if(rule->key.bool_udp_configured) { - print_start += sprintf(print_start, ",UDP%c", rule->bool_accept_udp ? '+' : '-'); - } - - if(rule->key.bool_icmp_configured) { - print_start += sprintf(print_start, ",ICMP%c", rule->bool_accept_icmp ? '+' : '-'); - } - - return buf; -} - - - -/* for [-Wmissing-declarations] */ -uint8_t march_cidr_and_address (in_addr_t network, uint8_t net_bitlen, in_addr_t ip_addr); - -uint8_t march_cidr_and_address (in_addr_t network, uint8_t net_bitlen, in_addr_t ip_addr) { - - in_addr_t mask = 0, ip_addr_network = 0; - - network = ntohl(network); - ip_addr = ntohl(ip_addr); - uint32_t mask1 = net_bitlen != 0 ? ((~mask) << (32u-net_bitlen)) : 0; - ip_addr_network = ip_addr & mask1; - if(network == ip_addr_network) { - return net_bitlen + 1; // march 0.0.0.0/0 still march success, that case return 1 - } else { - return 0; - } -} - -/* for [-Wmissing-declarations] */ -uint8_t march_rule_and_cache_key (filter_rule_key_t *rule_key, packet_address_proto_info_t *pkt_addr_info); - -// if ports march, compare cidr. if cidr ok, return sum of src&dst cidr net_bitlen. means always select larger net_bitlen record when multi record is marched. -uint8_t march_rule_and_cache_key (filter_rule_key_t *rule_key, packet_address_proto_info_t *pkt_addr_info) { - - // march failed if proto is not configured at the rule. - switch(pkt_addr_info->proto) { - case FPP_ICMP: - if(!rule_key->bool_icmp_configured) { - return 0; - } - break; - case FPP_UDP: - if(!rule_key->bool_udp_configured) { - return 0; - } - break; - case FPP_TCP: - if(!rule_key->bool_tcp_configured) { - return 0; - } - break; - default: - return 0; - } - - // ignore ports for ICMP proto. - if(pkt_addr_info->proto == FPP_ICMP || (rule_key->src_port_range.start_port <= pkt_addr_info->src_port - && pkt_addr_info->src_port <= rule_key->src_port_range.end_port - && rule_key->dst_port_range.start_port <= pkt_addr_info->dst_port - && pkt_addr_info->dst_port <= rule_key->dst_port_range.end_port)) { - uint8_t march_src_score = march_cidr_and_address(rule_key->src_net_cidr, rule_key->src_net_bit_len, pkt_addr_info->src_ip); - uint8_t march_dst_score = march_cidr_and_address(rule_key->dst_net_cidr, rule_key->dst_net_bit_len, pkt_addr_info->dst_ip); - if((march_src_score > 0) && (march_dst_score > 0)) { - return march_src_score + march_dst_score; - } - } - - return(0); -} - -/* for [-Wmissing-declarations] */ -filter_rule_t* get_filter_rule (filter_rule_t **rules, packet_address_proto_info_t *pkt_addr_info); - -filter_rule_t* get_filter_rule (filter_rule_t **rules, packet_address_proto_info_t *pkt_addr_info) { - - filter_rule_t *item = 0, *tmp = 0, *marched_rule = 0; - int march_score = 0; - - HASH_ITER(hh, *rules, item, tmp) { - /* ... it is safe to delete and free s here */ - uint8_t cur_march_score = march_rule_and_cache_key(&(item->key), pkt_addr_info); - if(cur_march_score > march_score) { - marched_rule = item; - march_score = cur_march_score; - } - } - - return marched_rule; -} - - -/* for [-Wmissing-declarations] */ -void update_and_clear_cache_if_need (network_traffic_filter_t *filter); - -void update_and_clear_cache_if_need (network_traffic_filter_t *filter) { - - if(++(filter->work_count_scene_last_clear) > CLEAR_CACHE_EVERY_X_COUNT) { - filter_rule_pair_cache_t *item = NULL, *tmp = NULL; - HASH_ITER(hh, filter->connections_rule_cache, item, tmp) { - /* ... it is safe to delete and free s here */ - if(item->active_count < CLAER_CACHE_ACTIVE_COUNT) { - traceEvent(TRACE_DEBUG, "### DELETE filter cache %s", get_filter_packet_info_log_string(&item->key)); - HASH_DEL(filter->connections_rule_cache, item); - free(item); - } else { - item->active_count = 0; - } - } - filter->work_count_scene_last_clear = 0; - } -} - -/* for [-Wmissing-declarations] */ -filter_rule_pair_cache_t* get_or_create_filter_rule_cache (network_traffic_filter_t *filter, packet_address_proto_info_t *pkt_addr_info); - -filter_rule_pair_cache_t* get_or_create_filter_rule_cache (network_traffic_filter_t *filter, packet_address_proto_info_t *pkt_addr_info) { - - filter_rule_pair_cache_t* rule_cache_find_result = 0; - HASH_FIND(hh, filter->connections_rule_cache, pkt_addr_info, sizeof(packet_address_proto_info_t), rule_cache_find_result); - if(!rule_cache_find_result) { - filter_rule_t* rule = get_filter_rule(&filter->rules, pkt_addr_info); - if(!rule) { - return NULL; - } - - rule_cache_find_result = malloc(sizeof(filter_rule_pair_cache_t)); - memset(rule_cache_find_result, 0, sizeof(filter_rule_pair_cache_t)); - rule_cache_find_result->key = *pkt_addr_info; - switch(rule_cache_find_result->key.proto) { - case FPP_ICMP: - rule_cache_find_result->bool_allow_traffic = rule->bool_accept_icmp; - break; - case FPP_UDP: - rule_cache_find_result->bool_allow_traffic = rule->bool_accept_udp; - break; - case FPP_TCP: - rule_cache_find_result->bool_allow_traffic = rule->bool_accept_tcp; - break; - default: - traceEvent(TRACE_WARNING, "### Generate filter rule cache failed!"); - return NULL; - } - traceEvent(TRACE_DEBUG, "### ADD filter cache %s", get_filter_packet_info_log_string(&rule_cache_find_result->key)); - HASH_ADD(hh, filter->connections_rule_cache, key, sizeof(packet_address_proto_info_t), rule_cache_find_result); - } - ++(rule_cache_find_result->active_count); - update_and_clear_cache_if_need(filter); - - return rule_cache_find_result; -} - -/* for [-Wmissing-declarations] */ -n2n_verdict filter_packet_from_peer (network_traffic_filter_t *filter, n2n_edge_t *eee, const n2n_sock_t *peer, uint8_t *payload, uint16_t payload_size); - -n2n_verdict filter_packet_from_peer (network_traffic_filter_t *filter, n2n_edge_t *eee, const n2n_sock_t *peer, uint8_t *payload, uint16_t payload_size) { - - filter_rule_pair_cache_t *cur_pkt_rule = 0; - packet_address_proto_info_t pkt_info; - - collect_packet_info(&pkt_info, payload, payload_size); - cur_pkt_rule = get_or_create_filter_rule_cache(filter, &pkt_info); - if(cur_pkt_rule && !cur_pkt_rule->bool_allow_traffic) { - traceEvent(TRACE_DEBUG, "### DROP %s", get_filter_packet_info_log_string(&pkt_info)); - return N2N_DROP; - } - - return N2N_ACCEPT; -} - -/* for [-Wmissing-declarations] */ -n2n_verdict filter_packet_from_tap (network_traffic_filter_t *filter, n2n_edge_t *eee, uint8_t *payload, uint16_t payload_size); - -n2n_verdict filter_packet_from_tap (network_traffic_filter_t *filter, n2n_edge_t *eee, uint8_t *payload, uint16_t payload_size) { - - filter_rule_pair_cache_t *cur_pkt_rule = 0; - packet_address_proto_info_t pkt_info; - - collect_packet_info(&pkt_info, payload, payload_size); - cur_pkt_rule = get_or_create_filter_rule_cache(filter, &pkt_info); - if(cur_pkt_rule && !cur_pkt_rule->bool_allow_traffic) { - traceEvent(TRACE_DEBUG, "### DROP %s", get_filter_packet_info_log_string(&pkt_info)); - return N2N_DROP; - } - - return N2N_ACCEPT; -} - -/* for [-Wmissing-declarations] */ -network_traffic_filter_t *create_network_traffic_filter (); - -network_traffic_filter_t *create_network_traffic_filter () { - - network_traffic_filter_t *filter = malloc(sizeof(network_traffic_filter_t)); - - memset(filter, 0, sizeof(network_traffic_filter_t)); - filter->filter_packet_from_peer = filter_packet_from_peer; - filter->filter_packet_from_tap = filter_packet_from_tap; - - return filter; -} - -/* for [-Wmissing-declarations] */ -void destroy_network_traffic_filter (network_traffic_filter_t *filter); - -void destroy_network_traffic_filter (network_traffic_filter_t *filter) { - - filter_rule_t *el = 0, *tmp = 0; - filter_rule_pair_cache_t* el1 = 0, * tmp1 = 0; - - HASH_ITER(hh, filter->rules, el, tmp) { - HASH_DEL(filter->rules, el); - free(el); - } - - HASH_ITER(hh, filter->connections_rule_cache, el1, tmp1) { - HASH_DEL(filter->connections_rule_cache, el1); - free(el); - } - - free(filter); -} - -/* for [-Wmissing-declarations] */ -void network_traffic_filter_add_rule (network_traffic_filter_t* filter, filter_rule_t* rules); - -void network_traffic_filter_add_rule (network_traffic_filter_t* filter, filter_rule_t* rules) { - - filter_rule_t *item = NULL, *tmp = NULL; - - HASH_ITER(hh, rules, item, tmp) { - filter_rule_t *new_rule = malloc(sizeof(filter_rule_t)); - memcpy(new_rule, item, sizeof(filter_rule_t)); - HASH_ADD(hh, filter->rules, key, sizeof(filter_rule_key_t), new_rule); - traceEvent(TRACE_NORMAL, "### ADD network traffic filter %s", get_filter_rule_info_log_string(new_rule)); - } -} - -/* for [-Wmissing-declarations] */ -in_addr_t get_int32_addr_from_ip_string (const char* begin, const char* next_pos_of_last_char); - -in_addr_t get_int32_addr_from_ip_string (const char* begin, const char* next_pos_of_last_char) { - - char buf[16] = {0}; - - if((next_pos_of_last_char - begin) > 15) { - traceEvent(TRACE_WARNING, "Internal Error"); - return -1; - } - memcpy(buf, begin, (next_pos_of_last_char - begin)); - - return inet_addr(buf); -} - -/* for [-Wmissing-declarations] */ -int get_int32_from_number_string (const char* begin, const char* next_pos_of_last_char); - -int get_int32_from_number_string (const char* begin, const char* next_pos_of_last_char) { - - char buf[6] = {0}; - - if((next_pos_of_last_char - begin) > 5 ) { // max is 65535, 5 char - traceEvent(TRACE_WARNING, "Internal Error"); - return 0; - } - memcpy(buf, begin, (next_pos_of_last_char - begin)); - - return atoi(buf); -} - -/* for [-Wmissing-declarations] */ -void process_traffic_filter_proto (const char* begin, const char* next_pos_of_last_char, filter_rule_t *rule_struct); - -void process_traffic_filter_proto (const char* begin, const char* next_pos_of_last_char, filter_rule_t *rule_struct) { - - char buf[6] = {0}; - - if((next_pos_of_last_char - begin) > 5 ) { // max length str is "ICMP+", 5 char - traceEvent(TRACE_WARNING, "Internal Error"); - } - memcpy(buf, begin, (next_pos_of_last_char - begin)); - - if(strstr(buf, "TCP")) { - rule_struct->key.bool_tcp_configured = 1; - rule_struct->bool_accept_tcp = buf[3] == '+'; - } else if(strstr(buf, "UDP")) { - rule_struct->key.bool_udp_configured = 1; - rule_struct->bool_accept_udp = buf[3] == '+'; - } else if(strstr(buf, "ICMP")) { - rule_struct->key.bool_icmp_configured = 1; - rule_struct->bool_accept_icmp = buf[4] == '+'; - } else { - traceEvent(TRACE_WARNING, "Invalid Proto : %s", buf); - } -} - -typedef enum { - FPS_SRC_NET = 1, - FPS_SRC_NET_BIT_LEN, - FPS_SRC_PORT_SINGLE, - FPS_SRC_PORT_RANGE, - FPS_SRC_PORT_START, - FPS_SRC_PORT_END, - FPS_DST_NET, - FPS_DST_NET_BIT_LEN, - FPS_DST_PORT_SINGLE, - FPS_DST_PORT_RANGE, - FPS_DST_PORT_START, - FPS_DST_PORT_END, - FPS_PROTO -} filter_process_stage; - -/* for [-Wmissing-declarations] */ -uint8_t process_traffic_filter_rule_str (const char *rule_str, filter_rule_t *rule_struct); - -uint8_t process_traffic_filter_rule_str (const char *rule_str, filter_rule_t *rule_struct) { - - const char *cur_pos = rule_str, *stage_begin_pos = rule_str; - filter_process_stage stage = FPS_SRC_NET; - - while(1) { - switch(stage) { - case FPS_SRC_NET: { - if((*cur_pos >= '0' && *cur_pos <= '9') || *cur_pos == '.') { - ; // Normal FPS_SRC_NET, next char - } else if(*cur_pos == '/') { - // FPS_SRC_NET finish, next is FPS_SRC_NET_BIT_LEN - rule_struct->key.src_net_cidr = get_int32_addr_from_ip_string(stage_begin_pos, cur_pos); - stage_begin_pos = cur_pos + 1; - stage = FPS_SRC_NET_BIT_LEN; - } else if(*cur_pos == ':') { - // FPS_SRC_NET finish, ignore FPS_SRC_NET_BIT_LEN(default 32), next is one of FPS_SRC_PORT_RANGE/FPS_SRC_PORT_SINGLE - rule_struct->key.src_net_cidr = get_int32_addr_from_ip_string(stage_begin_pos, cur_pos); - rule_struct->key.src_net_bit_len = 32; - stage_begin_pos = cur_pos + 1; - if(*(cur_pos + 1) == '[') { - stage = FPS_SRC_PORT_RANGE; - } else { - stage = FPS_SRC_PORT_SINGLE; - } - } else if(*cur_pos == ',') { - // FPS_SRC_NET finish, ignore FPS_SRC_NET_BIT_LEN(default 32), ignore FPS_SRC_PORT(default all), - // next is FPS_DST_NET - rule_struct->key.src_net_cidr = get_int32_addr_from_ip_string(stage_begin_pos, cur_pos); - rule_struct->key.src_net_bit_len = 32; - rule_struct->key.src_port_range.start_port = 0; - rule_struct->key.src_port_range.end_port = 65535; - stage_begin_pos = cur_pos + 1; - stage = FPS_DST_NET; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_SRC_NET_BIT_LEN: { - if((*cur_pos >= '0') && (*cur_pos <= '9')) { - ; // Normal FPS_SRC_NET_BIT_LEN, next char - } else if(*cur_pos == ':') { - // FPS_SRC_NET_BIT_LEN finish, next is one of FPS_SRC_PORT_RANGE/FPS_SRC_PORT_SINGLE - rule_struct->key.src_net_bit_len = get_int32_from_number_string(stage_begin_pos, cur_pos); - stage_begin_pos = cur_pos + 1; - if(*(cur_pos + 1) == '[') { - stage = FPS_SRC_PORT_RANGE; - } else { - stage = FPS_SRC_PORT_SINGLE; - } - } else if(*cur_pos == ',') { - // FPS_SRC_NET_BIT_LEN finish, ignore FPS_SRC_PORT(default all), next is FPS_DST_NET - rule_struct->key.src_net_bit_len = get_int32_from_number_string(stage_begin_pos, cur_pos);; - rule_struct->key.src_port_range.start_port = 0; - rule_struct->key.src_port_range.end_port = 65535; - stage_begin_pos = cur_pos + 1; - stage = FPS_DST_NET; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_SRC_PORT_SINGLE: { - if((*cur_pos >= '0') && (*cur_pos <= '9')) { - ; // Normal FPS_SRC_PORT_SINGLE, next char - } else if(*cur_pos == ',') { - // FPS_SRC_PORT_SINGLE finish, next is FPS_DST_NET - rule_struct->key.src_port_range.start_port = get_int32_from_number_string(stage_begin_pos, cur_pos); - rule_struct->key.src_port_range.end_port = rule_struct->key.src_port_range.start_port; - stage_begin_pos = cur_pos + 1; - stage = FPS_DST_NET; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_SRC_PORT_RANGE: { - if(*cur_pos == '[') { - stage_begin_pos = cur_pos + 1; - stage = FPS_SRC_PORT_START; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_SRC_PORT_START: { - if((*cur_pos >= '0') && (*cur_pos <= '9')) { - ; // Normal FPS_SRC_PORT_START, next char - } else if(*cur_pos == ',') { - // FPS_SRC_PORT_START finish, next is FPS_SRC_PORT_END - rule_struct->key.src_port_range.start_port = get_int32_from_number_string(stage_begin_pos, cur_pos); - stage_begin_pos = cur_pos + 1; - stage = FPS_SRC_PORT_END; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_SRC_PORT_END: { - if((*cur_pos >= '0') && (*cur_pos <= '9')) { - ; // Normal FPS_SRC_PORT_END, next char - } else if((*cur_pos == ']') && (*(cur_pos + 1) == ',')) { - // FPS_SRC_PORT_END finish, next is FPS_DST_NET - rule_struct->key.src_port_range.end_port = get_int32_from_number_string(stage_begin_pos, cur_pos); - stage_begin_pos = cur_pos + 2; - stage = FPS_DST_NET; - ++cur_pos; //skip next char ',' - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_DST_NET: { - if((*cur_pos >= '0' && *cur_pos <= '9') || *cur_pos == '.') { - ; // Normal FPS_DST_NET, next char - } else if(*cur_pos == '/') { - // FPS_DST_NET finish, next is FPS_DST_NET_BIT_LEN - rule_struct->key.dst_net_cidr = get_int32_addr_from_ip_string(stage_begin_pos, cur_pos); - stage_begin_pos = cur_pos + 1; - stage = FPS_DST_NET_BIT_LEN; - } else if(*cur_pos == ':') { - // FPS_DST_NET finish, ignore FPS_DST_NET_BIT_LEN(default 32), next is one of FPS_DST_PORT_RANGE/FPS_DST_PORT_SINGLE - rule_struct->key.dst_net_cidr = get_int32_addr_from_ip_string(stage_begin_pos, cur_pos); - rule_struct->key.dst_net_bit_len = 32; - stage_begin_pos = cur_pos + 1; - if(*(cur_pos + 1) == '[') { - stage = FPS_DST_PORT_RANGE; - } else { - stage = FPS_DST_PORT_SINGLE; - } - } else if((*cur_pos == ',') || (*cur_pos == 0)) { - // FPS_DST_NET finish, ignore FPS_DST_NET_BIT_LEN(default 32), ignore FPS_DST_PORT(default all), - // next is FPS_PROTO - rule_struct->key.dst_net_cidr = get_int32_addr_from_ip_string(stage_begin_pos, cur_pos); - rule_struct->key.dst_net_bit_len = 32; - rule_struct->key.dst_port_range.start_port = 0; - rule_struct->key.dst_port_range.end_port = 65535; - stage_begin_pos = cur_pos + 1; - stage = FPS_PROTO; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_DST_NET_BIT_LEN: { - if((*cur_pos >= '0') && (*cur_pos <= '9')) { - ; // Normal FPS_DST_NET_BIT_LEN, next char - } else if(*cur_pos == ':') { - // FPS_DST_NET_BIT_LEN finish, next is one of FPS_DST_PORT_RANGE/FPS_DST_PORT_SINGLE - rule_struct->key.dst_net_bit_len = get_int32_from_number_string(stage_begin_pos, cur_pos); - stage_begin_pos = cur_pos + 1; - if(*(cur_pos + 1) == '[') { - stage = FPS_DST_PORT_RANGE; - } else { - stage = FPS_DST_PORT_SINGLE; - } - } else if((*cur_pos == ',') || (*cur_pos == 0)) { - // FPS_DST_NET_BIT_LEN finish, ignore FPS_DST_PORT(default all), next is FPS_PROTO - rule_struct->key.dst_net_bit_len = get_int32_from_number_string(stage_begin_pos, cur_pos);; - rule_struct->key.dst_port_range.start_port = 0; - rule_struct->key.dst_port_range.end_port = 65535; - stage_begin_pos = cur_pos + 1; - stage = FPS_PROTO; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_DST_PORT_SINGLE: { - if((*cur_pos >= '0') && (*cur_pos <= '9')) { - ; // Normal FPS_DST_PORT_SINGLE, next char - } else if((*cur_pos == ',') || (*cur_pos == 0)) { - // FPS_DST_PORT_SINGLE finish, next is FPS_PROTO - rule_struct->key.dst_port_range.start_port = get_int32_from_number_string(stage_begin_pos, cur_pos); - rule_struct->key.dst_port_range.end_port = rule_struct->key.dst_port_range.start_port; - stage_begin_pos = cur_pos + 1; - stage = FPS_PROTO; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_DST_PORT_RANGE: { - if(*cur_pos == '[') { - stage_begin_pos = cur_pos + 1; - stage = FPS_DST_PORT_START; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_DST_PORT_START: { - if((*cur_pos >= '0') && (*cur_pos <= '9')) { - ; // Normal FPS_DST_PORT_START, next char - } else if(*cur_pos == ',') { - // FPS_DST_PORT_START finish, next is FPS_DST_PORT_END - rule_struct->key.dst_port_range.start_port = get_int32_from_number_string(stage_begin_pos, cur_pos); - stage_begin_pos = cur_pos + 1; - stage = FPS_DST_PORT_END; - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_DST_PORT_END: { - if((*cur_pos >= '0') && (*cur_pos <= '9')) { - ; // Normal FPS_DST_PORT_END, next char - } else if(*cur_pos == ']') { - // FPS_DST_PORT_END finish, next is FPS_PROTO - rule_struct->key.dst_port_range.end_port = get_int32_from_number_string(stage_begin_pos, cur_pos); - stage = FPS_PROTO; - if(*(cur_pos + 1) == ',') { - stage_begin_pos = cur_pos + 2; - ++cur_pos; //skip next char ',' - } else if(*(cur_pos + 1) != 0) { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - } else { - traceEvent(TRACE_WARNING, "process filter rule with error char %c at pos %d", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - - case FPS_PROTO: { - if((*cur_pos != '-') && (*cur_pos != '+') && (*cur_pos != ',')) { - ; // Normal FPS_PROTO. next char - } else if(*cur_pos != ',') { - process_traffic_filter_proto(stage_begin_pos, cur_pos + 1, rule_struct); - if(*(cur_pos+1) == 0) { // end of whole rule string - break; - } else { // new proto info, and skip next char ',' - stage_begin_pos = cur_pos + 2; - ++cur_pos; - } - } else { - traceEvent(TRACE_WARNING, "Internal Error: ',' should skiped", *cur_pos, cur_pos - rule_str); - return 0; - } - break; - } - } - - if(0 == *cur_pos) { - break; - } - ++cur_pos; - } - - return 1; -} diff --git a/bundles/n2n_ntop_v3/src/pearson.c b/bundles/n2n_ntop_v3/src/pearson.c deleted file mode 100644 index 68f9e38a..00000000 --- a/bundles/n2n_ntop_v3/src/pearson.c +++ /dev/null @@ -1,224 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -// taken from https://github.com/Logan007/pearsonB -// this is free and unencumbered software released into the public domain - - -#include "pearson.h" - - -// Christopher Wellons' triple32 from https://github.com/skeeto/hash-prospector -// published under The Unlicense -#define permute32(in) \ - in ^= in >> 17; \ - in *= 0xed5ad4bb; \ - in ^= in >> 11; \ - in *= 0xac4c1b51; \ - in ^= in >> 15; \ - in *= 0x31848bab; \ - in ^= in >> 14 - -// David Stafford's Mix13 from http://zimbry.blogspot.com/2011/09/better-bit-mixing-improving-on.html -// the author clarified via eMail that this of his work is released to the public domain -#define permute64(in) \ - in ^= (in >> 30); \ - in *= 0xbf58476d1ce4e5b9; \ - in ^= (in >> 27); \ - in *= 0x94d049bb133111eb; \ - in ^= (in >> 31) - -#define dec1(in) \ - in-- - -#define dec2(in) \ - dec1(in); \ - dec1(in) - -#define dec3(in) \ - dec2(in); \ - dec1(in) - -#define dec4(in) \ - dec3(in); \ - dec1(in) - -#define hash_round(hash, in, part) \ - hash##part ^= in; \ - dec##part(hash##part); \ - permute64(hash##part) - - -void pearson_hash_256 (uint8_t *out, const uint8_t *in, size_t len) { - - uint64_t *current; - current = (uint64_t*)in; - uint64_t org_len = len; - uint64_t hash1 = 0; - uint64_t hash2 = 0; - uint64_t hash3 = 0; - uint64_t hash4 = 0; - - while (len > 7) { - // digest words little endian first - hash_round(hash, le64toh(*current), 1); - hash_round(hash, le64toh(*current), 2); - hash_round(hash, le64toh(*current), 3); - hash_round(hash, le64toh(*current), 4); - - current++; - len-=8; - } - - // handle the rest - hash1 = ~hash1; - hash2 = ~hash2; - hash3 = ~hash3; - hash4 = ~hash4; - - while(len) { - // byte-wise, no endianess - hash_round(hash, *(uint8_t*)current, 1); - hash_round(hash, *(uint8_t*)current, 2); - hash_round(hash, *(uint8_t*)current, 3); - hash_round(hash, *(uint8_t*)current, 4); - - current = (uint64_t*)((uint8_t*)current + 1); - len--; - } - - // digest length - hash1 = ~hash1; - hash2 = ~hash2; - hash3 = ~hash3; - hash4 = ~hash4; - - hash_round(hash, org_len, 1); - hash_round(hash, org_len, 2); - hash_round(hash, org_len, 3); - hash_round(hash, org_len, 4); - - // hash string is stored big endian, the natural way to read - uint64_t *o; - o = (uint64_t*)out; - *o = htobe64(hash4); - o++; - *o = htobe64(hash3); - o++; - *o = htobe64(hash2); - o++; - *o = htobe64(hash1); -} - - -void pearson_hash_128 (uint8_t *out, const uint8_t *in, size_t len) { - - uint64_t *current; - current = (uint64_t*)in; - uint64_t org_len = len; - uint64_t hash1 = 0; - uint64_t hash2 = 0; - - while (len > 7) { - // digest words little endian first - hash_round(hash, le64toh(*current), 1); - hash_round(hash, le64toh(*current), 2); - - current++; - len-=8; - } - - // handle the rest - hash1 = ~hash1; - hash2 = ~hash2; - - while(len) { - // byte-wise, no endianess - hash_round(hash, *(uint8_t*)current, 1); - hash_round(hash, *(uint8_t*)current, 2); - - current = (uint64_t*)((uint8_t*)current + 1); - len--; - } - - // digest length - hash1 = ~hash1; - hash2 = ~hash2; - - hash_round(hash, org_len, 1); - hash_round(hash, org_len, 2); - - // hash string is stored big endian, the natural way to read - uint64_t *o; - o = (uint64_t*)out; - *o = htobe64(hash2); - o++; - *o = htobe64(hash1); -} - - -uint64_t pearson_hash_64 (const uint8_t *in, size_t len) { - - uint64_t *current; - current = (uint64_t*)in; - uint64_t org_len = len; - uint64_t hash1 = 0; - - while(len > 7) { - // digest words little endian first - hash_round(hash, le64toh(*current), 1); - - current++; - len-=8; - } - - // handle the rest - hash1 = ~hash1; - while(len) { - // byte-wise, no endianess - hash_round(hash, *(uint8_t*)current, 1); - - current = (uint64_t*)((uint8_t*)current + 1); - len--; - } - - // digest length - hash1 = ~hash1; - hash_round(hash, org_len, 1); - - // caller is responsible for storing it big endian to memory (if ever) - return hash1; -} - - -uint32_t pearson_hash_32 (const uint8_t *in, size_t len) { - - return pearson_hash_64(in, len); -} - - -uint16_t pearson_hash_16 (const uint8_t *in, size_t len) { - - return pearson_hash_64(in, len); -} - - -void pearson_hash_init(void) { - -} diff --git a/bundles/n2n_ntop_v3/src/random_numbers.c b/bundles/n2n_ntop_v3/src/random_numbers.c deleted file mode 100644 index 0adb8c6f..00000000 --- a/bundles/n2n_ntop_v3/src/random_numbers.c +++ /dev/null @@ -1,244 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "random_numbers.h" - - -// the following code offers an alterate pseudo random number generator -// namely XORSHIFT128+ to use instead of C's rand() -// its performance is on par with C's rand() - - -// the state must be seeded in a way that it is not all zero, choose some -// arbitrary defaults (in this case: taken from splitmix64) -static rn_generator_state_t rn_current_state = { - .a = 0x9E3779B97F4A7C15, - .b = 0xBF58476D1CE4E5B9 -}; - - -// used for mixing the initializing seed -static uint64_t splitmix64 (splitmix64_state_t *state) { - - uint64_t result = state->s; - - state->s = result + 0x9E3779B97F4A7C15; - - result = (result ^ (result >> 30)) * 0xBF58476D1CE4E5B9; - result = (result ^ (result >> 27)) * 0x94D049BB133111EB; - - return result ^ (result >> 31); -} - - -int n2n_srand (uint64_t seed) { - - uint8_t i; - splitmix64_state_t smstate = { seed }; - - rn_current_state.a = 0; - rn_current_state.b = 0; - - rn_current_state.a = splitmix64 (&smstate); - rn_current_state.b = splitmix64 (&smstate); - - // the following lines could be deleted as soon as it is formally prooved that - // there is no seed leading to (a == b == 0). until then, just to be safe: - if((rn_current_state.a == 0) && (rn_current_state.b == 0)) { - rn_current_state.a = 0x9E3779B97F4A7C15; - rn_current_state.b = 0xBF58476D1CE4E5B9; - } - - // stabilize in unlikely case of weak state with only a few bits set - for(i = 0; i < 32; i++) - n2n_rand(); - - return 0; -} - - -// the following code of xorshift128p was taken from -// https://en.wikipedia.org/wiki/Xorshift as of July, 2019 -// and thus is considered public domain -uint64_t n2n_rand (void) { - - uint64_t t = rn_current_state.a; - uint64_t const s = rn_current_state.b; - - rn_current_state.a = s; - t ^= t << 23; - t ^= t >> 17; - t ^= s ^ (s >> 26); - rn_current_state.b = t; - - return t + s; -} - - -// the following code tries to gather some entropy from several sources -// for use as seed. Note, that this code does not set the random generator -// state yet, a call to n2n_srand (n2n_seed()) would do -uint64_t n2n_seed (void) { - - uint64_t seed = 0; /* this could even go uninitialized */ - uint64_t ret = 0; /* this could even go uninitialized */ - size_t i = 0; - -#ifdef SYS_getrandom - int rc = -1; - for(i = 0; (i < RND_RETRIES) && (rc != sizeof(seed)); i++) { - rc = syscall (SYS_getrandom, &seed, sizeof(seed), GRND_NONBLOCK); - // if successful, rc should contain the requested number of random bytes - if(rc != sizeof(seed)) { - if (errno != EAGAIN) { - traceEvent(TRACE_ERROR, "n2n_seed faced error errno=%u from getrandom syscall.", errno); - break; - } - } - } - - // if we still see an EAGAIN error here, we must have run out of retries - if(errno == EAGAIN) { - traceEvent(TRACE_ERROR, "n2n_seed saw getrandom syscall indicate not being able to provide enough entropy yet."); - } -#endif - - // as we want randomness, it does no harm to add up even uninitialized values or - // erroneously arbitrary values returned from the syscall for the first time - ret += seed; - - // __RDRND__ is set only if architecturual feature is set, e.g. compiled with -march=native -#ifdef __RDRND__ - for(i = 0; i < RND_RETRIES; i++) { - if(_rdrand64_step((unsigned long long*)&seed)) { - // success! - // from now on, we keep this inside the loop because in case of failure - // and with unchanged values, we do not want to double the previous value - ret += seed; - break; - } - // continue loop to try again otherwise - } - if(i == RND_RETRIES) { - traceEvent(TRACE_ERROR, "n2n_seed was not able to get a hardware generated random number from RDRND."); - } -#endif - - // __RDSEED__ ist set only if architecturual feature is set, e.g. compile with -march=native -#ifdef __RDSEED__ -#if __GNUC__ > 4 - for(i = 0; i < RND_RETRIES; i++) { - if(_rdseed64_step((unsigned long long*)&seed)) { - // success! - ret += seed; - break; - } - // continue loop to try again otherwise - } - if(i == RND_RETRIES) { - traceEvent(TRACE_ERROR, "n2n_seed was not able to get a hardware generated random number from RDSEED."); - } -#endif -#endif - -#ifdef WIN32 - HCRYPTPROV crypto_provider; - CryptAcquireContext (&crypto_provider, NULL, NULL, - PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); - CryptGenRandom (crypto_provider, 8, &seed); - CryptReleaseContext (crypto_provider, 0); - ret += seed; -#endif - - seed = time(NULL); /* UTC in seconds */ - ret += seed; - - seed = clock(); /* ticks since program start */ - seed *= 18444244737; - ret += seed; - - return ret; -} - -// an integer squrare root approximation -// from https://stackoverflow.com/a/1100591 -static int ftbl[33] = { - 0, 1, 1, 2, 2, 4, 5, 8, 11, 16, 22, 32, 45, 64, 90, - 128, 181 ,256 ,362, 512, 724, 1024, 1448, 2048, 2896, - 4096, 5792, 8192, 11585, 16384, 23170, 32768, 46340 }; - - -static int ftbl2[32] = { - 32768, 33276, 33776, 34269, 34755, 35235, 35708, 36174, - 36635, 37090, 37540, 37984, 38423, 38858, 39287, 39712, - 40132, 40548, 40960, 41367, 41771, 42170, 42566, 42959, - 43347, 43733, 44115, 44493, 44869, 45241, 45611, 45977 }; - - -static int i_sqrt (int val) { - - int cnt = 0; - int t = val; - - while(t) { - cnt++; - t>>=1; - } - - if(6 >= cnt) - t = (val << (6-cnt)); - else - t = (val >> (cnt-6)); - - return (ftbl[cnt] * ftbl2[t & 31]) >> 15; -} - - -static int32_t int_sqrt (int val) { - - int ret; - - ret = i_sqrt (val); - ret += i_sqrt (val - ret * ret) / 16; - - return ret; -} - - -// returns a random number from [0, max_n] with higher probability towards the borders -uint32_t n2n_rand_sqr (uint32_t max_n) { - - uint32_t raw_max = 0; - uint32_t raw_rnd = 0; - int32_t ret = 0; - - raw_max = (max_n+2) * (max_n+2); - raw_rnd = n2n_rand() % (raw_max); - - ret = int_sqrt(raw_rnd) / 2; - ret = (raw_rnd & 1) ? ret : -ret; - ret = max_n / 2 + ret; - - if(ret < 0) - ret = 0; - if (ret > max_n) - ret = max_n; - - return ret; -} diff --git a/bundles/n2n_ntop_v3/src/sn_management.c b/bundles/n2n_ntop_v3/src/sn_management.c deleted file mode 100644 index 0f34a398..00000000 --- a/bundles/n2n_ntop_v3/src/sn_management.c +++ /dev/null @@ -1,441 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -/* - * This file has a large amount of duplication with the edge_management.c - * code. In the fullness of time, they should both be merged - */ - -#include "n2n.h" -#include "edge_utils_win32.h" - -int load_allowed_sn_community (n2n_sn_t *sss); /* defined in sn_utils.c */ - -#define FLAG_WROK 1 -typedef struct n2n_mgmt_handler { - int flags; - char *cmd; - char *help; - void (*func)(n2n_sn_t *sss, char *udp_buf, struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv); -} n2n_mgmt_handler_t; - -static void mgmt_error (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, char *tag, char *msg) { - size_t msg_len; - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"error\"," - "\"error\":\"%s\"}\n", - tag, - msg); - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_stop (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - if(type==N2N_MGMT_WRITE) { - *sss->keep_running = 0; - } - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"keep_running\":%u}\n", - tag, - *sss->keep_running); - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_verbose (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - if(type==N2N_MGMT_WRITE) { - if(argv) { - setTraceLevel(strtoul(argv, NULL, 0)); - } - } - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"traceLevel\":%u}\n", - tag, - getTraceLevel()); - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_reload_communities (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - if(type!=N2N_MGMT_WRITE) { - mgmt_error(sss, udp_buf, sender_sock, tag, "writeonly"); - return; - } - - if(!sss->community_file) { - mgmt_error(sss, udp_buf, sender_sock, tag, "nofile"); - return; - } - - int ok = load_allowed_sn_community(sss); - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"ok\":%i}\n", - tag, - ok); - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_timestamps (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"start_time\":%lu," - "\"last_fwd\":%ld," - "\"last_reg_super\":%ld}\n", - tag, - sss->start_time, - sss->stats.last_fwd, - sss->stats.last_reg_super); - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); -} - -static void mgmt_packetstats (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"type\":\"forward\"," - "\"tx_pkt\":%lu}\n", - tag, - sss->stats.fwd); - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"type\":\"broadcast\"," - "\"tx_pkt\":%lu}\n", - tag, - sss->stats.broadcast); - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"type\":\"reg_super\"," - "\"rx_pkt\":%lu," - "\"nak\":%lu}\n", - tag, - sss->stats.reg_super, - sss->stats.reg_super_nak); - - /* Note: reg_super_nak is not currently incremented anywhere */ - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - /* Generic errors when trying to sendto() */ - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"type\":\"errors\"," - "\"tx_pkt\":%lu}\n", - tag, - sss->stats.errors); - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - -} - -static void mgmt_communities (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - struct sn_community *community, *tmp; - dec_ip_bit_str_t ip_bit_str = {'\0'}; - - HASH_ITER(hh, sss->communities, community, tmp) { - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"community\":\"%s\"," - "\"purgeable\":%i," - "\"is_federation\":%i," - "\"ip4addr\":\"%s\"}\n", - tag, - (community->is_federation) ? "-/-" : community->community, - community->purgeable, - community->is_federation, - (community->auto_ip_net.net_addr == 0) ? "" : ip_subnet_to_str(ip_bit_str, &community->auto_ip_net)); - - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - } -} - -static void mgmt_edges (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - struct sn_community *community, *tmp; - struct peer_info *peer, *tmpPeer; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - dec_ip_bit_str_t ip_bit_str = {'\0'}; - - HASH_ITER(hh, sss->communities, community, tmp) { - HASH_ITER(hh, community->edges, peer, tmpPeer) { - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"community\":\"%s\"," - "\"ip4addr\":\"%s\"," - "\"purgeable\":%i," - "\"macaddr\":\"%s\"," - "\"sockaddr\":\"%s\"," - "\"proto\":\"%s\"," - "\"desc\":\"%s\"," - "\"last_seen\":%li}\n", - tag, - (community->is_federation) ? "-/-" : community->community, - (peer->dev_addr.net_addr == 0) ? "" : ip_subnet_to_str(ip_bit_str, &peer->dev_addr), - peer->purgeable, - (is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr), - sock_to_cstr(sockbuf, &(peer->sock)), - ((peer->socket_fd >= 0) && (peer->socket_fd != sss->sock)) ? "TCP" : "UDP", - peer->dev_desc, - peer->last_seen); - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - } - } -} - -static void mgmt_unimplemented (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - mgmt_error(sss, udp_buf, sender_sock, tag, "unimplemented"); -} - -static void mgmt_help (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv); - -n2n_mgmt_handler_t mgmt_handlers[] = { - { .cmd = "supernodes", .help = "Reserved for edge", .func = mgmt_unimplemented}, - - { .cmd = "stop", .flags = FLAG_WROK, .help = "Gracefully exit edge", .func = mgmt_stop}, - { .cmd = "verbose", .flags = FLAG_WROK, .help = "Manage verbosity level", .func = mgmt_verbose}, - { .cmd = "reload_communities", .flags = FLAG_WROK, .help = "Reloads communities and user's public keys", .func = mgmt_reload_communities}, - { .cmd = "communities", .help = "List current communities", .func = mgmt_communities}, - { .cmd = "edges", .help = "List current edges/peers", .func = mgmt_edges}, - { .cmd = "timestamps", .help = "Event timestamps", .func = mgmt_timestamps}, - { .cmd = "packetstats", .help = "Traffic statistics", .func = mgmt_packetstats}, - { .cmd = "help", .flags = FLAG_WROK, .help = "Show JSON commands", .func = mgmt_help}, - { .cmd = NULL }, -}; - -static void mgmt_help (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *tag, char *argv0, char *argv) { - size_t msg_len; - n2n_mgmt_handler_t *handler; - - /* - * Even though this command is readonly, we deliberately do not check - * the type - allowing help replies to both read and write requests - */ - - for( handler=mgmt_handlers; handler->cmd; handler++ ) { - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{" - "\"_tag\":\"%s\"," - "\"_type\":\"row\"," - "\"cmd\":\"%s\"," - "\"help\":\"%s\"}\n", - tag, - handler->cmd, - handler->help); - - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - } -} - -/* - * Check if the user is authorised for this command. - * - this should be more configurable! - * - for the moment we use some simple heuristics: - * Reads are not dangerous, so they are simply allowed - * Writes are possibly dangerous, so they need a fake password - */ -static int mgmt_auth (n2n_sn_t *sss, const struct sockaddr_in sender_sock, enum n2n_mgmt_type type, char *auth, char *argv0, char *argv) { - - if(auth) { - /* If we have an auth key, it must match */ - if(sss->mgmt_password_hash == pearson_hash_64((uint8_t*)auth, strlen(auth))) { - return 1; - } - return 0; - } - /* if we dont have an auth key, we can still read */ - if(type == N2N_MGMT_READ) { - return 1; - } - - return 0; -} - -void handleMgmtJson_sn (n2n_sn_t *sss, char *udp_buf, const struct sockaddr_in sender_sock) { - - char cmdlinebuf[80]; - enum n2n_mgmt_type type; - char *typechar; - char *options; - char *argv0; - char *argv; - char *tag; - char *flagstr; - int flags; - char *auth; - n2n_mgmt_handler_t *handler; - size_t msg_len; - - /* save a copy of the commandline before we reuse the udp_buf */ - strncpy(cmdlinebuf, udp_buf, sizeof(cmdlinebuf)-1); - cmdlinebuf[sizeof(cmdlinebuf)-1] = 0; - - traceEvent(TRACE_DEBUG, "mgmt json %s", cmdlinebuf); - - typechar = strtok(cmdlinebuf, " \r\n"); - if(!typechar) { - /* should not happen */ - mgmt_error(sss, udp_buf, sender_sock, "-1", "notype"); - return; - } - if(*typechar == 'r') { - type=N2N_MGMT_READ; - } else if(*typechar == 'w') { - type=N2N_MGMT_WRITE; - } else { - /* dunno how we got here */ - mgmt_error(sss, udp_buf, sender_sock, "-1", "badtype"); - return; - } - - /* Extract the tag to use in all reply packets */ - options = strtok(NULL, " \r\n"); - if(!options) { - mgmt_error(sss, udp_buf, sender_sock, "-1", "nooptions"); - return; - } - - argv0 = strtok(NULL, " \r\n"); - if(!argv0) { - mgmt_error(sss, udp_buf, sender_sock, "-1", "nocmd"); - return; - } - - /* - * The entire rest of the line is the argv. We apply no processing - * or arg separation so that the cmd can use it however it needs. - */ - argv = strtok(NULL, "\r\n"); - - /* - * There might be an auth token mixed in with the tag - */ - tag = strtok(options, ":"); - flagstr = strtok(NULL, ":"); - if(flagstr) { - flags = strtoul(flagstr, NULL, 16); - } else { - flags = 0; - } - - /* Only 1 flag bit defined at the moment - "auth option present" */ - if(flags & 1) { - auth = strtok(NULL, ":"); - } else { - auth = NULL; - } - - if(!mgmt_auth(sss, sender_sock, type, auth, argv0, argv)) { - mgmt_error(sss, udp_buf, sender_sock, tag, "badauth"); - return; - } - - for( handler=mgmt_handlers; handler->cmd; handler++ ) { - if(0 == strcmp(handler->cmd, argv0)) { - break; - } - } - if(!handler->cmd) { - mgmt_error(sss, udp_buf, sender_sock, tag, "unknowncmd"); - return; - } - - if((type==N2N_MGMT_WRITE) && !(handler->flags & FLAG_WROK)) { - mgmt_error(sss, udp_buf, sender_sock, tag, "readonly"); - return; - } - - /* - * TODO: - * The tag provided by the requester could contain chars - * that make our JSON invalid. - * - do we care? - */ - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{\"_tag\":\"%s\",\"_type\":\"begin\",\"cmd\":\"%s\"}\n", tag, argv0); - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - - handler->func(sss, udp_buf, sender_sock, type, tag, argv0, argv); - - msg_len = snprintf(udp_buf, N2N_PKT_BUF_SIZE, - "{\"_tag\":\"%s\",\"_type\":\"end\"}\n", tag); - sendto(sss->mgmt_sock, udp_buf, msg_len, 0, - (struct sockaddr *) &sender_sock, sizeof(struct sockaddr_in)); - return; -} diff --git a/bundles/n2n_ntop_v3/src/sn_selection.c b/bundles/n2n_ntop_v3/src/sn_selection.c deleted file mode 100644 index 13c0ff13..00000000 --- a/bundles/n2n_ntop_v3/src/sn_selection.c +++ /dev/null @@ -1,253 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -static SN_SELECTION_CRITERION_DATA_TYPE sn_selection_criterion_common_read (n2n_edge_t *eee); -static int sn_selection_criterion_sort (peer_info_t *a, peer_info_t *b); - - -/* Initialize selection_criterion field in peer_info structure*/ -int sn_selection_criterion_init (peer_info_t *peer) { - - if(peer != NULL) { - sn_selection_criterion_default(&(peer->selection_criterion)); - } - - return 0; /* OK */ -} - - -/* Set selection_criterion field to default value according to selected strategy. */ -int sn_selection_criterion_default (SN_SELECTION_CRITERION_DATA_TYPE *selection_criterion) { - - *selection_criterion = (SN_SELECTION_CRITERION_DATA_TYPE)(UINT64_MAX >> 1) - 1; - - return 0; /* OK */ -} - - -/* Set selection_criterion field to 'bad' value (worse than default) according to selected strategy. */ -int sn_selection_criterion_bad (SN_SELECTION_CRITERION_DATA_TYPE *selection_criterion) { - - *selection_criterion = (SN_SELECTION_CRITERION_DATA_TYPE)(UINT64_MAX >> 1); - - return 0; /* OK */ -} - -/* Set selection_criterion field to 'good' value (better than default) according to selected strategy. */ -int sn_selection_criterion_good (SN_SELECTION_CRITERION_DATA_TYPE *selection_criterion) { - - *selection_criterion = (SN_SELECTION_CRITERION_DATA_TYPE)(UINT64_MAX >> 1) - 2; - - return 0; /* OK */ -} - - -/* Take data from PEER_INFO payload and transform them into a selection_criterion. - * This function is highly dependant of the chosen selection criterion. - */ -int sn_selection_criterion_calculate (n2n_edge_t *eee, peer_info_t *peer, SN_SELECTION_CRITERION_DATA_TYPE *data) { - - SN_SELECTION_CRITERION_DATA_TYPE common_data; - int sum = 0; - - common_data = sn_selection_criterion_common_read(eee); - - switch(eee->conf.sn_selection_strategy) { - - case SN_SELECTION_STRATEGY_LOAD: { - peer->selection_criterion = (SN_SELECTION_CRITERION_DATA_TYPE)(be32toh(*data) + common_data); - - /* Mitigation of the real supernode load in order to see less oscillations. - * Edges jump from a supernode to another back and forth due to purging. - * Because this behavior has a cost of switching, the real load is mitigated with a stickyness factor. - * This factor is dynamically calculated basing on network size and prevent that unnecessary switching */ - if(peer == eee->curr_sn) { - sum = HASH_COUNT(eee->known_peers) + HASH_COUNT(eee->pending_peers); - peer->selection_criterion = peer->selection_criterion * sum / (sum + 1); - } - break; - } - - case SN_SELECTION_STRATEGY_RTT: { - peer->selection_criterion = (SN_SELECTION_CRITERION_DATA_TYPE)((uint32_t)time_stamp() >> 22) - common_data; - break; - } - - case SN_SELECTION_STRATEGY_MAC: { - peer->selection_criterion = 0; - memcpy(&peer->selection_criterion, /* leftbound, don't mess with pointer arithmetics */ - peer->mac_addr, - N2N_MAC_SIZE); - peer->selection_criterion = be64toh(peer->selection_criterion); - peer->selection_criterion >>= (sizeof(peer->selection_criterion) - N2N_MAC_SIZE) * 8; /* rightbound */ - break; - } - - default: { - // this should never happen - traceEvent(TRACE_ERROR, "selection_criterion unknown selection strategy configuration"); - break; - } - } - - return 0; /* OK */ -} - - -/* Set sn_selection_criterion_common_data field to default value. */ -int sn_selection_criterion_common_data_default (n2n_edge_t *eee) { - - switch(eee->conf.sn_selection_strategy) { - - case SN_SELECTION_STRATEGY_LOAD: { - SN_SELECTION_CRITERION_DATA_TYPE tmp = 0; - - tmp = HASH_COUNT(eee->pending_peers); - if(eee->conf.header_encryption == HEADER_ENCRYPTION_ENABLED) { - tmp *= 2; - } - eee->sn_selection_criterion_common_data = tmp / HASH_COUNT(eee->conf.supernodes); - break; - } - - case SN_SELECTION_STRATEGY_RTT: { - eee->sn_selection_criterion_common_data = (SN_SELECTION_CRITERION_DATA_TYPE)((uint32_t)time_stamp() >> 22); - break; - } - - case SN_SELECTION_STRATEGY_MAC: { - eee->sn_selection_criterion_common_data = 0; - break; - } - - default: { - // this should never happen - traceEvent(TRACE_ERROR, "selection_criterion unknown selection strategy configuration"); - break; - } - } - - return 0; /* OK */ -} - - -/* Return the value of sn_selection_criterion_common_data field. */ -static SN_SELECTION_CRITERION_DATA_TYPE sn_selection_criterion_common_read (n2n_edge_t *eee) { - - return eee->sn_selection_criterion_common_data; -} - - -/* Function that compare two selection_criterion fields and sorts them in ascending order. */ -static int sn_selection_criterion_sort (peer_info_t *a, peer_info_t *b) { - - int ret = 0; - - // comparison function for sorting supernodes in ascending order of their selection_criterion. - if(a->selection_criterion > b->selection_criterion) - ret = 1; - else if(a->selection_criterion < b->selection_criterion) - ret = -2; - - return ret; -} - - -/* Function that sorts peer_list using sn_selection_criterion_sort. */ -int sn_selection_sort (peer_info_t **peer_list) { - - HASH_SORT(*peer_list, sn_selection_criterion_sort); - - return 0; /* OK */ -} - - -/* Function that gathers requested data on a supernode. - * it remains unaffected by selection strategy because it refers to edge behaviour only - */ -SN_SELECTION_CRITERION_DATA_TYPE sn_selection_criterion_gather_data (n2n_sn_t *sss) { - - SN_SELECTION_CRITERION_DATA_TYPE data = 0, tmp = 0; - struct sn_community *comm, *tmp_comm; - - HASH_ITER(hh, sss->communities, comm, tmp_comm) { - // number of nodes in the community + the community itself - tmp = HASH_COUNT(comm->edges) + 1; - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - // double-count encrypted communities (and their nodes): they exert more load on supernode - tmp *= 2; - } - data += tmp; - } - - return htobe64(data); -} - - -/* Convert selection_criterion field in a string for management port output. */ -extern char * sn_selection_criterion_str (n2n_edge_t *eee, selection_criterion_str_t out, peer_info_t *peer) { - - int chars = 0; - - - if(NULL == out) { - return NULL; - } - memset(out, 0, SN_SELECTION_CRITERION_BUF_SIZE); - - // keep off the super-big values (used for "bad" or "good" or "undetermined" supernodes, - // easier to sort to the end of the list). - // Alternatively, typecast to (int16_t) and check for greater or equal zero - if(peer->selection_criterion < (UINT64_MAX >> 2)) { - - switch(eee->conf.sn_selection_strategy) { - - case SN_SELECTION_STRATEGY_LOAD: { - chars = snprintf(out, SN_SELECTION_CRITERION_BUF_SIZE, "load = %8ld", peer->selection_criterion); - break; - } - - case SN_SELECTION_STRATEGY_RTT: { - chars = snprintf(out, SN_SELECTION_CRITERION_BUF_SIZE, "rtt = %6ld ms", peer->selection_criterion); - break; - } - - case SN_SELECTION_STRATEGY_MAC: { - chars = snprintf(out, SN_SELECTION_CRITERION_BUF_SIZE, "%s", (int64_t)peer->selection_criterion > 0 ? "active" : ""); - break; - } - - default: { - // this should never happen - traceEvent(TRACE_ERROR, "selection_criterion unknown selection strategy configuration"); - break; - } - } - - // this test is to make "-Wformat-truncation" less sad - if(chars > SN_SELECTION_CRITERION_BUF_SIZE) { - traceEvent(TRACE_ERROR, "selection_criterion buffer overflow"); - } - } - - return out; -} diff --git a/bundles/n2n_ntop_v3/src/sn_utils.c b/bundles/n2n_ntop_v3/src/sn_utils.c deleted file mode 100644 index 40d67468..00000000 --- a/bundles/n2n_ntop_v3/src/sn_utils.c +++ /dev/null @@ -1,2930 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include "n2n.h" - -#define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out) - -int resolve_create_thread (n2n_resolve_parameter_t **param, struct peer_info *sn_list); -int resolve_check (n2n_resolve_parameter_t *param, uint8_t resolution_request, time_t now); -int resolve_cancel_thread (n2n_resolve_parameter_t *param); - - -static ssize_t sendto_peer (n2n_sn_t *sss, - const struct peer_info *peer, - const uint8_t *pktbuf, - size_t pktsize); - -static int sendto_mgmt (n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - const uint8_t *mgmt_buf, - size_t mgmt_size); - -static uint16_t reg_lifetime (n2n_sn_t *sss); - -static int update_edge (n2n_sn_t *sss, - const n2n_common_t* cmn, - const n2n_REGISTER_SUPER_t* reg, - struct sn_community *comm, - const n2n_sock_t *sender_sock, - const SOCKET socket_fd, - n2n_auth_t *answer_auth, - int skip_add, - time_t now); - -static int re_register_and_purge_supernodes (n2n_sn_t *sss, - struct sn_community *comm, - time_t *p_last_re_reg_and_purge, - time_t now, - uint8_t forced); - -static int purge_expired_communities (n2n_sn_t *sss, - time_t* p_last_purge, - time_t now); - -static int sort_communities (n2n_sn_t *sss, - time_t* p_last_sort, - time_t now); - -static int process_mgmt (n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - char *mgmt_buf, - size_t mgmt_size, - time_t now); - -static int process_udp (n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - const SOCKET socket_fd, - uint8_t *udp_buf, - size_t udp_size, - time_t now); - - -/* ************************************** */ - - -void close_tcp_connection (n2n_sn_t *sss, n2n_tcp_connection_t *conn) { - - struct sn_community *comm, *tmp_comm; - struct peer_info *edge, *tmp_edge; - - if(!conn) - return; - - // find peer by file descriptor - HASH_ITER(hh, sss->communities, comm, tmp_comm) { - HASH_ITER(hh, comm->edges, edge, tmp_edge) { - if(edge->socket_fd == conn->socket_fd) { - // remove peer - HASH_DEL(comm->edges, edge); - free(edge); - goto close_conn; /* break - level 2 */ - } - } - } - - close_conn: - // close the connection - shutdown(conn->socket_fd, SHUT_RDWR); - closesocket(conn->socket_fd); - // forget about the connection, will be deleted later - conn->inactive = 1; -} - - -/* *************************************************** */ - - -// generate shared secrets for user authentication; can be done only after -// federation name is known (-F) and community list completely read (-c) -void calculate_shared_secrets (n2n_sn_t *sss) { - - struct sn_community *comm, *tmp_comm; - sn_user_t *user, *tmp_user; - - traceEvent(TRACE_INFO, "started shared secrets calculation for edge authentication"); - - generate_private_key(sss->private_key, sss->federation->community + 1); /* skip '*' federation leading character */ - HASH_ITER(hh, sss->communities, comm, tmp_comm) { - if(comm->is_federation) { - continue; - } - HASH_ITER(hh, comm->allowed_users, user, tmp_user) { - // calculate common shared secret (ECDH) - generate_shared_secret(user->shared_secret, sss->private_key, user->public_key); - // prepare for use as key - user->shared_secret_ctx = (he_context_t*)calloc(1, sizeof(speck_context_t)); - speck_init((speck_context_t**)&user->shared_secret_ctx, user->shared_secret, 128); - } - } - - traceEvent(TRACE_NORMAL, "calculated shared secrets for edge authentication"); -} - - -// calculate dynamic keys -void calculate_dynamic_keys (n2n_sn_t *sss) { - - struct sn_community *comm, *tmp_comm = NULL; - - traceEvent(TRACE_INFO, "calculating dynamic keys"); - HASH_ITER(hh, sss->communities, comm, tmp_comm) { - // skip federation - if(comm->is_federation) { - continue; - } - - // calculate dynamic keys if this is a user/pw auth'ed community - if(comm->allowed_users) { - calculate_dynamic_key(comm->dynamic_key, /* destination */ - sss->dynamic_key_time, /* time - same for all */ - (uint8_t *)comm->community, /* community name */ - (uint8_t *)sss->federation->community); /* federation name */ - packet_header_change_dynamic_key(comm->dynamic_key, - &(comm->header_encryption_ctx_dynamic), - &(comm->header_iv_ctx_dynamic)); - traceEvent(TRACE_DEBUG, "calculated dynamic key for community '%s'", comm->community); - } - } -} - - -// send RE_REGISTER_SUPER to all edges from user/pw auth'ed communites -void send_re_register_super (n2n_sn_t *sss) { - - struct sn_community *comm, *tmp_comm = NULL; - struct peer_info *edge, *tmp_edge = NULL; - n2n_common_t cmn; - uint8_t rereg_buf[N2N_SN_PKTBUF_SIZE]; - size_t encx = 0; - n2n_sock_str_t sockbuf; - - HASH_ITER(hh, sss->communities, comm, tmp_comm) { - if(comm->is_federation) { - continue; - } - - // send RE_REGISTER_SUPER to edges if this is a user/pw auth community - if(comm->allowed_users) { - // prepare - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_re_register_super; - cmn.flags = N2N_FLAGS_FROM_SUPERNODE; - memcpy(cmn.community, comm->community, N2N_COMMUNITY_SIZE); - - HASH_ITER(hh, comm->edges, edge, tmp_edge) { - // encode - encx = 0; - encode_common(rereg_buf, &encx, &cmn); - - // send - traceEvent(TRACE_DEBUG, "send RE_REGISTER_SUPER to %s", - sock_to_cstr(sockbuf, &(edge->sock))); - - packet_header_encrypt(rereg_buf, encx, encx, - comm->header_encryption_ctx_dynamic, comm->header_iv_ctx_dynamic, - time_stamp()); - - /* sent = */ sendto_peer(sss, edge, rereg_buf, encx); - } - } - } -} - - -/** Load the list of allowed communities. Existing/previous ones will be removed, - * return 0 on success, -1 if file not found, -2 if no valid entries found - */ -int load_allowed_sn_community (n2n_sn_t *sss) { - - char buffer[4096], *line, *cmn_str, net_str[20], format[20]; - - sn_user_t *user, *tmp_user; - n2n_desc_t username; - n2n_private_public_key_t public_key; - char ascii_public_key[(N2N_PRIVATE_PUBLIC_KEY_SIZE * 8 + 5) / 6 + 1]; - - dec_ip_str_t ip_str = {'\0'}; - uint8_t bitlen; - in_addr_t net; - uint32_t mask; - FILE *fd = fopen(sss->community_file, "r"); - - struct sn_community *comm, *tmp_comm, *last_added_comm = NULL; - struct peer_info *edge, *tmp_edge; - node_supernode_association_t *assoc, *tmp_assoc; - n2n_tcp_connection_t *conn; - time_t any_time = 0; - - uint32_t num_communities = 0; - - struct sn_community_regular_expression *re, *tmp_re; - uint32_t num_regex = 0; - int has_net; - - if(fd == NULL) { - traceEvent(TRACE_WARNING, "File %s not found", sss->community_file); - return -1; - } - - // reset data structures ------------------------------ - - // send RE_REGISTER_SUPER to all edges from user/pw auth communites, this is safe because - // follow-up REGISTER_SUPER cannot be handled before this function ends - send_re_register_super(sss); - - // remove communities (not: federation) - HASH_ITER(hh, sss->communities, comm, tmp_comm) { - if(comm->is_federation) { - continue; - } - - // remove all edges from community - HASH_ITER(hh, comm->edges, edge, tmp_edge) { - // remove all edge associations (with other supernodes) - HASH_ITER(hh, comm->assoc, assoc, tmp_assoc) { - HASH_DEL(comm->assoc, assoc); - free(assoc); - } - - // close TCP connections, if any (also causes reconnect) - // and delete edge from list - if((edge->socket_fd != sss->sock) && (edge->socket_fd >= 0)) { - HASH_FIND_INT(sss->tcp_connections, &(edge->socket_fd), conn); - close_tcp_connection(sss, conn); /* also deletes the edge */ - } else { - HASH_DEL(comm->edges, edge); - free(edge); - } - } - - // remove allowed users from community - HASH_ITER(hh, comm->allowed_users, user, tmp_user) { - free(user->shared_secret_ctx); - HASH_DEL(comm->allowed_users, user); - free(user); - } - - // remove community - HASH_DEL(sss->communities, comm); - if(NULL != comm->header_encryption_ctx_static) { - // remove header encryption keys - free(comm->header_encryption_ctx_static); - free(comm->header_iv_ctx_static); - free(comm->header_encryption_ctx_dynamic); - free(comm->header_iv_ctx_dynamic); - } - free(comm); - } - - // remove all regular expressions for allowed communities - HASH_ITER(hh, sss->rules, re, tmp_re) { - HASH_DEL(sss->rules, re); - free(re); - } - - // prepare reading data ------------------------------- - - // new key_time for all communities, requires dynamic keys to be recalculated (see further below), - // and edges to re-register (see above) and ... - sss->dynamic_key_time = time(NULL); - // ... federated supernodes to re-register - re_register_and_purge_supernodes(sss, sss->federation, &any_time, any_time, 1 /* forced */); - - // format definition for possible user-key entries - sprintf(format, "%c %%%ds %%%lds", N2N_USER_KEY_LINE_STARTER, N2N_DESC_SIZE - 1, sizeof(ascii_public_key)-1); - - while((line = fgets(buffer, sizeof(buffer), fd)) != NULL) { - int len = strlen(line); - - if((len < 2) || line[0] == '#') { - continue; - } - - len--; - while(len > 0) { - if((line[len] == '\n') || (line[len] == '\r')) { - line[len] = '\0'; - len--; - } else { - break; - } - } - // the loop above does not always determine correct 'len' - len = strlen(line); - - // user-key line for edge authentication? - if(line[0] == N2N_USER_KEY_LINE_STARTER) { /* special first character */ - if(sscanf(line, format, username, ascii_public_key) == 2) { /* correct format */ - if(last_added_comm) { /* is there a valid community to add users to */ - user = (sn_user_t*)calloc(1, sizeof(sn_user_t)); - if(user) { - // username - memcpy(user->name, username, sizeof(username)); - // public key - ascii_to_bin(public_key, ascii_public_key); - memcpy(user->public_key, public_key, sizeof(public_key)); - // common shared secret will be calculated later - // add to list - HASH_ADD(hh, last_added_comm->allowed_users, public_key, sizeof(n2n_private_public_key_t), user); - traceEvent(TRACE_INFO, "added user '%s' with public key '%s' to community '%s'", - user->name, ascii_public_key, last_added_comm->community); - // enable header encryption - last_added_comm->header_encryption = HEADER_ENCRYPTION_ENABLED; - packet_header_setup_key(last_added_comm->community, - &(last_added_comm->header_encryption_ctx_static), - &(last_added_comm->header_encryption_ctx_dynamic), - &(last_added_comm->header_iv_ctx_static), - &(last_added_comm->header_iv_ctx_dynamic)); - // dynamic key setup follows at a later point in code - } - continue; - } - } - } - - // --- community name or regular expression - - // cut off any IP sub-network upfront - cmn_str = (char*)calloc(len + 1, sizeof(char)); - has_net = (sscanf(line, "%s %s", cmn_str, net_str) == 2); - - // if it contains typical characters... - if(NULL != strpbrk(cmn_str, ".*+?[]\\")) { - // ...it is treated as regular expression - re = (struct sn_community_regular_expression*)calloc(1, sizeof(struct sn_community_regular_expression)); - if(re) { - re->rule = re_compile(cmn_str); - HASH_ADD_PTR(sss->rules, rule, re); - num_regex++; - traceEvent(TRACE_INFO, "added regular expression for allowed communities '%s'", cmn_str); - free(cmn_str); - last_added_comm = NULL; - continue; - } - } - - comm = (struct sn_community*)calloc(1,sizeof(struct sn_community)); - - if(comm != NULL) { - comm_init(comm, cmn_str); - /* loaded from file, this community is unpurgeable */ - comm->purgeable = COMMUNITY_UNPURGEABLE; - /* we do not know if header encryption is used in this community, - * first packet will show. just in case, setup the key. */ - comm->header_encryption = HEADER_ENCRYPTION_UNKNOWN; - packet_header_setup_key(comm->community, - &(comm->header_encryption_ctx_static), - &(comm->header_encryption_ctx_dynamic), - &(comm->header_iv_ctx_static), - &(comm->header_iv_ctx_dynamic)); - HASH_ADD_STR(sss->communities, community, comm); - last_added_comm = comm; - - num_communities++; - traceEvent(TRACE_INFO, "added allowed community '%s' [total: %u]", - (char*)comm->community, num_communities); - - // check for sub-network address - if(has_net) { - if(sscanf(net_str, "%15[^/]/%hhu", ip_str, &bitlen) != 2) { - traceEvent(TRACE_WARNING, "bad net/bit format '%s' for community '%c', ignoring; see comments inside community.list file", - net_str, cmn_str); - has_net = 0; - } - net = inet_addr(ip_str); - mask = bitlen2mask(bitlen); - if((net == (in_addr_t)(-1)) || (net == INADDR_NONE) || (net == INADDR_ANY) - || ((ntohl(net) & ~mask) != 0)) { - traceEvent(TRACE_WARNING, "bad network '%s/%u' in '%s' for community '%s', ignoring", - ip_str, bitlen, net_str, cmn_str); - has_net = 0; - } - if((bitlen > 30) || (bitlen == 0)) { - traceEvent(TRACE_WARNING, "bad prefix '%hhu' in '%s' for community '%s', ignoring", - bitlen, net_str, cmn_str); - has_net = 0; - } - } - if(has_net) { - comm->auto_ip_net.net_addr = ntohl(net); - comm->auto_ip_net.net_bitlen = bitlen; - traceEvent(TRACE_INFO, "assigned sub-network %s/%u to community '%s'", - inet_ntoa(*(struct in_addr *) &net), - comm->auto_ip_net.net_bitlen, - comm->community); - } else { - assign_one_ip_subnet(sss, comm); - } - } - free(cmn_str); - } - - fclose(fd); - - if((num_regex + num_communities) == 0) { - traceEvent(TRACE_WARNING, "file %s does not contain any valid community names or regular expressions", sss->community_file); - return -2; - } - - traceEvent(TRACE_NORMAL, "loaded %u fixed-name communities from %s", - num_communities, sss->community_file); - - traceEvent(TRACE_NORMAL, "loaded %u regular expressions for community name matching from %s", - num_regex, sss->community_file); - - // calculate allowed user's shared secrets (shared with federation) - calculate_shared_secrets(sss); - - // calculcate communties' dynamic keys - calculate_dynamic_keys(sss); - - // no new communities will be allowed - sss->lock_communities = 1; - - return 0; -} - - -/* *************************************************** */ - - -/** Send a datagram to a file descriptor socket. - * - * @return -1 on error otherwise number of bytes sent - */ -static ssize_t sendto_fd (n2n_sn_t *sss, - SOCKET socket_fd, - const struct sockaddr *socket, - const uint8_t *pktbuf, - size_t pktsize) { - - ssize_t sent = 0; - n2n_tcp_connection_t *conn; - - sent = sendto(socket_fd, (void *)pktbuf, pktsize, 0 /* flags */, - socket, sizeof(struct sockaddr_in)); - - if((sent <= 0) && (errno)) { - char * c = strerror(errno); - traceEvent(TRACE_ERROR, "sendto failed (%d) %s", errno, c); -#ifdef WIN32 - traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - // if the erroneous connection is tcp, i.e. not the regular sock... - if((socket_fd >= 0) && (socket_fd != sss->sock)) { - // ...forget about the corresponding peer and the connection - HASH_FIND_INT(sss->tcp_connections, &socket_fd, conn); - close_tcp_connection(sss, conn); - return -1; - } - } else { - traceEvent(TRACE_DEBUG, "sendto sent=%d to ", (signed int)sent); - } - - return sent; -} - - -/** Send a datagram to a network order socket of type struct sockaddr. - * - * @return -1 on error otherwise number of bytes sent - */ -static ssize_t sendto_sock(n2n_sn_t *sss, - SOCKET socket_fd, - const struct sockaddr *socket, - const uint8_t *pktbuf, - size_t pktsize) { - - ssize_t sent = 0; - int value = 0; - - // if the connection is tcp, i.e. not the regular sock... - if((socket_fd >= 0) && (socket_fd != sss->sock)) { - - setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); - value = 1; -#ifdef LINUX - setsockopt(socket_fd, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); -#endif - - // prepend packet length... - uint16_t pktsize16 = htobe16(pktsize); - sent = sendto_fd(sss, socket_fd, socket, (uint8_t*)&pktsize16, sizeof(pktsize16)); - - if(sent <= 0) - return -1; - // ...before sending the actual data - } - - sent = sendto_fd(sss, socket_fd, socket, pktbuf, pktsize); - - // if the connection is tcp, i.e. not the regular sock... - if((socket_fd >= 0) && (socket_fd != sss->sock)) { - value = 1; /* value should still be set to 1 */ - setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); -#ifdef LINUX - value = 0; - setsockopt(socket_fd, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); -#endif - } - - return sent; -} - - -/** Send a datagram to a peer whose destination socket is embodied in its sock field of type n2n_sock_t. - * It calls sendto_sock to do the final send. - * - * @return -1 on error otherwise number of bytes sent - */ -static ssize_t sendto_peer (n2n_sn_t *sss, - const struct peer_info *peer, - const uint8_t *pktbuf, - size_t pktsize) { - - n2n_sock_str_t sockbuf; - - if(AF_INET == peer->sock.family) { - - // network order socket - struct sockaddr_in socket; - fill_sockaddr((struct sockaddr *)&socket, sizeof(socket), &(peer->sock)); - - traceEvent(TRACE_DEBUG, "sent %lu bytes to [%s]", - pktsize, - sock_to_cstr(sockbuf, &(peer->sock))); - - return sendto_sock(sss, - (peer->socket_fd >= 0) ? peer->socket_fd : sss->sock, - (const struct sockaddr*)&socket, pktbuf, pktsize); - } else { - /* AF_INET6 not implemented */ - errno = EAFNOSUPPORT; - return -1; - } -} - - -/** Try and broadcast a message to all edges in the community. - * - * This will send the exact same datagram to zero or more edges registered to - * the supernode. - */ -static int try_broadcast (n2n_sn_t * sss, - const struct sn_community *comm, - const n2n_common_t * cmn, - const n2n_mac_t srcMac, - uint8_t from_supernode, - const uint8_t * pktbuf, - size_t pktsize) { - - struct peer_info *scan, *tmp; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - traceEvent(TRACE_DEBUG, "try_broadcast"); - - /* We have to make sure that a broadcast reaches the other supernodes and edges - * connected to them. try_broadcast needs a from_supernode parameter: if set, - * do forward to edges of community only. If unset, forward to all locally known - * nodes of community AND all supernodes associated with the community */ - - if (!from_supernode) { - HASH_ITER(hh, sss->federation->edges, scan, tmp) { - int data_sent_len; - - data_sent_len = sendto_peer(sss, scan, pktbuf, pktsize); - - if(data_sent_len != pktsize) { - ++(sss->stats.errors); - traceEvent(TRACE_WARNING, "multicast %lu to supernode [%s] %s failed %s", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr), - strerror(errno)); - } else { - ++(sss->stats.broadcast); - traceEvent(TRACE_DEBUG, "multicast %lu to supernode [%s] %s", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr)); - } - } - } - - if(comm) { - HASH_ITER(hh, comm->edges, scan, tmp) { - if(memcmp(srcMac, scan->mac_addr, sizeof(n2n_mac_t)) != 0) { - /* REVISIT: exclude if the destination socket is where the packet came from. */ - int data_sent_len; - - data_sent_len = sendto_peer(sss, scan, pktbuf, pktsize); - - if(data_sent_len != pktsize) { - ++(sss->stats.errors); - traceEvent(TRACE_WARNING, "multicast %lu to [%s] %s failed %s", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr), - strerror(errno)); - } else { - ++(sss->stats.broadcast); - traceEvent(TRACE_DEBUG, "multicast %lu to [%s] %s", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr)); - } - } - } - } - - return 0; -} - - -static int try_forward (n2n_sn_t * sss, - const struct sn_community *comm, - const n2n_common_t * cmn, - const n2n_mac_t dstMac, - uint8_t from_supernode, - const uint8_t * pktbuf, - size_t pktsize) { - - struct peer_info * scan; - node_supernode_association_t *assoc; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - - HASH_FIND_PEER(comm->edges, dstMac, scan); - - if(NULL != scan) { - int data_sent_len; - data_sent_len = sendto_peer(sss, scan, pktbuf, pktsize); - - if(data_sent_len == pktsize) { - ++(sss->stats.fwd); - traceEvent(TRACE_DEBUG, "unicast %lu to [%s] %s", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr)); - } else { - ++(sss->stats.errors); - traceEvent(TRACE_ERROR, "unicast %lu to [%s] %s FAILED (%d: %s)", - pktsize, - sock_to_cstr(sockbuf, &(scan->sock)), - macaddr_str(mac_buf, scan->mac_addr), - errno, strerror(errno)); - return -1; - } - } else { - if(!from_supernode) { - // check if target edge is associated with a certain supernode - HASH_FIND(hh, comm->assoc, dstMac, sizeof(n2n_mac_t), assoc); - if(assoc) { - traceEvent(TRACE_DEBUG, "found mac address associated with a known supernode, forwarding packet to that supernode"); - sendto_sock(sss, sss->sock, - (const struct sockaddr*)&(assoc->sock), - pktbuf, pktsize); - } else { - // forwarding packet to all federated supernodes - traceEvent(TRACE_DEBUG, "unknown mac address, broadcasting packet to all federated supernodes"); - try_broadcast(sss, NULL, cmn, sss->mac_addr, from_supernode, pktbuf, pktsize); - } - } else { - traceEvent(TRACE_DEBUG, "unknown mac address in packet from a supernode, dropping the packet"); - /* Not a known MAC so drop. */ - return -2; - } - } - - return 0; -} - - -/** Initialise some fields of the community structure **/ -int comm_init (struct sn_community *comm, char *cmn) { - - strncpy((char*)comm->community, cmn, N2N_COMMUNITY_SIZE); - comm->community[N2N_COMMUNITY_SIZE - 1] = '\0'; - comm->is_federation = IS_NO_FEDERATION; - - return 0; /* OK */ -} - - -/** Initialise the supernode structure */ -int sn_init_defaults (n2n_sn_t *sss) { - - char *tmp_string; - -#ifdef WIN32 - initWin32(); -#endif - - pearson_hash_init(); - - memset(sss, 0, sizeof(n2n_sn_t)); - - strncpy(sss->version, GIT_RELEASE, sizeof(n2n_version_t)); - sss->version[sizeof(n2n_version_t) - 1] = '\0'; - sss->daemon = 1; /* By defult run as a daemon. */ - sss->lport = N2N_SN_LPORT_DEFAULT; - sss->mport = N2N_SN_MGMT_PORT; - sss->sock = -1; - sss->mgmt_sock = -1; - sss->min_auto_ip_net.net_addr = inet_addr(N2N_SN_MIN_AUTO_IP_NET_DEFAULT); - sss->min_auto_ip_net.net_addr = ntohl(sss->min_auto_ip_net.net_addr); - sss->min_auto_ip_net.net_bitlen = N2N_SN_AUTO_IP_NET_BIT_DEFAULT; - sss->max_auto_ip_net.net_addr = inet_addr(N2N_SN_MAX_AUTO_IP_NET_DEFAULT); - sss->max_auto_ip_net.net_addr = ntohl(sss->max_auto_ip_net.net_addr); - sss->max_auto_ip_net.net_bitlen = N2N_SN_AUTO_IP_NET_BIT_DEFAULT; - - sss->federation = (struct sn_community *)calloc(1, sizeof(struct sn_community)); - /* Initialize the federation */ - if(sss->federation) { - if(getenv("N2N_FEDERATION")) - snprintf(sss->federation->community, N2N_COMMUNITY_SIZE - 1 ,"*%s", getenv("N2N_FEDERATION")); - else - strncpy(sss->federation->community, (char*)FEDERATION_NAME, N2N_COMMUNITY_SIZE); - sss->federation->community[N2N_COMMUNITY_SIZE - 1] = '\0'; - /* enable the flag for federation */ - sss->federation->is_federation = IS_FEDERATION; - sss->federation->purgeable = COMMUNITY_UNPURGEABLE; - /* header encryption enabled by default */ - sss->federation->header_encryption = HEADER_ENCRYPTION_ENABLED; - /*setup the encryption key */ - packet_header_setup_key(sss->federation->community, - &(sss->federation->header_encryption_ctx_static), - &(sss->federation->header_encryption_ctx_dynamic), - &(sss->federation->header_iv_ctx_static), - &(sss->federation->header_iv_ctx_dynamic)); - sss->federation->edges = NULL; - } - - n2n_srand(n2n_seed()); - - /* Random auth token */ - sss->auth.scheme = n2n_auth_simple_id; - memrnd(sss->auth.token, N2N_AUTH_ID_TOKEN_SIZE); - sss->auth.token_size = N2N_AUTH_ID_TOKEN_SIZE; - - /* Random MAC address */ - memrnd(sss->mac_addr, N2N_MAC_SIZE); - sss->mac_addr[0] &= ~0x01; /* Clear multicast bit */ - sss->mac_addr[0] |= 0x02; /* Set locally-assigned bit */ - - tmp_string = calloc(1, strlen(N2N_MGMT_PASSWORD) + 1); - if(tmp_string) { - strncpy((char*)tmp_string, N2N_MGMT_PASSWORD, strlen(N2N_MGMT_PASSWORD) + 1); - sss->mgmt_password_hash = pearson_hash_64((uint8_t*)tmp_string, strlen(N2N_MGMT_PASSWORD)); - free(tmp_string); - } - - return 0; /* OK */ -} - - -/** Initialise the supernode */ -void sn_init (n2n_sn_t *sss) { - - if(resolve_create_thread(&(sss->resolve_parameter), sss->federation->edges) == 0) { - traceEvent(TRACE_NORMAL, "successfully created resolver thread"); - } -} - - -/** Deinitialise the supernode structure and deallocate any memory owned by - * it. */ -void sn_term (n2n_sn_t *sss) { - - struct sn_community *community, *tmp; - struct sn_community_regular_expression *re, *tmp_re; - n2n_tcp_connection_t *conn, *tmp_conn; - node_supernode_association_t *assoc, *tmp_assoc; - - resolve_cancel_thread(sss->resolve_parameter); - - if(sss->sock >= 0) { - closesocket(sss->sock); - } - sss->sock = -1; - - HASH_ITER(hh, sss->tcp_connections, conn, tmp_conn) { - shutdown(conn->socket_fd, SHUT_RDWR); - closesocket(conn->socket_fd); - HASH_DEL(sss->tcp_connections, conn); - free(conn); - } - - if(sss->tcp_sock >= 0) { - shutdown(sss->tcp_sock, SHUT_RDWR); - closesocket(sss->tcp_sock); - } - sss->tcp_sock = -1; - - if(sss->mgmt_sock >= 0) { - closesocket(sss->mgmt_sock); - } - sss->mgmt_sock = -1; - - HASH_ITER(hh, sss->communities, community, tmp) { - clear_peer_list(&community->edges); - if(NULL != community->header_encryption_ctx_static) { - free(community->header_encryption_ctx_static); - free(community->header_encryption_ctx_dynamic); - } - // remove all associations - HASH_ITER(hh, community->assoc, assoc, tmp_assoc) { - HASH_DEL(community->assoc, assoc); - free(assoc); - } - HASH_DEL(sss->communities, community); - free(community); - } - - HASH_ITER(hh, sss->rules, re, tmp_re) { - HASH_DEL(sss->rules, re); - if (NULL != re->rule) { - free(re->rule); - } - free(re); - } - - if(sss->community_file) - free(sss->community_file); -#ifdef WIN32 - destroyWin32(); -#endif -} - -void update_node_supernode_association (struct sn_community *comm, - n2n_mac_t *edgeMac, const struct sockaddr_in *sender_sock, - time_t now) { - - node_supernode_association_t *assoc; - - HASH_FIND(hh, comm->assoc, edgeMac, sizeof(n2n_mac_t), assoc); - if(!assoc) { - // create a new association - assoc = (node_supernode_association_t*)malloc(sizeof(node_supernode_association_t)); - if(assoc) { - memcpy(&(assoc->mac), edgeMac, sizeof(n2n_mac_t)); - memcpy((struct sockaddr_in*)&(assoc->sock), sender_sock, sizeof(struct sockaddr_in)); - assoc->last_seen = now; - HASH_ADD(hh, comm->assoc, mac, sizeof(n2n_mac_t), assoc); - } else { - // already there, update socket and time only - memcpy((struct sockaddr_in*)&(assoc->sock), sender_sock, sizeof(struct sockaddr_in)); - assoc->last_seen = now; - } - } -} - - -/** Determine the appropriate lifetime for new registrations. - * - * If the supernode has been put into a pre-shutdown phase then this lifetime - * should not allow registrations to continue beyond the shutdown point. - */ -static uint16_t reg_lifetime (n2n_sn_t *sss) { - - /* NOTE: UDP firewalls usually have a 30 seconds timeout */ - return 15; -} - - -/** Verifies authentication tokens from known edges. - * - * It is called by update_edge and during UNREGISTER_SUPER handling - * to verify the stored auth token. - */ -static int auth_edge (const n2n_auth_t *present, const n2n_auth_t *presented, n2n_auth_t *answer, struct sn_community *community) { - - sn_user_t *user = NULL; - - if(present->scheme == n2n_auth_none) { - // n2n_auth_none scheme (set at supernode if cli option '-M') - // if required, zero_token answer (not for NAK) - if(answer) - memset(answer, 0, sizeof(n2n_auth_t)); - // 0 == (always) successful - return 0; - } - - if((present->scheme == n2n_auth_simple_id) && (presented->scheme == n2n_auth_simple_id)) { - // n2n_auth_simple_id scheme: if required, zero_token answer (not for NAK) - if(answer) - memset(answer, 0, sizeof(n2n_auth_t)); - - // 0 = success (tokens are equal) - return (memcmp(present, presented, sizeof(n2n_auth_t))); - } - - if((present->scheme == n2n_auth_user_password) && (presented->scheme == n2n_auth_user_password)) { - // check if submitted public key is in list of allowed users - HASH_FIND(hh, community->allowed_users, &presented->token, sizeof(n2n_private_public_key_t), user); - if(user) { - if(answer) { - memcpy(answer, presented, sizeof(n2n_auth_t)); - - // return a double-encrypted challenge (just encrypt again) in the (first half of) public key field so edge can verify - memcpy(answer->token, answer->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, N2N_AUTH_CHALLENGE_SIZE); - speck_128_encrypt(answer->token, (speck_context_t*)user->shared_secret_ctx); - - // decrypt the challenge using user's shared secret - speck_128_decrypt(answer->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, (speck_context_t*)user->shared_secret_ctx); - // xor-in the community dynamic key - memxor(answer->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, community->dynamic_key, N2N_AUTH_CHALLENGE_SIZE); - // xor-in the user's shared secret - memxor(answer->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, user->shared_secret, N2N_AUTH_CHALLENGE_SIZE); - // encrypt it using user's shared secret - speck_128_encrypt(answer->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, (speck_context_t*)user->shared_secret_ctx); - // user in list? success! (we will see if edge can handle the key for further com) - } - return 0; - } - } - - // if not successful earlier: failure - return -1; -} - - -// provides the current / a new local auth token -// REVISIT: behavior should depend on some local auth scheme setting (to be implemented) -static int get_local_auth (n2n_sn_t *sss, n2n_auth_t *auth) { - - // n2n_auth_simple_id scheme - memcpy(auth, &(sss->auth), sizeof(n2n_auth_t)); - - return 0; -} - - -// handles an incoming (remote) auth token from a so far unknown edge, -// takes action as required by auth scheme, and -// could provide an answer auth token for use in REGISTER_SUPER_ACK -static int handle_remote_auth (n2n_sn_t *sss, const n2n_auth_t *remote_auth, - n2n_auth_t *answer_auth, - struct sn_community *community) { - - sn_user_t *user = NULL; - - if((NULL == community->allowed_users) != (remote_auth->scheme != n2n_auth_user_password)) { - // received token's scheme does not match expected scheme - return -1; - } - - switch(remote_auth->scheme) { - // we do not handle n2n_auth_none because the edge always edge always uses either id or user/password - // auth_none is sn-internal only (skipping MAC/IP address spoofing protection) - case n2n_auth_none: - case n2n_auth_simple_id: - // zero_token answer - memset(answer_auth, 0, sizeof(n2n_auth_t)); - return 0; - case n2n_auth_user_password: - // check if submitted public key is in list of allowed users - HASH_FIND(hh, community->allowed_users, &remote_auth->token, sizeof(n2n_private_public_key_t), user); - if(user) { - memcpy(answer_auth, remote_auth, sizeof(n2n_auth_t)); - - // return a double-encrypted challenge (just encrypt again) in the (first half of) public key field so edge can verify - memcpy(answer_auth->token, answer_auth->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, N2N_AUTH_CHALLENGE_SIZE); - speck_128_encrypt(answer_auth->token, (speck_context_t*)user->shared_secret_ctx); - - // wrap dynamic key for transmission - // decrypt the challenge using user's shared secret - speck_128_decrypt(answer_auth->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, (speck_context_t*)user->shared_secret_ctx); - // xor-in the community dynamic key - memxor(answer_auth->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, community->dynamic_key, N2N_AUTH_CHALLENGE_SIZE); - // xor-in the user's shared secret - memxor(answer_auth->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, user->shared_secret, N2N_AUTH_CHALLENGE_SIZE); - // encrypt it using user's shared secret - speck_128_encrypt(answer_auth->token + N2N_PRIVATE_PUBLIC_KEY_SIZE, (speck_context_t*)user->shared_secret_ctx); - return 0; - } - break; - default: - break; - } - - // if not successful earlier: failure - return -1; -} - - -/** Update the edge table with the details of the edge which contacted the - * supernode. */ -static int update_edge (n2n_sn_t *sss, - const n2n_common_t* cmn, - const n2n_REGISTER_SUPER_t* reg, - struct sn_community *comm, - const n2n_sock_t *sender_sock, - const SOCKET socket_fd, - n2n_auth_t *answer_auth, - int skip_add, - time_t now) { - - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - struct peer_info *scan, *iter, *tmp; - int ret; - - traceEvent(TRACE_DEBUG, "update_edge for %s [%s]", - macaddr_str(mac_buf, reg->edgeMac), - sock_to_cstr(sockbuf, sender_sock)); - - HASH_FIND_PEER(comm->edges, reg->edgeMac, scan); - - // if unknown, make sure it is also not known by IP address - if(NULL == scan) { - HASH_ITER(hh,comm->edges,iter,tmp) { - if(iter->dev_addr.net_addr == reg->dev_addr.net_addr) { - scan = iter; - HASH_DEL(comm->edges, scan); - memcpy(scan->mac_addr, reg->edgeMac, sizeof(n2n_mac_t)); - HASH_ADD_PEER(comm->edges, scan); - break; - } - } - } - - if(NULL == scan) { - /* Not known */ - if(handle_remote_auth(sss, &(reg->auth), answer_auth, comm) == 0) { - if(skip_add == SN_ADD) { - scan = (struct peer_info *) calloc(1, sizeof(struct peer_info)); /* deallocated in purge_expired_nodes */ - memcpy(&(scan->mac_addr), reg->edgeMac, sizeof(n2n_mac_t)); - scan->dev_addr.net_addr = reg->dev_addr.net_addr; - scan->dev_addr.net_bitlen = reg->dev_addr.net_bitlen; - memcpy((char*)scan->dev_desc, reg->dev_desc, N2N_DESC_SIZE); - memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); - scan->socket_fd = socket_fd; - scan->last_cookie = reg->cookie; - scan->last_valid_time_stamp = initial_time_stamp(); - // eventually, store edge's preferred local socket from REGISTER_SUPER - if(cmn->flags & N2N_FLAGS_SOCKET) - memcpy(&scan->preferred_sock, ®->sock, sizeof(n2n_sock_t)); - else - scan->preferred_sock.family = AF_INVALID; - - // store the submitted auth token - memcpy(&(scan->auth), &(reg->auth), sizeof(n2n_auth_t)); - // manually set to type 'auth_none' if cli option disables MAC/IP address spoofing protection - // for id based auth communities. This will be obsolete when handling public keys only (v4.0?) - if((reg->auth.scheme == n2n_auth_simple_id) && (sss->override_spoofing_protection)) - scan->auth.scheme = n2n_auth_none; - - HASH_ADD_PEER(comm->edges, scan); - - traceEvent(TRACE_INFO, "created edge %s ==> %s", - macaddr_str(mac_buf, reg->edgeMac), - sock_to_cstr(sockbuf, sender_sock)); - } - ret = update_edge_new_sn; - } else { - traceEvent(TRACE_INFO, "authentication failed"); - ret = update_edge_auth_fail; - } - } else { - /* Known */ - if(auth_edge(&(scan->auth), &(reg->auth), answer_auth, comm) == 0) { - if(!sock_equal(sender_sock, &(scan->sock))) { - memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); - scan->socket_fd = socket_fd; - scan->last_cookie = reg->cookie; - // eventually, update edge's preferred local socket from REGISTER_SUPER - if(cmn->flags & N2N_FLAGS_SOCKET) - memcpy(&scan->preferred_sock, ®->sock, sizeof(n2n_sock_t)); - else - scan->preferred_sock.family = AF_INVALID; - - traceEvent(TRACE_INFO, "updated edge %s ==> %s", - macaddr_str(mac_buf, reg->edgeMac), - sock_to_cstr(sockbuf, sender_sock)); - ret = update_edge_sock_change; - } else { - scan->last_cookie = reg->cookie; - - traceEvent(TRACE_DEBUG, "edge unchanged %s ==> %s", - macaddr_str(mac_buf, reg->edgeMac), - sock_to_cstr(sockbuf, sender_sock)); - - ret = update_edge_no_change; - } - } else { - traceEvent(TRACE_INFO, "authentication failed"); - ret = update_edge_auth_fail; - } - } - - if((scan != NULL) && (ret != update_edge_auth_fail)) { - scan->last_seen = now; - } - - return ret; -} - - -/** checks if a certain ip address is still available, i.e. not used by any other edge of a given community */ -static int ip_addr_available (struct sn_community *comm, n2n_ip_subnet_t *ip_addr) { - - int success = 1; - struct peer_info *peer, *tmp_peer; - - // prerequisite: list of peers is sorted according to peer's tap ip address - HASH_ITER(hh, comm->edges, peer, tmp_peer) { - if(peer->dev_addr.net_addr > ip_addr->net_addr) { - break; - } - if(peer->dev_addr.net_addr == ip_addr->net_addr) { - success = 0; - break; - } - } - - return success; -} - - -static signed int peer_tap_ip_sort (struct peer_info *a, struct peer_info *b) { - - uint32_t a_host_id = a->dev_addr.net_addr & (~bitlen2mask(a->dev_addr.net_bitlen)); - uint32_t b_host_id = b->dev_addr.net_addr & (~bitlen2mask(b->dev_addr.net_bitlen)); - - return ((signed int)a_host_id - (signed int)b_host_id); -} - - -/** The IP address assigned to the edge by the auto ip address function of sn. */ -static int assign_one_ip_addr (struct sn_community *comm, n2n_desc_t dev_desc, n2n_ip_subnet_t *ip_addr) { - - uint32_t tmp, success, net_id, mask, max_host, host_id = 1; - dec_ip_bit_str_t ip_bit_str = {'\0'}; - - mask = bitlen2mask(comm->auto_ip_net.net_bitlen); - net_id = comm->auto_ip_net.net_addr & mask; - max_host = ~mask; - - // sorting is a prerequisite for more efficient availabilitiy check - HASH_SORT(comm->edges, peer_tap_ip_sort); - - // first proposal derived from hash of mac address - tmp = pearson_hash_32(dev_desc, sizeof(n2n_desc_t)) & max_host; - if(tmp == 0) tmp++; /* avoid 0 host */ - if(tmp == max_host) tmp--; /* avoid broadcast address */ - tmp |= net_id; - - // candidate - ip_addr->net_bitlen = comm->auto_ip_net.net_bitlen; - - // check for availability starting from proposal, then downwards, ... - for(host_id = tmp; host_id > net_id; host_id--) { - ip_addr->net_addr = host_id; - success = ip_addr_available(comm, ip_addr); - if(success) { - break; - } - } - // ... then upwards - if(!success) { - for(host_id = tmp + 1; host_id < (net_id + max_host); host_id++) { - ip_addr->net_addr = host_id; - success = ip_addr_available(comm, ip_addr); - if(success) { - break; - } - } - } - - if(success) { - traceEvent(TRACE_INFO, "assign IP %s to tap adapter of edge", ip_subnet_to_str(ip_bit_str, ip_addr)); - return 0; - } else { - traceEvent(TRACE_WARNING, "no assignable IP to edge tap adapter"); - return -1; - } -} - - -/** checks if a certain sub-network is still available, i.e. does not cut any other community's sub-network */ -int subnet_available (n2n_sn_t *sss, - struct sn_community *comm, - uint32_t net_id, - uint32_t mask) { - - struct sn_community *cmn, *tmpCmn; - int success = 1; - - HASH_ITER(hh, sss->communities, cmn, tmpCmn) { - if(cmn == comm) { - continue; - } - if(cmn->is_federation == IS_FEDERATION) { - continue; - } - if((net_id <= (cmn->auto_ip_net.net_addr + ~bitlen2mask(cmn->auto_ip_net.net_bitlen))) - &&(net_id + ~mask >= cmn->auto_ip_net.net_addr)) { - success = 0; - break; - } - } - - return success; -} - - -/** The IP address range (subnet) assigned to the community by the auto ip address function of sn. */ -int assign_one_ip_subnet (n2n_sn_t *sss, - struct sn_community *comm) { - - uint32_t net_id, net_id_i, mask, net_increment; - uint32_t no_subnets; - uint8_t success; - in_addr_t net; - - mask = bitlen2mask(sss->min_auto_ip_net.net_bitlen); - // number of possible sub-networks - no_subnets = (sss->max_auto_ip_net.net_addr - sss->min_auto_ip_net.net_addr); - no_subnets >>= (32 - sss->min_auto_ip_net.net_bitlen); - no_subnets += 1; - - // proposal for sub-network to choose - net_id = pearson_hash_32((const uint8_t *)comm->community, N2N_COMMUNITY_SIZE) % no_subnets; - net_id = sss->min_auto_ip_net.net_addr + (net_id << (32 - sss->min_auto_ip_net.net_bitlen)); - - // check for availability starting from net_id, then downwards, ... - net_increment = (~mask+1); - for(net_id_i = net_id; net_id_i >= sss->min_auto_ip_net.net_addr; net_id_i -= net_increment) { - success = subnet_available(sss, comm, net_id_i, mask); - if(success) { - break; - } - } - // ... then upwards - if(!success) { - for(net_id_i = net_id + net_increment; net_id_i <= sss->max_auto_ip_net.net_addr; net_id_i += net_increment) { - success = subnet_available(sss, comm, net_id_i, mask); - if(success) { - break; - } - } - } - - if(success) { - comm->auto_ip_net.net_addr = net_id_i; - comm->auto_ip_net.net_bitlen = sss->min_auto_ip_net.net_bitlen; - net = htonl(comm->auto_ip_net.net_addr); - traceEvent(TRACE_INFO, "assigned sub-network %s/%u to community '%s'", - inet_ntoa(*(struct in_addr *) &net), - comm->auto_ip_net.net_bitlen, - comm->community); - return 0; - } else { - comm->auto_ip_net.net_addr = 0; - comm->auto_ip_net.net_bitlen = 0; - traceEvent(TRACE_WARNING, "no assignable sub-network left for community '%s'", - comm->community); - return -1; - } -} - - -/*** - * - * For a given packet, find the apporopriate internal last valid time stamp for lookup - * and verify it (and also update, if applicable). - */ -static int find_edge_time_stamp_and_verify (struct peer_info * edges, - peer_info_t *sn, n2n_mac_t mac, - uint64_t stamp, int allow_jitter) { - - uint64_t *previous_stamp = NULL; - - if(sn) { - previous_stamp = &(sn->last_valid_time_stamp); - } else { - struct peer_info *edge; - HASH_FIND_PEER(edges, mac, edge); - - if(edge) { - // time_stamp_verify_and_update allows the pointer a previous stamp to be NULL - // if it is a (so far) unknown edge - previous_stamp = &(edge->last_valid_time_stamp); - } - } - - // failure --> 0; success --> 1 - return time_stamp_verify_and_update(stamp, previous_stamp, allow_jitter); -} - - -static int re_register_and_purge_supernodes (n2n_sn_t *sss, struct sn_community *comm, time_t *p_last_re_reg_and_purge, time_t now, uint8_t forced) { - - time_t time; - struct peer_info *peer, *tmp; - - if(!forced) { - if((now - (*p_last_re_reg_and_purge)) < RE_REG_AND_PURGE_FREQUENCY) { - return 0; - } - - // purge long-time-not-seen supernodes - purge_expired_nodes(&(comm->edges), sss->sock, &sss->tcp_connections, p_last_re_reg_and_purge, - RE_REG_AND_PURGE_FREQUENCY, LAST_SEEN_SN_INACTIVE); - } - - if(comm != NULL) { - HASH_ITER(hh,comm->edges,peer,tmp) { - - time = now - peer->last_seen; - - if(!forced) { - if(time <= LAST_SEEN_SN_ACTIVE) { - continue; - } - } - - /* re-register (send REGISTER_SUPER) */ - uint8_t pktbuf[N2N_PKT_BUF_SIZE] = {0}; - size_t idx; - /* ssize_t sent; */ - n2n_common_t cmn; - n2n_REGISTER_SUPER_t reg; - n2n_sock_str_t sockbuf; - - memset(&cmn, 0, sizeof(cmn)); - memset(®, 0, sizeof(reg)); - - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_register_super; - cmn.flags = N2N_FLAGS_FROM_SUPERNODE; - memcpy(cmn.community, comm->community, N2N_COMMUNITY_SIZE); - - reg.cookie = n2n_rand(); - peer->last_cookie = reg.cookie; - - reg.dev_addr.net_addr = ntohl(peer->dev_addr.net_addr); - reg.dev_addr.net_bitlen = mask2bitlen(ntohl(peer->dev_addr.net_bitlen)); - get_local_auth(sss, &(reg.auth)); - - reg.key_time = sss->dynamic_key_time; - - idx = 0; - encode_mac(reg.edgeMac, &idx, sss->mac_addr); - - idx = 0; - encode_REGISTER_SUPER(pktbuf, &idx, &cmn, ®); - - traceEvent(TRACE_DEBUG, "send REGISTER_SUPER to %s", - sock_to_cstr(sockbuf, &(peer->sock))); - - packet_header_encrypt(pktbuf, idx, idx, - comm->header_encryption_ctx_static, comm->header_iv_ctx_static, - time_stamp()); - - /* sent = */ sendto_peer(sss, peer, pktbuf, idx); - } - } - - return 0; /* OK */ -} - - -static int purge_expired_communities (n2n_sn_t *sss, - time_t* p_last_purge, - time_t now) { - - struct sn_community *comm, *tmp_comm; - node_supernode_association_t *assoc, *tmp_assoc; - size_t num_reg = 0; - size_t num_assoc = 0; - - if((now - (*p_last_purge)) < PURGE_REGISTRATION_FREQUENCY) { - return 0; - } - - traceEvent(TRACE_DEBUG, "purging old communities and edges"); - - HASH_ITER(hh, sss->communities, comm, tmp_comm) { - // federation is taken care of in re_register_and_purge_supernodes() - if(comm->is_federation == IS_FEDERATION) - continue; - - // purge the community's local peers - num_reg += purge_peer_list(&comm->edges, sss->sock, &sss->tcp_connections, now - REGISTRATION_TIMEOUT); - - // purge the community's associated peers (connected to other supernodes) - HASH_ITER(hh, comm->assoc, assoc, tmp_assoc) { - if(comm->assoc->last_seen < (now - 3 * REGISTRATION_TIMEOUT)) { - HASH_DEL(comm->assoc, assoc); - free(assoc); - num_assoc++; - } - } - - if((comm->edges == NULL) && (comm->purgeable == COMMUNITY_PURGEABLE)) { - traceEvent(TRACE_INFO, "purging idle community %s", comm->community); - if(NULL != comm->header_encryption_ctx_static) { - /* this should not happen as 'purgeable' and thus only communities w/o encrypted header here */ - free(comm->header_encryption_ctx_static); - free(comm->header_iv_ctx_static); - free(comm->header_encryption_ctx_dynamic); - free(comm->header_iv_ctx_dynamic); - } - // remove all associations - HASH_ITER(hh, comm->assoc, assoc, tmp_assoc) { - HASH_DEL(comm->assoc, assoc); - free(assoc); - } - HASH_DEL(sss->communities, comm); - free(comm); - } - } - (*p_last_purge) = now; - - traceEvent(TRACE_DEBUG, "purge_expired_communities removed %ld locally registered edges and %ld remotely associated edges", - num_reg, num_assoc); - - return 0; -} - - -static int number_enc_packets_sort (struct sn_community *a, struct sn_community *b) { - - // comparison function for sorting communities in descending order of their - // number_enc_packets-fields - return (b->number_enc_packets - a->number_enc_packets); -} - - -static int sort_communities (n2n_sn_t *sss, - time_t* p_last_sort, - time_t now) { - - struct sn_community *comm, *tmp; - - if((now - (*p_last_sort)) < SORT_COMMUNITIES_INTERVAL) { - return 0; - } - - // this routine gets periodically called as defined in SORT_COMMUNITIES_INTERVAL - // it sorts the communities in descending order of their number_enc_packets-fields... - HASH_SORT(sss->communities, number_enc_packets_sort); - - // ... and afterward resets the number_enc__packets-fields to zero - // (other models could reset it to half of their value to respect history) - HASH_ITER(hh, sss->communities, comm, tmp) { - comm->number_enc_packets = 0; - } - - (*p_last_sort) = now; - - return 0; -} - - -static int process_mgmt (n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - char *mgmt_buf, - size_t mgmt_size, - time_t now) { - - char resbuf[N2N_SN_PKTBUF_SIZE]; - size_t ressize = 0; - uint32_t num_edges = 0; - uint32_t num_comm = 0; - uint32_t num = 0; - struct sn_community *community, *tmp; - struct peer_info *peer, *tmpPeer; - macstr_t mac_buf; - n2n_sock_str_t sockbuf; - char time_buf[10]; /* 9 digits + 1 terminating zero */ - dec_ip_bit_str_t ip_bit_str = {'\0'}; - - traceEvent(TRACE_DEBUG, "process_mgmt"); - - /* avoid parsing any uninitialized junk from the stack */ - mgmt_buf[mgmt_size] = 0; - - // process input, if any - if((0 == memcmp(mgmt_buf, "help", 4)) || (0 == memcmp(mgmt_buf, "?", 1))) { - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "Help for supernode management console:\n" - "\thelp | This help message\n" - "\treload_communities | Reloads communities and user's public keys\n" - "\t | Display status and statistics\n"); - sendto_mgmt(sss, sender_sock, (const uint8_t *) resbuf, ressize); - return 0; /* no status output afterwards */ - } - - if(0 == memcmp(mgmt_buf, "reload_communities", 18)) { - if(!sss->community_file) { - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "No community file provided (-c command line option)\n"); - sendto_mgmt(sss, sender_sock, (const uint8_t *) resbuf, ressize); - return 0; /* no status output afterwards */ - } - traceEvent(TRACE_NORMAL, "'reload_communities' command"); - - if(load_allowed_sn_community(sss)) { - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "Error while re-loading community file (not found or no valid content)\n"); - sendto_mgmt(sss, sender_sock, (const uint8_t *) resbuf, ressize); - return 0; /* no status output afterwards */ - } - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "OK.\n"); - sendto_mgmt(sss, sender_sock, (const uint8_t *) resbuf, ressize); - return 0; /* no status output afterwards */ - } - - if((mgmt_buf[0] == 'r' || mgmt_buf[0] == 'w') && (mgmt_buf[1] == ' ')) { - /* this is a JSON request */ - handleMgmtJson_sn(sss, mgmt_buf, *sender_sock); - return 0; - } - - // output current status - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - " ### | TAP | MAC | EDGE | HINT | LAST SEEN\n"); - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "========================================================================================================\n"); - HASH_ITER(hh, sss->communities, community, tmp) { - if(num_comm) - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "--------------------------------------------------------------------------------------------------------\n"); - num_comm++; - num_edges += HASH_COUNT(community->edges); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "%s '%s'\n", - (community->is_federation) ? "FEDERATION" : - ((community->purgeable == COMMUNITY_UNPURGEABLE) ? "FIXED NAME COMMUNITY" : "COMMUNITY"), - (community->is_federation) ? "-/-" : community->community); - sendto_mgmt(sss, sender_sock, (const uint8_t *) resbuf, ressize); - ressize = 0; - - num = 0; - HASH_ITER(hh, community->edges, peer, tmpPeer) { - sprintf (time_buf, "%9u", (unsigned int)(now - peer->last_seen)); - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "%4u | %-19s | %-17s | %-21s %-3s | %-15s | %9s\n", - ++num, - (peer->dev_addr.net_addr == 0) ? ((peer->purgeable == SN_UNPURGEABLE) ? "-l" : "") : - ip_subnet_to_str(ip_bit_str, &peer->dev_addr), - (is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr), - sock_to_cstr(sockbuf, &(peer->sock)), - ((peer->socket_fd >= 0) && (peer->socket_fd != sss->sock)) ? "TCP" : "", - peer->dev_desc, - (peer->last_seen) ? time_buf : ""); - - sendto_mgmt(sss, sender_sock, (const uint8_t *) resbuf, ressize); - ressize = 0; - } - } - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "========================================================================================================\n"); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "uptime %lu | ", (now - sss->start_time)); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "edges %u | ", - num_edges); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "reg_sup %u | ", - (unsigned int) sss->stats.reg_super); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "reg_nak %u | ", - (unsigned int) sss->stats.reg_super_nak); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "errors %u \n", - (unsigned int) sss->stats.errors); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "fwd %u | ", - (unsigned int) sss->stats.fwd); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "broadcast %u | ", - (unsigned int) sss->stats.broadcast); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "cur_cmnts %u\n", HASH_COUNT(sss->communities)); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "last_fwd %lu sec ago | ", - (long unsigned int) (now - sss->stats.last_fwd)); - - ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, - "last reg %lu sec ago\n\n", - (long unsigned int) (now - sss->stats.last_reg_super)); - - sendto_mgmt(sss, sender_sock, (const uint8_t *) resbuf, ressize); - - return 0; -} - - -static int sendto_mgmt (n2n_sn_t *sss, - const struct sockaddr_in *sender_sock, - const uint8_t *mgmt_buf, - size_t mgmt_size) { - - ssize_t r = sendto(sss->mgmt_sock, (void *)mgmt_buf, mgmt_size, 0 /*flags*/, - (struct sockaddr *)sender_sock, sizeof (struct sockaddr_in)); - - if(r <= 0) { - ++(sss->stats.errors); - traceEvent (TRACE_ERROR, "sendto_mgmt : sendto failed. %s", strerror (errno)); - return -1; - } - - return 0; -} - -/** Examine a datagram and determine what to do with it. - * - */ -static int process_udp (n2n_sn_t * sss, - const struct sockaddr_in *sender_sock, - const SOCKET socket_fd, - uint8_t * udp_buf, - size_t udp_size, - time_t now) { - - n2n_common_t cmn; /* common fields in the packet header */ - size_t rem; - size_t idx; - size_t msg_type; - uint8_t from_supernode; - peer_info_t *sn = NULL; - n2n_sock_t sender; - macstr_t mac_buf; - macstr_t mac_buf2; - n2n_sock_str_t sockbuf; - char buf[32]; - uint8_t hash_buf[16] = {0}; /* always size of 16 (max) despite the actual value of N2N_REG_SUP_HASH_CHECK_LEN (<= 16) */ - - struct sn_community *comm, *tmp; - uint32_t header_enc = 0; /* 1 == encrypted by static key, 2 == encrypted by dynamic key */ - uint64_t stamp; - int skip_add; - time_t any_time = 0; - - traceEvent(TRACE_DEBUG, "processing incoming UDP packet [len: %lu][sender: %s:%u]", - udp_size, intoa(ntohl(sender_sock->sin_addr.s_addr), buf, sizeof(buf)), - ntohs(sender_sock->sin_port)); - - /* check if header is unencrypted. the following check is around 99.99962 percent reliable. - * it heavily relies on the structure of packet's common part - * changes to wire.c:encode/decode_common need to go together with this code */ - if(udp_size < 24) { - traceEvent(TRACE_DEBUG, "dropped a packet too short to be valid"); - return -1; - } - if((udp_buf[23] == (uint8_t)0x00) // null terminated community name - && (udp_buf[00] == N2N_PKT_VERSION) // correct packet version - && ((be16toh(*(uint16_t*)&(udp_buf[02])) & N2N_FLAGS_TYPE_MASK) <= MSG_TYPE_MAX_TYPE) // message type - && ( be16toh(*(uint16_t*)&(udp_buf[02])) < N2N_FLAGS_OPTIONS) // flags - ) { - /* most probably unencrypted */ - /* make sure, no downgrading happens here and no unencrypted packets can be - * injected in a community which definitely deals with encrypted headers */ - HASH_FIND_COMMUNITY(sss->communities, (char *)&udp_buf[04], comm); - if(comm) { - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - traceEvent(TRACE_DEBUG, "dropped a packet with unencrypted header " - "addressed to community '%s' which uses encrypted headers", - comm->community); - return -1; - } - if(comm->header_encryption == HEADER_ENCRYPTION_UNKNOWN) { - traceEvent(TRACE_INFO, "locked community '%s' to " - "unencrypted headers", comm->community); - /* set 'no encryption' in case it is not set yet */ - comm->header_encryption = HEADER_ENCRYPTION_NONE; - comm->header_encryption_ctx_static = NULL; - comm->header_encryption_ctx_dynamic = NULL; - } - } - } else { - /* most probably encrypted */ - /* cycle through the known communities (as keys) to eventually decrypt */ - HASH_ITER(hh, sss->communities, comm, tmp) { - /* skip the definitely unencrypted communities */ - if(comm->header_encryption == HEADER_ENCRYPTION_NONE) { - continue; - } - - // match with static (1) or dynamic (2) ctx? - // check dynamic first as it is identical to static in normal header encryption mode - if(packet_header_decrypt(udp_buf, udp_size, - comm->community, - comm->header_encryption_ctx_dynamic, comm->header_iv_ctx_dynamic, - &stamp)) { - header_enc = 2; - } - if(!header_enc) { - pearson_hash_128(hash_buf, udp_buf, max(0, (int)udp_size - (int)N2N_REG_SUP_HASH_CHECK_LEN)); - header_enc = packet_header_decrypt(udp_buf, max(0, (int)udp_size - (int)N2N_REG_SUP_HASH_CHECK_LEN), comm->community, - comm->header_encryption_ctx_static, comm->header_iv_ctx_static, &stamp); - } - - if(header_enc) { - // time stamp verification follows in the packet specific section as it requires to determine the - // sender from the hash list by its MAC, this all depends on packet type and packet structure - // (MAC is not always in the same place) - - if(comm->header_encryption == HEADER_ENCRYPTION_UNKNOWN) { - traceEvent(TRACE_INFO, "locked community '%s' to " - "encrypted headers", comm->community); - /* set 'encrypted' in case it is not set yet */ - comm->header_encryption = HEADER_ENCRYPTION_ENABLED; - } - // count the number of encrypted packets for sorting the communities from time to time - // for the HASH_ITER a few lines above gets faster for the more busy communities - (comm->number_enc_packets)++; - // no need to test further communities - break; - } - } - if(!header_enc) { - // no matching key/community - traceEvent(TRACE_DEBUG, "dropped a packet with seemingly encrypted header " - "for which no matching community which uses encrypted headers was found"); - return -1; - } - } - - /* Use decode_common() to determine the kind of packet then process it: - * - * REGISTER_SUPER adds an edge and generate a return REGISTER_SUPER_ACK - * - * REGISTER, REGISTER_ACK and PACKET messages are forwarded to their - * destination edge. If the destination is not known then PACKETs are - * broadcast. - */ - - rem = udp_size; /* Counts down bytes of packet to protect against buffer overruns. */ - idx = 0; /* marches through packet header as parts are decoded. */ - - if(decode_common(&cmn, udp_buf, &rem, &idx) < 0) { - traceEvent(TRACE_ERROR, "failed to decode common section"); - return -1; /* failed to decode packet */ - } - - msg_type = cmn.pc; /* packet code */ - - // special case for user/pw auth - // community's auth scheme and message type need to match the used key (dynamic) - if(comm) { - if((comm->allowed_users) - && (msg_type != MSG_TYPE_REGISTER_SUPER) - && (msg_type != MSG_TYPE_REGISTER_SUPER_ACK) - && (msg_type != MSG_TYPE_REGISTER_SUPER_NAK)) { - if(header_enc != 2) { - traceEvent(TRACE_WARNING, "dropped packet encrypted with static key where expecting dynamic key"); - return -1; - } - } - } - - /* REVISIT: when UDP/IPv6 is supported we will need a flag to indicate which - * IP transport version the packet arrived on. May need to UDP sockets. */ - memset(&sender, 0, sizeof(n2n_sock_t)); - sender.family = AF_INET; /* UDP socket was opened PF_INET v4 */ - sender.port = ntohs(sender_sock->sin_port); - memcpy(&(sender.addr.v4), &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - - from_supernode = cmn.flags & N2N_FLAGS_FROM_SUPERNODE; - if(from_supernode) { - skip_add = SN_ADD_SKIP; - sn = add_sn_to_list_by_mac_or_sock (&(sss->federation->edges), &sender, null_mac, &skip_add); - // only REGISTER_SUPER allowed from unknown supernodes - if((!sn) && (msg_type != MSG_TYPE_REGISTER_SUPER)) { - traceEvent(TRACE_DEBUG, "dropped incoming data from unknown supernode"); - return -1; - } - } - - if(cmn.ttl < 1) { - traceEvent(TRACE_WARNING, "expired TTL"); - return 0; /* Don't process further */ - } - - --(cmn.ttl); /* The value copied into all forwarded packets. */ - - switch(msg_type) { - case MSG_TYPE_PACKET: { - /* PACKET from one edge to another edge via supernode. */ - - /* pkt will be modified in place and recoded to an output of potentially - * different size due to addition of the socket.*/ - n2n_PACKET_t pkt; - n2n_common_t cmn2; - uint8_t encbuf[N2N_SN_PKTBUF_SIZE]; - size_t encx = 0; - int unicast; /* non-zero if unicast */ - uint8_t * rec_buf; /* either udp_buf or encbuf */ - - if(!comm) { - traceEvent(TRACE_DEBUG, "PACKET with unknown community %s", cmn.community); - return -1; - } - - sss->stats.last_fwd = now; - decode_PACKET(&pkt, &cmn, udp_buf, &rem, &idx); - - // already checked for valid comm - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify(comm->edges, sn, pkt.srcMac, stamp, TIME_STAMP_ALLOW_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped PACKET due to time stamp error"); - return -1; - } - } - - unicast = (0 == is_multi_broadcast(pkt.dstMac)); - - traceEvent(TRACE_DEBUG, "RX PACKET (%s) %s -> %s %s", - (unicast ? "unicast" : "multicast"), - macaddr_str(mac_buf, pkt.srcMac), - macaddr_str(mac_buf2, pkt.dstMac), - (from_supernode ? "from sn" : "local")); - - if(!from_supernode) { - memcpy(&cmn2, &cmn, sizeof(n2n_common_t)); - - /* We are going to add socket even if it was not there before */ - cmn2.flags |= N2N_FLAGS_SOCKET | N2N_FLAGS_FROM_SUPERNODE; - - pkt.sock.family = AF_INET; - pkt.sock.port = ntohs(sender_sock->sin_port); - memcpy(pkt.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - - rec_buf = encbuf; - /* Re-encode the header. */ - encode_PACKET(encbuf, &encx, &cmn2, &pkt); - - uint16_t oldEncx = encx; - - /* Copy the original payload unchanged */ - encode_buf(encbuf, &encx, (udp_buf + idx), (udp_size - idx)); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - // in case of user-password auth, also encrypt the iv of payload assuming ChaCha20 and SPECK having the same iv size - packet_header_encrypt(rec_buf, oldEncx + (NULL != comm->allowed_users) * min(encx - oldEncx, N2N_SPECK_IVEC_SIZE), encx, - comm->header_encryption_ctx_dynamic, comm->header_iv_ctx_dynamic, - time_stamp()); - } - } else { - /* Already from a supernode. Nothing to modify, just pass to - * destination. */ - - traceEvent(TRACE_DEBUG, "Rx PACKET fwd unmodified"); - - rec_buf = udp_buf; - encx = udp_size; - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - // in case of user-password auth, also encrypt the iv of payload assuming ChaCha20 and SPECK having the same iv size - packet_header_encrypt(rec_buf, idx + (NULL != comm->allowed_users) * min(encx - idx, N2N_SPECK_IVEC_SIZE), encx, - comm->header_encryption_ctx_dynamic, comm->header_iv_ctx_dynamic, - time_stamp()); - } - } - - /* Common section to forward the final product. */ - if(unicast) { - try_forward(sss, comm, &cmn, pkt.dstMac, from_supernode, rec_buf, encx); - } else { - try_broadcast(sss, comm, &cmn, pkt.srcMac, from_supernode, rec_buf, encx); - } - break; - } - - case MSG_TYPE_REGISTER: { - /* Forwarding a REGISTER from one edge to the next */ - - n2n_REGISTER_t reg; - n2n_common_t cmn2; - uint8_t encbuf[N2N_SN_PKTBUF_SIZE]; - size_t encx = 0; - int unicast; /* non-zero if unicast */ - uint8_t * rec_buf; /* either udp_buf or encbuf */ - - if(!comm) { - traceEvent(TRACE_DEBUG, "REGISTER from unknown community %s", cmn.community); - return -1; - } - - sss->stats.last_fwd = now; - decode_REGISTER(®, &cmn, udp_buf, &rem, &idx); - - // already checked for valid comm - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify(comm->edges, sn, reg.srcMac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped REGISTER due to time stamp error"); - return -1; - } - } - - unicast = (0 == is_multi_broadcast(reg.dstMac)); - - if(unicast) { - traceEvent(TRACE_DEBUG, "Rx REGISTER %s -> %s %s", - macaddr_str(mac_buf, reg.srcMac), - macaddr_str(mac_buf2, reg.dstMac), - ((cmn.flags & N2N_FLAGS_FROM_SUPERNODE) ? "from sn" : "local")); - - if(0 == (cmn.flags & N2N_FLAGS_FROM_SUPERNODE)) { - memcpy(&cmn2, &cmn, sizeof(n2n_common_t)); - - /* We are going to add socket even if it was not there before */ - cmn2.flags |= N2N_FLAGS_SOCKET | N2N_FLAGS_FROM_SUPERNODE; - - reg.sock.family = AF_INET; - reg.sock.port = ntohs(sender_sock->sin_port); - memcpy(reg.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - - /* Re-encode the header. */ - encode_REGISTER(encbuf, &encx, &cmn2, ®); - - rec_buf = encbuf; - } else { - /* Already from a supernode. Nothing to modify, just pass to - * destination. */ - - rec_buf = udp_buf; - encx = udp_size; - } - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(rec_buf, encx, encx, - comm->header_encryption_ctx_dynamic, comm->header_iv_ctx_dynamic, - time_stamp()); - } - try_forward(sss, comm, &cmn, reg.dstMac, from_supernode, rec_buf, encx); /* unicast only */ - } else { - traceEvent(TRACE_ERROR, "Rx REGISTER with multicast destination"); - } - break; - } - - case MSG_TYPE_REGISTER_ACK: { - traceEvent(TRACE_DEBUG, "Rx REGISTER_ACK (not implemented) should not be via supernode"); - break; - } - - case MSG_TYPE_REGISTER_SUPER: { - n2n_REGISTER_SUPER_t reg; - n2n_REGISTER_SUPER_ACK_t ack; - n2n_REGISTER_SUPER_NAK_t nak; - n2n_common_t cmn2; - uint8_t ackbuf[N2N_SN_PKTBUF_SIZE]; - uint8_t payload_buf[REG_SUPER_ACK_PAYLOAD_SPACE]; - n2n_REGISTER_SUPER_ACK_payload_t *payload; - size_t encx = 0; - struct sn_community_regular_expression *re, *tmp_re; - struct peer_info *peer, *tmp_peer, *p; - int8_t allowed_match = -1; - uint8_t match = 0; - int match_length = 0; - n2n_ip_subnet_t ipaddr; - int num = 0; - int skip; - int ret_value; - sn_user_t *user = NULL; - - memset(&ack, 0, sizeof(n2n_REGISTER_SUPER_ACK_t)); - memset(&nak, 0, sizeof(n2n_REGISTER_SUPER_NAK_t)); - - /* Edge/supernode requesting registration with us. */ - sss->stats.last_reg_super=now; - ++(sss->stats.reg_super); - decode_REGISTER_SUPER(®, &cmn, udp_buf, &rem, &idx); - - if(comm) { - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify(comm->edges, sn, reg.edgeMac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped REGISTER_SUPER due to time stamp error"); - return -1; - } - } - } - - /* - Before we move any further, we need to check if the requested - community is allowed by the supernode. In case it is not we do - not report any message back to the edge to hide the supernode - existance (better from the security standpoint) - */ - - if(!comm && sss->lock_communities) { - HASH_ITER(hh, sss->rules, re, tmp_re) { - allowed_match = re_matchp(re->rule, (const char *)cmn.community, &match_length); - - if((allowed_match != -1) - && (match_length == strlen((const char *)cmn.community)) // --- only full matches allowed (remove, if also partial matches wanted) - && (allowed_match == 0)) { // --- only full matches allowed (remove, if also partial matches wanted) - match = 1; - break; - } - } - if(match != 1) { - traceEvent(TRACE_INFO, "discarded registration with unallowed community '%s'", - (char*)cmn.community); - return -1; - } - } - - if(!comm && (!sss->lock_communities || (match == 1))) { - comm = (struct sn_community*)calloc(1, sizeof(struct sn_community)); - - if(comm) { - comm_init(comm, (char *)cmn.community); - /* new communities introduced by REGISTERs could not have had encrypted header... */ - comm->header_encryption = HEADER_ENCRYPTION_NONE; - comm->header_encryption_ctx_static = NULL; - comm->header_encryption_ctx_dynamic = NULL; - /* ... and also are purgeable during periodic purge */ - comm->purgeable = COMMUNITY_PURGEABLE; - comm->number_enc_packets = 0; - HASH_ADD_STR(sss->communities, community, comm); - - traceEvent(TRACE_INFO, "new community: %s", comm->community); - assign_one_ip_subnet(sss, comm); - } - } - - if(!comm) { - traceEvent(TRACE_INFO, "discarded registration with unallowed community '%s'", - (char*)cmn.community); - return -1; - } - - // hash check (user/pw auth only) - if(comm->allowed_users) { - // check if submitted public key is in list of allowed users - HASH_FIND(hh, comm->allowed_users, ®.auth.token, sizeof(n2n_private_public_key_t), user); - if(user) { - speck_128_encrypt(hash_buf, (speck_context_t*)user->shared_secret_ctx); - if(memcmp(hash_buf, udp_buf + udp_size - N2N_REG_SUP_HASH_CHECK_LEN /* length has already been checked */, N2N_REG_SUP_HASH_CHECK_LEN)) { - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER with wrong hash"); - return -1; - } - } else { - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER from unknown user"); - // continue and let auth check do the rest (otherwise, no NAK is sent) - } - } - - cmn2.ttl = N2N_DEFAULT_TTL; - cmn2.pc = n2n_register_super_ack; - cmn2.flags = N2N_FLAGS_SOCKET | N2N_FLAGS_FROM_SUPERNODE; - memcpy(cmn2.community, cmn.community, sizeof(n2n_community_t)); - - ack.cookie = reg.cookie; - memcpy(ack.srcMac, sss->mac_addr, sizeof(n2n_mac_t)); - - if(comm->is_federation != IS_FEDERATION) { /* alternatively, do not send zero tap ip address in federation REGISTER_SUPER */ - if((reg.dev_addr.net_addr == 0) || (reg.dev_addr.net_addr == 0xFFFFFFFF) || (reg.dev_addr.net_bitlen == 0) || - ((reg.dev_addr.net_addr & 0xFFFF0000) == 0xA9FE0000 /* 169.254.0.0 */)) { - memset(&ipaddr, 0, sizeof(n2n_ip_subnet_t)); - assign_one_ip_addr(comm, reg.dev_desc, &ipaddr); - ack.dev_addr.net_addr = ipaddr.net_addr; - ack.dev_addr.net_bitlen = ipaddr.net_bitlen; - } - } - - ack.lifetime = reg_lifetime(sss); - - ack.sock.family = AF_INET; - ack.sock.port = ntohs(sender_sock->sin_port); - memcpy(ack.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - - /* Add sender's data to federation (or update it) */ - if(comm->is_federation == IS_FEDERATION) { - skip_add = SN_ADD; - p = add_sn_to_list_by_mac_or_sock(&(sss->federation->edges), &(ack.sock), reg.edgeMac, &skip_add); - p->last_seen = now; - // communication with other supernodes happens via standard udp port - p->socket_fd = sss->sock; - } - - /* Skip random numbers of supernodes before payload assembling, calculating an appropriate random_number. - * That way, all supernodes have a chance to be propagated with REGISTER_SUPER_ACK. */ - skip = HASH_COUNT(sss->federation->edges) - (int)(REG_SUPER_ACK_PAYLOAD_ENTRY_SIZE / REG_SUPER_ACK_PAYLOAD_ENTRY_SIZE); - skip = (skip < 0) ? 0 : n2n_rand_sqr(skip); - - /* Assembling supernode list for REGISTER_SUPER_ACK payload */ - payload = (n2n_REGISTER_SUPER_ACK_payload_t*)payload_buf; - HASH_ITER(hh, sss->federation->edges, peer, tmp_peer) { - if(skip) { - skip--; - continue; - } - if(peer->sock.family == (uint8_t)AF_INVALID) - continue; /* do not add unresolved supernodes to payload */ - if(memcmp(&(peer->sock), &(ack.sock), sizeof(n2n_sock_t)) == 0) continue; /* a supernode doesn't add itself to the payload */ - if((now - peer->last_seen) >= LAST_SEEN_SN_NEW) continue; /* skip long-time-not-seen supernodes. - * We need to allow for a little extra time because supernodes sometimes exceed - * their SN_ACTIVE time before they get re-registred to. */ - if(((++num)*REG_SUPER_ACK_PAYLOAD_ENTRY_SIZE) > REG_SUPER_ACK_PAYLOAD_SPACE) break; /* no more space available in REGISTER_SUPER_ACK payload */ - memcpy(&(payload->sock), &(peer->sock), sizeof(n2n_sock_t)); - memcpy(payload->mac, peer->mac_addr, sizeof(n2n_mac_t)); - // shift to next payload entry - payload++; - } - ack.num_sn = num; - - traceEvent(TRACE_DEBUG, "Rx REGISTER_SUPER for %s [%s]", - macaddr_str(mac_buf, reg.edgeMac), - sock_to_cstr(sockbuf, &(ack.sock))); - - // check authentication - ret_value = update_edge_no_change; - if(comm->is_federation != IS_FEDERATION) { /* REVISIT: auth among supernodes is not implemented yet */ - if(cmn.flags & N2N_FLAGS_FROM_SUPERNODE) { - ret_value = update_edge(sss, &cmn, ®, comm, &(ack.sock), socket_fd, &(ack.auth), SN_ADD_SKIP, now); - } else { - // do not add in case of null mac (edge asking for ip address) - ret_value = update_edge(sss, &cmn, ®, comm, &(ack.sock), socket_fd, &(ack.auth), is_null_mac(reg.edgeMac) ? SN_ADD_SKIP : SN_ADD, now); - } - } - - if(ret_value == update_edge_auth_fail) { - // send REGISTER_SUPER_NAK - cmn2.pc = n2n_register_super_nak; - nak.cookie = reg.cookie; - memcpy(nak.srcMac, reg.edgeMac, sizeof(n2n_mac_t)); - - encode_REGISTER_SUPER_NAK(ackbuf, &encx, &cmn2, &nak); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(ackbuf, encx, encx, - comm->header_encryption_ctx_static, comm->header_iv_ctx_static, - time_stamp()); - // if user-password-auth - if(comm->allowed_users) { - encode_buf(ackbuf, &encx, hash_buf /* no matter what content */, N2N_REG_SUP_HASH_CHECK_LEN); - } - } - sendto_sock(sss, socket_fd, (struct sockaddr *)sender_sock, ackbuf, encx); - - traceEvent(TRACE_DEBUG, "Tx REGISTER_SUPER_NAK for %s", - macaddr_str(mac_buf, reg.edgeMac)); - } else { - // if this is not already from a supernode ... - // and not from federation, ... - if((!(cmn.flags & N2N_FLAGS_FROM_SUPERNODE)) || (!(cmn.flags & N2N_FLAGS_SOCKET))) { - // ... forward to all other supernodes (note try_broadcast()'s behavior with - // NULL comm and from_supernode parameter) - // exception: do not forward auto ip draw - if(!is_null_mac(reg.edgeMac)) { - reg.sock.family = AF_INET; - reg.sock.port = ntohs(sender_sock->sin_port); - memcpy(reg.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - - cmn2.pc = n2n_register_super; - encode_REGISTER_SUPER(ackbuf, &encx, &cmn2, ®); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(ackbuf, encx, encx, - comm->header_encryption_ctx_static, comm->header_iv_ctx_static, - time_stamp()); - // if user-password-auth - if(comm->allowed_users) { - // append an encrypted packet hash - pearson_hash_128(hash_buf, ackbuf, encx); - // same 'user' as above - speck_128_encrypt(hash_buf, (speck_context_t*)user->shared_secret_ctx); - encode_buf(ackbuf, &encx, hash_buf, N2N_REG_SUP_HASH_CHECK_LEN); - } - } - - try_broadcast(sss, NULL, &cmn, reg.edgeMac, from_supernode, ackbuf, encx); - } - - // dynamic key time handling if appropriate - ack.key_time = 0; - if(comm->is_federation == IS_FEDERATION) { - if(reg.key_time > sss->dynamic_key_time) { - traceEvent(TRACE_DEBUG, "setting new key time"); - // have all edges re_register (using old dynamic key) - send_re_register_super(sss); - // set new key time - sss->dynamic_key_time = reg.key_time; - // calculate new dynamic keys for all communities - calculate_dynamic_keys(sss); - // force re-register with all supernodes - re_register_and_purge_supernodes(sss, sss->federation, &any_time, now, 1 /* forced */); - } - ack.key_time = sss->dynamic_key_time; - } - - // send REGISTER_SUPER_ACK - encx = 0; - cmn2.pc = n2n_register_super_ack; - - encode_REGISTER_SUPER_ACK(ackbuf, &encx, &cmn2, &ack, payload_buf); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(ackbuf, encx, encx, - comm->header_encryption_ctx_static, comm->header_iv_ctx_static, - time_stamp()); - // if user-password-auth - if(comm->allowed_users) { - // append an encrypted packet hash - pearson_hash_128(hash_buf, ackbuf, encx); - // same 'user' as above - speck_128_encrypt(hash_buf, (speck_context_t*)user->shared_secret_ctx); - encode_buf(ackbuf, &encx, hash_buf, N2N_REG_SUP_HASH_CHECK_LEN); - } - } - - sendto_sock(sss, socket_fd, (struct sockaddr *)sender_sock, ackbuf, encx); - - traceEvent(TRACE_DEBUG, "Tx REGISTER_SUPER_ACK for %s [%s]", - macaddr_str(mac_buf, reg.edgeMac), - sock_to_cstr(sockbuf, &(ack.sock))); - } else { - // this is an edge with valid authentication registering with another supernode, so ... - // 1- ... associate it with that other supernode - update_node_supernode_association(comm, &(reg.edgeMac), sender_sock, now); - // 2- ... we can delete it from regular list if present (can happen) - HASH_FIND_PEER(comm->edges, reg.edgeMac, peer); - if(peer != NULL) { - if((peer->socket_fd != sss->sock) && (peer->socket_fd >= 0)) { - n2n_tcp_connection_t *conn; - HASH_FIND_INT(sss->tcp_connections, &(peer->socket_fd), conn); - close_tcp_connection(sss, conn); /* also deletes the peer */ - } else { - HASH_DEL(comm->edges, peer); - free(peer); - } - } - } - } - - break; - } - - case MSG_TYPE_UNREGISTER_SUPER: { - n2n_UNREGISTER_SUPER_t unreg; - struct peer_info *peer; - int auth; - - - memset(&unreg, 0, sizeof(n2n_UNREGISTER_SUPER_t)); - - if(!comm) { - traceEvent(TRACE_DEBUG, "dropped UNREGISTER_SUPER with unknown community %s", cmn.community); - return -1; - } - - if((from_supernode == 1) || (comm->is_federation == IS_FEDERATION)) { - traceEvent(TRACE_DEBUG, "dropped UNREGISTER_SUPER: should not come from a supernode or federation."); - return -1; - } - - decode_UNREGISTER_SUPER(&unreg, &cmn, udp_buf, &rem, &idx); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify(comm->edges, sn, unreg.srcMac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped UNREGISTER_SUPER due to time stamp error"); - return -1; - } - } - - traceEvent(TRACE_DEBUG, "Rx UNREGISTER_SUPER from %s", - macaddr_str(mac_buf, unreg.srcMac)); - - HASH_FIND_PEER(comm->edges, unreg.srcMac, peer); - if(peer != NULL) { - if((auth = auth_edge(&(peer->auth), &unreg.auth, NULL, comm)) == 0) { - if((peer->socket_fd != sss->sock) && (peer->socket_fd >= 0)) { - n2n_tcp_connection_t *conn; - HASH_FIND_INT(sss->tcp_connections, &(peer->socket_fd), conn); - close_tcp_connection(sss, conn); /* also deletes the peer */ - } else { - HASH_DEL(comm->edges, peer); - free(peer); - } - } - } - break; - } - - case MSG_TYPE_REGISTER_SUPER_ACK: { - n2n_REGISTER_SUPER_ACK_t ack; - struct peer_info *scan, *tmp; - n2n_sock_str_t sockbuf1; - n2n_sock_str_t sockbuf2; - macstr_t mac_buf1; - n2n_sock_t sender; - n2n_sock_t *orig_sender; - int i; - uint8_t dec_tmpbuf[REG_SUPER_ACK_PAYLOAD_SPACE]; - n2n_REGISTER_SUPER_ACK_payload_t *payload; - - memset(&sender, 0, sizeof(n2n_sock_t)); - sender.family = AF_INET; - sender.port = ntohs(sender_sock->sin_port); - memcpy(&(sender.addr.v4), &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - orig_sender = &sender; - - memset(&ack, 0, sizeof(n2n_REGISTER_SUPER_ACK_t)); - - if(!comm) { - traceEvent(TRACE_DEBUG, "REGISTER_SUPER_ACK with unknown community %s", cmn.community); - return -1; - } - - if((from_supernode == 0) || (comm->is_federation == IS_NO_FEDERATION)) { - traceEvent(TRACE_DEBUG, "dropped REGISTER_SUPER_ACK, should not come from an edge or regular community"); - return -1; - } - - decode_REGISTER_SUPER_ACK(&ack, &cmn, udp_buf, &rem, &idx, dec_tmpbuf); - orig_sender = &(ack.sock); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify(comm->edges, sn, ack.srcMac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped REGISTER_SUPER_ACK due to time stamp error"); - return -1; - } - } - - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_ACK from MAC %s [%s] (external %s)", - macaddr_str(mac_buf1, ack.srcMac), - sock_to_cstr(sockbuf1, &sender), - sock_to_cstr(sockbuf2, orig_sender)); - - skip_add = SN_ADD_SKIP; - scan = add_sn_to_list_by_mac_or_sock(&(sss->federation->edges), &sender, ack.srcMac, &skip_add); - if(scan != NULL) { - scan->last_seen = now; - } else { - traceEvent(TRACE_DEBUG, "dropped REGISTER_SUPER_ACK due to an unknown supernode"); - break; - } - - if(ack.cookie == scan->last_cookie) { - - payload = (n2n_REGISTER_SUPER_ACK_payload_t *)dec_tmpbuf; - for(i = 0; i < ack.num_sn; i++) { - skip_add = SN_ADD; - tmp = add_sn_to_list_by_mac_or_sock(&(sss->federation->edges), &(payload->sock), payload->mac, &skip_add); - // other supernodes communicate via standard udp socket - tmp->socket_fd = sss->sock; - - if(skip_add == SN_ADD_ADDED) { - tmp->last_seen = now - LAST_SEEN_SN_NEW; - } - - // shift to next payload entry - payload++; - } - - if(ack.key_time > sss->dynamic_key_time) { - traceEvent(TRACE_DEBUG, "setting new key time"); - // have all edges re_register (using old dynamic key) - send_re_register_super(sss); - // set new key time - sss->dynamic_key_time = ack.key_time; - // calculate new dynamic keys for all communities - calculate_dynamic_keys(sss); - // force re-register with all supernodes - re_register_and_purge_supernodes(sss, sss->federation, &any_time, now, 1 /* forced */); - } - - } else { - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_ACK with wrong or old cookie"); - } - break; - } - - case MSG_TYPE_REGISTER_SUPER_NAK: { - n2n_REGISTER_SUPER_NAK_t nak; - uint8_t nakbuf[N2N_SN_PKTBUF_SIZE]; - size_t encx = 0; - struct peer_info *peer; - n2n_sock_str_t sockbuf; - macstr_t mac_buf; - n2n_sock_t sender; - - memset(&sender, 0, sizeof(n2n_sock_t)); - sender.family = AF_INET; - sender.port = ntohs(sender_sock->sin_port); - memcpy(&(sender.addr.v4), &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - - memset(&nak, 0, sizeof(n2n_REGISTER_SUPER_NAK_t)); - - if(!comm) { - traceEvent(TRACE_DEBUG, "REGISTER_SUPER_NAK with unknown community %s", cmn.community); - return -1; - } - - decode_REGISTER_SUPER_NAK(&nak, &cmn, udp_buf, &rem, &idx); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify(comm->edges, sn, nak.srcMac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "process_udp dropped REGISTER_SUPER_NAK due to time stamp error"); - return -1; - } - } - - traceEvent(TRACE_INFO, "Rx REGISTER_SUPER_NAK from %s [%s]", - macaddr_str(mac_buf, nak.srcMac), - sock_to_cstr(sockbuf, &sender)); - - HASH_FIND_PEER(comm->edges, nak.srcMac, peer); - if(comm->is_federation == IS_NO_FEDERATION) { - if(peer != NULL) { - // this is a NAK for one of the edges conencted to this supernode, forward, - // i.e. re-assemble (memcpy from udpbuf to nakbuf could be sufficient as well) - - // use incoming cmn (with already decreased TTL) - // NAK (cookie, srcMac, auth) remains unchanged - - encode_REGISTER_SUPER_NAK(nakbuf, &encx, &cmn, &nak); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(nakbuf, encx, encx, - comm->header_encryption_ctx_static, comm->header_iv_ctx_static, - time_stamp()); - // if user-password-auth - if(comm->allowed_users) { - encode_buf(nakbuf, &encx, hash_buf /* no matter what content */, N2N_REG_SUP_HASH_CHECK_LEN); - } - } - - sendto_peer(sss, peer, nakbuf, encx); - - if((peer->socket_fd != sss->sock) && (peer->socket_fd >= 0)) { - n2n_tcp_connection_t *conn; - HASH_FIND_INT(sss->tcp_connections, &(peer->socket_fd), conn); - close_tcp_connection(sss, conn); /* also deletes the peer */ - } else { - HASH_DEL(comm->edges, peer); - free(peer); - } - } - } - break; - } - - case MSG_TYPE_QUERY_PEER: { - n2n_QUERY_PEER_t query; - uint8_t encbuf[N2N_SN_PKTBUF_SIZE]; - size_t encx = 0; - n2n_common_t cmn2; - n2n_PEER_INFO_t pi; - struct sn_community_regular_expression *re, *tmp_re; - int8_t allowed_match = -1; - uint8_t match = 0; - int match_length = 0; - - if(!comm && sss->lock_communities) { - HASH_ITER(hh, sss->rules, re, tmp_re) { - allowed_match = re_matchp(re->rule, (const char *)cmn.community, &match_length); - - if((allowed_match != -1) - && (match_length == strlen((const char *)cmn.community)) // --- only full matches allowed (remove, if also partial matches wanted) - && (allowed_match == 0)) { // --- only full matches allowed (remove, if also partial matches wanted) - match = 1; - break; - } - } - if(match != 1) { - traceEvent(TRACE_DEBUG, "QUERY_PEER from unknown community %s", cmn.community); - return -1; - } - } - - if(!comm && sss->lock_communities && (match == 0)) { - traceEvent(TRACE_DEBUG, "QUERY_PEER from not allowed community %s", cmn.community); - return -1; - } - - decode_QUERY_PEER( &query, &cmn, udp_buf, &rem, &idx ); - - // to answer a PING, it is sufficient if the provided communtiy would be a valid one, there does not - // neccessarily need to be a comm entry present, e.g. because there locally are no edges of the - // community connected (several supernodes in a federation setup) - if(comm) { - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify(comm->edges, sn, query.srcMac, stamp, TIME_STAMP_ALLOW_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped QUERY_PEER due to time stamp error"); - return -1; - } - } - } - - if(is_null_mac(query.targetMac)) { - traceEvent(TRACE_DEBUG, "Rx PING from %s", - macaddr_str(mac_buf, query.srcMac)); - - cmn2.ttl = N2N_DEFAULT_TTL; - cmn2.pc = n2n_peer_info; - cmn2.flags = N2N_FLAGS_FROM_SUPERNODE; - memcpy(cmn2.community, cmn.community, sizeof(n2n_community_t)); - - pi.aflags = 0; - memcpy(pi.mac, query.targetMac, sizeof(n2n_mac_t)); - memcpy(pi.srcMac, sss->mac_addr, sizeof(n2n_mac_t)); - pi.sock.family = AF_INET; - pi.sock.port = ntohs(sender_sock->sin_port); - memcpy(pi.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE); - pi.load = sn_selection_criterion_gather_data(sss); - - snprintf(pi.version, sizeof(pi.version), "%s", sss->version); - pi.uptime = now - sss->start_time; - - encode_PEER_INFO(encbuf, &encx, &cmn2, &pi); - - if(comm) { - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(encbuf, encx, encx, comm->header_encryption_ctx_dynamic, - comm->header_iv_ctx_dynamic, - time_stamp()); - } - } - - sendto_sock(sss, socket_fd, (struct sockaddr *)sender_sock, encbuf, encx); - - traceEvent(TRACE_DEBUG, "Tx PONG to %s", - macaddr_str(mac_buf, query.srcMac)); - - } else { - traceEvent(TRACE_DEBUG, "Rx QUERY_PEER from %s for %s", - macaddr_str(mac_buf, query.srcMac), - macaddr_str(mac_buf2, query.targetMac)); - - struct peer_info *scan; - - // as opposed to the special case 'PING', proper QUERY_PEER processing requires a locally actually present community entry - if(!comm) { - traceEvent(TRACE_DEBUG, "QUERY_PEER with unknown community %s", cmn.community); - return -1; - } - - HASH_FIND_PEER(comm->edges, query.targetMac, scan); - if(scan) { - cmn2.ttl = N2N_DEFAULT_TTL; - cmn2.pc = n2n_peer_info; - cmn2.flags = N2N_FLAGS_FROM_SUPERNODE; - memcpy(cmn2.community, cmn.community, sizeof(n2n_community_t)); - - pi.aflags = 0; - memcpy(pi.srcMac, query.srcMac, sizeof(n2n_mac_t)); - memcpy(pi.mac, query.targetMac, sizeof(n2n_mac_t)); - pi.sock = scan->sock; - if(scan->preferred_sock.family != (uint8_t)AF_INVALID) { - cmn2.flags |= N2N_FLAGS_SOCKET; - pi.preferred_sock = scan->preferred_sock; - } - - encode_PEER_INFO(encbuf, &encx, &cmn2, &pi); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(encbuf, encx, encx, comm->header_encryption_ctx_dynamic, - comm->header_iv_ctx_dynamic, - time_stamp()); - } - // back to sender, be it edge or supernode (which will forward to edge) - sendto_sock(sss, socket_fd, (struct sockaddr *)sender_sock, encbuf, encx); - - traceEvent(TRACE_DEBUG, "Tx PEER_INFO to %s", - macaddr_str(mac_buf, query.srcMac)); - - } else { - - if(from_supernode) { - traceEvent(TRACE_DEBUG, "QUERY_PEER on unknown edge from supernode %s, dropping the packet", - macaddr_str(mac_buf, query.srcMac)); - } else { - traceEvent(TRACE_DEBUG, "QUERY_PEER from unknown edge %s, forwarding to all other supernodes", - macaddr_str(mac_buf, query.srcMac)); - - memcpy(&cmn2, &cmn, sizeof(n2n_common_t)); - cmn2.flags |= N2N_FLAGS_FROM_SUPERNODE; - - encode_QUERY_PEER(encbuf, &encx, &cmn2, &query); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(encbuf, encx, encx, comm->header_encryption_ctx_dynamic, - comm->header_iv_ctx_dynamic, - time_stamp()); - } - - try_broadcast(sss, NULL, &cmn, query.srcMac, from_supernode, encbuf, encx); - } - } - } - break; - } - - case MSG_TYPE_PEER_INFO: { - n2n_PEER_INFO_t pi; - uint8_t encbuf[N2N_SN_PKTBUF_SIZE]; - size_t encx = 0; - struct peer_info *peer; - - if(!comm) { - traceEvent(TRACE_DEBUG, "PEER_INFO with unknown community %s", cmn.community); - return -1; - } - - decode_PEER_INFO(&pi, &cmn, udp_buf, &rem, &idx); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - if(!find_edge_time_stamp_and_verify(comm->edges, sn, pi.srcMac, stamp, TIME_STAMP_NO_JITTER)) { - traceEvent(TRACE_DEBUG, "dropped PEER_INFO due to time stamp error"); - return -1; - } - } - - traceEvent(TRACE_INFO, "Rx PEER_INFO from %s [%s]", - macaddr_str(mac_buf, pi.srcMac), - sock_to_cstr(sockbuf, &sender)); - - HASH_FIND_PEER(comm->edges, pi.srcMac, peer); - if(peer != NULL) { - if((comm->is_federation == IS_NO_FEDERATION) && (!is_null_mac(pi.srcMac))) { - // snoop on the information to use for supernode forwarding (do not wait until first remote REGISTER_SUPER) - update_node_supernode_association(comm, &(pi.mac), sender_sock, now); - - // this is a PEER_INFO for one of the edges conencted to this supernode, forward, - // i.e. re-assemble (memcpy of udpbuf to encbuf could be sufficient as well) - - // use incoming cmn (with already decreased TTL) - // PEER_INFO remains unchanged - - encode_PEER_INFO(encbuf, &encx, &cmn, &pi); - - if(comm->header_encryption == HEADER_ENCRYPTION_ENABLED) { - packet_header_encrypt(encbuf, encx, encx, - comm->header_encryption_ctx_dynamic, comm->header_iv_ctx_dynamic, - time_stamp()); - } - - sendto_peer(sss, peer, encbuf, encx); - } - } - break; - } - - default: - /* Not a known message type */ - traceEvent(TRACE_WARNING, "unable to handle packet type %d: ignored", (signed int)msg_type); - } /* switch(msg_type) */ - - return 0; -} - - -/** Long lived processing entry point. Split out from main to simply - * daemonisation on some platforms. */ -int run_sn_loop (n2n_sn_t *sss) { - - uint8_t pktbuf[N2N_SN_PKTBUF_SIZE]; - time_t last_purge_edges = 0; - time_t last_sort_communities = 0; - time_t last_re_reg_and_purge = 0; - - sss->start_time = time(NULL); - - while(*sss->keep_running) { - int rc; - ssize_t bread; - int max_sock; - fd_set socket_mask; - n2n_tcp_connection_t *conn, *tmp_conn; - -#ifdef N2N_HAVE_TCP - SOCKET tmp_sock; - n2n_sock_str_t sockbuf; -#endif - struct timeval wait_time; - time_t before, now = 0; - - FD_ZERO(&socket_mask); - - FD_SET(sss->sock, &socket_mask); -#ifdef N2N_HAVE_TCP - FD_SET(sss->tcp_sock, &socket_mask); -#endif - FD_SET(sss->mgmt_sock, &socket_mask); - - max_sock = MAX(MAX(sss->sock, sss->mgmt_sock), sss->tcp_sock); - -#ifdef N2N_HAVE_TCP - // add the tcp connections' sockets - HASH_ITER(hh, sss->tcp_connections, conn, tmp_conn) { - //socket descriptor - FD_SET(conn->socket_fd, &socket_mask); - if(conn->socket_fd > max_sock) - max_sock = conn->socket_fd; - } -#endif - - wait_time.tv_sec = 10; - wait_time.tv_usec = 0; - - before = time(NULL); - - rc = select(max_sock + 1, &socket_mask, NULL, NULL, &wait_time); - - now = time(NULL); - - if(rc > 0) { - - // external udp - if(FD_ISSET(sss->sock, &socket_mask)) { - struct sockaddr_in sender_sock; - socklen_t i; - - i = sizeof(sender_sock); - bread = recvfrom(sss->sock, (void *)pktbuf, N2N_SN_PKTBUF_SIZE, 0 /*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t *)&i); - - if((bread < 0) -#ifdef WIN32 - && (WSAGetLastError() != WSAECONNRESET) -#endif - ) { - /* For UDP bread of zero just means no data (unlike TCP). */ - /* The fd is no good now. Maybe we lost our interface. */ - traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); -#ifdef WIN32 - traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - *sss->keep_running = 0; - break; - } - - // we have a datagram to process... - if(bread > 0) { - // ...and the datagram has data (not just a header) - process_udp(sss, &sender_sock, sss->sock, pktbuf, bread, now); - } - } - -#ifdef N2N_HAVE_TCP - // the so far known tcp connections - - // beware: current conn and other items of the connection list may be found - // due for deletion while processing packets. Even OTHER connections, e.g. if - // forwarding to another edge node fails. connections due for deletion will - // not immediately be deleted but marked 'inactive' for later deletion - HASH_ITER(hh, sss->tcp_connections, conn, tmp_conn) { - // do not process entries that have been marked inactive, those will be deleted - // immediately after this loop - if(conn->inactive) - continue; - - if(FD_ISSET(conn->socket_fd, &socket_mask)) { - - struct sockaddr_in sender_sock; - socklen_t i; - - i = sizeof(sender_sock); - bread = recvfrom(conn->socket_fd, - conn->buffer + conn->position, conn->expected - conn->position, 0 /*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t *)&i); - - if(bread <= 0) { - traceEvent(TRACE_INFO, "closing tcp connection to [%s]", sock_to_cstr(sockbuf, (n2n_sock_t*)&sender_sock)); - traceEvent(TRACE_DEBUG, "recvfrom() returns %d and sees errno %d (%s)", bread, errno, strerror(errno)); -#ifdef WIN32 - traceEvent(TRACE_DEBUG, "WSAGetLastError(): %u", WSAGetLastError()); -#endif - close_tcp_connection(sss, conn); - continue; - } - conn->position += bread; - - if(conn->position == conn->expected) { - if(conn->position == sizeof(uint16_t)) { - // the prepended length has been read, preparing for the packet - conn->expected += be16toh(*(uint16_t*)(conn->buffer)); - if(conn->expected > N2N_SN_PKTBUF_SIZE) { - traceEvent(TRACE_INFO, "closing tcp connection to [%s]", sock_to_cstr(sockbuf, (n2n_sock_t*)&sender_sock)); - traceEvent(TRACE_DEBUG, "too many bytes in tcp packet expected"); - close_tcp_connection(sss, conn); - continue; - } - } else { - // full packet read, handle it - process_udp(sss, (struct sockaddr_in*)&(conn->sock), conn->socket_fd, - conn->buffer + sizeof(uint16_t), conn->position - sizeof(uint16_t), now); - - // reset, await new prepended length - conn->expected = sizeof(uint16_t); - conn->position = 0; - } - } - } - } - - // remove inactive / already closed tcp connections from list - HASH_ITER(hh, sss->tcp_connections, conn, tmp_conn) { - if(conn->inactive) { - HASH_DEL(sss->tcp_connections, conn); - free(conn); - } - } - - // accept new incoming tcp connection - if(FD_ISSET(sss->tcp_sock, &socket_mask)) { - struct sockaddr_in sender_sock; - socklen_t i; - - i = sizeof(sender_sock); - if((HASH_COUNT(sss->tcp_connections) + 4) < FD_SETSIZE) { - tmp_sock = accept(sss->tcp_sock, (struct sockaddr *)&sender_sock, (socklen_t *)&i); - if(tmp_sock >= 0) { - conn = (n2n_tcp_connection_t*)malloc(sizeof(n2n_tcp_connection_t)); - if(conn) { - conn->socket_fd = tmp_sock; - memcpy(&(conn->sock), &sender_sock, sizeof(struct sockaddr_in)); - conn->inactive = 0; - conn->expected = sizeof(uint16_t); - conn->position = 0; - HASH_ADD_INT(sss->tcp_connections, socket_fd, conn); - traceEvent(TRACE_INFO, "accepted incoming TCP connection from [%s]", - sock_to_cstr(sockbuf, (n2n_sock_t*)&sender_sock)); - } - } - } else { - // no space to store the socket for a new connection, close immediately - traceEvent(TRACE_DEBUG, "denied incoming TCP connection from [%s] due to max connections limit hit", - sock_to_cstr(sockbuf, (n2n_sock_t*)&sender_sock)); - } - } -#endif /* N2N_HAVE_TCP */ - - // handle management port input - if(FD_ISSET(sss->mgmt_sock, &socket_mask)) { - struct sockaddr_in sender_sock; - size_t i; - - i = sizeof(sender_sock); - bread = recvfrom(sss->mgmt_sock, (void *)pktbuf, N2N_SN_PKTBUF_SIZE, 0 /*flags*/, - (struct sockaddr *)&sender_sock, (socklen_t *)&i); - - if(bread <= 0) { - traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); - *sss->keep_running = 0; - break; - } - - // we have a datagram to process - process_mgmt(sss, &sender_sock, (char *)pktbuf, bread, now); - } - - } else { - if(((now - before) < wait_time.tv_sec) && (*sss->keep_running)){ - // this is no real timeout, something went wrong with one of the tcp connections (probably) - // close them all, edges will re-open if they detect closure - traceEvent(TRACE_DEBUG, "falsly claimed timeout, assuming issue with tcp connection, closing them all"); - HASH_ITER(hh, sss->tcp_connections, conn, tmp_conn) - close_tcp_connection(sss, conn); - } else - traceEvent(TRACE_DEBUG, "timeout"); - } - - re_register_and_purge_supernodes(sss, sss->federation, &last_re_reg_and_purge, now, 0 /* not forced */); - purge_expired_communities(sss, &last_purge_edges, now); - sort_communities(sss, &last_sort_communities, now); - resolve_check(sss->resolve_parameter, 0 /* presumably, no special resolution requirement */, now); - } /* while */ - - sn_term(sss); - - return 0; -} diff --git a/bundles/n2n_ntop_v3/src/speck.c b/bundles/n2n_ntop_v3/src/speck.c deleted file mode 100644 index f0f28096..00000000 --- a/bundles/n2n_ntop_v3/src/speck.c +++ /dev/null @@ -1,1026 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -// cipher SPECK -- 128 bit block size -- 128 and 256 bit key size -- CTR mode -// taken from (and modified: removed pure crypto-stream generation and seperated key expansion) -// https://github.com/nsacyber/simon-speck-supercop/blob/master/crypto_stream/speck128256ctr/ - - -#include "speck.h" - - -#if defined (__AVX512F__) // AVX512 support ---------------------------------------------------------------------- - - -#define LCS(x,r) (((x)<>(64-r))) -#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) - -#define SET _mm512_set_epi64 -#define XOR _mm512_xor_si512 -#define ADD _mm512_add_epi64 -#define AND _mm512_and_si512 -#define ROL(X,r) (_mm512_rol_epi64(X,r)) -#define ROR(X,r) (_mm512_ror_epi64(X,r)) - -#define _q8 SET(0x7LL,0x3LL,0x6LL,0x2LL,0x5LL,0x1LL,0x4LL,0x0LL) -#define _eight SET(0x8LL,0x8LL,0x8LL,0x8LL,0x8LL,0x8LL,0x8LL,0x8LL) - -#define SET1(X,c) (X=SET(c,c,c,c,c,c,c,c)) -#define SET8(X,c) (X=SET(c,c,c,c,c,c,c,c), X=ADD(X,_q8)) - -#define LOW _mm512_unpacklo_epi64 -#define HIGH _mm512_unpackhi_epi64 -#define LD(ip) (_mm512_load_epi64(((void *)(ip)))) -#define ST(ip,X) _mm512_storeu_si512((void *)(ip),X) -#define STORE(out,X,Y) (ST(out,LOW(Y,X)), ST(out+64,HIGH(Y,X))) -#define XOR_STORE(in,out,X,Y) (ST(out,XOR(LD(in),LOW(Y,X))), ST(out+64,XOR(LD(in+64),HIGH(Y,X)))) - -#define Rx8(X,Y,k) (X[0]=XOR(ADD(ROR(X[0],8),Y[0]),k), \ - Y[0]=XOR(ROL(Y[0],3),X[0])) -#define Rx16(X,Y,k) (X[0]=XOR(ADD(ROR(X[0],8),Y[0]),k), X[1]=XOR(ADD(ROR(X[1],8),Y[1]),k), \ - Y[0]=XOR(ROL(Y[0],3),X[0]), Y[1]=XOR(ROL(Y[1],3),X[1])) -#define Rx24(X,Y,k) (X[0]=XOR(ADD(ROR(X[0],8),Y[0]),k), X[1]=XOR(ADD(ROR(X[1],8),Y[1]),k), X[2]=XOR(ADD(ROR(X[2],8),Y[2]),k), \ - Y[0]=XOR(ROL(Y[0],3),X[0]), Y[1]=XOR(ROL(Y[1],3),X[1]), Y[2]=XOR(ROL(Y[2],3),X[2])) -#define Rx32(X,Y,k) (X[0]=XOR(ADD(ROR(X[0],8),Y[0]),k), X[1]=XOR(ADD(ROR(X[1],8),Y[1]),k), \ - X[2]=XOR(ADD(ROR(X[2],8),Y[2]),k), X[3]=XOR(ADD(ROR(X[3],8),Y[3]),k), \ - Y[0]=XOR(ROL(Y[0],3),X[0]), Y[1]=XOR(ROL(Y[1],3),X[1]), \ - Y[2]=XOR(ROL(Y[2],3),X[2]), Y[3]=XOR(ROL(Y[3],3),X[3])) - -#define Rx1(x,y,k) (x[0]=RCS(x[0],8), x[0]+=y[0], x[0]^=k, y[0]=LCS(y[0],3), y[0]^=x[0]) -#define Rx1b(x,y,k) (x=RCS(x,8), x+=y, x^=k, y=LCS(y,3), y^=x) -#define Rx2(x,y,k) (x[0]=RCS(x[0],8), x[1]=RCS(x[1],8), x[0]+=y[0], x[1]+=y[1], \ - x[0]^=k, x[1]^=k, y[0]=LCS(y[0],3), y[1]=LCS(y[1],3), y[0]^=x[0], y[1]^=x[1]) - -#define Encrypt_128(X,Y,k,n) (Rx##n(X,Y,k[0]), Rx##n(X,Y,k[1]), Rx##n(X,Y,k[2]), Rx##n(X,Y,k[3]), Rx##n(X,Y,k[4]), Rx##n(X,Y,k[5]), Rx##n(X,Y,k[6]), Rx##n(X,Y,k[7]), \ - Rx##n(X,Y,k[8]), Rx##n(X,Y,k[9]), Rx##n(X,Y,k[10]), Rx##n(X,Y,k[11]), Rx##n(X,Y,k[12]), Rx##n(X,Y,k[13]), Rx##n(X,Y,k[14]), Rx##n(X,Y,k[15]), \ - Rx##n(X,Y,k[16]), Rx##n(X,Y,k[17]), Rx##n(X,Y,k[18]), Rx##n(X,Y,k[19]), Rx##n(X,Y,k[20]), Rx##n(X,Y,k[21]), Rx##n(X,Y,k[22]), Rx##n(X,Y,k[23]), \ - Rx##n(X,Y,k[24]), Rx##n(X,Y,k[25]), Rx##n(X,Y,k[26]), Rx##n(X,Y,k[27]), Rx##n(X,Y,k[28]), Rx##n(X,Y,k[29]), Rx##n(X,Y,k[30]), Rx##n(X,Y,k[31])) - -#define Encrypt_256(X,Y,k,n) (Encrypt_128(X,Y,k,n), \ - Rx##n(X,Y,k[32]), Rx##n(X,Y,k[33])) - -#define RK(X,Y,k,key,i) (SET1(k[i],Y), key[i]=Y, X=RCS(X,8), X+=Y, X^=i, Y=LCS(Y,3), Y^=X) - -#define EK(A,B,C,D,k,key) (RK(B,A,k,key,0), RK(C,A,k,key,1), RK(D,A,k,key,2), RK(B,A,k,key,3), RK(C,A,k,key,4), RK(D,A,k,key,5), RK(B,A,k,key,6), \ - RK(C,A,k,key,7), RK(D,A,k,key,8), RK(B,A,k,key,9), RK(C,A,k,key,10), RK(D,A,k,key,11), RK(B,A,k,key,12), RK(C,A,k,key,13), \ - RK(D,A,k,key,14), RK(B,A,k,key,15), RK(C,A,k,key,16), RK(D,A,k,key,17), RK(B,A,k,key,18), RK(C,A,k,key,19), RK(D,A,k,key,20), \ - RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \ - RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33)) - -#define Encrypt_Dispatcher(keysize) \ - u64 x[2], y[2]; \ - u512 X[4], Y[4]; \ - unsigned char block1024[128]; \ - \ - if(numbytes == 16) { \ - x[0] = nonce[1]; y[0] = nonce[0]; nonce[0]++; \ - Encrypt_##keysize(x, y, ctx->key, 1); \ - ((u64 *)out)[1] = x[0]; ((u64 *)out)[0] = y[0]; \ - return 0; \ - } \ - \ - if(numbytes == 32) { \ - x[0] = nonce[1]; y[0] = nonce[0]; nonce[0]++; \ - x[1] = nonce[1]; y[1] = nonce[0]; nonce[0]++; \ - Encrypt_##keysize(x, y, ctx->key, 2); \ - ((u64 *)out)[1] = x[0] ^ ((u64 *)in)[1]; ((u64 *)out)[0] = y[0] ^ ((u64 *)in)[0]; \ - ((u64 *)out)[3] = x[1] ^ ((u64 *)in)[3]; ((u64 *)out)[2] = y[1] ^ ((u64 *)in)[2]; \ - return 0; \ - } \ - \ - if(numbytes == 64) { \ - SET1(X[0], nonce[1]); \ - SET8(Y[0], nonce[0]); \ - Encrypt_##keysize(X, Y, ctx->rk, 8); \ - nonce[0] += (numbytes >> 4); \ - memcpy(block1024, in, 64); \ - XOR_STORE(block1024, block1024, X[0], Y[0]); \ - memcpy(out, block1024, 64); \ - return 0; \ - } \ - \ - SET1(X[0], nonce[1]); SET8(Y[0], nonce[0]); \ - \ - if(numbytes == 128) \ - Encrypt_##keysize(X, Y, ctx->rk, 8); \ - else { \ - X[1] = X[0]; \ - Y[1] = ADD(Y[0], _eight); \ - if(numbytes == 256) \ - Encrypt_##keysize(X, Y, ctx->rk, 16); \ - else { \ - X[2] = X[0]; \ - Y[2] = ADD(Y[1], _eight); \ - if(numbytes == 384) \ - Encrypt_##keysize(X, Y, ctx->rk, 24); \ - else { \ - X[3] = X[0]; \ - Y[3] = ADD(Y[2], _eight); \ - Encrypt_##keysize(X, Y, ctx->rk, 32); \ - } \ - } \ - } \ - \ - nonce[0] += (numbytes >> 4); \ - \ - XOR_STORE(in, out, X[0], Y[0]); \ - if (numbytes >= 256) \ - XOR_STORE(in + 128, out + 128, X[1], Y[1]); \ - if(numbytes >= 384) \ - XOR_STORE(in + 256, out + 256, X[2], Y[2]); \ - if(numbytes >= 512) \ - XOR_STORE(in + 384, out + 384, X[3], Y[3]); \ - \ - return 0 - - -static int speck_encrypt_xor(unsigned char *out, const unsigned char *in, u64 nonce[], speck_context_t *ctx, int numbytes) { - - if(ctx->keysize == 256) { - Encrypt_Dispatcher(256); - } else { - Encrypt_Dispatcher(128); - } -} - - -static int internal_speck_ctr(unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx) { - - int i; - u64 nonce[2]; - unsigned char block[16]; - u64 * const block64 = (u64 *)block; - - if (!inlen) - return 0; - - nonce[0] = ((u64 *)n)[0]; - nonce[1] = ((u64 *)n)[1]; - - while(inlen >= 512) { - speck_encrypt_xor(out, in, nonce, ctx, 512); - in += 512; inlen -= 512; out += 512; - } - - if(inlen >= 384) { - speck_encrypt_xor(out, in, nonce, ctx, 384); - in += 384; inlen -= 384; out += 384; - } - - if(inlen >= 256) { - speck_encrypt_xor(out, in, nonce, ctx, 256); - in += 256; inlen -= 256; out += 256; - } - - if(inlen >= 128) { - speck_encrypt_xor(out, in, nonce, ctx, 128); - in += 128; inlen -= 128; out += 128; - } - - if(inlen >= 64) { - speck_encrypt_xor(out, in, nonce, ctx, 64); - in += 64; inlen -= 64; out += 64; - } - - if(inlen >= 32) { - speck_encrypt_xor(out, in, nonce, ctx, 32); - in += 32; inlen -= 32; out += 32; - } - - if(inlen >= 16) { - speck_encrypt_xor(block, in, nonce, ctx, 16); - ((u64 *)out)[0] = block64[0] ^ ((u64 *)in)[0]; - ((u64 *)out)[1] = block64[1] ^ ((u64 *)in)[1]; - in += 16; inlen -= 16; out += 16; - } - - if(inlen > 0) { - speck_encrypt_xor(block, in, nonce, ctx, 16); - for(i = 0; i < inlen; i++) - out[i] = block[i] ^ in[i]; - } - - return 0; -} - - -static int speck_expand_key (speck_context_t *ctx, const unsigned char *k, int keysize) { - - u64 K[4]; - size_t i; - - for(i = 0; i < (keysize >> 6); i++) - K[i] = ((u64 *)k)[i]; - - // 128 bit has only two keys A and B thus replacing both C and D with B then - if(keysize == 128) { - EK(K[0], K[1], K[1], K[1], ctx->rk, ctx->key); - } else { - EK(K[0], K[1], K[2], K[3], ctx->rk, ctx->key); - } - - ctx->keysize = keysize; - - return 0; -} - - -#elif defined (__AVX2__) // AVX2 support ------------------------------------------------------------------------- - - -#define LCS(x,r) (((x)<>(64-r))) -#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) - -#define XOR _mm256_xor_si256 -#define AND _mm256_and_si256 -#define ADD _mm256_add_epi64 -#define SL _mm256_slli_epi64 -#define SR _mm256_srli_epi64 - -#define _q SET(0x3,0x1,0x2,0x0) -#define _four SET(0x4,0x4,0x4,0x4) - -#define SET _mm256_set_epi64x -#define SET1(X,c) (X=SET(c,c,c,c)) -#define SET4(X,c) (X=SET(c,c,c,c), X=ADD(X,_q)) - -#define LOW _mm256_unpacklo_epi64 -#define HIGH _mm256_unpackhi_epi64 -#define LD(ip) _mm256_loadu_si256((__m256i *)(ip)) -#define ST(ip,X) _mm256_storeu_si256((__m256i *)(ip),X) -#define STORE(out,X,Y) (ST(out,LOW(Y,X)), ST(out+32,HIGH(Y,X))) -#define STORE_ALT(out,X,Y) (ST(out,LOW(X,Y)), ST(out+32,HIGH(X,Y))) -#define XOR_STORE(in,out,X,Y) (ST(out,XOR(LD(in),LOW(Y,X))), ST(out+32,XOR(LD(in+32),HIGH(Y,X)))) -#define XOR_STORE_ALT(in,out,X,Y) (ST(out,XOR(LD(in),LOW(X,Y))), ST(out+32,XOR(LD(in+32),HIGH(X,Y)))) - -#define SHFL _mm256_shuffle_epi8 -#define R8 SET(0x080f0e0d0c0b0a09LL,0x0007060504030201LL,0x080f0e0d0c0b0a09LL,0x0007060504030201LL) -#define L8 SET(0x0e0d0c0b0a09080fLL,0x0605040302010007LL,0x0e0d0c0b0a09080fLL,0x0605040302010007LL) -#define ROL8(X) (SHFL(X,L8)) -#define ROR8(X) (SHFL(X,R8)) -#define ROL(X,r) (XOR(SL(X,r),SR(X,(64-r)))) -#define ROR(X,r) (XOR(SR(X,r),SL(X,(64-r)))) - -#define R(X,Y,k) (X=XOR(ADD(ROR8(X),Y),k), Y=XOR(ROL(Y,3),X)) - -#define Rx4(X,Y,k) (R(X[0],Y[0],k)) -#define Rx8(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k)) -#define Rx12(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k), R(X[2],Y[2],k)) -#define Rx16(X,Y,k) (X[0]=ROR8(X[0]), X[0]=ADD(X[0],Y[0]), X[1]=ROR8(X[1]), X[1]=ADD(X[1],Y[1]), \ - X[2]=ROR8(X[2]), X[2]=ADD(X[2],Y[2]), X[3]=ROR8(X[3]), X[3]=ADD(X[3],Y[3]), \ - X[0]=XOR(X[0],k), X[1]=XOR(X[1],k), X[2]=XOR(X[2],k), X[3]=XOR(X[3],k), \ - Z[0]=Y[0], Z[1]=Y[1], Z[2]=Y[2], Z[3]=Y[3], \ - Z[0]=SL(Z[0],3), Y[0]=SR(Y[0],61), Z[1]=SL(Z[1],3), Y[1]=SR(Y[1],61), \ - Z[2]=SL(Z[2],3), Y[2]=SR(Y[2],61), Z[3]=SL(Z[3],3), Y[3]=SR(Y[3],61), \ - Y[0]=XOR(Y[0],Z[0]), Y[1]=XOR(Y[1],Z[1]), Y[2]=XOR(Y[2],Z[2]), Y[3]=XOR(Y[3],Z[3]), \ - Y[0]=XOR(X[0],Y[0]), Y[1]=XOR(X[1],Y[1]), Y[2]=XOR(X[2],Y[2]), Y[3]=XOR(X[3],Y[3])) - -#define Rx1(x,y,k) (x[0]=RCS(x[0],8), x[0]+=y[0], x[0]^=k, y[0]=LCS(y[0],3), y[0]^=x[0]) -#define Rx1b(x,y,k) (x=RCS(x,8), x+=y, x^=k, y=LCS(y,3), y^=x) -#define Rx2(x,y,k) (x[0]=RCS(x[0],8), x[1]=RCS(x[1],8), x[0]+=y[0], x[1]+=y[1], \ - x[0]^=k, x[1]^=k, y[0]=LCS(y[0],3), y[1]=LCS(y[1],3), y[0]^=x[0], y[1]^=x[1]) - -#define Encrypt_128(X,Y,k,n) (Rx##n(X,Y,k[0]), Rx##n(X,Y,k[1]), Rx##n(X,Y,k[2]), Rx##n(X,Y,k[3]), Rx##n(X,Y,k[4]), Rx##n(X,Y,k[5]), Rx##n(X,Y,k[6]), Rx##n(X,Y,k[7]), \ - Rx##n(X,Y,k[8]), Rx##n(X,Y,k[9]), Rx##n(X,Y,k[10]), Rx##n(X,Y,k[11]), Rx##n(X,Y,k[12]), Rx##n(X,Y,k[13]), Rx##n(X,Y,k[14]), Rx##n(X,Y,k[15]), \ - Rx##n(X,Y,k[16]), Rx##n(X,Y,k[17]), Rx##n(X,Y,k[18]), Rx##n(X,Y,k[19]), Rx##n(X,Y,k[20]), Rx##n(X,Y,k[21]), Rx##n(X,Y,k[22]), Rx##n(X,Y,k[23]), \ - Rx##n(X,Y,k[24]), Rx##n(X,Y,k[25]), Rx##n(X,Y,k[26]), Rx##n(X,Y,k[27]), Rx##n(X,Y,k[28]), Rx##n(X,Y,k[29]), Rx##n(X,Y,k[30]), Rx##n(X,Y,k[31])) - -#define Encrypt_256(X,Y,k,n) (Encrypt_128(X,Y,k,n), \ - Rx##n(X,Y,k[32]), Rx##n(X,Y,k[33])) - -#define RK(X,Y,k,key,i) (SET1(k[i],Y), key[i]=Y, X=RCS(X,8), X+=Y, X^=i, Y=LCS(Y,3), Y^=X) - -#define EK(A,B,C,D,k,key) (RK(B,A,k,key,0), RK(C,A,k,key,1), RK(D,A,k,key,2), RK(B,A,k,key,3), RK(C,A,k,key,4), RK(D,A,k,key,5), RK(B,A,k,key,6), \ - RK(C,A,k,key,7), RK(D,A,k,key,8), RK(B,A,k,key,9), RK(C,A,k,key,10), RK(D,A,k,key,11), RK(B,A,k,key,12), RK(C,A,k,key,13), \ - RK(D,A,k,key,14), RK(B,A,k,key,15), RK(C,A,k,key,16), RK(D,A,k,key,17), RK(B,A,k,key,18), RK(C,A,k,key,19), RK(D,A,k,key,20), \ - RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \ - RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33)) - -#define Encrypt_Dispatcher(keysize) \ - u64 x[2], y[2]; \ - u256 X[4], Y[4], Z[4]; \ - \ - if(numbytes == 16) { \ - x[0] = nonce[1]; y[0] = nonce[0]; nonce[0]++; \ - Encrypt_##keysize(x, y, ctx->key, 1); \ - ((u64 *)out)[1] = x[0]; ((u64 *)out)[0] = y[0]; \ - return 0; \ - } \ - \ - if(numbytes == 32) { \ - x[0] = nonce[1]; y[0] = nonce[0]; nonce[0]++; \ - x[1] = nonce[1]; y[1] = nonce[0]; nonce[0]++; \ - Encrypt_##keysize(x , y, ctx->key, 2); \ - ((u64 *)out)[1] = x[0] ^ ((u64 *)in)[1]; ((u64 *)out)[0] = y[0] ^ ((u64 *)in)[0]; \ - ((u64 *)out)[3] = x[1] ^ ((u64 *)in)[3]; ((u64 *)out)[2] = y[1] ^ ((u64 *)in)[2]; \ - return 0; \ - } \ - \ - SET1(X[0], nonce[1]); SET4(Y[0], nonce[0]); \ - \ - if(numbytes == 64) \ - Encrypt_##keysize(X, Y, ctx->rk, 4); \ - else { \ - X[1] = X[0]; \ - Y[1] = ADD(Y[0], _four); \ - if(numbytes == 128) \ - Encrypt_##keysize(X, Y, ctx->rk, 8); \ - else { \ - X[2] = X[0]; \ - Y[2] = ADD(Y[1], _four); \ - if(numbytes == 192) \ - Encrypt_##keysize(X, Y, ctx->rk, 12); \ - else { \ - X[3] = X[0]; \ - Y[3] = ADD(Y[2], _four); \ - Encrypt_##keysize(X, Y, ctx->rk, 16); \ - } \ - } \ - } \ - \ - nonce[0] += (numbytes >> 4); \ - \ - XOR_STORE(in, out, X[0], Y[0]); \ - if (numbytes >= 128) \ - XOR_STORE(in + 64, out + 64, X[1], Y[1]); \ - if(numbytes >= 192) \ - XOR_STORE(in + 128, out + 128, X[2], Y[2]); \ - if(numbytes >= 256) \ - XOR_STORE(in + 192, out + 192, X[3], Y[3]); \ - \ - return 0 - - -static int speck_encrypt_xor(unsigned char *out, const unsigned char *in, u64 nonce[], speck_context_t *ctx, int numbytes) { - - if(ctx->keysize == 256) { - Encrypt_Dispatcher(256); - } else { - Encrypt_Dispatcher(128); - } -} - - -static int internal_speck_ctr(unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx) { - - int i; - u64 nonce[2]; - unsigned char block[16]; - u64 * const block64 = (u64 *)block; - - if (!inlen) - return 0; - - nonce[0] = ((u64 *)n)[0]; - nonce[1] = ((u64 *)n)[1]; - - while(inlen >= 256) { - speck_encrypt_xor(out, in, nonce, ctx, 256); - in += 256; inlen -= 256; out += 256; - } - - if(inlen >= 192) { - speck_encrypt_xor(out, in, nonce, ctx, 192); - in += 192; inlen -= 192; out += 192; - } - - if(inlen >= 128) { - speck_encrypt_xor(out, in, nonce, ctx, 128); - in += 128; inlen -= 128; out += 128; - } - - if(inlen >= 64) { - speck_encrypt_xor(out, in, nonce, ctx, 64); - in += 64; inlen -= 64; out += 64; - } - - if(inlen >= 32) { - speck_encrypt_xor(out, in, nonce, ctx, 32); - in += 32; inlen -= 32; out += 32; - } - - if(inlen >= 16) { - speck_encrypt_xor(block, in, nonce, ctx, 16); - ((u64 *)out)[0] = block64[0] ^ ((u64 *)in)[0]; - ((u64 *)out)[1] = block64[1] ^ ((u64 *)in)[1]; - in += 16; inlen -= 16; out += 16; - } - - if(inlen > 0) { - speck_encrypt_xor(block, in, nonce, ctx, 16); - for(i = 0; i < inlen; i++) - out[i] = block[i] ^ in[i]; - } - - return 0; -} - - -static int speck_expand_key (speck_context_t *ctx, const unsigned char *k, int keysize) { - - u64 K[4]; - size_t i; - - for(i = 0; i < (keysize >> 6); i++) - K[i] = ((u64 *)k)[i]; - - // 128 bit has only two keys A and B thus replacing both C and D with B then - if(keysize == 128) { - EK(K[0], K[1], K[1], K[1], ctx->rk, ctx->key); - } else { - EK(K[0], K[1], K[2], K[3], ctx->rk, ctx->key); - } - - ctx->keysize = keysize; - - return 0; -} - - -#elif defined (__SSE2__) // SSE support --------------------------------------------------------------------------- - - -#define LCS(x,r) (((x)<>(64-r))) -#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) - -#define XOR _mm_xor_si128 -#define AND _mm_and_si128 -#define ADD _mm_add_epi64 -#define SL _mm_slli_epi64 -#define SR _mm_srli_epi64 - -#define _q SET(0x1,0x0) -#define _two SET(0x2,0x2) - -#define SET _mm_set_epi64x -#define SET1(X,c) (X=SET(c,c)) -#define SET2(X,c) (X=SET(c,c), X=ADD(X,_q)) - -#define LOW _mm_unpacklo_epi64 -#define HIGH _mm_unpackhi_epi64 -#define LD(ip) _mm_loadu_si128((__m128i *)(ip)) -#define ST(ip,X) _mm_storeu_si128((__m128i *)(ip),X) -#define STORE(out,X,Y) (ST(out,LOW(Y,X)), ST(out+16,HIGH(Y,X))) -#define STORE_ALT(out,X,Y) (ST(out,LOW(X,Y)), ST(out+16,HIGH(X,Y))) -#define XOR_STORE(in,out,X,Y) (ST(out,XOR(LD(in),LOW(Y,X))), ST(out+16,XOR(LD(in+16),HIGH(Y,X)))) -#define XOR_STORE_ALT(in,out,X,Y) (ST(out,XOR(LD(in),LOW(X,Y))), ST(out+16,XOR(LD(in+16),HIGH(X,Y)))) - -#define ROL(X,r) (XOR(SL(X,r),SR(X,(64-r)))) -#define ROR(X,r) (XOR(SR(X,r),SL(X,(64-r)))) - -#if defined (__SSSE3__) // even SSSE3 ------------------------------- -#define SHFL _mm_shuffle_epi8 -#define R8 _mm_set_epi64x(0x080f0e0d0c0b0a09LL,0x0007060504030201LL) -#define L8 _mm_set_epi64x(0x0e0d0c0b0a09080fLL,0x0605040302010007LL) -#define ROL8(X) (SHFL(X,L8)) -#define ROR8(X) (SHFL(X,R8)) -#else // regular SSE2 ------------------------------------------------ -#define ROL8(X) (ROL(X,8)) -#define ROR8(X) (ROR(X,8)) -#endif // SSS3 vs. SSE2 ---------------------------------------------- - -#define R(X,Y,k) (X=XOR(ADD(ROR8(X),Y),k), Y=XOR(ROL(Y,3),X)) - -#define Rx2(X,Y,k) (R(X[0],Y[0],k)) -#define Rx4(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k)) -#define Rx6(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k), R(X[2],Y[2],k)) -#define Rx8(X,Y,k) (X[0]=ROR8(X[0]), X[0]=ADD(X[0],Y[0]), X[1]=ROR8(X[1]), X[1]=ADD(X[1],Y[1]), \ - X[2]=ROR8(X[2]), X[2]=ADD(X[2],Y[2]), X[3]=ROR8(X[3]), X[3]=ADD(X[3],Y[3]), \ - X[0]=XOR(X[0],k), X[1]=XOR(X[1],k), X[2]=XOR(X[2],k), X[3]=XOR(X[3],k), \ - Z[0]=Y[0], Z[1]=Y[1], Z[2]=Y[2], Z[3]=Y[3], \ - Z[0]=SL(Z[0],3), Y[0]=SR(Y[0],61), Z[1]=SL(Z[1],3), Y[1]=SR(Y[1],61), \ - Z[2]=SL(Z[2],3), Y[2]=SR(Y[2],61), Z[3]=SL(Z[3],3), Y[3]=SR(Y[3],61), \ - Y[0]=XOR(Y[0],Z[0]), Y[1]=XOR(Y[1],Z[1]), Y[2]=XOR(Y[2],Z[2]), Y[3]=XOR(Y[3],Z[3]), \ - Y[0]=XOR(X[0],Y[0]), Y[1]=XOR(X[1],Y[1]), Y[2]=XOR(X[2],Y[2]), Y[3]=XOR(X[3],Y[3])) - -#define Rx1(x,y,k) (x[0]=RCS(x[0],8), x[0]+=y[0], x[0]^=k, y[0]=LCS(y[0],3), y[0]^=x[0]) -#define Rx1b(x,y,k) (x=RCS(x,8), x+=y, x^=k, y=LCS(y,3), y^=x) - -#define Encrypt_128(X,Y,k,n) (Rx##n(X,Y,k[0]), Rx##n(X,Y,k[1]), Rx##n(X,Y,k[2]), Rx##n(X,Y,k[3]), Rx##n(X,Y,k[4]), Rx##n(X,Y,k[5]), Rx##n(X,Y,k[6]), Rx##n(X,Y,k[7]), \ - Rx##n(X,Y,k[8]), Rx##n(X,Y,k[9]), Rx##n(X,Y,k[10]), Rx##n(X,Y,k[11]), Rx##n(X,Y,k[12]), Rx##n(X,Y,k[13]), Rx##n(X,Y,k[14]), Rx##n(X,Y,k[15]), \ - Rx##n(X,Y,k[16]), Rx##n(X,Y,k[17]), Rx##n(X,Y,k[18]), Rx##n(X,Y,k[19]), Rx##n(X,Y,k[20]), Rx##n(X,Y,k[21]), Rx##n(X,Y,k[22]), Rx##n(X,Y,k[23]), \ - Rx##n(X,Y,k[24]), Rx##n(X,Y,k[25]), Rx##n(X,Y,k[26]), Rx##n(X,Y,k[27]), Rx##n(X,Y,k[28]), Rx##n(X,Y,k[29]), Rx##n(X,Y,k[30]), Rx##n(X,Y,k[31])) - -#define Encrypt_256(X,Y,k,n) (Encrypt_128(X,Y,k,n), \ - Rx##n(X,Y,k[32]), Rx##n(X,Y,k[33])) - -#define RK(X,Y,k,key,i) (SET1(k[i],Y), key[i]=Y, X=RCS(X,8), X+=Y, X^=i, Y=LCS(Y,3), Y^=X) - -#define EK(A,B,C,D,k,key) (RK(B,A,k,key,0), RK(C,A,k,key,1), RK(D,A,k,key,2), RK(B,A,k,key,3), RK(C,A,k,key,4), RK(D,A,k,key,5), RK(B,A,k,key,6), \ - RK(C,A,k,key,7), RK(D,A,k,key,8), RK(B,A,k,key,9), RK(C,A,k,key,10), RK(D,A,k,key,11), RK(B,A,k,key,12), RK(C,A,k,key,13), \ - RK(D,A,k,key,14), RK(B,A,k,key,15), RK(C,A,k,key,16), RK(D,A,k,key,17), RK(B,A,k,key,18), RK(C,A,k,key,19), RK(D,A,k,key,20), \ - RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \ - RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33)) - -#define Encrypt_Dispatcher(keysize) \ - u64 x[2], y[2]; \ - u128 X[4], Y[4], Z[4]; \ - \ - if(numbytes == 16) { \ - x[0] = nonce[1]; y[0] = nonce[0]; nonce[0]++; \ - Encrypt_##keysize(x, y, ctx.key, 1); \ - ((u64 *)out)[1] = x[0]; ((u64 *)out)[0] = y[0]; \ - return 0; \ - } \ - \ - SET1(X[0], nonce[1]); SET2(Y[0], nonce[0]); \ - \ - if(numbytes == 32) \ - Encrypt_##keysize(X, Y, ctx.rk, 2); \ - else { \ - X[1] = X[0]; Y[1] = ADD(Y[0], _two); \ - if(numbytes == 64) \ - Encrypt_##keysize(X, Y, ctx.rk, 4); \ - else { \ - X[2] = X[0]; Y[2] = ADD(Y[1], _two); \ - if(numbytes == 96) \ - Encrypt_##keysize(X, Y, ctx.rk, 6); \ - else { \ - X[3] = X[0]; Y[3] = ADD(Y[2], _two); \ - Encrypt_##keysize(X, Y, ctx.rk, 8); \ - } \ - } \ - } \ - \ - nonce[0] += (numbytes >> 4); \ - \ - XOR_STORE(in, out, X[0], Y[0]); \ - if(numbytes >= 64) \ - XOR_STORE(in + 32, out + 32, X[1], Y[1]); \ - if(numbytes >= 96) \ - XOR_STORE(in + 64, out + 64, X[2], Y[2]); \ - if(numbytes >= 128) \ - XOR_STORE(in + 96, out + 96, X[3], Y[3]); \ - \ - return 0 - - -// attention: ctx is provided by value as it is faster in this case, astonishingly -static int speck_encrypt_xor (unsigned char *out, const unsigned char *in, u64 nonce[], const speck_context_t ctx, int numbytes) { - - if(ctx.keysize == 256) { - Encrypt_Dispatcher(256); - } else { - Encrypt_Dispatcher(128); - } -} - - -// attention: ctx is provided by value as it is faster in this case, astonishingly -static int internal_speck_ctr (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, const speck_context_t ctx) { - - int i; - u64 nonce[2]; - unsigned char block[16]; - u64 * const block64 = (u64 *)block; - - if(!inlen) - return 0; - - nonce[0] = ((u64 *)n)[0]; - nonce[1] = ((u64 *)n)[1]; - - while(inlen >= 128) { - speck_encrypt_xor(out, in, nonce, ctx, 128); - in += 128; inlen -= 128; out += 128; - } - - if(inlen >= 96) { - speck_encrypt_xor(out, in, nonce, ctx, 96); - in += 96; inlen -= 96; out += 96; - } - - if(inlen >= 64) { - speck_encrypt_xor(out, in, nonce, ctx, 64); - in += 64; inlen -= 64; out += 64; - } - - if(inlen >= 32) { - speck_encrypt_xor(out, in, nonce, ctx, 32); - in += 32; inlen -= 32; out += 32; - } - - if(inlen >= 16) { - speck_encrypt_xor(block, in, nonce, ctx, 16); - ((u64 *)out)[0] = block64[0] ^ ((u64 *)in)[0]; - ((u64 *)out)[1] = block64[1] ^ ((u64 *)in)[1]; - in += 16; inlen -= 16; out += 16; - } - - if(inlen > 0) { - speck_encrypt_xor (block, in, nonce, ctx, 16); - for(i = 0; i < inlen; i++) - out[i] = block[i] ^ in[i]; - } - - return 0; -} - - -static int speck_expand_key (speck_context_t *ctx, const unsigned char *k, int keysize) { - - u64 K[4]; - size_t i; - - for(i = 0; i < (keysize >> 6 ); i++) - K[i] = ((u64 *)k)[i]; - - // 128 bit has only two keys A and B thus replacing both C and D with B then - if(keysize == 128) { - EK(K[0], K[1], K[1], K[1], ctx->rk, ctx->key); - } else { - EK(K[0], K[1], K[2], K[3], ctx->rk, ctx->key); - } - - ctx->keysize = keysize; - - return 0; -} - - -#elif defined (__ARM_NEON) && defined (SPECK_ARM_NEON) // NEON support --------------------------------------- - - -#define LCS(x,r) (((x)<>(64-r))) -#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) - -#define XOR veorq_u64 -#define AND vandq_u64 -#define ADD vaddq_u64 -#define SL vshlq_n_u64 -#define SR vshrq_n_u64 - -#define SET(a,b) vcombine_u64((uint64x1_t)(a),(uint64x1_t)(b)) -#define SET1(X,c) (X=SET(c,c)) -#define SET2(X,c) (SET1(X,c), X=ADD(X,SET(0x1ll,0x0ll)),c+=2) - -#define LOW(Z) vgetq_lane_u64(Z,0) -#define HIGH(Z) vgetq_lane_u64(Z,1) -#define STORE(ip,X,Y) (((u64 *)(ip))[0]=HIGH(Y), ((u64 *)(ip))[1]=HIGH(X), ((u64 *)(ip))[2]=LOW(Y), ((u64 *)(ip))[3]=LOW(X)) -#define XOR_STORE(in,out,X,Y) (Y=XOR(Y,SET(((u64 *)(in))[2],((u64 *)(in))[0])), X=XOR(X,SET(((u64 *)(in))[3],((u64 *)(in))[1])), STORE(out,X,Y)) - -#define ROR(X,r) vsriq_n_u64(SL(X,(64-r)),X,r) -#define ROL(X,r) ROR(X,(64-r)) - -#define tableR vcreate_u8(0x0007060504030201LL) -#define tableL vcreate_u8(0x0605040302010007LL) -#define ROR8(X) SET(vtbl1_u8((uint8x8_t)vget_low_u64(X),tableR), vtbl1_u8((uint8x8_t)vget_high_u64(X),tableR)) -#define ROL8(X) SET(vtbl1_u8((uint8x8_t)vget_low_u64(X),tableL), vtbl1_u8((uint8x8_t)vget_high_u64(X),tableL)) - -#define R(X,Y,k) (X=XOR(ADD(ROR8(X),Y),k), Y=XOR(ROL(Y,3),X)) - -#define Rx2(X,Y,k) (R(X[0],Y[0],k)) -#define Rx4(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k)) -#define Rx6(X,Y,k) (R(X[0],Y[0],k), R(X[1],Y[1],k), R(X[2],Y[2],k)) -#define Rx8(X,Y,k) (X[0]=ROR8(X[0]), X[0]=ADD(X[0],Y[0]), X[0]=XOR(X[0],k), X[1]=ROR8(X[1]), X[1]=ADD(X[1],Y[1]), X[1]=XOR(X[1],k), \ - X[2]=ROR8(X[2]), X[2]=ADD(X[2],Y[2]), X[2]=XOR(X[2],k), X[3]=ROR8(X[3]), X[3]=ADD(X[3],Y[3]), X[3]=XOR(X[3],k), \ - Z[0]=SL(Y[0],3), Z[1]=SL(Y[1],3), Z[2]=SL(Y[2],3), Z[3]=SL(Y[3],3), \ - Y[0]=SR(Y[0],61), Y[1]=SR(Y[1],61), Y[2]=SR(Y[2],61), Y[3]=SR(Y[3],61), \ - Y[0]=XOR(Y[0],Z[0]), Y[1]=XOR(Y[1],Z[1]), Y[2]=XOR(Y[2],Z[2]), Y[3]=XOR(Y[3],Z[3]), \ - Y[0]=XOR(X[0],Y[0]), Y[1]=XOR(X[1],Y[1]), Y[2]=XOR(X[2],Y[2]), Y[3]=XOR(X[3],Y[3])) - -#define Rx1(x,y,k) (x[0]=RCS(x[0],8), x[0]+=y[0], x[0]^=k, y[0]=LCS(y[0],3), y[0]^=x[0]) -#define Rx1b(x,y,k) (x=RCS(x,8), x+=y, x^=k, y=LCS(y,3), y^=x) - -#define Encrypt_128(X,Y,k,n) (Rx##n(X,Y,k[0]), Rx##n(X,Y,k[1]), Rx##n(X,Y,k[2]), Rx##n(X,Y,k[3]), Rx##n(X,Y,k[4]), Rx##n(X,Y,k[5]), Rx##n(X,Y,k[6]), Rx##n(X,Y,k[7]), \ - Rx##n(X,Y,k[8]), Rx##n(X,Y,k[9]), Rx##n(X,Y,k[10]), Rx##n(X,Y,k[11]), Rx##n(X,Y,k[12]), Rx##n(X,Y,k[13]), Rx##n(X,Y,k[14]), Rx##n(X,Y,k[15]), \ - Rx##n(X,Y,k[16]), Rx##n(X,Y,k[17]), Rx##n(X,Y,k[18]), Rx##n(X,Y,k[19]), Rx##n(X,Y,k[20]), Rx##n(X,Y,k[21]), Rx##n(X,Y,k[22]), Rx##n(X,Y,k[23]), \ - Rx##n(X,Y,k[24]), Rx##n(X,Y,k[25]), Rx##n(X,Y,k[26]), Rx##n(X,Y,k[27]), Rx##n(X,Y,k[28]), Rx##n(X,Y,k[29]), Rx##n(X,Y,k[30]), Rx##n(X,Y,k[31])) - -#define Encrypt_256(X,Y,k,n) (Encrypt_128(X,Y,k,n), \ - Rx##n(X,Y,k[32]), Rx##n(X,Y,k[33])) - -#define RK(X,Y,k,key,i) (SET1(k[i],Y), key[i]=Y, X=RCS(X,8), X+=Y, X^=i, Y=LCS(Y,3), Y^=X) - -#define EK(A,B,C,D,k,key) (RK(B,A,k,key,0), RK(C,A,k,key,1), RK(D,A,k,key,2), RK(B,A,k,key,3), RK(C,A,k,key,4), RK(D,A,k,key,5), RK(B,A,k,key,6), \ - RK(C,A,k,key,7), RK(D,A,k,key,8), RK(B,A,k,key,9), RK(C,A,k,key,10), RK(D,A,k,key,11), RK(B,A,k,key,12), RK(C,A,k,key,13), \ - RK(D,A,k,key,14), RK(B,A,k,key,15), RK(C,A,k,key,16), RK(D,A,k,key,17), RK(B,A,k,key,18), RK(C,A,k,key,19), RK(D,A,k,key,20), \ - RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \ - RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33)) - -#define Encrypt_Dispatcher(keysize) \ - u64 x[2], y[2]; \ - u128 X[4], Y[4], Z[4]; \ - \ - if(numbytes == 16) { \ - x[0] = nonce[1]; y[0]=nonce[0]; nonce[0]++; \ - Encrypt_##keysize(x, y, ctx->key, 1); \ - ((u64 *)out)[1] = x[0]; ((u64 *)out)[0] = y[0]; \ - return 0; \ - } \ - \ - SET1(X[0], nonce[1]); SET2(Y[0], nonce[0]); \ - \ - if(numbytes == 32) \ - Encrypt_##keysize(X, Y, ctx->rk, 2); \ - else { \ - X[1] = X[0]; SET2(Y[1], nonce[0]); \ - if(numbytes == 64) \ - Encrypt_##keysize(X, Y, ctx->rk, 4); \ - else { \ - X[2] = X[0]; SET2(Y[2], nonce[0]); \ - if(numbytes == 96) \ - Encrypt_##keysize(X, Y, ctx->rk, 6); \ - else { \ - X[3] = X[0]; SET2(Y[3], nonce[0]); \ - Encrypt_##keysize(X, Y, ctx->rk, 8); \ - } \ - } \ - } \ - \ - XOR_STORE(in, out, X[0], Y[0]); \ - if(numbytes >= 64) \ - XOR_STORE(in + 32, out + 32, X[1], Y[1]); \ - if(numbytes >= 96) \ - XOR_STORE(in + 64, out + 64, X[2], Y[2]); \ - if(numbytes >= 128) \ - XOR_STORE(in + 96, out + 96, X[3], Y[3]); \ - \ - return 0 - - -static int speck_encrypt_xor (unsigned char *out, const unsigned char *in, u64 nonce[], speck_context_t *ctx, int numbytes) { - - if(ctx->keysize == 256) { - Encrypt_Dispatcher(256); - } else { - Encrypt_Dispatcher(128); - } -} - - -static int internal_speck_ctr (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx) { - - int i; - u64 nonce[2]; - unsigned char block[16]; - u64 *const block64 = (u64 *)block; - - if(!inlen) - return 0; - - nonce[0] = ((u64 *)n)[0]; - nonce[1] = ((u64 *)n)[1]; - - while(inlen >= 128) { - speck_encrypt_xor(out, in, nonce, ctx, 128); - in += 128; inlen -= 128; out += 128; - } - - if(inlen >= 96) { - speck_encrypt_xor(out, in, nonce, ctx, 96); - in += 96; inlen -= 96; out += 96; - } - - if(inlen >= 64) { - speck_encrypt_xor(out, in, nonce, ctx, 64); - in += 64; inlen -= 64; out += 64; - } - - if(inlen >= 32) { - speck_encrypt_xor(out, in, nonce, ctx, 32); - in += 32; inlen -= 32; out += 32; - } - - if(inlen >= 16) { - speck_encrypt_xor(block, in, nonce, ctx, 16); - ((u64 *)out)[0] = block64[0] ^ ((u64 *)in)[0]; - ((u64 *)out)[1] = block64[1] ^ ((u64 *)in)[1]; - in += 16; inlen -= 16; out += 16; - } - - if(inlen > 0) { - speck_encrypt_xor(block, in, nonce, ctx, 16); - for(i = 0; i < inlen; i++) - out[i] = block[i] ^ in[i]; - } - - return 0; -} - - -static int speck_expand_key (speck_context_t *ctx, const unsigned char *k, int keysize) { - - u64 K[4]; - size_t i; - - for(i = 0; i < (keysize >> 6); i++) - K[i] = ((u64 *)k)[i]; - - // 128 bit has only two keys A and B thus replacing both C and D with B then - if(keysize == 128) { - EK(K[0], K[1], K[1], K[1], ctx->rk, ctx->key); - } else { - EK(K[0], K[1], K[2], K[3], ctx->rk, ctx->key); - } - - ctx->keysize = keysize; - - return 0; -} - - -#else // plain C ---------------------------------------------------------------------------------------- - - -#define ROR(x,r) (((x)>>(r))|((x)<<(64-(r)))) -#define ROL(x,r) (((x)<<(r))|((x)>>(64-(r)))) -#define R(x,y,k) (x=ROR(x,8), x+=y, x^=k, y=ROL(y,3), y^=x) - - -static int speck_encrypt (u64 *u, u64 *v, speck_context_t *ctx, int numrounds) { - - u64 i, x = *u, y = *v; - - for(i = 0; i < numrounds; i++) - R(x, y, ctx->key[i]); - *u = x; *v = y; - - return 0; -} - - -static int internal_speck_ctr (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx) { - - u64 i, nonce[2], x, y, t; - unsigned char *block = malloc(16); - int numrounds = (ctx->keysize == 256)?34:32; - - if(!inlen) { - free(block); - return 0; - } - nonce[0] = htole64( ((u64*)n)[0] ); - nonce[1] = htole64( ((u64*)n)[1] ); - - t=0; - while(inlen >= 16) { - x = nonce[1]; y = nonce[0]; nonce[0]++; - speck_encrypt(&x, &y, ctx, numrounds); - ((u64 *)out)[1+t] = htole64(x ^ ((u64 *)in)[1+t]); - ((u64 *)out)[0+t] = htole64(y ^ ((u64 *)in)[0+t]); - t += 2; - inlen -= 16; - } - - if(inlen > 0) { - x = nonce[1]; y = nonce[0]; - speck_encrypt(&x, &y, ctx, numrounds); - ((u64 *)block)[1] = htole64(x); ((u64 *)block)[0] = htole64(y); - for(i = 0; i < inlen; i++) - out[i + 8*t] = block[i] ^ in[i + 8*t]; - } - - free(block); - - return 0; -} - - -static int speck_expand_key (speck_context_t *ctx, const unsigned char *k, int keysize) { - - u64 K[4]; - u64 i; - - for(i = 0; i < (keysize >> 6); i++) - K[i] = htole64( ((u64 *)k)[i] ); - - for(i = 0; i < 33; i += 3) { - ctx->key[i ] = K[0]; - R(K[1], K[0], i ); - - if(keysize == 256) { - ctx->key[i+1] = K[0]; - R(K[2], K[0], i + 1); - ctx->key[i+2] = K[0]; - R(K[3], K[0], i + 2); - } else { - // counter the i += 3 to make the loop go one by one in this case - // we can afford the unused 31 and 32 - i -= 2; - } - } - ctx->key[33] = K[0]; - - ctx->keysize = keysize; - - return 1; -} - - -#endif // AVX, SSE, NEON, plain C ------------------------------------------------------------------------ - - -// this functions wraps the call to internal_speck_ctr functions which have slightly different -// signature -- ctx by value for SSE with SPECK_CTX_BYVAL defined in speck.h, by name otherwise -int speck_ctr (unsigned char *out, const unsigned char *in, unsigned long long inlen, - const unsigned char *n, speck_context_t *ctx) { - - return internal_speck_ctr(out, in, inlen, n, -#if defined (SPECK_CTX_BYVAL) - *ctx); -#else - ctx); -#endif -} - - -// create context loaded with round keys ready for use, key size either 128 or 256 (bits) -int speck_init (speck_context_t **ctx, const unsigned char *k, int keysize) { - -#if defined (SPECK_ALIGNED_CTX) - *ctx = (speck_context_t*)_mm_malloc(sizeof(speck_context_t), SPECK_ALIGNED_CTX); -#else - *ctx = (speck_context_t*)calloc(1, sizeof(speck_context_t)); -#endif - if(!(*ctx)) { - return -1; - } - - return speck_expand_key(*ctx, k, keysize); -} - - -int speck_deinit (speck_context_t *ctx) { - - if(ctx) { -#if defined (SPECK_ALIGNED_CTX) - _mm_free(ctx); -#else - free(ctx); -#endif - } - - return 0; -} - - -// ---------------------------------------------------------------------------------------------------------------- - - -// cipher SPECK -- 128 bit block size -- 128 bit key size -- ECB mode (decrypt only) -// follows endianess rules as used in official implementation guide and NOT as in original 2013 cipher presentation -// used for IV in header encryption (one block) and challenge encryption (user/password) -// for now: just plain C -- probably no need for AVX, SSE, NEON - - -#define ROTL64(x,r) (((x)<<(r))|((x)>>(64-(r)))) -#define ROTR64(x,r) (((x)>>(r))|((x)<<(64-(r)))) -#define DR128(x,y,k) (y^=x, y=ROTR64(y,3), x^=k, x-=y, x=ROTL64(x,8)) -#define ER128(x,y,k) (x=(ROTR64(x,8)+y)^k, y=ROTL64(y,3)^x) - -int speck_128_decrypt (unsigned char *inout, speck_context_t *ctx) { - - u64 x, y; - int i; - - x = le64toh( *(u64*)&inout[8] ); - y = le64toh( *(u64*)&inout[0] ); - - for(i = 31; i >= 0; i--) - DR128(x, y, ctx->key[i]); - - ((u64*)inout)[1] = htole64(x); - ((u64*)inout)[0] = htole64(y); - - return 0; -} - - -int speck_128_encrypt (unsigned char *inout, speck_context_t *ctx) { - - u64 x, y; - int i; - - x = le64toh( *(u64*)&inout[8] ); - y = le64toh( *(u64*)&inout[0] ); - - for(i = 0; i < 32; i++) - ER128(x, y, ctx->key[i]); - - ((u64*)inout)[1] = htole64(x); - ((u64*)inout)[0] = htole64(y); - - return 0; -} diff --git a/bundles/n2n_ntop_v3/src/supernode.c b/bundles/n2n_ntop_v3/src/supernode.c deleted file mode 100644 index 7266aab7..00000000 --- a/bundles/n2n_ntop_v3/src/supernode.c +++ /dev/null @@ -1,674 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -/* Supernode for n2n-2.x */ - -#include "n2n.h" -#include "header_encryption.h" - -#define HASH_FIND_COMMUNITY(head, name, out) HASH_FIND_STR(head, name, out) - -static n2n_sn_t sss_node; - -void close_tcp_connection (n2n_sn_t *sss, n2n_tcp_connection_t *conn); -void calculate_shared_secrets (n2n_sn_t *sss); -int load_allowed_sn_community (n2n_sn_t *sss); -int resolve_create_thread (n2n_resolve_parameter_t **param, struct peer_info *sn_list); - - -/** Help message to print if the command line arguments are not valid. */ -static void help (int level) { - - if(level == 0) /* no help required */ - return; - - printf("\n"); - print_n2n_version(); - - if(level == 1) /* short help */ { - - printf(" basic usage: supernode (see supernode.conf)\n" - "\n" - " or supernode " - "[optional parameters, at least one] " - "\n " - "\n technically, all parameters are optional, but the supernode executable" - "\n requires at least one parameter to run, .e.g. -v or -f, as otherwise this" - "\n short help text is displayed" - "\n\n -h shows a quick reference including all available options" - "\n --help gives a detailed parameter description" - "\n man files for n2n, edge, and superndode contain in-depth information" - "\n\n"); - - } else if(level == 2) /* quick reference */ { - - printf(" general usage: supernode (see supernode.conf)\n" - "\n" - " or supernode " - "[-p ] " - "\n " - "[-F ] " - "\n options for under- " - "[-l ] " - "\n lying connection " -#ifdef SN_MANUAL_MAC - "[-m ] " -#endif - "[-M] " - "[-V ] " - "\n\n overlay network " - "[-c ] " - "\n configuration " - "[-a -/] " - "\n\n local options " -#if defined(N2N_HAVE_DAEMON) - "[-f] " -#endif - "[-t ] " - "\n " - "[--management-password ] " - "[-v] " -#ifndef WIN32 - "\n " - "[-u ]" - "[-g ]" -#endif - "\n\n meaning of the " - "[-M] disable MAC and IP address spoofing protection" - "\n flag options " -#if defined(N2N_HAVE_DAEMON) - "[-f] do not fork but run in foreground" - "\n " -#endif - "[-v] make more verbose, repeat as required" - "\n " - "\n technically, all parameters are optional, but the supernode executable" - "\n requires at least one parameter to run, .e.g. -v or -f, as otherwise a" - "\n short help text is displayed" - "\n\n -h shows this quick reference including all available options" - "\n --help gives a detailed parameter description" - "\n man files for n2n, edge, and superndode contain in-depth information" - "\n\n"); - - } else /* long help */ { - - printf(" general usage: supernode (see supernode.conf)\n" - "\n" - " or supernode [optional parameters, at least one]\n\n" - ); - printf (" OPTIONS FOR THE UNDERLYING NETWORK CONNECTION\n"); - printf (" ---------------------------------------------\n\n"); - printf(" -p | fixed local UDP port, defaults to %u\n", N2N_SN_LPORT_DEFAULT); - printf(" -F | name of the supernode's federation, defaults to\n" - " | '%s'\n", (char *)FEDERATION_NAME); - printf(" -l | ip address or name, and port of known supernode\n"); -#ifdef SN_MANUAL_MAC - printf(" -m | fixed MAC address for the supernode, e.g.\n" - " | '-m 10:20:30:40:50:60', random otherwise\n"); -#endif - printf(" -M | disable MAC and IP address spoofing protection for all\n" - " | non-username-password-authenticating communities\n"); - printf(" -V | sends a custom supernode version string of max 19 letters \n" - " | length to edges, visible in their management port output\n"); - printf ("\n"); - printf (" TAP DEVICE AND OVERLAY NETWORK CONFIGURATION\n"); - printf (" --------------------------------------------\n\n"); - printf(" -c | file containing the allowed communities\n"); - printf(" -a | subnet range for auto ip address service, e.g.\n" - " | '-a 192.168.0.0-192.168.255.0/24', defaults\n" - " | to '10.128.255.0-10.255.255.0/24'\n"); - printf ("\n"); - printf (" LOCAL OPTIONS\n"); - printf (" -------------\n\n"); -#if defined(N2N_HAVE_DAEMON) - printf(" -f | do not fork and run as a daemon, rather run in foreground\n"); -#endif - printf(" -t | management UDP port, for multiple supernodes on a machine,\n" - " | defaults to %u\n", N2N_SN_MGMT_PORT); - printf(" --management_... | management port password, defaults to '%s'\n" - " ...password | \n", N2N_MGMT_PASSWORD); - printf(" -v | make more verbose, repeat as required\n"); -#ifndef WIN32 - printf(" -u | numeric user ID to use when privileges are dropped\n"); - printf(" -g | numeric group ID to use when privileges are dropped\n"); -#endif - printf("\n technically, all parameters are optional, but the supernode executable" - "\n requires at least one parameter to run, .e.g. -v or -f, as otherwise a" - "\n short help text is displayed" - "\n\n -h shows a quick reference including all available options" - "\n --help gives this detailed parameter description" - "\n man files for n2n, edge, and superndode contain in-depth information" - "\n\n"); - } - - exit(0); -} - - -/* *************************************************** */ - -static int setOption (int optkey, char *_optarg, n2n_sn_t *sss) { - - //traceEvent(TRACE_NORMAL, "Option %c = %s", optkey, _optarg ? _optarg : ""); - - switch(optkey) { - case 'p': /* local-port */ - sss->lport = atoi(_optarg); - - if(sss->lport == 0) - traceEvent(TRACE_WARNING, "bad local port format, defaulting to %u", N2N_SN_LPORT_DEFAULT); - // default is made sure in sn_init() - - break; - - case 't': /* mgmt-port */ - sss->mport = atoi(_optarg); - - if(sss->mport == 0) - traceEvent(TRACE_WARNING, "bad management port format, defaulting to %u", N2N_SN_MGMT_PORT); - // default is made sure in sn_init() - - break; - - case 'l': { /* supernode:port */ - n2n_sock_t *socket; - struct peer_info *anchor_sn; - size_t length; - int rv = -1; - int skip_add; - char *double_column = strchr(_optarg, ':'); - - length = strlen(_optarg); - if(length >= N2N_EDGE_SN_HOST_SIZE) { - traceEvent(TRACE_WARNING, "size of -l argument too long: %zu; maximum size is %d", length, N2N_EDGE_SN_HOST_SIZE); - return 1; - } - - if(!double_column) { - traceEvent(TRACE_WARNING, "invalid -l format, missing port"); - return 1; - } - - socket = (n2n_sock_t *)calloc(1, sizeof(n2n_sock_t)); - rv = supernode2sock(socket, _optarg); - - if(rv < -2) { /* we accept resolver failure as it might resolve later */ - traceEvent(TRACE_WARNING, "invalid supernode parameter"); - free(socket); - return 1; - } - - if(sss->federation != NULL) { - skip_add = SN_ADD; - anchor_sn = add_sn_to_list_by_mac_or_sock(&(sss->federation->edges), socket, null_mac, &skip_add); - - if(anchor_sn != NULL) { - anchor_sn->ip_addr = calloc(1, N2N_EDGE_SN_HOST_SIZE); - if(anchor_sn->ip_addr) { - strncpy(anchor_sn->ip_addr, _optarg, N2N_EDGE_SN_HOST_SIZE - 1); - memcpy(&(anchor_sn->sock), socket, sizeof(n2n_sock_t)); - memcpy(anchor_sn->mac_addr, null_mac, sizeof(n2n_mac_t)); - anchor_sn->purgeable = SN_UNPURGEABLE; - anchor_sn->last_valid_time_stamp = initial_time_stamp(); - } - } - } - - free(socket); - break; - } - - case 'a': { - dec_ip_str_t ip_min_str = {'\0'}; - dec_ip_str_t ip_max_str = {'\0'}; - in_addr_t net_min, net_max; - uint8_t bitlen; - uint32_t mask; - - if(sscanf(_optarg, "%15[^\\-]-%15[^/]/%hhu", ip_min_str, ip_max_str, &bitlen) != 3) { - traceEvent(TRACE_WARNING, "bad net-net/bit format '%s'.", _optarg); - return 2; - } - - net_min = inet_addr(ip_min_str); - net_max = inet_addr(ip_max_str); - mask = bitlen2mask(bitlen); - if((net_min == (in_addr_t)(-1)) || (net_min == INADDR_NONE) || (net_min == INADDR_ANY) - || (net_max == (in_addr_t)(-1)) || (net_max == INADDR_NONE) || (net_max == INADDR_ANY) - || (ntohl(net_min) > ntohl(net_max)) - || ((ntohl(net_min) & ~mask) != 0) || ((ntohl(net_max) & ~mask) != 0)) { - traceEvent(TRACE_WARNING, "bad network range '%s...%s/%u' in '%s', defaulting to '%s...%s/%d'", - ip_min_str, ip_max_str, bitlen, _optarg, - N2N_SN_MIN_AUTO_IP_NET_DEFAULT, N2N_SN_MAX_AUTO_IP_NET_DEFAULT, N2N_SN_AUTO_IP_NET_BIT_DEFAULT); - return 2; - } - - if((bitlen > 30) || (bitlen == 0)) { - traceEvent(TRACE_WARNING, "bad prefix '%hhu' in '%s', defaulting to '%s...%s/%d'", - bitlen, _optarg, - N2N_SN_MIN_AUTO_IP_NET_DEFAULT, N2N_SN_MAX_AUTO_IP_NET_DEFAULT, N2N_SN_AUTO_IP_NET_BIT_DEFAULT); - return 2; - } - - traceEvent(TRACE_NORMAL, "the network range for community ip address service is '%s...%s/%hhu'", ip_min_str, ip_max_str, bitlen); - - sss->min_auto_ip_net.net_addr = ntohl(net_min); - sss->min_auto_ip_net.net_bitlen = bitlen; - sss->max_auto_ip_net.net_addr = ntohl(net_max); - sss->max_auto_ip_net.net_bitlen = bitlen; - - break; - } -#ifndef WIN32 - case 'u': /* unprivileged uid */ - sss->userid = atoi(_optarg); - break; - - case 'g': /* unprivileged uid */ - sss->groupid = atoi(_optarg); - break; -#endif - case 'F': { /* federation name */ - snprintf(sss->federation->community, N2N_COMMUNITY_SIZE - 1 ,"*%s", _optarg); - sss->federation->community[N2N_COMMUNITY_SIZE - 1] = '\0'; - break; - } -#ifdef SN_MANUAL_MAC - case 'm': {/* MAC address */ - str2mac(sss->mac_addr,_optarg); - break; - } -#endif - case 'M': /* override spoofing protection */ - sss->override_spoofing_protection = 1; - break; - - case 'V': /* version text */ - strncpy(sss->version, _optarg, sizeof(n2n_version_t)); - sss->version[sizeof(n2n_version_t) - 1] = '\0'; - break; - case 'c': /* community file */ - sss->community_file = calloc(1, strlen(_optarg) + 1); - if(sss->community_file) - strcpy(sss->community_file, _optarg); - break; - - case ']': /* password for management port */ { - sss->mgmt_password_hash = pearson_hash_64((uint8_t*)_optarg, strlen(_optarg)); - - break; - } -#if defined(N2N_HAVE_DAEMON) - case 'f': /* foreground */ - sss->daemon = 0; - break; -#endif - case 'h': /* quick reference */ - return 2; - - case '@': /* long help */ - return 3; - - case 'v': /* verbose */ - setTraceLevel(getTraceLevel() + 1); - break; - - default: - traceEvent(TRACE_WARNING, "unknown option -%c:", (char) optkey); - return 2; - } - - return 0; -} - - -/* *********************************************** */ - -static const struct option long_options[] = { - {"communities", required_argument, NULL, 'c'}, -#if defined(N2N_HAVE_DAEMON) - {"foreground", no_argument, NULL, 'f'}, -#endif - {"local-port", required_argument, NULL, 'p'}, - {"mgmt-port", required_argument, NULL, 't'}, - {"autoip", required_argument, NULL, 'a'}, - {"verbose", no_argument, NULL, 'v'}, - {"help", no_argument, NULL, '@'}, /* special character '@' to identify long help case */ - {"management-password", required_argument, NULL, ']' }, /* ']' management port password */ - {NULL, 0, NULL, 0} -}; - -/* *************************************************** */ - -/* read command line options */ -static int loadFromCLI (int argc, char * const argv[], n2n_sn_t *sss) { - - u_char c; - - while((c = getopt_long(argc, argv, - "p:l:t:a:c:F:vhMV:" -#ifdef SN_MANUAL_MAC - "m:" -#endif -#if defined(N2N_HAVE_DAEMON) - "f" -#endif -#ifndef WIN32 - "u:g:" -#endif - , - long_options, NULL)) != '?') { - if(c == 255) { - break; - } - help(setOption(c, optarg, sss)); - } - - return 0; -} - -/* *************************************************** */ - -static char *trim (char *s) { - - char *end; - - while(isspace(s[0]) || (s[0] == '"') || (s[0] == '\'')) { - s++; - } - - if(s[0] == 0) { - return s; - } - - end = &s[strlen(s) - 1]; - while(end > s && (isspace(end[0])|| (end[0] == '"') || (end[0] == '\''))) { - end--; - } - end[1] = 0; - - return s; -} - -/* *************************************************** */ - -/* parse the configuration file */ -static int loadFromFile (const char *path, n2n_sn_t *sss) { - - char buffer[4096], *line; - char *line_vec[3]; - int tmp; - - FILE *fd; - - fd = fopen(path, "r"); - - if(fd == NULL) { - traceEvent(TRACE_WARNING, "config file %s not found", path); - return -1; - } - - // we mess around with optind, better save it - tmp = optind; - - while((line = fgets(buffer, sizeof(buffer), fd)) != NULL) { - line = trim(line); - - if(strlen(line) < 2 || line[0] == '#') { - continue; - } - - // executable, cannot be omitted, content can be anything - line_vec[0] = line; - // first token, e.g. `-p`, eventually followed by a whitespace or '=' delimiter - line_vec[1] = strtok(line, "\t ="); - // separate parameter option, if present - line_vec[2] = strtok(NULL, "\t "); - - // not to duplicate the option parser code, call loadFromCLI and pretend we have no option read yet - optind = 0; - // if separate second token present (optional argument, not part of first), then announce 3 vector members - loadFromCLI(line_vec[2] ? 3 : 2, line_vec, sss); - } - - fclose(fd); - optind = tmp; - - return 0; -} - -/* *************************************************** */ - -/* Add the federation to the communities list of a supernode */ -static int add_federation_to_communities (n2n_sn_t *sss) { - - uint32_t num_communities = 0; - - if(sss->federation != NULL) { - HASH_ADD_STR(sss->communities, community, sss->federation); - - num_communities = HASH_COUNT(sss->communities); - - traceEvent(TRACE_INFO, "added federation '%s' to the list of communities [total: %u]", - (char*)sss->federation->community, num_communities); - } - - return 0; -} - -/* *************************************************** */ - -#ifdef __linux__ -static void dump_registrations (int signo) { - - struct sn_community *comm, *ctmp; - struct peer_info *list, *tmp; - char buf[32]; - time_t now = time(NULL); - u_int num = 0; - - traceEvent(TRACE_NORMAL, "===================================="); - - HASH_ITER(hh, sss_node.communities, comm, ctmp) { - traceEvent(TRACE_NORMAL, "dumping community: %s", comm->community); - - HASH_ITER(hh, comm->edges, list, tmp) { - if(list->sock.family == AF_INET) { - traceEvent(TRACE_NORMAL, "[id: %u][MAC: %s][edge: %u.%u.%u.%u:%u][last seen: %u sec ago]", - ++num, macaddr_str(buf, list->mac_addr), - list->sock.addr.v4[0], list->sock.addr.v4[1], list->sock.addr.v4[2], list->sock.addr.v4[3], - list->sock.port, - now - list->last_seen); - } else { - traceEvent(TRACE_NORMAL, "[id: %u][MAC: %s][edge: IPv6:%u][last seen: %u sec ago]", - ++num, macaddr_str(buf, list->mac_addr), list->sock.port, - now - list->last_seen); - } - } - } - - traceEvent(TRACE_NORMAL, "===================================="); -} -#endif - -/* *************************************************** */ - -static int keep_running; - -#if defined(__linux__) || defined(WIN32) -#ifdef WIN32 -BOOL WINAPI term_handler (DWORD sig) -#else - static void term_handler(int sig) -#endif -{ - static int called = 0; - - if(called) { - traceEvent(TRACE_NORMAL, "ok, I am leaving now"); - _exit(0); - } else { - traceEvent(TRACE_NORMAL, "shutting down..."); - called = 1; - } - - keep_running = 0; -#ifdef WIN32 - return(TRUE); -#endif -} -#endif /* defined(__linux__) || defined(WIN32) */ - -/* *************************************************** */ - -/** Main program entry point from kernel. */ -int main (int argc, char * const argv[]) { - - int rc; -#ifndef WIN32 - struct passwd *pw = NULL; -#endif - struct peer_info *scan, *tmp; - - - sn_init_defaults(&sss_node); - add_federation_to_communities(&sss_node); - - if((argc >= 2) && (argv[1][0] != '-')) { - rc = loadFromFile(argv[1], &sss_node); - if(argc > 2) { - rc = loadFromCLI(argc, argv, &sss_node); - } - } else if(argc > 1) { - rc = loadFromCLI(argc, argv, &sss_node); - } else - -#ifdef WIN32 - // load from current directory - rc = loadFromFile("supernode.conf", &sss_node); -#else - rc = -1; -#endif - - if(rc < 0) { - help(1); /* short help */ - } - - if(sss_node.community_file) - load_allowed_sn_community(&sss_node); - -#if defined(N2N_HAVE_DAEMON) - if(sss_node.daemon) { - setUseSyslog(1); /* traceEvent output now goes to syslog. */ - - if(-1 == daemon(0, 0)) { - traceEvent(TRACE_ERROR, "failed to become daemon"); - exit(-5); - } - } -#endif /* #if defined(N2N_HAVE_DAEMON) */ - - // warn on default federation name - if(!strcmp(sss_node.federation->community, FEDERATION_NAME)) { - traceEvent(TRACE_WARNING, "using default federation name; FOR TESTING ONLY, usage of a custom federation name (-F) is highly recommended!"); - } - - if(sss_node.override_spoofing_protection) { - traceEvent(TRACE_WARNING, "disabled MAC and IP address spoofing protection; FOR TESTING ONLY, usage of user-password authentication (-I, -J, -P) recommended instead!"); - } - - calculate_shared_secrets(&sss_node); - - traceEvent(TRACE_DEBUG, "traceLevel is %d", getTraceLevel()); - - sss_node.sock = open_socket(sss_node.lport, INADDR_ANY, 0 /* UDP */); - if(-1 == sss_node.sock) { - traceEvent(TRACE_ERROR, "failed to open main socket. %s", strerror(errno)); - exit(-2); - } else { - traceEvent(TRACE_NORMAL, "supernode is listening on UDP %u (main)", sss_node.lport); - } - -#ifdef N2N_HAVE_TCP - sss_node.tcp_sock = open_socket(sss_node.lport, INADDR_ANY, 1 /* TCP */); - if(-1 == sss_node.tcp_sock) { - traceEvent(TRACE_ERROR, "failed to open auxiliary TCP socket, %s", strerror(errno)); - exit(-2); - } else { - traceEvent(TRACE_NORMAL, "supernode opened TCP %u (aux)", sss_node.lport); - } - - if(-1 == listen(sss_node.tcp_sock, N2N_TCP_BACKLOG_QUEUE_SIZE)) { - traceEvent(TRACE_ERROR, "failed to listen on auxiliary TCP socket, %s", strerror(errno)); - exit(-2); - } else { - traceEvent(TRACE_NORMAL, "supernode is listening on TCP %u (aux)", sss_node.lport); - } -#endif - - sss_node.mgmt_sock = open_socket(sss_node.mport, INADDR_LOOPBACK, 0 /* UDP */); - if(-1 == sss_node.mgmt_sock) { - traceEvent(TRACE_ERROR, "failed to open management socket, %s", strerror(errno)); - exit(-2); - } else { - traceEvent(TRACE_NORMAL, "supernode is listening on UDP %u (management)", sss_node.mport); - } - - HASH_ITER(hh, sss_node.federation->edges, scan, tmp) - scan->socket_fd = sss_node.sock; - -#ifndef WIN32 - if(((pw = getpwnam ("n2n")) != NULL) || ((pw = getpwnam ("nobody")) != NULL)) { - sss_node.userid = sss_node.userid == 0 ? pw->pw_uid : 0; - sss_node.groupid = sss_node.groupid == 0 ? pw->pw_gid : 0; - } - if((sss_node.userid != 0) || (sss_node.groupid != 0)) { - traceEvent(TRACE_NORMAL, "dropping privileges to uid=%d, gid=%d", - (signed int)sss_node.userid, (signed int)sss_node.groupid); - - /* Finished with the need for root privileges. Drop to unprivileged user. */ - if((setgid(sss_node.groupid) != 0) - || (setuid(sss_node.userid) != 0)) { - traceEvent(TRACE_ERROR, "unable to drop privileges [%u/%s]", errno, strerror(errno)); - exit(1); - } - } - - if((getuid() == 0) || (getgid() == 0)) { - traceEvent(TRACE_WARNING, "running as root is discouraged, check out the -u/-g options"); - } -#endif - - sn_init(&sss_node); - - traceEvent(TRACE_NORMAL, "supernode started"); - -#ifdef __linux__ - signal(SIGPIPE, SIG_IGN); - signal(SIGTERM, term_handler); - signal(SIGINT, term_handler); - signal(SIGHUP, dump_registrations); -#endif -#ifdef WIN32 - SetConsoleCtrlHandler(term_handler, TRUE); -#endif - - keep_running = 1; - sss_node.keep_running = &keep_running; - return run_sn_loop(&sss_node); -} diff --git a/bundles/n2n_ntop_v3/src/tf.c b/bundles/n2n_ntop_v3/src/tf.c deleted file mode 100644 index 418ba4e8..00000000 --- a/bundles/n2n_ntop_v3/src/tf.c +++ /dev/null @@ -1,619 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -// taken (and modified) from github/fudanchii/twofish as of August 2020 -// which itself is a modified copy of Andrew T. Csillag's implementation -// published on github/drewcsillag/twofish - - -/** - * The MIT License (MIT) - * - * Copyright (c) 2015 Andrew T. Csillag - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - -#include "tf.h" - - -const uint8_t RS[4][8] = { { 0x01, 0xA4, 0x55, 0x87, 0x5A, 0x58, 0xDB, 0x9E, }, - { 0xA4, 0x56, 0x82, 0xF3, 0x1E, 0xC6, 0x68, 0xE5, }, - { 0x02, 0xA1, 0xFC, 0xC1, 0x47, 0xAE, 0x3D, 0x19, }, - { 0xA4, 0x55, 0x87, 0x5A, 0x58, 0xDB, 0x9E, 0x03 } }; - -const uint8_t Q0[] = { 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78, 0xE4, 0xDD, 0xD1, 0x38, - 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, - 0xF2, 0xD0, 0x8B, 0x30, 0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, - 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE, 0x16, 0x0C, 0xE3, 0x61, - 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, - 0xE1, 0xE6, 0xBD, 0x45, 0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, - 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF, 0x33, 0xC9, 0x62, 0x71, - 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, - 0xA1, 0x1D, 0xAA, 0xED, 0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, - 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B, 0x5F, 0x93, 0x0A, 0xEF, - 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, - 0x2A, 0xCE, 0xCB, 0x2F, 0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, - 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17, 0x55, 0x1F, 0x8A, 0x7D, - 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, - 0x6E, 0x50, 0xDE, 0x68, 0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, - 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42, 0x4A, 0x5E, 0xC1, 0xE0 }; - -const uint8_t Q1[] = { 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B, 0x45, 0x7D, 0xE8, 0x4B, - 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, - 0x5E, 0xBA, 0xAE, 0x5B, 0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, - 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54, 0x92, 0x74, 0x36, 0x51, - 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, - 0x13, 0x95, 0x9C, 0xC7, 0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, - 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF, 0x40, 0xE7, 0x2B, 0xE2, - 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, - 0x66, 0x94, 0xA1, 0x1D, 0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, - 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21, 0xC4, 0x1A, 0xEB, 0xD9, - 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, - 0x4F, 0xF2, 0x65, 0x8E, 0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, - 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44, 0xE0, 0x4D, 0x43, 0x69, - 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, - 0x22, 0xC9, 0xC0, 0x9B, 0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, - 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56, 0x55, 0x09, 0xBE, 0x91 }; - -const uint8_t mult5B[] = { 0x00, 0x5B, 0xB6, 0xED, 0x05, 0x5E, 0xB3, 0xE8, 0x0A, 0x51, 0xBC, 0xE7, 0x0F, 0x54, 0xB9, 0xE2, - 0x14, 0x4F, 0xA2, 0xF9, 0x11, 0x4A, 0xA7, 0xFC, 0x1E, 0x45, 0xA8, 0xF3, 0x1B, 0x40, 0xAD, 0xF6, - 0x28, 0x73, 0x9E, 0xC5, 0x2D, 0x76, 0x9B, 0xC0, 0x22, 0x79, 0x94, 0xCF, 0x27, 0x7C, 0x91, 0xCA, - 0x3C, 0x67, 0x8A, 0xD1, 0x39, 0x62, 0x8F, 0xD4, 0x36, 0x6D, 0x80, 0xDB, 0x33, 0x68, 0x85, 0xDE, - 0x50, 0x0B, 0xE6, 0xBD, 0x55, 0x0E, 0xE3, 0xB8, 0x5A, 0x01, 0xEC, 0xB7, 0x5F, 0x04, 0xE9, 0xB2, - 0x44, 0x1F, 0xF2, 0xA9, 0x41, 0x1A, 0xF7, 0xAC, 0x4E, 0x15, 0xF8, 0xA3, 0x4B, 0x10, 0xFD, 0xA6, - 0x78, 0x23, 0xCE, 0x95, 0x7D, 0x26, 0xCB, 0x90, 0x72, 0x29, 0xC4, 0x9F, 0x77, 0x2C, 0xC1, 0x9A, - 0x6C, 0x37, 0xDA, 0x81, 0x69, 0x32, 0xDF, 0x84, 0x66, 0x3D, 0xD0, 0x8B, 0x63, 0x38, 0xD5, 0x8E, - 0xA0, 0xFB, 0x16, 0x4D, 0xA5, 0xFE, 0x13, 0x48, 0xAA, 0xF1, 0x1C, 0x47, 0xAF, 0xF4, 0x19, 0x42, - 0xB4, 0xEF, 0x02, 0x59, 0xB1, 0xEA, 0x07, 0x5C, 0xBE, 0xE5, 0x08, 0x53, 0xBB, 0xE0, 0x0D, 0x56, - 0x88, 0xD3, 0x3E, 0x65, 0x8D, 0xD6, 0x3B, 0x60, 0x82, 0xD9, 0x34, 0x6F, 0x87, 0xDC, 0x31, 0x6A, - 0x9C, 0xC7, 0x2A, 0x71, 0x99, 0xC2, 0x2F, 0x74, 0x96, 0xCD, 0x20, 0x7B, 0x93, 0xC8, 0x25, 0x7E, - 0xF0, 0xAB, 0x46, 0x1D, 0xF5, 0xAE, 0x43, 0x18, 0xFA, 0xA1, 0x4C, 0x17, 0xFF, 0xA4, 0x49, 0x12, - 0xE4, 0xBF, 0x52, 0x09, 0xE1, 0xBA, 0x57, 0x0C, 0xEE, 0xB5, 0x58, 0x03, 0xEB, 0xB0, 0x5D, 0x06, - 0xD8, 0x83, 0x6E, 0x35, 0xDD, 0x86, 0x6B, 0x30, 0xD2, 0x89, 0x64, 0x3F, 0xD7, 0x8C, 0x61, 0x3A, - 0xCC, 0x97, 0x7A, 0x21, 0xC9, 0x92, 0x7F, 0x24, 0xC6, 0x9D, 0x70, 0x2B, 0xC3, 0x98, 0x75, 0x2E }; - -const uint8_t multEF[] = { 0x00, 0xEF, 0xB7, 0x58, 0x07, 0xE8, 0xB0, 0x5F, 0x0E, 0xE1, 0xB9, 0x56, 0x09, 0xE6, 0xBE, 0x51, - 0x1C, 0xF3, 0xAB, 0x44, 0x1B, 0xF4, 0xAC, 0x43, 0x12, 0xFD, 0xA5, 0x4A, 0x15, 0xFA, 0xA2, 0x4D, - 0x38, 0xD7, 0x8F, 0x60, 0x3F, 0xD0, 0x88, 0x67, 0x36, 0xD9, 0x81, 0x6E, 0x31, 0xDE, 0x86, 0x69, - 0x24, 0xCB, 0x93, 0x7C, 0x23, 0xCC, 0x94, 0x7B, 0x2A, 0xC5, 0x9D, 0x72, 0x2D, 0xC2, 0x9A, 0x75, - 0x70, 0x9F, 0xC7, 0x28, 0x77, 0x98, 0xC0, 0x2F, 0x7E, 0x91, 0xC9, 0x26, 0x79, 0x96, 0xCE, 0x21, - 0x6C, 0x83, 0xDB, 0x34, 0x6B, 0x84, 0xDC, 0x33, 0x62, 0x8D, 0xD5, 0x3A, 0x65, 0x8A, 0xD2, 0x3D, - 0x48, 0xA7, 0xFF, 0x10, 0x4F, 0xA0, 0xF8, 0x17, 0x46, 0xA9, 0xF1, 0x1E, 0x41, 0xAE, 0xF6, 0x19, - 0x54, 0xBB, 0xE3, 0x0C, 0x53, 0xBC, 0xE4, 0x0B, 0x5A, 0xB5, 0xED, 0x02, 0x5D, 0xB2, 0xEA, 0x05, - 0xE0, 0x0F, 0x57, 0xB8, 0xE7, 0x08, 0x50, 0xBF, 0xEE, 0x01, 0x59, 0xB6, 0xE9, 0x06, 0x5E, 0xB1, - 0xFC, 0x13, 0x4B, 0xA4, 0xFB, 0x14, 0x4C, 0xA3, 0xF2, 0x1D, 0x45, 0xAA, 0xF5, 0x1A, 0x42, 0xAD, - 0xD8, 0x37, 0x6F, 0x80, 0xDF, 0x30, 0x68, 0x87, 0xD6, 0x39, 0x61, 0x8E, 0xD1, 0x3E, 0x66, 0x89, - 0xC4, 0x2B, 0x73, 0x9C, 0xC3, 0x2C, 0x74, 0x9B, 0xCA, 0x25, 0x7D, 0x92, 0xCD, 0x22, 0x7A, 0x95, - 0x90, 0x7F, 0x27, 0xC8, 0x97, 0x78, 0x20, 0xCF, 0x9E, 0x71, 0x29, 0xC6, 0x99, 0x76, 0x2E, 0xC1, - 0x8C, 0x63, 0x3B, 0xD4, 0x8B, 0x64, 0x3C, 0xD3, 0x82, 0x6D, 0x35, 0xDA, 0x85, 0x6A, 0x32, 0xDD, - 0xA8, 0x47, 0x1F, 0xF0, 0xAF, 0x40, 0x18, 0xF7, 0xA6, 0x49, 0x11, 0xFE, 0xA1, 0x4E, 0x16, 0xF9, - 0xB4, 0x5B, 0x03, 0xEC, 0xB3, 0x5C, 0x04, 0xEB, 0xBA, 0x55, 0x0D, 0xE2, 0xBD, 0x52, 0x0A, 0xE5 }; - - -#define RS_MOD 0x14D -#define RHO 0x01010101L - -#define ROL(x,n) (((x) << ((n) & 0x1F)) | ((x) >> (32-((n) & 0x1F)))) -#define ROR(x,n) (((x) >> ((n) & 0x1F)) | ((x) << (32-((n) & 0x1F)))) - -#define _b(x, N) (((x) >> (N*8)) & 0xFF) - -#define b0(x) ((uint8_t)(x)) -#define b1(x) ((uint8_t)((x) >> 8)) -#define b2(x) ((uint8_t)((x) >> 16)) -#define b3(x) ((uint8_t)((x) >> 24)) - -#define U8ARRAY_TO_U32(r) ((r[0] << 24) ^ (r[1] << 16) ^ (r[2] << 8) ^ r[3]) -#define U8S_TO_U32(r0, r1, r2, r3) ((r0 << 24) ^ (r1 << 16) ^ (r2 << 8) ^ r3) - - -// multiply two polynomials represented as u32's, actually called with bytes -uint32_t polyMult(uint32_t a, uint32_t b) { - - uint32_t t=0; - - while(a) { - if(a & 1) - t^=b; - b <<= 1; - a >>= 1; - } - - return t; -} - - -// take the polynomial t and return the t % modulus in GF(256) -uint32_t gfMod(uint32_t t, uint32_t modulus) { - - int i; - uint32_t tt; - - modulus <<= 7; - for(i = 0; i < 8; i++) { - tt = t ^ modulus; - if(tt < t) - t = tt; - modulus >>= 1; - } - - return t; -} - - -// multiply a and b and return the modulus -#define gfMult(a, b, modulus) gfMod(polyMult(a, b), modulus) - - -// return a u32 containing the result of multiplying the RS Code matrix by the sd matrix -uint32_t RSMatrixMultiply(uint8_t sd[8]) { - - int j, k; - uint8_t t; - uint8_t result[4]; - - for(j = 0; j < 4; j++) { - t = 0; - for(k = 0; k < 8; k++) { - t ^= gfMult(RS[j][k], sd[k], RS_MOD); - } - result[3-j] = t; - } - - return U8ARRAY_TO_U32(result); -} - - -// the Zero-keyed h function (used by the key setup routine) -uint32_t h(uint32_t X, uint32_t L[4], int k) { - - uint8_t y0, y1, y2, y3; - uint8_t z0, z1, z2, z3; - - y0 = b0(X); - y1 = b1(X); - y2 = b2(X); - y3 = b3(X); - - switch(k) { - case 4: - y0 = Q1[y0] ^ b0(L[3]); - y1 = Q0[y1] ^ b1(L[3]); - y2 = Q0[y2] ^ b2(L[3]); - y3 = Q1[y3] ^ b3(L[3]); - case 3: - y0 = Q1[y0] ^ b0(L[2]); - y1 = Q1[y1] ^ b1(L[2]); - y2 = Q0[y2] ^ b2(L[2]); - y3 = Q0[y3] ^ b3(L[2]); - case 2: - y0 = Q1[ Q0 [ Q0[y0] ^ b0(L[1]) ] ^ b0(L[0]) ]; - y1 = Q0[ Q0 [ Q1[y1] ^ b1(L[1]) ] ^ b1(L[0]) ]; - y2 = Q1[ Q1 [ Q0[y2] ^ b2(L[1]) ] ^ b2(L[0]) ]; - y3 = Q0[ Q1 [ Q1[y3] ^ b3(L[1]) ] ^ b3(L[0]) ]; - } - - // inline the MDS matrix multiply - z0 = multEF[y0] ^ y1 ^ multEF[y2] ^ mult5B[y3]; - z1 = multEF[y0] ^ mult5B[y1] ^ y2 ^ multEF[y3]; - z2 = mult5B[y0] ^ multEF[y1] ^ multEF[y2] ^ y3; - z3 = y0 ^ multEF[y1] ^ mult5B[y2] ^ mult5B[y3]; - - return U8S_TO_U32(z0, z1, z2, z3); -} - - -// given the Sbox keys, create the fully keyed QF -void fullKey(uint32_t L[4], int k, uint32_t QF[4][256]) { - - uint8_t y0, y1, y2, y3; - int i; - - // for all input values to the Q permutations - for(i = 0; i < 256; i++) { - // run the Q permutations - y0 = i; y1 = i; y2 = i; y3 = i; - switch(k) { - case 4: - y0 = Q1[y0] ^ b0(L[3]); - y1 = Q0[y1] ^ b1(L[3]); - y2 = Q0[y2] ^ b2(L[3]); - y3 = Q1[y3] ^ b3(L[3]); - case 3: - y0 = Q1[y0] ^ b0(L[2]); - y1 = Q1[y1] ^ b1(L[2]); - y2 = Q0[y2] ^ b2(L[2]); - y3 = Q0[y3] ^ b3(L[2]); - case 2: - y0 = Q1[ Q0 [ Q0[y0] ^ b0(L[1]) ] ^ b0(L[0]) ]; - y1 = Q0[ Q0 [ Q1[y1] ^ b1(L[1]) ] ^ b1(L[0]) ]; - y2 = Q1[ Q1 [ Q0[y2] ^ b2(L[1]) ] ^ b2(L[0]) ]; - y3 = Q0[ Q1 [ Q1[y3] ^ b3(L[1]) ] ^ b3(L[0]) ]; - } - - // now do the partial MDS matrix multiplies - QF[0][i] = ((multEF[y0] << 24) - | (multEF[y0] << 16) - | (mult5B[y0] << 8) - | y0); - QF[1][i] = ((y1 << 24) - | (mult5B[y1] << 16) - | (multEF[y1] << 8) - | multEF[y1]); - QF[2][i] = ((multEF[y2] << 24) - | (y2 << 16) - | (multEF[y2] << 8) - | mult5B[y2]); - QF[3][i] = ((mult5B[y3] << 24) - | (multEF[y3] << 16) - | (y3 << 8) - | mult5B[y3]); - } -} - -// ---------------------------------------------------------------------------------------------------------------- - - -// fully keyed h (aka g) function -#define fkh(X) (ctx->QF[0][b0(X)]^ctx->QF[1][b1(X)]^ctx->QF[2][b2(X)]^ctx->QF[3][b3(X)]) - - -// ---------------------------------------------------------------------------------------------------------------- - - -// one encryption round -#define ENC_ROUND(R0, R1, R2, R3, round) \ - T0 = fkh(R0); \ - T1 = fkh(ROL(R1, 8)); \ - R2 = ROR(R2 ^ (T1 + T0 + ctx->K[2*round+8]), 1); \ - R3 = ROL(R3, 1) ^ (2*T1 + T0 + ctx->K[2*round+9]); - - -void twofish_internal_encrypt(uint8_t PT[16], tf_context_t *ctx) { - - uint32_t R0, R1, R2, R3; - uint32_t T0, T1; - - // load/byteswap/whiten input - R3 = ctx->K[3] ^ le32toh(((uint32_t*)PT)[3]); - R2 = ctx->K[2] ^ le32toh(((uint32_t*)PT)[2]); - R1 = ctx->K[1] ^ le32toh(((uint32_t*)PT)[1]); - R0 = ctx->K[0] ^ le32toh(((uint32_t*)PT)[0]); - - ENC_ROUND(R0, R1, R2, R3, 0); - ENC_ROUND(R2, R3, R0, R1, 1); - ENC_ROUND(R0, R1, R2, R3, 2); - ENC_ROUND(R2, R3, R0, R1, 3); - ENC_ROUND(R0, R1, R2, R3, 4); - ENC_ROUND(R2, R3, R0, R1, 5); - ENC_ROUND(R0, R1, R2, R3, 6); - ENC_ROUND(R2, R3, R0, R1, 7); - ENC_ROUND(R0, R1, R2, R3, 8); - ENC_ROUND(R2, R3, R0, R1, 9); - ENC_ROUND(R0, R1, R2, R3, 10); - ENC_ROUND(R2, R3, R0, R1, 11); - ENC_ROUND(R0, R1, R2, R3, 12); - ENC_ROUND(R2, R3, R0, R1, 13); - ENC_ROUND(R0, R1, R2, R3, 14); - ENC_ROUND(R2, R3, R0, R1, 15); - - // whiten/byteswap/store output - ((uint32_t*)PT)[3] = htole32(R1 ^ ctx->K[7]); - ((uint32_t*)PT)[2] = htole32(R0 ^ ctx->K[6]); - ((uint32_t*)PT)[1] = htole32(R3 ^ ctx->K[5]); - ((uint32_t*)PT)[0] = htole32(R2 ^ ctx->K[4]); -} - - -// ---------------------------------------------------------------------------------------------------------------- - - -// one decryption round -#define DEC_ROUND(R0, R1, R2, R3, round) \ - T0 = fkh(R0); \ - T1 = fkh(ROL(R1, 8)); \ - R2 = ROL(R2, 1) ^ (T0 + T1 + ctx->K[2*round+8]); \ - R3 = ROR(R3 ^ (T0 + 2*T1 + ctx->K[2*round+9]), 1); - - -void twofish_internal_decrypt(uint8_t PT[16], const uint8_t CT[16], tf_context_t *ctx) { - - uint32_t T0, T1; - uint32_t R0, R1, R2, R3; - - // load/byteswap/whiten input - R3 = ctx->K[7] ^ le32toh(((uint32_t*)CT)[3]); - R2 = ctx->K[6] ^ le32toh(((uint32_t*)CT)[2]); - R1 = ctx->K[5] ^ le32toh(((uint32_t*)CT)[1]); - R0 = ctx->K[4] ^ le32toh(((uint32_t*)CT)[0]); - - DEC_ROUND(R0, R1, R2, R3, 15); - DEC_ROUND(R2, R3, R0, R1, 14); - DEC_ROUND(R0, R1, R2, R3, 13); - DEC_ROUND(R2, R3, R0, R1, 12); - DEC_ROUND(R0, R1, R2, R3, 11); - DEC_ROUND(R2, R3, R0, R1, 10); - DEC_ROUND(R0, R1, R2, R3, 9); - DEC_ROUND(R2, R3, R0, R1, 8); - DEC_ROUND(R0, R1, R2, R3, 7); - DEC_ROUND(R2, R3, R0, R1, 6); - DEC_ROUND(R0, R1, R2, R3, 5); - DEC_ROUND(R2, R3, R0, R1, 4); - DEC_ROUND(R0, R1, R2, R3, 3); - DEC_ROUND(R2, R3, R0, R1, 2); - DEC_ROUND(R0, R1, R2, R3, 1); - DEC_ROUND(R2, R3, R0, R1, 0); - - // whiten/byteswap/store output - ((uint32_t*)PT)[3] = htole32(R1 ^ ctx->K[3]); - ((uint32_t*)PT)[2] = htole32(R0 ^ ctx->K[2]); - ((uint32_t*)PT)[1] = htole32(R3 ^ ctx->K[1]); - ((uint32_t*)PT)[0] = htole32(R2 ^ ctx->K[0]); -} - - -// ------------------------------------------------------------------------------------- - - -// the key schedule routine -void keySched(const uint8_t M[], int N, uint32_t **S, uint32_t K[40], int *k) { - - uint32_t Mo[4], Me[4]; - int i, j; - uint8_t vector[8]; - uint32_t A, B; - - *k = (N + 63) / 64; - *S = (uint32_t*)malloc(sizeof(uint32_t) * (*k)); - - for(i = 0; i < *k; i++) { - Me[i] = le32toh(((uint32_t*)M)[2*i]); - Mo[i] = le32toh(((uint32_t*)M)[2*i+1]); - } - - for(i = 0; i < *k; i++) { - for(j = 0; j < 4; j++) - vector[j] = _b(Me[i], j); - for(j = 0; j < 4; j++) - vector[j+4] = _b(Mo[i], j); - (*S)[(*k)-i-1] = RSMatrixMultiply(vector); - } - - for(i = 0; i < 20; i++) { - A = h(2*i*RHO, Me, *k); - B = ROL(h(2*i*RHO + RHO, Mo, *k), 8); - K[2*i] = A+B; - K[2*i+1] = ROL(A + 2*B, 9); - } -} - - -// ---------------------------------------------------------------------------------------------------------------- - - -#define fix_xor(target, source) *(uint32_t*)&(target)[0] = *(uint32_t*)&(target)[0] ^ *(uint32_t*)&(source)[0]; *(uint32_t*)&(target)[4] = *(uint32_t*)&(target)[4] ^ *(uint32_t*)&(source)[4]; \ - *(uint32_t*)&(target)[8] = *(uint32_t*)&(target)[8] ^ *(uint32_t*)&(source)[8]; *(uint32_t*)&(target)[12] = *(uint32_t*)&(target)[12] ^ *(uint32_t*)&(source)[12]; - -// ---------------------------------------------------------------------------------------------------------------- - - -// public API - - -int tf_ecb_decrypt (unsigned char *out, const unsigned char *in, tf_context_t *ctx) { - - twofish_internal_decrypt(out, in, ctx); - - return TF_BLOCK_SIZE; -} - - -// not used -int tf_ecb_encrypt (unsigned char *out, const unsigned char *in, tf_context_t *ctx) { - - memcpy(out, in, TF_BLOCK_SIZE); - twofish_internal_encrypt(out, ctx); - - return TF_BLOCK_SIZE; -} - - -int tf_cbc_encrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, tf_context_t *ctx) { - - uint8_t tmp[TF_BLOCK_SIZE]; - size_t i; - size_t n; - - memcpy(tmp, iv, TF_BLOCK_SIZE); - - n = in_len / TF_BLOCK_SIZE; - for(i = 0; i < n; i++) { - fix_xor(tmp, &in[i * TF_BLOCK_SIZE]); - twofish_internal_encrypt(tmp, ctx); - memcpy(&out[i * TF_BLOCK_SIZE], tmp, TF_BLOCK_SIZE); - } - - return n * TF_BLOCK_SIZE; -} - - -int tf_cbc_decrypt (unsigned char *out, const unsigned char *in, size_t in_len, - const unsigned char *iv, tf_context_t *ctx) { - - int n; /* number of blocks */ - /* int ret = (int)in_len & 15; remainder, unused*/ - - uint8_t ivec[TF_BLOCK_SIZE]; /* the ivec/old handling might be optimized if we */ - uint8_t old[TF_BLOCK_SIZE]; /* can be sure that in != out */ - - memcpy(ivec, iv, TF_BLOCK_SIZE); - - // 3 parallel rails of twofish decryption - for(n = in_len / TF_BLOCK_SIZE; n > 2; n -=3) { - memcpy(old, in + 2 * TF_BLOCK_SIZE, TF_BLOCK_SIZE); - - uint32_t T0, T1; - uint32_t Q0, Q1, Q2, Q3, R0, R1, R2, R3, S0, S1, S2, S3; - - // load/byteswap/whiten input/iv - Q3 = ctx->K[7] ^ le32toh(((uint32_t*)in)[3]); - Q2 = ctx->K[6] ^ le32toh(((uint32_t*)in)[2]); - Q1 = ctx->K[5] ^ le32toh(((uint32_t*)in)[1]); - Q0 = ctx->K[4] ^ le32toh(((uint32_t*)in)[0]); - - R3 = ctx->K[7] ^ le32toh(((uint32_t*)in)[7]); - R2 = ctx->K[6] ^ le32toh(((uint32_t*)in)[6]); - R1 = ctx->K[5] ^ le32toh(((uint32_t*)in)[5]); - R0 = ctx->K[4] ^ le32toh(((uint32_t*)in)[4]); - - S3 = ctx->K[7] ^ le32toh(((uint32_t*)in)[11]); - S2 = ctx->K[6] ^ le32toh(((uint32_t*)in)[10]); - S1 = ctx->K[5] ^ le32toh(((uint32_t*)in)[9]); - S0 = ctx->K[4] ^ le32toh(((uint32_t*)in)[8]); - - DEC_ROUND(Q0, Q1, Q2, Q3, 15); DEC_ROUND(R0, R1, R2, R3, 15); DEC_ROUND(S0, S1, S2, S3, 15); - DEC_ROUND(Q2, Q3, Q0, Q1, 14); DEC_ROUND(R2, R3, R0, R1, 14); DEC_ROUND(S2, S3, S0, S1, 14); - DEC_ROUND(Q0, Q1, Q2, Q3, 13); DEC_ROUND(R0, R1, R2, R3, 13); DEC_ROUND(S0, S1, S2, S3, 13); - DEC_ROUND(Q2, Q3, Q0, Q1, 12); DEC_ROUND(R2, R3, R0, R1, 12); DEC_ROUND(S2, S3, S0, S1, 12); - DEC_ROUND(Q0, Q1, Q2, Q3, 11); DEC_ROUND(R0, R1, R2, R3, 11); DEC_ROUND(S0, S1, S2, S3, 11); - DEC_ROUND(Q2, Q3, Q0, Q1, 10); DEC_ROUND(R2, R3, R0, R1, 10); DEC_ROUND(S2, S3, S0, S1, 10); - DEC_ROUND(Q0, Q1, Q2, Q3, 9); DEC_ROUND(R0, R1, R2, R3, 9); DEC_ROUND(S0, S1, S2, S3, 9); - DEC_ROUND(Q2, Q3, Q0, Q1, 8); DEC_ROUND(R2, R3, R0, R1, 8); DEC_ROUND(S2, S3, S0, S1, 8); - DEC_ROUND(Q0, Q1, Q2, Q3, 7); DEC_ROUND(R0, R1, R2, R3, 7); DEC_ROUND(S0, S1, S2, S3, 7); - DEC_ROUND(Q2, Q3, Q0, Q1, 6); DEC_ROUND(R2, R3, R0, R1, 6); DEC_ROUND(S2, S3, S0, S1, 6); - DEC_ROUND(Q0, Q1, Q2, Q3, 5); DEC_ROUND(R0, R1, R2, R3, 5); DEC_ROUND(S0, S1, S2, S3, 5); - DEC_ROUND(Q2, Q3, Q0, Q1, 4); DEC_ROUND(R2, R3, R0, R1, 4); DEC_ROUND(S2, S3, S0, S1, 4); - DEC_ROUND(Q0, Q1, Q2, Q3, 3); DEC_ROUND(R0, R1, R2, R3, 3); DEC_ROUND(S0, S1, S2, S3, 3); - DEC_ROUND(Q2, Q3, Q0, Q1, 2); DEC_ROUND(R2, R3, R0, R1, 2); DEC_ROUND(S2, S3, S0, S1, 2); - DEC_ROUND(Q0, Q1, Q2, Q3, 1); DEC_ROUND(R0, R1, R2, R3, 1); DEC_ROUND(S0, S1, S2, S3, 1); - DEC_ROUND(Q2, Q3, Q0, Q1, 0); DEC_ROUND(R2, R3, R0, R1, 0); DEC_ROUND(S2, S3, S0, S1, 0); - - // whiten/byteswap/store output/iv - ((uint32_t*)out)[11] = htole32(S1 ^ ctx->K[3] ^ ((uint32_t*)in)[7]); - ((uint32_t*)out)[10] = htole32(S0 ^ ctx->K[2] ^ ((uint32_t*)in)[6]); - ((uint32_t*)out)[9] = htole32(S3 ^ ctx->K[1] ^ ((uint32_t*)in)[5]); - ((uint32_t*)out)[8] = htole32(S2 ^ ctx->K[0] ^ ((uint32_t*)in)[4]); - - ((uint32_t*)out)[7] = htole32(R1 ^ ctx->K[3] ^ ((uint32_t*)in)[3]); - ((uint32_t*)out)[6] = htole32(R0 ^ ctx->K[2] ^ ((uint32_t*)in)[2]); - ((uint32_t*)out)[5] = htole32(R3 ^ ctx->K[1] ^ ((uint32_t*)in)[1]); - ((uint32_t*)out)[4] = htole32(R2 ^ ctx->K[0] ^ ((uint32_t*)in)[0]); - - ((uint32_t*)out)[3] = htole32(Q1 ^ ctx->K[3] ^ ((uint32_t*)ivec)[3]); - ((uint32_t*)out)[2] = htole32(Q0 ^ ctx->K[2] ^ ((uint32_t*)ivec)[2]); - ((uint32_t*)out)[1] = htole32(Q3 ^ ctx->K[1] ^ ((uint32_t*)ivec)[1]); - ((uint32_t*)out)[0] = htole32(Q2 ^ ctx->K[0] ^ ((uint32_t*)ivec)[0]); - - in += 3 * TF_BLOCK_SIZE; out += 3 * TF_BLOCK_SIZE; - - memcpy(ivec, old, TF_BLOCK_SIZE); - } - - // handle the two or less remaining block on a single rail - for(; n != 0; n--) { - uint32_t T0, T1; - uint32_t Q0, Q1, Q2, Q3; - - memcpy(old, in, TF_BLOCK_SIZE); - - // load/byteswap/whiten input - Q3 = ctx->K[7] ^ le32toh(((uint32_t*)in)[3]); - Q2 = ctx->K[6] ^ le32toh(((uint32_t*)in)[2]); - Q1 = ctx->K[5] ^ le32toh(((uint32_t*)in)[1]); - Q0 = ctx->K[4] ^ le32toh(((uint32_t*)in)[0]); - - DEC_ROUND(Q0, Q1, Q2, Q3, 15); - DEC_ROUND(Q2, Q3, Q0, Q1, 14); - DEC_ROUND(Q0, Q1, Q2, Q3, 13); - DEC_ROUND(Q2, Q3, Q0, Q1, 12); - DEC_ROUND(Q0, Q1, Q2, Q3, 11); - DEC_ROUND(Q2, Q3, Q0, Q1, 10); - DEC_ROUND(Q0, Q1, Q2, Q3, 9); - DEC_ROUND(Q2, Q3, Q0, Q1, 8); - DEC_ROUND(Q0, Q1, Q2, Q3, 7); - DEC_ROUND(Q2, Q3, Q0, Q1, 6); - DEC_ROUND(Q0, Q1, Q2, Q3, 5); - DEC_ROUND(Q2, Q3, Q0, Q1, 4); - DEC_ROUND(Q0, Q1, Q2, Q3, 3); - DEC_ROUND(Q2, Q3, Q0, Q1, 2); - DEC_ROUND(Q0, Q1, Q2, Q3, 1); - DEC_ROUND(Q2, Q3, Q0, Q1, 0); - - // load/byteswap/whiten output/iv - ((uint32_t*)out)[3] = htole32(Q1 ^ ctx->K[3] ^ ((uint32_t*)ivec)[3]); - ((uint32_t*)out)[2] = htole32(Q0 ^ ctx->K[2] ^ ((uint32_t*)ivec)[2]); - ((uint32_t*)out)[1] = htole32(Q3 ^ ctx->K[1] ^ ((uint32_t*)ivec)[1]); - ((uint32_t*)out)[0] = htole32(Q2 ^ ctx->K[0] ^ ((uint32_t*)ivec)[0]); - - in += TF_BLOCK_SIZE; out+= TF_BLOCK_SIZE; - - memcpy(ivec, old, TF_BLOCK_SIZE); - } - - return n * TF_BLOCK_SIZE; -} - - -// by definition twofish can only accept key up to 256 bit -// we wont do any checking here and will assume user already -// know about it. twofish is undefined for key larger than 256 bit -int tf_init (const unsigned char *key, size_t key_size, tf_context_t **ctx) { - - int k; - uint32_t *S; - - *ctx = calloc(1, sizeof(tf_context_t)); - if(!(*ctx)) { - return -1; - } - - (*ctx)->N = key_size; - keySched(key, key_size, &S, (*ctx)->K, &k); - fullKey(S, k, (*ctx)->QF); - free(S); /* allocated in keySched(...) */ - - return 0; -} - - -int tf_deinit (tf_context_t *ctx) { - - if(ctx) free(ctx); - - return 0; -} diff --git a/bundles/n2n_ntop_v3/src/transform_aes.c b/bundles/n2n_ntop_v3/src/transform_aes.c deleted file mode 100644 index 9a7406ac..00000000 --- a/bundles/n2n_ntop_v3/src/transform_aes.c +++ /dev/null @@ -1,246 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -// size of random value prepended to plaintext defaults to AES BLOCK_SIZE; -// gradually abandoning security, lower values could be chosen; -// however, minimum transmission size with cipher text stealing scheme is one -// block; as network packets should be longer anyway, only low level programmer -// might encounter an issue with lower values here -#define AES_PREAMBLE_SIZE (AES_BLOCK_SIZE) - - -// cts/cbc mode is being used with random value prepended to plaintext -// instead of iv so, actual iv is aes_null_iv -const uint8_t aes_null_iv[AES_IV_SIZE] = { 0 }; - -typedef struct transop_aes { - aes_context_t *ctx; -} transop_aes_t; - - -static int transop_deinit_aes (n2n_trans_op_t *arg) { - - transop_aes_t *priv = (transop_aes_t *)arg->priv; - - if(priv->ctx) - aes_deinit(priv->ctx); - - if(priv) - free(priv); - - return 0; -} - - -// the aes packet format consists of -// -// - a random AES_PREAMBLE_SIZE-sized value prepended to plaintext -// encrypted together with the... -// - ... payload data -// -// [VV|DDDDDDDDDDDDDDDDDDDDD] -// | <---- encrypted ----> | -// -static int transop_encode_aes (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - transop_aes_t *priv = (transop_aes_t *)arg->priv; - - // the assembly buffer is a source for encrypting data - // the whole contents of assembly are encrypted - uint8_t assembly[N2N_PKT_BUF_SIZE]; - size_t idx = 0; - int padded_len; - uint8_t padding; - uint8_t buf[AES_BLOCK_SIZE]; - - if(in_len <= N2N_PKT_BUF_SIZE) { - if((in_len + AES_PREAMBLE_SIZE + AES_BLOCK_SIZE) <= out_len) { - traceEvent(TRACE_DEBUG, "transop_encode_aes %lu bytes plaintext", in_len); - - // full block sized random value (128 bit) - encode_uint64(assembly, &idx, n2n_rand()); - encode_uint64(assembly, &idx, n2n_rand()); - - // adjust for maybe differently chosen AES_PREAMBLE_SIZE - idx = AES_PREAMBLE_SIZE; - - // the plaintext data - encode_buf(assembly, &idx, inbuf, in_len); - - // round up to next whole AES block size - padded_len = (((idx - 1) / AES_BLOCK_SIZE) + 1) * AES_BLOCK_SIZE; - padding = (padded_len-idx); - - // pad the following bytes with zero, fixed length (AES_BLOCK_SIZE) seems to compile - // to slightly faster code than run-time dependant 'padding' - memset(assembly + idx, 0, AES_BLOCK_SIZE); - - aes_cbc_encrypt(outbuf, assembly, padded_len, aes_null_iv, priv->ctx); - - if(padding) { - // exchange last two cipher blocks - memcpy(buf, outbuf+padded_len - AES_BLOCK_SIZE, AES_BLOCK_SIZE); - memcpy(outbuf + padded_len - AES_BLOCK_SIZE, outbuf + padded_len - 2 * AES_BLOCK_SIZE, AES_BLOCK_SIZE); - memcpy(outbuf + padded_len - 2 * AES_BLOCK_SIZE, buf, AES_BLOCK_SIZE); - } - } else - traceEvent(TRACE_ERROR, "transop_encode_aes outbuf too small"); - } else - traceEvent(TRACE_ERROR, "transop_encode_aes inbuf too big to encrypt"); - - return idx; -} - - -// see transop_encode_aes for packet format -static int transop_decode_aes (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - transop_aes_t *priv = (transop_aes_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - uint8_t rest; - size_t penultimate_block; - uint8_t buf[AES_BLOCK_SIZE]; - int len = -1; - - if(((in_len - AES_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE) /* cipher text fits in assembly */ - && (in_len >= AES_PREAMBLE_SIZE) /* has at least random number */ - && (in_len >= AES_BLOCK_SIZE)) { /* minimum size requirement for cipher text stealing */ - traceEvent(TRACE_DEBUG, "transop_decode_aes %lu bytes ciphertext", in_len); - - rest = in_len % AES_BLOCK_SIZE; - if(rest) { /* cipher text stealing */ - penultimate_block = ((in_len / AES_BLOCK_SIZE) - 1) * AES_BLOCK_SIZE; - - // everything normal up to penultimate block - memcpy(assembly, inbuf, penultimate_block); - - // prepare new penultimate block in buf - aes_ecb_decrypt(buf, inbuf + penultimate_block, priv->ctx); - memcpy(buf, inbuf + in_len - rest, rest); - - // former penultimate block becomes new ultimate block - memcpy(assembly + penultimate_block + AES_BLOCK_SIZE, inbuf + penultimate_block, AES_BLOCK_SIZE); - - // write new penultimate block from buf - memcpy(assembly + penultimate_block, buf, AES_BLOCK_SIZE); - - // regular cbc decryption of the re-arranged ciphertext - aes_cbc_decrypt(assembly, assembly, in_len + AES_BLOCK_SIZE - rest, aes_null_iv, priv->ctx); - - // check for expected zero padding and give a warning otherwise - if(memcmp(assembly + in_len, aes_null_iv, AES_BLOCK_SIZE - rest)) { - traceEvent(TRACE_WARNING, "transop_decode_aes payload decryption failed with unexpected cipher text stealing padding"); - return -1; - } - } else { - // regular cbc decryption on multiple block-sized payload - aes_cbc_decrypt(assembly, inbuf, in_len, aes_null_iv, priv->ctx); - } - len = in_len - AES_PREAMBLE_SIZE; - memcpy(outbuf, assembly + AES_PREAMBLE_SIZE, len); - } else - traceEvent(TRACE_ERROR, "transop_decode_aes inbuf wrong size (%ul) to decrypt", in_len); - - return len; -} - - -static int setup_aes_key (transop_aes_t *priv, const uint8_t *password, ssize_t password_len) { - - unsigned char key_mat[32]; /* maximum aes key length, equals hash length */ - unsigned char *key; - size_t key_size; - - // let the user choose the degree of encryption: - // long input passwords will pick AES192 or AES256 with more robust but expensive encryption - - // the input password always gets hashed to make a more unpredictable use of the key space - // just think of usually reset MSB of ASCII coded password bytes - pearson_hash_256(key_mat, password, password_len); - - // the length-dependant scheme for key setup was discussed on github: - // https://github.com/ntop/n2n/issues/101 -- as no iv encryption required - // anymore, the key-size trigger values were roughly halved - if(password_len >= 33) { - key_size = AES256_KEY_BYTES; /* 256 bit */ - } else if(password_len >= 23) { - key_size = AES192_KEY_BYTES; /* 192 bit */ - } else { - key_size = AES128_KEY_BYTES; /* 128 bit */ - } - - // and use the last key-sized part of the hash as aes key - key = key_mat + sizeof(key_mat) - key_size; - - // setup the key and have corresponding context created - if(aes_init (key, key_size, &(priv->ctx))) { - traceEvent(TRACE_ERROR, "setup_aes_key %u-bit key setup unsuccessful", key_size * 8); - return -1; - } - traceEvent(TRACE_DEBUG, "setup_aes_key %u-bit key setup completed", key_size * 8); - - return 0; -} - - -static void transop_tick_aes (n2n_trans_op_t *arg, time_t now) { - - // no tick action -} - - -// AES initialization function -int n2n_transop_aes_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - - transop_aes_t *priv; - const u_char *encrypt_key = (const u_char *)conf->encrypt_key; - size_t encrypt_key_len = strlen(conf->encrypt_key); - - memset(ttt, 0, sizeof(*ttt)); - ttt->transform_id = N2N_TRANSFORM_ID_AES; - - ttt->tick = transop_tick_aes; - ttt->deinit = transop_deinit_aes; - ttt->fwd = transop_encode_aes; - ttt->rev = transop_decode_aes; - - priv = (transop_aes_t*)calloc(1, sizeof(transop_aes_t)); - if(!priv) { - traceEvent(TRACE_ERROR, "n2n_transop_aes_init cannot allocate transop_aes_t memory"); - return -1; - } - ttt->priv = priv; - - // setup the cipher and key - return setup_aes_key(priv, encrypt_key, encrypt_key_len); -} diff --git a/bundles/n2n_ntop_v3/src/transform_cc20.c b/bundles/n2n_ntop_v3/src/transform_cc20.c deleted file mode 100644 index fd8d3722..00000000 --- a/bundles/n2n_ntop_v3/src/transform_cc20.c +++ /dev/null @@ -1,170 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -// ChaCha20 plaintext preamble -#define CC20_PREAMBLE_SIZE (CC20_IV_SIZE) - - -typedef struct transop_cc20 { - cc20_context_t *ctx; -} transop_cc20_t; - - -static int transop_deinit_cc20 (n2n_trans_op_t *arg) { - - transop_cc20_t *priv = (transop_cc20_t *)arg->priv; - - if(priv->ctx) - cc20_deinit(priv->ctx); - - if(priv) - free(priv); - - return 0; -} - - -// the ChaCha20 packet format consists of -// -// - a 128-bit random iv -// - encrypted payload -// -// [IIII|DDDDDDDDDDDDDDDDDDDDD] -// |<---- encrypted ---->| -// -static int transop_encode_cc20 (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - int len = -1; - transop_cc20_t *priv = (transop_cc20_t *)arg->priv; - - if(in_len <= N2N_PKT_BUF_SIZE) { - if((in_len + CC20_PREAMBLE_SIZE) <= out_len) { - size_t idx = 0; - - traceEvent(TRACE_DEBUG, "encode_cc20 %lu bytes", in_len); - - // full iv sized random value (128 bit) - encode_uint64(outbuf, &idx, n2n_rand()); - encode_uint64(outbuf, &idx, n2n_rand()); - - len = in_len; - cc20_crypt(outbuf + CC20_PREAMBLE_SIZE, - inbuf, - in_len, - outbuf, /* iv */ - priv->ctx); - - // size of datacarried in UDP - len += CC20_PREAMBLE_SIZE; - } else - traceEvent(TRACE_ERROR, "encode_cc20 outbuf too small."); - } else - traceEvent(TRACE_ERROR, "encode_cc20 inbuf too big to encrypt."); - - return len; -} - - -// see transop_encode_cc20 for packet format -static int transop_decode_cc20 (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - int len = 0; - transop_cc20_t *priv = (transop_cc20_t *)arg->priv; - - if(((in_len - CC20_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE) /* cipher text fits in assembly */ - && (in_len >= CC20_PREAMBLE_SIZE)) { /* has at least iv */ - - traceEvent(TRACE_DEBUG, "decode_cc20 %lu bytes", in_len); - - len = (in_len - CC20_PREAMBLE_SIZE); - - cc20_crypt(outbuf, - inbuf + CC20_PREAMBLE_SIZE, - in_len, - inbuf, /* iv */ - priv->ctx); - } else - traceEvent(TRACE_ERROR, "decode_cc20 inbuf wrong size (%ul) to decrypt.", in_len); - - return len; -} - - -static int setup_cc20_key (transop_cc20_t *priv, const uint8_t *password, ssize_t password_len) { - - uint8_t key_mat[CC20_KEY_BYTES]; - - // the input key always gets hashed to make a more unpredictable and more complete use of the key space - pearson_hash_256(key_mat, password, password_len); - - if(cc20_init(key_mat, &(priv->ctx))) { - traceEvent(TRACE_ERROR, "setup_cc20_key setup unsuccessful"); - return -1; - } - - traceEvent(TRACE_DEBUG, "setup_cc20_key completed"); - - return 0; -} - - -static void transop_tick_cc20 (n2n_trans_op_t *arg, time_t now) { - - // no tick action -} - - -// ChaCha20 initialization function -int n2n_transop_cc20_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - - transop_cc20_t *priv; - const u_char *encrypt_key = (const u_char *)conf->encrypt_key; - size_t encrypt_key_len = strlen(conf->encrypt_key); - - memset(ttt, 0, sizeof(*ttt)); - ttt->transform_id = N2N_TRANSFORM_ID_CHACHA20; - - ttt->tick = transop_tick_cc20; - ttt->deinit = transop_deinit_cc20; - ttt->fwd = transop_encode_cc20; - ttt->rev = transop_decode_cc20; - - priv = (transop_cc20_t*)calloc(1, sizeof(transop_cc20_t)); - if(!priv) { - traceEvent(TRACE_ERROR, "cannot allocate transop_cc20_t memory"); - return -1; - } - ttt->priv = priv; - - // setup the cipher and key - return setup_cc20_key(priv, encrypt_key, encrypt_key_len); -} diff --git a/bundles/n2n_ntop_v3/src/transform_null.c b/bundles/n2n_ntop_v3/src/transform_null.c deleted file mode 100644 index 6fd9d5e7..00000000 --- a/bundles/n2n_ntop_v3/src/transform_null.c +++ /dev/null @@ -1,91 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -static int transop_deinit_null (n2n_trans_op_t *arg ) { - - // nothing to deallocate, nothing to release - - return 0; -} - - -static int transop_encode_null (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - int retval = -1; - - traceEvent(TRACE_DEBUG, "encode_null %lu", in_len); - if(out_len >= in_len) { - memcpy(outbuf, inbuf, in_len); - retval = in_len; - } else { - traceEvent(TRACE_DEBUG, "encode_null %lu too big for packet buffer", in_len); - } - - return retval; -} - - -static int transop_decode_null (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - int retval = -1; - - traceEvent(TRACE_DEBUG, "decode_null %lu", in_len); - if(out_len >= in_len) { - memcpy(outbuf, inbuf, in_len); - retval = in_len; - } else { - traceEvent(TRACE_DEBUG, "decode_null %lu too big for packet buffer", in_len); - } - - return retval; -} - - -static void transop_tick_null (n2n_trans_op_t *arg, time_t now) { - - // no tick action -} - - -int n2n_transop_null_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - - memset(ttt, 0, sizeof(n2n_trans_op_t)); - - ttt->transform_id = N2N_TRANSFORM_ID_NULL; - ttt->no_encryption = 1; - ttt->deinit = transop_deinit_null; - ttt->tick = transop_tick_null; - ttt->fwd = transop_encode_null; - ttt->rev = transop_decode_null; - - return 0; -} diff --git a/bundles/n2n_ntop_v3/src/transform_speck.c b/bundles/n2n_ntop_v3/src/transform_speck.c deleted file mode 100644 index 22bac109..00000000 --- a/bundles/n2n_ntop_v3/src/transform_speck.c +++ /dev/null @@ -1,174 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -// Speck plaintext preamble -#define TRANSOP_SPECK_PREAMBLE_SIZE (N2N_SPECK_IVEC_SIZE) - - -typedef struct transop_speck { - speck_context_t *ctx; /* the round keys for payload encryption & decryption */ -} transop_speck_t; - - -static int transop_deinit_speck (n2n_trans_op_t *arg) { - - transop_speck_t *priv = (transop_speck_t *)arg->priv; - - if(priv->ctx) - speck_deinit(priv->ctx); - - if(priv) - free(priv); - - return 0; -} - - -// the Speck packet format consists of -// -// - a 128-bit random iv -// - encrypted payload -// -// [IIII|DDDDDDDDDDDDDDDDDDDDD] -// |<---- encrypted ---->| -// -static int transop_encode_speck (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - int len = -1; - transop_speck_t *priv = (transop_speck_t *)arg->priv; - - if(in_len <= N2N_PKT_BUF_SIZE) { - if((in_len + TRANSOP_SPECK_PREAMBLE_SIZE) <= out_len) { - size_t idx = 0; - - traceEvent(TRACE_DEBUG, "encode_speck %lu bytes", in_len); - - // generate and encode the iv - encode_uint64(outbuf, &idx, n2n_rand()); - encode_uint64(outbuf, &idx, n2n_rand()); - - // encrypt the payload and write the ciphertext after the iv - // len is set to the length of the cipher plain text to be encrpyted - // which is (in this case) identical to original packet lentgh - len = in_len; - speck_ctr (outbuf + TRANSOP_SPECK_PREAMBLE_SIZE, /* output starts right after the iv */ - inbuf, /* input */ - in_len, /* len */ - outbuf, /* iv, already encoded in outbuf, speck does not change it */ - priv->ctx); /* ctx already setup with round keys */ - - traceEvent(TRACE_DEBUG, "encode_speck: encrypted %u bytes.\n", in_len); - - // size of data carried in UDP - len += TRANSOP_SPECK_PREAMBLE_SIZE; - } else - traceEvent(TRACE_ERROR, "encode_speck outbuf too small."); - } else - traceEvent(TRACE_ERROR, "encode_speck inbuf too big to encrypt."); - - return len; -} - - -// see transop_encode_speck for packet format -static int transop_decode_speck (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - int len = 0; - transop_speck_t *priv = (transop_speck_t *)arg->priv; - - if(((in_len - TRANSOP_SPECK_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE) /* cipher text fits in buffer */ - && (in_len >= TRANSOP_SPECK_PREAMBLE_SIZE)) { /* has at least iv */ - - traceEvent(TRACE_DEBUG, "decode_speck %lu bytes", in_len); - - len = (in_len - TRANSOP_SPECK_PREAMBLE_SIZE); - speck_ctr (outbuf, /* output */ - inbuf + TRANSOP_SPECK_PREAMBLE_SIZE, /* encrypted data starts right after preamble (iv) */ - len, /* len */ - inbuf, /* iv can be found at input's beginning */ - priv->ctx); /* ctx already setup with round keys */ - - traceEvent(TRACE_DEBUG, "decode_speck decrypted %u bytes.\n", len); - } else - traceEvent(TRACE_ERROR, "decode_speck inbuf wrong size (%ul) to decrypt.", in_len); - - return len; -} - - -static int setup_speck_key (transop_speck_t *priv, const uint8_t *key, ssize_t key_size) { - - uint8_t key_mat_buf[32]; - - // the input key always gets hashed to make a more unpredictable and more complete use of the key space - pearson_hash_256(key_mat_buf, key, key_size); - - // expand the key material to the context (= round keys), 256 bit keysize - speck_init(&(priv->ctx), key_mat_buf, 256); - - traceEvent(TRACE_DEBUG, "setup_speck_key completed\n"); - - return 0; -} - - -static void transop_tick_speck (n2n_trans_op_t *arg, time_t now) { - - // no tick action -} - - -// Speck initialization function -int n2n_transop_speck_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - - transop_speck_t *priv; - const u_char *encrypt_key = (const u_char *)conf->encrypt_key; - size_t encrypt_key_len = strlen(conf->encrypt_key); - - memset(ttt, 0, sizeof(*ttt)); - ttt->transform_id = N2N_TRANSFORM_ID_SPECK; - - ttt->tick = transop_tick_speck; - ttt->deinit = transop_deinit_speck; - ttt->fwd = transop_encode_speck; - ttt->rev = transop_decode_speck; - - priv = (transop_speck_t*)calloc(1, sizeof(transop_speck_t)); - if(!priv) { - traceEvent(TRACE_ERROR, "n2n_transop_speck_init cannot allocate transop_speck_t memory"); - return -1; - } - ttt->priv = priv; - - // setup the cipher and key - return setup_speck_key(priv, encrypt_key, encrypt_key_len); -} diff --git a/bundles/n2n_ntop_v3/src/transform_tf.c b/bundles/n2n_ntop_v3/src/transform_tf.c deleted file mode 100644 index 144b6ec9..00000000 --- a/bundles/n2n_ntop_v3/src/transform_tf.c +++ /dev/null @@ -1,232 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -// size of random value prepended to plaintext defaults to TF_BLOCK_SIZE; -// gradually abandoning security, lower values could be chosen; -// however, minimum transmission size with cipher text stealing scheme is one -// block; as network packets should be longer anyway, only low level programmer -// might encounter an issue with lower values here -#define TF_PREAMBLE_SIZE (TF_BLOCK_SIZE) - - -// cbc mode is being used with random value prepended to plaintext -// instead of iv so, actual iv is tf_null_iv -const uint8_t tf_null_iv[TF_IV_SIZE] = { 0 }; - -typedef struct transop_tf { - tf_context_t *ctx; -} transop_tf_t; - - -static int transop_deinit_tf (n2n_trans_op_t *arg) { - - transop_tf_t *priv = (transop_tf_t *)arg->priv; - - if(priv->ctx) - tf_deinit(priv->ctx); - - if(priv) - free(priv); - - return 0; -} - - -// the Twofish packet format consists of -// -// - a random TF_PREAMBLE_SIZE-sized value prepended to plaintext -// encrypted together with the... -// - ... payload data -// -// [VV|DDDDDDDDDDDDDDDDDDDDD] -// | <---- encrypted ----> | -// -static int transop_encode_tf (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - transop_tf_t *priv = (transop_tf_t *)arg->priv; - - // the assembly buffer is a source for encrypting data - // the whole contents of assembly are encrypted - uint8_t assembly[N2N_PKT_BUF_SIZE]; - size_t idx = 0; - int padded_len; - uint8_t padding; - uint8_t buf[TF_BLOCK_SIZE]; - - if(in_len <= N2N_PKT_BUF_SIZE) { - if((in_len + TF_PREAMBLE_SIZE + TF_BLOCK_SIZE) <= out_len) { - traceEvent(TRACE_DEBUG, "transop_encode_tf %lu bytes plaintext", in_len); - - // full block sized random value (128 bit) - encode_uint64(assembly, &idx, n2n_rand()); - encode_uint64(assembly, &idx, n2n_rand()); - - // adjust for maybe differently chosen TF_PREAMBLE_SIZE - idx = TF_PREAMBLE_SIZE; - - // the plaintext data - encode_buf(assembly, &idx, inbuf, in_len); - - // round up to next whole TF block size - padded_len = (((idx - 1) / TF_BLOCK_SIZE) + 1) * TF_BLOCK_SIZE; - padding = (padded_len-idx); - - // pad the following bytes with zero, fixed length (TF_BLOCK_SIZE) seems to compile - // to slightly faster code than run-time dependant 'padding' - memset(assembly + idx, 0, TF_BLOCK_SIZE); - tf_cbc_encrypt(outbuf, assembly, padded_len, tf_null_iv, priv->ctx); - - if(padding) { - // exchange last two cipher blocks - memcpy(buf, outbuf + padded_len - TF_BLOCK_SIZE, TF_BLOCK_SIZE); - memcpy(outbuf + padded_len - TF_BLOCK_SIZE, outbuf + padded_len - 2 * TF_BLOCK_SIZE, TF_BLOCK_SIZE); - memcpy(outbuf + padded_len - 2 * TF_BLOCK_SIZE, buf, TF_BLOCK_SIZE); - } - } else - traceEvent(TRACE_ERROR, "transop_encode_tf outbuf too small"); - } else - traceEvent(TRACE_ERROR, "transop_encode_tf inbuf too big to encrypt"); - - return idx; -} - - -// see transop_encode_tf for packet format -static int transop_decode_tf (n2n_trans_op_t *arg, - uint8_t *outbuf, - size_t out_len, - const uint8_t *inbuf, - size_t in_len, - const uint8_t *peer_mac) { - - - transop_tf_t *priv = (transop_tf_t *)arg->priv; - uint8_t assembly[N2N_PKT_BUF_SIZE]; - - uint8_t rest; - size_t penultimate_block; - uint8_t buf[TF_BLOCK_SIZE]; - int len = -1; - - if(((in_len - TF_PREAMBLE_SIZE) <= N2N_PKT_BUF_SIZE) /* cipher text fits in assembly */ - && (in_len >= TF_PREAMBLE_SIZE) /* has at least random number */ - && (in_len >= TF_BLOCK_SIZE)) { /* minimum size requirement for cipher text stealing */ - - traceEvent(TRACE_DEBUG, "transop_decode_tf %lu bytes ciphertext", in_len); - - rest = in_len % TF_BLOCK_SIZE; - if(rest) { /* cipher text stealing */ - penultimate_block = ((in_len / TF_BLOCK_SIZE) - 1) * TF_BLOCK_SIZE; - - // everything normal up to penultimate block - memcpy(assembly, inbuf, penultimate_block); - - // prepare new penultimate block in buf - tf_ecb_decrypt(buf, inbuf + penultimate_block, priv->ctx); - memcpy(buf, inbuf + in_len - rest, rest); - - // former penultimate block becomes new ultimate block - memcpy(assembly + penultimate_block + TF_BLOCK_SIZE, inbuf + penultimate_block, TF_BLOCK_SIZE); - - // write new penultimate block from buf - memcpy(assembly + penultimate_block, buf, TF_BLOCK_SIZE); - - // regular cbc decryption of the re-arranged ciphertext - tf_cbc_decrypt(assembly, assembly, in_len + TF_BLOCK_SIZE - rest, tf_null_iv, priv->ctx); - - // check for expected zero padding and give a warning otherwise - if(memcmp(assembly + in_len, tf_null_iv, TF_BLOCK_SIZE - rest)) { - traceEvent(TRACE_WARNING, "transop_decode_tf payload decryption failed with unexpected cipher text stealing padding"); - return -1; - } - } else { - // regular cbc decryption on multiple block-sized payload - tf_cbc_decrypt(assembly, inbuf, in_len, tf_null_iv, priv->ctx); - } - len = in_len - TF_PREAMBLE_SIZE; - memcpy(outbuf, assembly + TF_PREAMBLE_SIZE, len); - } else - traceEvent(TRACE_ERROR, "transop_decode_tf inbuf wrong size (%ul) to decrypt", in_len); - - return len; -} - - -static int setup_tf_key (transop_tf_t *priv, const uint8_t *password, ssize_t password_len) { - - unsigned char key[32]; /* tf key length, equals hash length */ - size_t key_size; - - // the input password always gets hashed to make a more unpredictable use of the key space - // just think of usually reset MSB of ASCII coded password bytes - pearson_hash_256(key, password, password_len); - - key_size = 32; /* 256 bit */ - - // setup the key and have corresponding context created - if(tf_init(key, key_size * 8, &(priv->ctx))) { - traceEvent(TRACE_ERROR, "setup_tf_key %u-bit key setup unsuccessful", key_size * 8); - return -1; - } - - traceEvent(TRACE_DEBUG, "setup_tf_key %u-bit key setup completed", key_size * 8); - - return 0; -} - - -static void transop_tick_tf (n2n_trans_op_t *arg, time_t now) { - - // no tick action -} - - -// Twofish initialization function -int n2n_transop_tf_init (const n2n_edge_conf_t *conf, n2n_trans_op_t *ttt) { - - transop_tf_t *priv; - const u_char *encrypt_key = (const u_char *)conf->encrypt_key; - size_t encrypt_key_len = strlen(conf->encrypt_key); - - memset(ttt, 0, sizeof(*ttt)); - ttt->transform_id = N2N_TRANSFORM_ID_TWOFISH; - - ttt->tick = transop_tick_tf; - ttt->deinit = transop_deinit_tf; - ttt->fwd = transop_encode_tf; - ttt->rev = transop_decode_tf; - - priv = (transop_tf_t*)calloc(1, sizeof(transop_tf_t)); - if(!priv) { - traceEvent(TRACE_ERROR, "n2n_transop_tf_cbc_init cannot allocate transop_tf_t memory"); - return -1; - } - ttt->priv = priv; - - // setup the cipher and key - return setup_tf_key(priv, encrypt_key, encrypt_key_len); -} diff --git a/bundles/n2n_ntop_v3/src/tuntap_freebsd.c b/bundles/n2n_ntop_v3/src/tuntap_freebsd.c deleted file mode 100644 index 02b99b13..00000000 --- a/bundles/n2n_ntop_v3/src/tuntap_freebsd.c +++ /dev/null @@ -1,136 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -#ifdef __FreeBSD__ - - -#define N2N_FREEBSD_TAPDEVICE_SIZE 32 - - -void tuntap_close (tuntap_dev *device); - - -int tuntap_open (tuntap_dev *device /* ignored */, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - - int i; - char tap_device[N2N_FREEBSD_TAPDEVICE_SIZE]; - - for(i = 0; i < 255; i++) { - snprintf(tap_device, sizeof(tap_device), "/dev/tap%d", i); - - device->fd = open(tap_device, O_RDWR); - if(device->fd > 0) { - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - break; - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open tap device"); - return -1; - } else { - char buf[256]; - FILE *fd; - - device->ip_addr = inet_addr(device_ip); - - if(device_mac && device_mac[0] != '\0') { - // FIXME - this is not tested, might be wrong syntax for OS X - - // set the hw address before bringing the if up - snprintf(buf, sizeof(buf), "ifconfig tap%d ether %s", i, device_mac); - system(buf); - } - - snprintf(buf, sizeof(buf), "ifconfig tap%d %s netmask %s mtu %d up", i, device_ip, device_mask, mtu); - system(buf); - - traceEvent(TRACE_NORMAL, "Interface tap%d up and running (%s/%s)", i, device_ip, device_mask); - - // read MAC address - snprintf(buf, sizeof(buf), "ifconfig tap%d |grep ether|cut -c 8-24", i); - // traceEvent(TRACE_INFO, "%s", buf); - - fd = popen(buf, "r"); - if(fd < 0) { - tuntap_close(device); - return -1; - } else { - int a, b, c, d, e, f; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address"); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface tap%d mac %s", i, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - - // read_mac(dev, device->mac_addr); - - return device->fd; -} - - -int tuntap_read (struct tuntap_dev *tuntap, unsigned char *buf, int len) { - - return read(tuntap->fd, buf, len); -} - - -int tuntap_write (struct tuntap_dev *tuntap, unsigned char *buf, int len) { - - return write(tuntap->fd, buf, len); -} - - -void tuntap_close (struct tuntap_dev *tuntap) { - - close(tuntap->fd); -} - - -// fill out the ip_addr value from the interface, called to pick up dynamic address changes -void tuntap_get_address (struct tuntap_dev *tuntap) { - - // no action -} - - -#endif /* #ifdef __FreeBSD__ */ diff --git a/bundles/n2n_ntop_v3/src/tuntap_linux.c b/bundles/n2n_ntop_v3/src/tuntap_linux.c deleted file mode 100644 index cc23facc..00000000 --- a/bundles/n2n_ntop_v3/src/tuntap_linux.c +++ /dev/null @@ -1,281 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#ifdef __linux__ - - -#include "n2n.h" - - -static int setup_ifname (int fd, const char *ifname, const char *ipaddr, - const char *netmask, uint8_t *mac, int mtu) { - - struct ifreq ifr; - - memset(&ifr, 0, sizeof(ifr)); - - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; - - ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; - memcpy(ifr.ifr_hwaddr.sa_data, mac, 6); - - if(ioctl(fd, SIOCSIFHWADDR, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFHWADDR) failed [%d]: %s", errno, strerror(errno)); - return -1; - } - - ifr.ifr_addr.sa_family = AF_INET; - - // interface address - inet_pton(AF_INET, ipaddr, &((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr); - if(ioctl(fd, SIOCSIFADDR, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFADDR) failed [%d]: %s", errno, strerror(errno)); - return -2; - } - - // netmask - if(netmask && (((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr.s_addr != 0)) { - inet_pton(AF_INET, netmask, &((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr); - if(ioctl(fd, SIOCSIFNETMASK, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFNETMASK, %s) failed [%d]: %s", netmask, errno, strerror(errno)); - return -3; - } - } - - // MTU - ifr.ifr_mtu = mtu; - if(ioctl(fd, SIOCSIFMTU, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFMTU) failed [%d]: %s", errno, strerror(errno)); - return -4; - } - - // set up and running - if(ioctl(fd, SIOCGIFFLAGS, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCGIFFLAGS) failed [%d]: %s", errno, strerror(errno)); - return -5; - } - - ifr.ifr_flags |= (IFF_UP | IFF_RUNNING); - - if(ioctl(fd, SIOCSIFFLAGS, &ifr) == -1) { - traceEvent(TRACE_ERROR, "ioctl(SIOCSIFFLAGS) failed [%d]: %s", errno, strerror(errno)); - return -6; - } - - return 0; -} - - -/** @brief Open and configure the TAP device for packet read/write. - * - * This routine creates the interface via the tuntap driver and then - * configures it. - * - * @param device - [inout] a device info holder object - * @param dev - user-defined name for the new iface, - * if NULL system will assign a name - * @param device_ip - address of iface - * @param device_mask - netmask for device_ip - * @param mtu - MTU for device_ip - * - * @return - negative value on error - * - non-negative file-descriptor on success - */ -int tuntap_open (tuntap_dev *device, - char *dev, /* user-definable interface name, eg. edge0 */ - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - - char *tuntap_device = "/dev/net/tun"; - int ioctl_fd; - struct ifreq ifr; - int rc; - int nl_fd; - char nl_buf[8192]; /* >= 8192 to avoid truncation, see "man 7 netlink" */ - struct iovec iov; - struct sockaddr_nl sa; - int up_and_running = 0; - struct msghdr msg; - - device->fd = open(tuntap_device, O_RDWR); - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "tuntap open() error: %s[%d]. Is the tun kernel module loaded?\n", strerror(errno), errno); - return -1; - } - - memset(&ifr, 0, sizeof(ifr)); - - // want a TAP device for layer 2 frames - ifr.ifr_flags = IFF_TAP|IFF_NO_PI; - - strncpy(ifr.ifr_name, dev, IFNAMSIZ-1); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; - rc = ioctl(device->fd, TUNSETIFF, (void *)&ifr); - - if(rc < 0) { - traceEvent(TRACE_ERROR, "tuntap ioctl(TUNSETIFF, IFF_TAP) error: %s[%d]\n", strerror(errno), rc); - close(device->fd); - return -1; - } - - // store the device name for later reuse - strncpy(device->dev_name, ifr.ifr_name, MIN(IFNAMSIZ, N2N_IFNAMSIZ)); - - if(device_mac && device_mac[0]) { - // use the user-provided MAC - str2mac(device->mac_addr, device_mac); - } else { - // set an explicit random MAC to know the exact MAC in use, manually - // reading the MAC address is not safe as it may change internally - // also after the TAP interface UP status has been notified - - memrnd(device->mac_addr, N2N_MAC_SIZE); - - // clear multicast bit - device->mac_addr[0] &= ~0x01; - - // set locally-assigned bit - device->mac_addr[0] |= 0x02; - } - - // initialize netlink socket - if((nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) == -1) { - traceEvent(TRACE_ERROR, "netlink socket creation failed [%d]: %s", errno, strerror(errno)); - return -1; - } - - iov.iov_base = nl_buf; - iov.iov_len = sizeof(nl_buf); - - memset(&sa, 0, sizeof(sa)); - sa.nl_family = PF_NETLINK; - sa.nl_groups = RTMGRP_LINK; - sa.nl_pid = getpid(); - - memset(&msg, 0, sizeof(msg)); - msg.msg_name = &sa; - msg.msg_namelen = sizeof(sa); - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - // subscribe to interface events - if(bind(nl_fd, (struct sockaddr*)&sa, sizeof(sa)) == -1) { - traceEvent(TRACE_ERROR, "netlink socket bind failed [%d]: %s", errno, strerror(errno)); - return -1; - } - - if((ioctl_fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) { - traceEvent(TRACE_ERROR, "socket creation failed [%d]: %s", errno, strerror(errno)); - close(nl_fd); - return -1; - } - - if(setup_ifname(ioctl_fd, device->dev_name, device_ip, device_mask, device->mac_addr, mtu) < 0) { - close(nl_fd); - close(ioctl_fd); - close(device->fd); - return -1; - } - - close(ioctl_fd); - - // wait for the up and running notification - traceEvent(TRACE_INFO, "Waiting for TAP interface to be up and running..."); - - while(!up_and_running) { - ssize_t len = recvmsg(nl_fd, &msg, 0); - struct nlmsghdr *nh; - - for(nh = (struct nlmsghdr *)nl_buf; NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len)) { - if(nh->nlmsg_type == NLMSG_ERROR) { - traceEvent(TRACE_DEBUG, "nh->nlmsg_type == NLMSG_ERROR"); - break; - } - - if(nh->nlmsg_type == NLMSG_DONE) - break; - - if(nh->nlmsg_type == NETLINK_GENERIC) { - struct ifinfomsg *ifi = NLMSG_DATA(nh); - - // NOTE: skipping interface name check, assuming it's our TAP - if((ifi->ifi_flags & IFF_UP) && (ifi->ifi_flags & IFF_RUNNING)) { - up_and_running = 1; - traceEvent(TRACE_INFO, "Interface is up and running"); - break; - } - } - } - } - - close(nl_fd); - - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - device->if_idx = if_nametoindex(dev); - - return device->fd; -} - - -int tuntap_read (struct tuntap_dev *tuntap, unsigned char *buf, int len) { - - return read(tuntap->fd, buf, len); -} - - -int tuntap_write (struct tuntap_dev *tuntap, unsigned char *buf, int len) { - - return write(tuntap->fd, buf, len); -} - - -void tuntap_close (struct tuntap_dev *tuntap) { - - close(tuntap->fd); -} - - -// fill out the ip_addr value from the interface, called to pick up dynamic address changes -void tuntap_get_address (struct tuntap_dev *tuntap) { - - struct ifreq ifr; - int fd; - - if((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) { - traceEvent(TRACE_ERROR, "socket creation failed [%d]: %s", errno, strerror(errno)); - return; - } - - ifr.ifr_addr.sa_family = AF_INET; - strncpy(ifr.ifr_name, tuntap->dev_name, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; - - if(ioctl(fd, SIOCGIFADDR, &ifr) != -1) - tuntap->ip_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; - - close(fd); -} - - -#endif /* #ifdef __linux__ */ diff --git a/bundles/n2n_ntop_v3/src/tuntap_netbsd.c b/bundles/n2n_ntop_v3/src/tuntap_netbsd.c deleted file mode 100644 index 088f4a8f..00000000 --- a/bundles/n2n_ntop_v3/src/tuntap_netbsd.c +++ /dev/null @@ -1,148 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -#ifdef __NetBSD__ - - -#include -#include -#include - - -#define N2N_NETBSD_TAPDEVICE_SIZE 32 - - -void tun_close (tuntap_dev *device); - - -int tuntap_open (tuntap_dev *device /* ignored */, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - - char tap_device[N2N_NETBSD_TAPDEVICE_SIZE]; - struct ifreq req; - - if(dev) { - snprintf(tap_device, sizeof(tap_device), "/dev/%s", dev); - device->fd = open(tap_device, O_RDWR); - snprintf(tap_device, sizeof(tap_device), "%s", dev); - } else { - device->fd = open("/dev/tap", O_RDWR); - if(device->fd >= 0) { - if(ioctl(device->fd, TAPGIFNAME, &req) == -1) { - traceEvent(TRACE_ERROR, "Unable to obtain name of tap device (%s)", strerror(errno)); - close(device->fd); - return -1; - } else { - snprintf(tap_device, sizeof(tap_device), req.ifr_name); - } - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open tap device (%s)", strerror(errno)); - return -1; - } else { - char cmd[256]; - FILE *fd; - - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - - device->ip_addr = inet_addr(device_ip); - - if(device_mac && device_mac[0] != '\0') { - // set the hw address before bringing the if up - snprintf(cmd, sizeof(cmd), "ifconfig %s link %s active", tap_device, device_mac); - system(cmd); - } - - snprintf(cmd, sizeof(cmd), "ifconfig %s %s netmask %s mtu %d up", tap_device, device_ip, device_mask, mtu); - system(cmd); - - traceEvent(TRACE_NORMAL, "Interface %s up and running (%s/%s)", tap_device, device_ip, device_mask); - - // read MAC address - snprintf(cmd, sizeof(cmd), "ifconfig %s |grep address|cut -c 11-28", tap_device); - // traceEvent(TRACE_INFO, "%s", cmd); - - fd = popen(cmd, "r"); - if(fd < 0) { - tun_close(device); - return -1; - } else { - int a, b, c, d, e, f; - char buf[256]; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read %s interface MAC address [%s]", tap_device, cmd); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface %s mac %s", tap_device, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - // read_mac(dev, device->mac_addr); - - return(device->fd); -} - - -int tuntap_read (struct tuntap_dev *tuntap, unsigned char *buf, int len) { - - return(read(tuntap->fd, buf, len)); -} - - -int tuntap_write (struct tuntap_dev *tuntap, unsigned char *buf, int len) { - - return(write(tuntap->fd, buf, len)); -} - - -void tuntap_close (struct tuntap_dev *tuntap) { - - close(tuntap->fd); -} - - -// fill out the ip_addr value from the interface, called to pick up dynamic address changes -void tuntap_get_address (struct tuntap_dev *tuntap) { - - // no action -} - - -#endif /* #ifdef __NetBSD__ */ diff --git a/bundles/n2n_ntop_v3/src/tuntap_osx.c b/bundles/n2n_ntop_v3/src/tuntap_osx.c deleted file mode 100644 index 4ba51af9..00000000 --- a/bundles/n2n_ntop_v3/src/tuntap_osx.c +++ /dev/null @@ -1,134 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - - -#include "n2n.h" - - -#ifdef __APPLE__ - - -#define N2N_OSX_TAPDEVICE_SIZE 32 - - -void tun_close (tuntap_dev *device); - - -int tuntap_open (tuntap_dev *device /* ignored */, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu) { - - int i; - char tap_device[N2N_OSX_TAPDEVICE_SIZE]; - - for(i = 0; i < 255; i++) { - snprintf(tap_device, sizeof(tap_device), "/dev/tap%d", i); - - device->fd = open(tap_device, O_RDWR); - if(device->fd > 0) { - traceEvent(TRACE_NORMAL, "Succesfully open %s", tap_device); - break; - } - } - - if(device->fd < 0) { - traceEvent(TRACE_ERROR, "Unable to open any tap devices /dev/tap0 through /dev/tap254. Is this user properly authorized to access those descriptors?"); - traceEvent(TRACE_ERROR, "Please read https://github.com/ntop/n2n/blob/dev/doc/Building.md"); - return -1; - } else { - char buf[256]; - FILE *fd; - - device->ip_addr = inet_addr(device_ip); - - if(device_mac && device_mac[0] != '\0') { - // FIXME - this is not tested. might be wrong syntax for OS X - // set the hw address before bringing the if up - snprintf(buf, sizeof(buf), "ifconfig tap%d ether %s", i, device_mac); - system(buf); - } - - snprintf(buf, sizeof(buf), "ifconfig tap%d %s netmask %s mtu %d up", i, device_ip, device_mask, mtu); - system(buf); - - traceEvent(TRACE_NORMAL, "Interface tap%d up and running (%s/%s)", i, device_ip, device_mask); - - // read MAC address - snprintf(buf, sizeof(buf), "ifconfig tap%d |grep ether|cut -c 8-24", i); - // traceEvent(TRACE_INFO, "%s", buf); - - fd = popen(buf, "r"); - if(fd < 0) { - tuntap_close(device); - return -1; - } else { - int a, b, c, d, e, f; - - buf[0] = 0; - fgets(buf, sizeof(buf), fd); - pclose(fd); - - if(buf[0] == '\0') { - traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address"); - exit(0); - } - - traceEvent(TRACE_NORMAL, "Interface tap%d [MTU %d] mac %s", i, mtu, buf); - if(sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &a, &b, &c, &d, &e, &f) == 6) { - device->mac_addr[0] = a, device->mac_addr[1] = b; - device->mac_addr[2] = c, device->mac_addr[3] = d; - device->mac_addr[4] = e, device->mac_addr[5] = f; - } - } - } - - // read_mac(dev, device->mac_addr); - - return(device->fd); -} - - -int tuntap_read (struct tuntap_dev *tuntap, unsigned char *buf, int len) { - - return(read(tuntap->fd, buf, len)); -} - - -int tuntap_write (struct tuntap_dev *tuntap, unsigned char *buf, int len) { - - return(write(tuntap->fd, buf, len)); -} - - -void tuntap_close (struct tuntap_dev *tuntap) { - - close(tuntap->fd); -} - -// fill out the ip_addr value from the interface, called to pick up dynamic address changes -void tuntap_get_address (struct tuntap_dev *tuntap) { - - // no action -} - - -#endif /* __APPLE__ */ diff --git a/bundles/n2n_ntop_v3/src/wire.c b/bundles/n2n_ntop_v3/src/wire.c deleted file mode 100644 index e7e2c251..00000000 --- a/bundles/n2n_ntop_v3/src/wire.c +++ /dev/null @@ -1,727 +0,0 @@ -/** - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -/** Routines for encoding and decoding n2n packets on the wire. - * - * encode_X(base,idx,v) prototypes are inspired by the erlang internal - * encoding model. Passing the start of a buffer in base and a pointer to an - * integer (initially set to zero). Each encode routine increases idx by the - * amount written and returns the amount written. In this way complex sequences - * of encodings can be represented cleanly. See encode_register() for an - * example. - */ - -#include "n2n.h" - - -int encode_uint8 (uint8_t * base, - size_t * idx, - const uint8_t v) { - - *(base + (*idx)) = (v & 0xff); - ++(*idx); - - return 1; -} - -int decode_uint8 (uint8_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx) { - - if(*rem < 1) { - return 0; - } - - *out = ( base[*idx] & 0xff ); - ++(*idx); - --(*rem); - - return 1; -} - -int encode_uint16 (uint8_t * base, - size_t * idx, - const uint16_t v) { - - *(base + (*idx)) = ( v >> 8) & 0xff; - *(base + (1 + *idx)) = ( v & 0xff ); - *idx += 2; - - return 2; -} - -int decode_uint16 (uint16_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx) { - - if(*rem < 2) { - return 0; - } - - *out = ( base[*idx] & 0xff ) << 8; - *out |= ( base[1 + *idx] & 0xff ); - *idx += 2; - *rem -= 2; - - return 2; -} - -int encode_uint32 (uint8_t * base, - size_t * idx, - const uint32_t v) { - - *(base + (0 + *idx)) = ( v >> 24) & 0xff; - *(base + (1 + *idx)) = ( v >> 16) & 0xff; - *(base + (2 + *idx)) = ( v >> 8) & 0xff; - *(base + (3 + *idx)) = ( v & 0xff ); - *idx += 4; - - return 4; -} - -int decode_uint32 (uint32_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx) { - - if(*rem < 4) { - return 0; - } - - *out = ( base[0 + *idx] & 0xff ) << 24; - *out |= ( base[1 + *idx] & 0xff ) << 16; - *out |= ( base[2 + *idx] & 0xff ) << 8; - *out |= ( base[3 + *idx] & 0xff ); - *idx += 4; - *rem -= 4; - - return 4; -} - -int encode_uint64 (uint8_t * base, - size_t * idx, - const uint64_t v) { - - *(uint64_t*)(base + *idx) = htobe64(v); - *idx += 8; - - return 8; -} - -int decode_uint64 (uint64_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx) { - - if(*rem < 8) { - return 0; - } - - *out = be64toh(*(uint64_t*)base + *idx); - *idx += 8; - *rem -= 8; - - return 8; -} - -int encode_buf (uint8_t * base, - size_t * idx, - const void * p, - size_t s) { - - memcpy((base + (*idx)), p, s); - *idx += s; - - return s; -} - -/* Copy from base to out of size bufsize */ -int decode_buf (uint8_t * out, - size_t bufsize, - const uint8_t * base, - size_t * rem, - size_t * idx) { - - if(*rem < bufsize) { - return 0; - } - - memcpy(out, (base + *idx), bufsize); - *idx += bufsize; - *rem -= bufsize; - - return bufsize; -} - - -int encode_mac (uint8_t * base, /* n2n_mac_t is typedefed array type which is always passed by reference */ - size_t * idx, - const n2n_mac_t m) { - - return encode_buf(base, idx, m, N2N_MAC_SIZE); -} - -int decode_mac (n2n_mac_t out, - const uint8_t * base, - size_t * rem, - size_t * idx) { - - return decode_buf(out, N2N_MAC_SIZE, base, rem, idx); -} - -int encode_cookie (uint8_t * base, - size_t * idx, - const n2n_cookie_t c) { - - return encode_uint32(base, idx, c); -} - -int decode_cookie (n2n_cookie_t * out, /* cookies are typedef'd as uint32_t which needs to correspond to this code */ - const uint8_t * base, - size_t * rem, - size_t * idx) { - - return decode_uint32(out, base, rem, idx); -} - - -int encode_common (uint8_t * base, - size_t * idx, - const n2n_common_t * common) { - - uint16_t flags = 0; - - encode_uint8(base, idx, N2N_PKT_VERSION); - encode_uint8(base, idx, common->ttl); - - flags = common->pc & N2N_FLAGS_TYPE_MASK; - flags |= common->flags & N2N_FLAGS_BITS_MASK; - - encode_uint16(base, idx, flags); - encode_buf(base, idx, common->community, N2N_COMMUNITY_SIZE); - - return -1; -} - -int decode_common (n2n_common_t * out, - const uint8_t * base, - size_t * rem, - size_t * idx) { - - size_t idx0 = *idx; - uint8_t dummy = 0; - - decode_uint8(&dummy, base, rem, idx); - - if(N2N_PKT_VERSION != dummy) { - return -1; - } - - decode_uint8(&(out->ttl), base, rem, idx); - decode_uint16(&(out->flags), base, rem, idx); - out->pc = (out->flags & N2N_FLAGS_TYPE_MASK); - out->flags &= N2N_FLAGS_BITS_MASK; - - decode_buf(out->community, N2N_COMMUNITY_SIZE, base, rem, idx); - - return (*idx - idx0); -} - - -int encode_sock (uint8_t * base, - size_t * idx, - const n2n_sock_t * sock) { - - int retval = 0; - uint16_t f; - - switch(sock->family) { - case AF_INET: { - f = 0; - retval += encode_uint16(base, idx, f); - retval += encode_uint16(base, idx, sock->port); - retval += encode_buf(base, idx, sock->addr.v4, IPV4_SIZE); - break; - } - - case AF_INET6: { - f = 0x8000; - retval += encode_uint16(base, idx, f); - retval += encode_uint16(base, idx, sock->port); - retval += encode_buf(base, idx, sock->addr.v6, IPV6_SIZE); - break; - } - - default: - retval = -1; - } - - return retval; -} - - -int decode_sock (n2n_sock_t * sock, - const uint8_t * base, - size_t * rem, - size_t * idx) { - - size_t * idx0 = idx; - uint16_t f = 0; - - decode_uint16(&f, base, rem, idx); - - if(f & 0x8000) { - - /* IPv6 */ - sock->family = AF_INET6; - decode_uint16(&(sock->port), base, rem, idx); - decode_buf(sock->addr.v6, IPV6_SIZE, base, rem, idx); - } else { - /* IPv4 */ - sock->family = AF_INET; - decode_uint16(&(sock->port), base, rem, idx); - memset(sock->addr.v6, 0, IPV6_SIZE); /* so memcmp() works for equality. */ - decode_buf(sock->addr.v4, IPV4_SIZE, base, rem, idx); - } - - return (idx - idx0); -} - - -int encode_REGISTER (uint8_t *base, - size_t *idx, - const n2n_common_t *common, - const n2n_REGISTER_t *reg) { - - int retval = 0; - - retval += encode_common(base, idx, common); - retval += encode_cookie(base, idx, reg->cookie); - retval += encode_mac(base, idx, reg->srcMac); - retval += encode_mac(base, idx, reg->dstMac); - if(common->flags & N2N_FLAGS_SOCKET) { - retval += encode_sock(base, idx, &(reg->sock)); - } - retval += encode_uint32(base, idx, reg->dev_addr.net_addr); - retval += encode_uint8(base, idx, reg->dev_addr.net_bitlen); - retval += encode_buf(base, idx, reg->dev_desc, N2N_DESC_SIZE); - - return retval; -} - - -int decode_REGISTER (n2n_REGISTER_t *reg, - const n2n_common_t *cmn, /* info on how to interpret it */ - const uint8_t *base, - size_t *rem, - size_t *idx) { - - size_t retval = 0; - memset(reg, 0, sizeof(n2n_REGISTER_t)); - - retval += decode_cookie(®->cookie, base, rem, idx); - retval += decode_mac(reg->srcMac, base, rem, idx); - retval += decode_mac(reg->dstMac, base, rem, idx); - if(cmn->flags & N2N_FLAGS_SOCKET) { - retval += decode_sock(&(reg->sock), base, rem, idx); - } - retval += decode_uint32(&(reg->dev_addr.net_addr), base, rem, idx); - retval += decode_uint8(&(reg->dev_addr.net_bitlen), base, rem, idx); - retval += decode_buf(reg->dev_desc, N2N_DESC_SIZE, base, rem, idx); - - return retval; -} - - -int encode_REGISTER_SUPER (uint8_t *base, - size_t *idx, - const n2n_common_t *common, - const n2n_REGISTER_SUPER_t *reg) { - - int retval = 0; - - retval += encode_common(base, idx, common); - retval += encode_cookie(base, idx, reg->cookie); - retval += encode_mac(base, idx, reg->edgeMac); - if(common->flags & N2N_FLAGS_SOCKET) { - retval += encode_sock(base, idx, &(reg->sock)); - } - retval += encode_uint32(base, idx, reg->dev_addr.net_addr); - retval += encode_uint8(base, idx, reg->dev_addr.net_bitlen); - retval += encode_buf(base, idx, reg->dev_desc, N2N_DESC_SIZE); - retval += encode_uint16(base, idx, reg->auth.scheme); - retval += encode_uint16(base, idx, reg->auth.token_size); - retval += encode_buf(base, idx, reg->auth.token, reg->auth.token_size); - retval += encode_uint32(base, idx, reg->key_time); - - return retval; -} - - -int decode_REGISTER_SUPER (n2n_REGISTER_SUPER_t *reg, - const n2n_common_t *cmn, /* info on how to interpret it */ - const uint8_t *base, - size_t *rem, - size_t *idx) { - - size_t retval = 0; - memset(reg, 0, sizeof(n2n_REGISTER_SUPER_t)); - - retval += decode_cookie(®->cookie, base, rem, idx); - retval += decode_mac(reg->edgeMac, base, rem, idx); - if(cmn->flags & N2N_FLAGS_SOCKET) { - retval += decode_sock(&(reg->sock), base, rem, idx); - } - retval += decode_uint32(&(reg->dev_addr.net_addr), base, rem, idx); - retval += decode_uint8(&(reg->dev_addr.net_bitlen), base, rem, idx); - retval += decode_buf(reg->dev_desc, N2N_DESC_SIZE, base, rem, idx); - retval += decode_uint16(&(reg->auth.scheme), base, rem, idx); - retval += decode_uint16(&(reg->auth.token_size), base, rem, idx); - retval += decode_buf(reg->auth.token, reg->auth.token_size, base, rem, idx); - retval += decode_uint32(&(reg->key_time), base, rem, idx); - - return retval; -} - - -int encode_UNREGISTER_SUPER (uint8_t *base, - size_t *idx, - const n2n_common_t *common, - const n2n_UNREGISTER_SUPER_t *unreg) { - - int retval = 0; - - retval += encode_common(base, idx, common); - retval += encode_uint16(base, idx, unreg->auth.scheme); - retval += encode_uint16(base, idx, unreg->auth.token_size); - retval += encode_buf(base, idx, unreg->auth.token, unreg->auth.token_size); - retval += encode_mac(base, idx, unreg->srcMac); - - return retval; -} - - -int decode_UNREGISTER_SUPER (n2n_UNREGISTER_SUPER_t *unreg, - const n2n_common_t *cmn, /* info on how to interpret it */ - const uint8_t *base, - size_t *rem, - size_t *idx) { - - size_t retval = 0; - memset(unreg, 0, sizeof(n2n_UNREGISTER_SUPER_t)); - - retval += decode_uint16(&(unreg->auth.scheme), base, rem, idx); - retval += decode_uint16(&(unreg->auth.token_size), base, rem, idx); - retval += decode_buf(unreg->auth.token, unreg->auth.token_size, base, rem, idx); - retval += decode_mac(unreg->srcMac, base, rem, idx); - - return retval; -} - - -int encode_REGISTER_ACK (uint8_t *base, - size_t *idx, - const n2n_common_t *common, - const n2n_REGISTER_ACK_t *reg) { - - int retval = 0; - - retval += encode_common(base, idx, common); - retval += encode_cookie(base, idx, reg->cookie); - retval += encode_mac(base, idx, reg->dstMac); - retval += encode_mac(base, idx, reg->srcMac); - - /* The socket in REGISTER_ACK is the socket from which the REGISTER - * arrived. This is sent back to the sender so it knows what its public - * socket is. */ - if(common->flags & N2N_FLAGS_SOCKET) { - retval += encode_sock(base, idx, &(reg->sock)); - } - - return retval; -} - - -int decode_REGISTER_ACK (n2n_REGISTER_ACK_t *reg, - const n2n_common_t *cmn, /* info on how to interpret it */ - const uint8_t *base, - size_t *rem, - size_t *idx) { - - size_t retval = 0; - memset(reg, 0, sizeof(n2n_REGISTER_ACK_t)); - - retval += decode_cookie(®->cookie, base, rem, idx); - retval += decode_mac(reg->dstMac, base, rem, idx); - retval += decode_mac(reg->srcMac, base, rem, idx); - - /* The socket in REGISTER_ACK is the socket from which the REGISTER - * arrived. This is sent back to the sender so it knows what its public - * socket is. */ - if(cmn->flags & N2N_FLAGS_SOCKET) { - retval += decode_sock(&(reg->sock), base, rem, idx); - } - - return retval; -} - - -int encode_REGISTER_SUPER_ACK (uint8_t *base, - size_t *idx, - const n2n_common_t *common, - const n2n_REGISTER_SUPER_ACK_t *reg, - uint8_t *tmpbuf) { - - int retval = 0; - - retval += encode_common(base, idx, common); - retval += encode_cookie(base, idx, reg->cookie); - retval += encode_mac(base, idx, reg->srcMac); - retval += encode_uint32(base, idx, reg->dev_addr.net_addr); - retval += encode_uint8(base, idx, reg->dev_addr.net_bitlen); - retval += encode_uint16(base, idx, reg->lifetime); - - retval += encode_sock(base, idx, &(reg->sock)); - - retval += encode_uint16(base, idx, reg->auth.scheme); - retval += encode_uint16(base, idx, reg->auth.token_size); - retval += encode_buf(base, idx, reg->auth.token, reg->auth.token_size); - - retval += encode_uint8(base, idx, reg->num_sn); - retval += encode_buf(base, idx, tmpbuf, (reg->num_sn*REG_SUPER_ACK_PAYLOAD_ENTRY_SIZE)); - - retval += encode_uint32(base, idx, reg->key_time); - - return retval; -} - - -int decode_REGISTER_SUPER_ACK (n2n_REGISTER_SUPER_ACK_t *reg, - const n2n_common_t *cmn, /* info on how to interpret it */ - const uint8_t *base, - size_t *rem, - size_t *idx, - uint8_t *tmpbuf) { - - size_t retval = 0; - memset(reg, 0, sizeof(n2n_REGISTER_SUPER_ACK_t)); - - retval += decode_cookie(®->cookie, base, rem, idx); - retval += decode_mac(reg->srcMac, base, rem, idx); - retval += decode_uint32(&(reg->dev_addr.net_addr), base, rem, idx); - retval += decode_uint8(&(reg->dev_addr.net_bitlen), base, rem, idx); - retval += decode_uint16(&(reg->lifetime), base, rem, idx); - - /* Socket is mandatory in this message type */ - retval += decode_sock(&(reg->sock), base, rem, idx); - - retval += decode_uint16(&(reg->auth.scheme), base, rem, idx); - retval += decode_uint16(&(reg->auth.token_size), base, rem, idx); - retval += decode_buf(reg->auth.token, reg->auth.token_size, base, rem, idx); - - /* Following the edge socket are an array of backup supernodes. */ - retval += decode_uint8(&(reg->num_sn), base, rem, idx); - retval += decode_buf(tmpbuf, (reg->num_sn * REG_SUPER_ACK_PAYLOAD_ENTRY_SIZE), base, rem, idx); - - retval += decode_uint32(&(reg->key_time), base, rem, idx); - - return retval; -} - - -int encode_REGISTER_SUPER_NAK (uint8_t *base, - size_t *idx, - const n2n_common_t *common, - const n2n_REGISTER_SUPER_NAK_t *nak) { - - int retval = 0; - - retval += encode_common(base, idx, common); - retval += encode_cookie(base, idx, nak->cookie); - retval += encode_mac(base, idx, nak->srcMac); - - retval += encode_uint16(base, idx, nak->auth.scheme); - retval += encode_uint16(base, idx, nak->auth.token_size); - retval += encode_buf(base, idx, nak->auth.token, nak->auth.token_size); - - return retval; -} - - -int decode_REGISTER_SUPER_NAK (n2n_REGISTER_SUPER_NAK_t *nak, - const n2n_common_t *cmn, /* info on how to interpret it */ - const uint8_t *base, - size_t *rem, - size_t *idx) { - - size_t retval = 0; - memset(nak, 0, sizeof(n2n_REGISTER_SUPER_NAK_t)); - - retval += decode_cookie(&nak->cookie, base, rem, idx); - retval += decode_mac(nak->srcMac, base, rem, idx); - - retval += decode_uint16(&(nak->auth.scheme), base, rem, idx); - retval += decode_uint16(&(nak->auth.token_size), base, rem, idx); - retval += decode_buf(nak->auth.token, nak->auth.token_size, base, rem, idx); - - return retval; -} - - -int fill_sockaddr (struct sockaddr * addr, - size_t addrlen, - const n2n_sock_t * sock) { - - int retval = -1; - - if(AF_INET == sock->family) { - if(addrlen >= sizeof(struct sockaddr_in)) { - struct sockaddr_in * si = (struct sockaddr_in *)addr; - si->sin_family = sock->family; - si->sin_port = htons(sock->port); - memcpy(&(si->sin_addr.s_addr), sock->addr.v4, IPV4_SIZE); - retval = 0; - } - } - - return retval; -} - - -int encode_PACKET (uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_PACKET_t * pkt) { - - int retval = 0; - - retval += encode_common(base, idx, common); - retval += encode_mac(base, idx, pkt->srcMac); - retval += encode_mac(base, idx, pkt->dstMac); - if(common->flags & N2N_FLAGS_SOCKET) { - retval += encode_sock(base, idx, &(pkt->sock)); - } - retval += encode_uint8(base, idx, pkt->compression); - retval += encode_uint8(base, idx, pkt->transform); - - return retval; -} - - -int decode_PACKET (n2n_PACKET_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx) { - - size_t retval = 0; - memset(pkt, 0, sizeof(n2n_PACKET_t)); - - retval += decode_mac(pkt->srcMac, base, rem, idx); - retval += decode_mac(pkt->dstMac, base, rem, idx); - - if(cmn->flags & N2N_FLAGS_SOCKET) { - retval += decode_sock(&(pkt->sock), base, rem, idx); - } - - retval += decode_uint8(&(pkt->compression), base, rem, idx); - retval += decode_uint8(&(pkt->transform), base, rem, idx); - - return retval; -} - - -int encode_PEER_INFO (uint8_t *base, - size_t *idx, - const n2n_common_t *cmn, - const n2n_PEER_INFO_t *pkt) { - - int retval = 0; - - retval += encode_common(base, idx, cmn); - retval += encode_uint16(base, idx, pkt->aflags); - retval += encode_mac(base, idx, pkt->srcMac); - retval += encode_mac(base, idx, pkt->mac); - retval += encode_sock(base, idx, &pkt->sock); - if(cmn->flags & N2N_FLAGS_SOCKET) { - retval += encode_sock(base, idx, &pkt->preferred_sock); - } - retval += encode_uint32(base, idx, (uint32_t)pkt->load); - retval += encode_uint32(base, idx, (uint32_t)pkt->uptime); - retval += encode_buf(base, idx, pkt->version, sizeof(n2n_version_t)); - - return retval; -} - - -int decode_PEER_INFO (n2n_PEER_INFO_t *pkt, - const n2n_common_t *cmn, /* info on how to interpret it */ - const uint8_t *base, - size_t *rem, - size_t *idx) { - - size_t retval = 0; - memset(pkt, 0, sizeof(n2n_PEER_INFO_t)); - - retval += decode_uint16(&(pkt->aflags), base, rem, idx); - retval += decode_mac(pkt->srcMac, base, rem, idx); - retval += decode_mac(pkt->mac, base, rem, idx); - retval += decode_sock(&pkt->sock, base, rem, idx); - if(cmn->flags & N2N_FLAGS_SOCKET) { - retval += decode_sock(&pkt->preferred_sock, base, rem, idx); - } - retval += decode_uint32(&pkt->load, base, rem, idx); - retval += decode_uint32((uint32_t*)&pkt->uptime, base, rem, idx); - retval += decode_buf((uint8_t*)pkt->version, sizeof(n2n_version_t), base, rem, idx); - - return retval; -} - - -int encode_QUERY_PEER (uint8_t * base, - size_t * idx, - const n2n_common_t * common, - const n2n_QUERY_PEER_t * pkt) { - - int retval = 0; - - retval += encode_common(base, idx, common); - retval += encode_mac(base, idx, pkt->srcMac); - retval += encode_mac(base, idx, pkt->targetMac); - retval += encode_uint16(base, idx, pkt->aflags); - - return retval; -} - -int decode_QUERY_PEER (n2n_QUERY_PEER_t * pkt, - const n2n_common_t * cmn, /* info on how to interpret it */ - const uint8_t * base, - size_t * rem, - size_t * idx) { - - size_t retval = 0; - memset(pkt, 0, sizeof(n2n_QUERY_PEER_t)); - - retval += decode_mac(pkt->srcMac, base, rem, idx); - retval += decode_mac(pkt->targetMac, base, rem, idx); - retval += decode_uint16(&(pkt->aflags), base, rem, idx); - - return retval; -} diff --git a/bundles/n2n_ntop_v3/supernode.1 b/bundles/n2n_ntop_v3/supernode.1 deleted file mode 100644 index 742b826c..00000000 --- a/bundles/n2n_ntop_v3/supernode.1 +++ /dev/null @@ -1,133 +0,0 @@ -.TH supernode 1 "Jul 16, 2021" "version 3" "USER COMMANDS" -.SH NAME -supernode \- n2n supernode daemon -.SH SYNOPSIS -.B supernode - -.br -.B supernode -[OPTION]... -.SH DESCRIPTION -N2N is a peer-to-peer VPN system. Supernode is a node introduction registry, -broadcast conduit and packet relay node for the n2n system. On startup supernode -begins listening on the specified UDP port for node registrations, and other -packets to route. The supernode can service any number of communities and routes -packets only between members of the same community. The supernode does not hold -the community encryption key and so cannot snoop or inject packets into the -community. -.PP -Supernode can service a number of n2n communities concurrently. Traffic does not -cross between communities. -.PP -All logging goes to stdout. -.PP -The config file is similar to the command line, with one option per line. -Lines starting with a "#" are ignored. -An equal sign ('=') should be used between key and value. Example: -p=7777 -.SH OPTIONS FOR THE UNDERLYING NETWORK CONNECTION -.TP -\fB\-p \fR<\fIlocal_port\fR>, \fB\-\-local-port\fR=<\fIlocal_port\fR> -listen on this fixed local UDP port, defaults to 7654 -.TP -\fB\-F \fR<\fIfed_name\fR> -name of the supernode's federation, defaults to '*Federation' (see also N2N_FEDERATION in ENVIRONMENT) -.TP -\fB\-l \fR<\fIhost:port\fR> -ip address or name, and port of known supernode -.TP -\fB\-m \fR<\fImac_address\fR> -fixed MAC address for the supernode, e.g. - '-m 10:20:30:40:50:60', random otherwise -.TP -\fB\-M\fR -disable MAC and IP address spoofing protection for all -non-username-password-authenticating communities -.TP -\fB\-V \fR<\fIversion_string\fR> -modify the supernode version string which is distributed to the -edges and shown at their management port output, up to 19 characters -.TP -.SH TAP DEVICE AND OVERLAY NETWORK CONFIGURATION -.TP -\fB\-c \fR<\fIpath\fR>, \fB\-\-communities\fR=<\fIpath\fR> -file containing the allowed communities and any User / Password based authentication -details (See ALLOWED COMMUNITIES FILE section) -.TP -\fB\-a \fR<\fInet-net/n\fR>, \fB\-\-autoip\fR= -subnet range for auto ip address service, -.br -e.g. '-a 192.168.0.0-192.168.255.0/24', -.br -defaults to '10.128.255.0-10.255.255.0/24' -.SH LOCAL OPTIONS -.TP -\fB\-f\fR, \fB\-\-foreground\fR -disable daemon mode (UNIX) and run in foreground. -.TP -\fB\-t \fR<\fIport\fR>, \fB\-\-mgmt-port\fR=<\fIport\fR> -management UDP port, for multiple supernodes on a machine, defaults to 5645 -.TP -\fB\-\-management-password \fR<\fIpassword\fR> -sets the password for access to JSON API at the management port, defaults to 'n2n'. The password -has to be provided for relevant access to JSON API at the management port. -.TP -\fB\-v\fR, \fB\-\-verbose\fR -use verbose logging -.TP -\fB\-u \fR<\fIUID\fR> -numeric user ID to use when privileges are dropped -.TP -\fB\-g \fR<\fIGID\fR> -numeric group ID to use when privileges are dropped -.TP -\fB-h\fR -shows a quick reference including all available options -.TP -\fB\-\-help\fR -shows detailed parameter description - -.SH ALLOWED COMMUNITIES FILE -This file is a plain text file. -Comments are introduced with a hash at the beginning of the line. -A line that begins with an asterisk is a user authentication definition and adds an allowed user to the most recently defined community. -Allowed communities can be specified with a regular expression. -.PP -Example community file: -.PP -.nf -.RS -# List of allowed communities -mynetwork -netleo -* logan nHWum+r42k1qDXdIeH-WFKeylK5UyLStRzxofRNAgpG -* sister HwHpPrdMft+38tFDDiunUds6927t0+zhCMMkQdJafcC -.RE -.fi -.PP -More details on creating the allowed communities file are found in the Communities.md and Authentication.md documentation included with this package. -.SH ENVIRONMENT -.TP -.B N2N_FEDERATION -set the federation name so it is not visible at the command line -.SH EXAMPLES -.TP -.B supernode -p 7654 -v -Start supernode listening on UDP port 7654 with verbose output. -.TP -.B echo | nc -w1 -u 127.0.0.1 5645 -Shows the management status of a running supernode. -.PP -.SH RESTART -When supernode restarts it loses all registration information from associated -edge nodes. It can take up to five minutes for the edge nodes to re-register and -normal traffic flow to resume. -.SH EXIT STATUS -supernode is a daemon and any exit is an error -.SH AUTHOR -Luca Deri ( deri (at) ntop.org ), Richard Andrews ( andrews (at) ntop.org ), Don Bindner -.SH SEE ALSO -ifconfig(8) edge(8) -.br -the documentation contained in the source code -.br -the extensive documentation found in n2n's \fBdoc/\fR folder diff --git a/bundles/n2n_ntop_v3/tests/tests-compress.expected b/bundles/n2n_ntop_v3/tests/tests-compress.expected deleted file mode 100644 index 6360547d..00000000 --- a/bundles/n2n_ntop_v3/tests/tests-compress.expected +++ /dev/null @@ -1,44 +0,0 @@ -original: input size = 0x200 -000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -010: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -020: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -030: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -040: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -050: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -060: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -070: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -080: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -090: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0a0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0b0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0c0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0d0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0e0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0f0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -100: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -110: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -120: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -130: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -140: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -150: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -160: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -170: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -180: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -190: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1a0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1b0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1c0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1d0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1e0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1f0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | - -lzo1x: output size = 0x2f -000: 0d 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e | | -010: 0f 20 00 bc 3c 00 00 02 0c 0d 0e 0f 00 01 02 03 | < | -020: 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 11 00 00 | | - -zstd: output size = 0x21 -000: 28 b5 2f fd 60 00 01 bd 00 00 80 00 01 02 03 04 |( / ` | -010: 05 06 07 08 09 0a 0b 0c 0d 0e 0f 01 00 da 47 9d | G | -020: 4b |K| - diff --git a/bundles/n2n_ntop_v3/tests/tests-elliptic.expected b/bundles/n2n_ntop_v3/tests/tests-elliptic.expected deleted file mode 100644 index c60ce1b5..00000000 --- a/bundles/n2n_ntop_v3/tests/tests-elliptic.expected +++ /dev/null @@ -1,11 +0,0 @@ -environment: input -000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | | -010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 | | -environment: key -000: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 |UUUUUUUUUUUUUUUU| -010: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 |UUUUUUUUUUUUUUUU| - -curve25519: output -000: 7f 42 1b f9 34 5a 59 84 4a 30 bc 53 64 74 fa 7c | B 4ZY J0 Sdt || -010: 15 81 77 a4 4d 34 6d 2f 8b c1 8c 05 d6 a9 44 54 | w M4m/ DT| - diff --git a/bundles/n2n_ntop_v3/tests/tests-hashing.expected b/bundles/n2n_ntop_v3/tests/tests-hashing.expected deleted file mode 100644 index 1f29fa95..00000000 --- a/bundles/n2n_ntop_v3/tests/tests-hashing.expected +++ /dev/null @@ -1,36 +0,0 @@ -environment: input size = 0x200 -000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -010: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -020: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -030: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -040: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -050: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -060: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -070: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -080: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -090: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0a0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0b0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0c0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0d0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0e0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0f0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -100: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -110: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -120: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -130: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -140: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -150: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -160: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -170: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -180: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -190: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1a0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1b0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1c0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1d0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1e0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1f0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | - -pearson: output = 0xb2d98fa82ea108be - diff --git a/bundles/n2n_ntop_v3/tests/tests-transform.expected b/bundles/n2n_ntop_v3/tests/tests-transform.expected deleted file mode 100644 index 14276cf2..00000000 --- a/bundles/n2n_ntop_v3/tests/tests-transform.expected +++ /dev/null @@ -1,225 +0,0 @@ -environment: community_name = "abc123def456" -environment: encrypt_key = "SoMEVer!S$cUREPassWORD" -environment: input size = 0x200 -000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -010: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -020: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -030: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -040: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -050: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -060: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -070: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -080: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -090: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0a0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0b0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0c0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0d0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0e0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -0f0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -100: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -110: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -120: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -130: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -140: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -150: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -160: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -170: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -180: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -190: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1a0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1b0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1c0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1d0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1e0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | -1f0: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f | | - -null: output size = 0x226 -000: 03 02 00 03 61 62 63 31 32 33 64 65 66 34 35 36 | abc123def456| -010: 00 00 00 00 00 00 00 00 00 01 02 03 04 05 00 01 | | -020: 02 03 04 05 00 00 00 01 02 03 04 05 06 07 08 09 | | -030: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -040: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -050: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -060: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -070: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -080: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -090: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -0a0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -0b0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -0c0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -0d0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -0e0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -0f0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -100: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -110: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -120: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -130: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -140: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -150: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -160: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -170: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -180: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -190: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -1a0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -1b0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -1c0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -1d0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -1e0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -1f0: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -200: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -210: 0a 0b 0c 0d 0e 0f 00 01 02 03 04 05 06 07 08 09 | | -220: 0a 0b 0c 0d 0e 0f | | - -tf: output size = 0x236 -000: 03 02 00 03 61 62 63 31 32 33 64 65 66 34 35 36 | abc123def456| -010: 00 00 00 00 00 00 00 00 00 01 02 03 04 05 00 01 | | -020: 02 03 04 05 00 00 69 54 ba b7 b9 00 7e 1f 4e 43 | iT ~ NC| -030: 6b 6e c0 b7 5a bb e1 6a 7d 8b f6 41 9e fb 7e c1 |kn Z j} A ~ | -040: a8 6c 67 6b c7 27 17 32 9b 89 f2 5d 1d 67 49 de | lgk ' 2 ] gI | -050: ab 5c d4 b7 a1 97 99 76 7d 90 8d 2c 7c 0d 65 66 | \ v} ,| ef| -060: d5 7f 1a 3b bf 0c 52 b3 42 0d c8 c8 0d 62 8e 4b | ; R B b K| -070: 98 7b bc 0d 9c db bf 61 dc 9d 9f 44 a4 fc 8d 1a | { a D | -080: 70 f0 14 87 89 0e 4a b8 7e 66 72 7a 04 6e 9b 17 |p J ~frz n | -090: e1 2c 06 ce 52 04 2a a0 0f 7f 76 f4 5c c5 e2 09 | , R * v \ | -0a0: f6 35 ff ad 87 ab 72 5a 6f bc 61 78 f6 3c 48 e2 | 5 rZo ax | -1a0: a7 fc d2 83 5b 61 b1 e0 fd 28 d1 ec 65 a2 cf 6c | [a ( e l| -1b0: ef 3b ad cc 75 e3 f9 71 0f 90 71 a6 bc 1a d5 17 | ; u q q | -1c0: 65 64 3e 0c d2 c8 de bd 1f d5 af 84 fc fe aa bd |ed> | -1d0: c5 88 13 af 09 ee 8c c0 38 49 79 09 a7 7a 01 48 | 8Iy z H| -1e0: 2e 3e 9a 38 1b c6 b8 c0 a9 4e 61 0f 19 2a 95 84 |.> 8 Na * | -1f0: 3b 53 1c db 9a ec af 8f 2d af 73 d5 cc 71 bd 42 |;S - s q B| -200: 4f e2 70 ca 45 b6 44 18 54 fe 6b 23 31 ba f4 b1 |O p E D T k#1 | -210: 02 a1 26 4f f1 a9 c0 78 e6 3b 11 9e d6 3c 61 e5 | &O x ; e 9 | -150: c2 4c 3d 3e 73 a7 15 fc 28 6c a6 e5 8b 16 bd c9 | L=>s (l | -160: e2 c9 5e d9 64 8e bc f5 92 a4 e5 74 04 cb 9c 90 | ^ d t | -170: 0c 10 28 5f 30 10 61 b7 44 50 b1 f9 3e 21 a1 41 | (_0 a DP >! A| -180: c2 e2 a5 e9 f7 33 16 52 32 61 d1 a3 c5 0b 61 d4 | 3 R2a a | -190: 53 0f 65 a8 d9 e1 fb e1 9b 1b 61 16 d1 75 0a 4b |S e a u K| -1a0: 9a 9f d1 f3 4e f6 ca b2 a2 24 50 8b 10 4d 45 54 | N $P MET| -1b0: 3d e1 c2 8f 07 52 67 52 7e d1 7f 99 3c 4e de eb |= RgR~ g|[2 6. | -080: 74 50 9f a3 de 38 4e c7 ca 6b 35 7c 1b 4e 39 ea |tP 8N k5| N9 | -090: 5f e2 8a 80 d9 58 6e 14 32 bf 8e e9 a2 b0 19 8a |_ Xn 2 | -0a0: e1 1d da fa 3f 4a b7 1c 03 e0 e3 17 85 54 84 c8 | ?J T | -0b0: 3e 90 8e 85 5b e7 12 3d 73 9e b9 ef 7e 48 c0 55 |> [ =s ~H U| -0c0: 59 28 29 f4 d1 12 62 b3 b3 db 65 0a 6c 8c 44 be |Y() b e l D | -0d0: e2 76 49 e6 b6 4a 9e 7e 9c 49 c9 10 d3 dc 85 33 | vI J ~ I 3| -0e0: fe eb a5 dc 5e 18 cf dc 9a 99 da bc 5c 9f c1 ff | ^ \ | -0f0: 9c 92 3b a9 9d d6 5d 03 f4 f3 5e a9 52 21 d2 d0 | ; ] ^ R! | -100: 8b 4e 8a b6 06 af 4e 34 98 e2 bc 9b c2 f1 9d 72 | N N4 r| -110: f8 0f f3 d5 83 34 7d 47 fe bf 6c 1d c2 d3 89 a4 | 4}G l | -120: ff 5b 76 3c cb 9b 4d 09 a6 3a a2 2f 0b 8d 7a 34 | [v< M : / z4| -130: 12 d5 73 c4 bc ba 13 76 e7 69 50 6d 50 ab 76 b5 | s v iPmP v | -140: a6 fb b4 fb c7 98 3d ac ce e1 e1 98 97 9f 24 98 | = $ | -150: 90 82 61 00 38 57 b0 36 7d 55 a7 70 9c ee 51 26 | a 8W 6}U p Q&| -160: 47 02 4f b5 fe cc 2c e0 07 c6 7b 04 6d a1 89 dc |G O , { m | -170: e8 98 71 fd 27 54 d1 f1 2d 0b 3e 64 ef 02 74 71 | q 'T - >d tq| -180: db f5 b1 84 87 6d c9 37 c5 c3 3a de ea 1b 53 d3 | m 7 : S | -190: f1 ed 8f 24 2d 74 a3 77 23 20 9b 75 c3 f2 ef 4a | $-t w# u J| -1a0: 75 ec d3 86 59 11 c5 fc b0 ed 79 b0 8e a8 03 c8 |u Y y | -1b0: 3e 05 db b0 65 62 53 e5 ef e7 95 88 ce 62 89 7a |> ebS b z| -1c0: 9d 3c bc ea a4 3a f6 df 1d 10 8a a3 80 7c 3b 80 | < : |; | -1d0: be 0a 27 76 2b bc 7d 02 98 bf b7 5e 4a 4c 53 df | 'v+ } ^JLS | -1e0: 57 ff 67 7e 33 6a 00 4c ff d6 c0 ff 3f 1c 24 f7 |W g~3j L ? $ | -1f0: fb fd 3b d2 4f 18 e3 9d 62 5b 9b 15 68 13 44 d8 | ; O b[ h D | -200: 71 79 9d b1 ab 2f bd f3 44 6b 77 96 b8 44 bc 90 |qy / Dkw D | -210: 1f 74 db d2 73 7d 5d 44 f7 a6 92 4e fa 24 e3 92 | t s}]D N $ | -220: c8 34 c7 1d 16 8b f5 80 d9 15 48 24 12 16 14 76 | 4 H$ v| -230: 15 5f d0 dc 1e 9c | _ | - -speck: output size = 0x236 -000: 03 02 00 03 61 62 63 31 32 33 64 65 66 34 35 36 | abc123def456| -010: 00 00 00 00 00 00 00 00 00 01 02 03 04 05 00 01 | | -020: 02 03 04 05 00 00 69 c2 17 4a ab 55 f3 8d 44 17 | i J U D | -030: 2c 31 09 b5 b0 2f 0c 87 f2 05 13 59 34 49 72 45 |,1 / Y4IrE| -040: 2c 79 51 cf 39 f5 ce 0e b9 fc c8 41 31 08 e9 a5 |,yQ 9 A1 | -050: 54 3c aa 77 aa 29 10 41 4a 16 4b e9 89 8f 92 7b |T< w ) AJ K {| -060: 29 b3 0b 4b 84 92 2a 3a fe bd c0 50 75 fc a4 7e |) K *: Pu ~| -070: 4e 20 2e 3b 53 eb d1 37 43 35 b6 5e 55 a6 5e 0e |N .;S 7C5 ^U ^ | -080: e3 05 db 07 5f a8 74 4d 9f 41 ed 5f 44 93 98 9b | _ tM A _D | -090: fb 48 3c 9c 36 8b a6 71 ed ee f4 e6 10 21 b1 b5 | H< 6 q ! | -0a0: f4 b7 28 db d5 5d 43 3d 4b 8d 1a 33 cf c5 54 09 | ( ]C=K 3 T | -0b0: b6 9d f5 f2 27 2f e7 be dd 4c 3c 5c c8 71 ca 71 | '/ L<\ q q| -0c0: 8c 47 37 21 6c ad 3f d6 9a 99 ab 18 fc d8 1b c7 | G7!l ? | -0d0: 72 c2 7d fb 57 8c 97 4f 77 4c 6c 94 4a ab f4 94 |r } W OwLl J | -0e0: d8 e3 02 e2 b9 bf 12 47 fb 53 aa b8 4a 93 38 c6 | G S J 8 | -0f0: bb 8b 27 8b d6 db f3 e4 e3 43 7e 7f 83 cf c9 df | ' C~ | -100: e5 71 b9 80 9c ad 38 e5 10 aa 99 ad e1 0d 34 6f | q 8 4o| -110: de 7e ff 29 cc fe b5 89 49 a9 a1 b5 9e 9f be 5e | ~ ) I ^| -120: e6 d2 74 2c 57 91 86 40 02 a0 7b 6b 42 6e b0 63 | t,W @ {kBn c| -130: 0e 04 19 7c f0 e5 ff 3d db de e3 c5 fc 70 18 7d | | = p }| -140: 06 33 7e 6a bb 46 3b 94 28 85 87 51 9f 6e 95 22 | 3~j F; ( Q n "| -150: 99 b4 34 bd 29 94 3a a8 a4 ff 5b 19 53 69 cb e5 | 4 ) : [ Si | -160: a6 0c 41 c5 22 89 82 a7 a5 f3 f3 49 ed 5d ce f3 | A " I ] | -170: a7 ee 77 dd a9 aa 26 5b 85 ec b1 6e f4 33 a0 b8 | w &[ n 3 | -180: 93 2a 80 6f 3f 5f 0a ff 1b 72 14 5d 4f 1a cc 74 | * o?_ r ]O t| -190: 69 01 da 81 7d 89 4b 0f 68 fe c6 c5 ae 39 86 1d |i } K h 9 | -1a0: ab e3 c7 35 2e 5d a8 3d 56 3e 26 52 74 72 5b f2 | 5.] =V>&Rtr[ | -1b0: 41 1a 7a 04 d9 d0 65 fe 92 c4 b9 be 75 e5 9e e1 |A z e u | -1c0: 8e 52 f4 27 98 44 61 26 7f 6b 96 0c c4 6a a6 6b | R ' Da& k j k| -1d0: 36 66 81 a1 f6 dd ab 2a a7 63 e5 7f 63 67 79 08 |6f * c cgy | -1e0: ba 7b bb 11 12 9c 14 b2 a4 2b 56 66 14 c1 54 c6 | { +Vf T | -1f0: 96 f0 e4 68 8a 5c 11 b6 27 af 61 ef ab 47 9e 7f | h \ ' a G | -200: 76 0e 39 c3 fb 88 94 29 7c 9e 96 9b e5 e1 6b ae |v 9 )| k | -210: 87 03 a4 86 a2 1f 91 cf 90 1c 11 08 57 bc c7 90 | W | -220: 0b c1 51 2e 28 a6 58 96 e2 e7 f2 20 c6 ac 06 05 | Q.( X | -230: 39 75 4a 56 cf f8 |9uJV | - diff --git a/bundles/n2n_ntop_v3/tests/tests-wire.expected b/bundles/n2n_ntop_v3/tests/tests-wire.expected deleted file mode 100644 index e4ba9de5..00000000 --- a/bundles/n2n_ntop_v3/tests/tests-wire.expected +++ /dev/null @@ -1,51 +0,0 @@ -environment: common.ttl = 2 -environment: common.flags = 0 -environment: common.community = "abc123def456z" - -REGISTER: common.pc = 1 -REGISTER: reg.cookie = 0 -REGISTER: reg.srcMac[] = 0:1:2:3:4:5 -REGISTER: reg.dstMac[] = 10:11:12:13:14:15 -REGISTER: reg.dev_addr.net_addr = 0x20212223 -REGISTER: reg.dev_addr.net_bitlen = 25 -REGISTER: reg.dev_desc = "Dummy_Dev_Desc" - -REGISTER: output retval = 0x24 -REGISTER: output idx = 0x3d -000: 03 02 00 01 61 62 63 31 32 33 64 65 66 34 35 36 | abc123def456| -010: 7a 00 00 00 00 00 00 00 00 00 00 00 00 01 02 03 |z | -020: 04 05 10 11 12 13 14 15 20 21 22 23 19 44 75 6d | !"# Dum| -030: 6d 79 5f 44 65 76 5f 44 65 73 63 00 00 |my_Dev_Desc | - -REGISTER_SUPER: common.pc = 5 -REGISTER_SUPER: reg.cookie = 0 -REGISTER_SUPER: reg.edgeMac[] = 20:21:22:23:24:25 -REGISTER_SUPER: reg.dev_addr.net_addr = 0x20212223 -REGISTER_SUPER: reg.dev_addr.net_bitlen = 25 -REGISTER_SUPER: reg.dev_desc = "Dummy_Dev_Desc" -REGISTER_SUPER: reg.auth.scheme = 1 -REGISTER_SUPER: reg.auth.token_size = 16 -REGISTER_SUPER: reg.auth.token[0] = 0xfe -REGISTER_SUPER: reg.key_time = 600 - -REGISTER_SUPER: output retval = 0x36 -REGISTER_SUPER: output idx = 0x4f -000: 03 02 00 05 61 62 63 31 32 33 64 65 66 34 35 36 | abc123def456| -010: 7a 00 00 00 00 00 00 00 00 00 00 00 20 21 22 23 |z !"#| -020: 24 25 20 21 22 23 19 44 75 6d 6d 79 5f 44 65 76 |$% !"# Dummy_Dev| -030: 5f 44 65 73 63 00 00 00 01 00 10 fe 00 00 00 fd |_Desc | -040: 00 00 00 fc 00 00 00 00 00 00 fb 00 00 02 58 | X| - -UNREGISTER_SUPER: common.pc = 6 -UNREGISTER_SUPER: unreg.auth.scheme = 1 -UNREGISTER_SUPER: unreg.auth.token_size = 16 -UNREGISTER_SUPER: unreg.auth.token[0] = 0xfe -UNREGISTER_SUPER: unreg.srcMac[] = 30:31:32:33:34:35 - -UNREGISTER_SUPER: output retval = 0x19 -UNREGISTER_SUPER: output idx = 0x32 -000: 03 02 00 06 61 62 63 31 32 33 64 65 66 34 35 36 | abc123def456| -010: 7a 00 00 00 00 00 00 00 00 01 00 10 fe 00 00 00 |z | -020: fd 00 00 00 fc 00 00 00 00 00 00 fb 30 31 32 33 | 0123| -030: 34 35 |45| - diff --git a/bundles/n2n_ntop_v3/tools/Makefile.in b/bundles/n2n_ntop_v3/tools/Makefile.in deleted file mode 100644 index d7bb734a..00000000 --- a/bundles/n2n_ntop_v3/tools/Makefile.in +++ /dev/null @@ -1,42 +0,0 @@ -# -# This is not a standalone makefile, it must be called from the toplevel -# makefile to inherit the correct environment - -DEBUG?=-g3 - -HEADERS=$(wildcard include/*.h) -CFLAGS+=-I../include -ifeq ($(CONFIG_TARGET),mingw) -CFLAGS+=-I../win32 -endif -CFLAGS+=$(DEBUG) -LDFLAGS+=-L.. - -N2N_LIB=../libn2n.a - -TOOLS=n2n-benchmark n2n-keygen -TOOLS+=@ADDITIONAL_TOOLS@ - -TESTS=tests-compress tests-elliptic tests-hashing tests-transform -TESTS+=tests-wire - -.PHONY: all clean install -all: $(TOOLS) $(TESTS) - -n2n-benchmark.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile -n2n-keygen.o: $(N2N_LIB) $(HEADERS) ../Makefile Makefile - -n2n-decode: n2n-decode.c $(N2N_LIB) $(HEADERS) ../Makefile Makefile - $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDLIBS) -lpcap -o $@ - -# See comments in the topdir Makefile about how to generate coverage -# data. -gcov: - gcov $(TOOLS) $(TESTS) - -clean: - rm -rf $(TOOLS) *.o *.dSYM *~ - rm -f $(TESTS) *.gcno *.gcda - -install: $(TOOLS) - $(INSTALL_PROG) $(TOOLS) $(SBINDIR)/ diff --git a/bundles/n2n_ntop_v3/tools/n2n-benchmark.c b/bundles/n2n_ntop_v3/tools/n2n-benchmark.c deleted file mode 100644 index 13bf7c07..00000000 --- a/bundles/n2n_ntop_v3/tools/n2n-benchmark.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - -#ifndef _MSC_VER -/* MinGW has undefined function gettimeofday() warnings without this header - * but Visual C++ doesnt even have the header */ -#include -#endif - -#include "n2n.h" - -#define DURATION 2.5 // test duration per algorithm -#define PACKETS_BEFORE_GETTIME 2047 // do not check time after every packet but after (2 ^ n - 1) - -/* heap allocation for compression as per lzo example doc */ -#define HEAP_ALLOC(var,size) lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ] -static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS); - - -uint8_t PKT_CONTENT[]={ - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }; - -/* Prototypes */ -static ssize_t do_encode_packet( uint8_t * pktbuf, size_t bufsize, const n2n_community_t c ); -static void run_transop_benchmark(const char *op_name, n2n_trans_op_t *op_fn, n2n_edge_conf_t *conf, uint8_t *pktbuf); -static void init_compression_for_benchmark(void); -static void deinit_compression_for_benchmark(void); -static void run_compression_benchmark(void); -static void run_hashing_benchmark(void); -static void run_ecc_benchmark(void); - - -int main(int argc, char * argv[]) { - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - n2n_trans_op_t transop_null, transop_tf; - n2n_trans_op_t transop_aes; - n2n_trans_op_t transop_cc20; - - n2n_trans_op_t transop_speck; - n2n_edge_conf_t conf; - - print_n2n_version(); - - /* Init configuration */ - edge_init_conf_defaults(&conf); - strncpy((char*)conf.community_name, "abc123def456", sizeof(conf.community_name)); - conf.encrypt_key = "SoMEVer!S$cUREPassWORD"; - - pearson_hash_init(); - - /* Init transopts */ - n2n_transop_null_init(&conf, &transop_null); - n2n_transop_tf_init(&conf, &transop_tf); - n2n_transop_aes_init(&conf, &transop_aes); - n2n_transop_cc20_init(&conf, &transop_cc20); - n2n_transop_speck_init(&conf, &transop_speck); - - /* Run the tests */ - run_transop_benchmark("null", &transop_null, &conf, pktbuf); - run_transop_benchmark("tf", &transop_tf, &conf, pktbuf); - run_transop_benchmark("aes", &transop_aes, &conf, pktbuf); - run_transop_benchmark("cc20", &transop_cc20, &conf, pktbuf); - run_transop_benchmark("speck", &transop_speck, &conf, pktbuf); - - run_ecc_benchmark(); - - /* Also for compression (init moved here for ciphers get run before in case of lzo init error) */ - init_compression_for_benchmark(); - run_compression_benchmark(); - - run_hashing_benchmark(); - - - /* Cleanup */ - transop_null.deinit(&transop_null); - transop_tf.deinit(&transop_tf); - transop_aes.deinit(&transop_aes); - transop_cc20.deinit(&transop_cc20); - transop_speck.deinit(&transop_speck); - - deinit_compression_for_benchmark(); - - return 0; -} - -// --- compression benchmark -------------------------------------------------------------- - -static void init_compression_for_benchmark(void) { - - if(lzo_init() != LZO_E_OK) { - traceEvent(TRACE_ERROR, "LZO compression init error"); - exit(1); - } - -#ifdef N2N_HAVE_ZSTD - // zstd does not require initialization. if it were required, this would be a good place -#endif -} - - -static void deinit_compression_for_benchmark(void) { - - // lzo1x does not require de-initialization. if it were required, this would be a good place - -#ifdef N2N_HAVE_ZSTD - // zstd does not require de-initialization. if it were required, this would be a good place -#endif -} - - -static void run_compression_benchmark() { - const float target_sec = DURATION; - struct timeval t1; - struct timeval t2; - ssize_t target_usec = target_sec * 1e6; - ssize_t tdiff; // microseconds - size_t num_packets; - float mpps; - uint8_t compression_buffer[N2N_PKT_BUF_SIZE]; // size allows enough of a reserve required for compression - lzo_uint compression_len = N2N_PKT_BUF_SIZE; - uint8_t deflation_buffer[N2N_PKT_BUF_SIZE]; - int64_t deflated_len; - - // compression - printf("{%s}\t%s\t%.1f sec\t(%u bytes)", - "lzo1x", "compr", target_sec, (unsigned int)sizeof(PKT_CONTENT)); - fflush(stdout); - tdiff = 0; - num_packets = 0; - gettimeofday( &t1, NULL ); - - while(tdiff < target_usec) { - compression_len = N2N_PKT_BUF_SIZE; - if(lzo1x_1_compress(PKT_CONTENT, sizeof(PKT_CONTENT), compression_buffer, &compression_len, wrkmem) != LZO_E_OK) { - printf("\n\t compression error\n"); - exit(1); - } - num_packets++; - if (!(num_packets & PACKETS_BEFORE_GETTIME)) { - gettimeofday( &t2, NULL ); - tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec); - } - } - mpps = num_packets / (tdiff / 1e6) / 1e6; - printf(" ---> (%u bytes)\t%12u packets\t%8.1f Kpps\t%8.1f MB/s\n", - (unsigned int)compression_len, (unsigned int)num_packets, mpps * 1e3, mpps * sizeof(PKT_CONTENT)); - - // decompression - printf("\t%s\t%.1f sec\t(%u bytes)", - "decompr", target_sec, (unsigned int)sizeof(PKT_CONTENT)); - fflush(stdout); - tdiff = 0; - num_packets = 0; - gettimeofday( &t1, NULL ); - - while(tdiff < target_usec) { - deflated_len = N2N_PKT_BUF_SIZE; - lzo1x_decompress (compression_buffer, compression_len, deflation_buffer, (lzo_uint*)&deflated_len, NULL); - num_packets++; - if (!(num_packets & PACKETS_BEFORE_GETTIME)) { - gettimeofday( &t2, NULL ); - tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec); - } - } - mpps = num_packets / (tdiff / 1e6) / 1e6; - printf(" <--- (%u bytes)\t%12u packets\t%8.1f Kpps\t%8.1f MB/s\n", - (unsigned int)compression_len, (unsigned int)num_packets, mpps * 1e3, mpps * sizeof(PKT_CONTENT)); - if(memcmp(deflation_buffer, PKT_CONTENT, sizeof(PKT_CONTENT)) != 0) - printf("\n\tdecompression error\n"); - printf ("\n"); - -#ifdef N2N_HAVE_ZSTD - // compression - printf("{%s}\t%s\t%.1f sec\t(%u bytes)", - "zstd", "compr", target_sec, (unsigned int)sizeof(PKT_CONTENT)); - fflush(stdout); - tdiff = 0; - num_packets = 0; - gettimeofday( &t1, NULL ); - while(tdiff < target_usec) { - compression_len = N2N_PKT_BUF_SIZE; - compression_len = ZSTD_compress(compression_buffer, compression_len, PKT_CONTENT, sizeof(PKT_CONTENT), ZSTD_COMPRESSION_LEVEL) ; - if(ZSTD_isError(compression_len)) { - printf("\n\t compression error\n"); - exit(1); - } - num_packets++; - if (!(num_packets & PACKETS_BEFORE_GETTIME)) { - gettimeofday( &t2, NULL ); - tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec); - } - } - mpps = num_packets / (tdiff / 1e6) / 1e6; - printf(" ---> (%u bytes)\t%12u packets\t%8.1f Kpps\t%8.1f MB/s\n", - (unsigned int)compression_len, (unsigned int)num_packets, mpps * 1e3, mpps * sizeof(PKT_CONTENT)); - - // decompression - printf("\t%s\t%.1f sec\t(%u bytes)", - "decompr", target_sec, (unsigned int)sizeof(PKT_CONTENT)); - fflush(stdout); - tdiff = 0; - num_packets = 0; - gettimeofday( &t1, NULL ); - while(tdiff < target_usec) { - deflated_len = N2N_PKT_BUF_SIZE; - deflated_len = (int32_t)ZSTD_decompress (deflation_buffer, deflated_len, compression_buffer, compression_len); - if(ZSTD_isError(deflated_len)) { - printf("\n\tdecompression error '%s'\n", - ZSTD_getErrorName(deflated_len)); - exit(1); - } - num_packets++; - if (!(num_packets & PACKETS_BEFORE_GETTIME)) { - gettimeofday( &t2, NULL ); - tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec); - } - } - mpps = num_packets / (tdiff / 1e6) / 1e6; - printf(" <--- (%u bytes)\t%12u packets\t%8.1f Kpps\t%8.1f MB/s\n", - (unsigned int)compression_len, (unsigned int)num_packets, mpps * 1e3, mpps * sizeof(PKT_CONTENT)); - if(memcmp(deflation_buffer, PKT_CONTENT, sizeof(PKT_CONTENT)) != 0) - printf("\n\tdecompression error\n"); - printf ("\n"); -#endif -} - -// --- hashing benchmark ------------------------------------------------------------------ - -static void run_hashing_benchmark(void) { - const float target_sec = DURATION; - struct timeval t1; - struct timeval t2; - ssize_t nw; - ssize_t target_usec = target_sec * 1e6; - ssize_t tdiff = 0; // microseconds - size_t num_packets = 0; - - uint64_t hash; - - printf("(%s)\t%s\t%.1f sec\t(%u bytes)", - "prs64", "hash", target_sec, (unsigned int)sizeof(PKT_CONTENT)); - fflush(stdout); - - gettimeofday( &t1, NULL ); - nw = 8; - - while(tdiff < target_usec) { - hash = pearson_hash_64(PKT_CONTENT, sizeof(PKT_CONTENT)); - hash++; // clever compiler finds out that we do no use the variable - num_packets++; - if (!(num_packets & PACKETS_BEFORE_GETTIME)) { - gettimeofday( &t2, NULL ); - tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec); - } - } - - float mpps = num_packets / (tdiff / 1e6) / 1e6; - - printf(" ---> (%u bytes)\t%12u packets\t%8.1f Kpps\t%8.1f MB/s\n", - (unsigned int)nw, (unsigned int)num_packets, mpps * 1e3, mpps * sizeof(PKT_CONTENT)); - printf("\n"); -} - -// --- ecc benchmark ---------------------------------------------------------------------- - -static void run_ecc_benchmark(void) { - const float target_sec = DURATION; - struct timeval t1; - struct timeval t2; - ssize_t nw; - ssize_t target_usec = target_sec * 1e6; - ssize_t tdiff = 0; // microseconds - size_t num_packets = 0; - - unsigned char b[32]; - unsigned char k[32]; - - memset(b, 0x00, 31); - b[31] = 9; - - memset(k, 0x55, 32); - - printf("[%s]\t%s\t%.1f sec\t(%u bytes) ", - "curve", "25519", target_sec, 32); - fflush(stdout); - - gettimeofday( &t1, NULL ); - nw = 32; - - while(tdiff < target_usec) { - curve25519(b, k, b); - num_packets++; - gettimeofday( &t2, NULL ); - tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec); - } - - float mpps = num_packets / (tdiff / 1e6) / 1e6; - - printf(" ---> (%u bytes)\t%12u ops\t%8.1f Kops/s\n", - (unsigned int)nw, (unsigned int)num_packets, mpps * 1e3); - printf("\n"); -} - -// --- cipher benchmark ------------------------------------------------------------------- - -static void run_transop_benchmark(const char *op_name, n2n_trans_op_t *op_fn, n2n_edge_conf_t *conf, uint8_t *pktbuf) { - n2n_common_t cmn; - n2n_PACKET_t pkt; - n2n_mac_t mac_buf; - uint8_t decodebuf[N2N_PKT_BUF_SIZE]; - const float target_sec = DURATION; - struct timeval t1; - struct timeval t2; - size_t idx; - size_t rem; - size_t nw; - ssize_t target_usec = target_sec * 1e6; - ssize_t tdiff; // microseconds - size_t num_packets; - float mpps; - - // encryption - printf("[%s]\t%s\t%.1f sec\t(%u bytes)", - op_name, "encrypt" , target_sec, (unsigned int)sizeof(PKT_CONTENT)); - fflush(stdout); - memset(mac_buf, 0, sizeof(mac_buf)); - num_packets = 0; - tdiff = 0; - gettimeofday( &t1, NULL ); - while(tdiff < target_usec) { - nw = do_encode_packet( pktbuf, N2N_PKT_BUF_SIZE, conf->community_name); - nw += op_fn->fwd(op_fn, - pktbuf+nw, N2N_PKT_BUF_SIZE-nw, - PKT_CONTENT, sizeof(PKT_CONTENT), mac_buf); - num_packets++; - if (!(num_packets & PACKETS_BEFORE_GETTIME)) { - gettimeofday( &t2, NULL ); - tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec); - } - } - mpps = num_packets / (tdiff / 1e6) / 1e6; - printf(" ---> (%u bytes)\t%12u packets\t%8.1f Kpps\t%8.1f MB/s\n", - (unsigned int)nw, (unsigned int)num_packets, mpps * 1e3, mpps * sizeof(PKT_CONTENT)); - - // decrpytion - printf("\t%s\t%.1f sec\t(%u bytes)", - "decrypt" , target_sec, (unsigned int)sizeof(PKT_CONTENT)); - fflush(stdout); - num_packets = 0; - tdiff = 0; - gettimeofday( &t1, NULL ); - while(tdiff < target_usec) { - idx=0; - rem=nw; - decode_common( &cmn, pktbuf, &rem, &idx); - decode_PACKET( &pkt, &cmn, pktbuf, &rem, &idx ); - op_fn->rev(op_fn, decodebuf, N2N_PKT_BUF_SIZE, pktbuf+idx, rem, 0); - num_packets++; - if (!(num_packets & PACKETS_BEFORE_GETTIME)) { - gettimeofday( &t2, NULL ); - tdiff = ((t2.tv_sec - t1.tv_sec) * 1000000) + (t2.tv_usec - t1.tv_usec); - } - } - mpps = num_packets / (tdiff / 1e6) / 1e6; - printf(" <--- (%u bytes)\t%12u packets\t%8.1f Kpps\t%8.1f MB/s\n", - (unsigned int)nw, (unsigned int)num_packets, mpps * 1e3, mpps * sizeof(PKT_CONTENT)); - if(memcmp(decodebuf, PKT_CONTENT, sizeof(PKT_CONTENT)) != 0) - printf("\tpayload decryption failed!\n"); - printf("\n"); -} - - -static ssize_t do_encode_packet( uint8_t * pktbuf, size_t bufsize, const n2n_community_t c ) -{ - n2n_mac_t destMac={0,1,2,3,4,5}; - n2n_common_t cmn; - n2n_PACKET_t pkt; - size_t idx; - - - memset( &cmn, 0, sizeof(cmn) ); - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_packet; - cmn.flags=0; /* no options, not from supernode, no socket */ - memcpy( cmn.community, c, N2N_COMMUNITY_SIZE ); - - memset( &pkt, 0, sizeof(pkt) ); - memcpy( pkt.srcMac, destMac, N2N_MAC_SIZE); - memcpy( pkt.dstMac, destMac, N2N_MAC_SIZE); - - pkt.sock.family=0; /* do not encode sock */ - - idx=0; - encode_PACKET( pktbuf, &idx, &cmn, &pkt ); - traceEvent( TRACE_DEBUG, "encoded PACKET header of size=%u", (unsigned int)idx ); - - return idx; -} diff --git a/bundles/n2n_ntop_v3/tools/n2n-decode.c b/bundles/n2n_ntop_v3/tools/n2n-decode.c deleted file mode 100644 index e0c9a9ad..00000000 --- a/bundles/n2n_ntop_v3/tools/n2n-decode.c +++ /dev/null @@ -1,371 +0,0 @@ -/** - * (C) 2019-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not see see - * - */ - -#include -#include "n2n.h" - -#define SNAPLEN 1500 -#define TIMEOUT 200 - -/* *************************************************** */ - -static int aes_mode = 0; -static int running = 1; -static char *ifname = NULL; -static n2n_edge_conf_t conf; -static n2n_trans_op_t transop; -static pcap_t *handle; -static pcap_dumper_t *dumper; - -/* *************************************************** */ - -static void help() { - fprintf(stderr, "n2n-decode -i ifname -k key -c community [-B bpf] [-w fname] [-v]" -#ifdef N2N_HAVE_AES - " [-A]" -#endif - "\n"); - fprintf(stderr, "-i | Specify the capture interface name.\n"); - fprintf(stderr, "-c | Specify the community.\n"); - fprintf(stderr, "-k | Specify the encryption key.\n"); -#ifdef N2N_HAVE_AES - fprintf(stderr, "-A | Use AES decryption (default=use twofish).\n"); -#endif - fprintf(stderr, "-B | Use set a BPF filter for the capture.\n"); - fprintf(stderr, "-w | Write decoded PCAP to file.\n"); - fprintf(stderr, "-v | Increase verbosity level.\n"); - - exit(0); -} - -/* *************************************************** */ - -#ifdef WIN32 -BOOL WINAPI term_handler(DWORD sig) -#else -static void term_handler(int sig) -#endif -{ - static int called = 0; - - if(called) { - traceEvent(TRACE_NORMAL, "Ok I am leaving now"); - _exit(0); - } else { - traceEvent(TRACE_NORMAL, "Shutting down..."); - called = 1; - } - - running = 0; -#ifdef WIN32 - return(TRUE); -#endif -} - -/* *************************************************** */ - -static void write_packet(const u_char *packet, struct pcap_pkthdr *hdr) { - pcap_dump((unsigned char*)dumper, hdr, packet); - pcap_dump_flush(dumper); -} - -/* *************************************************** */ - -static int decode_encrypted_packet(const u_char *packet, struct pcap_pkthdr *header, - n2n_PACKET_t *pkt, int encrypted_offset) { - uint8_t decoded_packet[encrypted_offset + N2N_PKT_BUF_SIZE]; - int decoded_eth_size; - int transop_shift; - - switch(pkt->transform) { - case N2N_TRANSFORM_ID_NULL: - /* Not encrypted, dump it */ - write_packet(packet, header); - break; - case N2N_TRANSFORM_ID_TWOFISH: - if(aes_mode) { - traceEvent(TRACE_INFO, "Skipping twofish encrypted packet"); - return(-1); - } - break; - case N2N_TRANSFORM_ID_AES: - if(!aes_mode) { - traceEvent(TRACE_INFO, "Skipping AES encrypted packet"); - return(-1); - } - break; - default: - traceEvent(TRACE_INFO, "Skipping unknown transform packet: %d", pkt->transform); - return(-2); - } - - decoded_eth_size = transop.rev(&transop, decoded_packet+encrypted_offset, N2N_PKT_BUF_SIZE, packet + encrypted_offset, - header->caplen - encrypted_offset, pkt->srcMac); - - transop_shift = (header->caplen - encrypted_offset) - decoded_eth_size; - - if(transop_shift >= 0) { - int transform_id_offset = encrypted_offset - 2; - - /* Copy the initial part of the packet */ - memcpy(decoded_packet, packet, encrypted_offset); - - /* Change the packet transform to NULL as there is now plaintext data */ - *((u_int16_t*)(decoded_packet + transform_id_offset)) = htons(N2N_TRANSFORM_ID_NULL); - - // TODO fix IP and UDP chechsums - write_packet(decoded_packet, header); - return(0); - } - - traceEvent(TRACE_INFO, "Something was wrong in the decoding"); - return(-3); -} - -/* *************************************************** */ - -#define ETH_SIZE 14 -#define UDP_SIZE 8 -#define MIN_IP_SIZE 20 -#define MIN_LEN (ETH_SIZE + UDP_SIZE + MIN_IP_SIZE + sizeof(n2n_common_t)) - -static int run_packet_loop() { - struct pcap_pkthdr header; - const u_char *packet; - - traceEvent(TRACE_NORMAL, "Capturing packets on %s...", ifname); - - while(running) { - n2n_common_t common; - n2n_PACKET_t pkt; - uint ipsize, common_offset; - size_t idx, rem; - - memset(&common, 0, sizeof(common)); - memset(&pkt, 0, sizeof(pkt)); - - packet = pcap_next(handle, &header); - - if(!packet) - continue; - - if(header.caplen < MIN_LEN) { - traceEvent(TRACE_INFO, "Skipping packet too small: size=%d", header.caplen); - continue; - } - - if(ntohs(*(uint16_t*)(packet + 12)) != 0x0800) { - traceEvent(TRACE_INFO, "Skipping non IPv4 packet"); - continue; - } - - if(packet[ETH_SIZE + 9] != IPPROTO_UDP) { - traceEvent(TRACE_INFO, "Skipping non UDP packet"); - continue; - } - - ipsize = (packet[ETH_SIZE] & 0x0F) * 4; - common_offset = ETH_SIZE + ipsize + UDP_SIZE; - - idx = common_offset; - rem = header.caplen - idx; - - if(decode_common(&common, packet, &rem, &idx) == -1) { - traceEvent(TRACE_INFO, "Skipping packet, decode common failed"); - continue; - } - - if(strncmp((char*)conf.community_name, (char*)common.community, N2N_COMMUNITY_SIZE) != 0) { - traceEvent(TRACE_INFO, "Skipping packet with non-matching community"); - continue; - } - - switch(common.pc) { - case n2n_ping: - case n2n_register: - case n2n_deregister: - case n2n_register_ack: - case n2n_register_super: - case n2n_register_super_ack: - case n2n_register_super_nak: - case n2n_federation: - case n2n_peer_info: - case n2n_query_peer: - write_packet(packet, &header); - break; - case n2n_packet: - decode_PACKET(&pkt, &common, packet, &rem, &idx); - decode_encrypted_packet(packet, &header, &pkt, idx); - break; - default: - traceEvent(TRACE_INFO, "Skipping packet with unknown type: %d", common.pc); - continue; - } - } - - return(0); -} - -/* *************************************************** */ - -int main(int argc, char* argv[]) { - u_char c; - struct bpf_program fcode; - char *bpf_filter = NULL, *out_fname = NULL; - char errbuf[PCAP_ERRBUF_SIZE]; - int rv = 0; - FILE *outf = stdout; - - /* Trace to stderr to leave stdout for the PCAP dump if "-w -" is used */ - setTraceFile(stderr); - - /* Init configuration */ - edge_init_conf_defaults(&conf); - - while((c = getopt(argc, argv, - "k:i:B:w:c:v" -#ifdef N2N_HAVE_AES - "A" -#endif - )) != '?') { - if(c == 255) break; - - switch(c) { - case 'c': - strncpy((char*)conf.community_name, optarg, sizeof(conf.community_name)-1); - break; - case 'i': - ifname = strdup(optarg); - break; - case 'k': - conf.encrypt_key = strdup(optarg); - break; - case 'B': - bpf_filter = strdup(optarg); - break; -#ifdef N2N_HAVE_AES - case 'A': - aes_mode = 1; - break; -#endif - case 'w': - if(strcmp(optarg, "-") != 0) - out_fname = strdup(optarg); - break; - case 'v': /* verbose */ - setTraceLevel(getTraceLevel() + 1); - break; - default: - help(); - } - } - - if((ifname == NULL) || (conf.encrypt_key == NULL) || (conf.community_name[0] == '\0')) - help(); - -#ifdef N2N_HAVE_AES - if(aes_mode) - n2n_transop_aes_init(&conf, &transop); - else -#endif - n2n_transop_tf_init(&conf, &transop); - - if((handle = pcap_create(ifname, errbuf)) == NULL) { - traceEvent(TRACE_ERROR, "Cannot open device %s: %s", ifname, errbuf); - return(1); - } - - if((pcap_set_timeout(handle, TIMEOUT) != 0) || - (pcap_set_snaplen(handle, SNAPLEN) != 0)) { - traceEvent(TRACE_ERROR, "Error while setting timeout/snaplen"); - return(1); - } - -#ifdef HAVE_PCAP_IMMEDIATE_MODE - /* The timeout is not honored unless immediate mode is set. - * See https://github.com/mfontanini/libtins/issues/180 */ - if(pcap_set_immediate_mode(handle, 1) != 0) { - traceEvent(TRACE_ERROR, "Could not set PCAP immediate mode"); - return(1); - } -#endif - - if(pcap_activate(handle) != 0) { - traceEvent(TRACE_ERROR, "pcap_activate failed: %s", pcap_geterr(handle)); - } - - if(pcap_datalink(handle) != DLT_EN10MB) { - traceEvent(TRACE_ERROR, "Device %s doesn't provide Ethernet headers - not supported", ifname); - return(2); - } - - if(bpf_filter) { - bpf_u_int32 net, mask; - - if(pcap_lookupnet(ifname, &net, &mask, errbuf) == -1) { - traceEvent(TRACE_WARNING, "Couldn't get netmask for device %s: %s", ifname, errbuf); - net = 0; - mask = 0; - } - - if((pcap_compile(handle, &fcode, bpf_filter, 1, net) < 0) - || (pcap_setfilter(handle, &fcode) < 0)) { - traceEvent(TRACE_ERROR, "Could not set BPF filter: %s", pcap_geterr(handle)); - return(3); - } - } - - if(out_fname) { - outf = fopen(out_fname, "wb"); - - if(outf == NULL) { - traceEvent(TRACE_ERROR, "Could not open %s for write[%d]: %s", errno, strerror(errno)); - return(4); - } - } - - dumper = pcap_dump_fopen(handle, outf); - - if(dumper == NULL) { - traceEvent(TRACE_ERROR, "Could dump file: %s", pcap_geterr(handle)); - return(5); - } - -#ifdef WIN32 - SetConsoleCtrlHandler(term_handler, TRUE); -#else - signal(SIGTERM, term_handler); - signal(SIGINT, term_handler); -#endif - - rv = run_packet_loop(); - - /* Cleanup */ - pcap_close(handle); - - if(conf.encrypt_key) free(conf.encrypt_key); - if(bpf_filter) free(bpf_filter); - if(ifname) free(ifname); - - if(out_fname) { - fclose(outf); - free(out_fname); - } - - return(rv); -} diff --git a/bundles/n2n_ntop_v3/tools/n2n-keygen.c b/bundles/n2n_ntop_v3/tools/n2n-keygen.c deleted file mode 100644 index 5cc21db9..00000000 --- a/bundles/n2n_ntop_v3/tools/n2n-keygen.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - - -#include "n2n.h" - - -int main(int argc, char * argv[]) { - - n2n_private_public_key_t prv; /* 32 bytes private key */ - n2n_private_public_key_t bin; /* 32 bytes public key binary output buffer */ - char asc[44]; /* 43 bytes + 0-terminator ascii string output */ - uint8_t fed = 0; - - // exactly two parameters required - if(argc != 3) { - // error message to stderr to not interfere with batch usage - fprintf(stderr, "\n" - "n2n-keygen tool\n\n" - " usage: n2n-keygen \n\n" - " or n2n-keygen -F \n\n" - " outputs a line to insert at supernode's community file for user-and-\n" - " password authentication or a command line parameter with the public\n" - " federation key for use at edge's command line, please refer to the\n" - " doc/Authentication.md document or the man pages for more details\n\n"); - return 1; - } - - // federation mode? - if(strcmp(argv[1], "-F") == 0) - fed = 1; - - // derive private key from username and password: - // hash username once, hash password twice (so password is bound - // to username but username and password are not interchangeable), - // finally xor the result - // in federation mode: only hash federation name, twice - generate_private_key(prv, argv[2]); - - // hash user name only if required - if(!fed) { - bind_private_key_to_username(prv, argv[1]); - } - - // calculate the public key into binary output buffer - generate_public_key(bin, prv); - - // clear out the private key - memset(prv, 0, sizeof(prv)); - - // convert binary output to 6-bit-ascii string output - bin_to_ascii(asc, bin, sizeof(bin)); - - // output - if(fed) - fprintf(stdout, "-P %s\n", asc); - else - fprintf(stdout, "%c %s %s\n", N2N_USER_KEY_LINE_STARTER, argv[1], asc); - - return 0; -} diff --git a/bundles/n2n_ntop_v3/tools/tests-compress.c b/bundles/n2n_ntop_v3/tools/tests-compress.c deleted file mode 100644 index f68d5108..00000000 --- a/bundles/n2n_ntop_v3/tools/tests-compress.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - -#include - -#include - -#include "n2n.h" -#include "hexdump.h" - -/* heap allocation for compression as per lzo example doc */ -#define HEAP_ALLOC(var,size) lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ] -static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS); - - -uint8_t PKT_CONTENT[]={ - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 -}; - -static void init_compression_for_benchmark (void) { - - if(lzo_init() != LZO_E_OK) { - traceEvent(TRACE_ERROR, "LZO compression init error"); - exit(1); - } - -#ifdef N2N_HAVE_ZSTD - // zstd does not require initialization. if it were required, this would be a good place -#endif -} - - -static void deinit_compression_for_benchmark (void) { - - // lzo1x does not require de-initialization. if it were required, this would be a good place - -#ifdef N2N_HAVE_ZSTD - // zstd does not require de-initialization. if it were required, this would be a good place -#endif -} - -void test_lzo1x () { - char *test_name = "lzo1x"; - uint8_t compression_buffer[N2N_PKT_BUF_SIZE]; // size allows enough of a reserve required for compression - lzo_uint compression_len = sizeof(compression_buffer); - - if(lzo1x_1_compress(PKT_CONTENT, sizeof(PKT_CONTENT), compression_buffer, &compression_len, wrkmem) != LZO_E_OK) { - fprintf(stderr, "%s: compression error\n", test_name); - exit(1); - } - - assert(compression_len == 47); - - printf("%s: output size = 0x%" PRIx64 "\n", test_name, compression_len); - fhexdump(0, compression_buffer, compression_len, stdout); - - uint8_t deflation_buffer[N2N_PKT_BUF_SIZE]; - lzo_uint deflated_len; - lzo1x_decompress(compression_buffer, compression_len, deflation_buffer, &deflated_len, NULL); - - assert(deflated_len == sizeof(PKT_CONTENT)); - if(memcmp(PKT_CONTENT, deflation_buffer, deflated_len)!=0) { - fprintf(stderr, "%s: round-trip buffer mismatch\n", test_name); - exit(1); - } - - fprintf(stderr, "%s: tested\n", test_name); - printf("\n"); -} - -void test_zstd () { - char *test_name = "zstd"; - -#ifdef N2N_HAVE_ZSTD - uint8_t compression_buffer[N2N_PKT_BUF_SIZE]; // size allows enough of a reserve required for compression - lzo_uint compression_len = sizeof(compression_buffer); - - compression_len = N2N_PKT_BUF_SIZE; - compression_len = ZSTD_compress(compression_buffer, compression_len, PKT_CONTENT, sizeof(PKT_CONTENT), ZSTD_COMPRESSION_LEVEL); - if(ZSTD_isError(compression_len)) { - fprintf(stderr, "%s: compression error\n", test_name); - exit(1); - } - - assert(compression_len == 33); - - printf("%s: output size = 0x%" PRIx64 "\n", test_name, compression_len); - fhexdump(0, compression_buffer, compression_len, stdout); - - uint8_t deflation_buffer[N2N_PKT_BUF_SIZE]; - int64_t deflated_len = sizeof(deflation_buffer); - deflated_len = (int32_t)ZSTD_decompress(deflation_buffer, deflated_len, compression_buffer, compression_len); - if(ZSTD_isError(deflated_len)) { - fprintf(stderr, "%s: decompression error '%s'\n", - test_name, ZSTD_getErrorName(deflated_len)); - exit(1); - } - - assert(deflated_len == sizeof(PKT_CONTENT)); - if(memcmp(PKT_CONTENT, deflation_buffer, deflated_len)!=0) { - fprintf(stderr, "%s: round-trip buffer mismatch\n", test_name); - exit(1); - } - - fprintf(stderr, "%s: tested\n", test_name); -#else - // FIXME - output dummy data to the stdout for easy comparison - printf("zstd: output size = 0x21\n"); - printf("000: 28 b5 2f fd 60 00 01 bd 00 00 80 00 01 02 03 04 |( / ` |\n"); - printf("010: 05 06 07 08 09 0a 0b 0c 0d 0e 0f 01 00 da 47 9d | G |\n"); - printf("020: 4b |K|\n"); - - fprintf(stderr, "%s: not compiled - dummy data output\n", test_name); -#endif - printf("\n"); -} - - -int main (int argc, char * argv[]) { - - /* Also for compression (init moved here for ciphers get run before in case of lzo init error) */ - init_compression_for_benchmark(); - - printf("%s: input size = 0x%" PRIx64 "\n", "original", sizeof(PKT_CONTENT)); - fhexdump(0, PKT_CONTENT, sizeof(PKT_CONTENT), stdout); - printf("\n"); - - test_lzo1x(); - test_zstd(); - - deinit_compression_for_benchmark(); - - return 0; -} - diff --git a/bundles/n2n_ntop_v3/tools/tests-elliptic.c b/bundles/n2n_ntop_v3/tools/tests-elliptic.c deleted file mode 100644 index 3a119bc6..00000000 --- a/bundles/n2n_ntop_v3/tools/tests-elliptic.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - -#include "n2n.h" -#include "hexdump.h" - -void test_curve25519 (unsigned char *pkt_input, unsigned char *key) { - char *test_name = "curve25519"; - unsigned char pkt_output[32]; - - curve25519(pkt_output, key, pkt_input); - - printf("%s: output\n", test_name); - fhexdump(0, pkt_output, sizeof(pkt_output), stdout); - - fprintf(stderr, "%s: tested\n", test_name); - printf("\n"); -} - -int main (int argc, char * argv[]) { - char *test_name = "environment"; - - unsigned char key[32]; - unsigned char pkt_input[32]; - - memset(pkt_input, 0, 31); - pkt_input[31] = 9; - - memset(key, 0x55, 32); - - printf("%s: input\n", test_name); - fhexdump(0, pkt_input, sizeof(pkt_input), stdout); - printf("%s: key\n", test_name); - fhexdump(0, key, sizeof(key), stdout); - printf("\n"); - - test_curve25519(pkt_input, key); - - return 0; -} - diff --git a/bundles/n2n_ntop_v3/tools/tests-hashing.c b/bundles/n2n_ntop_v3/tools/tests-hashing.c deleted file mode 100644 index 51efbeb6..00000000 --- a/bundles/n2n_ntop_v3/tools/tests-hashing.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - -#include - -#include "n2n.h" -#include "hexdump.h" - - -uint8_t PKT_CONTENT[]={ - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 -}; - -void test_pearson (void *buf, unsigned int bufsize) { - char *test_name = "pearson"; - - uint64_t hash = pearson_hash_64(buf, bufsize); - - printf("%s: output = 0x%" PRIx64 "\n", test_name, hash); - - fprintf(stderr, "%s: tested\n", test_name); - printf("\n"); -} - -int main (int argc, char * argv[]) { - pearson_hash_init(); - - char *test_name = "environment"; - printf("%s: input size = 0x%" PRIx64 "\n", test_name, sizeof(PKT_CONTENT)); - fhexdump(0, PKT_CONTENT, sizeof(PKT_CONTENT), stdout); - printf("\n"); - - test_pearson(PKT_CONTENT, sizeof(PKT_CONTENT)); - - return 0; -} - diff --git a/bundles/n2n_ntop_v3/tools/tests-transform.c b/bundles/n2n_ntop_v3/tools/tests-transform.c deleted file mode 100644 index 1ef42b5e..00000000 --- a/bundles/n2n_ntop_v3/tools/tests-transform.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - -#include - -#include "n2n.h" -#include "hexdump.h" - -#define DURATION 2.5 // test duration per algorithm -#define PACKETS_BEFORE_GETTIME 2047 // do not check time after every packet but after (2 ^ n - 1) - - -uint8_t PKT_CONTENT[]={ - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 -}; - -/* Prototypes */ -static ssize_t do_encode_packet ( uint8_t * pktbuf, size_t bufsize, const n2n_community_t c ); -static void run_transop_benchmark (const char *op_name, n2n_trans_op_t *op_fn, n2n_edge_conf_t *conf, uint8_t *pktbuf); - - -int main (int argc, char * argv[]) { - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - n2n_trans_op_t transop_null, transop_tf; - n2n_trans_op_t transop_aes; - n2n_trans_op_t transop_cc20; - - n2n_trans_op_t transop_speck; - n2n_edge_conf_t conf; - - /* Init configuration */ - edge_init_conf_defaults(&conf); - strncpy((char *)conf.community_name, "abc123def456", sizeof(conf.community_name)); - conf.encrypt_key = "SoMEVer!S$cUREPassWORD"; - - char *test_name = "environment"; - printf("%s: community_name = \"%s\"\n", test_name, conf.community_name); - printf("%s: encrypt_key = \"%s\"\n", test_name, conf.encrypt_key); - printf("%s: input size = 0x%" PRIx64 "\n", test_name, sizeof(PKT_CONTENT)); - fhexdump(0, PKT_CONTENT, sizeof(PKT_CONTENT), stdout); - printf("\n"); - - /* Init transopts */ - n2n_transop_null_init(&conf, &transop_null); - n2n_transop_tf_init(&conf, &transop_tf); - n2n_transop_aes_init(&conf, &transop_aes); - n2n_transop_cc20_init(&conf, &transop_cc20); - n2n_transop_speck_init(&conf, &transop_speck); - - /* Run the tests */ - /* FIXME: interop tests are pretty useless without the expected encrypted buffer data */ - run_transop_benchmark("null", &transop_null, &conf, pktbuf); - run_transop_benchmark("tf", &transop_tf, &conf, pktbuf); - run_transop_benchmark("aes", &transop_aes, &conf, pktbuf); - run_transop_benchmark("cc20", &transop_cc20, &conf, pktbuf); - run_transop_benchmark("speck", &transop_speck, &conf, pktbuf); - - /* Cleanup */ - transop_null.deinit(&transop_null); - transop_tf.deinit(&transop_tf); - transop_aes.deinit(&transop_aes); - transop_cc20.deinit(&transop_cc20); - transop_speck.deinit(&transop_speck); - - return 0; -} - -// --- cipher benchmark ------------------------------------------------------------------- - -static void run_transop_benchmark (const char *op_name, n2n_trans_op_t *op_fn, n2n_edge_conf_t *conf, uint8_t *pktbuf) { - n2n_common_t cmn; - n2n_PACKET_t pkt; - n2n_mac_t mac_buf; - uint8_t decodebuf[N2N_PKT_BUF_SIZE]; - size_t idx; - size_t rem; - size_t nw; - - // encryption - memset(mac_buf, 0, sizeof(mac_buf)); - - nw = do_encode_packet( pktbuf, N2N_PKT_BUF_SIZE, conf->community_name); - nw += op_fn->fwd(op_fn, - pktbuf+nw, N2N_PKT_BUF_SIZE-nw, - PKT_CONTENT, sizeof(PKT_CONTENT), mac_buf); - - printf("%s: output size = 0x%" PRIx64 "\n", op_name, nw); - fhexdump(0, pktbuf, nw, stdout); - - // decrpytion - idx=0; - rem=nw; - decode_common( &cmn, pktbuf, &rem, &idx); - decode_PACKET( &pkt, &cmn, pktbuf, &rem, &idx ); - op_fn->rev(op_fn, decodebuf, sizeof(decodebuf), pktbuf+idx, rem, 0); - - if(memcmp(decodebuf, PKT_CONTENT, sizeof(PKT_CONTENT)) != 0) { - fprintf(stderr, "%s: round-trip buffer mismatch\n", op_name); - exit(1); - } - - fprintf(stderr, "%s: tested\n", op_name); - printf("\n"); -} - - -static ssize_t do_encode_packet ( uint8_t * pktbuf, size_t bufsize, const n2n_community_t c ) -{ - // FIXME: this is a parameter of the test environment - n2n_mac_t destMac={0,1,2,3,4,5}; - - n2n_common_t cmn; - n2n_PACKET_t pkt; - size_t idx; - - - memset( &cmn, 0, sizeof(cmn) ); - cmn.ttl = N2N_DEFAULT_TTL; - cmn.pc = n2n_packet; - cmn.flags=0; /* no options, not from supernode, no socket */ - memcpy( cmn.community, c, N2N_COMMUNITY_SIZE ); - - memset( &pkt, 0, sizeof(pkt) ); - memcpy( pkt.srcMac, destMac, N2N_MAC_SIZE); - memcpy( pkt.dstMac, destMac, N2N_MAC_SIZE); - - pkt.sock.family=0; /* do not encode sock */ - - idx=0; - encode_PACKET( pktbuf, &idx, &cmn, &pkt ); - traceEvent( TRACE_DEBUG, "encoded PACKET header of size=%u", (unsigned int)idx ); - - return idx; -} diff --git a/bundles/n2n_ntop_v3/tools/tests-wire.c b/bundles/n2n_ntop_v3/tools/tests-wire.c deleted file mode 100644 index 9e14f018..00000000 --- a/bundles/n2n_ntop_v3/tools/tests-wire.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * (C) 2007-21 - ntop.org and contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see - * - */ - -#include - -#include "n2n.h" -#include "hexdump.h" - -void init_ip_subnet (n2n_ip_subnet_t * d) { - d->net_addr = 0x20212223; - d->net_bitlen = 25; -} - -void print_ip_subnet (char *test_name, char *field, n2n_ip_subnet_t * d) { - printf("%s: %s.net_addr = 0x%08x\n", - test_name, field, d->net_addr); - printf("%s: %s.net_bitlen = %i\n", - test_name, field, d->net_bitlen); -} - -void init_mac (n2n_mac_t mac, const uint8_t o0, const uint8_t o1, - const uint8_t o2, const uint8_t o3, - const uint8_t o4, const uint8_t o5) { - mac[0] = o0; - mac[1] = o1; - mac[2] = o2; - mac[3] = o3; - mac[4] = o4; - mac[5] = o5; -} - -void print_mac (char *test_name, char *field, n2n_mac_t mac) { - printf("%s: %s[] = %x:%x:%x:%x:%x:%x\n", - test_name, field, - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); -} - -void init_auth (n2n_auth_t *auth) { - auth->scheme = n2n_auth_simple_id; - auth->token_size = 16; - auth->token[0] = 0xfe; - auth->token[4] = 0xfd; - auth->token[8] = 0xfc; - auth->token[15] = 0xfb; -} - -void print_auth (char *test_name, char *field, n2n_auth_t *auth) { - printf("%s: %s.scheme = %i\n", test_name, field, auth->scheme); - printf("%s: %s.token_size = %i\n", test_name, field, auth->token_size); - printf("%s: %s.token[0] = 0x%02x\n", test_name, field, auth->token[0]); -} - -void init_common (n2n_common_t *common, char *community) { - memset( common, 0, sizeof(*common) ); - common->ttl = N2N_DEFAULT_TTL; - common->flags = 0; - strncpy( (char *)common->community, community, N2N_COMMUNITY_SIZE); - common->community[N2N_COMMUNITY_SIZE - 1] = '\0'; -} - -void print_common (char *test_name, n2n_common_t *common) { - printf("%s: common.ttl = %i\n", test_name, common->ttl); - printf("%s: common.flags = %i\n", test_name, common->flags); - printf("%s: common.community = \"%s\"\n", test_name, common->community); -} - -void test_REGISTER (n2n_common_t *common) { - char *test_name = "REGISTER"; - - common->pc = n2n_register; - printf("%s: common.pc = %i\n", test_name, common->pc); - - n2n_REGISTER_t reg; - memset( ®, 0, sizeof(reg) ); - init_mac( reg.srcMac, 0,1,2,3,4,5); - init_mac( reg.dstMac, 0x10,0x11,0x12,0x13,0x14,0x15); - init_ip_subnet(®.dev_addr); - strcpy( (char *)reg.dev_desc, "Dummy_Dev_Desc" ); - - printf("%s: reg.cookie = %i\n", test_name, reg.cookie); - print_mac(test_name, "reg.srcMac", reg.srcMac); - print_mac(test_name, "reg.dstMac", reg.dstMac); - // TODO: print reg.sock - print_ip_subnet(test_name, "reg.dev_addr", ®.dev_addr); - printf("%s: reg.dev_desc = \"%s\"\n", test_name, reg.dev_desc); - printf("\n"); - - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx = 0; - size_t retval = encode_REGISTER( pktbuf, &idx, common, ®); - - printf("%s: output retval = 0x%" PRIx64 "\n", test_name, retval); - printf("%s: output idx = 0x%" PRIx64 "\n", test_name, idx); - fhexdump(0, pktbuf, idx, stdout); - - // TODO: decode_REGISTER() and print - - fprintf(stderr, "%s: tested\n", test_name); - printf("\n"); -} - -void test_REGISTER_SUPER (n2n_common_t *common) { - char *test_name = "REGISTER_SUPER"; - - common->pc = n2n_register_super; - printf("%s: common.pc = %i\n", test_name, common->pc); - - n2n_REGISTER_SUPER_t reg; - memset( ®, 0, sizeof(reg) ); - init_mac( reg.edgeMac, 0x20,0x21,0x22,0x23,0x24,0x25); - // n2n_sock_t sock - init_ip_subnet(®.dev_addr); - strcpy( (char *)reg.dev_desc, "Dummy_Dev_Desc" ); - init_auth(®.auth); - reg.key_time = 600; - - - printf("%s: reg.cookie = %i\n", test_name, reg.cookie); - print_mac(test_name, "reg.edgeMac", reg.edgeMac); - // TODO: print reg.sock - print_ip_subnet(test_name, "reg.dev_addr", ®.dev_addr); - printf("%s: reg.dev_desc = \"%s\"\n", test_name, reg.dev_desc); - print_auth(test_name, "reg.auth", ®.auth); - printf("%s: reg.key_time = %" PRIi32 "\n", test_name, reg.key_time); - printf("\n"); - - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx = 0; - size_t retval = encode_REGISTER_SUPER( pktbuf, &idx, common, ®); - - printf("%s: output retval = 0x%" PRIx64 "\n", test_name, retval); - printf("%s: output idx = 0x%" PRIx64 "\n", test_name, idx); - fhexdump(0, pktbuf, idx, stdout); - - // TODO: decode_REGISTER_SUPER() and print - - fprintf(stderr, "%s: tested\n", test_name); - printf("\n"); -} - -void test_UNREGISTER_SUPER (n2n_common_t *common) { - char *test_name = "UNREGISTER_SUPER"; - - common->pc = n2n_unregister_super; - printf("%s: common.pc = %i\n", test_name, common->pc); - - n2n_UNREGISTER_SUPER_t unreg; - memset( &unreg, 0, sizeof(unreg) ); - init_auth(&unreg.auth); - init_mac( unreg.srcMac, 0x30,0x31,0x32,0x33,0x34,0x35); - - - print_auth(test_name, "unreg.auth", &unreg.auth); - print_mac(test_name, "unreg.srcMac", unreg.srcMac); - printf("\n"); - - uint8_t pktbuf[N2N_PKT_BUF_SIZE]; - size_t idx = 0; - size_t retval = encode_UNREGISTER_SUPER( pktbuf, &idx, common, &unreg); - - printf("%s: output retval = 0x%" PRIx64 "\n", test_name, retval); - printf("%s: output idx = 0x%" PRIx64 "\n", test_name, idx); - fhexdump(0, pktbuf, idx, stdout); - - // TODO: decode_UNREGISTER_SUPER() and print - - fprintf(stderr, "%s: tested\n", test_name); - printf("\n"); -} - -int main (int argc, char * argv[]) { - char *test_name = "environment"; - - n2n_common_t common; - init_common( &common, "abc123def456z" ); - print_common( test_name, &common ); - printf("\n"); - - test_REGISTER(&common); - test_REGISTER_SUPER(&common); - test_UNREGISTER_SUPER(&common); - // TODO: add more wire tests - - return 0; -} - diff --git a/bundles/n2n_ntop_v3/uncrustify.cfg b/bundles/n2n_ntop_v3/uncrustify.cfg deleted file mode 100644 index baef9cdb..00000000 --- a/bundles/n2n_ntop_v3/uncrustify.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Initial rules taken from a quick discussion -# (See https://github.com/ntop/n2n/commit/00159d0d012c6836fd972af1748833eeaf50fa22#commitcomment-57137247) - -# 4 space indention (never use tabs) -indent_columns = 4 -indent_with_tabs = 0 -indent_switch_case = 4 - -# space between name and bracket during function define -sp_func_def_paren = force -sp_func_proto_paren = force - -# no space between name and bracket during call -sp_func_call_paren = remove - -# no space after if and while -sp_before_sparen = remove -#sp_while_paren_open = remove # only in newer uncrustify - -# block-braces as seen above -nl_if_brace = remove -nl_brace_else = remove -nl_elseif_brace = remove -nl_else_brace = remove -#nl_before_opening_brace_func_class_def = remove # only in newer uncrustify -nl_for_brace = remove -nl_while_brace = remove - -# multi-line parameters with indentation under the opening bracket -# looks like this is the default, but might be the following: -#indent_func_call_param = false ? - -# Want to keep var definition alignment -#align_keep_extra_space = true diff --git a/bundles/n2n_ntop_v3/win32/CMakeLists.txt b/bundles/n2n_ntop_v3/win32/CMakeLists.txt deleted file mode 100644 index 2e96b181..00000000 --- a/bundles/n2n_ntop_v3/win32/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_library(n2n_win32 - getopt1.c - getopt.c - wintap.c) -target_link_libraries(n2n_win32 PUBLIC ws2_32.lib) diff --git a/bundles/n2n_ntop_v3/win32/DotNet/n2n.sln b/bundles/n2n_ntop_v3/win32/DotNet/n2n.sln deleted file mode 100644 index 95698872..00000000 --- a/bundles/n2n_ntop_v3/win32/DotNet/n2n.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "edge", "n2n.vcproj", "{4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "supernode", "supernode.vcproj", "{BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Debug|Win32.ActiveCfg = Debug|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Debug|Win32.Build.0 = Debug|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Release|Win32.ActiveCfg = Release|Win32 - {4911ADD4-08A3-4C9F-B9C9-9492DA10D01D}.Release|Win32.Build.0 = Release|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Debug|Win32.ActiveCfg = Debug|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Debug|Win32.Build.0 = Debug|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Release|Win32.ActiveCfg = Release|Win32 - {BDB93CAB-BE22-4ED6-9A05-2E4D6F1D76E1}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/bundles/n2n_ntop_v3/win32/DotNet/n2n.suo b/bundles/n2n_ntop_v3/win32/DotNet/n2n.suo deleted file mode 100644 index aae212bd..00000000 Binary files a/bundles/n2n_ntop_v3/win32/DotNet/n2n.suo and /dev/null differ diff --git a/bundles/n2n_ntop_v3/win32/DotNet/n2n.vcproj b/bundles/n2n_ntop_v3/win32/DotNet/n2n.vcproj deleted file mode 100644 index d62381d2..00000000 --- a/bundles/n2n_ntop_v3/win32/DotNet/n2n.vcproj +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/n2n_ntop_v3/win32/DotNet/supernode.vcproj b/bundles/n2n_ntop_v3/win32/DotNet/supernode.vcproj deleted file mode 100644 index e6a9e0d1..00000000 --- a/bundles/n2n_ntop_v3/win32/DotNet/supernode.vcproj +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/n2n_ntop_v3/win32/Makefile b/bundles/n2n_ntop_v3/win32/Makefile deleted file mode 100644 index 3ffda93a..00000000 --- a/bundles/n2n_ntop_v3/win32/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# This is not a standalone makefile, it must be called from the toplevel -# makefile to inherit the correct environment - -CFLAGS+=-I../include -LDFLAGS+=-L.. - -.PHONY: all clean install - -all: n2n_win32.a - -n2n_win32.a: getopt1.o getopt.o wintap.o - $(AR) rcs $@ $+ - -clean: - rm -rf n2n_win32.a *.o *.gcno *.gcda - -install: - true diff --git a/bundles/n2n_ntop_v3/win32/getopt.c b/bundles/n2n_ntop_v3/win32/getopt.c deleted file mode 100644 index 6bbb735a..00000000 --- a/bundles/n2n_ntop_v3/win32/getopt.c +++ /dev/null @@ -1,1074 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 - Free Software Foundation, Inc. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include -#ifdef WIN32 -#include -#endif - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include -# if _GNU_GETOPT<_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -# include -# include -#endif /* GNU C library. */ - -#ifdef VMS -# include -# if HAVE_STRING_H - 0 -# include -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# ifdef HAVE_LIBINTL_H -# include -# define _(msgid) gettext (msgid) -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -#ifndef DARWIN -char *optarg; -#endif - - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -#ifndef DARWIN -int optind = 1; -#endif - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -#ifndef DARWIN -#ifdef WIN32 -int opterr = 0; -#else -int opterr = 1; -#endif -#endif - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ -#ifndef DARWIN -int optopt = '?'; -#endif - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include -# define my_index strchr -#else - -#ifndef WIN32 -# if HAVE_STRING_H -# include -# else -# include -# endif -#endif - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (); -#endif - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; - -static int original_argc; -static char *const *original_argv; - -/* Make sure the environment variable bash 2.0 puts in the environment - is valid for the getopt call we must make sure that the ARGV passed - to getopt is that one passed to the process. */ -static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) -{ - /* XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ - original_argc = argc; - original_argv = argv; -} -# ifdef text_set_element -text_set_element (__libc_subinit, store_args_and_env); -# endif /* text_set_element */ - -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#ifdef _LIBC - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#ifdef _LIBC - if (posixly_correct == NULL - && argc == original_argc && argv == original_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - int print_errors = opterr; - if (optstring[0] == ':') - print_errors = 0; - - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#ifdef _LIBC -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (print_errors) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (print_errors) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt____ (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ - diff --git a/bundles/n2n_ntop_v3/win32/getopt.h b/bundles/n2n_ntop_v3/win32/getopt.h deleted file mode 100644 index b0147e9d..00000000 --- a/bundles/n2n_ntop_v3/win32/getopt.h +++ /dev/null @@ -1,169 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -# if defined __STDC__ && __STDC__ - const char *name; -# else - char *name; -# endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, `optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `getopt' that there are no more - options. - - If OPTS begins with `--', then non-option arguments are treated as - arguments to the option '\0'. This behavior is specific to the GNU - `getopt'. */ - -#if defined __STDC__ && __STDC__ -# ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/bundles/n2n_ntop_v3/win32/getopt1.c b/bundles/n2n_ntop_v3/win32/getopt1.c deleted file mode 100644 index 3d264f2d..00000000 --- a/bundles/n2n_ntop_v3/win32/getopt1.c +++ /dev/null @@ -1,188 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "getopt.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/bundles/n2n_ntop_v3/win32/n2n_win32.h b/bundles/n2n_ntop_v3/win32/n2n_win32.h deleted file mode 100644 index 8cddbb0e..00000000 --- a/bundles/n2n_ntop_v3/win32/n2n_win32.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - - (C) 2007-09 - Luca Deri - -*/ - -#ifndef _N2N_WIN32_H_ -#define _N2N_WIN32_H_ - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif - -#define WIN32_LEAN_AND_MEAN - -#if defined(__MINGW32__) -/* should be defined here and before winsock gets included */ -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x501 //Otherwise the linker doesnt find getaddrinfo -#endif /* #ifndef _WIN32_WINNT */ -#include -#endif /* #if defined(__MINGW32__) */ - - -#include -#include -#include -#include -#if defined(_MSC_VER) -#include -#pragma comment(lib,"Iphlpapi.lib") -#endif -#include -#include -#include - - -#include "wintap.h" - -#undef EAFNOSUPPORT -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define MAX(a,b) (a > b ? a : b) -#define MIN(a,b) (a < b ? a : b) - -#define snprintf _snprintf -#define strdup _strdup - -#define socklen_t int - - -/* ************************************* */ - -struct ip { -#if BYTE_ORDER == LITTLE_ENDIAN - u_char ip_hl:4, /* header length */ - ip_v:4; /* version */ -#else - u_char ip_v:4, /* version */ - ip_hl:4; /* header length */ -#endif - u_char ip_tos; /* type of service */ - short ip_len; /* total length */ - u_short ip_id; /* identification */ - short ip_off; /* fragment offset field */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_char ip_ttl; /* time to live */ - u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src,ip_dst; /* source and dest address */ -}; - - -/* ************************************* */ - - -typedef struct tuntap_dev { - HANDLE device_handle; - char *device_name; - char *ifName; - int if_idx; - OVERLAPPED overlap_read, overlap_write; - n2n_mac_t mac_addr; - uint32_t ip_addr; - uint32_t device_mask; - unsigned int mtu; - unsigned int metric; - unsigned int metric_original; -} tuntap_dev; - - -/* ************************************* */ - - -#define index(a, b) strchr(a, b) -#define sleep(x) Sleep(x * 1000) - - -/* ************************************* */ - - -#define HAVE_PTHREAD -#define pthread_t HANDLE -#define pthread_mutex_t HANDLE - -#define pthread_create(p_thread_handle, attr, thread_func, p_param) \ - (*p_thread_handle = CreateThread(0 /* default security flags */, 0 /*default stack*/, \ - thread_func, p_param, 0 /* default creation flags */, \ - NULL) == 0) - -#define pthread_cancel(p_thread_handle) \ - TerminateThread(p_thread_handle, 0) - -#define pthread_mutex_init(p_mutex_handle, attr) \ - *p_mutex_handle = CreateMutex(NULL /*default security flags */, \ - FALSE /* initially not owned */, NULL /* unnamed */) - -#define pthread_mutex_lock(mutex) \ - WaitForSingleObject(*mutex, INFINITE) - -#define pthread_mutex_trylock(mutex) \ - WaitForSingleObject(*mutex, NULL) - -#define pthread_mutex_unlock(mutex) \ - ReleaseMutex(*mutex) - - -/* ************************************* */ - - -#endif diff --git a/bundles/n2n_ntop_v3/win32/version-msvc.c b/bundles/n2n_ntop_v3/win32/version-msvc.c deleted file mode 100644 index 92cce068..00000000 --- a/bundles/n2n_ntop_v3/win32/version-msvc.c +++ /dev/null @@ -1,3 +0,0 @@ -const char * n2n_sw_version = "2.0.0"; -const char * n2n_sw_osName = "Win32"; -const char * n2n_sw_buildDate = __DATE__ " " __TIME__; diff --git a/bundles/n2n_ntop_v3/win32/winconfig.h b/bundles/n2n_ntop_v3/win32/winconfig.h deleted file mode 100644 index c206f138..00000000 --- a/bundles/n2n_ntop_v3/win32/winconfig.h +++ /dev/null @@ -1,15 +0,0 @@ -/* winconfig.h. Win32 replacement for file generated from config.h.in by configure. */ - -/* OS name */ -#ifndef PACKAGE_OSNAME -#define PACKAGE_OSNAME N2N_OSNAME -#endif - -/* Define to the version of this package. */ -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION N2N_VERSION -#endif -#ifndef GIT_RELEASE -#define GIT_RELEASE N2N_VERSION -#endif - diff --git a/bundles/n2n_ntop_v3/win32/wintap.c b/bundles/n2n_ntop_v3/win32/wintap.c deleted file mode 100644 index 6170124c..00000000 --- a/bundles/n2n_ntop_v3/win32/wintap.c +++ /dev/null @@ -1,517 +0,0 @@ -/* - (C) 2007-09 - Luca Deri -*/ - -#include "n2n.h" -#include "n2n_win32.h" - -/* ***************************************************** */ - -void initWin32() { - WSADATA wsaData; - int err; - - err = WSAStartup(MAKEWORD(2, 2), &wsaData ); - if( err != 0 ) { - /* Tell the user that we could not find a usable */ - /* WinSock DLL. */ - printf("FATAL ERROR: unable to initialise Winsock 2.x."); - exit(EXIT_FAILURE); - } -} - - -void destroyWin32() { - WSACleanup(); -} - -struct win_adapter_info { - HANDLE handle; - char adapterid[1024]; - char adaptername[1024]; -}; - -/* ***************************************************** */ - -static HANDLE open_tap_device(const char *adapterid) { - char tapname[1024]; - _snprintf(tapname, sizeof(tapname), USERMODEDEVICEDIR "%s" TAPSUFFIX, adapterid); - - return(CreateFile(tapname, GENERIC_WRITE | GENERIC_READ, - 0, /* Don't let other processes share or open - the resource until the handle's been closed */ - 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0)); -} - -/* ***************************************************** */ - -static void iterate_win_network_adapters( - int (*callback)(struct win_adapter_info*, struct tuntap_dev *), - void *userdata) { - HKEY key, key2; - char regpath[1024]; - long len, rc; - int found = 0; - int err, i; - struct win_adapter_info adapter; - - /* Open registry and look for network adapters */ - if((rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ, &key))) { - printf("Unable to read registry: [rc=%d]\n", rc); - exit(EXIT_FAILURE); - /* MSVC Note: If you keep getting rc=2 errors, make sure you set: - Project -> Properties -> Configuration Properties -> General -> Character set - to: "Use Multi-Byte Character Set" - */ - } - - for (i = 0; ; i++) { - len = sizeof(adapter.adapterid); - if(RegEnumKeyEx(key, i, (LPTSTR)adapter.adapterid, &len, 0, 0, 0, NULL)) - break; - - /* Find out more about this adapter */ - - _snprintf(regpath, sizeof(regpath), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, adapter.adapterid); - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCSTR)regpath, 0, KEY_READ, &key2)) - continue; - - len = sizeof(adapter.adaptername); - err = RegQueryValueEx(key2, "Name", 0, 0, adapter.adaptername, &len); - - RegCloseKey(key2); - - if(err) - continue; - - - adapter.handle = open_tap_device(adapter.adapterid); - - if(adapter.handle != INVALID_HANDLE_VALUE) { - /* Valid device, use the callback */ - if(!callback(&adapter, userdata)) - break; - else - CloseHandle(adapter.handle); - /* continue */ - } - } - - RegCloseKey(key); -} - -/* ***************************************************** */ - -static int print_adapter_callback(struct win_adapter_info *adapter, struct tuntap_dev *device) { - printf(" %s - %s\n", adapter->adapterid, adapter->adaptername); - - /* continue */ - return(1); -} - -void win_print_available_adapters() { - iterate_win_network_adapters(print_adapter_callback, NULL); -} - -/* ***************************************************** */ - -static int lookup_adapter_info_reg(const char *target_adapter, char *regpath, size_t regpath_size) { - HKEY key, key2; - long len, rc; - char index[16]; - int err, i; - char adapter_name[N2N_IFNAMSIZ]; - int rv = 0; - - if((rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ADAPTER_INFO_KEY, 0, KEY_READ, &key))) { - printf("Unable to read registry: %s, [rc=%d]\n", ADAPTER_INFO_KEY, rc); - exit(EXIT_FAILURE); - } - - for(i = 0; ; i++) { - len = sizeof(index); - if(RegEnumKeyEx(key, i, (LPTSTR)index, &len, 0, 0, 0, NULL)) - break; - - _snprintf(regpath, regpath_size, "%s\\%s", ADAPTER_INFO_KEY, index); - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCSTR)regpath, 0, KEY_READ, &key2)) - continue; - - len = sizeof(adapter_name); - err = RegQueryValueEx(key2, "NetCfgInstanceId", 0, 0, adapter_name, &len); - - RegCloseKey(key2); - - if(err) - continue; - - if(!strcmp(adapter_name, target_adapter)) { - rv = 1; - break; - } - } - - RegCloseKey(key); - return(rv); -} - -/* ***************************************************** */ - -static void set_interface_mac(struct tuntap_dev *device, const char *mac_str) { - char cmd[256]; - char mac_buf[18]; - char adapter_info_reg[1024]; - - uint64_t mac = 0; - uint8_t *ptr = (uint8_t*)&mac; - - if(strlen(mac_str) != 17) { - printf("Invalid MAC: %s\n", mac_str); - exit(EXIT_FAILURE); - } - - /* Remove the colons */ - for(int i=0; i<6; i++) { - mac_buf[i*2] = mac_str[2*i + i]; - mac_buf[i*2+1] = mac_str[2*i + i + 1]; - } - mac_buf[12] = '\0'; - - if(!lookup_adapter_info_reg(device->device_name, adapter_info_reg, sizeof(adapter_info_reg))) { - printf("Could not determine adapter MAC registry key\n"); - exit(EXIT_FAILURE); - } - - _snprintf(cmd, sizeof(cmd), - "reg add HKEY_LOCAL_MACHINE\\%s /v MAC /d %s /f > nul", adapter_info_reg, mac_buf); - system(cmd); - - /* Put down then up again to apply */ - CloseHandle(device->device_handle); - _snprintf(cmd, sizeof(cmd), "netsh interface set interface \"%s\" disabled > nul", device->ifName); - system(cmd); - _snprintf(cmd, sizeof(cmd), "netsh interface set interface \"%s\" enabled > nul", device->ifName); - system(cmd); - - device->device_handle = open_tap_device(device->device_name); - if(device->device_handle == INVALID_HANDLE_VALUE) { - printf("Reopening TAP device \"%s\" failed\n", device->device_name); - exit(EXIT_FAILURE); - } -} - -/* ***************************************************** */ - -static int choose_adapter_callback(struct win_adapter_info *adapter, struct tuntap_dev *device) { - if(device->device_name) { - /* A device name filter was set, name must match */ - if(strcmp(device->device_name, adapter->adapterid) && - strcmp(device->device_name, adapter->adaptername)) { - /* Not found, continue */ - return(1); - } - } /* otherwise just pick the first available adapter */ - - /* Adapter found, break */ - device->device_handle = adapter->handle; - if(device->device_name) free(device->device_name); - device->device_name = _strdup(adapter->adapterid); - device->ifName = _strdup(adapter->adaptername); - return(0); -} - -/* ***************************************************** */ - -int open_wintap(struct tuntap_dev *device, - const char * devname, - const char * address_mode, /* "static" or "dhcp" */ - char *device_ip, - char *device_mask, - const char *device_mac, - int mtu, - int metric) { - - char cmd[256]; - DWORD len; - ULONG status = TRUE; - - memset(device, 0, sizeof(struct tuntap_dev)); - device->device_handle = INVALID_HANDLE_VALUE; - device->device_name = devname[0] ? _strdup(devname) : NULL; - device->ifName = NULL; - device->ip_addr = inet_addr(device_ip); - - iterate_win_network_adapters(choose_adapter_callback, device); - - if(device->device_handle == INVALID_HANDLE_VALUE) { - if(!devname[0]) - printf("No Windows tap devices found, did you run tapinstall.exe?\n"); - else - printf("Cannot find tap device \"%s\"\n", devname); - return -1; - } - - /* ************************************** */ - - /* interface index, required for routing */ - - ULONG buffer_len = 0; - IP_ADAPTER_INFO *buffer; - - // get required buffer size and allocate buffer - GetAdaptersInfo(NULL, &buffer_len); - buffer = malloc(buffer_len); - - // find device by name and get its index - if(buffer && !GetAdaptersInfo(buffer, &buffer_len)) { - IP_ADAPTER_INFO *i; - for(i = buffer; i != NULL; i = i->Next) { - if(!strcmp(device->device_name, i->AdapterName)) { - device->if_idx = i->Index; - break; - } - } - } - - free(buffer); - - /* ************************************** */ - - if(device_mac[0]) - set_interface_mac(device, device_mac); - - /* Get MAC address from tap device->device_name */ - - if(!DeviceIoControl(device->device_handle, TAP_IOCTL_GET_MAC, - device->mac_addr, sizeof(device->mac_addr), - device->mac_addr, sizeof(device->mac_addr), &len, 0)) { - printf("Could not get MAC address from Windows tap %s (%s)\n", - device->device_name, device->ifName); - return -1; - } - - device->mtu = mtu; - - printf("Open device [name=%s][ip=%s][ifName=%s][MTU=%d][mac=%02X:%02X:%02X:%02X:%02X:%02X]\n", - device->device_name, device_ip, device->ifName, device->mtu, - device->mac_addr[0] & 0xFF, - device->mac_addr[1] & 0xFF, - device->mac_addr[2] & 0xFF, - device->mac_addr[3] & 0xFF, - device->mac_addr[4] & 0xFF, - device->mac_addr[5] & 0xFF); - - /* ****************** */ - - if ( 0 == strcmp("dhcp", address_mode) ) - { - _snprintf(cmd, sizeof(cmd), - "netsh interface ip set address \"%s\" dhcp > nul", - device->ifName); - } - else - { - _snprintf(cmd, sizeof(cmd), - "netsh interface ip set address \"%s\" static %s %s > nul", - device->ifName, device_ip, device_mask); - } - - if(system(cmd) == 0) { - device->ip_addr = inet_addr(device_ip); - device->device_mask = inet_addr(device_mask); - } else - printf("WARNING: Unable to set device %s IP address [%s]\n", - device->ifName, cmd); - - /* ****************** */ - - /* MTU */ - - _snprintf(cmd, sizeof(cmd), - "netsh interface ipv4 set subinterface \"%s\" mtu=%d store=persistent > nul", - device->ifName, mtu); - - if(system(cmd) != 0) - printf("WARNING: Unable to set device %s parameters MTU=%d store=persistent [%s]\n", - device->ifName, mtu, cmd); - - /* ****************** */ - - /* metric */ - - PMIB_IPINTERFACE_ROW Row; - - if(metric) { /* try to change only if a value has been given, otherwise leave with default or as set before */ - // find & store original metric - Row = calloc(1, sizeof(MIB_IPINTERFACE_ROW)); - InitializeIpInterfaceEntry(Row); - Row->InterfaceIndex = device->if_idx; - Row->Family = AF_INET; - GetIpInterfaceEntry(Row); - - device->metric_original = Row->Metric; - device->metric = metric; - - // set new value - Row->Metric = metric; - - // store - Row->SitePrefixLength = 0; /* if not set to zero, following function call fails... */ - SetIpInterfaceEntry(Row); - - free(Row); - } - - /* ****************** */ - - - /* set driver media status to 'connected' (i.e. set the interface up) */ - if (!DeviceIoControl (device->device_handle, TAP_IOCTL_SET_MEDIA_STATUS, - &status, sizeof (status), - &status, sizeof (status), &len, NULL)) - printf("WARNING: Unable to enable TAP adapter\n"); - - /* - * Initialize overlapped structures - */ - device->overlap_read.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - device->overlap_write.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (!device->overlap_read.hEvent || !device->overlap_write.hEvent) { - return -1; - } - - return(0); -} - -/* ************************************************ */ - -int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) -{ - DWORD read_size, last_err; - - ResetEvent(tuntap->overlap_read.hEvent); - if (ReadFile(tuntap->device_handle, buf, len, &read_size, &tuntap->overlap_read)) { - //printf("tun_read(len=%d)\n", read_size); - return read_size; - } - switch (last_err = GetLastError()) { - case ERROR_IO_PENDING: - WaitForSingleObject(tuntap->overlap_read.hEvent, INFINITE); - GetOverlappedResult(tuntap->device_handle, &tuntap->overlap_read, &read_size, FALSE); - return read_size; - break; - default: - printf("GetLastError() returned %d\n", last_err); - break; - } - - return -1; -} -/* ************************************************ */ - -int tuntap_write(struct tuntap_dev *tuntap, unsigned char *buf, int len) -{ - DWORD write_size; - - //printf("tun_write(len=%d)\n", len); - - ResetEvent(tuntap->overlap_write.hEvent); - if (WriteFile(tuntap->device_handle, - buf, - len, - &write_size, - &tuntap->overlap_write)) { - //printf("DONE tun_write(len=%d)\n", write_size); - return write_size; - } - switch (GetLastError()) { - case ERROR_IO_PENDING: - WaitForSingleObject(tuntap->overlap_write.hEvent, INFINITE); - GetOverlappedResult(tuntap->device_handle, &tuntap->overlap_write, - &write_size, FALSE); - return write_size; - break; - default: - break; - } - - return -1; -} - -/* ************************************************ */ - -int tuntap_open(struct tuntap_dev *device, - char *dev, - const char *address_mode, /* static or dhcp */ - char *device_ip, - char *device_mask, - const char * device_mac, - int mtu, - int metric) { - return(open_wintap(device, dev, address_mode, device_ip, device_mask, device_mac, mtu, metric)); -} - -/* ************************************************ */ - -void tuntap_close(struct tuntap_dev *tuntap) { - - PMIB_IPINTERFACE_ROW Row; - - if(tuntap->metric) { /* only required if a value has been given (and thus stored) */ - // find device entry - Row = calloc(1, sizeof(MIB_IPINTERFACE_ROW)); - InitializeIpInterfaceEntry(Row); - Row->InterfaceIndex = tuntap->if_idx; - Row->Family = AF_INET; - GetIpInterfaceEntry(Row); - - // restore original value - Row->Metric = tuntap->metric_original; - - // store - Row->SitePrefixLength = 0; /* if not set to zero, following function call fails... */ - SetIpInterfaceEntry(Row); - - free(Row); - } - - CloseHandle(tuntap->device_handle); -} - -/* Fill out the ip_addr value from the interface. Called to pick up dynamic - * address changes. */ -void tuntap_get_address(struct tuntap_dev *tuntap) -{ -} - -/* ************************************************ */ - -#if 0 -int main(int argc, char* argv[]) { - struct tuntap_dev tuntap; - int i; - int mtu = 1400; - - printf("Welcome to n2n\n"); - initWin32(); - open_wintap(&tuntap, "static", "1.2.3.20", "255.255.255.0", mtu, 0); - - for(i=0; i<10; i++) { - u_char buf[MTU]; - int rc; - - rc = tun_read(&tuntap, buf, sizeof(buf)); - buf[0]=2; - buf[1]=3; - buf[2]=4; - - printf("tun_read returned %d\n", rc); - rc = tun_write(&tuntap, buf, rc); - printf("tun_write returned %d\n", rc); - } - // rc = tun_open (device->device_name, IF_MODE_TUN); - WSACleanup (); - return(0); -} - -#endif diff --git a/bundles/n2n_ntop_v3/win32/wintap.h b/bundles/n2n_ntop_v3/win32/wintap.h deleted file mode 100644 index ce53b550..00000000 --- a/bundles/n2n_ntop_v3/win32/wintap.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - (C) 2007 - Luca Deri -*/ - -#ifndef _WINTAP_H_ -#define _WINTAP_H_ - -#undef UNICODE -#undef _UNICODE -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include -#include -#include - - - -//=============================================== -// This file is included both by OpenVPN and -// the TAP-Win32 driver and contains definitions -// common to both. -//=============================================== - -//============= -// TAP IOCTLs -//============= - -#define TAP_CONTROL_CODE(request,method) \ - CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) - -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) - -//================= -// Registry keys -//================= - -#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" -#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" -#define ADAPTER_INFO_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" - -//====================== -// Filesystem prefixes -//====================== - -#define USERMODEDEVICEDIR "\\\\.\\Global\\" -#define SYSDEVICEDIR "\\Device\\" -#define USERDEVICEDIR "\\DosDevices\\Global\\" -#define TAPSUFFIX ".tap" - -//========================================================= -// TAP_COMPONENT_ID -- This string defines the TAP driver -// type -- different component IDs can reside in the system -// simultaneously. -//========================================================= - -#define TAP_COMPONENT_ID "tap0801" - -extern void initWin32(); -extern void destroyWin32(); -extern void win_print_available_adapters(); - -#endif \ No newline at end of file diff --git a/bundles/n2n_ntop_v3/wireshark/README.md b/bundles/n2n_ntop_v3/wireshark/README.md deleted file mode 100644 index 4c0b6fdd..00000000 --- a/bundles/n2n_ntop_v3/wireshark/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Wireshark Lua plugin to dissect n2n traffic. - -Quick load: - -``` - wireshark -X lua_script:n2n.lua -``` - -NOTE: the dissector only decodes traffic on UDP port 50001. In order to decode n2n traffic on another UDP port you can use the "Decode As..." function of wireshark. diff --git a/bundles/n2n_ntop_v3/wireshark/n2n.lua b/bundles/n2n_ntop_v3/wireshark/n2n.lua deleted file mode 100644 index ff453410..00000000 --- a/bundles/n2n_ntop_v3/wireshark/n2n.lua +++ /dev/null @@ -1,316 +0,0 @@ --- (C) 2019 - ntop.org and contributors - -n2n = Proto("n2n", "n2n Protocol") - --- ############################################# - -PKT_TYPE_PING = 0 -PKT_TYPE_REGISTER = 1 -PKT_TYPE_DEREGISTER = 2 -PKT_TYPE_PACKET = 3 -PKT_TYPE_REGISTER_ACK = 4 -PKT_TYPE_REGISTER_SUPER = 5 -PKT_TYPE_REGISTER_SUPER_ACK = 6 -PKT_TYPE_REGISTER_SUPER_NAK = 7 -PKT_TYPE_FEDERATION = 8 -PKT_TYPE_PEER_INFO = 9 -PKT_TYPE_QUERY_PEER = 10 - -PKT_TRANSFORM_NULL = 1 -PKT_TRANSFORM_TWOFISH = 2 -PKT_TRANSFORM_AESCBC = 3 - -FLAG_FROM_SUPERNODE = 0x0020 -FLAG_SOCKET = 0x0040 -FLAG_OPTIONS = 0x0080 - -SOCKET_FAMILY_AF_INET = 0x0000 -SOCKET_FAMILY_AF_INET6 = 0x8000 - --- ############################################# - -version = ProtoField.uint8("n2n.version", "version", base.DEC) -ttl = ProtoField.uint8("n2n.ttl", "ttl", base.DEC) - -packet_type_mask = 0x001f -pkt_type_2_str = { - [PKT_TYPE_PING] = "ping", - [PKT_TYPE_REGISTER] = "register", - [PKT_TYPE_DEREGISTER] = "deregister", - [PKT_TYPE_PACKET] = "packet", - [PKT_TYPE_REGISTER_ACK] = "register_ack", - [PKT_TYPE_REGISTER_SUPER] = "register_super", - [PKT_TYPE_REGISTER_SUPER_ACK] = "register_super_ack", - [PKT_TYPE_REGISTER_SUPER_NAK] = "register_super_nak", - [PKT_TYPE_FEDERATION] = "federation", - [PKT_TYPE_PEER_INFO] = "peer_info", - [PKT_TYPE_QUERY_PEER] = "query_peer", -} -packet_type = ProtoField.uint8("n2n.packet_type", "packetType", base.HEX, pkt_type_2_str, packet_type_mask) - -flags_mask = 0xffe0 -flags = ProtoField.uint16("n2n.flags", "Flags", base.HEX, nil, flags_mask) -from_supernode_flag = ProtoField.uint16("n2n.flags.from_supernode", "from_supernode", base.BOOLEAN, nil, FLAG_FROM_SUPERNODE) -socket_flag = ProtoField.uint16("n2n.flags.socket", "socket", base.BOOLEAN, nil, FLAG_SOCKET) -options_flag = ProtoField.uint16("n2n.flags.options", "options", base.BOOLEAN, nil, FLAG_OPTIONS) -community = ProtoField.string("n2n.community", "Community", base.ASCII) - --- ############################################# - -src_mac = ProtoField.ether("n2n.src_mac", "Source") -dst_mac = ProtoField.ether("n2n.dst_mac", "Destination") -socket_info = ProtoField.none("n2n.socket", "Socket Info") -socket_family = ProtoField.uint16("n2n.socket.family", "Family", base.HEX, { - [0] = "AF_INET", -}) -socket_port = ProtoField.uint16("n2n.socket.port", "Port") -socket_ipv4 = ProtoField.ipv4("n2n.socket.ipv4", "IPv4") -socket_ipv6 = ProtoField.ipv6("n2n.socket.ipv6", "IPv6") - --- ############################################# - -peer_info_field = ProtoField.none("n2n.peer_info", "PeerInfo") -peer_info_flags = ProtoField.uint16("n2n.peer_info.flags", "Flags") -peer_info_mac = ProtoField.ether("n2n.peer_info.query_mac", "Query") - -query_peer_field = ProtoField.none("n2n.query_peer", "QueryPeer") - --- ############################################# - - - -packet_field = ProtoField.none("n2n.packet", "Packet") -packet_transform = ProtoField.uint16("n2n.packet.transform", "Transform", base.HEX, { - [PKT_TRANSFORM_NULL] = "Plaintext", - [PKT_TRANSFORM_TWOFISH] = "TwoFish", - [PKT_TRANSFORM_AESCBC] = "AES CBC", -}) -packet_payload = ProtoField.bytes("n2n.packet.payload", "Payload") - --- ############################################# - -register_field = ProtoField.none("n2n.register", "Register") -register_cookie = ProtoField.uint32("n2n.register.cookie", "Cookie", base.HEX) - -register_ack_field = ProtoField.none("n2n.register_ack", "RegisterACK") -register_ack_cookie = ProtoField.uint32("n2n.register_ack.cookie", "Cookie", base.HEX) - -register_super_field = ProtoField.none("n2n.register_super", "RegisterSuper") -register_super_cookie = ProtoField.uint32("n2n.register_super.cookie", "Cookie", base.HEX) -register_super_auth_schema = ProtoField.uint16("n2n.register_super.auth.schema", "AuthSchema", base.HEX) -register_super_auth_data = ProtoField.uint16("n2n.register_super.auth.data", "AuthData", base.HEX) - -register_super_ack_field = ProtoField.none("n2n.register_super_ack", "RegisterSuperACK") -register_super_ack_cookie = ProtoField.uint32("n2n.register_super_ack.cookie", "Cookie", base.HEX) -register_super_ack_lifetime = ProtoField.uint16("n2n.register_super_ack.lifetime", "Registration Lifetime", base.DEC) -register_super_ack_num_sn = ProtoField.uint8("n2n.register_super_ack.num_sn", "Num Supernodes", base.DEC) - --- ############################################# - -n2n.fields = { - version, ttl, packet_type, - flags, from_supernode_flag, socket_flag, options_flag, - community, - - -- Generic - src_mac, dst_mac, - socket_info, socket_family, socket_port, socket_ipv4, socket_ipv6, - - -- PKT_TYPE_REGISTER - register_field, register_cookie, - -- PKT_TYPE_PACKET - packet_field, packet_transform, packet_payload, - -- PKT_TYPE_REGISTER_ACK - register_ack_field, register_ack_cookie, - -- PKT_TYPE_REGISTER_SUPER - register_super_field, register_super_cookie, register_super_auth_schema, register_super_auth_data, - -- PKT_TYPE_REGISTER_SUPER_ACK - register_super_ack_field, register_super_ack_cookie, register_super_ack_lifetime, register_super_ack_num_sn, - -- PKT_TYPE_PEER_INFO - peer_info_field, peer_info_flags, peer_info_mac, - -- PKT_TYPE_QUERY_PEER - query_peer_field, -} - --- ############################################# - -function dissect_socket(subtree, buffer, offset) - local sock_baselen = 4 - local sock_protolen = 0 - buffer = buffer(offset) - local sock_family = bit.band(buffer(0,4):uint(), 0xFFFF0000) - - if(sock_family == SOCKET_FAMILY_AF_INET) then - sock_protolen = 4 - elseif(sock_family == SOCKET_FAMILY_AF_INET6) then - sock_protolen = 16 - end - - local totlen = sock_baselen + sock_protolen - local socktree = subtree:add(socket_info, buffer(0, totlen)) - - socktree:add(socket_family, buffer(0, 2)) - socktree:add(socket_port, buffer(2, 2)) - - if(sock_family == SOCKET_FAMILY_AF_INET) then - socktree:add(socket_ipv4, buffer(4, sock_protolen)) - elseif(sock_family == SOCKET_FAMILY_AF_INET6) then - socktree:add(socket_ipv6, buffer(4, sock_protolen)) - end - - return offset+totlen, socktree -end - --- ############################################# - -function dissect_register(subtree, buffer, flags) - local regtree = subtree:add(register_field, buffer) - - regtree:add(register_cookie, buffer(0,4)) - regtree:add(src_mac, buffer(4,6)) - regtree:add(dst_mac, buffer(10,6)) - - if(bit.band(flags, FLAG_SOCKET) == FLAG_SOCKET) then - dissect_socket(regtree, buffer, 16) - end - - return regtree -end - --- ############################################# - -function dissect_register_ack(subtree, buffer, flags) - local regtree = subtree:add(register_ack_field, buffer) - - regtree:add(register_ack_cookie, buffer(0,4)) - regtree:add(src_mac, buffer(4,6)) - regtree:add(dst_mac, buffer(10,6)) - - return regtree -end - --- ############################################# - -function dissect_packet(subtree, buffer, flags, pinfo) - local pktree = subtree:add(packet_field, buffer) - - pktree:add(src_mac, buffer(0,6)) - pktree:add(dst_mac, buffer(6,6)) - - if(bit.band(flags, FLAG_SOCKET) == FLAG_SOCKET) then - idx = dissect_socket(pktree, buffer, 12) - else - idx = 12 - end - - pktree:add(packet_transform, buffer(idx,2)) - local payload = pktree:add(packet_payload, buffer(idx+2)) - local transform = buffer(idx,2):uint() - - -- Can only dissect unencrypted data - if(transform == PKT_TRANSFORM_NULL) then - Dissector.get("eth_withoutfcs"):call(buffer(idx+2):tvb(), pinfo, payload) - end - - return pktree -end - --- ############################################# - -function dissect_register_super(subtree, buffer, flags) - local regtree = subtree:add(register_super_field, buffer) - - regtree:add(register_super_cookie, buffer(0,4)) - regtree:add(src_mac, buffer(4,6)) - regtree:add(register_super_auth_schema, buffer(10,2)) - regtree:add(register_super_auth_data, buffer(12,2)) - - return regtree -end - --- ############################################# - -function dissect_register_super_ack(subtree, buffer, flags) - local regtree = subtree:add(register_super_ack_field, buffer) - - regtree:add(register_super_ack_cookie, buffer(0,4)) - regtree:add(dst_mac, buffer(4,6)) - regtree:add(register_super_ack_lifetime, buffer(10,2)) - local idx = dissect_socket(regtree, buffer, 12) - regtree:add(register_super_ack_num_sn, buffer(idx, 1)) - - return regtree -end - --- ############################################# - -function dissect_peer_info(subtree, buffer, flags) - local peertree = subtree:add(peer_info_field, buffer) - - peertree:add(peer_info_flags, buffer(0,2)) - peertree:add(peer_info_mac, buffer(2,6)) - dissect_socket(peertree, buffer, 8) - - return peertree -end - --- ############################################# - -function dissect_query_peer(subtree, buffer, flags) - local peertree = subtree:add(query_peer_field, buffer) - - peertree:add(src_mac, buffer(0,6)) - peertree:add(dst_mac, buffer(6,6)) - - return peertree -end - --- ############################################# - -function n2n.dissector(buffer, pinfo, tree) - local length = buffer:len() - if length < 20 then return end - - pinfo.cols.protocol = n2n.name - - local pkt_type = bit.band(buffer(2,2):uint(), packet_type_mask) - local subtree = tree:add(n2n, buffer(), string.format("n2n Protocol, Type: %s", pkt_type_2_str[pkt_type] or "Unknown")) - - -- Common - subtree:add(version, buffer(0,1)) - subtree:add(ttl, buffer(1,1)) - subtree:add(packet_type, buffer(2,2)) - local flags_buffer = buffer(2,2) - local flags_tree = subtree:add(flags, flags_buffer) - subtree:add(community, buffer(4,16)) - - -- Flags - flags_tree:add(from_supernode_flag, flags_buffer) - flags_tree:add(socket_flag, flags_buffer) - flags_tree:add(options_flag, flags_buffer) - - -- Packet specific - local flags = bit.band(buffer(2,2):uint(), flags_mask) - local typebuf = buffer(20) - - if(pkt_type == PKT_TYPE_REGISTER) then - dissect_register(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_REGISTER) then - dissect_register_ack(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_PACKET) then - dissect_packet(subtree, typebuf, flags, pinfo) - elseif(pkt_type == PKT_TYPE_REGISTER_SUPER) then - dissect_register_super(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_REGISTER_SUPER_ACK) then - dissect_register_super_ack(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_PEER_INFO) then - dissect_peer_info(subtree, typebuf, flags) - elseif(pkt_type == PKT_TYPE_QUERY_PEER) then - dissect_query_peer(subtree, typebuf, flags) - end -end - --- ############################################# - -local udp_port = DissectorTable.get("udp.port") -udp_port:add(50001, n2n) diff --git a/bundles/slog/slog.c b/bundles/slog/slog.c deleted file mode 100644 index c7231bf0..00000000 --- a/bundles/slog/slog.c +++ /dev/null @@ -1,133 +0,0 @@ -// -// Created by switchwang(https://github.com/switch-st) on 2018-04-21. -// - -#include "slog.h" -#include -#include -#include -#include -#include -#include - -#define SLOG_MAX_CHECK_TIMES 100 - -static FILE* create_and_open_file(char* path) -{ - int ret; - FILE* fp = NULL; - char* c = NULL; - const char* p = path; - - if (!path || path[0] == '\0') { - return NULL; - } - if (path[0] == '/') path++; - while (path[0] != '\0') { - c = strchr(path, '/'); - if (c == NULL) { - fp = fopen(p, "a"); - return fp; - } - *c = '\0'; - ret = mkdir(p, 0755); - *c = '/'; - if (ret != 0) { - if (errno != EEXIST) { - return NULL; - } - } - path = c + 1; - } - - return NULL; -} - -static slog_t* check_log_path(slog_t* slog) -{ - if (!slog) - return NULL; - if (!slog->path) { - fclose(slog->fp); - free(slog); - return NULL; - } - slog->times = 0; - if (!access(slog->path, W_OK)) - return slog; - if (slog->fp) { - fclose(slog->fp); - slog->fp = NULL; - } - slog->fp = create_and_open_file(slog->path); - return slog; -} - -slog_t* initslog(int base, const char* path) -{ - if (base < 0 || path == NULL || path[0] == '\0') - return NULL; - char* p = strdup(path); - FILE* fp = create_and_open_file(p); - if (fp == NULL) { - free(p); - return NULL; - } - slog_t* slog = malloc(sizeof(slog_t)); - slog->fp = fp; - slog->base = base; - slog->path = p; - slog->times = 0; - return slog; -} - -slog_t* writeslog(slog_t* p, int level, const char* tag, const char* text) -{ - return printslog(p, level, tag, "%s\n", text); -} - -slog_t* printslog(slog_t* p, int level, const char* tag, const char* fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - p = vprintslog(p, level, tag, fmt, ap); - va_end(ap); - return p; -} - -slog_t* vprintslog(slog_t* p, int level, const char* tag, const char* fmt, va_list ap) -{ - if (!p) { - return NULL; - } - if (level < p->base) { - return p; - } -#ifndef NDEBUG - __android_log_vprint(level, tag, fmt, ap); -#endif /* #ifndef NDEBUG */ - if (p->fp) { - fprintf(p->fp, "%s: ", tag); - vfprintf(p->fp, fmt, ap); - fflush(p->fp); - } - p->times++; - if (p->times > SLOG_MAX_CHECK_TIMES) { - fflush(p->fp); - p = check_log_path(p); - } - return p; -} - -void closeslog(slog_t* p) -{ - if (p) { - if (p->fp) { - fclose(p->fp); - } - if (p->path) { - free(p->path); - } - free(p); - } -} diff --git a/bundles/slog/slog.h b/bundles/slog/slog.h deleted file mode 100644 index 1853f1c3..00000000 --- a/bundles/slog/slog.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// Created by switchwang(https://github.com/switch-st) on 2018-04-21. -// - -#ifndef _SIMPLELOG_H_ -#define _SIMPLELOG_H_ - -#include -#include - -typedef struct slog_st { - FILE* fp; - int base; - char* path; - int times; -} slog_t; - -slog_t* initslog(int base, const char* path); -slog_t* writeslog(slog_t* p, int level, const char* tag, const char* text); -slog_t* printslog(slog_t* p, int level, const char* tag, const char* fmt, ...); -slog_t* vprintslog(slog_t* p, int level, const char* tag, const char* fmt, va_list ap); -void closeslog(slog_t* p); - -#endif //_SIMPLELOG_H_ diff --git a/bundles/tun2tap/tun2tap.c b/bundles/tun2tap/tun2tap.c deleted file mode 100644 index 02c5958d..00000000 --- a/bundles/tun2tap/tun2tap.c +++ /dev/null @@ -1,9 +0,0 @@ -// -// Created by switchwang(https://github.com/switch-st) on 2018-04-20. -// - -#include "tun2tap.h" - -u8_t* uip_buf = NULL; -u8_t uip_arp_buf[UIP_LLH_LEN + UIP_ARP_LEN]; -u16_t uip_arp_len = 0; diff --git a/bundles/tun2tap/tun2tap.h b/bundles/tun2tap/tun2tap.h deleted file mode 100644 index cb38a422..00000000 --- a/bundles/tun2tap/tun2tap.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// Created by switchwang(https://github.com/switch-st) on 2018-04-14. -// - -#ifndef _TUN2TAP_H_ -#define _TUN2TAP_H_ - -#ifdef HTONS -#undef HTONS -#endif - -#include "uip-conf.h" -#include -#include - -#define UIP_ARP_LEN 28 - -struct arp_hdr { - struct uip_eth_hdr ethhdr; - u16_t hwtype; - u16_t protocol; - u8_t hwlen; - u8_t protolen; - u16_t opcode; - struct uip_eth_addr shwaddr; - u16_t sipaddr[2]; - struct uip_eth_addr dhwaddr; - u16_t dipaddr[2]; -}; - -struct ethip_hdr { - struct uip_eth_hdr ethhdr; - /* IP header. */ - u8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - u16_t ipchksum; - u16_t srcipaddr[2], - destipaddr[2]; -}; - -#define BUF ((struct arp_hdr *)&uip_buf[0]) -#define IPBUF ((struct ethip_hdr *)&uip_buf[0]) - -extern u8_t* uip_buf; -extern u8_t uip_arp_buf[UIP_LLH_LEN + UIP_ARP_LEN]; -extern u16_t uip_arp_len; - -#endif //_TUN2TAP_H_ diff --git a/bundles/tun2tap/tun2tap_appdef.h b/bundles/tun2tap/tun2tap_appdef.h deleted file mode 100644 index 03d490da..00000000 --- a/bundles/tun2tap/tun2tap_appdef.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// Created by switchwang(https://github.com/switch-st) on 2018-04-14. -// - -#ifndef _TUN2TAP_DEFINE_H_ -#define _TUN2TAP_DEFINE_H_ - -#define uip_tcp_appstate_t void* -#define UIP_APPCALL() - -extern u8_t* uip_buf; - -#endif //_TUN2TAP_DEFINE_H_ diff --git a/bundles/tun2tap/uip-conf.h b/bundles/tun2tap/uip-conf.h deleted file mode 100644 index 8b755cc1..00000000 --- a/bundles/tun2tap/uip-conf.h +++ /dev/null @@ -1,163 +0,0 @@ -/** - * \addtogroup uipopt - * @{ - */ - -/** - * \name Project-specific configuration options - * @{ - * - * uIP has a number of configuration options that can be overridden - * for each project. These are kept in a project-specific uip-conf.h - * file and all configuration names have the prefix UIP_CONF. - */ - -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * $Id: uip-conf.h,v 1.6 2006/06/12 08:00:31 adam Exp $ - */ - -/** - * \file - * An example uIP configuration file - * \author - * Adam Dunkels - */ - -#ifndef __UIP_CONF_H__ -#define __UIP_CONF_H__ - -#include - -/** - * 8 bit datatype - * - * This typedef defines the 8-bit type used throughout uIP. - * - * \hideinitializer - */ -typedef uint8_t u8_t; - -/** - * 16 bit datatype - * - * This typedef defines the 16-bit type used throughout uIP. - * - * \hideinitializer - */ -typedef uint16_t u16_t; - -/** - * Statistics datatype - * - * This typedef defines the dataype used for keeping statistics in - * uIP. - * - * \hideinitializer - */ -typedef unsigned short uip_stats_t; - -/** - * Maximum number of TCP connections. - * - * \hideinitializer - */ -#define UIP_CONF_MAX_CONNECTIONS 40 - -/** - * Maximum number of listening TCP ports. - * - * \hideinitializer - */ -#define UIP_CONF_MAX_LISTENPORTS 40 - -/** - * uIP buffer size. - * - * \hideinitializer - */ -/*#define UIP_CONF_BUFFER_SIZE 420*/ -#define UIP_CONF_BUFFER_SIZE 2048 - -/** - * Manually define the uip_buf. - * - * \hideinitializer - */ -#define UIP_CONF_EXTERNAL_BUFFER - -/** - * CPU byte order. - * Defined in CMakeList.txt - * - * \hideinitializer - */ -#ifndef UIP_CONF_BYTE_ORDER -#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN -#endif - -/** - * Logging on or off - * - * \hideinitializer - */ -/*#define UIP_CONF_LOGGING 1*/ -#define UIP_CONF_LOGGING 0 - -/** - * UDP support on or off - * - * \hideinitializer - */ -#define UIP_CONF_UDP 0 - -/** - * UDP checksums on or off - * - * \hideinitializer - */ -#define UIP_CONF_UDP_CHECKSUMS 1 - -/** - * uIP statistics on or off - * - * \hideinitializer - */ -#define UIP_CONF_STATISTICS 1 - -/* Here we include the header file for the application(s) we use in - our project. */ -#include "tun2tap_appdef.h" - -#endif /* __UIP_CONF_H__ */ - -/** @} */ -/** @} */ diff --git a/bundles/uip/README b/bundles/uip/README deleted file mode 100644 index b5015386..00000000 --- a/bundles/uip/README +++ /dev/null @@ -1,13 +0,0 @@ -uIP is a very small implementation of the TCP/IP stack that is written -by Adam Dunkels . More information can be obtained -at the uIP homepage at http://www.sics.se/~adam/uip/. - -This is version $Name: uip-1-0 $. - -The directory structure look as follows: - -apps/ - Example applications -doc/ - Documentation -lib/ - Library code used by some applications -uip/ - uIP TCP/IP stack code -unix/ - uIP as a user space process under FreeBSD or Linux diff --git a/bundles/uip/apps/README b/bundles/uip/apps/README deleted file mode 100644 index 0096c4e4..00000000 --- a/bundles/uip/apps/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains a few example applications. They are not all -heavily tested, however. diff --git a/bundles/uip/apps/dhcpc/Makefile.dhcpc b/bundles/uip/apps/dhcpc/Makefile.dhcpc deleted file mode 100644 index f84c84ff..00000000 --- a/bundles/uip/apps/dhcpc/Makefile.dhcpc +++ /dev/null @@ -1 +0,0 @@ -APP_SOURCES += dhcpc.c timer.c diff --git a/bundles/uip/apps/dhcpc/dhcpc.c b/bundles/uip/apps/dhcpc/dhcpc.c deleted file mode 100644 index ac738e7e..00000000 --- a/bundles/uip/apps/dhcpc/dhcpc.c +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * @(#)$Id: dhcpc.c,v 1.2 2006/06/11 21:46:37 adam Exp $ - */ - -#include -#include - -#include "uip.h" -#include "dhcpc.h" -#include "timer.h" -#include "pt.h" - -#define STATE_INITIAL 0 -#define STATE_SENDING 1 -#define STATE_OFFER_RECEIVED 2 -#define STATE_CONFIG_RECEIVED 3 - -static struct dhcpc_state s; - -struct dhcp_msg { - u8_t op, htype, hlen, hops; - u8_t xid[4]; - u16_t secs, flags; - u8_t ciaddr[4]; - u8_t yiaddr[4]; - u8_t siaddr[4]; - u8_t giaddr[4]; - u8_t chaddr[16]; -#ifndef UIP_CONF_DHCP_LIGHT - u8_t sname[64]; - u8_t file[128]; -#endif - u8_t options[312]; -}; - -#define BOOTP_BROADCAST 0x8000 - -#define DHCP_REQUEST 1 -#define DHCP_REPLY 2 -#define DHCP_HTYPE_ETHERNET 1 -#define DHCP_HLEN_ETHERNET 6 -#define DHCP_MSG_LEN 236 - -#define DHCPC_SERVER_PORT 67 -#define DHCPC_CLIENT_PORT 68 - -#define DHCPDISCOVER 1 -#define DHCPOFFER 2 -#define DHCPREQUEST 3 -#define DHCPDECLINE 4 -#define DHCPACK 5 -#define DHCPNAK 6 -#define DHCPRELEASE 7 - -#define DHCP_OPTION_SUBNET_MASK 1 -#define DHCP_OPTION_ROUTER 3 -#define DHCP_OPTION_DNS_SERVER 6 -#define DHCP_OPTION_REQ_IPADDR 50 -#define DHCP_OPTION_LEASE_TIME 51 -#define DHCP_OPTION_MSG_TYPE 53 -#define DHCP_OPTION_SERVER_ID 54 -#define DHCP_OPTION_REQ_LIST 55 -#define DHCP_OPTION_END 255 - -static const u8_t xid[4] = {0xad, 0xde, 0x12, 0x23}; -static const u8_t magic_cookie[4] = {99, 130, 83, 99}; -/*---------------------------------------------------------------------------*/ -static u8_t * -add_msg_type(u8_t *optptr, u8_t type) -{ - *optptr++ = DHCP_OPTION_MSG_TYPE; - *optptr++ = 1; - *optptr++ = type; - return optptr; -} -/*---------------------------------------------------------------------------*/ -static u8_t * -add_server_id(u8_t *optptr) -{ - *optptr++ = DHCP_OPTION_SERVER_ID; - *optptr++ = 4; - memcpy(optptr, s.serverid, 4); - return optptr + 4; -} -/*---------------------------------------------------------------------------*/ -static u8_t * -add_req_ipaddr(u8_t *optptr) -{ - *optptr++ = DHCP_OPTION_REQ_IPADDR; - *optptr++ = 4; - memcpy(optptr, s.ipaddr, 4); - return optptr + 4; -} -/*---------------------------------------------------------------------------*/ -static u8_t * -add_req_options(u8_t *optptr) -{ - *optptr++ = DHCP_OPTION_REQ_LIST; - *optptr++ = 3; - *optptr++ = DHCP_OPTION_SUBNET_MASK; - *optptr++ = DHCP_OPTION_ROUTER; - *optptr++ = DHCP_OPTION_DNS_SERVER; - return optptr; -} -/*---------------------------------------------------------------------------*/ -static u8_t * -add_end(u8_t *optptr) -{ - *optptr++ = DHCP_OPTION_END; - return optptr; -} -/*---------------------------------------------------------------------------*/ -static void -create_msg(register struct dhcp_msg *m) -{ - m->op = DHCP_REQUEST; - m->htype = DHCP_HTYPE_ETHERNET; - m->hlen = s.mac_len; - m->hops = 0; - memcpy(m->xid, xid, sizeof(m->xid)); - m->secs = 0; - m->flags = HTONS(BOOTP_BROADCAST); /* Broadcast bit. */ - /* uip_ipaddr_copy(m->ciaddr, uip_hostaddr);*/ - memcpy(m->ciaddr, uip_hostaddr, sizeof(m->ciaddr)); - memset(m->yiaddr, 0, sizeof(m->yiaddr)); - memset(m->siaddr, 0, sizeof(m->siaddr)); - memset(m->giaddr, 0, sizeof(m->giaddr)); - memcpy(m->chaddr, s.mac_addr, s.mac_len); - memset(&m->chaddr[s.mac_len], 0, sizeof(m->chaddr) - s.mac_len); -#ifndef UIP_CONF_DHCP_LIGHT - memset(m->sname, 0, sizeof(m->sname)); - memset(m->file, 0, sizeof(m->file)); -#endif - - memcpy(m->options, magic_cookie, sizeof(magic_cookie)); -} -/*---------------------------------------------------------------------------*/ -static void -send_discover(void) -{ - u8_t *end; - struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; - - create_msg(m); - - end = add_msg_type(&m->options[4], DHCPDISCOVER); - end = add_req_options(end); - end = add_end(end); - - uip_send(uip_appdata, end - (u8_t *)uip_appdata); -} -/*---------------------------------------------------------------------------*/ -static void -send_request(void) -{ - u8_t *end; - struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; - - create_msg(m); - - end = add_msg_type(&m->options[4], DHCPREQUEST); - end = add_server_id(end); - end = add_req_ipaddr(end); - end = add_end(end); - - uip_send(uip_appdata, end - (u8_t *)uip_appdata); -} -/*---------------------------------------------------------------------------*/ -static u8_t -parse_options(u8_t *optptr, int len) -{ - u8_t *end = optptr + len; - u8_t type = 0; - - while(optptr < end) { - switch(*optptr) { - case DHCP_OPTION_SUBNET_MASK: - memcpy(s.netmask, optptr + 2, 4); - break; - case DHCP_OPTION_ROUTER: - memcpy(s.default_router, optptr + 2, 4); - break; - case DHCP_OPTION_DNS_SERVER: - memcpy(s.dnsaddr, optptr + 2, 4); - break; - case DHCP_OPTION_MSG_TYPE: - type = *(optptr + 2); - break; - case DHCP_OPTION_SERVER_ID: - memcpy(s.serverid, optptr + 2, 4); - break; - case DHCP_OPTION_LEASE_TIME: - memcpy(s.lease_time, optptr + 2, 4); - break; - case DHCP_OPTION_END: - return type; - } - - optptr += optptr[1] + 2; - } - return type; -} -/*---------------------------------------------------------------------------*/ -static u8_t -parse_msg(void) -{ - struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; - - if(m->op == DHCP_REPLY && - memcmp(m->xid, xid, sizeof(xid)) == 0 && - memcmp(m->chaddr, s.mac_addr, s.mac_len) == 0) { - memcpy(s.ipaddr, m->yiaddr, 4); - return parse_options(&m->options[4], uip_datalen()); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_dhcp(void)) -{ - PT_BEGIN(&s.pt); - - /* try_again:*/ - s.state = STATE_SENDING; - s.ticks = CLOCK_SECOND; - - do { - send_discover(); - timer_set(&s.timer, s.ticks); - PT_WAIT_UNTIL(&s.pt, uip_newdata() || timer_expired(&s.timer)); - - if(uip_newdata() && parse_msg() == DHCPOFFER) { - s.state = STATE_OFFER_RECEIVED; - break; - } - - if(s.ticks < CLOCK_SECOND * 60) { - s.ticks *= 2; - } - } while(s.state != STATE_OFFER_RECEIVED); - - s.ticks = CLOCK_SECOND; - - do { - send_request(); - timer_set(&s.timer, s.ticks); - PT_WAIT_UNTIL(&s.pt, uip_newdata() || timer_expired(&s.timer)); - - if(uip_newdata() && parse_msg() == DHCPACK) { - s.state = STATE_CONFIG_RECEIVED; - break; - } - - if(s.ticks <= CLOCK_SECOND * 10) { - s.ticks += CLOCK_SECOND; - } else { - PT_RESTART(&s.pt); - } - } while(s.state != STATE_CONFIG_RECEIVED); - -#if 0 - printf("Got IP address %d.%d.%d.%d\n", - uip_ipaddr1(s.ipaddr), uip_ipaddr2(s.ipaddr), - uip_ipaddr3(s.ipaddr), uip_ipaddr4(s.ipaddr)); - printf("Got netmask %d.%d.%d.%d\n", - uip_ipaddr1(s.netmask), uip_ipaddr2(s.netmask), - uip_ipaddr3(s.netmask), uip_ipaddr4(s.netmask)); - printf("Got DNS server %d.%d.%d.%d\n", - uip_ipaddr1(s.dnsaddr), uip_ipaddr2(s.dnsaddr), - uip_ipaddr3(s.dnsaddr), uip_ipaddr4(s.dnsaddr)); - printf("Got default router %d.%d.%d.%d\n", - uip_ipaddr1(s.default_router), uip_ipaddr2(s.default_router), - uip_ipaddr3(s.default_router), uip_ipaddr4(s.default_router)); - printf("Lease expires in %ld seconds\n", - ntohs(s.lease_time[0])*65536ul + ntohs(s.lease_time[1])); -#endif - - dhcpc_configured(&s); - - /* timer_stop(&s.timer);*/ - - /* - * PT_END restarts the thread so we do this instead. Eventually we - * should reacquire expired leases here. - */ - while(1) { - PT_YIELD(&s.pt); - } - - PT_END(&s.pt); -} -/*---------------------------------------------------------------------------*/ -void -dhcpc_init(const void *mac_addr, int mac_len) -{ - uip_ipaddr_t addr; - - s.mac_addr = mac_addr; - s.mac_len = mac_len; - - s.state = STATE_INITIAL; - uip_ipaddr(addr, 255,255,255,255); - s.conn = uip_udp_new(&addr, HTONS(DHCPC_SERVER_PORT)); - if(s.conn != NULL) { - uip_udp_bind(s.conn, HTONS(DHCPC_CLIENT_PORT)); - } - PT_INIT(&s.pt); -} -/*---------------------------------------------------------------------------*/ -void -dhcpc_appcall(void) -{ - handle_dhcp(); -} -/*---------------------------------------------------------------------------*/ -void -dhcpc_request(void) -{ - u16_t ipaddr[2]; - - if(s.state == STATE_INITIAL) { - uip_ipaddr(ipaddr, 0,0,0,0); - uip_sethostaddr(ipaddr); - /* handle_dhcp(PROCESS_EVENT_NONE, NULL);*/ - } -} -/*---------------------------------------------------------------------------*/ diff --git a/bundles/uip/apps/dhcpc/dhcpc.h b/bundles/uip/apps/dhcpc/dhcpc.h deleted file mode 100644 index c6550ec5..00000000 --- a/bundles/uip/apps/dhcpc/dhcpc.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * @(#)$Id: dhcpc.h,v 1.3 2006/06/11 21:46:37 adam Exp $ - */ -#ifndef __DHCPC_H__ -#define __DHCPC_H__ - -#include "timer.h" -#include "pt.h" - -struct dhcpc_state { - struct pt pt; - char state; - struct uip_udp_conn *conn; - struct timer timer; - u16_t ticks; - const void *mac_addr; - int mac_len; - - u8_t serverid[4]; - - u16_t lease_time[2]; - u16_t ipaddr[2]; - u16_t netmask[2]; - u16_t dnsaddr[2]; - u16_t default_router[2]; -}; - -void dhcpc_init(const void *mac_addr, int mac_len); -void dhcpc_request(void); - -void dhcpc_appcall(void); - -void dhcpc_configured(const struct dhcpc_state *s); - -typedef struct dhcpc_state uip_udp_appstate_t; -#define UIP_UDP_APPCALL dhcpc_appcall - - -#endif /* __DHCPC_H__ */ diff --git a/bundles/uip/apps/hello-world/Makefile.hello-world b/bundles/uip/apps/hello-world/Makefile.hello-world deleted file mode 100644 index e34aaf51..00000000 --- a/bundles/uip/apps/hello-world/Makefile.hello-world +++ /dev/null @@ -1 +0,0 @@ -APP_SOURCES += hello-world.c diff --git a/bundles/uip/apps/hello-world/hello-world.c b/bundles/uip/apps/hello-world/hello-world.c deleted file mode 100644 index 7d0697ce..00000000 --- a/bundles/uip/apps/hello-world/hello-world.c +++ /dev/null @@ -1,100 +0,0 @@ -/** - * \addtogroup helloworld - * @{ - */ - -/** - * \file - * An example of how to write uIP applications - * with protosockets. - * \author - * Adam Dunkels - */ - -/* - * This is a short example of how to write uIP applications using - * protosockets. - */ - -/* - * We define the application state (struct hello_world_state) in the - * hello-world.h file, so we need to include it here. We also include - * uip.h (since this cannot be included in hello-world.h) and - * , since we use the memcpy() function in the code. - */ -#include "hello-world.h" -#include "uip.h" -#include - -/* - * Declaration of the protosocket function that handles the connection - * (defined at the end of the code). - */ -static int handle_connection(struct hello_world_state *s); -/*---------------------------------------------------------------------------*/ -/* - * The initialization function. We must explicitly call this function - * from the system initialization code, some time after uip_init() is - * called. - */ -void -hello_world_init(void) -{ - /* We start to listen for connections on TCP port 1000. */ - uip_listen(HTONS(1000)); -} -/*---------------------------------------------------------------------------*/ -/* - * In hello-world.h we have defined the UIP_APPCALL macro to - * hello_world_appcall so that this funcion is uIP's application - * function. This function is called whenever an uIP event occurs - * (e.g. when a new connection is established, new data arrives, sent - * data is acknowledged, data needs to be retransmitted, etc.). - */ -void -hello_world_appcall(void) -{ - /* - * The uip_conn structure has a field called "appstate" that holds - * the application state of the connection. We make a pointer to - * this to access it easier. - */ - struct hello_world_state *s = &(uip_conn->appstate); - - /* - * If a new connection was just established, we should initialize - * the protosocket in our applications' state structure. - */ - if(uip_connected()) { - PSOCK_INIT(&s->p, s->inputbuffer, sizeof(s->inputbuffer)); - } - - /* - * Finally, we run the protosocket function that actually handles - * the communication. We pass it a pointer to the application state - * of the current connection. - */ - handle_connection(s); -} -/*---------------------------------------------------------------------------*/ -/* - * This is the protosocket function that handles the communication. A - * protosocket function must always return an int, but must never - * explicitly return - all return statements are hidden in the PSOCK - * macros. - */ -static int -handle_connection(struct hello_world_state *s) -{ - PSOCK_BEGIN(&s->p); - - PSOCK_SEND_STR(&s->p, "Hello. What is your name?\n"); - PSOCK_READTO(&s->p, '\n'); - strncpy(s->name, s->inputbuffer, sizeof(s->name)); - PSOCK_SEND_STR(&s->p, "Hello "); - PSOCK_SEND_STR(&s->p, s->name); - PSOCK_CLOSE(&s->p); - - PSOCK_END(&s->p); -} -/*---------------------------------------------------------------------------*/ diff --git a/bundles/uip/apps/hello-world/hello-world.h b/bundles/uip/apps/hello-world/hello-world.h deleted file mode 100644 index 5ef333b8..00000000 --- a/bundles/uip/apps/hello-world/hello-world.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * \addtogroup apps - * @{ - */ - -/** - * \defgroup helloworld Hello, world - * @{ - * - * A small example showing how to write applications with - * \ref psock "protosockets". - */ - -/** - * \file - * Header file for an example of how to write uIP applications - * with protosockets. - * \author - * Adam Dunkels - */ - -#ifndef __HELLO_WORLD_H__ -#define __HELLO_WORLD_H__ - -/* Since this file will be included by uip.h, we cannot include uip.h - here. But we might need to include uipopt.h if we need the u8_t and - u16_t datatypes. */ -#include "uipopt.h" - -#include "psock.h" - -/* Next, we define the uip_tcp_appstate_t datatype. This is the state - of our application, and the memory required for this state is - allocated together with each TCP connection. One application state - for each TCP connection. */ -typedef struct hello_world_state { - struct psock p; - char inputbuffer[10]; - char name[40]; -} uip_tcp_appstate_t; - -/* Finally we define the application function to be called by uIP. */ -void hello_world_appcall(void); -#ifndef UIP_APPCALL -#define UIP_APPCALL hello_world_appcall -#endif /* UIP_APPCALL */ - -void hello_world_init(void); - -#endif /* __HELLO_WORLD_H__ */ -/** @} */ -/** @} */ diff --git a/bundles/uip/apps/resolv/Makefile.resolv b/bundles/uip/apps/resolv/Makefile.resolv deleted file mode 100644 index 94c37d8c..00000000 --- a/bundles/uip/apps/resolv/Makefile.resolv +++ /dev/null @@ -1 +0,0 @@ -APP_SOURCES += resolv.c diff --git a/bundles/uip/apps/resolv/resolv.c b/bundles/uip/apps/resolv/resolv.c deleted file mode 100644 index 8afbca6c..00000000 --- a/bundles/uip/apps/resolv/resolv.c +++ /dev/null @@ -1,464 +0,0 @@ -/** - * \addtogroup apps - * @{ - */ - -/** - * \defgroup resolv DNS resolver - * @{ - * - * The uIP DNS resolver functions are used to lookup a hostname and - * map it to a numerical IP address. It maintains a list of resolved - * hostnames that can be queried with the resolv_lookup() - * function. New hostnames can be resolved using the resolv_query() - * function. - * - * When a hostname has been resolved (or found to be non-existant), - * the resolver code calls a callback function called resolv_found() - * that must be implemented by the module that uses the resolver. - */ - -/** - * \file - * DNS host name to IP address resolver. - * \author Adam Dunkels - * - * This file implements a DNS host name to IP address resolver. - */ - -/* - * Copyright (c) 2002-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: resolv.c,v 1.5 2006/06/11 21:46:37 adam Exp $ - * - */ - -#include "resolv.h" -#include "uip.h" - -#include - -#ifndef NULL -#define NULL (void *)0 -#endif /* NULL */ - -/** \internal The maximum number of retries when asking for a name. */ -#define MAX_RETRIES 8 - -/** \internal The DNS message header. */ -struct dns_hdr { - u16_t id; - u8_t flags1, flags2; -#define DNS_FLAG1_RESPONSE 0x80 -#define DNS_FLAG1_OPCODE_STATUS 0x10 -#define DNS_FLAG1_OPCODE_INVERSE 0x08 -#define DNS_FLAG1_OPCODE_STANDARD 0x00 -#define DNS_FLAG1_AUTHORATIVE 0x04 -#define DNS_FLAG1_TRUNC 0x02 -#define DNS_FLAG1_RD 0x01 -#define DNS_FLAG2_RA 0x80 -#define DNS_FLAG2_ERR_MASK 0x0f -#define DNS_FLAG2_ERR_NONE 0x00 -#define DNS_FLAG2_ERR_NAME 0x03 - u16_t numquestions; - u16_t numanswers; - u16_t numauthrr; - u16_t numextrarr; -}; - -/** \internal The DNS answer message structure. */ -struct dns_answer { - /* DNS answer record starts with either a domain name or a pointer - to a name already present somewhere in the packet. */ - u16_t type; - u16_t class; - u16_t ttl[2]; - u16_t len; - uip_ipaddr_t ipaddr; -}; - -struct namemap { -#define STATE_UNUSED 0 -#define STATE_NEW 1 -#define STATE_ASKING 2 -#define STATE_DONE 3 -#define STATE_ERROR 4 - u8_t state; - u8_t tmr; - u8_t retries; - u8_t seqno; - u8_t err; - char name[32]; - uip_ipaddr_t ipaddr; -}; - -#ifndef UIP_CONF_RESOLV_ENTRIES -#define RESOLV_ENTRIES 4 -#else /* UIP_CONF_RESOLV_ENTRIES */ -#define RESOLV_ENTRIES UIP_CONF_RESOLV_ENTRIES -#endif /* UIP_CONF_RESOLV_ENTRIES */ - - -static struct namemap names[RESOLV_ENTRIES]; - -static u8_t seqno; - -static struct uip_udp_conn *resolv_conn = NULL; - - -/*---------------------------------------------------------------------------*/ -/** \internal - * Walk through a compact encoded DNS name and return the end of it. - * - * \return The end of the name. - */ -/*---------------------------------------------------------------------------*/ -static unsigned char * -parse_name(unsigned char *query) -{ - unsigned char n; - - do { - n = *query++; - - while(n > 0) { - /* printf("%c", *query);*/ - ++query; - --n; - }; - /* printf(".");*/ - } while(*query != 0); - /* printf("\n");*/ - return query + 1; -} -/*---------------------------------------------------------------------------*/ -/** \internal - * Runs through the list of names to see if there are any that have - * not yet been queried and, if so, sends out a query. - */ -/*---------------------------------------------------------------------------*/ -static void -check_entries(void) -{ - register struct dns_hdr *hdr; - char *query, *nptr, *nameptr; - static u8_t i; - static u8_t n; - register struct namemap *namemapptr; - - for(i = 0; i < RESOLV_ENTRIES; ++i) { - namemapptr = &names[i]; - if(namemapptr->state == STATE_NEW || - namemapptr->state == STATE_ASKING) { - if(namemapptr->state == STATE_ASKING) { - if(--namemapptr->tmr == 0) { - if(++namemapptr->retries == MAX_RETRIES) { - namemapptr->state = STATE_ERROR; - resolv_found(namemapptr->name, NULL); - continue; - } - namemapptr->tmr = namemapptr->retries; - } else { - /* printf("Timer %d\n", namemapptr->tmr);*/ - /* Its timer has not run out, so we move on to next - entry. */ - continue; - } - } else { - namemapptr->state = STATE_ASKING; - namemapptr->tmr = 1; - namemapptr->retries = 0; - } - hdr = (struct dns_hdr *)uip_appdata; - memset(hdr, 0, sizeof(struct dns_hdr)); - hdr->id = htons(i); - hdr->flags1 = DNS_FLAG1_RD; - hdr->numquestions = HTONS(1); - query = (char *)uip_appdata + 12; - nameptr = namemapptr->name; - --nameptr; - /* Convert hostname into suitable query format. */ - do { - ++nameptr; - nptr = query; - ++query; - for(n = 0; *nameptr != '.' && *nameptr != 0; ++nameptr) { - *query = *nameptr; - ++query; - ++n; - } - *nptr = n; - } while(*nameptr != 0); - { - static unsigned char endquery[] = - {0,0,1,0,1}; - memcpy(query, endquery, 5); - } - uip_udp_send((unsigned char)(query + 5 - (char *)uip_appdata)); - break; - } - } -} -/*---------------------------------------------------------------------------*/ -/** \internal - * Called when new UDP data arrives. - */ -/*---------------------------------------------------------------------------*/ -static void -newdata(void) -{ - char *nameptr; - struct dns_answer *ans; - struct dns_hdr *hdr; - static u8_t nquestions, nanswers; - static u8_t i; - register struct namemap *namemapptr; - - hdr = (struct dns_hdr *)uip_appdata; - /* printf("ID %d\n", htons(hdr->id)); - printf("Query %d\n", hdr->flags1 & DNS_FLAG1_RESPONSE); - printf("Error %d\n", hdr->flags2 & DNS_FLAG2_ERR_MASK); - printf("Num questions %d, answers %d, authrr %d, extrarr %d\n", - htons(hdr->numquestions), - htons(hdr->numanswers), - htons(hdr->numauthrr), - htons(hdr->numextrarr)); - */ - - /* The ID in the DNS header should be our entry into the name - table. */ - i = htons(hdr->id); - namemapptr = &names[i]; - if(i < RESOLV_ENTRIES && - namemapptr->state == STATE_ASKING) { - - /* This entry is now finished. */ - namemapptr->state = STATE_DONE; - namemapptr->err = hdr->flags2 & DNS_FLAG2_ERR_MASK; - - /* Check for error. If so, call callback to inform. */ - if(namemapptr->err != 0) { - namemapptr->state = STATE_ERROR; - resolv_found(namemapptr->name, NULL); - return; - } - - /* We only care about the question(s) and the answers. The authrr - and the extrarr are simply discarded. */ - nquestions = htons(hdr->numquestions); - nanswers = htons(hdr->numanswers); - - /* Skip the name in the question. XXX: This should really be - checked agains the name in the question, to be sure that they - match. */ - nameptr = parse_name((char *)uip_appdata + 12) + 4; - - while(nanswers > 0) { - /* The first byte in the answer resource record determines if it - is a compressed record or a normal one. */ - if(*nameptr & 0xc0) { - /* Compressed name. */ - nameptr +=2; - /* printf("Compressed anwser\n");*/ - } else { - /* Not compressed name. */ - nameptr = parse_name((char *)nameptr); - } - - ans = (struct dns_answer *)nameptr; - /* printf("Answer: type %x, class %x, ttl %x, length %x\n", - htons(ans->type), htons(ans->class), (htons(ans->ttl[0]) - << 16) | htons(ans->ttl[1]), htons(ans->len));*/ - - /* Check for IP address type and Internet class. Others are - discarded. */ - if(ans->type == HTONS(1) && - ans->class == HTONS(1) && - ans->len == HTONS(4)) { - /* printf("IP address %d.%d.%d.%d\n", - htons(ans->ipaddr[0]) >> 8, - htons(ans->ipaddr[0]) & 0xff, - htons(ans->ipaddr[1]) >> 8, - htons(ans->ipaddr[1]) & 0xff);*/ - /* XXX: we should really check that this IP address is the one - we want. */ - namemapptr->ipaddr[0] = ans->ipaddr[0]; - namemapptr->ipaddr[1] = ans->ipaddr[1]; - - resolv_found(namemapptr->name, namemapptr->ipaddr); - return; - } else { - nameptr = nameptr + 10 + htons(ans->len); - } - --nanswers; - } - } - -} -/*---------------------------------------------------------------------------*/ -/** \internal - * The main UDP function. - */ -/*---------------------------------------------------------------------------*/ -void -resolv_appcall(void) -{ - if(uip_udp_conn->rport == HTONS(53)) { - if(uip_poll()) { - check_entries(); - } - if(uip_newdata()) { - newdata(); - } - } -} -/*---------------------------------------------------------------------------*/ -/** - * Queues a name so that a question for the name will be sent out. - * - * \param name The hostname that is to be queried. - */ -/*---------------------------------------------------------------------------*/ -void -resolv_query(char *name) -{ - static u8_t i; - static u8_t lseq, lseqi; - register struct namemap *nameptr; - - lseq = lseqi = 0; - - for(i = 0; i < RESOLV_ENTRIES; ++i) { - nameptr = &names[i]; - if(nameptr->state == STATE_UNUSED) { - break; - } - if(seqno - nameptr->seqno > lseq) { - lseq = seqno - nameptr->seqno; - lseqi = i; - } - } - - if(i == RESOLV_ENTRIES) { - i = lseqi; - nameptr = &names[i]; - } - - /* printf("Using entry %d\n", i);*/ - - strcpy(nameptr->name, name); - nameptr->state = STATE_NEW; - nameptr->seqno = seqno; - ++seqno; -} -/*---------------------------------------------------------------------------*/ -/** - * Look up a hostname in the array of known hostnames. - * - * \note This function only looks in the internal array of known - * hostnames, it does not send out a query for the hostname if none - * was found. The function resolv_query() can be used to send a query - * for a hostname. - * - * \return A pointer to a 4-byte representation of the hostname's IP - * address, or NULL if the hostname was not found in the array of - * hostnames. - */ -/*---------------------------------------------------------------------------*/ -u16_t * -resolv_lookup(char *name) -{ - static u8_t i; - struct namemap *nameptr; - - /* Walk through the list to see if the name is in there. If it is - not, we return NULL. */ - for(i = 0; i < RESOLV_ENTRIES; ++i) { - nameptr = &names[i]; - if(nameptr->state == STATE_DONE && - strcmp(name, nameptr->name) == 0) { - return nameptr->ipaddr; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -/** - * Obtain the currently configured DNS server. - * - * \return A pointer to a 4-byte representation of the IP address of - * the currently configured DNS server or NULL if no DNS server has - * been configured. - */ -/*---------------------------------------------------------------------------*/ -u16_t * -resolv_getserver(void) -{ - if(resolv_conn == NULL) { - return NULL; - } - return resolv_conn->ripaddr; -} -/*---------------------------------------------------------------------------*/ -/** - * Configure which DNS server to use for queries. - * - * \param dnsserver A pointer to a 4-byte representation of the IP - * address of the DNS server to be configured. - */ -/*---------------------------------------------------------------------------*/ -void -resolv_conf(u16_t *dnsserver) -{ - if(resolv_conn != NULL) { - uip_udp_remove(resolv_conn); - } - - resolv_conn = uip_udp_new(dnsserver, HTONS(53)); -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the resolver. - */ -/*---------------------------------------------------------------------------*/ -void -resolv_init(void) -{ - static u8_t i; - - for(i = 0; i < RESOLV_ENTRIES; ++i) { - names[i].state = STATE_DONE; - } - -} -/*---------------------------------------------------------------------------*/ - -/** @} */ -/** @} */ diff --git a/bundles/uip/apps/resolv/resolv.h b/bundles/uip/apps/resolv/resolv.h deleted file mode 100644 index abab34e1..00000000 --- a/bundles/uip/apps/resolv/resolv.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * \addtogroup resolv - * @{ - */ -/** - * \file - * DNS resolver code header file. - * \author Adam Dunkels - */ - -/* - * Copyright (c) 2002-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: resolv.h,v 1.4 2006/06/11 21:46:37 adam Exp $ - * - */ -#ifndef __RESOLV_H__ -#define __RESOLV_H__ - -typedef int uip_udp_appstate_t; -void resolv_appcall(void); -#define UIP_UDP_APPCALL resolv_appcall - -#include "uipopt.h" - -/** - * Callback function which is called when a hostname is found. - * - * This function must be implemented by the module that uses the DNS - * resolver. It is called when a hostname is found, or when a hostname - * was not found. - * - * \param name A pointer to the name that was looked up. \param - * ipaddr A pointer to a 4-byte array containing the IP address of the - * hostname, or NULL if the hostname could not be found. - */ -void resolv_found(char *name, u16_t *ipaddr); - -/* Functions. */ -void resolv_conf(u16_t *dnsserver); -u16_t *resolv_getserver(void); -void resolv_init(void); -u16_t *resolv_lookup(char *name); -void resolv_query(char *name); - -#endif /* __RESOLV_H__ */ - -/** @} */ diff --git a/bundles/uip/apps/smtp/Makefile.smtp b/bundles/uip/apps/smtp/Makefile.smtp deleted file mode 100644 index 8b3a5aa4..00000000 --- a/bundles/uip/apps/smtp/Makefile.smtp +++ /dev/null @@ -1 +0,0 @@ -APP_SOURCES += smtp.c smtp-strings.c memb.c diff --git a/bundles/uip/apps/smtp/makestrings b/bundles/uip/apps/smtp/makestrings deleted file mode 100644 index bea18a6c..00000000 --- a/bundles/uip/apps/smtp/makestrings +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - - -sub stringify { - my $name = shift(@_); - open(OUTPUTC, "> $name.c"); - open(OUTPUTH, "> $name.h"); - - open(FILE, "$name"); - - while() { - if(/(.+) "(.+)"/) { - $var = $1; - $data = $2; - - $datan = $data; - $datan =~ s/\\r/\r/g; - $datan =~ s/\\n/\n/g; - $datan =~ s/\\01/\01/g; - $datan =~ s/\\0/\0/g; - - printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); - printf(OUTPUTC "/* \"$data\" */\n"); - printf(OUTPUTC "{"); - for($j = 0; $j < length($datan); $j++) { - printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); - } - printf(OUTPUTC "};\n"); - - printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); - - } - } - close(OUTPUTC); - close(OUTPUTH); -} -stringify("smtp-strings"); - -exit 0; - diff --git a/bundles/uip/apps/smtp/smtp-strings b/bundles/uip/apps/smtp/smtp-strings deleted file mode 100644 index 27f639c2..00000000 --- a/bundles/uip/apps/smtp/smtp-strings +++ /dev/null @@ -1,11 +0,0 @@ -smtp_220 "220" -smtp_helo "HELO " -smtp_mail_from "MAIL FROM: " -smtp_rcpt_to "RCPT TO: " -smtp_data "DATA\r\n" -smtp_to "To: " -smtp_from "From: " -smtp_subject "Subject: " -smtp_quit "QUIT\r\n" -smtp_crnl "\r\n" -smtp_crnlperiodcrnl "\r\n.\r\n" \ No newline at end of file diff --git a/bundles/uip/apps/smtp/smtp-strings.c b/bundles/uip/apps/smtp/smtp-strings.c deleted file mode 100644 index f3981a17..00000000 --- a/bundles/uip/apps/smtp/smtp-strings.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: smtp-strings.c,v 1.3 2006/06/11 21:46:37 adam Exp $ - */ -const char smtp_220[4] = -/* "220" */ -{0x32, 0x32, 0x30, }; -const char smtp_helo[6] = -/* "HELO " */ -{0x48, 0x45, 0x4c, 0x4f, 0x20, }; -const char smtp_mail_from[12] = -/* "MAIL FROM: " */ -{0x4d, 0x41, 0x49, 0x4c, 0x20, 0x46, 0x52, 0x4f, 0x4d, 0x3a, 0x20, }; -const char smtp_rcpt_to[10] = -/* "RCPT TO: " */ -{0x52, 0x43, 0x50, 0x54, 0x20, 0x54, 0x4f, 0x3a, 0x20, }; -const char smtp_data[7] = -/* "DATA\r\n" */ -{0x44, 0x41, 0x54, 0x41, 0xd, 0xa, }; -const char smtp_to[5] = -/* "To: " */ -{0x54, 0x6f, 0x3a, 0x20, }; -const char smtp_cc[5] = -/* "Cc: " */ -{0x43, 0x63, 0x3a, 0x20, }; -const char smtp_from[7] = -/* "From: " */ -{0x46, 0x72, 0x6f, 0x6d, 0x3a, 0x20, }; -const char smtp_subject[10] = -/* "Subject: " */ -{0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x3a, 0x20, }; -const char smtp_quit[7] = -/* "QUIT\r\n" */ -{0x51, 0x55, 0x49, 0x54, 0xd, 0xa, }; -const char smtp_crnl[3] = -/* "\r\n" */ -{0xd, 0xa, }; -const char smtp_crnlperiodcrnl[6] = -/* "\r\n.\r\n" */ -{0xd, 0xa, 0x2e, 0xd, 0xa, }; diff --git a/bundles/uip/apps/smtp/smtp-strings.h b/bundles/uip/apps/smtp/smtp-strings.h deleted file mode 100644 index f5ae68c8..00000000 --- a/bundles/uip/apps/smtp/smtp-strings.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: smtp-strings.h,v 1.3 2006/06/11 21:46:37 adam Exp $ - */ -extern const char smtp_220[4]; -extern const char smtp_helo[6]; -extern const char smtp_mail_from[12]; -extern const char smtp_rcpt_to[10]; -extern const char smtp_data[7]; -extern const char smtp_to[5]; -extern const char smtp_cc[5]; -extern const char smtp_from[7]; -extern const char smtp_subject[10]; -extern const char smtp_quit[7]; -extern const char smtp_crnl[3]; -extern const char smtp_crnlperiodcrnl[6]; diff --git a/bundles/uip/apps/smtp/smtp.c b/bundles/uip/apps/smtp/smtp.c deleted file mode 100644 index a860006a..00000000 --- a/bundles/uip/apps/smtp/smtp.c +++ /dev/null @@ -1,262 +0,0 @@ -/** - * \addtogroup apps - * @{ - */ - -/** - * \defgroup smtp SMTP E-mail sender - * @{ - * - * The Simple Mail Transfer Protocol (SMTP) as defined by RFC821 is - * the standard way of sending and transfering e-mail on the - * Internet. This simple example implementation is intended as an - * example of how to implement protocols in uIP, and is able to send - * out e-mail but has not been extensively tested. - */ - -/** - * \file - * SMTP example implementation - * \author Adam Dunkels - */ - -/* - * Copyright (c) 2004, Adam Dunkels. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: smtp.c,v 1.4 2006/06/11 21:46:37 adam Exp $ - */ -#include "smtp.h" - -#include "smtp-strings.h" -#include "psock.h" -#include "uip.h" - -#include - -static struct smtp_state s; - -static char *localhostname; -static uip_ipaddr_t smtpserver; - -#define ISO_nl 0x0a -#define ISO_cr 0x0d - -#define ISO_period 0x2e - -#define ISO_2 0x32 -#define ISO_3 0x33 -#define ISO_4 0x34 -#define ISO_5 0x35 - - -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(smtp_thread(void)) -{ - PSOCK_BEGIN(&s.psock); - - PSOCK_READTO(&s.psock, ISO_nl); - - if(strncmp(s.inputbuffer, smtp_220, 3) != 0) { - PSOCK_CLOSE(&s.psock); - smtp_done(2); - PSOCK_EXIT(&s.psock); - } - - PSOCK_SEND_STR(&s.psock, (char *)smtp_helo); - PSOCK_SEND_STR(&s.psock, localhostname); - PSOCK_SEND_STR(&s.psock, (char *)smtp_crnl); - - PSOCK_READTO(&s.psock, ISO_nl); - - if(s.inputbuffer[0] != ISO_2) { - PSOCK_CLOSE(&s.psock); - smtp_done(3); - PSOCK_EXIT(&s.psock); - } - - PSOCK_SEND_STR(&s.psock, (char *)smtp_mail_from); - PSOCK_SEND_STR(&s.psock, s.from); - PSOCK_SEND_STR(&s.psock, (char *)smtp_crnl); - - PSOCK_READTO(&s.psock, ISO_nl); - - if(s.inputbuffer[0] != ISO_2) { - PSOCK_CLOSE(&s.psock); - smtp_done(4); - PSOCK_EXIT(&s.psock); - } - - PSOCK_SEND_STR(&s.psock, (char *)smtp_rcpt_to); - PSOCK_SEND_STR(&s.psock, s.to); - PSOCK_SEND_STR(&s.psock, (char *)smtp_crnl); - - PSOCK_READTO(&s.psock, ISO_nl); - - if(s.inputbuffer[0] != ISO_2) { - PSOCK_CLOSE(&s.psock); - smtp_done(5); - PSOCK_EXIT(&s.psock); - } - - if(s.cc != 0) { - PSOCK_SEND_STR(&s.psock, (char *)smtp_rcpt_to); - PSOCK_SEND_STR(&s.psock, s.cc); - PSOCK_SEND_STR(&s.psock, (char *)smtp_crnl); - - PSOCK_READTO(&s.psock, ISO_nl); - - if(s.inputbuffer[0] != ISO_2) { - PSOCK_CLOSE(&s.psock); - smtp_done(6); - PSOCK_EXIT(&s.psock); - } - } - - PSOCK_SEND_STR(&s.psock, (char *)smtp_data); - - PSOCK_READTO(&s.psock, ISO_nl); - - if(s.inputbuffer[0] != ISO_3) { - PSOCK_CLOSE(&s.psock); - smtp_done(7); - PSOCK_EXIT(&s.psock); - } - - PSOCK_SEND_STR(&s.psock, (char *)smtp_to); - PSOCK_SEND_STR(&s.psock, s.to); - PSOCK_SEND_STR(&s.psock, (char *)smtp_crnl); - - if(s.cc != 0) { - PSOCK_SEND_STR(&s.psock, (char *)smtp_cc); - PSOCK_SEND_STR(&s.psock, s.cc); - PSOCK_SEND_STR(&s.psock, (char *)smtp_crnl); - } - - PSOCK_SEND_STR(&s.psock, (char *)smtp_from); - PSOCK_SEND_STR(&s.psock, s.from); - PSOCK_SEND_STR(&s.psock, (char *)smtp_crnl); - - PSOCK_SEND_STR(&s.psock, (char *)smtp_subject); - PSOCK_SEND_STR(&s.psock, s.subject); - PSOCK_SEND_STR(&s.psock, (char *)smtp_crnl); - - PSOCK_SEND(&s.psock, s.msg, s.msglen); - - PSOCK_SEND_STR(&s.psock, (char *)smtp_crnlperiodcrnl); - - PSOCK_READTO(&s.psock, ISO_nl); - if(s.inputbuffer[0] != ISO_2) { - PSOCK_CLOSE(&s.psock); - smtp_done(8); - PSOCK_EXIT(&s.psock); - } - - PSOCK_SEND_STR(&s.psock, (char *)smtp_quit); - smtp_done(SMTP_ERR_OK); - PSOCK_END(&s.psock); -} -/*---------------------------------------------------------------------------*/ -void -smtp_appcall(void) -{ - if(uip_closed()) { - s.connected = 0; - return; - } - if(uip_aborted() || uip_timedout()) { - s.connected = 0; - smtp_done(1); - return; - } - smtp_thread(); -} -/*---------------------------------------------------------------------------*/ -/** - * Specificy an SMTP server and hostname. - * - * This function is used to configure the SMTP module with an SMTP - * server and the hostname of the host. - * - * \param lhostname The hostname of the uIP host. - * - * \param server A pointer to a 4-byte array representing the IP - * address of the SMTP server to be configured. - */ -void -smtp_configure(char *lhostname, void *server) -{ - localhostname = lhostname; - uip_ipaddr_copy(smtpserver, server); -} -/*---------------------------------------------------------------------------*/ -/** - * Send an e-mail. - * - * \param to The e-mail address of the receiver of the e-mail. - * \param cc The e-mail address of the CC: receivers of the e-mail. - * \param from The e-mail address of the sender of the e-mail. - * \param subject The subject of the e-mail. - * \param msg The actual e-mail message. - * \param msglen The length of the e-mail message. - */ -unsigned char -smtp_send(char *to, char *cc, char *from, - char *subject, char *msg, u16_t msglen) -{ - struct uip_conn *conn; - - conn = uip_connect(smtpserver, HTONS(25)); - if(conn == NULL) { - return 0; - } - s.connected = 1; - s.to = to; - s.cc = cc; - s.from = from; - s.subject = subject; - s.msg = msg; - s.msglen = msglen; - - PSOCK_INIT(&s.psock, s.inputbuffer, sizeof(s.inputbuffer)); - - return 1; -} -/*---------------------------------------------------------------------------*/ -void -smtp_init(void) -{ - s.connected = 0; -} -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/bundles/uip/apps/smtp/smtp.h b/bundles/uip/apps/smtp/smtp.h deleted file mode 100644 index 44d0766e..00000000 --- a/bundles/uip/apps/smtp/smtp.h +++ /dev/null @@ -1,103 +0,0 @@ - -/** - * \addtogroup smtp - * @{ - */ - - -/** - * \file - * SMTP header file - * \author Adam Dunkels - */ - -/* - * Copyright (c) 2002, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: smtp.h,v 1.4 2006/06/11 21:46:37 adam Exp $ - * - */ -#ifndef __SMTP_H__ -#define __SMTP_H__ - -#include "uipopt.h" - -/** - * Error number that signifies a non-error condition. - */ -#define SMTP_ERR_OK 0 - -/** - * Callback function that is called when an e-mail transmission is - * done. - * - * This function must be implemented by the module that uses the SMTP - * module. - * - * \param error The number of the error if an error occured, or - * SMTP_ERR_OK. - */ -void smtp_done(unsigned char error); - -void smtp_init(void); - -/* Functions. */ -void smtp_configure(char *localhostname, u16_t *smtpserver); -unsigned char smtp_send(char *to, char *from, - char *subject, char *msg, - u16_t msglen); -#define SMTP_SEND(to, cc, from, subject, msg) \ - smtp_send(to, cc, from, subject, msg, strlen(msg)) - -void smtp_appcall(void); - -struct smtp_state { - u8_t state; - char *to; - char *from; - char *subject; - char *msg; - u16_t msglen; - - u16_t sentlen, textlen; - u16_t sendptr; - -}; - - -#ifndef UIP_APPCALL -#define UIP_APPCALL smtp_appcall -#endif -typedef struct smtp_state uip_tcp_appstate_t; - - -#endif /* __SMTP_H__ */ - -/** @} */ diff --git a/bundles/uip/apps/telnetd/Makefile.telnetd b/bundles/uip/apps/telnetd/Makefile.telnetd deleted file mode 100644 index afb1b593..00000000 --- a/bundles/uip/apps/telnetd/Makefile.telnetd +++ /dev/null @@ -1 +0,0 @@ -APP_SOURCES += telnetd.c shell.c memb.c diff --git a/bundles/uip/apps/telnetd/shell.c b/bundles/uip/apps/telnetd/shell.c deleted file mode 100644 index 9345cae9..00000000 --- a/bundles/uip/apps/telnetd/shell.c +++ /dev/null @@ -1,123 +0,0 @@ - /* - * Copyright (c) 2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: shell.c,v 1.1 2006/06/07 09:43:54 adam Exp $ - * - */ - -#include "shell.h" - -#include - -struct ptentry { - char *commandstr; - void (* pfunc)(char *str); -}; - -#define SHELL_PROMPT "uIP 1.0> " - -/*---------------------------------------------------------------------------*/ -static void -parse(register char *str, struct ptentry *t) -{ - struct ptentry *p; - for(p = t; p->commandstr != NULL; ++p) { - if(strncmp(p->commandstr, str, strlen(p->commandstr)) == 0) { - break; - } - } - - p->pfunc(str); -} -/*---------------------------------------------------------------------------*/ -static void -inttostr(register char *str, unsigned int i) -{ - str[0] = '0' + i / 100; - if(str[0] == '0') { - str[0] = ' '; - } - str[1] = '0' + (i / 10) % 10; - if(str[0] == ' ' && str[1] == '0') { - str[1] = ' '; - } - str[2] = '0' + i % 10; - str[3] = ' '; - str[4] = 0; -} -/*---------------------------------------------------------------------------*/ -static void -help(char *str) -{ - shell_output("Available commands:", ""); - shell_output("stats - show network statistics", ""); - shell_output("conn - show TCP connections", ""); - shell_output("help, ? - show help", ""); - shell_output("exit - exit shell", ""); -} -/*---------------------------------------------------------------------------*/ -static void -unknown(char *str) -{ - if(strlen(str) > 0) { - shell_output("Unknown command: ", str); - } -} -/*---------------------------------------------------------------------------*/ -static struct ptentry parsetab[] = - {{"stats", help}, - {"conn", help}, - {"help", help}, - {"exit", shell_quit}, - {"?", help}, - - /* Default action */ - {NULL, unknown}}; -/*---------------------------------------------------------------------------*/ -void -shell_init(void) -{ -} -/*---------------------------------------------------------------------------*/ -void -shell_start(void) -{ - shell_output("uIP command shell", ""); - shell_output("Type '?' and return for help", ""); - shell_prompt(SHELL_PROMPT); -} -/*---------------------------------------------------------------------------*/ -void -shell_input(char *cmd) -{ - parse(cmd, parsetab); - shell_prompt(SHELL_PROMPT); -} -/*---------------------------------------------------------------------------*/ diff --git a/bundles/uip/apps/telnetd/shell.h b/bundles/uip/apps/telnetd/shell.h deleted file mode 100644 index b57d7be2..00000000 --- a/bundles/uip/apps/telnetd/shell.h +++ /dev/null @@ -1,104 +0,0 @@ -/** - * \file - * Interface for the Contiki shell. - * \author Adam Dunkels - * - * Some of the functions declared in this file must be implemented as - * a shell back-end in the architecture specific files of a Contiki - * port. - */ - - -/* - * Copyright (c) 2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the Contiki desktop OS. - * - * $Id: shell.h,v 1.1 2006/06/07 09:43:54 adam Exp $ - * - */ -#ifndef __SHELL_H__ -#define __SHELL_H__ - -/** - * Initialize the shell. - * - * Called when the shell front-end process starts. This function may - * be used to start listening for signals. - */ -void shell_init(void); - -/** - * Start the shell back-end. - * - * Called by the front-end when a new shell is started. - */ -void shell_start(void); - -/** - * Process a shell command. - * - * This function will be called by the shell GUI / telnet server whan - * a command has been entered that should be processed by the shell - * back-end. - * - * \param command The command to be processed. - */ -void shell_input(char *command); - -/** - * Quit the shell. - * - */ -void shell_quit(char *); - - -/** - * Print a string to the shell window. - * - * This function is implemented by the shell GUI / telnet server and - * can be called by the shell back-end to output a string in the - * shell window. The string is automatically appended with a linebreak. - * - * \param str1 The first half of the string to be output. - * \param str2 The second half of the string to be output. - */ -void shell_output(char *str1, char *str2); - -/** - * Print a prompt to the shell window. - * - * This function can be used by the shell back-end to print out a - * prompt to the shell window. - * - * \param prompt The prompt to be printed. - * - */ -void shell_prompt(char *prompt); - -#endif /* __SHELL_H__ */ diff --git a/bundles/uip/apps/telnetd/telnetd.c b/bundles/uip/apps/telnetd/telnetd.c deleted file mode 100644 index 7a5ae858..00000000 --- a/bundles/uip/apps/telnetd/telnetd.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack - * - * $Id: telnetd.c,v 1.2 2006/06/07 09:43:54 adam Exp $ - * - */ - -#include "uip.h" -#include "telnetd.h" -#include "memb.h" -#include "shell.h" - -#include - -#define ISO_nl 0x0a -#define ISO_cr 0x0d - -struct telnetd_line { - char line[TELNETD_CONF_LINELEN]; -}; -MEMB(linemem, struct telnetd_line, TELNETD_CONF_NUMLINES); - -#define STATE_NORMAL 0 -#define STATE_IAC 1 -#define STATE_WILL 2 -#define STATE_WONT 3 -#define STATE_DO 4 -#define STATE_DONT 5 -#define STATE_CLOSE 6 - -static struct telnetd_state s; - -#define TELNET_IAC 255 -#define TELNET_WILL 251 -#define TELNET_WONT 252 -#define TELNET_DO 253 -#define TELNET_DONT 254 -/*---------------------------------------------------------------------------*/ -static char * -alloc_line(void) -{ - return memb_alloc(&linemem); -} -/*---------------------------------------------------------------------------*/ -static void -dealloc_line(char *line) -{ - memb_free(&linemem, line); -} -/*---------------------------------------------------------------------------*/ -void -shell_quit(char *str) -{ - s.state = STATE_CLOSE; -} -/*---------------------------------------------------------------------------*/ -static void -sendline(char *line) -{ - static unsigned int i; - - for(i = 0; i < TELNETD_CONF_NUMLINES; ++i) { - if(s.lines[i] == NULL) { - s.lines[i] = line; - break; - } - } - if(i == TELNETD_CONF_NUMLINES) { - dealloc_line(line); - } -} -/*---------------------------------------------------------------------------*/ -void -shell_prompt(char *str) -{ - char *line; - line = alloc_line(); - if(line != NULL) { - strncpy(line, str, TELNETD_CONF_LINELEN); - /* petsciiconv_toascii(line, TELNETD_CONF_LINELEN);*/ - sendline(line); - } -} -/*---------------------------------------------------------------------------*/ -void -shell_output(char *str1, char *str2) -{ - static unsigned len; - char *line; - - line = alloc_line(); - if(line != NULL) { - len = strlen(str1); - strncpy(line, str1, TELNETD_CONF_LINELEN); - if(len < TELNETD_CONF_LINELEN) { - strncpy(line + len, str2, TELNETD_CONF_LINELEN - len); - } - len = strlen(line); - if(len < TELNETD_CONF_LINELEN - 2) { - line[len] = ISO_cr; - line[len+1] = ISO_nl; - line[len+2] = 0; - } - /* petsciiconv_toascii(line, TELNETD_CONF_LINELEN);*/ - sendline(line); - } -} -/*---------------------------------------------------------------------------*/ -void -telnetd_init(void) -{ - uip_listen(HTONS(23)); - memb_init(&linemem); - shell_init(); -} -/*---------------------------------------------------------------------------*/ -static void -acked(void) -{ - static unsigned int i; - - while(s.numsent > 0) { - dealloc_line(s.lines[0]); - for(i = 1; i < TELNETD_CONF_NUMLINES; ++i) { - s.lines[i - 1] = s.lines[i]; - } - s.lines[TELNETD_CONF_NUMLINES - 1] = NULL; - --s.numsent; - } -} -/*---------------------------------------------------------------------------*/ -static void -senddata(void) -{ - static char *bufptr, *lineptr; - static int buflen, linelen; - - bufptr = uip_appdata; - buflen = 0; - for(s.numsent = 0; s.numsent < TELNETD_CONF_NUMLINES && - s.lines[s.numsent] != NULL ; ++s.numsent) { - lineptr = s.lines[s.numsent]; - linelen = strlen(lineptr); - if(linelen > TELNETD_CONF_LINELEN) { - linelen = TELNETD_CONF_LINELEN; - } - if(buflen + linelen < uip_mss()) { - memcpy(bufptr, lineptr, linelen); - bufptr += linelen; - buflen += linelen; - } else { - break; - } - } - uip_send(uip_appdata, buflen); -} -/*---------------------------------------------------------------------------*/ -static void -closed(void) -{ - static unsigned int i; - - for(i = 0; i < TELNETD_CONF_NUMLINES; ++i) { - if(s.lines[i] != NULL) { - dealloc_line(s.lines[i]); - } - } -} -/*---------------------------------------------------------------------------*/ -static void -get_char(u8_t c) -{ - if(c == ISO_cr) { - return; - } - - s.buf[(int)s.bufptr] = c; - if(s.buf[(int)s.bufptr] == ISO_nl || - s.bufptr == sizeof(s.buf) - 1) { - if(s.bufptr > 0) { - s.buf[(int)s.bufptr] = 0; - /* petsciiconv_topetscii(s.buf, TELNETD_CONF_LINELEN);*/ - } - shell_input(s.buf); - s.bufptr = 0; - } else { - ++s.bufptr; - } -} -/*---------------------------------------------------------------------------*/ -static void -sendopt(u8_t option, u8_t value) -{ - char *line; - line = alloc_line(); - if(line != NULL) { - line[0] = TELNET_IAC; - line[1] = option; - line[2] = value; - line[3] = 0; - sendline(line); - } -} -/*---------------------------------------------------------------------------*/ -static void -newdata(void) -{ - u16_t len; - u8_t c; - char *dataptr; - - - len = uip_datalen(); - dataptr = (char *)uip_appdata; - - while(len > 0 && s.bufptr < sizeof(s.buf)) { - c = *dataptr; - ++dataptr; - --len; - switch(s.state) { - case STATE_IAC: - if(c == TELNET_IAC) { - get_char(c); - s.state = STATE_NORMAL; - } else { - switch(c) { - case TELNET_WILL: - s.state = STATE_WILL; - break; - case TELNET_WONT: - s.state = STATE_WONT; - break; - case TELNET_DO: - s.state = STATE_DO; - break; - case TELNET_DONT: - s.state = STATE_DONT; - break; - default: - s.state = STATE_NORMAL; - break; - } - } - break; - case STATE_WILL: - /* Reply with a DONT */ - sendopt(TELNET_DONT, c); - s.state = STATE_NORMAL; - break; - - case STATE_WONT: - /* Reply with a DONT */ - sendopt(TELNET_DONT, c); - s.state = STATE_NORMAL; - break; - case STATE_DO: - /* Reply with a WONT */ - sendopt(TELNET_WONT, c); - s.state = STATE_NORMAL; - break; - case STATE_DONT: - /* Reply with a WONT */ - sendopt(TELNET_WONT, c); - s.state = STATE_NORMAL; - break; - case STATE_NORMAL: - if(c == TELNET_IAC) { - s.state = STATE_IAC; - } else { - get_char(c); - } - break; - } - - - } - -} -/*---------------------------------------------------------------------------*/ -void -telnetd_appcall(void) -{ - static unsigned int i; - if(uip_connected()) { - /* tcp_markconn(uip_conn, &s);*/ - for(i = 0; i < TELNETD_CONF_NUMLINES; ++i) { - s.lines[i] = NULL; - } - s.bufptr = 0; - s.state = STATE_NORMAL; - - shell_start(); - } - - if(s.state == STATE_CLOSE) { - s.state = STATE_NORMAL; - uip_close(); - return; - } - - if(uip_closed() || - uip_aborted() || - uip_timedout()) { - closed(); - } - - if(uip_acked()) { - acked(); - } - - if(uip_newdata()) { - newdata(); - } - - if(uip_rexmit() || - uip_newdata() || - uip_acked() || - uip_connected() || - uip_poll()) { - senddata(); - } -} -/*---------------------------------------------------------------------------*/ diff --git a/bundles/uip/apps/telnetd/telnetd.h b/bundles/uip/apps/telnetd/telnetd.h deleted file mode 100644 index 2ee8acdb..00000000 --- a/bundles/uip/apps/telnetd/telnetd.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack - * - * $Id: telnetd.h,v 1.2 2006/06/07 09:43:54 adam Exp $ - * - */ -#ifndef __TELNETD_H__ -#define __TELNETD_H__ - -#include "uipopt.h" - -void telnetd_appcall(void); - -#ifndef TELNETD_CONF_LINELEN -#define TELNETD_CONF_LINELEN 40 -#endif -#ifndef TELNETD_CONF_NUMLINES -#define TELNETD_CONF_NUMLINES 16 -#endif - -struct telnetd_state { - char *lines[TELNETD_CONF_NUMLINES]; - char buf[TELNETD_CONF_LINELEN]; - char bufptr; - u8_t numsent; - u8_t state; -}; - -typedef struct telnetd_state uip_tcp_appstate_t; - -#ifndef UIP_APPCALL -#define UIP_APPCALL telnetd_appcall -#endif - -#endif /* __TELNETD_H__ */ diff --git a/bundles/uip/apps/webclient/Makefile.webclient b/bundles/uip/apps/webclient/Makefile.webclient deleted file mode 100644 index e6e7f082..00000000 --- a/bundles/uip/apps/webclient/Makefile.webclient +++ /dev/null @@ -1 +0,0 @@ -APP_SOURCES += webclient-strings.c webclient.c diff --git a/bundles/uip/apps/webclient/makestrings b/bundles/uip/apps/webclient/makestrings deleted file mode 100644 index 6dec075d..00000000 --- a/bundles/uip/apps/webclient/makestrings +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - - -sub stringify { - my $name = shift(@_); - open(OUTPUTC, "> $name.c"); - open(OUTPUTH, "> $name.h"); - - open(FILE, "$name"); - - while() { - if(/(.+) "(.+)"/) { - $var = $1; - $data = $2; - - $datan = $data; - $datan =~ s/\\r/\r/g; - $datan =~ s/\\n/\n/g; - $datan =~ s/\\01/\01/g; - $datan =~ s/\\0/\0/g; - - printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); - printf(OUTPUTC "/* \"$data\" */\n"); - printf(OUTPUTC "{"); - for($j = 0; $j < length($datan); $j++) { - printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); - } - printf(OUTPUTC "0 };\n"); - - printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); - - } - } - close(OUTPUTC); - close(OUTPUTH); -} -stringify("webclient-strings"); - -exit 0; - diff --git a/bundles/uip/apps/webclient/webclient-strings b/bundles/uip/apps/webclient/webclient-strings deleted file mode 100644 index a3313972..00000000 --- a/bundles/uip/apps/webclient/webclient-strings +++ /dev/null @@ -1,31 +0,0 @@ -http_http "http://" -http_200 "200 " -http_301 "301 " -http_302 "302 " -http_get "GET " -http_10 "HTTP/1.0" -http_11 "HTTP/1.1" -http_content_type "content-type: " -http_texthtml "text/html" -http_location "location: " -http_host "host: " -http_crnl "\r\n" -http_index_html "/index.html" -http_404_html "/404.html" -http_content_type_html "Content-type: text/html\r\n\r\n" -http_content_type_css "Content-type: text/css\r\n\r\n" -http_content_type_text "Content-type: text/text\r\n\r\n" -http_content_type_png "Content-type: image/png\r\n\r\n" -http_content_type_gif "Content-type: image/gif\r\n\r\n" -http_content_type_jpg "Content-type: image/jpeg\r\n\r\n" -http_content_type_binary "Content-type: application/octet-stream\r\n\r\n" -http_html ".html" -http_shtml ".shtml" -http_htm ".htm" -http_css ".css" -http_png ".png" -http_gif ".gif" -http_jpg ".jpg" -http_text ".text" -http_txt ".txt" -http_user_agent_fields "Connection: close\r\nUser-Agent: uIP/1.0 (; http://www.sics.se/~adam/uip/)\r\n\r\n" diff --git a/bundles/uip/apps/webclient/webclient-strings.c b/bundles/uip/apps/webclient/webclient-strings.c deleted file mode 100644 index 94723308..00000000 --- a/bundles/uip/apps/webclient/webclient-strings.c +++ /dev/null @@ -1,93 +0,0 @@ -const char http_http[8] = -/* "http://" */ -{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0 }; -const char http_200[5] = -/* "200 " */ -{0x32, 0x30, 0x30, 0x20, 0 }; -const char http_301[5] = -/* "301 " */ -{0x33, 0x30, 0x31, 0x20, 0 }; -const char http_302[5] = -/* "302 " */ -{0x33, 0x30, 0x32, 0x20, 0 }; -const char http_get[5] = -/* "GET " */ -{0x47, 0x45, 0x54, 0x20, 0 }; -const char http_10[9] = -/* "HTTP/1.0" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0 }; -const char http_11[9] = -/* "HTTP/1.1" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, 0 }; -const char http_content_type[15] = -/* "content-type: " */ -{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0 }; -const char http_texthtml[10] = -/* "text/html" */ -{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_location[11] = -/* "location: " */ -{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0 }; -const char http_host[7] = -/* "host: " */ -{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, 0 }; -const char http_crnl[3] = -/* "\r\n" */ -{0xd, 0xa, 0 }; -const char http_index_html[12] = -/* "/index.html" */ -{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_404_html[10] = -/* "/404.html" */ -{0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_content_type_html[28] = -/* "Content-type: text/html\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_css [27] = -/* "Content-type: text/css\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_text[28] = -/* "Content-type: text/text\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x74, 0x65, 0x78, 0x74, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_png [28] = -/* "Content-type: image/png\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_gif [28] = -/* "Content-type: image/gif\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_jpg [29] = -/* "Content-type: image/jpeg\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x65, 0x67, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_content_type_binary[43] = -/* "Content-type: application/octet-stream\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x2d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0xd, 0xa, 0xd, 0xa, 0 }; -const char http_html[6] = -/* ".html" */ -{0x2e, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_shtml[7] = -/* ".shtml" */ -{0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0 }; -const char http_htm[5] = -/* ".htm" */ -{0x2e, 0x68, 0x74, 0x6d, 0 }; -const char http_css[5] = -/* ".css" */ -{0x2e, 0x63, 0x73, 0x73, 0 }; -const char http_png[5] = -/* ".png" */ -{0x2e, 0x70, 0x6e, 0x67, 0 }; -const char http_gif[5] = -/* ".gif" */ -{0x2e, 0x67, 0x69, 0x66, 0 }; -const char http_jpg[5] = -/* ".jpg" */ -{0x2e, 0x6a, 0x70, 0x67, 0 }; -const char http_text[6] = -/* ".text" */ -{0x2e, 0x74, 0x65, 0x78, 0x74, 0 }; -const char http_txt[5] = -/* ".txt" */ -{0x2e, 0x74, 0x78, 0x74, 0 }; -const char http_user_agent_fields[77] = -/* "Connection: close\r\nUser-Agent: uIP/1.0 (; http://www.sics.se/~adam/uip/)\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x28, 0x3b, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0x29, 0xd, 0xa, 0xd, 0xa, 0 }; diff --git a/bundles/uip/apps/webclient/webclient-strings.h b/bundles/uip/apps/webclient/webclient-strings.h deleted file mode 100644 index 9e3ec934..00000000 --- a/bundles/uip/apps/webclient/webclient-strings.h +++ /dev/null @@ -1,31 +0,0 @@ -extern const char http_http[8]; -extern const char http_200[5]; -extern const char http_301[5]; -extern const char http_302[5]; -extern const char http_get[5]; -extern const char http_10[9]; -extern const char http_11[9]; -extern const char http_content_type[15]; -extern const char http_texthtml[10]; -extern const char http_location[11]; -extern const char http_host[7]; -extern const char http_crnl[3]; -extern const char http_index_html[12]; -extern const char http_404_html[10]; -extern const char http_content_type_html[28]; -extern const char http_content_type_css [27]; -extern const char http_content_type_text[28]; -extern const char http_content_type_png [28]; -extern const char http_content_type_gif [28]; -extern const char http_content_type_jpg [29]; -extern const char http_content_type_binary[43]; -extern const char http_html[6]; -extern const char http_shtml[7]; -extern const char http_htm[5]; -extern const char http_css[5]; -extern const char http_png[5]; -extern const char http_gif[5]; -extern const char http_jpg[5]; -extern const char http_text[6]; -extern const char http_txt[5]; -extern const char http_user_agent_fields[77]; diff --git a/bundles/uip/apps/webclient/webclient.c b/bundles/uip/apps/webclient/webclient.c deleted file mode 100644 index 746c008c..00000000 --- a/bundles/uip/apps/webclient/webclient.c +++ /dev/null @@ -1,439 +0,0 @@ -/** - * \addtogroup apps - * @{ - */ - -/** - * \defgroup webclient Web client - * @{ - * - * This example shows a HTTP client that is able to download web pages - * and files from web servers. It requires a number of callback - * functions to be implemented by the module that utilizes the code: - * webclient_datahandler(), webclient_connected(), - * webclient_timedout(), webclient_aborted(), webclient_closed(). - */ - -/** - * \file - * Implementation of the HTTP client. - * \author Adam Dunkels - */ - -/* - * Copyright (c) 2002, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: webclient.c,v 1.2 2006/06/11 21:46:37 adam Exp $ - * - */ - -#include "uip.h" -#include "uiplib.h" -#include "webclient.h" -#include "resolv.h" - -#include - -#define WEBCLIENT_TIMEOUT 100 - -#define WEBCLIENT_STATE_STATUSLINE 0 -#define WEBCLIENT_STATE_HEADERS 1 -#define WEBCLIENT_STATE_DATA 2 -#define WEBCLIENT_STATE_CLOSE 3 - -#define HTTPFLAG_NONE 0 -#define HTTPFLAG_OK 1 -#define HTTPFLAG_MOVED 2 -#define HTTPFLAG_ERROR 3 - - -#define ISO_nl 0x0a -#define ISO_cr 0x0d -#define ISO_space 0x20 - - -static struct webclient_state s; - -/*-----------------------------------------------------------------------------------*/ -char * -webclient_mimetype(void) -{ - return s.mimetype; -} -/*-----------------------------------------------------------------------------------*/ -char * -webclient_filename(void) -{ - return s.file; -} -/*-----------------------------------------------------------------------------------*/ -char * -webclient_hostname(void) -{ - return s.host; -} -/*-----------------------------------------------------------------------------------*/ -unsigned short -webclient_port(void) -{ - return s.port; -} -/*-----------------------------------------------------------------------------------*/ -void -webclient_init(void) -{ - -} -/*-----------------------------------------------------------------------------------*/ -static void -init_connection(void) -{ - s.state = WEBCLIENT_STATE_STATUSLINE; - - s.getrequestleft = sizeof(http_get) - 1 + 1 + - sizeof(http_10) - 1 + - sizeof(http_crnl) - 1 + - sizeof(http_host) - 1 + - sizeof(http_crnl) - 1 + - strlen(http_user_agent_fields) + - strlen(s.file) + strlen(s.host); - s.getrequestptr = 0; - - s.httpheaderlineptr = 0; -} -/*-----------------------------------------------------------------------------------*/ -void -webclient_close(void) -{ - s.state = WEBCLIENT_STATE_CLOSE; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -webclient_get(char *host, u16_t port, char *file) -{ - struct uip_conn *conn; - uip_ipaddr_t *ipaddr; - static uip_ipaddr_t addr; - - /* First check if the host is an IP address. */ - ipaddr = &addr; - if(uiplib_ipaddrconv(host, (unsigned char *)addr) == 0) { - ipaddr = (uip_ipaddr_t *)resolv_lookup(host); - - if(ipaddr == NULL) { - return 0; - } - } - - conn = uip_connect(ipaddr, htons(port)); - - if(conn == NULL) { - return 0; - } - - s.port = port; - strncpy(s.file, file, sizeof(s.file)); - strncpy(s.host, host, sizeof(s.host)); - - init_connection(); - return 1; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned char * -copy_string(unsigned char *dest, - const unsigned char *src, unsigned char len) -{ - strncpy(dest, src, len); - return dest + len; -} -/*-----------------------------------------------------------------------------------*/ -static void -senddata(void) -{ - u16_t len; - char *getrequest; - char *cptr; - - if(s.getrequestleft > 0) { - cptr = getrequest = (char *)uip_appdata; - - cptr = copy_string(cptr, http_get, sizeof(http_get) - 1); - cptr = copy_string(cptr, s.file, strlen(s.file)); - *cptr++ = ISO_space; - cptr = copy_string(cptr, http_10, sizeof(http_10) - 1); - - cptr = copy_string(cptr, http_crnl, sizeof(http_crnl) - 1); - - cptr = copy_string(cptr, http_host, sizeof(http_host) - 1); - cptr = copy_string(cptr, s.host, strlen(s.host)); - cptr = copy_string(cptr, http_crnl, sizeof(http_crnl) - 1); - - cptr = copy_string(cptr, http_user_agent_fields, - strlen(http_user_agent_fields)); - - len = s.getrequestleft > uip_mss()? - uip_mss(): - s.getrequestleft; - uip_send(&(getrequest[s.getrequestptr]), len); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -acked(void) -{ - u16_t len; - - if(s.getrequestleft > 0) { - len = s.getrequestleft > uip_mss()? - uip_mss(): - s.getrequestleft; - s.getrequestleft -= len; - s.getrequestptr += len; - } -} -/*-----------------------------------------------------------------------------------*/ -static u16_t -parse_statusline(u16_t len) -{ - char *cptr; - - while(len > 0 && s.httpheaderlineptr < sizeof(s.httpheaderline)) { - s.httpheaderline[s.httpheaderlineptr] = *(char *)uip_appdata; - ++((char *)uip_appdata); - --len; - if(s.httpheaderline[s.httpheaderlineptr] == ISO_nl) { - - if((strncmp(s.httpheaderline, http_10, - sizeof(http_10) - 1) == 0) || - (strncmp(s.httpheaderline, http_11, - sizeof(http_11) - 1) == 0)) { - cptr = &(s.httpheaderline[9]); - s.httpflag = HTTPFLAG_NONE; - if(strncmp(cptr, http_200, sizeof(http_200) - 1) == 0) { - /* 200 OK */ - s.httpflag = HTTPFLAG_OK; - } else if(strncmp(cptr, http_301, sizeof(http_301) - 1) == 0 || - strncmp(cptr, http_302, sizeof(http_302) - 1) == 0) { - /* 301 Moved permanently or 302 Found. Location: header line - will contain thw new location. */ - s.httpflag = HTTPFLAG_MOVED; - } else { - s.httpheaderline[s.httpheaderlineptr - 1] = 0; - } - } else { - uip_abort(); - webclient_aborted(); - return 0; - } - - /* We're done parsing the status line, so we reset the pointer - and start parsing the HTTP headers.*/ - s.httpheaderlineptr = 0; - s.state = WEBCLIENT_STATE_HEADERS; - break; - } else { - ++s.httpheaderlineptr; - } - } - return len; -} -/*-----------------------------------------------------------------------------------*/ -static char -casecmp(char *str1, const char *str2, char len) -{ - static char c; - - while(len > 0) { - c = *str1; - /* Force lower-case characters. */ - if(c & 0x40) { - c |= 0x20; - } - if(*str2 != c) { - return 1; - } - ++str1; - ++str2; - --len; - } - return 0; -} -/*-----------------------------------------------------------------------------------*/ -static u16_t -parse_headers(u16_t len) -{ - char *cptr; - static unsigned char i; - - while(len > 0 && s.httpheaderlineptr < sizeof(s.httpheaderline)) { - s.httpheaderline[s.httpheaderlineptr] = *(char *)uip_appdata; - ++((char *)uip_appdata); - --len; - if(s.httpheaderline[s.httpheaderlineptr] == ISO_nl) { - /* We have an entire HTTP header line in s.httpheaderline, so - we parse it. */ - if(s.httpheaderline[0] == ISO_cr) { - /* This was the last header line (i.e., and empty "\r\n"), so - we are done with the headers and proceed with the actual - data. */ - s.state = WEBCLIENT_STATE_DATA; - return len; - } - - s.httpheaderline[s.httpheaderlineptr - 1] = 0; - /* Check for specific HTTP header fields. */ - if(casecmp(s.httpheaderline, http_content_type, - sizeof(http_content_type) - 1) == 0) { - /* Found Content-type field. */ - cptr = strchr(s.httpheaderline, ';'); - if(cptr != NULL) { - *cptr = 0; - } - strncpy(s.mimetype, s.httpheaderline + - sizeof(http_content_type) - 1, sizeof(s.mimetype)); - } else if(casecmp(s.httpheaderline, http_location, - sizeof(http_location) - 1) == 0) { - cptr = s.httpheaderline + - sizeof(http_location) - 1; - - if(strncmp(cptr, http_http, 7) == 0) { - cptr += 7; - for(i = 0; i < s.httpheaderlineptr - 7; ++i) { - if(*cptr == 0 || - *cptr == '/' || - *cptr == ' ' || - *cptr == ':') { - s.host[i] = 0; - break; - } - s.host[i] = *cptr; - ++cptr; - } - } - strncpy(s.file, cptr, sizeof(s.file)); - /* s.file[s.httpheaderlineptr - i] = 0;*/ - } - - - /* We're done parsing, so we reset the pointer and start the - next line. */ - s.httpheaderlineptr = 0; - } else { - ++s.httpheaderlineptr; - } - } - return len; -} -/*-----------------------------------------------------------------------------------*/ -static void -newdata(void) -{ - u16_t len; - - len = uip_datalen(); - - if(s.state == WEBCLIENT_STATE_STATUSLINE) { - len = parse_statusline(len); - } - - if(s.state == WEBCLIENT_STATE_HEADERS && len > 0) { - len = parse_headers(len); - } - - if(len > 0 && s.state == WEBCLIENT_STATE_DATA && - s.httpflag != HTTPFLAG_MOVED) { - webclient_datahandler((char *)uip_appdata, len); - } -} -/*-----------------------------------------------------------------------------------*/ -void -webclient_appcall(void) -{ - if(uip_connected()) { - s.timer = 0; - s.state = WEBCLIENT_STATE_STATUSLINE; - senddata(); - webclient_connected(); - return; - } - - if(s.state == WEBCLIENT_STATE_CLOSE) { - webclient_closed(); - uip_abort(); - return; - } - - if(uip_aborted()) { - webclient_aborted(); - } - if(uip_timedout()) { - webclient_timedout(); - } - - - if(uip_acked()) { - s.timer = 0; - acked(); - } - if(uip_newdata()) { - s.timer = 0; - newdata(); - } - if(uip_rexmit() || - uip_newdata() || - uip_acked()) { - senddata(); - } else if(uip_poll()) { - ++s.timer; - if(s.timer == WEBCLIENT_TIMEOUT) { - webclient_timedout(); - uip_abort(); - return; - } - /* senddata();*/ - } - - if(uip_closed()) { - if(s.httpflag != HTTPFLAG_MOVED) { - /* Send NULL data to signal EOF. */ - webclient_datahandler(NULL, 0); - } else { - if(resolv_lookup(s.host) == NULL) { - resolv_query(s.host); - } - webclient_get(s.host, s.port, s.file); - } - } -} -/*-----------------------------------------------------------------------------------*/ - -/** @} */ -/** @} */ diff --git a/bundles/uip/apps/webclient/webclient.h b/bundles/uip/apps/webclient/webclient.h deleted file mode 100644 index 44cb95ca..00000000 --- a/bundles/uip/apps/webclient/webclient.h +++ /dev/null @@ -1,228 +0,0 @@ -/** - * \addtogroup webclient - * @{ - */ - -/** - * \file - * Header file for the HTTP client. - * \author Adam Dunkels - */ - -/* - * Copyright (c) 2002, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: webclient.h,v 1.2 2006/06/11 21:46:37 adam Exp $ - * - */ -#ifndef __WEBCLIENT_H__ -#define __WEBCLIENT_H__ - - -#include "webclient-strings.h" -#include "uipopt.h" - -#define WEBCLIENT_CONF_MAX_URLLEN 100 - -struct webclient_state { - u8_t timer; - u8_t state; - u8_t httpflag; - - u16_t port; - char host[40]; - char file[WEBCLIENT_CONF_MAX_URLLEN]; - u16_t getrequestptr; - u16_t getrequestleft; - - char httpheaderline[200]; - u16_t httpheaderlineptr; - - char mimetype[32]; -}; - -typedef struct webclient_state uip_tcp_appstate_t; -#define UIP_APPCALL webclient_appcall - -/** - * Callback function that is called from the webclient code when HTTP - * data has been received. - * - * This function must be implemented by the module that uses the - * webclient code. The function is called from the webclient module - * when HTTP data has been received. The function is not called when - * HTTP headers are received, only for the actual data. - * - * \note This function is called many times, repetedly, when data is - * being received, and not once when all data has been received. - * - * \param data A pointer to the data that has been received. - * \param len The length of the data that has been received. - */ -void webclient_datahandler(char *data, u16_t len); - -/** - * Callback function that is called from the webclient code when the - * HTTP connection has been connected to the web server. - * - * This function must be implemented by the module that uses the - * webclient code. - */ -void webclient_connected(void); - -/** - * Callback function that is called from the webclient code if the - * HTTP connection to the web server has timed out. - * - * This function must be implemented by the module that uses the - * webclient code. - */ -void webclient_timedout(void); - -/** - * Callback function that is called from the webclient code if the - * HTTP connection to the web server has been aborted by the web - * server. - * - * This function must be implemented by the module that uses the - * webclient code. - */ -void webclient_aborted(void); - -/** - * Callback function that is called from the webclient code when the - * HTTP connection to the web server has been closed. - * - * This function must be implemented by the module that uses the - * webclient code. - */ -void webclient_closed(void); - - - -/** - * Initialize the webclient module. - */ -void webclient_init(void); - -/** - * Open an HTTP connection to a web server and ask for a file using - * the GET method. - * - * This function opens an HTTP connection to the specified web server - * and requests the specified file using the GET method. When the HTTP - * connection has been connected, the webclient_connected() callback - * function is called and when the HTTP data arrives the - * webclient_datahandler() callback function is called. - * - * The callback function webclient_timedout() is called if the web - * server could not be contacted, and the webclient_aborted() callback - * function is called if the HTTP connection is aborted by the web - * server. - * - * When the HTTP request has been completed and the HTTP connection is - * closed, the webclient_closed() callback function will be called. - * - * \note If the function is passed a host name, it must already be in - * the resolver cache in order for the function to connect to the web - * server. It is therefore up to the calling module to implement the - * resolver calls and the signal handler used for reporting a resolv - * query answer. - * - * \param host A pointer to a string containing either a host name or - * a numerical IP address in dotted decimal notation (e.g., 192.168.23.1). - * - * \param port The port number to which to connect, in host byte order. - * - * \param file A pointer to the name of the file to get. - * - * \retval 0 if the host name could not be found in the cache, or - * if a TCP connection could not be created. - * - * \retval 1 if the connection was initiated. - */ -unsigned char webclient_get(char *host, u16_t port, char *file); - -/** - * Close the currently open HTTP connection. - */ -void webclient_close(void); -void webclient_appcall(void); - -/** - * Obtain the MIME type of the current HTTP data stream. - * - * \return A pointer to a string contaning the MIME type. The string - * may be empty if no MIME type was reported by the web server. - */ -char *webclient_mimetype(void); - -/** - * Obtain the filename of the current HTTP data stream. - * - * The filename of an HTTP request may be changed by the web server, - * and may therefore not be the same as when the original GET request - * was made with webclient_get(). This function is used for obtaining - * the current filename. - * - * \return A pointer to the current filename. - */ -char *webclient_filename(void); - -/** - * Obtain the hostname of the current HTTP data stream. - * - * The hostname of the web server of an HTTP request may be changed - * by the web server, and may therefore not be the same as when the - * original GET request was made with webclient_get(). This function - * is used for obtaining the current hostname. - * - * \return A pointer to the current hostname. - */ -char *webclient_hostname(void); - -/** - * Obtain the port number of the current HTTP data stream. - * - * The port number of an HTTP request may be changed by the web - * server, and may therefore not be the same as when the original GET - * request was made with webclient_get(). This function is used for - * obtaining the current port number. - * - * \return The port number of the current HTTP data stream, in host byte order. - */ -unsigned short webclient_port(void); - - - -#endif /* __WEBCLIENT_H__ */ - -/** @} */ diff --git a/bundles/uip/apps/webserver/Makefile.webserver b/bundles/uip/apps/webserver/Makefile.webserver deleted file mode 100644 index 7d3e0869..00000000 --- a/bundles/uip/apps/webserver/Makefile.webserver +++ /dev/null @@ -1 +0,0 @@ -APP_SOURCES += httpd.c http-strings.c httpd-fs.c httpd-cgi.c diff --git a/bundles/uip/apps/webserver/http-strings b/bundles/uip/apps/webserver/http-strings deleted file mode 100644 index d0b9121b..00000000 --- a/bundles/uip/apps/webserver/http-strings +++ /dev/null @@ -1,35 +0,0 @@ -http_http "http://" -http_200 "200 " -http_301 "301 " -http_302 "302 " -http_get "GET " -http_10 "HTTP/1.0" -http_11 "HTTP/1.1" -http_content_type "content-type: " -http_texthtml "text/html" -http_location "location: " -http_host "host: " -http_crnl "\r\n" -http_index_html "/index.html" -http_404_html "/404.html" -http_referer "Referer:" -http_header_200 "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" -http_header_404 "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" -http_content_type_plain "Content-type: text/plain\r\n\r\n" -http_content_type_html "Content-type: text/html\r\n\r\n" -http_content_type_css "Content-type: text/css\r\n\r\n" -http_content_type_text "Content-type: text/text\r\n\r\n" -http_content_type_png "Content-type: image/png\r\n\r\n" -http_content_type_gif "Content-type: image/gif\r\n\r\n" -http_content_type_jpg "Content-type: image/jpeg\r\n\r\n" -http_content_type_binary "Content-type: application/octet-stream\r\n\r\n" -http_html ".html" -http_shtml ".shtml" -http_htm ".htm" -http_css ".css" -http_png ".png" -http_gif ".gif" -http_jpg ".jpg" -http_text ".txt" -http_txt ".txt" - diff --git a/bundles/uip/apps/webserver/http-strings.c b/bundles/uip/apps/webserver/http-strings.c deleted file mode 100644 index 0d822baf..00000000 --- a/bundles/uip/apps/webserver/http-strings.c +++ /dev/null @@ -1,102 +0,0 @@ -const char http_http[8] = -/* "http://" */ -{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, }; -const char http_200[5] = -/* "200 " */ -{0x32, 0x30, 0x30, 0x20, }; -const char http_301[5] = -/* "301 " */ -{0x33, 0x30, 0x31, 0x20, }; -const char http_302[5] = -/* "302 " */ -{0x33, 0x30, 0x32, 0x20, }; -const char http_get[5] = -/* "GET " */ -{0x47, 0x45, 0x54, 0x20, }; -const char http_10[9] = -/* "HTTP/1.0" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, }; -const char http_11[9] = -/* "HTTP/1.1" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, }; -const char http_content_type[15] = -/* "content-type: " */ -{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, }; -const char http_texthtml[10] = -/* "text/html" */ -{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_location[11] = -/* "location: " */ -{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, }; -const char http_host[7] = -/* "host: " */ -{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, }; -const char http_crnl[3] = -/* "\r\n" */ -{0xd, 0xa, }; -const char http_index_html[12] = -/* "/index.html" */ -{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_404_html[10] = -/* "/404.html" */ -{0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_referer[9] = -/* "Referer:" */ -{0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, 0x3a, }; -const char http_header_200[84] = -/* "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32, 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, }; -const char http_header_404[91] = -/* "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */ -{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34, 0x30, 0x34, 0x20, 0x4e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0xd, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, }; -const char http_content_type_plain[29] = -/* "Content-type: text/plain\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_html[28] = -/* "Content-type: text/html\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_css [27] = -/* "Content-type: text/css\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_text[28] = -/* "Content-type: text/text\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x74, 0x65, 0x78, 0x74, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_png [28] = -/* "Content-type: image/png\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_gif [28] = -/* "Content-type: image/gif\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_jpg [29] = -/* "Content-type: image/jpeg\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x65, 0x67, 0xd, 0xa, 0xd, 0xa, }; -const char http_content_type_binary[43] = -/* "Content-type: application/octet-stream\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x2d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0xd, 0xa, 0xd, 0xa, }; -const char http_html[6] = -/* ".html" */ -{0x2e, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_shtml[7] = -/* ".shtml" */ -{0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, }; -const char http_htm[5] = -/* ".htm" */ -{0x2e, 0x68, 0x74, 0x6d, }; -const char http_css[5] = -/* ".css" */ -{0x2e, 0x63, 0x73, 0x73, }; -const char http_png[5] = -/* ".png" */ -{0x2e, 0x70, 0x6e, 0x67, }; -const char http_gif[5] = -/* ".gif" */ -{0x2e, 0x67, 0x69, 0x66, }; -const char http_jpg[5] = -/* ".jpg" */ -{0x2e, 0x6a, 0x70, 0x67, }; -const char http_text[5] = -/* ".txt" */ -{0x2e, 0x74, 0x78, 0x74, }; -const char http_txt[5] = -/* ".txt" */ -{0x2e, 0x74, 0x78, 0x74, }; diff --git a/bundles/uip/apps/webserver/http-strings.h b/bundles/uip/apps/webserver/http-strings.h deleted file mode 100644 index f121dd73..00000000 --- a/bundles/uip/apps/webserver/http-strings.h +++ /dev/null @@ -1,34 +0,0 @@ -extern const char http_http[8]; -extern const char http_200[5]; -extern const char http_301[5]; -extern const char http_302[5]; -extern const char http_get[5]; -extern const char http_10[9]; -extern const char http_11[9]; -extern const char http_content_type[15]; -extern const char http_texthtml[10]; -extern const char http_location[11]; -extern const char http_host[7]; -extern const char http_crnl[3]; -extern const char http_index_html[12]; -extern const char http_404_html[10]; -extern const char http_referer[9]; -extern const char http_header_200[84]; -extern const char http_header_404[91]; -extern const char http_content_type_plain[29]; -extern const char http_content_type_html[28]; -extern const char http_content_type_css [27]; -extern const char http_content_type_text[28]; -extern const char http_content_type_png [28]; -extern const char http_content_type_gif [28]; -extern const char http_content_type_jpg [29]; -extern const char http_content_type_binary[43]; -extern const char http_html[6]; -extern const char http_shtml[7]; -extern const char http_htm[5]; -extern const char http_css[5]; -extern const char http_png[5]; -extern const char http_gif[5]; -extern const char http_jpg[5]; -extern const char http_text[5]; -extern const char http_txt[5]; diff --git a/bundles/uip/apps/webserver/httpd-cgi.c b/bundles/uip/apps/webserver/httpd-cgi.c deleted file mode 100644 index 62570359..00000000 --- a/bundles/uip/apps/webserver/httpd-cgi.c +++ /dev/null @@ -1,203 +0,0 @@ -/** - * \addtogroup httpd - * @{ - */ - -/** - * \file - * Web server script interface - * \author - * Adam Dunkels - * - */ - -/* - * Copyright (c) 2001-2006, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: httpd-cgi.c,v 1.2 2006/06/11 21:46:37 adam Exp $ - * - */ - -#include "uip.h" -#include "psock.h" -#include "httpd.h" -#include "httpd-cgi.h" -#include "httpd-fs.h" - -#include -#include - -HTTPD_CGI_CALL(file, "file-stats", file_stats); -HTTPD_CGI_CALL(tcp, "tcp-connections", tcp_stats); -HTTPD_CGI_CALL(net, "net-stats", net_stats); - -static const struct httpd_cgi_call *calls[] = { &file, &tcp, &net, NULL }; - -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(nullfunction(struct httpd_state *s, char *ptr)) -{ - PSOCK_BEGIN(&s->sout); - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -httpd_cgifunction -httpd_cgi(char *name) -{ - const struct httpd_cgi_call **f; - - /* Find the matching name in the table, return the function. */ - for(f = calls; *f != NULL; ++f) { - if(strncmp((*f)->name, name, strlen((*f)->name)) == 0) { - return (*f)->function; - } - } - return nullfunction; -} -/*---------------------------------------------------------------------------*/ -static unsigned short -generate_file_stats(void *arg) -{ - char *f = (char *)arg; - return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, "%5u", httpd_fs_count(f)); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(file_stats(struct httpd_state *s, char *ptr)) -{ - PSOCK_BEGIN(&s->sout); - - PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static const char closed[] = /* "CLOSED",*/ -{0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0}; -static const char syn_rcvd[] = /* "SYN-RCVD",*/ -{0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56, - 0x44, 0}; -static const char syn_sent[] = /* "SYN-SENT",*/ -{0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e, - 0x54, 0}; -static const char established[] = /* "ESTABLISHED",*/ -{0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48, - 0x45, 0x44, 0}; -static const char fin_wait_1[] = /* "FIN-WAIT-1",*/ -{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, - 0x54, 0x2d, 0x31, 0}; -static const char fin_wait_2[] = /* "FIN-WAIT-2",*/ -{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, - 0x54, 0x2d, 0x32, 0}; -static const char closing[] = /* "CLOSING",*/ -{0x43, 0x4c, 0x4f, 0x53, 0x49, - 0x4e, 0x47, 0}; -static const char time_wait[] = /* "TIME-WAIT,"*/ -{0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41, - 0x49, 0x54, 0}; -static const char last_ack[] = /* "LAST-ACK"*/ -{0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43, - 0x4b, 0}; - -static const char *states[] = { - closed, - syn_rcvd, - syn_sent, - established, - fin_wait_1, - fin_wait_2, - closing, - time_wait, - last_ack}; - - -static unsigned short -generate_tcp_stats(void *arg) -{ - struct uip_conn *conn; - struct httpd_state *s = (struct httpd_state *)arg; - - conn = &uip_conns[s->count]; - return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, - "%d%u.%u.%u.%u:%u%s%u%u%c %c\r\n", - htons(conn->lport), - htons(conn->ripaddr[0]) >> 8, - htons(conn->ripaddr[0]) & 0xff, - htons(conn->ripaddr[1]) >> 8, - htons(conn->ripaddr[1]) & 0xff, - htons(conn->rport), - states[conn->tcpstateflags & UIP_TS_MASK], - conn->nrtx, - conn->timer, - (uip_outstanding(conn))? '*':' ', - (uip_stopped(conn))? '!':' '); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr)) -{ - - PSOCK_BEGIN(&s->sout); - - for(s->count = 0; s->count < UIP_CONNS; ++s->count) { - if((uip_conns[s->count].tcpstateflags & UIP_TS_MASK) != UIP_CLOSED) { - PSOCK_GENERATOR_SEND(&s->sout, generate_tcp_stats, s); - } - } - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static unsigned short -generate_net_stats(void *arg) -{ - struct httpd_state *s = (struct httpd_state *)arg; - return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, - "%5u\n", ((uip_stats_t *)&uip_stat)[s->count]); -} - -static -PT_THREAD(net_stats(struct httpd_state *s, char *ptr)) -{ - PSOCK_BEGIN(&s->sout); - -#if UIP_STATISTICS - - for(s->count = 0; s->count < sizeof(uip_stat) / sizeof(uip_stats_t); - ++s->count) { - PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s); - } - -#endif /* UIP_STATISTICS */ - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/bundles/uip/apps/webserver/httpd-cgi.h b/bundles/uip/apps/webserver/httpd-cgi.h deleted file mode 100644 index e6ba51e7..00000000 --- a/bundles/uip/apps/webserver/httpd-cgi.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * \addtogroup httpd - * @{ - */ - -/** - * \file - * Web server script interface header file - * \author - * Adam Dunkels - * - */ - - - -/* - * Copyright (c) 2001, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: httpd-cgi.h,v 1.2 2006/06/11 21:46:38 adam Exp $ - * - */ - -#ifndef __HTTPD_CGI_H__ -#define __HTTPD_CGI_H__ - -#include "psock.h" -#include "httpd.h" - -typedef PT_THREAD((* httpd_cgifunction)(struct httpd_state *, char *)); - -httpd_cgifunction httpd_cgi(char *name); - -struct httpd_cgi_call { - const char *name; - const httpd_cgifunction function; -}; - -/** - * \brief HTTPD CGI function declaration - * \param name The C variable name of the function - * \param str The string name of the function, used in the script file - * \param function A pointer to the function that implements it - * - * This macro is used for declaring a HTTPD CGI - * function. This function is then added to the list of - * HTTPD CGI functions with the httpd_cgi_add() function. - * - * \hideinitializer - */ -#define HTTPD_CGI_CALL(name, str, function) \ -static PT_THREAD(function(struct httpd_state *, char *)); \ -static const struct httpd_cgi_call name = {str, function} - -void httpd_cgi_init(void); -#endif /* __HTTPD_CGI_H__ */ - -/** @} */ diff --git a/bundles/uip/apps/webserver/httpd-fs.c b/bundles/uip/apps/webserver/httpd-fs.c deleted file mode 100644 index 21185e87..00000000 --- a/bundles/uip/apps/webserver/httpd-fs.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: httpd-fs.c,v 1.1 2006/06/07 09:13:08 adam Exp $ - */ - -#include "httpd.h" -#include "httpd-fs.h" -#include "httpd-fsdata.h" - -#ifndef NULL -#define NULL 0 -#endif /* NULL */ - -#include "httpd-fsdata.c" - -#if HTTPD_FS_STATISTICS -static u16_t count[HTTPD_FS_NUMFILES]; -#endif /* HTTPD_FS_STATISTICS */ - -/*-----------------------------------------------------------------------------------*/ -static u8_t -httpd_fs_strcmp(const char *str1, const char *str2) -{ - u8_t i; - i = 0; - loop: - - if(str2[i] == 0 || - str1[i] == '\r' || - str1[i] == '\n') { - return 0; - } - - if(str1[i] != str2[i]) { - return 1; - } - - - ++i; - goto loop; -} -/*-----------------------------------------------------------------------------------*/ -int -httpd_fs_open(const char *name, struct httpd_fs_file *file) -{ -#if HTTPD_FS_STATISTICS - u16_t i = 0; -#endif /* HTTPD_FS_STATISTICS */ - struct httpd_fsdata_file_noconst *f; - - for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; - f != NULL; - f = (struct httpd_fsdata_file_noconst *)f->next) { - - if(httpd_fs_strcmp(name, f->name) == 0) { - file->data = f->data; - file->len = f->len; -#if HTTPD_FS_STATISTICS - ++count[i]; -#endif /* HTTPD_FS_STATISTICS */ - return 1; - } -#if HTTPD_FS_STATISTICS - ++i; -#endif /* HTTPD_FS_STATISTICS */ - - } - return 0; -} -/*-----------------------------------------------------------------------------------*/ -void -httpd_fs_init(void) -{ -#if HTTPD_FS_STATISTICS - u16_t i; - for(i = 0; i < HTTPD_FS_NUMFILES; i++) { - count[i] = 0; - } -#endif /* HTTPD_FS_STATISTICS */ -} -/*-----------------------------------------------------------------------------------*/ -#if HTTPD_FS_STATISTICS -u16_t httpd_fs_count -(char *name) -{ - struct httpd_fsdata_file_noconst *f; - u16_t i; - - i = 0; - for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; - f != NULL; - f = (struct httpd_fsdata_file_noconst *)f->next) { - - if(httpd_fs_strcmp(name, f->name) == 0) { - return count[i]; - } - ++i; - } - return 0; -} -#endif /* HTTPD_FS_STATISTICS */ -/*-----------------------------------------------------------------------------------*/ diff --git a/bundles/uip/apps/webserver/httpd-fs.h b/bundles/uip/apps/webserver/httpd-fs.h deleted file mode 100644 index d80ed3df..00000000 --- a/bundles/uip/apps/webserver/httpd-fs.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: httpd-fs.h,v 1.1 2006/06/07 09:13:08 adam Exp $ - */ -#ifndef __HTTPD_FS_H__ -#define __HTTPD_FS_H__ - -#define HTTPD_FS_STATISTICS 1 - -struct httpd_fs_file { - char *data; - int len; -}; - -/* file must be allocated by caller and will be filled in - by the function. */ -int httpd_fs_open(const char *name, struct httpd_fs_file *file); - -#ifdef HTTPD_FS_STATISTICS -#if HTTPD_FS_STATISTICS == 1 -u16_t httpd_fs_count(char *name); -#endif /* HTTPD_FS_STATISTICS */ -#endif /* HTTPD_FS_STATISTICS */ - -void httpd_fs_init(void); - -#endif /* __HTTPD_FS_H__ */ diff --git a/bundles/uip/apps/webserver/httpd-fs/404.html b/bundles/uip/apps/webserver/httpd-fs/404.html deleted file mode 100644 index a17711d0..00000000 --- a/bundles/uip/apps/webserver/httpd-fs/404.html +++ /dev/null @@ -1,8 +0,0 @@ - - -
-

404 - file not found

-

Go here instead.

-
- - \ No newline at end of file diff --git a/bundles/uip/apps/webserver/httpd-fs/fade.png b/bundles/uip/apps/webserver/httpd-fs/fade.png deleted file mode 100644 index a9e69f75..00000000 Binary files a/bundles/uip/apps/webserver/httpd-fs/fade.png and /dev/null differ diff --git a/bundles/uip/apps/webserver/httpd-fs/files.shtml b/bundles/uip/apps/webserver/httpd-fs/files.shtml deleted file mode 100644 index 811e2303..00000000 --- a/bundles/uip/apps/webserver/httpd-fs/files.shtml +++ /dev/null @@ -1,35 +0,0 @@ -%!: /header.html -

File statistics

-
- - - - - - - - - - - - - - - -
/index.html%! file-stats /index.html -
/files.shtml%! file-stats /files.shtml -
/tcp.shtml%! file-stats /tcp.shtml -
/stats.shtml%! file-stats /stats.shtml -
/style.css%! file-stats /style.css -
/404.html%! file-stats /404.html -
/fade.png%! file-stats /fade.png -
-
-%!: /footer.html diff --git a/bundles/uip/apps/webserver/httpd-fs/footer.html b/bundles/uip/apps/webserver/httpd-fs/footer.html deleted file mode 100644 index 1fd5f4f2..00000000 --- a/bundles/uip/apps/webserver/httpd-fs/footer.html +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/bundles/uip/apps/webserver/httpd-fs/header.html b/bundles/uip/apps/webserver/httpd-fs/header.html deleted file mode 100644 index 7b1a1fe7..00000000 --- a/bundles/uip/apps/webserver/httpd-fs/header.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - Welcome to the uIP web server! - - - - - - -
diff --git a/bundles/uip/apps/webserver/httpd-fs/index.html b/bundles/uip/apps/webserver/httpd-fs/index.html deleted file mode 100644 index 27cbc93f..00000000 --- a/bundles/uip/apps/webserver/httpd-fs/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - Welcome to the uIP web server! - - - - - - -
-

- These web pages are served by a small web server running on top of - the uIP embedded TCP/IP - stack. -

-

- Click on the links above for web server statistics. -

- - - diff --git a/bundles/uip/apps/webserver/httpd-fs/processes.shtml b/bundles/uip/apps/webserver/httpd-fs/processes.shtml deleted file mode 100644 index 2f93e359..00000000 --- a/bundles/uip/apps/webserver/httpd-fs/processes.shtml +++ /dev/null @@ -1,5 +0,0 @@ -%!: /header.html -

System processes


- -%! processes -%!: /footer.html \ No newline at end of file diff --git a/bundles/uip/apps/webserver/httpd-fs/stats.shtml b/bundles/uip/apps/webserver/httpd-fs/stats.shtml deleted file mode 100644 index c63ed4af..00000000 --- a/bundles/uip/apps/webserver/httpd-fs/stats.shtml +++ /dev/null @@ -1,31 +0,0 @@ -%!: /header.html -

Network statistics

-
-
IDNamePriorityPoll handlerEvent handlerProcstate
-
-IP           Packets received
-             Packets sent
-	     Packets dropped
-IP errors    IP version/header length
-             IP length, high byte
-             IP length, low byte
-             IP fragments
-             Header checksum
-             Wrong protocol
-ICMP	     Packets received
-             Packets sent
-             Packets dropped
-             Type errors
-TCP          Packets received
-             Packets sent
-             Packets dropped
-             Checksum errors
-             Data packets without ACKs
-             Resets
-             Retransmissions
-	     No connection avaliable
-	     Connection attempts to closed ports
-
%! net-stats
-
- -%!: /footer.html diff --git a/bundles/uip/apps/webserver/httpd-fs/style.css b/bundles/uip/apps/webserver/httpd-fs/style.css deleted file mode 100644 index ba6df7f1..00000000 --- a/bundles/uip/apps/webserver/httpd-fs/style.css +++ /dev/null @@ -1,92 +0,0 @@ -h1 -{ - text-align: center; - font-size:14pt; - font-family:arial,helvetica; - font-weight:bold; - padding:10px; -} - -body -{ - - background-color: #fffeec; - color:black; - - font-size:8pt; - font-family:arial,helvetica; -} - -.menu -{ - margin: 4px; - width:60%; - - padding:2px; - - border: solid 1px; - background-color: #fffcd2; - text-align:left; - - font-size:9pt; - font-family:arial,helvetica; -} - -div.menubox -{ - width: 25%; - border: 0; - float: left; -text-align: center; -} - -.contentblock -{ - margin: 4px; - width:60%; - - padding:2px; - - border: 1px dotted; - background-color: white; - - font-size:8pt; - font-family:arial,helvetica; - -} - -p.intro -{ - margin-left:20px; - margin-right:20px; - - font-size:10pt; -/* font-weight:bold; */ - font-family:arial,helvetica; -} - -p.clink -{ - font-size:12pt; - font-family:courier,monospace; - text-align:center; -} - -p.clink9 -{ - font-size:9pt; - font-family:courier,monospace; - text-align:center; -} - - -p -{ - padding-left:10px; -} - -p.right -{ - text-align:right; -} - diff --git a/bundles/uip/apps/webserver/httpd-fs/tcp.shtml b/bundles/uip/apps/webserver/httpd-fs/tcp.shtml deleted file mode 100644 index 4c4bffe9..00000000 --- a/bundles/uip/apps/webserver/httpd-fs/tcp.shtml +++ /dev/null @@ -1,5 +0,0 @@ -%!: /header.html -

Current connections


- -%! tcp-connections -%!: /footer.html \ No newline at end of file diff --git a/bundles/uip/apps/webserver/httpd-fsdata.c b/bundles/uip/apps/webserver/httpd-fsdata.c deleted file mode 100644 index 491095ec..00000000 --- a/bundles/uip/apps/webserver/httpd-fsdata.c +++ /dev/null @@ -1,607 +0,0 @@ -static const unsigned char data_processes_shtml[] = { - /* /processes.shtml */ - 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, - 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x70, 0x72, - 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x3c, 0x2f, 0x68, - 0x31, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x3c, 0x74, 0x61, 0x62, - 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, - 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0xa, 0x3c, 0x74, 0x72, - 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x49, 0x44, 0x3c, 0x2f, 0x74, - 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x4e, 0x61, 0x6d, 0x65, - 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x50, - 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3c, 0x2f, 0x74, - 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x50, 0x6f, 0x6c, 0x6c, - 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x3c, 0x2f, - 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, - 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x50, - 0x72, 0x6f, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3c, 0x2f, - 0x74, 0x68, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x25, - 0x21, 0x20, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, - 0x73, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, 0x6f, 0x6f, - 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0}; - -static const unsigned char data_404_html[] = { - /* /404.html */ - 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x20, 0x20, 0x3c, - 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c, - 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22, - 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x63, 0x65, 0x6e, - 0x74, 0x65, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, - 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, - 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, - 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x68, 0x33, - 0x3e, 0x47, 0x6f, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, - 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x68, 0x65, 0x72, 0x65, - 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, - 0x61, 0x64, 0x2e, 0x3c, 0x2f, 0x68, 0x33, 0x3e, 0xa, 0x20, - 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, - 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, - 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, -0}; - -static const unsigned char data_files_shtml[] = { - /* /files.shtml */ - 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, - 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, - 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x68, 0x31, - 0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e, - 0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, - 0x64, 0x74, 0x68, 0x3d, 0x22, 0x33, 0x30, 0x30, 0x22, 0x3e, - 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, - 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22, - 0x3e, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, - 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, - 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, - 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, - 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, - 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, - 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, 0x63, 0x3d, - 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, - 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x31, - 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x25, 0x21, - 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, - 0x73, 0x20, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, - 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, 0x74, 0x64, - 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, 0x74, 0x72, - 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, - 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, - 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, 0x66, - 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, - 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, - 0x3c, 0x74, 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, - 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x66, - 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, - 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, - 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, - 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x22, - 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x31, 0x30, - 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x25, 0x21, 0x20, - 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, - 0x20, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, - 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, 0x74, 0x64, - 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, 0x74, 0x72, - 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, - 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, - 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, 0x74, 0x63, 0x70, - 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, - 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, - 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, - 0x61, 0x74, 0x73, 0x20, 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, - 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, - 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, - 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, - 0x70, 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, - 0x3d, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, - 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x74, 0x63, 0x70, 0x2e, - 0x73, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, - 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, - 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, - 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x73, 0x74, 0x61, - 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, - 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, - 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, - 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, - 0x6d, 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, - 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, 0x63, - 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, - 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, - 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x25, - 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, - 0x74, 0x73, 0x20, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, - 0x73, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, - 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, - 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, - 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x73, 0x74, 0x79, - 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x22, 0x3e, 0x2f, 0x73, - 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x3c, 0x2f, - 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, - 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, - 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x73, 0x74, 0x79, - 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0xa, 0x3c, 0x2f, 0x74, - 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, - 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, - 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, - 0x74, 0x68, 0x3d, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, - 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x73, 0x74, - 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0xa, 0x3e, 0x20, - 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, - 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, - 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x34, - 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, - 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x3c, 0x2f, - 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, - 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, - 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x34, 0x30, 0x34, - 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, - 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, - 0x73, 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, - 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, - 0x68, 0x3d, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, - 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x34, 0x30, 0x34, - 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, - 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, - 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, - 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, - 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x3e, 0x2f, 0x66, 0x61, - 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x3c, 0x2f, 0x61, 0x3e, - 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, - 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, - 0x61, 0x74, 0x73, 0x20, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, - 0x70, 0x6e, 0x67, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, - 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, - 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, - 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, - 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, - 0x61, 0x74, 0x73, 0x20, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, - 0x70, 0x6e, 0x67, 0xa, 0x3e, 0x20, 0x3c, 0x2f, 0x74, 0x64, - 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, 0x2f, 0x74, - 0x61, 0x62, 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x2f, 0x63, 0x65, - 0x6e, 0x74, 0x65, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x3a, 0x20, - 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, - 0x6d, 0x6c, 0xa, 0}; - -static const unsigned char data_footer_html[] = { - /* /footer.html */ - 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, - 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0}; - -static const unsigned char data_header_html[] = { - /* /header.html */ - 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, - 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, - 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, - 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, - 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, - 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, - 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, - 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, - 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, - 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, - 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, - 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, - 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x49, 0x50, 0x20, 0x77, - 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x21, - 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x20, - 0x20, 0x20, 0x20, 0x3c, 0x6c, 0x69, 0x6e, 0x6b, 0x20, 0x72, - 0x65, 0x6c, 0x3d, 0x22, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x73, - 0x68, 0x65, 0x65, 0x74, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, - 0x3d, 0x22, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, - 0x22, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, 0x74, - 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x22, 0x3e, 0x20, - 0x20, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, - 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, - 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, - 0x66, 0x66, 0x66, 0x65, 0x65, 0x63, 0x22, 0x20, 0x74, 0x65, - 0x78, 0x74, 0x3d, 0x22, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x22, - 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, - 0x75, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, - 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, - 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, - 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x46, - 0x72, 0x6f, 0x6e, 0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, - 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, - 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, - 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6f, - 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, - 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, - 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, - 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, - 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, - 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, - 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, - 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, - 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, - 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, - 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, - 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, - 0x65, 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, - 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, 0x70, - 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0xa, 0x20, 0x20, 0x63, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, - 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, - 0x20, 0x20, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, - 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0xa, 0x20, - 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, - 0x73, 0x3d, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0}; - -static const unsigned char data_index_html[] = { - /* /index.html */ - 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, - 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, - 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, - 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, - 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, - 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, - 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, - 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, - 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, - 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, - 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, - 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, - 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x49, 0x50, 0x20, 0x77, - 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x21, - 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x20, - 0x20, 0x20, 0x20, 0x3c, 0x6c, 0x69, 0x6e, 0x6b, 0x20, 0x72, - 0x65, 0x6c, 0x3d, 0x22, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x73, - 0x68, 0x65, 0x65, 0x74, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, - 0x3d, 0x22, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, - 0x22, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, 0x74, - 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x22, 0x3e, 0x20, - 0x20, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, - 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, - 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, - 0x66, 0x66, 0x66, 0x65, 0x65, 0x63, 0x22, 0x20, 0x74, 0x65, - 0x78, 0x74, 0x3d, 0x22, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x22, - 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, - 0x75, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, - 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, - 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, - 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x46, - 0x72, 0x6f, 0x6e, 0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, - 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, - 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, - 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6f, - 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, - 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, - 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, - 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, - 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, - 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, - 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, - 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, - 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, - 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, - 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, - 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, - 0x65, 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, - 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, 0x70, - 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0xa, 0x20, 0x20, 0x63, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, - 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, - 0x20, 0x20, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, - 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, - 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, - 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x62, 0x6c, - 0x6f, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x70, - 0x3e, 0xa, 0x20, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, - 0x77, 0x65, 0x62, 0x20, 0x70, 0x61, 0x67, 0x65, 0x73, 0x20, - 0x61, 0x72, 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x20, 0x62, 0x79, 0x20, 0x61, 0x20, 0x73, 0x6d, 0x61, 0x6c, - 0x6c, 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, - 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, - 0xa, 0x20, 0x20, 0x74, 0x68, 0x65, 0x20, 0x3c, 0x61, 0x20, - 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, - 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, - 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, - 0x2f, 0x75, 0x69, 0x70, 0x2f, 0x22, 0x3e, 0x75, 0x49, 0x50, - 0x20, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, - 0x54, 0x43, 0x50, 0x2f, 0x49, 0x50, 0xa, 0x20, 0x20, 0x73, - 0x74, 0x61, 0x63, 0x6b, 0x3c, 0x2f, 0x61, 0x3e, 0x2e, 0xa, - 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0x20, 0x20, 0x3c, - 0x70, 0x3e, 0xa, 0x20, 0x20, 0x43, 0x6c, 0x69, 0x63, 0x6b, - 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, - 0x6e, 0x6b, 0x73, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, - 0x66, 0x6f, 0x72, 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, - 0x73, 0x74, 0x69, 0x63, 0x73, 0x2e, 0xa, 0x20, 0x20, 0x3c, - 0x2f, 0x70, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, - 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, - 0x6c, 0x3e, 0xa, 0}; - -static const unsigned char data_style_css[] = { - /* /style.css */ - 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0, - 0x68, 0x31, 0x20, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x74, 0x65, - 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x20, - 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3b, 0xa, 0x20, 0x20, - 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, - 0x31, 0x34, 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, - 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, - 0x61, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x68, 0x65, 0x6c, 0x76, - 0x65, 0x74, 0x69, 0x63, 0x61, 0x3b, 0xa, 0x20, 0x20, 0x66, - 0x6f, 0x6e, 0x74, 0x2d, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x3a, 0x62, 0x6f, 0x6c, 0x64, 0x3b, 0xa, 0x20, 0x20, 0x70, - 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x31, 0x30, 0x70, - 0x78, 0x3b, 0x20, 0xa, 0x7d, 0xa, 0xa, 0x62, 0x6f, 0x64, - 0x79, 0xa, 0x7b, 0xa, 0xa, 0x20, 0x20, 0x62, 0x61, 0x63, - 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, 0x6f, - 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x66, 0x66, 0x65, - 0x65, 0x63, 0x3b, 0xa, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, - 0x72, 0x3a, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x3b, 0xa, 0xa, - 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, - 0x65, 0x3a, 0x38, 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, - 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, - 0x3a, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x68, 0x65, 0x6c, - 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, 0x3b, 0xa, 0x7d, 0xa, - 0xa, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0xa, 0x7b, 0xa, 0x20, - 0x20, 0x6d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x3a, 0x20, 0x34, - 0x70, 0x78, 0x3b, 0xa, 0x20, 0x20, 0x77, 0x69, 0x64, 0x74, - 0x68, 0x3a, 0x36, 0x30, 0x25, 0x3b, 0xa, 0xa, 0x20, 0x20, - 0x70, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x32, 0x70, - 0x78, 0x3b, 0xa, 0x9, 0xa, 0x20, 0x20, 0x62, 0x6f, 0x72, - 0x64, 0x65, 0x72, 0x3a, 0x20, 0x73, 0x6f, 0x6c, 0x69, 0x64, - 0x20, 0x31, 0x70, 0x78, 0x3b, 0xa, 0x20, 0x20, 0x62, 0x61, - 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, - 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x66, 0x66, - 0x63, 0x64, 0x32, 0x3b, 0xa, 0x20, 0x20, 0x74, 0x65, 0x78, - 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x6c, 0x65, - 0x66, 0x74, 0x3b, 0xa, 0x20, 0x20, 0xa, 0x20, 0x20, 0x66, - 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, 0x39, - 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, - 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x61, 0x72, - 0x69, 0x61, 0x6c, 0x2c, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x74, - 0x69, 0x63, 0x61, 0x3b, 0x20, 0x20, 0xa, 0x7d, 0xa, 0xa, - 0x64, 0x69, 0x76, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6f, - 0x78, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x77, 0x69, 0x64, 0x74, - 0x68, 0x3a, 0x20, 0x32, 0x35, 0x25, 0x3b, 0xa, 0x20, 0x20, - 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3a, 0x20, 0x30, 0x3b, - 0xa, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3a, 0x20, - 0x6c, 0x65, 0x66, 0x74, 0x3b, 0xa, 0x74, 0x65, 0x78, 0x74, - 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x20, 0x63, 0x65, - 0x6e, 0x74, 0x65, 0x72, 0x3b, 0xa, 0x7d, 0xa, 0xa, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0xa, 0x7b, 0x20, 0x20, 0xa, 0x20, 0x20, 0x6d, - 0x61, 0x72, 0x67, 0x69, 0x6e, 0x3a, 0x20, 0x34, 0x70, 0x78, - 0x3b, 0xa, 0x20, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3a, - 0x36, 0x30, 0x25, 0x3b, 0xa, 0xa, 0x20, 0x20, 0x70, 0x61, - 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x32, 0x70, 0x78, 0x3b, - 0xa, 0xa, 0x20, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, - 0x3a, 0x20, 0x31, 0x70, 0x78, 0x20, 0x64, 0x6f, 0x74, 0x74, - 0x65, 0x64, 0x3b, 0xa, 0x20, 0x20, 0x62, 0x61, 0x63, 0x6b, - 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, 0x6f, 0x6c, - 0x6f, 0x72, 0x3a, 0x20, 0x77, 0x68, 0x69, 0x74, 0x65, 0x3b, - 0xa, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, - 0x69, 0x7a, 0x65, 0x3a, 0x38, 0x70, 0x74, 0x3b, 0xa, 0x20, - 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, - 0x6c, 0x79, 0x3a, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x68, - 0x65, 0x6c, 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, 0x3b, 0x20, - 0x20, 0xa, 0xa, 0x7d, 0xa, 0xa, 0x70, 0x2e, 0x69, 0x6e, - 0x74, 0x72, 0x6f, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x6d, 0x61, - 0x72, 0x67, 0x69, 0x6e, 0x2d, 0x6c, 0x65, 0x66, 0x74, 0x3a, - 0x32, 0x30, 0x70, 0x78, 0x3b, 0xa, 0x20, 0x20, 0x6d, 0x61, - 0x72, 0x67, 0x69, 0x6e, 0x2d, 0x72, 0x69, 0x67, 0x68, 0x74, - 0x3a, 0x32, 0x30, 0x70, 0x78, 0x3b, 0xa, 0xa, 0x20, 0x20, - 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, - 0x31, 0x30, 0x70, 0x74, 0x3b, 0xa, 0x2f, 0x2a, 0x20, 0x20, - 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x77, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x3a, 0x62, 0x6f, 0x6c, 0x64, 0x3b, 0x20, 0x2a, 0x2f, - 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, - 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x61, 0x72, 0x69, 0x61, 0x6c, - 0x2c, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, - 0x3b, 0x20, 0x20, 0xa, 0x7d, 0xa, 0xa, 0x70, 0x2e, 0x63, - 0x6c, 0x69, 0x6e, 0x6b, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x66, - 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, 0x31, - 0x32, 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, - 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x63, - 0x6f, 0x75, 0x72, 0x69, 0x65, 0x72, 0x2c, 0x6d, 0x6f, 0x6e, - 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x3b, 0x20, 0x20, 0xa, - 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, - 0x67, 0x6e, 0x3a, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3b, - 0xa, 0x7d, 0xa, 0xa, 0x70, 0x2e, 0x63, 0x6c, 0x69, 0x6e, - 0x6b, 0x39, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, - 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, 0x39, 0x70, 0x74, - 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, - 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x63, 0x6f, 0x75, 0x72, - 0x69, 0x65, 0x72, 0x2c, 0x6d, 0x6f, 0x6e, 0x6f, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x3b, 0x20, 0x20, 0xa, 0x20, 0x20, 0x74, - 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, - 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3b, 0xa, 0x7d, 0xa, - 0xa, 0xa, 0x70, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x70, 0x61, - 0x64, 0x64, 0x69, 0x6e, 0x67, 0x2d, 0x6c, 0x65, 0x66, 0x74, - 0x3a, 0x31, 0x30, 0x70, 0x78, 0x3b, 0xa, 0x7d, 0xa, 0xa, - 0x70, 0x2e, 0x72, 0x69, 0x67, 0x68, 0x74, 0xa, 0x7b, 0xa, - 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, - 0x67, 0x6e, 0x3a, 0x72, 0x69, 0x67, 0x68, 0x74, 0x3b, 0x20, - 0xa, 0x7d, 0xa, 0xa, 0}; - -static const unsigned char data_tcp_shtml[] = { - /* /tcp.shtml */ - 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, - 0x3e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x3c, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64, 0x74, - 0x68, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0xa, - 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x4c, 0x6f, - 0x63, 0x61, 0x6c, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, - 0x68, 0x3e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x3c, 0x2f, - 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, - 0x3e, 0x52, 0x65, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x74, 0x68, - 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x54, 0x69, 0x6d, 0x65, 0x72, - 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x46, - 0x6c, 0x61, 0x67, 0x73, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, - 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x20, 0x74, 0x63, - 0x70, 0x2d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, - 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, -0}; - -static const unsigned char data_fade_png[] = { - /* /fade.png */ - 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0, - 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 00, 00, - 00, 0xd, 0x49, 0x48, 0x44, 0x52, 00, 00, 00, 0x4, - 00, 00, 00, 0xa, 0x8, 0x2, 00, 00, 00, 0x1c, - 0x99, 0x68, 0x59, 00, 00, 00, 0x9, 0x70, 0x48, 0x59, - 0x73, 00, 00, 0xb, 0x13, 00, 00, 0xb, 0x13, 0x1, - 00, 0x9a, 0x9c, 0x18, 00, 00, 00, 0x7, 0x74, 0x49, - 0x4d, 0x45, 0x7, 0xd6, 0x6, 0x8, 0x14, 0x1b, 0x39, 0xaf, - 0x5b, 0xc0, 0xe3, 00, 00, 00, 0x1d, 0x74, 0x45, 0x58, - 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 00, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, - 0x68, 0x20, 0x54, 0x68, 0x65, 0x20, 0x47, 0x49, 0x4d, 0x50, - 0xef, 0x64, 0x25, 0x6e, 00, 00, 00, 0x3a, 0x49, 0x44, - 0x41, 0x54, 0x8, 0xd7, 0x75, 0x8c, 0x31, 0x12, 00, 0x10, - 0x10, 0xc4, 0x2e, 0x37, 0x9e, 0x40, 0x65, 0xfd, 0xff, 0x83, - 0xf4, 0xa, 0x1c, 0x8d, 0x54, 0x9b, 0xc9, 0xcc, 0x9a, 0x3d, - 0x90, 0x73, 0x71, 0x67, 0x91, 0xd4, 0x74, 0x36, 0xa9, 0x55, - 0x1, 0xf8, 0x29, 0x58, 0xc8, 0xbf, 0x48, 0xc4, 0x81, 0x74, - 0xb, 0xa3, 0xf, 0x7c, 0xdb, 0x4, 0xe8, 0x40, 0x5, 0xdf, - 0xa1, 0xf3, 0xfc, 0x73, 00, 00, 00, 00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0}; - -static const unsigned char data_stats_shtml[] = { - /* /stats.shtml */ - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, - 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, - 0x3e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x73, - 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, - 0x2f, 0x68, 0x31, 0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, - 0x65, 0x72, 0x3e, 0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, - 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x33, 0x30, - 0x30, 0x22, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, - 0x22, 0x30, 0x22, 0x3e, 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, - 0x74, 0x64, 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x3e, 0xa, 0x49, - 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, - 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0xa, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, - 0x73, 0x65, 0x6e, 0x74, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, - 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x49, 0x50, 0x20, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x20, 0x20, 0x20, 0x20, - 0x49, 0x50, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, - 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2c, 0x20, 0x68, - 0x69, 0x67, 0x68, 0x20, 0x62, 0x79, 0x74, 0x65, 0xa, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x49, 0x50, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x2c, 0x20, 0x6c, 0x6f, 0x77, 0x20, 0x62, 0x79, 0x74, - 0x65, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, 0x20, 0x66, 0x72, - 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0xa, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0xa, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x57, 0x72, 0x6f, 0x6e, 0x67, 0x20, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0xa, 0x49, 0x43, 0x4d, 0x50, 0x9, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, - 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, - 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, - 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x54, 0x79, 0x70, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x73, 0xa, 0x54, 0x43, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, - 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, - 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, - 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x20, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x44, - 0x61, 0x74, 0x61, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, - 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, - 0x41, 0x43, 0x4b, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x65, - 0x73, 0x65, 0x74, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x65, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x73, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x4e, 0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x76, 0x61, 0x6c, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x20, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, 0x20, - 0x74, 0x6f, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x20, - 0x70, 0x6f, 0x72, 0x74, 0x73, 0xa, 0x3c, 0x2f, 0x70, 0x72, - 0x65, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, - 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x3e, 0x25, 0x21, 0x20, 0x6e, - 0x65, 0x74, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0xa, 0x3c, - 0x2f, 0x70, 0x72, 0x65, 0x3e, 0x3c, 0x2f, 0x74, 0x61, 0x62, - 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, - 0x65, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, - 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, - 0xa, 0}; - -const struct httpd_fsdata_file file_processes_shtml[] = {{NULL, data_processes_shtml, data_processes_shtml + 17, sizeof(data_processes_shtml) - 17}}; - -const struct httpd_fsdata_file file_404_html[] = {{file_processes_shtml, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}}; - -const struct httpd_fsdata_file file_files_shtml[] = {{file_404_html, data_files_shtml, data_files_shtml + 13, sizeof(data_files_shtml) - 13}}; - -const struct httpd_fsdata_file file_footer_html[] = {{file_files_shtml, data_footer_html, data_footer_html + 13, sizeof(data_footer_html) - 13}}; - -const struct httpd_fsdata_file file_header_html[] = {{file_footer_html, data_header_html, data_header_html + 13, sizeof(data_header_html) - 13}}; - -const struct httpd_fsdata_file file_index_html[] = {{file_header_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}}; - -const struct httpd_fsdata_file file_style_css[] = {{file_index_html, data_style_css, data_style_css + 11, sizeof(data_style_css) - 11}}; - -const struct httpd_fsdata_file file_tcp_shtml[] = {{file_style_css, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 11}}; - -const struct httpd_fsdata_file file_fade_png[] = {{file_tcp_shtml, data_fade_png, data_fade_png + 10, sizeof(data_fade_png) - 10}}; - -const struct httpd_fsdata_file file_stats_shtml[] = {{file_fade_png, data_stats_shtml, data_stats_shtml + 13, sizeof(data_stats_shtml) - 13}}; - -#define HTTPD_FS_ROOT file_stats_shtml - -#define HTTPD_FS_NUMFILES 10 diff --git a/bundles/uip/apps/webserver/httpd-fsdata.h b/bundles/uip/apps/webserver/httpd-fsdata.h deleted file mode 100644 index 0ad2d6e7..00000000 --- a/bundles/uip/apps/webserver/httpd-fsdata.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: httpd-fsdata.h,v 1.1 2006/06/07 09:13:08 adam Exp $ - */ -#ifndef __HTTPD_FSDATA_H__ -#define __HTTPD_FSDATA_H__ - -#include "uip.h" - -struct httpd_fsdata_file { - const struct httpd_fsdata_file *next; - const char *name; - const char *data; - const int len; -#ifdef HTTPD_FS_STATISTICS -#if HTTPD_FS_STATISTICS == 1 - u16_t count; -#endif /* HTTPD_FS_STATISTICS */ -#endif /* HTTPD_FS_STATISTICS */ -}; - -struct httpd_fsdata_file_noconst { - struct httpd_fsdata_file *next; - char *name; - char *data; - int len; -#ifdef HTTPD_FS_STATISTICS -#if HTTPD_FS_STATISTICS == 1 - u16_t count; -#endif /* HTTPD_FS_STATISTICS */ -#endif /* HTTPD_FS_STATISTICS */ -}; - -#endif /* __HTTPD_FSDATA_H__ */ diff --git a/bundles/uip/apps/webserver/httpd.c b/bundles/uip/apps/webserver/httpd.c deleted file mode 100644 index 937e1382..00000000 --- a/bundles/uip/apps/webserver/httpd.c +++ /dev/null @@ -1,338 +0,0 @@ -/** - * \addtogroup apps - * @{ - */ - -/** - * \defgroup httpd Web server - * @{ - * The uIP web server is a very simplistic implementation of an HTTP - * server. It can serve web pages and files from a read-only ROM - * filesystem, and provides a very small scripting language. - - */ - -/** - * \file - * Web server - * \author - * Adam Dunkels - */ - - -/* - * Copyright (c) 2004, Adam Dunkels. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: httpd.c,v 1.2 2006/06/11 21:46:38 adam Exp $ - */ - -#include "uip.h" -#include "httpd.h" -#include "httpd-fs.h" -#include "httpd-cgi.h" -#include "http-strings.h" - -#include - -#define STATE_WAITING 0 -#define STATE_OUTPUT 1 - -#define ISO_nl 0x0a -#define ISO_space 0x20 -#define ISO_bang 0x21 -#define ISO_percent 0x25 -#define ISO_period 0x2e -#define ISO_slash 0x2f -#define ISO_colon 0x3a - - -/*---------------------------------------------------------------------------*/ -static unsigned short -generate_part_of_file(void *state) -{ - struct httpd_state *s = (struct httpd_state *)state; - - if(s->file.len > uip_mss()) { - s->len = uip_mss(); - } else { - s->len = s->file.len; - } - memcpy(uip_appdata, s->file.data, s->len); - - return s->len; -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_file(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sout); - - do { - PSOCK_GENERATOR_SEND(&s->sout, generate_part_of_file, s); - s->file.len -= s->len; - s->file.data += s->len; - } while(s->file.len > 0); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_part_of_file(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sout); - - PSOCK_SEND(&s->sout, s->file.data, s->len); - - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static void -next_scriptstate(struct httpd_state *s) -{ - char *p; - p = strchr(s->scriptptr, ISO_nl) + 1; - s->scriptlen -= (unsigned short)(p - s->scriptptr); - s->scriptptr = p; -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_script(struct httpd_state *s)) -{ - char *ptr; - - PT_BEGIN(&s->scriptpt); - - - while(s->file.len > 0) { - - /* Check if we should start executing a script. */ - if(*s->file.data == ISO_percent && - *(s->file.data + 1) == ISO_bang) { - s->scriptptr = s->file.data + 3; - s->scriptlen = s->file.len - 3; - if(*(s->scriptptr - 1) == ISO_colon) { - httpd_fs_open(s->scriptptr + 1, &s->file); - PT_WAIT_THREAD(&s->scriptpt, send_file(s)); - } else { - PT_WAIT_THREAD(&s->scriptpt, - httpd_cgi(s->scriptptr)(s, s->scriptptr)); - } - next_scriptstate(s); - - /* The script is over, so we reset the pointers and continue - sending the rest of the file. */ - s->file.data = s->scriptptr; - s->file.len = s->scriptlen; - } else { - /* See if we find the start of script marker in the block of HTML - to be sent. */ - - if(s->file.len > uip_mss()) { - s->len = uip_mss(); - } else { - s->len = s->file.len; - } - - if(*s->file.data == ISO_percent) { - ptr = strchr(s->file.data + 1, ISO_percent); - } else { - ptr = strchr(s->file.data, ISO_percent); - } - if(ptr != NULL && - ptr != s->file.data) { - s->len = (int)(ptr - s->file.data); - if(s->len >= uip_mss()) { - s->len = uip_mss(); - } - } - PT_WAIT_THREAD(&s->scriptpt, send_part_of_file(s)); - s->file.data += s->len; - s->file.len -= s->len; - - } - } - - PT_END(&s->scriptpt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr)) -{ - char *ptr; - - PSOCK_BEGIN(&s->sout); - - PSOCK_SEND_STR(&s->sout, statushdr); - - ptr = strrchr(s->filename, ISO_period); - if(ptr == NULL) { - PSOCK_SEND_STR(&s->sout, http_content_type_binary); - } else if(strncmp(http_html, ptr, 5) == 0 || - strncmp(http_shtml, ptr, 6) == 0) { - PSOCK_SEND_STR(&s->sout, http_content_type_html); - } else if(strncmp(http_css, ptr, 4) == 0) { - PSOCK_SEND_STR(&s->sout, http_content_type_css); - } else if(strncmp(http_png, ptr, 4) == 0) { - PSOCK_SEND_STR(&s->sout, http_content_type_png); - } else if(strncmp(http_gif, ptr, 4) == 0) { - PSOCK_SEND_STR(&s->sout, http_content_type_gif); - } else if(strncmp(http_jpg, ptr, 4) == 0) { - PSOCK_SEND_STR(&s->sout, http_content_type_jpg); - } else { - PSOCK_SEND_STR(&s->sout, http_content_type_plain); - } - PSOCK_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_output(struct httpd_state *s)) -{ - char *ptr; - - PT_BEGIN(&s->outputpt); - - if(!httpd_fs_open(s->filename, &s->file)) { - httpd_fs_open(http_404_html, &s->file); - strcpy(s->filename, http_404_html); - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, - http_header_404)); - PT_WAIT_THREAD(&s->outputpt, - send_file(s)); - } else { - PT_WAIT_THREAD(&s->outputpt, - send_headers(s, - http_header_200)); - ptr = strchr(s->filename, ISO_period); - if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0) { - PT_INIT(&s->scriptpt); - PT_WAIT_THREAD(&s->outputpt, handle_script(s)); - } else { - PT_WAIT_THREAD(&s->outputpt, - send_file(s)); - } - } - PSOCK_CLOSE(&s->sout); - PT_END(&s->outputpt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_input(struct httpd_state *s)) -{ - PSOCK_BEGIN(&s->sin); - - PSOCK_READTO(&s->sin, ISO_space); - - - if(strncmp(s->inputbuf, http_get, 4) != 0) { - PSOCK_CLOSE_EXIT(&s->sin); - } - PSOCK_READTO(&s->sin, ISO_space); - - if(s->inputbuf[0] != ISO_slash) { - PSOCK_CLOSE_EXIT(&s->sin); - } - - if(s->inputbuf[1] == ISO_space) { - strncpy(s->filename, http_index_html, sizeof(s->filename)); - } else { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; - strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename)); - } - - /* httpd_log_file(uip_conn->ripaddr, s->filename);*/ - - s->state = STATE_OUTPUT; - - while(1) { - PSOCK_READTO(&s->sin, ISO_nl); - - if(strncmp(s->inputbuf, http_referer, 8) == 0) { - s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0; - /* httpd_log(&s->inputbuf[9]);*/ - } - } - - PSOCK_END(&s->sin); -} -/*---------------------------------------------------------------------------*/ -static void -handle_connection(struct httpd_state *s) -{ - handle_input(s); - if(s->state == STATE_OUTPUT) { - handle_output(s); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_appcall(void) -{ - struct httpd_state *s = (struct httpd_state *)&(uip_conn->appstate); - - if(uip_closed() || uip_aborted() || uip_timedout()) { - } else if(uip_connected()) { - PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); - PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); - PT_INIT(&s->outputpt); - s->state = STATE_WAITING; - /* timer_set(&s->timer, CLOCK_SECOND * 100);*/ - s->timer = 0; - handle_connection(s); - } else if(s != NULL) { - if(uip_poll()) { - ++s->timer; - if(s->timer >= 20) { - uip_abort(); - } - } else { - s->timer = 0; - } - handle_connection(s); - } else { - uip_abort(); - } -} -/*---------------------------------------------------------------------------*/ -/** - * \brief Initialize the web server - * - * This function initializes the web server and should be - * called at system boot-up. - */ -void -httpd_init(void) -{ - uip_listen(HTONS(80)); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/bundles/uip/apps/webserver/httpd.h b/bundles/uip/apps/webserver/httpd.h deleted file mode 100644 index 270d49de..00000000 --- a/bundles/uip/apps/webserver/httpd.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2001-2005, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: httpd.h,v 1.2 2006/06/11 21:46:38 adam Exp $ - * - */ - -#ifndef __HTTPD_H__ -#define __HTTPD_H__ - -#include "psock.h" -#include "httpd-fs.h" - -struct httpd_state { - unsigned char timer; - struct psock sin, sout; - struct pt outputpt, scriptpt; - char inputbuf[50]; - char filename[20]; - char state; - struct httpd_fs_file file; - int len; - char *scriptptr; - int scriptlen; - - unsigned short count; -}; - -void httpd_init(void); -void httpd_appcall(void); - -void httpd_log(char *msg); -void httpd_log_file(u16_t *requester, char *file); - -#endif /* __HTTPD_H__ */ diff --git a/bundles/uip/apps/webserver/makefsdata b/bundles/uip/apps/webserver/makefsdata deleted file mode 100644 index b2109abd..00000000 --- a/bundles/uip/apps/webserver/makefsdata +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/perl - -open(OUTPUT, "> httpd-fsdata.c"); - -chdir("httpd-fs"); - -opendir(DIR, "."); -@files = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); -closedir(DIR); - -foreach $file (@files) { - - if(-d $file && $file !~ /^\./) { - print "Processing directory $file\n"; - opendir(DIR, $file); - @newfiles = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); - closedir(DIR); - printf "Adding files @newfiles\n"; - @files = (@files, map { $_ = "$file/$_" } @newfiles); - next; - } -} - -foreach $file (@files) { - if(-f $file) { - - print "Adding file $file\n"; - - open(FILE, $file) || die "Could not open file $file\n"; - - $file =~ s-^-/-; - $fvar = $file; - $fvar =~ s-/-_-g; - $fvar =~ s-\.-_-g; - # for AVR, add PROGMEM here - print(OUTPUT "static const unsigned char data".$fvar."[] = {\n"); - print(OUTPUT "\t/* $file */\n\t"); - for($j = 0; $j < length($file); $j++) { - printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1))); - } - printf(OUTPUT "0,\n"); - - - $i = 0; - while(read(FILE, $data, 1)) { - if($i == 0) { - print(OUTPUT "\t"); - } - printf(OUTPUT "%#02x, ", unpack("C", $data)); - $i++; - if($i == 10) { - print(OUTPUT "\n"); - $i = 0; - } - } - print(OUTPUT "0};\n\n"); - close(FILE); - push(@fvars, $fvar); - push(@pfiles, $file); - } -} - -for($i = 0; $i < @fvars; $i++) { - $file = $pfiles[$i]; - $fvar = $fvars[$i]; - - if($i == 0) { - $prevfile = "NULL"; - } else { - $prevfile = "file" . $fvars[$i - 1]; - } - print(OUTPUT "const struct httpd_fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, "); - print(OUTPUT "data$fvar + ". (length($file) + 1) .", "); - print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n"); -} - -print(OUTPUT "#define HTTPD_FS_ROOT file$fvars[$i - 1]\n\n"); -print(OUTPUT "#define HTTPD_FS_NUMFILES $i\n"); diff --git a/bundles/uip/apps/webserver/makestrings b/bundles/uip/apps/webserver/makestrings deleted file mode 100644 index 20f0e242..00000000 --- a/bundles/uip/apps/webserver/makestrings +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - - -sub stringify { - my $name = shift(@_); - open(OUTPUTC, "> $name.c"); - open(OUTPUTH, "> $name.h"); - - open(FILE, "$name"); - - while() { - if(/(.+) "(.+)"/) { - $var = $1; - $data = $2; - - $datan = $data; - $datan =~ s/\\r/\r/g; - $datan =~ s/\\n/\n/g; - $datan =~ s/\\01/\01/g; - $datan =~ s/\\0/\0/g; - - printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); - printf(OUTPUTC "/* \"$data\" */\n"); - printf(OUTPUTC "{"); - for($j = 0; $j < length($datan); $j++) { - printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); - } - printf(OUTPUTC "};\n"); - - printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); - - } - } - close(OUTPUTC); - close(OUTPUTH); -} -stringify("http-strings"); - -exit 0; - diff --git a/bundles/uip/apps/webserver/webserver.h b/bundles/uip/apps/webserver/webserver.h deleted file mode 100644 index 48753e69..00000000 --- a/bundles/uip/apps/webserver/webserver.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack - * - * $Id: webserver.h,v 1.2 2006/06/11 21:46:38 adam Exp $ - * - */ -#ifndef __WEBSERVER_H__ -#define __WEBSERVER_H__ - -#include "httpd.h" - -typedef struct httpd_state uip_tcp_appstate_t; -/* UIP_APPCALL: the name of the application function. This function - must return void and take no arguments (i.e., C type "void - appfunc(void)"). */ -#ifndef UIP_APPCALL -#define UIP_APPCALL httpd_appcall -#endif - - -#endif /* __WEBSERVER_H__ */ diff --git a/bundles/uip/lib/memb.c b/bundles/uip/lib/memb.c deleted file mode 100644 index 777b52f7..00000000 --- a/bundles/uip/lib/memb.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: memb.c,v 1.1 2006/06/12 08:21:43 adam Exp $ - */ - -/** - * \addtogroup memb - * @{ - */ - - /** - * \file - * Memory block allocation routines. - * \author Adam Dunkels - */ -#include - -#include "memb.h" - -/*---------------------------------------------------------------------------*/ -void -memb_init(struct memb_blocks *m) -{ - memset(m->count, 0, m->num); - memset(m->mem, 0, m->size * m->num); -} -/*---------------------------------------------------------------------------*/ -void * -memb_alloc(struct memb_blocks *m) -{ - int i; - - for(i = 0; i < m->num; ++i) { - if(m->count[i] == 0) { - /* If this block was unused, we increase the reference count to - indicate that it now is used and return a pointer to the - memory block. */ - ++(m->count[i]); - return (void *)((char *)m->mem + (i * m->size)); - } - } - - /* No free block was found, so we return NULL to indicate failure to - allocate block. */ - return NULL; -} -/*---------------------------------------------------------------------------*/ -char -memb_free(struct memb_blocks *m, void *ptr) -{ - int i; - char *ptr2; - - /* Walk through the list of blocks and try to find the block to - which the pointer "ptr" points to. */ - ptr2 = (char *)m->mem; - for(i = 0; i < m->num; ++i) { - - if(ptr2 == (char *)ptr) { - /* We've found to block to which "ptr" points so we decrease the - reference count and return the new value of it. */ - if(m->count[i] > 0) { - /* Make sure that we don't deallocate free memory. */ - --(m->count[i]); - } - return m->count[i]; - } - ptr2 += m->size; - } - return -1; -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/bundles/uip/lib/memb.h b/bundles/uip/lib/memb.h deleted file mode 100644 index b725ebe1..00000000 --- a/bundles/uip/lib/memb.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: memb.h,v 1.1 2006/06/12 08:21:43 adam Exp $ - */ - -/** - * \defgroup memb Memory block management functions - * - * The memory block allocation routines provide a simple yet powerful - * set of functions for managing a set of memory blocks of fixed - * size. A set of memory blocks is statically declared with the - * MEMB() macro. Memory blocks are allocated from the declared - * memory by the memb_alloc() function, and are deallocated with the - * memb_free() function. - * - * \note Because of namespace clashes only one MEMB() can be - * declared per C module, and the name scope of a MEMB() memory - * block is local to each C module. - * - * The following example shows how to declare and use a memory block - * called "cmem" which has 8 chunks of memory with each memory chunk - * being 20 bytes large. - * - * @{ - */ - - -/** - * \file - * Memory block allocation routines. - * \author - * Adam Dunkels - * - */ - -#ifndef __MEMB_H__ -#define __MEMB_H__ - -/* - * Here we define a C preprocessing macro for concatenating to - * strings. We need use two macros in order to allow concatenation of - * two #defined macros. - */ -#define MEMB_CONCAT2(s1, s2) s1##s2 -#define MEMB_CONCAT(s1, s2) MEMB_CONCAT2(s1, s2) - -/** - * Declare a memory block. - * - * This macro is used to staticall declare a block of memory that can - * be used by the block allocation functions. The macro statically - * declares a C array with a size that matches the specified number of - * blocks and their individual sizes. - * - * Example: - \code -MEMB(connections, sizeof(struct connection), 16); - \endcode - * - * \param name The name of the memory block (later used with - * memb_init(), memb_alloc() and memb_free()). - * - * \param size The size of each memory chunk, in bytes. - * - * \param num The total number of memory chunks in the block. - * - */ -#define MEMB(name, structure, num) \ - static char MEMB_CONCAT(name,_memb_count)[num]; \ - static structure MEMB_CONCAT(name,_memb_mem)[num]; \ - static struct memb_blocks name = {sizeof(structure), num, \ - MEMB_CONCAT(name,_memb_count), \ - (void *)MEMB_CONCAT(name,_memb_mem)} - -struct memb_blocks { - unsigned short size; - unsigned short num; - char *count; - void *mem; -}; - -/** - * Initialize a memory block that was declared with MEMB(). - * - * \param m A memory block previosly declared with MEMB(). - */ -void memb_init(struct memb_blocks *m); - -/** - * Allocate a memory block from a block of memory declared with MEMB(). - * - * \param m A memory block previosly declared with MEMB(). - */ -void *memb_alloc(struct memb_blocks *m); - -/** - * Deallocate a memory block from a memory block previously declared - * with MEMB(). - * - * \param m m A memory block previosly declared with MEMB(). - * - * \param ptr A pointer to the memory block that is to be deallocated. - * - * \return The new reference count for the memory block (should be 0 - * if successfully deallocated) or -1 if the pointer "ptr" did not - * point to a legal memory block. - */ -char memb_free(struct memb_blocks *m, void *ptr); - -/** @} */ - -#endif /* __MEMB_H__ */ diff --git a/bundles/uip/uip-1.0-changelog.txt b/bundles/uip/uip-1.0-changelog.txt deleted file mode 100644 index 1e6c61cf..00000000 --- a/bundles/uip/uip-1.0-changelog.txt +++ /dev/null @@ -1,98 +0,0 @@ -* A new API: protosockets that are similar to BSD sockets but does not - require any underlying multithreading system. - -* Very rudimentary IPv6 support - -* New application: DHCP client. Web server rewritten with protosockets. - -* Removed uIP zero-copy functionality in order to simplify uIP device - driver coding: outbound packets are now *always* stored in full in - the uip_buf buffer. - -* Checksum computation is now part of uip.c, but it still is possible - to implement them in assembly code by specifying a configuration - option. Checksum code now runs on architectures with 2-byte alignment. - -* Added TCP persistent timer. - -* Made all IP address representations use the new uip_ipaddr_ip - datatype for clarity. - -* Updated window behavior so that sending to a host with a small open - window works better now. - -* UDP API change: uip_udp_new() now takes port numbers in network byte - order like TCP functions. - -* Allow reception of packets when no IP address is configured to make - DHCP work. - -* Moved Ethernet address into main uIP module from ARP module. - -* Made constants explicit #defines and moved them out of the code - (header sizes, TCP options, TCP header length field). - -* If uip_len is less than that reported by the IP header, the packet - is discarded. If uip_len is greater than the length reported by the - IP header, uip_len is adjusted. - -* Moved header size definitions into header file. - -* Added uIP call for polling an application without triggering any - timer events. Removed redundant assignments of uip_len and uip_slen. - -* Removed compiler warning about icmp_input label being defined when - UIP_PINGADDRCONF was not used. - -* Added UIP_APPDATA_SIZE macro that holds the available buffer size - for user data. - -* Added uip_udp_bind() call. - -* Moved checksum code into main uIP module. - -* Switched the TCP, UDP and IP header structures to be structs rather - than typedefs. - -* Prefixed TCP state names with UIP_ to avoid name space - contamination. - -* Changed declarations of uip_appdatap and friends to void * to avoid - explicit typecasts. - -* Bugfixes - - o TCP: Fixed bug with high byte of peer window size. - - o TCP: Fixed bug that in some cases prevented concurrent reception and - transmission of TCP data. - - o TCP: uip_connect() didn't correctly calculate age of TIME_WAIT - connections. - - o TCP: Array index for uip_conns[] array was out of bounds in - comparison. Comparison changed to make index within bounds. - - o TCP: if the remote host crashes and tries to reestablish an old - connection, uIP should respond with an ACK with the correct - sequence and acknowledgment numbers, to which the remote host - should respond with an ACK. uIP did not respond with the correct - ACK. - - o TCP: Fixed check for SYNACK segment: now checks only relevant TCP - control flags and discards flags reserved for future expansion. - - o TCP: Fixed bug where uIP did not inform application that a connection - had been aborted during an active open. - - o TCP: FIN segment was accepted even though application had stopped - incoming data with uip_stop(). - - o TCP: A FINACK segment would not always correctly acknowledge data. - - o UDP: checksums are now calculated after all fields have been - filled in. - - o UDP: network byte order on lastport in uip_udp_new(). - - o IP: memset() bugs in IP fragment reassembly code fixed. diff --git a/bundles/uip/uip/Makefile.include b/bundles/uip/uip/Makefile.include deleted file mode 100644 index b4d8a94c..00000000 --- a/bundles/uip/uip/Makefile.include +++ /dev/null @@ -1,47 +0,0 @@ - - -ifdef APPS - APPDIRS = $(foreach APP, $(APPS), ../apps/$(APP)) - -include $(foreach APP, $(APPS), ../apps/$(APP)/Makefile.$(APP)) - CFLAGS += $(addprefix -I../apps/,$(APPS)) -endif - -ifndef CCDEP - CCDEP = $(CC) -endif -ifndef CCDEPCFLAGS - CCDEPCFLAGS = $(CFLAGS) -endif -ifndef OBJECTDIR - OBJECTDIR = obj -endif - -ifeq (${wildcard $(OBJECTDIR)},) - DUMMY := ${shell mkdir $(OBJECTDIR)} -endif - - -vpath %.c . ../uip ../lib $(APPDIRS) - -$(OBJECTDIR)/%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ - -$(OBJECTDIR)/%.d: %.c - @set -e; rm -f $@; \ - $(CCDEP) -MM $(CCDEPCFLAGS) $< > $@.$$$$; \ - sed 's,\($*\)\.o[ :]*,$(OBJECTDIR)/\1.o $@ : ,g' < $@.$$$$ > $@; \ - rm -f $@.$$$$ - -UIP_SOURCES=uip.c uip_arp.c uiplib.c psock.c timer.c uip-neighbor.c - - -ifneq ($(MAKECMDGOALS),clean) --include $(addprefix $(OBJECTDIR)/,$(UIP_SOURCES:.c=.d) \ - $(APP_SOURCES:.c=.d)) -endif - -uip.a: ${addprefix $(OBJECTDIR)/, $(UIP_SOURCES:.c=.o)} - $(AR) rcf $@ $^ - -apps.a: ${addprefix $(OBJECTDIR)/, $(APP_SOURCES:.c=.o)} - $(AR) rcf $@ $^ diff --git a/bundles/uip/uip/clock.h b/bundles/uip/uip/clock.h deleted file mode 100644 index f34d78fd..00000000 --- a/bundles/uip/uip/clock.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - * \defgroup clock Clock interface - * - * The clock interface is the interface between the \ref timer "timer library" - * and the platform specific clock functionality. The clock - * interface must be implemented for each platform that uses the \ref - * timer "timer library". - * - * The clock interface does only one this: it measures time. The clock - * interface provides a macro, CLOCK_SECOND, which corresponds to one - * second of system time. - * - * \sa \ref timer "Timer library" - * - * @{ - */ - -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: clock.h,v 1.3 2006/06/11 21:46:39 adam Exp $ - */ -#ifndef __CLOCK_H__ -#define __CLOCK_H__ - -#include "clock-arch.h" - -/** - * Initialize the clock library. - * - * This function initializes the clock library and should be called - * from the main() function of the system. - * - */ -void clock_init(void); - -/** - * Get the current clock time. - * - * This function returns the current system clock time. - * - * \return The current clock time, measured in system ticks. - */ -clock_time_t clock_time(void); - -/** - * A second, measured in system clock time. - * - * \hideinitializer - */ -#ifdef CLOCK_CONF_SECOND -#define CLOCK_SECOND CLOCK_CONF_SECOND -#else -#define CLOCK_SECOND (clock_time_t)32 -#endif - -#endif /* __CLOCK_H__ */ - -/** @} */ diff --git a/bundles/uip/uip/lc-addrlabels.h b/bundles/uip/uip/lc-addrlabels.h deleted file mode 100644 index fe1387e5..00000000 --- a/bundles/uip/uip/lc-addrlabels.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2004-2005, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: lc-addrlabels.h,v 1.3 2006/06/12 08:00:30 adam Exp $ - */ - -/** - * \addtogroup lc - * @{ - */ - -/** - * \file - * Implementation of local continuations based on the "Labels as - * values" feature of gcc - * \author - * Adam Dunkels - * - * This implementation of local continuations is based on a special - * feature of the GCC C compiler called "labels as values". This - * feature allows assigning pointers with the address of the code - * corresponding to a particular C label. - * - * For more information, see the GCC documentation: - * http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html - * - * Thanks to dividuum for finding the nice local scope label - * implementation. - */ - -#ifndef __LC_ADDRLABELS_H__ -#define __LC_ADDRLABELS_H__ - -/** \hideinitializer */ -typedef void * lc_t; - -#define LC_INIT(s) s = NULL - - -#define LC_RESUME(s) \ - do { \ - if(s != NULL) { \ - goto *s; \ - } \ - } while(0) - -#define LC_SET(s) \ - do { ({ __label__ resume; resume: (s) = &&resume; }); }while(0) - -#define LC_END(s) - -#endif /* __LC_ADDRLABELS_H__ */ - -/** @} */ diff --git a/bundles/uip/uip/lc-switch.h b/bundles/uip/uip/lc-switch.h deleted file mode 100644 index f32885fd..00000000 --- a/bundles/uip/uip/lc-switch.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004-2005, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: lc-switch.h,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ - -/** - * \addtogroup lc - * @{ - */ - -/** - * \file - * Implementation of local continuations based on switch() statment - * \author Adam Dunkels - * - * This implementation of local continuations uses the C switch() - * statement to resume execution of a function somewhere inside the - * function's body. The implementation is based on the fact that - * switch() statements are able to jump directly into the bodies of - * control structures such as if() or while() statmenets. - * - * This implementation borrows heavily from Simon Tatham's coroutines - * implementation in C: - * http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html - */ - -#ifndef __LC_SWITCH_H__ -#define __LC_SWTICH_H__ - -/* WARNING! lc implementation using switch() does not work if an - LC_SET() is done within another switch() statement! */ - -/** \hideinitializer */ -typedef unsigned short lc_t; - -#define LC_INIT(s) s = 0; - -#define LC_RESUME(s) switch(s) { case 0: - -#define LC_SET(s) s = __LINE__; case __LINE__: - -#define LC_END(s) } - -#endif /* __LC_SWITCH_H__ */ - -/** @} */ diff --git a/bundles/uip/uip/lc.h b/bundles/uip/uip/lc.h deleted file mode 100644 index a9e9d469..00000000 --- a/bundles/uip/uip/lc.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2004-2005, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: lc.h,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ - -/** - * \addtogroup pt - * @{ - */ - -/** - * \defgroup lc Local continuations - * @{ - * - * Local continuations form the basis for implementing protothreads. A - * local continuation can be set in a specific function to - * capture the state of the function. After a local continuation has - * been set can be resumed in order to restore the state of the - * function at the point where the local continuation was set. - * - * - */ - -/** - * \file lc.h - * Local continuations - * \author - * Adam Dunkels - * - */ - -#ifdef DOXYGEN -/** - * Initialize a local continuation. - * - * This operation initializes the local continuation, thereby - * unsetting any previously set continuation state. - * - * \hideinitializer - */ -#define LC_INIT(lc) - -/** - * Set a local continuation. - * - * The set operation saves the state of the function at the point - * where the operation is executed. As far as the set operation is - * concerned, the state of the function does not include the - * call-stack or local (automatic) variables, but only the program - * counter and such CPU registers that needs to be saved. - * - * \hideinitializer - */ -#define LC_SET(lc) - -/** - * Resume a local continuation. - * - * The resume operation resumes a previously set local continuation, thus - * restoring the state in which the function was when the local - * continuation was set. If the local continuation has not been - * previously set, the resume operation does nothing. - * - * \hideinitializer - */ -#define LC_RESUME(lc) - -/** - * Mark the end of local continuation usage. - * - * The end operation signifies that local continuations should not be - * used any more in the function. This operation is not needed for - * most implementations of local continuation, but is required by a - * few implementations. - * - * \hideinitializer - */ -#define LC_END(lc) - -/** - * \var typedef lc_t; - * - * The local continuation type. - * - * \hideinitializer - */ -#endif /* DOXYGEN */ - -#ifndef __LC_H__ -#define __LC_H__ - -#ifdef LC_CONF_INCLUDE -#include LC_CONF_INCLUDE -#else -#include "lc-switch.h" -#endif /* LC_CONF_INCLUDE */ - -#endif /* __LC_H__ */ - -/** @} */ -/** @} */ diff --git a/bundles/uip/uip/psock.c b/bundles/uip/uip/psock.c deleted file mode 100644 index f284cb90..00000000 --- a/bundles/uip/uip/psock.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: psock.c,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ - -#include -#include - -#include "uipopt.h" -#include "psock.h" -#include "uip.h" - -#define STATE_NONE 0 -#define STATE_ACKED 1 -#define STATE_READ 2 -#define STATE_BLOCKED_NEWDATA 3 -#define STATE_BLOCKED_CLOSE 4 -#define STATE_BLOCKED_SEND 5 -#define STATE_DATA_SENT 6 - -/* - * Return value of the buffering functions that indicates that a - * buffer was not filled by incoming data. - * - */ -#define BUF_NOT_FULL 0 -#define BUF_NOT_FOUND 0 - -/* - * Return value of the buffering functions that indicates that a - * buffer was completely filled by incoming data. - * - */ -#define BUF_FULL 1 - -/* - * Return value of the buffering functions that indicates that an - * end-marker byte was found. - * - */ -#define BUF_FOUND 2 - -/*---------------------------------------------------------------------------*/ -static void -buf_setup(struct psock_buf *buf, - u8_t *bufptr, u16_t bufsize) -{ - buf->ptr = bufptr; - buf->left = bufsize; -} -/*---------------------------------------------------------------------------*/ -static u8_t -buf_bufdata(struct psock_buf *buf, u16_t len, - u8_t **dataptr, u16_t *datalen) -{ - if(*datalen < buf->left) { - memcpy(buf->ptr, *dataptr, *datalen); - buf->ptr += *datalen; - buf->left -= *datalen; - *dataptr += *datalen; - *datalen = 0; - return BUF_NOT_FULL; - } else if(*datalen == buf->left) { - memcpy(buf->ptr, *dataptr, *datalen); - buf->ptr += *datalen; - buf->left = 0; - *dataptr += *datalen; - *datalen = 0; - return BUF_FULL; - } else { - memcpy(buf->ptr, *dataptr, buf->left); - buf->ptr += buf->left; - *datalen -= buf->left; - *dataptr += buf->left; - buf->left = 0; - return BUF_FULL; - } -} -/*---------------------------------------------------------------------------*/ -static u8_t -buf_bufto(register struct psock_buf *buf, u8_t endmarker, - register u8_t **dataptr, register u16_t *datalen) -{ - u8_t c; - while(buf->left > 0 && *datalen > 0) { - c = *buf->ptr = **dataptr; - ++*dataptr; - ++buf->ptr; - --*datalen; - --buf->left; - - if(c == endmarker) { - return BUF_FOUND; - } - } - - if(*datalen == 0) { - return BUF_NOT_FOUND; - } - - while(*datalen > 0) { - c = **dataptr; - --*datalen; - ++*dataptr; - - if(c == endmarker) { - return BUF_FOUND | BUF_FULL; - } - } - - return BUF_FULL; -} -/*---------------------------------------------------------------------------*/ -static char -send_data(register struct psock *s) -{ - if(s->state != STATE_DATA_SENT || uip_rexmit()) { - if(s->sendlen > uip_mss()) { - uip_send(s->sendptr, uip_mss()); - } else { - uip_send(s->sendptr, s->sendlen); - } - s->state = STATE_DATA_SENT; - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static char -data_acked(register struct psock *s) -{ - if(s->state == STATE_DATA_SENT && uip_acked()) { - if(s->sendlen > uip_mss()) { - s->sendlen -= uip_mss(); - s->sendptr += uip_mss(); - } else { - s->sendptr += s->sendlen; - s->sendlen = 0; - } - s->state = STATE_ACKED; - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(psock_send(register struct psock *s, const char *buf, - unsigned int len)) -{ - PT_BEGIN(&s->psockpt); - - /* If there is no data to send, we exit immediately. */ - if(len == 0) { - PT_EXIT(&s->psockpt); - } - - /* Save the length of and a pointer to the data that is to be - sent. */ - s->sendptr = buf; - s->sendlen = len; - - s->state = STATE_NONE; - - /* We loop here until all data is sent. The s->sendlen variable is - updated by the data_sent() function. */ - while(s->sendlen > 0) { - - /* - * The condition for this PT_WAIT_UNTIL is a little tricky: the - * protothread will wait here until all data has been acknowledged - * (data_acked() returns true) and until all data has been sent - * (send_data() returns true). The two functions data_acked() and - * send_data() must be called in succession to ensure that all - * data is sent. Therefore the & operator is used instead of the - * && operator, which would cause only the data_acked() function - * to be called when it returns false. - */ - PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s)); - } - - s->state = STATE_NONE; - - PT_END(&s->psockpt); -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(psock_generator_send(register struct psock *s, - unsigned short (*generate)(void *), void *arg)) -{ - PT_BEGIN(&s->psockpt); - - /* Ensure that there is a generator function to call. */ - if(generate == NULL) { - PT_EXIT(&s->psockpt); - } - - /* Call the generator function to generate the data in the - uip_appdata buffer. */ - s->sendlen = generate(arg); - s->sendptr = uip_appdata; - - s->state = STATE_NONE; - do { - /* Call the generator function again if we are called to perform a - retransmission. */ - if(uip_rexmit()) { - generate(arg); - } - /* Wait until all data is sent and acknowledged. */ - PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s)); - } while(s->sendlen > 0); - - s->state = STATE_NONE; - - PT_END(&s->psockpt); -} -/*---------------------------------------------------------------------------*/ -u16_t -psock_datalen(struct psock *psock) -{ - return psock->bufsize - psock->buf.left; -} -/*---------------------------------------------------------------------------*/ -char -psock_newdata(struct psock *s) -{ - if(s->readlen > 0) { - /* There is data in the uip_appdata buffer that has not yet been - read with the PSOCK_READ functions. */ - return 1; - } else if(s->state == STATE_READ) { - /* All data in uip_appdata buffer already consumed. */ - s->state = STATE_BLOCKED_NEWDATA; - return 0; - } else if(uip_newdata()) { - /* There is new data that has not been consumed. */ - return 1; - } else { - /* There is no new data. */ - return 0; - } -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(psock_readto(register struct psock *psock, unsigned char c)) -{ - PT_BEGIN(&psock->psockpt); - - buf_setup(&psock->buf, psock->bufptr, psock->bufsize); - - /* XXX: Should add buf_checkmarker() before do{} loop, if - incoming data has been handled while waiting for a write. */ - - do { - if(psock->readlen == 0) { - PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); - psock->state = STATE_READ; - psock->readptr = (u8_t *)uip_appdata; - psock->readlen = uip_datalen(); - } - } while((buf_bufto(&psock->buf, c, - &psock->readptr, - &psock->readlen) & BUF_FOUND) == 0); - - if(psock_datalen(psock) == 0) { - psock->state = STATE_NONE; - PT_RESTART(&psock->psockpt); - } - PT_END(&psock->psockpt); -} -/*---------------------------------------------------------------------------*/ -PT_THREAD(psock_readbuf(register struct psock *psock)) -{ - PT_BEGIN(&psock->psockpt); - - buf_setup(&psock->buf, psock->bufptr, psock->bufsize); - - /* XXX: Should add buf_checkmarker() before do{} loop, if - incoming data has been handled while waiting for a write. */ - - do { - if(psock->readlen == 0) { - PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); - printf("Waited for newdata\n"); - psock->state = STATE_READ; - psock->readptr = (u8_t *)uip_appdata; - psock->readlen = uip_datalen(); - } - } while(buf_bufdata(&psock->buf, psock->bufsize, - &psock->readptr, - &psock->readlen) != BUF_FULL); - - if(psock_datalen(psock) == 0) { - psock->state = STATE_NONE; - PT_RESTART(&psock->psockpt); - } - PT_END(&psock->psockpt); -} -/*---------------------------------------------------------------------------*/ -void -psock_init(register struct psock *psock, char *buffer, unsigned int buffersize) -{ - psock->state = STATE_NONE; - psock->readlen = 0; - psock->bufptr = buffer; - psock->bufsize = buffersize; - buf_setup(&psock->buf, buffer, buffersize); - PT_INIT(&psock->pt); - PT_INIT(&psock->psockpt); -} -/*---------------------------------------------------------------------------*/ diff --git a/bundles/uip/uip/psock.h b/bundles/uip/uip/psock.h deleted file mode 100644 index 3dffa735..00000000 --- a/bundles/uip/uip/psock.h +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: psock.h,v 1.3 2006/06/12 08:00:30 adam Exp $ - */ - -/** - * \defgroup psock Protosockets library - * @{ - * - * The protosocket library provides an interface to the uIP stack that is - * similar to the traditional BSD socket interface. Unlike programs - * written for the ordinary uIP event-driven interface, programs - * written with the protosocket library are executed in a sequential - * fashion and does not have to be implemented as explicit state - * machines. - * - * Protosockets only work with TCP connections. - * - * The protosocket library uses \ref pt protothreads to provide - * sequential control flow. This makes the protosockets lightweight in - * terms of memory, but also means that protosockets inherits the - * functional limitations of protothreads. Each protosocket lives only - * within a single function. Automatic variables (stack variables) are - * not retained across a protosocket library function call. - * - * \note Because the protosocket library uses protothreads, local - * variables will not always be saved across a call to a protosocket - * library function. It is therefore advised that local variables are - * used with extreme care. - * - * The protosocket library provides functions for sending data without - * having to deal with retransmissions and acknowledgements, as well - * as functions for reading data without having to deal with data - * being split across more than one TCP segment. - * - * Because each protosocket runs as a protothread, the protosocket has to be - * started with a call to PSOCK_BEGIN() at the start of the function - * in which the protosocket is used. Similarly, the protosocket protothread can - * be terminated by a call to PSOCK_EXIT(). - * - */ - -/** - * \file - * Protosocket library header file - * \author - * Adam Dunkels - * - */ - -#ifndef __PSOCK_H__ -#define __PSOCK_H__ - -#include "uipopt.h" -#include "pt.h" - - /* - * The structure that holds the state of a buffer. - * - * This structure holds the state of a uIP buffer. The structure has - * no user-visible elements, but is used through the functions - * provided by the library. - * - */ -struct psock_buf { - u8_t *ptr; - unsigned short left; -}; - -/** - * The representation of a protosocket. - * - * The protosocket structrure is an opaque structure with no user-visible - * elements. - */ -struct psock { - struct pt pt, psockpt; /* Protothreads - one that's using the psock - functions, and one that runs inside the - psock functions. */ - const u8_t *sendptr; /* Pointer to the next data to be sent. */ - u8_t *readptr; /* Pointer to the next data to be read. */ - - char *bufptr; /* Pointer to the buffer used for buffering - incoming data. */ - - u16_t sendlen; /* The number of bytes left to be sent. */ - u16_t readlen; /* The number of bytes left to be read. */ - - struct psock_buf buf; /* The structure holding the state of the - input buffer. */ - unsigned int bufsize; /* The size of the input buffer. */ - - unsigned char state; /* The state of the protosocket. */ -}; - -void psock_init(struct psock *psock, char *buffer, unsigned int buffersize); -/** - * Initialize a protosocket. - * - * This macro initializes a protosocket and must be called before the - * protosocket is used. The initialization also specifies the input buffer - * for the protosocket. - * - * \param psock (struct psock *) A pointer to the protosocket to be - * initialized - * - * \param buffer (char *) A pointer to the input buffer for the - * protosocket. - * - * \param buffersize (unsigned int) The size of the input buffer. - * - * \hideinitializer - */ -#define PSOCK_INIT(psock, buffer, buffersize) \ - psock_init(psock, buffer, buffersize) - -/** - * Start the protosocket protothread in a function. - * - * This macro starts the protothread associated with the protosocket and - * must come before other protosocket calls in the function it is used. - * - * \param psock (struct psock *) A pointer to the protosocket to be - * started. - * - * \hideinitializer - */ -#define PSOCK_BEGIN(psock) PT_BEGIN(&((psock)->pt)) - -PT_THREAD(psock_send(struct psock *psock, const char *buf, unsigned int len)); -/** - * Send data. - * - * This macro sends data over a protosocket. The protosocket protothread blocks - * until all data has been sent and is known to have been received by - * the remote end of the TCP connection. - * - * \param psock (struct psock *) A pointer to the protosocket over which - * data is to be sent. - * - * \param data (char *) A pointer to the data that is to be sent. - * - * \param datalen (unsigned int) The length of the data that is to be - * sent. - * - * \hideinitializer - */ -#define PSOCK_SEND(psock, data, datalen) \ - PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, data, datalen)) - -/** - * \brief Send a null-terminated string. - * \param psock Pointer to the protosocket. - * \param str The string to be sent. - * - * This function sends a null-terminated string over the - * protosocket. - * - * \hideinitializer - */ -#define PSOCK_SEND_STR(psock, str) \ - PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, str, strlen(str))) - -PT_THREAD(psock_generator_send(struct psock *psock, - unsigned short (*f)(void *), void *arg)); - -/** - * \brief Generate data with a function and send it - * \param psock Pointer to the protosocket. - * \param generator Pointer to the generator function - * \param arg Argument to the generator function - * - * This function generates data and sends it over the - * protosocket. This can be used to dynamically generate - * data for a transmission, instead of generating the data - * in a buffer beforehand. This function reduces the need for - * buffer memory. The generator function is implemented by - * the application, and a pointer to the function is given - * as an argument with the call to PSOCK_GENERATOR_SEND(). - * - * The generator function should place the generated data - * directly in the uip_appdata buffer, and return the - * length of the generated data. The generator function is - * called by the protosocket layer when the data first is - * sent, and once for every retransmission that is needed. - * - * \hideinitializer - */ -#define PSOCK_GENERATOR_SEND(psock, generator, arg) \ - PT_WAIT_THREAD(&((psock)->pt), \ - psock_generator_send(psock, generator, arg)) - - -/** - * Close a protosocket. - * - * This macro closes a protosocket and can only be called from within the - * protothread in which the protosocket lives. - * - * \param psock (struct psock *) A pointer to the protosocket that is to - * be closed. - * - * \hideinitializer - */ -#define PSOCK_CLOSE(psock) uip_close() - -PT_THREAD(psock_readbuf(struct psock *psock)); -/** - * Read data until the buffer is full. - * - * This macro will block waiting for data and read the data into the - * input buffer specified with the call to PSOCK_INIT(). Data is read - * until the buffer is full.. - * - * \param psock (struct psock *) A pointer to the protosocket from which - * data should be read. - * - * \hideinitializer - */ -#define PSOCK_READBUF(psock) \ - PT_WAIT_THREAD(&((psock)->pt), psock_readbuf(psock)) - -PT_THREAD(psock_readto(struct psock *psock, unsigned char c)); -/** - * Read data up to a specified character. - * - * This macro will block waiting for data and read the data into the - * input buffer specified with the call to PSOCK_INIT(). Data is only - * read until the specifieed character appears in the data stream. - * - * \param psock (struct psock *) A pointer to the protosocket from which - * data should be read. - * - * \param c (char) The character at which to stop reading. - * - * \hideinitializer - */ -#define PSOCK_READTO(psock, c) \ - PT_WAIT_THREAD(&((psock)->pt), psock_readto(psock, c)) - -/** - * The length of the data that was previously read. - * - * This macro returns the length of the data that was previously read - * using PSOCK_READTO() or PSOCK_READ(). - * - * \param psock (struct psock *) A pointer to the protosocket holding the data. - * - * \hideinitializer - */ -#define PSOCK_DATALEN(psock) psock_datalen(psock) - -u16_t psock_datalen(struct psock *psock); - -/** - * Exit the protosocket's protothread. - * - * This macro terminates the protothread of the protosocket and should - * almost always be used in conjunction with PSOCK_CLOSE(). - * - * \sa PSOCK_CLOSE_EXIT() - * - * \param psock (struct psock *) A pointer to the protosocket. - * - * \hideinitializer - */ -#define PSOCK_EXIT(psock) PT_EXIT(&((psock)->pt)) - -/** - * Close a protosocket and exit the protosocket's protothread. - * - * This macro closes a protosocket and exits the protosocket's protothread. - * - * \param psock (struct psock *) A pointer to the protosocket. - * - * \hideinitializer - */ -#define PSOCK_CLOSE_EXIT(psock) \ - do { \ - PSOCK_CLOSE(psock); \ - PSOCK_EXIT(psock); \ - } while(0) - -/** - * Declare the end of a protosocket's protothread. - * - * This macro is used for declaring that the protosocket's protothread - * ends. It must always be used together with a matching PSOCK_BEGIN() - * macro. - * - * \param psock (struct psock *) A pointer to the protosocket. - * - * \hideinitializer - */ -#define PSOCK_END(psock) PT_END(&((psock)->pt)) - -char psock_newdata(struct psock *s); - -/** - * Check if new data has arrived on a protosocket. - * - * This macro is used in conjunction with the PSOCK_WAIT_UNTIL() - * macro to check if data has arrived on a protosocket. - * - * \param psock (struct psock *) A pointer to the protosocket. - * - * \hideinitializer - */ -#define PSOCK_NEWDATA(psock) psock_newdata(psock) - -/** - * Wait until a condition is true. - * - * This macro blocks the protothread until the specified condition is - * true. The macro PSOCK_NEWDATA() can be used to check if new data - * arrives when the protosocket is waiting. - * - * Typically, this macro is used as follows: - * - \code - PT_THREAD(thread(struct psock *s, struct timer *t)) - { - PSOCK_BEGIN(s); - - PSOCK_WAIT_UNTIL(s, PSOCK_NEWADATA(s) || timer_expired(t)); - - if(PSOCK_NEWDATA(s)) { - PSOCK_READTO(s, '\n'); - } else { - handle_timed_out(s); - } - - PSOCK_END(s); - } - \endcode - * - * \param psock (struct psock *) A pointer to the protosocket. - * \param condition The condition to wait for. - * - * \hideinitializer - */ -#define PSOCK_WAIT_UNTIL(psock, condition) \ - PT_WAIT_UNTIL(&((psock)->pt), (condition)); - -#define PSOCK_WAIT_THREAD(psock, condition) \ - PT_WAIT_THREAD(&((psock)->pt), (condition)) - -#endif /* __PSOCK_H__ */ - -/** @} */ diff --git a/bundles/uip/uip/pt.h b/bundles/uip/uip/pt.h deleted file mode 100644 index 9f1f64da..00000000 --- a/bundles/uip/uip/pt.h +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 2004-2005, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: pt.h,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ - -/** - * \addtogroup pt - * @{ - */ - -/** - * \file - * Protothreads implementation. - * \author - * Adam Dunkels - * - */ - -#ifndef __PT_H__ -#define __PT_H__ - -#include "lc.h" - -struct pt { - lc_t lc; -}; - -#define PT_WAITING 0 -#define PT_EXITED 1 -#define PT_ENDED 2 -#define PT_YIELDED 3 - -/** - * \name Initialization - * @{ - */ - -/** - * Initialize a protothread. - * - * Initializes a protothread. Initialization must be done prior to - * starting to execute the protothread. - * - * \param pt A pointer to the protothread control structure. - * - * \sa PT_SPAWN() - * - * \hideinitializer - */ -#define PT_INIT(pt) LC_INIT((pt)->lc) - -/** @} */ - -/** - * \name Declaration and definition - * @{ - */ - -/** - * Declaration of a protothread. - * - * This macro is used to declare a protothread. All protothreads must - * be declared with this macro. - * - * \param name_args The name and arguments of the C function - * implementing the protothread. - * - * \hideinitializer - */ -#define PT_THREAD(name_args) char name_args - -/** - * Declare the start of a protothread inside the C function - * implementing the protothread. - * - * This macro is used to declare the starting point of a - * protothread. It should be placed at the start of the function in - * which the protothread runs. All C statements above the PT_BEGIN() - * invokation will be executed each time the protothread is scheduled. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_BEGIN(pt) { char PT_YIELD_FLAG = 1; LC_RESUME((pt)->lc) - -/** - * Declare the end of a protothread. - * - * This macro is used for declaring that a protothread ends. It must - * always be used together with a matching PT_BEGIN() macro. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_END(pt) LC_END((pt)->lc); PT_YIELD_FLAG = 0; \ - PT_INIT(pt); return PT_ENDED; } - -/** @} */ - -/** - * \name Blocked wait - * @{ - */ - -/** - * Block and wait until condition is true. - * - * This macro blocks the protothread until the specified condition is - * true. - * - * \param pt A pointer to the protothread control structure. - * \param condition The condition. - * - * \hideinitializer - */ -#define PT_WAIT_UNTIL(pt, condition) \ - do { \ - LC_SET((pt)->lc); \ - if(!(condition)) { \ - return PT_WAITING; \ - } \ - } while(0) - -/** - * Block and wait while condition is true. - * - * This function blocks and waits while condition is true. See - * PT_WAIT_UNTIL(). - * - * \param pt A pointer to the protothread control structure. - * \param cond The condition. - * - * \hideinitializer - */ -#define PT_WAIT_WHILE(pt, cond) PT_WAIT_UNTIL((pt), !(cond)) - -/** @} */ - -/** - * \name Hierarchical protothreads - * @{ - */ - -/** - * Block and wait until a child protothread completes. - * - * This macro schedules a child protothread. The current protothread - * will block until the child protothread completes. - * - * \note The child protothread must be manually initialized with the - * PT_INIT() function before this function is used. - * - * \param pt A pointer to the protothread control structure. - * \param thread The child protothread with arguments - * - * \sa PT_SPAWN() - * - * \hideinitializer - */ -#define PT_WAIT_THREAD(pt, thread) PT_WAIT_WHILE((pt), PT_SCHEDULE(thread)) - -/** - * Spawn a child protothread and wait until it exits. - * - * This macro spawns a child protothread and waits until it exits. The - * macro can only be used within a protothread. - * - * \param pt A pointer to the protothread control structure. - * \param child A pointer to the child protothread's control structure. - * \param thread The child protothread with arguments - * - * \hideinitializer - */ -#define PT_SPAWN(pt, child, thread) \ - do { \ - PT_INIT((child)); \ - PT_WAIT_THREAD((pt), (thread)); \ - } while(0) - -/** @} */ - -/** - * \name Exiting and restarting - * @{ - */ - -/** - * Restart the protothread. - * - * This macro will block and cause the running protothread to restart - * its execution at the place of the PT_BEGIN() call. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_RESTART(pt) \ - do { \ - PT_INIT(pt); \ - return PT_WAITING; \ - } while(0) - -/** - * Exit the protothread. - * - * This macro causes the protothread to exit. If the protothread was - * spawned by another protothread, the parent protothread will become - * unblocked and can continue to run. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_EXIT(pt) \ - do { \ - PT_INIT(pt); \ - return PT_EXITED; \ - } while(0) - -/** @} */ - -/** - * \name Calling a protothread - * @{ - */ - -/** - * Schedule a protothread. - * - * This function shedules a protothread. The return value of the - * function is non-zero if the protothread is running or zero if the - * protothread has exited. - * - * \param f The call to the C function implementing the protothread to - * be scheduled - * - * \hideinitializer - */ -#define PT_SCHEDULE(f) ((f) == PT_WAITING) - -/** @} */ - -/** - * \name Yielding from a protothread - * @{ - */ - -/** - * Yield from the current protothread. - * - * This function will yield the protothread, thereby allowing other - * processing to take place in the system. - * - * \param pt A pointer to the protothread control structure. - * - * \hideinitializer - */ -#define PT_YIELD(pt) \ - do { \ - PT_YIELD_FLAG = 0; \ - LC_SET((pt)->lc); \ - if(PT_YIELD_FLAG == 0) { \ - return PT_YIELDED; \ - } \ - } while(0) - -/** - * \brief Yield from the protothread until a condition occurs. - * \param pt A pointer to the protothread control structure. - * \param cond The condition. - * - * This function will yield the protothread, until the - * specified condition evaluates to true. - * - * - * \hideinitializer - */ -#define PT_YIELD_UNTIL(pt, cond) \ - do { \ - PT_YIELD_FLAG = 0; \ - LC_SET((pt)->lc); \ - if((PT_YIELD_FLAG == 0) || !(cond)) { \ - return PT_YIELDED; \ - } \ - } while(0) - -/** @} */ - -#endif /* __PT_H__ */ - -/** @} */ diff --git a/bundles/uip/uip/timer.c b/bundles/uip/uip/timer.c deleted file mode 100644 index 74eedf61..00000000 --- a/bundles/uip/uip/timer.c +++ /dev/null @@ -1,127 +0,0 @@ -/** - * \addtogroup timer - * @{ - */ - -/** - * \file - * Timer library implementation. - * \author - * Adam Dunkels - */ - -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: timer.c,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ - -#include "clock.h" -#include "timer.h" - -/*---------------------------------------------------------------------------*/ -/** - * Set a timer. - * - * This function is used to set a timer for a time sometime in the - * future. The function timer_expired() will evaluate to true after - * the timer has expired. - * - * \param t A pointer to the timer - * \param interval The interval before the timer expires. - * - */ -void -timer_set(struct timer *t, clock_time_t interval) -{ - t->interval = interval; - t->start = clock_time(); -} -/*---------------------------------------------------------------------------*/ -/** - * Reset the timer with the same interval. - * - * This function resets the timer with the same interval that was - * given to the timer_set() function. The start point of the interval - * is the exact time that the timer last expired. Therefore, this - * function will cause the timer to be stable over time, unlike the - * timer_rester() function. - * - * \param t A pointer to the timer. - * - * \sa timer_restart() - */ -void -timer_reset(struct timer *t) -{ - t->start += t->interval; -} -/*---------------------------------------------------------------------------*/ -/** - * Restart the timer from the current point in time - * - * This function restarts a timer with the same interval that was - * given to the timer_set() function. The timer will start at the - * current time. - * - * \note A periodic timer will drift if this function is used to reset - * it. For preioric timers, use the timer_reset() function instead. - * - * \param t A pointer to the timer. - * - * \sa timer_reset() - */ -void -timer_restart(struct timer *t) -{ - t->start = clock_time(); -} -/*---------------------------------------------------------------------------*/ -/** - * Check if a timer has expired. - * - * This function tests if a timer has expired and returns true or - * false depending on its status. - * - * \param t A pointer to the timer - * - * \return Non-zero if the timer has expired, zero otherwise. - * - */ -int -timer_expired(struct timer *t) -{ - return (clock_time_t)(clock_time() - t->start) >= (clock_time_t)t->interval; -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/bundles/uip/uip/timer.h b/bundles/uip/uip/timer.h deleted file mode 100644 index 057bea49..00000000 --- a/bundles/uip/uip/timer.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * \defgroup timer Timer library - * - * The timer library provides functions for setting, resetting and - * restarting timers, and for checking if a timer has expired. An - * application must "manually" check if its timers have expired; this - * is not done automatically. - * - * A timer is declared as a \c struct \c timer and all access to the - * timer is made by a pointer to the declared timer. - * - * \note The timer library uses the \ref clock "Clock library" to - * measure time. Intervals should be specified in the format used by - * the clock library. - * - * @{ - */ - - -/** - * \file - * Timer library header file. - * \author - * Adam Dunkels - */ - -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: timer.h,v 1.3 2006/06/11 21:46:39 adam Exp $ - */ -#ifndef __TIMER_H__ -#define __TIMER_H__ - -#include "clock.h" - -/** - * A timer. - * - * This structure is used for declaring a timer. The timer must be set - * with timer_set() before it can be used. - * - * \hideinitializer - */ -struct timer { - clock_time_t start; - clock_time_t interval; -}; - -void timer_set(struct timer *t, clock_time_t interval); -void timer_reset(struct timer *t); -void timer_restart(struct timer *t); -int timer_expired(struct timer *t); - -#endif /* __TIMER_H__ */ - -/** @} */ diff --git a/bundles/uip/uip/uip-fw.c b/bundles/uip/uip/uip-fw.c deleted file mode 100644 index 01858ea7..00000000 --- a/bundles/uip/uip/uip-fw.c +++ /dev/null @@ -1,532 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: uip-fw.c,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ -/** - * \addtogroup uip - * @{ - */ - -/** - * \defgroup uipfw uIP packet forwarding - * @{ - * - */ - -/** - * \file - * uIP packet forwarding. - * \author Adam Dunkels - * - * This file implements a number of simple functions which do packet - * forwarding over multiple network interfaces with uIP. - * - */ - -#include "uip.h" -#include "uip_arch.h" -#include "uip-fw.h" - -#include /* for memcpy() */ - -/* - * The list of registered network interfaces. - */ -static struct uip_fw_netif *netifs = NULL; - -/* - * A pointer to the default network interface. - */ -static struct uip_fw_netif *defaultnetif = NULL; - -struct tcpip_hdr { - /* IP header. */ - u8_t vhl, - tos; - u16_t len, - ipid, - ipoffset; - u8_t ttl, - proto; - u16_t ipchksum; - u16_t srcipaddr[2], - destipaddr[2]; - - /* TCP header. */ - u16_t srcport, - destport; - u8_t seqno[4], - ackno[4], - tcpoffset, - flags, - wnd[2]; - u16_t tcpchksum; - u8_t urgp[2]; - u8_t optdata[4]; -}; - -struct icmpip_hdr { - /* IP header. */ - u8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - u16_t ipchksum; - u16_t srcipaddr[2], - destipaddr[2]; - /* ICMP (echo) header. */ - u8_t type, icode; - u16_t icmpchksum; - u16_t id, seqno; - u8_t payload[1]; -}; - -/* ICMP ECHO. */ -#define ICMP_ECHO 8 - -/* ICMP TIME-EXCEEDED. */ -#define ICMP_TE 11 - -/* - * Pointer to the TCP/IP headers of the packet in the uip_buf buffer. - */ -#define BUF ((struct tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) - -/* - * Pointer to the ICMP/IP headers of the packet in the uip_buf buffer. - */ -#define ICMPBUF ((struct icmpip_hdr *)&uip_buf[UIP_LLH_LEN]) - -/* - * Certain fields of an IP packet that are used for identifying - * duplicate packets. - */ -struct fwcache_entry { - u16_t timer; - - u16_t srcipaddr[2]; - u16_t destipaddr[2]; - u16_t ipid; - u8_t proto; - u8_t unused; - -#if notdef - u16_t payload[2]; -#endif - -#if UIP_REASSEMBLY > 0 - u16_t len, offset; -#endif -}; - -/* - * The number of packets to remember when looking for duplicates. - */ -#ifdef UIP_CONF_FWCACHE_SIZE -#define FWCACHE_SIZE UIP_CONF_FWCACHE_SIZE -#else -#define FWCACHE_SIZE 2 -#endif - - -/* - * A cache of packet header fields which are used for - * identifying duplicate packets. - */ -static struct fwcache_entry fwcache[FWCACHE_SIZE]; - -/** - * \internal - * The time that a packet cache is active. - */ -#define FW_TIME 20 - -/*------------------------------------------------------------------------------*/ -/** - * Initialize the uIP packet forwarding module. - */ -/*------------------------------------------------------------------------------*/ -void -uip_fw_init(void) -{ - struct uip_fw_netif *t; - defaultnetif = NULL; - while(netifs != NULL) { - t = netifs; - netifs = netifs->next; - t->next = NULL; - } -} -/*------------------------------------------------------------------------------*/ -/** - * \internal - * Check if an IP address is within the network defined by an IP - * address and a netmask. - * - * \param ipaddr The IP address to be checked. - * \param netipaddr The IP address of the network. - * \param netmask The netmask of the network. - * - * \return Non-zero if IP address is in network, zero otherwise. - */ -/*------------------------------------------------------------------------------*/ -static unsigned char -ipaddr_maskcmp(u16_t *ipaddr, u16_t *netipaddr, u16_t *netmask) -{ - return (ipaddr[0] & netmask [0]) == (netipaddr[0] & netmask[0]) && - (ipaddr[1] & netmask[1]) == (netipaddr[1] & netmask[1]); -} -/*------------------------------------------------------------------------------*/ -/** - * \internal - * Send out an ICMP TIME-EXCEEDED message. - * - * This function replaces the packet in the uip_buf buffer with the - * ICMP packet. - */ -/*------------------------------------------------------------------------------*/ -static void -time_exceeded(void) -{ - u16_t tmp16; - - /* We don't send out ICMP errors for ICMP messages. */ - if(ICMPBUF->proto == UIP_PROTO_ICMP) { - uip_len = 0; - return; - } - /* Copy fields from packet header into payload of this ICMP packet. */ - memcpy(&(ICMPBUF->payload[0]), ICMPBUF, 28); - - /* Set the ICMP type and code. */ - ICMPBUF->type = ICMP_TE; - ICMPBUF->icode = 0; - - /* Calculate the ICMP checksum. */ - ICMPBUF->icmpchksum = 0; - ICMPBUF->icmpchksum = ~uip_chksum((u16_t *)&(ICMPBUF->type), 36); - - /* Set the IP destination address to be the source address of the - original packet. */ - tmp16= BUF->destipaddr[0]; - BUF->destipaddr[0] = BUF->srcipaddr[0]; - BUF->srcipaddr[0] = tmp16; - tmp16 = BUF->destipaddr[1]; - BUF->destipaddr[1] = BUF->srcipaddr[1]; - BUF->srcipaddr[1] = tmp16; - - /* Set our IP address as the source address. */ - BUF->srcipaddr[0] = uip_hostaddr[0]; - BUF->srcipaddr[1] = uip_hostaddr[1]; - - /* The size of the ICMP time exceeded packet is 36 + the size of the - IP header (20) = 56. */ - uip_len = 56; - ICMPBUF->len[0] = 0; - ICMPBUF->len[1] = uip_len; - - /* Fill in the other fields in the IP header. */ - ICMPBUF->vhl = 0x45; - ICMPBUF->tos = 0; - ICMPBUF->ipoffset[0] = ICMPBUF->ipoffset[1] = 0; - ICMPBUF->ttl = UIP_TTL; - ICMPBUF->proto = UIP_PROTO_ICMP; - - /* Calculate IP checksum. */ - ICMPBUF->ipchksum = 0; - ICMPBUF->ipchksum = ~(uip_ipchksum()); - - -} -/*------------------------------------------------------------------------------*/ -/** - * \internal - * Register a packet in the forwarding cache so that it won't be - * forwarded again. - */ -/*------------------------------------------------------------------------------*/ -static void -fwcache_register(void) -{ - struct fwcache_entry *fw; - int i, oldest; - - oldest = FW_TIME; - fw = NULL; - - /* Find the oldest entry in the cache. */ - for(i = 0; i < FWCACHE_SIZE; ++i) { - if(fwcache[i].timer == 0) { - fw = &fwcache[i]; - break; - } else if(fwcache[i].timer <= oldest) { - fw = &fwcache[i]; - oldest = fwcache[i].timer; - } - } - - fw->timer = FW_TIME; - fw->ipid = BUF->ipid; - fw->srcipaddr[0] = BUF->srcipaddr[0]; - fw->srcipaddr[1] = BUF->srcipaddr[1]; - fw->destipaddr[0] = BUF->destipaddr[0]; - fw->destipaddr[1] = BUF->destipaddr[1]; - fw->proto = BUF->proto; -#if notdef - fw->payload[0] = BUF->srcport; - fw->payload[1] = BUF->destport; -#endif -#if UIP_REASSEMBLY > 0 - fw->len = BUF->len; - fw->offset = BUF->ipoffset; -#endif -} -/*------------------------------------------------------------------------------*/ -/** - * \internal - * Find a network interface for the IP packet in uip_buf. - */ -/*------------------------------------------------------------------------------*/ -static struct uip_fw_netif * -find_netif(void) -{ - struct uip_fw_netif *netif; - - /* Walk through every network interface to check for a match. */ - for(netif = netifs; netif != NULL; netif = netif->next) { - if(ipaddr_maskcmp(BUF->destipaddr, netif->ipaddr, - netif->netmask)) { - /* If there was a match, we break the loop. */ - return netif; - } - } - - /* If no matching netif was found, we use default netif. */ - return defaultnetif; -} -/*------------------------------------------------------------------------------*/ -/** - * Output an IP packet on the correct network interface. - * - * The IP packet should be present in the uip_buf buffer and its - * length in the global uip_len variable. - * - * \retval UIP_FW_ZEROLEN Indicates that a zero-length packet - * transmission was attempted and that no packet was sent. - * - * \retval UIP_FW_NOROUTE No suitable network interface could be found - * for the outbound packet, and the packet was not sent. - * - * \return The return value from the actual network interface output - * function is passed unmodified as a return value. - */ -/*------------------------------------------------------------------------------*/ -u8_t -uip_fw_output(void) -{ - struct uip_fw_netif *netif; - - if(uip_len == 0) { - return UIP_FW_ZEROLEN; - } - - fwcache_register(); - -#if UIP_BROADCAST - /* Link local broadcasts go out on all interfaces. */ - if(/*BUF->proto == UIP_PROTO_UDP &&*/ - BUF->destipaddr[0] == 0xffff && - BUF->destipaddr[1] == 0xffff) { - if(defaultnetif != NULL) { - defaultnetif->output(); - } - for(netif = netifs; netif != NULL; netif = netif->next) { - netif->output(); - } - return UIP_FW_OK; - } -#endif /* UIP_BROADCAST */ - - netif = find_netif(); - /* printf("uip_fw_output: netif %p ->output %p len %d\n", netif, - netif->output, - uip_len);*/ - - if(netif == NULL) { - return UIP_FW_NOROUTE; - } - /* If we now have found a suitable network interface, we call its - output function to send out the packet. */ - return netif->output(); -} -/*------------------------------------------------------------------------------*/ -/** - * Forward an IP packet in the uip_buf buffer. - * - * - * - * \return UIP_FW_FORWARDED if the packet was forwarded, UIP_FW_LOCAL if - * the packet should be processed locally. - */ -/*------------------------------------------------------------------------------*/ -u8_t -uip_fw_forward(void) -{ - struct fwcache_entry *fw; - - /* First check if the packet is destined for ourselves and return 0 - to indicate that the packet should be processed locally. */ - if(BUF->destipaddr[0] == uip_hostaddr[0] && - BUF->destipaddr[1] == uip_hostaddr[1]) { - return UIP_FW_LOCAL; - } - - /* If we use ping IP address configuration, and our IP address is - not yet configured, we should intercept all ICMP echo packets. */ -#if UIP_PINGADDRCONF - if((uip_hostaddr[0] | uip_hostaddr[1]) == 0 && - BUF->proto == UIP_PROTO_ICMP && - ICMPBUF->type == ICMP_ECHO) { - return UIP_FW_LOCAL; - } -#endif /* UIP_PINGADDRCONF */ - - /* Check if the packet is in the forwarding cache already, and if so - we drop it. */ - - for(fw = fwcache; fw < &fwcache[FWCACHE_SIZE]; ++fw) { - if(fw->timer != 0 && -#if UIP_REASSEMBLY > 0 - fw->len == BUF->len && - fw->offset == BUF->ipoffset && -#endif - fw->ipid == BUF->ipid && - fw->srcipaddr[0] == BUF->srcipaddr[0] && - fw->srcipaddr[1] == BUF->srcipaddr[1] && - fw->destipaddr[0] == BUF->destipaddr[0] && - fw->destipaddr[1] == BUF->destipaddr[1] && -#if notdef - fw->payload[0] == BUF->srcport && - fw->payload[1] == BUF->destport && -#endif - fw->proto == BUF->proto) { - /* Drop packet. */ - return UIP_FW_FORWARDED; - } - } - - /* If the TTL reaches zero we produce an ICMP time exceeded message - in the uip_buf buffer and forward that packet back to the sender - of the packet. */ - if(BUF->ttl <= 1) { - /* No time exceeded for broadcasts and multicasts! */ - if(BUF->destipaddr[0] == 0xffff && BUF->destipaddr[1] == 0xffff) { - return UIP_FW_LOCAL; - } - time_exceeded(); - } - - /* Decrement the TTL (time-to-live) value in the IP header */ - BUF->ttl = BUF->ttl - 1; - - /* Update the IP checksum. */ - if(BUF->ipchksum >= HTONS(0xffff - 0x0100)) { - BUF->ipchksum = BUF->ipchksum + HTONS(0x0100) + 1; - } else { - BUF->ipchksum = BUF->ipchksum + HTONS(0x0100); - } - - if(uip_len > 0) { - uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]; - uip_fw_output(); - } - -#if UIP_BROADCAST - if(BUF->destipaddr[0] == 0xffff && BUF->destipaddr[1] == 0xffff) { - return UIP_FW_LOCAL; - } -#endif /* UIP_BROADCAST */ - - /* Return non-zero to indicate that the packet was forwarded and that no - other processing should be made. */ - return UIP_FW_FORWARDED; -} -/*------------------------------------------------------------------------------*/ -/** - * Register a network interface with the forwarding module. - * - * \param netif A pointer to the network interface that is to be - * registered. - */ -/*------------------------------------------------------------------------------*/ -void -uip_fw_register(struct uip_fw_netif *netif) -{ - netif->next = netifs; - netifs = netif; -} -/*------------------------------------------------------------------------------*/ -/** - * Register a default network interface. - * - * All packets that don't go out on any of the other interfaces will - * be routed to the default interface. - * - * \param netif A pointer to the network interface that is to be - * registered. - */ -/*------------------------------------------------------------------------------*/ -void -uip_fw_default(struct uip_fw_netif *netif) -{ - defaultnetif = netif; -} -/*------------------------------------------------------------------------------*/ -/** - * Perform periodic processing. - */ -/*------------------------------------------------------------------------------*/ -void -uip_fw_periodic(void) -{ - struct fwcache_entry *fw; - for(fw = fwcache; fw < &fwcache[FWCACHE_SIZE]; ++fw) { - if(fw->timer > 0) { - --fw->timer; - } - } -} -/*------------------------------------------------------------------------------*/ diff --git a/bundles/uip/uip/uip-fw.h b/bundles/uip/uip/uip-fw.h deleted file mode 100644 index 90338509..00000000 --- a/bundles/uip/uip/uip-fw.h +++ /dev/null @@ -1,176 +0,0 @@ -/** - * \addtogroup uipfw - * @{ - */ - -/** - * \file - * uIP packet forwarding header file. - * \author Adam Dunkels - */ - -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: uip-fw.h,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ -#ifndef __UIP_FW_H__ -#define __UIP_FW_H__ - -#include "uip.h" - -/** - * Representation of a uIP network interface. - */ -struct uip_fw_netif { - struct uip_fw_netif *next; /**< Pointer to the next interface when - linked in a list. */ - u16_t ipaddr[2]; /**< The IP address of this interface. */ - u16_t netmask[2]; /**< The netmask of the interface. */ - u8_t (* output)(void); - /**< A pointer to the function that - sends a packet. */ -}; - -/** - * Intantiating macro for a uIP network interface. - * - * Example: - \code - struct uip_fw_netif slipnetif = - {UIP_FW_NETIF(192,168,76,1, 255,255,255,0, slip_output)}; - \endcode - * \param ip1,ip2,ip3,ip4 The IP address of the network interface. - * - * \param nm1,nm2,nm3,nm4 The netmask of the network interface. - * - * \param outputfunc A pointer to the output function of the network interface. - * - * \hideinitializer - */ -#define UIP_FW_NETIF(ip1,ip2,ip3,ip4, nm1,nm2,nm3,nm4, outputfunc) \ - NULL, \ - {HTONS((ip1 << 8) | ip2), HTONS((ip3 << 8) | ip4)}, \ - {HTONS((nm1 << 8) | nm2), HTONS((nm3 << 8) | nm4)}, \ - outputfunc - -/** - * Set the IP address of a network interface. - * - * \param netif A pointer to the uip_fw_netif structure for the network interface. - * - * \param addr A pointer to an IP address. - * - * \hideinitializer - */ -#define uip_fw_setipaddr(netif, addr) \ - do { (netif)->ipaddr[0] = ((u16_t *)(addr))[0]; \ - (netif)->ipaddr[1] = ((u16_t *)(addr))[1]; } while(0) -/** - * Set the netmask of a network interface. - * - * \param netif A pointer to the uip_fw_netif structure for the network interface. - * - * \param addr A pointer to an IP address representing the netmask. - * - * \hideinitializer - */ -#define uip_fw_setnetmask(netif, addr) \ - do { (netif)->netmask[0] = ((u16_t *)(addr))[0]; \ - (netif)->netmask[1] = ((u16_t *)(addr))[1]; } while(0) - -void uip_fw_init(void); -u8_t uip_fw_forward(void); -u8_t uip_fw_output(void); -void uip_fw_register(struct uip_fw_netif *netif); -void uip_fw_default(struct uip_fw_netif *netif); -void uip_fw_periodic(void); - - -/** - * A non-error message that indicates that a packet should be - * processed locally. - * - * \hideinitializer - */ -#define UIP_FW_LOCAL 0 - -/** - * A non-error message that indicates that something went OK. - * - * \hideinitializer - */ -#define UIP_FW_OK 0 - -/** - * A non-error message that indicates that a packet was forwarded. - * - * \hideinitializer - */ -#define UIP_FW_FORWARDED 1 - -/** - * A non-error message that indicates that a zero-length packet - * transmission was attempted, and that no packet was sent. - * - * \hideinitializer - */ -#define UIP_FW_ZEROLEN 2 - -/** - * An error message that indicates that a packet that was too large - * for the outbound network interface was detected. - * - * \hideinitializer - */ -#define UIP_FW_TOOLARGE 3 - -/** - * An error message that indicates that no suitable interface could be - * found for an outbound packet. - * - * \hideinitializer - */ -#define UIP_FW_NOROUTE 4 - -/** - * An error message that indicates that a packet that should be - * forwarded or output was dropped. - * - * \hideinitializer - */ -#define UIP_FW_DROPPED 5 - - -#endif /* __UIP_FW_H__ */ - -/** @} */ diff --git a/bundles/uip/uip/uip-neighbor.c b/bundles/uip/uip/uip-neighbor.c deleted file mode 100644 index 739c03e9..00000000 --- a/bundles/uip/uip/uip-neighbor.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * $Id: uip-neighbor.c,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ - -/** - * \file - * Database of link-local neighbors, used by IPv6 code and - * to be used by a future ARP code rewrite. - * \author - * Adam Dunkels - */ - -#include "uip-neighbor.h" - -#include - -#define MAX_TIME 128 - -#ifdef UIP_NEIGHBOR_CONF_ENTRIES -#define ENTRIES UIP_NEIGHBOR_CONF_ENTRIES -#else /* UIP_NEIGHBOR_CONF_ENTRIES */ -#define ENTRIES 8 -#endif /* UIP_NEIGHBOR_CONF_ENTRIES */ - -struct neighbor_entry { - uip_ipaddr_t ipaddr; - struct uip_neighbor_addr addr; - u8_t time; -}; -static struct neighbor_entry entries[ENTRIES]; - -/*---------------------------------------------------------------------------*/ -void -uip_neighbor_init(void) -{ - int i; - - for(i = 0; i < ENTRIES; ++i) { - entries[i].time = MAX_TIME; - } -} -/*---------------------------------------------------------------------------*/ -void -uip_neighbor_periodic(void) -{ - int i; - - for(i = 0; i < ENTRIES; ++i) { - if(entries[i].time < MAX_TIME) { - entries[i].time++; - } - } -} -/*---------------------------------------------------------------------------*/ -void -uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr) -{ - int i, oldest; - u8_t oldest_time; - - printf("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n", - addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3], - addr->addr.addr[4], addr->addr.addr[5]); - - /* Find the first unused entry or the oldest used entry. */ - oldest_time = 0; - oldest = 0; - for(i = 0; i < ENTRIES; ++i) { - if(entries[i].time == MAX_TIME) { - oldest = i; - break; - } - if(uip_ipaddr_cmp(entries[i].ipaddr, addr)) { - oldest = i; - break; - } - if(entries[i].time > oldest_time) { - oldest = i; - oldest_time = entries[i].time; - } - } - - /* Use the oldest or first free entry (either pointed to by the - "oldest" variable). */ - entries[oldest].time = 0; - uip_ipaddr_copy(entries[oldest].ipaddr, ipaddr); - memcpy(&entries[oldest].addr, addr, sizeof(struct uip_neighbor_addr)); -} -/*---------------------------------------------------------------------------*/ -static struct neighbor_entry * -find_entry(uip_ipaddr_t ipaddr) -{ - int i; - - for(i = 0; i < ENTRIES; ++i) { - if(uip_ipaddr_cmp(entries[i].ipaddr, ipaddr)) { - return &entries[i]; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ -void -uip_neighbor_update(uip_ipaddr_t ipaddr) -{ - struct neighbor_entry *e; - - e = find_entry(ipaddr); - if(e != NULL) { - e->time = 0; - } -} -/*---------------------------------------------------------------------------*/ -struct uip_neighbor_addr * -uip_neighbor_lookup(uip_ipaddr_t ipaddr) -{ - struct neighbor_entry *e; - - e = find_entry(ipaddr); - if(e != NULL) { - /* printf("Lookup neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n", - e->addr.addr.addr[0], e->addr.addr.addr[1], e->addr.addr.addr[2], e->addr.addr.addr[3], - e->addr.addr.addr[4], e->addr.addr.addr[5]);*/ - - return &e->addr; - } - return NULL; -} -/*---------------------------------------------------------------------------*/ diff --git a/bundles/uip/uip/uip-neighbor.h b/bundles/uip/uip/uip-neighbor.h deleted file mode 100644 index d3b351c2..00000000 --- a/bundles/uip/uip/uip-neighbor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * $Id: uip-neighbor.h,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ - -/** - * \file - * Header file for database of link-local neighbors, used by - * IPv6 code and to be used by future ARP code. - * \author - * Adam Dunkels - */ - -#ifndef __UIP_NEIGHBOR_H__ -#define __UIP_NEIGHBOR_H__ - -#include "uip.h" - -struct uip_neighbor_addr { -#if UIP_NEIGHBOR_CONF_ADDRTYPE - UIP_NEIGHBOR_CONF_ADDRTYPE addr; -#else - struct uip_eth_addr addr; -#endif -}; - -void uip_neighbor_init(void); -void uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr); -void uip_neighbor_update(uip_ipaddr_t ipaddr); -struct uip_neighbor_addr *uip_neighbor_lookup(uip_ipaddr_t ipaddr); -void uip_neighbor_periodic(void); - -#endif /* __UIP-NEIGHBOR_H__ */ diff --git a/bundles/uip/uip/uip-split.c b/bundles/uip/uip/uip-split.c deleted file mode 100644 index a910ee62..00000000 --- a/bundles/uip/uip/uip-split.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: uip-split.c,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ - -#include - -#include "uip-split.h" -#include "uip.h" -#include "uip-fw.h" -#include "uip_arch.h" - - - -#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) - -/*-----------------------------------------------------------------------------*/ -void -uip_split_output(void) -{ - u16_t tcplen, len1, len2; - - /* We only try to split maximum sized TCP segments. */ - if(BUF->proto == UIP_PROTO_TCP && - uip_len == UIP_BUFSIZE - UIP_LLH_LEN) { - - tcplen = uip_len - UIP_TCPIP_HLEN; - /* Split the segment in two. If the original packet length was - odd, we make the second packet one byte larger. */ - len1 = len2 = tcplen / 2; - if(len1 + len2 < tcplen) { - ++len2; - } - - /* Create the first packet. This is done by altering the length - field of the IP header and updating the checksums. */ - uip_len = len1 + UIP_TCPIP_HLEN; -#if UIP_CONF_IPV6 - /* For IPv6, the IP length field does not include the IPv6 IP header - length. */ - BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); - BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); -#else /* UIP_CONF_IPV6 */ - BUF->len[0] = uip_len >> 8; - BUF->len[1] = uip_len & 0xff; -#endif /* UIP_CONF_IPV6 */ - - /* Recalculate the TCP checksum. */ - BUF->tcpchksum = 0; - BUF->tcpchksum = ~(uip_tcpchksum()); - -#if !UIP_CONF_IPV6 - /* Recalculate the IP checksum. */ - BUF->ipchksum = 0; - BUF->ipchksum = ~(uip_ipchksum()); -#endif /* UIP_CONF_IPV6 */ - - /* Transmit the first packet. */ - /* uip_fw_output();*/ - tcpip_output(); - - /* Now, create the second packet. To do this, it is not enough to - just alter the length field, but we must also update the TCP - sequence number and point the uip_appdata to a new place in - memory. This place is detemined by the length of the first - packet (len1). */ - uip_len = len2 + UIP_TCPIP_HLEN; -#if UIP_CONF_IPV6 - /* For IPv6, the IP length field does not include the IPv6 IP header - length. */ - BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); - BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); -#else /* UIP_CONF_IPV6 */ - BUF->len[0] = uip_len >> 8; - BUF->len[1] = uip_len & 0xff; -#endif /* UIP_CONF_IPV6 */ - - /* uip_appdata += len1;*/ - memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2); - - uip_add32(BUF->seqno, len1); - BUF->seqno[0] = uip_acc32[0]; - BUF->seqno[1] = uip_acc32[1]; - BUF->seqno[2] = uip_acc32[2]; - BUF->seqno[3] = uip_acc32[3]; - - /* Recalculate the TCP checksum. */ - BUF->tcpchksum = 0; - BUF->tcpchksum = ~(uip_tcpchksum()); - -#if !UIP_CONF_IPV6 - /* Recalculate the IP checksum. */ - BUF->ipchksum = 0; - BUF->ipchksum = ~(uip_ipchksum()); -#endif /* UIP_CONF_IPV6 */ - - /* Transmit the second packet. */ - /* uip_fw_output();*/ - tcpip_output(); - } else { - /* uip_fw_output();*/ - tcpip_output(); - } - -} -/*-----------------------------------------------------------------------------*/ diff --git a/bundles/uip/uip/uip-split.h b/bundles/uip/uip/uip-split.h deleted file mode 100644 index c2c1789c..00000000 --- a/bundles/uip/uip/uip-split.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * Author: Adam Dunkels - * - * $Id: uip-split.h,v 1.2 2006/06/12 08:00:30 adam Exp $ - */ -/** - * \addtogroup uip - * @{ - */ - -/** - * \defgroup uipsplit uIP TCP throughput booster hack - * @{ - * - * The basic uIP TCP implementation only allows each TCP connection to - * have a single TCP segment in flight at any given time. Because of - * the delayed ACK algorithm employed by most TCP receivers, uIP's - * limit on the amount of in-flight TCP segments seriously reduces the - * maximum achievable throughput for sending data from uIP. - * - * The uip-split module is a hack which tries to remedy this - * situation. By splitting maximum sized outgoing TCP segments into - * two, the delayed ACK algorithm is not invoked at TCP - * receivers. This improves the throughput when sending data from uIP - * by orders of magnitude. - * - * The uip-split module uses the uip-fw module (uIP IP packet - * forwarding) for sending packets. Therefore, the uip-fw module must - * be set up with the appropriate network interfaces for this module - * to work. - */ - - -/** - * \file - * Module for splitting outbound TCP segments in two to avoid the - * delayed ACK throughput degradation. - * \author - * Adam Dunkels - * - */ - -#ifndef __UIP_SPLIT_H__ -#define __UIP_SPLIT_H__ - -/** - * Handle outgoing packets. - * - * This function inspects an outgoing packet in the uip_buf buffer and - * sends it out using the uip_fw_output() function. If the packet is a - * full-sized TCP segment it will be split into two segments and - * transmitted separately. This function should be called instead of - * the actual device driver output function, or the uip_fw_output() - * function. - * - * The headers of the outgoing packet is assumed to be in the uip_buf - * buffer and the payload is assumed to be wherever uip_appdata - * points. The length of the outgoing packet is assumed to be in the - * uip_len variable. - * - */ -void uip_split_output(void); - -#endif /* __UIP_SPLIT_H__ */ - -/** @} */ -/** @} */ diff --git a/bundles/uip/uip/uip.c b/bundles/uip/uip/uip.c deleted file mode 100644 index ee885143..00000000 --- a/bundles/uip/uip/uip.c +++ /dev/null @@ -1,1897 +0,0 @@ -#define DEBUG_PRINTF(...) /*printf(__VA_ARGS__)*/ - -/** - * \defgroup uip The uIP TCP/IP stack - * @{ - * - * uIP is an implementation of the TCP/IP protocol stack intended for - * small 8-bit and 16-bit microcontrollers. - * - * uIP provides the necessary protocols for Internet communication, - * with a very small code footprint and RAM requirements - the uIP - * code size is on the order of a few kilobytes and RAM usage is on - * the order of a few hundred bytes. - */ - -/** - * \file - * The uIP TCP/IP stack code. - * \author Adam Dunkels - */ - -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: uip.c,v 1.65 2006/06/11 21:46:39 adam Exp $ - * - */ - -/* - * uIP is a small implementation of the IP, UDP and TCP protocols (as - * well as some basic ICMP stuff). The implementation couples the IP, - * UDP, TCP and the application layers very tightly. To keep the size - * of the compiled code down, this code frequently uses the goto - * statement. While it would be possible to break the uip_process() - * function into many smaller functions, this would increase the code - * size because of the overhead of parameter passing and the fact that - * the optimier would not be as efficient. - * - * The principle is that we have a small buffer, called the uip_buf, - * in which the device driver puts an incoming packet. The TCP/IP - * stack parses the headers in the packet, and calls the - * application. If the remote host has sent data to the application, - * this data is present in the uip_buf and the application read the - * data from there. It is up to the application to put this data into - * a byte stream if needed. The application will not be fed with data - * that is out of sequence. - * - * If the application whishes to send data to the peer, it should put - * its data into the uip_buf. The uip_appdata pointer points to the - * first available byte. The TCP/IP stack will calculate the - * checksums, and fill in the necessary header fields and finally send - * the packet back to the peer. -*/ - -#include "uip.h" -#include "uipopt.h" -#include "uip_arch.h" - -#if UIP_CONF_IPV6 -#include "uip-neighbor.h" -#endif /* UIP_CONF_IPV6 */ - -#include - -/*---------------------------------------------------------------------------*/ -/* Variable definitions. */ - - -/* The IP address of this host. If it is defined to be fixed (by - setting UIP_FIXEDADDR to 1 in uipopt.h), the address is set - here. Otherwise, the address */ -#if UIP_FIXEDADDR > 0 -const uip_ipaddr_t uip_hostaddr = - {HTONS((UIP_IPADDR0 << 8) | UIP_IPADDR1), - HTONS((UIP_IPADDR2 << 8) | UIP_IPADDR3)}; -const uip_ipaddr_t uip_draddr = - {HTONS((UIP_DRIPADDR0 << 8) | UIP_DRIPADDR1), - HTONS((UIP_DRIPADDR2 << 8) | UIP_DRIPADDR3)}; -const uip_ipaddr_t uip_netmask = - {HTONS((UIP_NETMASK0 << 8) | UIP_NETMASK1), - HTONS((UIP_NETMASK2 << 8) | UIP_NETMASK3)}; -#else -uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask; -#endif /* UIP_FIXEDADDR */ - -static const uip_ipaddr_t all_ones_addr = -#if UIP_CONF_IPV6 - {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff}; -#else /* UIP_CONF_IPV6 */ - {0xffff,0xffff}; -#endif /* UIP_CONF_IPV6 */ -static const uip_ipaddr_t all_zeroes_addr = -#if UIP_CONF_IPV6 - {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; -#else /* UIP_CONF_IPV6 */ - {0x0000,0x0000}; -#endif /* UIP_CONF_IPV6 */ - - -#if UIP_FIXEDETHADDR -const struct uip_eth_addr uip_ethaddr = {{UIP_ETHADDR0, - UIP_ETHADDR1, - UIP_ETHADDR2, - UIP_ETHADDR3, - UIP_ETHADDR4, - UIP_ETHADDR5}}; -#else -struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}}; -#endif - -#ifndef UIP_CONF_EXTERNAL_BUFFER -u8_t uip_buf[UIP_BUFSIZE + 2]; /* The packet buffer that contains - incoming packets. */ -#endif /* UIP_CONF_EXTERNAL_BUFFER */ - -void *uip_appdata; /* The uip_appdata pointer points to - application data. */ -void *uip_sappdata; /* The uip_appdata pointer points to - the application data which is to - be sent. */ -#if UIP_URGDATA > 0 -void *uip_urgdata; /* The uip_urgdata pointer points to - urgent data (out-of-band data), if - present. */ -u16_t uip_urglen, uip_surglen; -#endif /* UIP_URGDATA > 0 */ - -u16_t uip_len, uip_slen; - /* The uip_len is either 8 or 16 bits, - depending on the maximum packet - size. */ - -u8_t uip_flags; /* The uip_flags variable is used for - communication between the TCP/IP stack - and the application program. */ -struct uip_conn *uip_conn; /* uip_conn always points to the current - connection. */ - -struct uip_conn uip_conns[UIP_CONNS]; - /* The uip_conns array holds all TCP - connections. */ -u16_t uip_listenports[UIP_LISTENPORTS]; - /* The uip_listenports list all currently - listning ports. */ -#if UIP_UDP -struct uip_udp_conn *uip_udp_conn; -struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; -#endif /* UIP_UDP */ - -static u16_t ipid; /* Ths ipid variable is an increasing - number that is used for the IP ID - field. */ - -void uip_setipid(u16_t id) { ipid = id; } - -static u8_t iss[4]; /* The iss variable is used for the TCP - initial sequence number. */ - -#if UIP_ACTIVE_OPEN -static u16_t lastport; /* Keeps track of the last port used for - a new connection. */ -#endif /* UIP_ACTIVE_OPEN */ - -/* Temporary variables. */ -u8_t uip_acc32[4]; -static u8_t c, opt; -static u16_t tmp16; - -/* Structures and definitions. */ -#define TCP_FIN 0x01 -#define TCP_SYN 0x02 -#define TCP_RST 0x04 -#define TCP_PSH 0x08 -#define TCP_ACK 0x10 -#define TCP_URG 0x20 -#define TCP_CTL 0x3f - -#define TCP_OPT_END 0 /* End of TCP options list */ -#define TCP_OPT_NOOP 1 /* "No-operation" TCP option */ -#define TCP_OPT_MSS 2 /* Maximum segment size TCP option */ - -#define TCP_OPT_MSS_LEN 4 /* Length of TCP MSS option. */ - -#define ICMP_ECHO_REPLY 0 -#define ICMP_ECHO 8 - -#define ICMP6_ECHO_REPLY 129 -#define ICMP6_ECHO 128 -#define ICMP6_NEIGHBOR_SOLICITATION 135 -#define ICMP6_NEIGHBOR_ADVERTISEMENT 136 - -#define ICMP6_FLAG_S (1 << 6) - -#define ICMP6_OPTION_SOURCE_LINK_ADDRESS 1 -#define ICMP6_OPTION_TARGET_LINK_ADDRESS 2 - - -/* Macros. */ -#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) -#define FBUF ((struct uip_tcpip_hdr *)&uip_reassbuf[0]) -#define ICMPBUF ((struct uip_icmpip_hdr *)&uip_buf[UIP_LLH_LEN]) -#define UDPBUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN]) - - -#if UIP_STATISTICS == 1 -struct uip_stats uip_stat; -#define UIP_STAT(s) s -#else -#define UIP_STAT(s) -#endif /* UIP_STATISTICS == 1 */ - -#if UIP_LOGGING == 1 -#include -void uip_log(char *msg); -#define UIP_LOG(m) uip_log(m) -#else -#define UIP_LOG(m) -#endif /* UIP_LOGGING == 1 */ - -#if ! UIP_ARCH_ADD32 -void -uip_add32(u8_t *op32, u16_t op16) -{ - uip_acc32[3] = op32[3] + (op16 & 0xff); - uip_acc32[2] = op32[2] + (op16 >> 8); - uip_acc32[1] = op32[1]; - uip_acc32[0] = op32[0]; - - if(uip_acc32[2] < (op16 >> 8)) { - ++uip_acc32[1]; - if(uip_acc32[1] == 0) { - ++uip_acc32[0]; - } - } - - - if(uip_acc32[3] < (op16 & 0xff)) { - ++uip_acc32[2]; - if(uip_acc32[2] == 0) { - ++uip_acc32[1]; - if(uip_acc32[1] == 0) { - ++uip_acc32[0]; - } - } - } -} - -#endif /* UIP_ARCH_ADD32 */ - -#if ! UIP_ARCH_CHKSUM -/*---------------------------------------------------------------------------*/ -static u16_t -chksum(u16_t sum, const u8_t *data, u16_t len) -{ - u16_t t; - const u8_t *dataptr; - const u8_t *last_byte; - - dataptr = data; - last_byte = data + len - 1; - - while(dataptr < last_byte) { /* At least two more bytes */ - t = (dataptr[0] << 8) + dataptr[1]; - sum += t; - if(sum < t) { - sum++; /* carry */ - } - dataptr += 2; - } - - if(dataptr == last_byte) { - t = (dataptr[0] << 8) + 0; - sum += t; - if(sum < t) { - sum++; /* carry */ - } - } - - /* Return sum in host byte order. */ - return sum; -} -/*---------------------------------------------------------------------------*/ -u16_t -uip_chksum(u16_t *data, u16_t len) -{ - return htons(chksum(0, (u8_t *)data, len)); -} -/*---------------------------------------------------------------------------*/ -#ifndef UIP_ARCH_IPCHKSUM -u16_t -uip_ipchksum(void) -{ - u16_t sum; - - sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN); - DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum); - return (sum == 0) ? 0xffff : htons(sum); -} -#endif -/*---------------------------------------------------------------------------*/ -static u16_t -upper_layer_chksum(u8_t proto) -{ - u16_t upper_layer_len; - u16_t sum; - -#if UIP_CONF_IPV6 - upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]); -#else /* UIP_CONF_IPV6 */ - upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN; -#endif /* UIP_CONF_IPV6 */ - - /* First sum pseudoheader. */ - - /* IP protocol and length fields. This addition cannot carry. */ - sum = upper_layer_len + proto; - /* Sum IP source and destination addresses. */ - sum = chksum(sum, (u8_t *)&BUF->srcipaddr[0], 2 * sizeof(uip_ipaddr_t)); - - /* Sum TCP header and data. */ - sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], - upper_layer_len); - - return (sum == 0) ? 0xffff : htons(sum); -} -/*---------------------------------------------------------------------------*/ -#if UIP_CONF_IPV6 -u16_t -uip_icmp6chksum(void) -{ - return upper_layer_chksum(UIP_PROTO_ICMP6); - -} -#endif /* UIP_CONF_IPV6 */ -/*---------------------------------------------------------------------------*/ -u16_t -uip_tcpchksum(void) -{ - return upper_layer_chksum(UIP_PROTO_TCP); -} -/*---------------------------------------------------------------------------*/ -#if UIP_UDP_CHECKSUMS -u16_t -uip_udpchksum(void) -{ - return upper_layer_chksum(UIP_PROTO_UDP); -} -#endif /* UIP_UDP_CHECKSUMS */ -#endif /* UIP_ARCH_CHKSUM */ -/*---------------------------------------------------------------------------*/ -void -uip_init(void) -{ - for(c = 0; c < UIP_LISTENPORTS; ++c) { - uip_listenports[c] = 0; - } - for(c = 0; c < UIP_CONNS; ++c) { - uip_conns[c].tcpstateflags = UIP_CLOSED; - } -#if UIP_ACTIVE_OPEN - lastport = 1024; -#endif /* UIP_ACTIVE_OPEN */ - -#if UIP_UDP - for(c = 0; c < UIP_UDP_CONNS; ++c) { - uip_udp_conns[c].lport = 0; - } -#endif /* UIP_UDP */ - - - /* IPv4 initialization. */ -#if UIP_FIXEDADDR == 0 - /* uip_hostaddr[0] = uip_hostaddr[1] = 0;*/ -#endif /* UIP_FIXEDADDR */ - -} -/*---------------------------------------------------------------------------*/ -#if UIP_ACTIVE_OPEN -struct uip_conn * -uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) -{ - register struct uip_conn *conn, *cconn; - - /* Find an unused local port. */ - again: - ++lastport; - - if(lastport >= 32000) { - lastport = 4096; - } - - /* Check if this port is already in use, and if so try to find - another one. */ - for(c = 0; c < UIP_CONNS; ++c) { - conn = &uip_conns[c]; - if(conn->tcpstateflags != UIP_CLOSED && - conn->lport == htons(lastport)) { - goto again; - } - } - - conn = 0; - for(c = 0; c < UIP_CONNS; ++c) { - cconn = &uip_conns[c]; - if(cconn->tcpstateflags == UIP_CLOSED) { - conn = cconn; - break; - } - if(cconn->tcpstateflags == UIP_TIME_WAIT) { - if(conn == 0 || - cconn->timer > conn->timer) { - conn = cconn; - } - } - } - - if(conn == 0) { - return 0; - } - - conn->tcpstateflags = UIP_SYN_SENT; - - conn->snd_nxt[0] = iss[0]; - conn->snd_nxt[1] = iss[1]; - conn->snd_nxt[2] = iss[2]; - conn->snd_nxt[3] = iss[3]; - - conn->initialmss = conn->mss = UIP_TCP_MSS; - - conn->len = 1; /* TCP length of the SYN is one. */ - conn->nrtx = 0; - conn->timer = 1; /* Send the SYN next time around. */ - conn->rto = UIP_RTO; - conn->sa = 0; - conn->sv = 16; /* Initial value of the RTT variance. */ - conn->lport = htons(lastport); - conn->rport = rport; - uip_ipaddr_copy(&conn->ripaddr, ripaddr); - - return conn; -} -#endif /* UIP_ACTIVE_OPEN */ -/*---------------------------------------------------------------------------*/ -#if UIP_UDP -struct uip_udp_conn * -uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport) -{ - register struct uip_udp_conn *conn; - - /* Find an unused local port. */ - again: - ++lastport; - - if(lastport >= 32000) { - lastport = 4096; - } - - for(c = 0; c < UIP_UDP_CONNS; ++c) { - if(uip_udp_conns[c].lport == htons(lastport)) { - goto again; - } - } - - - conn = 0; - for(c = 0; c < UIP_UDP_CONNS; ++c) { - if(uip_udp_conns[c].lport == 0) { - conn = &uip_udp_conns[c]; - break; - } - } - - if(conn == 0) { - return 0; - } - - conn->lport = HTONS(lastport); - conn->rport = rport; - if(ripaddr == NULL) { - memset(conn->ripaddr, 0, sizeof(uip_ipaddr_t)); - } else { - uip_ipaddr_copy(&conn->ripaddr, ripaddr); - } - conn->ttl = UIP_TTL; - - return conn; -} -#endif /* UIP_UDP */ -/*---------------------------------------------------------------------------*/ -void -uip_unlisten(u16_t port) -{ - for(c = 0; c < UIP_LISTENPORTS; ++c) { - if(uip_listenports[c] == port) { - uip_listenports[c] = 0; - return; - } - } -} -/*---------------------------------------------------------------------------*/ -void -uip_listen(u16_t port) -{ - for(c = 0; c < UIP_LISTENPORTS; ++c) { - if(uip_listenports[c] == 0) { - uip_listenports[c] = port; - return; - } - } -} -/*---------------------------------------------------------------------------*/ -/* XXX: IP fragment reassembly: not well-tested. */ - -#if UIP_REASSEMBLY && !UIP_CONF_IPV6 -#define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN) -static u8_t uip_reassbuf[UIP_REASS_BUFSIZE]; -static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; -static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, - 0x0f, 0x07, 0x03, 0x01}; -static u16_t uip_reasslen; -static u8_t uip_reassflags; -#define UIP_REASS_FLAG_LASTFRAG 0x01 -static u8_t uip_reasstmr; - -#define IP_MF 0x20 - -static u8_t -uip_reass(void) -{ - u16_t offset, len; - u16_t i; - - /* If ip_reasstmr is zero, no packet is present in the buffer, so we - write the IP header of the fragment into the reassembly - buffer. The timer is updated with the maximum age. */ - if(uip_reasstmr == 0) { - memcpy(uip_reassbuf, &BUF->vhl, UIP_IPH_LEN); - uip_reasstmr = UIP_REASS_MAXAGE; - uip_reassflags = 0; - /* Clear the bitmap. */ - memset(uip_reassbitmap, 0, sizeof(uip_reassbitmap)); - } - - /* Check if the incoming fragment matches the one currently present - in the reasembly buffer. If so, we proceed with copying the - fragment into the buffer. */ - if(BUF->srcipaddr[0] == FBUF->srcipaddr[0] && - BUF->srcipaddr[1] == FBUF->srcipaddr[1] && - BUF->destipaddr[0] == FBUF->destipaddr[0] && - BUF->destipaddr[1] == FBUF->destipaddr[1] && - BUF->ipid[0] == FBUF->ipid[0] && - BUF->ipid[1] == FBUF->ipid[1]) { - - len = (BUF->len[0] << 8) + BUF->len[1] - (BUF->vhl & 0x0f) * 4; - offset = (((BUF->ipoffset[0] & 0x3f) << 8) + BUF->ipoffset[1]) * 8; - - /* If the offset or the offset + fragment length overflows the - reassembly buffer, we discard the entire packet. */ - if(offset > UIP_REASS_BUFSIZE || - offset + len > UIP_REASS_BUFSIZE) { - uip_reasstmr = 0; - goto nullreturn; - } - - /* Copy the fragment into the reassembly buffer, at the right - offset. */ - memcpy(&uip_reassbuf[UIP_IPH_LEN + offset], - (char *)BUF + (int)((BUF->vhl & 0x0f) * 4), - len); - - /* Update the bitmap. */ - if(offset / (8 * 8) == (offset + len) / (8 * 8)) { - /* If the two endpoints are in the same byte, we only update - that byte. */ - - uip_reassbitmap[offset / (8 * 8)] |= - bitmap_bits[(offset / 8 ) & 7] & - ~bitmap_bits[((offset + len) / 8 ) & 7]; - } else { - /* If the two endpoints are in different bytes, we update the - bytes in the endpoints and fill the stuff inbetween with - 0xff. */ - uip_reassbitmap[offset / (8 * 8)] |= - bitmap_bits[(offset / 8 ) & 7]; - for(i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) { - uip_reassbitmap[i] = 0xff; - } - uip_reassbitmap[(offset + len) / (8 * 8)] |= - ~bitmap_bits[((offset + len) / 8 ) & 7]; - } - - /* If this fragment has the More Fragments flag set to zero, we - know that this is the last fragment, so we can calculate the - size of the entire packet. We also set the - IP_REASS_FLAG_LASTFRAG flag to indicate that we have received - the final fragment. */ - - if((BUF->ipoffset[0] & IP_MF) == 0) { - uip_reassflags |= UIP_REASS_FLAG_LASTFRAG; - uip_reasslen = offset + len; - } - - /* Finally, we check if we have a full packet in the buffer. We do - this by checking if we have the last fragment and if all bits - in the bitmap are set. */ - if(uip_reassflags & UIP_REASS_FLAG_LASTFRAG) { - /* Check all bytes up to and including all but the last byte in - the bitmap. */ - for(i = 0; i < uip_reasslen / (8 * 8) - 1; ++i) { - if(uip_reassbitmap[i] != 0xff) { - goto nullreturn; - } - } - /* Check the last byte in the bitmap. It should contain just the - right amount of bits. */ - if(uip_reassbitmap[uip_reasslen / (8 * 8)] != - (u8_t)~bitmap_bits[uip_reasslen / 8 & 7]) { - goto nullreturn; - } - - /* If we have come this far, we have a full packet in the - buffer, so we allocate a pbuf and copy the packet into it. We - also reset the timer. */ - uip_reasstmr = 0; - memcpy(BUF, FBUF, uip_reasslen); - - /* Pretend to be a "normal" (i.e., not fragmented) IP packet - from now on. */ - BUF->ipoffset[0] = BUF->ipoffset[1] = 0; - BUF->len[0] = uip_reasslen >> 8; - BUF->len[1] = uip_reasslen & 0xff; - BUF->ipchksum = 0; - BUF->ipchksum = ~(uip_ipchksum()); - - return uip_reasslen; - } - } - - nullreturn: - return 0; -} -#endif /* UIP_REASSEMBLY */ -/*---------------------------------------------------------------------------*/ -static void -uip_add_rcv_nxt(u16_t n) -{ - uip_add32(uip_conn->rcv_nxt, n); - uip_conn->rcv_nxt[0] = uip_acc32[0]; - uip_conn->rcv_nxt[1] = uip_acc32[1]; - uip_conn->rcv_nxt[2] = uip_acc32[2]; - uip_conn->rcv_nxt[3] = uip_acc32[3]; -} -/*---------------------------------------------------------------------------*/ -void -uip_process(u8_t flag) -{ - register struct uip_conn *uip_connr = uip_conn; - -#if UIP_UDP - if(flag == UIP_UDP_SEND_CONN) { - goto udp_send; - } -#endif /* UIP_UDP */ - - uip_sappdata = uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN]; - - /* Check if we were invoked because of a poll request for a - particular connection. */ - if(flag == UIP_POLL_REQUEST) { - if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED && - !uip_outstanding(uip_connr)) { - uip_flags = UIP_POLL; - UIP_APPCALL(); - goto appsend; - } - goto drop; - - /* Check if we were invoked because of the perodic timer fireing. */ - } else if(flag == UIP_TIMER) { -#if UIP_REASSEMBLY - if(uip_reasstmr != 0) { - --uip_reasstmr; - } -#endif /* UIP_REASSEMBLY */ - /* Increase the initial sequence number. */ - if(++iss[3] == 0) { - if(++iss[2] == 0) { - if(++iss[1] == 0) { - ++iss[0]; - } - } - } - - /* Reset the length variables. */ - uip_len = 0; - uip_slen = 0; - - /* Check if the connection is in a state in which we simply wait - for the connection to time out. If so, we increase the - connection's timer and remove the connection if it times - out. */ - if(uip_connr->tcpstateflags == UIP_TIME_WAIT || - uip_connr->tcpstateflags == UIP_FIN_WAIT_2) { - ++(uip_connr->timer); - if(uip_connr->timer == UIP_TIME_WAIT_TIMEOUT) { - uip_connr->tcpstateflags = UIP_CLOSED; - } - } else if(uip_connr->tcpstateflags != UIP_CLOSED) { - /* If the connection has outstanding data, we increase the - connection's timer and see if it has reached the RTO value - in which case we retransmit. */ - if(uip_outstanding(uip_connr)) { - if(uip_connr->timer-- == 0) { - if(uip_connr->nrtx == UIP_MAXRTX || - ((uip_connr->tcpstateflags == UIP_SYN_SENT || - uip_connr->tcpstateflags == UIP_SYN_RCVD) && - uip_connr->nrtx == UIP_MAXSYNRTX)) { - uip_connr->tcpstateflags = UIP_CLOSED; - - /* We call UIP_APPCALL() with uip_flags set to - UIP_TIMEDOUT to inform the application that the - connection has timed out. */ - uip_flags = UIP_TIMEDOUT; - UIP_APPCALL(); - - /* We also send a reset packet to the remote host. */ - BUF->flags = TCP_RST | TCP_ACK; - goto tcp_send_nodata; - } - - /* Exponential backoff. */ - uip_connr->timer = UIP_RTO << (uip_connr->nrtx > 4? - 4: - uip_connr->nrtx); - ++(uip_connr->nrtx); - - /* Ok, so we need to retransmit. We do this differently - depending on which state we are in. In ESTABLISHED, we - call upon the application so that it may prepare the - data for the retransmit. In SYN_RCVD, we resend the - SYNACK that we sent earlier and in LAST_ACK we have to - retransmit our FINACK. */ - UIP_STAT(++uip_stat.tcp.rexmit); - switch(uip_connr->tcpstateflags & UIP_TS_MASK) { - case UIP_SYN_RCVD: - /* In the SYN_RCVD state, we should retransmit our - SYNACK. */ - goto tcp_send_synack; - -#if UIP_ACTIVE_OPEN - case UIP_SYN_SENT: - /* In the SYN_SENT state, we retransmit out SYN. */ - BUF->flags = 0; - goto tcp_send_syn; -#endif /* UIP_ACTIVE_OPEN */ - - case UIP_ESTABLISHED: - /* In the ESTABLISHED state, we call upon the application - to do the actual retransmit after which we jump into - the code for sending out the packet (the apprexmit - label). */ - uip_flags = UIP_REXMIT; - UIP_APPCALL(); - goto apprexmit; - - case UIP_FIN_WAIT_1: - case UIP_CLOSING: - case UIP_LAST_ACK: - /* In all these states we should retransmit a FINACK. */ - goto tcp_send_finack; - - } - } - } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) { - /* If there was no need for a retransmission, we poll the - application for new data. */ - uip_flags = UIP_POLL; - UIP_APPCALL(); - goto appsend; - } - } - goto drop; - } -#if UIP_UDP - if(flag == UIP_UDP_TIMER) { - if(uip_udp_conn->lport != 0) { - uip_conn = NULL; - uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; - uip_len = uip_slen = 0; - uip_flags = UIP_POLL; - UIP_UDP_APPCALL(); - goto udp_send; - } else { - goto drop; - } - } -#endif - - /* This is where the input processing starts. */ - UIP_STAT(++uip_stat.ip.recv); - - /* Start of IP input header processing code. */ - -#if UIP_CONF_IPV6 - /* Check validity of the IP header. */ - if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */ - UIP_STAT(++uip_stat.ip.drop); - UIP_STAT(++uip_stat.ip.vhlerr); - UIP_LOG("ipv6: invalid version."); - goto drop; - } -#else /* UIP_CONF_IPV6 */ - /* Check validity of the IP header. */ - if(BUF->vhl != 0x45) { /* IP version and header length. */ - UIP_STAT(++uip_stat.ip.drop); - UIP_STAT(++uip_stat.ip.vhlerr); - UIP_LOG("ip: invalid version or header length."); - goto drop; - } -#endif /* UIP_CONF_IPV6 */ - - /* Check the size of the packet. If the size reported to us in - uip_len is smaller the size reported in the IP header, we assume - that the packet has been corrupted in transit. If the size of - uip_len is larger than the size reported in the IP packet header, - the packet has been padded and we set uip_len to the correct - value.. */ - - if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) { - uip_len = (BUF->len[0] << 8) + BUF->len[1]; -#if UIP_CONF_IPV6 - uip_len += 40; /* The length reported in the IPv6 header is the - length of the payload that follows the - header. However, uIP uses the uip_len variable - for holding the size of the entire packet, - including the IP header. For IPv4 this is not a - problem as the length field in the IPv4 header - contains the length of the entire packet. But - for IPv6 we need to add the size of the IPv6 - header (40 bytes). */ -#endif /* UIP_CONF_IPV6 */ - } else { - UIP_LOG("ip: packet shorter than reported in IP header."); - goto drop; - } - -#if !UIP_CONF_IPV6 - /* Check the fragment flag. */ - if((BUF->ipoffset[0] & 0x3f) != 0 || - BUF->ipoffset[1] != 0) { -#if UIP_REASSEMBLY - uip_len = uip_reass(); - if(uip_len == 0) { - goto drop; - } -#else /* UIP_REASSEMBLY */ - UIP_STAT(++uip_stat.ip.drop); - UIP_STAT(++uip_stat.ip.fragerr); - UIP_LOG("ip: fragment dropped."); - goto drop; -#endif /* UIP_REASSEMBLY */ - } -#endif /* UIP_CONF_IPV6 */ - - if(uip_ipaddr_cmp(uip_hostaddr, all_zeroes_addr)) { - /* If we are configured to use ping IP address configuration and - hasn't been assigned an IP address yet, we accept all ICMP - packets. */ -#if UIP_PINGADDRCONF && !UIP_CONF_IPV6 - if(BUF->proto == UIP_PROTO_ICMP) { - UIP_LOG("ip: possible ping config packet received."); - goto icmp_input; - } else { - UIP_LOG("ip: packet dropped since no address assigned."); - goto drop; - } -#endif /* UIP_PINGADDRCONF */ - - } else { - /* If IP broadcast support is configured, we check for a broadcast - UDP packet, which may be destined to us. */ -#if UIP_BROADCAST - DEBUG_PRINTF("UDP IP checksum 0x%04x\n", uip_ipchksum()); - if(BUF->proto == UIP_PROTO_UDP && - uip_ipaddr_cmp(BUF->destipaddr, all_ones_addr) - /*&& - uip_ipchksum() == 0xffff*/) { - goto udp_input; - } -#endif /* UIP_BROADCAST */ - - /* Check if the packet is destined for our IP address. */ -#if !UIP_CONF_IPV6 - if(!uip_ipaddr_cmp(BUF->destipaddr, uip_hostaddr)) { - UIP_STAT(++uip_stat.ip.drop); - goto drop; - } -#else /* UIP_CONF_IPV6 */ - /* For IPv6, packet reception is a little trickier as we need to - make sure that we listen to certain multicast addresses (all - hosts multicast address, and the solicited-node multicast - address) as well. However, we will cheat here and accept all - multicast packets that are sent to the ff02::/16 addresses. */ - if(!uip_ipaddr_cmp(BUF->destipaddr, uip_hostaddr) && - BUF->destipaddr[0] != HTONS(0xff02)) { - UIP_STAT(++uip_stat.ip.drop); - goto drop; - } -#endif /* UIP_CONF_IPV6 */ - } - -#if !UIP_CONF_IPV6 - if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header - checksum. */ - UIP_STAT(++uip_stat.ip.drop); - UIP_STAT(++uip_stat.ip.chkerr); - UIP_LOG("ip: bad checksum."); - goto drop; - } -#endif /* UIP_CONF_IPV6 */ - - if(BUF->proto == UIP_PROTO_TCP) { /* Check for TCP packet. If so, - proceed with TCP input - processing. */ - goto tcp_input; - } - -#if UIP_UDP - if(BUF->proto == UIP_PROTO_UDP) { - goto udp_input; - } -#endif /* UIP_UDP */ - -#if !UIP_CONF_IPV6 - /* ICMPv4 processing code follows. */ - if(BUF->proto != UIP_PROTO_ICMP) { /* We only allow ICMP packets from - here. */ - UIP_STAT(++uip_stat.ip.drop); - UIP_STAT(++uip_stat.ip.protoerr); - UIP_LOG("ip: neither tcp nor icmp."); - goto drop; - } - -#if UIP_PINGADDRCONF - icmp_input: -#endif /* UIP_PINGADDRCONF */ - UIP_STAT(++uip_stat.icmp.recv); - - /* ICMP echo (i.e., ping) processing. This is simple, we only change - the ICMP type from ECHO to ECHO_REPLY and adjust the ICMP - checksum before we return the packet. */ - if(ICMPBUF->type != ICMP_ECHO) { - UIP_STAT(++uip_stat.icmp.drop); - UIP_STAT(++uip_stat.icmp.typeerr); - UIP_LOG("icmp: not icmp echo."); - goto drop; - } - - /* If we are configured to use ping IP address assignment, we use - the destination IP address of this ping packet and assign it to - ourself. */ -#if UIP_PINGADDRCONF - if((uip_hostaddr[0] | uip_hostaddr[1]) == 0) { - uip_hostaddr[0] = BUF->destipaddr[0]; - uip_hostaddr[1] = BUF->destipaddr[1]; - } -#endif /* UIP_PINGADDRCONF */ - - ICMPBUF->type = ICMP_ECHO_REPLY; - - if(ICMPBUF->icmpchksum >= HTONS(0xffff - (ICMP_ECHO << 8))) { - ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8) + 1; - } else { - ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8); - } - - /* Swap IP addresses. */ - uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr); - uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); - - UIP_STAT(++uip_stat.icmp.sent); - goto send; - - /* End of IPv4 input header processing code. */ -#else /* !UIP_CONF_IPV6 */ - - /* This is IPv6 ICMPv6 processing code. */ - DEBUG_PRINTF("icmp6_input: length %d\n", uip_len); - - if(BUF->proto != UIP_PROTO_ICMP6) { /* We only allow ICMPv6 packets from - here. */ - UIP_STAT(++uip_stat.ip.drop); - UIP_STAT(++uip_stat.ip.protoerr); - UIP_LOG("ip: neither tcp nor icmp6."); - goto drop; - } - - UIP_STAT(++uip_stat.icmp.recv); - - /* If we get a neighbor solicitation for our address we should send - a neighbor advertisement message back. */ - if(ICMPBUF->type == ICMP6_NEIGHBOR_SOLICITATION) { - if(uip_ipaddr_cmp(ICMPBUF->icmp6data, uip_hostaddr)) { - - if(ICMPBUF->options[0] == ICMP6_OPTION_SOURCE_LINK_ADDRESS) { - /* Save the sender's address in our neighbor list. */ - uip_neighbor_add(ICMPBUF->srcipaddr, &(ICMPBUF->options[2])); - } - - /* We should now send a neighbor advertisement back to where the - neighbor solicication came from. */ - ICMPBUF->type = ICMP6_NEIGHBOR_ADVERTISEMENT; - ICMPBUF->flags = ICMP6_FLAG_S; /* Solicited flag. */ - - ICMPBUF->reserved1 = ICMPBUF->reserved2 = ICMPBUF->reserved3 = 0; - - uip_ipaddr_copy(ICMPBUF->destipaddr, ICMPBUF->srcipaddr); - uip_ipaddr_copy(ICMPBUF->srcipaddr, uip_hostaddr); - ICMPBUF->options[0] = ICMP6_OPTION_TARGET_LINK_ADDRESS; - ICMPBUF->options[1] = 1; /* Options length, 1 = 8 bytes. */ - memcpy(&(ICMPBUF->options[2]), &uip_ethaddr, sizeof(uip_ethaddr)); - ICMPBUF->icmpchksum = 0; - ICMPBUF->icmpchksum = ~uip_icmp6chksum(); - goto send; - - } - goto drop; - } else if(ICMPBUF->type == ICMP6_ECHO) { - /* ICMP echo (i.e., ping) processing. This is simple, we only - change the ICMP type from ECHO to ECHO_REPLY and update the - ICMP checksum before we return the packet. */ - - ICMPBUF->type = ICMP6_ECHO_REPLY; - - uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr); - uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); - ICMPBUF->icmpchksum = 0; - ICMPBUF->icmpchksum = ~uip_icmp6chksum(); - - UIP_STAT(++uip_stat.icmp.sent); - goto send; - } else { - DEBUG_PRINTF("Unknown icmp6 message type %d\n", ICMPBUF->type); - UIP_STAT(++uip_stat.icmp.drop); - UIP_STAT(++uip_stat.icmp.typeerr); - UIP_LOG("icmp: unknown ICMP message."); - goto drop; - } - - /* End of IPv6 ICMP processing. */ - -#endif /* !UIP_CONF_IPV6 */ - -#if UIP_UDP - /* UDP input processing. */ - udp_input: - /* UDP processing is really just a hack. We don't do anything to the - UDP/IP headers, but let the UDP application do all the hard - work. If the application sets uip_slen, it has a packet to - send. */ -#if UIP_UDP_CHECKSUMS - uip_len = uip_len - UIP_IPUDPH_LEN; - uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; - if(UDPBUF->udpchksum != 0 && uip_udpchksum() != 0xffff) { - UIP_STAT(++uip_stat.udp.drop); - UIP_STAT(++uip_stat.udp.chkerr); - UIP_LOG("udp: bad checksum."); - goto drop; - } -#else /* UIP_UDP_CHECKSUMS */ - uip_len = uip_len - UIP_IPUDPH_LEN; -#endif /* UIP_UDP_CHECKSUMS */ - - /* Demultiplex this UDP packet between the UDP "connections". */ - for(uip_udp_conn = &uip_udp_conns[0]; - uip_udp_conn < &uip_udp_conns[UIP_UDP_CONNS]; - ++uip_udp_conn) { - /* If the local UDP port is non-zero, the connection is considered - to be used. If so, the local port number is checked against the - destination port number in the received packet. If the two port - numbers match, the remote port number is checked if the - connection is bound to a remote port. Finally, if the - connection is bound to a remote IP address, the source IP - address of the packet is checked. */ - if(uip_udp_conn->lport != 0 && - UDPBUF->destport == uip_udp_conn->lport && - (uip_udp_conn->rport == 0 || - UDPBUF->srcport == uip_udp_conn->rport) && - (uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_zeroes_addr) || - uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_ones_addr) || - uip_ipaddr_cmp(BUF->srcipaddr, uip_udp_conn->ripaddr))) { - goto udp_found; - } - } - UIP_LOG("udp: no matching connection found"); - goto drop; - - udp_found: - uip_conn = NULL; - uip_flags = UIP_NEWDATA; - uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; - uip_slen = 0; - UIP_UDP_APPCALL(); - udp_send: - if(uip_slen == 0) { - goto drop; - } - uip_len = uip_slen + UIP_IPUDPH_LEN; - -#if UIP_CONF_IPV6 - /* For IPv6, the IP length field does not include the IPv6 IP header - length. */ - BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); - BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); -#else /* UIP_CONF_IPV6 */ - BUF->len[0] = (uip_len >> 8); - BUF->len[1] = (uip_len & 0xff); -#endif /* UIP_CONF_IPV6 */ - - BUF->ttl = uip_udp_conn->ttl; - BUF->proto = UIP_PROTO_UDP; - - UDPBUF->udplen = HTONS(uip_slen + UIP_UDPH_LEN); - UDPBUF->udpchksum = 0; - - BUF->srcport = uip_udp_conn->lport; - BUF->destport = uip_udp_conn->rport; - - uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); - uip_ipaddr_copy(BUF->destipaddr, uip_udp_conn->ripaddr); - - uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPTCPH_LEN]; - -#if UIP_UDP_CHECKSUMS - /* Calculate UDP checksum. */ - UDPBUF->udpchksum = ~(uip_udpchksum()); - if(UDPBUF->udpchksum == 0) { - UDPBUF->udpchksum = 0xffff; - } -#endif /* UIP_UDP_CHECKSUMS */ - - goto ip_send_nolen; -#endif /* UIP_UDP */ - - /* TCP input processing. */ - tcp_input: - UIP_STAT(++uip_stat.tcp.recv); - - /* Start of TCP input header processing code. */ - - if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP - checksum. */ - UIP_STAT(++uip_stat.tcp.drop); - UIP_STAT(++uip_stat.tcp.chkerr); - UIP_LOG("tcp: bad checksum."); - goto drop; - } - - - /* Demultiplex this segment. */ - /* First check any active connections. */ - for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_CONNS - 1]; - ++uip_connr) { - if(uip_connr->tcpstateflags != UIP_CLOSED && - BUF->destport == uip_connr->lport && - BUF->srcport == uip_connr->rport && - uip_ipaddr_cmp(BUF->srcipaddr, uip_connr->ripaddr)) { - goto found; - } - } - - /* If we didn't find and active connection that expected the packet, - either this packet is an old duplicate, or this is a SYN packet - destined for a connection in LISTEN. If the SYN flag isn't set, - it is an old packet and we send a RST. */ - if((BUF->flags & TCP_CTL) != TCP_SYN) { - goto reset; - } - - tmp16 = BUF->destport; - /* Next, check listening connections. */ - for(c = 0; c < UIP_LISTENPORTS; ++c) { - if(tmp16 == uip_listenports[c]) - goto found_listen; - } - - /* No matching connection found, so we send a RST packet. */ - UIP_STAT(++uip_stat.tcp.synrst); - reset: - - /* We do not send resets in response to resets. */ - if(BUF->flags & TCP_RST) { - goto drop; - } - - UIP_STAT(++uip_stat.tcp.rst); - - BUF->flags = TCP_RST | TCP_ACK; - uip_len = UIP_IPTCPH_LEN; - BUF->tcpoffset = 5 << 4; - - /* Flip the seqno and ackno fields in the TCP header. */ - c = BUF->seqno[3]; - BUF->seqno[3] = BUF->ackno[3]; - BUF->ackno[3] = c; - - c = BUF->seqno[2]; - BUF->seqno[2] = BUF->ackno[2]; - BUF->ackno[2] = c; - - c = BUF->seqno[1]; - BUF->seqno[1] = BUF->ackno[1]; - BUF->ackno[1] = c; - - c = BUF->seqno[0]; - BUF->seqno[0] = BUF->ackno[0]; - BUF->ackno[0] = c; - - /* We also have to increase the sequence number we are - acknowledging. If the least significant byte overflowed, we need - to propagate the carry to the other bytes as well. */ - if(++BUF->ackno[3] == 0) { - if(++BUF->ackno[2] == 0) { - if(++BUF->ackno[1] == 0) { - ++BUF->ackno[0]; - } - } - } - - /* Swap port numbers. */ - tmp16 = BUF->srcport; - BUF->srcport = BUF->destport; - BUF->destport = tmp16; - - /* Swap IP addresses. */ - uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr); - uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); - - /* And send out the RST packet! */ - goto tcp_send_noconn; - - /* This label will be jumped to if we matched the incoming packet - with a connection in LISTEN. In that case, we should create a new - connection and send a SYNACK in return. */ - found_listen: - /* First we check if there are any connections avaliable. Unused - connections are kept in the same table as used connections, but - unused ones have the tcpstate set to CLOSED. Also, connections in - TIME_WAIT are kept track of and we'll use the oldest one if no - CLOSED connections are found. Thanks to Eddie C. Dost for a very - nice algorithm for the TIME_WAIT search. */ - uip_connr = 0; - for(c = 0; c < UIP_CONNS; ++c) { - if(uip_conns[c].tcpstateflags == UIP_CLOSED) { - uip_connr = &uip_conns[c]; - break; - } - if(uip_conns[c].tcpstateflags == UIP_TIME_WAIT) { - if(uip_connr == 0 || - uip_conns[c].timer > uip_connr->timer) { - uip_connr = &uip_conns[c]; - } - } - } - - if(uip_connr == 0) { - /* All connections are used already, we drop packet and hope that - the remote end will retransmit the packet at a time when we - have more spare connections. */ - UIP_STAT(++uip_stat.tcp.syndrop); - UIP_LOG("tcp: found no unused connections."); - goto drop; - } - uip_conn = uip_connr; - - /* Fill in the necessary fields for the new connection. */ - uip_connr->rto = uip_connr->timer = UIP_RTO; - uip_connr->sa = 0; - uip_connr->sv = 4; - uip_connr->nrtx = 0; - uip_connr->lport = BUF->destport; - uip_connr->rport = BUF->srcport; - uip_ipaddr_copy(uip_connr->ripaddr, BUF->srcipaddr); - uip_connr->tcpstateflags = UIP_SYN_RCVD; - - uip_connr->snd_nxt[0] = iss[0]; - uip_connr->snd_nxt[1] = iss[1]; - uip_connr->snd_nxt[2] = iss[2]; - uip_connr->snd_nxt[3] = iss[3]; - uip_connr->len = 1; - - /* rcv_nxt should be the seqno from the incoming packet + 1. */ - uip_connr->rcv_nxt[3] = BUF->seqno[3]; - uip_connr->rcv_nxt[2] = BUF->seqno[2]; - uip_connr->rcv_nxt[1] = BUF->seqno[1]; - uip_connr->rcv_nxt[0] = BUF->seqno[0]; - uip_add_rcv_nxt(1); - - /* Parse the TCP MSS option, if present. */ - if((BUF->tcpoffset & 0xf0) > 0x50) { - for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) { - opt = uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + c]; - if(opt == TCP_OPT_END) { - /* End of options. */ - break; - } else if(opt == TCP_OPT_NOOP) { - ++c; - /* NOP option. */ - } else if(opt == TCP_OPT_MSS && - uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { - /* An MSS option with the right option length. */ - tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | - (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c]; - uip_connr->initialmss = uip_connr->mss = - tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; - - /* And we are done processing options. */ - break; - } else { - /* All other options have a length field, so that we easily - can skip past them. */ - if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) { - /* If the length field is zero, the options are malformed - and we don't process them further. */ - break; - } - c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c]; - } - } - } - - /* Our response will be a SYNACK. */ -#if UIP_ACTIVE_OPEN - tcp_send_synack: - BUF->flags = TCP_ACK; - - tcp_send_syn: - BUF->flags |= TCP_SYN; -#else /* UIP_ACTIVE_OPEN */ - tcp_send_synack: - BUF->flags = TCP_SYN | TCP_ACK; -#endif /* UIP_ACTIVE_OPEN */ - - /* We send out the TCP Maximum Segment Size option with our - SYNACK. */ - BUF->optdata[0] = TCP_OPT_MSS; - BUF->optdata[1] = TCP_OPT_MSS_LEN; - BUF->optdata[2] = (UIP_TCP_MSS) / 256; - BUF->optdata[3] = (UIP_TCP_MSS) & 255; - uip_len = UIP_IPTCPH_LEN + TCP_OPT_MSS_LEN; - BUF->tcpoffset = ((UIP_TCPH_LEN + TCP_OPT_MSS_LEN) / 4) << 4; - goto tcp_send; - - /* This label will be jumped to if we found an active connection. */ - found: - uip_conn = uip_connr; - uip_flags = 0; - /* We do a very naive form of TCP reset processing; we just accept - any RST and kill our connection. We should in fact check if the - sequence number of this reset is wihtin our advertised window - before we accept the reset. */ - if(BUF->flags & TCP_RST) { - uip_connr->tcpstateflags = UIP_CLOSED; - UIP_LOG("tcp: got reset, aborting connection."); - uip_flags = UIP_ABORT; - UIP_APPCALL(); - goto drop; - } - /* Calculated the length of the data, if the application has sent - any data to us. */ - c = (BUF->tcpoffset >> 4) << 2; - /* uip_len will contain the length of the actual TCP data. This is - calculated by subtracing the length of the TCP header (in - c) and the length of the IP header (20 bytes). */ - uip_len = uip_len - c - UIP_IPH_LEN; - - /* First, check if the sequence number of the incoming packet is - what we're expecting next. If not, we send out an ACK with the - correct numbers in. */ - if(!(((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) && - ((BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)))) { - if((uip_len > 0 || ((BUF->flags & (TCP_SYN | TCP_FIN)) != 0)) && - (BUF->seqno[0] != uip_connr->rcv_nxt[0] || - BUF->seqno[1] != uip_connr->rcv_nxt[1] || - BUF->seqno[2] != uip_connr->rcv_nxt[2] || - BUF->seqno[3] != uip_connr->rcv_nxt[3])) { - goto tcp_send_ack; - } - } - - /* Next, check if the incoming segment acknowledges any outstanding - data. If so, we update the sequence number, reset the length of - the outstanding data, calculate RTT estimations, and reset the - retransmission timer. */ - if((BUF->flags & TCP_ACK) && uip_outstanding(uip_connr)) { - uip_add32(uip_connr->snd_nxt, uip_connr->len); - - if(BUF->ackno[0] == uip_acc32[0] && - BUF->ackno[1] == uip_acc32[1] && - BUF->ackno[2] == uip_acc32[2] && - BUF->ackno[3] == uip_acc32[3]) { - /* Update sequence number. */ - uip_connr->snd_nxt[0] = uip_acc32[0]; - uip_connr->snd_nxt[1] = uip_acc32[1]; - uip_connr->snd_nxt[2] = uip_acc32[2]; - uip_connr->snd_nxt[3] = uip_acc32[3]; - - - /* Do RTT estimation, unless we have done retransmissions. */ - if(uip_connr->nrtx == 0) { - signed char m; - m = uip_connr->rto - uip_connr->timer; - /* This is taken directly from VJs original code in his paper */ - m = m - (uip_connr->sa >> 3); - uip_connr->sa += m; - if(m < 0) { - m = -m; - } - m = m - (uip_connr->sv >> 2); - uip_connr->sv += m; - uip_connr->rto = (uip_connr->sa >> 3) + uip_connr->sv; - - } - /* Set the acknowledged flag. */ - uip_flags = UIP_ACKDATA; - /* Reset the retransmission timer. */ - uip_connr->timer = uip_connr->rto; - - /* Reset length of outstanding data. */ - uip_connr->len = 0; - } - - } - - /* Do different things depending on in what state the connection is. */ - switch(uip_connr->tcpstateflags & UIP_TS_MASK) { - /* CLOSED and LISTEN are not handled here. CLOSE_WAIT is not - implemented, since we force the application to close when the - peer sends a FIN (hence the application goes directly from - ESTABLISHED to LAST_ACK). */ - case UIP_SYN_RCVD: - /* In SYN_RCVD we have sent out a SYNACK in response to a SYN, and - we are waiting for an ACK that acknowledges the data we sent - out the last time. Therefore, we want to have the UIP_ACKDATA - flag set. If so, we enter the ESTABLISHED state. */ - if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_ESTABLISHED; - uip_flags = UIP_CONNECTED; - uip_connr->len = 0; - if(uip_len > 0) { - uip_flags |= UIP_NEWDATA; - uip_add_rcv_nxt(uip_len); - } - uip_slen = 0; - UIP_APPCALL(); - goto appsend; - } - goto drop; -#if UIP_ACTIVE_OPEN - case UIP_SYN_SENT: - /* In SYN_SENT, we wait for a SYNACK that is sent in response to - our SYN. The rcv_nxt is set to sequence number in the SYNACK - plus one, and we send an ACK. We move into the ESTABLISHED - state. */ - if((uip_flags & UIP_ACKDATA) && - (BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) { - - /* Parse the TCP MSS option, if present. */ - if((BUF->tcpoffset & 0xf0) > 0x50) { - for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) { - opt = uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + c]; - if(opt == TCP_OPT_END) { - /* End of options. */ - break; - } else if(opt == TCP_OPT_NOOP) { - ++c; - /* NOP option. */ - } else if(opt == TCP_OPT_MSS && - uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { - /* An MSS option with the right option length. */ - tmp16 = (uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | - uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 3 + c]; - uip_connr->initialmss = - uip_connr->mss = tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; - - /* And we are done processing options. */ - break; - } else { - /* All other options have a length field, so that we easily - can skip past them. */ - if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) { - /* If the length field is zero, the options are malformed - and we don't process them further. */ - break; - } - c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c]; - } - } - } - uip_connr->tcpstateflags = UIP_ESTABLISHED; - uip_connr->rcv_nxt[0] = BUF->seqno[0]; - uip_connr->rcv_nxt[1] = BUF->seqno[1]; - uip_connr->rcv_nxt[2] = BUF->seqno[2]; - uip_connr->rcv_nxt[3] = BUF->seqno[3]; - uip_add_rcv_nxt(1); - uip_flags = UIP_CONNECTED | UIP_NEWDATA; - uip_connr->len = 0; - uip_len = 0; - uip_slen = 0; - UIP_APPCALL(); - goto appsend; - } - /* Inform the application that the connection failed */ - uip_flags = UIP_ABORT; - UIP_APPCALL(); - /* The connection is closed after we send the RST */ - uip_conn->tcpstateflags = UIP_CLOSED; - goto reset; -#endif /* UIP_ACTIVE_OPEN */ - - case UIP_ESTABLISHED: - /* In the ESTABLISHED state, we call upon the application to feed - data into the uip_buf. If the UIP_ACKDATA flag is set, the - application should put new data into the buffer, otherwise we are - retransmitting an old segment, and the application should put that - data into the buffer. - - If the incoming packet is a FIN, we should close the connection on - this side as well, and we send out a FIN and enter the LAST_ACK - state. We require that there is no outstanding data; otherwise the - sequence numbers will be screwed up. */ - - if(BUF->flags & TCP_FIN && !(uip_connr->tcpstateflags & UIP_STOPPED)) { - if(uip_outstanding(uip_connr)) { - goto drop; - } - uip_add_rcv_nxt(1 + uip_len); - uip_flags |= UIP_CLOSE; - if(uip_len > 0) { - uip_flags |= UIP_NEWDATA; - } - UIP_APPCALL(); - uip_connr->len = 1; - uip_connr->tcpstateflags = UIP_LAST_ACK; - uip_connr->nrtx = 0; - tcp_send_finack: - BUF->flags = TCP_FIN | TCP_ACK; - goto tcp_send_nodata; - } - - /* Check the URG flag. If this is set, the segment carries urgent - data that we must pass to the application. */ - if((BUF->flags & TCP_URG) != 0) { -#if UIP_URGDATA > 0 - uip_urglen = (BUF->urgp[0] << 8) | BUF->urgp[1]; - if(uip_urglen > uip_len) { - /* There is more urgent data in the next segment to come. */ - uip_urglen = uip_len; - } - uip_add_rcv_nxt(uip_urglen); - uip_len -= uip_urglen; - uip_urgdata = uip_appdata; - uip_appdata += uip_urglen; - } else { - uip_urglen = 0; -#else /* UIP_URGDATA > 0 */ - uip_appdata = ((char *)uip_appdata) + ((BUF->urgp[0] << 8) | BUF->urgp[1]); - uip_len -= (BUF->urgp[0] << 8) | BUF->urgp[1]; -#endif /* UIP_URGDATA > 0 */ - } - - /* If uip_len > 0 we have TCP data in the packet, and we flag this - by setting the UIP_NEWDATA flag and update the sequence number - we acknowledge. If the application has stopped the dataflow - using uip_stop(), we must not accept any data packets from the - remote host. */ - if(uip_len > 0 && !(uip_connr->tcpstateflags & UIP_STOPPED)) { - uip_flags |= UIP_NEWDATA; - uip_add_rcv_nxt(uip_len); - } - - /* Check if the available buffer space advertised by the other end - is smaller than the initial MSS for this connection. If so, we - set the current MSS to the window size to ensure that the - application does not send more data than the other end can - handle. - - If the remote host advertises a zero window, we set the MSS to - the initial MSS so that the application will send an entire MSS - of data. This data will not be acknowledged by the receiver, - and the application will retransmit it. This is called the - "persistent timer" and uses the retransmission mechanim. - */ - tmp16 = ((u16_t)BUF->wnd[0] << 8) + (u16_t)BUF->wnd[1]; - if(tmp16 > uip_connr->initialmss || - tmp16 == 0) { - tmp16 = uip_connr->initialmss; - } - uip_connr->mss = tmp16; - - /* If this packet constitutes an ACK for outstanding data (flagged - by the UIP_ACKDATA flag, we should call the application since it - might want to send more data. If the incoming packet had data - from the peer (as flagged by the UIP_NEWDATA flag), the - application must also be notified. - - When the application is called, the global variable uip_len - contains the length of the incoming data. The application can - access the incoming data through the global pointer - uip_appdata, which usually points UIP_IPTCPH_LEN + UIP_LLH_LEN - bytes into the uip_buf array. - - If the application wishes to send any data, this data should be - put into the uip_appdata and the length of the data should be - put into uip_len. If the application don't have any data to - send, uip_len must be set to 0. */ - if(uip_flags & (UIP_NEWDATA | UIP_ACKDATA)) { - uip_slen = 0; - UIP_APPCALL(); - - appsend: - - if(uip_flags & UIP_ABORT) { - uip_slen = 0; - uip_connr->tcpstateflags = UIP_CLOSED; - BUF->flags = TCP_RST | TCP_ACK; - goto tcp_send_nodata; - } - - if(uip_flags & UIP_CLOSE) { - uip_slen = 0; - uip_connr->len = 1; - uip_connr->tcpstateflags = UIP_FIN_WAIT_1; - uip_connr->nrtx = 0; - BUF->flags = TCP_FIN | TCP_ACK; - goto tcp_send_nodata; - } - - /* If uip_slen > 0, the application has data to be sent. */ - if(uip_slen > 0) { - - /* If the connection has acknowledged data, the contents of - the ->len variable should be discarded. */ - if((uip_flags & UIP_ACKDATA) != 0) { - uip_connr->len = 0; - } - - /* If the ->len variable is non-zero the connection has - already data in transit and cannot send anymore right - now. */ - if(uip_connr->len == 0) { - - /* The application cannot send more than what is allowed by - the mss (the minumum of the MSS and the available - window). */ - if(uip_slen > uip_connr->mss) { - uip_slen = uip_connr->mss; - } - - /* Remember how much data we send out now so that we know - when everything has been acknowledged. */ - uip_connr->len = uip_slen; - } else { - - /* If the application already had unacknowledged data, we - make sure that the application does not send (i.e., - retransmit) out more than it previously sent out. */ - uip_slen = uip_connr->len; - } - } - uip_connr->nrtx = 0; - apprexmit: - uip_appdata = uip_sappdata; - - /* If the application has data to be sent, or if the incoming - packet had new data in it, we must send out a packet. */ - if(uip_slen > 0 && uip_connr->len > 0) { - /* Add the length of the IP and TCP headers. */ - uip_len = uip_connr->len + UIP_TCPIP_HLEN; - /* We always set the ACK flag in response packets. */ - BUF->flags = TCP_ACK | TCP_PSH; - /* Send the packet. */ - goto tcp_send_noopts; - } - /* If there is no data to send, just send out a pure ACK if - there is newdata. */ - if(uip_flags & UIP_NEWDATA) { - uip_len = UIP_TCPIP_HLEN; - BUF->flags = TCP_ACK; - goto tcp_send_noopts; - } - } - goto drop; - case UIP_LAST_ACK: - /* We can close this connection if the peer has acknowledged our - FIN. This is indicated by the UIP_ACKDATA flag. */ - if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_CLOSED; - uip_flags = UIP_CLOSE; - UIP_APPCALL(); - } - break; - - case UIP_FIN_WAIT_1: - /* The application has closed the connection, but the remote host - hasn't closed its end yet. Thus we do nothing but wait for a - FIN from the other side. */ - if(uip_len > 0) { - uip_add_rcv_nxt(uip_len); - } - if(BUF->flags & TCP_FIN) { - if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_TIME_WAIT; - uip_connr->timer = 0; - uip_connr->len = 0; - } else { - uip_connr->tcpstateflags = UIP_CLOSING; - } - uip_add_rcv_nxt(1); - uip_flags = UIP_CLOSE; - UIP_APPCALL(); - goto tcp_send_ack; - } else if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_FIN_WAIT_2; - uip_connr->len = 0; - goto drop; - } - if(uip_len > 0) { - goto tcp_send_ack; - } - goto drop; - - case UIP_FIN_WAIT_2: - if(uip_len > 0) { - uip_add_rcv_nxt(uip_len); - } - if(BUF->flags & TCP_FIN) { - uip_connr->tcpstateflags = UIP_TIME_WAIT; - uip_connr->timer = 0; - uip_add_rcv_nxt(1); - uip_flags = UIP_CLOSE; - UIP_APPCALL(); - goto tcp_send_ack; - } - if(uip_len > 0) { - goto tcp_send_ack; - } - goto drop; - - case UIP_TIME_WAIT: - goto tcp_send_ack; - - case UIP_CLOSING: - if(uip_flags & UIP_ACKDATA) { - uip_connr->tcpstateflags = UIP_TIME_WAIT; - uip_connr->timer = 0; - } - } - goto drop; - - - /* We jump here when we are ready to send the packet, and just want - to set the appropriate TCP sequence numbers in the TCP header. */ - tcp_send_ack: - BUF->flags = TCP_ACK; - tcp_send_nodata: - uip_len = UIP_IPTCPH_LEN; - tcp_send_noopts: - BUF->tcpoffset = (UIP_TCPH_LEN / 4) << 4; - tcp_send: - /* We're done with the input processing. We are now ready to send a - reply. Our job is to fill in all the fields of the TCP and IP - headers before calculating the checksum and finally send the - packet. */ - BUF->ackno[0] = uip_connr->rcv_nxt[0]; - BUF->ackno[1] = uip_connr->rcv_nxt[1]; - BUF->ackno[2] = uip_connr->rcv_nxt[2]; - BUF->ackno[3] = uip_connr->rcv_nxt[3]; - - BUF->seqno[0] = uip_connr->snd_nxt[0]; - BUF->seqno[1] = uip_connr->snd_nxt[1]; - BUF->seqno[2] = uip_connr->snd_nxt[2]; - BUF->seqno[3] = uip_connr->snd_nxt[3]; - - BUF->proto = UIP_PROTO_TCP; - - BUF->srcport = uip_connr->lport; - BUF->destport = uip_connr->rport; - - uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); - uip_ipaddr_copy(BUF->destipaddr, uip_connr->ripaddr); - - if(uip_connr->tcpstateflags & UIP_STOPPED) { - /* If the connection has issued uip_stop(), we advertise a zero - window so that the remote host will stop sending data. */ - BUF->wnd[0] = BUF->wnd[1] = 0; - } else { - BUF->wnd[0] = ((UIP_RECEIVE_WINDOW) >> 8); - BUF->wnd[1] = ((UIP_RECEIVE_WINDOW) & 0xff); - } - - tcp_send_noconn: - BUF->ttl = UIP_TTL; -#if UIP_CONF_IPV6 - /* For IPv6, the IP length field does not include the IPv6 IP header - length. */ - BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); - BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); -#else /* UIP_CONF_IPV6 */ - BUF->len[0] = (uip_len >> 8); - BUF->len[1] = (uip_len & 0xff); -#endif /* UIP_CONF_IPV6 */ - - BUF->urgp[0] = BUF->urgp[1] = 0; - - /* Calculate TCP checksum. */ - BUF->tcpchksum = 0; - BUF->tcpchksum = ~(uip_tcpchksum()); - - ip_send_nolen: - -#if UIP_CONF_IPV6 - BUF->vtc = 0x60; - BUF->tcflow = 0x00; - BUF->flow = 0x00; -#else /* UIP_CONF_IPV6 */ - BUF->vhl = 0x45; - BUF->tos = 0; - BUF->ipoffset[0] = BUF->ipoffset[1] = 0; - ++ipid; - BUF->ipid[0] = ipid >> 8; - BUF->ipid[1] = ipid & 0xff; - /* Calculate IP checksum. */ - BUF->ipchksum = 0; - BUF->ipchksum = ~(uip_ipchksum()); - DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum()); -#endif /* UIP_CONF_IPV6 */ - - UIP_STAT(++uip_stat.tcp.sent); - send: - DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len, - (BUF->len[0] << 8) | BUF->len[1]); - - UIP_STAT(++uip_stat.ip.sent); - /* Return and let the caller do the actual transmission. */ - uip_flags = 0; - return; - drop: - uip_len = 0; - uip_flags = 0; - return; -} -/*---------------------------------------------------------------------------*/ -u16_t -htons(u16_t val) -{ - return HTONS(val); -} -/*---------------------------------------------------------------------------*/ -void -uip_send(const void *data, int len) -{ - if(len > 0) { - uip_slen = len; - if(data != uip_sappdata) { - memcpy(uip_sappdata, (data), uip_slen); - } - } -} -/** @} */ diff --git a/bundles/uip/uip/uip.h b/bundles/uip/uip/uip.h deleted file mode 100644 index 4216e9b8..00000000 --- a/bundles/uip/uip/uip.h +++ /dev/null @@ -1,1603 +0,0 @@ - -/** - * \addtogroup uip - * @{ - */ - -/** - * \file - * Header file for the uIP TCP/IP stack. - * \author Adam Dunkels - * - * The uIP TCP/IP stack header file contains definitions for a number - * of C macros that are used by uIP programs as well as internal uIP - * structures, TCP/IP header structures and function declarations. - * - */ - - -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: uip.h,v 1.40 2006/06/08 07:12:07 adam Exp $ - * - */ - -#ifndef __UIP_H__ -#define __UIP_H__ - -#include "uipopt.h" - -/** - * Repressentation of an IP address. - * - */ -typedef u16_t uip_ip4addr_t[2]; -typedef u16_t uip_ip6addr_t[8]; -#if UIP_CONF_IPV6 -typedef uip_ip6addr_t uip_ipaddr_t; -#else /* UIP_CONF_IPV6 */ -typedef uip_ip4addr_t uip_ipaddr_t; -#endif /* UIP_CONF_IPV6 */ - -/*---------------------------------------------------------------------------*/ -/* First, the functions that should be called from the - * system. Initialization, the periodic timer and incoming packets are - * handled by the following three functions. - */ - -/** - * \defgroup uipconffunc uIP configuration functions - * @{ - * - * The uIP configuration functions are used for setting run-time - * parameters in uIP such as IP addresses. - */ - -/** - * Set the IP address of this host. - * - * The IP address is represented as a 4-byte array where the first - * octet of the IP address is put in the first member of the 4-byte - * array. - * - * Example: - \code - - uip_ipaddr_t addr; - - uip_ipaddr(&addr, 192,168,1,2); - uip_sethostaddr(&addr); - - \endcode - * \param addr A pointer to an IP address of type uip_ipaddr_t; - * - * \sa uip_ipaddr() - * - * \hideinitializer - */ -#define uip_sethostaddr(addr) uip_ipaddr_copy(uip_hostaddr, (addr)) - -/** - * Get the IP address of this host. - * - * The IP address is represented as a 4-byte array where the first - * octet of the IP address is put in the first member of the 4-byte - * array. - * - * Example: - \code - uip_ipaddr_t hostaddr; - - uip_gethostaddr(&hostaddr); - \endcode - * \param addr A pointer to a uip_ipaddr_t variable that will be - * filled in with the currently configured IP address. - * - * \hideinitializer - */ -#define uip_gethostaddr(addr) uip_ipaddr_copy((addr), uip_hostaddr) - -/** - * Set the default router's IP address. - * - * \param addr A pointer to a uip_ipaddr_t variable containing the IP - * address of the default router. - * - * \sa uip_ipaddr() - * - * \hideinitializer - */ -#define uip_setdraddr(addr) uip_ipaddr_copy(uip_draddr, (addr)) - -/** - * Set the netmask. - * - * \param addr A pointer to a uip_ipaddr_t variable containing the IP - * address of the netmask. - * - * \sa uip_ipaddr() - * - * \hideinitializer - */ -#define uip_setnetmask(addr) uip_ipaddr_copy(uip_netmask, (addr)) - - -/** - * Get the default router's IP address. - * - * \param addr A pointer to a uip_ipaddr_t variable that will be - * filled in with the IP address of the default router. - * - * \hideinitializer - */ -#define uip_getdraddr(addr) uip_ipaddr_copy((addr), uip_draddr) - -/** - * Get the netmask. - * - * \param addr A pointer to a uip_ipaddr_t variable that will be - * filled in with the value of the netmask. - * - * \hideinitializer - */ -#define uip_getnetmask(addr) uip_ipaddr_copy((addr), uip_netmask) - -/** @} */ - -/** - * \defgroup uipinit uIP initialization functions - * @{ - * - * The uIP initialization functions are used for booting uIP. - */ - -/** - * uIP initialization function. - * - * This function should be called at boot up to initilize the uIP - * TCP/IP stack. - */ -void uip_init(void); - -/** - * uIP initialization function. - * - * This function may be used at boot time to set the initial ip_id. - */ -void uip_setipid(u16_t id); - -/** @} */ - -/** - * \defgroup uipdevfunc uIP device driver functions - * @{ - * - * These functions are used by a network device driver for interacting - * with uIP. - */ - -/** - * Process an incoming packet. - * - * This function should be called when the device driver has received - * a packet from the network. The packet from the device driver must - * be present in the uip_buf buffer, and the length of the packet - * should be placed in the uip_len variable. - * - * When the function returns, there may be an outbound packet placed - * in the uip_buf packet buffer. If so, the uip_len variable is set to - * the length of the packet. If no packet is to be sent out, the - * uip_len variable is set to 0. - * - * The usual way of calling the function is presented by the source - * code below. - \code - uip_len = devicedriver_poll(); - if(uip_len > 0) { - uip_input(); - if(uip_len > 0) { - devicedriver_send(); - } - } - \endcode - * - * \note If you are writing a uIP device driver that needs ARP - * (Address Resolution Protocol), e.g., when running uIP over - * Ethernet, you will need to call the uIP ARP code before calling - * this function: - \code - #define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - uip_len = ethernet_devicedrver_poll(); - if(uip_len > 0) { - if(BUF->type == HTONS(UIP_ETHTYPE_IP)) { - uip_arp_ipin(); - uip_input(); - if(uip_len > 0) { - uip_arp_out(); - ethernet_devicedriver_send(); - } - } else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - if(uip_len > 0) { - ethernet_devicedriver_send(); - } - } - \endcode - * - * \hideinitializer - */ -#define uip_input() uip_process(UIP_DATA) - -/** - * Periodic processing for a connection identified by its number. - * - * This function does the necessary periodic processing (timers, - * polling) for a uIP TCP conneciton, and should be called when the - * periodic uIP timer goes off. It should be called for every - * connection, regardless of whether they are open of closed. - * - * When the function returns, it may have an outbound packet waiting - * for service in the uIP packet buffer, and if so the uip_len - * variable is set to a value larger than zero. The device driver - * should be called to send out the packet. - * - * The ususal way of calling the function is through a for() loop like - * this: - \code - for(i = 0; i < UIP_CONNS; ++i) { - uip_periodic(i); - if(uip_len > 0) { - devicedriver_send(); - } - } - \endcode - * - * \note If you are writing a uIP device driver that needs ARP - * (Address Resolution Protocol), e.g., when running uIP over - * Ethernet, you will need to call the uip_arp_out() function before - * calling the device driver: - \code - for(i = 0; i < UIP_CONNS; ++i) { - uip_periodic(i); - if(uip_len > 0) { - uip_arp_out(); - ethernet_devicedriver_send(); - } - } - \endcode - * - * \param conn The number of the connection which is to be periodically polled. - * - * \hideinitializer - */ -#define uip_periodic(conn) do { uip_conn = &uip_conns[conn]; \ - uip_process(UIP_TIMER); } while (0) - -/** - * - * - */ -#define uip_conn_active(conn) (uip_conns[conn].tcpstateflags != UIP_CLOSED) - -/** - * Perform periodic processing for a connection identified by a pointer - * to its structure. - * - * Same as uip_periodic() but takes a pointer to the actual uip_conn - * struct instead of an integer as its argument. This function can be - * used to force periodic processing of a specific connection. - * - * \param conn A pointer to the uip_conn struct for the connection to - * be processed. - * - * \hideinitializer - */ -#define uip_periodic_conn(conn) do { uip_conn = conn; \ - uip_process(UIP_TIMER); } while (0) - -/** - * Reuqest that a particular connection should be polled. - * - * Similar to uip_periodic_conn() but does not perform any timer - * processing. The application is polled for new data. - * - * \param conn A pointer to the uip_conn struct for the connection to - * be processed. - * - * \hideinitializer - */ -#define uip_poll_conn(conn) do { uip_conn = conn; \ - uip_process(UIP_POLL_REQUEST); } while (0) - - -#if UIP_UDP -/** - * Periodic processing for a UDP connection identified by its number. - * - * This function is essentially the same as uip_periodic(), but for - * UDP connections. It is called in a similar fashion as the - * uip_periodic() function: - \code - for(i = 0; i < UIP_UDP_CONNS; i++) { - uip_udp_periodic(i); - if(uip_len > 0) { - devicedriver_send(); - } - } - \endcode - * - * \note As for the uip_periodic() function, special care has to be - * taken when using uIP together with ARP and Ethernet: - \code - for(i = 0; i < UIP_UDP_CONNS; i++) { - uip_udp_periodic(i); - if(uip_len > 0) { - uip_arp_out(); - ethernet_devicedriver_send(); - } - } - \endcode - * - * \param conn The number of the UDP connection to be processed. - * - * \hideinitializer - */ -#define uip_udp_periodic(conn) do { uip_udp_conn = &uip_udp_conns[conn]; \ - uip_process(UIP_UDP_TIMER); } while (0) - -/** - * Periodic processing for a UDP connection identified by a pointer to - * its structure. - * - * Same as uip_udp_periodic() but takes a pointer to the actual - * uip_conn struct instead of an integer as its argument. This - * function can be used to force periodic processing of a specific - * connection. - * - * \param conn A pointer to the uip_udp_conn struct for the connection - * to be processed. - * - * \hideinitializer - */ -#define uip_udp_periodic_conn(conn) do { uip_udp_conn = conn; \ - uip_process(UIP_UDP_TIMER); } while (0) - - -#endif /* UIP_UDP */ - -/** - * The uIP packet buffer. - * - * The uip_buf array is used to hold incoming and outgoing - * packets. The device driver should place incoming data into this - * buffer. When sending data, the device driver should read the link - * level headers and the TCP/IP headers from this buffer. The size of - * the link level headers is configured by the UIP_LLH_LEN define. - * - * \note The application data need not be placed in this buffer, so - * the device driver must read it from the place pointed to by the - * uip_appdata pointer as illustrated by the following example: - \code - void - devicedriver_send(void) - { - hwsend(&uip_buf[0], UIP_LLH_LEN); - if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) { - hwsend(&uip_buf[UIP_LLH_LEN], uip_len - UIP_LLH_LEN); - } else { - hwsend(&uip_buf[UIP_LLH_LEN], UIP_TCPIP_HLEN); - hwsend(uip_appdata, uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN); - } - } - \endcode - */ -#ifndef UIP_CONF_EXTERNAL_BUFFER -extern u8_t uip_buf[UIP_BUFSIZE+2]; -#endif /* UIP_CONF_EXTERNAL_BUFFER */ - -/** @} */ - -/*---------------------------------------------------------------------------*/ -/* Functions that are used by the uIP application program. Opening and - * closing connections, sending and receiving data, etc. is all - * handled by the functions below. -*/ -/** - * \defgroup uipappfunc uIP application functions - * @{ - * - * Functions used by an application running of top of uIP. - */ - -/** - * Start listening to the specified port. - * - * \note Since this function expects the port number in network byte - * order, a conversion using HTONS() or htons() is necessary. - * - \code - uip_listen(HTONS(80)); - \endcode - * - * \param port A 16-bit port number in network byte order. - */ -void uip_listen(u16_t port); - -/** - * Stop listening to the specified port. - * - * \note Since this function expects the port number in network byte - * order, a conversion using HTONS() or htons() is necessary. - * - \code - uip_unlisten(HTONS(80)); - \endcode - * - * \param port A 16-bit port number in network byte order. - */ -void uip_unlisten(u16_t port); - -/** - * Connect to a remote host using TCP. - * - * This function is used to start a new connection to the specified - * port on the specied host. It allocates a new connection identifier, - * sets the connection to the SYN_SENT state and sets the - * retransmission timer to 0. This will cause a TCP SYN segment to be - * sent out the next time this connection is periodically processed, - * which usually is done within 0.5 seconds after the call to - * uip_connect(). - * - * \note This function is avaliable only if support for active open - * has been configured by defining UIP_ACTIVE_OPEN to 1 in uipopt.h. - * - * \note Since this function requires the port number to be in network - * byte order, a conversion using HTONS() or htons() is necessary. - * - \code - uip_ipaddr_t ipaddr; - - uip_ipaddr(&ipaddr, 192,168,1,2); - uip_connect(&ipaddr, HTONS(80)); - \endcode - * - * \param ripaddr The IP address of the remote hot. - * - * \param port A 16-bit port number in network byte order. - * - * \return A pointer to the uIP connection identifier for the new connection, - * or NULL if no connection could be allocated. - * - */ -struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port); - - - -/** - * \internal - * - * Check if a connection has outstanding (i.e., unacknowledged) data. - * - * \param conn A pointer to the uip_conn structure for the connection. - * - * \hideinitializer - */ -#define uip_outstanding(conn) ((conn)->len) - -/** - * Send data on the current connection. - * - * This function is used to send out a single segment of TCP - * data. Only applications that have been invoked by uIP for event - * processing can send data. - * - * The amount of data that actually is sent out after a call to this - * funcion is determined by the maximum amount of data TCP allows. uIP - * will automatically crop the data so that only the appropriate - * amount of data is sent. The function uip_mss() can be used to query - * uIP for the amount of data that actually will be sent. - * - * \note This function does not guarantee that the sent data will - * arrive at the destination. If the data is lost in the network, the - * application will be invoked with the uip_rexmit() event being - * set. The application will then have to resend the data using this - * function. - * - * \param data A pointer to the data which is to be sent. - * - * \param len The maximum amount of data bytes to be sent. - * - * \hideinitializer - */ -void uip_send(const void *data, int len); - -/** - * The length of any incoming data that is currently avaliable (if avaliable) - * in the uip_appdata buffer. - * - * The test function uip_data() must first be used to check if there - * is any data available at all. - * - * \hideinitializer - */ -/*void uip_datalen(void);*/ -#define uip_datalen() uip_len - -/** - * The length of any out-of-band data (urgent data) that has arrived - * on the connection. - * - * \note The configuration parameter UIP_URGDATA must be set for this - * function to be enabled. - * - * \hideinitializer - */ -#define uip_urgdatalen() uip_urglen - -/** - * Close the current connection. - * - * This function will close the current connection in a nice way. - * - * \hideinitializer - */ -#define uip_close() (uip_flags = UIP_CLOSE) - -/** - * Abort the current connection. - * - * This function will abort (reset) the current connection, and is - * usually used when an error has occured that prevents using the - * uip_close() function. - * - * \hideinitializer - */ -#define uip_abort() (uip_flags = UIP_ABORT) - -/** - * Tell the sending host to stop sending data. - * - * This function will close our receiver's window so that we stop - * receiving data for the current connection. - * - * \hideinitializer - */ -#define uip_stop() (uip_conn->tcpstateflags |= UIP_STOPPED) - -/** - * Find out if the current connection has been previously stopped with - * uip_stop(). - * - * \hideinitializer - */ -#define uip_stopped(conn) ((conn)->tcpstateflags & UIP_STOPPED) - -/** - * Restart the current connection, if is has previously been stopped - * with uip_stop(). - * - * This function will open the receiver's window again so that we - * start receiving data for the current connection. - * - * \hideinitializer - */ -#define uip_restart() do { uip_flags |= UIP_NEWDATA; \ - uip_conn->tcpstateflags &= ~UIP_STOPPED; \ - } while(0) - - -/* uIP tests that can be made to determine in what state the current - connection is, and what the application function should do. */ - -/** - * Is the current connection a UDP connection? - * - * This function checks whether the current connection is a UDP connection. - * - * \hideinitializer - * - */ -#define uip_udpconnection() (uip_conn == NULL) - -/** - * Is new incoming data available? - * - * Will reduce to non-zero if there is new data for the application - * present at the uip_appdata pointer. The size of the data is - * avaliable through the uip_len variable. - * - * \hideinitializer - */ -#define uip_newdata() (uip_flags & UIP_NEWDATA) - -/** - * Has previously sent data been acknowledged? - * - * Will reduce to non-zero if the previously sent data has been - * acknowledged by the remote host. This means that the application - * can send new data. - * - * \hideinitializer - */ -#define uip_acked() (uip_flags & UIP_ACKDATA) - -/** - * Has the connection just been connected? - * - * Reduces to non-zero if the current connection has been connected to - * a remote host. This will happen both if the connection has been - * actively opened (with uip_connect()) or passively opened (with - * uip_listen()). - * - * \hideinitializer - */ -#define uip_connected() (uip_flags & UIP_CONNECTED) - -/** - * Has the connection been closed by the other end? - * - * Is non-zero if the connection has been closed by the remote - * host. The application may then do the necessary clean-ups. - * - * \hideinitializer - */ -#define uip_closed() (uip_flags & UIP_CLOSE) - -/** - * Has the connection been aborted by the other end? - * - * Non-zero if the current connection has been aborted (reset) by the - * remote host. - * - * \hideinitializer - */ -#define uip_aborted() (uip_flags & UIP_ABORT) - -/** - * Has the connection timed out? - * - * Non-zero if the current connection has been aborted due to too many - * retransmissions. - * - * \hideinitializer - */ -#define uip_timedout() (uip_flags & UIP_TIMEDOUT) - -/** - * Do we need to retransmit previously data? - * - * Reduces to non-zero if the previously sent data has been lost in - * the network, and the application should retransmit it. The - * application should send the exact same data as it did the last - * time, using the uip_send() function. - * - * \hideinitializer - */ -#define uip_rexmit() (uip_flags & UIP_REXMIT) - -/** - * Is the connection being polled by uIP? - * - * Is non-zero if the reason the application is invoked is that the - * current connection has been idle for a while and should be - * polled. - * - * The polling event can be used for sending data without having to - * wait for the remote host to send data. - * - * \hideinitializer - */ -#define uip_poll() (uip_flags & UIP_POLL) - -/** - * Get the initial maxium segment size (MSS) of the current - * connection. - * - * \hideinitializer - */ -#define uip_initialmss() (uip_conn->initialmss) - -/** - * Get the current maxium segment size that can be sent on the current - * connection. - * - * The current maxiumum segment size that can be sent on the - * connection is computed from the receiver's window and the MSS of - * the connection (which also is available by calling - * uip_initialmss()). - * - * \hideinitializer - */ -#define uip_mss() (uip_conn->mss) - -/** - * Set up a new UDP connection. - * - * This function sets up a new UDP connection. The function will - * automatically allocate an unused local port for the new - * connection. However, another port can be chosen by using the - * uip_udp_bind() call, after the uip_udp_new() function has been - * called. - * - * Example: - \code - uip_ipaddr_t addr; - struct uip_udp_conn *c; - - uip_ipaddr(&addr, 192,168,2,1); - c = uip_udp_new(&addr, HTONS(12345)); - if(c != NULL) { - uip_udp_bind(c, HTONS(12344)); - } - \endcode - * \param ripaddr The IP address of the remote host. - * - * \param rport The remote port number in network byte order. - * - * \return The uip_udp_conn structure for the new connection or NULL - * if no connection could be allocated. - */ -struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport); - -/** - * Removed a UDP connection. - * - * \param conn A pointer to the uip_udp_conn structure for the connection. - * - * \hideinitializer - */ -#define uip_udp_remove(conn) (conn)->lport = 0 - -/** - * Bind a UDP connection to a local port. - * - * \param conn A pointer to the uip_udp_conn structure for the - * connection. - * - * \param port The local port number, in network byte order. - * - * \hideinitializer - */ -#define uip_udp_bind(conn, port) (conn)->lport = port - -/** - * Send a UDP datagram of length len on the current connection. - * - * This function can only be called in response to a UDP event (poll - * or newdata). The data must be present in the uip_buf buffer, at the - * place pointed to by the uip_appdata pointer. - * - * \param len The length of the data in the uip_buf buffer. - * - * \hideinitializer - */ -#define uip_udp_send(len) uip_send((char *)uip_appdata, len) - -/** @} */ - -/* uIP convenience and converting functions. */ - -/** - * \defgroup uipconvfunc uIP conversion functions - * @{ - * - * These functions can be used for converting between different data - * formats used by uIP. - */ - -/** - * Construct an IP address from four bytes. - * - * This function constructs an IP address of the type that uIP handles - * internally from four bytes. The function is handy for specifying IP - * addresses to use with e.g. the uip_connect() function. - * - * Example: - \code - uip_ipaddr_t ipaddr; - struct uip_conn *c; - - uip_ipaddr(&ipaddr, 192,168,1,2); - c = uip_connect(&ipaddr, HTONS(80)); - \endcode - * - * \param addr A pointer to a uip_ipaddr_t variable that will be - * filled in with the IP address. - * - * \param addr0 The first octet of the IP address. - * \param addr1 The second octet of the IP address. - * \param addr2 The third octet of the IP address. - * \param addr3 The forth octet of the IP address. - * - * \hideinitializer - */ -#define uip_ipaddr(addr, addr0,addr1,addr2,addr3) do { \ - ((u16_t *)(addr))[0] = htons(((addr0) << 8) | (addr1)); \ - ((u16_t *)(addr))[1] = htons(((addr2) << 8) | (addr3)); \ - } while(0) - -/** - * Construct an IPv6 address from eight 16-bit words. - * - * This function constructs an IPv6 address. - * - * \hideinitializer - */ -#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \ - ((u16_t *)(addr))[0] = HTONS((addr0)); \ - ((u16_t *)(addr))[1] = HTONS((addr1)); \ - ((u16_t *)(addr))[2] = HTONS((addr2)); \ - ((u16_t *)(addr))[3] = HTONS((addr3)); \ - ((u16_t *)(addr))[4] = HTONS((addr4)); \ - ((u16_t *)(addr))[5] = HTONS((addr5)); \ - ((u16_t *)(addr))[6] = HTONS((addr6)); \ - ((u16_t *)(addr))[7] = HTONS((addr7)); \ - } while(0) - -/** - * Copy an IP address to another IP address. - * - * Copies an IP address from one place to another. - * - * Example: - \code - uip_ipaddr_t ipaddr1, ipaddr2; - - uip_ipaddr(&ipaddr1, 192,16,1,2); - uip_ipaddr_copy(&ipaddr2, &ipaddr1); - \endcode - * - * \param dest The destination for the copy. - * \param src The source from where to copy. - * - * \hideinitializer - */ -#if !UIP_CONF_IPV6 -#define uip_ipaddr_copy(dest, src) do { \ - ((u16_t *)dest)[0] = ((u16_t *)src)[0]; \ - ((u16_t *)dest)[1] = ((u16_t *)src)[1]; \ - } while(0) -#else /* !UIP_CONF_IPV6 */ -#define uip_ipaddr_copy(dest, src) memcpy(dest, src, sizeof(uip_ip6addr_t)) -#endif /* !UIP_CONF_IPV6 */ - -/** - * Compare two IP addresses - * - * Compares two IP addresses. - * - * Example: - \code - uip_ipaddr_t ipaddr1, ipaddr2; - - uip_ipaddr(&ipaddr1, 192,16,1,2); - if(uip_ipaddr_cmp(&ipaddr2, &ipaddr1)) { - printf("They are the same"); - } - \endcode - * - * \param addr1 The first IP address. - * \param addr2 The second IP address. - * - * \hideinitializer - */ -#if !UIP_CONF_IPV6 -#define uip_ipaddr_cmp(addr1, addr2) (((u16_t *)addr1)[0] == ((u16_t *)addr2)[0] && \ - ((u16_t *)addr1)[1] == ((u16_t *)addr2)[1]) -#else /* !UIP_CONF_IPV6 */ -#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0) -#endif /* !UIP_CONF_IPV6 */ - -/** - * Compare two IP addresses with netmasks - * - * Compares two IP addresses with netmasks. The masks are used to mask - * out the bits that are to be compared. - * - * Example: - \code - uip_ipaddr_t ipaddr1, ipaddr2, mask; - - uip_ipaddr(&mask, 255,255,255,0); - uip_ipaddr(&ipaddr1, 192,16,1,2); - uip_ipaddr(&ipaddr2, 192,16,1,3); - if(uip_ipaddr_maskcmp(&ipaddr1, &ipaddr2, &mask)) { - printf("They are the same"); - } - \endcode - * - * \param addr1 The first IP address. - * \param addr2 The second IP address. - * \param mask The netmask. - * - * \hideinitializer - */ -#define uip_ipaddr_maskcmp(addr1, addr2, mask) \ - (((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \ - (((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \ - ((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \ - (((u16_t *)addr2)[1] & ((u16_t *)mask)[1]))) - - -/** - * Mask out the network part of an IP address. - * - * Masks out the network part of an IP address, given the address and - * the netmask. - * - * Example: - \code - uip_ipaddr_t ipaddr1, ipaddr2, netmask; - - uip_ipaddr(&ipaddr1, 192,16,1,2); - uip_ipaddr(&netmask, 255,255,255,0); - uip_ipaddr_mask(&ipaddr2, &ipaddr1, &netmask); - \endcode - * - * In the example above, the variable "ipaddr2" will contain the IP - * address 192.168.1.0. - * - * \param dest Where the result is to be placed. - * \param src The IP address. - * \param mask The netmask. - * - * \hideinitializer - */ -#define uip_ipaddr_mask(dest, src, mask) do { \ - ((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \ - ((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \ - } while(0) - -/** - * Pick the first octet of an IP address. - * - * Picks out the first octet of an IP address. - * - * Example: - \code - uip_ipaddr_t ipaddr; - u8_t octet; - - uip_ipaddr(&ipaddr, 1,2,3,4); - octet = uip_ipaddr1(&ipaddr); - \endcode - * - * In the example above, the variable "octet" will contain the value 1. - * - * \hideinitializer - */ -#define uip_ipaddr1(addr) (htons(((u16_t *)(addr))[0]) >> 8) - -/** - * Pick the second octet of an IP address. - * - * Picks out the second octet of an IP address. - * - * Example: - \code - uip_ipaddr_t ipaddr; - u8_t octet; - - uip_ipaddr(&ipaddr, 1,2,3,4); - octet = uip_ipaddr2(&ipaddr); - \endcode - * - * In the example above, the variable "octet" will contain the value 2. - * - * \hideinitializer - */ -#define uip_ipaddr2(addr) (htons(((u16_t *)(addr))[0]) & 0xff) - -/** - * Pick the third octet of an IP address. - * - * Picks out the third octet of an IP address. - * - * Example: - \code - uip_ipaddr_t ipaddr; - u8_t octet; - - uip_ipaddr(&ipaddr, 1,2,3,4); - octet = uip_ipaddr3(&ipaddr); - \endcode - * - * In the example above, the variable "octet" will contain the value 3. - * - * \hideinitializer - */ -#define uip_ipaddr3(addr) (htons(((u16_t *)(addr))[1]) >> 8) - -/** - * Pick the fourth octet of an IP address. - * - * Picks out the fourth octet of an IP address. - * - * Example: - \code - uip_ipaddr_t ipaddr; - u8_t octet; - - uip_ipaddr(&ipaddr, 1,2,3,4); - octet = uip_ipaddr4(&ipaddr); - \endcode - * - * In the example above, the variable "octet" will contain the value 4. - * - * \hideinitializer - */ -#define uip_ipaddr4(addr) (htons(((u16_t *)(addr))[1]) & 0xff) - -/** - * Convert 16-bit quantity from host byte order to network byte order. - * - * This macro is primarily used for converting constants from host - * byte order to network byte order. For converting variables to - * network byte order, use the htons() function instead. - * - * \hideinitializer - */ -#ifndef HTONS -# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN -# define HTONS(n) (n) -# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ -# define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8)) -# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ -#else -#error "HTONS already defined!" -#endif /* HTONS */ - -/** - * Convert 16-bit quantity from host byte order to network byte order. - * - * This function is primarily used for converting variables from host - * byte order to network byte order. For converting constants to - * network byte order, use the HTONS() macro instead. - */ -#ifndef htons -u16_t htons(u16_t val); -#endif /* htons */ -#ifndef ntohs -#define ntohs htons -#endif - -/** @} */ - -/** - * Pointer to the application data in the packet buffer. - * - * This pointer points to the application data when the application is - * called. If the application wishes to send data, the application may - * use this space to write the data into before calling uip_send(). - */ -extern void *uip_appdata; - -#if UIP_URGDATA > 0 -/* u8_t *uip_urgdata: - * - * This pointer points to any urgent data that has been received. Only - * present if compiled with support for urgent data (UIP_URGDATA). - */ -extern void *uip_urgdata; -#endif /* UIP_URGDATA > 0 */ - - -/** - * \defgroup uipdrivervars Variables used in uIP device drivers - * @{ - * - * uIP has a few global variables that are used in device drivers for - * uIP. - */ - -/** - * The length of the packet in the uip_buf buffer. - * - * The global variable uip_len holds the length of the packet in the - * uip_buf buffer. - * - * When the network device driver calls the uIP input function, - * uip_len should be set to the length of the packet in the uip_buf - * buffer. - * - * When sending packets, the device driver should use the contents of - * the uip_len variable to determine the length of the outgoing - * packet. - * - */ -extern u16_t uip_len; - -/** @} */ - -#if UIP_URGDATA > 0 -extern u16_t uip_urglen, uip_surglen; -#endif /* UIP_URGDATA > 0 */ - - -/** - * Representation of a uIP TCP connection. - * - * The uip_conn structure is used for identifying a connection. All - * but one field in the structure are to be considered read-only by an - * application. The only exception is the appstate field whos purpose - * is to let the application store application-specific state (e.g., - * file pointers) for the connection. The type of this field is - * configured in the "uipopt.h" header file. - */ -struct uip_conn { - uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */ - - u16_t lport; /**< The local TCP port, in network byte order. */ - u16_t rport; /**< The local remote TCP port, in network byte - order. */ - - u8_t rcv_nxt[4]; /**< The sequence number that we expect to - receive next. */ - u8_t snd_nxt[4]; /**< The sequence number that was last sent by - us. */ - u16_t len; /**< Length of the data that was previously sent. */ - u16_t mss; /**< Current maximum segment size for the - connection. */ - u16_t initialmss; /**< Initial maximum segment size for the - connection. */ - u8_t sa; /**< Retransmission time-out calculation state - variable. */ - u8_t sv; /**< Retransmission time-out calculation state - variable. */ - u8_t rto; /**< Retransmission time-out. */ - u8_t tcpstateflags; /**< TCP state and flags. */ - u8_t timer; /**< The retransmission timer. */ - u8_t nrtx; /**< The number of retransmissions for the last - segment sent. */ - - /** The application state. */ - uip_tcp_appstate_t appstate; -}; - - -/** - * Pointer to the current TCP connection. - * - * The uip_conn pointer can be used to access the current TCP - * connection. - */ -extern struct uip_conn *uip_conn; -/* The array containing all uIP connections. */ -extern struct uip_conn uip_conns[UIP_CONNS]; -/** - * \addtogroup uiparch - * @{ - */ - -/** - * 4-byte array used for the 32-bit sequence number calculations. - */ -extern u8_t uip_acc32[4]; - -/** @} */ - - -#if UIP_UDP -/** - * Representation of a uIP UDP connection. - */ -struct uip_udp_conn { - uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */ - u16_t lport; /**< The local port number in network byte order. */ - u16_t rport; /**< The remote port number in network byte order. */ - u8_t ttl; /**< Default time-to-live. */ - - /** The application state. */ - uip_udp_appstate_t appstate; -}; - -/** - * The current UDP connection. - */ -extern struct uip_udp_conn *uip_udp_conn; -extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; -#endif /* UIP_UDP */ - -/** - * The structure holding the TCP/IP statistics that are gathered if - * UIP_STATISTICS is set to 1. - * - */ -struct uip_stats { - struct { - uip_stats_t drop; /**< Number of dropped packets at the IP - layer. */ - uip_stats_t recv; /**< Number of received packets at the IP - layer. */ - uip_stats_t sent; /**< Number of sent packets at the IP - layer. */ - uip_stats_t vhlerr; /**< Number of packets dropped due to wrong - IP version or header length. */ - uip_stats_t hblenerr; /**< Number of packets dropped due to wrong - IP length, high byte. */ - uip_stats_t lblenerr; /**< Number of packets dropped due to wrong - IP length, low byte. */ - uip_stats_t fragerr; /**< Number of packets dropped since they - were IP fragments. */ - uip_stats_t chkerr; /**< Number of packets dropped due to IP - checksum errors. */ - uip_stats_t protoerr; /**< Number of packets dropped since they - were neither ICMP, UDP nor TCP. */ - } ip; /**< IP statistics. */ - struct { - uip_stats_t drop; /**< Number of dropped ICMP packets. */ - uip_stats_t recv; /**< Number of received ICMP packets. */ - uip_stats_t sent; /**< Number of sent ICMP packets. */ - uip_stats_t typeerr; /**< Number of ICMP packets with a wrong - type. */ - } icmp; /**< ICMP statistics. */ - struct { - uip_stats_t drop; /**< Number of dropped TCP segments. */ - uip_stats_t recv; /**< Number of recived TCP segments. */ - uip_stats_t sent; /**< Number of sent TCP segments. */ - uip_stats_t chkerr; /**< Number of TCP segments with a bad - checksum. */ - uip_stats_t ackerr; /**< Number of TCP segments with a bad ACK - number. */ - uip_stats_t rst; /**< Number of recevied TCP RST (reset) segments. */ - uip_stats_t rexmit; /**< Number of retransmitted TCP segments. */ - uip_stats_t syndrop; /**< Number of dropped SYNs due to too few - connections was avaliable. */ - uip_stats_t synrst; /**< Number of SYNs for closed ports, - triggering a RST. */ - } tcp; /**< TCP statistics. */ -#if UIP_UDP - struct { - uip_stats_t drop; /**< Number of dropped UDP segments. */ - uip_stats_t recv; /**< Number of recived UDP segments. */ - uip_stats_t sent; /**< Number of sent UDP segments. */ - uip_stats_t chkerr; /**< Number of UDP segments with a bad - checksum. */ - } udp; /**< UDP statistics. */ -#endif /* UIP_UDP */ -}; - -/** - * The uIP TCP/IP statistics. - * - * This is the variable in which the uIP TCP/IP statistics are gathered. - */ -extern struct uip_stats uip_stat; - - -/*---------------------------------------------------------------------------*/ -/* All the stuff below this point is internal to uIP and should not be - * used directly by an application or by a device driver. - */ -/*---------------------------------------------------------------------------*/ -/* u8_t uip_flags: - * - * When the application is called, uip_flags will contain the flags - * that are defined in this file. Please read below for more - * infomation. - */ -extern u8_t uip_flags; - -/* The following flags may be set in the global variable uip_flags - before calling the application callback. The UIP_ACKDATA, - UIP_NEWDATA, and UIP_CLOSE flags may both be set at the same time, - whereas the others are mutualy exclusive. Note that these flags - should *NOT* be accessed directly, but only through the uIP - functions/macros. */ - -#define UIP_ACKDATA 1 /* Signifies that the outstanding data was - acked and the application should send - out new data instead of retransmitting - the last data. */ -#define UIP_NEWDATA 2 /* Flags the fact that the peer has sent - us new data. */ -#define UIP_REXMIT 4 /* Tells the application to retransmit the - data that was last sent. */ -#define UIP_POLL 8 /* Used for polling the application, to - check if the application has data that - it wants to send. */ -#define UIP_CLOSE 16 /* The remote host has closed the - connection, thus the connection has - gone away. Or the application signals - that it wants to close the - connection. */ -#define UIP_ABORT 32 /* The remote host has aborted the - connection, thus the connection has - gone away. Or the application signals - that it wants to abort the - connection. */ -#define UIP_CONNECTED 64 /* We have got a connection from a remote - host and have set up a new connection - for it, or an active connection has - been successfully established. */ - -#define UIP_TIMEDOUT 128 /* The connection has been aborted due to - too many retransmissions. */ - -/* uip_process(flag): - * - * The actual uIP function which does all the work. - */ -void uip_process(u8_t flag); - -/* The following flags are passed as an argument to the uip_process() - function. They are used to distinguish between the two cases where - uip_process() is called. It can be called either because we have - incoming data that should be processed, or because the periodic - timer has fired. These values are never used directly, but only in - the macrose defined in this file. */ - -#define UIP_DATA 1 /* Tells uIP that there is incoming - data in the uip_buf buffer. The - length of the data is stored in the - global variable uip_len. */ -#define UIP_TIMER 2 /* Tells uIP that the periodic timer - has fired. */ -#define UIP_POLL_REQUEST 3 /* Tells uIP that a connection should - be polled. */ -#define UIP_UDP_SEND_CONN 4 /* Tells uIP that a UDP datagram - should be constructed in the - uip_buf buffer. */ -#if UIP_UDP -#define UIP_UDP_TIMER 5 -#endif /* UIP_UDP */ - -/* The TCP states used in the uip_conn->tcpstateflags. */ -#define UIP_CLOSED 0 -#define UIP_SYN_RCVD 1 -#define UIP_SYN_SENT 2 -#define UIP_ESTABLISHED 3 -#define UIP_FIN_WAIT_1 4 -#define UIP_FIN_WAIT_2 5 -#define UIP_CLOSING 6 -#define UIP_TIME_WAIT 7 -#define UIP_LAST_ACK 8 -#define UIP_TS_MASK 15 - -#define UIP_STOPPED 16 - -/* The TCP and IP headers. */ -struct uip_tcpip_hdr { -#if UIP_CONF_IPV6 - /* IPv6 header. */ - u8_t vtc, - tcflow; - u16_t flow; - u8_t len[2]; - u8_t proto, ttl; - uip_ip6addr_t srcipaddr, destipaddr; -#else /* UIP_CONF_IPV6 */ - /* IPv4 header. */ - u8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - u16_t ipchksum; - u16_t srcipaddr[2], - destipaddr[2]; -#endif /* UIP_CONF_IPV6 */ - - /* TCP header. */ - u16_t srcport, - destport; - u8_t seqno[4], - ackno[4], - tcpoffset, - flags, - wnd[2]; - u16_t tcpchksum; - u8_t urgp[2]; - u8_t optdata[4]; -}; - -/* The ICMP and IP headers. */ -struct uip_icmpip_hdr { -#if UIP_CONF_IPV6 - /* IPv6 header. */ - u8_t vtc, - tcf; - u16_t flow; - u8_t len[2]; - u8_t proto, ttl; - uip_ip6addr_t srcipaddr, destipaddr; -#else /* UIP_CONF_IPV6 */ - /* IPv4 header. */ - u8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - u16_t ipchksum; - u16_t srcipaddr[2], - destipaddr[2]; -#endif /* UIP_CONF_IPV6 */ - - /* ICMP (echo) header. */ - u8_t type, icode; - u16_t icmpchksum; -#if !UIP_CONF_IPV6 - u16_t id, seqno; -#else /* !UIP_CONF_IPV6 */ - u8_t flags, reserved1, reserved2, reserved3; - u8_t icmp6data[16]; - u8_t options[1]; -#endif /* !UIP_CONF_IPV6 */ -}; - - -/* The UDP and IP headers. */ -struct uip_udpip_hdr { -#if UIP_CONF_IPV6 - /* IPv6 header. */ - u8_t vtc, - tcf; - u16_t flow; - u8_t len[2]; - u8_t proto, ttl; - uip_ip6addr_t srcipaddr, destipaddr; -#else /* UIP_CONF_IPV6 */ - /* IP header. */ - u8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - u16_t ipchksum; - u16_t srcipaddr[2], - destipaddr[2]; -#endif /* UIP_CONF_IPV6 */ - - /* UDP header. */ - u16_t srcport, - destport; - u16_t udplen; - u16_t udpchksum; -}; - - - -/** - * The buffer size available for user data in the \ref uip_buf buffer. - * - * This macro holds the available size for user data in the \ref - * uip_buf buffer. The macro is intended to be used for checking - * bounds of available user data. - * - * Example: - \code - snprintf(uip_appdata, UIP_APPDATA_SIZE, "%u\n", i); - \endcode - * - * \hideinitializer - */ -#define UIP_APPDATA_SIZE (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) - - -#define UIP_PROTO_ICMP 1 -#define UIP_PROTO_TCP 6 -#define UIP_PROTO_UDP 17 -#define UIP_PROTO_ICMP6 58 - -/* Header sizes. */ -#if UIP_CONF_IPV6 -#define UIP_IPH_LEN 40 -#else /* UIP_CONF_IPV6 */ -#define UIP_IPH_LEN 20 /* Size of IP header */ -#endif /* UIP_CONF_IPV6 */ -#define UIP_UDPH_LEN 8 /* Size of UDP header */ -#define UIP_TCPH_LEN 20 /* Size of TCP header */ -#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) /* Size of IP + - UDP - header */ -#define UIP_IPTCPH_LEN (UIP_TCPH_LEN + UIP_IPH_LEN) /* Size of IP + - TCP - header */ -#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN - - -#if UIP_FIXEDADDR -extern const uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr; -#else /* UIP_FIXEDADDR */ -extern uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr; -#endif /* UIP_FIXEDADDR */ - - - -/** - * Representation of a 48-bit Ethernet address. - */ -struct uip_eth_addr { - u8_t addr[6]; -}; - -/** - * Calculate the Internet checksum over a buffer. - * - * The Internet checksum is the one's complement of the one's - * complement sum of all 16-bit words in the buffer. - * - * See RFC1071. - * - * \param buf A pointer to the buffer over which the checksum is to be - * computed. - * - * \param len The length of the buffer over which the checksum is to - * be computed. - * - * \return The Internet checksum of the buffer. - */ -u16_t uip_chksum(u16_t *buf, u16_t len); - -/** - * Calculate the IP header checksum of the packet header in uip_buf. - * - * The IP header checksum is the Internet checksum of the 20 bytes of - * the IP header. - * - * \return The IP header checksum of the IP header in the uip_buf - * buffer. - */ -u16_t uip_ipchksum(void); - -/** - * Calculate the TCP checksum of the packet in uip_buf and uip_appdata. - * - * The TCP checksum is the Internet checksum of data contents of the - * TCP segment, and a pseudo-header as defined in RFC793. - * - * \return The TCP checksum of the TCP segment in uip_buf and pointed - * to by uip_appdata. - */ -u16_t uip_tcpchksum(void); - -/** - * Calculate the UDP checksum of the packet in uip_buf and uip_appdata. - * - * The UDP checksum is the Internet checksum of data contents of the - * UDP segment, and a pseudo-header as defined in RFC768. - * - * \return The UDP checksum of the UDP segment in uip_buf and pointed - * to by uip_appdata. - */ -u16_t uip_udpchksum(void); - - -#endif /* __UIP_H__ */ - - -/** @} */ diff --git a/bundles/uip/uip/uip_arch.h b/bundles/uip/uip/uip_arch.h deleted file mode 100644 index 71fd84bf..00000000 --- a/bundles/uip/uip/uip_arch.h +++ /dev/null @@ -1,138 +0,0 @@ -/** - * \addtogroup uip - * {@ - */ - -/** - * \defgroup uiparch Architecture specific uIP functions - * @{ - * - * The functions in the architecture specific module implement the IP - * check sum and 32-bit additions. - * - * The IP checksum calculation is the most computationally expensive - * operation in the TCP/IP stack and it therefore pays off to - * implement this in efficient assembler. The purpose of the uip-arch - * module is to let the checksum functions to be implemented in - * architecture specific assembler. - * - */ - -/** - * \file - * Declarations of architecture specific functions. - * \author Adam Dunkels - */ - -/* - * Copyright (c) 2001, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: uip_arch.h,v 1.2 2006/06/07 09:15:19 adam Exp $ - * - */ - -#ifndef __UIP_ARCH_H__ -#define __UIP_ARCH_H__ - -#include "uip.h" - -/** - * Carry out a 32-bit addition. - * - * Because not all architectures for which uIP is intended has native - * 32-bit arithmetic, uIP uses an external C function for doing the - * required 32-bit additions in the TCP protocol processing. This - * function should add the two arguments and place the result in the - * global variable uip_acc32. - * - * \note The 32-bit integer pointed to by the op32 parameter and the - * result in the uip_acc32 variable are in network byte order (big - * endian). - * - * \param op32 A pointer to a 4-byte array representing a 32-bit - * integer in network byte order (big endian). - * - * \param op16 A 16-bit integer in host byte order. - */ -void uip_add32(u8_t *op32, u16_t op16); - -/** - * Calculate the Internet checksum over a buffer. - * - * The Internet checksum is the one's complement of the one's - * complement sum of all 16-bit words in the buffer. - * - * See RFC1071. - * - * \note This function is not called in the current version of uIP, - * but future versions might make use of it. - * - * \param buf A pointer to the buffer over which the checksum is to be - * computed. - * - * \param len The length of the buffer over which the checksum is to - * be computed. - * - * \return The Internet checksum of the buffer. - */ -u16_t uip_chksum(u16_t *buf, u16_t len); - -/** - * Calculate the IP header checksum of the packet header in uip_buf. - * - * The IP header checksum is the Internet checksum of the 20 bytes of - * the IP header. - * - * \return The IP header checksum of the IP header in the uip_buf - * buffer. - */ -u16_t uip_ipchksum(void); - -/** - * Calculate the TCP checksum of the packet in uip_buf and uip_appdata. - * - * The TCP checksum is the Internet checksum of data contents of the - * TCP segment, and a pseudo-header as defined in RFC793. - * - * \note The uip_appdata pointer that points to the packet data may - * point anywhere in memory, so it is not possible to simply calculate - * the Internet checksum of the contents of the uip_buf buffer. - * - * \return The TCP checksum of the TCP segment in uip_buf and pointed - * to by uip_appdata. - */ -u16_t uip_tcpchksum(void); - -u16_t uip_udpchksum(void); - -/** @} */ -/** @} */ - -#endif /* __UIP_ARCH_H__ */ diff --git a/bundles/uip/uip/uip_arp.c b/bundles/uip/uip/uip_arp.c deleted file mode 100644 index 75ade649..00000000 --- a/bundles/uip/uip/uip_arp.c +++ /dev/null @@ -1,423 +0,0 @@ -/** - * \addtogroup uip - * @{ - */ - -/** - * \defgroup uiparp uIP Address Resolution Protocol - * @{ - * - * The Address Resolution Protocol ARP is used for mapping between IP - * addresses and link level addresses such as the Ethernet MAC - * addresses. ARP uses broadcast queries to ask for the link level - * address of a known IP address and the host which is configured with - * the IP address for which the query was meant, will respond with its - * link level address. - * - * \note This ARP implementation only supports Ethernet. - */ - -/** - * \file - * Implementation of the ARP Address Resolution Protocol. - * \author Adam Dunkels - * - */ - -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: uip_arp.c,v 1.8 2006/06/02 23:36:21 adam Exp $ - * - */ - - -#include "uip_arp.h" - -#include - -struct arp_hdr { - struct uip_eth_hdr ethhdr; - u16_t hwtype; - u16_t protocol; - u8_t hwlen; - u8_t protolen; - u16_t opcode; - struct uip_eth_addr shwaddr; - u16_t sipaddr[2]; - struct uip_eth_addr dhwaddr; - u16_t dipaddr[2]; -}; - -struct ethip_hdr { - struct uip_eth_hdr ethhdr; - /* IP header. */ - u8_t vhl, - tos, - len[2], - ipid[2], - ipoffset[2], - ttl, - proto; - u16_t ipchksum; - u16_t srcipaddr[2], - destipaddr[2]; -}; - -#define ARP_REQUEST 1 -#define ARP_REPLY 2 - -#define ARP_HWTYPE_ETH 1 - -struct arp_entry { - u16_t ipaddr[2]; - struct uip_eth_addr ethaddr; - u8_t time; -}; - -static const struct uip_eth_addr broadcast_ethaddr = - {{0xff,0xff,0xff,0xff,0xff,0xff}}; -static const u16_t broadcast_ipaddr[2] = {0xffff,0xffff}; - -static struct arp_entry arp_table[UIP_ARPTAB_SIZE]; -static u16_t ipaddr[2]; -static u8_t i, c; - -static u8_t arptime; -static u8_t tmpage; - -#define BUF ((struct arp_hdr *)&uip_buf[0]) -#define IPBUF ((struct ethip_hdr *)&uip_buf[0]) -/*-----------------------------------------------------------------------------------*/ -/** - * Initialize the ARP module. - * - */ -/*-----------------------------------------------------------------------------------*/ -void -uip_arp_init(void) -{ - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - memset(arp_table[i].ipaddr, 0, 4); - } -} -/*-----------------------------------------------------------------------------------*/ -/** - * Periodic ARP processing function. - * - * This function performs periodic timer processing in the ARP module - * and should be called at regular intervals. The recommended interval - * is 10 seconds between the calls. - * - */ -/*-----------------------------------------------------------------------------------*/ -void -uip_arp_timer(void) -{ - struct arp_entry *tabptr; - - ++arptime; - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; - if((tabptr->ipaddr[0] | tabptr->ipaddr[1]) != 0 && - arptime - tabptr->time >= UIP_ARP_MAXAGE) { - memset(tabptr->ipaddr, 0, 4); - } - } - -} -/*-----------------------------------------------------------------------------------*/ -static void -uip_arp_update(u16_t *ipaddr, struct uip_eth_addr *ethaddr) -{ - register struct arp_entry *tabptr; - /* Walk through the ARP mapping table and try to find an entry to - update. If none is found, the IP -> MAC address mapping is - inserted in the ARP table. */ - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - - tabptr = &arp_table[i]; - /* Only check those entries that are actually in use. */ - if(tabptr->ipaddr[0] != 0 && - tabptr->ipaddr[1] != 0) { - - /* Check if the source IP address of the incoming packet matches - the IP address in this ARP table entry. */ - if(ipaddr[0] == tabptr->ipaddr[0] && - ipaddr[1] == tabptr->ipaddr[1]) { - - /* An old entry found, update this and return. */ - memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6); - tabptr->time = arptime; - - return; - } - } - } - - /* If we get here, no existing ARP table entry was found, so we - create one. */ - - /* First, we try to find an unused entry in the ARP table. */ - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; - if(tabptr->ipaddr[0] == 0 && - tabptr->ipaddr[1] == 0) { - break; - } - } - - /* If no unused entry is found, we try to find the oldest entry and - throw it away. */ - if(i == UIP_ARPTAB_SIZE) { - tmpage = 0; - c = 0; - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; - if(arptime - tabptr->time > tmpage) { - tmpage = arptime - tabptr->time; - c = i; - } - } - i = c; - tabptr = &arp_table[i]; - } - - /* Now, i is the ARP table entry which we will fill with the new - information. */ - memcpy(tabptr->ipaddr, ipaddr, 4); - memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6); - tabptr->time = arptime; -} -/*-----------------------------------------------------------------------------------*/ -/** - * ARP processing for incoming IP packets - * - * This function should be called by the device driver when an IP - * packet has been received. The function will check if the address is - * in the ARP cache, and if so the ARP cache entry will be - * refreshed. If no ARP cache entry was found, a new one is created. - * - * This function expects an IP packet with a prepended Ethernet header - * in the uip_buf[] buffer, and the length of the packet in the global - * variable uip_len. - */ -/*-----------------------------------------------------------------------------------*/ -#if 0 -void -uip_arp_ipin(void) -{ - uip_len -= sizeof(struct uip_eth_hdr); - - /* Only insert/update an entry if the source IP address of the - incoming IP packet comes from a host on the local network. */ - if((IPBUF->srcipaddr[0] & uip_netmask[0]) != - (uip_hostaddr[0] & uip_netmask[0])) { - return; - } - if((IPBUF->srcipaddr[1] & uip_netmask[1]) != - (uip_hostaddr[1] & uip_netmask[1])) { - return; - } - uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src)); - - return; -} -#endif /* 0 */ -/*-----------------------------------------------------------------------------------*/ -/** - * ARP processing for incoming ARP packets. - * - * This function should be called by the device driver when an ARP - * packet has been received. The function will act differently - * depending on the ARP packet type: if it is a reply for a request - * that we previously sent out, the ARP cache will be filled in with - * the values from the ARP reply. If the incoming ARP packet is an ARP - * request for our IP address, an ARP reply packet is created and put - * into the uip_buf[] buffer. - * - * When the function returns, the value of the global variable uip_len - * indicates whether the device driver should send out a packet or - * not. If uip_len is zero, no packet should be sent. If uip_len is - * non-zero, it contains the length of the outbound packet that is - * present in the uip_buf[] buffer. - * - * This function expects an ARP packet with a prepended Ethernet - * header in the uip_buf[] buffer, and the length of the packet in the - * global variable uip_len. - */ -/*-----------------------------------------------------------------------------------*/ -void -uip_arp_arpin(void) -{ - - if(uip_len < sizeof(struct arp_hdr)) { - uip_len = 0; - return; - } - uip_len = 0; - - switch(BUF->opcode) { - case HTONS(ARP_REQUEST): - /* ARP request. If it asked for our address, we send out a - reply. */ - if(uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr)) { - /* First, we register the one who made the request in our ARP - table, since it is likely that we will do more communication - with this host in the future. */ - uip_arp_update(BUF->sipaddr, &BUF->shwaddr); - - /* The reply opcode is 2. */ - BUF->opcode = HTONS(2); - - memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6); - memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6); - memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6); - memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6); - - BUF->dipaddr[0] = BUF->sipaddr[0]; - BUF->dipaddr[1] = BUF->sipaddr[1]; - BUF->sipaddr[0] = uip_hostaddr[0]; - BUF->sipaddr[1] = uip_hostaddr[1]; - - BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP); - uip_len = sizeof(struct arp_hdr); - } - break; - case HTONS(ARP_REPLY): - /* ARP reply. We insert or update the ARP table if it was meant - for us. */ - if(uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr)) { - uip_arp_update(BUF->sipaddr, &BUF->shwaddr); - } - break; - } - - return; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Prepend Ethernet header to an outbound IP packet and see if we need - * to send out an ARP request. - * - * This function should be called before sending out an IP packet. The - * function checks the destination IP address of the IP packet to see - * what Ethernet MAC address that should be used as a destination MAC - * address on the Ethernet. - * - * If the destination IP address is in the local network (determined - * by logical ANDing of netmask and our IP address), the function - * checks the ARP cache to see if an entry for the destination IP - * address is found. If so, an Ethernet header is prepended and the - * function returns. If no ARP cache entry is found for the - * destination IP address, the packet in the uip_buf[] is replaced by - * an ARP request packet for the IP address. The IP packet is dropped - * and it is assumed that they higher level protocols (e.g., TCP) - * eventually will retransmit the dropped packet. - * - * If the destination IP address is not on the local network, the IP - * address of the default router is used instead. - * - * When the function returns, a packet is present in the uip_buf[] - * buffer, and the length of the packet is in the global variable - * uip_len. - */ -/*-----------------------------------------------------------------------------------*/ -void -uip_arp_out(void) -{ - struct arp_entry *tabptr; - - /* Find the destination IP address in the ARP table and construct - the Ethernet header. If the destination IP addres isn't on the - local network, we use the default router's IP address instead. - - If not ARP table entry is found, we overwrite the original IP - packet with an ARP request for the IP address. */ - - /* First check if destination is a local broadcast. */ - if(uip_ipaddr_cmp(IPBUF->destipaddr, broadcast_ipaddr)) { - memcpy(IPBUF->ethhdr.dest.addr, broadcast_ethaddr.addr, 6); - } else { - /* Check if the destination address is on the local network. */ - if(!uip_ipaddr_maskcmp(IPBUF->destipaddr, uip_hostaddr, uip_netmask)) { - /* Destination address was not on the local network, so we need to - use the default router's IP address instead of the destination - address when determining the MAC address. */ - uip_ipaddr_copy(ipaddr, uip_draddr); - } else { - /* Else, we use the destination IP address. */ - uip_ipaddr_copy(ipaddr, IPBUF->destipaddr); - } - - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; - if(uip_ipaddr_cmp(ipaddr, tabptr->ipaddr)) { - break; - } - } - - if(i == UIP_ARPTAB_SIZE) { - /* The destination address was not in our ARP table, so we - overwrite the IP packet with an ARP request. */ - - memset(BUF->ethhdr.dest.addr, 0xff, 6); - memset(BUF->dhwaddr.addr, 0x00, 6); - memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6); - memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6); - - uip_ipaddr_copy(BUF->dipaddr, ipaddr); - uip_ipaddr_copy(BUF->sipaddr, uip_hostaddr); - BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */ - BUF->hwtype = HTONS(ARP_HWTYPE_ETH); - BUF->protocol = HTONS(UIP_ETHTYPE_IP); - BUF->hwlen = 6; - BUF->protolen = 4; - BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP); - - uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN]; - - uip_len = sizeof(struct arp_hdr); - return; - } - - /* Build an ethernet header. */ - memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6); - } - memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6); - - IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP); - - uip_len += sizeof(struct uip_eth_hdr); -} -/*-----------------------------------------------------------------------------------*/ - -/** @} */ -/** @} */ diff --git a/bundles/uip/uip/uip_arp.h b/bundles/uip/uip/uip_arp.h deleted file mode 100644 index e32594da..00000000 --- a/bundles/uip/uip/uip_arp.h +++ /dev/null @@ -1,144 +0,0 @@ -/** - * \addtogroup uip - * @{ - */ - -/** - * \addtogroup uiparp - * @{ - */ - -/** - * \file - * Macros and definitions for the ARP module. - * \author Adam Dunkels - */ - - -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: uip_arp.h,v 1.5 2006/06/11 21:46:39 adam Exp $ - * - */ - -#ifndef __UIP_ARP_H__ -#define __UIP_ARP_H__ - -#include "uip.h" - - -extern struct uip_eth_addr uip_ethaddr; - -/** - * The Ethernet header. - */ -struct uip_eth_hdr { - struct uip_eth_addr dest; - struct uip_eth_addr src; - u16_t type; -}; - -#define UIP_ETHTYPE_ARP 0x0806 -#define UIP_ETHTYPE_IP 0x0800 -#define UIP_ETHTYPE_IP6 0x86dd - - -/* The uip_arp_init() function must be called before any of the other - ARP functions. */ -void uip_arp_init(void); - -/* The uip_arp_ipin() function should be called whenever an IP packet - arrives from the Ethernet. This function refreshes the ARP table or - inserts a new mapping if none exists. The function assumes that an - IP packet with an Ethernet header is present in the uip_buf buffer - and that the length of the packet is in the uip_len variable. */ -/*void uip_arp_ipin(void);*/ -#define uip_arp_ipin() - -/* The uip_arp_arpin() should be called when an ARP packet is received - by the Ethernet driver. This function also assumes that the - Ethernet frame is present in the uip_buf buffer. When the - uip_arp_arpin() function returns, the contents of the uip_buf - buffer should be sent out on the Ethernet if the uip_len variable - is > 0. */ -void uip_arp_arpin(void); - -/* The uip_arp_out() function should be called when an IP packet - should be sent out on the Ethernet. This function creates an - Ethernet header before the IP header in the uip_buf buffer. The - Ethernet header will have the correct Ethernet MAC destination - address filled in if an ARP table entry for the destination IP - address (or the IP address of the default router) is present. If no - such table entry is found, the IP packet is overwritten with an ARP - request and we rely on TCP to retransmit the packet that was - overwritten. In any case, the uip_len variable holds the length of - the Ethernet frame that should be transmitted. */ -void uip_arp_out(void); - -/* The uip_arp_timer() function should be called every ten seconds. It - is responsible for flushing old entries in the ARP table. */ -void uip_arp_timer(void); - -/** @} */ - -/** - * \addtogroup uipconffunc - * @{ - */ - - -/** - * Specifiy the Ethernet MAC address. - * - * The ARP code needs to know the MAC address of the Ethernet card in - * order to be able to respond to ARP queries and to generate working - * Ethernet headers. - * - * \note This macro only specifies the Ethernet MAC address to the ARP - * code. It cannot be used to change the MAC address of the Ethernet - * card. - * - * \param eaddr A pointer to a struct uip_eth_addr containing the - * Ethernet MAC address of the Ethernet card. - * - * \hideinitializer - */ -#define uip_setethaddr(eaddr) do {uip_ethaddr.addr[0] = eaddr.addr[0]; \ - uip_ethaddr.addr[1] = eaddr.addr[1];\ - uip_ethaddr.addr[2] = eaddr.addr[2];\ - uip_ethaddr.addr[3] = eaddr.addr[3];\ - uip_ethaddr.addr[4] = eaddr.addr[4];\ - uip_ethaddr.addr[5] = eaddr.addr[5];} while(0) - -/** @} */ -/** @} */ - -#endif /* __UIP_ARP_H__ */ diff --git a/bundles/uip/uip/uiplib.c b/bundles/uip/uip/uiplib.c deleted file mode 100644 index cb5af2cd..00000000 --- a/bundles/uip/uip/uiplib.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels and the Swedish Institute of - * Computer Science. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack - * - * $Id: uiplib.c,v 1.2 2006/06/12 08:00:31 adam Exp $ - * - */ - - -#include "uip.h" -#include "uiplib.h" - - -/*-----------------------------------------------------------------------------------*/ -unsigned char -uiplib_ipaddrconv(char *addrstr, unsigned char *ipaddr) -{ - unsigned char tmp; - char c; - unsigned char i, j; - - tmp = 0; - - for(i = 0; i < 4; ++i) { - j = 0; - do { - c = *addrstr; - ++j; - if(j > 4) { - return 0; - } - if(c == '.' || c == 0) { - *ipaddr = tmp; - ++ipaddr; - tmp = 0; - } else if(c >= '0' && c <= '9') { - tmp = (tmp * 10) + (c - '0'); - } else { - return 0; - } - ++addrstr; - } while(c != '.' && c != 0); - } - return 1; -} - -/*-----------------------------------------------------------------------------------*/ diff --git a/bundles/uip/uip/uiplib.h b/bundles/uip/uip/uiplib.h deleted file mode 100644 index c676849e..00000000 --- a/bundles/uip/uip/uiplib.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * \file - * Various uIP library functions. - * \author - * Adam Dunkels - * - */ - -/* - * Copyright (c) 2002, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack - * - * $Id: uiplib.h,v 1.1 2006/06/07 09:15:19 adam Exp $ - * - */ -#ifndef __UIPLIB_H__ -#define __UIPLIB_H__ - -/** - * \addtogroup uipconvfunc - * @{ - */ - -/** - * Convert a textual representation of an IP address to a numerical representation. - * - * This function takes a textual representation of an IP address in - * the form a.b.c.d and converts it into a 4-byte array that can be - * used by other uIP functions. - * - * \param addrstr A pointer to a string containing the IP address in - * textual form. - * - * \param addr A pointer to a 4-byte array that will be filled in with - * the numerical representation of the address. - * - * \retval 0 If the IP address could not be parsed. - * \retval Non-zero If the IP address was parsed. - */ -unsigned char uiplib_ipaddrconv(char *addrstr, unsigned char *addr); - -/** @} */ - -#endif /* __UIPLIB_H__ */ diff --git a/bundles/uip/uip/uipopt.h b/bundles/uip/uip/uipopt.h deleted file mode 100644 index ae263652..00000000 --- a/bundles/uip/uip/uipopt.h +++ /dev/null @@ -1,541 +0,0 @@ -/** - * \defgroup uipopt Configuration options for uIP - * @{ - * - * uIP is configured using the per-project configuration file - * uipopt.h. This file contains all compile-time options for uIP and - * should be tweaked to match each specific project. The uIP - * distribution contains a documented example "uipopt.h" that can be - * copied and modified for each project. - * - * \note Most of the configuration options in the uipopt.h should not - * be changed, but rather the per-project uip-conf.h file. - */ - -/** - * \file - * Configuration options for uIP. - * \author Adam Dunkels - * - * This file is used for tweaking various configuration options for - * uIP. You should make a copy of this file into one of your project's - * directories instead of editing this example "uipopt.h" file that - * comes with the uIP distribution. - */ - -/* - * Copyright (c) 2001-2003, Adam Dunkels. - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: uipopt.h,v 1.4 2006/06/12 08:00:31 adam Exp $ - * - */ - -#ifndef __UIPOPT_H__ -#define __UIPOPT_H__ - -#ifndef UIP_LITTLE_ENDIAN -#define UIP_LITTLE_ENDIAN 3412 -#endif /* UIP_LITTLE_ENDIAN */ -#ifndef UIP_BIG_ENDIAN -#define UIP_BIG_ENDIAN 1234 -#endif /* UIP_BIG_ENDIAN */ - -#include "uip-conf.h" - -/*------------------------------------------------------------------------------*/ - -/** - * \name Static configuration options - * @{ - * - * These configuration options can be used for setting the IP address - * settings statically, but only if UIP_FIXEDADDR is set to 1. The - * configuration options for a specific node includes IP address, - * netmask and default router as well as the Ethernet address. The - * netmask, default router and Ethernet address are appliciable only - * if uIP should be run over Ethernet. - * - * All of these should be changed to suit your project. -*/ - -/** - * Determines if uIP should use a fixed IP address or not. - * - * If uIP should use a fixed IP address, the settings are set in the - * uipopt.h file. If not, the macros uip_sethostaddr(), - * uip_setdraddr() and uip_setnetmask() should be used instead. - * - * \hideinitializer - */ -#define UIP_FIXEDADDR 0 - -/** - * Ping IP address asignment. - * - * uIP uses a "ping" packets for setting its own IP address if this - * option is set. If so, uIP will start with an empty IP address and - * the destination IP address of the first incoming "ping" (ICMP echo) - * packet will be used for setting the hosts IP address. - * - * \note This works only if UIP_FIXEDADDR is 0. - * - * \hideinitializer - */ -#ifdef UIP_CONF_PINGADDRCONF -#define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF -#else /* UIP_CONF_PINGADDRCONF */ -#define UIP_PINGADDRCONF 0 -#endif /* UIP_CONF_PINGADDRCONF */ - - -/** - * Specifies if the uIP ARP module should be compiled with a fixed - * Ethernet MAC address or not. - * - * If this configuration option is 0, the macro uip_setethaddr() can - * be used to specify the Ethernet address at run-time. - * - * \hideinitializer - */ -#define UIP_FIXEDETHADDR 0 - -/** @} */ -/*------------------------------------------------------------------------------*/ -/** - * \name IP configuration options - * @{ - * - */ -/** - * The IP TTL (time to live) of IP packets sent by uIP. - * - * This should normally not be changed. - */ -#define UIP_TTL 64 - -/** - * Turn on support for IP packet reassembly. - * - * uIP supports reassembly of fragmented IP packets. This features - * requires an additonal amount of RAM to hold the reassembly buffer - * and the reassembly code size is approximately 700 bytes. The - * reassembly buffer is of the same size as the uip_buf buffer - * (configured by UIP_BUFSIZE). - * - * \note IP packet reassembly is not heavily tested. - * - * \hideinitializer - */ -#define UIP_REASSEMBLY 0 - -/** - * The maximum time an IP fragment should wait in the reassembly - * buffer before it is dropped. - * - */ -#define UIP_REASS_MAXAGE 40 - -/** @} */ - -/*------------------------------------------------------------------------------*/ -/** - * \name UDP configuration options - * @{ - */ - -/** - * Toggles wether UDP support should be compiled in or not. - * - * \hideinitializer - */ -#ifdef UIP_CONF_UDP -#define UIP_UDP UIP_CONF_UDP -#else /* UIP_CONF_UDP */ -#define UIP_UDP 0 -#endif /* UIP_CONF_UDP */ - -/** - * Toggles if UDP checksums should be used or not. - * - * \note Support for UDP checksums is currently not included in uIP, - * so this option has no function. - * - * \hideinitializer - */ -#ifdef UIP_CONF_UDP_CHECKSUMS -#define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS -#else -#define UIP_UDP_CHECKSUMS 0 -#endif - -/** - * The maximum amount of concurrent UDP connections. - * - * \hideinitializer - */ -#ifdef UIP_CONF_UDP_CONNS -#define UIP_UDP_CONNS UIP_CONF_UDP_CONNS -#else /* UIP_CONF_UDP_CONNS */ -#define UIP_UDP_CONNS 10 -#endif /* UIP_CONF_UDP_CONNS */ - -/** - * The name of the function that should be called when UDP datagrams arrive. - * - * \hideinitializer - */ - - -/** @} */ -/*------------------------------------------------------------------------------*/ -/** - * \name TCP configuration options - * @{ - */ - -/** - * Determines if support for opening connections from uIP should be - * compiled in. - * - * If the applications that are running on top of uIP for this project - * do not need to open outgoing TCP connections, this configration - * option can be turned off to reduce the code size of uIP. - * - * \hideinitializer - */ -#define UIP_ACTIVE_OPEN 1 - -/** - * The maximum number of simultaneously open TCP connections. - * - * Since the TCP connections are statically allocated, turning this - * configuration knob down results in less RAM used. Each TCP - * connection requires approximatly 30 bytes of memory. - * - * \hideinitializer - */ -#ifndef UIP_CONF_MAX_CONNECTIONS -#define UIP_CONNS 10 -#else /* UIP_CONF_MAX_CONNECTIONS */ -#define UIP_CONNS UIP_CONF_MAX_CONNECTIONS -#endif /* UIP_CONF_MAX_CONNECTIONS */ - - -/** - * The maximum number of simultaneously listening TCP ports. - * - * Each listening TCP port requires 2 bytes of memory. - * - * \hideinitializer - */ -#ifndef UIP_CONF_MAX_LISTENPORTS -#define UIP_LISTENPORTS 20 -#else /* UIP_CONF_MAX_LISTENPORTS */ -#define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS -#endif /* UIP_CONF_MAX_LISTENPORTS */ - -/** - * Determines if support for TCP urgent data notification should be - * compiled in. - * - * Urgent data (out-of-band data) is a rarely used TCP feature that - * very seldom would be required. - * - * \hideinitializer - */ -#define UIP_URGDATA 0 - -/** - * The initial retransmission timeout counted in timer pulses. - * - * This should not be changed. - */ -#define UIP_RTO 3 - -/** - * The maximum number of times a segment should be retransmitted - * before the connection should be aborted. - * - * This should not be changed. - */ -#define UIP_MAXRTX 8 - -/** - * The maximum number of times a SYN segment should be retransmitted - * before a connection request should be deemed to have been - * unsuccessful. - * - * This should not need to be changed. - */ -#define UIP_MAXSYNRTX 5 - -/** - * The TCP maximum segment size. - * - * This is should not be to set to more than - * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN. - */ -#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) - -/** - * The size of the advertised receiver's window. - * - * Should be set low (i.e., to the size of the uip_buf buffer) is the - * application is slow to process incoming data, or high (32768 bytes) - * if the application processes data quickly. - * - * \hideinitializer - */ -#ifndef UIP_CONF_RECEIVE_WINDOW -#define UIP_RECEIVE_WINDOW UIP_TCP_MSS -#else -#define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW -#endif - -/** - * How long a connection should stay in the TIME_WAIT state. - * - * This configiration option has no real implication, and it should be - * left untouched. - */ -#define UIP_TIME_WAIT_TIMEOUT 120 - - -/** @} */ -/*------------------------------------------------------------------------------*/ -/** - * \name ARP configuration options - * @{ - */ - -/** - * The size of the ARP table. - * - * This option should be set to a larger value if this uIP node will - * have many connections from the local network. - * - * \hideinitializer - */ -#ifdef UIP_CONF_ARPTAB_SIZE -#define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE -#else -#define UIP_ARPTAB_SIZE 8 -#endif - -/** - * The maxium age of ARP table entries measured in 10ths of seconds. - * - * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD - * default). - */ -#define UIP_ARP_MAXAGE 120 - -/** @} */ - -/*------------------------------------------------------------------------------*/ - -/** - * \name General configuration options - * @{ - */ - -/** - * The size of the uIP packet buffer. - * - * The uIP packet buffer should not be smaller than 60 bytes, and does - * not need to be larger than 1500 bytes. Lower size results in lower - * TCP throughput, larger size results in higher TCP throughput. - * - * \hideinitializer - */ -#ifndef UIP_CONF_BUFFER_SIZE -#define UIP_BUFSIZE 400 -#else /* UIP_CONF_BUFFER_SIZE */ -#define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE -#endif /* UIP_CONF_BUFFER_SIZE */ - - -/** - * Determines if statistics support should be compiled in. - * - * The statistics is useful for debugging and to show the user. - * - * \hideinitializer - */ -#ifndef UIP_CONF_STATISTICS -#define UIP_STATISTICS 0 -#else /* UIP_CONF_STATISTICS */ -#define UIP_STATISTICS UIP_CONF_STATISTICS -#endif /* UIP_CONF_STATISTICS */ - -/** - * Determines if logging of certain events should be compiled in. - * - * This is useful mostly for debugging. The function uip_log() - * must be implemented to suit the architecture of the project, if - * logging is turned on. - * - * \hideinitializer - */ -#ifndef UIP_CONF_LOGGING -#define UIP_LOGGING 0 -#else /* UIP_CONF_LOGGING */ -#define UIP_LOGGING UIP_CONF_LOGGING -#endif /* UIP_CONF_LOGGING */ - -/** - * Broadcast support. - * - * This flag configures IP broadcast support. This is useful only - * together with UDP. - * - * \hideinitializer - * - */ -#ifndef UIP_CONF_BROADCAST -#define UIP_BROADCAST 0 -#else /* UIP_CONF_BROADCAST */ -#define UIP_BROADCAST UIP_CONF_BROADCAST -#endif /* UIP_CONF_BROADCAST */ - -/** - * Print out a uIP log message. - * - * This function must be implemented by the module that uses uIP, and - * is called by uIP whenever a log message is generated. - */ -void uip_log(char *msg); - -/** - * The link level header length. - * - * This is the offset into the uip_buf where the IP header can be - * found. For Ethernet, this should be set to 14. For SLIP, this - * should be set to 0. - * - * \hideinitializer - */ -#ifdef UIP_CONF_LLH_LEN -#define UIP_LLH_LEN UIP_CONF_LLH_LEN -#else /* UIP_CONF_LLH_LEN */ -#define UIP_LLH_LEN 14 -#endif /* UIP_CONF_LLH_LEN */ - -/** @} */ -/*------------------------------------------------------------------------------*/ -/** - * \name CPU architecture configuration - * @{ - * - * The CPU architecture configuration is where the endianess of the - * CPU on which uIP is to be run is specified. Most CPUs today are - * little endian, and the most notable exception are the Motorolas - * which are big endian. The BYTE_ORDER macro should be changed to - * reflect the CPU architecture on which uIP is to be run. - */ - -/** - * The byte order of the CPU architecture on which uIP is to be run. - * - * This option can be either BIG_ENDIAN (Motorola byte order) or - * LITTLE_ENDIAN (Intel byte order). - * - * \hideinitializer - */ -#if 0 -#ifdef UIP_CONF_BYTE_ORDER -#define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER -#else /* UIP_CONF_BYTE_ORDER */ -#define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN -#endif /* UIP_CONF_BYTE_ORDER */ -#endif - -/** @} */ -/*------------------------------------------------------------------------------*/ - -/** - * \name Appication specific configurations - * @{ - * - * An uIP application is implemented using a single application - * function that is called by uIP whenever a TCP/IP event occurs. The - * name of this function must be registered with uIP at compile time - * using the UIP_APPCALL definition. - * - * uIP applications can store the application state within the - * uip_conn structure by specifying the type of the application - * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t. - * - * The file containing the definitions must be included in the - * uipopt.h file. - * - * The following example illustrates how this can look. - \code - -void httpd_appcall(void); -#define UIP_APPCALL httpd_appcall - -struct httpd_state { - u8_t state; - u16_t count; - char *dataptr; - char *script; -}; -typedef struct httpd_state uip_tcp_appstate_t - \endcode - */ - -/** - * \var #define UIP_APPCALL - * - * The name of the application function that uIP should call in - * response to TCP/IP events. - * - */ - -/** - * \var typedef uip_tcp_appstate_t - * - * The type of the application state that is to be stored in the - * uip_conn structure. This usually is typedef:ed to a struct holding - * application state information. - */ - -/** - * \var typedef uip_udp_appstate_t - * - * The type of the application state that is to be stored in the - * uip_conn structure. This usually is typedef:ed to a struct holding - * application state information. - */ -/** @} */ -/** @} */ - -#endif /* __UIPOPT_H__ */ diff --git a/bundles/uip/unix/Makefile b/bundles/uip/unix/Makefile deleted file mode 100644 index ed64927b..00000000 --- a/bundles/uip/unix/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2001, Adam Dunkels. -# 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. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. -# -# $Id: Makefile,v 1.13 2006/06/11 21:55:03 adam Exp $ -# - -all: uip - -CC = gcc -AR = ar -APPS = webserver -CFLAGS = -Wall -g -I../uip -I. -fpack-struct -Os --include ../uip/Makefile.include - -uip: $(addprefix $(OBJECTDIR)/, main.o tapdev.o clock-arch.o) apps.a uip.a - -clean: - rm -fr *.o *~ *core uip $(OBJECTDIR) *.a diff --git a/bundles/uip/unix/clock-arch.c b/bundles/uip/unix/clock-arch.c deleted file mode 100644 index d140aaf7..00000000 --- a/bundles/uip/unix/clock-arch.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * $Id: clock-arch.c,v 1.2 2006/06/12 08:00:31 adam Exp $ - */ - -/** - * \file - * Implementation of architecture-specific clock functionality - * \author - * Adam Dunkels - */ - -#include "clock-arch.h" -#include - -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - struct timeval tv; - struct timezone tz; - - gettimeofday(&tv, &tz); - - return tv.tv_sec * 1000 + tv.tv_usec / 1000; -} -/*---------------------------------------------------------------------------*/ diff --git a/bundles/uip/unix/clock-arch.h b/bundles/uip/unix/clock-arch.h deleted file mode 100644 index e51eee93..00000000 --- a/bundles/uip/unix/clock-arch.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * $Id: clock-arch.h,v 1.2 2006/06/12 08:00:31 adam Exp $ - */ - -#ifndef __CLOCK_ARCH_H__ -#define __CLOCK_ARCH_H__ - -typedef int clock_time_t; -#define CLOCK_CONF_SECOND 1000 - -#endif /* __CLOCK_ARCH_H__ */ diff --git a/bundles/uip/unix/main.c b/bundles/uip/unix/main.c deleted file mode 100644 index e4130e9d..00000000 --- a/bundles/uip/unix/main.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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 acknowledgement: - * This product includes software developed by Adam Dunkels. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: main.c,v 1.16 2006/06/11 21:55:03 adam Exp $ - * - */ - - -#include "uip.h" -#include "uip_arp.h" -#include "tapdev.h" - -#include "timer.h" - -#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - -#ifndef NULL -#define NULL (void *)0 -#endif /* NULL */ - -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - int i; - uip_ipaddr_t ipaddr; - struct timer periodic_timer, arp_timer; - - timer_set(&periodic_timer, CLOCK_SECOND / 2); - timer_set(&arp_timer, CLOCK_SECOND * 10); - - tapdev_init(); - uip_init(); - - uip_ipaddr(ipaddr, 192,168,0,2); - uip_sethostaddr(ipaddr); - uip_ipaddr(ipaddr, 192,168,0,1); - uip_setdraddr(ipaddr); - uip_ipaddr(ipaddr, 255,255,255,0); - uip_setnetmask(ipaddr); - - httpd_init(); - - /* telnetd_init();*/ - - /* hello_world_init();*/ - - /* { - u8_t mac[6] = {1,2,3,4,5,6}; - dhcpc_init(&mac, 6); - }*/ - - /*uip_ipaddr(ipaddr, 127,0,0,1); - smtp_configure("localhost", ipaddr); - SMTP_SEND("adam@sics.se", NULL, "uip-testing@example.com", - "Testing SMTP from uIP", - "Test message sent by uIP\r\n");*/ - - /* - webclient_init(); - resolv_init(); - uip_ipaddr(ipaddr, 195,54,122,204); - resolv_conf(ipaddr); - resolv_query("www.sics.se");*/ - - - - while(1) { - uip_len = tapdev_read(); - if(uip_len > 0) { - if(BUF->type == htons(UIP_ETHTYPE_IP)) { - uip_arp_ipin(); - uip_input(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - uip_arp_out(); - tapdev_send(); - } - } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - tapdev_send(); - } - } - - } else if(timer_expired(&periodic_timer)) { - timer_reset(&periodic_timer); - for(i = 0; i < UIP_CONNS; i++) { - uip_periodic(i); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - uip_arp_out(); - tapdev_send(); - } - } - -#if UIP_UDP - for(i = 0; i < UIP_UDP_CONNS; i++) { - uip_udp_periodic(i); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - uip_arp_out(); - tapdev_send(); - } - } -#endif /* UIP_UDP */ - - /* Call the ARP timer function every 10 seconds. */ - if(timer_expired(&arp_timer)) { - timer_reset(&arp_timer); - uip_arp_timer(); - } - } - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -uip_log(char *m) -{ - printf("uIP log message: %s\n", m); -} -void -resolv_found(char *name, u16_t *ipaddr) -{ - u16_t *ipaddr2; - - if(ipaddr == NULL) { - printf("Host '%s' not found.\n", name); - } else { - printf("Found name '%s' = %d.%d.%d.%d\n", name, - htons(ipaddr[0]) >> 8, - htons(ipaddr[0]) & 0xff, - htons(ipaddr[1]) >> 8, - htons(ipaddr[1]) & 0xff); - /* webclient_get("www.sics.se", 80, "/~adam/uip");*/ - } -} -#ifdef __DHCPC_H__ -void -dhcpc_configured(const struct dhcpc_state *s) -{ - uip_sethostaddr(s->ipaddr); - uip_setnetmask(s->netmask); - uip_setdraddr(s->default_router); - resolv_conf(s->dnsaddr); -} -#endif /* __DHCPC_H__ */ -void -smtp_done(unsigned char code) -{ - printf("SMTP done with code %d\n", code); -} -void -webclient_closed(void) -{ - printf("Webclient: connection closed\n"); -} -void -webclient_aborted(void) -{ - printf("Webclient: connection aborted\n"); -} -void -webclient_timedout(void) -{ - printf("Webclient: connection timed out\n"); -} -void -webclient_connected(void) -{ - printf("Webclient: connected, waiting for data...\n"); -} -void -webclient_datahandler(char *data, u16_t len) -{ - printf("Webclient: got %d bytes of data.\n", len); -} -/*---------------------------------------------------------------------------*/ diff --git a/bundles/uip/unix/tapdev.c b/bundles/uip/unix/tapdev.c deleted file mode 100644 index 417b2888..00000000 --- a/bundles/uip/unix/tapdev.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * Author: Adam Dunkels - * - * $Id: tapdev.c,v 1.8 2006/06/07 08:39:58 adam Exp $ - */ - -#define UIP_DRIPADDR0 192 -#define UIP_DRIPADDR1 168 -#define UIP_DRIPADDR2 0 -#define UIP_DRIPADDR3 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef linux -#include -#include -#include -#define DEVTAP "/dev/net/tun" -#else /* linux */ -#define DEVTAP "/dev/tap0" -#endif /* linux */ - -#include "uip.h" - -static int drop = 0; -static int fd; - - -/*---------------------------------------------------------------------------*/ -void -tapdev_init(void) -{ - char buf[1024]; - - fd = open(DEVTAP, O_RDWR); - if(fd == -1) { - perror("tapdev: tapdev_init: open"); - exit(1); - } - -#ifdef linux - { - struct ifreq ifr; - memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TAP|IFF_NO_PI; - if (ioctl(fd, TUNSETIFF, (void *) &ifr) < 0) { - perror(buf); - exit(1); - } - } -#endif /* Linux */ - - snprintf(buf, sizeof(buf), "ifconfig tap0 inet %d.%d.%d.%d", - UIP_DRIPADDR0, UIP_DRIPADDR1, UIP_DRIPADDR2, UIP_DRIPADDR3); - system(buf); - -} -/*---------------------------------------------------------------------------*/ -unsigned int -tapdev_read(void) -{ - fd_set fdset; - struct timeval tv, now; - int ret; - - tv.tv_sec = 0; - tv.tv_usec = 1000; - - - FD_ZERO(&fdset); - FD_SET(fd, &fdset); - - ret = select(fd + 1, &fdset, NULL, NULL, &tv); - if(ret == 0) { - return 0; - } - ret = read(fd, uip_buf, UIP_BUFSIZE); - if(ret == -1) { - perror("tap_dev: tapdev_read: read"); - } - - /* printf("--- tap_dev: tapdev_read: read %d bytes\n", ret);*/ - /* { - int i; - for(i = 0; i < 20; i++) { - printf("%x ", uip_buf[i]); - } - printf("\n"); - }*/ - /* check_checksum(uip_buf, ret);*/ - return ret; -} -/*---------------------------------------------------------------------------*/ -void -tapdev_send(void) -{ - int ret; - /* printf("tapdev_send: sending %d bytes\n", size);*/ - /* check_checksum(uip_buf, size);*/ - - /* drop++; - if(drop % 8 == 7) { - printf("Dropped a packet!\n"); - return; - }*/ - ret = write(fd, uip_buf, uip_len); - if(ret == -1) { - perror("tap_dev: tapdev_send: writev"); - exit(1); - } -} -/*---------------------------------------------------------------------------*/ diff --git a/bundles/uip/unix/tapdev.h b/bundles/uip/unix/tapdev.h deleted file mode 100644 index 280bc52b..00000000 --- a/bundles/uip/unix/tapdev.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * 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 acknowledgement: - * This product includes software developed by Adam Dunkels. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 file is part of the uIP TCP/IP stack. - * - * $Id: tapdev.h,v 1.1 2002/01/10 06:22:56 adam Exp $ - * - */ - -#ifndef __TAPDEV_H__ -#define __TAPDEV_H__ - -void tapdev_init(void); -unsigned int tapdev_read(void); -void tapdev_send(void); - -#endif /* __TAPDEV_H__ */ diff --git a/bundles/uip/unix/uip-conf.h b/bundles/uip/unix/uip-conf.h deleted file mode 100644 index 2878c85b..00000000 --- a/bundles/uip/unix/uip-conf.h +++ /dev/null @@ -1,157 +0,0 @@ -/** - * \addtogroup uipopt - * @{ - */ - -/** - * \name Project-specific configuration options - * @{ - * - * uIP has a number of configuration options that can be overridden - * for each project. These are kept in a project-specific uip-conf.h - * file and all configuration names have the prefix UIP_CONF. - */ - -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * 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. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. - * - * This file is part of the uIP TCP/IP stack - * - * $Id: uip-conf.h,v 1.6 2006/06/12 08:00:31 adam Exp $ - */ - -/** - * \file - * An example uIP configuration file - * \author - * Adam Dunkels - */ - -#ifndef __UIP_CONF_H__ -#define __UIP_CONF_H__ - -#include - -/** - * 8 bit datatype - * - * This typedef defines the 8-bit type used throughout uIP. - * - * \hideinitializer - */ -typedef uint8_t u8_t; - -/** - * 16 bit datatype - * - * This typedef defines the 16-bit type used throughout uIP. - * - * \hideinitializer - */ -typedef uint16_t u16_t; - -/** - * Statistics datatype - * - * This typedef defines the dataype used for keeping statistics in - * uIP. - * - * \hideinitializer - */ -typedef unsigned short uip_stats_t; - -/** - * Maximum number of TCP connections. - * - * \hideinitializer - */ -#define UIP_CONF_MAX_CONNECTIONS 40 - -/** - * Maximum number of listening TCP ports. - * - * \hideinitializer - */ -#define UIP_CONF_MAX_LISTENPORTS 40 - -/** - * uIP buffer size. - * - * \hideinitializer - */ -#define UIP_CONF_BUFFER_SIZE 420 - -/** - * CPU byte order. - * - * \hideinitializer - */ -#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN - -/** - * Logging on or off - * - * \hideinitializer - */ -#define UIP_CONF_LOGGING 1 - -/** - * UDP support on or off - * - * \hideinitializer - */ -#define UIP_CONF_UDP 0 - -/** - * UDP checksums on or off - * - * \hideinitializer - */ -#define UIP_CONF_UDP_CHECKSUMS 1 - -/** - * uIP statistics on or off - * - * \hideinitializer - */ -#define UIP_CONF_STATISTICS 1 - -/* Here we include the header file for the application(s) we use in - our project. */ -/*#include "smtp.h"*/ -/*#include "hello-world.h"*/ -/*#include "telnetd.h"*/ -#include "webserver.h" -/*#include "dhcpc.h"*/ -/*#include "resolv.h"*/ -/*#include "webclient.h"*/ - -#endif /* __UIP_CONF_H__ */ - -/** @} */ -/** @} */ diff --git a/link.bat b/link.bat deleted file mode 100644 index 3a04decb..00000000 --- a/link.bat +++ /dev/null @@ -1,27 +0,0 @@ -@echo off - -call:chklink n2n_v1 bundles\n2n_meyerd\n2n_v1 -call:chklink n2n_v2 bundles\n2n_ntop_v2 -call:chklink n2n_v2s bundles\n2n_meyerd\n2n_v2 -call:chklink n2n_v3 bundles\n2n_ntop_v3 -call:chklink uip bundles\uip\uip -call:chklink tun2tap bundles\tun2tap -call:chklink slog bundles\slog -pushd Hin2n\src\main\cpp -call:chklink n2n_v1 ..\..\..\..\bundles\n2n_meyerd\n2n_v1 -call:chklink n2n_v2 ..\..\..\..\bundles\n2n_ntop_v2 -call:chklink n2n_v2s ..\..\..\..\bundles\n2n_meyerd\n2n_v2 -call:chklink n2n_v3 ..\..\..\..\bundles\n2n_ntop_v3 -call:chklink uip ..\..\..\..\bundles\uip\uip -call:chklink tun2tap ..\..\..\..\bundles\tun2tap -call:chklink slog ..\..\..\..\bundles\slog -popd -goto:eof - -:chklink -if exist %~1 ( - pushd %~1 2>nul && popd || (del /q %~1 & mklink /d %~1 %~2) -) else ( - mklink /d %~1 %~2 -) -goto:eof \ No newline at end of file diff --git a/n2n_v1 b/n2n_v1 deleted file mode 120000 index 6182eef8..00000000 --- a/n2n_v1 +++ /dev/null @@ -1 +0,0 @@ -bundles/n2n_meyerd/n2n_v1 \ No newline at end of file diff --git a/n2n_v2 b/n2n_v2 deleted file mode 120000 index 15470553..00000000 --- a/n2n_v2 +++ /dev/null @@ -1 +0,0 @@ -bundles/n2n_ntop_v2 \ No newline at end of file diff --git a/n2n_v2s b/n2n_v2s deleted file mode 120000 index 88a13cc4..00000000 --- a/n2n_v2s +++ /dev/null @@ -1 +0,0 @@ -bundles/n2n_meyerd/n2n_v2 \ No newline at end of file diff --git a/n2n_v3 b/n2n_v3 deleted file mode 120000 index e38596b4..00000000 --- a/n2n_v3 +++ /dev/null @@ -1 +0,0 @@ -bundles/n2n_ntop_v3 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index c78d2b36..5cb401f6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,4 +13,3 @@ include ':FilePicker' include ':Boat' include ':PojavLauncher' include ':ZipTools' -include ':Hin2n' diff --git a/slog b/slog deleted file mode 120000 index 6bec3e9b..00000000 --- a/slog +++ /dev/null @@ -1 +0,0 @@ -bundles/slog \ No newline at end of file diff --git a/tun2tap b/tun2tap deleted file mode 120000 index 9a89de52..00000000 --- a/tun2tap +++ /dev/null @@ -1 +0,0 @@ -bundles/tun2tap \ No newline at end of file diff --git a/uip b/uip deleted file mode 120000 index fb57db9f..00000000 --- a/uip +++ /dev/null @@ -1 +0,0 @@ -bundles/uip/uip \ No newline at end of file
LocalRemoteStateRetransmissionsTimerFlags